1

Install and Configure SNMP on Centos                                                                                  https://www.unixmen.com/cacti-monitor-linux-servers-using-snmp/

1- Install SNMP and SNMP Utilities

Installing SNMP and some optional SNMP utilities is as simple as running one command:

yum -y install net-snmp net-snmp-utils

2- Add a Basic Configuration for SNMP

Now, let’s take the default SNMP configuration file, /etc/snmp/snmpd.conf and move it to an alternate location,/etc/snmp/snmpd.conf.orig.

mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig

And now we’ll create a new /etc/snmp/snmpd.conf:

vim /etc/snmp/snmpd.conf

Insert the following text into the new /etc/snmp/snmpd.conf

# Map 'tes90w90t' community to the 'AllUser' #       sec.name        source          community com2sec AllUser         default         tes90w90t  # Map 'ConfigUser' to 'ConfigGroup' for SNMP Version 2c # Map 'AllUser' to 'AllGroup' for SNMP Version 2c #                       sec.model       sec.name group   AllGroup        v2c             AllUser  # Define 'SystemView', which includes everything under .1.3.6.1.2.1.1 (or .1.3.6.1.2.1.25.1) # Define 'AllView', which includes everything under .1 #                       incl/excl       subtree view    SystemView      included        .1.3.6.1.2.1.1 view    SystemView      included        .1.3.6.1.2.1.25.1.1 view    AllView         included        .1  # Give 'ConfigGroup' read access to objects in the view 'SystemView' # Give 'AllGroup' read access to objects in the view 'AllView' #                       context model   level   prefix  read            write   notify access  AllGroup        ""      any     noauth  exact   AllView         none    none

The above text is noted with basic information on the function of each configuration line. In short, we’re creating this scenarios for the polling

AllUser is assigned to AllGroup and may only use SNMP security model 2c , AllGroupcan use the AllView .

AllView is assigned to the entire OID tree, and all of this is referenced in an SNMP poll by the secret, and unique community string tes90w90t.

Exit vim, and restart the SNMP service to reload the new configuration file:

service snmpd restart

Configure SNMP to start when the server boots:

chkconfig snmpd on

3- Test the SNMP Configuration

If you have a firewall configured, ensure that you have UDP port 161 open to your SNMP lookup server.

On your SNMP lookup server, you can do the following to perform a quick SNMP test to ensure that it’s working.

snmpwalk -v 2c -c tes90w90wer -O e 127.0.0.1 

you should get an output like below :

SNMPv2-MIB::sysDescr.0 = STRING: Linux 2.6.18-194.11.4.el5xen #1 SMP Tue Sep 21 05:40:24 EDT 201 0 x86_64 SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (242211) 0:40:22.11 SNMPv2-MIB::sysContact.0 = STRING: root@localhost SNMPv2-MIB::sysName.0 = STRING:  SNMPv2-MIB::sysLocation.0 = STRING: Unknown SNMPv2-MIB::sysORLastChange.0 = Timeticks: (2) 0:00:00.02 SNMPv2-MIB::sysORID.1 = OID: SNMPv2-MIB::snmpMIB SNMPv2-MIB::sysORID.2 = OID: TCP-MIB::tcpMIB SNMPv2-MIB::sysORID.3 = OID: IP-MIB::ip SNMPv2-MIB::sysORID.4 = OID: UDP-MIB::udpMIB SNMPv2-MIB::sysORID.5 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup SNMPv2-MIB::sysORID.6 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance SNMPv2-MIB::sysORID.7 = OID: SNMP-MPD-MIB::snmpMPDCompliance SNMPv2-MIB::sysORID.8 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance

Configuring Cacti to Monitor Linux Servers

Once that is done you will need to add the new box as a device on your Cacti web interface. I wont go into much detail with that in this post, but here’s a quick walk-through.

To add devices, we login as admin and go to console in the Cacti admin panel. We click Console > Devices.

There may already be a device named ‘localhost’. We do not need it as we will create fresh graphs. We can delete this device from the list. We add a new device by using the ‘add’ button.

Next, we set the device parameters.

Now that the device has been added, we specify the graph templates that we want to create. This section can be found in the bottom section of the page.

And then we proceed to creating the graphs.

Here, we create graphs for load average, RAM and hard disk, processor.

Interface Graphs and 64-bit Counters

By default, Cacti uses 32-bit counters in SNMP queries. 32-bit counters are sufficient for most bandwidth graphs, but they do not work correctly for graphs greater than 100 Mbps. If it is known that the bandwidth will exceed more than 100 Mbps, it is always advisable to use 64-bit counters. Using 64-bit counters is not hard at all.

Note: It takes around 15 minutes for Cacti to populate new graphs. There are not alternatives to being patient.

Creating Graph Trees

To create a new graph tree, select the Graph Trees menu item under the Management header. Select Add on this page to create a new tree.

The following page will prompt you for a tree name, which will be used to identify the graph tree throughout Cacti.

Along with the Name, you may select one of four currently supported Sorting Types

We can verify the graph in the graph tree.

User Management

Finally, we create a user with view permission to only the graph that we have created. Cacti enables you to create users that are tailored specifically to their requirements. Each user has certain settings such as login actions, as well as graph viewing settings. There are also two levels of permissions control, realm permissions and graph permissions which enable you to control what the user can see and change.

To create a new user, select the User Management item under the Utilities heading on the Cacti menu. Once at the user management screen, click Add.

At minimum, you must specify a User Name and a Password for each user.

To enable or disable a set of or a single user, select the User Management item under the Utilities heading on the Cacti menu. Once at the user management screen, select the user(s) you would like to enable or disable and select enable or disable from the Action selection box, click Go to continue.

After completing these steps, we can log in with the user ‘user1’ and verify that only this user is able to view the graph.

And thus we have deployed a Cacti server in the network monitoring system. Cacti servers are stable, and can deal with tons of graphs without any problems.

Now you have access to Cacti’s graphing capabilities.

Hope this helps and enjoy your monitoing platform!