packages feed

nagios-check 0.2.0 → 0.2.1

raw patch · 4 files changed

+48/−19 lines, 4 filesdep ~basedep ~nagios-perfdataPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, nagios-perfdata

API changes (from Hackage documentation)

Files

+ CHANGELOG.md view
@@ -0,0 +1,11 @@+# Changelog++## v0.2.1++ - Support for GHC 7.4 (Justin S. Leitgeib, @jsl).+ - Fix bug in perfdata ordering (correct order is warn, crit, min, max;+   not min, max, warn, crit).++## v0.2.0++ - add addBarePerfdatum convenience function
README.md view
@@ -1,4 +1,21 @@-nagios-check-============+[![Build Status](https://travis-ci.org/fractalcat/haskell-nagios-check.svg?branch=master)](https://travis-ci.org/fractalcat/haskell-nagios-check) +# nagios-check+ Write Nagios (or Icinga, Shinken, et cetera) plugins in Haskell.++## Example usage++```haskell+{-# LANGUAGE OverloadedStrings #-}++import System.Nagios.Plugin++universeCheck :: Double -> NagiosPlugin ()+universeCheck pi' = do+    addResult OK "universe passes basic consistency tests"+    if (pi' < (3.0 :: Double)) then addResult Critical "universe broken, π < 3" else return ()++main :: IO ()+main = runNagiosPlugin (universeCheck 3.1415)+```
lib/System/Nagios/Plugin/Check.hs view
@@ -23,7 +23,7 @@ ) where  import           Control.Applicative-import           Control.Monad.Catch+import qualified Control.Monad.Catch as E import           Control.Monad.State.Lazy import           Data.Bifunctor import           Data.Int@@ -35,7 +35,7 @@ import           System.Exit  -- | Nagios plugin exit statuses. Ordered by priority ----   OK < Warning < Critical < Unknown, which correspond to plugin exit+--   'OK' < 'Warning' < 'Critical' < 'Unknown', which correspond to plugin exit --   statuses of 0, 1, 2, and 3 respectively. data CheckStatus = OK       -- ^ Check executed successfully and                             --   detected no service problems.@@ -65,7 +65,7 @@   { unCheckResult :: (CheckStatus, Text) }     deriving (Eq, Ord, Show) --- | Extract the return status from a 'CheckResult'+-- | Extract the return status from a 'CheckResult'. checkStatus :: CheckResult -> CheckStatus checkStatus = fst . unCheckResult @@ -75,7 +75,7 @@  -- | Value of a performance metric. data PerfValue = RealValue Double | IntegralValue Int64-  deriving Eq+  deriving (Eq, Ord)  instance Show PerfValue where     show (RealValue x) = show x@@ -106,16 +106,16 @@ newtype NagiosPlugin a = NagiosPlugin   {     unNagiosPlugin :: StateT CheckState IO a-  } deriving (Functor, Applicative, Monad, MonadIO, MonadState CheckState, MonadCatch, MonadThrow)+  } deriving (Functor, Applicative, Monad, MonadIO, MonadState CheckState, E.MonadCatch, E.MonadThrow)  -- | Execute a Nagios check. The program will terminate at the check's --   completion. A default status will provided if none is given. runNagiosPlugin :: NagiosPlugin a -> IO () runNagiosPlugin check = do-    (_, st) <- runNagiosPlugin' $ catch check panic+    (_, st) <- runNagiosPlugin' $ E.catch check panic     finishWith st   where-    panic :: SomeException -> NagiosPlugin a+    panic :: E.SomeException -> NagiosPlugin a     panic = liftIO . finishWith . panicState  -- | Execute a Nagios check as with 'runNagiosPlugin', but return its@@ -165,7 +165,7 @@  -- | The state the plugin will exit with if an uncaught exception occurs. --   within the plugin.-panicState :: SomeException -> CheckState+panicState :: E.SomeException -> CheckState panicState = (,[]) . return . CheckResult . panicResult   where     panicResult e = (Critical,@@ -188,10 +188,10 @@         , "="         , T.pack (show _value)         , T.pack (show _uom)-        , fmtThreshold _min-        , fmtThreshold _max         , fmtThreshold _warn         , fmtThreshold _crit+        , fmtThreshold _min+        , fmtThreshold _max         ]      fmtThreshold Nothing = ";"
nagios-check.cabal view
@@ -1,10 +1,10 @@ name:                nagios-check-version:             0.2.0+version:             0.2.1 synopsis:            Package for writing monitoring plugins description:         Implements Nagios plugin development guidelines                      within a Haskell framework for writing Nagios                      checks.-homepage:            https://github.com/fractalcat/nagios-check+homepage:            https://github.com/fractalcat/haskell-nagios-check license:             MIT license-file:        LICENSE author:              Sharif Olorin@@ -12,12 +12,13 @@ copyright:           2014 Sharif Olorin category:            System build-type:          Simple-extra-source-files:  README.md+extra-source-files:  README.md,+                     CHANGELOG.md cabal-version:       >=1.10  source-repository    head-  type:              git -  location:          git@github.com:fractalcat/nagios-check.git+  type:              git+  location:          git@github.com:fractalcat/haskell-nagios-check.git  library   exposed-modules:     System.Nagios.Plugin@@ -28,7 +29,7 @@                        text,                        bifunctors,                        exceptions,-                       nagios-perfdata+                       nagios-perfdata >= 0.2.2   hs-source-dirs:      lib   default-language:    Haskell2010   ghc-options:         -Wall@@ -40,7 +41,7 @@   main-is:           NagiosCheckTest.hs   type:              exitcode-stdio-1.0   default-language:    Haskell2010-  build-depends:       base >=4.7 && <5,+  build-depends:       base >=4.5 && <5,                        hspec,                        QuickCheck,                        text,