Discovery Plugin not Detecting SNMP on Canopy Devices

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
jrwagz
Posts: 12
Joined: Tue Sep 01, 2009 7:10 pm

Discovery Plugin not Detecting SNMP on Canopy Devices

Post by jrwagz »

I am running Cacti 0.8.7e with PA 2.6 and I just installed Discovery v0.9.

I would like to have the Discovery plugin automatically find the thousands of Canopy SM's that are on my network and automatically add them as a device with the correct SysName as read from the device.

I was able to get the plugin functioning and it gives me results. It can find the SNMP information on my Mikrotik Routers, but it says that the Canopy SM's (which respond to ICMP Pings) do not respond to SNMP. I know that they are responding correctly because when I manually add one of the Canopy SM's it populates data correctly (interface traffic and Canopy specific information with the canopy templates I have loaded.

I know that the Canopy devices must use SNMP v2c.

Any and all help is greatly appreciated!

Thanks,

Justin
jrwagz
Posts: 12
Joined: Tue Sep 01, 2009 7:10 pm

Post by jrwagz »

Here are some screenshots showing the issues I am seeing.

I can do an SNMPWalk from the Cacti server and get the info I want to show up in Discover using v2c on the SM's, but using v I get a timeout.

Using the same snmpwalk on the Mikrotik devices I get responses with both v1 and v2c.

You will notice the problem in the discovery screenshot that shows the Mikrotik device as responding to SNMP and the Canopy SM's as not responding.

My guess is that Discovery is using v1 even though I have v2c set as the default in the settings screen.

Anybody know how I can force Discovery to use v2c?
Attachments
SNMP responses ok from Miktotik device, but no reponse from Canopy SM's
SNMP responses ok from Miktotik device, but no reponse from Canopy SM's
Discover Results.PNG (39.4 KiB) Viewed 2206 times
SNMP walk on both types of devices show that SM only responds to v2c and Mikrotik devices repond to both v1 and v2c
SNMP walk on both types of devices show that SM only responds to v2c and Mikrotik devices repond to both v1 and v2c
SNMP Walk.PNG (53.88 KiB) Viewed 2206 times
jrwagz
Posts: 12
Joined: Tue Sep 01, 2009 7:10 pm

Post by jrwagz »

I found the problem in findhosts.php lines 293-318.

You will see that the SNMP version is hard set to ver 1 and the port is set to 161. I changed the version to 2 and it worked for me.

Code: Select all

	while ($host = discover_get_next_host($start, $total, $count)) {
		$count++;
		discover_debug($host);
		if (!in_array($host, $known)) {
			if (substr($host, -3) < 255) {
				$stats['scanned']++;
				$hash = discover_ip_hash($host);
				$device = array(
					'snmp_status'		=> 0,
					'ping_status'		=> 0,
					'hostname'		=> $host,
					'community'		=> '',
					'dnsname'		=> '',
					'snmp_readstring'	=> $pcname,
					'snmp_readstrings'	=> $scname,
					'snmp_version'	=> 1,               <-- Problem
					'snmp_port'		=> 161,    <-- Problem
					'snmp_timeout'	=> 100,
					'snmp_sysObjectID'	=> '',
					'snmp_sysName'	=> '',
					'snmp_sysLocation'	=> '',
					'snmp_sysContact'	=> '',
					'snmp_sysDescr'	=> '',
					'snmp_sysUptime'	=> 0,
					'os'			=> '',
					'hash' => $hash);
Shouldn't these values be pointed at the SQL database?

I thought so and here is how I modified the file so that they are:

The first two lines were added and then those variables were placed in their respective spots of the code.

Code: Select all

$snmp_version 	= read_config_option("snmp_ver");        <-- Added
$snmp_port	= read_config_option("snmp_port");         <-- Added

/* Let's do some stats! */
$stats = array();
$stats['scanned'] = 0;
$stats['ping'] = 0;
$stats['snmp'] = 0;
$stats['added'] = 0;
$count_graph = 0;

for ($arg = 0; $arg < count($hosts); $arg++) {
	$count = 0;

	discover_debug("Calculating Info for Subnet :" . $hosts[$arg] . "\n");
	$start = discover_calculate_start($hosts, $arg);
	$total = discover_calculate_total_ips($hosts, $arg);

	discover_debug("Start IP is " . $start . "\n");
	discover_debug("Total IPs is " . $total . "\n");

	while ($host = discover_get_next_host($start, $total, $count)) {
		$count++;
		discover_debug($host);
		if (!in_array($host, $known)) {
			if (substr($host, -3) < 255) {
				$stats['scanned']++;
				$hash = discover_ip_hash($host);
				$device = array(
					'snmp_status'		=> 0,
					'ping_status'		=> 0,
					'hostname'		=> $host,
					'community'		=> '',
					'dnsname'		=> '',
					'snmp_readstring'	=> $pcname,
					'snmp_readstrings'	=> $scname,
					'snmp_version'	=> $snmp_version, <-- Fixed
					'snmp_port'		=> $snmp_port, <-- Fixed
					'snmp_timeout'	=> 100,
					'snmp_sysObjectID'	=> '',
					'snmp_sysName'	=> '',
					'snmp_sysLocation'	=> '',
					'snmp_sysContact'	=> '',
					'snmp_sysDescr'	=> '',
					'snmp_sysUptime'	=> 0,
					'os'			=> '',
					'hash' => $hash);
User avatar
TheWitness
Developer
Posts: 17062
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I fixed this in SVN.

Thanks,

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
jrwagz
Posts: 12
Joined: Tue Sep 01, 2009 7:10 pm

Post by jrwagz »

Excuse my ignorance, but what is SVN? I am assuming it is the central place where the plugin binaries are kept for download? So that means that any new download of Discovery v0.9 will have this patch?
User avatar
TheWitness
Developer
Posts: 17062
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Yes. It's in the same location as here:

http://www.cacti.net/svn.php

However, the directory is "cacti_plugins" and not simply "cacti".

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Post by Linegod »

jrwagz wrote:Excuse my ignorance, but what is SVN? I am assuming it is the central place where the plugin binaries are kept for download? So that means that any new download of Discovery v0.9 will have this patch?
SVN is subversion - a version control system - where developers commit our changes to the code.

They are not the binaries (and there really are no binaries in Cacti or Cacti plugins), but the raw code.

It will not appear in the cacti plugin package until a new release is done.

However, if take a look at the code within SVN, you can see what changes where made, and make the same changes to your local copy, or you can 'checkout' the SVN copy - this has risks as other 'unstable' changes may happen in SVN.
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests