{"id":1735,"date":"2018-12-15T10:59:45","date_gmt":"2018-12-15T07:59:45","guid":{"rendered":"http:\/\/kifarunix.com\/?p=1735"},"modified":"2024-03-11T21:44:02","modified_gmt":"2024-03-11T18:44:02","slug":"nagios-snmp-monitoring-of-linux-hosts-on-alienvault-usm-ossim","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/nagios-snmp-monitoring-of-linux-hosts-on-alienvault-usm-ossim\/","title":{"rendered":"Nagios SNMP Monitoring of Linux Hosts on AlienVault USM\/OSSIM"},"content":{"rendered":"\n
In this guide, we are going to learn how to configure Nagios SNMP monitoring of Linux hosts. We will be using AlienVault USM\/OSSIM as our Nagios server. Just like we have stated in our previous articles, AlienVault uses Nagios by default for monitoring hosts. In order to monitor hosts, you can use the agent-based or agentless method.<\/p>\n\n\n\n
Agent-based method involves installation of Nagios plugins and NRPE agents on the remote host while the agentless method involves the use of protocol such as SNMP to poll remote system metrics. This guide describes how to install and configure Nagios SNMP monitoring for polling Linux system metrics such as;<\/p>\n\n\n\n
You might want to check our previous article on configuring Nagios availability monitoring on AlienVault USM\/OSSIM<\/a>.<\/p>\n\n\n\n Before you can proceed, ensure that you have installed and configure SNMP on the remote devices to be monitored. See our previous article on how to install and configure SNMP on Ubuntu 18.04\/CentOS 7. See our guide on how to Install and Configure SNMP on Ubuntu 18.04 and CentOS 7<\/a>.<\/p>\n\n\n\n Add hosts to monitor to AlienVault server. Check our previous article on how to Import assets to AlienVault USM\/OSSIM using a CSV file<\/a>.<\/p>\n\n\n\n Create an asset group to put together hosts that share a common functionality, for example Linux Servers. After that, enable availability monitoring for the group.<\/p>\n\n\n\n Enabling availability monitoring will help automate the creation of Nagios hosts and hostgroup definition configuration files. All you need to do is to set the command<\/strong> and service<\/strong> definition for your asset group.<\/p>\n\n\n\n Login to the AlienVault USM\/OSSIM backend and navigate to Nagios configuration directory, If you can check, the hosts<\/strong> directory will contain the host definition configurations while hostgroups<\/strong> directory contain the hostgroup definition configuration file.<\/p>\n\n\n\n By default, AlienVault ships with Nagios SNMP monitoring plugins called Before you can proceed, ensure that you have the SNMP authentication details. For SNMP v2c, ensure you have created the community and for SNMP v3 ensure that you have the username and the authentication password.<\/p>\n\n\n\n Also ensure that you have the In this guide, we are going to use the default Nagios SNMP monitoring plugin, Obtain the community from the hosts and verify from the AlienVault or Nagios server that the host services can be queried before you can proceed to define your commands and services.<\/p>\n\n\n\n Beautiful. Everything seems to be working well. Proceed to create command and service definitions for your host servers.<\/p>\n\n\n\n If you are using SNMP version 3, you would run the check_snmp command with the syntax;<\/p>\n\n\n\n For example, to check system Uptime with SNMP version 3;<\/p>\n\n\n\n You can learn how to configure SNMP v2c and 3 on Debian 9 by following the links below;<\/p>\n\n\n\n How to Configure SNMP Version 2c on Debian 9<\/a><\/p>\n\n\n\nMonitoring of Linux Hosts with Nagios using SNMP<\/h2>\n\n\n\n
Enable Nagios Availability Monitoring<\/h4>\n\n\n\n
Configure Nagios SNMP Monitoring of Linux Hosts<\/h2>\n\n\n\n
cd \/etc\/nagios3\/conf.d\/<\/code>. Under this directory there is a directory called
ossim-configs<\/code> which contains the hosts and hostgroups definition configuration files that are auto created when you enable availability monitoring for hostgroup from AlienVault Web UI.<\/p>\n\n\n\n
ls \/etc\/nagios3\/conf.d\/ossim-configs\/ <\/code><\/pre>\n\n\n\n
host-services hostgroup-services hostgroups hosts<\/strong><\/code><\/pre>\n\n\n\n
ls \/etc\/nagios3\/conf.d\/ossim-configs\/hosts<\/code><\/pre>\n\n\n\n
192.168.43.154.cfg 192.168.43.23.cfg<\/strong><\/code><\/pre>\n\n\n\n
less \/etc\/nagios3\/conf.d\/ossim-configs\/hostgroups<\/strong>\/Linux\\ Servers.cfg\n<\/strong><\/code><\/pre>\n\n\n\n
\ndefine hostgroup{\n hostgroup_name Linux Servers\n alias Linux Servers\n members ubuntu,centos7<\/strong>\n }\n<\/code><\/pre>\n\n\n\n
Configure Nagios SNMP Monitoring Commands<\/h2>\n\n\n\n
check_snmp<\/code>. The plugins are located under
\/usr\/lib\/nagios\/plugins\/<\/code>.<\/p>\n\n\n\n
ls \/usr\/lib\/nagios\/plugins\/ | grep snmp<\/code><\/pre>\n\n\n\n
check_snmp<\/code><\/pre>\n\n\n\n
Object Identifiers (OIDs)<\/code> for whatever service you want to monitor. You can find the common OIDs on OID Repository page<\/a>.<\/p>\n\n\n\n
check_snmp<\/code>, to monitor uptime, running processes, CPU load average and logged in users while for monitoring disk and physical memory usage, we are going to use this beautiful
check_snmp_disk<\/code> perl script that somebody else has made an effort to create. Therefore download the check_snmp_disk<\/a> perl script and place it under the default Nagios plugins directory on AlienVault USM,
\/usr\/lib\/nagios\/plugins\/<\/code>.<\/p>\n\n\n\n
Check for Uptime<\/h4>\n\n\n\n
\/usr\/lib\/nagios\/plugins\/check_snmp -H 192.168.43.154 -C Ex@mPL3 -o .1.3.6.1.2.1.1.3.0<\/code><\/pre>\n\n\n\n
SNMP OK - Timeticks: (4240427) 11:46:44.27 |<\/code><\/pre>\n\n\n\n
Running processes<\/h4>\n\n\n\n
\/usr\/lib\/nagios\/plugins\/check_snmp -H 192.168.43.154 -C Ex@mPL3 -o .1.3.6.1.2.1.25.1.6.0 -w 300 -c 400<\/code><\/pre>\n\n\n\n
SNMP OK - 117 | iso.3.6.1.2.1.25.1.6.0=117<\/code><\/pre>\n\n\n\n
Load Average<\/h4>\n\n\n\n
\/usr\/lib\/nagios\/plugins\/check_snmp -H 192.168.43.154 -C Ex@mPL3 -o .1.3.6.1.4.1.2021.10.1.3.1 -w 2.0 -c 5.0<\/code><\/pre>\n\n\n\n
SNMP OK - 0 | iso.3.6.1.4.1.2021.10.1.3.1=0<\/code><\/pre>\n\n\n\n
Logged In Users<\/h4>\n\n\n\n
\/usr\/lib\/nagios\/plugins\/check_snmp -H 192.168.43.154 -C Ex@mPL3 -o .1.3.6.1.2.1.25.1.5.0 -w 5 -c 10<\/code><\/pre>\n\n\n\n
SNMP OK - 2 | iso.3.6.1.2.1.25.1.5.0=2<\/code><\/pre>\n\n\n\n
Disk Usage<\/h4>\n\n\n\n
\/usr\/lib\/nagios\/plugins\/check_snmp_disk -H 192.168.43.23 -s Ex@mPL3 -d \/ -w 80% -c 90%<\/code><\/pre>\n\n\n\n
SNMP OK - \/ at 16% with 6,788 of 8,178 MB free<\/code><\/pre>\n\n\n\n
RAM Usage<\/h4>\n\n\n\n
\/usr\/lib\/nagios\/plugins\/check_snmp_disk -H 192.168.43.23 -s Ex@mPL3 -d 1 -w 80% -c 90%<\/code><\/pre>\n\n\n\n
SNMP OK - Physical memory at 61% with 188 of 487 MB free<\/code><\/pre>\n\n\n\n
\/usr\/lib\/nagios\/plugins\/check_snmp -H HOSTADDRESS -P 3 -L authPriv -U
[username]<\/code> -a [MD5|SHA] [-A authpass] -x [AES|DES] [-X privpass] -o [OID]<\/code><\/pre>\n\n\n\n
\/usr\/lib\/nagios\/plugins\/check_snmp -H 192.168.43.188 -P 3 -L authPriv -U snmpreadonly -a SHA -A PassWORD123 -x AES -X pAssWORD321 -o .1.3.6.1.2.1.1.3.0<\/code><\/pre>\n\n\n\n
SNMP OK - Timeticks: (685) 0:00:06.85 |<\/code><\/pre>\n\n\n\n