nicolaslm / sauna Goto Github PK
View Code? Open in Web Editor NEWLightweight daemon that runs and reports health checks
Home Page: https://sauna.readthedocs.io
License: BSD 2-Clause "Simplified" License
Lightweight daemon that runs and reports health checks
Home Page: https://sauna.readthedocs.io
License: BSD 2-Clause "Simplified" License
When plugin or consumer dependencies are not installed, sauna prints a message and exits. Sometimes however it prints the message and does not exit, it just hangs, waiting for a ^C:
root@a7864fef64e6:/# sauna
HTTPConsumer depends on requests. It can be installed with:
pip install requests
apt-get install python3-requests
Memory depends on psutil. It can be installed with:
pip install psutil
apt-get install python3-psutil
^CException ignored in: <module 'threading' from '/usr/lib/python3.4/threading.py'>
Traceback (most recent call last):
File "/usr/lib/python3.4/threading.py", line 1294, in _shutdown
t.join()
File "/usr/lib/python3.4/threading.py", line 1060, in join
self._wait_for_tstate_lock()
File "/usr/lib/python3.4/threading.py", line 1076, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt
It must be a race condition somewhere.
The documentation built with Sphinx does not provide the list of plugins and consumers available.
It would make sense to generate this list together with the specificities of each plugin.
To improve HTTP request performance, you should avoid re-opening a new HTTP session each time (or at least add an option to make this configurable). With requests
, instead of calling requests.request
, you could create a Session
object and keep it open for each call.
I was wondering how to implement alerts based on a PostgreSQL query.
My need here is to trigger a critical status if I have an entry older than XXX in my database.
Would a PostgresSQL plugin with custom query support be relevant ?
Or is it too specific, and I should use the command
plugin ?
Hi,
Could you publish the current version on pypi? The last version dates from august.
Thanks
Judging by the code, I don't see the possibility to set the headers and the payload/body in HTTP and HTTP-JSON plugins.
Sauna is extremely useful for monitoring hosts with OVH Shinken as a Service. It is installed on each host or VM that is monitored.
If installing it is easy thanks to the .deb, upgrading it on each and every monitored host is a real pain.
Would it be possible to offer a PPA (Personal Package Archive) for Sauna ? (so that upgrades would be done automatically)
Nose is unmaintained and py.test is awesome.
It's possible to release new version with dashboard ?
I tried to run sauna with the latest docker image (and the latest commit from master) and I can't get it to start with concurrency: 1
---
periodicity: 10
concurrency: 1
hostname: dev-timothee
consumers:
# Listen on a TCP port and serve results to incoming connections
- type: TCPServer
port: 55555
# Just prints checks on the standard output
- type: Stdout
# HTTP Server that exposes sauna status as a REST API
- type: HTTPServer
port: 8088
plugins:
# Fake checks that return the provided
# status and output
- type: Dummy
checks:
- type: dummy
status: 0
output: Everything is alright
$ sauna --level debug
2017/01/09 15:55:42 - INFO - Running checks with interval: {10}
2017/01/09 15:55:42 - DEBUG - Running consumer TCPServer
2017/01/09 15:55:42 - DEBUG - Scheduler has 1 ticks, each one is 10 seconds
2017/01/09 15:55:42 - DEBUG - Tick 0, scheduled [<Job launch_and_publish_checks_with_periodicity every 10 seconds>]
2017/01/09 15:55:42 - DEBUG - Pushing to consumers: dummy_dummy
Exception in thread producer:
Traceback (most recent call last):
File "/home/admin/.pyenv/versions/3.5.2/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/home/admin/.pyenv/versions/3.5.2/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/home/admin/dev/sauna/sauna/__init__.py", line 331, in run_producer
for _ in scheduler:
File "/home/admin/dev/sauna/sauna/scheduler.py", line 54, in __next__
job()
File "/home/admin/dev/sauna/sauna/scheduler.py", line 97, in __call__
self.func(*self.func_args, **self.func_kwargs)
File "/home/admin/dev/sauna/sauna/__init__.py", line 291, in launch_and_publish_checks_with_periodicity
self._check_helper(check)
File "/home/admin/dev/sauna/sauna/__init__.py", line 302, in _check_helper
self._current_checks.remove(service_check.name)
ValueError: list.remove(x): x not in list
2017/01/09 15:55:42 - DEBUG - [StdoutConsumer] Got check ServiceCheck(timestamp=1483977342, hostname='dev-timothee', name='dummy_dummy', status=0, output='Everything is alright')
ServiceCheck(timestamp=1483977342, hostname='dev-timothee', name='dummy_dummy', status=0, output='Everything is alright')
2017/01/09 15:55:42 - DEBUG - Running consumer Stdout
2017/01/09 15:55:42 - DEBUG - Running consumer HTTPServer
2017/01/09 15:55:42 - INFO - Exiting...
2017/01/09 15:55:42 - INFO - [StdoutConsumer] Check sent
2017/01/09 15:55:42 - DEBUG - [StdoutConsumer] Exited consumer thread
2017/01/09 15:55:43 - DEBUG - [HTTPServerConsumer] Exited consumer thread
2017/01/09 15:55:43 - DEBUG - [TCPServerConsumer] Exited consumer thread
2017/01/09 15:55:43 - DEBUG - Exited main thread
It's seems to be related to this line :
https://github.com/NicolasLM/sauna/blob/master/sauna/__init__.py#L300
Check if the service is in the _current_check list before trying to remove it
with self._current_checks_lock:
if service_check.name in self._current_checks:
self._current_checks.remove(service_check.name)
It seems to work
select
can only handle processes with less than 1024 file descriptors. The default selector usually do not use select
but more modern alternatives that don't have this arbitrary limitation.
Hi,
I'm using the plugin http-json to expect the integer value 0 as a result after json extraction.
- type: HTTP-JSON
checks:
- type: request
name: check_1234
url: http://<check_endpoint>
verify_ca_crt: false
method: GET
code: 200
expect: "0"
success_jsonpath: '$.value'
error_jsonpath: '$..*'
timeout: 5000
warn: 1000
crit: 5000
The <check_endpoint> returns the json response: {value:0}
.
sauna fails with the error: expected string or buffer
.
See: https://github.com/NicolasLM/sauna/blob/master/sauna/plugins/ext/http_json.py#L54
The value parameter given to regex.match must be a string or a buffer.
I think a fix could be to force the string conversion?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.