SquidGuard is a URL redirector used to use blacklists with the proxysoftware Squid. There are two big advantages to squidguard: it is fast and it is free.
PNP4Nagios
Prerequisites
- RRDtool is the OpenSource industry standard, high performance data logging and graphing system for time series data. Use it to write your custom monitoring shell scripts or create whole applications using its Perl, Python, Ruby, TCL or PHP bindings.
Our CentOS server needed a few devel libraries installed for RRDtool:yum -y install cairo-devel glib2-devel pango-devel
Download the latest source for RRDtool
cd /extra/src
wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.3.tar.gz
tar zxf rrdtool-1.4.3.tar.gz
cd rrdtool-1.4.3Configure it with a few adjustments for our setup:
./configure --prefix=/usr/local/rrdtool
If everything is ok, then build and install it
make
make install - Zlib support for PHP -
--with-zlib
Installation
Download the latest version of PNP4Nagios:
cd /extra/src
wget http://sourceforge.net/projects/pnp4nagios/files/PNP-0.6/pnp4nagios-0.6.3.tar.gz/download
tar zxf pnp4nagios-0.6.3.tar.gz
cd pnp4nagios-0.6.3
Configure it:
./configure \
--with-rrdtool=/usr/local/rrdtool/bin/rrdtool \
--with-httpd-conf=/usr/local/apache2/conf/extra \
--with-perl_lib_path=/usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi
Then build and install:
make all
make install
Copy the sample config files:
make install-config
Add pnp4nagios to your Apache configuration:
- Install the Apache config file into
/usr/local/apache2/conf/extra/pnp4nagios.conf
:
make install-webconf
Then edit
/usr/local/apache2/conf/httpd.conf
and add a line to load the PNP4Nagios conf file:Include conf/extra/pnp4nagios.conf
- orcan add the contents of
src/httpd.conf
to your Nagios VirtualHost directive:
Alias /pnp4nagios "/usr/local/pnp4nagios/share"
<Directory "/usr/local/pnp4nagios/share">
AllowOverride None
Order allow,deny
Allow from all
#
# Use the same value as defined in nagios.conf
#
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
<IfModule mod_rewrite.c>
# Turn on URL rewriting
RewriteEngine On
Options FollowSymLinks
# Installation directory
RewriteBase /pnp4nagios/
# Protect application and system files from being viewed
RewriteRule ^(application|modules|system) - [F,L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT,L]
</IfModule>
</Directory>
Access the PNP4Nagios Environment Tests by going to http:///pnp4nagios. If it passes all the tests, remove the install.php
file:
rm /usr/local/pnp4nagios/share/install.php
NPCD Daemon
We're going to use daemontools. If you haven't already, install daemontools.
Copy the sample NPCD config file:
cp /usr/local/pnp4nagios/etc/npcd.cfg-sample /usr/local/pnp4nagios/etc/npcd.cfg
Create a directory for the NRPE service:
mkdir -m 1755 /var/service/npcd
cd /var/service/npcd
Create the run script and make it executable:
echo '#!/bin/sh' > run
echo 'exec 2>&1' >> run
echo 'exec /usr/local/pnp4nagios/bin/npcd -f /usr/local/pnp4nagios/etc/npcd.cfg' >> run
chmod 755 run
Our log script comes from John Simpson's:
mkdir -m 755 log
cd log
wget http://qmail.jms1.net/scripts/service-any-log-run
mv service-any-log-run run
chmod 755 run
Finally, add the service to daemontools by creating the symbolic link in /service
ln -s /var/service/npcd /service/npcd
Confirm that the service is running:
svstat /service/npcd /service/npcd/log
Data Collection
Nagios needs to be configured to trigger the data collector by editing /usr/local/nagios/etc/nagios.cfg
and editing/uncommenting some lines:
process_performance_data=1
service_perfdata_command=process-service-perfdata
host_perfdata_command=process-host-perfdata
Edit /usr/local/nagios/etc/objects/commands.cfg
and remove the existing process-service-perfdata and process-host-perfdata commands. Then add the new PNP4Nagios commands for service and host performance data logging:
define command {
command_name process-service-perfdata
command_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl
}
define command {
command_name process-host-perfdata
command_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
}
Nagios Web Front-End Integration
In order to easily view the graphs from your Nagios server, we can take advantage of Nagios' external URL features in extended info configs. There are two ways of doing it - regular links or Javascript pop-ups:
- Regular Links
Edit/usr/local/nagios/etc/objects/templates.cfg
and add:# PNP4Nagios host/service definitions
define host {
name host-pnp
action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=_HOST_
register 0
}define service {
name srv-pnp
action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
register 0
} - Javascript pop-ups
Copy status-header.ssi to your Nagios web files:cp /extra/src/pnp4nagios-0.6.3/contrib/ssi/status-header.ssi \
/usr/local/nagios/share/ssi/Edit
/usr/local/nagios/etc/objects/templates.cfg
and add:define host {
name host-pnp
action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=_HOST_' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=_HOST_
register 0
}define service {
name srv-pnp
action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=$SERVICEDESC$
register 0
}
To use them, add them to your host/service definitions with something similiar to:
define host{
use linux-server,host-pnp ; Name of host templates to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name localhost
alias localhost
address 127.0.0.1
}
define service{
use local-service,srv-pnp ; Name of service template to use
host_name localhost
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
- Log in to post comments