Cacti-1.04 on CentOS7 架設筆記

關閉防火牆、查看IP並連接ssh

yum install vim
systemctl firewalld stop
ip addr

新增marinaDB套件來源 (5.4 -> 10.1)

vim /etc/yum.repos.d/MariaDB.repo

    # MariaDB 10.1 CentOS repository list - created 2017-04-18 11:15 UTC
    # http://downloads.mariadb.org/mariadb/repositories/
    [mariadb]
    name = MariaDB
    baseurl = http://yum.mariadb.org/10.1/centos7-amd64
    gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
    gpgcheck=1

安裝需求套件

yum install -y httpd mariadb-server php php-mysql php-pear php-gd php-mbstring net-snmp net-snmp-utils rrdtool

yum install -y epel-release

yum install -y cacti

建立資料庫

systemctl enable mariadb

systemctl start mariadb

mysql_secure_installation (打完密碼後一直按enter)

mysql -u root -p -A mysql

MariaDB > create database cacti;

MariaDB > GRANT SELECT ON mysql.time_zone_name TO cacti@localhost IDENTIFIED BY 'cactipassword';

MariaDB > grant all privileges on cacti.* to cacti@localhost identified by 'cactipassword';

MariaDB > flush privileges;

MariaDB > exit

mysql -u root -p -A cacti < /usr/share/doc/cacti-1.0.4/cacti.sql

設定 httpd、cacti db、php

vim /etc/httpd/conf.d/cacti.conf

新增 Require ip 192.168.56.0/24


vi /etc/cacti/db.php

    $database_type = "mysql";
    $database_default = "cacti";
    $database_hostname = "localhost";
    $database_username = "cacti";
    $database_password = "cactipassword";
    $database_port = "3306";
    $database_ssl = false;

vim /etc/php.ini 在最後加上

    date.timezone = Asia/Taipei

vim /etc/my.cnf

[mysqld]

innodb_buffer_pool_size = 512M

symbolic-links=0

character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
init-connect='SET NAMES utf8'
lower_case_table_names=0

max_heap_table_size=90M
max_allowed_packet=167M
tmp_table_size = 64M
join_buffer_size =128M
sort_buffer_size = 4M
read_rnd_buffer_size = 4M
innodb_doublewrite = OFF
innodb_flush_log_at_timeout = 3
innodb_read_io_threads = 32
innodb_write_io_threads = 16
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
innodb_additional_mem_pool_size = 80M
#default_time_zone = Asia/Taipei

log-error=/var/log/mysqld.log

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

systemctl restart mysqld

sed -i 's/^/#/g' /etc/httpd/conf.d/welcome.conf

systemctl enable httpd

systemctl start httpd

網頁設置

用瀏覽器打開 http://linux.host.ip/cacti/install

  1. 勾選同意,Next

  2. 確認畫面沒有紅字,Next

  3. Next*2,直到看到這個畫面,全勾後Next

  4. 登入,預設帳密皆為admin

  5. 輸入新密碼

  6. 燈愣/

One more thing

vi /etc/cron.d/cacti
取消註解

*/5 * * * * cacti   /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1

systemctl enable snmpd
systemctl start snmpd

新增switch

  1. 點選 devices

  2. 點選 add

  3. 輸入以下資訊,並點選右下方 "Create"

  4. 完成後會看到"SNMP Information 有相關資訊",點選"Create Graphs for this Device"新增圖表

  5. 選取所有資料源,並按右下方 "Create"

  6. 點選右方選單"Trees"

  7. 點選 "Default tree"

  8. 點選 "Edit tree"

  9. 將"snmg_test"拖曳至左方裝置的上方或下方

  10. 點選右方"Save"

  11. 經過一段時間(10~15min)後,即可看到出現統計圖

Reference

  1. https://downloads.mariadb.org/mariadb/repositories/#mirror=ossplanet&distro=CentOS&distro_release=centos7-amd64--centos7&version=10.1
  2. http://jamyy.us.to/blog/2015/10/7767.html
  3. http://forums.cacti.net/viewtopic.php?f=21&t=56848

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *