zabbix是一个基于WEB界面的提供分布式网络监视功能的企业级的开源解决方案。相对于cacti和nagios而言,zabbix最大的特点是分布式监控,自动发现,自定义监控项目。
1、数据采集
zabbix采集数据的手段有SNMP、zabbix的Agent、IPMI agent、web monitoring、database monitoring,Internal check、calculated monitoring、custom command monitoring、ping或端口检查等。
2、数据存储
zabbix将数据存储在RDBMS中。
3、数据展示
zabbix使用php开发的程序进行绘图。
4、事件报警
zabbix通知机制有:E-mail、SMS、Jabber、Chat message、Command execution。
zabbix-serve:负责接收agent发送的报告信息,所有配置、统计数据及操作数据都有此组件组织进行;
database:用于存储配置信息和zabbix收集的数据
web-interface:zabbix的GUI接口,通常与server运行在同一台主机上;
proxy:可选组件,常用于分布式监控环境中,代替server收集其他被监控端的监控数据,并统一发送到server端。
Agent:部署在被监控主机上,负责收集本地数据发往server或proxy端。
主机(host):要监控的网络设备统称;
主机组(host group):主机的逻辑容器,可以包含主机和模板;
监控项(item):一个特定监控指标和对应的数据,每个item由key进行标示;
trigger(触发器):一个表达式,用于评估某监控对象的某个特定的item所接收的数据是否在合理范围内,即阈值,状态分为“OK”和“problem”。
事件(event):发生的一个值得关注的事情,如:触发器的状态转变,新的agent上线或自动发现等操作。
动作:对于指定的event发生以后所采定义的处理方法,如发送通知或报警;
报警升级(escalation):发送警告信息的方案,如果在定义内的警告次数之内没有处理,将向上级发送报警短信;
媒介(media):发送通知的手段,如Email、SMS、Jabber等。
通知(notification):通过媒介向用户发送某事件的信息。
说明:此脚本只适用与RHEL6.x系列;Nginx版本为1.6最新稳定版;PHP为5.4最新版;Mysql为5.5最新稳定版;Zabbix暂时为2.4最新版。
只要你能连上网络,只要你会运行脚本。那你就会完成zabbix的部署安装了,内嵌yum源及LNMP及zabbix的下载安装!!真正的实现一步到位!!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | #!/bin/bash # install Nginx 1.6.2 + mysql5.5.x + PHP-FPM 5.4.x + Zabbix 2.4.4 automatically. # Tested on CentOS 6.5 ############################################## # 变量 ############################################## err_echo(){ echo -e "e[91m[Error]: $1 33[0m" exit 1 } info_echo(){ echo -e "e[92m[Info]: $1 33[0m" } warn_echo(){ echo -e "e[93m[Warning]: $1 33[0m" } check_exit(){ if [ $? -ne 0 ]; then err_echo "$1" exit1 fi } ############################################## # check ############################################## if [ $EUID -ne 0 ]; then err_echo "please run this script as root user." exit 1 fi if [ "$(awk '{if ( $3 >= 6.0 ) print "CentOS 6.x"}' /etc/redhat-release 2>/dev/null)" != "CentOS 6.x" ];then err_echo "This script is used for RHEL/CentOS 6.x only." fi ############################################## # Useradd deploy nginx程序运行账号 ############################################## info_echo "Useradd deploy" useradd deploy ############################################## # yum repo ############################################## info_echo "配置yum源......" if [ ! -f LNMP+zabbix.repo ]; then cat> /etc/yum.repos.d/LNMP+zabbix.repo <<'EOF' [nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/6/$basearch/ gpgcheck=0 enabled=1 [webtatic] name=Webtatic Repository EL6 - $basearch #baseurl=http://repo.webtatic.com/yum/el6/$basearch/ mirrorlist=http://mirror.webtatic.com/yum/el6/$basearch/mirrorlist failovermethod=priority enabled=0 gpgcheck=0 [epel] name=Extra Packages for Enterprise Linux 6 - $basearch baseurl=http://mirrors.aliyun.com/epel/6/$basearch http://mirrors.aliyuncs.com/epel/6/$basearch #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch failovermethod=priority enabled=1 gpgcheck=0 [remi] name=Les RPM de remi pour Enterprise Linux 6 - $basearch #baseurl=http://rpms.famillecollet.com/enterprise/6/remi/$basearch/ mirrorlist=http://rpms.famillecollet.com/enterprise/6/remi/mirror enabled=1 gpgcheck=0 [zabbix] name=Zabbix Official Repository-$basearch baseurl=http://repo.zabbix.com/zabbix/2.4/rhel/6/$basearch/ enabled=1 gpgcheck=0 [zabbix-non-supported] name=Zabbix Official Repository non-supported-$basearch baseurl=http://repo.zabbix.com/non-supported/rhel/6/$basearch/ enabled=1 gpgcheck=0 EOF fi ############################################## # Install nginx+Mysql+PHP+zabbix ############################################## info_echo "Install nginx+Mysql+PHP+zabbix......" yum -y install nginx php php-fpm php-cli php-common php-gd php-mbstring php-mcrypt php-mysql php-pdo php-devel php-imagick php-xmlrpc php-xml php-bcmath php-dba php-enchant php-yaf mysql mysql-server zabbix zabbix-get zabbix-agent zabbix-server-mysql zabbix-web-mysql zabbix-server check_exit "Failed to install Nginx/Mysql/PHP/Zabbix!" ######################################### # Nginx ######################################### info_echo "Nginx 配置文件更新 ...." if [ -f /etc/nginx/nginx.conf ]; then mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak cat> /etc/nginx/nginx.conf <<'EOF' user deploy; worker_processes 2; pid /var/run/nginx.pid; worker_rlimit_nofile 65535; events { worker_connections 65535; use epoll; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; server_tokens off; client_header_buffer_size 4k; open_file_cache max=65535 inactive=60s; open_file_cache_valid 80s; open_file_cache_min_uses 1; server_names_hash_bucket_size 64; server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## gzip on; gzip_disable "msie6"; gzip_min_length 1k; gzip_buffers 4 16k; gzip_comp_level 2; gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; ## # nginx-naxsi config ## # Uncomment it if you installed nginx-naxsi ## #include /etc/nginx/naxsi_core.rules; ## # nginx-passenger config ## # Uncomment it if you installed nginx-passenger ## #passenger_root /usr; #passenger_ruby /usr/bin/ruby; ## # Virtual Host Configs ## log_format main '$server_name $remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for" ' '$ssl_protocol $ssl_cipher $upstream_addr $request_time $upstream_response_time'; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*.conf; } EOF fi sed -i "/worker_processes/cworker_processes $( grep "processor" /proc/cpuinfo| wc -l );" /etc/nginx/nginx.conf info_echo "zabbix 配置文件添加" cat> /etc/nginx/conf.d/zabbix.conf <<'EOF' server{ listen 80; server_name _; index index.php; root /data/web/zabbix; location ~* .(js|css|png|jpg|jpeg|gif|ico)$ { expires 30d; } location ~* .php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } EOF mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak /etc/init.d/nginx restart ######################################### # Zabbix ######################################### info_echo "Downloading zabbix Web...." info_echo "创建网站目录..." mkdir -p /data/web/zabbix info_echo "Downloading..." if [ ! -f /tmp/zabbix.tar.gz ]; then cd /tmp && wget -O zabbix.tar.gz 'http://sourceforge.net/projects/zabbix/files/latest/download?source=files' fi info_echo "解压安装文件..." cd /tmp && tar -zxvf /tmp/zabbix.tar.gz check_exit "failed to extract zabbix frontend" ZABBIX_DIR=`ls /tmp/|grep zabbix-` mv /tmp/${ZABBIX_DIR}/frontends/php/* /data/web/zabbix/ chown -R deploy.deploy /data/web/zabbix ############################################## # Database ############################################## info_echo "Mysql配置文件更新..." sed -i '/^socket/iport = 3306' /etc/my.cnf sed -i '/^socket/askip-external-lockingnkey_buffer_size = 256Mnmax_allowed_packet = 1Mntable_open_cache = 256nsort_buffer_size = 1Mnread_buffer_size = 1Mnread_rnd_buffer_size = 4Mnmyisam_sort_buffer_size = 64Mnthread_cache_size = 8nquery_cache_size= 16Mnthread_concurrency = 4ncharacter-set-server=utf8ninnodb_file_per_table=1' /etc/my.cnf info_echo "Restart mysql ..." /etc/init.d/mysqld start info_echo "Create Databases..." mysql -e 'CREATE DATABASE `zabbix` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;' mysql -e "GRANT ALL PRIVILEGES on *.* to zabbix@'localhost' IDENTIFIED BY 'zabbix';" mysql -e "flush privileges" info_echo "配置zabbix的数据库项" sed -i '/DBPassword=/aDBPassword=zabbix' /etc/zabbix/zabbix_server.conf info_echo "importing schema.sql" mysql -uzabbix -pzabbix zabbix < $(rpm -ql zabbix-server-mysql|grep schema.sql) check_exit "failed to import schema.sql" info_echo "importing images.sql" mysql -uzabbix -pzabbix zabbix < $(rpm -ql zabbix-server-mysql| grep images.sql) check_exit "failed to import images.sql" info_echo "importing data.sql" mysql -uzabbix -pzabbix zabbix < $(rpm -ql zabbix-server-mysql|grep data.sql) check_exit "failed to import data.sql" ######################################### # PHP-FPM ######################################### info_echo "更新/etc/php.ini,www.conf ..." sed -i '/^;default_charset/adefault_charset = "UTF-8"' /etc/php.ini sed -i '/^expose_php/cexpose_php = Off' /etc/php.ini sed -i '/^max_execution_time/cmax_execution_time = 300' /etc/php.ini sed -i '/^max_input_time/cmax_input_time = 300' /etc/php.ini sed -i '/^memory_limit/cmemory_limit = 256M' /etc/php.ini sed -i '/^post_max_size/cpost_max_size = 32M' /etc/php.ini sed -i '/^upload_max_filesize/cupload_max_filesize = 300M' /etc/php.ini sed -i '/^max_file_uploads/cmax_file_uploads = 30' /etc/php.ini sed -i '/^;date.timezone/cdate.timezone = "PRC"' /etc/php.ini sed -i 's/apache/deploy/g' /etc/php-fpm.d/www.conf chown deploy.deploy -R /var/lib/php info_echo "Checking php-fpm configuration file..." /etc/init.d/php-fpm configtest check_exit "PHP-FPM configuration syntax error" info_echo "Restart PHP-FPM ..." /etc/init.d/php-fpm restart info_echo "Restart Zabbix Server ..." /etc/init.d/zabbix-server restart info_echo "Restart Zabbix Agent ..." /etc/init.d/zabbix-agent restart ######################################### # Chkconfig ######################################### chkconfig nginx on chkconfig php-fpm on chkconfig mysqld on chkconfig zabbix-agent on chkconfig zabbix-server on |
地址:IP地址
至此zabbix一键部署安装就完成了,请多提意见!谢谢
zabbix是一个基于WEB界面的提供分布式网络监视功能的企业级的开源解决方案。相对于cacti和nagios而言,zabbix最大的特点是分布式监控,自动发现,自定义监控项目。
1、数据采集
zabbix采集数据的手段有SNMP、zabbix的Agent、IPMI agent、web monitoring、database monitoring,Internal check、calculated monitoring、custom command monitoring、ping或端口检查等。
2、数据存储
zabbix将数据存储在RDBMS中。
3、数据展示
zabbix使用php开发的程序进行绘图。
4、事件报警
zabbix通知机制有:E-mail、SMS、Jabber、Chat message、Command execution。
zabbix-serve:负责接收agent发送的报告信息,所有配置、统计数据及操作数据都有此组件组织进行;
database:用于存储配置信息和zabbix收集的数据
web-interface:zabbix的GUI接口,通常与server运行在同一台主机上;
proxy:可选组件,常用于分布式监控环境中,代替server收集其他被监控端的监控数据,并统一发送到server端。
Agent:部署在被监控主机上,负责收集本地数据发往server或proxy端。
主机(host):要监控的网络设备统称;
主机组(host group):主机的逻辑容器,可以包含主机和模板;
监控项(item):一个特定监控指标和对应的数据,每个item由key进行标示;
trigger(触发器):一个表达式,用于评估某监控对象的某个特定的item所接收的数据是否在合理范围内,即阈值,状态分为“OK”和“problem”。
事件(event):发生的一个值得关注的事情,如:触发器的状态转变,新的agent上线或自动发现等操作。
动作:对于指定的event发生以后所采定义的处理方法,如发送通知或报警;
报警升级(escalation):发送警告信息的方案,如果在定义内的警告次数之内没有处理,将向上级发送报警短信;
媒介(media):发送通知的手段,如Email、SMS、Jabber等。
通知(notification):通过媒介向用户发送某事件的信息。
说明:此脚本只适用与RHEL6.x系列;Nginx版本为1.6最新稳定版;PHP为5.4最新版;Mysql为5.5最新稳定版;Zabbix暂时为2.4最新版。
只要你能连上网络,只要你会运行脚本。那你就会完成zabbix的部署安装了,内嵌yum源及LNMP及zabbix的下载安装!!真正的实现一步到位!!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | #!/bin/bash # install Nginx 1.6.2 + mysql5.5.x + PHP-FPM 5.4.x + Zabbix 2.4.4 automatically. # Tested on CentOS 6.5 ############################################## # 变量 ############################################## err_echo(){ echo -e "e[91m[Error]: $1 33[0m" exit 1 } info_echo(){ echo -e "e[92m[Info]: $1 33[0m" } warn_echo(){ echo -e "e[93m[Warning]: $1 33[0m" } check_exit(){ if [ $? -ne 0 ]; then err_echo "$1" exit1 fi } ############################################## # check ############################################## if [ $EUID -ne 0 ]; then err_echo "please run this script as root user." exit 1 fi if [ "$(awk '{if ( $3 >= 6.0 ) print "CentOS 6.x"}' /etc/redhat-release 2>/dev/null)" != "CentOS 6.x" ];then err_echo "This script is used for RHEL/CentOS 6.x only." fi ############################################## # Useradd deploy nginx程序运行账号 ############################################## info_echo "Useradd deploy" useradd deploy ############################################## # yum repo ############################################## info_echo "配置yum源......" if [ ! -f LNMP+zabbix.repo ]; then cat> /etc/yum.repos.d/LNMP+zabbix.repo <<'EOF' [nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/6/$basearch/ gpgcheck=0 enabled=1 [webtatic] name=Webtatic Repository EL6 - $basearch #baseurl=http://repo.webtatic.com/yum/el6/$basearch/ mirrorlist=http://mirror.webtatic.com/yum/el6/$basearch/mirrorlist failovermethod=priority enabled=0 gpgcheck=0 [epel] name=Extra Packages for Enterprise Linux 6 - $basearch baseurl=http://mirrors.aliyun.com/epel/6/$basearch http://mirrors.aliyuncs.com/epel/6/$basearch #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch failovermethod=priority enabled=1 gpgcheck=0 [remi] name=Les RPM de remi pour Enterprise Linux 6 - $basearch #baseurl=http://rpms.famillecollet.com/enterprise/6/remi/$basearch/ mirrorlist=http://rpms.famillecollet.com/enterprise/6/remi/mirror enabled=1 gpgcheck=0 [zabbix] name=Zabbix Official Repository-$basearch baseurl=http://repo.zabbix.com/zabbix/2.4/rhel/6/$basearch/ enabled=1 gpgcheck=0 [zabbix-non-supported] name=Zabbix Official Repository non-supported-$basearch baseurl=http://repo.zabbix.com/non-supported/rhel/6/$basearch/ enabled=1 gpgcheck=0 EOF fi ############################################## # Install nginx+Mysql+PHP+zabbix ############################################## info_echo "Install nginx+Mysql+PHP+zabbix......" yum -y install nginx php php-fpm php-cli php-common php-gd php-mbstring php-mcrypt php-mysql php-pdo php-devel php-imagick php-xmlrpc php-xml php-bcmath php-dba php-enchant php-yaf mysql mysql-server zabbix zabbix-get zabbix-agent zabbix-server-mysql zabbix-web-mysql zabbix-server check_exit "Failed to install Nginx/Mysql/PHP/Zabbix!" ######################################### # Nginx ######################################### info_echo "Nginx 配置文件更新 ...." if [ -f /etc/nginx/nginx.conf ]; then mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak cat> /etc/nginx/nginx.conf <<'EOF' user deploy; worker_processes 2; pid /var/run/nginx.pid; worker_rlimit_nofile 65535; events { worker_connections 65535; use epoll; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; server_tokens off; client_header_buffer_size 4k; open_file_cache max=65535 inactive=60s; open_file_cache_valid 80s; open_file_cache_min_uses 1; server_names_hash_bucket_size 64; server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## gzip on; gzip_disable "msie6"; gzip_min_length 1k; gzip_buffers 4 16k; gzip_comp_level 2; gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; ## # nginx-naxsi config ## # Uncomment it if you installed nginx-naxsi ## #include /etc/nginx/naxsi_core.rules; ## # nginx-passenger config ## # Uncomment it if you installed nginx-passenger ## #passenger_root /usr; #passenger_ruby /usr/bin/ruby; ## # Virtual Host Configs ## log_format main '$server_name $remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for" ' '$ssl_protocol $ssl_cipher $upstream_addr $request_time $upstream_response_time'; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*.conf; } EOF fi sed -i "/worker_processes/cworker_processes $( grep "processor" /proc/cpuinfo| wc -l );" /etc/nginx/nginx.conf info_echo "zabbix 配置文件添加" cat> /etc/nginx/conf.d/zabbix.conf <<'EOF' server{ listen 80; server_name _; index index.php; root /data/web/zabbix; location ~* .(js|css|png|jpg|jpeg|gif|ico)$ { expires 30d; } location ~* .php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } EOF mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak /etc/init.d/nginx restart ######################################### # Zabbix ######################################### info_echo "Downloading zabbix Web...." info_echo "创建网站目录..." mkdir -p /data/web/zabbix info_echo "Downloading..." if [ ! -f /tmp/zabbix.tar.gz ]; then cd /tmp && wget -O zabbix.tar.gz 'http://sourceforge.net/projects/zabbix/files/latest/download?source=files' fi info_echo "解压安装文件..." cd /tmp && tar -zxvf /tmp/zabbix.tar.gz check_exit "failed to extract zabbix frontend" ZABBIX_DIR=`ls /tmp/|grep zabbix-` mv /tmp/${ZABBIX_DIR}/frontends/php/* /data/web/zabbix/ chown -R deploy.deploy /data/web/zabbix ############################################## # Database ############################################## info_echo "Mysql配置文件更新..." sed -i '/^socket/iport = 3306' /etc/my.cnf sed -i '/^socket/askip-external-lockingnkey_buffer_size = 256Mnmax_allowed_packet = 1Mntable_open_cache = 256nsort_buffer_size = 1Mnread_buffer_size = 1Mnread_rnd_buffer_size = 4Mnmyisam_sort_buffer_size = 64Mnthread_cache_size = 8nquery_cache_size= 16Mnthread_concurrency = 4ncharacter-set-server=utf8ninnodb_file_per_table=1' /etc/my.cnf info_echo "Restart mysql ..." /etc/init.d/mysqld start info_echo "Create Databases..." mysql -e 'CREATE DATABASE `zabbix` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;' mysql -e "GRANT ALL PRIVILEGES on *.* to zabbix@'localhost' IDENTIFIED BY 'zabbix';" mysql -e "flush privileges" info_echo "配置zabbix的数据库项" sed -i '/DBPassword=/aDBPassword=zabbix' /etc/zabbix/zabbix_server.conf info_echo "importing schema.sql" mysql -uzabbix -pzabbix zabbix < $(rpm -ql zabbix-server-mysql|grep schema.sql) check_exit "failed to import schema.sql" info_echo "importing images.sql" mysql -uzabbix -pzabbix zabbix < $(rpm -ql zabbix-server-mysql| grep images.sql) check_exit "failed to import images.sql" info_echo "importing data.sql" mysql -uzabbix -pzabbix zabbix < $(rpm -ql zabbix-server-mysql|grep data.sql) check_exit "failed to import data.sql" ######################################### # PHP-FPM ######################################### info_echo "更新/etc/php.ini,www.conf ..." sed -i '/^;default_charset/adefault_charset = "UTF-8"' /etc/php.ini sed -i '/^expose_php/cexpose_php = Off' /etc/php.ini sed -i '/^max_execution_time/cmax_execution_time = 300' /etc/php.ini sed -i '/^max_input_time/cmax_input_time = 300' /etc/php.ini sed -i '/^memory_limit/cmemory_limit = 256M' /etc/php.ini sed -i '/^post_max_size/cpost_max_size = 32M' /etc/php.ini sed -i '/^upload_max_filesize/cupload_max_filesize = 300M' /etc/php.ini sed -i '/^max_file_uploads/cmax_file_uploads = 30' /etc/php.ini sed -i '/^;date.timezone/cdate.timezone = "PRC"' /etc/php.ini sed -i 's/apache/deploy/g' /etc/php-fpm.d/www.conf chown deploy.deploy -R /var/lib/php info_echo "Checking php-fpm configuration file..." /etc/init.d/php-fpm configtest check_exit "PHP-FPM configuration syntax error" info_echo "Restart PHP-FPM ..." /etc/init.d/php-fpm restart info_echo "Restart Zabbix Server ..." /etc/init.d/zabbix-server restart info_echo "Restart Zabbix Agent ..." /etc/init.d/zabbix-agent restart ######################################### # Chkconfig ######################################### chkconfig nginx on chkconfig php-fpm on chkconfig mysqld on chkconfig zabbix-agent on chkconfig zabbix-server on |
地址:IP地址
至此zabbix一键部署安装就完成了,请多提意见!谢谢
如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!
赞1
添加新评论0 条评论