]> git.pld-linux.org Git - packages/nagios-plugin-check_elvis_status.git/commitdiff
up to 0.2, use tarball distribution auto/th/nagios-plugin-check_elvis_status-0.2-1
authorElan Ruusamäe <glen@delfi.ee>
Tue, 20 May 2014 08:42:07 +0000 (11:42 +0300)
committerElan Ruusamäe <glen@delfi.ee>
Tue, 20 May 2014 08:42:07 +0000 (11:42 +0300)
README.md [deleted file]
check_elvis_status.cfg [deleted file]
check_elvis_status.php [deleted file]
nagios-plugin-check_elvis_status.spec

diff --git a/README.md b/README.md
deleted file mode 100644 (file)
index 72e246b..0000000
--- a/README.md
+++ /dev/null
@@ -1,53 +0,0 @@
-Nagios plugin: check_elvis_status
-=================================
-
-Check [Elvis DAM](http://www.elvisdam.com/) status via admin /server-status json data.
-
-This plugins allows you monitor number and boolean values from server-status json (specified with `-u` option).
-Numbers may be expressed with size qualifiers (TB, GB, MB).
-
-It expression is taken via `-e` option, the warning and critical tresholds are configurable with `-w` and `-c` 
-options respectively. Additionally `-i` option allows you inverse the comparision logic.
-
-Requires: php 5.2, [php-json](http://php.net/json) (if using php < 5.2, use [json pecl](http://pecl.php.net/package/json))
-
-Examples
-========
-  
-Check for API Operations count:
-
-    ./check_elvis_status -u elvis.json -e '->securityStatus->apiOperationsToday' -m 'API ops' -w 3000 -c 5000
-    ELVIS_STATUS: CRITICAL: API ops: 5329
-     
-    ./check_elvis_status -u elvis.json -e '->securityStatus->apiOperationsToday' -m 'API ops' -w 5000 -c 15000
-    ELVIS_STATUS: WARNING: API ops: 5329
-
-    ./check_elvis_status -u elvis.json -e '->securityStatus->apiOperationsToday' -m 'API ops' -w 6000 -c 15000
-    ELVIS_STATUS: OK: API ops: 5329
-
-
-Check processing queue monitoring if >300 warning, if >500 critical
-
-     ./check_elvis_status.php -u elvis.json -e '->mediaStatus->waitingProcessingRequests' -m 'waitingProcessingRequests' -w 300 -c 500
-    ELVIS_STATUS: OK: waitingProcessingRequests: 0
-
-Check if proccessing servers are seen by Elvis:
-
-    ./check_elvis_status.php -u elvis.json -e '->mediaStatus->operationalNodes' -m operationalNodes -v -i -c 3 
-    EVAL: return $json->mediaStatus->operationalNodes;
-    ELVIS_STATUS: OK: operationalNodes: 3
-
-Check if Processing Servers are Connected & status ready.  
-This one converts boolean value to integer to be able to make comparision :)
-
-    ./check_elvis_status.php -u elvis.json -e '->mediaStatus->mediaNodesStatus[0]->ready+0' -m 'ready' -c 1 -i
-    ELVIS_STATUS: OK: ready: 1
-    ./check_elvis_status.php -u elvis.json -e '->mediaStatus->mediaNodesStatus[0]->ready+0' -m 'ready' -c 1 -i
-    ELVIS_STATUS: CRITICAL: ready: 0
-    
-If you want the same check to give WARNING instead of CRITICAL, setup warning option instead:
-
-    ./check_elvis_status.php -u elvis.json -e '->mediaStatus->mediaNodesStatus[0]->ready+0' -m 'ready' -w 1 -i
-    ELVIS_STATUS: OK: ready: 1
-    ./check_elvis_status.php -u elvis.json -e '->mediaStatus->mediaNodesStatus[0]->ready+0' -m 'ready' -w 1 -i
-    ELVIS_STATUS: WARNING: ready: 0
diff --git a/check_elvis_status.cfg b/check_elvis_status.cfg
deleted file mode 100644 (file)
index 344bd19..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# Usage:
-# check_elvis_status
-define command {
-       command_name    check_elvis_status
-       command_line    /usr/lib/nagios/plugins/check_elvis_status $ARG1$
-}
-
-define service {
-       use                     generic-service
-       name                    elvis_status
-       service_description     elvis_status
-       register                0
-
-       normal_check_interval   5
-       retry_check_interval    1
-
-       notification_interval   10
-
-       check_command           check_elvis_status
-}
diff --git a/check_elvis_status.php b/check_elvis_status.php
deleted file mode 100755 (executable)
index b842238..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-#!/usr/bin/php
-<?php
-/* vim: set encoding=utf-8: */
-/*
- * Nagios plugin to check Elvis DAM server-status json
- * Copyright (C) 2013 Elan Ruusamäe <glen@delfi.ee>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-define('PROGNAME', basename(array_shift($argv), '.php'));
-define('LABEL', strtoupper(str_replace('check_', '', PROGNAME)));
-
-// loads from same dir as program
-require_once 'utils.php';
-
-function usage() {
-       global $default_opt;
-       $opt = $default_opt;
-    echo "Usage: ", PROGNAME, " [OPTION]...
-
-Check Elvis DAM server-status data
-Example: ", PROGNAME ,"
-
-Plugin action specific options:
-  -u    URL to Elvis DAM /server-status. Sample: http://USERNAME:PASSWORD@HOSTNAME/dam/controller/admin/server-status
-  -m    Message what you are querying
-  -e    Expression what to retrieve from json data. this must be valid PHP Expression
-  -i    Invert expression, critical and warning must be below the tresholds
-  -w    The warning range. default '{$opt['w']}'
-  -c    The critical range. default '{$opt['c']}'
-  -v    Enable verbose mode.
-";
-       exit(STATE_UNKNOWN);
-}
-
-/*
- * based on code from:
- * http://stackoverflow.com/questions/11807115/php-convert-kb-mb-gb-tb-etc-to-bytes
- */
-function byteConvert($input) {
-       if (!preg_match('/^(?P<number>[\d.,]+)\s*(?P<type>\w+B)$/i', $input, $m)) {
-               return $input;
-       }
-
-       // comma is decimal separator. replace it to computer language
-       $number = str_replace(',', '.', $m['number']);
-
-       switch (strtoupper($m['type'])) {
-       case "B":
-               $output = $number;
-               break;
-       case "KB":
-               $output = $number*1024;
-               break;
-       case "MB":
-               $output = $number*1024*1024;
-               break;
-       case "GB":
-               $output = $number*1024*1024*1024;
-               break;
-       case "TB":
-               $output = $number*1024*1024*1024;
-               break;
-       }
-       return $output;
-}
-
-$default_opt = array(
-       'u' => '',
-       'm' => '',
-       'e' => null,
-       'v' => null,
-       'w' => 0,
-       'c' => 0,
-);
-$opt = array_merge($default_opt, getopt("u:e:m:w:c:vi"));
-$invert = isset($opt['i']);
-$verbose = isset($opt['v']);
-$critical = byteConvert($opt['c']);
-$warning = byteConvert($opt['w']);
-
-if (empty($opt['u']) || !isset($opt['e'])) {
-       usage();
-}
-
-$data = file_get_contents($opt['u']);
-if ($data === false) {
-       echo "ERROR: Can't fetch '{$opt['u']}'\n";
-       exit(STATE_CRITICAL);
-}
-
-$json = json_decode($data);
-if ($json === null) {
-       echo "ERROR: Can't parse json\n";
-       exit(STATE_CRITICAL);
-}
-
-$eval = 'return $json' . $opt['e'] .';';
-if ($verbose) {
-       echo "EVAL: $eval\n";
-}
-$res = eval($eval);
-
-if ($res === null) {
-       echo LABEL, ": ERROR: {$opt['m']}: Unexpected null\n";
-       exit(STATE_UNKNOWN);
-} elseif ($res === false) {
-       echo LABEL, ": ERROR: {$opt['m']}: parse error: {$opt['e']}\n";
-       exit(STATE_UNKNOWN);
-}
-
-$value = byteConvert($res);
-if ($verbose) {
-       echo "RES: $res; VALUE: $value; WARNING: $warning; CRITICAL: $critical\n";
-}
-
-if ((!$invert && $value > $critical) || ($invert && $value < $critical))  {
-       echo LABEL, ": CRITICAL: {$opt['m']}: $res\n";
-       exit(STATE_CRITICAL);
-} elseif ((!$invert && $value > $warning) || ($invert && $value < $warning)) {
-       echo LABEL, ": WARNING: {$opt['m']}: $res\n";
-       exit(STATE_WARNING);
-} else {
-       echo LABEL, ": OK: {$opt['m']}: $res\n";
-       exit(STATE_OK);
-}
index 2f29471ca86310286a14ee51a340d84f3da30ac4..a15558bb65b470c4187c885e87a967668f9924e3 100644 (file)
@@ -3,12 +3,12 @@
 %include       /usr/lib/rpm/macros.php
 Summary:       Nagios plugin to check Elvis DAM status
 Name:          nagios-plugin-%{plugin}
-Version:       0.1
-Release:       2
+Version:       0.2
+Release:       1
 License:       GPL v2
 Group:         Networking
-Source0:       %{plugin}.php
-Source1:       %{plugin}.cfg
+Source0:       https://github.com/glensc/nagios-plugin-check_elvis_status/archive/v%{version}/%{plugin}-%{version}.tar.gz
+# Source0-md5: a0ecef927a2fc9c7c3982c626757586f
 URL:           https://github.com/glensc/nagios-plugin-check_elvis_status
 Requires:      nagios-common
 Requires:      nagios-plugins-libs
@@ -17,9 +17,6 @@ Requires:     php(json)
 BuildArch:     noarch
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
-# for perl plugins:
-%define                _noautoreq      perl(utils)
-
 %define                _sysconfdir     /etc/nagios/plugins
 %define                plugindir       %{_prefix}/lib/nagios/plugins
 
@@ -28,14 +25,12 @@ Nagios plugin to check Elvis DAM status via admin /server-status json
 data.
 
 %prep
-%setup -qcT
-cp -p %{SOURCE0} %{plugin}
-cp -p %{SOURCE1} .
+%setup -q
 
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{plugindir}}
-install -p %{plugin} $RPM_BUILD_ROOT%{plugindir}/%{plugin}
+install -p %{plugin}.php $RPM_BUILD_ROOT%{plugindir}/%{plugin}
 cp -p %{plugin}.cfg $RPM_BUILD_ROOT%{_sysconfdir}/%{plugin}.cfg
 
 %clean
This page took 0.081744 seconds and 4 git commands to generate.