差異處
這裏顯示兩個版本的差異處。
兩邊的前次修訂版 前次修改 下次修改 | 前次修改 | ||
tech:zabbix:ngnix [2015/06/07 23:33] – jonathan | tech:zabbix:ngnix [2015/10/06 20:35] (目前版本) – [@nginx Server 設定程序] jonathan | ||
---|---|---|---|
行 1: | 行 1: | ||
+ | ====== nginx 納入 Zabbix 監控 ====== | ||
+ | |||
+ | ===== @nginx Server 設定程序 ===== | ||
+ | * 設定 nginx 提供狀態頁面< | ||
+ | vi / | ||
+ | : | ||
+ | location / { | ||
+ | root / | ||
+ | index index.html index.htm; | ||
+ | } | ||
+ | |||
+ | location / | ||
+ | stub_status on; | ||
+ | access_log | ||
+ | allow 127.0.0.1; | ||
+ | deny all; | ||
+ | } | ||
+ | |||
+ | # | ||
+ | : | ||
+ | </ | ||
+ | service nginx restart | ||
+ | curl http:// | ||
+ | Active connections: | ||
+ | server accepts handled requests | ||
+ | 3 3 3 | ||
+ | Reading: 0 Writing: 1 Waiting: 0 | ||
+ | </ | ||
+ | * 設定 Zabbix Agent Script< | ||
+ | cd / | ||
+ | wget https:// | ||
+ | chmod a+x zbx_nginx_stats.py | ||
+ | vi zbx_nginx_stats.py</ | ||
+ | : | ||
+ | zabbix_host = ' | ||
+ | zabbix_port = 10051 # Zabbix server port | ||
+ | hostname = ' | ||
+ | time_delta = 1 # grep interval in minutes | ||
+ | |||
+ | # URL to nginx stat (http_stub_status_module) | ||
+ | stat_url = ' | ||
+ | |||
+ | # Nginx log file path | ||
+ | nginx_log_file_path = '/ | ||
+ | |||
+ | # Optional Basic Auth | ||
+ | username = ' | ||
+ | password = ' | ||
+ | : | ||
+ | </ | ||
+ | vi / | ||
+ | : | ||
+ | # zabbix nginx | ||
+ | * * * * * root / | ||
+ | </ | ||
+ | service crond restart | ||
+ | </ | ||
+ | |||
+ | ===== @Zabbix Server 設定程序 ===== | ||
+ | * 至 https:// | ||
+ | * 將 zbx_nginx_templates.xml 匯入至 Zabbix Server → Configuration → Templates → Import | ||
+ | |||
+ | ===== 參考網址 ===== | ||
+ | * https:// | ||
+ | |||
+ | {{tag> | ||