Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

Ubuntu (This is as if running on XYMon Server)

See Custom Script template if running on separate host

cat << 'EOL' >/usr/lib/xymon/client/ext/zabbix.sh
#!/bin/sh

#This tag goes in hosts.cfg
HOSTTAG=zabbix
COLUMN=$HOSTTAG

##XYMon Configs -- Leave Alone##
$XYMONHOME/bin/xymongrep $HOSTTAG | while read L
   do
      set $L# To get one line of output from xymongrep

      HOSTIP="$1"
      MACHINEDOTS="$2"
      MACHINE=`echo $2 | $SED -e's/\./,/g'`

      COLOR=green
      MSG="$HOSTTAG status for host $MACHINEDOTS"

##Begin Custom If/Then Script##

#In this test, if var = empty = RED
var="$(netstat -tulpn | grep zabbix_server)"
var1="$(netstat -tulpn | grep zabbix_agent)"
cmd="$(netstat -tulpn | grep zabbix)"


if [ -z "$var" ] || [ -z "$var1" ]

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}
"
done

exit 0

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

Restart Service :

sudo service xymon-client restart

On Server :

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