服務器監控系統——Cacti

cati監控系統

主要監控流量和性能

cati配置安裝

1.搭建好LAMP或者LNMP架構的網絡服務器架構

安裝httpd和php

yum -y install httpd php php-mysql php-snmp php-xml php-ldap php-gd php-mbstring php-posix

systemctl start httpd && systemctl enable httpd

安裝Mariadb10.3版本

vim /etc/yum.repos.d/mariadb10.3.repo

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

yum install -y MariaDB-server MariaDB-client MariaDB-devel

systemctl start mariadb && systemctl enable mariadb

數據庫創建用戶初始化

mysqladmin -u root password '123456'

添加參數

vim /etc/my.cnf.d/server.cnf

[server]
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_flush_log_at_timeout = 3
innodb_read_io_threads = 32
innodb_write_io_threads =16
innodb_file_format = Barracuda
innodb_large_prefix = 1

測試LAMP

<?php
$a=mysql_connect("localhost","root","123456");
if($a){echo "數據庫連接成功!!!";}else{echo "數據庫連接失敗!!!";}
?>
<?php
phpinfo();
?>

如下圖環境搭建成功:

2.安裝net-snmp-utils並啓動snmp服務

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

systemctl start snmpd && systemctl enable snmpd

3.安裝rrdtool軟件包

安裝相關依賴包

yum -y install cairo-devel zlib libxml2 libxml2-devel glib2 glib2-devel libpng libpng-devel freetype freetype_devel libart_lgpl pango pango_devel pear pear_devel perl-CPAN perl-YAML

安裝rddtool

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

4.安裝部署cacti

tar zxf cacti-1.2.12.tar.gz

mv cacti-1.2.12 /var/www/html/cacti

useradd cacti

chown -R apache.apache /var/www/html/cacti/

5.建立數據庫,表結構

在建立數據庫之前修改該網站的include目錄下的config.php文件修改登錄數據庫用戶和登錄密碼等信息

vim /var/www/html/cacti/include/config.php

$database_type     = 'mysql';
$database_default  = 'cacti';
$database_hostname = 'localhost';
$database_username = 'cacti';  #這裏的用戶名和後面數據庫授權有關
$database_password = 'cacti';  #這裏的密碼也和後面的數據庫授權有關
$database_port     = '3306';
$database_retries  = 5;
$database_ssl      = false;
$database_ssl_key  = '';
$database_ssl_cert = '';
$database_ssl_ca   = '';
$url_path = '/cacti/';

登錄數據創建表授權

mysql -uroot -p123456

MariaDB [(none)]> create database cacti;

MariaDB [(none)]> grant all on cacti.* to cacti@localhost identified by "cacti";

MariaDB [(none)]> GRANT SELECT ON mysql.time_zone_name TO 'cacti'@'localhost' IDENTIFIED BY 'cacti';

MariaDB [(none)]> quit

導入該網站的數據庫

mysql -uroot -p123456 cacti < /var/www/html/cacti/cacti.sql

6.修改時區

mysql_tzinfo_to_sql /usr/share/zoneinfo/ | mysql -uroot -p123456 mysql

vim /etc/php.ini

date.timezone = "Asia/Shanghai"

6.訪問網站http://192.168.11.25/cacti/

會自動跳轉到安裝界面進行安裝

安裝完成之後

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章