Cacti : Install2022/12/14 |
Install Cacti to monitor system status.
|
|
[1] | |
[2] |
Configure SSL/TLS setting for Apache2, refer to here. (not required but recommended)
|
[3] | |
[4] | |
[5] | Install Cacti, SNMP. |
root@dlp:~#
apt -y install cacti snmp snmpd snmp-mibs-downloader libnet-snmp-perl snmptrapd php-mysql php-snmp rrdtool # select apache2 on here +- - - - - - - - - - - - + Configuring cacti +- - - - - - - - - - - - - -+ | Please select the web server for which Cacti should be automatically | | configured. | | | | Select "None" if you would like to configure the web server manually. | | | | Web server: | | | | apache2 | | lighttpd | | None | | | | | | <Ok> | | | +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # select No on here +- - - - - - - - - - - - -+ Configuring cacti +- - - - - - - - - - - - - - -+ | | | The cacti package must have a database installed and configured before | | it can be used. This can be optionally handled with dbconfig-common. | | | | If you are an advanced database administrator and know that you want to | | perform this configuration manually, or if your database has already | | been installed and configured, you should refuse this option. Details | | on what needs to be done should most likely be provided in | | /usr/share/doc/cacti. | | | | Otherwise, you should probably choose this option. | | | | Configure database for cacti with dbconfig-common? | | | | <Yes> <No> | | | +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+ |
[6] | Configure SNMP (Simple Network Management Protocol). |
root@dlp:~#
vi /etc/snmp/snmp.conf # line 4 : comment out # mibs :
root@dlp:~#
vi /etc/snmp/snmpd.conf # line 18, 19 : change to any location name and email address sysLocation "Server World" sysContact "root@dlp.srv.world" # line 71, 72 : comment out # line 73 : add any community name #rocommunity public default -V systemonly #rocommunity6 public default -V systemonly rocommunity Serverworld localhost
root@dlp:~#
systemctl restart snmpd # verify status # replace [Serverworld] to the community name you set root@dlp:~# snmpwalk -v 2c -c Serverworld localhost system SNMPv2-MIB::sysDescr.0 = STRING: Linux dlp.srv.world 5.15.0-47-generic #51-Ubuntu SMP Thu Aug 11 07:51:15 UTC 2022 x86_64 SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1121) 0:00:11.21 SNMPv2-MIB::sysContact.0 = STRING: "root@dlp.srv.world" SNMPv2-MIB::sysName.0 = STRING: dlp.srv.world SNMPv2-MIB::sysLocation.0 = STRING: "Server World" SNMPv2-MIB::sysServices.0 = INTEGER: 72 ..... ..... SNMPv2-MIB::sysORUpTime.8 = Timeticks: (0) 0:00:00.00 SNMPv2-MIB::sysORUpTime.9 = Timeticks: (0) 0:00:00.00 SNMPv2-MIB::sysORUpTime.10 = Timeticks: (0) 0:00:00.00 |
[7] | Create a Database for Cacti and import tables. |
root@dlp:~# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 60 Server version: 10.6.11-MariaDB-0ubuntu0.22.04.1 Ubuntu 22.04 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database cacti character set utf8mb4 collate utf8mb4_unicode_ci; Query OK, 1 row affected (0.00 sec) # replace the [password] to the any password you like MariaDB [(none)]> grant all privileges on cacti.* to cacti@'localhost' identified by 'password'; Query OK, 0 rows affected (0.00 sec) # add [select] right to [time_zone_name] table in [mysql] DB for Cacti requirements MariaDB [(none)]> grant select on mysql.time_zone_name to cacti@'localhost'; MariaDB [(none)]> exit Bye # set timezone info root@dlp:~# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql
mysql -u cacti -p cacti < /usr/share/doc/cacti/cacti.sql Enter password: # cacti user's password
|
[8] | Configure Cacti. |
root@dlp:~#
vi /usr/share/cacti/site/include/config.php // line 45 : change to your DB info $database_type = 'mysql'; $database_default = 'cacti'; $database_hostname = 'localhost'; $database_username = 'cacti'; $database_password = 'password'; $database_port = '3306'; ..... .....
root@dlp:~#
vi /etc/mysql/mariadb.conf.d/50-server.cnf # add into the [mysqld] section (Cacti requirements) [mysqld] character-set-server=utf8mb4 character_set_client=utf8mb4 collation-server=utf8mb4_unicode_ci max_heap_table_size=128M tmp_table_size=128M join_buffer_size=256M innodb_buffer_pool_size=2048M innodb_flush_log_at_timeout=3 innodb_read_io_threads=32 innodb_write_io_threads=16 innodb_buffer_pool_instances=17 innodb_io_capacity=5000 innodb_io_capacity_max=10000 innodb_doublewrite=off # line 103, 104 : comment out #character-set-server = utf8mb4 #collation-server = utf8mb4_general_ci
root@dlp:~#
vi /etc/php/8.1/apache2/php.ini ;; line 409 : change to Cacti recommended value max_execution_time = 60
;; line 430 : change to Cacti recommended value memory_limit = 512M
;; line 968 : uncomment and set your timezone date.timezone = Asia/Tokyo
root@dlp:~#
vi /etc/apache2/conf-available/cacti.conf # line 7 : change to access permission if you need # Require all granted
Require host localhost
Require ip 10.0.0.0/24 chown -R www-data /usr/share/cacti/site/resource/snmp_queries \ /usr/share/cacti/site/resource/script_server \ /usr/share/cacti/site/resource/script_queries \ /usr/share/cacti/site/scripts \ /var/log/cacti root@dlp:~# systemctl restart apache2 mariadb |
Sponsored Link |
|