On Thu, 14 Jul 2016, Dmitri Stepanov wrote:

Some of those hosts haven't NUT including upsmon (and other software which is not included by suppliers of the hosts) for a number of reasons. I don't need to inform not-NUT hosts about any UPS events, etc... but only shutdown all the hosts after upssched timer expired. So I think shutdown them via ssh would be enough and creating some replacement for upsmon is too much.

Perhaps it is possible to have a micro upsmon in the form of a cron job in every slave which, every minute, runs something like

 rprice@maria:~> X=$( echo "GET VAR my-ups battery.charge" | netcat -w1 
upsd-server 3493 )
 rprice@maria:~> if [[ "$X" =~ \"([0-9]*)\" ]] ; then Y=${BASH_REMATCH[1]}; 
else Y=999 ; fi
 rprice@maria:~> if [[ "$Y" -gt 35 ]] ; then echo "Carry on $Y" ; else echo 
"Shutdown $Y" ; fi
 Carry on 100

Different slaves could have different low battery values. I'm sure that a netcat expert would be able to find a way of executing netcat only once.

Roger

_______________________________________________
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser

Reply via email to