网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

zabbix_agent如何安装

这篇文章主要介绍zabbix_agent如何安装,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

成都创新互联公司服务项目包括临泉网站建设、临泉网站制作、临泉网页制作以及临泉网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,临泉网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到临泉省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!

一.install_zabbix_agent_centos5.sh

  1. #!/bin/bash

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

  3. grep zabbix_agent /etc/services > /dev/null

  4. stat1=$?

  5. if [ $stat1 -ne 0 ];then

  6. cat >> /etc/services <

  7. zabbix_agent 10050/tcp #Zabbix Agent

  8. zabbix_agent 10050/udp #Zabbix Agent

  9. zabbix_trapper 10051/tcp #Zabbix Trapper

  10. zabbix_trapper 10051/udp #Zabbix Trapper

  11. EOF

  12. fi

  13. cd /opt

  14. if [ -d "zabbix" ];then

  15. /etc/init.d/zabbix_agentd stop

  16. \mv zabbix /tmp

  17. fi

  18. tar zxvf zabbix-2.4.3_centos5.tar.gz

  19. mv /opt/zabbix-2.4.3 /opt/zabbix

  20. cp /opt/zabbix/zabbix_agentd /etc/init.d/

  21. cp /opt/zabbix/iostatcron /etc/cron.d/

  22. chown root:root /etc/cron.d/iostatcron

  23. chown root:root /etc/init.d/zabbix_agentd

  24. chmod a+x /etc/init.d/zabbix_agentd

  25. rpm -ivh /opt/zabbix/python-pika-0.9.5-3.el5.noarch.rpm

  26. id zabbix

  27. stat=$?

  28. if [ "$stat" -ne 0 ];then

  29. useradd zabbix

  30. chown -R zabbix:zabbix /opt/zabbix

  31. else

  32. chown -R zabbix:zabbix /opt/zabbix

  33. fi

  34. chmod a+x /opt/zabbix/sbin/*

  35. chmod a+x /opt/zabbix/bin/*

  36. chmod a+x /opt/zabbix/script/*

  37. cat /var/spool/cron/root | grep "discovery_port.sh" | grep -v grep > /dev/null

  38. stat1=$?

  39. if [ "$stat1" -ne 0 ];then

  40. echo "*/10 * * * * /opt/zabbix/script/discovery_port.sh > /dev/null 2>&1 &" >> /var/spool/cron/root

  41. fi

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

  43. stat2=$?

  44. if [ "$stat2" -ne 0 ];then

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

  46. fi

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

  48. stat_jstat=$?

  49. if [ "$stat_jstat" -ne 0 ];then

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

  51. fi

  52. #set hostname

  53. #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

  54. ad -n 1`

  55. 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

  56. `

  57. echo $ip

  58. sed -i 's/Hostname=.*/Hostname='${ip}_jgz'/g' /opt/zabbix/etc/zabbix_agentd.conf

  59. grep Hostname /opt/zabbix/etc/zabbix_agentd.conf

  60. /etc/init.d/zabbix_agentd start

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

  62. stat3=$?

  63. if [ "$stat3" -ne 0 ];then

  64. echo "/etc/init.d/zabbix_agentd start" >> /etc/rc.d/rc.local

  65. fi

二.install_zabbix_agent_centos6.sh

  1. #!/bin/bash

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

  3. grep zabbix_agent /etc/services > /dev/null

  4. stat1=$?

  5. if [ $stat1 -ne 0 ];then

  6. cat >> /etc/services <

  7. zabbix_agent 10050/tcp #Zabbix Agent

  8. zabbix_agent 10050/udp #Zabbix Agent

  9. zabbix_trapper 10051/tcp #Zabbix Trapper

  10. zabbix_trapper 10051/udp #Zabbix Trapper

  11. EOF

  12. fi

  13. cd /opt

  14. if [ -d "zabbix" ];then

  15. /etc/init.d/zabbix_agentd stop

  16. \mv zabbix /tmp

  17. fi

  18. tar zxvf zabbix-2.4.3_centos6.tar.gz

  19. mv /opt/zabbix-2.4.3 /opt/zabbix

  20. cp /opt/zabbix/zabbix_agentd /etc/init.d/

  21. cp /opt/zabbix/iostatcron /etc/cron.d/

  22. chown root:root /etc/cron.d/iostatcron

  23. chown root:root /etc/init.d/zabbix_agentd

  24. chmod a+x /etc/init.d/zabbix_agentd

  25. rpm -ivh /opt/zabbix/python-pika-0.9.5-2.el6.noarch.rpm

  26. id zabbix

  27. stat=$?

  28. if [ "$stat" -ne 0 ];then

  29. useradd zabbix

  30. chown -R zabbix:zabbix /opt/zabbix

  31. else

  32. chown -R zabbix:zabbix /opt/zabbix

  33. fi

  34. chmod a+x /opt/zabbix/sbin/*

  35. chmod a+x /opt/zabbix/bin/*

  36. chmod a+x /opt/zabbix/script/*

  37. cat /var/spool/cron/root | grep "discovery_port.sh" | grep -v grep > /dev/null

  38. stat1=$?

  39. if [ "$stat1" -ne 0 ];then

  40. echo "*/10 * * * * /opt/zabbix/script/discovery_port.sh > /dev/null 2>&1 &" >> /var/spool/cron/root

  41. fi

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

  43. stat2=$?

  44. if [ "$stat2" -ne 0 ];then

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

  46. fi

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

  48. stat_jstat=$?

  49. if [ "$stat_jstat" -ne 0 ];then

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

  51. fi

  52. #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

  53. ad -n 1`

  54. 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

  55. `

  56. echo $ip

  57. sed -i 's/Hostname=.*/Hostname='${ip}_jgz'/g' /opt/zabbix/etc/zabbix_agentd.conf

  58. grep Hostname /opt/zabbix/etc/zabbix_agentd.conf

  59. /etc/init.d/zabbix_agentd start

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

  61. stat3=$?

  62. if [ "$stat3" -ne 0 ];then

  63. echo "/etc/init.d/zabbix_agentd start" >> /etc/rc.d/rc.local

  64. fi

三.install_zabbix_agent_centos7.sh

  1. #!/bin/bash

  2. grep zabbix_agent /etc/services > /dev/null

  3. stat1=$?

  4. if [ $stat1 -ne 0 ];then

  5. cat >> /etc/services <

  6. zabbix_agent 10050/tcp #Zabbix Agent

  7. zabbix_agent 10050/udp #Zabbix Agent

  8. zabbix_trapper 10051/tcp #Zabbix Trapper

  9. zabbix_trapper 10051/udp #Zabbix Trapper

  10. EOF

  11. fi

  12. cd /opt

  13. if [ -d "zabbix" ];then

  14. /etc/init.d/zabbix_agentd stop

  15. \mv zabbix /tmp

  16. fi

  17. tar zxvf zabbix-2.4.3_centos7.tar.gz

  18. cd /opt/zabbix-2.4.3

  19. ./configure --prefix=/opt/zabbix --enable-agent

  20. make

  21. make install

  22. #mv /opt/zabbix-2.4.3 /opt/zabbix

  23. cp /opt/zabbix-2.4.3/zabbix_agentd /etc/init.d/

  24. cp /opt/zabbix-2.4.3/iostatcron /etc/cron.d/

  25. \cp /opt/zabbix-2.4.3/zabbix_agentd.conf /opt/zabbix/etc/

  26. cp -r /opt/zabbix-2.4.3/script /opt/zabbix/script

  27. mkdir /opt/zabbix/logs

  28. mkdir /opt/zabbix/var

  29. chown root:root /etc/cron.d/iostatcron

  30. chown root:root /etc/init.d/zabbix_agentd

  31. chmod a+x /etc/init.d/zabbix_agentd

  32. rpm -ivh python2-pika-0.10.0-3.el7.noarch.rpm

  33. id zabbix

  34. stat=$?

  35. if [ "$stat" -ne 0 ];then

  36. useradd zabbix

  37. chown -R zabbix:zabbix /opt/zabbix

  38. else

  39. chown -R zabbix:zabbix /opt/zabbix

  40. fi

  41. chmod a+x /opt/zabbix/sbin/*

  42. chmod a+x /opt/zabbix/bin/*

  43. chmod a+x /opt/zabbix/script/*

  44. cat /var/spool/cron/root | grep "discovery_port.sh" | grep -v grep > /dev/null

  45. stat1=$?

  46. if [ "$stat1" -ne 0 ];then

  47. echo "*/10 * * * * /opt/zabbix/script/discovery_port.sh > /dev/null 2>&1 &" >> /var/spool/cron/root

  48. fi

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

  50. stat2=$?

  51. if [ "$stat2" -ne 0 ];then

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

  53. fi

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

  55. stat_jstat=$?

  56. if [ "$stat_jstat" -ne 0 ];then

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

  58. fi

  59. #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

  60. ad -n 1`

  61. 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

  62. `

  63. echo $ip

  64. sed -i 's/Hostname=.*/Hostname='${ip}_jgz'/g' /opt/zabbix/etc/zabbix_agentd.conf

  65. grep Hostname /opt/zabbix/etc/zabbix_agentd.conf

  66. systemctl daemon-reload

  67. /etc/init.d/zabbix_agentd start

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

  69. stat3=$?

  70. if [ "$stat3" -ne 0 ];then

  71. echo "/etc/init.d/zabbix_agentd start" >> /etc/rc.d/rc.local

  72. fi

以上是“zabbix_agent如何安装”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!


新闻名称:zabbix_agent如何安装
标题路径:http://bjjierui.cn/article/giijee.html

其他资讯