{"id":14235361,"url":"https://github.com/alerta/zabbix-alerta","last_synced_at":"2025-04-11T23:11:46.005Z","repository":{"id":10944052,"uuid":"13252148","full_name":"alerta/zabbix-alerta","owner":"alerta","description":"Forward Zabbix alerts to the alerta monitoring system","archived":false,"fork":false,"pushed_at":"2021-06-14T17:56:01.000Z","size":3418,"stargazers_count":100,"open_issues_count":0,"forks_count":41,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-11T23:11:39.154Z","etag":null,"topics":["alerta","zabbix"],"latest_commit_sha":null,"homepage":"http://alerta.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alerta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-01T18:41:39.000Z","updated_at":"2025-02-17T08:16:29.000Z","dependencies_parsed_at":"2022-08-28T11:50:18.524Z","dependency_job_id":null,"html_url":"https://github.com/alerta/zabbix-alerta","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alerta%2Fzabbix-alerta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alerta%2Fzabbix-alerta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alerta%2Fzabbix-alerta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alerta%2Fzabbix-alerta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alerta","download_url":"https://codeload.github.com/alerta/zabbix-alerta/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248492877,"owners_count":21113163,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alerta","zabbix"],"created_at":"2024-08-20T21:01:48.846Z","updated_at":"2025-04-11T23:11:45.986Z","avatar_url":"https://github.com/alerta.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"Zabbix-Alerta Gateway\n=====================\n\nConsolidate Zabbix alerts from across multiple sites into a single\n\"at-a-glance\" console by using a custom Zabbix [alertscript](https://www.zabbix.com/documentation/current/manual/config/notifications/media/script).\n\nTransform this ...\n\n![zabbix](/docs/images/zabbix-alerta-before.png?raw=true)\n\nInto this ...\n\n![alerta](/docs/images/zabbix-alerta-after.png?raw=true)\n\nFor help, join [![Slack chat](https://img.shields.io/badge/chat-on%20slack-blue?logo=slack)](https://slack.alerta.dev)\n\nInstallation\n------------\n\nClone the GitHub repo and run:\n\n    $ python setup.py install\n\nOr, to install remotely from GitHub run:\n\n    $ pip install git+https://github.com/alerta/zabbix-alerta\n\nThen symlink the `zabbix-alerta` script to the `AlertScriptsPath` directory\nwhich can be found in the `/etc/zabbix/zabbix_server.conf` configuration file:\n\n    $ grep -e '^AlertScriptsPath' /etc/zabbix/zabbix_server.conf\n    AlertScriptsPath=/path/to/zabbix/alertscripts\n    $ ln -s `which zabbix-alerta` /path/to/zabbix/alertscripts\n\nConfiguration\n-------------\n\nTo forward Zabbix events to Alerta a new media script needs to be created\nand associated with a user. Follow the steps below as a Zabbix Admin user...\n\n1/ Create a new media type [Admininstration \u003e Media Types \u003e Create Media Type]\n\n```\nName: Alerta\nType: Script\nScript name: zabbix-alerta\nScript parameters:\n    1st: {ALERT.SENDTO}\n    2nd: {ALERT.SUBJECT}\n    3rd: {ALERT.MESSAGE}\nEnabled: [x]\n```\n\n2/ Modify the Media for the Admin user [Administration \u003e Users]\n\n```\nType: Alerta\nSend to: http://x.x.x.x:8080   =\u003e API hostname/IP and port of alerta server\nWhen active: 1-7,00:00-24:00\nUse if severity: (all)\nStatus: Enabled\n```\n\n**Note:** If the [Docker container for Alerta](https://hub.docker.com/r/alerta/alerta-web/)\nis used then the \"Send to\" URL will use a host and port specific to\nyour environment and the URL path will need to include `/api` eg. `http://x.x.x.x:8080/api`.\n\n**Note:** If API authentication is enabled then an API key will need to be\nspecified in the `Send to` configuration. The API key is added after the API\nendpoint separated only by a semicolon. eg. `http://x.x.x.x;YOUR_API_KEY_HERE`\n\n3/ Configure Action [Configuration \u003e Actions \u003e Create Action \u003e Action]\n\n```\nName: Forward to Alerta\n```\n```\nDefault subject:\n{TRIGGER.STATUS}: {TRIGGER.NAME}\n```\n```\nDefault message:\nresource={HOST.NAME1}\nevent={ITEM.KEY1}\nenvironment=Production\nseverity={TRIGGER.SEVERITY}\nstatus={TRIGGER.STATUS}\nack={EVENT.ACK.STATUS}\nservice={TRIGGER.HOSTGROUP.NAME}\ngroup=Zabbix\nvalue={ITEM.VALUE1}\ntext={TRIGGER.STATUS}: {TRIGGER.NAME}\ntags={EVENT.TAGS}\nattributes.ip={HOST.IP1}\nattributes.thresholdInfo={TRIGGER.TEMPLATE.NAME}: {TRIGGER.EXPRESSION}\ntype=zabbixAlert\ndateTime={EVENT.DATE}T{EVENT.TIME}Z\n\n```\n\nRECOVERY\n```\nDefault subject:\n{TRIGGER.STATUS}: {TRIGGER.NAME}\n```\n```\nDefault message:\nresource={HOST.NAME1}\nevent={ITEM.KEY1}\nenvironment=Production\nseverity={TRIGGER.SEVERITY}\nstatus={TRIGGER.STATUS}\nack={EVENT.ACK.STATUS}\nservice={TRIGGER.HOSTGROUP.NAME}\ngroup=Zabbix\nvalue={ITEM.VALUE1}\ntext={TRIGGER.STATUS}: {ITEM.NAME1}\ntags={EVENT.RECOVERY.TAGS}\nattributes.ip={HOST.IP1}\nattributes.thresholdInfo={TRIGGER.TEMPLATE.NAME}: {TRIGGER.EXPRESSION}\nattributes.moreInfo=\u003ca href=\"http://x.x.x.x/tr_events.php?triggerid={TRIGGER.ID}\u0026eventid={EVENT.RECOVERY.ID}\"\u003eZabbix console\u003c/a\u003e\ntype=zabbixAlert\ndateTime={EVENT.RECOVERY.DATE}T{EVENT.RECOVERY.TIME}Z\n```\n\nhttps://www.zabbix.com/documentation/current/manual/appendix/macros/supported_by_location\n\nTo send OK events ...\n\n````\nRecovery message: [check]\nEnabled [check]\n````\n\nAt the Conditions tab, to only forward PROBLEM and OK events ...\n\n```\n(A)\tMaintenance status not in \"maintenance\"\n(B)\tTrigger value = \"PROBLEM\"\n```\n\nTo forward PROBLEM, ACKNOWLEDGED, OK events ...\n\n```\n(A)\tMaintenance status not in \"maintenance\"\n```\n\nFinally, add an operation:\n\n```\nSend to Users: Admin\nSend only to: Alerta API\n```\n\nAdvanced Configuration\n----------------------\n\nAdditional features are available that enhance the integration\nbetween Zabbix and Alerta if configuration profiles are used instead\nof the basic `URL;Key` format described above.\n\n**Configuration Profiles**\n\nAdditional configuration options are available if you use a profile for\nthe `sendto` value.\n\n  * endpoint\n  * API key\n  * disable ssl verify\n  * debug\n\nDefine `ALERTA_CONF_FILE` env var in the `/etc/default/zabbix-server` file\nso that `zabbix-alerta` can find configuration settings during startup:\n\n    $ sudo vi /etc/default/zabbix-server\n    START=yes\n    ALERTA_CONF_FILE=/etc/alerta.conf    =\u003e default: /var/lib/zabbix/.alerta.conf\n\nCreate the configuration file referred to by the `ALERTA_CONF_FILE` file\nabove that contains one or more configuration profiles:\n\n    $ sudo vi /etc/alerta.conf\n    [default]\n    profile = production\n\n    [profile production]\n    endpoint = https://api.alerta.io\n    key = XCYxMmPYUKHRmm-V-rYHGpzA2vveC8yT7zuvid7B\n    sslverify = on\n    debug = off\n\n    [profile development]\n    endpoint = http://localhost:8080\n    key = demo-key\n    sslverify = off\n    debug = on\n\nUse a profile name instead of the API URL in the \"Send to\" input box:\n\n2/ Modify the Media for the Admin user [Administration \u003e Users]\n\n```\nType: Alerta\nSend to: production    \u003c= profile not URL\nWhen active: 1-7,00:00-24:00\nUse if severity: (all)\nStatus: Enabled\n```\n\n**Setting Alert Environment**\n\nUsing a custom user macro called `{$ENVIRONMENT}` it is possible to\nset the environment of alerts received by Alerta in Zabbix. By default\nthe environment will be `Production` but this can be overidden at the host,\ntemplate group or global level using the `{$ENVIRONMENT}` macro.\n\n**Use Zabbix severity levels and colours in Alerta**\n\nAlerta can display alerts using the Zabbix standard severity names and\ncolours and sorted correctly by priority.\n\nZabbix uses the following severity hierarchy:\n\n    Numerical trigger severity. Possible values:\n    0 - Not classified,\n    1 - Information,\n    2 - Warning,\n    3 - Average,\n    4 - High,\n    5 - Disaster.\n    Supported starting from Zabbix 1.6.2.\n\nIn zabbix config append `!!` to the `severity` line to tell `zabbix-alerta`\nto use the supplied Trigger severity and not to map the value to the\nAlerta severity:\n\n```\nDefault message:\nresource={HOST.NAME1}\nevent={ITEM.KEY1}\nenvironment=Production\nseverity={TRIGGER.SEVERITY}!!\nstatus={TRIGGER.STATUS}\nack={EVENT.ACK.STATUS}\nservice={TRIGGER.HOSTGROUP.NAME}\n...\n```\n\nAdd the following to the Alerta server configuration file `alertad.conf`:\n\n```python\nSEVERITY_MAP = {\n    'Disaster'      : 0,\n    'High'          : 1,\n    'Average'       : 2,\n    'Warning'       : 3,\n    'Information'   : 4,\n    'OK'            : 5,\n    'Not classified': 6,\n    'unknown'       : 9\n}\nDEFAULT_NORMAL_SEVERITY = 'OK'\nDEFAULT_PREVIOUS_SEVERITY = 'Not classified'\n\nCOLOR_MAP = {\n    'severity': {\n        'Disaster'      : '#E45959',\n        'High'          : '#E97659',\n        'Average'       : '#FFA059',\n        'Warning'       : '#FFC859',\n        'Information'   : '#7499FF',\n        'Not classified': '#97AAB3',\n        'OK'            : '#59DB8F',\n        'unknown'       : '#BA2222'\n    }\n}\n```\n\n![zabbix-severity-colors](/docs/images/zabbix-severity-colors.png?raw=true)\n\n**Zabbix Console Integration**\n\nTo add a web link in Alerta that links to the specific event in Zabbix\nthat triggered the alert add:\n\nACTION:\n\nattributes.moreInfo=\\\u003ca href=\"http://x.x.x.x/tr_events.php?triggerid={TRIGGER.ID}\u0026eventid={EVENT.ID}\"\u003eZabbix console\u003c/a\\\u003e\n\nRECOVERY\n\nattributes.moreInfo=\\\u003ca href=\"http://x.x.x.x/tr_events.php?triggerid={TRIGGER.ID}\u0026eventid={EVENT.RECOVERY.ID}\"\u003eZabbix console\u003c/a\\\u003e\n\nTroubleshooting\n---------------\n\nSet the debug level to `4`, restart the zabbix server and tail the server\nlogs:\n\n    $ vi /etc/zabbix/zabbix_server.conf\n    DebugLevel=4\n\n    $ tail -f /var/log/zabbix/zabbix_server.log\n\nSee the [PagerDuty guide](http://www.pagerduty.com/docs/guides/zabbix-integration-guide/)\nto configuring Zabbix integrations for an example installation with\nscreenshots.\n\nReferences\n----------\n\n  * Zabbix Custom Alert Scripts: https://www.zabbix.com/documentation/current/manual/config/notifications/media/script\n  * Zabbix Custom User Macros: https://www.zabbix.com/documentation/current/manual/config/macros/usermacros\n\nLicense\n-------\n\nCopyright (c) 2013-2019 Nick Satterly. Available under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falerta%2Fzabbix-alerta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falerta%2Fzabbix-alerta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falerta%2Fzabbix-alerta/lists"}