cooperlees / monitord-exporter

Tell prometheus how happy your systemd is ! 😊
GNU General Public License v2.0
3 stars 1 forks source link

Non-compliant scrape target with prometheus 3.0.0 #47

Open cooperlees opened 2 days ago

cooperlees commented 2 days ago
Error scraping target: non-compliant scrape target sending blank Content-Type and no fallback_scrape_protocol specified for target

Need to workout and fix - Probably need to investigate prometheus_exporter crate here ...

Working vs. Non Working:

cooper@home1:~$ curl -v http://10.254.254.24:9342/metrics
*   Trying 10.254.254.24:9342...
* Connected to 10.254.254.24 (10.254.254.24) port 9342
> GET /metrics HTTP/1.1
> Host: 10.254.254.24:9342
> User-Agent: curl/8.5.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/plain; version=0.0.4; charset=utf-8; escaping=underscores
< Date: Tue, 19 Nov 2024 03:12:03 GMT
< Transfer-Encoding: chunked
<

----

cooper@home1:~$ curl -v http://[::1]:1/metrics
*   Trying [::1]:1...
* Connected to ::1 (::1) port 1
> GET /metrics HTTP/1.1
> Host: [::1]:1
> User-Agent: curl/8.5.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: tiny-http (Rust)
< Date: Tue, 19 Nov 2024 03:14:54 GMT
< Content-Length: 8719
cooperlees commented 21 hours ago

Making a tiny-http hello world server I get Context-Type:

+    let server = Server::http("0.0.0.0:8000").unwrap();
+
+    for request in server.incoming_requests() {
+        println!(
+            "received request! method: {:?}, url: {:?}, headers: {:?}",
+            request.method(),
+            request.url(),
+            request.headers()
+        );
+
+        let response = Response::from_string("hello world");
+        request.respond(response)?;
+    }
+
     Ok(())
 }
crl-m1:~ cooper$ curl -v http://127.0.0.1:8000/
*   Trying 127.0.0.1:8000...
* Connected to 127.0.0.1 (127.0.0.1) port 8000
> GET / HTTP/1.1
> Host: 127.0.0.1:8000
> User-Agent: curl/8.7.1
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 200 OK
< Server: tiny-http (Rust)
< Date: Tue, 19 Nov 2024 03:43:03 GMT
< Content-Type: text/plain; charset=UTF-8
< Content-Length: 11
<
* Connection #0 to host 127.0.0.1 left intact
hello world

So might have to open an issue and read the code for prometheus_exporter ...

cooperlees commented 20 hours ago

Workaround: Add a fallback_scrape_protocol

   - job_name: 'monitord-exporter'
     scrape_interval: 120s
+    fallback_scrape_protocol: 'PrometheusText0.0.4'
     static_configs:
       - targets:
         - auv6:1
cooperlees commented 20 hours ago

Have logged a bug with prometheues_exporter crate here: https://github.com/AlexanderThaller/prometheus_exporter/issues/44

Will see if we can work on a fix ...