Revision 75706f3a src/Ganeti/DataCollectors/Drbd.hs
b/src/Ganeti/DataCollectors/Drbd.hs | ||
---|---|---|
32 | 32 |
, dcFormatVersion |
33 | 33 |
, dcCategory |
34 | 34 |
, dcKind |
35 |
, dcData
|
|
35 |
, dcReport
|
|
36 | 36 |
) where |
37 | 37 |
|
38 | 38 |
|
... | ... | |
90 | 90 |
dcKind = DCKStatus |
91 | 91 |
|
92 | 92 |
-- | The data exported by the data collector, taken from the default location. |
93 |
dcData :: IO J.JSValue
|
|
94 |
dcData = buildJsonReport defaultFile Nothing
|
|
93 |
dcReport :: IO DCReport
|
|
94 |
dcReport = buildDCReport defaultFile Nothing
|
|
95 | 95 |
|
96 | 96 |
-- * Command line options |
97 | 97 |
|
... | ... | |
205 | 205 |
let status = computeStatus drbdData |
206 | 206 |
return . addStatus status $ J.showJSON drbdData |
207 | 207 |
|
208 |
-- | This function computes the DCReport for the DRBD status. |
|
209 |
buildDCReport :: FilePath -> Maybe FilePath -> IO DCReport |
|
210 |
buildDCReport statusFile pairingFile = |
|
211 |
buildJsonReport statusFile pairingFile >>= |
|
212 |
buildReport dcName dcVersion dcFormatVersion dcCategory dcKind |
|
213 |
|
|
208 | 214 |
-- | Main function. |
209 | 215 |
main :: Options -> [String] -> IO () |
210 | 216 |
main opts args = do |
... | ... | |
212 | 218 |
pairingFile = optDrbdPairing opts |
213 | 219 |
unless (null args) . exitErr $ "This program takes exactly zero" ++ |
214 | 220 |
" arguments, got '" ++ unwords args ++ "'" |
215 |
report <- buildJsonReport statusFile pairingFile >>= |
|
216 |
buildReport dcName dcVersion dcFormatVersion dcCategory dcKind |
|
221 |
report <- buildDCReport statusFile pairingFile |
|
217 | 222 |
putStrLn $ J.encode report |
Also available in: Unified diff