List Client IP and Count Hits
awk -F'[ “]+’ ‘$7 == “/” { ipcount[$1]++ } END { for (i in ipcount) { printf “%15s – %d\n”, i, ipcount[i] } }’ access.log
List Client IP and RDNS
cat access.log | awk ‘{print $1}’ | logresolve
Figuring things out, to get it done!
List Client IP and Count Hits
awk -F'[ “]+’ ‘$7 == “/” { ipcount[$1]++ } END { for (i in ipcount) { printf “%15s – %d\n”, i, ipcount[i] } }’ access.log
List Client IP and RDNS
cat access.log | awk ‘{print $1}’ | logresolve
In many cases, the dev class vm’s do not have Internet access (annoying) so you cannot install software vi the Internet.
Mount the ISO in the VM.
On the server run the following command:
sudo mount /dev/sr0 /cdrom
ensure that only the following line is uncommented in /etc/ap[t/sources.list
deb cdrom:[Ubuntu-Server 10.04 LTS _Lucid Lynx_ – Release amd64 (20100427)]/ lucid main restricted
Run sudo apt-get update to update the repository. Then install what you need.
# apache2ctl -t -D DUMP_MODULES
check_procs is an example for a plugin which doesn’t deliver performance data:
./check_procs -a apache2 -w 1: -c 0:
PROCS OK: 33 processes with args ‘apache2’
This can be changed with the following wrapper script:
#!/bin/bash LINE=`/usr/local/nagios/libexec/check_procs $*` RC=$? COUNT=`echo $LINE | awk '{print $3}'` echo $LINE \| procs=$COUNT exit $RC
Now you’ll get the number together with the required label:
PROCS OK: 33 processes with args ‘apache2’| procs=33
These commands are tailored for a nagios installation.
Starting the selenium rc:
Sample nagios check command:
./check_selenium com.example.tests.someWebsiteCom http://some.website.com*firefox
Schedule:
Currently, login test is every hour.
This is a ruby script that can download a web page. Source here:
http://code.google.com/p/nagios-check-webpage/
Installation:
Prerequisites:
apt-get install ruby rubygems
gem update
apt-get install ruby1.8-dev
gem install hpricot
apt-get install libopenssl-ruby
Nagios Check Command:
define command{
command_name check-webpage
command_line $USER1$/check_webpage.rb -u $HOSTADDRESS$$ARG1$
}
/usr/bin – binary
/usr/share/nagios – main web site content
/usr/lib/nagios – CGI’s
/var/nagios – logs, archives, external commands
/etc/nagios – configs
/var/log/nagios – logs
/usr/include/nagios – headers