On Wed, Feb 25, 2004 at 12:10:05PM -0800, Jim Trocki wrote:
> On Wed, 25 Feb 2004, Mehmet Ali Suzen wrote:
>
> > Hi All,
> > I wrote a simple monitor script to check whether Cisco routers given
> > interface is up or down. Is it worth to publish it as contrib monitor
> > script? If so how?
>
> is it different than this one?
>
> http://ftp.kernel.org/pub/software/admin/mon/contrib/monitors/cisco/
my version is primitive compare to that one and tested only on cisco 2500 series,
relies
on an IoS command. I got an other script which checks CPU utilization
and IP Input load, which returns exit 1 when the value is above the
treshold. Does anyone might need this as well? If so I will post it
to the mailing list.
>
>
> just post your script to the mailing list.
Here is the source:
###################################################################
# Check the given interface of Cisco Router. Return 1
# if line protocol is down.
#
# Arguments it should be in quotes
# "interface_name" : First Argument
# Copyright (C) 2004, Mehmet Ali Suzen <[EMAIL PROTECTED]>
# Kibris.Net Internet Services Nicosia, Cyprus
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
###################################################################
use Net::Telnet::Cisco;
use strict;
my ($router_ip,$password,$password_ena,
$interface_name,$session,@output,$line,
@upinfo,$command,$comment);
$interface_name=$ARGV[0];
##############################################################3
# Change this info to fit your system
$router_ip="your_router_ip";
$password="acess_password";
$password_ena="ena_password";
##############################################################3
$session = Net::Telnet::Cisco->new(Host => $router_ip);
$session->login(Password => $password);
# Execute a command
$session->enable(Password => $password_ena);
#$output= $session->cmd('show interface serial 0 | include line protocol');
$command="show interface $interface_name | include line protocol";
@output= $session->cmd($command);
$line=$output[0];
@upinfo=split(/\s+/,$line);
if( ($upinfo[2] ne ",up") && ($upinfo[6] ne "up") ) {
print "$interface_name down\n";
exit 1;
}
print "$interface_name up\n";
exit 0;
##############################################################3
_______________________________________________
mon mailing list
[EMAIL PROTECTED]
http://linux.kernel.org/mailman/listinfo/mon