Created
          November 16, 2015 14:00 
        
      - 
      
- 
        Save faxm0dem/79b78afb777d8d518c47 to your computer and use it in GitHub Desktop. 
    Riemann.io exceptions to events
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | ;; watchdog-cfg is just a hash with host, port, etc. | |
| (streams | |
| ;; irrelevant code ommited :) | |
| (where (service #"riemann server") | |
| (let [send-watchdog (forward (riemann.client/tcp-client watchdog-cfg))] | |
| (fn watchdog-sending [event] | |
| (try (send-watchdog event) | |
| (catch Exception exc | |
| (tell-ops (utils/exception->event exc)))))))) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | (ns bla-bla.utils | |
| (require [clj-time.core :as ct]) | |
| (require [clj-time.coerce :as tc])) | |
| (defn exception->event | |
| [exc] | |
| {:host "riemann.local" | |
| :service "riemann" | |
| :state "critical" | |
| :metric 1 | |
| :tags [] | |
| :ttl 60 | |
| :description (str exc) | |
| :time (tc/to-long (ct/now))}) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment