更新升级 专属应用 系统故障 硬件故障 电脑汽车 鸿蒙刷机 鸿蒙开发Linux教程 鸿蒙开发Linux命令
当前位置:HMXT之家 > 鸿蒙开发Linux教程 > 在Ubuntu 20.04系统上安装Cacti Spine轮询器的步骤

在Ubuntu 20.04系统上安装Cacti Spine轮询器的步骤

更新时间:2022-12-20 15:34:17浏览次数:416+次

Cacti是一个开源的绘图和网络监控工具,用作行业标准的数据记录和RRD工具。本文介绍在Ubuntu 20.04 Linux系统上安装Cacti Spine轮询器的方法。现在,Cacti和Spine已经包含在许多Linux发行版中,所以安装它们很容易。在安装前,系统中要有Cacti。

安装Cacti Spine轮询器的步骤

步骤1、在Ubuntu 20.04上下载Cacti Spine轮询器

使用以下命令:

sudo apt install <cacti-spine-package>

但这种方法的唯一问题是,不能保证您使用最新版本的Spine。

从官方Cacti下载页面下载最新版本的Spine,地址在https://files.cacti.net/spine/。或者使用Wget下载最新版本的Cacti-spine:

sudo apt install wget

wget https://www.cacti.net/downloads/spine/cacti-spine-latest.tar.gz

步骤2、在Ubuntu 20.04上安装Cacti Spine轮询器

一旦下载,我们就可以安装它了。对于本文,我们将从源代码构建它。因此,我们将安装以下所需的软件包:

sudo apt install build-essential autoconf automake dos2unix gzip help2man m4 make wget libtool libsnmp-dev libmariadb-dev libmariadbclient-dev

提取下载的Cacti-spine文件:

tar zxvf cacti-spine-latest.tar.gz

导航到提取的文件目录:

cd cacti-spine-*/

现在,通过运行引导文件创建配置脚本,如下所示:

sudo ./bootstrap

样本输出:

INFO: Starting Spine build process

INFO: Removing cache directories

INFO: Running auto-tools to verify buildability

aclocal: installing 'm4/libtool.m4' from '/usr/share/aclocal/libtool.m4'

aclocal: installing 'm4/ltoptions.m4' from '/usr/share/aclocal/ltoptions.m4'

aclocal: installing 'm4/ltsugar.m4' from '/usr/share/aclocal/ltsugar.m4'

aclocal: installing 'm4/ltversion.m4' from '/usr/share/aclocal/ltversion.m4'

aclocal: installing 'm4/lt~obsolete.m4' from '/usr/share/aclocal/lt~obsolete.m4'

libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'config'.

libtoolize: linking file 'config/ltmain.sh'

configure.ac:11: installing 'config/compile'

configure.ac:7: installing 'config/config.guess'

configure.ac:7: installing 'config/config.sub'

configure.ac:13: installing 'config/install-sh'

configure.ac:13: installing 'config/missing'

Makefile.am: installing 'config/depcomp'

  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

现在运行configure脚本来检测以下可用内容:

sudo ./configure

样本输出:

checking build system type... x86_64-pc-linux-gnu

checking host system type... x86_64-pc-linux-gnu

checking for gcc... gcc

checking whether the C compiler works... yes

checking for C compiler default output file name... a.out

checking for suffix of executables... 

checking whether we are cross compiling... no

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether gcc accepts -g... yes

checking for gcc option to accept ISO C89... none needed

checking whether gcc understands -c and -o together... yes

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

checking for a thread-safe mkdir -p... /usr/bin/mkdir -p

checking for gawk... gawk

checking if we can support mysql/mariadb ssl keys... yes

checking that generated files are newer than configure... done

configure: creating ./config.status

config.status: creating Makefile

config.status: creating config/config.h

config.status: executing depfiles commands

config.status: executing libtool commands

使用以下命令将Cacti spine安装到默认的/usr/local/spine目录中:

sudo make

sudo make install

样本输出:

make[1]: Entering directory '/home/thor/cacti-spine-1.2.19'

 /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]: Leaving directory '/home/thor/cacti-spine-1.2.19'

将二进制文件的所有权分配给root,如下所示:

sudo chown root:root /usr/local/spine/bin/spine 

sudo chmod +s /usr/local/spine/bin/spine

创建Spine配置文件:

sudo cp /usr/local/spine/etc/spine.conf.dist /usr/local/spine/etc/spine.conf

编辑配置文件并添加数据库详细信息:

sudo vi /usr/local/spine/etc/spine.conf

在文件中,添加数据库详细信息,如下所示:

DB_Host 'localhost'

DB_Database 'cacti'

DB_User 'cacti_user'

DB_Pass 'strongpassword'

DB_Port '3306'

步骤3、使用Cacti Spine轮询器

登录到您的Cacti站点并导航到Configuration->Settings:

\

现在更新您的Cacti配置如下:

Spine Binary File Location : /usr/local/spine/bin/spine

Spine Config File Path : /usr/local/spine/etc/spine.conf

在路径下,应按以下方式填充:

\

保存所做的更改并将Poller更新为Cacti-spine,如图所示:

\

现在,使轮询器能够从受监控的设备收集数据,添加一个新的crontab,以便能够通过SNMP查询设备:

sudo crontab -u www-data -e

选择所需的编辑器并继续将以下行添加到文件中:

*/5 * * * * /usr/bin/php /var/www/html/poller.php

给它几分钟时间,然后在图形->默认树(Graphs -> Default Tree)下进行检查。您应该能够看到收集的数据,如下所示:

\

至此,已经成功的在Ubuntu 20.04上安装了Cacti Spine轮询器。