Hi everybody!
Until now we always got alerts by eMail and Windows Popup. Problem is, when a Windows PopUp comes up, you can't type anything in that Windows machine until the popup's ok-button is pressed!
So i created a system to send zabbix alerts per icq.
1st: Get an ICQ Account for your zabbix server
2nd: install tcl on your server (if not installed)
3rd: install the text-based icq-client "climm" on your zabbix server. it must have tcl support activated (FC6 RPM did so)
4th: On first start of climm, enter the ICQ UIN and password you registerd for the server if you are on climm's console and type
You should get the message (if you are logged in into zabbix) to your account. then exit climm.
3rd: further testing: on linux console, exec:
climm should connect to icq, send the message, and exit again.
4th: create the following tcl-script (this is your unix -> ICQ gateway):
I placed it in /bin/icq-forwarder. Open the file and enter your ICQ UIN in the global section ("set admin ...").
5th: this is your zabbix alert script (client), so place it in your zabbix binary dir (e.g. /home/zabbix/bin/icq-clientscript.sh)
take care of the file access: both must be executable, the clientscript should belong to user zabbix.
6th: now try this:
If everything works fine, you should see this line:
. you also should have got a message via icq saying 'ICQ-Forwarder gestartet. '. If so, your icq-forwarder is running, connected to zabbix, and listening on a local socket (port 33000). you may want to check this using
7th: open a new console as user zabbix (or su -l zabbix) and change to your zabbix script dir (~/bin/). Now send a message to the ICQ-Forwarder using the local port 33000:
8th: If this works as well, you can configure this script as an alert script in zabbix frontend. Please search this forum if you don't know how to do that.
9th: stopping the forwarder:
directly in the console by pressing [strg]+[c] 2 times, or by sending "kill" with the clientscript:
finally: As you might have noticed, the climm icq client needs a console. so you best install screen, then create a new virtual console
in that console you can run the forwarder with the command posted above. You can now leave the virtual console
. You can access it again with
Hope it works for you.
THIS IS ONLY POOOOOORLY TESTED! USE ON YOUR OWN RISK!!!
If some of you are interested in this, i'll spend more time in this (improve this tutorial, improve handling (start/stopping), write english comments, do some debugging, etc...)
Best regards
Heiner
PS: Sorry for my writing: It's after 5 and i can't wait getting home for weekend!
PPS: If someone can tell me, how to create the screen, start the forwarder and detatch the screen in 1 line, please post here!
"screen -dmS works, but i don't get the forwarder running... how do i tell screen?
Until now we always got alerts by eMail and Windows Popup. Problem is, when a Windows PopUp comes up, you can't type anything in that Windows machine until the popup's ok-button is pressed!
So i created a system to send zabbix alerts per icq.
1st: Get an ICQ Account for your zabbix server
2nd: install tcl on your server (if not installed)
3rd: install the text-based icq-client "climm" on your zabbix server. it must have tcl support activated (FC6 RPM did so)
4th: On first start of climm, enter the ICQ UIN and password you registerd for the server if you are on climm's console and type
Code:
msg <your icq uin> <message>
3rd: further testing: on linux console, exec:
Code:
climm -u <zabbixserver's ICQ UIN> -p <password> -C 'msg <your icq uin> <message>; exit'
4th: create the following tcl-script (this is your unix -> ICQ gateway):
Code:
# Verbindet sich mit ICQ, horcht an Socket und sendet Nachrichten per ICQ weiter
###
#
# Globals
#
# ICQ UIN des Admins
# (bekommt Nachrichten beim Starten und Stoppen des ICQ-Forwarders)
set admin "<your ICQ UIN>"
###
#
# Funktionen
#
# Startet die Socket
proc serverOpen {channel addr port} {
global connected
set connected 1
fileevent $channel readable "readLine Server $channel"
# puts "Client verbunden, warte auf Daten..."
# puts "Client verbunden"
}
# Liest Zeilen aus der Socket
proc readLine {who channel} {
global out didRead admin
gets $channel line
if {"$line" == ""} {
fileevent $channel readable {}
after idle {
# puts "Idle, warte auf Verbindung..."
set didRead 1
}
} elseif {$line == "kill"} {
set killmsg "kill-Befehl erhalten, Server wird gestoppt!"
climm exec "msg $admin $killmsg"
puts $channel $msg
flush $channel
exit
} else {
climm exec "msg $line"
#after 3000
# puts "out: \"$antwort\""
# puts $channel "$antwort"
# flush $channel;
set didRead 1
}
}
#
###
#
# Hauptprogramm
#
# Socket als verfügbar markieren
set connected 0
# Server an Port 33000 starten
set server [socket -server serverOpen 33000]
puts "ICQ-Forwarder gestartet, horche auf Port 33000"
climm exec "msg $admin ICQ-Forwarder gestartet."
while [ vwait out ] {
vwait connected
vwait didRead
unset connected didRead
}
5th: this is your zabbix alert script (client), so place it in your zabbix binary dir (e.g. /home/zabbix/bin/icq-clientscript.sh)
Code:
#!/usr/bin/tclsh
#
# (Test-)Client: Sendet Daten an den Server
#
# zu Socket verbinden, Referenz in Variable "sock" speichern
set sock [socket -async 127.0.0.1 33000]
# Wenn Kommandozeilenparameter vorhanden,
# Dann diese in Var. "eingabe" schreiben
# Sonst an StdIn auf Eingabe warten und in Var schreiben
if {$argc > 0} {
set eingabe "$argv"
} else {
puts "Bitte Daten eingeben, \"kill\" stoppt den Server:"
set eingabe [gets stdin]
}
# Inhalt aus "eingabe" an Socket senden
puts $sock "$eingabe"
flush $sock
#puts "Serverantwort:"
#set len [gets $sock ausgabe]
#puts "in : \"$ausgabe\""
# Client beenden
close $sock
exit
6th: now try this:
Code:
climm -u <zabbixserver's ICQ UIN> -p <password> -C 'tclscript /bin/icq-forwarder'
Code:
ICQ-Forwarder gestartet, horche auf Port 33000
Code:
[root@server ~]# netstat -ap|grep climm tcp 0 0 *:33000 *:* LISTEN 31143/climm
Code:
[zabbix@server bin]$ ./icq-clientscript.tcl <your ICQ UIN> <your message>
9th: stopping the forwarder:
directly in the console by pressing [strg]+[c] 2 times, or by sending "kill" with the clientscript:
Code:
[zabbix@server bin]$ ./icq-clientscript.tcl kill
Code:
[root@server ~]# screen -S icqforwarder
Code:
[Strg]+[a]+[d]
Code:
screen -r icqforwarder
THIS IS ONLY POOOOOORLY TESTED! USE ON YOUR OWN RISK!!!
If some of you are interested in this, i'll spend more time in this (improve this tutorial, improve handling (start/stopping), write english comments, do some debugging, etc...)
Best regards
Heiner
PS: Sorry for my writing: It's after 5 and i can't wait getting home for weekend!

PPS: If someone can tell me, how to create the screen, start the forwarder and detatch the screen in 1 line, please post here!
"screen -dmS works, but i don't get the forwarder running... how do i tell screen?



Comment