I/O and actions reference

This section lists all built-in actions and I/O available in Mirabelle.

Outputs

Outputs can be referenced in streams in order to forward events to external systems.

File

This I/O write all events into a file, as edn.

{:my-io-file {:config {:path "/tmp/events?edn"}
              :type :file}}

Pagerduty

This I/O forwards events to Pagerduty.

{:pagerduty-client {:config {:service-key #secret "pagerduty-service-key"
                             :source-key :service
                             :summary-keys [:host :service :state]
                             :dedup-keys [:host :service]
                             :http-options {:socket-timeout 5000
                                            :connection-timeout 5000}}
                    :type :pagerduty}}
  • The :service-key parameter is your Pagerduty service (integration) key.
  • :source-key is the event key which will be used for the alert source in the Pagerduty payload.
  • :summary-keys is a list of keys which will be used to build the event summary. In this example, the summary would be <event-host>-<event-service>-<event-state>.
  • :dedup-keys is a list of keys used to build the Pagerduty dedup key in the alert payload. :http-options is an optional map for extra HTTP options (see clj-http for more information).

The raw event will also be sent to Pagerduty in the custom_details field. The alert timestamp will be the event time, or the current time if the event has no time.

By default, the event :state is used to deduce the right Pagerduty action:

  • “critical”: trigger
  • “ok”: resolve

You can also set a :pagerduty/action key to your event in order to set the action (with the with action for example: (with :pagerduty/action :trigger ...)

InfluxDB

Forward events to the InfluxDB timserie database. This I/O forwards events to InfluxDB asynchronously.

{:influxdb {:config {:connection-string "http://127.0.0.1:8086"
                     :bucket "mirabelle"
                     :org "mirabelle"
                     :measurement :service
                     ;; either use username/password
                     :username "mirabelle"
                     :password #secret "mirabelle"
                     ;; or token authenticate
                     :token #secret "my-token"
                     :default-tags {"project" "mirabelle"}
                     :tags [:service]
                     :fields [:environment]}
            :type :influxdb}}

The :measurement, :username, :password, :token, :default-tags, :tags and fields parameters are optional. The :measurement parameter is the event key which will be used for the influxdb measurement

Default tags will be added to all events. The :tags option contains the list of keys to convert to influxdb tags, and the :fields option for fields.

You can also add the :influxdb/measurement, :influxdb/fields and :influxdb/tags to your events (using the with action for example) in order to override per event the default configuration for these options.

Elasticsearch

Forward events to ElasticSearch. This I/O forwards events to Elasticsearch asynchronously.

{:elastic {:type :elasticsearch
           :config {;; the list of elasticsearch osts
                    :hosts [{:address "localhost"
                             :port 9200}]
                    ;; the path to tls certificates (optional)
                    :key "/tmp/client-key.key"
                    :cert "/tmp/client-cert.crt"
                    :cacert "/tmp/cacert.crt"
                    ;; The http scheme (http or https)
                    :scheme "http"
                    ;; The default Elasticsearch index name
                    :default-index "abc"
                    ;; The default index pattern which will be added to the index
                    ;; name. optional
                    :default-index-pattern "yyyy-MM-dd"
                    ;; Timeouts options (optional)
                    :connect-timeout 1000000
                    :socket-timeout 1000000
                    ;; The number of threads for the client (optional)
                    :thread-count 3
                    ;; Basic auth configuration (optional)
                    :basic-auth {:username "name"
                                 :password #secret "pass"}
                    ;; Service token (optional)
                    :service-token #secret "my-service-token"
                    ;; API key configuration (optional)
                    :api-key {:id "id"
                              :secret #secret "secret"}}}}

You can set :elasticsearch/index to your event in order to forward an event to a specific index.

Actions

The generated documentation from the code contains explanations and examples about the available actions. Here is the list: