Skip to content

Commit

Permalink
upload, v1
Browse files Browse the repository at this point in the history
  • Loading branch information
delin committed Sep 18, 2013
1 parent e709dd9 commit f92f4eb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions sh/ups_status.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh

ups=$1
key=$2

if [ $key = ups.status ]; then
state=`/bin/upsc $ups $key`
case $state in
OL) echo 1 ;; #'On line (mains is present)' ;;
OB) echo 2 ;; #'On battery (mains is not present)' ;;
LB) echo 3 ;; #'Low battery' ;;
RB) echo 4 ;; #'The battery needs to be replaced' ;;
CHRG) echo 5 ;; #'The battery is charging' ;;
DISCHRG) echo 6 ;; #'The battery is discharging (inverter is providing load power)' ;;
BYPASS) echo 7 ;; #'UPS bypass circuit is active echo no battery protection is available' ;;
CAL) echo 8 ;; #'UPS is currently performing runtime calibration (on battery)' ;;
OFF) echo 9 ;; #'UPS is offline and is not supplying power to the load' ;;
OVER) echo 10 ;; #'UPS is overloaded' ;;
TRIM) echo 11 ;; #'UPS is trimming incoming voltage (called "buck" in some hardware)' ;;
BOOST) echo 12 ;; #'UPS is boosting incoming voltage' ;;
* ) echo 0 ;; #'unknown state' ;;
esac
else
/bin/upsc $ups $key
fi
1 change: 1 addition & 0 deletions zabbix_agentd.d/userparameter_nut.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
UserParameter=upsmon[*],/etc/zabbix/sh/ups_status.sh $1 $2

0 comments on commit f92f4eb

Please sign in to comment.