Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docpublic:reseaux:services:monitcacti [2015/03/29 09:32]
procacci@tem-tsp.eu [create DB]
docpublic:reseaux:services:monitcacti [2019/03/11 21:53] (current)
procacci@tem-tsp.eu [postfix template for cacti]
Line 1: Line 1:
 ====== supervision cacti ====== ====== supervision cacti ======
  
 +
 +===== references =====
 +
 +==== debug ====
 +
 +  * https://docs.cacti.net/manual:087:4_help.2_debugging
 +  * https://unix.stackexchange.com/questions/248685/which-oid-to-check-for-extend-sh-script-output-in-net-snmp-snmpd
 ===== base systeme ===== ===== base systeme =====
  
Line 139: Line 146:
 </code> </code>
  
 +
 +==== import initial DB structure ====
 +
 +if not recovering an aold instance, create new one 
 +
 +<code>
 +# mysql -u usercacti -p -h localhost cacti_bd < /var/www/html/cacti-0.8.8e/cacti.sql 
 +Enter password: 
 +</code>
 ===== installation cacti 8.8c ===== ===== installation cacti 8.8c =====
  
Line 158: Line 174:
 [root@monitor cacti]# vim ./include/config.php [root@monitor cacti]# vim ./include/config.php
 </code> </code>
 +
 +==== cacti cron job ====
 +
 +beware to set full path name to **/usr/bin/php** in the cron job , if not poller is not executed !
 +
 +<code>
 + # cat /etc/cron.d/cacti 
 +*/5 * * * * cacti /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1
 +</code>
 +
  
 ===== upgrade-recover data from old cacti ===== ===== upgrade-recover data from old cacti =====
Line 179: Line 205:
 </code> </code>
  
 +
 +==== copy-recover ressources ====
 +
 +<code>
 +[root@monit cacti]# cp -v -u -R /root/cacti/oldresource/* ./resource/
 +« /root/cacti/oldresource/script_queries/Cisco4400_aps.xml » -> « ./resource/script_queries/Cisco4400_aps.xml »
 +...
 +</code>
 +
 +==== run web update URL ====
 +
 +go run install-update to your server http://monitor.it-sudparis.eu/cacti/install/index.php
 +
 +<code>
 +Cacti Installation Guide
 +
 +Upgrade results:
 +
 +0.8.7g -> 0.8.7h
 +
 +[Success] ALTER TABLE host_snmp_cache ADD COLUMN present tinyint NOT NULL DEFAULT '1' AFTER `oid`
 +
 +[Success] ALTER TABLE host_snmp_cache ADD INDEX present (present)
 +
 +[Success] ALTER TABLE poller_item ADD COLUMN present tinyint NOT NULL DEFAULT '1' AFTER `action`
 +
 +[Success] ALTER TABLE poller_item ADD INDEX present (present)
 +
 +[Success] ALTER TABLE poller_reindex ADD COLUMN present tinyint NOT NULL DEFAULT '1' AFTER `action`
 +
 +[Success] ALTER TABLE poller_reindex ADD INDEX present (present)
 +
 +[Success] ALTER TABLE host ADD COLUMN device_threads tinyint(2) unsigned NOT NULL DEFAULT '1' AFTER max_oids;
 +
 +[Success] ALTER TABLE `data_template_rrd` ADD UNIQUE INDEX `duplicate_dsname_contraint` (`local_data_id`, `data_source_name`, `data_template_id`)
 +
 +0.8.7i -> 0.8.8
 +
 +[Success] ALTER TABLE `poller_item` MODIFY COLUMN `host_id` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0'
 +
 +[Success] ALTER TABLE `poller_output` DROP PRIMARY KEY
 +
 +[Success] ALTER TABLE `poller_output` ADD PRIMARY KEY (`local_data_id`, `rrd_name`, `time`) /*!50060 USING BTREE */
 +
 +[Success] ALTER TABLE `user_log` ADD KEY `user_id` (`user_id`)
 +
 +[Success] CREATE TABLE IF NOT EXISTS `plugin_config` (
 +`id` int(8) unsigned NOT NULL auto_increment,
 +`directory` varchar(32) NOT NULL default '',
 +`name` varchar(64) NOT NULL default '',
 +`status` tinyint(2) NOT NULL default 0,
 +`author` varchar(64) NOT NULL default '',
 +`webpage` varchar(255) NOT NULL default '',
 +`version` varchar(8) NOT NULL default '',
 +PRIMARY KEY (`id`),
 +KEY `status` (`status`),
 +KEY `directory` (`directory`)
 +) ENGINE=MyISAM COMMENT='Plugin Configuration'
 +
 +[Success] CREATE TABLE IF NOT EXISTS `plugin_db_changes` (
 +`id` int(10) unsigned NOT NULL auto_increment,
 +`plugin` varchar(16) NOT NULL default '',
 +`table` varchar(64) NOT NULL default '',
 +`column` varchar(64) NOT NULL default '',
 +`method` varchar(16) NOT NULL default '',
 +PRIMARY KEY (`id`),
 +KEY `plugin` (`plugin`),
 +KEY `method` (`method`)
 +) ENGINE=MyISAM COMMENT='Plugin Database Changes'
 +
 +[Success] CREATE TABLE IF NOT EXISTS `plugin_hooks` (
 +`id` int(8) unsigned NOT NULL auto_increment,
 +`name` varchar(32) NOT NULL default '',
 +`hook` varchar(64) NOT NULL default '',
 +`file` varchar(255) NOT NULL default '',
 +`function` varchar(128) NOT NULL default '',
 +`status` int(8) NOT NULL default 0,
 +PRIMARY KEY (`id`),
 +KEY `hook` (`hook`),
 +KEY `status` (`status`)
 +) ENGINE=MyISAM COMMENT='Plugin Hooks'
 +
 +[Success] CREATE TABLE IF NOT EXISTS `plugin_realms` (
 +`id` int(8) unsigned NOT NULL auto_increment,
 +`plugin` varchar(32) NOT NULL default '',
 +`file` text NOT NULL,
 +`display` varchar(64) NOT NULL default '',
 +PRIMARY KEY (`id`),
 +KEY `plugin` (`plugin`)
 +) ENGINE=MyISAM COMMENT='Plugin Realms'
 +
 +[Success] REPLACE INTO `plugin_realms` VALUES (1, 'internal', 'plugins.php', 'Plugin Management')
 +
 +[Success] REPLACE INTO `plugin_hooks` VALUES (1, 'internal', 'config_arrays', '', 'plugin_config_arrays', 1)
 +
 +[Success] REPLACE INTO `plugin_hooks` VALUES (2, 'internal', 'draw_navigation_text', '', 'plugin_draw_navigation_text', 1)
 +
 +[Success] REPLACE INTO user_auth_realm VALUES (101,1)
 +
 +[Success] ALTER TABLE `data_template_data` ADD KEY `data_input_id` (`data_input_id`)
 +
 +</code>
 +
 +
 +===== optimize run with spine =====
 +
 +<code>
 +[root@monitor ~]# cat /etc/cron.d/cacti
 +*/5 * * * *     apache   php /var/www/html/cacti/poller.php > /dev/null 2>&1
 +
 +[root@monitor ~]# chown apache.cacti /var/log/cacti/cacti.log
 +
 +[root@monitor ~]# wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.8c.tar.gz
 +
 +[root@monitor ~]# tar xvfz cacti-spine-0.8.8c.tar.gz
 +[root@monitor ~]# cd cacti-spine-0.8.8c/
 +[root@monitor cacti-spine-0.8.8c]#
 +[root@monitor cacti-spine-0.8.8c]# ./configure
 +[root@monitor cacti-spine-0.8.8c]# make
 +[root@monitor cacti-spine-0.8.8c]# make install
 +make[1] : on entre dans le répertoire « /root/cacti-spine-0.8.8c »
 + /usr/bin/mkdir -p '/usr/local/spine/bin'
 +  /bin/sh ./libtool   --mode=install /usr/bin/install -c spine '/usr/local/spine/bin'
 +libtool: install: /usr/bin/install -c spine /usr/local/spine/bin/spine
 + /usr/bin/mkdir -p '/usr/local/spine/etc'
 + /usr/bin/install -c -m 644 spine.conf.dist '/usr/local/spine/etc'
 +make[1] : on quitte le répertoire « /root/cacti-spine-0.8.8c »
 +</code>
 +
 +==== debug spine poller ====
 +
 +
 +  * https://github.com/Cacti/cacti/issues/284
 +  * https://www.carta.tech/man-pages/man1/spine.1.html
 +
 +<code>
 +/usr/local/spine/bin/spine -R -V 5 -f 1 -l 1 -S -p 4 -C /usr/local/spine/etc/spine.conf
 +</code>
 +
 +parfois un script a un pb de droit de fichier tmp dans /tmp apres debug en root , cela marche en shell root mais pas via spine / apache .
 +
 +<code>
 +[cacti@mon ~]$ /usr/share/cacti-1.1.20/scripts/tomcat_stats.pl 'tomcat.tsp.eu' 'tp' 'get' 'maxThreads' 'Catalina:type=ThreadPool,name="http-bio-8080"'
 +Could not open cache /tmp/tomcat.tsp.eu-cacti_tomcat-Q2F0YWxpbmE6dHlwZT1UaHJlYWRQb29sLG5hbWU9Kg== at /usr/share/cacti-1.1.20/scripts/tomcat_stats.pl line 338.
 +[cacti@mon ~]$ exit
 +déconnexion
 +[root@mon include]# ls -l /tmp/tomcat.tsp.eu-cacti_tomcat-Q2F0YWxpbmE6dHlwZT1UaHJlYW*
 +-rw-r--r-- 1 root root 2045 18 avril 21:18 /tmp/tomcat.tsp.eu-cacti_tomcat-Q2F0YWxpbmE6dHlwZT1UaHJlYWRQb29sLG5hbWU9Kg==
 +[root@monit include]# chown apache:cacti /tmp/tomcat.tsp.eu-cacti_tomcat-Q2F0YWxpbmE6dHlwZT1UaHJlYWRQb29sLG5hbWU9Kg\=\= 
 +</code>
  
  
Line 270: Line 446:
 </code> </code>
  
 +
 +
 +===== postfix template for cacti =====
 +
 +
 +  * https://www.pitt-pladdy.com/blog/_20091122-164951_0000_Postfix_stats_on_Cacti_via_SNMP_/
 +  * https://www.pitt-pladdy.com/blog/_20120305-102839_0000_Cacti_hack_for_forward_compatibility/
 +
 +
 +recopies depuis smtpO vers smtpF
 +
 +<code>
 +[root@smtpO ~]# scp /etc/snmp/local-snmp-cronjob root@smtpF.imt-tsp.eu:/etc/snmp/
 +
 +
 +[root@smtpO ~]# scp -r /etc/snmp/postfix-script-stats root@smtpF.imt-tsp.eu:/etc/snmp/
 +spamd.pm                                                                                                        100% 2971     2.5MB/  00:00    
 +postfix-stats-local 
 +
 +         
 +[root@smtpO ~]# scp /etc/cron.d/local-snmp root@smtpF.imt-tsp.eu:/etc/cron.d/
 +local-snmp              
 +
 +[root@smtpO ~]# scp -r /etc/snmp/uloganalyser-plugin root@smtpF.imt-tsp.eu:/etc/snmp/
 +postfix.pm  
 +
 +[root@smtpO ~]# scp /etc/snmp/uloganalyser root@smtp4.imtbs-tsp.eu:/etc/snmp/
 +uloganalyser                                                                   
 +
 +</code>
 +
 +sur la destination 
 +
 +<code>
 +[root@smtpF ~]# mkdir /var/local/snmp
 +</code>
 +
 +puis apres 5-10 mn , le cron a joué son role et les stats pour cacti sont là : 
 +
 +<code>
 +[root@smtpF ~]# cat /var/local/snmp/mail
 +lastrun=1552322401
 +lastline=16519
 +lastposition=2213301
 +repeatline=Mar 11 17:39:54 smtp4 postfix/qmgr[31062]: 68980116F2E1: removed
 +lastinode=344479
 +postfix:local:sent=2
 +postfix:local:sent:mailbox=2
 +postfix:pickup=2
 +postfix:queue:active=0
 +postfix:queue:deferred=194
 +postfix:queue:hold=0
 +postfix:queue:incoming=0
 +postfix:queue:maildrop=0
 +postfix:smtp:bounced=460
 +postfix:smtp:connect=3150
 +postfix:smtp:connect:ipv4=2826
 +postfix:smtp:connect:ipv6=323
 +postfix:smtp:connrefused=100
 +postfix:smtp:deferred=766
 +postfix:smtp:deferred:brokenserver=503
 +postfix:smtp:deferred:dnserror=10
 +postfix:smtp:deferred:greylist=144
 +postfix:smtp:deferred:other=88
 +postfix:smtp:deferred:timeout=11
 +postfix:smtp:lostconnection=77
 +postfix:smtp:noroute=107
 +postfix:smtp:sent=1040
 +postfix:smtp:timeout=220
 +postfix:smtp:unreachable=261
 +postfix:smtp:warning=6
 +postfix:smtpd:QUEUED=1162
 +postfix:smtpd:connect=1137
 +postfix:smtpd:connect:ipv4=1137
 +</code>
 +
 +
 +ajouter les extend a snmpd.conf 
 +
 +<code>
 +##  #cacti 
 +##  #  #http://www.pitt-pladdy.com/blog/_20091122-164951_0000_Postfix_stats_on_Cacti_via_SNMP_/
 +#
 +extend postfixlocal     /etc/snmp/postfix-script-stats/postfix-stats-local
 +extend postfixlmtp      /etc/snmp/postfix-script-stats/postfix-stats-lmtp
 +extend postfixpickup /etc/snmp/postfix-script-stats/postfix-stats-pickup
 +extend postfixqueue /etc/snmp/postfix-script-stats/postfix-stats-queue
 +extend postfixsmtp      /etc/snmp/postfix-script-stats/postfix-stats-smtp-connect
 +extend postfixsmtpstatus        /etc/snmp/postfix-script-stats/postfix-stats-smtp-status
 +extend postfixsmtptls   /etc/snmp/postfix-script-stats/postfix-stats-smtp-tls
 +extend postfixsmtpwarn  /etc/snmp/postfix-script-stats/postfix-stats-smtp-warning
 +extend postfixsmtpd     /etc/snmp/postfix-script-stats/postfix-stats-smtpd-connect
 +extend postfixsmtpdnq   /etc/snmp/postfix-script-stats/postfix-stats-smtpd-noqueue
 +extend postfixsmtpdnqrec        /etc/snmp/postfix-script-stats/postfix-stats-smtpd-noqueue-recipient
 +extend postfixsmtpdnqrel        /etc/snmp/postfix-script-stats/postfix-stats-smtpd-noqueue-relay
 +extend postfixsmtpdnqsnd        /etc/snmp/postfix-script-stats/postfix-stats-smtpd-noqueue-sender
 +extend postfixsmtpdnqclnt       /etc/snmp/postfix-script-stats/postfix-stats-smtpd-noqueue-client
 +extend postfixsmtpdqd   /etc/snmp/postfix-script-stats/postfix-stats-smtpd-queued
 +extend postfixsmtpdtls  /etc/snmp/postfix-script-stats/postfix-stats-smtpd-tls
 +extend postfixsmtpdwarn /etc/snmp/postfix-script-stats/postfix-stats-smtpd-warning
 +extend postfixcleanup   /etc/snmp/postfix-script-stats/postfix-stats-cleanup
 +extend postfixpolicy /etc/snmp/postfix-script-stats/postfix-stats-policy
 +extend postfixip /etc/snmp/postfix-script-stats/postfix-stats-connect-ip
 +extend clamav /etc/snmp/postfix-script-stats/clamav-stats
 +extend dkim /etc/snmp/postfix-script-stats/dkim-stats
 +extend spamd /etc/snmp/postfix-script-stats/spamd-stats
 +</code>
docpublic/reseaux/services/monitcacti.1427621544.txt.gz · Last modified: 2015/03/29 09:32 by procacci@tem-tsp.eu
[unknown link type]Back to top
CC Attribution-Noncommercial-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0