Nagios plugin pour les onduleurs Eaton Powerare
Récemment j’ai décidé de monitorer notre onduleur Eaton Powerare 9SX. Les plugins dispo sur l’exchange de Nagios ne fonctionnant pas, j’en ai adapté un pour mon cas.Voici donc mon plugin check_ups_eaton.sh
Il faut tout d’abord activer le snmp sur l’onduleur, en fonction du modéle ça se fait soit sur l’interface web, soit en telnet/ssh.
Je me suis servis du plugin de dduenasd que j’ai trouvé sur l’exchange de nagios.
Le plugin check_ups_eaton
Disponible sur mon Github
A placer dans /usr/local/nagios/libexec
Pour adapter le plugin à mes onduleurs ( Eaton SX3000 et Eaton 9SX ) j’ai du remplacer les OIDs.
Le seuls améliorations que j’ai rajoutés par rapport au script d’origine c’est des messages d’erreurs quand on oublie de préciser les options warning et critical.
Les options
PARAMETERS: ups_alarm:The present number of active alarm conditions. If number is zero, status is OK, if > 0 the status is CRITICAL If an alarm is present, the plugin show the upsAlarmDescr and upsAlarmTime, if you want show the text description of the oid upsAlarmDescr, you must define the directory of the mibs files with -d Option (./mibs by default) output_load :The percentage of the UPS power capacity presently being used on this output line, i.e., the greater of the percent load of true power capacity and the percent load of VA. warning and critical requiered. input_voltage :The magnitude of the present input voltage in the input lines. normal value, interval warning and interval critical requiered Example: normal value is 400V, warning in 395-405 V interval and critical 390-410 V interval use: ./check_ups_eaton.sh -H 10.40.80.1 -p input_voltage -w 395:405 -c 390:400 in the example, normal value is 400V, warning in 395-405 V interval and critical 390-410 V interval num_input_lines :The number of input lines utilized in this device. This variable indicates the number of rows in the input table, percent warning and critical no requiered. num_output_lines :The number of output lines utilized in this device. This variable indicates the number of rows in the output table, warning and critical no requiered. battery_status :The indication of the capacity remaining in the UPS system's batteries. A value of batteryNormal indicates that the remaining run-time is greater than upsConfigLowBattTime. A value of batteryLow indicates that the remaining battery run-time is less than or equal to upsConfigLowBattTime. A value of batteryDepleted indicates that the UPS will be unable to sustain the present load when and if the utility power is lost (including the possibility that the utility power is currently absent and the UPS is unable to sustain the output).warning and critical no requiered. No perfdata show. battery_charge_remain: An estimate of the battery charge remaining expressed as a percent of full charge and minutes. Warning and critical required and refered to the percent of charge
Voici les résultats chez moi pour vous donner une idée :
11:17 root@nagios /home/si # /usr/local/nagios/libexec/check_ups_eaton.sh -H 192.168.x.x -v 1 -C public -p battery_charge_remain -w 30 -c 15 OK - estimated battery charge: 100%, estimated minutes to depleted: 297 min |'charge'=100%;30;15;; 'time_to_depleted'=17820s;;;0; 11:17 root@nagios /home/si # /usr/local/nagios/libexec/check_ups_eaton.sh -H 192.168.x.x -v 1 -C public -p input_voltage -w 220:240 -c 210:250 OK - Voltage of 1 input lines: L1=236V|'L1'=236;220:240;210:250;; 11:17 root@nagios /home/si # /usr/local/nagios/libexec/check_ups_eaton.sh -H 192.168.x.x -v 1 -C public -p output_load -w 80 -c 90 OK - Percent Load of 1 lines: L1=33%|'L1'=33%;80;90;0;100
Ajout dans nConf
Dans nConf, j’ai ajouté une checkcommand avec :
- check command name : check_ups_eaton_load
- check command line : $USER1$/check_ups_eaton.sh -H $HOSTADDRESS$ -v 1 -C public -p $ARG1$ -w $ARG2$ -c $ARG3$
- params description : output_load input_voltage battery_charge_remain,warning,critical
- amount of param : 3
Le reste des paramétres est en fonction de votre installation.
Dans ce scénario je n’utilise que les options output_load, input_voltage et battery_charge_remain. Les autres ne m’intéressent pas.
Si vous les voulez il faudra créer la même checkcommand et enlever les paramètres -w et -c.