Wednesday, November 27, 2024

Nagios Core 3.x installation guide on Debian 8.x (Jessie)

Abstract: This short howto explains, how a basic nagios installation could be installed, which can be used to trigger remote Powershell commands for monitoring purpose.

Some users asked me if I can provide a quick installation manual for a basic Debian installation which can be used to trigger the PS scripts.

As this is a very basic Nagios environment to help you to get started, this howto didn´t make use of some special security implementations!

1.) Setup a Debian 8.x (Jessie) basis installation (for example as explained here)

2.) We will now perform a basic installation

2a.) login as root and install nagios 3 and the nagios plugins & the NRPE plugin via:

apt-get install nagios3 nagios-plugins nagios-nrpe-plugin

2b.) The wizard will ask you to enter a password for the “nagiosadmin” user. For this small howto we will use “password”. For you environment it would be wise to choose a better password!

2c.) Once the wizard close, the basic installation is finished now and you can login via

http://<NagiosServerIP>/nagios3

You can use “ifconfig” to get the current IP from the debian OS.

Username: nagiosadmin

Password: <ThePasswordYouChoose>

3.) The next step will cover a very basic Nagios configuration.

3a.) Make sure that the check_nrpe.cfg contains the basic settings as below via:

nano /etc/nagios-plugins/config/check_nrpe.cfg

# this command runs a program $ARG1$ with arguments $ARG2$
define command {
        command_name    check_nrpe
        command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $
}

# this command runs a program $ARG1$ with no arguments
define command {
        command_name    check_nrpe_1arg
        command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $
}

4.) In the last step we will trigger an powershell script on an Windows Server via NSCP (NSClient++). In this example we will use the Exchange 2010/2013/2016 MailQueue monitoring script.

4a.) Make sure that the nagios NRPE plugin is running. If it is running we can perform a basic connection test via:

cd /usr/lib/nagios/plugins

./check_nrpe -H <YourExchangeServer> -c <The script name, preferred: check_exchange_mailqueue>

Example:

./check_nrpe -H exch01.int.contoso.com -c check_exchange_mailqueue

this should output the following:

OK: All mail queues within limits. |'queue '=0;10;20;0

4b.) If that is working we could start to add the server to the nagios environment. At first we will add it as a new host via:

nano /etc/nagios3/conf.d/exserver1_nagios2.cfg

and past the following into it (adjust it to fits your needs)

define host{
        use                 generic-host
        host_name           exserver1.int.contoso.com
        alias               exserver1
        address             192.168.0.2
        }

We will do the same for the 2nd host we have:

nano /etc/nagios3/conf.d/exserver2_nagios2.cfg

and past the following into it (adjust it to fits your needs)

define host{
        use                 generic-host
        host_name           exserver2.int.contoso.com
        alias               exserver1
        address             192.168.0.3
        }

If you now perform a nagios reload:

/etc/init.d/nagios3 reload

and check the nagios website http://<YourNagiosServer>/nagios3/ you can see that a new server is visible there and the hostname should show a successfull response to a ping command and the server therefore should be online.

4c.) As we now with to have a Hostgroup called “Exchange” we will do the following:

xx

and add the following codebox at the bottom

# A list of your Microsoft Exchange servers
define hostgroup {
        hostgroup_name  ms-exchange
                alias           MS-Exchange servers
                members         exserver1.int.contoso.com,exserver2.int.contoso.com
        }

If you now perform a nagios reload:

/etc/init.d/nagios3 reload

and check the nagios website http://<YourNagiosServer>/nagios3/ you can see that a new hostgroup exists now with our exchange server.

4c.) We will now add the Exchange Mailqueue Service. So edit again our config from above via:

nano /etc/nagios3/conf.d/exserver1_nagios2.cfg

and below the host definition add the following:

define service {
        host_name                       exserver1.int.contoso.com
        service_description             Mail
        check_command                   check_nrpe_1arg!check_exchange_mailqueue
        use                             generic-service
        notification_interval           0
}

 

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Stay Connected

35FollowersFollow
- Advertisement -

Latest Articles