62 lines
1.4 KiB
Markdown
62 lines
1.4 KiB
Markdown
# 启动
|
||
docker-compose -f zabbix.yml up -d
|
||
# 查看进程
|
||
docker-compose ps
|
||
# 停止
|
||
docker-compose -f zabbix.yml down
|
||
|
||
# http://192.168.8.110:8088/index.php
|
||
Admin/zabbix
|
||
|
||
# 如果发现zabbix_server起不来,状态是Exit,查看日志
|
||
docker logs -f mysql-server
|
||
docker logs -f zabbix-java-gateway
|
||
docker logs -f zabbix-server
|
||
docker logs -f zabbix-web-nginx-mysql
|
||
docker logs -f zabbix-agent
|
||
|
||
# 测试端口
|
||
docker exec -uroot -it zabbix-server bash
|
||
nc -vz 172.17.0.1 10050 -w 2
|
||
nc -vz 172.17.0.1 10051 -w 2
|
||
|
||
|
||
# 安装Python3
|
||
```python
|
||
#!/usr/bin/python3
|
||
# -*- coding: utf-8 -*-
|
||
|
||
import json
|
||
import sys
|
||
import os
|
||
import datetime
|
||
import http.client
|
||
|
||
# 你复制的webhook地址粘贴进url内
|
||
def send_message(key, message):
|
||
url = f"https://open.larksuite.com/open-apis/bot/v2/hook/{key}"
|
||
payload_message = {
|
||
"msg_type": "text",
|
||
"content": {
|
||
"text": message
|
||
}
|
||
}
|
||
headers = {
|
||
'Content-Type': 'application/json'
|
||
}
|
||
|
||
conn = http.client.HTTPSConnection("open.larksuite.com")
|
||
conn.request("POST", f"/open-apis/bot/v2/hook/{key}", body=json.dumps(payload_message), headers=headers)
|
||
response = conn.getresponse()
|
||
data = response.read()
|
||
conn.close()
|
||
return data
|
||
|
||
if __name__ == '__main__':
|
||
key = sys.argv[1]
|
||
text = sys.argv[2]
|
||
send_message(key, text)
|
||
```
|
||
|
||
# 脚本参数
|
||
{ALERT.SENDTO} {ALERT.MESSAGE} |