update readme
This commit is contained in:
parent
2445f54899
commit
7b135a1785
45
README.md
45
README.md
|
@ -1,5 +1,50 @@
|
||||||
# osnova-api-alert
|
# osnova-api-alert
|
||||||
|
|
||||||
|
swagger - https://osnova-api-alert.sm8255082.ru/docs
|
||||||
|
|
||||||
|
endpoints:
|
||||||
|
- https://osnova-api-alert.sm8255082.ru/ping (get, post)
|
||||||
|
без авторизации, без параметров
|
||||||
|
- https://osnova-api-alert.sm8255082.ru/api/v1/tg/send (post)
|
||||||
|
в заголовке должен быть токен 'x-api-key: токен'
|
||||||
|
должны предаваться в data problem_id:int, message:str
|
||||||
|
js для заббикса:
|
||||||
|
```js
|
||||||
|
function sendMessage(value) {
|
||||||
|
var params = JSON.parse(value),
|
||||||
|
data,
|
||||||
|
response,
|
||||||
|
request = new HttpRequest(),
|
||||||
|
url = 'https://osnova-api-alert.sm8255082.ru/api/v1/tg/send';
|
||||||
|
request.addHeader('Content-Type: application/json');
|
||||||
|
request.addHeader('x-api-key: nz7cA1NKOwxwtiTZdbBDtLwopt2tOm7W');
|
||||||
|
data = JSON.stringify(params);
|
||||||
|
response = request.post(url, data);
|
||||||
|
|
||||||
|
if (request.getStatus() === 200) {
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (typeof response.description === 'string') {
|
||||||
|
throw response.description;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw 'Unknown error. Check debug log for more information.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
Zabbix.log(4, value)
|
||||||
|
sendMessage(value);
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
throw 'Unknown error ' + error;
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
You can try to get the message_thread_id from the message link
|
You can try to get the message_thread_id from the message link
|
||||||
|
|
Loading…
Reference in New Issue