This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
docpublic:reseaux:services:monitcacti [2015/01/10 23:52] procacci@tem-tsp.eu created |
docpublic:reseaux:services:monitcacti [2019/03/11 21:53] (current) procacci@tem-tsp.eu [postfix template for cacti] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== supervision cacti ====== | ||
| + | |||
| + | |||
| + | ===== references ===== | ||
| + | |||
| + | ==== debug ==== | ||
| + | |||
| + | * https:// | ||
| + | * https:// | ||
| + | ===== base systeme ===== | ||
| + | |||
| + | < | ||
| + | # cat / | ||
| + | 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 | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== installation ===== | ||
| + | |||
| + | < | ||
| + | # 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 | ||
| + | |||
| + | Taille totale des téléchargements : 59 M | ||
| + | Taille d' | ||
| + | </ | ||
| + | |||
| + | ===== serveur apache httpd ===== | ||
| + | |||
| + | 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 '/ | ||
| + | |||
| + | |||
| + | root@monitor ~]# systemctl list-units | ||
| + | httpd.service loaded active running | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== firewalld ===== | ||
| + | |||
| + | ref | ||
| + | |||
| + | * http:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | |||
| + | < | ||
| + | [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 | ||
| + | </ | ||
| + | |||
| + | ===== DB mariaDB ===== | ||
| + | |||
| + | ==== start ==== | ||
| + | < | ||
| + | [root@monitor ~]# systemctl enable mariadb.service | ||
| + | ln -s '/ | ||
| + | [root@monitor ~]# systemctl list-units | ||
| + | mariadb.service loaded inactive dead MariaDB database server | ||
| + | [root@monitor ~]# systemctl start mariadb.service | ||
| + | [root@monitor ~]# systemctl list-units | ||
| + | mariadb.service loaded active running | ||
| + | </ | ||
| + | |||
| + | ==== configure and secure ==== | ||
| + | |||
| + | < | ||
| + | [root@monitor ~]# / | ||
| + | |||
| + | |||
| + | 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: | ||
| + | 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! | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | ==== create DB ==== | ||
| + | |||
| + | < | ||
| + | [root@monit ~]# mysqladmin -u root -p create cacti_monitor | ||
| + | Enter password: | ||
| + | |||
| + | MariaDB [(none)]> | ||
| + | Query OK, 0 rows affected (0.04 sec) | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== import initial DB structure ==== | ||
| + | |||
| + | if not recovering an aold instance, create new one | ||
| + | |||
| + | < | ||
| + | # mysql -u usercacti -p -h localhost cacti_bd < / | ||
| + | Enter password: | ||
| + | </ | ||
| + | ===== installation cacti 8.8c ===== | ||
| + | |||
| + | < | ||
| + | [root@monitor ~]# wget http:// | ||
| + | |||
| + | [root@monitor html]# tar xvfz / | ||
| + | [root@monitor html]# ln -s cacti-0.8.8c/ | ||
| + | [root@monitor html]# ls -l | ||
| + | total 4 | ||
| + | lrwxrwxrwx. | ||
| + | drwxr-xr-x. 13 1000 users 4096 23 nov. 21:18 cacti-0.8.8c | ||
| + | |||
| + | [root@monitor html]# adduser cacti | ||
| + | [root@monitor html]# cd / | ||
| + | [root@monitor cacti]# chown -R cacti.apache rra log | ||
| + | [root@monitor cacti]# chmod 775 rra log | ||
| + | |||
| + | [root@monitor cacti]# vim ./ | ||
| + | </ | ||
| + | |||
| + | ==== cacti cron job ==== | ||
| + | |||
| + | beware to set full path name to **/ | ||
| + | |||
| + | < | ||
| + | # cat / | ||
| + | */5 * * * * cacti / | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== upgrade-recover data from old cacti ===== | ||
| + | |||
| + | * http:// | ||
| + | |||
| + | < | ||
| + | [root@monitor cacti]# | ||
| + | Enter password: | ||
| + | </ | ||
| + | |||
| + | ==== copy rrd files ==== | ||
| + | |||
| + | 6 . Copy the *.rrd files from the old Cacti directory. | ||
| + | |||
| + | < | ||
| + | [root@monitor cacti]# cp -v -u / | ||
| + | « / | ||
| + | « / | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== copy-recover ressources ==== | ||
| + | |||
| + | < | ||
| + | [root@monit cacti]# cp -v -u -R / | ||
| + | « / | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | ==== run web update URL ==== | ||
| + | |||
| + | go run install-update to your server http:// | ||
| + | |||
| + | < | ||
| + | Cacti Installation Guide | ||
| + | |||
| + | Upgrade results: | ||
| + | |||
| + | 0.8.7g -> 0.8.7h | ||
| + | |||
| + | [Success] ALTER TABLE host_snmp_cache ADD COLUMN present tinyint NOT NULL DEFAULT ' | ||
| + | |||
| + | [Success] ALTER TABLE host_snmp_cache ADD INDEX present (present) | ||
| + | |||
| + | [Success] ALTER TABLE poller_item ADD COLUMN present tinyint NOT NULL DEFAULT ' | ||
| + | |||
| + | [Success] ALTER TABLE poller_item ADD INDEX present (present) | ||
| + | |||
| + | [Success] ALTER TABLE poller_reindex ADD COLUMN present tinyint NOT NULL DEFAULT ' | ||
| + | |||
| + | [Success] ALTER TABLE poller_reindex ADD INDEX present (present) | ||
| + | |||
| + | [Success] ALTER TABLE host ADD COLUMN device_threads tinyint(2) unsigned NOT NULL DEFAULT ' | ||
| + | |||
| + | [Success] ALTER TABLE `data_template_rrd` ADD UNIQUE INDEX `duplicate_dsname_contraint` (`local_data_id`, | ||
| + | |||
| + | 0.8.7i -> 0.8.8 | ||
| + | |||
| + | [Success] ALTER TABLE `poller_item` MODIFY COLUMN `host_id` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT ' | ||
| + | |||
| + | [Success] ALTER TABLE `poller_output` DROP PRIMARY KEY | ||
| + | |||
| + | [Success] ALTER TABLE `poller_output` ADD PRIMARY KEY (`local_data_id`, | ||
| + | |||
| + | [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=' | ||
| + | |||
| + | [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=' | ||
| + | |||
| + | [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=' | ||
| + | |||
| + | [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=' | ||
| + | |||
| + | [Success] REPLACE INTO `plugin_realms` VALUES (1, ' | ||
| + | |||
| + | [Success] REPLACE INTO `plugin_hooks` VALUES (1, ' | ||
| + | |||
| + | [Success] REPLACE INTO `plugin_hooks` VALUES (2, ' | ||
| + | |||
| + | [Success] REPLACE INTO user_auth_realm VALUES (101,1) | ||
| + | |||
| + | [Success] ALTER TABLE `data_template_data` ADD KEY `data_input_id` (`data_input_id`) | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | ===== optimize run with spine ===== | ||
| + | |||
| + | < | ||
| + | [root@monitor ~]# cat / | ||
| + | */5 * * * * | ||
| + | |||
| + | [root@monitor ~]# chown apache.cacti / | ||
| + | |||
| + | [root@monitor ~]# wget http:// | ||
| + | |||
| + | [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]# | ||
| + | [root@monitor cacti-spine-0.8.8c]# | ||
| + | [root@monitor cacti-spine-0.8.8c]# | ||
| + | make[1] : on entre dans le répertoire « / | ||
| + | / | ||
| + | /bin/sh ./ | ||
| + | libtool: install: / | ||
| + | / | ||
| + | / | ||
| + | make[1] : on quitte le répertoire « / | ||
| + | </ | ||
| + | |||
| + | ==== debug spine poller ==== | ||
| + | |||
| + | |||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | < | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | 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 ~]$ / | ||
| + | Could not open cache / | ||
| + | [cacti@mon ~]$ exit | ||
| + | déconnexion | ||
| + | [root@mon include]# ls -l / | ||
| + | -rw-r--r-- 1 root root 2045 18 avril 21:18 / | ||
| + | [root@monit include]# chown apache: | ||
| + | </ | ||
| + | |||
| + | |||
| ===== cacti 8.8c ===== | ===== cacti 8.8c ===== | ||
| Line 59: | Line 417: | ||
| // print "< | // print "< | ||
| + | </ | ||
| + | |||
| + | ==== superlink iframe short ==== | ||
| + | |||
| + | cf http:// | ||
| + | |||
| + | workaround: | ||
| + | |||
| + | < | ||
| + | [root@monit superlinks]# | ||
| + | 53c53 | ||
| + | < print '< | ||
| + | --- | ||
| + | > print '< | ||
| + | </ | ||
| + | |||
| + | ===== plugin php-weathermap ===== | ||
| + | |||
| + | * http:// | ||
| + | * http:// | ||
| + | |||
| + | |||
| + | < | ||
| + | [root@monit plugins]# wget http:// | ||
| + | [root@monit plugins]# unzip php-weathermap-0.97c.zip | ||
| + | [root@monit plugins]# cd weathermap/ | ||
| + | [root@monit weathermap]# | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | ===== postfix template for cacti ===== | ||
| + | |||
| + | |||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | |||
| + | recopies depuis smtpO vers smtpF | ||
| + | |||
| + | < | ||
| + | [root@smtpO ~]# scp / | ||
| + | |||
| + | |||
| + | [root@smtpO ~]# scp -r / | ||
| + | spamd.pm | ||
| + | postfix-stats-local | ||
| + | |||
| + | |||
| + | [root@smtpO ~]# scp / | ||
| + | local-snmp | ||
| + | |||
| + | [root@smtpO ~]# scp -r / | ||
| + | postfix.pm | ||
| + | |||
| + | [root@smtpO ~]# scp / | ||
| + | uloganalyser | ||
| + | |||
| + | </ | ||
| + | |||
| + | sur la destination | ||
| + | |||
| + | < | ||
| + | [root@smtpF ~]# mkdir / | ||
| + | </ | ||
| + | |||
| + | puis apres 5-10 mn , le cron a joué son role et les stats pour cacti sont là : | ||
| + | |||
| + | < | ||
| + | [root@smtpF ~]# cat / | ||
| + | lastrun=1552322401 | ||
| + | lastline=16519 | ||
| + | lastposition=2213301 | ||
| + | repeatline=Mar 11 17:39:54 smtp4 postfix/ | ||
| + | lastinode=344479 | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | postfix: | ||
| + | </ | ||
| + | |||
| + | |||
| + | ajouter les extend a snmpd.conf | ||
| + | |||
| + | < | ||
| + | ## # | ||
| + | ## # # | ||
| + | # | ||
| + | extend postfixlocal | ||
| + | extend postfixlmtp | ||
| + | extend postfixpickup / | ||
| + | extend postfixqueue / | ||
| + | extend postfixsmtp | ||
| + | extend postfixsmtpstatus | ||
| + | extend postfixsmtptls | ||
| + | extend postfixsmtpwarn | ||
| + | extend postfixsmtpd | ||
| + | extend postfixsmtpdnq | ||
| + | extend postfixsmtpdnqrec | ||
| + | extend postfixsmtpdnqrel | ||
| + | extend postfixsmtpdnqsnd | ||
| + | extend postfixsmtpdnqclnt | ||
| + | extend postfixsmtpdqd | ||
| + | extend postfixsmtpdtls | ||
| + | extend postfixsmtpdwarn / | ||
| + | extend postfixcleanup | ||
| + | extend postfixpolicy / | ||
| + | extend postfixip / | ||
| + | extend clamav / | ||
| + | extend dkim / | ||
| + | extend spamd / | ||
| </ | </ | ||