LCG-FR / SA1-FR Monitoring WG CACTI

Un article de lcgwiki.
Revision as of 09:14, 17 décembre 2008 by Mendoza (talk | contribs)
Jump to: navigation, search

Installation de CACTI

http://www.cacti.net/

Installation

Suivre le manuel très bien fait: http://www.cacti.net/downloads/docs/pdf/manual.pdf

Installation des RPMs

Un certian nombre de RPMs utiles se trouvent sur le repositary du LAL:

wget http://quattorsrv.lal.in2p3.fr/packages/cacti/cacti-0.8.7b-2.el4.rf.noarch.rpm
wget http://quattorsrv.lal.in2p3.fr/packages/os/sl460-x86_64/base/SL/RPMS/php-snmp-4.3.9-3.22.9.x86_64.rpm
wget http://quattorsrv.lal.in2p3.fr/packages/os/sl460-x86_64/base/SL/RPMS/\
 mysql-server-4.1.20-3.RHEL4.1.el4_6.1.x86_64.rpm
wget http://quattorsrv.lal.in2p3.fr/packages/os/sl460-x86_64/base/SL/RPMS/perl-DBD-MySQL-2.9004-3.1.x86_64.rpm
rpm -ivh http://quattorsrv.lal.in2p3.fr/packages/os/sl460-x86_64/base/SL/RPMS/perl-DBD-MySQL-2.9004-3.1.x86_64.rpm mysql-server-4.1.20-3.RHEL4.1.el4_6.1.x86_64.rpm
 

Config Mysql

Se référer a la Doc: http://www.cacti.net/downloads/docs/pdf/manual.pdf

Ceci n'est qu'un copier/coller des actions faites sur un site:

/etc/init.d/mysqld start
mysqladmin --user=root password *yourpasswd*
mysqladmin --user=root create cacti -p
mysql cacti -p  < /var/www/cacti/cacti.sql
Modifier 
/var/www/cacti/include/config.php

Config http

Modifier le fichier:

/etc/httpd/conf.d/cacti.conf

Config php

Modifier le fichier /etc/php.ini:

memory_limit = 128M

Vérifier que snmp V1 répond

snmpwalk -v 1 -c public 'your switch'

Configuration

Ajout des nouveaux devices en utilisant les commandes en ligne

Cela permet d'automatiser la configuration de plusieurs machines:

http://www.cacti.net/downloads/docs/html/scripts.html

Ajouter un device (attention utiliser template 1 pour pouvoir recuperer les stats des interfaces)

for i in $(cat /root/CACTI/wnlistplat); do php -q add_device.php --avail=ping --ping_method=udp --ping_retries=1 \
 --description=$i --ip=$i --template=1 --community="public" ; done

Ajouter les devices dans un tree:

for i in $(seq  83 147); do php -q add_tree.php --type=node --node-type=host --tree-id=4 --host-id=$i; done

Ajouter les graphes (type 'ds') des interfaces pour tous les devices:

for i in $(seq  83 147); do php -q add_graphs.php --host-id=$i --graph-type=ds --snmp-query-id=1 \
--snmp-query- type-id=13 --snmp-field=ifOperStatus  --snmp-value=Up --graph-template-id=2 ; done

Ajouter les graphes cg linux

for i in $(seq  83 147); do  for j in  7 8 9 10 12 ; do  php -q add_graphs.php --host-id=$i  \
--snmp-query-id=6 --graph- template-id=$j --graph-type=cg; done; done

Dépannage

Optimisation

Migrer vers InnoDB

Pour pouvoir utiliser des locks par ligne

Créer des indexes

http://bugs.cacti.net/view.php?id=1333

create index `data_template_data_id` ON `data_input_data` (`data_template_data_id`);
create index `host_id_snmp_query_id_snmp_index` ON data_local (`host_id`,`snmp_query_id`,`snmp_index`);
create index `local_data_id_data_source_name` ON data_template_rrd (`local_data_id`,`data_source_name`);
create index `graph_template_id_local_graph_id` ON graph_templates_item (`graph_template_id`,`local_graph_id`);
create index `local_graph_template_item_id` ON graph_templates_item (`local_graph_template_item_id`);
create index `host_id_snmp_query_id_snmp_index` ON host_snmp_cache (`host_id`,`snmp_query_id`,`snmp_index`);
create index `local_data_id_rrd_path` ON poller_item (`local_data_id`,`rrd_path`);
create index `host_id_rrd_next_step` ON poller_item (`host_id`,`rrd_next_step`);
create index order_key3 on graph_tree_items (order_key(3));
create index order_key6 on graph_tree_items (order_key(6));
create index order_key9 on graph_tree_items (order_key(9));
create index host_id_snmp_query_id ON host_snmp_cache (host_id,snmp_query_id);
create index host_id_snmp_port ON poller_item (host_id,snmp_port);

spine

Extension

Grille