Cisco SAN MDS9020 Switch Port statistics

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

User avatar
kwabbernoot
Cacti User
Posts: 99
Joined: Mon Oct 13, 2003 4:11 am
Location: Zottegem, Belgium

Cisco SAN MDS9020 Switch Port statistics

Post by kwabbernoot »

Hi,

I developped a Data Query that allows you to graph statistics on the Fiber Channel ports of a Cisco MDS9020 SAN Switch. The query interrogates the Fiber Alliance (http://www.fiberalliance.org) SNMP MIB v4.0

Remark: The result of the SNMP queries are sometimes in HEX format, therefor the script has a convert function attached. I noticed however that the HEX result can differ between systems. If your graphs remain empty please very the output of the script by executing it manually.
Currently the scripts detects HEX output has the following formats: "HEX-aa:bb:cc:dd:ee:ff:gg:hh:ii" or "aa:bb:cc:dd:ee:ff:gg:hh:ii"


The Data Query was created and tested in Cacti 0.8.6h.
It was exported from Cacti 0.8.6h, imported and currently used in my production Cacti 0.8.6h environment.

To use:
- Take a backup of your current Cacti DB (allows you to return if the import detroys your Cacti environment)
- Import the Data Query Export xml into your Cacti application
- Unzip/untar the attached .tar.gz file
- Place the xml file into "<path_cacti>/resource/script_queries"
- Place the script into "<path_cacti>/scripts"

Regards,
Kwabbernoot
Attachments
cacti_data_query_san_switch_port_statistics.xml
Data Query Export/Import information
(100.1 KiB) Downloaded 4455 times
san_port_info.tar.gz
Contains both the script and script_query xml information file
(1.95 KiB) Downloaded 3603 times
Example graphs
Example graphs
Overview.jpg (116.68 KiB) Viewed 50169 times
matibut14
Posts: 8
Joined: Wed Nov 22, 2006 10:28 am

Post by matibut14 »

Works great with the following McData SAN switches:
ES-3232 (Sphereon)
ED-6140 (Intrepid)

As you are using the Fiber Alliance MIB, I think you should remove all references to the MDS9020 in the scripts and filename.

Thanks a lot!
skasaxaphone
Posts: 1
Joined: Tue Dec 12, 2006 5:21 pm

trouble with template

Post by skasaxaphone »

I am using the same version (0.8.6h) of cacti, and I have been attempting to use this template to monitor ports on a Cisco MDS9020. when i attatch the template to the device it will not give me the option of selecting any ports as on other switches with SNMP-interfaces.

How do you properly set up the template to allow the ports to actually be monitored?
User avatar
kwabbernoot
Cacti User
Posts: 99
Joined: Mon Oct 13, 2003 4:11 am
Location: Zottegem, Belgium

Implement script

Post by kwabbernoot »

Sorry for the late reply, but it has been some time since I checked the Cacti forum. If you have a specific question you can always send a private message. The system sends me a mail and I always verify them.

The implementation of the script is explained in the original post.

I could remark however to test the script from command line and if possible interrogate the SAN switch manually using snmpget or another snmp query/walk software.

Like I mention on the script

Code: Select all

	// Its a pain in the ass, but the fiber Channel SNMP OIDS have a small difference on each device.
	// Only an SNMP walk can find the correct oid and the correct value
The snmp oids differ per switch and this does not facilitate debugging, check if the oids on your device do not differ earlier in the oid value.

If you manually modified the script/xml file to support your needs double check the syntax. When developing the script I had strange results/anomalies that were due to a typo error within the xml file. The result was that my script worked fine in command line, but failed to work within Cacti.
Regards,
Kwabbernoot

OS : [b]Slackware 10.2.0[/b]
Cacti : [b]0.8.6j[/b]
Cactid : [b]0.8.6j[/b]
Apache : [b]1.3.34[/b]
PHP : [b]5.1.4[/b]
MySQL : [b]4.1.21[/b]
RRDTool : [b]1.2.12[/b]
Net-SNMP : [b]5.3.0[/b]
johncall
Posts: 1
Joined: Sat Dec 02, 2006 2:08 pm
Location: BYU Hawaii

Error in script

Post by johncall »

Has anybody seen this before?
Notice: Undefined index: sgg_13 in /var/www/cacti/graphs_new.php on line 71

Warning: Cannot modify header information - headers already sent by (output started at /var/www/cacti/graphs_new.php:71) in /var/www/cacti/graphs_new.php on line 322
I got this after I added my IBM SAN24M1 (McData Sphereon 4500) device. Then I added the data query to the device (san_port.xml). Following the 'create graphs' link I saw all of my FCSwitch ports and their descriptions. I selected about 10/12 ports to graph and saw the above error after I pressed the 'create graphs' button.

Thanks,
John
Nesarin
Posts: 13
Joined: Wed Dec 20, 2006 2:40 pm

Post by Nesarin »

Sorry, I haven't seen anything like that, but I just wanted to say that I was able to get this working after a bit of a struggle. The heart of the problem that I had was that the php script seems not to work if the snmp version isn't set to 1. We monitor almost all our equipment with v2c, but when the script was run manually, I'd get undefined offset errors, however when I ran it with with version 1 at the command line, everything worked. I changed this under the device within cacti and re-added the script to the device. Lo and behold it populated the correct number of ports. I was also getting 'U' as an output for a while until I realized that I had left a few lines of output from the code up so that I could troubleshoot, once I took them out, the cacti log showed that the script was getting numbered results. AFter that, it was just a matter of deleting the rrd files for the device and letting the poller recreate them. The graphs populated and everything is working great now.

I guess the main point of my ramblings is that you have to use SNMP v 1, at least that's what I learned. :)
fosforo
Posts: 2
Joined: Thu Jun 28, 2007 9:24 am

Problem with importing XML template

Post by fosforo »

When i try to import the XML template i get always the same error:


Error: XML: Hash version does not exist.



What i can do?
neochi808
Posts: 1
Joined: Tue Apr 22, 2008 1:57 pm

Script does not work on clean install of cacti-0.8.7b

Post by neochi808 »

I tried building this on the latest cacti release as of today. snmpwalk works fine from the command line, but not from cmd.php.

Downgraded to cacti-0.8.6j and all worked okay. Not sure what is causing it.
Any tips on troubleshooting this?

Thanks in advance.
User avatar
carlosruiz
Posts: 2
Joined: Tue Jun 17, 2008 11:48 pm

Post by carlosruiz »

hi

this template can work with Cisco MDS9124 i really need this one to get graphs by cacti

10xs
Froz
Posts: 19
Joined: Tue Aug 26, 2008 9:42 am

Post by Froz »

this is what i get when i try running the first script from the command line. any ideas??

[UTWMAD0P0698] C:\>E:\php\php.exe -q E:\cacti\scripts\query_mds9020_san_portinfo.php 10.68.1.14 public 1 query index
PHP Notice: Undefined variable: config in E:\cacti\lib\snmp.php on line 33
PHP Warning: Missing argument 7 for cacti_snmp_walk(), called in E:\cacti\scripts\query_mds9020_san_portinfo.php on lin
e 47 and defined in E:\cacti\lib\snmp.php on line 225
PHP Warning: Missing argument 8 for cacti_snmp_walk(), called in E:\cacti\scripts\query_mds9020_san_portinfo.php on lin
e 47 and defined in E:\cacti\lib\snmp.php on line 225
PHP Warning: Missing argument 9 for cacti_snmp_walk(), called in E:\cacti\scripts\query_mds9020_san_portinfo.php on lin
e 47 and defined in E:\cacti\lib\snmp.php on line 225
PHP Warning: Missing argument 10 for cacti_snmp_walk(), called in E:\cacti\scripts\query_mds9020_san_portinfo.php on li
ne 47 and defined in E:\cacti\lib\snmp.php on line 225
PHP Notice: Use of undefined constant SNMP_POLLER - assumed 'SNMP_POLLER' in E:\cacti\lib\snmp.php on line 225
PHP Fatal error: Call to undefined function read_config_option() in E:\cacti\lib\snmp.php on line 234
xefil
Cacti User
Posts: 233
Joined: Tue Jun 20, 2006 2:48 am
Location: Italy
Contact:

Post by xefil »

Have a problem too on a MCDATA4500 fiber switch:

[root@cacti log]# /usr/bin/php -q /opt/cacti/scripts/query_mds9020_san_portinfo.php <IPofSwitch> <rightcomunity> index
PHP Notice: Undefined variable: config in /opt/cacti/lib/snmp.php on line 33
PHP Warning: Missing argument 7 for cacti_snmp_walk(), called in /opt/cacti/scripts/query_mds9020_san_portinfo.php on line 38 and defined in /opt/cacti/lib/snmp.php on line 225
PHP Warning: Missing argument 8 for cacti_snmp_walk(), called in /opt/cacti/scripts/query_mds9020_san_portinfo.php on line 38 and defined in /opt/cacti/lib/snmp.php on line 225
PHP Warning: Missing argument 9 for cacti_snmp_walk(), called in /opt/cacti/scripts/query_mds9020_san_portinfo.php on line 38 and defined in /opt/cacti/lib/snmp.php on line 225
PHP Warning: Missing argument 10 for cacti_snmp_walk(), called in /opt/cacti/scripts/query_mds9020_san_portinfo.php on line 38 and defined in /opt/cacti/lib/snmp.php on line 225
PHP Notice: Use of undefined constant SNMP_POLLER - assumed 'SNMP_POLLER' in /opt/cacti/lib/snmp.php on line 225
PHP Fatal error: Call to undefined function read_config_option() in /opt/cacti/lib/snmp.php on line 233
User avatar
cflong
Posts: 17
Joined: Thu Oct 25, 2007 8:16 am
Contact:

Possible fix

Post by cflong »

I also got these errors on 8.7b until I made some changes to query_mds9020_san_portinfo.php

Namely, include functions.php and global.php. I also added blank parameters the snmp walk function call to eliminate those warnings.
Attachments
query_mds9020_san_portinfo.php.gz
(1.25 KiB) Downloaded 1289 times
xefil
Cacti User
Posts: 233
Joined: Tue Jun 20, 2006 2:48 am
Location: Italy
Contact:

Post by xefil »

Sorry for delay in answer, but still doesn't work :(

In details:

Cacti Version 0.8.7d - PA 2.4

Switch details:

[root@cacti ~ ]# snmpwalk -Of -c tux -v 1 -t 2 switch-IP system
.iso.org.dod.internet.mgmt.mib-2.system.sysDescr.0 = STRING: EMC DS-24M2 Model 001 Fibre Channel Switch, firmware 09.00.00 76
.iso.org.dod.internet.mgmt.mib-2.system.sysObjectID.0 = OID: .iso.org.dod.internet.private.enterprises.289.2.1.1.2
.iso.org.dod.internet.mgmt.mib-2.system.sysUpTime.sysUpTimeInstance = Timeticks: (3985857604) 461 days, 7:49:36.04
.iso.org.dod.internet.mgmt.mib-2.system.sysContact.0 = STRING: ME
.iso.org.dod.internet.mgmt.mib-2.system.sysName.0 = STRING: switch_b
.iso.org.dod.internet.mgmt.mib-2.system.sysLocation.0 = STRING: Datacenter
.iso.org.dod.internet.mgmt.mib-2.system.sysServices.0 = INTEGER: 2

Executing manually:

[root@cacti ~]# /usr/bin/php -q /opt/cacti/scripts/query_mds9020_san_portinfo.php <switch-IP> <comunity> 1 index
PHP Notice: Undefined variable: config in /opt/cacti/lib/snmp.php on line 33
PHP Warning: Missing argument 7 for cacti_snmp_walk(), called in /opt/cacti/scripts/query_mds9020_san_portinfo.php on line 38 and defined in /opt/cacti/lib/snmp.php on line 225
PHP Warning: Missing argument 8 for cacti_snmp_walk(), called in /opt/cacti/scripts/query_mds9020_san_portinfo.php on line 38 and defined in /opt/cacti/lib/snmp.php on line 225
PHP Warning: Missing argument 9 for cacti_snmp_walk(), called in /opt/cacti/scripts/query_mds9020_san_portinfo.php on line 38 and defined in /opt/cacti/lib/snmp.php on line 225
PHP Warning: Missing argument 10 for cacti_snmp_walk(), called in /opt/cacti/scripts/query_mds9020_san_portinfo.php on line 38 and defined in /opt/cacti/lib/snmp.php on line 225
PHP Notice: Use of undefined constant SNMP_POLLER - assumed 'SNMP_POLLER' in /opt/cacti/lib/snmp.php on line 225
PHP Fatal error: Call to undefined function read_config_option() in /opt/cacti/lib/snmp.php on line 235

Any ideas?

Thank's a lot!!!

Simon
xefil
Cacti User
Posts: 233
Joined: Tue Jun 20, 2006 2:48 am
Location: Italy
Contact:

Post by xefil »

My mistrake, I've copied the modified script into wrong place and the old was used. :( :)

Ok, now all works !!!

great ;)
spols
Posts: 6
Joined: Wed Jan 14, 2009 8:45 pm
Location: Melbourne, Australia

Re: Error in script

Post by spols »

Hi John,
You wrote:
johncall wrote:Has anybody seen this before?
Notice: Undefined index: sgg_13 in /var/www/cacti/graphs_new.php on line 71

Warning: Cannot modify header information - headers already sent by (output started at /var/www/cacti/graphs_new.php:71) in /var/www/cacti/graphs_new.php on line 322
I got this after I added my IBM SAN24M1 (McData Sphereon 4500) device. Then I added the data query to the device (san_port.xml). Following the 'create graphs' link I saw all of my FCSwitch ports and their descriptions. I selected about 10/12 ports to graph and saw the above error after I pressed the 'create graphs' button.

Thanks,
John


Did you find a way to fix this? I am having the same problem with an SNMP xml template I've built (sgg_13). The verbose query preview shows everything looking just perfect, but I get the error.


Thanks,

Scott
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests