Dmitri Stepanov
2016-Jul-14 16:14 UTC
[Nut-upsuser] Best practice to shutdown hosts which has not NUT via upssched
Thank you for answer Stuart>?????, 13 ???? 2016, 17:54 +03:00 ?? Stuart Gathman <stuart at gathman.org>: > >On 07/13/2016 10:02 AM, Stuart Gathman wrote: >> On 07/13/2016 04:17 AM, Dmitri Stepanov wrote: >>> I need to shutdown a number of hosts which has not NUT from one which has it. >> Let's make sure you are not missing an obvious point. By "has not NUT", >> you might mean not running upsd. The best practice is to run upsmon on >> the other hosts. This does not require running NUT proper (server). Is >> there some reason why you can't run upsmon on the other hosts? >> Typically, upsd and drivers are packaged as something like "nut-server", >> whereas upsmon is packaged as "nut-client". >If you truly can't run upsmon, then you can speak the upsd protocol >directly over tcp. For an example non-nut implementation, look at the >"check_ups" plugin for nagios. It queries a NUT server for basic >information, including whether it is on battery. >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.>_______________________________________________ >Nut-upsuser mailing list >Nut-upsuser at lists.alioth.debian.org >http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser
Roger Price
2016-Jul-14 20:58 UTC
[Nut-upsuser] Best practice to shutdown hosts which has not NUT via upssched
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 at maria:~> X=$( echo "GET VAR my-ups battery.charge" | netcat -w1 upsd-server 3493 ) rprice at maria:~> if [[ "$X" =~ \"([0-9]*)\" ]] ; then Y=${BASH_REMATCH[1]}; else Y=999 ; fi rprice at 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
Dmitri Stepanov
2016-Jul-15 08:57 UTC
[Nut-upsuser] Best practice to shutdown hosts which has not NUT via upssched
>???????, 14 ???? 2016, 23:58 +03:00 ?? Roger Price < roger at rogerprice.org >: > >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 at maria:~> X=$( echo "GET VAR my-ups battery.charge" | netcat -w1 upsd-server 3493 ) >??rprice at maria:~> if [[ "$X" =~ \"([0-9]*)\" ]] ; then Y=${BASH_REMATCH[1]}; else Y=999 ; fi >??rprice at 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.Cool. I've never think via this way. I'm sure I'll use it. Thank you for the hint. But a problem could be with netcat software (if it installed or not on the not-NUT slaves, moreover there are a number of Windows hosts). Unfortunately I have no ability to break in configuration and installed software of the not-NUT hosts too deeply (licenses of the suppliers of the hosts, etc...). Thanks to Kris Jordan, I guess the problem is the uid of the upssched (CMDSCRIPT and my shutdown script and ssh) process. I hope I 'd check it as soon as I get connection to the system.> >Roger > >_______________________________________________ >Nut-upsuser mailing list > Nut-upsuser at lists.alioth.debian.org > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20160715/e3100c60/attachment.html>
Reasonably Related Threads
- Best practice to shutdown hosts which has not NUT via upssched
- Best practice to shutdown hosts which has not NUT via upssched
- Best practice to shutdown hosts which has not NUT via upssched
- Best practice to shutdown hosts which has not NUT via upssched
- Best practice to shutdown hosts which has not NUT via upssched