# cat /etc/redhat-release CentOS Linux release 7.0.1406 (Core) [root@monitor ~]# uname -a Linux monitor.it-sudparis.eu 3.10.0-123.20.1.el7.x86_64 #1 SMP Thu Jan 29 18:05:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
# yum -y install mariadb-server php php-cli php-mysql net-snmp-utils rrdtool php-snmp gcc mariadb-devel net-snmp-devel autoconf automake libtool dos2unix Résumé de la transaction Installation 14 Paquets (+33 Paquets en dépendance) Taille totale des téléchargements : 59 M Taille d'installation : 210 M
activation du service apache sous centos 7 (systemctl)
[root@monitor ~]# systemctl list-units -all | grep -i http httpd.service loaded inactive dead The Apache HTTP Server [root@monitor ~]# systemctl enable httpd.service ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service' root@monitor ~]# systemctl list-units | grep -i http httpd.service loaded active running The Apache HTTP Server
ref
[root@monitor ~]# firewall-cmd --get-active-zones public interfaces: eth0 [root@monitor ~]# firewall-cmd --permanent --zone=public --add-service=http success [root@monitor ~]# firewall-cmd --reload success [root@monitor ~]# firewall-cmd --list-services dhcpv6-client http ssh [root@monitor ~]# firewall-cmd --permanent --zone=public --add-service=https success [root@monitor ~]# firewall-cmd --reload success [root@monitor ~]# firewall-cmd --list-services dhcpv6-client http https ssh
[root@monitor ~]# systemctl enable mariadb.service ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service' [root@monitor ~]# systemctl list-units --all | grep -i maria mariadb.service loaded inactive dead MariaDB database server [root@monitor ~]# systemctl start mariadb.service [root@monitor ~]# systemctl list-units | grep -i maria mariadb.service loaded active running MariaDB database server
[root@monitor ~]# /usr/bin/mysql_secure_installation Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] Y New password: Re-enter new password: Sorry, passwords do not match. New password: secret Re-enter new password: secret Password updated successfully! Reloading privilege tables.. ... Success! Remove anonymous users? [Y/n] Y ... Success! Disallow root login remotely? [Y/n] n ... skipping. Remove test database and access to it? [Y/n] Y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reload privilege tables now? [Y/n] Y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
[root@monit ~]# mysqladmin -u root -p create cacti_monitor Enter password: MariaDB [(none)]> GRANT ALL ON cacti_monitor.* TO usercacti@localhost IDENTIFIED BY 'secret'; Query OK, 0 rows affected (0.04 sec)
if not recovering an aold instance, create new one
# mysql -u usercacti -p -h localhost cacti_bd < /var/www/html/cacti-0.8.8e/cacti.sql Enter password:
[root@monitor ~]# wget http://www.cacti.net/downloads/cacti-0.8.8c.tar.gz [root@monitor html]# tar xvfz /root/cacti-0.8.8c.tar.gz [root@monitor html]# ln -s cacti-0.8.8c/ cacti [root@monitor html]# ls -l total 4 lrwxrwxrwx. 1 root root 13 27 déc. 22:03 cacti -> cacti-0.8.8c/ drwxr-xr-x. 13 1000 users 4096 23 nov. 21:18 cacti-0.8.8c [root@monitor html]# adduser cacti [root@monitor html]# cd /var/www/html/cacti [root@monitor cacti]# chown -R cacti.apache rra log [root@monitor cacti]# chmod 775 rra log [root@monitor cacti]# vim ./include/config.php
beware to set full path name to /usr/bin/php in the cron job , if not poller is not executed !
# cat /etc/cron.d/cacti */5 * * * * cacti /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1
[root@monitor cacti]# mysql -h localhost -u cactiuser -p cacti_monitor < /root/cacti_old_monitor-jp-2014-12-27-21h52.sql Enter password:
6 . Copy the *.rrd files from the old Cacti directory.
[root@monitor cacti]# cp -v -u /root/cacti/oldscripts/* ./scripts/ « /root/cacti/oldscripts/bind-stats.sh » -> « ./scripts/bind-stats.sh » « /root/cacti/oldscripts/cacti_graph_template_postfix_queues_246.xml » -> « ./scripts/cacti_graph_template_postfix_queues_246.xml » ...
[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 » ...
go run install-update to your server http://monitor.it-sudparis.eu/cacti/install/index.php
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`)
[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 »
/usr/local/spine/bin/spine -R -V 5 -f 1 -l 1 -S -p 4 -C /usr/local/spine/etc/spine.conf
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 .
[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\=\=
update superlink
http://forums.cacti.net/viewtopic.php?f=14&t=48245
Finally solved. mysql> drop table superlinks_auth; mysql> drop table superlinks_pages; and recreate the table manually to work CREATE TABLE superlinks_pages( id int(11) NOT NULL auto_increment, sortorder int(11) NOT NULL default 0, disabled char(2) NOT NULL default '', contentfile text NOT NULL, title text NOT NULL, style varchar(10) NOT NULL DEFAULT 'TAB', extendedstyle varchar(50) NOT NULL DEFAULT '', imagecache varchar(60) NOT NULL DEFAULT '', PRIMARY KEY (id) ) ENGINE=MyISAM; CREATE TABLE superlinks_auth ( userid mediumint(9) NOT NULL default '0', pageid int(11) NOT NULL default '0' ) ENGINE=MyISAM;
uninstall and reinstall
http://forums.cacti.net/viewtopic.php?f=14&t=45286
Just in case someone comes across this. In order to uninstall it and you cannot, then use this URL: http://<cacti-server>/cacti/plugins.php?mode=uninstall&id=superlinks
graph emtpty/ blanck after superlink install ⇒ comment jquery in plugin setup file
cf http://licanli2082.blogspot.fr/2014/12/cacti-088c-reportit-cause-graph-tree.html
[root@monit superlinks]# cp setup.php setup.php.orig [root@monit superlinks]# vim setup.php function superlinks_page_head() { global $config; // print "<script type='text/javascript' src='".$config['url_path'] ."/plugins/superlinks/jquery-latest.min.js'></script>";
cf http://forums.cacti.net/viewtopic.php?f=14&t=30823&start=15
workaround:
[root@monit superlinks]# diff superlinks.php superlinks.php.orig 53c53 < print '<iframe id="slcontent" src="' . $page['contentfile'] . '"width="100%" height="900px" frameborder="0"></iframe>'; --- > print '<iframe id="slcontent" src="' . $page['contentfile'] . '" frameborder="0"></iframe>';
[root@monit plugins]# wget http://network-weathermap.com/files/php-weathermap-0.97c.zip [root@monit plugins]# unzip php-weathermap-0.97c.zip [root@monit plugins]# cd weathermap/ [root@monit weathermap]# chown apache output/
recopies depuis smtpO vers smtpF
[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/s 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
sur la destination
[root@smtpF ~]# mkdir /var/local/snmp
puis apres 5-10 mn , le cron a joué son role et les stats pour cacti sont là :
[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
ajouter les extend a snmpd.conf
## #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