這文章是參照https://gist.github.com/anamorph/dadeb22340ca4deec...旳作法

# yum install mysql-server mysql php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-snmp php-pear-Net-SMTP php-mysql httpd -y

# chkconfig mysqld on

# chkconfig httpd on
# service mysqld start
# service httpd start

# mysqladmin -u root password 你自己的密碼

# mysql -uroot -p mysql
mysql> create database cacti;
mysql> grant all on cacti.* to cacti identified by 'cacti';
mysql> flush privileges;
mysql> quit

# yum install net-snmp-utils php-snmp net-snmp-libs -y

# vi /etc/snmp/snmpd.conf

如果考量安全性,community請不要用public,改成自己的設定

####
# First, map the community name "public" into a "security name"
#       sec.name  source          community
com2sec local     localhost       public
####
# Second, map the security name into a group name:
#       groupName      securityModel securityName
group   MyRWGroup      v1            local
group   MyRWGroup      v2c           local
group   MyRWGroup      usm           local
####
# Third, create a view for us to let the group have rights to:
# Make at least  snmpwalk -v 1 localhost -c public system fast again.
#       name           incl/excl     subtree         mask(optional)
view    all            included      .1              80
####
# Finally, grant the group read-only access to the systemview view.
#       group          context sec.model sec.level prefix read   write  notif
access  MyRWGroup      ""      any       noauth    exact  all    all    none    
###############################################################################
# System contact information
#
# It is also possible to set the sysContact and sysLocation system
# variables through the snmpd.conf file:
syslocation "Running from above, in the Cloud"
syscontact "me@nuage.ninja"    

# /etc/init.d/snmpd start

# chkconfig snmpd on

# yum install cacti -y

# mysql -uroot -p cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql

# vi /usr/share/cacti/include/config.php

因為本例並沒有為cacti建立單獨的mysql使用者,建議不要使用root,但本例使用root

$database_username = "root";
$database_password = "這裡改成前面步驟你自己的密碼";

# vi /etc/httpd/conf.d/cacti.conf

請改成這樣,讓你的cacti能從任何網路訪問,不然你只能在本機測試

<Directory /usr/share/cacti/>
        <IfModule mod_authz_core.c>
                # httpd 2.4
                # Require host localhost
                Require host any
        </IfModule>
        <IfModule !mod_authz_core.c>
                # httpd 2.2
                Order deny,allow
                Deny from all
                # Allow from localhost
                Allow from all
        </IfModule>
</Directory>

# vi /etc/cron.d/cacti

將前面的黎

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

# service crond restart

# service httpd restart

好了,完成了,你可使用 http://你cacti的IP/cacti/ 來登入cacti了

預設帳號是admin 預設密碼也是admin


arrow
arrow
    文章標籤
    Amazon Linux cacti install
    全站熱搜

    痞客興 發表在 痞客邦 留言(0) 人氣()