Code Monkey home page Code Monkey logo

zabbix-cachet's Introduction

Zabbix-Cachet

This is python script which provides synchronisation between Zabbix IT Services and Cachet

Description

The idea of Zabbix-Cachet is providing the easiest way to export Zabbix terms to Cachet. With this script you can maintain Cachet though Zabbix.

Zabbix-Cachet reads pre-configured Zabbix IT Services and automatically creates Cachet components. After that Zabbix-Cachet periodically checks Zabbix triggers (that linked to you IT Services) and manipulate with Cachet incidents and Component statuses based on triggers.

Zabbix-Cachet communicate with Zabbix and Cachet via API interface. To make it works you need a zabbix user with sufficient permissions to read triggers, items of services that is exported to Cachet and Cachet`s API key.

Features

  • Automatically creates Cachet Components and Components group
  • Automatically creates Cachet Incidents and update them with acknowledgement messages
  • Allow to specify root IT service where Zabbix-Cachet will work

Example

Zabbix IT Services.

  • Cachet - root_service for zabbix-cachet script.
  • Bitbucket, Network Connectivity - parent services. They will be Components Groups in Cachet.
  • GIT https, GIT ssh - Components in Cachet. Do not forget to set Zabbix trigger to this group.

Zabbix IT Services

Cachet

Cachet Components

Requirements

  • Cachet 2.2, 2.3
  • Zabbix 2.X, 3.X, 4.0, 5.0, 6.0, 6.4
  • python 3.6+

Installation

Docker Installation

  1. Create /etc/zabbix-cachet.yml file based config-example.yml.
  2. Run Docker container
    docker run --name zabbix-cachet -v /etc/zabbix-cachet.yml:/config.yml qk4l/zabbix-cachet
    
  3. Drink a cup of tea (optional)

Python package

  1. Install python package via pip
    pip install zabbix-cachet
  2. Rename config-example.yml to config.yml and fill a file with your settings.
  3. Define CONFIG_FILE environment variable which point to your config.yml or change current work directory to folder with config
  4. Launch zabbix-cachet

Apt (outdated release)

  1. Add official Zabbix-Cachet PPA:
    add-apt-repository ppa:reg-tem4uk/zabbix-cachet
    apt-get update
  2. Install the package: apt-get install zabbix-cachet
  3. Configure it: nano /etc/zabbix-cachet.yml
  4. Restart it: systemctl enable zabbix-cachet && systemctl restart zabbix-cachet

Configuration

Settings are storing in config.yml file which should be placed in script's working directory. If you want to use another path for config.yml use CONFIG_FILE environment variable.

zabbix-cachet's People

Contributors

altmas5 avatar beryju avatar dependabot[bot] avatar donaldini avatar dp19 avatar qk4l avatar roblevesque avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

zabbix-cachet's Issues

Trigger Watcher - sometimes dont work

Hi,
I have some problems with Trigger Watcher, basically when I have some incident zabbix-cachet open an Incident on cachet, but sometimes dont close, but on zabbix the incident was closed some minutes a go. Trigger Watcher here check every 40 seconds.

With this problem I put a restart on cron to read again the information on zabbix.

Documentation zabbix user rights

I've found a problem using a zabbix user with a low permissions, i need to use an zabbix privileged user, i think this need to be documented

thanks

MST Error's when using nested triggers

For whatever reason, when using the nested triggers branch (I need to use this due to my IT services setup) I am getting the below error. This does not occur with the same config on the master branch, though if I use that it does not catch my triggers as they are nested. Any ideas on why this would happen? Thank you sir!

5d04-0311-4a73-9e5a-665729a47eaf","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:05:45 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/4, 500: {"errors":[{"id":"b05221f4-ea28-4bd4-9bf4-de69cc7b6dad","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:05:46 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/5, 500: {"errors":[{"id":"5694e03d-6d75-4b43-b5db-e4b75319dd67","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:05:47 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/6, 500: {"errors":[{"id":"b4e7eeac-24b3-4f00-bb28-457ec401bae7","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:05:48 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/8, 500: {"errors":[{"id":"f8fb4569-be56-4f0d-aae1-630cf362254d","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:05:49 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/9, 500: {"errors":[{"id":"b750c760-17c0-479e-97f9-7a617c906caf","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:07:50 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/3, 500: {"errors":[{"id":"29558193-ee1c-48b6-93b5-3bbe87fea58f","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:07:51 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/4, 500: {"errors":[{"id":"521a683e-7659-49e0-9fc9-1d2ac0488a42","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:07:52 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/5, 500: {"errors":[{"id":"348cdfa0-bd6d-47da-8464-06bc5cd135f6","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:07:53 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/6, 500: {"errors":[{"id":"090dddef-e236-43b3-9ce7-484bcdcca88c","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:07:54 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/8, 500: {"errors":[{"id":"1e715661-9429-47dc-96f6-38f5edc569cb","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:07:55 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/9, 500: {"errors":[{"id":"af08cc02-592e-4a74-a40a-22c975cb0755","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:09:56 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/3, 500: {"errors":[{"id":"b5bf3502-9dc5-42ab-8359-70278e2e8a54","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:09:57 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/4, 500: {"errors":[{"id":"9d34c25e-88c4-4750-99c3-df1824b800d7","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:09:57 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/5, 500: {"errors":[{"id":"b698653a-05be-43ab-8c6e-e755abb4dd93","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:09:58 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/6, 500: {"errors":[{"id":"938e6a45-59e7-486c-97e2-d8a495b2aa87","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:09:59 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/8, 500: {"errors":[{"id":"600bd79d-b463-4d4f-91fe-40180d68b5be","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:10:00 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/9, 500: {"errors":[{"id":"37acd993-37d8-4f17-b961-eb4d23d95c3f","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:12:01 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/3, 500: {"errors":[{"id":"02043446-9b17-48bd-88d8-220855d43d41","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:12:02 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/4, 500: {"errors":[{"id":"2d5bc447-0e2a-48b0-9c1b-7c8ace0132f8","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:12:05 MST INFO: (Trigger Watcher) Incident There is a problem with REDACTED (id=7) was created for component id 5. 2018-11-16 15:12:05 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/6, 500: {"errors":[{"id":"97b7c757-513c-4a84-892f-c0a6e506067d","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:12:07 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/8, 500: {"errors":[{"id":"c90cd341-c9a5-4b7f-a946-d25561e5c7e7","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}] 2018-11-16 15:12:08 MST ERROR: (Trigger Watcher) ClientHttpError[http://status.REDACTED.com/api/v1/components/9, 500: {"errors":[{"id":"996db8b8-ccd4-4306-ae0f-25f132f4a7a0","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}]

ZAbbix-cachet status shows ERROR: (MainThread) Expecting value: line 1 column 1 (char 0

Installed
Zabbix server 3.4
Cachet 2.3.9
Zabbix-cachet tried three methods
When i start the service i get the following error:

root@ip-172-31-29-168:/var/www/html/cachet# /usr/bin/zabbix-cachet restart
2019-03-21 09:57:35 UTC INFO: (MainThread) Zabbix Cachet v.1.3.6 started
2019-03-21 09:57:35 UTC INFO: (MainThread) JSON-RPC Server Endpoint: http://54.171.249.134/zabbix/api_jsonrpc.php
2019-03-21 09:57:35 UTC ERROR: (MainThread) Expecting value: line 1 column 1 (char 0)

Could you please guide me on this

Docker running error - Invalid format

Hi,

I'm getting this error when I try to create a container

ClientHttpError[http://192.168.56.102:8000/api/v1/components, 400: {"errors":[{"id":"943625b1-258a-41fb-aa7b-6cf29bff87fc","status":400,"title":"Bad Request","detail":"The request cannot be fulfilled due to bad syntax.","meta":{"details":["The link format is invalid."]}}]}]
2017-12-25 18:52:33 ERROR: (MainThread) 'NoneType' object is not subscriptable

Please help! this is my command

sudo docker run --name zabbix-cachet -v zabbix-cachet.yml:/config.yml qk4l/zabbix-cachet

and this is my config.yml

zabbix:
user: admin
pass: zabbix
server: http://192.168.56.102
https-verify: false

cachet:
token: xxxxxxxxxxxxxxx
server: http://192.168.56.102:8000
https-verify: false

settings:
root_service: Cachet

components and groups are not created

Hi Alex,

another problem. Ich can see, in debug mode, that i get an response from my zabbix-server. but nothing is happened on cachet side. Responses for child items are empty...

Any hint for that?
Zabbix: 3.0.7
Cachet: 2.3.9
Api are both working.
User have the rights.

Debug output on zabbix-server:

2017-01-22 16:16:44 CET INFO: (MainThread) Zabbix Cachet v.0.1 started
2017-01-22 16:16:44 CET INFO: (MainThread) JSON-RPC Server Endpoint: http://watchdog01.test.int/api_jsonrpc.php
2017-01-22 16:16:44 CET DEBUG: (MainThread) Sending: {
"id": 0,
"params": {
"user": "user_cachet",
"password": "XXX"
},
"jsonrpc": "2.0",
"method": "user.login"
}
2017-01-22 16:16:44 CET DEBUG: (MainThread) Response Code: 200
2017-01-22 16:16:44 CET DEBUG: (MainThread) Response Body: {
"id": 0,
"result": "933cd00b59683575aeedb096318fb11e",
"jsonrpc": "2.0"
}
2017-01-22 16:16:44 CET DEBUG: (MainThread) Sending: {
"auth": "933cd00b59683575aeedb096318fb11e",
"id": 1,
"params": {
"filter": {
"name": "cachet_status"
},
"selectDependencies": "extend"
},
"jsonrpc": "2.0",
"method": "service.get"
}
2017-01-22 16:16:44 CET DEBUG: (MainThread) Response Code: 200
2017-01-22 16:16:44 CET DEBUG: (MainThread) Response Body: {
"id": 1,
"result": [
{
"triggerid": "0",
"serviceid": "6",
"goodsla": "99.0500",
"name": "XXXXX_status",
"dependencies": [],
"sortorder": "0",
"showsla": "1",
"status": "1",
"algorithm": "1"
}
],
"jsonrpc": "2.0"
}
2017-01-22 16:16:44 CET DEBUG: (MainThread) Sending: {
"auth": "933cd00b59683575aeedb096318fb11e",
"id": 2,
"params": {
"serviceids": [],
"selectDependencies": "extend"
},
"jsonrpc": "2.0",
"method": "service.get"
}
2017-01-22 16:16:44 CET DEBUG: (MainThread) Response Code: 200
2017-01-22 16:16:44 CET DEBUG: (MainThread) Response Body: {
"id": 2,
"result": [],
"jsonrpc": "2.0"
}

thanks in advance and regards
sentinel

Using only IT Services from Zabbix?

Hi,

I started evaluating Cachet for our system. I have Zabbix implemented and monitoring - trying to integrate it with Cachet and on their website they are recommend zabbix-cachet plugin as 3rd party integration solution. I would like to send web scenerios status to Cachet will this plugin allow me to do that?

Children of components won't trigger an issue

Currently, I have a service configuration like this::

root
↳Cachet
  ↳Gameserver
    ↳Minecraft
    ↳GMod

Where "Cachet" is the configured root for cachet, so "Gameserver" are a component group and the services below are the actual components. These services (in this case Minecraft & Gmod) have configured a trigger which results in a status message being created by this zabbix-cachet-integration.
This is pretty limiting, since for every service/component there can only be a single trigger.

In Zabbix, you'd normally just create children for the services which would contain different triggers - but these children aren't being detected by this script. It'd be pretty great to have that kind of functionality.
You could configure different triggers per component, which would result in different status messages and severities. For example, a trigger for high latency could result in performance problems, whilst a server being fully unreachable would result in full failure status.

Zabbix: 403 Client Error

Started seeing this suddenly. At first thought it was because the password expired, which it did. However after updating it started to get these error messaged.

zabbix-cachet     | 2020-03-23 20:56:18  INFO: (MainThread) Zabbix Cachet v.1.3.6 started
zabbix-cachet     | 2020-03-23 20:56:18  INFO: (MainThread) JSON-RPC Server Endpoint: https://monitoring.example.com/api_jsonrpc.php
zabbix-cachet     | 2020-03-23 20:56:18  DEBUG: (MainThread) Sending: {
zabbix-cachet     |     "jsonrpc": "2.0",
zabbix-cachet     |     "params": {
zabbix-cachet     |         "password": "password",
zabbix-cachet     |         "user": "zabbix-cachet"
zabbix-cachet     |     },
zabbix-cachet     |     "method": "user.login",
zabbix-cachet     |     "id": 0
zabbix-cachet     | }
zabbix-cachet     | 2020-03-23 20:56:18  INFO: (MainThread) Starting new HTTPS connection (1): monitoring.example.com
zabbix-cachet     | 2020-03-23 20:56:18  DEBUG: (MainThread) "POST /api_jsonrpc.php HTTP/1.1" 403 None
zabbix-cachet     | 2020-03-23 20:56:18  DEBUG: (MainThread) Response Code: 403
zabbix-cachet     | 2020-03-23 20:56:18  ERROR: (MainThread) 403 Client Error: Forbidden for url: https://monitoring.example.com/api_jsonrpc.php

Seeing these types of logs in the Zabbix server, but I don't think it is directly related.

item "status-test.example.com:net.if.in[<veth* or br-*>]" became not supported: Cannot find information for this network interface in /proc/net/dev.

status-test.example.com is the server where the cachet stack is, including zabbix-cachet.

I have been troubleshooting this on and off for a couple days and have not figured out what is happening. Any help would be appreciated, I am sure I am missing something obvious.

Duplicating components

Everytime the container checks for new IT services my components are duplicated on Cachet. After a while it becomes a problem, overloading my server.
Anyone else having the same issue? Any ideas?

Sync to a specific Components group

Hi,
I would like to know if I can sync to Cachet to a specific components group, since I would like having all IT Services from Zabbix coming to a Zabbix Component group, and then other Items populating other Components group.

Updating Component from Zabbix when Trigger happens but still see operational

I have a trigger displayed in Zabbix

image

But in Cachet I still see:

image

So if you hoover the "?" you see the trigger but the green light is always "Operational"

Is zabbix-cachet supposed to change status from operational to problem in Cachet when the trigger is happening in zabbix?

I am using zabbix 3, cachet 2.5.0-dev

Thanks

Compability with 3.4

Hello,

I am having issues with your script and Zabbix 3.4. When I am trying to link both it just returns this:

2018-07-06 21:29:14 CEST INFO: (MainThread) Zabbix Cachet v.1.3.6 started
2018-07-06 21:29:14 CEST INFO: (MainThread) JSON-RPC Server Endpoint: https://<url>/api_jsonrpc.php
2018-07-06 21:29:14 CEST INFO: (MainThread) Zabbix ver: 3.4.11. Cachet ver: 2.3.14-dev
2018-07-06 21:29:14 CEST ERROR: (MainThread) Zabbix Service with service id = 5 does not have trigger or child service
2018-07-06 21:29:14 CEST ERROR: (MainThread) Sorry, can not create Zabbix <> Cachet mapping for you. Please check above errors

I have made it like you in your example:

screenshot 484

screenshot 485

Can you tell me what I am doing wrong?

Services with multible childs

So I was thinking that it would be usefull to cause different errors based on the trigger.
For that I has a setup like:

Services
- Webserver
-- Responce time Trigger ( Warning )
-- HTTP code trigger ( Average )
-- Ping trigger ( Disaster )

Well that caused some problems as the script now created own categorys for the childs in cachet. like:

Services
- Webserver

Webserver
- Responce time Trigger ( Warning )
- HTTP code trigger ( Average )
- Ping trigger ( Disaster )

Is there another way to set it up like that without using childs or make childs invisible for the API?
I really dont want to see a extra tab for every child on Cachet.

Screenshot:
screenshot 637

zabbix-cachet status error Invalid params

I started the zabbix-cachet but then got this error

2019-10-13 16:14:03  DEBUG: (MainThread) Starting new HTTP connection (1): 10.147.20.33:79
2019-10-13 16:14:05  DEBUG: (MainThread) http://10.147.20.33:79 "POST /api_jsonrpc.php HTTP/1.1" 200 None
2019-10-13 16:14:05  DEBUG: (MainThread) Response Code: 200
2019-10-13 16:14:05  DEBUG: (MainThread) Response Body: {
    "jsonrpc": "2.0",
    "error": {
        "message": "Invalid params.",
        "data": "Invalid parameter \"/password\": a character string is expected.",
        "code": -32602
    },
    "id": 0
}
2019-10-13 16:14:05  ERROR: (MainThread) ('Error -32602: Invalid params., Invalid parameter "/password": a character string is expected.', -32602)
[email protected]:~/blog/status#

Zabbix 4.2.6
Cachet 2.4-dev
All in docker

And I am trying to use pyzabbix is no problem

ERROR : list indices must be integers, not str

Hi,

Think Ive got everything setup correctly, but when the script attempts to add a Component Group to Cachet it throws an error and dies without adding anything to the service. Any ideas?


2017-02-07 09:22:33 AEST INFO: (MainThread) Zabbix Cachet v.0.2 started
2017-02-07 09:22:33 AEST INFO: (MainThread) JSON-RPC Server Endpoint: http://zabbix.teysaust.com.au/zabbix/api_jsonrpc.php
2017-02-07 09:22:33 AEST INFO: (MainThread) Starting new HTTP connection (1): zabbix
2017-02-07 09:22:34 AEST INFO: (MainThread) Resetting dropped connection: zabbix.
2017-02-07 09:22:34 AEST INFO: (MainThread) Starting new HTTP connection (1): status
2017-02-07 09:22:34 AEST INFO: (MainThread) Starting new HTTPS connection (1): status
2017-02-07 09:22:34 AEST INFO: (MainThread) Starting new HTTP connection (1): status
2017-02-07 09:22:34 AEST INFO: (MainThread) Starting new HTTPS connection (1): status
2017-02-07 09:22:34 AEST INFO: (MainThread) Component Group IT Infrastructure was created.
2017-02-07 09:22:34 AEST ERROR: (MainThread) list indices must be integers, not str

ERROR: (MainThread) list index out of range

Hi I've an error with Zabbix Cachet.

Description of the error

Zabbix Cachet crash at start with this error:

2016-10-14 17:23:23 CEST INFO: (MainThread) Zabbix Cachet v.0.1 started
2016-10-14 17:23:23 CEST INFO: (MainThread) JSON-RPC Server Endpoint: https://monitor.aresrpg.fr/api_jsonrpc.php
2016-10-14 17:23:23 CEST DEBUG: (MainThread) Sending: {
    "jsonrpc": "2.0",
    "id": 0,
    "method": "user.login",
    "params": {
        "password": "xxxxxxxxxxxxxxxxxxxxxxx",
        "user": "bot"
    }
}
2016-10-14 17:23:23 CEST INFO: (MainThread) Starting new HTTPS connection (1): monitor.aresrpg.fr
2016-10-14 17:23:25 CEST DEBUG: (MainThread) "POST /api_jsonrpc.php HTTP/1.1" 200 None
2016-10-14 17:23:25 CEST DEBUG: (MainThread) Response Code: 200
2016-10-14 17:23:25 CEST DEBUG: (MainThread) Response Body: {
    "jsonrpc": "2.0",
    "result": "837e692f7f981cc981791f688301aa04",
    "id": 0
}
2016-10-14 17:23:25 CEST DEBUG: (MainThread) Sending: {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "service.get",
    "params": {
        "selectDependencies": "extend",
        "filter": {
            "name": "Cachet"
        }
    },
    "auth": "xxxxxxxxxxxxxxxx"
}
2016-10-14 17:23:25 CEST DEBUG: (MainThread) "POST /api_jsonrpc.php HTTP/1.1" 200 None
2016-10-14 17:23:25 CEST DEBUG: (MainThread) Response Code: 200
2016-10-14 17:23:25 CEST DEBUG: (MainThread) Response Body: {
    "jsonrpc": "2.0",
    "result": [
        {
            "dependencies": [
                {
                    "soft": "0",
                    "linkid": "1",
                    "serviceupid": "1",
                    "serviceid": "2",
                    "sortorder": "0",
                    "servicedownid": "2"
                }
            ],
            "showsla": "0",
            "goodsla": "99.9000",
            "algorithm": "1",
            "serviceid": "1",
            "sortorder": "0",
            "triggerid": "0",
            "status": "0",
            "name": "Cachet"
        }
    ],
    "id": 1
}
2016-10-14 17:23:25 CEST DEBUG: (MainThread) Sending: {
    "jsonrpc": "2.0",
    "id": 2,
    "method": "service.get",
    "params": {
        "selectDependencies": "extend",
        "serviceids": [
            "2"
        ]
    },
    "auth": "xxxxxxxxxxxxxxxxxxxxxxxxx"
}
2016-10-14 17:23:25 CEST DEBUG: (MainThread) "POST /api_jsonrpc.php HTTP/1.1" 200 None
2016-10-14 17:23:25 CEST DEBUG: (MainThread) Response Code: 200
2016-10-14 17:23:25 CEST DEBUG: (MainThread) Response Body: {
    "jsonrpc": "2.0",
    "result": [
        {
            "dependencies": [],
            "showsla": "0",
            "goodsla": "99.9000",
            "algorithm": "1",
            "serviceid": "2",
            "sortorder": "0",
            "triggerid": "0",
            "status": "0",
            "name": "Plateformes Web publiques"
        }
    ],
    "id": 2
}
2016-10-14 17:23:25 CEST DEBUG: (MainThread) Sending: {
    "jsonrpc": "2.0",
    "id": 3,
    "method": "service.get",
    "params": {
        "selectDependencies": "extend",
        "serviceids": []
    },
    "auth": "xxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
2016-10-14 17:23:25 CEST DEBUG: (MainThread) "POST /api_jsonrpc.php HTTP/1.1" 200 None
2016-10-14 17:23:25 CEST DEBUG: (MainThread) Response Code: 200
2016-10-14 17:23:25 CEST DEBUG: (MainThread) Response Body: {
    "jsonrpc": "2.0",
    "result": [],
    "id": 3
}
2016-10-14 17:23:25 CEST DEBUG: (MainThread) Sending: {
    "jsonrpc": "2.0",
    "id": 4,
    "method": "trigger.get",
    "params": {
        "expandComment": "true",
        "triggerids": "0",
        "expandDescription": "true"
    },
    "auth": "xxxxxxxxxxxx"
}
2016-10-14 17:23:25 CEST DEBUG: (MainThread) "POST /api_jsonrpc.php HTTP/1.1" 200 None
2016-10-14 17:23:25 CEST DEBUG: (MainThread) Response Code: 200
2016-10-14 17:23:25 CEST DEBUG: (MainThread) Response Body: {
    "jsonrpc": "2.0",
    "result": [],
    "id": 4
}
2016-10-14 17:23:25 CEST ERROR: (MainThread) list index out of range

I tried to remove and recreate the trigger and the IT service but it still doesn't work.

Technical information

My configuration file


---
zabbix:
  user: bot
  pass: xxxxxxxxxxxxxxxx
  server: https://monitor.aresrpg.fr
  https-verify: true

cachet:
  token: 'xxxxxxxxxxxxxx'
  server: https://status.aresrpg.fr
  https-verify: true

settings:
  # IT Service which will be a root for Cachet Components
  # Leave it empty if you want to use /
  root_service: 'Cachet'
  # How often check Zabbix for new incidents
  update_inc_interval: 30  # in seconds
  # How often check Zabbix for new IT Services
  update_comp_interval: 30  # in seconds
  # Log level https://docs.python.org/3.4/library/logging.html#levels
  log_level: DEBUG
  # Additional logging level for requests module
  log_level_requests: DEBUG

Screenshots of Cachet and Zabbix




Duplicating Components

The script is creating componets inside my groups and outside:

2017-08-11 14:54:31 EDT INFO: (MainThread) Zabbix Cachet v.1.2.1 started
2017-08-11 14:54:31 EDT INFO: (MainThread) JSON-RPC Server Endpoint: http://zabbix.DOMAIN.local/api_jsonrpc.php
2017-08-11 14:54:31 EDT INFO: (MainThread) Component Group Corp AD was created.
2017-08-11 14:54:31 EDT INFO: (MainThread) Component LDAP was created in group id 7.
2017-08-11 14:54:32 EDT INFO: (MainThread) Component LDAP was created in group id 0.
2017-08-11 14:54:32 EDT INFO: (MainThread) Component Group Corp AD 02 was created.
2017-08-11 14:54:32 EDT INFO: (MainThread) Component LDAP was created in group id 8.
2017-08-11 14:54:32 EDT INFO: (MainThread) Successfully synced Cachet components with Zabbix Services
2017-08-11 14:54:32 EDT INFO: (MainThread) Restart triggers_watcher worker
2017-08-11 14:54:32 EDT INFO: (Trigger Watcher) start trigger watcher
2017-08-11 14:56:33 EDT INFO: (MainThread) Component Too Many Processes was created in group id 7.
2017-08-11 14:56:33 EDT INFO: (MainThread) Component Too Many Processes was created in group id 0.
2017-08-11 14:56:33 EDT INFO: (MainThread) Successfully synced Cachet components with Zabbix Services
2017-08-11 14:56:33 EDT INFO: (MainThread) Restart triggers_watcher worker
2017-08-11 14:57:33 EDT INFO: (Trigger Watcher) end trigger watcher
2017-08-11 14:57:34 EDT INFO: (Trigger Watcher) start trigger watcher
2017-08-11 14:59:36 EDT INFO: (MainThread) Component TEST was created in group id 8.
2017-08-11 14:59:36 EDT INFO: (MainThread) Component TEST was created in group id 0.
2017-08-11 14:59:36 EDT INFO: (MainThread) Successfully synced Cachet components with Zabbix Services
2017-08-11 14:59:36 EDT INFO: (MainThread) Restart triggers_watcher worker
2017-08-11 15:00:36 EDT INFO: (Trigger Watcher) end trigger watcher
2017-08-11 15:00:37 EDT INFO: (Trigger Watcher) start trigger watcher
2017-08-11 15:02:39 EDT INFO: (MainThread) Successfully synced Cachet components with Zabbix Services
2017-08-11 15:02:39 EDT INFO: (MainThread) Restart triggers_watcher worker
2017-08-11 15:02:39 EDT INFO: (Trigger Watcher) end trigger watcher
2017-08-11 15:02:40 EDT INFO: (Trigger Watcher) start trigger watcher
2017-08-11 15:04:41 EDT INFO: (MainThread) Successfully synced Cachet components with Zabbix Services
2017-08-11 15:06:43 EDT INFO: (MainThread) Successfully synced Cachet components with Zabbix Services

Initial error message replaced by ack

Hello,

I just started to use your docker container and have a major "issue", where I'm not sure wether its wanted or not.

If I kill zabbix-agent on a monitored host, everything's okay. A report is created and displayed in Cachet but once I ack it, the initial report is completely replaced by by the ack message. If I then resume the zabbix-agent, a "Resolved" is appended to the ack.

Log lines, which are relevant:

2017-09-16 19:49:21 INFO: (MainThread) Component *.*.*.lio-server.de was created in group id 4. 2017-09-16 19:49:21 INFO: (MainThread) Component *.*.*.lio-server.de was created in group id 0. 2017-09-16 19:49:21 INFO: (MainThread) Successfully synced Cachet components with Zabbix Services
It can be seen here, what I mean (Check the 16th of September)

Maintenance Alerts

Any Idea If We Can Also Get It To Update Cachet Maintenance Window Alerts? I Checked The API And It Seems To Support It.

Once I've Got A Test Install Up And Running I Might Have A Go.

Change service statuses when zabbix is unavailable

Hi,
Is there anything we can do to detect issues with zabbix itself? During large outages also zabbix itself can be affected and currently it will not reflect on Components of Cachet.

Maybe have the possibility to have a component in cachet called "Zabbix" or similar as an optional configuration? That will be marked down when there is issue with reaching zabbix for this plugin itself.

When I on purpose disrupt reaching of zabbix - then in the log I see:
Aug 8 08:01:07 ip-172-31-19-171 zabbix-cachet[22872]: 2017-08-08 08:01:07 UTC INFO: (Trigger Watcher) Resetting dropped connection: [hostname redacted]

So the plugin is aware of the connection breaking to zabbix, but it is not reflected in the components.

As a workaround we could create a separate monitor into Cachet itself to monitor zabbix, but it would be nicer if this zabbix-cachet itself is able to report zabbix issues.

ClientHttpError when exec docker

Hi, I'm trying to launch the docker image for the first time with

docker run --name zabbix-cachet -v /etc/zabbix-cachet.yml:/config.yml qk4l/zabbix-cachet

but this error appear:

2019-01-16 08:21:43  ERROR: (MainThread) ClientHttpError[http://domain:8000/api/v1/components/groups, 401: {"errors":[{"id":"6f919f7d-263d-464a-a5c9-6875ac3b820d","status":401,"title":"Unauthorized","detail":"Authentication is required and has failed or has not yet been provided."}]}]
2019-01-16 08:21:43  ERROR: (MainThread) argument of type 'NoneType' is not iterable

How can I solve that? There is no user and password for cachet in the .yml file

Not syncing properly

Issue is when there is an issue on Zabbix the issue isn't showing up on CachetHQ. How do I correct this? I've checked that the service/script is running. I've tried restarting it. I've also tried to manually set it to each of the settings and then back and it still is reporting that there is no issue.

Zabbix is reporting an issue.

0

The Frontend dashboard

screenshot-status lib utk edu-2018 04 24-10-26-37

Expanded the last one that is experiencing issues.

screenshot-status lib utk edu-2018 04 24-11-08-33

zabbix-cachet.py startup fails with error

Heyho!

Great work, but when i start zabbix-cachet.py, i get this error message:

./zabbix-cachet.py
2017-01-22 11:57:17 CET INFO: (MainThread) Zabbix Cachet v.0.1 started
2017-01-22 11:57:17 CET INFO: (MainThread) JSON-RPC Server Endpoint: http://watchdog01.test.int/api_jsonrpc.php
2017-01-22 11:57:17 CET ERROR: (MainThread) list index out of range

All requirements are installed. I'm using Python 3.5 on CentOS 7

Did i've something missing?

Acknowledged not working :(

Hi,

First of all, thanks for this script.

So, synchronization works correctly, error triggers generate the event in Cachet, but when it's automatically acknowledged in the trigger ("Event Generation OK" by expression)
I've the following error :

Exception in thread Trigger Watcher:
Traceback (most recent call last):
File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
self.run()
File "/usr/lib/python3.4/threading.py", line 868, in run
self._target(*self._args, **self._kwargs)
File "/usr/bin/zabbix-cachet", line 595, in triggers_watcher_worker
triggers_watcher(service_map)
File "/usr/bin/zabbix-cachet", line 511, in triggers_watcher
message=inc_msg)
File "/usr/bin/zabbix-cachet", line 454, in upd_incident
data = self._http_put(url, params)
File "/usr/bin/zabbix-cachet", line 251, in _http_put
r = requests.put(url=url, json=params, headers=self.headers, verify=self.verify)
File "/usr/lib/python3/dist-packages/requests/api.py", line 99, in put
return request('put', url, data=data, **kwargs)
File "/usr/lib/python3/dist-packages/requests/api.py", line 44, in request
return session.request(method=method, url=url, **kwargs)
TypeError: request() got an unexpected keyword argument 'json'

With log in debug I see the trigger in resolve :

}
2018-05-22 15:27:48 CEST DEBUG: (Trigger Watcher) Sending to http://0.0.0.0/api/v1/incidents/7: {
"component_id": 91,
"message": "Resolved - May 22, 15:27\n\n______\nLIAISONS Si\u00e8ges | TESTPING check failed - May 22, 15:15\n\nN'est pas disponible par ICMP",
"status": 4,
"component_status": 1
}

I tested creating a new trigger that is not acknowledged automatically and when I manually acknowledged (with a message) in Zabbix, I get the same error.
I modified the trigger associated with the service and restart a synchronization before my tests.

Cachet v2.3.14
Zabbix v3.4.9 (Maybe that's where the problem is)

Thanks in advance.

New Issue With Trigger Update

Hi,

Please see new issue below. Initial trigger updates cachet. When issue is fixed, I get the message below and cachet does not update.


2016-08-21 21:21:46  INFO: (MainThread) Zabbix Cachet v.0.1 started
2016-08-21 21:21:46  INFO: (MainThread) JSON-RPC Server Endpoint: http://zabbix.pqus.com/zabbix/api_jsonrpc.php
2016-08-21 21:21:48  INFO: (MainThread) Restart triggers_watcher worker
2016-08-21 21:21:48  INFO: (Trigger Watcher) start trigger watcher
2016-08-21 21:33:51  INFO: (Trigger Watcher) Incident Web Platforms | ServiceDesk Service Down (id=12) was created for component id 21.
2016-08-21 21:35:51  ERROR: (Trigger Watcher) ClientHttpError[http://status.pqus.com/api/v1/incidents/12, 500: {"errors":[{"id":"dfda8721-afcf-4750-81bb-cef0535e1dce","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}]

TypeError: list indices must be integers, not str

I have this problem:

2017-07-26 14:19:58 -03 INFO: (MainThread) Successfully synced Cachet components with Zabbix Services
2017-07-26 14:19:58 -03 INFO: (MainThread) Restart triggers_watcher worker
2017-07-26 14:19:58 -03 INFO: (Trigger Watcher) start trigger watcher

with python2

Exception in thread Trigger Watcher:
Traceback (most recent call last):
File "/usr/lib64/python2.7/threading.py", line 804, in __bootstrap_inner
self.run()
File "/usr/lib64/python2.7/threading.py", line 757, in run
self.__target(*self.__args, **self.__kwargs)
File "zabbix-cachet.py", line 483, in triggers_watcher_worker
triggers_watcher(service_map)
File "zabbix-cachet.py", line 424, in triggers_watcher
if zbx_event['acknowledged'] == '1':
TypeError: list indices must be integers, not str

with python3

Exception in thread Trigger Watcher:
Traceback (most recent call last):
File "/usr/lib64/python3.4/threading.py", line 920, in _bootstrap_inner
self.run()
File "/usr/lib64/python3.4/threading.py", line 868, in run
self._target(*self._args, **self._kwargs)
File "zabbix-cachet.py", line 483, in triggers_watcher_worker
triggers_watcher(service_map)
File "zabbix-cachet.py", line 424, in triggers_watcher
if zbx_event['acknowledged'] == '1':
TypeError: list indices must be integers, not str

I put on line 424 a print to the zbx_event and get this:

[{'eventid': '2989272', 'value': '1', 'source': '0', 'clock': '1501093615', 'objectid': '17103', 'object': '0', 'acknowledged': '0', 'acknowledges': [], 'ns': '876343048'}]

Obs:. this happen when I have an incident, but, sometimes dont show this error and add on works fine.
Can you help ?

the same error with python3 and python2

Error with embedding 'soft' dependencies

EDIT: Just noticed this causes an error. So I'm switching this from a "how to" to a "how to replicate error exactly"

$ systemctl status zabbix-cachethq.service
....
● zabbix-cachethq.service - Zabbix to Cachet Sync Service
   Loaded: loaded (/usr/lib/systemd/system/zabbix-cachethq.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2020-01-28 07:16:16 EST; 7h ago
 Main PID: 103293 (python3)
   CGroup: /system.slice/zabbix-cachethq.service
           └─103293 /PATH/.local/share/virtualenvs/zabbix-cachet-d3Qr61UG/bin/python3 /PATH/zabbix-cachet/zabbix-cachet.py

Jan 28 14:30:19 peacock zabbix-cachethq[103293]: 2020-01-28 14:30:19 EST ERROR: (Trigger Watcher) ClientHttpError[https://status.utk.edu/api/v1/incidents, 500: {"errors":[{"id":"f8b10c85-9031-48fd-b107-b9bb4598888d","status":500,"title":"Internal Server Error","detail":"An error has occurred and this resource cannot be displayed."}]}]
Jan 28 14:30:19 peacock zabbix-cachethq[103293]: 2020-01-28 14:30:19 EST ERROR: (Trigger Watcher) triggers_watcher() raised an Exception. Something gone wrong
Jan 28 14:30:19 peacock zabbix-cachethq[103293]: 2020-01-28 14:30:19 EST ERROR: (Trigger Watcher) 'NoneType' object is not subscriptable
Jan 28 14:30:19 peacock zabbix-cachethq[103293]: Traceback (most recent call last):
Jan 28 14:30:19 peacock zabbix-cachethq[103293]: File "/PATH/zabbix-cachet/zabbix-cachet.py", line 611, in triggers_watcher_worker
Jan 28 14:30:19 peacock zabbix-cachethq[103293]: triggers_watcher(service_map)
Jan 28 14:30:19 peacock zabbix-cachethq[103293]: File "/PATH/zabbix-cachet/zabbix-cachet.py", line 580, in triggers_watcher
Jan 28 14:30:19 peacock zabbix-cachethq[103293]: component_id=i['component_id'], component_status=comp_status)
Jan 28 14:30:19 peacock zabbix-cachethq[103293]: File "/PATH/zabbix-cachet/zabbix-cachet.py", line 444, in new_incidents
Jan 28 14:30:19 peacock zabbix-cachethq[103293]: incident_id=data['data']['id'],
Jan 28 14:30:19 peacock zabbix-cachethq[103293]: TypeError: 'NoneType' object is not subscriptable

I want to only show Parents + Children but not grandchildren (individual triggers/services) on the frontend page.

Turns out to be a little complicated but I hope this might help others attempting to not disclose too much information about their site on the status page.

Create the grouping you need in Zabbix Services first

Create groups of services with their triggers.

├──  ServerA HTTP/HTTPS Services
│   ├── ServerA: HTTP service is down
│   └── ServerA: HTTPs service is down
└──  ServerA Support Services
    ├── ServerA: I/O overloaded
    ├── ServerA:  Lack of available memory
    └── ServerA: MySQL is down

Set them to soft

Service Dependencies soft trigger image

Create a alternative to root for zabbix-cachet to look at

From within Zabbix Create a new service with a name and NO triggers. The example in this image I used 'cachethq'. Name it anything you want.
Create new root

Modify the config.yml file

Change it from a blank string to the name you created in the previous step.

settings:
  root_service: 'cachethq'

Remove all of the components from cachet

Before you start I would stop the zabbix-cachet service first.
Navigate to your Cachethq site's dashboard/components and remove everything (all those items that are normally imported. Otherwise the low level services that you want to hide will continue to appear.
Remove the component groups as well and restart the zabbix-cachet service.

It should not do anything yet but if it creates a component on the main status page of the blank component then you might need to change the root_service: ''cachethq" string to the number value of the zabbix service root_service: ''42".

Create the Children you want to show on the site.

Create a child with no triggers and the dependencies should only be the parents (not the child triggers) from root with soft checked for the services. Nothing should show up as a trigger on this page.
Properly set children

Once complete all that should show under cachethq is parents and children but not triggers.

Screen Shot 2020-01-24 at 11 25 50 AM

This should omit the children but still report the status. I've modified my component.blade.php file so the final info looks a bit different but I'm hoping it's obvious how this limits the information being disclosed.
Frontend View

This is a lot of screenshots. Apologies. I'd like to see something like this in the documentation or a simplified process for this.

(MainThread) list indices must be integers or slices, not str

I got error "(MainThread) list indices must be integers or slices, not str" when use ./zabbix-cachet.py .

root@cachetindo:/var/www/html/integrator/zabbix-cachet# ./zabbix-cachet.py 
2019-08-01 07:40:10 WIB INFO: (MainThread) Zabbix Cachet v.1.3.6 started
2019-08-01 07:40:10 WIB INFO: (MainThread) JSON-RPC Server Endpoint: https://zabbix.wowrack.com/zabbix/api_jsonrpc.php
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:794: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
2019-08-01 07:40:11 WIB INFO: (MainThread) Zabbix ver: 3.2.11. Cachet ver: 2.3.14-dev
2019-08-01 07:40:12 WIB ERROR: (MainThread) list indices must be integers or slices, not str

I have cloned the script twice and still get same error.
Could you let me know how to fix this error?
Thank you

Ability to nest trigers

Hi Artem,

Would it be possible to add the ability to trigger a service based on its subordinate triggers?

Currently only one level of nesting is allowed, we would like to have high-level categories that can be triggered by a number of subordinates.

ie.

Service Status (root level)
-- Core Services
---- Internet Service (shown on cachet, triggers based on subordinates)
------ Proxy Service (trigger, hidden on cachet)
------ DNS Service (trigger, hidden on cachet)

capture

Local ip

Can the script be used with local ip for zabbix and cachet ? Should the https verify turned to false ? Thanks

ERROR: (MainThread) Can not find any child service for ""

Hi,
I am running cachet in docker and I get the following error:

[root@projects zabbix-cachet]# docker run --name zabbix-cachet -v /root/docker/zabbix-cachet/config.yml:/config.yml qk4l/zabbix-cachet
2018-06-06 08:04:41  INFO: (MainThread) Zabbix Cachet v.1.3.5 started
2018-06-06 08:04:41  INFO: (MainThread) JSON-RPC Server Endpoint: http://montest.example.com/zabbix/api_jsonrpc.php
2018-06-06 08:04:41  INFO: (MainThread) Zabbix ver: 3.0.2. Cachet ver: 2.5.0-dev
2018-06-06 08:04:41  ERROR: (MainThread) Can not find any child service for ""
2018-06-06 08:04:41  ERROR: (MainThread) Sorry, can not create Zabbix <> Cachet mapping for you. Please check above errors

Any idea what I am doing wrong?

Typo bug

I've found a typo in a code, can you patch and publish new docker image please?

diff --git a/zabbix-cachet.py b/zabbix-cachet.py
index a1d3bbd..f89e337 100755
--- a/zabbix-cachet.py
+++ b/zabbix-cachet.py
@@ -236,7 +236,7 @@ class Cachet:
                                                                           indent=4,
                                                                           separators=(',', ': '))))
         try:
-            r = requests.put(url=url, json=params, headerhs=self.headers, verify=self.verify)
+            r = requests.put(url=url, json=params, headers=self.headers, verify=self.verify)
         except requests.exceptions.RequestException as e:
             raise client_http_error(url, None, e)
         # r.raise_for_status()

Non-latin symbols in templtaes

Hello,

I am trying to use non-latin symbols in templates.
Tried ansi and utf-8 charset, however, for anything non-latin zabbix-cachet.py responds with an error:
[root@status zabbix-cachet]# ./zabbix-cachet.py Traceback (most recent call last): File "./zabbix-cachet.py", line 675, in <module> config = read_config(CONFIG_F) File "./zabbix-cachet.py", line 664, in read_config return yaml.safe_load(open(config_f, "r")) File "/usr/lib64/python3.4/site-packages/yaml/__init__.py", line 94, in safe_load return load(stream, SafeLoader) File "/usr/lib64/python3.4/site-packages/yaml/__init__.py", line 70, in load loader = Loader(stream) File "/usr/lib64/python3.4/site-packages/yaml/loader.py", line 24, in __init__ Reader.__init__(self, stream) File "/usr/lib64/python3.4/site-packages/yaml/reader.py", line 85, in __init__ self.determine_encoding() File "/usr/lib64/python3.4/site-packages/yaml/reader.py", line 124, in determine_encoding self.update_raw() File "/usr/lib64/python3.4/site-packages/yaml/reader.py", line 178, in update_raw data = self.stream.read(size) File "/usr/lib64/python3.4/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xee in position 1015: ordinal not in range(128)

Trigger Not Updating Cachet

Good morning,

New issue now. The triggers are not reflecting on cachet. The only thing replicating from zabbix to cachet are the groups and components.

image

image

running zabbix-cachet.py error

I started the implementation but then got this error

2017-07-20 15:04:33 UTC INFO: (MainThread) Zabbix Cachet v.0.2.1 started
2017-07-20 15:04:33 UTC ERROR: (MainThread) Unable to parse json: No JSON object could be decoded

Running
Zabbix 3.2.6
OS Centos 7
Cachet 2.4-dev
Python 2.7.5

---
zabbix:
  user: anna
  pass: zabbixpass
  server: https://zabbix.example.com/index.php
  https-verify: true

cachet:
  token: api token
  server: https://status.cachet.com
  https-verify: true

settings:
  # IT Service which will be a root for Cachet Components
  # Leave it empty if you want to use /
  root_service: ''
  # How often check Zabbix for new incidents
  update_inc_interval: 120  # in seconds
  # How often check Zabbix for new IT Services
  update_comp_interval: 3600  # in seconds
  # Log level https://docs.python.org/3.4/library/logging.html#levels
  log_level: INFO
  # Additional logging level for requests module
  log_level_requests: WARNING
~

screen shot 2017-07-21 at 11 29 00

Cachet Auth Issues

Possible auth issues?

Trying to set up for the first time. Ran the zabbix-cachet.py with the following error(s). Not sure what I'm doing wrong or what I've missed.

$ ./zabbix-cachet.py

2018-03-28 11:26:10 EDT INFO: (MainThread) Zabbix Cachet v.1.3.4 started
2018-03-28 11:26:10 EDT INFO: (MainThread) JSON-RPC Server Endpoint: https://zmonitor.lib.utk.edu/api_jsonrpc.php
2018-03-28 11:26:10 EDT INFO: (MainThread) Zabbix ver: 3.2.11. Cachet ver: 2.3.9
2018-03-28 11:26:10 EDT ERROR: (MainThread) ClientHttpError[https://cachet.example.com/api/v1/components, 401: {"errors":[{"id":"00452337-0803-45ef-8d6b-26324ff860ec","status":401,"title":"Unauthorized","detail":"Authentication is required and has failed or has not yet been provided."}]}]
2018-03-28 11:26:10 EDT ERROR: (MainThread) 'NoneType' object is not subscriptable

File: config.yml

Not my actual values (obviously) but wasn't sure what needs to be wrapped (if anything) in quotes. And I removed comment fields for this issue post. The service name is the URL of the service (something.example.com). I did try to just aim it at the root ('/') with no luck. Root would be preferred.

zabbix:
  user: read_access_only_user
  pass: this_is_my_password
  server: https://zabbix.example.com
  https-verify: true

cachet:
  token: base64:Not_REAL-HNvyVLGYaUyhOfEsMcKIhTHhZDmZl4wtnbOS3kyD-Not_REAL=
  server: https://cachet.example.com
  https-verify: true

settings:
  root_service: 'something.example.com'
  update_inc_interval: 120
  update_comp_interval: 3600
  log_level: INFO
  log_level_requests: WARNING

templates:
  acknowledgement: "{message}\n\n###### {ack_time} by {author}\n\n______\n"
  investigating: "{group} | {component} check **failed** - {time}\n\n```{trigger_name}```"
  resolving: "__Resolved__ - {time}\n\n______\n"

Timezone using local set timezone

This is great when it's running on the same server as cachet but not so great when it's running in a container in Kubernetes where cachet is. All of the messages for incidents are in UTC but the zabbix events are in local time and cachet is setup to also be in local time (EDT in this case)

Can we work on getting support for setting this timezone so it will work in k8s correctly?

Not finding childs

Hello,

I have these IT services :

root
| SC001
| | Service 1 (with trigger)
| | Service 2 (with trigger)
| | Service 3 (with trigger)
| | Service 4 (with trigger)

In my config file, I put : root_service: 'SC001'
And I get this error when starting the service :

Mar 02 23:30:55 sc002 zabbix-cachet[22807]: 2019-03-02 23:30:55 UTC ERROR: (MainThread) Can not find any child service for "SC001"

Any idea ? Thank you ! :)

Script does not update incident from zabbix acknowleddgment messages

I am investigating the use of Cachet and this zabbix-cachet container. I am using zabbix 3.0.9, Cachet 2.3.12 and the latest version of this script/container.

I have created a very simple IT Services

  • Cachet
    -- Test Service
    --- Host1 Trigger

When I run the script it correctly creates everything in Cachet.

If I fault the Test Service on Host1 , once zabbix see's the fault, the script updates Cachet correctly. If I repair the fault, it is again updated in Cachet correctly.

However, I fault the Test service on Host1, allow zabbix to see it and the script to update cachet. I then Ack the fault in zabbix. The script sees the Ack but does not update zabbix and subsequently appears to hang. I have to restart the container.
Attached is a log of a complete session as described above.

debug.txt

Unit zabbix-cachet.service entered failed state

Installed with apt-get
version = '0.1'

● zabbix-cachet.service - Zabbix-Cachet
Loaded: loaded (/lib/systemd/system/zabbix-cachet.service; enabled)
Active: failed (Result: exit-code) since Fri 2016-11-11 15:44:29 EST; 30min ago
Process: 2398 ExecStart=/usr/bin/zabbix-cachet (code=exited, status=1/FAILURE)
Main PID: 2398 (code=exited, status=1/FAILURE)

Nov 11 15:44:25 MONITORING systemd[1]: Starting Zabbix-Cachet...
Nov 11 15:44:25 MONITORING systemd[1]: Started Zabbix-Cachet.
Nov 11 15:44:29 MONITORING systemd[1]: zabbix-cachet.service: main process exited, code=exited, status=1/FAILURE
Nov 11 15:44:29 MONITORING systemd[1]: Unit zabbix-cachet.service entered failed state.

LOG:
2016-11-11 15:44:25 EST DEBUG: (MainThread) "POST /zabbix/api_jsonrpc.php HTTP/1.1" 200 36
2016-11-11 15:44:25 EST DEBUG: (MainThread) Response Code: 200
2016-11-11 15:44:25 EST DEBUG: (MainThread) Response Body: {
"result": [],
"jsonrpc": "2.0",
"id": 3
}
2016-11-11 15:44:25 EST DEBUG: (MainThread) Sending: {
"method": "trigger.get",
"auth": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"jsonrpc": "2.0",
"id": 4,
"params": {
"expandComment": "true",
"expandDescription": "true",
"triggerids": "14164"
}
}
2016-11-11 15:44:25 EST INFO: (MainThread) Starting new HTTP connection (1): status.mysite.com
2016-11-11 15:44:29 EST DEBUG: (MainThread) "GET /api/v1/components HTTP/1.1" 200 1202
2016-11-11 15:44:29 EST DEBUG: (MainThread) Sending: {
"method": "trigger.get",
"auth": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"jsonrpc": "2.0",
"id": 5,
"params": {
"expandComment": "true",
"expandDescription": "true",
"triggerids": "0"
}
}
2016-11-11 15:44:29 EST DEBUG: (MainThread) "POST /zabbix/api_jsonrpc.php HTTP/1.1" 200 36
2016-11-11 15:44:29 EST DEBUG: (MainThread) Response Code: 200
2016-11-11 15:44:29 EST DEBUG: (MainThread) Response Body: {
"result": [],
"jsonrpc": "2.0",
"id": 5
}
2016-11-11 15:44:29 EST ERROR: (MainThread) list index out of range

Install Location

Hello,

This is not an issue or a bug, just a quick question. Is there a specific server this needs to be installed on? If not, is it preferable to install this on the box running zabbix or the box running cachet?

Thank you,

Evangelos

Triggers not updating status after Zabbix is triggering events

So I managed the get zabbix-cachet plugin working. Now I have another issue (or issues)

First plugin is checking the status of the triggers every 60 minutes which is reflected in the log

Aug  3 08:49:56 localhost python: 2017-08-03 08:49:56 UTC INFO: (MainThread) Successfully synced Cachet components with Zabbix Services
Aug  3 09:49:57 localhost python: 2017-08-03 09:49:57 UTC INFO: (MainThread) Successfully synced Cachet components with Zabbix Services

Yet the Cachet itself is saying no update since I started the plugin yesterday

screen shot 2017-08-03 at 11 12 29

Second issue:
I triggered the even on my IT services for testing purposes - The Test1 is pinging the website every 60 sec and return 200 OK, if not available it returns 400
And I am getting this error

Aug  3 09:52:37 localhost python: 2017-08-03 09:52:37 UTC ERROR: (Trigger Watcher) ClientHttpError[https://status.sonru.com/api/v1/incidents, 400: {"errors":[{"id":"261aa814-c094-4550-acb9-107f4969d82c","status":400,"title":"Bad Request","detail":"The request cannot be fulfilled due to bad syntax.","meta":{"details":["The notify field must be true or false."]}}]}]

The description field is required. Cachet 2.4

With Cachet 2.4.0DEV, the POST to Cachet on new components failed with HTTP return code 400: "The description field is required"

ERROR: (MainThread) ClientHttpError[https://xxxxxxxxx/api/v1/components, 400: {"errors":[{"id":"xxxxxxxxxxxx","status":400,"title":"Bad Request","detail":"The request cannot be fulfilled due to bad syntax.","meta":{"details":["The name field is required.","The description field is required."]}}]}]

As a work-around, I change line #237 to params = {'name': name, 'link': '', 'description': name, 'status': '1', 'group_id': 0}

TypeError: list indices must be integers, not str

Hello,

I have a TypeError:

2018-01-11 15:32:19 CET DEBUG: (MainThread) Creating Component Group FOOBAR...
2018-01-11 15:32:19 CET DEBUG: (MainThread) Sending to http://cachet.local/api/v1/components/groups: {
    "collapsed": 2,
    "name": "FOOBAR"
}
2018-01-11 15:32:19 CET INFO: (MainThread) Starting new HTTP connection (1): cachet.local
2018-01-11 15:32:19 CET DEBUG: (MainThread) "POST /api/v1/components/groups HTTP/1.1" 301 185
2018-01-11 15:32:19 CET INFO: (MainThread) Starting new HTTPS connection (1): cachet.local
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:791: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
2018-01-11 15:32:19 CET DEBUG: (MainThread) "GET /api/v1/components/groups HTTP/1.1" 200 None
2018-01-11 15:32:19 CET DEBUG: (MainThread) Response Body: {
    "meta": {
        "pagination": {
            "count": 0,
            "links": {
                "next_page": null,
                "previous_page": null
            },
            "current_page": 1,
            "total_pages": 0,
            "per_page": 20,
            "total": 0
        }
    },
    "data": []
}
Traceback (most recent call last):
  File "zabbix-cachet.py", line 701, in <module>
    zbxtr2cachet_new = init_cachet(itservices)
  File "zabbix-cachet.py", line 604, in init_cachet
    group = cachet.new_components_gr(zbx_service['name'])
  File "zabbix-cachet.py", line 389, in new_components_gr
    logging.info('Component Group {} was created ({})'.format(params['name'], data['data']['id']))
TypeError: list indices must be integers, not str

I dont know why data is a list here, i am using the tools from the requierements.txt in the exact versions and Zabbix 3.4.4 as well as cachet: 2.4.0-dev

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.