Sponsored Content
Special Forums UNIX and Linux Applications Infrastructure Monitoring Zabbix Template and PERL Script for Monitoring Apache2 Post 302299058 by Neo on Thursday 19th of March 2009 05:33:30 AM
Old 03-19-2009
Version 3: Zabbix Scripts for Monitoring Apache2 (+ vBulletin)

We updated this Zabbix template and scripts we are using to monitor our Apache2 server. In this version, we add monitoring for web crawlers (spiders), Treason uncloaked! (TCP bug) and for vBulletin online users stats:

Here are the addition entries for zabbix_agentd.conf

Code:
UserParameter=spider.googlebot,cut -f1 -d":" /tmp/zabbix_spiders.dat
UserParameter=spider.slurp,cut -f2 -d":" /tmp/zabbix_spiders.dat
UserParameter=spider.others,cut -f3 -d":" /tmp/zabbix_spiders.dat
UserParameter=vbulletin.totalonline,cut -f1 -d":" /tmp/zabbix_vbulletin.txt
UserParameter=vbulletin.membersonline,cut -f2 -d":" /tmp/zabbix_vbulletin.txt
UserParameter=vbulletin.guestsonline,cut -f3 -d":" /tmp/zabbix_vbulletin.txt
UserParameter=security.treason,cut -f1 -d":" /tmp/zabbix_security.dat

Here are the scripts (we run them in cron):

This simple one is for detecting spiders with a two minute delay, to give time for the log file to catch up. However, during heavy load times, more delay might be needed:

Code:
#!/bin/bash
#spiders.sh
TIME=`date +%d/%b/%Y:%H:%M`
LOG="/website/logs/apache2/access.log"
sleep 120
GBOT=`grep "$TIME" "$LOG"| grep Googlebot |wc -l`
SLURP=`grep "$TIME" "$LOG"|grep "Yahoo! Slurp" |wc -l`
OTHER=`grep "$TIME" "$LOG"|grep -i bot| grep -v "Yahoo! Slurp"|grep -v Googlebot |grep -v Firefox|wc -l`
echo $GBOT:$SLURP:$OTHER > /tmp/zabbix_spiders.dat

This simple one is for detecting the Treason Uncloaked! TCP Bug:

Code:
#!/bin/bash
#security.sh
TIME=`date +%d/%b/%Y:%k:%M`
LOG="/var/log/kern.log"
sleep 60
TREASON=`grep "$TIME" "$LOG"| grep -i "Treason Uncloaked" |wc -l`
echo $TREASON: > /tmp/zabbix_security.dat

This simple php code is for writing vBulletin online user information to a temp file for Zabbix:

Code:
$ourFileName = "/tmp/zabbix_vbulletin.txt";
$zabbixfile = fopen($ourFileName, 'w+');
vfprintf($zabbixfile,"%s:%s:%s\n",array($totalonline,$numberregistered,$numberguest));
fclose($zabbixfile);

We call this from a modified index.php file from cron instead of directly from the vB production code to minimize the load.
This User Gave Thanks to Neo For This Post:
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Log Monitoring through Perl

Hi, I am new to perl. I want to write a perl script to monitor logs. Where i want to monitor exceptions logged or any kind of error strings. I have a dir(On Solaris) with multiple log file which keeps rolling to .gz file after some time in that same dir. These logs files size keeps on... (0 Replies)
Discussion started by: solitare123
0 Replies

2. UNIX for Dummies Questions & Answers

Perl Scripting for monitoring logs

Hi, I am new to perl. I want to write a perl script to monitor logs. Where i want to monitor exceptions logged or any kind of error strings. I have a dir(On Solaris) with multiple log file which keeps rolling to .gz file after some time in that same dir. These logs files size keeps on... (1 Reply)
Discussion started by: solitare123
1 Replies

3. Infrastructure Monitoring

A Review of Zabbix - Zabbix Rules! (Part 1)

Tim Bass 03-20-2009 07:02 AM Source... (0 Replies)
Discussion started by: Linux Bot
0 Replies

4. Infrastructure Monitoring

A Review of Zabbix - Zabbix Rules! (Part 2)

Tim Bass 03-23-2009 03:45 PM Source... (0 Replies)
Discussion started by: Linux Bot
0 Replies

5. Programming

Perl script to create latex template.

Hi, I have XML file and I extracted some tags and stored in hash, my data as look like this $var1={ 'stud.xml'={ '24'=>'<address> <streetname="xxxx"/> <housenum="138"/"> ... (9 Replies)
Discussion started by: veerubiji
9 Replies

6. Programming

need help in perl template toolkit module.

Hi how can I read this information using template toolkit $var1= { 'STC'=> }; I am not able to get this type of complex data , Remaining everything I solved and I am getting output as I want but this problem suffers me.please help me. (0 Replies)
Discussion started by: veerubiji
0 Replies

7. Shell Programming and Scripting

Help with FTP Monitoring Using Perl

Hi, Can anyone help me to start a monitoring script in perl of a FTP server. (2 Replies)
Discussion started by: phanik143
2 Replies

8. Shell Programming and Scripting

Script to complete all fields of template

Hello gurus; I need to do a script to complete a technical template and I don't have idea to how to do :wall: I've try with bash and awk or sed but my brain is empty in this script. I need help please. The incoming file is a csv with an index number, first occurence in the possition of the... (2 Replies)
Discussion started by: renderuas
2 Replies
All times are GMT -4. The time now is 10:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy