一、zabbix使用nginx做web服务器
yum nginx装好,默认的default.conf文件直接backup掉,新建一个zabbx.conf文件,
如果有报错看下nginx_log 日志排错。
1、安装nginx
[root@server1 ~]# cd /etc/nginx/
[root@server1 nginx]# ls
conf.d koi-utf mime.types scgi_params win-utf
fastcgi_params koi-win nginx.conf uwsgi_params
[root@server1 nginx]# cd conf.d/
[root@server1 conf.d]# ls
default.conf example_ssl.conf
[root@server1 conf.d]# vim default.conf
location /status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
[root@server1 conf.d]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@server1 conf.d]# nginx
[root@server1 conf.d]# nginx -s reload
2、网页访问:
3、shell测试:
4、配置 zabbix nginx 文件 。
[root@server1 nginx]# cd /etc/zabbix/
[root@server1 zabbix]# ls
zabbix_agentd.conf zabbix_agentd.d
[root@server1 zabbix]# cd zabbix_agentd.d/
[root@server1 zabbix_agentd.d]# ls
userparameter_mysql.conf
[root@server1 zabbix_agentd.d]# cp userparameter_mysql.conf userparameter_nginx.conf
[root@server1 zabbix_agentd.d]# vim userparameter_nginx.conf
[root@server1 zabbix_agentd.d]# /etc/init.d/zabbix-agent restart
Shutting down Zabbix agent: [FAILED]
Starting Zabbix agent: [ OK ]
5、 zabbix 主机 开启服务 :
[root@localhost ~]# systemctl start mariadb
[root@localhost ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@localhost ~]# systemctl start zabbix-server
[root@localhost ~]# systemctl enable zabbix-server
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
[root@localhost ~]# systemctl start zabbix-agent
[root@localhost ~]# systemctl enable zabbix-agent
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agen