Giter VIP home page Giter VIP logo

zabbix-nginx-stats's Introduction

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):

  • Request Count
  • Request count by status code
  • Request Time: Average, Mean, Median, 90%, 80% and 25% lines
  • Upstream Response Time (Same as Request Time)
  • Body Bytes Sent: Average, Sum

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

  • logtail2 (debian: apt-get install logtail)
  • Perl
  • Statistics::Descriptive, Date::Parse and File::Temp
    • for debian: install packages libstatistics-descriptive-perl libtimedate-perl

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.

Screenshot Requests by Status

Changelog

  • 2013-07-15: Initial release

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.

Bitdeli Badge

zabbix-nginx-stats's People

Contributors

bitdeli-chef avatar ejimz avatar hpoul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zabbix-nginx-stats's Issues

Use of uninitialized value $value in addition

Hello,

I use the template to monitor Ngnix and get this error

Use of uninitialized value $value in addition (+) at /etc/zabbix/zabbix-nginx-stats/zabbix-nginx-stats.pl line 146, <> line 1.

Thank you for your help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.