Clickhouse table
CREATE TABLE zabbix.events
(
`Date` Date DEFAULT toDate(Clock),
`Clock` UInt32,
`RecoveryClock` UInt32,
`Eventid` UInt64,
`Name` String,
`Hosts` Array(String),
`Groups` Array(String),
`Tags` Array(String),
`Source` String,
`Severity` String
)
ENGINE = ReplacingMergeTree(RecoveryClock)
PARTITION BY toISOWeek(Date)
ORDER BY Eventid
Installation:
- Go to alert script location
- Create venv for script
python3 -m venv venv_click
- Activate venv and install clickhouse_client module
pip install clickhouse-driver deactivate
- Download script and edit path to venv
- Add media type
- Add media to Super Admin user
- Add actions
Actions text:
Problem
Subject
{EVENT.VALUE}
Message:
{"datetime":"{EVENT.DATE} {EVENT.TIME}","eventid":{EVENT.ID},"name":"{EVENT.NAME}","groups":"{TRIGGER.HOSTGROUP.NAME}","host":"{HOST.NAME}","tags":"{EVENT.TAGS}","source":"ZabbixSYSLOCAL","severity":"{EVENT.SEVERITY}"}
Recovery
Subject
{EVENT.VALUE}
Message:
{"recoverydatetime":"{EVENT.RECOVERY.DATE} {EVENT.RECOVERY.TIME}","eventid":{EVENT.ID},"startdatetime":"{EVENT.DATE} {EVENT.TIME}","name":"{EVENT.NAME}","groups":"{TRIGGER.HOSTGROUP.NAME}","host":"{HOST.NAME}","tags":"{EVENT.TAGS}","source":"ZabbixSYSLOCAL","severity":"{EVENT.SEVERITY}"}