您好,登錄后才能下訂單哦!
鏈接:https://pan.baidu.com/s/1Hu-RykIAs6xzahM2Ldby8g
提取碼:6un5
此實驗需要聯網,所以要兩塊網卡,一塊僅主機,一塊橋接
systemctl stop firewalld
setenforce 0
cd /etc/yum.repos.d/
cp back/* ./
添加所需的yum源
vi all.repo
---新增中科大mariadb源----
[mariadb]
name = MariaDB
baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.3/centos7-amd64/
gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
?
?
安裝所需的安裝包:
yum install -y \
httpd \
MariaDB-client MariaDB-server \
MariaDB-devel \
php \
php-snmp \
php-ldap \
php-pdo \
php-mysql \
php-devel \
php-pear \
php-common \
php-gd \
php-mbstring \
php-xml \
php-process \
net-snmp \
net-snmp-utils \
net-snmp-libs \
net-snmp-agent-libs \
net-snmp-devel \
rrdtool \
rrdtool-php \
rrdtool-perl \
rrdtool-devel \
gcc openssl-devel \
dos2unix \
autoconf \
automake \
binutils libtool \
cpp postfix \
glibc-headers \
kernel-headers \
glibc-devel \
gd gd-devel \
help2man \
ntpdate \
wget patch
vi /etc/httpd/conf/httpd.conf
ServerName www.aa.com
?DirectoryIndex index.html //把html改成php
vi /etc/httpd/conf.d/php.conf ——————末尾新增
LoadModule php5_module modules/libphp5.so
?
?
vi /etc/php.ini
safe_mode=off //在[PHP]下插入
date.timezone = PRC //去掉注釋
?
?
systemctl stop firewalld
setenforce 0
?
systemctl start httpd
systemctl start mariadb
?
netstat -anpt | grep 80
?
netstat -anpt | grep 3306
?
mysql_secure_installation 安全配置向導
?
y-n-y-y
vi /var/www/html/index.php //編輯網頁測試文件
<?php
phpinfo();
?>
?
測試,在瀏覽器中輸入192.168.80.100
?
?
vi /etc/my.cnf.d/server.cnf //[mysqld]下配置
?
character_set_server = utf8mb4
collation_server = utf8mb4_unicode_ci
character_set_client = utf8mb4
max_connections = 100
max_heap_table_size = 256M
max_allowed_packet = 16777216
join_buffer_size = 64M
tmp_table_size = 64M
innodb_file_per_table = ON
innodb_buffer_pool_size = 1024M
innodb_doublewrite = OFF
innodb_lock_wait_timeout = 50
innodb_flush_log_at_timeout = 3
innodb_read_io_threads = 32
innodb_write_io_threads = 16
?
?
mysql -u root -p //登入數據庫
?
CREATE DATABASE cacti character set utf8 collate utf8_bin;
GRANT all ON cacti.* TO 'cacti'@'%' IDENTIFIED BY 'admin123';
GRANT all ON cacti.* TO 'cacti'@'localhost' IDENTIFIED BY 'admin123';
flush privileges;
?
?
vi /var/www/html/index.php
<?php
$link=mysqli_connect('192.168.80.100','cacti','admin123');
if($link) echo "<h2>Success!!</h2>";
else echo "Fail!!";
?>
?
測試檢測mysql php是否協同工作,在瀏覽器中輸入192.168.80.100
?
---------------------到此,LAMP架構結束---------------------------
yum install -y lrz*s
安裝cacti
tar xf cacti-1.1.26.tar.gz
mv cacti-1.1.26 /var/www/html/cacti
mysql -ucacti -p cacti < /var/www/html/cacti/cacti.sql
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot mysql -p
?
?
mysql -u root -p
?
grant select on mysql.time_zone_name to 'cacti'@'%' IDENTIFIED BY 'admin123';
//在數據庫中為時區文件授權
flush privileges;
?
?
vi /var/www/html/cacti/include/config.php
$database_hostname='192.168.80.100';
$database_username = 'cacti';
$database_password = 'admin123';
?
?
配置SNMP 簡單網絡管理協議
vi /etc/snmp/snmpd.conf
?
access notConfigGroup "" any noauth exact all none none //把systemview改成all 62
?
view all included .1 80 // 去掉#號 85
?
?
?
systemctl restart snmpd
systemctl enable snmpd
?
useradd -r -M cacti
chown -R 777 /var/www/html/cacti/rra/
chown -R 777 /var/www/html/cacti/log/
chown -R apache.apache /var/www/html/cacti/resource/
chown -R apache.apache /var/www/html/cacti/cache
chown -R apache.apache /var/www/html/cacti/scripts
?
crontab -e
*/5 * * * * /usr/bin/php /var/www/html/cacti/poller.php >> /tmp/cacti_rrdtool.log
?
?
?
安裝cacti-spine優化數據輪詢速度
ln -s /usr/lib64/libmysqlclient.so.18.0.0 /usr/lib64/libmysqlclient.so
?
tar xf cacti-spine-1.1.26.tar.gz
cd cacti-spine-1.1.26
./configure && make && make install
?
cp /usr/local/spine/etc/spine.conf.dist /usr/local/spine/etc/spine.conf
?
vi /usr/local/spine/etc/spine.conf //修改相關參數
?
DB_Host localhost
DB_Database cacti
DB_User cacti
DB_Pass admin123
DB_Port 3306
?
RDB_Host localhost
RDB_Database cacti
RDB_User cacti
RDB_Pass admin123
RDB_Port 3306
?
/usr/local/spine/bin/spine -c /usr/local/spine/etc/spine.conf
?
systemctl restart httpd
systemctl restart mariadb
?
-----------登錄到頁面-----------
192.168.80.100/cacti/
?
安裝過程
用戶名與密碼默認admin,登錄后密碼要求修改(至少八位,并且復雜)
重設密碼,密碼為大寫小寫特殊字符組合
?
重新訪問:http://192.168.80.10/cacti/
?
(控制臺)Console -> 系統配置 -> 設置(Cacti Settings) -> Paths -> 在 Spine Binary File Location 文本框內填入配置文件路徑 /usr/local/spine/bin/spine ,點擊保存 (Save)。
Console -> 設置(Cacti Settings) -> Poller -> 在 Poller Type 下拉框中選擇 spine ,點擊保存 (Save)。注意:假如使用spine的話,下面兩項輪訓時間和計劃任務間隔時間都要設置為every Minute
?
在查看圖形數據的時候如果報錯:
/bin/rrdtool :symbol lookup error: /lib64/libpango-1.0.so.0:undefined symboll
?
解決方法:
yum update glib2 -y
?
如果報錯:
error:opening '/var/www/html/cacti/rra/local_linux_machine_load_1min_2.rrd':No such file or directory
?
解決方法:
chmod -R 777 /var/www/html/cacti/rra
/usr/bin/php /var/www/html/cacti/poller.php
?
?
?
添加設備:
?
?
?Win7設置:
控制面板—程序和功能
?
打開服務管理器:
Win+r,services.msc
?
?
?
在添加完設備和圖形后,需要重建采集器緩存。
去cacti上查看
管理à設備(device)
查看linux狀態為UP即可,注意不要著急spine方式剛剛啟動需要2-5分鐘左右時間,有快有慢
設置主機的IP地址:
然后直接選圖形,可以查看cacti處理后的圖片
?
?
?
--------------------------添加一臺linux服務器:-------------------------
yum install -y \
net-snmp \
net-snmp-utils \
net-snmp-libs \
net-snmp-agent-libs \
net-snmp-devel
?
?
配置SNMP 簡單網絡管理協議
vi /etc/snmp/snmpd.conf
?
com2sec notConfigUser 192.168.80.100 public #允許哪個服務器監控本機 ,public團體名
?
access notConfigGroup "" any noauth exact all none none //把systemview改成all 62
?
view all included .1 80 // 去掉#號 85
?
systemctl restart snmpd
?
可以再cacti服務器端執行如下命令:
snmpwalk -v2c -c public 192.168.80.101
測試能不能抓取到數據
?
?
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。