Comments (6)
By default, the config file has access to all the functions in the streams namespace. However, prometheus-batch
is defined in the prometheus namespace, which is not automatically included.
Try adding this to your configuration:
(require '[riemann.prometheus :refer :all])
from riemann.
Hi @jarpy,
Thank you for the answer, it works but I met another error when send to prometheus pushgateway.
riemann.conf
[root@centos riemann]# cat /etc/riemann/riemann.config
; -*- mode: clojure; -*-
; vim: filetype=clojure
(require '[riemann.prometheus :refer :all])
(logging/init {:file "/var/log/riemann/riemann.log"})
; Listen on the local interface over TCP (5555), UDP (5555), and websockets
; (5556)
(let [host "127.0.0.1"]
(tcp-server {:host host})
(udp-server {:host host})
(ws-server {:host host}))
; Expire old events from the index every 5 seconds.
(periodically-expire 5)
(let [index (index)]
; Inbound events will be passed to these streams:
(streams
(default :ttl 60
(batch 1000 5 (prometheus-batch {:host "infradev-prometheuspushgateway"
:port 9091
:job "test"
}))
; Index all events immediately.
index
; Log expired events.
(expired
(fn [event] (info "expired" event))))))
Start Riemann
[root@centos riemann]# java -cp /usr/lib/riemann/riemann.jar: riemann.bin start /etc/riemann/riemann.config
INFO [2021-01-15 03:30:50,337] main - riemann.bin - Loading /etc/riemann/riemann.config
INFO [2021-01-15 03:30:50,348] main - riemann.bin - PID 535
INFO [2021-01-15 03:30:50,507] clojure-agent-send-off-pool-1 - riemann.transport.websockets - Websockets server 127.0.0.1 5556 online
INFO [2021-01-15 03:30:50,754] clojure-agent-send-off-pool-2 - riemann.transport.udp - UDP server 127.0.0.1 5555 16384 -1 online
INFO [2021-01-15 03:30:50,778] clojure-agent-send-off-pool-3 - riemann.transport.tcp - TCP server 127.0.0.1 5555 online
INFO [2021-01-15 03:30:50,779] main - riemann.core - Hyperspace core online
WARN [2021-01-15 03:31:05,661] riemann task 3 - riemann.streams - riemann.prometheus$prometheus_batch$fn__13326@f8917d3 threw
clojure.lang.ExceptionInfo: clj-http: status 400 {:cached nil, :request-time 123, :repeatable? false, :protocol-version {:name "HTTP", :major 1, :minor 1}, :streaming? true, :http-client #object[org.apache.http.impl.client.Intern
alHttpClient 0x102c3608 "org.apache.http.impl.client.InternalHttpClient@102c3608"], :chunked? false, :reason-phrase "Bad Request", :headers {"Content-Type" "text/plain; charset=utf-8", "X-Content-Type-Options" "nosniff", "Date" "
Fri, 15 Jan 2021 03:31:05 GMT", "Content-Length" "85", "Connection" "close"}, :orig-content-encoding nil, :status 400, :length 85, :body "text format parsing error in line 1: expected '\"' at start of label value, found 'c'\n", :
trace-redirects []}
at slingshot.support$stack_trace.invoke(support.clj:201)
at clj_http.client$exceptions_response.invokeStatic(client.clj:252)
at clj_http.client$exceptions_response.invoke(client.clj:244)
at clj_http.client$wrap_exceptions$fn__2988.invoke(client.clj:262)
at clj_http.client$wrap_accept$fn__3194.invoke(client.clj:734)
at clj_http.client$wrap_accept_encoding$fn__3201.invoke(client.clj:756)
at clj_http.client$wrap_content_type$fn__3188.invoke(client.clj:717)
at clj_http.client$wrap_form_params$fn__3287.invoke(client.clj:958)
at clj_http.client$wrap_nested_params$fn__3308.invoke(client.clj:992)
at clj_http.client$wrap_flatten_nested_params$fn__3317.invoke(client.clj:1016)
at clj_http.client$wrap_method$fn__3255.invoke(client.clj:892)
at clj_http.cookies$wrap_cookies$fn__404.invoke(cookies.clj:131)
at clj_http.links$wrap_links$fn__1531.invoke(links.clj:63)
at clj_http.client$wrap_unknown_host$fn__3325.invoke(client.clj:1045)
at clj_http.client$request_STAR_.invokeStatic(client.clj:1173)
at clj_http.client$request_STAR_.invoke(client.clj:1166)
at clj_http.client$post.invokeStatic(client.clj:1191)
at clj_http.client$post.doInvoke(client.clj:1187)
at clojure.lang.RestFn.invoke(RestFn.java:423)
at riemann.prometheus$post_datapoint.invokeStatic(prometheus.clj:116)
at riemann.prometheus$post_datapoint.invoke(prometheus.clj:108)
at riemann.prometheus$prometheus_batch$fn__13326.invoke(prometheus.clj:170)
at riemann.streams$batch$flush__8589$fn__8607.invoke(streams.clj:1185)
at riemann.streams$batch$flush__8589.invoke(streams.clj:1185)
at riemann.streams$part_time_simple$tick__7713.invoke(streams.clj:633)
at riemann.time.Once.run(time.clj:42)
at riemann.time$run_tasks_BANG_$fn__5393$fn__5394.invoke(time.clj:154)
at riemann.time$run_tasks_BANG_$fn__5393.invoke(time.clj:153)
at riemann.time$run_tasks_BANG_.invokeStatic(time.clj:147)
at riemann.time$run_tasks_BANG_.invoke(time.clj:142)
at riemann.time$start_BANG_$fn__5413$fn__5414.invoke(time.clj:193)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invokeStatic(core.clj:657)
at clojure.core$with_bindings_STAR_.invokeStatic(core.clj:1965)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1965)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invokeStatic(core.clj:661)
at clojure.core$bound_fn_STAR_$fn__5471.doInvoke(core.clj:1995)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.run(AFn.java:22)
at java.lang.Thread.run(Thread.java:748)
WARN [2021-01-15 03:31:15,473] riemann task 3 - riemann.streams - riemann.prometheus$prometheus_batch$fn__13326@f8917d3 threw
clojure.lang.ExceptionInfo: clj-http: status 400 {:cached nil, :request-time 3, :repeatable? false, :protocol-version {:name "HTTP", :major 1, :minor 1}, :streaming? true, :http-client #object[org.apache.http.impl.client.Internal
HttpClient 0x4e398f55 "org.apache.http.impl.client.InternalHttpClient@4e398f55"], :chunked? false, :reason-phrase "Bad Request", :headers {"Content-Type" "text/plain; charset=utf-8", "X-Content-Type-Options" "nosniff", "Date" "Fr
i, 15 Jan 2021 03:31:15 GMT", "Content-Length" "85", "Connection" "close"}, :orig-content-encoding nil, :status 400, :length 85, :body "text format parsing error in line 1: expected '\"' at start of label value, found 'c'\n", :tr
ace-redirects []}
at slingshot.support$stack_trace.invoke(support.clj:201)
at clj_http.client$exceptions_response.invokeStatic(client.clj:252)
at clj_http.client$exceptions_response.invoke(client.clj:244)
at clj_http.client$wrap_exceptions$fn__2988.invoke(client.clj:262)
at clj_http.client$wrap_accept$fn__3194.invoke(client.clj:734)
at clj_http.client$wrap_accept_encoding$fn__3201.invoke(client.clj:756)
at clj_http.client$wrap_content_type$fn__3188.invoke(client.clj:717)
at clj_http.client$wrap_form_params$fn__3287.invoke(client.clj:958)
at clj_http.client$wrap_nested_params$fn__3308.invoke(client.clj:992)
at clj_http.client$wrap_flatten_nested_params$fn__3317.invoke(client.clj:1016)
at clj_http.client$wrap_method$fn__3255.invoke(client.clj:892)
at clj_http.cookies$wrap_cookies$fn__404.invoke(cookies.clj:131)
at clj_http.links$wrap_links$fn__1531.invoke(links.clj:63)
at clj_http.client$wrap_unknown_host$fn__3325.invoke(client.clj:1045)
at clj_http.client$request_STAR_.invokeStatic(client.clj:1173)
at clj_http.client$request_STAR_.invoke(client.clj:1166)
at clj_http.client$post.invokeStatic(client.clj:1191)
at clj_http.client$post.doInvoke(client.clj:1187)
at clojure.lang.RestFn.invoke(RestFn.java:423)
at riemann.prometheus$post_datapoint.invokeStatic(prometheus.clj:116)
at riemann.prometheus$post_datapoint.invoke(prometheus.clj:108)
at riemann.prometheus$prometheus_batch$fn__13326.invoke(prometheus.clj:170)
at riemann.streams$batch$flush__8589$fn__8607.invoke(streams.clj:1185)
at riemann.streams$batch$flush__8589.invoke(streams.clj:1185)
at riemann.streams$part_time_simple$tick__7713.invoke(streams.clj:633)
at riemann.time.Once.run(time.clj:42)
at riemann.time$run_tasks_BANG_$fn__5393$fn__5394.invoke(time.clj:154)
at riemann.time$run_tasks_BANG_$fn__5393.invoke(time.clj:153)
at riemann.time$run_tasks_BANG_.invokeStatic(time.clj:147)
at riemann.time$run_tasks_BANG_.invoke(time.clj:142)
at riemann.time$start_BANG_$fn__5413$fn__5414.invoke(time.clj:193)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invokeStatic(core.clj:657)
at clojure.core$with_bindings_STAR_.invokeStatic(core.clj:1965)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1965)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invokeStatic(core.clj:661)
at clojure.core$bound_fn_STAR_$fn__5471.doInvoke(core.clj:1995)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.run(AFn.java:22)
at java.lang.Thread.run(Thread.java:748)
WARN [2021-01-15 03:31:25,468] riemann task 2 - riemann.streams - riemann.prometheus$prometheus_batch$fn__13326@f8917d3 threw
clojure.lang.ExceptionInfo: clj-http: status 400 {:cached nil, :request-time 4, :repeatable? false, :protocol-version {:name "HTTP", :major 1, :minor 1}, :streaming? true, :http-client #object[org.apache.http.impl.client.Internal
HttpClient 0x166413ee "org.apache.http.impl.client.InternalHttpClient@166413ee"], :chunked? false, :reason-phrase "Bad Request", :headers {"Content-Type" "text/plain; charset=utf-8", "X-Content-Type-Options" "nosniff", "Date" "Fr
i, 15 Jan 2021 03:31:25 GMT", "Content-Length" "85", "Connection" "close"}, :orig-content-encoding nil, :status 400, :length 85, :body "text format parsing error in line 1: expected '\"' at start of label value, found 'c'\n", :tr
ace-redirects []}
at slingshot.support$stack_trace.invoke(support.clj:201)
at clj_http.client$exceptions_response.invokeStatic(client.clj:252)
at clj_http.client$exceptions_response.invoke(client.clj:244)
at clj_http.client$wrap_exceptions$fn__2988.invoke(client.clj:262)
at clj_http.client$wrap_accept$fn__3194.invoke(client.clj:734)
at clj_http.client$wrap_accept_encoding$fn__3201.invoke(client.clj:756)
at clj_http.client$wrap_content_type$fn__3188.invoke(client.clj:717)
at clj_http.client$wrap_form_params$fn__3287.invoke(client.clj:958)
at clj_http.client$wrap_nested_params$fn__3308.invoke(client.clj:992)
at clj_http.client$wrap_flatten_nested_params$fn__3317.invoke(client.clj:1016)
at clj_http.client$wrap_method$fn__3255.invoke(client.clj:892)
at clj_http.cookies$wrap_cookies$fn__404.invoke(cookies.clj:131)
at clj_http.links$wrap_links$fn__1531.invoke(links.clj:63)
at clj_http.client$wrap_unknown_host$fn__3325.invoke(client.clj:1045)
at clj_http.client$request_STAR_.invokeStatic(client.clj:1173)
at clj_http.client$request_STAR_.invoke(client.clj:1166)
at clj_http.client$post.invokeStatic(client.clj:1191)
at clj_http.client$post.doInvoke(client.clj:1187)
at clojure.lang.RestFn.invoke(RestFn.java:423)
at riemann.prometheus$post_datapoint.invokeStatic(prometheus.clj:116)
at riemann.prometheus$post_datapoint.invoke(prometheus.clj:108)
at riemann.prometheus$prometheus_batch$fn__13326.invoke(prometheus.clj:170)
at riemann.streams$batch$flush__8589$fn__8607.invoke(streams.clj:1185)
at riemann.streams$batch$flush__8589.invoke(streams.clj:1185)
at riemann.streams$part_time_simple$tick__7713.invoke(streams.clj:633)
at riemann.time.Once.run(time.clj:42)
at riemann.time$run_tasks_BANG_$fn__5393$fn__5394.invoke(time.clj:154)
at riemann.time$run_tasks_BANG_$fn__5393.invoke(time.clj:153)
at riemann.time$run_tasks_BANG_.invokeStatic(time.clj:147)
at riemann.time$run_tasks_BANG_.invoke(time.clj:142)
at riemann.time$start_BANG_$fn__5413$fn__5414.invoke(time.clj:193)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invokeStatic(core.clj:657)
at clojure.core$with_bindings_STAR_.invokeStatic(core.clj:1965)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1965)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invokeStatic(core.clj:661)
at clojure.core$bound_fn_STAR_$fn__5471.doInvoke(core.clj:1995)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.run(AFn.java:22)
at java.lang.Thread.run(Thread.java:748)
Prometheus pushgateway works fine
[root@centos riemann]# curl http://infradev-prometheuspushgateway:9091
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex,nofollow">
<title>Prometheus Pushgateway</title>
<link rel="shortcut icon" href="/static/favicon.ico?v=c28992c985ce6c4fcf4247ba9736b72a3d43882f">
<script src="/static/jquery-3.5.1.min.js?v=c28992c985ce6c4fcf4247ba9736b72a3d43882f"></script>
<script src="/static/bootstrap-4.3.1-dist/js/bootstrap.min.js?v=c28992c985ce6c4fcf4247ba9736b72a3d43882f"></script>
<script src="/static/functions.js?v=c28992c985ce6c4fcf4247ba9736b72a3d43882f"></script>
<link type="text/css" rel="stylesheet" href="/static/bootstrap-4.3.1-dist/css/bootstrap.min.css?v=c28992c985ce6c4fcf4247ba9736b72a3d43882f">
<link type="text/css" rel="stylesheet" href="/static/prometheus.css?v=c28992c985ce6c4fcf4247ba9736b72a3d43882f">
<link type="text/css" rel="stylesheet" href="/static/bootstrap4-glyphicons/css/bootstrap-glyphicons.min.css?v=c28992c985ce6c4fcf4247ba9736b72a3d43882f">
</head>
<body>
<nav class="navbar fixed-top navbar-expand-sm navbar-dark bg-dark">
<div class="container-fluid">
<button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#nav-content" aria-expanded="false" aria-controls="nav-content" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Pushgateway</a>
<div id="nav-content" class="navbar-collapse collapse">
<ul class="navbar-nav">
<li class="nav-item active" onclick="pushgateway.switchToMetrics()" id="metrics-li">
<a class="nav-link" href="#">Metrics</a>
</li>
<li class="nav-item" onclick="pushgateway.switchToStatus()" id="status-li">
<a class="nav-link" href="#">Status</a>
</li>
<li class="nav-item" >
<a class ="nav-link" href="https://github.com/prometheus/pushgateway/blob/master/README.md" target="_blank">Help</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container-fluid" id="metrics-div">
<div class="blank-card">
<button class="btn btn-xs btn-danger float-right disabled" onclick="pushgateway.showDelAllModal()" id="del-all">Delete All <span class="badge badge-warning" id="del-all-counter">0</span> Groups</button>
</div>
<div class="accordion" id="job-accordion">
</div>
</div>
<div class="container-fluid" id="status-div" style="display: none;">
<h2>Runtime Information</h2>
<table class="table table-condensed table-bordered table-striped">
<tbody>
<tr>
<th>Started</th>
<td>2021-01-15 02:58:52.751890303 +0000 UTC m=+0.012294356</td>
</tr>
</tbody>
</table>
<h2>Build Information</h2>
<table class="table table-condensed table-bordered table-striped">
<tbody>
<tr>
<th scope="row">branch</th>
<td>HEAD</td>
</tr>
<tr>
<th scope="row">buildDate</th>
<td>20201001-12:03:34</td>
</tr>
<tr>
<th scope="row">buildUser</th>
<td>root@cf69166ae53e</td>
</tr>
<tr>
<th scope="row">goVersion</th>
<td>go1.15.2</td>
</tr>
<tr>
<th scope="row">revision</th>
<td>c28992c985ce6c4fcf4247ba9736b72a3d43882f</td>
</tr>
<tr>
<th scope="row">version</th>
<td>1.3.0</td>
</tr>
</tbody>
</table>
<h2>Startup Flags</h2>
<table class="table table-condensed table-bordered table-striped">
<tbody>
<tr>
<th scope="row">log.format</th>
<td>logfmt</td>
</tr>
<tr>
<th scope="row">log.level</th>
<td>info</td>
</tr>
<tr>
<th scope="row">persistence.file</th>
<td></td>
</tr>
<tr>
<th scope="row">persistence.interval</th>
<td>5m0s</td>
</tr>
<tr>
<th scope="row">push.disable-consistency-check</th>
<td>false</td>
</tr>
<tr>
<th scope="row">web.enable-admin-api</th>
<td>true</td>
</tr>
<tr>
<th scope="row">web.enable-lifecycle</th>
<td>false</td>
</tr>
<tr>
<th scope="row">web.external-url</th>
<td></td>
</tr>
<tr>
<th scope="row">web.listen-address</th>
<td>:9091</td>
</tr>
<tr>
<th scope="row">web.route-prefix</th>
<td></td>
</tr>
<tr>
<th scope="row">web.telemetry-path</th>
<td>/metrics</td>
</tr>
</tbody>
</table>
</div>
<div id="del-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="del-header" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Deletion Confirmation</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p id="del-modal-msg"></p>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button class="btn btn-primary btn-danger" onclick="pushgateway.deleteGroup()">Delete</button>
</div>
</div>
</div>
</div>
<div id="del-all-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="del-header" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Deletion Confirmation</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p id="del-modal-all-msg"></p>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button class="btn btn-primary btn-danger" onclick="pushgateway.deleteAllGroup()">Delete All</button>
</div>
</div>
</div>
</div>
</body>
</html>
from riemann.
I'm afraid I'm not familiar with the Prometheus code. I'm just a user trying to help where I can :).
Judging by the commit history, perhaps @yershalom would be able to comment if they have time.
from riemann.
Hi @jarpy,
It's ok, also thank you again.
from riemann.
Does it work without batch (by using (prometheus {...})
)?
from riemann.
Please re-open if you still have issues.
from riemann.
Related Issues (20)
- Slack notifications do not work with new slack app webhooks
- Which versions of riemann, if any, are susceptible to log4shell (log4j vulnerability)? HOT 1
- Docker image builds switched architecture HOT 2
- Store the events for riemann in an external database HOT 3
- functions using riemann.folds/count drops suddenly on high load HOT 2
- Logback needs update to 1.2.10 HOT 1
- [influxdb.clj] SSLSocketfactory not supported on JDK 9+ HOT 1
- Netty executor queue size is infinite resulting in GC pressure / OOM HOT 4
- Has 0.3.8 been retagged? HOT 1
- "Interrupted consumption" from riemann.kafka and it never recovers HOT 3
- `-XX:-StackTraceInThrowable` causes a index out of bounds exception HOT 1
- amazonica throws RuntimeException on jdk 17/18
- Expired events sometimes have the `:time` field set to a value of type `Ratio` HOT 2
- `influxdb2` keeps accumulating background threads HOT 3
- Riemann becomes unresponsive when CPU Count count is increased HOT 9
- "Throttle" is not working as expected HOT 5
- Query of `riemann streams rate` & instrumentation HOT 1
- Update to Clojure 1.11.1 HOT 5
- Riemann writes not all messages to InfluxDB HOT 2
- Implement InfluxDB 2.0 plugin HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from riemann.