October 30, 2008
Cacti On Slackware 12.1
Untuk memonitor network, kita bisa memakai salah satu software open source yaitu Cacti. Kestabilan dan kemudahan Cacti sudah terbukti dipakai baik untuk network skala kecil maupun network skala besar. Untuk instalasi Cacti juga harus diperlukan web server baik itu apache ataupun lainnya, mysql untuk menyimpan database, snmp, dan rrd-tool. Di bawah ini dijelaskan langkah-langkah untuk instalasi dan konfigurasi Cacti di Slackware 12.1. Semoga dapat membantu anda.
root@router21:/# cd /usr/local/src/
Download file rrdtool (rrdtool akan di install langsung dari source) dan cacti
root@router21:/usr/local/src# wget ftp://ftp.pucpr.br/rrdtool/rrdtool-1.2.25.tar.gz
root@router21:/usr/local/src# wget http://www.cacti.net/downloads/cacti-0.8.7b.tar.gz
Install rrdtool
root@router21:/usr/local/src# tar -zxvf rrdtool-1.2.25.tar.gz
root@router21:/usr/local/src# cd rrdtool-1.2.25/
root@router21:/usr/local/src/rrdtool-1.2.25# ./configure –enable-shared=/usr/local/rrdtool
root@router21:/usr/local/src/rrdtool-1.2.25# make && make install
root@router21:/usr/local/src/rrdtool-1.2.25#ln -s /usr/local/rrdtool-1.2.25/bin/rrdtool /usr/bin/
Tambahkan baris “export PATH=/usr/local/rrdtool-1.2.25/bin:$PATH” ke dalam file /etc/profile
root@router21:/usr/local/src/rrdtool-1.2.25#mcedit /etc/profile
export HOSTNAME=”`cat /etc/HOSTNAME`”
export LESSOPEN=”|lesspipe.sh %s”
export LESS=”-M”
export PATH=/usr/local/rrdtool-1.2.25/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/lib
Oke, instalasi rrdtool sudah selesai, sekarang kita bisa melakukan konfigurasi pada snmp.conf.
Disini saya menggunakan snmp bawaan slackware 12.1, untuk melihat apakah sudah terinstall kita bisa cek dengan menngunakan pkgtool. Pastikan juga mysql dan apache sudah terinstall
Edit file snmp.conf di /etc/snmp sesuai keperluan anda
root@router21:/usr/local/src/rrdtool-1.2.25# cd /
root@router21:/# mcedit /etc/snmp/snmp.conf
## sec.name source community
com2sec local localhost slack
com2sec network 192.168.2.0/27 slack
## group.name sec.model sec.name
group MyROGroup v1 network
group MyROGroup v2c network
## incl/excl subtree mask
view all included .1 80
## context sec.model sec.level prefix read write notif
access MyROGroup “” any noauth 0 all none none
##################################################################
# System contact information
#
# It is also possible to set the sysContact and sysLocation system
# variables through the snmpd.conf file:
syslocation Indonesia (edit /etc/snmp/snmpd.conf)
syscontact Root <root@slack.porong.net.id> (configure /etc/snmp/snmp.local.conf)
Setelah itu pastikan konfigurasi snmp anda sudah benar dan berjalan
root@router21:/# /etc/rc.d/rc.snmpd start
root@router21:/# snmpwalk -c slack -v1 192.168.2.1
Kalau terlihat output MIB maka sudah berjalan snmp anda, berikut contoh potongan dari keluaran snmpwalk
DISMAN-EVENT-MIB::mteEventNotificationObjects.”_snmpd”.’_linkDown’ = STRING: _linkUpDown
DISMAN-EVENT-MIB::mteEventNotificationObjects.”_snmpd”.’_linkUp’ = STRING: _linkUpDown
DISMAN-EVENT-MIB::mteEventNotificationObjects.”_snmpd”.’_mteTriggerFailure’ = STRING: _triggerFail
DISMAN-EVENT-MIB::mteEventNotificationObjects.”_snmpd”.’_mteTriggerFalling’ = STRING: _triggerFire
DISMAN-EVENT-MIB::mteEventNotificationObjects.”_snmpd”.’_mteTriggerFired’ = STRING: _triggerFire
DISMAN-EVENT-MIB::mteEventNotificationObjects.”_snmpd”.’_mteTriggerRising’ = STRING: _triggerFire
NOTIFICATION-LOG-MIB::nlmConfigGlobalEntryLimit.0 = Gauge32: 1000
NOTIFICATION-LOG-MIB::nlmConfigGlobalAgeOut.0 = Gauge32: 1440 minutes
NOTIFICATION-LOG-MIB::nlmStatsGlobalNotificationsLogged.0 = Counter32: 0 notifications
NOTIFICATION-LOG-MIB::nlmStatsGlobalNotificationsBumped.0 = Counter32: 0 notifications
Lalu kita bisa lanjutkan untuk konfigurasi cacti :
Extract file cacti yang sudah kita download tadi dan buat direktori untuk menyimpan hasil ekstrakan file cacti di direktori htdocs apache web server anda
root@router21:/# cd /usr/local/src/
root@router21:/usr/local/src# tar -zxvf cacti-0.8.7b.tar.gz
root@router21:/usr/local/src# mkdir /var/www/htdocs/mrtg
root@router21:/usr/local/src# cp -Rf /usr/local/src/cacti-0.8.7b /var/www/htdocs/mrtg
Untuk konfigurasi mysql yaitu sebagai berikut
root@router21:/# cd /var/www/htdocs/mrtg
root@router21:/var/www/htdocs/mrtg# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 5.0.51b-log Source distribution
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> create database cacti;
mysql> grant all on cacti.* to root;
mysql> grant all on cacti.* to root@localhost;
mysql> grant all on cacti.* to cacti;
mysql> grant all on cacti.* to cacti@localhost;
mysql> set password for cacti@localhost=password(’password anda’);
root@router21:/var/www/htdocs/mrtg# mysql -u root -p cacti < cacti.sql
root@router21:/var/www/htdocs/mrtg# mysql -u root -p
Enter password:
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| cacti |
| mysql |
| test |
+——————–+
4 rows in set (0.00 sec)
mysql> use cacti;
Database changed
mysql> show tables;
+—————————+
| Tables_in_cacti |
+—————————+
| cdef |
| cdef_items |
| colors |
| data_input |
| data_input_data |
| data_input_fields |
| data_local |
| data_template |
| data_template_data |
| data_template_data_rra |
| data_template_rrd |
| graph_local |
| graph_template_input |
| graph_template_input_defs |
| graph_templates |
| graph_templates_gprint |
| graph_templates_graph |
| graph_templates_item |
| graph_tree |
| graph_tree_items |
| host |
| host_graph |
| host_snmp_cache |
| host_snmp_query |
| host_template |
| host_template_graph |
| host_template_snmp_query |
| poller |
| poller_command |
| poller_item |
| poller_output |
| poller_reindex |
| poller_time |
| rra |
| rra_cf |
| settings |
| settings_graphs |
| settings_tree |
| snmp_query |
| snmp_query_graph |
| snmp_query_graph_rrd |
| snmp_query_graph_rrd_sv |
| snmp_query_graph_sv |
| user_auth |
| user_auth_perms |
| user_auth_realm |
| user_log |
| version |
+—————————+
48 rows in set (0.00 sec)
mysql> exit
Selanjutnya kita bisa mengkonfigurasi file config dari cacti
root@router21:/var/www/htdocs/mrtg# mcedit include/config.php
/* make sure these values refect your actual database/host/user/password */
$database_type = “mysql”;
$database_default = “cacti”;
$database_hostname = “localhost”;
$database_username = “cacti”;
$database_password = “password anda”;
$database_port = “3306″;
Mengubah kepemilikan direktori mrtg untuk user apache
root@router21:/var/www/htdocs/mrtg# chown -Rf apache.apache /var/www/htdocs/mrtg
Setelah semua sudah terkonfigurasi kita bisa menyelesaikan instalasi cacti lewat web, buka web browser anda misalnya http://192.168.2.1/mrtg
Kalau ternyata kita bisa masuk ke web base cacti berarti instalasi kita sudh benar dan kita bisa melanjutkan instalasi
Sedangkan untuk langkah terakhir yaitu kita bisa memasukkan poller cacti di crontab agar bisa update setiap 5 menit sekali
# If you don’t want the output of a cron job mailed to you, you have to direct
# any output to /dev/null. We’ll do this here since these jobs should run
# properly on a newly installed system, but if they don’t the average newbie
# might get quite perplexed about getting strange mail every 5 minutes. :^)
#
# Run the hourly, daily, weekly, and monthly cron jobs.
# Jobs that need different timing may be entered into the crontab as before,
# but most really don’t need greater granularity than this. If the exact
# times of the hourly, daily, weekly, and monthly cron jobs do not suit your
# needs, feel free to adjust them.
#
# Run hourly cron jobs at 47 minutes after the hour:
40 4 * * * /usr/bin/run-parts /etc/cron.daily 1> /dev/null
#
# Run daily cron jobs at 4:40 every day:
47 * * * * /usr/bin/run-parts /etc/cron.hourly 1> /dev/null
#
# Run weekly cron jobs at 4:30 on the first day of the week:
30 4 * * 0 /usr/bin/run-parts /etc/cron.weekly 1> /dev/null
#
# Run monthly cron jobs at 4:20 on the first day of the month:
20 4 1 * * /usr/bin/run-parts /etc/cron.monthly 1> /dev/null
#untuk poller cacti setiap 5 menit sekali
/5 * * * * /usr/bin/php /var/www/htdocs/mrtg/poller.php > /dev/null 2>&1
Konfigurasi tersebut di atas sudah berjalan sukses di Slackware 12.1
3 Comments »
The URI to TrackBack this entry is: http://jeky466.blogsome.com/2008/10/30/cacti-on-slackware-121/trackback/
RSS feed for comments on this post.
allow a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>


tambah canggih ae mas iki rek” :p
Comment by servdal — October 31, 2008 @ 3:17 pm
Terus semangat Jek..
*wasemmm… kate komen kon ngeja ongko2 ra genah.. capchamu dowo timen..
Comment by Beton — October 31, 2008 @ 4:37 pm
Suwun yang dah comment di blog saya , kulo berusaha memperbaiki terus kekurangan yang ada.
Comment by jeky — October 31, 2008 @ 5:19 pm