problem with script template for mds9020
Moderators: Developers, Moderators
problem with script template for mds9020
We've been having a terrible time getting the the script in this thread to load. We've done what was required for the placement of the php script and the xml file, but when we go to test out the functions, all we receive is information on the management port of the switch. We are not seeing any instances of the individual port information at all. Is there anyone who can give me a little help. I'm not sure how to start diagnosing the problem.
Thanks in advance.
Thanks in advance.
OK, I did a manual run of the query_mds9020_san_portinfo.php by pointing to it on the cacti server and in the browser. I get this for output:
Those lines correspond to this piece of code:
From doing a little reading, the variables he's creating are being referenced to a predefined variable within php. Does this mean that my Cacti box's version of php isn't recognizing theese predefined variables?
Edit: Upon further inspection and thought, I suppose you would have to run the scripts that pass in the information before it would know which box to query, so therefore it doesn't find that info. Or at least that's what I'm assuming.
Code: Select all
Notice: Undefined offset: 1 in /var/www/html/cacti/scripts/query_mds9020_san_portinfo.php on line 30
Notice: Undefined offset: 2 in /var/www/html/cacti/scripts/query_mds9020_san_portinfo.php on line 31
Notice: Undefined offset: 3 in /var/www/html/cacti/scripts/query_mds9020_san_portinfo.php on line 32
Notice: Undefined offset: 4 in /var/www/html/cacti/scripts/query_mds9020_san_portinfo.php on line 33
Host = Community = Command =
Code: Select all
$hostname = $_SERVER["argv"][1];
$snmp_community = $_SERVER["argv"][2];
$snmp_version = $_SERVER["argv"][3];
$cmd = $_SERVER["argv"][4];
Edit: Upon further inspection and thought, I suppose you would have to run the scripts that pass in the information before it would know which box to query, so therefore it doesn't find that info. Or at least that's what I'm assuming.
If it helps anyone. When I run a verbose on one of the data queries for this script, I get this for the debug output...
Code: Select all
+ Running data query [13].
+ Found type = '4 '[script query].
+ Found data query XML file at '/var/www/html/cacti/resource/script_queries/san_port.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/bin/php -q /var/www/html/cacti/scripts/query_mds9020_san_portinfo.php <hostname> <snmpstring> 2 index'
+ Executing script query '/usr/bin/php -q /var/www/html/cacti/scripts/query_mds9020_san_portinfo.php
<hostname removed> <community string removed> 2 query index'
+ Executing script query '/usr/bin/php -q /var/www/html/cacti/scripts/query_mds9020_san_portinfo.php
<hostname removed> <community string removed> 2 query name'
+ Executing script query '/usr/bin/php -q /var/www/html/cacti/scripts/query_mds9020_san_portinfo.php
<hostname removed> <community string removed> 2 query speed'
+ Found data query XML file at '/var/www/html/cacti/resource/script_queries/san_port.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/script_queries/san_port.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/script_queries/san_port.xml'
OK, after a long time off from this problem. I wanted to come back to it. I'm not sure if any of this is relevant, but I wanted to say that I think I've found a few different reason for why there has been a problem with this script. First of all, our mds9020 doesn't seem to respond to the Fibre Alliance MIB v4.0 It does respond to the MIB II oid's.
However, I need to know more about how scripts using PHP act with Cacti. Because it seems that any scripts that have been tried that use php scripts do not work at all. We are using Cactid v0.8.6h and Cacti 0.8.6i (fully patched). It does say that php snmp support is set to no. Do we need the php snmp support in order for these scripts to work or is there something that I'm missing??
However, I need to know more about how scripts using PHP act with Cacti. Because it seems that any scripts that have been tried that use php scripts do not work at all. We are using Cactid v0.8.6h and Cacti 0.8.6i (fully patched). It does say that php snmp support is set to no. Do we need the php snmp support in order for these scripts to work or is there something that I'm missing??
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
In general, it is not a must to use php-snmp. Personally, I'm currently struggeling with an incompatibilty between net-snmp and php-snmp. So you may try if this solves your problem.
For some more infos on using scripts, see My Cacti Stuff. It's general purpose, but may help understanding
Reinhard
For some more infos on using scripts, see My Cacti Stuff. It's general purpose, but may help understanding
Reinhard
Ok, I've been doing a little more in-depth searching on this script. I have put the script and the xml files in their correct places. I then tried to add the script to the correct device. Afterwards, I tried to run it verbosely within Cacti.
I was curious, so I tried to run some of the commands that this was doing manually. Though I didn't notice any errors reported from that. I did see that cacti was calling the perl script like so:
I tried running this through manually at the command prompt and got the following:
This continues to repeat from offset 0-19. ie. the number of ports the switch has.
I went back and looked at the script code and this is the section of code it is complaining about.
I'm not trained in php particularly, but it looked like everything in the statement would be solid. So I put a print statement just above line 51 to output the information that $arr and what $arr[$i] returns. It looks like $arr returns "Array" and $arr[$i] returns nothing, just blank space. Could this be where part of my trouble is coming from???
I was curious, so I tried to run some of the commands that this was doing manually. Though I didn't notice any errors reported from that. I did see that cacti was calling the perl script like so:
Code: Select all
/usr/bin/php -q /var/www/html/cacti/scripts/query_mds9020_san_portinfo.php <device name> <community string> 2 query index
Code: Select all
<b>Notice</b>: Undefined offset: 0 in <b>/var/www/html/cacti/scripts/query_mds9020_san_portinfo.php</b> on line <b>51</b><br />
32!
I went back and looked at the script code and this is the section of code it is complaining about.
Code: Select all
elseif ($cmd == "query") {
$arg = $_SERVER["argv"][5];
$arr_index = reindex(cacti_snmp_walk($hostname, $snmp_community, $oids["index"], $snmp_version, "", ""));
$arr = reindex(cacti_snmp_walk($hostname, $snmp_community, $oids[$arg], $snmp_version, "", ""));
for ($i=0;($i<sizeof($arr_index));$i++)
{
$convert_hex = hex2dec($arr[$i]); // Line 51
print $arr . "\n";
print $arr_index[$i] . "!" . $convert_hex . "\n";
I'm not trained in php particularly, but it looked like everything in the statement would be solid. So I put a print statement just above line 51 to output the information that $arr and what $arr[$i] returns. It looks like $arr returns "Array" and $arr[$i] returns nothing, just blank space. Could this be where part of my trouble is coming from???
Nesarin wrote:Ok, I've been doing a little more in-depth searching on this script. I have put the script and the xml files in their correct places. I then tried to add the script to the correct device. Afterwards, I tried to run it verbosely within Cacti.
I was curious, so I tried to run some of the commands that this was doing manually. Though I didn't notice any errors reported from that. I did see that cacti was calling the php script like so:I tried running this through manually at the command prompt and got the following:Code: Select all
/usr/bin/php -q /var/www/html/cacti/scripts/query_mds9020_san_portinfo.php <device name> <community string> 2 query index
This continues to repeat from offset 0-19. ie. the number of ports the switch has.Code: Select all
<b>Notice</b>: Undefined offset: 0 in <b>/var/www/html/cacti/scripts/query_mds9020_san_portinfo.php</b> on line <b>51</b><br /> 32!
I went back and looked at the script code and this is the section of code it is complaining about.Code: Select all
elseif ($cmd == "query") { $arg = $_SERVER["argv"][5]; $arr_index = reindex(cacti_snmp_walk($hostname, $snmp_community, $oids["index"], $snmp_version, "", "")); $arr = reindex(cacti_snmp_walk($hostname, $snmp_community, $oids[$arg], $snmp_version, "", "")); for ($i=0;($i<sizeof($arr_index));$i++) { $convert_hex = hex2dec($arr[$i]); // Line 51 print $arr . "\n"; print $arr_index[$i] . "!" . $convert_hex . "\n";
I'm not trained in php particularly, but it looked like everything in the statement would be solid. So I put a print statement just above line 51 to output the information that $arr and what $arr[$i] returns. It looks like $arr returns "Array" and $arr[$i] returns nothing, just blank space. Could this be where part of my trouble is coming from???
Who is online
Users browsing this forum: No registered users and 3 guests