Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


[HOWTO] Graph multiple servers using an SNMP proxy

 
Post new topic   Reply to topic    Cacti Forum Index -> Informational/HOWTO's
Author Message
fmangeant
Cacti Guru User


Joined: 19 Sep 2003
Posts: 2325
Location: Sophia-Antipolis, France

PostPosted: Fri Jul 11, 2008 5:11 am    Post subject: [HOWTO] Graph multiple servers using an SNMP proxy Reply with quote

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


Last edited by fmangeant on Wed Jul 23, 2008 4:49 am; edited 2 times in total
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12206
Location: Muenster, Germany

PostPosted: Fri Jul 11, 2008 3:18 pm    Post subject: Reply with quote

I love you, Frederic
Reinhard
Back to top
fmangeant
Cacti Guru User


Joined: 19 Sep 2003
Posts: 2325
Location: Sophia-Antipolis, France

PostPosted: Wed Jul 23, 2008 4:47 am    Post subject: Reply with quote

Sorry Reinhard, you're not my type
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Informational/HOWTO's All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group