Hi !
I am using nagios to monitor my equipments .
I have to monitor the interfaces of my switches and routers, but is a big number of interfaces and equipments , i can’t add it one by one manualy .
I searshed in internet , and i have found this script :
[code]#!/usr/bin/perl
use strict;
open(MODEL, “modele.txt”);
mkdir(“modeles”) if(!-d(“modeles”));
while() {
chomp();
my($modele, $ip) = split(/;/);
my @interfaces = snmpwalk -c ecalyptus -v 2c $ip 1.3.6.1.2.1.2.2.1.2
;
open(MODEL_CFG, “>modeles/switch-$modele.cfg”);
foreach(@interfaces) {
if(/iso.3.6.1.2.1.2.2.1.2.(\d+) = STRING: “(.Ethernet.)”/) {
my ($id, $interface) = ($1, $2);
print MODEL_CFG “define service {
hostgroup_name $modele
use generic-service
service_description $interface
check_command check_port_usage!$id!6000!8000
}
\n”;
}
}
close(MODEL_CFG);
}
close(MODEL);[/code]
i don’t know how to use it , what should I write on modele.com file, and from where my script will get the $ip et $modele ?
Please help me .
Here i found this script :
Best regards,
FanUser