Skip to content
This repository was archived by the owner on Nov 14, 2021. It is now read-only.

Python exception error #13

Description

@sheevaeva

Hello
I'm in the process of configuring ping exporter and the issue i'm facing is the metric values are not populated on Prometheus (metrics are available). If I access http://IP:8085/probe?prot=4&target=target_ip in the browser i see the values as below:

ping_avg 21.0
ping_max 21.9
ping_min 20.6
ping_loss 0

Prometheus config looks like this
'''

  • job_name: 'ping-exporter'
    scrape_interval: 60s
    metrics_path: /probe
    params:
    prot: ['4']
    static_configs:
    - targets:
    - target_ip
    relabel_configs:
    - source_labels: [address]
    target_label: __param_target
    - source_labels: [__param_target]
    target_label: instance
    - target_label: address
    replacement: Prom_IP:8085

'''
As i run the exporter I see below exception :

2019-09-21 09:44:29,097 root INFO /usr/bin/fping -4 -b 56 -i 1 -p 500 -q -c 10 Target_ip
client_ip - - [21/Sep/2019 09:44:33] "GET /probe?prot=4&target=target_ip HTTP/1.1" 200 -

Exception happened during processing of request from ('Prom_IP', 64464)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 596, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 652, in init
self.handle()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
self.handle_one_request()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
method()
File "/opt/ping-exporter.py", line 58, in do_GET
address = value['target'][0]
KeyError: 'target'

Would like to know why are the values not populating on Prometheus metrics. Kindly help!

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions