Difference between revisions of "Cool Solution - Monitoring UCC with nagios"

From Univention Wiki

Jump to: navigation, search
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Cool Solutions Disclaimer|Repository=no|UCS=3.2|UCC=1.0}}
+
{{Version|UCS=4.1}}
= Introduction =
+
{{Version|UCC=3.0}}
 +
{{Cool Solutions Disclaimer|Repository=no}}
 +
{{#seo:
 +
|title={{#replace:{{#replace:{{#replace:{{#replace:{{FULLPAGENAME}}|'|'}}|&|&}}|"|"}}|Cool Solution - |}} - {{SITENAME}}
 +
<!--|description=-->
 +
}}
  
It's relatively easy to use [http://docs.univention.de/manual-3.2.html#nagios::general 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.
+
It's relatively easy to use [http://docs.univention.de/manual-3.2.html#nagios::general Nagios to monitor UCS servers]. The idea here is to show how to integrate Univention Corporate Clients (UCC) into the monitoring setup 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.  
+
We will first install the NRPE packages (Nagios Remote Plugin Executor) in UCC to make the system a Nagios client. As part of the setup, 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.
+
Finally, the Nagios server has to be aware of these new clients to monitor. For that, we will enable the Nagios services for the UCC hosts.
  
= UCC set up (Nagios client) =
+
{{TOC}}
  
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 [http://docs.univention.de/ucc-manual-1.0.html#imagegen:modify UCC Manual]).
+
== UCC setup (Nagios client) ==
  
Install Nagios-NRPE packages (agent and plug-ins):
+
'''Note:''' In some environments, it would be preferable to perform these steps within the image file before a roll out (by mounting it as described in the [http://docs.univention.de/ucc-manual-1.0.html#imagegen:modify UCC manual]).
 +
 
 +
Install the Nagios NRPE packages (agent and plug-ins):
 
  apt-get install nagios-nrpe-server
 
  apt-get install nagios-nrpe-server
  
Accept monitoring from UCS-Nagios Server:
+
Open '''/etc/nagios/nrpe.cfg''' with an editor and allow the Nagios server as host in the nrpe.cfg file:
vi /etc/nagios/nrpe.cfg
 
 
 
Allow the Nagios server in nrpe.cfg:
 
 
  #---
 
  #---
 
  allowed_hosts=server.example.com
 
  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.
+
Now you need to copy the needed Univention plug-ins from your Nagios server onto our UCC system:
 
+
  scp server.example.com:/etc/nagios/nrpe.univention.d/* /etc/nagios/nrpe.d/
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.
 
'''Note:''' If working on the UCC image, it could be better to move the files before performing the chroot to it.
  
 
Restart NRPE service
 
Restart NRPE service
 
  service nagios-nrpe-server restart
 
  service nagios-nrpe-server restart
'''Note:''' This wouldn't have any effect if you are modifying an UCC image.
+
'''Note:''' This won'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
+
== UCS setup (Nagios server) ==
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:
+
The next step is to set the UCC host to be monitored.
#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:
+
For this, you have to open the Univention Management Console and switch to the "Computers" module.<br>
service nagios3 restart
+
Now open the settings of the UCC host, switch to the "Options" tab and tick the "Nagios support" option<br>
 +
As the final step, you have to assign the Nagios services "UNIVENTION_DISK_ROOT" and "UNIVENTION_PING" in the "Advanced settings" tab below "Nagios services".
  
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.
+
Now you should be able to see the computer in your Nagios web interface. After some minutes the plug-ins will start returning status information to the Nagios server.
  
= References =
+
== References ==
* Univention Nagios - http://docs.univention.de/manual-3.2.html#nagios::general
+
* Univention Nagios - http://docs.univention.de/manual-4.1.html#nagios::general
 
* NRPE Monitoring - http://library.nagios.com/library/products/nagiosxi/documentation/487-monitoring-hosts-using-nrpe
 
* NRPE Monitoring - http://library.nagios.com/library/products/nagiosxi/documentation/487-monitoring-hosts-using-nrpe
* UCC manual - Modifying an image - http://docs.univention.de/ucc-manual-1.0.html#imagegen:modify
+
* UCC manual - Modifying an image - http://docs.univention.de/ucc-manual-3.0.html#imagegen:modify

Latest revision as of 14:03, 8 September 2017

Produktlogo UCS Version 4.1
Produktlogo UCC Version 3.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 setup 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 setup, we need to manually copy Nagios plugins to UCC.

Finally, the Nagios server has to be aware of these new clients to monitor. For that, we will enable the Nagios services for the UCC hosts.

UCC setup (Nagios client)

Note: In some environments, it would be preferable to perform these steps within the image file before a roll out (by mounting it as described in the UCC manual).

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

apt-get install nagios-nrpe-server

Open /etc/nagios/nrpe.cfg with an editor and allow the Nagios server as host in the nrpe.cfg file:

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

Now you need to copy the needed Univention plug-ins from your Nagios server onto our UCC system:

scp server.example.com:/etc/nagios/nrpe.univention.d/* /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 won't have any effect if you are modifying an UCC image.

UCS setup (Nagios server)

The next step is to set the UCC host to be monitored.

For this, you have to open the Univention Management Console and switch to the "Computers" module.
Now open the settings of the UCC host, switch to the "Options" tab and tick the "Nagios support" option
As the final step, you have to assign the Nagios services "UNIVENTION_DISK_ROOT" and "UNIVENTION_PING" in the "Advanced settings" tab below "Nagios services".

Now you should be able to see the computer in your Nagios web interface. After some minutes the plug-ins will start returning status information to the Nagios server.

References

Personal tools