Archive for August, 2005

yet another MRTG Generator

Friday, August 26th, 2005

#!/bin/sh
# just save this script, and name it “mrtg-gen”
# chmod 755 mrtg-gen
# then just run it : ./mrtg-gen
# this script help us to create MRTG in easy way
# need : apache, mrtg,rrd,gd,pearl.
# im lack …
# im nothing …
clear
if [ "$1" = "" ]
then
echo | date
echo “”
echo -e “\a”
echo “MRTG Auto Compiler v.2 by rizky.md@gmail.com”
echo “”
echo “———————————————-”
echo “Cara penggunaan :”
echo “./mrtg-gen snmp — untuk setting snmp ”
echo “./mrtg-gen config — untuk bikin config file ”
echo “./mrtg-gen index — untuk generate html file ”
echo “./mrtg-gen exe — untuk file executor ”
echo “———————————————-”
echo “Tested on Redhat,CentOS,IGOS,FEDORA & RHEL try yours ….”
echo “”
echo “Have a nice day …”
echo -e “\a”
exit
fi

if [ "$1" = "snmp" ]
then
echo “Inputkan community string ( contoh : kentang ) :”
read CM
echo “Inputkan file config snmp ( contoh : /etc/snmp/snmpd.conf ) :”
read SMLOC
echo “Inputkan contact person system ( contoh : Rizky M. Dinata ) :”
read SYC
echo “Inputkan lokasi system ( contoh : Australia 33th Avenue DH BLD 4th floor ) :”
read SYAD
echo “Inputkan identitas system ( contoh : My-BlackboX ) :”
read SYID
echo “rocommunity $CM
syslocation $SYAD
sysname $SYID
syscontact $SYC” > $SMLOC
echo “Service snmp di restart …”
echo “”
service snmpd restart
exit
fi

echo “Inputkan lokasi file MRTG ( contoh : /var/www/html/mrtg ) :”
read GLB
echo “Inputkan community string snmp target ( contoh : public ) :”
read NAMA
echo “Inputkan IP address target ( contoh : 192.168.0.1 ) :”
read ALA
echo “Inputkan lokasi file configurasi MRTG ( contoh : /etc/mrtg ) :”
read KON
echo “Inputkan nama file configurasi MRTG ( contoh : test.cfg ) :”
read CFG

if [ "$1" = "config" ]
then
cfgmaker –global “WorkDir: $GLB” –global “Options[_]: growright,bits” –global “RunAsDaemon:Yes” –global “Interval:5″ –global “Refresh:300″ $NAMA@$ALA > $KON/$CFG
echo -e “\a”
echo “File konfigurasi MRTG telah selesai dibuat.”
echo “lokasi file configurasi anda : $KON/$CFG ”
echo “Lanjutkan dengan membuat index file.”
exit
fi

if [ "$1" = "index" ]
then
indexmaker –columns=1 –show=day –pagetop=MRTG-GEN-V2 –title=Network-Traffic-Analysis –output=$GLB/index.html $KON/$CFG
rm $KON/*.pid
mrtg $KON/$CFG
echo -e “\a”
echo “File index telah selesai dibuat.”
echo “lokasi file index anda : $GLB ”
echo “Proses MRTG telah berjalan.”
exit
fi

if [ "$1" = "exe" ]
then
echo ”
rm $KON/*.pid
mrtg $KON/$CFG ” > /etc/mrtg-run
chmod 755 /etc/mrtg-run
ln -s /etc/mrtg-run /etc/init.d/mrtg-run
ln -s /etc/mrtg-run /etc/rc.d/rc3.d/K80mrtg-run
ln -s /etc/mrtg-run /etc/rc.d/rc3.d/S80mrtg-run
echo -e “\a”
echo “Konfigurasi eksekutor selesai .”
echo “Untuk menjalankan secara manual :”
echo “cukup running script : /etc/mrtg-run”
exit
fi
##########################################
# The world will never know … #
# and i will never understand #
# losing my grip … slepted away #
# tryin’ to find my way back #
# to the main purposes why GOD create me #
##########################################