# 开源监控对接

> 公司使用的Prometheus、Openfalcon、zabbix等开源监控工具的告警完全可以对接到Saturn监控中心，来统一管控告警，控制告警风暴，对报警分类及统一告警模板、告警分析等，下面介绍每种开源工具对接方式.

#### 对接后所有告警都会统一在告警历史中记录

![history](/files/w9peWI64OD5OazYy1pSk)

>

### Prometheus告警接入

> uri: /api/v2/prometheus 修改Alertmanager告警接收人配置,替换webhook\_configs中的url为告警平台saturn的地址。 ![config](/files/7e0OlbwxG7ntNDYXGoMi)

### Openfalcon告警接入

> uri: /api/v2/falcon 修改alarm组件cfg.json配置文件,告警会发送给告警中心统一记录分析。 ![falcon](/files/vmRIcpGBohpSs3QWCUPt)

### zabbix对接地址 <http://saturs地址/api/v2/zabbix/>

![zabbixconfig](/files/6XGnC4bxBqg69bjb6bxl)

```
zabbix告警脚本名称请保持上图脚本名称一致 按照实际修改
#!/usr/local/python36/bin/python3.6
#!coding:utf-8
from redis.sentinel import Sentinel,MasterNotFoundError,SlaveNotFoundError
import os,sys,json,time,re
import requests,redis
RequestsHeader = {"Content-Type": "application/json"}


class Alert(object):
    def __init__(self):
        '''
            传入配置文件名。
        '''
        self.message = sys.argv[-1]

    def IntegrateAliDtsAlert(self):
        MessageList = self.AlertMessage.split('\n')
        message = ''
        for iterm in MessageList:
            if '主机IP' not in iterm:
                message += (iterm + '\n')
        return message

    def AlertDingDing(self):
     
        RequestsHeader = {"Content-Type": "application/json"}
        result = requests.post("http://saturn地址/api/v2/zabbix/", data=json.dumps({'AlarmType':'ZabbixAlarm','AlarmMsg':self.message}), headers=RequestsHeader)

if __name__ == '__main__':
    Alert().AlertDingDing()
```

### 自定义告警对接

> uri: /api/v2/push

![push](/files/EWYwYmbYaFzMzFYAwjyy)

#### 告警效果

![ding](/files/XSXLLDeS2o0YezWN4sUm)

#### 业务日志基于告警策略检索ES后的告警效果

![es](/files/dln2TUygJqctf1FgSJ7F)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ztth.gitbook.io/gops/yong-hu-shou-ce/saturn/join.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
