Another modern method for the mobile age to be up to date everywhere about your infrastructure. Everyone has a mobile device with internet access, you need only a ICQ client to receive information notifications.
Today I’m going to talk about how to bring this idea to live…
Client (PC or mobile device iPad or whatever) side configuration:
Install icq client and go online, that’s all =)
Server side configuration:
Install a tiny command line instant messenger client (Debian/Ubuntu way):
1 | apt-get install centerim-utf8 |
Add a additional system user or use existing user for usage (adduser id), if you can please revoke root privileges;)
Before you go on you need a second ICQ-Account or you get a new one from official icq site:
Start centerim “centerim-utf8” as new user, and click done to continue to account manager:
Now you are able to configure icq, yahoo, jabber and a lot of other protocols, we choose icq.
Enter your UIN and password to continue.
1 | su - id -c "screen -d -m /usr/bin/centericq-utf8" |
This process will run in background as user “id”.
Add a cron job with this tiny script which will monitor special system behaviors:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #!/bin/bash # logfile to monitor LOG=/var/log/syslog # centerim binary file CIM=/usr/bin/centericq-utf8 # lines to watch in $LOG LINE=20 # we are looking for EXPR="DHCPREQUEST" # md5-hash of last run MDFILE=/home/id/monitoring/auth.md5 # filtered messages TXTFILE=/home/id/monitoring/auth.txt # filtered messages TXTFILE2=/home/id/monitoring/auth.new # previliged user to run centericq JABBERUSER=id # protocoll PROTO=icq # reciever UIM UIN=905720 # filter garbage EXCL='munin|Invalid|getaddrinfo' OLD=`cat $MDFILE` tail -$LINE $LOG | grep -E $EXPR | grep -v -E "$EXCL" > $TXTFILE2 READ=`tail -1 $TXTFILE2 | md5sum | awk '{print $1};'` if [ "$READ" == "$OLD" ]; then exit 0 else echo -e $READ > $MDFILE cat $TXTFILE2 > $TXTFILE su - $JABBERUSER -c "cat $TXTFILE | $CIM -s msg -p $PROTO -t $UIN" fi |
1 | mkdir /home/$username/monitoring |
Every time this script will be executed by cron, you will receive a ICQ-message.
zeldor says
ar, centerim-utf8 supports jabber messaging too =), with some little modifications to this script you could run monitoring with jabber.
ar says
i think jabber would be better because of hosting your own server and so you’re not dependent.