📜 ⬆️ ⬇️

A little more about Zabbix - we set up ICQ notifications



On Habré, quite a lot was written 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 perfectly with the CA department in Jabber, but for the house it was decided to use a different type of notification - ICQ.
There are several reasons for this - the habit of this IM system, the reluctance of the additional service on the tracking machine, and curiosity - the notifications in Jabber work out of the box, but ICQ does not.
')


We put ICQ

CenterIM was chosen as the console IM client, firstly because it only appeared in the CentOS repositories I used, secondly, because UTF-8 can do it and generally have positive feedback about it.

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

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

Remote charset: cp1251
Local charset: utf-8
ICQ UIN
ICQ Password



More we will not see this interface.

After the setup is complete, CenterIM creates the $ HOME / .centerim / folder to store settings and conversation history.
By default, zabbix has a home directory in / var / lib / zabbix (which is also its directory for notification scripts).

As follows from the documentation and FAQ, in order to use CenterIM from scripts, the workflow should be launched into the 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 


Pay attention - in order not to run into my rake and not to fight with the error “event sending error directory for the contact”, 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 transfer 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 is in / var / lib / zabbix / icq

Configuring Zabbix

Open the Zabbix web interface, go to Administration -> Alert methods and create a “script” type alert with some friendly name.



Go to Administration -> Users and specify the ICQ number to the user who will receive notifications



And finally, we will 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:


Source: https://habr.com/ru/post/164415/


All Articles