Safe Haskell | None |
---|
Implementation of the Ganeti data collector types.
- data DCCategory
- = DCInstance
- | DCStorage
- | DCDaemon
- | DCHypervisor
- getCategoryName :: DCCategory -> String
- categoryNames :: Map String DCCategory
- data DCStatusCode
- = DCSCOk
- | DCSCTempBad
- | DCSCUnknown
- | DCSCBad
- data DCStatus = DCStatus {
- dcStatusCode :: DCStatusCode
- dcStatusMessage :: String
- loadDCStatus :: JSValue -> Result DCStatus
- saveDCStatus :: DCStatus -> JSValue
- data DCKind
- data DCVersion
- = DCVerBuiltin
- | DCVersion String
- data CollectorData
- = CPULoadData (Seq (ClockTime, [Int]))
- | InstanceCpuLoad (Map String (Seq (ClockTime, Double)))
- type CollectorMap = Map String CollectorData
- data DCReport = DCReport {
- dcReportName :: String
- dcReportVersion :: DCVersion
- dcReportFormatVersion :: Int
- dcReportTimestamp :: Integer
- dcReportCategory :: Maybe DCCategory
- dcReportKind :: DCKind
- dcReportData :: JSValue
- loadDCReport :: JSValue -> Result DCReport
- saveDCReport :: DCReport -> JSValue
- addStatus :: DCStatus -> JSValue -> JSValue
- mergeStatuses :: (DCStatusCode, String) -> (DCStatusCode, [String]) -> (DCStatusCode, [String])
- buildReport :: String -> DCVersion -> Int -> Maybe DCCategory -> DCKind -> JSValue -> IO DCReport
- data ReportBuilder
- = StatelessR (IO DCReport)
- | StatefulR (Maybe CollectorData -> IO DCReport)
- type Name = String
- data DataCollector = DataCollector {
- dName :: Name
- dCategory :: Maybe DCCategory
- dKind :: DCKind
- dReport :: ReportBuilder
- dUpdate :: Maybe (Maybe CollectorData -> IO CollectorData)
- dActive :: Name -> ConfigData -> Bool
- dInterval :: Name -> ConfigData -> Integer
Documentation
data DCCategory Source
The possible classes a data collector can belong to.
Bounded DCCategory | |
Enum DCCategory | |
Eq DCCategory | |
Read DCCategory | |
Show DCCategory | |
JSON DCCategory | The JSON instance for DCCategory. |
getCategoryName :: DCCategory -> StringSource
Get the category name and return it as a string.
categoryNames :: Map String DCCategorySource
data DCStatusCode Source
The possible status codes of a data collector.
DCSCOk | Everything is OK |
DCSCTempBad | Bad, but being automatically fixed |
DCSCUnknown | Unable to determine the status |
DCSCBad | Bad. External intervention required |
Eq DCStatusCode | |
Ord DCStatusCode | |
Show DCStatusCode | |
JSON DCStatusCode | The JSON instance for CollectorStatus. |
The status of a "status reporting data collector".
DCStatus | |
|
Eq DCStatus | |
Show DCStatus | |
JSON DCStatus | |
ArrayObject DCStatus | |
DictObject DCStatus |
loadDCStatus :: JSValue -> Result DCStatusSource
saveDCStatus :: DCStatus -> JSValueSource
The type representing the kind of the collector.
Type representing the version number of a data collector.
DCVerBuiltin | |
DCVersion String |
data CollectorData Source
Type for the value field of the CollectorMap
below.
CPULoadData (Seq (ClockTime, [Int])) | |
InstanceCpuLoad (Map String (Seq (ClockTime, Double))) |
NFData CollectorData |
type CollectorMap = Map String CollectorDataSource
Type for the map storing the data of the statefull DataCollectors.
This is the format of the report produced by each data collector.
DCReport | |
|
Eq DCReport | |
Show DCReport | |
JSON DCReport | |
ArrayObject DCReport | |
DictObject DCReport |
loadDCReport :: JSValue -> Result DCReportSource
saveDCReport :: DCReport -> JSValueSource
addStatus :: DCStatus -> JSValue -> JSValueSource
Add the data collector status information to the JSON representation of the collector data.
mergeStatuses :: (DCStatusCode, String) -> (DCStatusCode, [String]) -> (DCStatusCode, [String])Source
Helper function for merging statuses.
buildReport :: String -> DCVersion -> Int -> Maybe DCCategory -> DCKind -> JSValue -> IO DCReportSource
Utility function for building a report automatically adding the current timestamp (rounded up to seconds). If the version is not specified, it will be set to the value indicating a builtin collector.
data ReportBuilder Source
A report of a data collector might be stateful or stateless.
StatelessR (IO DCReport) | |
StatefulR (Maybe CollectorData -> IO DCReport) |
data DataCollector Source
Type describing a data collector basic information
DataCollector | |
|