Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install zabbix_agent

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to install zabbix_agent. It is very detailed and has a certain reference value. Friends who are interested must finish it!

I. install_zabbix_agent_centos5.sh

#! / bin/bash

Yum-y install unixODBC-devel unixODBC net-snmp net-snmp-devel OpenIPMI OpenIPM-devel openldap openldap-devel wget curl.x86_64

Grep zabbix_agent / etc/services > / dev/null

Stat1=$?

If [$stat1-ne 0]; then

Cat > > / etc/services > / var/spool/cron/root

Fi

Cat / var/spool/cron/root | grep "discovery_services.py" | grep-v grep > / dev/null

Stat2=$?

If ["$stat2"-ne 0]; then

Echo "* / 30 * / usr/bin/nohup / opt/zabbix/script/discovery_services.py > / dev/null 2 > & 1 &" > / var/spool/cron/root

Fi

Cat / var/spool/cron/root | grep "get_java_jstat.py" | grep-v grep > / dev/null

Stat_jstat=$?

If ["$stat_jstat"-ne 0]; then

Echo "* / 1 * / usr/bin/nohup / opt/zabbix/script/get_java_jstat.py > / dev/null 2 > & 1 &" > / var/spool/cron/root

Fi

# set hostname

# ip= `/ sbin/ifconfig-a | grep inet | grep-v 127.0.0.1 | grep-v "172." | grep-v "192" | grep-v inet6 | awk'{print $2}'| tr-d "addr:" | he

Ad-n 1`

Ip= `/ sbin/ifconfig-a | grep inet | grep-v inet6 | grep-v 127.0.0.1 | awk-F\:'{print $2}'| awk'{print $1}'| grep-v "^ 172" | head-n 1

`

Echo $ip

Sed-I's Universe Hostnameplate. Hostnameplate hostnameplates ${ip} _ jgz'/g' / opt/zabbix/etc/zabbix_agentd.conf

Grep Hostname / opt/zabbix/etc/zabbix_agentd.conf

/ etc/init.d/zabbix_agentd start

Grep 'zabbix_agentd' / etc/rc.d/rc.local | grep-v grep > / dev/null

Stat3=$?

If ["$stat3"-ne 0]; then

Echo "/ etc/init.d/zabbix_agentd start" > > / etc/rc.d/rc.local

Fi

II. Install_zabbix_agent_centos6.sh

#! / bin/bash

Yum-y install unixODBC-devel unixODBC net-snmp net-snmp-devel OpenIPMI OpenIPM-devel openldap openldap-devel wget curl.x86_64

Grep zabbix_agent / etc/services > / dev/null

Stat1=$?

If [$stat1-ne 0]; then

Cat > > / etc/services > / var/spool/cron/root

Fi

Cat / var/spool/cron/root | grep "discovery_services.py" | grep-v grep > / dev/null

Stat2=$?

If ["$stat2"-ne 0]; then

Echo "* / 30 * / usr/bin/nohup / opt/zabbix/script/discovery_services.py > / dev/null 2 > & 1 &" > / var/spool/cron/root

Fi

Cat / var/spool/cron/root | grep "get_java_jstat.py" | grep-v grep > / dev/null

Stat_jstat=$?

If ["$stat_jstat"-ne 0]; then

Echo "* / 1 * / usr/bin/nohup / opt/zabbix/script/get_java_jstat.py > / dev/null 2 > & 1 &" > / var/spool/cron/root

Fi

# ip= `/ sbin/ifconfig-a | grep inet | grep-v 127.0.0.1 | grep-v "172." | grep-v "192" | grep-v inet6 | awk'{print $2}'| tr-d "addr:" | he

Ad-n 1`

Ip= `/ sbin/ifconfig-a | grep inet | grep-v inet6 | grep-v 127.0.0.1 | awk-F\:'{print $2}'| awk'{print $1}'| grep-v "^ 172" | head-n 1

`

Echo $ip

Sed-I's Universe Hostnameplate. Hostnameplate hostnameplates ${ip} _ jgz'/g' / opt/zabbix/etc/zabbix_agentd.conf

Grep Hostname / opt/zabbix/etc/zabbix_agentd.conf

/ etc/init.d/zabbix_agentd start

Grep 'zabbix_agentd' / etc/rc.d/rc.local | grep-v grep > / dev/null

Stat3=$?

If ["$stat3"-ne 0]; then

Echo "/ etc/init.d/zabbix_agentd start" > > / etc/rc.d/rc.local

Fi

III. Install _ zabbix_agent_centos7.sh

#! / bin/bash

Grep zabbix_agent / etc/services > / dev/null

Stat1=$?

If [$stat1-ne 0]; then

Cat > > / etc/services > / var/spool/cron/root

Fi

Cat / var/spool/cron/root | grep "discovery_services.py" | grep-v grep > / dev/null

Stat2=$?

If ["$stat2"-ne 0]; then

Echo "* / 30 * / usr/bin/nohup / opt/zabbix/script/discovery_services.py > / dev/null 2 > & 1 &" > / var/spool/cron/root

Fi

Cat / var/spool/cron/root | grep "get_java_jstat.py" | grep-v grep > / dev/null

Stat_jstat=$?

If ["$stat_jstat"-ne 0]; then

Echo "* / 1 * / usr/bin/nohup / opt/zabbix/script/get_java_jstat.py > / dev/null 2 > & 1 &" > / var/spool/cron/root

Fi

# ip= `/ sbin/ifconfig-a | grep inet | grep-v 127.0.0.1 | grep-v "172." | grep-v "192" | grep-v inet6 | awk'{print $2}'| tr-d "addr:" | he

Ad-n 1`

Ip= `/ sbin/ifconfig-a | grep inet | grep-v inet6 | grep-v 127.0.0.1 | awk-F\:'{print $2}'| awk'{print $1}'| grep-v "^ 172" | head-n 1

`

Echo $ip

Sed-I's Universe Hostnameplate. Hostnameplate hostnameplates ${ip} _ jgz'/g' / opt/zabbix/etc/zabbix_agentd.conf

Grep Hostname / opt/zabbix/etc/zabbix_agentd.conf

Systemctl daemon-reload

/ etc/init.d/zabbix_agentd start

Grep 'zabbix_agentd' / etc/rc.d/rc.local | grep-v grep > / dev/null

Stat3=$?

If ["$stat3"-ne 0]; then

Echo "/ etc/init.d/zabbix_agentd start" > > / etc/rc.d/rc.local

Fi

These are all the contents of the article "how to install zabbix_agent". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report