编译安装(以centos为主)
环境准备
[root@zabbix-server ~]
'第一个历程:卸载系统中默认已有php程序(避免冲突)
[root@zabbix-server ~]
'第二个历程:优化下载源(为了下载php7 .1版本程序)
[root@zabbix-server ~]
[root@zabbix-server ~]
'第三个历程:下载php程序与相关组件包
[root@zabbix-server ~]
[root@zabbix-server ~]
编译安装Zabbix
[root@zabbix-server src]
[root@zabbix-server zabbix-4.0.49]
[root@zabbix-server zabbix-4.0.49]
准备数据库
[root@mysql-master ~]
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 268
Server version: 5.5.68-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database zabbix_server character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix_server.* to zabbix@"192.168.%.%" identified by 'zabbix123';
MariaDB [(none)]> FLUSH PRIVILEGES;
导入数据库
[root@zabbix-server ~]
[root@zabbix-server mysql]
[root@zabbix-server mysql]
[root@zabbix-server mysql]
修改zabbix配置文件
[root@zabbix-server ~]
......
DBHost=192.168.139.33
DBName=zabbix_server
DBUser=zabbix
DBPassword=zabbix123
DBPort=3306
.....
创建普通用户
[root@zabbix-server ~]
启动zabbix-server
[root@zabbix-server ~]
拷贝php程序
[root@zabbix-server ~]
启动httpd程序
[root@zabbix-server ~]
验证访问


2.4.11)编写php配置文件
[root@zabbix-server ~]
........
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = Asia/Shanghai
............
`重启httpd`
[root@zabbix-server ~]
"再次访问网址"

2.4.12)zabbix页面配置


[root@zabbix-server ~]
[root@zabbix-server conf]
[root@zabbix-server conf]
-rw-r--r-- 1 root root 456 Oct 24 14:36 zabbix.conf.php


2.4.13)zabbix server与agent启动文件:
2.4.13.1)zabbix server启动文件
[root@zabbix-server zabbix_server]
[Unit]
Description=Zabbix Server
After=syslog.target
After=network.target
[Service]
Environment="CONFFILE=/apps/zabbix_server/etc/zabbix_server.conf"
EnvironmentFile=-/usr/local/zabbix
Type=forking
PIDFile=/apps/zabbix_server/run/zabbix_server.pid
ExecStart=/apps/zabbix_server/sbin/zabbix_server -c /apps/zabbix_server/etc/zabbix_server.conf
ExecStop=/usr/bin/kill $MAINPID
Restart=always
RestartSec=5
User=zabbix
Group=zabbix
[Install]
WantedBy=multi-user.target
`创建目录run`
[root@zabbix-server ~]
`修改配置文件zabbix-server.conf的pid文件`
[root@zabbix-server ~]
.....
PidFile=/apps/zabbix_server/run/zabbix_server.pid
.....
`修改权限`
[root@zabbix-server ~]
`启动服务`
[root@zabbix-server ~]
[root@zabbix-server run]
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:10051 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 [::]:80 [::]:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 100 [::1]:25 [::]:*
2.4.13.2)zabbix agent启动文件
[root@zabbix-server ~]
[Unit]
Description=Zabbix Agent
After=syslog.target
After=network.target
[Service]
Environment="CONFFILE=/apps/zabbix_server/etc/zabbix_agentd.conf"
EnvironmentFile=-/usr/local/zabbix
Type=forking
PIDFile=/apps/zabbix_server/run/zabbix_agentd.pid
ExecStart=/apps/zabbix_server/sbin/zabbix_agentd -c /apps/zabbix_server/etc/zabbix_agentd.conf
ExecStop=/usr/bin/kill $MAINPID
Restart=always
RestartSec=5
User=zabbix
Group=zabbix
[Install]
WantedBy=multi-user.target
`创建目录run`
[root@zabbix-server ~]
`修改配置文件zabbix-agentd.conf的pid文件`
[root@zabbix-server ~]
.....
PidFile=/apps/zabbix_server/run/zabbix_agentd.pid
.....
`修改权限`
[root@zabbix-server ~]
`启动服务`
[root@zabbix-server ~]
文章评论