Linux Check Snmp Status

What is SNMP? 
SNMP stands for Simple Network Management Protocol. This Protocol is used to monitor device-device is connected to the network will be the system conditions are important. For example CPU usage, disk usage, memory usage, network traffic and others. For device-device that can be monitored is device-device such as a PC, Server, or router. While the Operating System could be Linux, * Nix, Windows, or the other.

With the SNMP does not need to check – check out one on one server, but you can simply access a computer to see the condition of the entire server and router. This is due to the server and the router will act as an SNMP-server whose job that provides SNMP requset from another computer. One PC will act as a SNMP Agent that is a computer that collects information from SNMP-servers.

In addition to being used to monitor SNMP can be used to actually make a change and give the new configuration to the server. But changing the system configuration on the server is only done when there is a change in the network infrastructure.

The values of variables that are accessed using the SNMP are organized in the form of a hierarchy. Type hierarchy and metadata (such as the type and description of variables) is set by the Management Information Bases

Set The SNMP Server
To start the SNMP set you need to install some programs, namely:

You can use yum, by means of:
# yum install net-snmp net-snmp-utils

Server SNMP for security using passwords that are referred to by the community. Although SNMPv1 and SNMPv2 not using system encryption on data transfer but both versions are still widely used by computer devices today. If you want to use with better security then it is strongly recommended you use SNMPv3.

For SNMP community settings in the trick is:
  • Move the original configuration file from SNMP you with another name. For that, use the command:
cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf
  • After that you create a new configuration file. And therein specify the password of the new community, for example I gave "adadeh":
vi /etc/snmp/snmpd.conf
Fill in with:
rocommunity adadeh
  • Restart service SNMP your server:
/etc/init.d/snmpd restart
  • Then check if your SNMP service is already running:
netstat -tanp|grep snmp
The result:
tcp  0   0*   LISTEN  3672/snmpd

Getting Server information with the SNMP Agent 
SNMP Agent is used to retrieve the information that is provided by the server. Where to get it you can use snmpwalk. Here's how:

# snmpwalk -v [versi] -c [community] [host] [OID]
-v [version] = shows the version of SNMP. Can version 1, 2 and 3.
-c [community] = SNMP community password from your server.
[host] = host dari SNMP server.
[OID] = is the object of the system that you want to show the already determined by the MIB. Suppose you want to display large CPU usage you write hrSystemProcesses.

For example I would like to get information about processes that are running, here's how
# snmpwalk -v 2c -c adadeh hrSWRunName

The result:
HOST-RESOURCES-MIB::hrSWRunName.2 = STRING: "kthreadd"
HOST-RESOURCES-MIB::hrSWRunName.3 = STRING: "migration/0"
HOST-RESOURCES-MIB::hrSWRunName.4 = STRING: "ksoftirqd/0"
HOST-RESOURCES-MIB::hrSWRunName.5 = STRING: "watchdog/0"
HOST-RESOURCES-MIB::hrSWRunName.6 = STRING: "events/0"
HOST-RESOURCES-MIB::hrSWRunName.7 = STRING: "khelper"
HOST-RESOURCES-MIB::hrSWRunName.59 = STRING: "kblockd/0"
HOST-RESOURCES-MIB::hrSWRunName.61 = STRING: "kacpid"

or view a percentage of the CPU usage you are using:
# snmpwalk -v 2c -c adadeh hrSystemProcesses

The result:
HOST-RESOURCES-MIB::hrSystemProcesses.0 = Gauge32: 94

Click here for Comments