Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

Install PWRSTAT

PWRSTAT Configurations

CentOS

sudo visudo
[root@sql2 ~]# which pwrstat
/usr/sbin/pwrstat
xymon  ALL=(ALL)      NOPASSWD:/usr/sbin/pwrstat
sudo su
su -s /bin/sh xymon
sudo pwrstat -status
cat << 'EOL' >/usr/share/xymon-client/ext/ups.sh
#!/bin/sh

COLUMN=ups							
COLOR=green							
MSG="pwrstat -status | grep Normal" # The comamnd from var

#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


chown xymon:xymon /usr/share/xymon-client/ext/ups.sh
chmod 777 /usr/share/xymon-client/ext/ups.sh
 

cat << 'EOL' >/etc/xymon-client/client.d/ups.cfg
[ups]
 ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
 CMD $XYMONCLIENTHOME/ext/ups.sh
 LOGFILE $XYMONCLIENTHOME/logs/ups.log
 INTERVAL 15m
EOL
 
chown xymon:xymon /etc/xymon-client/client.d/ups.cfg
chmod 777 /etc/xymon-client/client.d/ups.cfg

/usr/share/xymon-client/bin/xymoncmd /usr/share/xymon-client/ext/ups.sh

service xymon restart

 

On Server :Restart Service :

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