ups_exporter/script1.sh

33 lines
1.2 KiB
Bash
Executable File

pwrstat -status | grep -E 'State|Power Supply by|Utility Voltage|Output Voltage|Battery Capacity|Remaining Runtime|Load|Line Interaction|Test Result|Last Power Event' > ups
pwrstat -status "State... Normal" | grep State | sed 's/[.]*//g' | tr 'A-Z' 'a-z' | sed -e '$
state{"normal"} 1
pwrstat -status "Power Supply by... Utility Power" | grep Power Supply by | sed 's/[.]*//g' $
Power Supply by{"utility power"} 1
pwrstat -status "Utility Voltage... 237 V" | grep Utility Voltage | sed 's/[.]*//g' | tr 'A-$
Utility Voltage{"normal"} 1
pwrstat -status "Output Voltage... 237 V" | grep Output Voltage | sed 's/[.]*//g' | tr 'A-Z$
output voltage{"237"} 1
pwrstat -status "Remaining Runtime... 100 min" | grep Remaining Runtime | sed 's/[.]*//g' | $
Remaining Runtime{"100"} 1
pwrstat -status "Load" | grep Load | sed 's/[.]*//g' | t$
load{"0"} 1
pwrstat -status "Line Interaction... None" | grep Line Interaction | sed 's/[.]*//g' | t$
line interaction{"none"} 1
pwrstat -status "Test Result... Unknown" | grep Test Result | sed 's/[.]*//g' | t$
Test Result{"unknown"} 1
pwrstat -status "Last Power Event...Blackout at 2019/07/23 10:14:07 for 72 min
" | grep Last Power Event | sed 's/[.]*//g' | t$
Last Power Event{"backout"} 1