Riemann integration

questions
riemann

(Larry Larionov) #1

Hi Dears!

We want to integrate PD with our riemann.
Can we ask u to help us with it?
There is our riemann.config:

; -*- mode: clojure; -*-
; vim: filetype=clojure

(require '[clj-http.client :as client]
	 	 '[cheshire.core :as json]
	 	 '[clojure.string :as s]
)

(logging/init {:file "/var/log/riemann/riemann.log"})

; Listen on the local interface over TCP (5555), UDP (5555), and websockets
; (5556)
(let [host "0.0.0.0"]
	(tcp-server {:host host})
	(udp-server {:host host})
	(ws-server	{:host host})
)

(periodically-expire 90)

; Streams
(include "sys.clj")

(let [index (index)]
	(streams
		(with :ttl 60
			index
			(where (= (:plugin event) "memory")
				(adjust [:service str " Gb"]
					(scale (/ 1 1024 1024 1024) index)
				)
			)
		)
	)
)

And our custom alert sys.clj:

(streams
; (with :ttl 60
    (where (or (not (state "expired"))(not (nil? metric)))
      (smap rewrite-service
        (index)
        (by [:host :service]
          (where (or (service "LA relative shortterm")
                (service "swap used %"))
            (stable 60 :state
              (where (state "warning")
                (throttle 1 7200
                  (email-alert "admin@example.com")
                )
              )
              (where (state "critical")
                (throttle 1 1800
                  (email-alert "admin@example.com")
                  (send-sms-alert admin-phones)
                )
              )
            )
          )

          (where (service #"^df")
            (stable 300 :state
              (where (state "warning")
                (throttle 1 7200
                  (email-alert "admin@example.com")
                )
              )
              (where (state "critical")
                (throttle 1 1800
                  (email-alert "admin@example.com")
                  (send-sms-alert admin-phones)
                )
              )
            )
          )

          (where (service #"^filecount")
            (stable 300 :state
              (where (state "warning")
                (throttle 1 7200
                  (email-alert "admin@example.com")
                )
              )
              (where (state "critical")
                (throttle 1 1800
                  (email-alert "admin@example.com")
                  (send-sms-alert admin-phones)
                )
              )
            )
          )

          (where (service #"docker_registry")
            (stable 60 :state
              (where (state "critical")
                (throttle 1 1800
                  (email-alert "admin@example.com")
                  (send-sms-alert admin-phones)
                )
              )
            )
          )

          (where (service #"nginx_health")
            (stable 60 :state
              (where (state "critical")
                (throttle 1 1800
                  (email-alert "admin@example.com")
                  (send-sms-alert admin-phones)
                )
              )
            )
          )

          (where (service "processes-lsyncd/ps_count")
            (stable 60 :state
              (where (state "critical")
                (throttle 1 1800
                  (email-alert "admin@example.com")
                  (send-sms-alert admin-phones)
                )
              )
            )
          )

          (where (service "processes-rsync/ps_count")
            (stable 60 :state
              (where (state "critical")
                (throttle 1 1800
                  (email-alert "admin@example.com")
                  (send-sms-alert admin-phones)
                )
              )
            )
          )
        )
      )
    )
)

Please, say what we need to add to riemann.config and to sys.clj to send alerts to pagerduty.

Thanks


(Larry Larionov) #2

; resolved :slight_smile:


(system) #3