Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

Install PWRSTAT (PowerPanel) - CyberPower Linux CLI Interface - Ubuntu - CentOS

PWRSTAT Configurations

Ubuntu

sudo visudo && sudo service sudo restart
xymon  ALL=(ALL)      NOPASSWD:ALL
sudo su
su -s /bin/sh xymon
sudo pwrstat -status
cat << 'EOL' >/usr/lib/xymon/client/ext/ups.sh
#!/bin/sh

COLUMN=ups			
COLOR=green				
MSG="pwrstat -status | grep Normal"

#In this test, if var = empty = RED

var="$(sudo pwrstat -status | grep Normal)"
cmd="$(sudo pwrstat -status && sudo pwrstat -config)"

if [ -z "$var" ]

then

COLOR=red
MSG="${MSG}
FAILED
"${cmd}"
"
else

MSG="${MSG}
SUCCESS
"${cmd}"
"
fi

# Leave the rest of script alone
# Tell Xymon about it
$XYMON $XYMSRV "status $MACHINE.$COLUMN $COLOR `date`

${MSG}
"

exit 0

EOL
sudo chown xymon:xymon /usr/lib/xymon/client/ext/ups.sh
sudo chmod 777 /usr/lib/xymon/client/ext/ups.sh
cat << 'EOL' >/etc/xymon/clientlaunch.d/ups.cfg
[ups]
ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
CMD $XYMONCLIENTHOME/ext/ups.sh
LOGFILE $XYMONCLIENTHOME/logs/ups.log
INTERVAL 10m
EOL
/usr/lib/xymon/client/bin/xymoncmd /usr/lib/xymon/client/ext/ups.sh

Restart Service :

sudo service xymon-client restart

On Server :

sudo service xymon restart && sudo service apache2 restart
  • No labels