In the previous entry I explained how I set-up the basic router notifications with emails. I also had created an extra trigger for the critical routers that I said I would use to send WinPopUp messages.
This is a how-to with respect of how I did it. The original how-to is here (I also have a question posted so if you can help I’d appreciate it).
First you need to install the sambaclient package. Remember that you don’t need the whole Samba.
After you install that, open a terminal as zabbix and go to your homedir, if you aren’t there already.
Don’t close this terminal, you’ll need it in a while.
Create a new file winpopup.sh in this new bin/ directory and put the following in it.
# Script to send WinPopUp message to Zabbix admins
echo -e "$2nn"$3 > /etc/zabbix/msg.txt
# Send the message
cat /etc/zabbix/msg.txt|/usr/bin/smbclient -M [NETBIOS NAME] -U Zabbix
Replace the [NETBIOS NAME] with the name of the windows PC you want to send the message.
Now go back to the terminal you left open
chmod +x winpopup.sh
As a test, you can run the script using your own computer name (or a nearby computer if you don’t run windows) and see if it works
You should receive a simple message.
Now go to the default control pannel
Configuration->General->(Choose) Media Types->Create Media Type
Use an appropriate name for the Media, like “WinPopUp” and put the script’s filename without the path winpopup.sh
Although the original guide mentions that we need to edit the server config file, this is an advice for an older version of zabbix. In newer versions, the default path is set for /home/zabbix/bin which, “incidentally” is where we’ve put it already 😉
Don’t forget to put the new media in the user
Click on the Media of the user you want to receive popups and choose your new script and the severity you want to use (for example I only use scripts for Disaster triggers, as the one I made for the Critical Routers). It doesn’t matter what you put in the Send-to inputbox. Although I wanted to use it to put the Netbios name of the PC I want to send the message, I haven’t found out how yet, hence my question
So now, each time the action that activates on the Critical Router lost connectivity trigger is run, this user will receive both an email and a WinPopUp message.
(Screenshot removed due to legal reasons)
Time to create a simple Zabbix map