zabbix監控軟件

Zabbix監控軟件
重要組件
Zabbix Server:負責接收組件
Database storage:負責存儲收集的信息
Web interface:圖形界面接口
Proxy:分佈式組件,可選安裝
Agent:負責收集被監控端的信息並傳給Server
zabbix進程
zabbix_agentd: C守護進程,負責收集傳送
zabbix_get: S端手動獲取C信息程序
zabbix_sender: C手動上傳信息
zabbix_server: S守護進程,負責接收
zabbix_proxy: 代理進程
監控架構:
S-C :直連架構
S-N-C :node架構
S-P-C :proxy架構
實驗環境

LAMP或LNMP環境
通過yum安裝
yum -y install mariadb mariadb-server #安裝數據庫
systemctl start mariadb
mysqladmin -u root password 'password123'

cp -r /abc/Zabbix軟件包 /Zabbix
mv yum源所需 yum
createrepo /Zabbix/yum #生成yum倉庫目錄
修改本地yum源公鑰檢測爲0,修改目錄爲/Zabbix
vim /etc/yum.repos.d/a.repo
[a]
name=a
baseurl=file:///Zabbix/yum/
gpgcheck=0
enable=0
yum -y install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent
mysql -u root -ppassword123
create database zabbix character set utf8 collate utf8_bin; #創建數據庫
grant all privileges on zabbix.* to zabbix@localhost identified by 'password456'; #賦權

zcat /usr/share/doc/zabbix-server-mysql-3.4.1/create.sql.gz | mysql -u zabbix -p zabbix #導入腳本進zabbix
vim /etc/zabbix/zabbix_server.conf #修改server配置文件
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password456
cp /etc/zabbix/zabbix_agentd.conf /etc/zabbix/.zabbix_agentd.conf.bak
vim /etc/zabbix/zabbix_agentd.conf
Server=127.0.0.1 #指定server主機地址(被動)
ServerActive=127.0.0.1 #指定server地址(主動)
Hostname=linux-server001
systemctl start zabbix-server
systemctl enable zabbix-server
搭建GNS3

R1:
conf t
int e0/0
ip add 192.168.10.100 255.255.255.0
no sh
exit
no ip routing
snmp-server community centos RO
snmp-server enable traps #開啓主動上傳模式
snmp-server host 192.168.10.1 centos #指定zabbix服務器

監控Linux服務器
cd /abc/Zabbix軟件包/yum源所需/
rpm -ivh zabbix-agent-3.4.1-1.el7.x86_64.rpm
vim /etc/zabbix/zabbix_agentd.conf
Server=192.168.10.1 #指定server主機地址(被動)
ServerActive=192.168.10.1 #指定server地址(主動)
Hostname=linux-server001
systemctl start zabbix-agent.service
netstat -anpt | grep agent

yum -y install httpd
mkdir /etc/zabbix/zabbix_scripts
cd /etc/zabbix/zabbix_scripts
vim check_httpd.sh
#!/bin/bash
a=netstat -anpt | grep httpd
if [[ -n $a ]]
then
echo "2"
else
echo "0"
fi

vim /etc/zabbix/zabbix_agentd.conf
UnsafeUserParameters=1 #支持自定義腳本
vim /etc/zabbix/zabbix_agentd.d/userparameter_httpd.conf
UserParameter=check_httpd,sh /etc/zabbix/zabbix_scripts/check_httpd.sh

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