skript kterej resetuje poctadla :
# !/bin/bash
DIALOG=${DIALOG:-`which dialog`} # Where we have dialog executable
SSH=${SSH:-`which ssh`} # Where to find ssh
EXPECT=${EXPECT:-`which expect`} # Where to find expect
TMPFILE=`mktemp /tmp/routeros.tmp.XXXXXXXX` # Temp file
### Change following values: ####
ROUTER_LIST="/opt/snmp/servers.txt" # List of your routers, one per line
###-----------------------------------------------------###
ROUTER_IP=`cat ${ROUTER_LIST}`
ROUTER_AMOUNT=`cat ${ROUTER_LIST} | wc -l`
ROUTER_NUM=`cat -n ${ROUTER_LIST} | cut -f 1`
echo '
spawn '${SSH}' 192.168.123.254 -l admin
expect -re "password:"
send "heslo\r"
#
expect -re "] > "
send "/queue tree reset-counters\r"
sleep 2
#
expect -re "] > "
send "/queue simple reset-counters\r"
sleep 2
expect -re "] > " exit
' > ${TMPFILE}
${EXPECT} ${TMPFILE}
rm -rf ${TMPFILE}
echo ""
exit 0
PHP script ktery precte urcita OID ktera si bere z databaze:
<?php
//pripojeni k SNMP serveru
$hostitel="192.168.123.254";
$komunita="free";
//pripojeni k databazi
@$spojeni = MySQL_Connect("localhost","root","heslo");
if (!$spojeni):
echo "Připojení k databázi se nezdařilo...";
break;
endif;
MySQL_Select_DB("rajhradice_net");
while ($zaznam = MySQL_Fetch_Array($vysledek)){
$down0=snmpget($hostitel,$komunita,$zaznam["oid_down"]);
$p2p0=snmpget($hostitel,$komunita,$zaznam["oid_p2p"]);
$up0=snmpget($hostitel,$komunita,$zaznam["oid_up"]);
}
mysql_Close();
echo "OK";
?>