Networknet archive Blog

CactiEZ: Configure SNMP on CentOS

Originally published Last updated 1 comment

I have been running the CactiEZ VMware appliance for a while. Some graphs I wanted were not covered by its SNMP configuration.

CactiEZ is based on the CentOS Linux distribution.

Check that the SNMP daemon is running

Code3 lines
1
2
3
[root@CACTI-04 /]# ps -ef | grep snmp
root 29283 1 0 Jan06 ? 00:00:00 /usr/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd -a
[root@CACTI-04 /]#

Rename the default configuration file

Code4 lines
1
2
3
4
[root@CACTI-04 /]# mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.org
[root@CACTI-04 /]# ls /etc/snmp/
snmpd.org
[root@CACTI-04 /]#

Create a new SNMP configuration

Code50 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
[root@CACTI-04 /]# vi /etc/snmp/snmpd.conf
###########################################################################
#
# snmpd.conf
#
# - created by the snmpconf configuration program
#
###########################################################################
# SECTION: System Information Setup
#
# This section defines some of the information reported in
# the "system" mib group in the mibII tree.
# syslocation: The [typically physical] location of the system.
# Note that setting this value here means that when trying to
# perform an snmp SET operation to the sysLocation.0 variable will make
# the agent return the "notWritable" error code. IE, including
# this token in the snmpd.conf file will disable write access to
# the variable.
# arguments: location_string
syslocation NETWORKNET
# syscontact: The contact information for the administrator
# Note that setting this value here means that when trying to
# perform an snmp SET operation to the sysContact.0 variable will make
# the agent return the "notWritable" error code. IE, including
# this token in the snmpd.conf file will disable write access to
# the variable.
# arguments: contact_string
syscontact Ivan Versluis
###########################################################################
# SECTION: Access Control Setup
#
# This section defines who is allowed to talk to your running
# snmp agent.
# rocommunity: a SNMPv1/SNMPv2c read-only access community name
# arguments: community [default|hostname|network/bits] [oid]
rocommunity net_ro_public
###########################################################################
# SECTION: Agent Operating Mode
#
# This section defines how the agent will operate when it
# is running.
# agentaddress: The IP address and port number that the agent will listen on.
# By default the agent listens to any and all traffic from any
# interface on the default SNMP port (161). This allows you to
# specify which address, interface, transport type and port(s) that you
# want the agent to listen on. Multiple definitions of this token
# are concatenated together (using ':'s).
# arguments: [transport:]port[@interface/address],...
agentaddress 127.0.0.1:161
ESC and :wq! to save and exit the file.

Reload and check the configuration

Reload snmpd.conf and verify the SNMP configuration with snmpread.

Code3 lines
1
2
3
[root@CACTI-04 /]# service snmpd reload
Reloading snmpd: [ OK ]
[root@CACTI-04 /]#

Add the device in Cacti

Open Devices in Cacti and choose to add a new host.

clip_image002

After adding the CentOS device, reopen it. The SNMP information should appear as in my example below.

CACTI-04 (127.0.0.1)

Code6 lines
1
2
3
4
5
6
SNMP Information
System: Linux CACTI-04.almatis.internal 2.6.9-34.EL #1 Wed Mar 8 00:07:35 CST 2006 i686
Uptime: 12822505
Hostname: CACTI-04.networknet.nl
Location: NETWORKNET
Contact: Ivan Versluis

Create the graphs

The last step is to create new graphs. Depending on the chosen host template, these can show CPU, memory and NIC data.

NIC

clip_image004

CPU

clip_image006

Memory

clip_image008

1 comment

Comments from the original WordPress site, kept read-only.

  1. Chris

    Hello, I am trying to figure out why cacti is not graphing some data and I see errors in getting the SNMP data in my cacti logs so I came to your site. I just thought I would let you know it is very hard to read your "code" because there are HTML tags inside your "code" view on your blog. I would use a better plugin.