Safe Haskell | None |
---|
Implementation of the Ganeti data collector types.
Synopsis
- data DCCategory
- getCategoryName :: DCCategory -> String
- categoryNames :: Map String DCCategory
- data DCStatusCode
- 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.
Instances
getCategoryName :: DCCategory -> String Source #
Get the category name and return it as a string.
categoryNames :: Map String DCCategory Source #
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 |
Instances
Eq DCStatusCode # | |
Defined in Ganeti.DataCollectors.Types (==) :: DCStatusCode -> DCStatusCode -> Bool (/=) :: DCStatusCode -> DCStatusCode -> Bool | |
Ord DCStatusCode # | |
Defined in Ganeti.DataCollectors.Types compare :: DCStatusCode -> DCStatusCode -> Ordering (<) :: DCStatusCode -> DCStatusCode -> Bool (<=) :: DCStatusCode -> DCStatusCode -> Bool (>) :: DCStatusCode -> DCStatusCode -> Bool (>=) :: DCStatusCode -> DCStatusCode -> Bool max :: DCStatusCode -> DCStatusCode -> DCStatusCode min :: DCStatusCode -> DCStatusCode -> DCStatusCode | |
Show DCStatusCode # | |
Defined in Ganeti.DataCollectors.Types showsPrec :: Int -> DCStatusCode -> ShowS show :: DCStatusCode -> String showList :: [DCStatusCode] -> ShowS | |
JSON DCStatusCode # | The JSON instance for CollectorStatus. |
Defined in Ganeti.DataCollectors.Types readJSON :: JSValue -> Result DCStatusCode showJSON :: DCStatusCode -> JSValue readJSONs :: JSValue -> Result [DCStatusCode] showJSONs :: [DCStatusCode] -> JSValue |
The status of a "status reporting data collector".
DCStatus | |
|
Instances
Eq DCStatus # | |
Show DCStatus # | |
JSON DCStatus # | |
ArrayObject DCStatus # | |
Defined in Ganeti.DataCollectors.Types | |
DictObject DCStatus # | |
loadDCStatus :: JSValue -> Result DCStatus Source #
saveDCStatus :: DCStatus -> JSValue Source #
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))) |
Instances
NFData CollectorData # | |
Defined in Ganeti.DataCollectors.Types rnf :: CollectorData -> () |
type CollectorMap = Map String CollectorData Source #
Type for the map storing the data of the statefull DataCollectors.
This is the format of the report produced by each data collector.
DCReport | |
|
Instances
Eq DCReport # | |
Show DCReport # | |
JSON DCReport # | |
ArrayObject DCReport # | |
Defined in Ganeti.DataCollectors.Types | |
DictObject DCReport # | |
loadDCReport :: JSValue -> Result DCReport Source #
saveDCReport :: DCReport -> JSValue Source #
addStatus :: DCStatus -> JSValue -> JSValue Source #
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 DCReport Source #
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 | |
|