habbix-0.1.0.0: Multi-Axis library/executable and misc. zabbix tools

Copyright(C) 2014 Samuli Thomasson
LicenseMIT (see the file LICENSE)
MaintainerSamuli Thomasson <samuli.thomasson@paivola.fi>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Query

Contents

Description

Queries built with persistent esqueleto against or db (see models in Models).

Synopsis

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

type DPS = Source DB (Epoch, Rational)

selectHistory :: ItemId -> DPS

Get all history for given item.

selectHistory'

Arguments

:: ItemId 
-> Epoch

Current time (for relative From)

-> Maybe Epoch

From

-> Maybe Epoch

To

-> DPS 

Get all history for given item, vtype == 0 or 3.

Future

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.

General utility

withMaybe :: Monad m => Maybe a -> (a -> m ()) -> m ()