Comments (5)
Is it related to your (email ...)
?
In order to test your code, I replaced it with #(info %)
:
(logging/init {:file "/var/log/riemann/riemann.log"})
(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
; Index all events immediately.
;index
(by [:host :service]
(where (state "critical")
(where (tagged "dummy_alert")
(throttle 3 30
#(info %)))))
; Log expired events.
(expired
(fn [event] (info "expired" event))))))
Then send some events:
r = Riemann::Client.new.tcp
['n1', 'n2', 'n3'].each do |service|
10.times do |n|
r << {
host: "TESTING",
service: service,
state: 'critical',
tags: ["dummy_alert"],
ttl: 3600,
description: n,
}
end
end
and got the expected outcome in the log file:
INFO [2023-04-06 16:36:58,520] defaultEventExecutorGroup-2-3 - riemann.config - #riemann.codec.Event{:host TESTING, :service n1, :state critical, :description 0, :metric nil, :tags [dummy_alert], :time 1.680835018520078E9, :ttl 3600.0}
INFO [2023-04-06 16:36:58,522] defaultEventExecutorGroup-2-3 - riemann.config - #riemann.codec.Event{:host TESTING, :service n1, :state critical, :description 1, :metric nil, :tags [dummy_alert], :time 1.680835018521604E9, :ttl 3600.0}
INFO [2023-04-06 16:36:58,524] defaultEventExecutorGroup-2-3 - riemann.config - #riemann.codec.Event{:host TESTING, :service n1, :state critical, :description 2, :metric nil, :tags [dummy_alert], :time 1.680835018523878E9, :ttl 3600.0}
INFO [2023-04-06 16:36:58,531] defaultEventExecutorGroup-2-3 - riemann.config - #riemann.codec.Event{:host TESTING, :service n2, :state critical, :description 0, :metric nil, :tags [dummy_alert], :time 1.680835018531222E9, :ttl 3600.0}
INFO [2023-04-06 16:36:58,532] defaultEventExecutorGroup-2-3 - riemann.config - #riemann.codec.Event{:host TESTING, :service n2, :state critical, :description 1, :metric nil, :tags [dummy_alert], :time 1.680835018532433E9, :ttl 3600.0}
INFO [2023-04-06 16:36:58,533] defaultEventExecutorGroup-2-3 - riemann.config - #riemann.codec.Event{:host TESTING, :service n2, :state critical, :description 2, :metric nil, :tags [dummy_alert], :time 1.680835018533418E9, :ttl 3600.0}
INFO [2023-04-06 16:36:58,542] defaultEventExecutorGroup-2-3 - riemann.config - #riemann.codec.Event{:host TESTING, :service n3, :state critical, :description 0, :metric nil, :tags [dummy_alert], :time 1.680835018541492E9, :ttl 3600.0}
INFO [2023-04-06 16:36:58,543] defaultEventExecutorGroup-2-3 - riemann.config - #riemann.codec.Event{:host TESTING, :service n3, :state critical, :description 1, :metric nil, :tags [dummy_alert], :time 1.680835018543208E9, :ttl 3600.0}
INFO [2023-04-06 16:36:58,545] defaultEventExecutorGroup-2-3 - riemann.config - #riemann.codec.Event{:host TESTING, :service n3, :state critical, :description 2, :metric nil, :tags [dummy_alert], :time 1.680835018544439E9, :ttl 3600.0}
from riemann.
Hi @smortex, Your observation is very insightful, thank you. Since email
is an inbuilt function, I don't think that could have been the issue. Can you be able to reproduce the issue when using email
?
from riemann.
Hum 🤔 I can't find any email
function in the API
I adjusted my test example like this, defining my own email
:
--- /usr/local/etc/riemann/riemann.config.orig 2023-04-10 10:45:38.625538000 -1000
+++ /usr/local/etc/riemann/riemann.config 2023-04-10 10:46:30.465567000 -1000
@@ -13,7 +13,9 @@
; Expire old events from the index every 5 seconds.
(periodically-expire 5)
-(let [index (index)]
+
+(let [index (index)
+ email (mailer)]
; Inbound events will be passed to these streams:
(streams
(default :ttl 60
@@ -24,6 +26,7 @@
(where (state "critical")
(where (tagged "dummy_alert")
(throttle 3 30
+ (email "romain@localhost")
#(info %)))))
; Log expired events.
I received the 9 expected messages, the 3 first of each host. Maybe you can post your email
definition?
from riemann.
Apologies for the delayed response, the definition of email function is as follows:
(def email (mailer {:from "[email protected]" :host "email_api_service_provider.com" :user "[email protected]" :pass "password" :port port_number :ssl :yes :body (fn [events] (apply prn-str events)) }))
from riemann.
@Magesh-B can you create a simple riemann.config
with #(info %)
, instead of (email)
and try to reproduce this?
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
- 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.