juniper policer data-query (QoS) released

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

Moderators: Developers, Moderators

User avatar
johnrembo
Cacti User
Posts: 216
Joined: Mon Apr 24, 2006 3:33 am

juniper policer data-query (QoS) released

Post by johnrembo »

hello community,

this data-query allows to gather juniper policer counters.

tested with m320 router series.

currently I was unable to relate policers with physical interfaces. that means this template can't display port status, errors/discards along with traffic counters.

Image

data-query, data and graph templates were created with cacti 0.8.7, so you won't be able to import i to older cacti release. yet, in the package you will find an xml file prepared for 0.8.6.x, but you will have to create templates by yourself(i simply have no time for this).
Attachments
functions_v2.zip
updated functions.php (v2)
(862 Bytes) Downloaded 573 times
juniper_firewall(policer)_counters.zip
v 1.0, cacti 0.8.7.x
(8.5 KiB) Downloaded 687 times
juniper_firewall(policer)_counters.tar.gz
v 1.0 cacti 0.8.7.x
(5.61 KiB) Downloaded 798 times
Last edited by johnrembo on Mon Aug 25, 2008 5:09 am, edited 2 times in total.
[url=http://forums.cacti.net/viewtopic.php?t=24934&highlight=zond]zond plugin[/url]
[url=http://forums.cacti.net/viewtopic.php?t=28384]memorize plugin[/url]
[url=http://forums.cacti.net/viewtopic.php?p=141322#141322]transporter plugin[/url]
wandererjs
Posts: 4
Joined: Wed Jan 16, 2008 7:06 am

Re: juniper policer data-query released

Post by wandererjs »

FYI: It is possible to associate the counter and the policer with the original interface. Unfortunately, I can't do it with a native Cacti SNMP poll: I had to write a script to do it.

When using "interface-specific" counters/policers in your firewall filter, the interface name shows up in both filter name and counter name when polled via SNMP (or from the CLI's show firewall).

I poll the Tx traffic / drop statistics with the normal MIBs, and use the ifDescr table as a hash to the IfIndex.

When I poll the firewall mib, I pull out the interface name with a regular expression, use that to identify the IfIndex, and associate the counter with the original interface.

The part I'm working on now is tying that back into Cacti as data polled via a script. As I'm new to Cacti, I'm sure it can be done... just figuring out the syntax.
User avatar
johnrembo
Cacti User
Posts: 216
Joined: Mon Apr 24, 2006 3:33 am

Re: juniper policer data-query released

Post by johnrembo »

wandererjs wrote:FYI:
(...)
I poll the Tx traffic / drop statistics with the normal MIBs, and use the ifDescr table as a hash to the IfIndex.
(...)
yup, currently I am also using this solution, but this is kind of perversion :]
there is allways a human factor when ifalias might not correspond to policer or template name because of syntax, some might not be using aliases at all etc etc...

i've asked juniper support on this subject and will share their response as soon as I will get one.
mandrade
Posts: 5
Joined: Thu Jun 12, 2008 9:38 am

Post by mandrade »

Hi, I install the template, but when executed php script, return the next error

[root@localhost ~]# /usr/bin/php /var/www/html/scripts/juniper-policer-64.php xxx.xxx.xxx.xxx "2::xxxxx::::::MD5::::DES::" index
PHP Warning: Invalid argument supplied for foreach() in /var/www/html/scripts/juniper-policer-64.php on line 33

Warning: Invalid argument supplied for foreach() in /var/www/html/scripts/juniper-policer-64.php on line 33
PHP Notice: Undefined variable: structure in /var/www/html/scripts/juniper-policer-64.php on line 57

Notice: Undefined variable: structure in /var/www/html/scripts/juniper-policer-64.php on line 57
PHP Warning: Invalid argument supplied for foreach() in /var/www/html/scripts/juniper-policer-64.php on line 57

Warning: Invalid argument supplied for foreach() in /var/www/html/scripts/juniper-policer-64.php on line 57



any idea please???

thanks

PD: sorry, my english isn´t good. :(
User avatar
johnrembo
Cacti User
Posts: 216
Joined: Mon Apr 24, 2006 3:33 am

Post by johnrembo »

Hey,
there might be some problems with non alphanumeric strings in community names. if you can - please try other, simpler community name.
everything else looks ok.

mandrade wrote:Hi, I install the template, but when executed php script, return the next error

[root@localhost ~]# /usr/bin/php /var/www/html/scripts/juniper-policer-64.php xxx.xxx.xxx.xxx "2::xxxxx::::::MD5::::DES::" index
PHP Warning: Invalid argument supplied for foreach() in /var/www/html/scripts/juniper-policer-64.php on line 33

Warning: Invalid argument supplied for foreach() in /var/www/html/scripts/juniper-policer-64.php on line 33
PHP Notice: Undefined variable: structure in /var/www/html/scripts/juniper-policer-64.php on line 57

Notice: Undefined variable: structure in /var/www/html/scripts/juniper-policer-64.php on line 57
PHP Warning: Invalid argument supplied for foreach() in /var/www/html/scripts/juniper-policer-64.php on line 57

Warning: Invalid argument supplied for foreach() in /var/www/html/scripts/juniper-policer-64.php on line 57



any idea please???

thanks

PD: sorry, my english isn´t good. :(
mandrade
Posts: 5
Joined: Thu Jun 12, 2008 9:38 am

Post by mandrade »

ok, but the community name is "public". :cry: .
User avatar
johnrembo
Cacti User
Posts: 216
Joined: Mon Apr 24, 2006 3:33 am

Post by johnrembo »

mandrade wrote:ok, but the community name is "public". :cry: .
in this case - all I can say - your snmp request fails and script terminates with an error.

you should check if device is really accessible via snmp with snmpwalk command.
mandrade
Posts: 5
Joined: Thu Jun 12, 2008 9:38 am

Post by mandrade »

OK, snmpwalk return after 2 minuts this:

# snmpwalk -On -v 2c -c public <ip> .1.3.6.1.4.1.2636.3.5.2.1.5

.1.3.6.1.4.1.2636.3.5.2.1.5.19.84.114.97.102.102.105.99.45.65.110.97.108.121.115.105.115.45.105.110.14.87.101.98.45.84.114.97.102.102.105.99.45.73.110.2 = Counter64: 0
.1.3.6.1.4.1.2636.3.5.2.1.5.20.84.114.97.102.102.105.99.45.65.110.97.108.121.115.105.115.45.111.117.116.15.87.101.98.45.84.114.97.102.102.105.99.45.79.117.116.2 = Counter64: 0
.1.3.6.1.4.1.2636.3.5.2.1.5.21.71.84.68.45.103.101.45.48.47.51.47.48.46.48.45.105.110.101.116.45.105.21.71.84.68.45.103.101.45.48.47.51.47.48.46.48.45.105.110.101.116.45.105.3 = Counter64: 0
.1.3.6.1.4.1.2636.3.5.2.1.5.21.71.84.68.45.103.101.45.48.47.51.47.48.46.48.45.105.110.101.116.45.111.21.71.84.68.45.103.101.45.48.47.51.47.48.46.48.45.105.110.101.116.45.111.3 = Counter64: 0
etc.....

.97.99.45.50.48.52.56.105.110.116.101.114.45.111.117.116.95.110.97.116.105.111.110.97.108.95.111.117.116.45.103.101.45.48.47.50.47.48.46.50.52.48.54.45.111.2 = Counter64: 9252413331
Timeout: No Response from <ip>

but I have two m20 routers, en the second run cool, but the first the snmp walk return timeout. in the second router i have 4 policies and the first router 120 policies. could be this???? :(


thanks..!!
User avatar
johnrembo
Cacti User
Posts: 216
Joined: Mon Apr 24, 2006 3:33 am

Post by johnrembo »

mandrade wrote:OK, snmpwalk return after 2 minuts this:

# snmpwalk -On -v 2c -c public <ip> .1.3.6.1.4.1.2636.3.5.2.1.5

.1.3.6.1.4.1.2636.3.5.2.1.5.19.84.114.97.102.102.105.99.45.65.110.97.108.121.115.105.115.45.105.110.14.87.101.98.45.84.114.97.102.102.105.99.45.73.110.2 = Counter64: 0
.1.3.6.1.4.1.2636.3.5.2.1.5.20.84.114.97.102.102.105.99.45.65.110.97.108.121.115.105.115.45.111.117.116.15.87.101.98.45.84.114.97.102.102.105.99.45.79.117.116.2 = Counter64: 0
.1.3.6.1.4.1.2636.3.5.2.1.5.21.71.84.68.45.103.101.45.48.47.51.47.48.46.48.45.105.110.101.116.45.105.21.71.84.68.45.103.101.45.48.47.51.47.48.46.48.45.105.110.101.116.45.105.3 = Counter64: 0
.1.3.6.1.4.1.2636.3.5.2.1.5.21.71.84.68.45.103.101.45.48.47.51.47.48.46.48.45.105.110.101.116.45.111.21.71.84.68.45.103.101.45.48.47.51.47.48.46.48.45.105.110.101.116.45.111.3 = Counter64: 0
etc.....

.97.99.45.50.48.52.56.105.110.116.101.114.45.111.117.116.95.110.97.116.105.111.110.97.108.95.111.117.116.45.103.101.45.48.47.50.47.48.46.50.52.48.54.45.111.2 = Counter64: 9252413331
Timeout: No Response from <ip>

but I have two m20 routers, en the second run cool, but the first the snmp walk return timeout. in the second router i have 4 policies and the first router 120 policies. could be this???? :(


thanks..!!
first, you should increase snmp-timeout for apropriate host at console->devices (if your timeouts are up to 2 mins - the you shoul enter some 150000, but this is stupid solution).
second - you have some serious problems with you snmp, routers or cacti server itself. fix it.
I've heard of m20 snmp problem - ask support for solutions or something. You snmp request should return within 50mili-secons, i'm not even speaking of timeouts.
mandrade
Posts: 5
Joined: Thu Jun 12, 2008 9:38 am

Post by mandrade »

I change the m20 snmp config and fix the time out problem:

snmpwalk -On -v 2c -c public <ip> 1.3.6.1.4.1.2636.3.5.2.1.5
.1.3.6.1.4.1.2636.3.5.2.1.5.6.71.84.68.45.73.78.6.71.84.68.45.105.110.2 = Counter64: 0
.1.3.6.1.4.1.2636.3.5.2.1.5.6.71.84.68.45.73.78.16.51.48.48.109.98.45.78.65.84.73.79.78.65.76.45.49.3 = Counter64: 0
.1.3.6.1.4.1.2636.3.5.2.1.5.7.71.84.68.45.79.85.84.7.71.84.68.45.111.117.116.2 = Counter64: 0
etc.
etc.
.1.3.6.1.4.1.2636.3.5.2.1.5.48.101.115.116.117.100.105.111.115.97.99.101.115.111.114.105.97.99.97.112. = Counter64: 5489222116
You have new mail in /var/spool/mail/root
[root@localhost ~]#


But the problem is the same.

[root@localhost ~]# /usr/bin/php /var/www/html/scripts/juniper-policer-64.php <ip> "2::public::::::MD5::::DES::" index
PHP Warning: Invalid argument supplied for foreach() in /var/www/html/scripts/juniper-policer-64.php on line 33

Warning: Invalid argument supplied for foreach() in /var/www/html/scripts/juniper-policer-64.php on line 33
PHP Notice: Undefined variable: structure in /var/www/html/scripts/juniper-policer-64.php on line 57

Notice: Undefined variable: structure in /var/www/html/scripts/juniper-policer-64.php on line 57
PHP Warning: Invalid argument supplied for foreach() in /var/www/html/scripts/juniper-policer-64.php on line 57

Warning: Invalid argument supplied for foreach() in /var/www/html/scripts/juniper-policer-64.php on line 57


:( help please!!!
User avatar
johnrembo
Cacti User
Posts: 216
Joined: Mon Apr 24, 2006 3:33 am

Post by johnrembo »

mandrade wrote:I change the m20 snmp config and fix the time out problem:

snmpwalk -On -v 2c -c public <ip> 1.3.6.1.4.1.2636.3.5.2.1.5
.1.3.6.1.4.1.2636.3.5.2.1.5.6.71.84.68.45.73.78.6.71.84.68.45.105.110.2 = Counter64: 0
.1.3.6.1.4.1.2636.3.5.2.1.5.6.71.84.68.45.73.78.16.51.48.48.109.98.45.78.65.84.73.79.78.65.76.45.49.3 = Counter64: 0
.1.3.6.1.4.1.2636.3.5.2.1.5.7.71.84.68.45.79.85.84.7.71.84.68.45.111.117.116.2 = Counter64: 0
etc.
etc.
.1.3.6.1.4.1.2636.3.5.2.1.5.48.101.115.116.117.100.105.111.115.97.99.101.115.111.114.105.97.99.97.112. = Counter64: 5489222116
You have new mail in /var/spool/mail/root
[root@localhost ~]#


But the problem is the same.

[root@localhost ~]# /usr/bin/php /var/www/html/scripts/juniper-policer-64.php <ip> "2::public::::::MD5::::DES::" index
PHP Warning: Invalid argument supplied for foreach() in /var/www/html/scripts/juniper-policer-64.php on line 33

Warning: Invalid argument supplied for foreach() in /var/www/html/scripts/juniper-policer-64.php on line 33
PHP Notice: Undefined variable: structure in /var/www/html/scripts/juniper-policer-64.php on line 57

Notice: Undefined variable: structure in /var/www/html/scripts/juniper-policer-64.php on line 57
PHP Warning: Invalid argument supplied for foreach() in /var/www/html/scripts/juniper-policer-64.php on line 57

Warning: Invalid argument supplied for foreach() in /var/www/html/scripts/juniper-policer-64.php on line 57


:( help please!!!
Well my situation is currently same as yours. Everything was working fine for half a year and after last juniper firmware upgrade it came out with snmp-timeouts.

I have just checked on my m320. (JUNOS 8.5R2.10). Still the same - snmpwalk starts returning lots of data and then suddenly terminates with
"Timeout: No Response from xx.xx.xx.xx".
The same shit happens with cacti_snmp_walk in juniper-policer-64.php. This is cacti's build-in function (/lib/snmp.php) and it can't deal with timeout's even if they occur at the very end of snmp query.

Are you sure you aren't getting timeouts? Try running snmpwalk for some 5 times. Maybe timeout's are getting produced with every second/third query and unluckily php script catches them?

ps: what config fix have you applied on m20? Our tech-guys still have no solutions for this. So, until, i have no machine to play on.
mandrade
Posts: 5
Joined: Thu Jun 12, 2008 9:38 am

Post by mandrade »

I`m sure, snmp timeout is out. The firewall filter name can`t be more 50 strings or received snmp timeout. But the problem continuos. Any other idea?

thks johnrembo
User avatar
johnrembo
Cacti User
Posts: 216
Joined: Mon Apr 24, 2006 3:33 am

Post by johnrembo »

mandrade wrote:I`m sure, snmp timeout is out. The firewall filter name can`t be more 50 strings or received snmp timeout. But the problem continuos. Any other idea?

thks johnrembo
thanx for the tip mandrade. I'll fix my configs and will run test environment again...
terziyski
Cacti User
Posts: 93
Joined: Thu Nov 02, 2006 6:02 am
Location: Bulgaria
Contact:

Post by terziyski »

Hi,

I am using:
-Cacti 0.8.7b
-Spine 0.8.7a
-MySQL 5.0.51a
-PHP 5.2.5
-Net-SNMP 5.4.1.3
-RRDTool 1.2.26
-Cygwin 1.5.25-7
-GetIF 2.3.1
-MySQL Administrator 1.1.19
on Windows XP Professional

I tried to use the template, but when I run the script in a console:

/usr/bin/php juniper-policer-64.php <IP> "2::public::::::MD5::::DES::" index

it gives me :

PHP Fatal error: Call to undefined function: snmp_set_oid_numeric_print() in /opt/apache/htdocs/cacti/scripts/functions.php on line 26

any ideas ?
Cacti user
User avatar
johnrembo
Cacti User
Posts: 216
Joined: Mon Apr 24, 2006 3:33 am

Post by johnrembo »

terziyski wrote:Hi,

I am using:
-Cacti 0.8.7b
-Spine 0.8.7a
-MySQL 5.0.51a
-PHP 5.2.5
-Net-SNMP 5.4.1.3
-RRDTool 1.2.26
-Cygwin 1.5.25-7
-GetIF 2.3.1
-MySQL Administrator 1.1.19
on Windows XP Professional

I tried to use the template, but when I run the script in a console:

/usr/bin/php juniper-policer-64.php <IP> "2::public::::::MD5::::DES::" index

it gives me :

PHP Fatal error: Call to undefined function: snmp_set_oid_numeric_print() in /opt/apache/htdocs/cacti/scripts/functions.php on line 26

any ideas ?
windows? :wink:

you can simply comment-out line 26 (and 27 I think) by adding an extra slash "//" or grid "#" at the beginning of line.
theoreticaly it should work - practicaly I haven't tested it on windows yet
[url=http://forums.cacti.net/viewtopic.php?t=24934&highlight=zond]zond plugin[/url]
[url=http://forums.cacti.net/viewtopic.php?t=28384]memorize plugin[/url]
[url=http://forums.cacti.net/viewtopic.php?p=141322#141322]transporter plugin[/url]
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests