Code Monkey home page Code Monkey logo

hap-monitor's Introduction

HAP-Monitor

Requests HAProxy statistics and reports them to a Graphite/NodeJS backend. This version of the script is intedend to be executed as a cronjob.

A script doing the same, but runs as a daemon was created by P. Roberts and can be found here: https://github.com/phillipbroberts/HAP-Monitor

Purpose

A simple Python script requesting the statistics of several HAProxies (http://www.haproxy.org/) and reports them into Graphite (http://graphite.wikidot.com/).

Dependencies

In order to report data to Graphite, the Python module py-statsd is used. The source code can be found here at GitHub in the repository https://github.com/sivy/py-statsd.git. Installation instructions are given in according README.md file.

Configuration

The script is configured solely by CLI argumets.

usage: hap-monitor-cron.py [-h] [--backend B] [--sockets S [S ...]] [--verbose]

optional arguments:
  -h, --help           show this help message and exit
  --backend B          Graphite server URL[:port][::scope] to which the script will report to. E.g. --backend graphite.host:8025::my.system.stats.haproxy
  --type T             Type of the backend server. Supported values are: G (Graphite) and S (statsd)
  --sockets S [S ...]  a list of socket files e.g. /var/run/haproxy_admin_process_no_1.sock
  --verbose            makes it chatty

To execute it in the desired interval define a cronjob on the host running HAProxy. For example, we want collect data with one minute intervall:

*/1 * * * * python /usr/local/bin/hap-monitor.py --backend graphite.host:8025::my.system.stats.haproxy --type G --sockets /var/run/haproxy_admin_process_no_1.sock /var/run/haproxy_admin_process_no_2.sock

Also note, that the example above assumes HAProxy running two processes reproting iwhich conequently report into two distinct sockets.

License

Copyright European Organization for Nuclear Research (CERN)

Licensed under the Apache License, Version 2.0 (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

hap-monitor's People

Contributors

vigne avatar

Watchers

 avatar  avatar

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.