Cisco CBWFQ - PHP Script Server

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

Moderators: Developers, Moderators

hgrueber
Posts: 4
Joined: Tue Sep 15, 2009 7:25 pm

Post by hgrueber »

Had this awesome script working under 0.8.7b. I have since migrated to 0.8.7e and now this script generates errors in Cacti. :(

Warning: Invalid argument supplied for foreach() in /usr/share/cacti/site/lib/snmp.php on line 483

Warning: Cannot modify header information - headers already sent by (output started at /usr/share/cacti/site/lib/snmp.php:483) in /usr/share/cacti/site/host.php on line 79


It does create the appropriate graphs. However everytime the php script is run it generates the above errors in the browser. Any suggestions on where to start looking and how to fix?

Thanks
Hansy

EDIT: Argh disregard this. It is a problem related to 0.8.7e and PIA 2.5.
maxstoner
Posts: 16
Joined: Fri Dec 30, 2005 9:27 am

Jays Problem

Post by maxstoner »

Hello Jay,

To run the command out of script server you must pass the function name after the script path.
That is be done by cacti for you when calling the script server out of cacti.

Must be something like that:

- SPINE: Poller[0] Host[66] DS[3452] SS[0] SERVER: /usr/local/nms/applications/cacti/scripts/ss_cisco_cbwfq.php ss_cisco_cbwfq <x.x.x.x> <SNMP-Community> 2 161 500 "" "" get qosdropbitrate 4.class-default.2.66.15082481, output: 1000

So the argument here is <ss_cisco_cbwfq>, what is the function name within this script.

Then you should be able to troubleshoot from CLI
Best regards
Max
jay
Cacti User
Posts: 390
Joined: Wed Aug 31, 2005 8:55 am
Location: Bristol, England

Post by jay »

Hi Max

Thanks for replying. I have added the function name after the path and I can now see results from a working device as shown. I do notice that it does show a U at the end though.

C:\\Apache2\\htdocs\\cacti\\scripts\\ss_cisco_cbwfq.php ss_cisco_cbwfq <ipadd> public 2 161 3000 "" "" query ifname
2.ClassMap_3.2.1081.1083!Fa0/0
2.class-default.2.1081.1089!Fa0/0
3.ClassMap_3.1.1097.1099!Fa0/1
3.class-default.1.1097.1105!Fa0/1
3.ClassMap_3.2.1113.1115!Fa0/1
3.class-default.2.1113.1121!Fa0/1
11.COSP_EVPN_NMC_RP.2.1935.1939!ATM1/0.40-aal5 layer
11.COSP_EVPN_NMC_NM.2.1935.1945!ATM1/0.40-aal5 layer
11.class-default.2.1935.1951!ATM1/0.40-aal5 layer
11.COSQ_EVPN_NMC.2.1935.1955!ATM1/0.40-aal5 layer
11.COSP_EVPN_CSIS_TC4_COS1.2.1935.1965!ATM1/0.40-aal5 layer
11.class-default.2.1935.1971!ATM1/0.40-aal5 layer
11.COSQ_EVPN_CSIS_TC4_COS1.2.1935.1975!ATM1/0.40-aal5 layer
11.COSP_EVPN_CSIS_TC4_COS3.2.1935.1985!ATM1/0.40-aal5 layer
11.class-default.2.1935.1991!ATM1/0.40-aal5 layer
11.COSQ_EVPN_CSIS_TC4_COS3.2.1935.1995!ATM1/0.40-aal5 layer
11.class-default.2.1935.2003!ATM1/0.40-aal5 layer
U
quit
PHP Script Server Shutdown request received, exiting



When I try with a non working device I just get a U .

C:\Apache2\htdocs\cacti>php script_server.php
PHP Script Server has Started - Parent is cmd
C:\\Apache2\\htdocs\\cacti\\scripts\\ss_cisco_cbwfq.php ss_cisco_cbwfq <ipadd> public 2 161 3000 "" "" query ifname
U


I have looked through the Cacti documentaion and none of the debugging steps can help me in this case. I'm at a loss as to what the issue is here :o(

Just to confirm I have the following templates:-
Data template (which calls Get script server data (indexed) as its data input method).
Graph template
Data query (which calls Get script server data (indexed) as its data input method).

If this is incorrect could this cause the issues that I'm seeing? The fact that I see issues when I run the script from the CLI tells me no.
Should I be using a seperate data input method and get the data query to call this instead of the script server data method?? If so what should I get the data template to call??

Cheers

Jay
Cacti Version 0.8.7e, Spine 0.8.7e, Apache 2.2.15, Mysql 5.0.88, PHP 5.2.13, RRDTool 1.2.30, NET-SNMP 5.5
Quad Core AMD Opteron Processor 2384, 2.70Ghz, 2GB RAM , 1 CPU used
Windows Server 2003 (X64), VMWARE ESX
Plugins: Aggregate 0.75

SYSTEM STATS: Time:12.5140 Method:spine Processes:2 Threads:15 Hosts:400 HostsPerProcess:200 DataSources:2909 RRDsProcessed:1384
jay
Cacti User
Posts: 390
Joined: Wed Aug 31, 2005 8:55 am
Location: Bristol, England

Post by jay »

Hi

This is still not working :o(

C:\Apache2\htdocs\cacti>php script_server.php
PHP Script Server has Started - Parent is cmd
C:\\Apache2\\htdocs\\cacti\\scripts\\ss_cisco_cbwfq.php ss_cisco_cbwfq <IPadd> <community> 2 161 3000 "" "" query ifname
U


I have tried using snmp version 1 . Our ISP are using snmp-server view, to only allow access to certain MIBS, but see below for test to prove this isn't causing a problem. I can also see the following command on the router, snmp-server view pointofview ciscoCBQosMIB included.
I have also gone through all the OID's used in the script to make sure the information is available via snmp and it is.

Just so you know I had to change the script to make it work with my Cacti version as I'm using older version, see signature. I changed the global.php to config.php a shown below.

error_reporting(0);

include_once(dirname(__FILE__) . "/../lib/snmp.php");

if (!isset($called_by_script_server)) {
include_once(dirname(__FILE__) . "/../include/config.php");
array_shift($_SERVER["argv"]);

I'm completely stumped. Can anyone help me with this as I would really like to get this working????

Regards

Jay
Cacti Version 0.8.7e, Spine 0.8.7e, Apache 2.2.15, Mysql 5.0.88, PHP 5.2.13, RRDTool 1.2.30, NET-SNMP 5.5
Quad Core AMD Opteron Processor 2384, 2.70Ghz, 2GB RAM , 1 CPU used
Windows Server 2003 (X64), VMWARE ESX
Plugins: Aggregate 0.75

SYSTEM STATS: Time:12.5140 Method:spine Processes:2 Threads:15 Hosts:400 HostsPerProcess:200 DataSources:2909 RRDsProcessed:1384
jay
Cacti User
Posts: 390
Joined: Wed Aug 31, 2005 8:55 am
Location: Bristol, England

Post by jay »

Hi

I have been doing some debugging using Wireshark. I have uploaded 2 screenshots one from a working and one from a non working device. I used the WAN interfaces so I could make sure I only captured the running of the PHP script and not any other information.

If I look at the non working capture I see loads of ICMP destiantion unreachables. In the working one I see only 2 instances of this which might explain the U I see at the end of the output. Could this be causing my problems?? I see no reference in the script for ICMP.

Has anyone any idea what might be going on here?? Could the ICMP unreachables be the cause of the problem?? If so how are these called in the script ??

Regards

Jay
Attachments
Cbwfq_php_wireshark_NON_working_capture.JPG
Cbwfq_php_wireshark_NON_working_capture.JPG (355.46 KiB) Viewed 3428 times
Cbwfq_php_wireshark_working_capture.JPG
Cbwfq_php_wireshark_working_capture.JPG (356.26 KiB) Viewed 3428 times
Cacti Version 0.8.7e, Spine 0.8.7e, Apache 2.2.15, Mysql 5.0.88, PHP 5.2.13, RRDTool 1.2.30, NET-SNMP 5.5
Quad Core AMD Opteron Processor 2384, 2.70Ghz, 2GB RAM , 1 CPU used
Windows Server 2003 (X64), VMWARE ESX
Plugins: Aggregate 0.75

SYSTEM STATS: Time:12.5140 Method:spine Processes:2 Threads:15 Hosts:400 HostsPerProcess:200 DataSources:2909 RRDsProcessed:1384
jay
Cacti User
Posts: 390
Joined: Wed Aug 31, 2005 8:55 am
Location: Bristol, England

Post by jay »

Hi

Has anyone got any ideas??

Cheers

Jay
Cacti Version 0.8.7e, Spine 0.8.7e, Apache 2.2.15, Mysql 5.0.88, PHP 5.2.13, RRDTool 1.2.30, NET-SNMP 5.5
Quad Core AMD Opteron Processor 2384, 2.70Ghz, 2GB RAM , 1 CPU used
Windows Server 2003 (X64), VMWARE ESX
Plugins: Aggregate 0.75

SYSTEM STATS: Time:12.5140 Method:spine Processes:2 Threads:15 Hosts:400 HostsPerProcess:200 DataSources:2909 RRDsProcessed:1384
Stonephoenix
Posts: 5
Joined: Tue Mar 04, 2014 7:53 am
Location: Dominican Republic

Re: Cisco CBWFQ - PHP Script Server

Post by Stonephoenix »

I don't getting any data. I run Cacti on Debian, should it works!!?
Attachments
cbwfq.png
cbwfq.png (29.82 KiB) Viewed 1479 times
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests