Hello,
I just made a Zabbix template to monitor my Symbol node, I’m sharing it in case anyone find it useful.
It can be used to send alarms to your email/Telegram/whatever, it can also generate nice graphs like these ones:
I’m assuming you already have your Zabbix server, your Zabbix agent, your media types in place, there’s a lot of documentation online covering that.
I developed it on Zabbix 5.0 but I guess it should work without issues on other versions too.
The first step is creating a Bash script on your node to gather informations, I called it /etc/zabbix/symbol_info.sh
#!/bin/bash
LOGDIR=/home/symbol/target/nodes/node/logs/
HARVESTINGCONFIG=/home/symbol/target/nodes/node/server-config/resources/config-harvesting.properties
LINKEDPUBLICKEY=2812813BAE035D6B2293C94EBE4FE8B533B81FD156477036F7D7C01AE48E7C23
if [ "$1" == "harvested" ]
then
if [ "$2" == "me" ]
then
ME=$LINKEDPUBLICKEY
fi
LOGS=`find $LOGDIR -mtime -1 -type f -name 'catapult_server*.log'`
HARVESTED="successfully harvested block at [0-9]+ with signer $ME"
YESTERDAY=`date "+%Y-%m-%d %H:%M:%S" -d yesterday`
egrep -a -h "$HARVESTED" $LOGS | awk "\$0 > \"$YESTERDAY\"" | wc -l
elif [ "$1" == "maxUnlockedAccounts" ]
then
grep maxUnlockedAccounts $HARVESTINGCONFIG | awk '{print $3}'
elif [ "$1" == "broker_is_running" ]
then
ps axu 2>/dev/null | grep /usr/catapult/bin/catapult.broker | grep -v grep | wc -l
elif [ "$1" == "catapult_is_running" ]
then
ps axu 2>/dev/null | grep /usr/catapult/bin/catapult.server | grep -v grep | wc -l
elif [ "$1" == "mongodb_is_running" ]
then
ps axu 2>/dev/null | grep mongodb | grep -v grep | wc -l
elif [ "$1" == "rest_is_running" ]
then
ps axu 2>/dev/null | grep /symbol-workdir/rest.json | grep -v grep | wc -l
fi
You have to modify the 3 variables at the top to suite your node and account. If you don’t know your account linked public key you can just search for your account on Symbol Block Explorer
Please, dont forget to make the script executable:
chmod a+x /etc/zabbix/symbol_info.sh
Once the script is in place, you must give the zabbix user the permission to run it impersonating the symbol user (or whatever the user you are running your node is called). To do so create the file /etc/sudoers.d/zabbix with this content:
zabbix ALL=(symbol)NOPASSWD:/etc/zabbix/symbol_info.sh
Probably your sudo will complain if you don’t give it correct permissions:
chmod 0640 /etc/sudoers.d/zabbix
Now it’s time to inform the Zabbix agent about the existence of this script, let’s create a new file /etc/zabbix/zabbix_agentd.d/nem_symbol.conf containing:
UserParameter=symbol_info[*],sudo -u symbol /etc/zabbix/symbol_info.sh $1 $2
Make sure zabbix user has permisson to read this file and restart the agent:
systemctl restart zabbix-agent
The Zabbix agent is ready, the next step is to import this template via Zabbix web interface and add it to the host.
One last step: in Zabbix web interface add a Macro called {$SYMBOL_ACCOUNT} to your host, the value obviously must be your main Symbol account address.
Some items need time to show some value but most of them will work in few minutes. In the meantime look at Zabbix agent logs (/var/log/zabbix/zabbix_agentd.log) to spot any problem.
Please, consider offering me a beer if you find it useful: NATR4OJ2ROAMZLRCPWYLOC7PDW57KK75TKDG3KQ