Linux Server Monitoring using SNMP (Simple Network Management Protocol) Nagios

If you would like to monitor servers agent less ultimately the best solution is SNMP (Simple Network Management Protocol). Agent less server monitoring using Nagios. In this Article we are going to see how to Linux server Monitoring Using SNMP Nagios.

Why you would like to go with an Agent less monitoring? because when your server is already in production but you don’t want to modify / Install extra packages in them. In this case simple method is enabling SNMP in client which send traps to Nagios server.

Linux Server Monitoring Using SNMP Nagios

Open SNMP communication from Linux client and monitor using Nagios. Let’s see what are steps we have to follow in order to configure.

Complete Step by step guide for SNMP Installation and configuration

[root@Arkit-Serv~]# vi /etc/snmp/snmpd.conf

rocommunity commstring NAGIOS-SERVER-IP

:wq

Just check from Nagios server that SNMP is responding properly, if you get output like below then its working fine.

./check_snmp -H 192.168.1.23 -o .1.3.6.1.2.1.1.3.0 -C commstring
SNMP OK - Timeticks: (60558317) 7 days, 0:13:03.17 |

Define Commands

define command {
 command_name check_service_snmp
 command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
}

Now Define your Host and Service Definitions

###############################################################
# #
# ::: Host Defination ::: #
###############################################################

define host {
 host_name LinuxServer.arkit.co.in
 use generic_host
 address 192.168.1.2
 hostgroups linux-servers
 max_check_attempts 5
 check_interval 5
 retry_interval 1
 check_period 24x7
 contacts Linuxadmin
 contact_groups LinuxGroup
 notification_interval 0
 notification_period 24x7
 notifications_enabled 1
 }

###############################################################
# #
# ::: Service Defination ::: #
###############################################################
define service {
 host_name LinuxServer.arkit.co.in
 service_description / Disk Usage
 use Linuxsnmp_storage
 check_command check_service_snmp! -C commstring --v2c -m "^/$" -w 90 -c 95 -f
 max_check_attempts 5
 check_interval 10
 retry_interval 1
 check_period 24x7
 notification_interval 0
 notification_period 24x7
 contacts Linuxadmin
 contact_groups LinuxGroup
 }

define service {
 host_name LinuxServer.arkit.co.in
 service_description CPU Usage
 use linuxsnmp_load
 check_command check_service_snmp! -C commstring --v2c -w 90 -c 95 -f
 max_check_attempts 5
 check_interval 10
 retry_interval 1
 check_period 24x7
 notification_interval 0
 notification_period 24x7
 contacts Linuxadmin
 contact_groups LinuxGroup

}

define service {
 host_name LinuxServer.arkit.co.in
 service_description Memory Usage
 use Linuxsnmp_storage
 check_command check_service_snmp! -C commstring --v2c -m Physical -w 90 -c 95 -f
 max_check_attempts 5
 check_interval 10
 retry_interval 1
 check_period 24x7
 notification_interval 0
 notification_period 24x7
 contacts Linuxadmin
 contact_groups LinuxGroup

}

define service {
 host_name LinuxServer.arkit.co.in
 service_description Ping
 use genericnetdevice_ping_service
 check_command check-host-alive
 max_check_attempts 5
 check_interval 10
 retry_interval 1
 check_period 24x7
 notification_interval 0
 notification_period 24x7
 notifications_enabled 1
 contacts Linuxadmin
 contact_groups LinuxGroup

}

define service {
 host_name LinuxServer.arkit.co.in
 service_description Swap Usage
 use Linuxsnmp_storage
 check_command check_service_snmp! -C commstring --v2c -m 'Swap' -w 90 -c 95 -f
 max_check_attempts 5
 check_interval 10
 retry_interval 1
 check_period 24x7
 notification_interval 0
 notification_period 24x7
 contacts Linuxadmin
 contact_groups LinuxGroup

}

 That’s it Go and see in your Nagios web console you can see all specified service status.

Nagios Linux

Nagios Linux

Conclusion:

If you have Network latency / Network slowness then you will so many false positive alarms from Monitoring tool. If you use NRPE client which reduce little bit of false positive alerts. Nagios Server resource utilization will go high when you use SNMP. Linux server monitoring using snmp

Related Articles

Core 4 Installation and configuration

Consolidate reports for Hosts and Services

Installing and Configuring NRPE Client

Monitoring Linux Using NRPE Client

Thanks for your wonderful Support and Encouragement