Site icon Flutter Packages | Pub dev Packages – Flutter Mobile App World

Simple access log parsing for zabbix

zabbix-nginx-stats

Simple script to import basic nginx statistics into zabbix. It parses the log file (currently only supports one basic format) and pushes the data into zabbix. It is written in perl with a small bash wrapper script which uses logtail.

Synced values include (all since last execution):

The default zabbix template has preconfigured triggers to warn on 5 errors (status code 500, 503 and 403) and graphs for request time and request count by status.

Installation/Configuration:

checkout from github

install dependencies

configure logfile output:

     log_format timed_combined '$remote_addr $host $remote_user [$time_local]  '
                '"$request" $status $body_bytes_sent '
                '"$http_referer" "$http_user_agent" $request_time $upstream_response_time $pipe';
                
     access_log /var/log/nginx/access.log timed_combined;

Import template zbx_template_nginx.xml

configure crontab to run every 10 minutes:

8-59/10 * * * *   root      /home/scripts/zabbix-nginx-stats/zabbix-nginx-stats-runner.sh

watch results coming in.

Changelog

Roadmap

Allow pushing to multiple zabbix hosts – If you are using nginx as proxy in front of various applications it should be possible to filter these applications to get separated statistics.

Download zabbix nginx stats source code on GitHub

https://github.com/hpoul/zabbix-nginx-stats

Exit mobile version
Skip to toolbar