A little more about Zabbix'e - we configure ICQ notifications



Habré already wrote a lot about this wonderful system - one , two , three , four , but I would like to return to this topic once more, and I think not the last.

At my current place of work, Zabbix communicates wonderfully with the CA department in Jabber, but it was decided to use a different type of notification for home - ICQ.
There are several reasons for this - the habit of this IM system, the reluctance of an additional service on a tracking machine, and curiosity - notifications in Jabber work out of the box, but there is no ICQ.



We put ICQ

CenterIM was chosen as a console IM client , firstly because it was the only one in the CentOS repositories that I used, and secondly because it knew how to use UTF-8 and generally positive reviews about it.

Further actions are described using the example of CentOS 6.3 x86_64 and Zabbix 1.8.15.

We install CenterIM from the Epel repository, run it once in the terminal to specify the necessary settings:

Remote charset: cp1251
Local charset: utf-8
ICQ UIN
ICQ Password
We won’t see this interface anymore. After completing the settings, CenterIM creates a $ HOME / .centerim / folder to store the settings and conversation history. By default, zabbix has a hom directory in / var / lib / zabbix






(which is its directory for notification scripts).

As follows from the documentation and the FAQ for using CenterIM from scripts, you should run the workflow in screen, which we will do:

# стартуем CenterIM в screen от пользователя zabbix
su -m zabbix --shell=/bin/bash -c '/usr/bin/screen -d -m /usr/bin/centerim -b /var/lib/zabbix/.centerim/'
# передаем команду сменить статус ICQ на Online
/usr/bin/centerim -b /var/lib/zabbix/.centerim/ -S o -p icq


Please note - in order not to run into my rake and fight the “event sending error error creating directory for the contact” error, always explicitly specify the configuration directory:
-b /var/lib/zabbix/.centerim/

Now we write a small script that will receive a message from Zabbix and send it to CenterIM:

#!/bin/sh
export receiver="$1"
export subject="$2"
export body="$3"
/bin/echo -e "[$subject] \n\n $body" | /usr/bin/centerim -b /var/lib/zabbix/.centerim/ -s msg -p icq -t $receiver


Everything is simple and clear.
The script lies in / var / lib / zabbix / icq

Customize Zabbix

Open Zabbix’s web interface, go to Administration -> Methods of alerts and create an alert of the “script” type with some friendly name.



Go to Administration -> Users and specify the ICQ number to the user who will receive notifications. And finally, create an action to respond to triggers and send notifications. Settings -> Actions Actually, everything can be used. And finally, a couple of beautiful graphs - a dedicated MySQL server is happy to install SSD:
















Also popular now: