zeldor.biz

Linux, programming and more

Copyright © 2025
Log in

Monitoring with ICQ

September 3, 2012 by Igor Drobot 2 Comments

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

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"

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

#!/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

mkdir /home/$username/monitoring

Every time this script will be executed by cron, you will receive a ICQ-message.

Filed Under: Bash, Debian, Linux, Monitoring, Ubuntu Tagged With: centerim-utf8, ICQ, Instant Messaging, Monitoring, ssh

Categories

Archives

Tags

apache2 Apple arduino ARM Automation backup bash Cisco Cluster Corosync Database Debian Debian squeeze DIY DNS Fedora FTP Fun Icinga Ipv6 KVM Linux LVM MAC OS X Monitoring MySQL Nagios Nginx openSUSE OpenVPN PHP Proxy Python python3 qemu RAID rsync Samba security ssh Ubuntu virtualization Windows Windows 7 Wordpress

Comments

  1. zeldor says

    September 4, 2012 at 12:07

    ar, centerim-utf8 supports jabber messaging too =), with some little modifications to this script you could run monitoring with jabber.

  2. ar says

    September 4, 2012 at 11:53

    i think jabber would be better because of hosting your own server and so you’re not dependent.

Leave a Reply

Your email address will not be published. Required fields are marked *

Yeaaah Cookie! We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok