Code Monkey home page Code Monkey logo

healthd's Introduction

healthd

Checks system KPIs over HTTP listening on a UNIX domain socket

Installation

clone repository

https://github.com/jursonovicst/healthd.git

check python3

python3 --version
pip3 --version

install python dependencies

pip3 install -r requirements.txt

deploy as a unix service: copy heathd.service under /etc/systemd/system and start the service with systemct start healthd

HTTP api

The daemon can be accessed via HTTP over a unix domain socket:

http:///<path>?<kpi_name>=<kpi_limit>&<kpi_name>=<kpi_limit>...

The request <path> is ignored. The query string is parsed, and searched for the supported <kpi_name> and <kpi_limit>:

kpi_name Description unit expression
loadavg_1 system load 1 minute average - kpi < limit
loadavg_1 system load 5 minute average - kpi < limit
loadavg_15 system load 15 minute average - kpi < limit
cpu_idle CPU in IDLE state (over 1 second) percent kpi > limit
mem_free free memory byte kpi > limit
iface, tx interface name, interface transmit throughput string, bps kpi[iface] < limit

KPI expressions evaluations are combined with AND relation. If the results is true, the --ok-string is returned. The individual KPIs can also be returned with the --return-kpis argument.

Examples:

 ~ % curl  -v --unix-socket /tmp/healthd.sock 'http:/test?loadavg_1=100'
*   Trying /tmp/healthd.sock...
* Connected to test (/tmp/healthd.sock) port 80 (#0)
> GET /?loadavg_1=100 HTTP/1.1
> Host: test
> User-Agent: curl/7.64.1
> Accept: */*
> 
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: healthd/1.0
< Date: Mon, 23 Nov 2020 21:28:44 GMT
< Content-type: text/html
< Content-Length: 11
< 
* Closing connection 0
webisonline%                            
 ~ % curl  -v --unix-socket /tmp/healthd.sock 'http:/test?loadavg_1=0.6'
*   Trying /tmp/healthd.sock...
* Connected to test (/tmp/healthd.sock) port 80 (#0)
> GET /?loadavg_1=0.6 HTTP/1.1
> Host: test
> User-Agent: curl/7.64.1
> Accept: */*
> 
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: healthd/1.0
< Date: Mon, 23 Nov 2020 21:28:33 GMT
< Content-type: text/html
< Content-Length: 8
< 
* Closing connection 0
critical% 
 ~ %
```                                                                                                                                               jursonovicst@Tamas-MacBook-Pro ~ %  

healthd's People

Contributors

jursonovicst avatar

Watchers

 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.