Install and Configure Zenoss as Centralized Monitoring System

Good system administrator should know that they need to do these 3 most important things after delivering a server:

  • secure
  • monitor
  • backup

As part of monitoring task, in this tutorial, I am going to show on how to build a centralized monitoring system using Zenoss. Zenoss will need to use SNMP agent in every server that need to be monitored. If you have high number of servers, you should use Zenoss instead of Cacti or Nagios because it is easier to setup and maintain. The web-based management portal is really easy to understand and you can monitor a lot of things, not limited to SNMP MIB reporting only.

Zenoss has the community version which is free. The latest version of Zenoss at this date is version 4. Zenoss installer recommending user to use a clean server. But in my case, I will use a cPanel server which really not heavy in usage for this purpose. In order to run Zenoss in ‘not-so-clean’ server, I need to use Zenoss stack version 3. I will be using following variables:

OS: RHEL 5.3 64bit (Tikanga)
cPanel: 11.32.3 (build 23)
Zenoss server IP: 210.20.88.50
Server to be monitored: 177.60.52.200 and 81.71.46.44

Install Zenoss

1. Download the Zenoss stack version 3 at here http://sourceforge.net/projects/zenoss/files/zenoss-3.2/zenoss-3.2.1/. The file you should download is zenoss-stack-3.2.1-linux-x64.bin.

2. Give execute permission and install it. Follow and accept the default value of installation wizard:

$ chmod +x zenoss-stack-3.2.1-linux-x64.bin
$ ./zenoss-stack-3.2.1-linux-x64.bin

3. Make sure you open following port for Zenoss usage:

TCP: 8080
UDP: 514
UDP: 161
UDP: 162

4. Navigate to your browser and access Zenoss to create the admin user at http://210.20.88.50:8080/.

Enable SNMP

In all servers that need to be monitored, we need to install and enable SNMP agent. RHEL/CentOS 5 and 6 have some kind of different way on activating SNMP as example below:

Server #1 (177.60.52.200) – CentOS 5.6 64bit

1. Install and enable SNMP on startup:

$ yum install net-snmp
$ chkconfig snmpd on

2. Open /etc/hosts.allow using text editor and add following line:

snmpd: 210.20.88.50

This will allow Zenoss collector to connect to SNMP service of this server.

3. Run following command to add SNMP community string for Zenoss collector:

echo "rocommunity zenossreporting" > /etc/snmp/snmpd.conf

4. Disable SNMP informational logging. If you are not doing this, SNMP will flooding out your /var/log/message. Open /etc/sysconfig/snmpd.options and add following line:

OPTIONS="-LS 5 d -Lf /dev/null -p /var/run/snmpd.pid -a"

5. Save and restart SNMP service:

$ service snmpd start

6. Make sure UDP port 161 is open for SNMP collection.

Server #2 (81.71.46.44) – CentOS 6.2 64bit

1. Install and enable SNMP on startup:

$ yum install net-snmp
$ chkconfig snmpd on

2. Run following command to add SNMP community string for Zenoss collector:

echo "rocommunity zenossreporting" > /etc/snmp/snmpd.conf

3. Disable SNMP informational logging. If you are not doing this, SNMP will flooding out your /var/log/message. Open /etc/sysconfig/snmpd and add following line:

OPTIONS="-LS 5 d -Lf /dev/null -p /var/run/snmpd.pid -a"

4. Save and restart SNMP service:

$ service snmpd start

5. Make sure UDP port 161 is open for SNMP collection.

Configure Zenoss

1. Login into the Zenoss management portal at http://210.20.88.50:8080/ . Lets add a node to monitor. Go to INFRASTRUCTURE > Device > click the plus “+” icon and enter required information as screenshot below:

2. After added, we need to model the device. Select the device in the device list and select “Model Device” on the bottom left menu as screen host below:

3. This will build up the model based from Zenoss collector. You should see the left-side menu for the respective device appear following added menu:

4. Done. Your server load average, CPU utilization, memory utilization, disk IO, disk usage and network interface are being monitored now. You can repeat this step to all servers that need to be monitored.

 

Monitor Apache & MySQL using Zenoss

Zenoss has some kind of extension called ZenPacks used to monitor other services or processes. You just need to download and install the ZenPacks using Zenoss management portal. I will use ZenPacks to monitor Apache and MySQL as well.

1. Download ZenPacks for Apache and MySQL at here http://community.zenoss.org/community/zenpacks/:

Apache: http://community.zenoss.org/docs/DOC-3442
MySQL: http://community.zenoss.org/docs/DOC-3501

2. Upload and install both ZenPacks into Zenoss. Go to Zenoss > ADVANCED > ZenPacks > click the gear icon > Install ZenPack..

3. You need to restart Zenoss for this. Login into the server via SSH and run following command:

$ service zenoss-stack restart

4. Login into the server that we need to monitor Apache and MySQL via SSH. We need to create the Apache server-status page for Apache monitoring plugin. Open main httpd.conf file which usually located under /etc/httpd/conf/httpd.conf and add following line:

ExtendedStatus On
 
<Location /server-status>
   SetHandler server-status
   Order deny,allow
   Deny from all
   Allow from 210.20.88.50
</Location>

5. For cPanel servers, you may need to run following command to retain the httpd.conf in case if cPanel rebuild the httpd.conf file:

$ /usr/local/cpanel/bin/apache_conf_distiller --update --main

6. Restart Apache to apply the changes:

$ service httpd restart

7. Login into MySQL via console and run following SQL line:

mysql> grant usage on *.* to [email protected]'%' identified by 'zenP455w0rd';

8. Go back to Zenoss portal for the device. Go to Configuration Properties and find following fields and update the value:

zMySqlPassword = zenP455w0rd
zCollectorClientTimeout = 300
zSnmpTimeout = 5
zSnmpTries = 4

9. Last step is to bind the Apache and MySQL monitoring templates into the device monitoring properties. Go to gear icon on bottom-left menu and click Bind Templates and select both templates to the right side as screen shot below:

Open Zenoss > INFRASTRUCTURE > Devices > server name > Graphs and wait for a while. You should see a complete monitoring graph as screenshot below in this page: