install nagios3 packages:
1
2
3
| $ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install nagios3 nagios3-doc |
config files are located in /etc/nagios3 and /etc/nagios3/conf.d configure your contacts and hosts accordingly.
what got me crazy was enabling external commands (needed to perform actions in the webinterface like sending alerts or enabling/disabling things).
edit /etc/nagios3/nagios.cfg:
1
2
3
4
5
6
7
8
9
10
11
| # EXTERNAL COMMAND OPTION
# Values: 0 = disable commands, 1 = enable commands
check_external_commands=1
# EXTERNAL COMMAND CHECK INTERVAL
# NOTE: Setting this value to -1 causes Nagios to check the external
# command file as often as possible.
command_check_interval=15s
#command_check_interval=-1 |
to get rid of Error: Could not stat() command file ‘/var/lib/nagios3/rw/nagios.cmd’, i had to do this:
1
2
3
4
| $ sudo /etc/init.d/nagios3 stop
$ sudo dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw
$ sudo dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3
$ sudo /etc/init.d/nagios3 start |
to send notification mails using the corporate smtp host i had to do this:
http://exchange.nagios.org/directory/Addons/Notifications/Notifications-using-ISP-SMTP-server-with-Authentication/details
1
| $ sudo apt-get install sendemail |
Edit /etc/nagios3/resource.cfg:
1
2
3
| $USER5$=your_isp_email_username
$USER6$=your_isp_email_password
$USER7$=your_isp_outgoing_mail_server |
Edit /etc/nagios3/commands.cfg
Change command_line for command_name notify-host-by-email:
1
| command_line /usr/bin/sendemail -o tls=yes -s $USER7$ -xu $USER5$ -xp $USER6$ -t $CONTACTEMAIL$ -f $CONTACTEMAIL$ -l /var/log/sendEmail -u "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -m "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" |
and the notify-service-by-email command line to
1
| command_line /usr/bin/sendemail -o tls=yes -s $USER7$ -xu $USER5$ -xp $USER6$ -t $CONTACTEMAIL$ -f $CONTACTEMAIL$ -l /var/log/sendEmail -u "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -m "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" |
1
2
3
| $ sudo touch /var/log/sendEmail
$ sudo chown nagios:nagios /var/log/sendEmail
$ sudo /etc/init.d/nagios3 restart |