diff --git a/.gitignore b/.gitignore index d2d6f36..b082e3e 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,11 @@ nosetests.xml .mr.developer.cfg .project .pydevproject + +# VIM +.*.swp +.*.swo + +# packages +*.rpm +*.deb diff --git a/LICENSE b/LICENSE index 1a74422..038e485 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2013, Věroš Kaplan +Copyright (c) 2013, Veros Kaplan All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -11,7 +11,7 @@ are permitted provided that the following conditions are met: list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the {organization} nor the names of its + Neither the name of the organization nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/README.md b/README.md index e91b97d..8cbe012 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,12 @@ nagios-snmp-tortilla ==================== -Nagios SNMP plugin for dummies +Nagios/Icinga SNMP plugin for dummies (and/or lazy administrators). + +This script contains prepackaged definitions of miscellaneous +hardware/software which can be modified by Nagios. + +Just use: +$ check_snmp_tortilla -c config_file.ini -C community -H host_address + +Feel free to send updates. diff --git a/ini/apc-pdu-environment.ini b/ini/apc-pdu-environment.ini new file mode 100644 index 0000000..ff49f30 --- /dev/null +++ b/ini/apc-pdu-environment.ini @@ -0,0 +1,17 @@ +# APC PDU with SNMP - http://goo.gl/KkiEg2 +# +# temperature, humidity +# +[value:temperature] +oid = .1.3.6.1.4.1.318.1.1.26.10.2.2.1.8.1 +units = C +func = lambda x: float(x)/10 +warning = temperature > 21 +critical = temperature > 25 +name = Teplota + +[value:humidity] +oid = .1.3.6.1.4.1.318.1.1.26.10.2.2.1.10.1 +units = % +warning = (humidity > 60) + diff --git a/ini/apc-pdu-temperature.ini b/ini/apc-pdu-temperature.ini new file mode 100644 index 0000000..42cedb7 --- /dev/null +++ b/ini/apc-pdu-temperature.ini @@ -0,0 +1,12 @@ +# APC PDU with SNMP - http://goo.gl/KkiEg2 +# +# only temperature +# +[value:temperature] +oid = .1.3.6.1.4.1.318.1.1.26.10.2.2.1.8.1 +units = C +func = lambda x: float(x)/10 +warning = temperature > 21 +critical = temperature > 25 +name = Teplota + diff --git a/ini/apc-pdu.ini b/ini/apc-pdu.ini new file mode 100644 index 0000000..2a9dfdc --- /dev/null +++ b/ini/apc-pdu.ini @@ -0,0 +1,27 @@ +# APC PDU with SNMP - http://goo.gl/KkiEg2 +# +# voltage, current and power +# + +[value:current] +oid = .1.3.6.1.4.1.318.1.1.26.6.3.1.5.1 +func = lambda x: float(x)/10 +warning = current > 9 +critical = current > 15 +name = Current +units = A + +[value:voltage] +oid = .1.3.6.1.4.1.318.1.1.26.6.3.1.6.1 +warning = (voltage < 231) or (voltage > 232) +critical = (voltage < 229) or (voltage > 235) +units = V +name = Voltage + +[value:power] +oid = .1.3.6.1.4.1.318.1.1.26.6.3.1.7.1 +units = W +func = lambda x: float(x)*10 +warning = (power > 1800) +critical = (power > 2000) +name = Power diff --git a/make_packages_fpm b/make_packages_fpm new file mode 100755 index 0000000..b4c537f --- /dev/null +++ b/make_packages_fpm @@ -0,0 +1,48 @@ +#!/bin/bash + +# prepare RPM a DEB packages using +# Effing Package Manager ( see https://github.com/jordansissel/fpm ) + +set -ex +TARGET_DIR=/opt/nagios-plugins +PACKAGE_NAME=snmp-tortilla +TMPDIR=`mktemp -d /tmp/tmp.fpm.XXXXXXXXXX` +RELEASE=`date +%Y%m%d` +EPOCH=$[ $(date +%s ) - 1363388400 ] + +mkdir ${TMPDIR}/bin +mkdir ${TMPDIR}/ini +mkdir ${TMPDIR}/cfg +cp -r src/check_snmp_tortilla ${TMPDIR}/bin/check_snmp_tortilla +cp -r ini/*.ini ${TMPDIR}/ini +for fname in ini/*.ini; do + base=$( basename $fname .ini ) + cat > $TMPDIR/cfg/check-${base}.cfg <