[XML] Netscreen CPU Memory and Session stats

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

Moderators: Moderators, Developers

Author
Message
fletch
Cacti User
Posts: 132
Joined: Mon Oct 06, 2003 5:40 pm
Location: Stanford, CA

[XML] Netscreen CPU Memory and Session stats

#1 Post by fletch » Wed Jan 14, 2004 6:32 pm

This archive contains the XML templates exported from the config I use to generate cacti graphs for Netscreen firewall CPU, Memory and Session stats.

Inspired by this thread:
http://www.raxnet.net/board/viewtopic.p ... =netscreen

Please send feedback to [email protected]
Attachments
cacti_netscreen.tar.gz
(5.01 KiB) Downloaded 9863 times

User avatar
TFC
Cacti Pro User
Posts: 722
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

#2 Post by TFC » Tue Jan 20, 2004 4:40 am

Hi,
Sorry, but I dont understand step 3 and 4 and 5 in INSTALL.txt.
Can you describe me how can I do these?

User avatar
TFC
Cacti Pro User
Posts: 722
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

#3 Post by TFC » Tue Jan 20, 2004 9:40 am

TFC wrote:Hi,
Sorry, but I dont understand step 3 and 4 and 5 in INSTALL.txt.
Can you describe me how can I do these?
OK. I did these steps.
Now, another problem exists:
I use cactid.
When I run cactid manually. I get these messages:
[[email protected]_test bin]# ./cactid
cactid version 0.8.4 starting.
Using cactid config file [cactid.conf].
Connecting to MySQL database 'cacti' on 'localhost'...
Cactid Ready.
Connecting to MySQL database 'cacti' on 'localhost'...
Connecting to MySQL database 'cacti' on 'localhost'...
Connecting to MySQL database 'cacti' on 'localhost'...
sh: /www/htdocs/cacti/scripts/netscreen_stats.pl: /usr/bin/perl: bad interpreter: Permission denied
[10] Error executing command, '/www/htdocs/cacti/scripts/netscreen_stats.pl 192.168.113.120'
[10] MUTLI command: /www/htdocs/cacti/scripts/netscreen_stats.pl 192.168.113.120, output: U
[2] SNMP v1: 10.200.100.12, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.2, value: 372807968
sh: /www/htdocs/cacti/scripts/netscreen_stats.pl: /usr/bin/perl: bad interpreter: Permission denied
[2] SNMP v1: 10.200.100.12, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.2, value: 292468073
RRDCMD: update '/www/htdocs/cacti/rra/m_2b_7507_traffic_in_15.rrd' --template traffic_in:traffic_out N:372807968:292468073
[10] Error executing command, '/www/htdocs/cacti/scripts/netscreen_stats.pl 192.168.113.120'
[10] MUTLI command: /www/htdocs/cacti/scripts/netscreen_stats.pl 192.168.113.120, output: U
sh: /www/htdocs/cacti/scripts/netscreen_stats.pl: /usr/bin/perl: bad interpreter: Permission denied
[2] SNMP v1: 10.200.100.12, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.3, value: 1824854812
[10] Error executing command, '/www/htdocs/cacti/scripts/netscreen_stats.pl 192.168.113.120'
[10] MUTLI command: /www/htdocs/cacti/scripts/netscreen_stats.pl 192.168.113.120, output: U
...
...
..
Then I run the script manually :
[[email protected]_test scripts]# pwd
/www/htdocs/cacti/scripts
[[email protected]_test scripts]# perl netscreen_stats.pl 192.168.113.120
Timeout: No Response from 192.168.113.120
cpu1: cpu5: cpu15: memory_allocated: memoryAvailable: memoryFragmented: sessionsAllocated: sessionsMaximum: sessionsFailed: [[email protected]_test scripts]#
And my graphs shows "nan"
Anybody have an idea?

fletch
Cacti User
Posts: 132
Joined: Mon Oct 06, 2003 5:40 pm
Location: Stanford, CA

timeouts

#4 Post by fletch » Tue Jan 20, 2004 1:58 pm

You must allow SNMP in the netscreen config:
Network->Interfaces (check SNMP in the "Service Options" section)

You might also need to add config for the community string in:
Configuration->Report Settings->SNMP

User avatar
TFC
Cacti Pro User
Posts: 722
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

#5 Post by TFC » Wed Jan 21, 2004 2:22 am

Hi

Configuration->Report Settings->SNMP.........I have already wrtitten community string in this section

Network->Interfaces I control that every interfaces allow the snmp traffic.
I use :
[[email protected]_test root] snmpget -c <snmp_community> XXX.XXX.XXX.XXX enterprises.3224.16.1.2.0
enterprises.3224.16.1.2.0=3
As you see I can collect data from Netscreen firewall, community string and snmp configs are ok.
I think may be my perl is not approriate one for this script.
My Linux is RH7.3 and
perl 5.6.1-34.99.6
perl-CGI 2.752-34.99.6
perl-CPAN 1.59_54-34.99.6
perl-DB _File 1.75-34.99.6
perl-NDBM_File 1.75-34.99.6
What is the problem?

fletch
Cacti User
Posts: 132
Joined: Mon Oct 06, 2003 5:40 pm
Location: Stanford, CA

locate perl

#6 Post by fletch » Wed Jan 21, 2004 1:09 pm

You may need to change the first line of the script to point to your perl location:
#!/usr/local/bin/perl

do a
which perl
or
locate perl
if you are in doubt...

Then run the script from the command line as your cactiuser:
scripts/netscreen_stats.pl
You should get something like:
cpu1:1 cpu5:1 cpu15:1 memory_allocated:131975680 memoryAvailable:117585408 memoryFragmented:8667 sessionsAllocated:1500 sessionsMaximum:250000 sessionsFailed:0

Guest

#7 Post by Guest » Thu Jan 22, 2004 8:17 pm

The script runs fine for me locally:

perl netscreen_stats.pl 172.16.1.1

cpu1:2 cpu5:2 cpu15:2 memory_allocated:28785520 memoryAvailable:76753856 memoryFragmented:2834 sessionsAllocated:177 sessionsMaximum:16000 sessionsFailed:0

But my graphs still show Nan inside cacti. My interface traffic graphs are working fine, just the netscreen_stats graphs aren't working.

fletch
Cacti User
Posts: 132
Joined: Mon Oct 06, 2003 5:40 pm
Location: Stanford, CA

#8 Post by fletch » Fri Jan 23, 2004 12:54 am

Try adding the full path to your snmpwalk - eg:
/usr/local/bin/snmpwalk
in the netscreen_stats.pl script

and check the log of your cactid or cmd.php has the perl script call and output correct.
eg I log my cactid cronjob to /tmp for debugging:
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/cactid/bin/cactid > /tmp/cactid.out 2>&1

grep netscreen /tmp/cactid.out

[46] MUTLI command: /usr/local/cacti/scripts/netscreen_stats.pl, output: cpu1:17 cpu5:16 cpu15:16 memory_allocatd:131975808 memoryAvailable:117585280 memoryFragmented:8672 sessionsAllocated:503 sessionsMaximum:250000 sessionFailed:0
[46] MUTLI command: /usr/local/cacti/scripts/netscreen_stats.pl, output: cpu1:16 cpu5:16 cpu15:16 memory_allocatd:131975808 memoryAvailable:117585280 memoryFragmented:8672 sessionsAllocated:536 sessionsMaximum:250000 sessionFailed:0

User avatar
TFC
Cacti Pro User
Posts: 722
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

#9 Post by TFC » Tue Feb 10, 2004 3:35 am

Ok. I change the script like this:

Code: Select all

open(tmp_lines,"/usr/bin/snmpwalk -v 1 -c zzzzzz $hostname .1.3.6.1.4.1.3224.16|");
@output_a = <tmp_lines>;
#print $output_a[0];
#print $output_a[1];
#print $#output_a;
for($i=0;$i<=$#output_a;$i++)
{
$output_a[$i] =~s/^.+= //;
$output_a[$i] =~s/[ \n]+$//;
}
#$output =~ /SNMPv2-SMI::enterprises.3224.16.1.2.0 = INTEGER: (.*)/;
print "cpu1:".$output_a[1]." ";
#$output =~ /SNMPv2-SMI::enterprises.3224.16.1.3.0 = INTEGER: (.*)/;
print "cpu5:".$output_a[2]." ";
#$output =~ /SNMPv2-SMI::enterprises.3224.16.1.4.0 = INTEGER: (.*)/;
print "cpu15:".$output_a[3]." ";
#$output =~ /SNMPv2-SMI::enterprises.3224.16.2.1.0 = INTEGER: (.*)/;
print "memory_allocated:".$output_a[4]." ";
#$output =~ /SNMPv2-SMI::enterprises.3224.16.2.2.0 = INTEGER: (.*)/;
print "memoryAvailable:".$output_a[5]." ";
#$output =~ /SNMPv2-SMI::enterprises.3224.16.2.3.0 = INTEGER: (.*)/;
print "memoryFragmented:".$output_a[6]." ";
#$output =~ /SNMPv2-SMI::enterprises.3224.16.3.2.0 = INTEGER: (.*)/;
print "sessionsAllocated:".$output_a[7]." ";
#$output =~ /SNMPv2-SMI::enterprises.3224.16.3.3.0 = INTEGER: (.*)/;
print "sessionsMaximum:".$output_a[8]." ";
#$output =~ /SNMPv2-SMI::enterprises.3224.16.3.4.0 = INTEGER: (.*)/;
print "sessionsFailed:".$output_a[9]." ";
And when I run scripte manually I get tis :
[[email protected]_test scripts]# perl netscreen_stats.pl 192.168.X.X
cpu1:3 cpu5:1 cpu15:1 memory_allocated:135225184 memoryAvailable:114335904 memoryFragmented:8396 sessionsAllocated:10449 sessionsMaximum:250000 sessionsFailed:0
But when I run the cactidI get this:
sh: /usr/local/cacti/scripts/netscreen_stats.pl: No such file or directory
[19] Error executing command, '/usr/local/cacti/scripts/netscreen_stats.pl'
[19] MUTLI command: /usr/local/cacti/scripts/netscreen_stats.pl, output: U
As you see, cactid look for the script in /usr/local/cacti/scripts directory.But my script is in /www/htdocs/cacti/scripts directory.
I change the scripts path in Data inpt methods/Netscreen -stats section. But cacti still look wrong directory. After that I reconfigure xml files and save them. then I export these. But cactid still look at wrong directory for script.
Nevermind , I crate /usr/local/cacti/scripts directory and copy the scripts.
Everything seems ok. But cacti still send me a error:
[19] MUTLI command: /usr/local/cacti/scripts/netscreen_stats.pl, output: cpu1: cpu5: cpu15: memory_allocated: memoryAvailable: memoryFragmented: sessionsAllocated: sessionsMaximum: sessionsFailed:
MULTI expansion: found fieldname: cpu1, found rrdname: cpu1, local_data_id: 80
MULTI expansion: found fieldname: cpu15, found rrdname: cpu15, local_data_id: 80
MULTI expansion: found fieldname: memoryAvailable, found rrdname: memoryAvailable, local_data_id: 80
MULTI expansion: found fieldname: sessionsAllocated, found rrdname: sessionsAllocated, local_data_id: 80
MULTI expansion: found fieldname: sessionsFailed, found rrdname: sessionsFailed, local_data_id: 80
RRDCMD: update '/www/htdocs/cacti/rra/netscreen1_cpu1_80.rrd' --template cpu1:cpu15:memoryAvailable:sessionsAllocated:sessionsFailed N:cpu5:memory_allocated:memoryFragmented:sessionsMaximum
Timeout: No Response from localhost
[19] MUTLI command: /usr/local/cacti/scripts/netscreen_stats.pl, output: cpu1: cpu5: cpu15: memory_allocated: memoryAvailable: memoryFragmented: sessionsAllocated: sessionsMaximum: sessionsFailed:
MULTI expansion: found fieldname: cpu1, found rrdname: cpu1, local_data_id: 81
MULTI expansion: found fieldname: cpu15, found rrdname: cpu15, local_data_id: 81
MULTI expansion: found fieldname: memoryAvailable, found rrdname: memoryAvailable, local_data_id: 81
MULTI expansion: found fieldname: sessionsAllocated, found rrdname: sessionsAllocated, local_data_id: 81
MULTI expansion: found fieldname: sessionsFailed, found rrdname: sessionsFailed, local_data_id: 81
RRDCMD: update '/www/htdocs/cacti/rra/netscreen1_cpu1_81.rrd' --template cpu1:cpu15:memoryAvailable:sessionsAllocated:sessionsFailed N:cpu5:memory_allocated:memoryFragmented:sessionsMaximum

..........
..........
OK u:0.01 s:0.00 r:14.01
OK u:0.01 s:0.00 r:14.01
OK u:0.01 s:0.01 r:14.01
OK u:0.01 s:0.01 r:14.01
OK u:0.01 s:0.01 r:14.01
OK u:0.01 s:0.01 r:14.01
OK u:0.01 s:0.01 r:14.01
OK u:0.01 s:0.01 r:14.01
....
....
ERROR: expected 5 data source readings (got 4) from N:cpu5:memory_allocated:memoryFragmented:sessionsMaximum:...
OK u:0.01 s:0.01 r:14.01
ERROR: expected 5 data source readings (got 4) from N:cpu5:memory_allocated:memoryFragmented:sessionsMaximum:...
....
Can you help me?
Last edited by TFC on Mon Sep 13, 2004 3:24 am, edited 1 time in total.

Caliban
Posts: 31
Joined: Wed Sep 08, 2004 2:07 am
Location: Maine

#10 Post by Caliban » Wed Sep 08, 2004 2:38 am

Thanks Fletch for the work you've done. Hope you don't mind I fixed a few bugs I found and repackaged everything:
+The script assumes the community is public it now gets it from the Device entry snmp_community
+Input String of Data Input Method tried to find the script in a static location now it uses the <path_cacti> macro.
+Create a Host Template called Netscreen that also includes Associated Data Queries SNMP - Interface Statistics and Unix - Get Mounted Partitions

This is my first attempted at giving back to the Open Source community as well as Cacti so go easy on me if I messed up somewhere.
Attachments
cacti_netscreen.zip
(11.98 KiB) Downloaded 3861 times

User avatar
TFC
Cacti Pro User
Posts: 722
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

#11 Post by TFC » Mon Sep 13, 2004 3:23 am

hi,
I import new version of netscreen_stats
but i have these errors:
[617] MUTLI command: perl /www/htdocs/cacti/scripts/netscreen_stats.pl 192.168.X.X ibRA74Di, output: cpu1: cpu5: cpu15: memory_allocated: memoryAvailable: memoryFragmented: sessionsAllocated: sessionsMaximum: sessionsFailed:
MULTI expansion: found fieldname: cpu1, found rrdname: cpu1, local_data_id: 7050
MULTI expansion: found fieldname: cpu15, found rrdname: cpu15, local_data_id: 7050
MULTI expansion: found fieldname: memoryAvailable, found rrdname: memoryAvailable, local_data_id: 7050
MULTI expansion: found fieldname: sessionsAllocated, found rrdname: sessionsAllocated, local_data_id: 7050
MULTI expansion: found fieldname: sessionsFailed, found rrdname: sessionsFailed, local_data_id: 7050
RRDCMD: update '/www/htdocs/cacti/rra/netscreen_birinci_memoryavailable_7050.rrd' --template cpu1:cpu15:memoryAvailable:sessionsAllocated:sessionsFailed N:cpu5:memory_allocated:memoryFragmented:sessionsMaximum
RRDCMD: create '/www/htdocs/cacti/rra/netscreen_birinci_memoryavailable_7051.rrd' --step 300 DS:cpu1:GAUGE:600:0:100 DS:sessionsAllocated:GAUGE:600:0:300000 DS:sessionsMaximum:GAUGE:600:0:300000 DS:cpu15:GAUGE:600:0:100 DS:cpu5:GAUGE:600:0:100 DS:memory_allocated:GAUGE:600:0:400000000 DS:memoryAvailable:GAUGE:600:0:300000000 DS:sessionsFailed:GAUGE:600:0:100 DS:memoryFragmented:GAUGE:600:0:30000000 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:1:17280 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:6:700 RRA:MAX:0.5:1:17280 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797
[617] MUTLI command: perl /www/htdocs/cacti/scripts/netscreen_stats.pl 192.168.X.X ibRA74Di, output: cpu1: cpu5: cpu15: memory_allocated: memoryAvailable: memoryFragmented: sessionsAllocated: sessionsMaximum: sessionsFailed:
MULTI expansion: found fieldname: cpu1, found rrdname: cpu1, local_data_id: 7051
MULTI expansion: found fieldname: cpu15, found rrdname: cpu15, local_data_id: 7051
MULTI expansion: found fieldname: memoryAvailable, found rrdname: memoryAvailable, local_data_id: 7051
MULTI expansion: found fieldname: sessionsAllocated, found rrdname: sessionsAllocated, local_data_id: 7051
MULTI expansion: found fieldname: sessionsFailed, found rrdname: sessionsFailed, local_data_id: 7051
RRDCMD: update '/www/htdocs/cacti/rra/netscreen_birinci_memoryavailable_7051.rrd' --template cpu1:cpu15:memoryAvailable:sessionsAllocated:sessionsFailed N:cpu5:memory_allocated:memoryFragmented:sessionsMaximum
RRDCMD: create '/www/htdocs/cacti/rra/netscreen_birinci_memoryavailable_7052.rrd' --step 300 DS:sessionsFailed:GAUGE:600:0:100 DS:sessionsAllocated:GAUGE:600:0:300000 DS:cpu1:GAUGE:600:0:100 DS:memoryAvailable:GAUGE:600:0:300000000 DS:sessionsMaximum:GAUGE:600:0:300000 DS:memory_allocated:GAUGE:600:0:400000000 DS:cpu15:GAUGE:600:0:100 DS:cpu5:GAUGE:600:0:100 DS:memoryFragmented:GAUGE:600:0:30000000 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:1:17280 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:6:700 RRA:MAX:0.5:1:17280 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797
[617] MUTLI command: perl /www/htdocs/cacti/scripts/netscreen_stats.pl 192.168.X.X ibRA74Di, output: cpu1: cpu5: cpu15: memory_allocated: memoryAvailable: memoryFragmented: sessionsAllocated: sessionsMaximum: sessionsFailed:
MULTI expansion: found fieldname: cpu1, found rrdname: cpu1, local_data_id: 7052
MULTI expansion: found fieldname: cpu15, found rrdname: cpu15, local_data_id: 7052
MULTI expansion: found fieldname: memoryAvailable, found rrdname: memoryAvailable, local_data_id: 7052
MULTI expansion: found fieldname: sessionsAllocated, found rrdname: sessionsAllocated, local_data_id: 7052
MULTI expansion: found fieldname: sessionsFailed, found rrdname: sessionsFailed, local_data_id: 7052
RRDCMD: update '/www/htdocs/cacti/rra/netscreen_birinci_memoryavailable_7052.rrd' --template cpu1:cpu15:memoryAvailable:sessionsAllocated:sessionsFailed N:cpu5:memory_allocated:memoryFragmented:sessionsMaximum

----- Poll complete. (Polling Time: 33.477871s) -----

OK u:0.18 s:0.21 r:33.85
OK u:0.18 s:0.21 r:33.85
OK u:0.30 s:0.23 r:33.99
OK u:0.30 s:0.23 r:33.99
OK u:0.30 s:0.23 r:33.99
OK u:0.30 s:0.23 r:33.99
OK u:0.30 s:0.23 r:33.99
OK u:0.30 s:0.23 r:33.99
OK u:0.30 s:0.23 r:33.99
OK u:0.30 s:0.23 r:33.99
OK u:0.30 s:0.23 r:33.99
OK u:0.30 s:0.23 r:33.99
ERROR: expected 5 data source readings (got 4) from N:cpu5:memory_allocated:memoryFragmented:sessionsMaximum:...
OK u:0.30 s:0.23 r:33.99
OK u:0.42 s:0.25 r:34.13
ERROR: expected 5 data source readings (got 4) from N:cpu5:memory_allocated:memoryFragmented:sessionsMaximum:...
OK u:0.42 s:0.25 r:34.13
OK u:0.53 s:0.28 r:34.27
ERROR: expected 5 data source readings (got 4) from N:cpu5:memory_allocated:memoryFragmented:sessionsMaximum:...
OK u:0.53 s:0.28 r:34.27
Anybody can help me?

Caliban
Posts: 31
Joined: Wed Sep 08, 2004 2:07 am
Location: Maine

#12 Post by Caliban » Tue Sep 14, 2004 1:10 am

Just a guess.. try deleting and recreating your Graphs. My guess is you imported the new scripts but are still using the old graphs. Make sure you're using the new templates too thats included.

User avatar
TFC
Cacti Pro User
Posts: 722
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

#13 Post by TFC » Tue Sep 14, 2004 1:52 am

I delete data sources, rrd files about netscreen and re create everything but no change...

tsanchez37

#14 Post by tsanchez37 » Fri Sep 17, 2004 3:37 pm

I have just found that the netscreen_stats.pl script doesn't appear to work with 0.8.6 cactid. I've tried it on two different machines. It appears that it may be a pathing issue, but I don't have time to troubleshoot it right now.

I'll try to fix it later at work - Will post anything I figure out.

Caliban
Posts: 31
Joined: Wed Sep 08, 2004 2:07 am
Location: Maine

#15 Post by Caliban » Sun Sep 19, 2004 10:54 pm

Odd.. its still working on mine after the upgrade without a hitch, and I thought I fixed the path issues..

Post Reply