From e34d66c02d080f9ef27fed5d4aa8036e5ab1632a Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Tue, 5 May 2009 10:10:37 +0000 Subject: [PATCH] mac accounting updates git-svn-id: http://www.observium.org/svn/observer/trunk@425 61d68cd4-352d-0410-923a-c4978735b2b8 --- discover-macaccounting.php | 36 -------- mac-accounting.pl | 163 ------------------------------------- mac-accounting.sh.example | 2 - process-syslog.php | 3 - 4 files changed, 204 deletions(-) delete mode 100755 discover-macaccounting.php delete mode 100755 mac-accounting.pl delete mode 100755 mac-accounting.sh.example diff --git a/discover-macaccounting.php b/discover-macaccounting.php deleted file mode 100755 index 399503660b..0000000000 --- a/discover-macaccounting.php +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/php - diff --git a/mac-accounting.pl b/mac-accounting.pl deleted file mode 100755 index a753b33855..0000000000 --- a/mac-accounting.pl +++ /dev/null @@ -1,163 +0,0 @@ -#! /usr/bin/perl -# $Id: bgp-peers.pl,v 1.5 2001/08/06 14:45:55 lwa Exp $ - -# $Log: bgp-peers.pl,v $ -# Revision 1.5 2001/08/06 14:45:55 lwa -# add help -# -# Revision 1.4 2001/08/03 19:03:22 lwa -# display hardware mac address (in Cisco format) -# -# - -=pod - -=head1 NAME - - bgp-peers.pl - generate MRTG configuration for BGP peering point - -=head1 SYNOPSIS - - ./bgp-peers.pl - -=head1 DESCRIPTION - -This program generates a MRTG configuration file for graphing traffic -to and from all peers present on a Cisco NAP, using -mac-accounting. Tested with Cisco 720x and Cisco 750x. - -You can then use indexmaker (from mrtg distribution) to generate a cool index -and run the whole stuff from a cronjob. - - -=head2 CISCO CONFIGURATION - -Enable mac-accounting on NAP interface (see the example below) - -=over 4 - - Router# conf t - Router(config)# interface FastEthernet2/0 - Router(config-if)# ip accounting mac-address input - Router(config-if)# ip accounting mac-address output - Router(config-if)#exit - Router(config)#exit - -=back - -=head1 BUGS - -The only problem I have noticed is when your are not getting any data -from a peer (IN or OUT) the variable wont be in the SNMP tree and -MRTG will complain. If its occurs during long time, this probably mean -you have a problem with your peer because you are expected to make -some traffic with it (at least, BGP traffic). - -If the peer change its hardware address, you have to re-run -this program to take the modification. - -=head1 THANKS - -Thanks to groups.google.com for the tricks : http://groups.google.com/groups?q=this_mac&hl=en&safe=off&rnum=1&ic=1&selm=91750329.28451%40news.Colorado.EDU - -Thanks to Robert Kiessling from Easynet Germany to have irritated us. - -=head1 AUTHORS - - Erwan Lerale - Arnaud le Taillanter - Laurent Wacrenier - -=cut - -use SNMP_Session; -use SNMP_util; -use BER; -use Socket; - -my $hostname = shift; -my $community = shift; -my %interface; -$interface{ip} = shift; - -if ($hostname !~ /^\d+\.\d+\.\d+\.\d+$/) { - print STDERR - "usage: $0 router community interface_ip \n"; - exit 1; -} - -$community = "public" unless defined $community; - -my %OIDS = ( - ipNetToMediaPhysAddress => "1.3.6.1.2.1.4.22.1.2", - bgpPeerState => "1.3.6.1.2.1.15.3.1.2", - bgpPeerRemoteAs => "1.3.6.1.2.1.15.3.1.9", - bgpPeerRemoteAddr => "1.3.6.1.2.1.15.3.1.7", - bgpPeerLocalAddr => "1.3.6.1.2.1.15.3.1.5", - cipMacSwitchedBytes => "1.3.6.1.4.1.9.9.84.1.2.1.1.4", - ); - -my %peers; - -($interface{index}) = snmpget("$community\@$hostname", - "ipAdEntIfIndex.$interface{ip}"); - -($interface{speed}) = snmpget("$community\@$hostname", - "ifSpeed.$interface{index}"); -$interface{speed}/=8; - - -my $session = SNMP_Session->open ($hostname, $community, 161) - or die "Couldn't open SNMP session to $hostname"; - -$session->map_table([ [split /\./, $OIDS{bgpPeerRemoteAddr}], - [split /\./, $OIDS{bgpPeerRemoteAs}], - [split /\./, $OIDS{bgpPeerState}], - [split /\./, $OIDS{bgpPeerLocalAddr}], - ], \&getpeers); - -sub getpeers { - my ($index, $RemoteAddr, $RemoteAs, $State, $LocalAddr) = @_; - my $pLocalAddr = pretty_print($LocalAddr); - return if $pLocalAddr ne $interface{ip}; - - my ($PhysAddress) = snmpget("$community\@$hostname", - "ipNetToMediaPhysAddress.$interface{index}.$index"); - - $peer{$index} = { - RemoteAs => pretty_print($RemoteAs), - PhysAddress => join(".", unpack("C*", $PhysAddress)), - }; - -} - -for my $peer (sort keys %peer) { - my $name = gethostbyaddr(inet_aton($peer), AF_INET) || $peer; - my $mac = sprintf "%02x%02x.%02x%02x.%02x%02x", - split(/\./, $peer{$peer}->{PhysAddress}); - -# print <{PhysAddress}\&$OIDS{cipMacSwitchedBytes}.$interface{index}.2.$peer{$peer}->{PhysAddress}:$community\@$interface{ip} -#MaxBytes[$peer]: $interface{speed} -#Options[$peer]: bits, growright -#ShortLegend[$peer]: bps -#Title[$peer]: MAC traffic for $name (AS$peer{$peer}->{RemoteAs}) -#PageTop[$peer]:

MAC traffic for $name (AS$peer{$peer}->{RemoteAs}) -#

-# -# -# -# -# -#
Peer Name:$name
IP address:$peer
Mac address:$mac
Peer AS:$peer{$peer}->{RemoteAs}
-# -#EOF - -print <{RemoteAs},$mac,$OIDS{cipMacSwitchedBytes}.$interface{index}.1.$peer{$peer}->{PhysAddress},$OIDS{cipMacSwitchedBytes}.$interface{index}.2.$peer{$peer}->{PhysAddress},$community -EOF - - - -} - diff --git a/mac-accounting.sh.example b/mac-accounting.sh.example deleted file mode 100755 index 21526068df..0000000000 --- a/mac-accounting.sh.example +++ /dev/null @@ -1,2 +0,0 @@ -./mac-accounting.pl planning > mac-accounting.txt -./mac-accounting.pl planning >> mac-accounting.txt diff --git a/process-syslog.php b/process-syslog.php index 2d19569ef3..0d78943c76 100755 --- a/process-syslog.php +++ b/process-syslog.php @@ -11,9 +11,6 @@ mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `msg` LIKE '%PM-3- mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `msg` LIKE '%RHWatchdog%'"); mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `msg` LIKE '%Hardware Monitoring%'"); - - - if(!$config['enable_syslog']) { echo("Syslog support disabled.\n"); exit();