Git Product home page Git Product logo

alertmanager-zabbix-provisioner's Introduction

Build Status

DEPRECATED

Hey guys, I don`t have much time to properly work on this project anymore since I'm not using Zabbix in my pipelines as of late. I would gladely point/link to a fork if you guys have a maintained and living project for that. Thanks Guys. And sorry about that.

alertmanager-zabbix-provisioner

The provisioner will connect to your prometheus to get the current configured rules and will create a host/items/triggers accordingly
Data for those items can then be sent via a webhook: https://github.com/gmauleon/alertmanager-zabbix-webhook

The concept is to use annotations in prometheus rules, along with a provisionner configuration file to automatically create everything in Zabbix

Howto

Have a look at the default config.yaml for the possible parameters
Kubernetes examples manifests can be found here: https://github.com/gmauleon/alertmanager-zabbix-provisioner/tree/master/contrib/kubernetes

To create a host with items/triggers in Zabbix, your prometheus rule need to have some annotations matching your selector configuration for that host
For example that configuration:

zabbixHosts:
  - name: gmauleon-test01
    selector:
      zabbix: gmauleon-test01

Will match rules like:

ANNOTATIONS {
  zabbix = "gmauleon-test01",
  summary = "Alerting DeadMansSwitch",
  description = "This is a DeadMansSwitch meant to ensure that the entire Alerting pipeline is functional.",
}

You can choose what Prometheus rule appear in Zabbix with that behavior.

In Zabbix, fields for an item are populated following the behavior below:
Name = rule name
Description = zabbix_description annotation OR description annotation OR empty
Applications = zabbix_applications annotation OR itemDefaultApplication configuration
History storage period = zabbix_history annotation OR itemDefaultHistory configuration
Trend storage period = zabbix_trend annotation OR itemDefaultTrends configuration
Allowed hosts = zabbix_trapper_hosts annotation OR itemDefaultTrapperHosts configuration

Fields for triggers are populated:

Name = zabbix_trigger_name annotation OR summary annotation OR rule name
Description = zabbix_trigger_description annotation OR description annotation OR empty
Severity = zabbix_trigger_severity annotation OR not classified

There is a special annotations called zabbix_trigger_nodata which will add a nodata condition on the item in Zabbix
The value of zabbix_trigger_nodata corresponds to the time in seconds after when the trigger will fire if no data is send to this item

ANNOTATIONS {
  zabbix = "gmauleon-test01",
  zabbix_trigger_nodata = "100",
  summary = "Node status is NotReady",
  description = "The Kubelet on {{ $labels.node }} has not checked in with the API, or has set itself to NotReady, for more than an hour",
}

Examples in prometheus:

ANNOTATIONS {
  zabbix = "gmauleon-test01",
  zabbix_history = "7d",
  zabbix_applications = "kubelet,prometheus,alertmanager",
  zabbix_trigger_severity = "critical",
  zabbix_description = "One of the Kubelet has not checked in with the API",
  summary = "Node status is NotReady",
  description = "The Kubelet on {{ $labels.node }} has not checked in with the API, or has set itself to NotReady, for more than an hour",
}

Limitations

For now a minimal scraper, parse the html page that expose rules on your Prometheus (which is pretty clumsy :( )
Note that the HTML page exposed by prometheus currently does not resolve variables, so it's better to use the dedicated Zabbix annotations not to have variables names in your Zabbix items...
Ultimately, this will be replaced by the rules API endpoint, see prometheus/prometheus#2600

Since host groups and hosts are declared in the provisionner configuration, there will not be deleted automatically (since I don't have any state saved anywhere).
So you'll have to delete those by hands in Zabbix if you remove some

alertmanager-zabbix-provisioner's People

Contributors

gmauleon avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.