ini bisa jadi solusi buat yang aktifin fitur graphing di mikocok untuk graphing queue nya.. tapi data selalu hilang bila terjadi mati listrik ( bukan mati lampu ya ) kalo mati lampu ya nyalain aja sakelar nya :))
yuu ah geboooy
cat /usr/sbin/automrtg
#!/bin/bash
#######################################
# automatic mrtg config maker #
# by angga_s@raharja-net.co.id #
# 14 Februari 2013 #
#######################################
/usr/bin/ssh 192.168.2.254 -p 2222 /queue simple print without-paging where disabled=no > /root/get1
/usr/bin/ssh 192.168.2.254 -p 2222 /queue simple print oid without-paging where disabled=no > /root/get2
/bin/sed '1d' /root/get2 > /root/get2a
/bin/grep -n D /root/get2a |/usr/bin/awk '{print $1}' | /usr/bin/cut -f1 -d: > /root/get2b
/bin/cat -n /root/get2b | /usr/bin/sort -nr | /usr/bin/awk '{print $2}' > /root/get2c
for xd in $(/bin/cat /root/get2c)
do
/bin/echo "/bin/sed -i '$xd d' /root/get2a" > /tmp/goban1
/bin/echo "/bin/sed -i '$xd d' /root/get2a" >> /tmp/goban1
/bin/echo "/bin/sed -i '$xd d' /root/get2a" >> /tmp/goban1
/bin/echo "/bin/sed -i '$xd d' /root/get2a" >> /tmp/goban1
/bin/echo "/bin/sed -i '$xd d' /root/get2a" >> /tmp/goban1
/bin/echo "/bin/sed -i '$xd d' /root/get2a" >> /tmp/goban1
/bin/echo "/bin/sed -i '$xd d' /root/get2a" >> /tmp/goban1
/bin/sh /tmp/goban1
done
/bin/sed -i '1 d' /root/get1
/bin/grep -n 'D name' /root/get1 |/usr/bin/awk '{print $1}' |/usr/bin/awk '{print $1}' | /usr/bin/cut -f1 -d: > /root/get1a
/bin/cat -n /root/get1a | /usr/bin/sort -nr | /usr/bin/awk '{print $2}' > /root/get1b
for dx in $(/bin/cat /root/get1b)
do
/bin/echo "/bin/sed -i '$dx d' /root/get1" > /tmp/goban2
/bin/echo "/bin/sed -i '$dx d' /root/get1" >> /tmp/goban2
/bin/echo "/bin/sed -i '$dx d' /root/get1" >> /tmp/goban2
/bin/echo "/bin/sed -i '$dx d' /root/get1" >> /tmp/goban2
/bin/echo "/bin/sed -i '$dx d' /root/get1" >> /tmp/goban2
/bin/sh /tmp/goban2
done
/bin/cat /root/get2a |/bin/grep name |/usr/bin/awk '{print $1}' > /root/nomor-get2
/bin/grep 'name=' /root/get1 | /usr/bin/awk '{print $1,$2}' > /root/nama-get1
/bin/grep -v name /root/get2a |/bin/grep -v packets-in | /bin/grep -v packets-out | /bin/grep -v queues-in |/bin/grep -v queues-out |/bin/grep bytes-out |/usr/bin/awk '{print $1}' > /root/bytes-out
/bin/grep -v name /root/get2a |/bin/grep -v packets-in | /bin/grep -v packets-out | /bin/grep -v queues-in |/bin/grep -v queues-out |/bin/grep bytes-in |/usr/bin/awk '{print $1}' > /root/bytes-in
/bin/grep -n bytes /root/bytes-in |/usr/bin/awk '{print $1}' | /usr/bin/cut -f1 -d: > /root/nomor
/bin/echo "WorkDir: /var/www/mrtg/" > /etc/mrtg.cfg
for nomor in $(/bin/cat /root/nomor)
do
nama="$(head -$nomor /root/nama-get1 |tail -1 |/usr/bin/awk '{print $2}' |/bin/sed 's/.\{1\}$//' | /bin/sed 's/^......//')"
bytein="$(head -$nomor /root/bytes-in |tail -1 |/usr/bin/awk '{print $1}' | /bin/sed 's/^.........//')"
byteout="$(head -$nomor /root/bytes-out |tail -1 |/usr/bin/awk '{print $1}' | /bin/sed 's/^..........//')"
/usr/sbin/create-mrtg $nama $bytein $byteout >> /etc/mrtg.cfg
done
/usr/bin/indexmaker --output /var/www/mrtg/index.html /etc/mrtg.cfg
/bin/grep -n MRTG /var/www/mrtg/index.html |/bin/grep Index |/usr/bin/awk '{print $1}' | /usr/bin/cut -f1 -d: > /root/hapus
for hapus in $(/bin/cat /root/hapus)
do
/bin/echo "/bin/sed -i '$hapus d' /var/www/mrtg/index.html" > /tmp/hapus
/bin/sh /tmp/hapus
done
cat /usr/sbin/create-mrtg
#!/bin/bash
echo "Target[$1]:$2&$3:public@192.168.2.254:"
echo "MaxBytes[$1]: 64000"
echo "Options[$1]: bits,nobanner"
echo "Title[$1]: $1"
echo "PageTop[$1]: <H1>$1</H1>"
crontab -l |grep mrtg
*/5 * * * * /usr/bin/env LANG=C /usr/bin/mrtg /etc/mrtg.cfg
1 * * * * /usr/sbin/automrtg &
Sekian dan Terima kasih...