ports/106720: [NEW PORT] net-mgmt/routers2-extras: Extra extensions and scripts for routers2 frontend
Xavier Beaudouin
kiwi at oav.net
Thu Dec 14 15:39:26 UTC 2006
>Number: 106720
>Category: ports
>Synopsis: [NEW PORT] net-mgmt/routers2-extras: Extra extensions and scripts for routers2 frontend
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Thu Dec 14 15:30:07 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: Xavier Beaudouin
>Release: FreeBSD 6.2-PRERELEASE i386
>Organization:
Association KAZAR / The Caudium Group
>Environment:
System: FreeBSD proxy.home.oav.net 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #0: Tue Nov 7 22:12:43 CET
>Description:
Extras extensions and third party scripts for routers2 frontend
WWW: http://www.steveshipway.org/software/
Generated with FreeBSD Port Tools 0.77
>How-To-Repeat:
>Fix:
--- routers2-extras-2.17.shar begins here ---
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# routers2-extras
# routers2-extras/files
# routers2-extras/files/patch-buildwan.pl
# routers2-extras/files/patch-cfgmaker_host.pl
# routers2-extras/files/patch-95.pl
# routers2-extras/Makefile
# routers2-extras/distinfo
# routers2-extras/pkg-descr
# routers2-extras/pkg-plist
#
echo c - routers2-extras
mkdir -p routers2-extras > /dev/null 2>&1
echo c - routers2-extras/files
mkdir -p routers2-extras/files > /dev/null 2>&1
echo x - routers2-extras/files/patch-buildwan.pl
sed 's/^X//' >routers2-extras/files/patch-buildwan.pl << 'END-of-routers2-extras/files/patch-buildwan.pl'
X--- buildwan.pl.orig Fri Jun 16 00:17:53 2006
X+++ buildwan.pl Thu Dec 14 15:41:08 2006
X@@ -1,4 +1,4 @@
X-#!/usr/bin/perl
X+#!%%PERL%%
X #
X # Try to build configuration files for all the routers in the WAN,
X # by recursively scanning them. Can take a long time to run!
X@@ -16,7 +16,7 @@
X use strict;
X use Net::SNMP;
X use FileHandle;
X-use vars qw($opt_L $opt_h $opt_s $opt_c $opt_D $opt_w $opt_N $opt_A);
X+use vars qw($opt_L $opt_h $opt_s $opt_c $opt_D $opt_w $opt_N $opt_A $opt_p);
X use Getopt::Std;
X
X my( $conffile, %config, at cfgfiles, $pathsep );
X@@ -32,7 +32,12 @@
X my($IPIFINDEX) = "1.3.6.1.2.1.4.20.1.2";
X my($IPROUTEGW) = "1.3.6.1.2.1.4.21.1.7";
X my($CPUOID) = "1.3.6.1.4.1.9.2.1.58.0";
X+my($FNDRYCPUOID) = "1.3.6.1.4.1.1991.1.1.2.1.35.0";
X my($MEMOID) = "1.3.6.1.4.1.9.9.48.1.1.1.5.1"; # have to find out
X+my($FNDRYMEMOID) = "1.3.6.1.4.1.1991.1.1.2.1.55.0";
X+my($FNDRYMAXMEMOID) = "1.3.6.1.4.1.1991.1.1.2.1.54.0";
X+my($FNDRYBGPOID) = "1.3.6.1.4.1.1991.1.2.11.1.27.0";
X+my($FNDRYTEMPOID) = "1.3.6.1.4.1.1991.1.1.1.1.18.0";
X # Cisco 7200 Series Temperature
X my($CISCOTEMP) = "1.3.6.1.4.1.9.9.13.1.3.1";
X
X@@ -47,7 +52,8 @@
X my( $domain ) = "...\.adsw\.com";
X my( @community ) = ( "public" );
X my( $community );
X-my( $workdir ) = "/var/rrdtool/auto";
X+my( $workdir ) = "/var/db/rrdtool";
X+my( $pathadd ) = "/usr/local/bin";
X my( @queue ) = ( );
X my( $subdir ) = "";
X my( @filelist ) = ();
X@@ -80,8 +86,9 @@
X {
X my($snmp, $resp, $snmperr, $k);
X my($n,$v,$ip);
X- my($cpuok,$memok) ;
X+ my($cpuok,$memok,$bgpok,$tempok);
X my($rcomm) = "";
X+ my($fndrymaxmem);
X
X $router = $_[0];
X $cpuok = $memok = "";
X@@ -268,15 +275,48 @@
X $routerhostname = $routerip if(!$routerhostname);
X
X # now check to see if the router has an OID for CPU and mem
X- $resp = $snmp->get_request( $CPUOID, $MEMOID );
X+ $resp = $snmp->get_request( $MEMOID );
X if( $resp ) {
X- $cpuok = $CPUOID if( $resp->{$CPUOID} );
X $memok = $MEMOID if( $resp->{$MEMOID} );
X+ } else {
X+ $resp = $snmp->get_request( $FNDRYMEMOID );
X+ if( $resp ) {
X+ $memok = $FNDRYMEMOID if( $resp->{$FNDRYMEMOID} );
X+ $resp = $snmp->get_request( $FNDRYMAXMEMOID );
X+ if( $resp ) {
X+ $fndrymaxmem = $resp->{$FNDRYMAXMEMOID} if( $resp->{$FNDRYMAXMEMOID} );
X+ }
X+ }
X }
X
X+ # Try $CPUOID, if this doesn't work, try Foundry one
X+ $resp = $snmp->get_request( $CPUOID );
X+ if( $resp ) {
X+ $cpuok = $CPUOID if( $resp->{$CPUOID} );
X+ } else {
X+ $resp = $snmp->get_request( $FNDRYCPUOID );
X+ if( $resp ) {
X+ $cpuok = $FNDRYCPUOID if( $resp->{$FNDRYCPUOID} );
X+ }
X+ }
X+
X+ # Try to check if BGP routes exists
X+ $resp = $snmp->get_request( $FNDRYBGPOID );
X+ if( $resp ) {
X+ $bgpok = $FNDRYBGPOID if( $resp->{$FNDRYBGPOID} );
X+ }
X+
X+ # Try to check if router has temp sensors (currently only foundry !)
X+ $resp = $snmp->get_request( $FNDRYTEMPOID );
X+ if( $resp ) {
X+ $tempok = $FNDRYTEMPOID if( $resp->{$FNDRYTEMPOID} );
X+ }
X+
X+
X $routers{$router} = { interfaces=>{%interfaces}, name=>$routerdesc,
X ip=>$routerip, hostname=>$routerhostname, community=>$rcomm,
X- cpu=>$cpuok, mem=>$memok };
X+ cpu=>$cpuok, mem=>$memok, fndrymaxmem=>$fndrymaxmem,
X+ bgp=>$bgpok, temp=>$tempok };
X
X print "\rFinished router $routerhostname at address $routerip\n";
X
X@@ -332,15 +372,20 @@
X my($k,$nextip,$icon);
X my($t,$d,$f);
X my($mb,$pfx);
X+ my $descr;
X
X $n = ucfirst $n if($n !~ /\./);
X
X foreach $k ( keys %$ifp ) {
X+ my $descr;
X+ $descr = $ifp->{$k}->{descr};
X+ $descr =~ s/\n//g;
X $icon = "interface-sm.gif";
X $pfx = "";
X $d = "";
X $t = $h.".".$k;
X- $t = $h.".".$ifp->{$k}->{descr} if($ifp->{$k}->{descr});
X+ #$t = $h.".".$ifp->{$k}->{descr} if($ifp->{$k}->{descr});
X+ $t = $h.".".$descr if($descr);
X $t =~ s/[\[\]#\/\\\s]+/./g;
X $t =~ s/\.+/./g;
X $t = lc $t;
X@@ -349,7 +394,7 @@
X if(!$ifp->{$k}->{speed} or !$c or !$h) {
X $pfx = "# ";
X }
X- if(!$includelans and $ifp->{$k}->{descr} =~ /(ether|token)/i) {
X+ if(!$includelans and $descr =~ /(ether|token)/i) {
X $pfx = "# ";
X }
X # print "$k".$ifp->{$k}{state}.": ".$ifp->{$k}{descr}
X@@ -388,10 +433,10 @@
X
X print CFG $pfx."Title[".$t."]: $n";
X print CFG " (".$ifp->{$k}->{ip}.")" if($ifp->{$k}->{ip});
X- print CFG ": ".$ifp->{$k}->{descr}." $d\n";
X+ print CFG ": ".$descr." $d\n";
X print CFG $pfx."PageTop[".$t."]: <H1>Traffic analysis for "
X- .$ifp->{$k}->{descr}."</H1>\n";
X- print CFG $pfx."SetEnv[".$t."]: MRTG_INT_DESCR=\"".$ifp->{$k}->{descr}
X+ .$descr."</H1>\n";
X+ print CFG $pfx."SetEnv[".$t."]: MRTG_INT_DESCR=\"".$descr
X ."\" MRTG_INT_IP=\"".$ifp->{$k}->{ip}."\"\n";
X if($mb > 1000000) {
X print CFG $pfx."routers.cgi*UnScaled[$t]: none\n"
X@@ -408,7 +453,7 @@
X .$ifp->{$k}->{destination}[2]." router-sm.gif\n";
X }
X print CFG $pfx."routers.cgi*ShortDesc[$t]: "
X- .$ifp->{$k}->{descr}." (".(ucfirst $ifp->{$k}->{destination}[0])
X+ .$descr." (".(ucfirst $ifp->{$k}->{destination}[0])
X .")\n"
X if( $ifp->{$k}->{destination}[0]
X # and ($ifp->{$k}->{destination}[0] !~ /^\d/i)
X@@ -431,7 +476,8 @@
X open CFG, ">$fname";
X print CFG "# MRTG config for router ".$routers{$rk}{hostname}
X ." community ".$routers{$rk}{community}
X- ."\n\nWorkdir: $workdir\nLogformat: rrdtool\nOptions[_]: growright bits \n";
X+ ."\n\nWorkdir: $workdir\n"
X+ ."PathAdd: $pathadd\nLogformat: rrdtool\nOptions[_]: growright bits \n";
X
X print CFG "routers.cgi*Icon: router-sm.gif\n"
X ."routers.cgi*ShortDesc: ".$routers{$rk}{name}."\n\n";
X@@ -451,6 +497,7 @@
X .$routers{$rk}{name}." CPU Load\n";
X print CFG "PageTop[".$routers{$rk}{hostname}.".CPU]: CPU Stats\n";
X print CFG "routers.cgi*Mode[".$routers{$rk}{hostname}.".CPU]: cpu\n";
X+ print CFG "routers.cgi*UnScaled[".$routers{$rk}{hostname}.".CPU]: none\n";
X print CFG "routers.cgi*ShortDesc[".$routers{$rk}{hostname}
X .".CPU]: CPU Stats\n";
X } else {
X@@ -461,7 +508,11 @@
X print CFG "Target[".$routers{$rk}{hostname}.".MEM]: "
X .$routers{$rk}{mem}."&".$routers{$rk}{mem}.":"
X .$routers{$rk}{community}."\@".$routers{$rk}{hostname}."\n";
X- print CFG "MaxBytes[".$routers{$rk}{hostname}.".MEM]: 64000000\n";
X+ if( $routers{$rk}{mem} == $FNDRYMEMOID ) {
X+ print CFG "MaxBytes[".$routers{$rk}{hostname}.".MEM]: ".$routers{$rk}{fndrymaxmem}."\n";
X+ } else {
X+ print CFG "MaxBytes[".$routers{$rk}{hostname}.".MEM]: 64000000\n";
X+ }
X print CFG "Options[".$routers{$rk}{hostname}.".MEM]: "
X ."nopercent integer gauge noo\n";
X print CFG "routers.cgi*UnScaled[".$routers{$rk}{hostname}.".MEM]: none\n";
X@@ -480,6 +531,61 @@
X } else {
X print CFG "# Unable to identify a Memory usage OID in MIB\n";
X }
X+
X+ if( $routers{$rk}{bgp} ) {
X+ print CFG "# BGP routes\n";
X+ print CFG "Target[".$routers{$rk}{hostname}.".BGP]: "
X+ .$routers{$rk}{bgp}."&".$routers{$rk}{bgp}.":"
X+ .$routers{$rk}{community}."\@".$routers{$rk}{hostname}."\n";
X+ print CFG "MaxBytes[".$routers{$rk}{hostname}.".BGP]: 100000000\n";
X+ print CFG "Options[".$routers{$rk}{hostname}.".BGP]: "
X+ ."absolute nopercent integer gauge noo\n";
X+ print CFG "routers.cgi*UnScaled[".$routers{$rk}{hostname}.".BGP]: none\n";
X+ print CFG "Title[".$routers{$rk}{hostname}.".BGP]: "
X+ .$routers{$rk}{name}." Total BGP routes\n";
X+ print CFG "ShortLegend[".$routers{$rk}{hostname}.".BGP]: Routes\n";
X+ print CFG "YLegend[".$routers{$rk}{hostname}.".BGP]: BGP Routes\n";
X+ print CFG "PageTop[".$routers{$rk}{hostname}.".BGP]: Total BGP Routes\n";
X+ print CFG "LegendI[".$routers{$rk}{hostname}.".BGP]: Routes:\n";
X+ print CFG "Legend1[".$routers{$rk}{hostname}.".BGP]: Routes\n";
X+ print CFG "Legend3[".$routers{$rk}{hostname}.".BGP]: Peak Routes\n";
X+ print CFG "routers.cgi*ShortDesc[".$routers{$rk}{hostname}
X+ .".BGP]: BGP Routes\n";
X+ print CFG "routers.cgi*Options[".$routers{$rk}{hostname}
X+ .".BGP]: noo, nopercent, absolute, nototal, nopercentile\n";
X+ } else {
X+ print CFG "# No BGP routes OID in MIB\n";
X+ }
X+
X+ if( $routers{$rk}{temp} ) {
X+ print CFG "# Temperature\n";
X+ # Warning Foundry OID is temperature * 2, so we have to divide it by 2
X+ print CFG "Target[".$routers{$rk}{hostname}.".TEMP]: "
X+ .$routers{$rk}{temp}."&".$routers{$rk}{temp}.":"
X+ .$routers{$rk}{community}."\@".$routers{$rk}{hostname}." / 2\n";
X+ # 100°C is sufficient to handle this. At this temperature, we can think
X+ # that router ... near to die.
X+ print CFG "MaxBytes[".$routers{$rk}{hostname}.".TEMP]: 100\n";
X+ print CFG "Options[".$routers{$rk}{hostname}.".TEMP]: "
X+ ."absolute nopercent gauge noo\n";
X+ print CFG "routers.cgi*UnScaled[".$routers{$rk}{hostname}.".TEMP]: none\n";
X+ print CFG "Title[".$routers{$rk}{hostname}.".TEMP]: "
X+ .$routers{$rk}{name}." Temperature\n";
X+ print CFG "ShortLegend[".$routers{$rk}{hostname}.".TEMP]: °C\n";
X+ print CFG "PageTop[".$routers{$rk}{hostname}.".TEMP]: Temperature\n";
X+ print CFG "LegendI[".$routers{$rk}{hostname}.".TEMP]: Temperature\n";
X+ print CFG "Legend1[".$routers{$rk}{hostname}.".TEMP]: Temperature\n";
X+ print CFG "Legend3[".$routers{$rk}{hostname}.".TEMP]: Peak Temperature\n";
X+ print CFG "routers.cgi*ShortDesc[".$routers{$rk}{hostname}
X+ .".TEMP]: Temperature\n";
X+ print CFG "routers.cgi*Options[".$routers{$rk}{hostname}
X+ .".TEMP]: noo, nopercent, absolute, nototal, nopercentile\n";
X+ print CFG "routers.cgi*Icon[".$routers{$rk}{hostname}
X+ .".TEMP]: temp-sm.gif\n";
X+ } else {
X+ print CFG "# No Temperature OID in MIB\n";
X+ }
X+
X
X close CFG;
X
X@@ -495,10 +601,10 @@
X $script = "/cgi-bin/routers2.pl";
X }
X
X-getopts('hc:D:s:Lw:NA');
X+getopts('hc:D:s:Lw:NAp:');
X
X if($opt_h or $#ARGV<0) {
X- print "Usage: buildwan -h\n buildwan [-L][-A][-N][-s <subdir>][-c <communitylist>][-D <domainname>] -w <workdir> <router>...\n";
X+ print "Usage: buildwan -h\n buildwan [-L][-A][-N][-s <subdir>][-c <communitylist>][-D <domainname>] -w <workdir> -p <rrdpath> <router>...\n";
X print "-L: Include ethernet/token ring Lan interfaces\n";
X print "-A: Include ethernet/token ring Lan interfaces even if they are down\n";
X print "-N: Don't browse network neighors.\n";
X@@ -506,6 +612,7 @@
X print "-D: Specify domain name to be stripped from hostnames in descriptions\n";
X print "-c: Specify SNMP community string (default is 'public'), separate with commas\n";
X print "-w: Specify Work directory where the .rrd files go.\n";
X+ print "-p: Specify the rddtool path (default is /usr/local/bin).\n";
X
X exit 1;
X }
X@@ -515,6 +622,7 @@
X $includelans = 1 if($opt_L);
X $includealllan = 1 if($opt_A);
X $workdir = $opt_w if($opt_w);
X+$pathadd = $opt_p if($opt_p);
X @community = split /,\s*/,$opt_c if($opt_c);
X @community = ( 'public' ) if(!@community);
X if($opt_D) {
END-of-routers2-extras/files/patch-buildwan.pl
echo x - routers2-extras/files/patch-cfgmaker_host.pl
sed 's/^X//' >routers2-extras/files/patch-cfgmaker_host.pl << 'END-of-routers2-extras/files/patch-cfgmaker_host.pl'
X--- cfgmaker_host.pl.orig Thu Dec 14 15:43:49 2006
X+++ cfgmaker_host.pl Thu Dec 14 15:44:43 2006
X@@ -1,4 +1,4 @@
X-#!/usr/bin/perl
X+#!%%PERL%%
X #
X # Create a MRTG .cfg file for a given host. Include routers.cgi
X # extensions. Check for different SNMP options available.
X@@ -34,7 +33,7 @@
X my($PS) = '/';
X my($TIMEOUT) = 4;
X my($RETRIES) = 2;
X-my($pingprobe) = "/usr/local/bin/mrtg-ping-probe";
X+my($pingprobe) = "%%LOCALBASE%%/bin/mrtg-ping-probe";
X
X $|=1;
X #######################################################################
X@@ -78,12 +77,16 @@
X netopiausedmem => 'enterprises.304.1.3.1.3.6.0',
X netopiacurcpu => 'enterprises.304.1.3.1.3.1.0',
X netopiaavgcpu => 'enterprises.304.1.3.1.3.2.0',
X- # Fortynet
X- fortycpuusage => 'enterprises.12356.1.1.6.1.0',
X- fortycpuidle => 'enterprises.12356.1.1.6.2.0',
X- fortycpuint => 'enterprises.12356.1.1.6.3.0',
X- fortymemusage => 'enterprises.12356.1.1.6.4.0',
X- fortysessions => 'enterprises.12356.1.1.6.6.0',
X+ # Fortinet MIB
X+ forticpu => 'enterprises.12356.1.8.0',
X+ fortimem => 'enterprises.12356.1.9.0',
X+ fortisessions => 'enterprises.12356.1.10.0',
X+# fortycpuidle => 'enterprises.12356.1.1.6.2.0',
X+# fortycpuint => 'enterprises.12356.1.1.6.3.0',
X+# fortymemusage => 'enterprises.12356.1.1.6.4.0',
X+# fortysessions => 'enterprises.12356.1.1.6.6.0',
X+ # Foundry MID
X+ fndycpu => 'entreprises.1991.1.1.2.1.35.0',
X );
X
X #######################################################################
X@@ -304,8 +307,74 @@
X print CFG "routers.cgi*Title[$hostname-CPU]: CPU Usage on $hostname\n";
X print CFG "routers.cgi*InSummary[$hostname-CPU]: yes\n";
X } else {
X- print CFG "#\n# Not available.\n";
X- print "CPU usage statistics not available.\n";
X+ $rv = undef;
X+ ($rv) = snmpget ($snmp, $OID{forticpu});
X+ if (defined $rv and ($rv > 0)) {
X+ print "* CPU usage statistic available (FortiOS MIB).\n";
X+ # Current CPU
X+ print CFG "Target[$hostname-cpu-cur]: $OID{forticpu}&$OID{forticpu}:$snmp\n";
X+ print CFG "PageTop[$hostname-cpu-cur]: $sdesc<BR>Current CPU usage\n";
X+ print CFG "Title[$hostname-cpu-cur]: Current CPU on $sname\n";
X+ print CFG "Maxbytes[$hostname-cpu-cur]: 100\n";
X+ print CFG "Options[$hostname-cpu-cur]: gauge\n";
X+ print CFG "YLegend[$hostname-cpu-cur]: percent\n";
X+ print CFG "ShortLegend[$hostname-cpu-cur]: %\n";
X+ print CFG "LegendI[$hostname-cpu-cur]: user:\n";
X+ print CFG "Legend1[$hostname-cpu-cur]: Current CPU Usage\n";
X+ print CFG "Legend3[$hostname-cpu-cur]: Current CPU Usage Peak\n";
X+ print CFG "routers.cgi*WithPeak[$hostname-cpu-cur]: none\n";
X+ print CFG "routers.cgi*Options[$hostname-cpu-cur]: noo, nopercent, nototal\n";
X+ print CFG "routers.cgi*Graph[$hostname-cpu-cur]: $hostname-CPU \"CPU usage\" noo\n";
X+ print CFG "routers.cgi*InMenu[$hostname-cpu-cur]: no\n";
X+ print CFG "routers.cgi*InOut[$hostname-cpu-cur]: no\n";
X+ print CFG "routers.cgi*InSummary[$hostname-cpu-cur]: no\n";
X+ # Total & Graph
X+ print CFG "routers.cgi*ShortName[$hostname-CPU]: CPU Utilisation\n";
X+ print CFG "routers.cgi*Description[$hostname-CPU]: $hostname CPU Utilisation\n";
X+ print CFG "routers.cgi*GraphStyle[$hostname-CPU]: normal\n";
X+ print CFG "routers.cgi*Options[$hostname-CPU]: total, available\n";
X+ print CFG "routers.cgi*LegendTI[$hostname-CPU]: Total usage\n";
X+ print CFG "routers.cgi*MBLegend[$hostname-CPU]: 100% Utilisation\n";
X+ print CFG "routers.cgi*Icon[$hostname-CPU]: cpu-sm.gif\n";
X+ print CFG "routers.cgi*Title[$hostname-CPU]: CPU Usage on $hostname\n";
X+ print CFG "routers.cgi*InSummary[$hostname-CPU]: yes\n";
X+ } else {
X+ $rv = undef;
X+ ($rv) = snmpget ($snmp, $OID{fndrycpu});
X+ if (defined $rv and ($rv > 0)) {
X+ print "* CPU usage statistic available (Foundry MIB).\n";
X+ # Current CPU
X+ print CFG "Target[$hostname-cpu-cur]: $OID{fndrycpu}&$OID{fndrycpu}:$snmp\n";
X+ print CFG "PageTop[$hostname-cpu-cur]: $sdesc<BR>Current CPU usage\n";
X+ print CFG "Title[$hostname-cpu-cur]: Current CPU on $sname\n";
X+ print CFG "Maxbytes[$hostname-cpu-cur]: 100\n";
X+ print CFG "Options[$hostname-cpu-cur]: gauge\n";
X+ print CFG "YLegend[$hostname-cpu-cur]: percent\n";
X+ print CFG "ShortLegend[$hostname-cpu-cur]: %\n";
X+ print CFG "LegendI[$hostname-cpu-cur]: user:\n";
X+ print CFG "Legend1[$hostname-cpu-cur]: Current CPU Usage\n";
X+ print CFG "Legend3[$hostname-cpu-cur]: Current CPU Usage Peak\n";
X+ print CFG "routers.cgi*WithPeak[$hostname-cpu-cur]: none\n";
X+ print CFG "routers.cgi*Options[$hostname-cpu-cur]: noo, nopercent, nototal\n";
X+ print CFG "routers.cgi*Graph[$hostname-cpu-cur]: $hostname-CPU \"CPU usage\" noo\n";
X+ print CFG "routers.cgi*InMenu[$hostname-cpu-cur]: no\n";
X+ print CFG "routers.cgi*InOut[$hostname-cpu-cur]: no\n";
X+ print CFG "routers.cgi*InSummary[$hostname-cpu-cur]: no\n";
X+ # Total & Graph
X+ print CFG "routers.cgi*ShortName[$hostname-CPU]: CPU Utilisation\n";
X+ print CFG "routers.cgi*Description[$hostname-CPU]: $hostname CPU Utilisation\n";
X+ print CFG "routers.cgi*GraphStyle[$hostname-CPU]: normal\n";
X+ print CFG "routers.cgi*Options[$hostname-CPU]: total, available\n";
X+ print CFG "routers.cgi*LegendTI[$hostname-CPU]: Total usage\n";
X+ print CFG "routers.cgi*MBLegend[$hostname-CPU]: 100% Utilisation\n";
X+ print CFG "routers.cgi*Icon[$hostname-CPU]: cpu-sm.gif\n";
X+ print CFG "routers.cgi*Title[$hostname-CPU]: CPU Usage on $hostname\n";
X+ print CFG "routers.cgi*InSummary[$hostname-CPU]: yes\n";
X+ } else {
X+ print CFG "#\n# Not available.\n";
X+ print "CPU usage statistics not available.\n";
X+ }
X+ }
X }
X }
X
X@@ -313,6 +382,7 @@
X # physical and virtual
X print CFG "\n#######################################\n";
X print CFG "# Memory used\n";
X+ my $oldsname = $sname; # To restore it later.
X $rv = undef;
X ($rv) = snmpget($snmp, $OID{totalswap} );
X if(defined $rv and ($rv > 0)) {
X@@ -356,7 +426,21 @@
X $targ = "$aroid&$asoid:$snmp";
X $factor = 1;
X } else {
X- print "Memory stats not available.\n";
X+ $rv = undef;
X+ ($rv) = snmpget($snmp, $OID{fortimem} );
X+ if ($rv>0) {
X+ print "* Memory utilisation available (FortiOS MIB).\n";
X+ #($mbr, $mbs) = snmpget($snmp, $OID{fortimem}, $OID{fortimem});
X+ $mbr = 100;
X+ $mbs = 100;;
X+ $aroid = $OID{fortimem};
X+ $asoid = $OID{fortimem};
X+ $targ = "$aroid&$asoid:$snmp";
X+ $factor = 1;
X+ $sname = "$sname in % ";
X+ } else {
X+ print "Memory stats not available.\n";
X+ }
X }
X }
X }
X@@ -441,6 +525,7 @@
X print CFG "#\n# Not available.\n";
X print "Paging statistics not available.\n";
X }
X+ $sname = $oldsname;
X
X # Disk
X # individual disk spaces, and one userdefined summary
X@@ -622,6 +707,51 @@
X print CFG "#\n# Not available.\n";
X print "User count not available.\n";
X }
X+
X+ # Sessions
X+ print CFG "\n#######################################\n";
X+ print CFG "# Session count\n";
X+ $rv = undef;
X+ $targ = "";
X+ ($rv) = snmpget($snmp, $OID{fortisessions} );
X+ if(defined $rv) {
X+ print "* Session counter available (FortiOS MIB).\n";
X+ $targ = "$OID{fortisessions}&$OID{fortisessions}:$snmp";
X+
X+# } else {
X+# ($rv) = snmpget($snmp, $OID{sunusers} );
X+# if(defined $rv) {
X+# print "* User counter available (Sun-MIB).\n";
X+# $targ = "$OID{sunusers}&$OID{sunusers}:$snmp";
X+# }
X+ }
X+
X+ if($targ) {
X+ print CFG "Target[$hostname-sessions]: $targ\n";
X+ print CFG "PageTop[$hostname-sessions]: $sdesc<BR>Active Sessions\n";
X+ print CFG "Title[$hostname-sessions]: Active Sessions on $sname\n";
X+ print CFG "MaxBytes[$hostname-sessions]: 1000000\n";
X+ print CFG "SetEnv[$hostname-sessions]: MRTG_INT_DESCR=\"Sessions\"\n";
X+ print CFG "Options[$hostname-sessions]: nopercent, gauge\n";
X+ print CFG "YLegend[$hostname-sessions]: Sessions\n";
X+ print CFG "ShortLegend[$hostname-sessions]: \n";
X+ print CFG "LegendI[$hostname-sessions]: Sessions\n";
X+ print CFG "Legend1[$hostname-sessions]: Active Sessions\n";
X+ print CFG "Legend3[$hostname-sessions]: Peak Active Sessions\n";
X+ print CFG "routers.cgi*Options[$hostname-sessions]: nomax, nototal, fixunit, noo\n";
X+ print CFG "routers.cgi*Mode[$hostname-sessions]: general\n";
X+ print CFG "routers.cgi*ShortDesc[$hostname-sessions]: Sessions\n";
X+ print CFG "routers.cgi*Description[$hostname-sessions]: Sessions on $sname\n";
X+ print CFG "routers.cgi*UnScaled[$hostname-sessions]: none\n";
X+ print CFG "routers.cgi*InOut[$hostname-sessions]: no\n";
X+ print CFG "routers.cgi*InSummary[$hostname-sessions]: yes\n";
X+ print CFG "routers.cgi*InCompact[$hostname-sessions]: no\n";
X+ print CFG "routers.cgi*Icon[$hostname-sessions]: user-sm.gif\n";
X+ } else {
X+ print CFG "#\n# Not available.\n";
X+ print "Sessions count not available.\n";
X+ }
X+
X
X # processes
X print CFG "\n#######################################\n";
END-of-routers2-extras/files/patch-cfgmaker_host.pl
echo x - routers2-extras/files/patch-95.pl
sed 's/^X//' >routers2-extras/files/patch-95.pl << 'END-of-routers2-extras/files/patch-95.pl'
X--- 95.pl.orig Thu Dec 14 16:22:04 2006
X+++ 95.pl Thu Dec 14 16:22:56 2006
X@@ -0,0 +1,80 @@
X+#!%%PERL%%
X+
X+use strict;
X+use Getopt::Long;
X+
X+# Options
X+my %option;
X+
X+sub usage
X+{
X+ print <<"EOA"
X+usage: 95 --rrd=/path/to/rrdfile.rdd
X+ --rrd=file rrdfile to be used to compute the 95 percentil
X+ --help this help
X+ -h this help
X+EOA
X+}
X+
X+sub main
X+{
X+ my $rrd;
X+ my $line;
X+ my $value;
X+ my $percentile95;
X+ my $percentile95i;
X+ my $percentile95o;
X+ my @rrdfetch;
X+ my @allvalues;
X+ my @allvaluesi;
X+ my @allvalueso;
X+ my $in;
X+ my $out;
X+ my @array;
X+
X+ die unless GetOptions(
X+ 'help|h' => \$option{'help'},
X+ 'rrd=s' => \$option{'rrd'},
X+ );
X+
X+ if ($option{'help'}) {
X+ usage();
X+ exit;
X+ }
X+
X+ unless (defined $option{'rrd'} ) {
X+ usage();
X+ die 'rrdfile is not specified';
X+ }
X+
X+ $rrd = $option{'rrd'};
X+
X+ #@rrdfetch=qx(/usr/local/bin/rrdtool fetch $rrd AVERAGE -r 300 -s -30000 -e -300);
X+# @rrdfetch=qx(/usr/local/bin/rrdtool fetch $rrd AVERAGE -r 300 -s -24h);
X+# @rrdfetch=qx(/usr/local/bin/rrdtool fetch $rrd AVERAGE -r 300 -s -24h -e -300);
X+ #@rrdfetch=qx(/usr/local/bin/rrdtool fetch $rrd AVERAGE -r 300 -s -1m -e -300);
X+ @rrdfetch=qx(/usr/local/bin/rrdtool fetch $rrd AVERAGE -r 300 -s -1month);
X+ chomp @array;
X+ foreach $line (@rrdfetch) {
X+ split(/\s+/,$line);
X+ $in = $_[1]; $out = $_[2];
X+ #$value=($_[1] > $_[2]) ? $_[1] : $_[2];
X+ $value=($in > $out) ? $in : $out;
X+ push (@allvalues,$value);
X+ push (@allvaluesi,$in);
X+ push (@allvalueso,$out);
X+ }
X+
X+ @allvalues=sort {$a <=> $b} @allvalues;
X+ $percentile95=sprintf("%.2f",($allvalues[(sprintf("%.0f",(@allvalues*0.95))-1)]*8/1000));
X+ @allvaluesi=sort {$a <=> $b} @allvaluesi;
X+ $percentile95i=sprintf("%.2f",($allvaluesi[(sprintf("%.0f",(@allvaluesi*0.95))-1)]*8/1000));
X+ @allvalueso=sort {$a <=> $b} @allvalueso;
X+ $percentile95o=sprintf("%.2f",($allvalueso[(sprintf("%.0f",(@allvalueso*0.95))-1)]*8/1000));
X+ print "In/Out : $percentile95 KBytes\n";
X+ print "In : $percentile95i KBytes\n";
X+ print "Out : $percentile95o KBytes\n";
X+
X+}
X+
X+main();
END-of-routers2-extras/files/patch-95.pl
echo x - routers2-extras/Makefile
sed 's/^X//' >routers2-extras/Makefile << 'END-of-routers2-extras/Makefile'
X# New ports collection makefile for: routers2
X# Date created: December 14th 2006
X# Whom: Xavier Beaudouin <kiwi at oav.net>
X#
X# $FreeBSD$
X#
X
XPORTNAME= routers2-extras
XPORTVERSION= 2.17
XCATEGORIES= net-mgmt
XMASTER_SITES= http://www.steveshipway.org/software/rrd/ \
X ftp://ftp.oav.oav.net/routers2/
XDISTNAME= routers2-v${PORTVERSION}a
X
XMAINTAINER= kiwi at oav.net
XCOMMENT= Extra extensions and scripts for routers2 frontend
X
XRUN_DEPENDS= ${LOCALBASE}/www/routers2/routers2.cgi:${PORTSDIR}/net-mgmt/routers2 \
X ${LOCALBASE}/bin/mrtg-ping-probe:${PORTSDIR}/net/mrtg-ping-probe
X
XWRKSRC= ${WRKDIR}/routers2-v${PORTVERSION}/extras
X
XUSE_PERL5= YES
X
XNO_BUILD= YES
X
Xpost-patch:
X for file in buildwan.pl cfgmaker_host.pl 95.pl ; do \
X ${REINPLACE_CMD} -e 's|%%PERL%%|${PERL}|' ${WRKSRC}/$$file; \
X done
X for file in cfgmaker_host.pl ; do \
X ${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' ${WRKSRC}/$$file; \
X done
X
Xdo-install:
X ${MKDIR} -m 755 ${PREFIX}/www/routers2/extras
X.if !defined(NOPORTDOCS)
X ${MKDIR} -m 755 ${DOCSDIR}
X for file in README *.txt; do \
X ${INSTALL_DATA} ${WRKSRC}/$$file ${DOCSDIR}; \
X done
X.endif
X for file in buildwan.pl cfgmaker_host.pl check_esx2 check_foundry checkagent \
X gather.pl getstats.sh graphprune.pl mrtg-apache mrtg-nrpe.pl mrtg-nrpe.sh \
X mrtg-pnsclient.pl mrtg-portsinuse.pl rrd-archive-clean.pl \
X rrd-archive.pl rrdextend.pl vmware_monitor.pl vmware_monitor2.pl \
X winalert.pl targetnames/targetnames.pl 95.pl; do \
X ${INSTALL_SCRIPT} ${WRKSRC}/$$file ${PREFIX}/www/routers2/extras; \
X done
X for file in mrtg-nrpe.cfg mrtg-pnsclient.cfg rrd-archive.conf winalert.conf ; do \
X ${INSTALL_DATA} ${WRKSRC}/$$file ${PREFIX}/www/routers2/extras; \
X done
X ${MKDIR} -m 755 ${PREFIX}/www/routers2/extras/templates
X for file in templates/* ; do \
X ${INSTALL_DATA} ${WRKSRC}/$$file ${PREFIX}/www/routers2/extras/templates; \
X done
X
X.include <bsd.port.mk>
END-of-routers2-extras/Makefile
echo x - routers2-extras/distinfo
sed 's/^X//' >routers2-extras/distinfo << 'END-of-routers2-extras/distinfo'
XMD5 (routers2-v2.17a.tar.gz) = 57e1542bca50940aa4b3908cc7ed5551
XSHA256 (routers2-v2.17a.tar.gz) = a8aa61db9969ebae2b56fe92184d045f03780a8c9412f99f48ecfed879d9703e
XSIZE (routers2-v2.17a.tar.gz) = 383280
END-of-routers2-extras/distinfo
echo x - routers2-extras/pkg-descr
sed 's/^X//' >routers2-extras/pkg-descr << 'END-of-routers2-extras/pkg-descr'
XExtras extensions and third party scripts for routers2 frontend
X
XWWW: http://www.steveshipway.org/software/
END-of-routers2-extras/pkg-descr
echo x - routers2-extras/pkg-plist
sed 's/^X//' >routers2-extras/pkg-plist << 'END-of-routers2-extras/pkg-plist'
Xwww/routers2/extras/buildwan.pl
Xwww/routers2/extras/cfgmaker_host.pl
Xwww/routers2/extras/check_esx2
Xwww/routers2/extras/check_foundry
Xwww/routers2/extras/checkagent
Xwww/routers2/extras/gather.pl
Xwww/routers2/extras/getstats.sh
Xwww/routers2/extras/graphprune.pl
Xwww/routers2/extras/mrtg-apache
Xwww/routers2/extras/mrtg-nrpe.pl
Xwww/routers2/extras/mrtg-nrpe.sh
Xwww/routers2/extras/mrtg-pnsclient.pl
Xwww/routers2/extras/mrtg-portsinuse.pl
Xwww/routers2/extras/rrd-archive-clean.pl
Xwww/routers2/extras/rrd-archive.pl
Xwww/routers2/extras/rrdextend.pl
Xwww/routers2/extras/vmware_monitor.pl
Xwww/routers2/extras/vmware_monitor2.pl
Xwww/routers2/extras/winalert.pl
Xwww/routers2/extras/targetnames.pl
Xwww/routers2/extras/mrtg-nrpe.cfg
Xwww/routers2/extras/mrtg-pnsclient.cfg
Xwww/routers2/extras/rrd-archive.conf
Xwww/routers2/extras/winalert.conf
Xwww/routers2/extras/95.pl
Xwww/routers2/extras/templates/template-mrtg-dns
Xwww/routers2/extras/templates/template-mrtg-ipcs
Xwww/routers2/extras/templates/template-mrtg-nrpe
Xwww/routers2/extras/templates/template-mrtg-ping
Xwww/routers2/extras/templates/template-mrtg-pnsclient
X%%PORTDOCS%%%%DOCSDIR%%/README
X%%PORTDOCS%%%%DOCSDIR%%/buildwan.txt
X%%PORTDOCS%%%%DOCSDIR%%/graphprune.txt
X%%PORTDOCS%%%%DOCSDIR%%/mrtg-nrpe.txt
X%%PORTDOCS%%%%DOCSDIR%%/mrtg-pnsclient.txt
X%%PORTDOCS%%%%DOCSDIR%%/rrd-archive.txt
X%%PORTDOCS%%%%DOCSDIR%%/vmware_monitor.txt
X%%PORTDOCS%%%%DOCSDIR%%/winalert.txt
X at dirrm www/routers2/extras/templates
X at dirrm www/routers2/extras
X%%PORTDOCS%%@dirrm %%DOCSDIR%%
END-of-routers2-extras/pkg-plist
exit
--- routers2-extras-2.17.shar ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list