Copyright | (C) 2014 Samuli Thomasson |
---|---|
License | MIT (see the file LICENSE) |
Maintainer | Samuli Thomasson <samuli.thomasson@paivola.fi> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Query
Description
Queries built with persistent esqueleto against or db (see models in Models).
- selectHosts :: DB [(Entity Group, Entity Host)]
- selectHostApplications :: HostId -> DB [Entity Application]
- selectAppItems :: ApplicationId -> DB [Entity Item]
- type DPS = Source DB (Epoch, Rational)
- selectHistory :: ItemId -> DPS
- selectHistory' :: ItemId -> Epoch -> Maybe Epoch -> Maybe Epoch -> DPS
- selectHistoryLast :: ItemId -> DB (Maybe (Epoch, Rational))
- selectHistoryMax :: ItemId -> DB (Maybe Rational)
- selectZabTrendItem :: ItemId -> DB (Entity Host, Entity Item, [Trend])
- newItemFuture :: ItemId -> FutureModelId -> Bool -> Habbix ItemFutureId
- populateZabbixParts :: Habbix ()
- populateDefaultFutures :: Habbix ()
- populateAll :: Habbix ()
- withMaybe :: Monad m => Maybe a -> (a -> m ()) -> m ()
- getCurrentEpoch :: IO Epoch
Host and app info
selectHosts :: DB [(Entity Group, Entity Host)]
Select all hosts along with their groups that do not belong to the Templates (groupid == 1).
selectHostApplications :: HostId -> DB [Entity Application]
All apps for the host (cpu, memory, network, fs, ...).
selectAppItems :: ApplicationId -> DB [Entity Item]
All items for an application. For example, querying for CPU gives items for 1 min avg load, 5 min avg load 15 min avg load, idle time, etc.
Discards items that do not show up in the history table.
History and trends
selectHistory :: ItemId -> DPS
Get all history for given item.
Get all history for given item, vtype == 0 or 3.
selectHistoryMax :: ItemId -> DB (Maybe Rational)
Future
newItemFuture :: ItemId -> FutureModelId -> Bool -> Habbix ItemFutureId
Populate from remote
populateZabbixParts :: Habbix ()
Fetch zabbix data (from remote to local) for all zabbix-tables except history and trends
populateDefaultFutures :: Habbix ()
Adds default item_futures to those items that do not have any.
Items to add must satisfy: - key_ must be in metric table - hostid must not be in the Templates host group (groupid = 1) - the itemid must not be present in any row of item_future
populateAll :: Habbix ()
Fetch zabbix history data (from remote to local) for all items present in the item_future table.