Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to install zabbix_agent

Shulou Source: shulou.com Published: 2022-06-01 03:01:58 10月06日 Update

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!

Tags: Content articles value interests guys partners more knowledge industry information channels channels references help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Microsoft vpn Shulou Tech Info Linux