Shell Road--zabbix Automatic deployment

Source: Internet
Author: User
Tags curl snmp tru64

#!/bin/bash

#auto Install Zabbix

#by Max 2017


zabbix_soft= "Zabbix-2.0.6.tar.gz"

Install_dir= "/usr/local/zabbix/"

server_ip= "192.168.0.100"

ip= ' Ifconfig|grep Bcast|awk ' {print $} ' |sed ' s/addr://g '


Server_install () {

Yum-y Install Curl Curl-devel net-snmp net-snmp-devel perl-dbi

Groupadd Zabbix

Useradd-g Zabbix zabbix;usermod-s/sbin/nologin Zabbix


TAR-XZF $ZABBIX _soft

CD ' Echo $ZABBIX _soft|sed ' s/.tar.*//g '

./configure--prefix=/usr/local/zabbix--enable-server--enable-agent--with-mysql--enable-ipv6--WITH-NET-SNMP-- With-libcurl &&make Install

If [$?-eq 0];then

Ln-s/usr/local/zabbix/sbin/zabbix_*/usr/local/sbin/

Fi


CD-

CD zabbix-2.0.6

CP Misc/init.d/tru64/{zabbix_agentd,zabbix_server}/etc/init.d/

chmod o+x/etc/init.d/zabbix_*

Mkdir-p/var/www/html/zabbix/

Cp-a frontends/php/*/var/www/html/zabbix/


#config Zabbix Server

Cat > $INSTALL _dir/etc/zabbix_server.conf<<eof

Logfile=/tmp/zabbix_server.log

Dbhost=localhost

Dbname=zabbix

Dbuser=zabbix

dbpassword=123456

Eof

#config Zabbix Agentd

Cat > $INSTALL _dir/etc/zabbix_agentd.conf<<eof

Logfile=/tmp/zabbix_agentd.log

server= $SERVER _ip

Serveractive= $SERVER _ip

Hostname = $IP

Eof


#start Zabbix Agentd

/etc/init.d/zabbix_server restart

/etc/init.d/zabbix_agentd restart

/etc/init.d/iptables stop

Setenforce 0

}


Agent_install () {

Yum-y Install Curl Curl-devel net-snmp net-snmp-devel perl-dbi

Groupadd Zabbix

Useradd-g Zabbix zabbix;usermod-s/sbin/nologin Zabbix


TAR-XZF $ZABBIX _soft

CD ' Echo $ZABBIX _soft|sed ' s/.tar.*//g '

./configure--prefix=/usr/local/zabbix--enable-agent&&make Install

If [$?-eq 0];then

Ln-s/usr/local/zabbix/sbin/zabbix_*/usr/local/sbin/

Fi


CD-

CD zabbix-2.0.6

CP Misc/init.d/tru64/zabbix_agentd/etc/init.d/zabbix_agentd

chmod O+x/etc/init.d/zabbix_agentd


#config Zabbix Agentd

Cat > $INSTALL _dir/etc/zabbix_agentd.conf<<eof

Logfile=/tmp/zabbix_agentd.log

server= $SERVER _ip

Serveractive= $SERVER _ip

Hostname = $IP

Eof


#start Zabbix Agentd

/etc/init.d/zabbix_agentd restart

/etc/init.d/iptables stop

Setenforce 0

}


Read-p "Confirm whether to install Zabbix server,yes or no? [y/n] The INPUT

if [$INPUT = = "Y"];then

Server_install

Else

Agent_install

Fi


Shell Road--zabbix Automatic deployment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.