首先,先安装LNMP服务

安装一:

如果觉得安装起来麻烦,可以到如下网站进行安装;

https://lnmp.org/install.html

安装二:

采用yum或者安装包的方式进行安装,具体操作请参照百度。

开始配置Cacti

1:安装net-snmp简单网络管理协议

yum install -y net-snmp net-snmp-libs net-snmp-utils net-snmp-devel net-snmp-perl

2:安装RRDTool 绘图工具

yum install -y rrdtool rrdtool-devel rrdtool-php rrdtool-perl perl-devel perl-CPAN perl-YAML

3:配置SNMP
修改snmp配置文件,找到如下内容修改
vim /etc/snmp/snmpd.conf
//修改default为本机ip,修改public为自己的团体名(可以不改),41行
com2sec notConfigUser default public
//把systemview改成all ,供所有snmp 访问权限 62行
access notConfigGroup "" any noauth exact all none none
//去掉此行注释
view all included .1 80 // 去掉#号 85行
重启snmp服务

systemctl restart snmpd.service && systemctl enable snmpd.service

4:修改PHP时区
vim /usr/local/php/etc/php.ini
[PHP]
safe_mode = Off
……
date.timezone = Asia/Shanghai

5:修改Mysql配置文件
vim /etc/my.cnf
在文件最末尾新建[server]区域,复制进去以下内容
[server]

# this is only for the mysqld standalone daemon
character_set_server = utf8mb4
collation-server = utf8mb4_unicode_ci
max_heap_table_size = 256M
max_allowed_packet = 16777216
tmp_table_size = 64M
join_buffer_size = 64M
innodb_file_per_table = ON
innodb_buffer_pool_size = 1024M
innodb_doublewrite = OFF
#innodb_additional_mem_pool_size = 96M
innodb_flush_log_at_timeout = 3
innodb_read_io_threads = 32
innodb_write_io_threads =16

注释掉[mysqld]区域下的
#max_allowed_packet = 1M

/etc/init.d/mysql restart
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!

6:下载cacti安装包
wget https://www.cacti.net/downloads/cacti-1.1.38.tar.gz
tar zxvf cacti-1.1.38.tar.gz
cp -R cacti-1.1.38 /home/wwwroot/default/cacti

7:创建cacti数据库

[root@localhost /]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18-log Source distribution

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database cacti;
Query OK, 1 row affected (0.00 sec)

mysql> grant all on cacti.* to cactiuser@localhost identified by "cactiuser";
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> GRANT SELECT ON mysql.time_zone_name TO 'cactiuser'@'localhost' IDENTIFIED BY 'cactiuser';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

注意:这里的数据库用户名密码全部为cactiuser,可以自定义。

8:导入cacti数据文件
mysql> use cacti;
Database changed
mysql> source /home/wwwroot/default/cacti/cacti.sql
Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

....................................
Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

9:配置数据库时区
cd /usr/local/mysql/bin/
./mysql_tzinfo_to_sql /usr/share/zoneinfo/ | mysql -u root -p mysql
Enter password:
Warning: Unable to load '/usr/share/zoneinfo//iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo//zone.tab' as time zone. Skipping it.

10:cacti配置文件config.php

主要修改数据库用户名密码,和cacti路径,这里全部默认,根据个人配置进行修改
vim /home/wwwroot/default/cacti/include/config.php
$database_type = 'mysql';
$database_default = 'cacti';
$database_hostname = 'localhost';
$database_username = 'cactiuser';
$database_password = 'cactiuser';
$database_port = '3306';
$database_ssl = false;

11:创建 cacti 系统用户,设置目录权限

useradd -r -M cacti
chown -R cacti /home/wwwroot/default/cacti/{rra,log}/
chown -R www:www /home/wwwroot/default/cacti/{resource,cache,scripts}
chmod -R 777 /home/wwwroot/default/cacti/

12:添加定时任务
[root@localhost bin]# crontab -e
*/5 * * * * cactiuser php /home/wwwroot/default/cacti/poller.php > /dev/null 2>&1

no crontab for root - using an empty one
crontab: installing new crontab

13:重新启动相关服务
systemctl restart crond && systemctl restart snmpd

14:安装spine
cacti默认使用cmd.php来轮询数据,速度会很慢,因此我们采用Spine来轮询数据。cacti-spine是一个由C语言开发的,用于替代cmd.php的快速获取速度的引擎。(也可以不装)
安装spine高速数据采集插件

15:访问ip

查看是否完成配置,按照提示操作进行一步步安装。

Centos 7 install cacti监控的更多相关文章

  1. centos 安装cacti监控

    CentOS 6下Cacti搭建文档 安装依赖关系 yum -y install mysql-devel httpd php php-pdo php-snmp php-mysql lm_sensors ...

  2. Cacti监控服务器配置教程(基于CentOS+Nginx+MySQL+PHP环境搭建)

    Cacti监控服务器配置教程(基于CentOS+Nginx+MySQL+PHP环境搭建) 具体案例:局域网内有两台主机,一台Linux.一台Windows,现在需要配置一台Cacti监控服务器对这两台 ...

  3. How to install cacti on centos 6

    Cacti – Network and performance monitoring tool   Cacti is one of best monitoring tool used to monit ...

  4. cacti监控juniper路由器

    之前也没有写过博客,但是最近一直在做监控.从网上查找很多资料都还是感觉差一点.所以自己添加一份我在cacti监控路由器的步骤. 环境,ubuntu14.04,apt-get install cacti ...

  5. Cacti监控Tomcatserver实现过程

    1 首先去官网上面下载通用的监控模板 一般使用TomcatStats-0.1.zip 模板居多,下载地址: http://forums.cacti.net/download/file.php?id=1 ...

  6. cacti监控部署与配置

    cacti是一套基于PHP,mysql,SNMP及RRDTool开发的网络流量测试图形分析工具 cacti是通过snmpget来获取数据,使用RRDtool绘画图形 ,而且完全可以不需要了解RRDto ...

  7. cacti监控jvm

    jdk环境 java version "1.6.0_37" Java(TM) SE Runtime Environment (build 1.6.0_37-b06) Java Ho ...

  8. cacti监控mssql 2005运行资源情况

    概述:SQL Server2000\2005\2008本身不支持snmp,使用cacti监控mssql,必须通过php连接mssql来获取SQL 2005性能计算器的值. 操作步骤: 1.php连接m ...

  9. Cacti监控mysql数据库服务器实现过程

    Cacti监控mysql数据库服务器实现过程 2014-05-29      0个评论    来源:Cacti监控mysql数据库服务器实现过程   收藏    我要投稿 1 先在cacti服务器端安 ...

随机推荐

  1. <算法笔记>关于快速排序的算法优化排序(顺便给百度百科纠个错)

    快速排序是排序算法之中的基本中的基本,虽然越来越多的接口函数将快速排序“完美的封装了起来”,比如C++中的qsort或者<algorithm>中的sort(与stable_sort相对应) ...

  2. ContextLoaderListener容器初始化

    http://blog.csdn.net/qq924862077/article/details/52769754 <context-param> <param-name>co ...

  3. python之menu

    只有主菜单没有二级菜单的例子: from tkinter import * root=Tk() root.wm_title('同济大学财务管理系统') menubar=Menu(root)#指定菜单实 ...

  4. capsule network——CNN仅仅考虑了“有没有”的问题,没有考虑feature map的结构关系。这个结构关系包括位置,角度等。Capsule layer的输出也跟feature map的max-pooling输出不同,capsule layer的输出是一个向量,这个向量包含了位置,大小,角度等信息,这是feature map仅能输出一个值所不具备的;训练比较慢

    capsule network--<Dynamic Routing Between Capsules> from:https://zhuanlan.zhihu.com/p/31491520 ...

  5. 1>/dev/null 2>&1 & 意思解析

    原文:https://jingyan.baidu.com/article/6dad5075334e26a123e36e31.html 用 /dev/null 2>&1 这样的写法.这条命 ...

  6. Qt容器组件(二)之QWidgetStack、QMdiArea、QDockWidget

    QT中有九种容器组件,分别是组合框QGroupBox.滚动区QScrollArea.工具箱QToolBox.选项卡QTabWidget.控件栈QWidgetStack.框架QFrame.组件QWidg ...

  7. MyEclipse异常关闭导致启动不了tomcat的解决方法

     由于MyEclipse的异常关闭从而导致Tomcat并没有关闭,所以再次启动Tomcat当然是无法启动的啦,解决方法:在任务管理器中关闭一个叫javaw.exe的进程,如果你这时已经启动了MyEcl ...

  8. 取分组TOPN好理解案例

  9. 洛谷 P1496 火烧赤壁

    题目描述 曹操平定北方以后,公元208年,率领大军南下,进攻刘表.他的人马还没有到荆州,刘表已经病死.他的儿子刘琮听到曹军声势浩大,吓破了胆,先派人求降了. 孙权任命周瑜为都督,拨给他三万水军,叫他同 ...

  10. MyEclipse修改Servlet模板

    进入myeclipse的安装路径 然后进入plugins文件夹 打开搜索框,输入 *wizard* 找到名字是 com.genuitec.eclipse.wizards_11.5.0.me201310 ...