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 writes all events into a file, as edn.

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

Prometheus

This I/O forwards events to Prometheus.

The :name value is used for the metric name. The :state and service keys will be used as labels, as well as all keys stored in the :attributes map.

{:name "http_requests_total"
 :service "my-app"
 :state "critical"
 :metric 10
 :timestamp 1735047872000000000
 :attributes {:environment "production"}}

This event will produce the metric http_requests_total{"service": "my-app", "state": "critical", "environment": "production"} 10 for the given timestamp.

{:prometheus {:type :prometheus
              :config {:url "http://localhost:9090/api/v1/write"}}}

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.

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 ...)

Actions

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