Giter Site home page Giter Site logo

lekpamartin / uptimerobot_exporter Goto Github PK

View Code? Open in Web Editor NEW
45.0 4.0 22.0 408 KB

Expose uptimerobot.com metrics for prometheus and visualize it in Grafana

License: Apache License 2.0

Dockerfile 1.98% Python 78.27% Shell 19.75%
grafana grafana-dashboard prometheus exporter docker docker-image docker-compose dockerfile uptimerobot

uptimerobot_exporter's People

Contributors

lekpamartin avatar lululombard avatar martinhell avatar x4e-jonas avatar ypid-work 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

uptimerobot_exporter's Issues

Cannot read property 'result' of undefined

Hey! :)

Tried setting this up but having a slight issue with the dashboard side of things.

I know Grafana can get the data as the query inspector shows the result, but I'm unaware why it's not displaying it in the graph.

Thanks

leverage 'logs' feature of getMonitors?

One challenge with using this to alert on outages is that polling the API will fail when there is an internet outage, and we generally won't have a record of it because we are only capturing the 'current state' of the monitors.

It would be great if we could leverage the logs feature of the getMonitors endpoint to capture past or missed outages.

There is an example implementation of this approach in a javascript solution which leverages influxdb instead of prometheus.

Is such a thing even possible with prometheus style metrics collection? It would be great if we could persist outage information as well as the other metrics.

Adding License?

Hi,

Could a license be added to this repository? Right now we can't use this code because of it missing a license.

exception on GET request

I tried to get the exporter up & running but on datasource creation (save & test) in prometheus i get an exception:
I'm using the "lekpamartin/uptimerobot_exporter:latest" image.


Exception happened during processing of request from ('172.30.0.7', 57568)
Traceback (most recent call last):
File "/usr/local/lib/python3.8/socketserver.py", line 316, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/local/lib/python3.8/socketserver.py", line 347, in process_request
self.finish_request(request, client_address)
File "/usr/local/lib/python3.8/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/lib/python3.8/socketserver.py", line 720, in init
self.handle()
File "/usr/local/lib/python3.8/http/server.py", line 426, in handle
self.handle_one_request()
File "/usr/local/lib/python3.8/http/server.py", line 414, in handle_one_request
method()
File "/exporter.py", line 112, in do_GET
answer = fetch_data(api_key)
File "/exporter.py", line 27, in fetch_data
return req.json()
File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

172.30.0.7 - - [20/Nov/2019 16:00:13] code 501, message Unsupported method ('POST')
172.30.0.7 - - [20/Nov/2019 16:00:13] "POST /api/v1/query HTTP/1.1" 501 -
172.30.0.7 - - [20/Nov/2019 16:00:14] code 501, message Unsupported method ('POST')
172.30.0.7 - - [20/Nov/2019 16:00:14] "POST /api/v1/query HTTP/1.1" 501 -

The POST request seems fine, so i thought my config is right.

uptimerobot_exporter crashes when in uptimerobots i have more than one monitor

Hey lekpamartin,

I have problem when I have more monitored pages, when i have one domain in uptimerobot it works fine:

127.0.0.1 - - [23/Jan/2020 21:19:35] "GET /metrics HTTP/1.1" 200 -
127.0.0.1 - - [23/Jan/2020 21:19:49] "GET /metrics HTTP/1.1" 200 -
127.0.0.1 - - [23/Jan/2020 21:20:04] "GET /metrics HTTP/1.1" 200 -
127.0.0.1 - - [23/Jan/2020 21:20:19] "GET /metrics HTTP/1.1" 200 -
127.0.0.1 - - [23/Jan/2020 21:20:34] "GET /metrics HTTP/1.1" 200 -
127.0.0.1 - - [23/Jan/2020 21:20:49] "GET /metrics HTTP/1.1" 200 -
127.0.0.1 - - [23/Jan/2020 21:21:05] "GET /metrics HTTP/1.1" 200 -
127.0.0.1 - - [23/Jan/2020 21:21:19] "GET /metrics HTTP/1.1" 200 -
127.0.0.1 - - [23/Jan/2020 21:21:34] "GET /metrics HTTP/1.1" 200 -
127.0.0.1 - - [23/Jan/2020 21:21:49] "GET /metrics HTTP/1.1" 200 -
127.0.0.1 - - [23/Jan/2020 21:22:04] "GET /metrics HTTP/1.1" 200 -
127.0.0.1 - - [23/Jan/2020 21:22:19] "GET /metrics HTTP/1.1" 200 -
127.0.0.1 - - [23/Jan/2020 21:22:34] "GET /metrics HTTP/1.1" 200 -
127.0.0.1 - - [23/Jan/2020 21:22:49] "GET /metrics HTTP/1.1" 200 -
127.0.0.1 - - [23/Jan/2020 21:23:04] "GET /metrics HTTP/1.1" 200 -
127.0.0.1 - - [23/Jan/2020 21:23:19] "GET /metrics HTTP/1.1" 200 -
127.0.0.1 - - [23/Jan/2020 21:23:34] "GET /metrics HTTP/1.1" 200 -
127.0.0.1 - - [23/Jan/2020 21:23:49] "GET /metrics HTTP/1.1" 200 -
127.0.0.1 - - [23/Jan/2020 21:24:04] "GET /metrics HTTP/1.1" 200 -

but when it adds more monitors the python script crashes:

Exception happened during processing of request from ('127.0.0.1', 57420)
Traceback (most recent call last):
  File "/usr/lib64/python2.7/SocketServer.py", line 295, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib64/python2.7/SocketServer.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib64/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib64/python2.7/SocketServer.py", line 649, in __init__
    self.handle()
  File "/usr/lib64/python2.7/BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "/usr/lib64/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
    method()
  File "/usr/bin/uptimerobot_exporter", line 121, in do_GET
    format_prometheus(answer.get('monitors')).encode('utf-8')
  File "/usr/bin/uptimerobot_exporter", line 59, in format_prometheus
    item.get('response_times').pop().get('value'),
IndexError: pop from empty list

Grafana Dashboard Not Loading Data

I have all the parts of this working up to the dashboard itself.

I can see my data in Prometheus but when I setup the dashboard it is just blank.

Screenshot 2024-04-04 at 4 34 36 PM

Running on ARM

Trying to run this on a raspberry Pi 4 and I get this error when checking my docker logs. Has anyone got this running on an ARM based CPU?

pi@raspberrypi:~ $ sudo docker logs bfec5389915c
standard_init_linux.go:211: exec user process caused "exec format error"
standard_init_linux.go:211: exec user process caused "exec format error"
standard_init_linux.go:211: exec user process caused "exec format error"

Exception occurred during processing of request

Attaching to uptimerobot_exporter
uptimerobot_exporter    | 192.168.2.2 - - [23/Sep/2021 12:58:00] "GET / HTTP/1.1" 200 -
uptimerobot_exporter    | 192.168.2.2 - - [23/Sep/2021 12:58:02] "GET /favicon.ico HTTP/1.1" 200 -
uptimerobot_exporter    | ----------------------------------------
uptimerobot_exporter    | Exception occurred during processing of request from ('192.168.2.2', 65068)
uptimerobot_exporter    | Traceback (most recent call last):
uptimerobot_exporter    |   File "/usr/local/lib/python3.9/socketserver.py", line 316, in _handle_request_noblock
uptimerobot_exporter    |     self.process_request(request, client_address)
uptimerobot_exporter    |   File "/usr/local/lib/python3.9/socketserver.py", line 347, in process_request
uptimerobot_exporter    |     self.finish_request(request, client_address)
uptimerobot_exporter    |   File "/usr/local/lib/python3.9/socketserver.py", line 360, in finish_request
uptimerobot_exporter    |     self.RequestHandlerClass(request, client_address, self)
uptimerobot_exporter    |   File "/usr/local/lib/python3.9/socketserver.py", line 747, in __init__
uptimerobot_exporter    |     self.handle()
uptimerobot_exporter    |   File "/usr/local/lib/python3.9/http/server.py", line 427, in handle
uptimerobot_exporter    |     self.handle_one_request()
uptimerobot_exporter    |   File "/usr/local/lib/python3.9/http/server.py", line 415, in handle_one_request
uptimerobot_exporter    |     method()
uptimerobot_exporter    |   File "/exporter.py", line 127, in do_GET
uptimerobot_exporter    |     accountdetails = fetch_accountdetails(api_key)
uptimerobot_exporter    |   File "/exporter.py", line 87, in fetch_accountdetails
uptimerobot_exporter    |     return req.json()
uptimerobot_exporter    |   File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 910, in json
uptimerobot_exporter    |     return complexjson.loads(self.text, **kwargs)
uptimerobot_exporter    |   File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
uptimerobot_exporter    |     return _default_decoder.decode(s)
uptimerobot_exporter    |   File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
uptimerobot_exporter    |     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
uptimerobot_exporter    |   File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode
uptimerobot_exporter    |     raise JSONDecodeError("Expecting value", s, err.value) from None
uptimerobot_exporter    | json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
uptimerobot_exporter    | ----------------------------------------

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.