This HowTo will explain how to graph multiple device by querying a single host, using an SNMP proxy and "contexts".
It's useful if you don't want/can't open many firewall ports between your Cacti server and your target hosts.
- Version 0.2 (07/23/2008) : few typos
- Version 0.1 (07/11/2008) : initial release
This HowTo is based on the Net-SNMP
wiki.
This has been tested with Net-SNMP 5.4
Note that it seems "community string/context mapping" has been correctly implemented with Net-SNMP 5.3
In this example, the Cacti server can reach the Gateway, which can itself reach the target server.
IP forwarding is not needed.
First of all, set up the Net-SNMP agent on the target host (192.168.1.2) :
Code:
rocommunity public
disk /
From the "gateway" server, check that SNMP requests work as expected :
Code:
$ snmpwalk -v 1 -c public 192.168.1.2 sysname
SNMPv2-MIB::sysName.0 = STRING: hades
Next step is to configure the SNMP proxy on the "gateway" host :
Code:
# Define a simple view 'systemview', which includes everthing under .1.3.6.1
view systemview included .1.3.6.1
# Map 'public' community to the 'notConfigUser'
com2sec notConfigUser default public
# Map 'notConfigUser' to 'notConfigGroup'
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
# Give 'notConfigGroup' read access to objects in the view 'systemview'
access notConfigGroup "" any noauth exact systemview none none
# v1/v2c community string for each proxied host
com2sec -Cn ctx_hades notConfigUser default cmty_hades
# Allow the 'notConfigUser' (a member of 'notConfigGroup') access for these contexts
access notConfigGroup ctx_hades any noauth prefix systemview none none
# Setting up the proxy configuration
proxy -Cn ctx_hades -v 2c -c public 192.168.1.2 .1.3
Start (or restart) the SNMP agent on the "gateway" host, and run this SNMP request from the "gateway" host :
Code:
$ snmpwalk -v 1 -c cmty_hades localhost sysname
SNMPv2-MIB::sysName.0 = STRING: hades
If it's working as expected, run this SNMP request from your Cacti server :
Code:
$ snmpwalk -v 1 -c cmty_hades 192.168.0.2 sysname
SNMPv2-MIB::sysName.0 = STRING: hades
Voila ! Your target server can now be graphed in Cacti

If you want to proxy some other hosts, you'll have to duplicate the last 3 lines of the previous configuration example :
Code:
com2sec -Cn ctx_foo notConfigUser default cmty_foo
access notConfigGroup ctx_foo any noauth prefix systemview none none
proxy -Cn ctx_foo -v 2c -c public 10.20.30.40 .1.3