Cisco CBWFQ - PHP Script Server

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

Moderators: Developers, Moderators

maxstoner
Posts: 16
Joined: Fri Dec 30, 2005 9:27 am

Cisco CBWFQ - PHP Script Server

Post by maxstoner »

Hello,

We used the original Cisco CBWFQ Scipts from this topic:
http://forums.cacti.net/viewtopic.php?t=7401

But we had some performance impacts when using this script on our servers. For my opinion this is because of using script/command and the script itself is doing 4 snmpwalks whenever requesting a "get".

Now I did some modifications to the original script of user pwozney.

First of all I changed language to PHP. Then in the second step we are using PHP script server, so we do not need to recompile the script each time.

The last step was to eliminate the 4 snmpwalks when doing a "get". We only need one snmp_get when fetching the values now.

I will post all necessary parts here soon.

Max
maxstoner
Posts: 16
Joined: Fri Dec 30, 2005 9:27 am

needed Files

Post by maxstoner »

Import cacti_graph_template_cisco_-_cbwfq_statistics.xml and cacti_data_query_cisco_-_cbwfq_statistics.xml to cacti. It is exported in version 0.8.7b.
Copy cisco.cbwfq.xml to <cacti>/resource/script_server/
and ss_cisco_cbwfq.php to <cacti>/scripts/

Max
Attachments
cisco_cbwfq.zip
all needed files (data_query included)
(9.69 KiB) Downloaded 723 times
Last edited by maxstoner on Tue Jul 07, 2009 10:50 am, edited 2 times in total.
msw1970
Cacti User
Posts: 206
Joined: Tue Jan 09, 2007 8:28 am
Location: London, UK

Post by msw1970 »

Shouldn't there also be a data input method to go with this??
maxstoner
Posts: 16
Joined: Fri Dec 30, 2005 9:27 am

Post by maxstoner »

sorry, can't test the export. Included date_query_export now. Hope that's all.
drewshin99
Posts: 24
Joined: Thu Jan 22, 2009 5:06 pm

thanks!

Post by drewshin99 »

thanks for sharing this maxstoner, this is the only script for cbwfq that has worked for me!
snoopy72
Posts: 7
Joined: Sat Aug 01, 2009 11:48 am

Post by snoopy72 »

8)
This script works perfectly on the 6509.
Thank you very much.
MKS
Posts: 2
Joined: Mon Oct 20, 2008 9:51 am

XML hash version

Post by MKS »

I just get this error when I import the templates, using versio 0.8.7

Error: XML: Hash version does not exist.
snoopy72
Posts: 7
Joined: Sat Aug 01, 2009 11:48 am

Post by snoopy72 »

Hi maxstoner,
I have script polling on 6509E with dual sup720 and DFC cards. The graphs are reporting less than actual traffic. Is there the way I can combine all traffic through all the slots.
Thanks,
Snoopy

I-MF-DS#sh policy-map interface g2/7 output class class-default


GigabitEthernet2/7

Service-policy output: to-ms-school

class-map: class-default (match-any)
Match: any
police :
55000000 bps 1718000 limit 1718000 extended limit
Earl in slot 1 :
17857570475695 bytes
30 second offered rate 11486224 bps
aggregate-forwarded 17857556770235 bytes action: transmit
exceeded 13705460 bytes action: drop
aggregate-forward 11515288 bps exceed 0 bps
Earl in slot 2 :
17501553073 bytes
30 second offered rate 296 bps
aggregate-forwarded 17501553073 bytes action: transmit
exceeded 0 bytes action: drop
aggregate-forward 376 bps exceed 0 bps
Earl in slot 3 :
518523602620 bytes
30 second offered rate 378504 bps
aggregate-forwarded 518505355290 bytes action: transmit
exceeded 18247330 bytes action: drop
aggregate-forward 254296 bps exceed 0 bps
Earl in slot 5 :
3904464245588 bytes
30 second offered rate 67624 bps
aggregate-forwarded 3903954967691 bytes action: transmit
exceeded 509277897 bytes action: drop
aggregate-forward 142312 bps exceed 0 bps
Earl in slot 6 :
30016324127 bytes
30 second offered rate 2880 bps
aggregate-forwarded 30016284185 bytes action: transmit
exceeded 39942 bytes action: drop
aggregate-forward 1928 bps exceed 0 bps
Earl in slot 7 :
587911565500 bytes
30 second offered rate 8934376 bps

aggregate-forwarded 587879695594 bytes action: transmit
exceeded 31869906 bytes action: drop
aggregate-forward 9067536 bps exceed 0 bps
I-MF-DS#sh int g2/7
GigabitEthernet2/7 is up, line protocol is up (connected)
Hardware is C6k 1000Mb 802.3, address is 0022.9113.3c00 (bia 0022.9113.3c00)

MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec,
reliability 255/255, txload 5/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Full-duplex, 1000Mb/s, media type is LH
input flow-control is off, output flow-control is off
Clock mode is auto
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:06, output 00:00:01, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
30 second input rate 1622000 bits/sec, 2452 packets/sec
30 second output rate 21172000 bits/sec, 4696 packets/sec

L2 Switched: ucast: 1038879 pkt, 73758286 bytes - mcast: 1317912 pkt, 126614391 bytes
L3 in Switched: ucast: 20068614055 pkt, 1627256674311 bytes - mcast: 0 pkt, 0 bytes mcast
L3 out Switched: ucast: 38918068381 pkt, 22986956377669 bytes mcast: 0 pkt, 0 bytes
20071623630 packets input, 1627592603401 bytes, 0 no buffer
Received 1925653 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 0 multicast, 0 pause input
0 input packets with dribble condition detected
38956788087 packets output, 23017336771769 bytes, 0 underruns
0 output errors, 0 collisions, 1 interface resets
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 PAUSE output
0 output buffer failures, 0 output buffers swapped out
jay
Cacti User
Posts: 390
Joined: Wed Aug 31, 2005 8:55 am
Location: Bristol, England

Post by jay »

Snoopy

I know a manual way of doing it. Gotto graph management - click add - leave graph template and host as none and click create. Then under graph items add your data sources you want to graph. This will combine all the datasources into 1 graph. You can add gprint and all sorts as you would when creating a new graph template.

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

Does anyone know of what OID I can use to get the bandwith from each class map / policy?? I want to be able to create an Hrule based on that so I can set a threshold for my graphs to see if traffic is bursting above my COS queues.
Is this possible when they our providor are using bandwith remaing statements rather than a bandwith statement with a bps figure?

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

The template and script was initially working fine. I had 2 devices working ok using this script. I have tried to now add additional devices but its not working for any new devices I tried to add the template too.

WHen I do a debug on the script I get this:-

+ Running data query [34].
+ Found type = '6 '[script query].
+ Found data query XML file at 'C:/Apache2/htdocs/cacti/resource/script_server/cisco_cbwfq.xml'
+ XML file parsed ok.
+ Executing script for list of indexes 'c:\php\php.exe -q C:\Apache2\htdocs\cacti\scripts\ss_cisco_cbwfq.php 32.34.94.221 public 2 161 3000 "" "" index'
+ Executing script query 'c:\php\php.exe -q C:\Apache2\htdocs\cacti\scripts\ss_cisco_cbwfq.php 32.34.94.221 public 2 161 3000 "" "" query index'
+ Executing script query 'c:\php\php.exe -q C:\Apache2\htdocs\cacti\scripts\ss_cisco_cbwfq.php 32.34.94.221 public 2 161 3000 "" "" query ifname
etc, etc, etc etc,

Here is a successful run on annother device

+ Running data query [34].
+ Found type = '6 '[script query].
+ Found data query XML file at 'C:/Apache2/htdocs/cacti/resource/script_server/cisco_cbwfq.xml'
+ XML file parsed ok.
+ Executing script for list of indexes 'c:\php\php.exe -q C:\Apache2\htdocs\cacti\scripts\ss_cisco_cbwfq.php 32.37.136.86 public 2 161 2000 "" "" index'
+ Executing script query 'c:\php\php.exe -q C:\Apache2\htdocs\cacti\scripts\ss_cisco_cbwfq.php 32.37.136.86 public 2 161 2000 "" "" query index'
+ Found item [customindex='2.ClassMap_0.2.1081.1083'] index: 2.ClassMap_0.2.1081.1083
+ Found item [customindex='2.class-default.2.1081.1089'] index: 2.class-default.2.1081.1089


These are both Cisco routers on our ISP managed WAN.

I'm able to poll the MIB in question as shown below so I know its allowing SNMP to this MIB.


C:\net-snmp\bin>snmpwalk -v2c -c public 32.34.94.221 .1.3.6.1.4.1.9.9.
166.1.7.1.1.1
SNMPv2-SMI::enterprises.9.9.166.1.7.1.1.1.1025 = STRING: "class-default"
SNMPv2-SMI::enterprises.9.9.166.1.7.1.1.1.1029 = STRING: "NMC"
SNMPv2-SMI::enterprises.9.9.166.1.7.1.1.1.1035 = STRING: "COS3"
SNMPv2-SMI::enterprises.9.9.166.1.7.1.1.1.1041 = STRING: "ClassMap_3"

I have also tried walking the whole MIB as shown

C:\net-snmp\bin>snmpwalk -v2c -c public 32.34.94.221 .1.3.6.1.4.1.9.9.
166.1.15
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.1.1065.1067 = Counter32: 1
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.1.1065.1073 = Counter32: 0
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.1.1081.1083 = Counter32: 1
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.1.1081.1089 = Counter32: 0
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.1.1097.1099 = Counter32: 0
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.1.1097.1105 = Counter32: 0
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.1.1113.1115 = Counter32: 0
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.1.1113.1121 = Counter32: 0
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.1.1163.1165 = Counter32: 0
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.1.1163.1171 = Counter32: 0
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.1.1163.1177 = Counter32: 0
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.1.1191.1193 = Counter32: 0
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.1.1191.1199 = Counter32: 0
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.1.1191.1205 = Counter32: 0
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.2.1065.1067 = Counter32: 610870772
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.2.1065.1073 = Counter32: 0
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.2.1081.1083 = Counter32: 529878093
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.2.1081.1089 = Counter32: 15771482
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.2.1097.1099 = Counter32: 0
etc, etc ,etc



When I run the script from the CLI I get a warning error. I get this when I run it against a device that works and one that doesn't, which doesn't make any sense!

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 32.34.94.221 public
are!s 2 161 3000 "" "" query index
WARNING: Function does not exist


C:\\Apache2\\htdocs\\cacti\\scripts\\ss_cisco_cbwfq.php 32.37.136.86 public
are!s 2 161 3000 query ifname
WARNING: Function does not exist

C:\\Apache2\\htdocs\\cacti\\scripts\\ss_cisco_cbwfq.php 172.27.252.57 2ndsight 2
161 3000 query ifname
WARNING: Function does not exist

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
jay
Cacti User
Posts: 390
Joined: Wed Aug 31, 2005 8:55 am
Location: Bristol, England

Post by jay »

Just to add to this. I have just tried testing the script server using the host disk, which works fine, and I also get the same warning message. So maybe this is default behaviour when using the script server???


C:\Apache2\htdocs\cacti>php script_server.php
PHP Script Server has Started - Parent is cmd
C:\\Apache2\\htdocs\\cacti\\scripts\\ss_host_disk.php 1.1.1.1 349 2:161:2000:
public:::MD5::[None] query index
WARNING: Function does not exist
C:\\Apache2\\htdocs\\cacti\\scripts\\ss_host_disk.php 1.1.1.1 349 2:161:2000:
public query index
WARNING: Function does not exist

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

I have also just double checked I can walk all the OIDS that are used in the script.

I have started trying to add all of our ISP routers to this template and at the moment only 2 are working correctly. Its really strange. As a test I removed the template from a working device and re-added it and it still scanned the device and bought back results. This proves that the script/template hasn't been messed with since I initially added the working devices.

If anyone has any ideas it would be appreciated.

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
nxumdon
Posts: 7
Joined: Thu Aug 27, 2009 10:52 am

Post by nxumdon »

Does this script graph CBWFQ Input, or just bits OUTPUT? Does anyone know of a way to graph CBWFQ bits INPUT? Thanks.
nxumdon
Posts: 7
Joined: Thu Aug 27, 2009 10:52 am

Post by nxumdon »

Can anyone assist with the creation of the data input method for this? Thanks...
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests