用預編譯包安裝zabbix-agent

若是主機沒法上網,安裝rpm又缺乏依賴時,能夠經過預編譯包進行安裝zabbix-agent,下載地址html

 https://www.zabbix.com/downloadmysql

下載後,執行以下命令:linux

wget https://assets.zabbix.com/downloads/3.2.7/zabbix_agents_3.2.7.linux2_6.amd64.tar.gz
# 沒法上網手動下載,上傳至服務器
sudo groupadd zabbix
sudo useradd -g zabbix zabbix -s /sbin/nologin
sudo useradd zabbix tar -zxvf zabbix_agents_3.2.7.linux2_6.amd64.tar.gz sudo cp bin/* /usr/bin/ sudo cp sbin/* /usr/sbin sudo chmod +x /usr/bin/zabbix_* sudo chmod +x /usr/sbin/zabbix_* sudo mkdir -p /opt/zabbix/ sudo cp conf/zabbix_agentd.conf /opt/zabbix/ sudo vi /opt/zabbix/zabbix_agentd.conf sed -i "s/Server=127.0.0.1/Server=10.231.67.220,10.231.64.31/g" /opt/zabbix/zabbix_agentd.conf sed -i "s/ServerActive=127.0.0.1/ServerActive=10.231.67.220/g" /opt/zabbix/zabbix_agentd.conf sed -i "s/Hostname=Zabbix server/# Hostname=Zabbix server/g" /opt/zabbix/zabbix/zabbix_agentd.conf sed -i "s/# HostnameItem=system.hostname/HostnameItem=system.hostname/g" /opt/zabbix/zabbix/zabbix_agentd.conf #Hostname=Zabbix server HostnameItem=system.hostname 結束進程: killall zabbix_agentd 啓動服務: zabbix_agentd -c /opt/zabbix/zabbix_agentd.conf 查看服務啓動 netstat -tunlp | grep 10050 sudo ps -ef | grep zabbix_agentd

Killall命令須要安裝以下:sql

yum install psmisc

添加自動啓動centos

[root@mysql-m ~]# vi /usr/lib/systemd/system/zabbix-agentd.service 

內容以下:

[Unit]
Description=Zabbix Agent
After=syslog.target
After=network.target

[Service]
Environment="CONFFILE=/etc/zabbix/zabbix_agentd.conf"
Type=forking
PIDFile=/tmp/zabbix_agentd.pid
Restart=on-failure
KillMode=control-group
ExecStart=/usr/sbin/zabbix_agentd -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s

[Install]
WantedBy=multi-user.target

systemctl start zabbix-agentd.service
systemctl enable zabbix-agentd.service

6.x 編輯/etc/rc.local服務器

[xiamen@vmxmfora1 ~]$ sudo cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.spa

touch /var/lock/subsys/local
/sbin/service ntpd restart
ntpdate -q pyro.apc.com
echo "search apc.com" >> /etc/resolv.conf
sudo /usr/sbin/zabbix_agentd -c /opt/zabbix/zabbix_agentd.confrest

編輯/etc/sudoers,使用該用戶不用輸入密碼:code

## Allows people in group wheel to run all commands
# %wheel        ALL=(ALL)       ALL
 %admin         ALL=(ALL)       ALL
 %devs          ALL=(ALL)       /bin/su - itacmes
xiamen          ALL=(ALL)       NOPASSWD: ALL

 

 

 

參考:server

https://www.centos.bz/2017/09/centos-7-zabbix-agent-%E5%AE%A2%E6%88%B7%E7%AB%AF%E6%BA%90%E7%A0%81%E7%BC%96%E8%AF%91%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/

https://www.cnblogs.com/gaoyuechen/p/8991091.html頁面增長該服務器。

相關文章
相關標籤/搜索