Install Nagios Core 4.1.1 in Debian Jessie Part 4

We already have Nagios working and our optionals clients. Now we have to configure our clients.

Installing Check_MK Agent

Preparing centralized repository

To get all the files together and make easily to deploy new host, I created a directory on my Nagios to put all the installers.

cd /usr/src
wget https://github.com/lplinux/scripts/raw/master/mk_agents.tar.gz
tar xvzf mk_agents.tar.gz  -C /var/www/
chown -R www-data:www-data /var/www/mk_agents/

Configuring Apache

To get access to the installer from any host in the network, we have to add this block to our Apache configuration:

vim /etc/apache2/sites-available/mk_agents.conf
Alias /mk_agents "/var/www/mk_agents"

<Directory "/var/www/mk_agents">
#       Require all granted
        AllowOverride None
        Order allow,deny
        Allow from all
        #
        # Use the same value as defined in nagios.conf
        #
        AuthName "MK Agent Download Center"
        AuthType Basic
        AuthUserFile /var/www/mk_agents/htpasswd.users
        Require valid-user
        <IfModule mod_rewrite.c>
                # Turn on URL rewriting
                RewriteEngine On
                Options FollowSymLinks
                # Installation directory
                RewriteBase /mk_agents
                # Protect application and system files from being viewed
                RewriteRule "^(?:application|modules|system)/" - [F]
                # Allow any files or directories that exist to be displayed directly
                RewriteCond "%{REQUEST_FILENAME}" !-f
                RewriteCond "%{REQUEST_FILENAME}" !-d
        </IfModule>
</Directory>

cd /etc/apache2/sites-enabled
ln -s ../sites-available/mk_agents.conf mk_agents.conf
apache2ctl configtest
Syntax OK

apache2ctl graceful

Installing Check_MK Agent

On client side we have to install our agent. To do that I made a script that detects our Linux version and install the check_mk_agent and its dependencies.

cd /tmp
wget https://raw.githubusercontent.com/lplinux/scripts/master/install_check_mk.sh
chmod +x install_check_mk.sh
./install_check_mk.sh 10.50.40.101

And then, we could check if Xinetd is running:

netstat -putanl|grep xine
tcp        0      0 0.0.0.0:6556            0.0.0.0:*               LISTEN      517/xinetd

 

NOTE: This script uses an user/password that is already created on /var/www/mk_agents/htpasswd.users. You should change the credentials just in case. 10.50.40.101 is Nagios’s IP.

SNMPD Client

Installation

On Centos/Redhat

yum -y install net-snmp net-snmp-utils

On Debian/Ubuntu

apt-get install -y snmpd

Configuration

We have to edit the snmpd config file:

vim /etc/snmp/snmpd.conf

Here, we need to comment the default listen port:

#agentAddress udp:127.0.0.1:161

And add this two lines to give access using <code>”nagios”</code>  community to our nagios server.

agentAddress udp:161
rocommunity nagios 10.50.40.101/32

And restart the service:

service snmpd restart

 

Adding the new server

Login into Check_MK interface and go to WATO-Configuration => Hosts
Add_Host_Using_WATO_01

Then to “Create New Host”.

Add_Host_Using_WATO_02
Using Check_MK Agent
Using SNMPD
Using SNMPD

Now we click on “Save & go to Services”

Add_Host_Using_WATO_03
Using Check_MK Agent
Add_Host_Using_WATO_09
Using SNMPD

“Save manual check configuration”

Add_Host_Using_WATO_04

And “Apply changes”

Add_Host_Using_WATO_05

Add_Host_Using_WATO_06

Go to “Views” => “Services” => “All services” and you should see the new host and its services.

Add_Host_Using_WATO_07

The yellow star belongs to the PNP4Nagios graphs for that service.

Reference Links:

Print Friendly

Pablo Javier Furnari

Linux System Administrator at La Plata Linux
I'm a Linux Sysadmin with 8 years of experience. I work with several clients as a consulter here in Argentina and oversea (I have clients in the United States, Mexico, Pakistan and Germany).

I know my strengths and weaknesses. I'm a quick learner, I know how to work with small and big teams. I'm hard worker, proactive and I achieve everything I propose.

Leave a Reply

Your email address will not be published. Required fields are marked *


CAPTCHA Image
Reload Image