Nagios is used for Network Monitoring Services. The Linux System Administrator use it. The SNMP is abbreviated as Simple Network Management Protocol. Set of rules of network for managing complex networks in this tutorial we are dealing with the how to install and integrate the SNMP with the Nagios  to monitor the Remote Linux Machines.

Step-1 (Installation of SNMP on respective Remote Linux Machine)

First of all Starting of Remote Linux Machines and Login using root Credentials

Then On CentOS / RHEL / Scientific Linux / Oracle Linux and all RPM based Systems

# dnf install net-snmp

After that On Ubuntu Server / Debian / Linux Mint / Kali Linux and all DEB based systems

# apt install snmpd
Step-2 (Create the snmpd.conf file and add the following lines on it)
# cd /etc/snmp
# cp snmpd.conf snmpd.conf.bak
# vim snmpd.conf

Secondly Add the following lines

Also Read  AlmaLinux Offers Free Replacement of CentOS
# rocommunity public <Your Nagios IP Address>/<Port Number of Nagios>

:wq (Save and Exit)

Step-3 (Restart the snmpd Services)

Then On CentOS / RHEL / Scientific Linux / Oracle Linux  and all RPM based Systems

# service snmpd restart

After that On Ubuntu Server / Debian / Linux Mint / Pear OS / Kali Linux and all DEB based systems

# service snmpd restart
Step-4 (Edit the Firewall Settings)

Finally On Firewall Settings White-list the SNMP UDP Port 161 to allow queries

Using IPtables command

# iptables -I INPUT -p udp –-destination-port 161 -j ACCEPT /etc/init.d/iptables save

As soon as Modifying host file

# vim /etc/hosts.allow

finally add the allowed address of Nagios host Here on port 161

Also Read  How to Fix Installation Failed at Boot /dev/root Does Not Exist on CentOS 7 / RHEL 8
Step-5 (Add SNMP daemon automatically on every system restart)

Then On CentOS / RHEL / Scientific Linux / Oracle Linux and all RPM based Systems

# systemctl enable snmpd

After that On Ubuntu Server / Debian / Linux Mint / Kali Linux and all DEB based systems

# systemctl start snmpd
Step-6 (The SNMP is Configured )
# cd /usr/local/nagios/libexec
# ./check_snmp_storage.pl -H <Your  SNMP IP Address>

Final Results

  • Correct Configuration : Above command return data
  • Wrong Configuration : Above command doesn’t return data

Congratulations now you have monitor remote Linux Machine using SNMP with NagiOS.