svenstaro / site24x7_exporter

A Prometheus compatible exporter for site24x7.com
MIT License
17 stars 7 forks source link

Add support of REST API site24 monitors #338

Closed AlKapkone closed 6 months ago

AlKapkone commented 7 months ago

Hi, I tried this tool and it works. Thank you. But I have a question: What should I do if I want to monitor not only site24 website monitors but also REST API monitors? Because now I only get metrics from website monitors.

github issue
AlKapkone commented 7 months ago

Should this be enough? BTW, I'm sorry, I'm not a RUST developer at all.


    for monitor_maybe in monitors {
        let monitor_type = monitor_maybe.to_string();
        let monitor = match monitor_maybe {
            site24x7_types::MonitorMaybe::URL(m)
            | site24x7_types::MonitorMaybe::HOMEPAGE(m)
            | site24x7_types::MonitorMaybe::REALBROWSER(m) => m,
            MonitorMaybe::RESTAPI(m) => m, // Handle REST API monitor
            MonitorMaybe::Unknown => continue,
        };```
svenstaro commented 7 months ago

Maybe that's enough, I don't know. I haven't been using this for a long time as the client contract has ended. If you want to try your change, go right ahead. I also accept PRs.

AlKapkone commented 6 months ago

Unfortunately, after the latest release (https://github.com/svenstaro/site24x7_exporter/releases/tag/v1.1.0) something goes wrong.

10:39:41 [INFO] site24x7_exporter 1.1.0
10:39:41 [INFO] Using site24x7 endpoint: https://www.Eu/api
10:39:41 [INFO] Using Zoho endpoint: https://accounts.zoho.Eu
10:39:41 [INFO] Not using any proxies
10:39:41 [INFO] Requesting access token from https://accounts.zoho.Eu/oauth/v2/token
10:39:41 [INFO] Successfully acquired access token
10:39:56 [INFO] Serving metrics
10:39:56 [ERROR] An unexpected error occurred.
10:39:56 [ERROR] Other(Error during web request to fetch curent status.

Caused by:
    0: error sending request for url (https://www.eu/api/current_status)
    1: client error (Connect)
    2: tcp connect error: Connection refused (os error 111)
    3: Connection refused (os error 111))
10:39:58 [INFO] Serving metrics
10:39:58 [ERROR] An unexpected error occurred.
10:39:58 [ERROR] Other(Error during web request to fetch curent status.

Caused by:
    0: error sending request for url (https://www.eu/api/current_status)
    1: client error (Connect)
    2: tcp connect error: Connection refused (os error 111)
    3: Connection refused (os error 111))
svenstaro commented 6 months ago

I see the error. Fixing now and releasing as v1.1.1.