Nagios Monitoring for Noosfero

Install Nagios server

# aptitude install nagios3 nagios-nrpe-plugin libapache2-mod-php5
remember the admin password you will set at the Nagios debconf dialog.

If you want to send commands to Nagios from it's web interface, set check_external_commands=1 at /etc/nagios3/nagios.cfg. And make the cgi executable:
# adduser www-data nagios
# chmod g+rx /var/lib/nagios3/rw
# chmod +x /var/lib/nagios3/rw/nagios.cmd

Update /etc/nagios3/conf.d/contacts_nagios2.cfg with your identity:
define contact{
        contact_name                    ze
        alias                           Joze
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    w,u,c,r
        host_notification_options       d,r
        service_notification_commands   notify-service-by-email
        host_notification_commands      notify-host-by-email
        email                           ze@noosfero.org
        }

define contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
        members                 ze
        }

Add your servers config files at /etc/nagios3/conf.d. Example: my-noosfero.org.cfg
define host{
        use                     generic-host            ; Name of host template to use
        host_name               my-noosfero.org
        alias                   My-Noosfero
        address                 111.222.333.444
        contact_groups          admins
        }

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       my-noosfero.org
        service_description             has_delayed_job
        check_command                   check_nrpe_1arg!has_delayed_job
        }
(and other service tests...)

Add Nagios to some vitualhost in SSL

<VirtualHost *:443>
  ServerName your-server.some.where
  ...
  Include /etc/nagios3/apache2.conf
</VirtualHost>

Nagios is alive at: https://your-server.some.where/nagios3 User:=nagiosadmin=

New users must be added to /etc/nagios3/htpasswd.users and their permission set in cgi.cfg.

Install Nagios Client in your Noosfero server

# aptitude install nagios-nrpe-server nagios-plugins

Update /etc/nagios/nrpe.cfg to:
allowed_hosts=127.0.0.1,001.002.003.004

You'll need to set new command tests at /etc/nagios/nrpe_local.cfg:
command[check_all_disks]=/usr/lib/nagios/plugins/check_disk -w '20%' -c '10%' -e
command[has_delayed_job]=has_delayed_job

Create /usr/local/bin/has_delayed_job:
#!/bin/bash

dummy=/usr/lib/nagios/plugins/check_dummy
num=$(ps aux | grep 'noosfero .* [d]elayed_job' | wc -l)

case $num in
  0) $dummy 2 'There is no delayed_job proc';;
  1) $dummy 1 'There is only one delayed_job proc';;
  *) $dummy 0 "There are $num delayed_job procs";;
esac
...and make it executable.

If you add/change something, reload the service:
# service nagios-nrpe-server restart

Add comment
You need to login to be able to comment.
 
Topic revision: r1 - 24 Apr 2017, AurelioAHeckert

irc Talk with Devs Now!

 
Translations: English
Search on Docs:
   
ActionItem Search:

Copyright © 2007-2018 by the Noosfero contributors
Colivre - Cooperativa de Tecnologias Livres