Monitor routers interfaces

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 :

use strict;

open(MODEL, “modele.txt”);
mkdir(“modeles”) if(!-d(“modeles”));
while() {
my($modele, $ip) = split(/;/);
my @interfaces = snmpwalk -c ecalyptus -v 2c $ip;
open(MODEL_CFG, “>modeles/switch-$modele.cfg”);
foreach(@interfaces) {
if(/iso.\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

i don’t know how to use it , what should I write on file, and from where my script will get the $ip et $modele ?

Please help me .

Here i found this script :

Best regards,