added 'asterisk'

This commit is contained in:
Pavel Muhortov 2024-06-29 11:22:42 +03:00
parent acbc1d9758
commit 8746596e01
3 changed files with 188 additions and 0 deletions

View File

@ -5,6 +5,7 @@ Templates, scripts and hints for Zabbix.
## [Templates](templates)
* [Applications](templates/applications)
* [Asterisk](templates/applications/asterisk/6.0)
* [check.business.ru](templates/applications/check.business.ru/6.0)
* [MiniDLNA](templates/applications/minidlna/6.0)
* [VPN](templates/applications/vpn)

View File

@ -0,0 +1,65 @@
# Asterisk by HTTP - TSP network check
## Overview
This template is designed for Asterisk custom web-page parse by HTTP agent and doesn't require any external scripts.
Custom web-page request:
```shell
curl http://asterisk/network_check.php
```
Custom web-page response:
```json
{"providers":[{"name":"tsp-1","last_check":"2001-01-01 01:01:01"},{"name":"tsp-2","last_check":"2002-02-02 02:02:02"}]}
```
## Requirements
- Zabbix version: 6.0 and higher.
## Tested versions
This template has been tested on:
- [Debian GNU/Linux 12](http://ftp.debian.org/debian/dists/bookworm/)
### Macros used
|Name|Description|Default|
|----|-----------|-------|
|{$TSP.AVAIL.DEADLINE}|Availability deadline in seconds|`900`|
|{$TSP.STATUS.PATH}|path to custom web-page|`http://asterisk/network_check.php`|
|{$TSP.DESCRIPTION.<TSP_NAME>}|trigger operational data info||
### Items
|Name|Description|Type|Key and additional info|
|----|-----------|----|-----------------------|
|Asterisk TSP: Get stats|-|HTTP agent|asterisk.tsp.get_status|
### Triggers
There are no triggers in this template.
### Discovery rules
|Name|Description|Type|Key and additional info|
|----|-----------|----|-----------------------|
|Discovery Asterisk TSP|-|Dependent item|get.asterisk.tsp.stats|
### Item prototypes
|Name|Description|Type|Key and additional info|
|----|-----------|----|-----------------------|
|Asterisk TSP "{#TSP_NAME}" last success check|-|Dependent item|asterisk.tsp.last_check.name[{#TSP_NAME}]|
|Asterisk TSP "{#TSP_NAME}" last success check timestamp|-|Dependent item|asterisk.tsp.last_check.timestamp.name[{#TSP_NAME}]|
### Trigger prototypes
|Name|Description|Expression|Severity|Dependencies and additional info|
|----|-----------|----------|--------|--------------------------------|
|Asterisk TSP "{#TSP_NAME}" not available for {$TSP.AVAIL.DEADLINE} seconds|-|last(/Asterisk by HTTP - TSP network check/asterisk.tsp.last_check.name[{#TSP_NAME}],#1)>{$TSP.AVAIL.DEADLINE}|Average|Manual close: No, Operational data: {$TSP.DESCRIPTION.{#TSP_NAME}}|

View File

@ -0,0 +1,122 @@
zabbix_export:
version: '6.0'
date: '2024-06-27T00:00:00Z'
groups:
-
uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
name: Templates/Applications
templates:
-
uuid: ed25bfc3c7e84c8abc484ea208457db3
template: 'Asterisk by HTTP - TSP network check'
name: 'Asterisk by HTTP - TSP network check'
groups:
-
name: Templates/Applications
items:
-
uuid: cdae5f6801b44131b951c5c75071b8bb
name: 'Asterisk TSP: Get stats'
type: HTTP_AGENT
key: asterisk.tsp.get_status
history: 1h
trends: '0'
value_type: TEXT
description: 'Converted Asterisk TSP status to JSON'
preprocessing:
-
type: JAVASCRIPT
parameters:
- 'return value.toUpperCase()'
url: '{$TSP.STATUS.PATH}'
tags:
-
tag: Application
value: Asterisk
-
tag: component
value: raw
discovery_rules:
-
uuid: 3925e2ee2f414dfb8f5ef35a986a14f2
name: 'Discovery Asterisk TSP'
type: DEPENDENT
key: get.asterisk.tsp.stats
delay: '0'
item_prototypes:
-
uuid: e32065344b6042d9ac49a04daa15def1
name: 'Asterisk TSP "{#TSP_NAME}" last success check'
type: DEPENDENT
key: 'asterisk.tsp.last_check.name[{#TSP_NAME}]'
delay: '0'
preprocessing:
-
type: JAVASCRIPT
parameters:
- 'return Math.trunc( (Date.now() - Date.parse(new Date(Date.parse(value)))) / 1000 + 10800 )'
master_item:
key: 'asterisk.tsp.last_check.timestamp.name[{#TSP_NAME}]'
tags:
-
tag: Application
value: Asterisk
-
tag: TSP
value: '{#TSP_NAME}'
trigger_prototypes:
-
uuid: ba610e0de2cd47229376252c90cda88f
expression: 'last(/Asterisk by HTTP - TSP network check/asterisk.tsp.last_check.name[{#TSP_NAME}],#1)>{$TSP.AVAIL.DEADLINE}'
name: 'Asterisk TSP "{#TSP_NAME}" not available for {$TSP.AVAIL.DEADLINE} seconds'
opdata: '{$TSP.DESCRIPTION.{#TSP_NAME}}'
priority: AVERAGE
-
uuid: 86667b8e0f68470eadd229d86a79362a
name: 'Asterisk TSP "{#TSP_NAME}" last success check timestamp'
type: DEPENDENT
key: 'asterisk.tsp.last_check.timestamp.name[{#TSP_NAME}]'
delay: '0'
trends: '0'
value_type: TEXT
preprocessing:
-
type: JSONPATH
parameters:
- '$.PROVIDERS.[?(@.NAME=="{#TSP_NAME}")].LAST_CHECK.first()'
master_item:
key: asterisk.tsp.get_status
tags:
-
tag: Application
value: Asterisk
-
tag: TSP
value: '{#TSP_NAME}'
master_item:
key: asterisk.tsp.get_status
lld_macro_paths:
-
lld_macro: '{#TSP_LAST_CHECK}'
path: $..LAST_CHECK.first()
-
lld_macro: '{#TSP_NAME}'
path: $..NAME.first()
preprocessing:
-
type: STR_REPLACE
parameters:
- PROVIDERS
- data
tags:
-
tag: Application
value: Asterisk
macros:
-
macro: '{$TSP.AVAIL.DEADLINE}'
value: '900'
description: 'Availability deadline in seconds'
-
macro: '{$TSP.STATUS.PATH}'
value: 'http://asterisk/network_check.php'