Nagios
Contents
Debian
aptitude install nagios3 nagios-plugins nagios-nrpe-plugin nagios3-doc
you could also install
nagios-plugins-openstack nagios-snmp-plugins
you could also install
nagios-plugins-contrib
from
deb http://YOURMIRROR.debian.org/debian-backports squeeze-backports main
Set domain if you have one (else leave default) and set login user and password (it should prompt your for both)
At the time I had to apply the fix that is here: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=626462
Notes
- http://www.howtoforge.com/installing-nagios-on-debian-lenny-and-monitoring-a-debian-lenny-server
- http://www.the-tech-tutorial.com/wp-content/uploads/2011/07/nagios-config.png
- http://packages.debian.org/squeeze/nagiosgrapher
General Ping Monitoring
You put a host config file in the host config directory and restart nagios. It will then pull the new host in.
/etc/nagios3/conf.d
Contains templates that you can pull into your host config files.
/etc/nagios3/conf.d
is also where you put your host config files.
- Example
define host{ use generic-host ; Name of host template to use host_name HOSTNAME alias HOSTNAME address 192.168.52.20 }
Save that in
/etc/nagios3/conf.d
and
/etc/init.d/nagios3 restart
you should see it pop in
I make my own dir:
/etc/nagios3/hosts.d
and then add
cfg_dir=/etc/nagios3/hosts.d
to nagios.cfg
Windows Internal (Private Data) Monitoring
- configure nagios
nano /etc/nagios3/conf.d/winserver_nagios.cfg
put
# Windows host definition template - This is NOT a real host, just a template! define host{ name windows-server ; The name of this host template use generic-host ; Inherit default values from the generic-host template check_period 24x7 ; By default, Windows servers are monitored round the clock check_interval 5 ; Actively check the server every 5 minutes retry_interval 1 ; Schedule host check retries at 1 minute intervals max_check_attempts 10 ; Check each server 10 times (max) check_command check-host-alive ; Default command to check if servers are "alive" notification_period 24x7 ; Send notification out at any time - day or night notification_interval 30 ; Resend notifications every 30 minutes notification_options d,r ; Only send notifications for specific host states contact_groups admins ; Notifications get sent to the admins by default hostgroups windows-servers ; Host groups that Windows servers should be a member of register 0 ; DONT REGISTER THIS - ITS JUST A TEMPLATE }
I pulled the above from /usr/share/doc/nagios3-common/examples/template-object/templates.cfg.gz
- save
- restart nagios
Installing via MSI
- Complete
- Install sample config
- Check all users
- Add allowed host
- check everything except what you are not using
- change service to allow desktop interaction
Installing the Windows Agent Manually
- Download the latest stable version of the NSClient++ addon from http://sourceforge.net/projects/nscplus
- Unzip the NSClient++ files into a new C:\NSClient++ directory
- Open a command prompt and change to the C:\NSClient++ directory
- Register the NSClient++ system service with the following command:
nscp.exe service --install
- Open the services manager and make sure the NSClientpp service is allowed to interact with the desktop (see the 'Log On' tab of the services manager). If it isn't already allowed to interact with the desktop, check the box to allow it to.
- create a nsclient.ini file
- start service/reboot/run command to start
Windows Password Fix on Server
The guys who make the package in the debian readme file state that they make definitions flexible so that if the devs decide to change a port then the rule will update where if you define the port in the check_nt statement then it will not. This is why the debian check_nt is different then some others.
It is best to use the user vars in the resource.cfg file for your password instead of setting them in the cfg files that are accessible by cgi.
so
nano resource.cfg
change one of the user vars to your pass and then edit
nano /etc/nagios-plugins/config/nt.cfg
with
define command{ command_name check_nt command_line $USER1$/check_nt -H $HOSTADDRESS$ -s $USER9$ -v $ARG1$ }
where $USER9$ is your var that contains the password.
notes
below is old
If you specified a password in the NSClient++ configuration file on the Windows machine, you'll need to modify the check_nt command definition to include the password. Open the commands.cfg file for editing.
vi /usr/local/nagios/etc/objects/commands.cfg
but in debian it is:
nano /etc/nagios-plugins/config/nt.cfg
Change the definition of the check_nt command to include the "-s <PASSWORD>" argument (where PASSWORD is the password you specified on the Windows machine) like this:
define command{ command_name check_nt command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s PASSWORD -v $ARG1$ }
Instead I changed my windows definitions to use check_nscp instead of check_nt and modified that definition to include the password
define command { command_name check_nscp command_line /usr/lib/nagios/plugins/check_nt -H '$HOSTADDRESS$' -s $USER4$ -p 12489 -v '$ARG1$' }
Save the file.
add host to nagios
Notes
debian external command fix/setup
easy right? nope
nano nagios.cfg
change
check_external_commands=0
to
check_external_commands=1
Then
/etc/init.d/nagios3 stop dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3 /etc/init.d/nagios3 start