Debian 11.3安装配置Cacti1.2.16监控系统

一、安装apache、rrdtool、mariadb、snmp、php软件

root@debian:~# apt-get install -y apache2 rrdtool mariadb-server snmp php php-mysql

root@debian:~# echo $?
0

root@debian:/etc/apache2/sites-enabled# dpkg -l | grep -i php
ii  libapache2-mod-php7.4                    7.4.28-1+deb11u1               amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php                                      2:7.4+76                       all          server-side, HTML-embedded scripting language (default)
ii  php-common                               2:76                           all          Common files for PHP packages
ii  php-fpm                                  2:7.4+76                       all          server-side, HTML-embedded scripting language (FPM-CGI binary) (default)
ii  php-mysql                                2:7.4+76                       all          MySQL module for PHP [default]
ii  php7.4                                   7.4.28-1+deb11u1               all          server-side, HTML-embedded scripting language (metapackage)
ii  php7.4-cli                               7.4.28-1+deb11u1               amd64        command-line interpreter for the PHP scripting language
ii  php7.4-common                            7.4.28-1+deb11u1               amd64        documentation, examples and common module for PHP
ii  php7.4-fpm                               7.4.28-1+deb11u1               amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php7.4-gd                                7.4.28-1+deb11u1               amd64        GD module for PHP
ii  php7.4-gmp                               7.4.28-1+deb11u1               amd64        GMP module for PHP
ii  php7.4-json                              7.4.28-1+deb11u1               amd64        JSON module for PHP
ii  php7.4-ldap                              7.4.28-1+deb11u1               amd64        LDAP module for PHP
ii  php7.4-mbstring                          7.4.28-1+deb11u1               amd64        MBSTRING module for PHP
ii  php7.4-mysql                             7.4.28-1+deb11u1               amd64        MySQL module for PHP
ii  php7.4-opcache                           7.4.28-1+deb11u1               amd64        Zend OpCache module for PHP
ii  php7.4-readline                          7.4.28-1+deb11u1               amd64        readline module for PHP
ii  php7.4-snmp                              7.4.28-1+deb11u1               amd64        SNMP module for PHP
ii  php7.4-xml                               7.4.28-1+deb11u1               amd64        DOM, SimpleXML, XML, and XSL module for PHP
ii  php7.4-zip                               7.4.28-1+deb11u1               amd64        Zip module for PHP

查看安装结果,访问网址显示apache works!

查看php安装结果

root@debian:~# php -v
PHP 7.4.28 (cli) (built: Feb 17 2022 16:17:19) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.28, Copyright (c), by Zend Technologies

查看数据库状态为active状态

root@debian:~# service mysqld status
● mariadb.service - MariaDB 10.5.15 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-06-18 13:07:26 CST; 18min ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 11624 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 8 (limit: 19164)
     Memory: 79.5M
        CPU: 1.248s
     CGroup: /system.slice/mariadb.service
             └─11624 /usr/sbin/mariadbd

6月 18 13:07:26 debian mariadbd[11624]: 2022-06-18 13:07:26 0 [Note] InnoDB: 10.5.15 started; log sequence number 45106; transaction id 20
6月 18 13:07:26 debian mariadbd[11624]: 2022-06-18 13:07:26 0 [Note] Plugin 'FEEDBACK' is disabled.
6月 18 13:07:26 debian mariadbd[11624]: 2022-06-18 13:07:26 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
6月 18 13:07:26 debian mariadbd[11624]: 2022-06-18 13:07:26 0 [Note] InnoDB: Buffer pool(s) load completed at 220618 13:07:26
6月 18 13:07:26 debian mariadbd[11624]: 2022-06-18 13:07:26 0 [Note] Server socket created on IP: '127.0.0.1'.
6月 18 13:07:26 debian mariadbd[11624]: 2022-06-18 13:07:26 0 [Note] Reading of all Master_info entries succeeded
6月 18 13:07:26 debian mariadbd[11624]: 2022-06-18 13:07:26 0 [Note] Added new Master_info '' to hash table
6月 18 13:07:26 debian mariadbd[11624]: 2022-06-18 13:07:26 0 [Note] /usr/sbin/mariadbd: ready for connections.
6月 18 13:07:26 debian mariadbd[11624]: Version: '10.5.15-MariaDB-0+deb11u1'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Debian 11
6月 18 13:07:26 debian systemd[1]: Started MariaDB 10.5.15 database server.

二、下载Cacti1.2.16及其他组件包

由于我之前已经下载过这些软件包,这里我把它们放在百度网盘中共享出来,大家可以打包下载,不用一一去官网找版本下载,当然如果你想安装更高的版本的话除外。

https://pan.baidu.com/s/17pwpD8QZcEzbfzynKrWBDQ?pwd=sd9f
提取码:sd9f(永久有效)
root@debian:~# dpkg -l | grep -i lrzsz //检查系统是否安装lrzsz,没有的话按下面方法安装

 安装Lrzsz软件包,rz从本地上传至服务器,debian下安装lrzsz方法参见:http://t.csdn.cn/5bw4u 

root@debian:~/softlist# rz
rz waiting to receive.
Starting zmodem transfer.  Press Ctrl+C to cancel.
Transferring cacti-1.2.16.tar.gz...
  100%   28512 KB     445 KB/sec    00:01:04       0 Errors  
Transferring cacti-spine-1.2.16.tar.gz...
  100%     105 KB     105 KB/sec    00:00:01       0 Errors  
Transferring fzhtk.ttf...
  100%    9727 KB     540 KB/sec    00:00:18       0 Errors  
Transferring plugin_monitor-2.3.6.tar.gz...
  100%    3762 KB     940 KB/sec    00:00:04       0 Errors  
Transferring plugin_thold-1.3.2.tar.gz...
  100%     816 KB     816 KB/sec    00:00:01       0 Errors  
Transferring rrdtool-1.7.2.tar.gz...
  100%    2816 KB    1408 KB/sec    00:00:02       0 Errors 

三、开始部署CACTI

1.解压cacti并移动到网站根目录

root@debian:~/softlist# tar zxvf cacti-1.2.16.tar.gz 
root@debian:~/softlist# mv cacti-1.2.16 /var/www/html/cacti
root@debian:~/softlist# cd /var/www/html/cacti/

2.配置mariadb数据库,为cacti创建一个数据库

root@debian:~# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 48
Server version: 10.5.15-MariaDB-0+deb11u1 Debian 11

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 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Query OK, 1 row affected (0.023 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON cacti.* TO 'cactiuser'@'localhost' IDENTIFIED BY 'your cactiuser password';
Query OK, 0 rows affected (0.002 sec)

MariaDB [(none)]> ALTER DATABASE cacti CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> exit;
Bye

3.到如cacti数据库文件

root@debian:~# mysql -u root -p cacti < /var/www/html/cacti/cacti.sql
Enter password: 

4.修改cacti配置文件

root@debian:~# cd /var/www/html/cacti/include
root@debian:~# vi config.php
$database_type     = 'mysql';
$database_default  = 'cacti';
$database_hostname = 'localhost';
$database_username = 'cactiuser';
$database_password = 'your cactiuser password';
$database_port     = '3306';
$database_retries  = 5;
$database_ssl      = false;
$database_ssl_key  = '';

5.修改apache2配置文件设置网站DocumentRoot路径,这里默认无需修改

root@debian:~# vi /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

6.重启apache2、mysqld

root@debian:~#  service apache2 restart
root@debian:~#  service mysqld restart

7.访问网址显示错误,由于cacti.log文件没有写入权限导致
System log file is not available for writing, please enable write access Log: /var/www/html/cacti/log/cacti.log

root@debian:~# touch /var/www/html/cacti/log/cacti.log
root@debian:~# chmod -R 777 /var/www/html/cacti/log
root@debian:~# chmod -R 777 /var/www/html/cacti/log/cacti.log

8.再次访问

根据提示调整PHP,MYSQL的相关参数以最优化。

[PHP - Recommendations (web)]
date.timezone:  错误	A valid timezone that matches MySQL and the system
-->
root@debian:~# cp /etc/php/7.4/apache2/php.ini /etc/php/7.4/apache2/php.ini.bak
root@debian:~# vi /etc/php/7.4/apache2/php.ini
date.timezone = Asia/Shanghai //解除该注释并设置参数为Asia/Shanghai
memory_limit  = 500M //A minimum of 400M memory limit
max_execution_time = 60 //至少 60 m 执行时间
root@debian:~# systemctl restart php7.4-fpm.service
root@debian:~# systemctl restart apache2.service

[PHP - Recommendations (cli)]
date.timezone:  错误	A valid timezone that matches MySQL and the system
-->
root@debian:~# cp /etc/php/7.4/cli/php.ini /etc/php/7.4/cli/php.ini.bak
root@debian:~# vi /etc/php/7.4/cli/php.ini
date.timezone = Asia/Shanghai //解除该注释并设置参数为Asia/Shanghai
root@debian:~# systemctl restart php7.4-fpm.service
root@debian:~# systemctl restart apache2.service

[MySQL - 时区支持]
ERROR: 您的Cacti 数据库登录帐户无权访问MySQL TimeZone 数据库. 请提供Cacti 数据库帐户对 "mysql" 数据库中 "time_zone_name" 表的 "select" 访问权,并在继续之前填充MySQL 的TimeZone 信息.
-->
root@debian:~# mysql -u root -p
MariaDB [(none)]> GRANT SELECT ON mysql.time_zone_name TO cactiuser@localhost IDENTIFIED BY 'your cactiuser password';
Query OK, 0 rows affected (0.006 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)

root@debian:~# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql -p

root@debian:~# systemctl restart php7.4-fpm.service
root@debian:~# systemctl restart apache2.service

[MySQL - 设置]
root@debian:~# vi /etc/mysql/mariadb.conf.d/50-server.cnf //MariaDB service配置文件,和my.cnf作用一样
character-set-server                = utf8mb4
collation-server                    = utf8mb4_unicode_ci
max_allowed_packet                  = 18M
max_heap_table_size                 = 300M
tmp_table_size                      = 256M
join_buffer_size                    = 600M
innodb_buffer_pool_size             = 4096M
innodb_doublewrite                  = ON
innodb_buffer_pool_instances        = 18
innodb_io_capacity                  = 5000
innodb_io_capacity_max              = 10000
innodb_flush_log_at_timeout         = 3
innodb_read_io_threads              = 32
innodb_write_io_threads             = 16
innodb_file_format                  = Barracuda
innodb_large_prefix                 = 1
log-error                           = /var/log/mysql/mysql-error.log
log-queries-not-using-indexes       = 1
slow-query-log                      = 1
slow-query-log-file                 = /var/log/mysql/mysql-slow.log

//复制粘贴到50-server.cnf配置文件中,注意参数不要有重复的,一般character-set-server和collation-server两个参数原本就有且生效中。

root@debian:~# systemctl restart mysql.service

我需要1分钟的监控频率,因此我选1分钟,如果需要5分钟的选5分钟即可。

9. 验证cacti snmp是否正常,如果正常,会返回以下内容

root@debian:~# snmpwalk -v 2c -c public localhost
iso.3.6.1.2.1.1.1.0 = STRING: "Linux debian 5.10.0-15-amd64 #1 SMP Debian 5.10.120-1 (2022-06-09) x86_64"
iso.3.6.1.2.1.1.2.0 = OID: iso.3.6.1.4.1.8072.3.2.10
iso.3.6.1.2.1.1.3.0 = Timeticks: (4858198) 13:29:41.98
iso.3.6.1.2.1.1.4.0 = STRING: "Me <me@example.org>"
iso.3.6.1.2.1.1.5.0 = STRING: "debian"
iso.3.6.1.2.1.1.6.0 = STRING: "Sitting on the Dock of the Bay"
iso.3.6.1.2.1.1.7.0 = INTEGER: 72
iso.3.6.1.2.1.1.8.0 = Timeticks: (2) 0:00:00.02
iso.3.6.1.2.1.1.9.1.2.1 = OID: iso.3.6.1.6.3.10.3.1.1
iso.3.6.1.2.1.1.9.1.2.2 = OID: iso.3.6.1.6.3.11.3.1.1
iso.3.6.1.2.1.1.9.1.2.3 = OID: iso.3.6.1.6.3.15.2.1.1
iso.3.6.1.2.1.1.9.1.2.4 = OID: iso.3.6.1.6.3.1
iso.3.6.1.2.1.1.9.1.2.5 = OID: iso.3.6.1.6.3.16.2.2.1
iso.3.6.1.2.1.1.9.1.2.6 = OID: iso.3.6.1.2.1.49
iso.3.6.1.2.1.1.9.1.2.7 = OID: iso.3.6.1.2.1.50
iso.3.6.1.2.1.1.9.1.2.8 = OID: iso.3.6.1.2.1.4
iso.3.6.1.2.1.1.9.1.2.9 = OID: iso.3.6.1.6.3.13.3.1.3
iso.3.6.1.2.1.1.9.1.2.10 = OID: iso.3.6.1.2.1.92
iso.3.6.1.2.1.1.9.1.3.1 = STRING: "The SNMP Management Architecture MIB."
iso.3.6.1.2.1.1.9.1.3.2 = STRING: "The MIB for Message Processing and Dispatching."
iso.3.6.1.2.1.1.9.1.3.3 = STRING: "The management information definitions for the SNMP User-based Security Model."
iso.3.6.1.2.1.1.9.1.3.4 = STRING: "The MIB module for SNMPv2 entities"
iso.3.6.1.2.1.1.9.1.3.5 = STRING: "View-based Access Control Model for SNMP."
iso.3.6.1.2.1.1.9.1.3.6 = STRING: "The MIB module for managing TCP implementations"
iso.3.6.1.2.1.1.9.1.3.7 = STRING: "The MIB module for managing UDP implementations"
iso.3.6.1.2.1.1.9.1.3.8 = STRING: "The MIB module for managing IP and ICMP implementations"
iso.3.6.1.2.1.1.9.1.3.9 = STRING: "The MIB modules for managing SNMP Notification, plus filtering."
iso.3.6.1.2.1.1.9.1.3.10 = STRING: "The MIB module for logging SNMP Notifications."
iso.3.6.1.2.1.1.9.1.4.1 = Timeticks: (1) 0:00:00.01
iso.3.6.1.2.1.1.9.1.4.2 = Timeticks: (1) 0:00:00.01
iso.3.6.1.2.1.1.9.1.4.3 = Timeticks: (1) 0:00:00.01
iso.3.6.1.2.1.1.9.1.4.4 = Timeticks: (1) 0:00:00.01
iso.3.6.1.2.1.1.9.1.4.5 = Timeticks: (1) 0:00:00.01
iso.3.6.1.2.1.1.9.1.4.6 = Timeticks: (1) 0:00:00.01
iso.3.6.1.2.1.1.9.1.4.7 = Timeticks: (1) 0:00:00.01
iso.3.6.1.2.1.1.9.1.4.8 = Timeticks: (1) 0:00:00.01
iso.3.6.1.2.1.1.9.1.4.9 = Timeticks: (2) 0:00:00.02
iso.3.6.1.2.1.1.9.1.4.10 = Timeticks: (2) 0:00:00.02
iso.3.6.1.2.1.25.1.1.0 = Timeticks: (4859538) 13:29:55.38
iso.3.6.1.2.1.25.1.2.0 = Hex-STRING: 07 E6 06 13 0C 33 31 00 2B 08 00 
iso.3.6.1.2.1.25.1.3.0 = INTEGER: 393216
iso.3.6.1.2.1.25.1.4.0 = STRING: "BOOT_IMAGE=/boot/vmlinuz-5.10.0-15-amd64 root=UUID=a091c396-257e-40d7-8d0e-eb0aeab8b4a5 ro quiet
"
iso.3.6.1.2.1.25.1.5.0 = Gauge32: 1
iso.3.6.1.2.1.25.1.6.0 = Gauge32: 107
iso.3.6.1.2.1.25.1.7.0 = INTEGER: 0
iso.3.6.1.2.1.25.1.7.0 = No more variables left in this MIB View (It is past the end of the MIB tree)

10.验证默认的cmd poller工作是否正常,返回如下的话表示正常

root@debian:~# /usr/bin/php /var/www/html/cacti/poller.php 
OK u:0.01 s:0.01 r:1.03
OK u:0.01 s:0.01 r:1.03
OK u:0.01 s:0.02 r:1.06
OK u:0.01 s:0.02 r:1.07
OK u:0.01 s:0.02 r:1.09
OK u:0.01 s:0.02 r:1.09
OK u:0.01 s:0.03 r:1.12
OK u:0.01 s:0.03 r:1.12
2022-06-19 12:56:32 - SYSTEM STATS: Time:1.3908 Method:cmd.php Processes:1 Threads:1 Hosts:1 HostsPerProcess:1 DataSources:5 RRDsProcessed:5
OK u:0.01 s:0.03 r:1.15
OK u:0.01 s:0.03 r:1.15

四、Cacti安装后的配置

1.安装cacti spine轮询器

 由于cmd poller效率比较低,因此我们需要采用spine poller替代它,

注意:选择安装的spine poller版本一定要和cacti版本一致,我这里安装1.2.16版本

root@debian:~/softlist# tar zxf cacti-spine-1.2.16.tar.gz
root@debian:~/softlist# cd cacti-spine-1.2.16
root@debian:~/softlist/cacti-spine-1.2.16# ./bootstrap 
INFO: Starting Spine build process
INFO: Removing cache directories
INFO: Running auto-tools to verify buildability
./bootstrap: 50: aclocal: not found
./bootstrap: 51: libtoolize: not found
./bootstrap: 52: autoheader: not found
./bootstrap: 53: automake: not found
./bootstrap: 54: autoreconf: not found
ERROR: 'autoreconf' exited with errors
./bootstrap: 55: exit: Illegal number: -1

//根据错误提示我们知道没有安装automake工具集,automake同时需要autoconf和libtool等辅助库支持
root@debian:~/softlist/cacti-spine-1.2.16# apt-get install -y  dos2unix autoconf automake binutils libtool cpp help2man
root@debian:~/softlist/cacti-spine-1.2.16# echo $?
0

//再次执行./bootstrap
root@debian:~/softlist/cacti-spine-1.2.16# ./bootstrap 
  These instructions assume the default install location for spine
  of /usr/local/spine.  If you choose to use another prefix, make
  sure you update the commands as required for that new path.

  To compile and install Spine using MySQL versions 5.5 or higher
  please do the following:

  ./configure
  make
  make install
  chown root:root /usr/local/spine/bin/spine
  chmod +s /usr/local/spine/bin/spine

  To compile and install Spine using MySQL versions previous to 5.5
  please do the following:

  ./configure --with-reentrant
  make
  make install
  chown root:root /usr/local/spine/bin/spine
  chmod +s /usr/local/spine/bin/spine

root@debian:~/softlist/cacti-spine-1.2.16# echo $?
0

//执行编译过程 ./configure
root@debian:~/softlist/cacti-spine-1.2.16# ./configure

checking whether time.h and sys/time.h may both be included... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking return type of signal handlers... void
checking for malloc... no
checking for calloc... no
checking for gettimeofday... no
checking for strerror... no
checking for strtoll... no
checking priv.h usability... no
checking priv.h presence... no
checking for priv.h... no
checking whether we are using Solaris privileges... no
checking sys/capability.h usability... no
checking sys/capability.h presence... no
checking for sys/capability.h... no
checking whether we are using Linux Capabilities... no
configure: error: Cannot find MySQL headers.  Use --with-mysql= to specify non-default path.
root@debian:~/softlist/cacti-spine-1.2.16# echo $?
1

//解决错误(configure: error: Cannot find MySQL headers.  Use --with-mysql= to specify non-default path.)可以看到是关于MySQL路径的,我们采用错误建议方法看看行不行不行的话,就需要安装glibc了,debian镜像源中是没有该组件库的,需要添加镜像源安装

root@debian:~/softlist/cacti-spine-1.2.16# apt-get upgrade glibc //验证执行检查镜像源是否有该组件包,结果没有该库文件
root@debian:~/softlist/cacti-spine-1.2.16# vi /etc/apt/sources.list
deb http://ftp.cn.debian.org/debian sid main //最底部添加该源,后面安装好glibc后再删掉
root@debian:~/softlist/cacti-spine-1.2.16# apt-get update 
获取:11 http://ftp.cn.debian.org/debian sid/main Translation-zh [1,215 B]                                                                                                                                                                  
已下载 16.5 MB,耗时 0分 12秒 (2300.7 kB/s)                                                                                                                                                                                              
正在读取软件包列表... 完成
root@debian:~/softlist/cacti-spine-1.2.16# apt-get -t sid install libc6 libc6-dev libc6-dbg libmysql++-dev
checking priv.h usability... no
checking priv.h presence... no
checking for priv.h... no
checking whether we are using Solaris privileges... no
checking sys/capability.h usability... no
checking sys/capability.h presence... no
checking for sys/capability.h... no
checking whether we are using Linux Capabilities... no
checking for mysql_init in -lmysqlclient... yes
configure: error: Cannot find SNMP headers.  Use --with-snmp= to specify non-default path.
//又报SNMP的错误,看来给装系统的人装的太缺组件了,继续解决configure: error: Cannot find SNMP headers.  Use --with-snmp= to specify non-default path.
从错误结果看spine安装缺少和snmp之间的组件libsnmp-dev 安装即可
root@debian:~/softlist/cacti-spine-1.2.16# apt-get install libsnmp-dev -y 
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config/config.h
config.status: executing depfiles commands
config.status: executing libtool commands
root@debian:~/softlist/cacti-spine-1.2.16# echo $?
0

root@debian:~/softlist/cacti-spine-1.2.16# ./configure
root@debian:~/softlist/cacti-spine-1.2.16# echo $?
0

root@debian:~/softlist/cacti-spine-1.2.16# make && make install
 /usr/bin/mkdir -p '/usr/local/spine/bin'
  /bin/bash ./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'
 /usr/bin/mkdir -p '/usr/local/spine/share/man/man1'
 /usr/bin/install -c -m 644 spine.1 '/usr/local/spine/share/man/man1'
make[1]: 离开目录“/root/softlist/cacti-spine-1.2.16”
root@debian:~/softlist/cacti-spine-1.2.16# echo $?
0
root@debian:~/softlist/cacti-spine-1.2.16# chown root:root /usr/local/spine/bin/spine
root@debian:~/softlist/cacti-spine-1.2.16# chmod +s /usr/local/spine/bin/spine

2.修改spine配置

root@debian:~# cd /usr/local/spine/etc
root@debian:/usr/local/spine/etc# ls
spine.conf.dist
root@debian:/usr/local/spine/etc# cp spine.conf.dist spine.conf
root@debian:/usr/local/spine/etc# vi spine.conf
DB_Host       localhost  //cacti地址,这里在本机
DB_Database   cacti  //cacti数据库名称
DB_User       cactiuser  //cacti数据库所使用的用户
DB_Pass       your cactiuser password //你的cacti数据库用户cactiuser密码
DB_Port       3306

3.验证spine工作是否正常,结果显示没有问题

root@debian:/usr/local/spine/etc# /usr/local/spine/bin/spine
SPINE: Using spine config file [spine.conf]
SPINE: Version 1.2.16 starting
SPINE: Time: 0.3857 s, Threads: 1, Devices: 2

4.修改web管理界面poller类型为spine

 5.设置确认spine路径

 至此关于spine的安装配置就结束了,我们来看下前台图形是否显示,正常应该没有数据才对,单个图形的实时数据应该是OK的,因为我们还没有配置cron计划任务来定期执行poller。

猜想既是如此

 五、配置Cron计划任务执行poller

root@debian:~# crontab -e
#For cacti poller executing
*/1 * * * * /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1
root@debian:~# systemctl restart cron.service

六、开启相关服务的自启动

root@debian:~# systemctl enable crond.service
root@debian:~# systemctl enable apache2.service
root@debian:~# systemctl enable mysql.service
root@debian:~# systemctl enable php7.4-fpm.service

 至此我们就完成了在Debian 11.3系统中安装部署Cacti监控系统,加上整理文档历时近4个小时,从这个过程中,我们要克服烦躁,毕竟Linux中安装软件需要各种环境支持及异常报错,不怕有错就怕沉不下心去解决,如果是新手这个估计没几天完成不了,各种报错,所以在运维过程中,前提基础要搞好,从装系统开始就准备避免后面软件安装异常报错程度。总之,熟能生巧,熟能判断报错问题原因,动手,频繁动手,第一次安装没有报错不代表第二次第三次安装就有报错。

后面会继续完善这个监控系统,目前是1台,目标是实现2台cacti能够主备负载均衡以满足监控节点数量多的性能需求,最后再公布采用脚本方式在debian中自动安装cacti,实现系统版本检测环境检测适应不同版本,还是要加强下基础的功力才行。

就这些,关注我THHT,为大家继续发布实际生产环境中遇到的问题及工作内容,为大家提出个人的思路建议,同时可以给予痛苦中的你一个指路明灯。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Cacti是一款基于PHP、MySQL、SNMP及RRDTool开发的网络流量监测图形分析工具,通过snmpget来获取数据,使用RRDtool绘画图形,提供了非常强大的数据和用户管理功能。 Cacti 1.2.16 更新日志:2020-11-30问题#3704:生成报告时,“级联分支”功能与预期不符;问题#3859:查看图形时,会自动刷新,因此无法始终按预期工作;问题#3898:实时图形弹出计数器错误;问题#3903:创建新数据源时可能会发生未定义的变量错误;问题#3907:发生错误时,基于cli的安装程序不会以非零退出代码退出;问题#3912:导出完成后,有时进度条仍会保留;问题#3915:启用许多设备时,可以达到阈值,从而导致进程变慢;问题#3916:对设备执行操作时,复制的设备信息有时可能会丢失;问题#3917:使用API​​重命名树节点时,回溯可能显示不正确;问题#3919:搜索时,ddb4github有时可以将有效页面显示为空;问题#3920:从图形导出数据时,并未正确包含所有数据;问题#3924:由ddb4github创建的新图形后,“图形模板”过滤器未更新;问题#3926:登录页面上的用户名和密码在经典主题中不可见;问题#3929:改进并发进程和线程设置的措辞;问题#3930:位置过滤器应通过ddb4github删除空白条目;问题#3931:同步数据收集器时,可能会不必要地触发重新索引事件;问题#3932:自动化网络允许发现无效的IP地址;问题#3933:更改当前用户的权限时,它们不会立即生效;问题#3935:为设备重新编制索引时,有时会显示错误的页面;问题#3942:修复数据库时,audit_database.php不会添加缺少的列;问题#3948:Spine1.2.15-Spine遇到未处理的异常信号号:'6'[11,资源暂时不可用](Spine线程);问题#3949:如果不存在日志信息,则日志页面不应为空;问题#3953:在升级期间,有时会复制领域,从而导致SQL错误;问题#3957:使用ping.php时,hypnotoad无法正确解释UDP响应时间;问题#3960:改进了在尝试查看您无权访问的日志文件时收到的警告;问题#3962:复制文件时,脚本未标记为可执行文件;问题#3963:创建插件表时,排序规则设置不正确;功能:将c3.js更新到版本0.7.20;功能:将Chart.js更新到版本2.9.4;功能:将phpseclib更新到版本2.0.29;功能:将PHPMailer更新到版本6.1.8;功能:对CLI脚本使用LSB shebang表示法;功能:添加对基于cactid守护程序的启动器的支持;feature#3923:新增了通过datatecuk隐藏“图表向下钻取”图标的功能;feature#3943:为插件添加钩子以显示自定义图形源和自定义模板URL(列表视图)。
Cacti是一款基于PHP、MySQL、SNMP及RRDTool开发的网络流量监测图形分析工具,通过snmpget来获取数据,使用RRDtool绘画图形,提供了非常强大的数据和用户管理功能。 Cacti 1.2.2 更新日志:2019-02-24 问题#599:聚合图模板假定AVG合并功能;问题#2312:在Safari上检索设备信息似乎失败;问题#2317:Unabe将新记录添加到'poller_time'表;问题#2327:运行轮询器复制时内存耗尽;问题#2334:某些浏览器在切换到控制台时报告javascript错误;问题#2337:运行升级时,将重置日志文件的路径;问题#2339:收件人地址中的某些字符可能导致电子邮件失败;问题#2343:由于缺少默认关键字,导出挂钩不再起作用;问题#2346:列出插件权限时,“Legacy 1.x插件”可能出现在错误的单元格中;问题#2347:允许排序输出将返回的数据注入特定对象;问题#2350:无法为包含第n个百分位数和带宽的HRULES和COMMENTS选择数据源;问题#2352:SNMP描述字段有时可能包含受损数据;问题#2354:在自动化中重新编制索引时,图表和数据源的标题不会更新;问题#2355:指定自定义数据时,有时会复制数据源;问题#2357:当索引不正确时,轮询器应记录更多信息;问题#2359:升级时,“安装/升级”权限可能先前已丢失;问题#2360:检索数据库/表/列信息时,并不总是应用模式名称;问题#2362:当ifSpeed和ifHighSpeed返回为零时,无法默认接口速度;问题#2365:编辑聚合图时,并不总是删除孤立的项;问题#2372:数据查询重建索引导致图形中的间隙;问题#2376:手动添加Automation发现的设备会导致记录错误;问题#2380:设备可能会遇到不断的重建索引;问题#2384:当身份验证方法设置为“无”时,更改为“内置”,因为“无”已被删除;问题#2393:重新索引设备时,Graph Automation每次都会创建重复的图表;问题#2416:SELinux希望APPEND不对Fedora/EPEL(RHEL,Centos)进行WRITE许可;问题#2419:未正确计算主机状态时间;问题#2426:为'custom_logout_message'和'custom_denied'恢复缺少的插件挂钩;问题#2431:“邮件方法”(settings_how)的默认值不正确导致错误;问题#2432:更新RRD数据时未定义的变量警告;问题#2451:拖放并不总是正常运行;功能:将javascript库c3.js更新为0.6.12版;功能:将phpseclib更新为2.0.14版;功能:将PHPMailer更新到版本6.0.7;功能:将javascript库d3.js更新为版本5.9.1。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值