diff --git a/net-mgmt/Makefile b/net-mgmt/Makefile index fd4f877a24cb..9233b0ded3fb 100644 --- a/net-mgmt/Makefile +++ b/net-mgmt/Makefile @@ -184,6 +184,7 @@ SUBDIR += rotorouter SUBDIR += routers2 SUBDIR += routers2-extensions + SUBDIR += routers2-extras SUBDIR += rubygem-snmp SUBDIR += satellite SUBDIR += scdp diff --git a/net-mgmt/routers2-extras/Makefile b/net-mgmt/routers2-extras/Makefile new file mode 100644 index 000000000000..2ba37d6b15fc --- /dev/null +++ b/net-mgmt/routers2-extras/Makefile @@ -0,0 +1,58 @@ +# New ports collection makefile for: routers2 +# Date created: December 14th 2006 +# Whom: Xavier Beaudouin +# +# $FreeBSD$ +# + +PORTNAME= routers2-extras +PORTVERSION= 2.17 +CATEGORIES= net-mgmt +MASTER_SITES= http://www.steveshipway.org/software/rrd/ \ + ftp://ftp.oav.oav.net/routers2/ +DISTNAME= routers2-v${PORTVERSION}a + +MAINTAINER= kiwi@oav.net +COMMENT= Extra extensions and scripts for routers2 frontend + +RUN_DEPENDS= ${LOCALBASE}/www/routers2/routers2.cgi:${PORTSDIR}/net-mgmt/routers2 \ + ${LOCALBASE}/bin/mrtg-ping-probe:${PORTSDIR}/net/mrtg-ping-probe + +WRKSRC= ${WRKDIR}/routers2-v${PORTVERSION}/extras + +USE_PERL5= YES + +NO_BUILD= YES + +post-patch: + for file in buildwan.pl cfgmaker_host.pl 95.pl ; do \ + ${REINPLACE_CMD} -e 's|%%PERL%%|${PERL}|' ${WRKSRC}/$$file; \ + done + for file in cfgmaker_host.pl ; do \ + ${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' ${WRKSRC}/$$file; \ + done + +do-install: + ${MKDIR} -m 755 ${PREFIX}/www/routers2/extras +.if !defined(NOPORTDOCS) + ${MKDIR} -m 755 ${DOCSDIR} + for file in README *.txt; do \ + ${INSTALL_DATA} ${WRKSRC}/$$file ${DOCSDIR}; \ + done +.endif + for file in buildwan.pl cfgmaker_host.pl check_esx2 check_foundry checkagent \ + gather.pl getstats.sh graphprune.pl mrtg-apache mrtg-nrpe.pl mrtg-nrpe.sh \ + mrtg-pnsclient.pl mrtg-portsinuse.pl rrd-archive-clean.pl \ + rrd-archive.pl rrdextend.pl vmware_monitor.pl vmware_monitor2.pl \ + winalert.pl targetnames/targetnames.pl 95.pl; do \ + ${INSTALL_SCRIPT} ${WRKSRC}/$$file ${PREFIX}/www/routers2/extras; \ + done + for file in mrtg-nrpe.cfg mrtg-pnsclient.cfg rrd-archive.conf winalert.conf ; do \ + ${INSTALL_DATA} ${WRKSRC}/$$file ${PREFIX}/www/routers2/extras; \ + done + ${MKDIR} -m 755 ${PREFIX}/www/routers2/extras/templates + for file in templates/* ; do \ + ${INSTALL_DATA} ${WRKSRC}/$$file ${PREFIX}/www/routers2/extras/templates; \ + done + +.include diff --git a/net-mgmt/routers2-extras/distinfo b/net-mgmt/routers2-extras/distinfo new file mode 100644 index 000000000000..7d2d8539b328 --- /dev/null +++ b/net-mgmt/routers2-extras/distinfo @@ -0,0 +1,3 @@ +MD5 (routers2-v2.17a.tar.gz) = 57e1542bca50940aa4b3908cc7ed5551 +SHA256 (routers2-v2.17a.tar.gz) = a8aa61db9969ebae2b56fe92184d045f03780a8c9412f99f48ecfed879d9703e +SIZE (routers2-v2.17a.tar.gz) = 383280 diff --git a/net-mgmt/routers2-extras/files/patch-95.pl b/net-mgmt/routers2-extras/files/patch-95.pl new file mode 100644 index 000000000000..0c4c513c98ba --- /dev/null +++ b/net-mgmt/routers2-extras/files/patch-95.pl @@ -0,0 +1,83 @@ +--- 95.pl.orig Thu Dec 14 16:22:04 2006 ++++ 95.pl Thu Dec 14 16:22:56 2006 +@@ -0,0 +1,80 @@ ++#!%%PERL%% ++ ++use strict; ++use Getopt::Long; ++ ++# Options ++my %option; ++ ++sub usage ++{ ++ print <<"EOA" ++usage: 95 --rrd=/path/to/rrdfile.rdd ++ --rrd=file rrdfile to be used to compute the 95 percentil ++ --help this help ++ -h this help ++EOA ++} ++ ++sub main ++{ ++ my $rrd; ++ my $line; ++ my $value; ++ my $percentile95; ++ my $percentile95i; ++ my $percentile95o; ++ my @rrdfetch; ++ my @allvalues; ++ my @allvaluesi; ++ my @allvalueso; ++ my $in; ++ my $out; ++ my @array; ++ ++ die unless GetOptions( ++ 'help|h' => \$option{'help'}, ++ 'rrd=s' => \$option{'rrd'}, ++ ); ++ ++ if ($option{'help'}) { ++ usage(); ++ exit; ++ } ++ ++ unless (defined $option{'rrd'} ) { ++ usage(); ++ die 'rrdfile is not specified'; ++ } ++ ++ $rrd = $option{'rrd'}; ++ ++ #@rrdfetch=qx(/usr/local/bin/rrdtool fetch $rrd AVERAGE -r 300 -s -30000 -e -300); ++# @rrdfetch=qx(/usr/local/bin/rrdtool fetch $rrd AVERAGE -r 300 -s -24h); ++# @rrdfetch=qx(/usr/local/bin/rrdtool fetch $rrd AVERAGE -r 300 -s -24h -e -300); ++ #@rrdfetch=qx(/usr/local/bin/rrdtool fetch $rrd AVERAGE -r 300 -s -1m -e -300); ++ @rrdfetch=qx(/usr/local/bin/rrdtool fetch $rrd AVERAGE -r 300 -s -1month); ++ chomp @array; ++ foreach $line (@rrdfetch) { ++ split(/\s+/,$line); ++ $in = $_[1]; $out = $_[2]; ++ #$value=($_[1] > $_[2]) ? $_[1] : $_[2]; ++ $value=($in > $out) ? $in : $out; ++ push (@allvalues,$value); ++ push (@allvaluesi,$in); ++ push (@allvalueso,$out); ++ } ++ ++ @allvalues=sort {$a <=> $b} @allvalues; ++ $percentile95=sprintf("%.2f",($allvalues[(sprintf("%.0f",(@allvalues*0.95))-1)]*8/1000)); ++ @allvaluesi=sort {$a <=> $b} @allvaluesi; ++ $percentile95i=sprintf("%.2f",($allvaluesi[(sprintf("%.0f",(@allvaluesi*0.95))-1)]*8/1000)); ++ @allvalueso=sort {$a <=> $b} @allvalueso; ++ $percentile95o=sprintf("%.2f",($allvalueso[(sprintf("%.0f",(@allvalueso*0.95))-1)]*8/1000)); ++ print "In/Out : $percentile95 KBytes\n"; ++ print "In : $percentile95i KBytes\n"; ++ print "Out : $percentile95o KBytes\n"; ++ ++} ++ ++main(); diff --git a/net-mgmt/routers2-extras/files/patch-buildwan.pl b/net-mgmt/routers2-extras/files/patch-buildwan.pl new file mode 100644 index 000000000000..6636c61ac416 --- /dev/null +++ b/net-mgmt/routers2-extras/files/patch-buildwan.pl @@ -0,0 +1,279 @@ +--- buildwan.pl.orig Fri Jun 16 00:17:53 2006 ++++ buildwan.pl Thu Dec 14 15:41:08 2006 +@@ -1,4 +1,4 @@ +-#!/usr/bin/perl ++#!%%PERL%% + # + # Try to build configuration files for all the routers in the WAN, + # by recursively scanning them. Can take a long time to run! +@@ -16,7 +16,7 @@ + use strict; + use Net::SNMP; + use FileHandle; +-use vars qw($opt_L $opt_h $opt_s $opt_c $opt_D $opt_w $opt_N $opt_A); ++use vars qw($opt_L $opt_h $opt_s $opt_c $opt_D $opt_w $opt_N $opt_A $opt_p); + use Getopt::Std; + + my( $conffile, %config,@cfgfiles, $pathsep ); +@@ -32,7 +32,12 @@ + my($IPIFINDEX) = "1.3.6.1.2.1.4.20.1.2"; + my($IPROUTEGW) = "1.3.6.1.2.1.4.21.1.7"; + my($CPUOID) = "1.3.6.1.4.1.9.2.1.58.0"; ++my($FNDRYCPUOID) = "1.3.6.1.4.1.1991.1.1.2.1.35.0"; + my($MEMOID) = "1.3.6.1.4.1.9.9.48.1.1.1.5.1"; # have to find out ++my($FNDRYMEMOID) = "1.3.6.1.4.1.1991.1.1.2.1.55.0"; ++my($FNDRYMAXMEMOID) = "1.3.6.1.4.1.1991.1.1.2.1.54.0"; ++my($FNDRYBGPOID) = "1.3.6.1.4.1.1991.1.2.11.1.27.0"; ++my($FNDRYTEMPOID) = "1.3.6.1.4.1.1991.1.1.1.1.18.0"; + # Cisco 7200 Series Temperature + my($CISCOTEMP) = "1.3.6.1.4.1.9.9.13.1.3.1"; + +@@ -47,7 +52,8 @@ + my( $domain ) = "...\.adsw\.com"; + my( @community ) = ( "public" ); + my( $community ); +-my( $workdir ) = "/var/rrdtool/auto"; ++my( $workdir ) = "/var/db/rrdtool"; ++my( $pathadd ) = "/usr/local/bin"; + my( @queue ) = ( ); + my( $subdir ) = ""; + my( @filelist ) = (); +@@ -80,8 +86,9 @@ + { + my($snmp, $resp, $snmperr, $k); + my($n,$v,$ip); +- my($cpuok,$memok) ; ++ my($cpuok,$memok,$bgpok,$tempok); + my($rcomm) = ""; ++ my($fndrymaxmem); + + $router = $_[0]; + $cpuok = $memok = ""; +@@ -268,15 +275,48 @@ + $routerhostname = $routerip if(!$routerhostname); + + # now check to see if the router has an OID for CPU and mem +- $resp = $snmp->get_request( $CPUOID, $MEMOID ); ++ $resp = $snmp->get_request( $MEMOID ); + if( $resp ) { +- $cpuok = $CPUOID if( $resp->{$CPUOID} ); + $memok = $MEMOID if( $resp->{$MEMOID} ); ++ } else { ++ $resp = $snmp->get_request( $FNDRYMEMOID ); ++ if( $resp ) { ++ $memok = $FNDRYMEMOID if( $resp->{$FNDRYMEMOID} ); ++ $resp = $snmp->get_request( $FNDRYMAXMEMOID ); ++ if( $resp ) { ++ $fndrymaxmem = $resp->{$FNDRYMAXMEMOID} if( $resp->{$FNDRYMAXMEMOID} ); ++ } ++ } + } + ++ # Try $CPUOID, if this doesn't work, try Foundry one ++ $resp = $snmp->get_request( $CPUOID ); ++ if( $resp ) { ++ $cpuok = $CPUOID if( $resp->{$CPUOID} ); ++ } else { ++ $resp = $snmp->get_request( $FNDRYCPUOID ); ++ if( $resp ) { ++ $cpuok = $FNDRYCPUOID if( $resp->{$FNDRYCPUOID} ); ++ } ++ } ++ ++ # Try to check if BGP routes exists ++ $resp = $snmp->get_request( $FNDRYBGPOID ); ++ if( $resp ) { ++ $bgpok = $FNDRYBGPOID if( $resp->{$FNDRYBGPOID} ); ++ } ++ ++ # Try to check if router has temp sensors (currently only foundry !) ++ $resp = $snmp->get_request( $FNDRYTEMPOID ); ++ if( $resp ) { ++ $tempok = $FNDRYTEMPOID if( $resp->{$FNDRYTEMPOID} ); ++ } ++ ++ + $routers{$router} = { interfaces=>{%interfaces}, name=>$routerdesc, + ip=>$routerip, hostname=>$routerhostname, community=>$rcomm, +- cpu=>$cpuok, mem=>$memok }; ++ cpu=>$cpuok, mem=>$memok, fndrymaxmem=>$fndrymaxmem, ++ bgp=>$bgpok, temp=>$tempok }; + + print "\rFinished router $routerhostname at address $routerip\n"; + +@@ -332,15 +372,20 @@ + my($k,$nextip,$icon); + my($t,$d,$f); + my($mb,$pfx); ++ my $descr; + + $n = ucfirst $n if($n !~ /\./); + + foreach $k ( keys %$ifp ) { ++ my $descr; ++ $descr = $ifp->{$k}->{descr}; ++ $descr =~ s/\n//g; + $icon = "interface-sm.gif"; + $pfx = ""; + $d = ""; + $t = $h.".".$k; +- $t = $h.".".$ifp->{$k}->{descr} if($ifp->{$k}->{descr}); ++ #$t = $h.".".$ifp->{$k}->{descr} if($ifp->{$k}->{descr}); ++ $t = $h.".".$descr if($descr); + $t =~ s/[\[\]#\/\\\s]+/./g; + $t =~ s/\.+/./g; + $t = lc $t; +@@ -349,7 +394,7 @@ + if(!$ifp->{$k}->{speed} or !$c or !$h) { + $pfx = "# "; + } +- if(!$includelans and $ifp->{$k}->{descr} =~ /(ether|token)/i) { ++ if(!$includelans and $descr =~ /(ether|token)/i) { + $pfx = "# "; + } + # print "$k".$ifp->{$k}{state}.": ".$ifp->{$k}{descr} +@@ -388,10 +433,10 @@ + + print CFG $pfx."Title[".$t."]: $n"; + print CFG " (".$ifp->{$k}->{ip}.")" if($ifp->{$k}->{ip}); +- print CFG ": ".$ifp->{$k}->{descr}." $d\n"; ++ print CFG ": ".$descr." $d\n"; + print CFG $pfx."PageTop[".$t."]:

Traffic analysis for " +- .$ifp->{$k}->{descr}."

\n"; +- print CFG $pfx."SetEnv[".$t."]: MRTG_INT_DESCR=\"".$ifp->{$k}->{descr} ++ .$descr."\n"; ++ print CFG $pfx."SetEnv[".$t."]: MRTG_INT_DESCR=\"".$descr + ."\" MRTG_INT_IP=\"".$ifp->{$k}->{ip}."\"\n"; + if($mb > 1000000) { + print CFG $pfx."routers.cgi*UnScaled[$t]: none\n" +@@ -408,7 +453,7 @@ + .$ifp->{$k}->{destination}[2]." router-sm.gif\n"; + } + print CFG $pfx."routers.cgi*ShortDesc[$t]: " +- .$ifp->{$k}->{descr}." (".(ucfirst $ifp->{$k}->{destination}[0]) ++ .$descr." (".(ucfirst $ifp->{$k}->{destination}[0]) + .")\n" + if( $ifp->{$k}->{destination}[0] + # and ($ifp->{$k}->{destination}[0] !~ /^\d/i) +@@ -431,7 +476,8 @@ + open CFG, ">$fname"; + print CFG "# MRTG config for router ".$routers{$rk}{hostname} + ." community ".$routers{$rk}{community} +- ."\n\nWorkdir: $workdir\nLogformat: rrdtool\nOptions[_]: growright bits \n"; ++ ."\n\nWorkdir: $workdir\n" ++ ."PathAdd: $pathadd\nLogformat: rrdtool\nOptions[_]: growright bits \n"; + + print CFG "routers.cgi*Icon: router-sm.gif\n" + ."routers.cgi*ShortDesc: ".$routers{$rk}{name}."\n\n"; +@@ -451,6 +497,7 @@ + .$routers{$rk}{name}." CPU Load\n"; + print CFG "PageTop[".$routers{$rk}{hostname}.".CPU]: CPU Stats\n"; + print CFG "routers.cgi*Mode[".$routers{$rk}{hostname}.".CPU]: cpu\n"; ++ print CFG "routers.cgi*UnScaled[".$routers{$rk}{hostname}.".CPU]: none\n"; + print CFG "routers.cgi*ShortDesc[".$routers{$rk}{hostname} + .".CPU]: CPU Stats\n"; + } else { +@@ -461,7 +508,11 @@ + print CFG "Target[".$routers{$rk}{hostname}.".MEM]: " + .$routers{$rk}{mem}."&".$routers{$rk}{mem}.":" + .$routers{$rk}{community}."\@".$routers{$rk}{hostname}."\n"; +- print CFG "MaxBytes[".$routers{$rk}{hostname}.".MEM]: 64000000\n"; ++ if( $routers{$rk}{mem} == $FNDRYMEMOID ) { ++ print CFG "MaxBytes[".$routers{$rk}{hostname}.".MEM]: ".$routers{$rk}{fndrymaxmem}."\n"; ++ } else { ++ print CFG "MaxBytes[".$routers{$rk}{hostname}.".MEM]: 64000000\n"; ++ } + print CFG "Options[".$routers{$rk}{hostname}.".MEM]: " + ."nopercent integer gauge noo\n"; + print CFG "routers.cgi*UnScaled[".$routers{$rk}{hostname}.".MEM]: none\n"; +@@ -480,6 +531,61 @@ + } else { + print CFG "# Unable to identify a Memory usage OID in MIB\n"; + } ++ ++ if( $routers{$rk}{bgp} ) { ++ print CFG "# BGP routes\n"; ++ print CFG "Target[".$routers{$rk}{hostname}.".BGP]: " ++ .$routers{$rk}{bgp}."&".$routers{$rk}{bgp}.":" ++ .$routers{$rk}{community}."\@".$routers{$rk}{hostname}."\n"; ++ print CFG "MaxBytes[".$routers{$rk}{hostname}.".BGP]: 100000000\n"; ++ print CFG "Options[".$routers{$rk}{hostname}.".BGP]: " ++ ."absolute nopercent integer gauge noo\n"; ++ print CFG "routers.cgi*UnScaled[".$routers{$rk}{hostname}.".BGP]: none\n"; ++ print CFG "Title[".$routers{$rk}{hostname}.".BGP]: " ++ .$routers{$rk}{name}." Total BGP routes\n"; ++ print CFG "ShortLegend[".$routers{$rk}{hostname}.".BGP]: Routes\n"; ++ print CFG "YLegend[".$routers{$rk}{hostname}.".BGP]: BGP Routes\n"; ++ print CFG "PageTop[".$routers{$rk}{hostname}.".BGP]: Total BGP Routes\n"; ++ print CFG "LegendI[".$routers{$rk}{hostname}.".BGP]: Routes:\n"; ++ print CFG "Legend1[".$routers{$rk}{hostname}.".BGP]: Routes\n"; ++ print CFG "Legend3[".$routers{$rk}{hostname}.".BGP]: Peak Routes\n"; ++ print CFG "routers.cgi*ShortDesc[".$routers{$rk}{hostname} ++ .".BGP]: BGP Routes\n"; ++ print CFG "routers.cgi*Options[".$routers{$rk}{hostname} ++ .".BGP]: noo, nopercent, absolute, nototal, nopercentile\n"; ++ } else { ++ print CFG "# No BGP routes OID in MIB\n"; ++ } ++ ++ if( $routers{$rk}{temp} ) { ++ print CFG "# Temperature\n"; ++ # Warning Foundry OID is temperature * 2, so we have to divide it by 2 ++ print CFG "Target[".$routers{$rk}{hostname}.".TEMP]: " ++ .$routers{$rk}{temp}."&".$routers{$rk}{temp}.":" ++ .$routers{$rk}{community}."\@".$routers{$rk}{hostname}." / 2\n"; ++ # 100°C is sufficient to handle this. At this temperature, we can think ++ # that router ... near to die. ++ print CFG "MaxBytes[".$routers{$rk}{hostname}.".TEMP]: 100\n"; ++ print CFG "Options[".$routers{$rk}{hostname}.".TEMP]: " ++ ."absolute nopercent gauge noo\n"; ++ print CFG "routers.cgi*UnScaled[".$routers{$rk}{hostname}.".TEMP]: none\n"; ++ print CFG "Title[".$routers{$rk}{hostname}.".TEMP]: " ++ .$routers{$rk}{name}." Temperature\n"; ++ print CFG "ShortLegend[".$routers{$rk}{hostname}.".TEMP]: °C\n"; ++ print CFG "PageTop[".$routers{$rk}{hostname}.".TEMP]: Temperature\n"; ++ print CFG "LegendI[".$routers{$rk}{hostname}.".TEMP]: Temperature\n"; ++ print CFG "Legend1[".$routers{$rk}{hostname}.".TEMP]: Temperature\n"; ++ print CFG "Legend3[".$routers{$rk}{hostname}.".TEMP]: Peak Temperature\n"; ++ print CFG "routers.cgi*ShortDesc[".$routers{$rk}{hostname} ++ .".TEMP]: Temperature\n"; ++ print CFG "routers.cgi*Options[".$routers{$rk}{hostname} ++ .".TEMP]: noo, nopercent, absolute, nototal, nopercentile\n"; ++ print CFG "routers.cgi*Icon[".$routers{$rk}{hostname} ++ .".TEMP]: temp-sm.gif\n"; ++ } else { ++ print CFG "# No Temperature OID in MIB\n"; ++ } ++ + + close CFG; + +@@ -495,10 +601,10 @@ + $script = "/cgi-bin/routers2.pl"; + } + +-getopts('hc:D:s:Lw:NA'); ++getopts('hc:D:s:Lw:NAp:'); + + if($opt_h or $#ARGV<0) { +- print "Usage: buildwan -h\n buildwan [-L][-A][-N][-s ][-c ][-D ] -w ...\n"; ++ print "Usage: buildwan -h\n buildwan [-L][-A][-N][-s ][-c ][-D ] -w -p ...\n"; + print "-L: Include ethernet/token ring Lan interfaces\n"; + print "-A: Include ethernet/token ring Lan interfaces even if they are down\n"; + print "-N: Don't browse network neighors.\n"; +@@ -506,6 +612,7 @@ + print "-D: Specify domain name to be stripped from hostnames in descriptions\n"; + print "-c: Specify SNMP community string (default is 'public'), separate with commas\n"; + print "-w: Specify Work directory where the .rrd files go.\n"; ++ print "-p: Specify the rddtool path (default is /usr/local/bin).\n"; + + exit 1; + } +@@ -515,6 +622,7 @@ + $includelans = 1 if($opt_L); + $includealllan = 1 if($opt_A); + $workdir = $opt_w if($opt_w); ++$pathadd = $opt_p if($opt_p); + @community = split /,\s*/,$opt_c if($opt_c); + @community = ( 'public' ) if(!@community); + if($opt_D) { diff --git a/net-mgmt/routers2-extras/files/patch-cfgmaker_host.pl b/net-mgmt/routers2-extras/files/patch-cfgmaker_host.pl new file mode 100644 index 000000000000..413f2f80e9fe --- /dev/null +++ b/net-mgmt/routers2-extras/files/patch-cfgmaker_host.pl @@ -0,0 +1,208 @@ +--- cfgmaker_host.pl.orig Thu Dec 14 15:43:49 2006 ++++ cfgmaker_host.pl Thu Dec 14 15:44:43 2006 +@@ -1,4 +1,4 @@ +-#!/usr/bin/perl ++#!%%PERL%% + # + # Create a MRTG .cfg file for a given host. Include routers.cgi + # extensions. Check for different SNMP options available. +@@ -34,7 +33,7 @@ + my($PS) = '/'; + my($TIMEOUT) = 4; + my($RETRIES) = 2; +-my($pingprobe) = "/usr/local/bin/mrtg-ping-probe"; ++my($pingprobe) = "%%LOCALBASE%%/bin/mrtg-ping-probe"; + + $|=1; + ####################################################################### +@@ -78,12 +77,16 @@ + netopiausedmem => 'enterprises.304.1.3.1.3.6.0', + netopiacurcpu => 'enterprises.304.1.3.1.3.1.0', + netopiaavgcpu => 'enterprises.304.1.3.1.3.2.0', +- # Fortynet +- fortycpuusage => 'enterprises.12356.1.1.6.1.0', +- fortycpuidle => 'enterprises.12356.1.1.6.2.0', +- fortycpuint => 'enterprises.12356.1.1.6.3.0', +- fortymemusage => 'enterprises.12356.1.1.6.4.0', +- fortysessions => 'enterprises.12356.1.1.6.6.0', ++ # Fortinet MIB ++ forticpu => 'enterprises.12356.1.8.0', ++ fortimem => 'enterprises.12356.1.9.0', ++ fortisessions => 'enterprises.12356.1.10.0', ++# fortycpuidle => 'enterprises.12356.1.1.6.2.0', ++# fortycpuint => 'enterprises.12356.1.1.6.3.0', ++# fortymemusage => 'enterprises.12356.1.1.6.4.0', ++# fortysessions => 'enterprises.12356.1.1.6.6.0', ++ # Foundry MID ++ fndycpu => 'entreprises.1991.1.1.2.1.35.0', + ); + + ####################################################################### +@@ -304,8 +307,74 @@ + print CFG "routers.cgi*Title[$hostname-CPU]: CPU Usage on $hostname\n"; + print CFG "routers.cgi*InSummary[$hostname-CPU]: yes\n"; + } else { +- print CFG "#\n# Not available.\n"; +- print "CPU usage statistics not available.\n"; ++ $rv = undef; ++ ($rv) = snmpget ($snmp, $OID{forticpu}); ++ if (defined $rv and ($rv > 0)) { ++ print "* CPU usage statistic available (FortiOS MIB).\n"; ++ # Current CPU ++ print CFG "Target[$hostname-cpu-cur]: $OID{forticpu}&$OID{forticpu}:$snmp\n"; ++ print CFG "PageTop[$hostname-cpu-cur]: $sdesc
Current CPU usage\n"; ++ print CFG "Title[$hostname-cpu-cur]: Current CPU on $sname\n"; ++ print CFG "Maxbytes[$hostname-cpu-cur]: 100\n"; ++ print CFG "Options[$hostname-cpu-cur]: gauge\n"; ++ print CFG "YLegend[$hostname-cpu-cur]: percent\n"; ++ print CFG "ShortLegend[$hostname-cpu-cur]: %\n"; ++ print CFG "LegendI[$hostname-cpu-cur]: user:\n"; ++ print CFG "Legend1[$hostname-cpu-cur]: Current CPU Usage\n"; ++ print CFG "Legend3[$hostname-cpu-cur]: Current CPU Usage Peak\n"; ++ print CFG "routers.cgi*WithPeak[$hostname-cpu-cur]: none\n"; ++ print CFG "routers.cgi*Options[$hostname-cpu-cur]: noo, nopercent, nototal\n"; ++ print CFG "routers.cgi*Graph[$hostname-cpu-cur]: $hostname-CPU \"CPU usage\" noo\n"; ++ print CFG "routers.cgi*InMenu[$hostname-cpu-cur]: no\n"; ++ print CFG "routers.cgi*InOut[$hostname-cpu-cur]: no\n"; ++ print CFG "routers.cgi*InSummary[$hostname-cpu-cur]: no\n"; ++ # Total & Graph ++ print CFG "routers.cgi*ShortName[$hostname-CPU]: CPU Utilisation\n"; ++ print CFG "routers.cgi*Description[$hostname-CPU]: $hostname CPU Utilisation\n"; ++ print CFG "routers.cgi*GraphStyle[$hostname-CPU]: normal\n"; ++ print CFG "routers.cgi*Options[$hostname-CPU]: total, available\n"; ++ print CFG "routers.cgi*LegendTI[$hostname-CPU]: Total usage\n"; ++ print CFG "routers.cgi*MBLegend[$hostname-CPU]: 100% Utilisation\n"; ++ print CFG "routers.cgi*Icon[$hostname-CPU]: cpu-sm.gif\n"; ++ print CFG "routers.cgi*Title[$hostname-CPU]: CPU Usage on $hostname\n"; ++ print CFG "routers.cgi*InSummary[$hostname-CPU]: yes\n"; ++ } else { ++ $rv = undef; ++ ($rv) = snmpget ($snmp, $OID{fndrycpu}); ++ if (defined $rv and ($rv > 0)) { ++ print "* CPU usage statistic available (Foundry MIB).\n"; ++ # Current CPU ++ print CFG "Target[$hostname-cpu-cur]: $OID{fndrycpu}&$OID{fndrycpu}:$snmp\n"; ++ print CFG "PageTop[$hostname-cpu-cur]: $sdesc
Current CPU usage\n"; ++ print CFG "Title[$hostname-cpu-cur]: Current CPU on $sname\n"; ++ print CFG "Maxbytes[$hostname-cpu-cur]: 100\n"; ++ print CFG "Options[$hostname-cpu-cur]: gauge\n"; ++ print CFG "YLegend[$hostname-cpu-cur]: percent\n"; ++ print CFG "ShortLegend[$hostname-cpu-cur]: %\n"; ++ print CFG "LegendI[$hostname-cpu-cur]: user:\n"; ++ print CFG "Legend1[$hostname-cpu-cur]: Current CPU Usage\n"; ++ print CFG "Legend3[$hostname-cpu-cur]: Current CPU Usage Peak\n"; ++ print CFG "routers.cgi*WithPeak[$hostname-cpu-cur]: none\n"; ++ print CFG "routers.cgi*Options[$hostname-cpu-cur]: noo, nopercent, nototal\n"; ++ print CFG "routers.cgi*Graph[$hostname-cpu-cur]: $hostname-CPU \"CPU usage\" noo\n"; ++ print CFG "routers.cgi*InMenu[$hostname-cpu-cur]: no\n"; ++ print CFG "routers.cgi*InOut[$hostname-cpu-cur]: no\n"; ++ print CFG "routers.cgi*InSummary[$hostname-cpu-cur]: no\n"; ++ # Total & Graph ++ print CFG "routers.cgi*ShortName[$hostname-CPU]: CPU Utilisation\n"; ++ print CFG "routers.cgi*Description[$hostname-CPU]: $hostname CPU Utilisation\n"; ++ print CFG "routers.cgi*GraphStyle[$hostname-CPU]: normal\n"; ++ print CFG "routers.cgi*Options[$hostname-CPU]: total, available\n"; ++ print CFG "routers.cgi*LegendTI[$hostname-CPU]: Total usage\n"; ++ print CFG "routers.cgi*MBLegend[$hostname-CPU]: 100% Utilisation\n"; ++ print CFG "routers.cgi*Icon[$hostname-CPU]: cpu-sm.gif\n"; ++ print CFG "routers.cgi*Title[$hostname-CPU]: CPU Usage on $hostname\n"; ++ print CFG "routers.cgi*InSummary[$hostname-CPU]: yes\n"; ++ } else { ++ print CFG "#\n# Not available.\n"; ++ print "CPU usage statistics not available.\n"; ++ } ++ } + } + } + +@@ -313,6 +382,7 @@ + # physical and virtual + print CFG "\n#######################################\n"; + print CFG "# Memory used\n"; ++ my $oldsname = $sname; # To restore it later. + $rv = undef; + ($rv) = snmpget($snmp, $OID{totalswap} ); + if(defined $rv and ($rv > 0)) { +@@ -356,7 +426,21 @@ + $targ = "$aroid&$asoid:$snmp"; + $factor = 1; + } else { +- print "Memory stats not available.\n"; ++ $rv = undef; ++ ($rv) = snmpget($snmp, $OID{fortimem} ); ++ if ($rv>0) { ++ print "* Memory utilisation available (FortiOS MIB).\n"; ++ #($mbr, $mbs) = snmpget($snmp, $OID{fortimem}, $OID{fortimem}); ++ $mbr = 100; ++ $mbs = 100;; ++ $aroid = $OID{fortimem}; ++ $asoid = $OID{fortimem}; ++ $targ = "$aroid&$asoid:$snmp"; ++ $factor = 1; ++ $sname = "$sname in % "; ++ } else { ++ print "Memory stats not available.\n"; ++ } + } + } + } +@@ -441,6 +525,7 @@ + print CFG "#\n# Not available.\n"; + print "Paging statistics not available.\n"; + } ++ $sname = $oldsname; + + # Disk + # individual disk spaces, and one userdefined summary +@@ -622,6 +707,51 @@ + print CFG "#\n# Not available.\n"; + print "User count not available.\n"; + } ++ ++ # Sessions ++ print CFG "\n#######################################\n"; ++ print CFG "# Session count\n"; ++ $rv = undef; ++ $targ = ""; ++ ($rv) = snmpget($snmp, $OID{fortisessions} ); ++ if(defined $rv) { ++ print "* Session counter available (FortiOS MIB).\n"; ++ $targ = "$OID{fortisessions}&$OID{fortisessions}:$snmp"; ++ ++# } else { ++# ($rv) = snmpget($snmp, $OID{sunusers} ); ++# if(defined $rv) { ++# print "* User counter available (Sun-MIB).\n"; ++# $targ = "$OID{sunusers}&$OID{sunusers}:$snmp"; ++# } ++ } ++ ++ if($targ) { ++ print CFG "Target[$hostname-sessions]: $targ\n"; ++ print CFG "PageTop[$hostname-sessions]: $sdesc
Active Sessions\n"; ++ print CFG "Title[$hostname-sessions]: Active Sessions on $sname\n"; ++ print CFG "MaxBytes[$hostname-sessions]: 1000000\n"; ++ print CFG "SetEnv[$hostname-sessions]: MRTG_INT_DESCR=\"Sessions\"\n"; ++ print CFG "Options[$hostname-sessions]: nopercent, gauge\n"; ++ print CFG "YLegend[$hostname-sessions]: Sessions\n"; ++ print CFG "ShortLegend[$hostname-sessions]:  \n"; ++ print CFG "LegendI[$hostname-sessions]: Sessions\n"; ++ print CFG "Legend1[$hostname-sessions]: Active Sessions\n"; ++ print CFG "Legend3[$hostname-sessions]: Peak Active Sessions\n"; ++ print CFG "routers.cgi*Options[$hostname-sessions]: nomax, nototal, fixunit, noo\n"; ++ print CFG "routers.cgi*Mode[$hostname-sessions]: general\n"; ++ print CFG "routers.cgi*ShortDesc[$hostname-sessions]: Sessions\n"; ++ print CFG "routers.cgi*Description[$hostname-sessions]: Sessions on $sname\n"; ++ print CFG "routers.cgi*UnScaled[$hostname-sessions]: none\n"; ++ print CFG "routers.cgi*InOut[$hostname-sessions]: no\n"; ++ print CFG "routers.cgi*InSummary[$hostname-sessions]: yes\n"; ++ print CFG "routers.cgi*InCompact[$hostname-sessions]: no\n"; ++ print CFG "routers.cgi*Icon[$hostname-sessions]: user-sm.gif\n"; ++ } else { ++ print CFG "#\n# Not available.\n"; ++ print "Sessions count not available.\n"; ++ } ++ + + # processes + print CFG "\n#######################################\n"; diff --git a/net-mgmt/routers2-extras/pkg-descr b/net-mgmt/routers2-extras/pkg-descr new file mode 100644 index 000000000000..33211c2af75f --- /dev/null +++ b/net-mgmt/routers2-extras/pkg-descr @@ -0,0 +1,3 @@ +Extras extensions and third party scripts for routers2 frontend + +WWW: http://www.steveshipway.org/software/ diff --git a/net-mgmt/routers2-extras/pkg-plist b/net-mgmt/routers2-extras/pkg-plist new file mode 100644 index 000000000000..911211a7d1db --- /dev/null +++ b/net-mgmt/routers2-extras/pkg-plist @@ -0,0 +1,41 @@ +www/routers2/extras/buildwan.pl +www/routers2/extras/cfgmaker_host.pl +www/routers2/extras/check_esx2 +www/routers2/extras/check_foundry +www/routers2/extras/checkagent +www/routers2/extras/gather.pl +www/routers2/extras/getstats.sh +www/routers2/extras/graphprune.pl +www/routers2/extras/mrtg-apache +www/routers2/extras/mrtg-nrpe.pl +www/routers2/extras/mrtg-nrpe.sh +www/routers2/extras/mrtg-pnsclient.pl +www/routers2/extras/mrtg-portsinuse.pl +www/routers2/extras/rrd-archive-clean.pl +www/routers2/extras/rrd-archive.pl +www/routers2/extras/rrdextend.pl +www/routers2/extras/vmware_monitor.pl +www/routers2/extras/vmware_monitor2.pl +www/routers2/extras/winalert.pl +www/routers2/extras/targetnames.pl +www/routers2/extras/mrtg-nrpe.cfg +www/routers2/extras/mrtg-pnsclient.cfg +www/routers2/extras/rrd-archive.conf +www/routers2/extras/winalert.conf +www/routers2/extras/95.pl +www/routers2/extras/templates/template-mrtg-dns +www/routers2/extras/templates/template-mrtg-ipcs +www/routers2/extras/templates/template-mrtg-nrpe +www/routers2/extras/templates/template-mrtg-ping +www/routers2/extras/templates/template-mrtg-pnsclient +%%PORTDOCS%%%%DOCSDIR%%/README +%%PORTDOCS%%%%DOCSDIR%%/buildwan.txt +%%PORTDOCS%%%%DOCSDIR%%/graphprune.txt +%%PORTDOCS%%%%DOCSDIR%%/mrtg-nrpe.txt +%%PORTDOCS%%%%DOCSDIR%%/mrtg-pnsclient.txt +%%PORTDOCS%%%%DOCSDIR%%/rrd-archive.txt +%%PORTDOCS%%%%DOCSDIR%%/vmware_monitor.txt +%%PORTDOCS%%%%DOCSDIR%%/winalert.txt +@dirrm www/routers2/extras/templates +@dirrm www/routers2/extras +%%PORTDOCS%%@dirrm %%DOCSDIR%%