Cool Solution - Monitoring UCC with nagios

From Univention Wiki

Revision as of 14:14, 5 September 2016 by Hpeter (talk | contribs)
Jump to: navigation, search
Produktlogo UCS Version 3.2
Produktlogo UCC Version 1.0

Note: Cool Solutions are articles documenting additional functionality based on Univention products. Not all of the shown steps in the article are covered by Univention Support. For questions about your support coverage contact your contact person at Univention before you want to implement one of the shown steps.

Also regard the legal notes at Terms of Service.


It's relatively easy to use Nagios to monitor UCS servers. The idea here is to show how to integrate Univention Corporate Clients (UCC) into the monitoring set up of an UCS-Nagios server.

We will first install the NRPE packages (Nagios Remote Plugin Executor) in UCC to make the system a Nagios client. As part of the set up we need to manually copy Nagios plugins to UCC.

Finally, the Nagios server has to be aware of this new clients to monitor. For that, we will generate the corresponding Nagios configuration for the UCC hostgroup.

UCC set up (Nagios client)

In some environments would be preferable to perform this steps within the image file before a roll out (by mounting it as described in the UCC Manual).

Install Nagios-NRPE packages (agent and plug-ins):

apt-get install nagios-nrpe-server

Accept monitoring from UCS-Nagios Server:

vi /etc/nagios/nrpe.cfg

Allow the Nagios server in nrpe.cfg:

#---
allowed_hosts=server.example.com
#---

For this set up it's helpful to use an UCS system that is already being monitored (it has the univention-nagios-client package installed). The idea is to copy the needed plug-ins and files into our UCC system.

Bring Univention Plug-ins from another nagios-monitored client (e.g. UCS slave):

scp  slave1.example.com:/etc/nagios-plugins/config/UNIVENTION* /etc/nagios/nrpe.d/

Note: If working on the UCC image, it could be better to move the files before performing the chroot to it.

Restart NRPE service

service nagios-nrpe-server restart

Note: This wouldn't have any effect if you are modifying an UCC image.

UCS set up (Nagios server)

Next step is to add the UCC host to be monitored, to each of the desired Nagios checks on the server.

Add the computer to the preconfigured check in udm:

udm nagios/service modify --dn cn=UNIVENTION_DISK_ROOT,cn=nagios,dc=example,dc=com --append assignedHosts='cn=ucc-client50,cn=computers,dc=example,dc=com'
udm nagios/service modify --dn cn=UNIVENTION_PING,cn=nagios,dc=example,dc=com --append assignedHosts='cn=ucc-client50,cn=computers,dc=example,dc=com'

Since the Nagios services attribute is not defined for UCC Objects, we will have to create this part manually. I suspect there are simpler ways to do this, but for now let us create a host file and add the new host to a hostgroup file.

Ceate a host for each client:

cd /etc/nagios3/conf.univention.d/hosts/
cp master.example.com.cfg ucc-client50.example.com.cfg 
vi ucc-client50.example.com.cfg 

Example of host file ucc-client.example.com.cfg:

#manually created
define host {
   host_name               ucc-client50.example.com
   alias                   ucc-client50.example.com
   address                 192.168.0.50
   check_command           check-host-alive
   max_check_attempts      10
   contact_groups          cg-ucc-client50.example.com
   notification_interval   180
   notification_period     Univention-Predefined-24x7
   notification_options    d,u,r
}

Create a hostgroup for the clients

cd /etc/nagios3/conf.univention.d/hostgrps/
cp dc_computers.cfg ucc_computers.cfg 
vi ucc_computers.cfg

Example of host group ucc_computers.cfg:

#Manually created
define hostgroup {
   hostgroup_name     ucc_computers
   alias              Hostgroup ucc_computers
   members            ucc-client50.example.com, ucc-client49.example.com, ucc-client48.example.com 
}

Restart Nagios service:

service nagios3 restart

Now you should be able to see the ucc_computers hostgroup in your Nagios Web interface. After some minutes the Plug-ins will start returning status information to the Nagios server.

References

Personal tools