added minidlna teplate
This commit is contained in:
parent
2f53d79694
commit
4e794b611c
|
@ -1,2 +1,8 @@
|
||||||
# zabbix
|
# Zabbix
|
||||||
|
|
||||||
|
Templates, scripts and hints for Zabbix.
|
||||||
|
|
||||||
|
## [Templates](templates)
|
||||||
|
|
||||||
|
* [Applications](templates/applications)
|
||||||
|
* [MiniDLNA](templates/applications/minidlna/6.0)
|
||||||
|
|
55
templates/applications/minidlna/6.0/README.md
Executable file
55
templates/applications/minidlna/6.0/README.md
Executable file
|
@ -0,0 +1,55 @@
|
||||||
|
|
||||||
|
# MiniDLNA by HTTP
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
This template is designed for [MiniDLNA](https://minidlna.sourceforge.net/) monitoring by Zabbix via HTTP and doesn't require any external scripts.
|
||||||
|
The template `MiniDLNA by HTTP` - collects metrics by polling MiniDLNA status page with HTTP agent remotely.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
Zabbix version: 6.0 and higher.
|
||||||
|
|
||||||
|
## Tested versions
|
||||||
|
|
||||||
|
This template has been tested on:
|
||||||
|
|
||||||
|
- MiniDLNA 1.3.0
|
||||||
|
|
||||||
|
### Macros used
|
||||||
|
|
||||||
|
|Name|Description|Default|
|
||||||
|
|----|-----------|-------|
|
||||||
|
|{$MINIDLNA.STATUS.PORT}}|The port of the MiniDLNA status page.|`8200`|
|
||||||
|
|{$MINIDLNA.STATUS.SCHEME}|The request scheme, which may be either HTTP or HTTPS.|`http`|
|
||||||
|
|
||||||
|
### Items
|
||||||
|
|
||||||
|
|Name|Description|Type|Key and additional info|
|
||||||
|
|----|-----------|----|-----------------------|
|
||||||
|
|MiniDLNA: Get status|Converted MiniDLNA status to JSON|HTTP agent|minidlna.get_status|
|
||||||
|
|MiniDLNA: Audio files|Amount of audio files|Dependent item|minidlna.audio_files|
|
||||||
|
|MiniDLNA: Image files|Amount of image files|Dependent item|minidlna.image_files|
|
||||||
|
|MiniDLNA: Video files|Amount of video files|Dependent item|minidlna.video_files|
|
||||||
|
|MiniDLNA: Clients amount|Amount of clients|Dependent item|minidlna.clients_num|
|
||||||
|
|MiniDLNA: Version|Service version|Dependent item|minidlna.version|
|
||||||
|
|MiniDLNA: Service ping|-|Simple check|net.tcp.service[{$MINIDLNA.STATUS.SCHEME},"{HOST.CONN}","{$MINIDLNA.STATUS.PORT}"]|
|
||||||
|
|
||||||
|
### Triggers
|
||||||
|
|
||||||
|
|Name|Description|Expression|Severity|Dependencies and additional info|
|
||||||
|
|----|-----------|----------|--------|--------------------------------|
|
||||||
|
|MiniDLNA: Service is down||last(/MiniDLNA by HTTP/net.tcp.service[{$MINIDLNA.STATUS.SCHEME},"{HOST.CONN}","{$MINIDLNA.STATUS.PORT}"])=0|Average|Manual close: Yes|
|
||||||
|
|
||||||
|
### Discovery rules
|
||||||
|
|
||||||
|
|Name|Description|Type|Key and additional info|
|
||||||
|
|----|-----------|----|-----------------------|
|
||||||
|
|Clients discovery|The discovery of clients|Dependent item|minidlna.clients.discovery|
|
||||||
|
|
||||||
|
### Item prototypes for Clients discovery
|
||||||
|
|
||||||
|
|Name|Description|Type|Key and additional info|
|
||||||
|
|----|-----------|----|-----------------------|
|
||||||
|
|MiniDLNA client "{#MINIDLNA_CLIENT_IPADDR}" connections|Number of connections from client|Dependent item|minidlna.client.connections[{#MINIDLNA_CLIENT_IPADDR}]|
|
||||||
|
|MiniDLNA client "{#MINIDLNA_CLIENT_IPADDR}" MAC address|Client MAC address|Dependent item|minidlna.client.hw_address[{#MINIDLNA_CLIENT_IPADDR}]|
|
340
templates/applications/minidlna/6.0/minidlna_by_http.yaml
Executable file
340
templates/applications/minidlna/6.0/minidlna_by_http.yaml
Executable file
|
@ -0,0 +1,340 @@
|
||||||
|
zabbix_export:
|
||||||
|
version: '6.0'
|
||||||
|
date: '2023-09-09T17:00:00Z'
|
||||||
|
groups:
|
||||||
|
-
|
||||||
|
uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
|
||||||
|
name: Templates/Applications
|
||||||
|
templates:
|
||||||
|
-
|
||||||
|
uuid: d0ccd623f0534ff886bf14b4df9aef0e
|
||||||
|
template: 'MiniDLNA by HTTP'
|
||||||
|
name: 'MiniDLNA by HTTP'
|
||||||
|
groups:
|
||||||
|
-
|
||||||
|
name: Templates/Applications
|
||||||
|
items:
|
||||||
|
-
|
||||||
|
uuid: ac1b5ca61f114dd09961d763a601c53a
|
||||||
|
name: 'MiniDLNA: Audio files'
|
||||||
|
type: DEPENDENT
|
||||||
|
key: minidlna.audio_files
|
||||||
|
delay: '0'
|
||||||
|
description: 'Amount of audio files'
|
||||||
|
preprocessing:
|
||||||
|
-
|
||||||
|
type: JSONPATH
|
||||||
|
parameters:
|
||||||
|
- $.audio_files
|
||||||
|
master_item:
|
||||||
|
key: minidlna.get_status
|
||||||
|
tags:
|
||||||
|
-
|
||||||
|
tag: Application
|
||||||
|
value: minidlna
|
||||||
|
-
|
||||||
|
uuid: b28dab5c0ea84f7a892e061dbd4b8f51
|
||||||
|
name: 'MiniDLNA: Clients amount'
|
||||||
|
type: DEPENDENT
|
||||||
|
key: minidlna.clients_num
|
||||||
|
delay: '0'
|
||||||
|
description: 'Amount of clients'
|
||||||
|
preprocessing:
|
||||||
|
-
|
||||||
|
type: JSONPATH
|
||||||
|
parameters:
|
||||||
|
- $.clients_num
|
||||||
|
master_item:
|
||||||
|
key: minidlna.get_status
|
||||||
|
tags:
|
||||||
|
-
|
||||||
|
tag: Application
|
||||||
|
value: minidlna
|
||||||
|
-
|
||||||
|
uuid: eed1cf5217164710bc1c428fb6a0e193
|
||||||
|
name: 'MiniDLNA: Get status'
|
||||||
|
type: HTTP_AGENT
|
||||||
|
key: minidlna.get_status
|
||||||
|
history: 1h
|
||||||
|
trends: '0'
|
||||||
|
value_type: TEXT
|
||||||
|
description: 'Converted MiniDLNA status to JSON'
|
||||||
|
preprocessing:
|
||||||
|
-
|
||||||
|
type: JAVASCRIPT
|
||||||
|
parameters:
|
||||||
|
- |
|
||||||
|
// Convert MiniDLNA status to JSON
|
||||||
|
var clients_raw = [];
|
||||||
|
var clients_arr = [];
|
||||||
|
var clients_num = 0;
|
||||||
|
|
||||||
|
// Get all clients
|
||||||
|
clients_raw = value.split('<tr><td>ID</td><td>Type</td><td>IP Address</td><td>HW Address</td><td>Connections</td></tr>')[1].split('</table>')[0].split(/<tr><td>\d<\/td><td>/);
|
||||||
|
clients_raw.shift()
|
||||||
|
|
||||||
|
// Parse clients
|
||||||
|
for (var i = 0; i < clients_raw.length; i++) {
|
||||||
|
if (clients_raw[i] !== null) {
|
||||||
|
var client_raw = clients_raw[i].split('</td></tr>')[0]
|
||||||
|
var client = {
|
||||||
|
ip_address: client_raw.split('</td><td>')[1],
|
||||||
|
hw_address: client_raw.split('</td><td>')[2],
|
||||||
|
connections: parseInt(client_raw.split('</td><td>')[3])
|
||||||
|
};
|
||||||
|
|
||||||
|
clients_arr.push(client);
|
||||||
|
clients_num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare output
|
||||||
|
var output = {
|
||||||
|
bin_version: value.split('<TITLE>')[1].split('</TITLE>')[0].split(' ')[1],
|
||||||
|
audio_files: parseInt(value.split('<tr><td>Audio files</td><td>')[1].split('</td></tr>')[0]),
|
||||||
|
video_files: parseInt(value.split('<tr><td>Video files</td><td>')[1].split('</td></tr>')[0]),
|
||||||
|
image_files: parseInt(value.split('<tr><td>Image files</td><td>')[1].split('</td></tr>')[0]),
|
||||||
|
clients_num: parseInt(clients_num),
|
||||||
|
data: clients_arr
|
||||||
|
};
|
||||||
|
|
||||||
|
// Return JSON string
|
||||||
|
return JSON.stringify(output);
|
||||||
|
url: '{$MINIDLNA.STATUS.SCHEME}://{HOST.CONN}:{$MINIDLNA.STATUS.PORT}'
|
||||||
|
tags:
|
||||||
|
-
|
||||||
|
tag: Application
|
||||||
|
value: minidlna
|
||||||
|
-
|
||||||
|
tag: component
|
||||||
|
value: raw
|
||||||
|
-
|
||||||
|
uuid: e05aae11c3d74157a78422733da21486
|
||||||
|
name: 'MiniDLNA: Image files'
|
||||||
|
type: DEPENDENT
|
||||||
|
key: minidlna.image_files
|
||||||
|
delay: '0'
|
||||||
|
description: 'Amount of image files'
|
||||||
|
preprocessing:
|
||||||
|
-
|
||||||
|
type: JSONPATH
|
||||||
|
parameters:
|
||||||
|
- $.image_files
|
||||||
|
master_item:
|
||||||
|
key: minidlna.get_status
|
||||||
|
tags:
|
||||||
|
-
|
||||||
|
tag: Application
|
||||||
|
value: minidlna
|
||||||
|
-
|
||||||
|
uuid: b4de3ddd3b9347fd9496bcb11d6abd6c
|
||||||
|
name: 'MiniDLNA: Version'
|
||||||
|
type: DEPENDENT
|
||||||
|
key: minidlna.version
|
||||||
|
delay: '0'
|
||||||
|
history: 7d
|
||||||
|
trends: '0'
|
||||||
|
value_type: CHAR
|
||||||
|
description: 'Service version'
|
||||||
|
preprocessing:
|
||||||
|
-
|
||||||
|
type: JSONPATH
|
||||||
|
parameters:
|
||||||
|
- $.bin_version
|
||||||
|
master_item:
|
||||||
|
key: minidlna.get_status
|
||||||
|
tags:
|
||||||
|
-
|
||||||
|
tag: Application
|
||||||
|
value: minidlna
|
||||||
|
-
|
||||||
|
uuid: 58d98974b2164f1ab9c9db8b5dd4e235
|
||||||
|
name: 'MiniDLNA: Video files'
|
||||||
|
type: DEPENDENT
|
||||||
|
key: minidlna.video_files
|
||||||
|
delay: '0'
|
||||||
|
description: 'Amount of video files'
|
||||||
|
preprocessing:
|
||||||
|
-
|
||||||
|
type: JSONPATH
|
||||||
|
parameters:
|
||||||
|
- $.video_files
|
||||||
|
master_item:
|
||||||
|
key: minidlna.get_status
|
||||||
|
tags:
|
||||||
|
-
|
||||||
|
tag: Application
|
||||||
|
value: minidlna
|
||||||
|
-
|
||||||
|
uuid: 08f1de5f34584f99a3d4f4672f0f6459
|
||||||
|
name: 'MiniDLNA: Service ping'
|
||||||
|
type: SIMPLE
|
||||||
|
key: 'net.tcp.service[{$MINIDLNA.STATUS.SCHEME},"{HOST.CONN}","{$MINIDLNA.STATUS.PORT}"]'
|
||||||
|
history: 7d
|
||||||
|
tags:
|
||||||
|
-
|
||||||
|
tag: Application
|
||||||
|
value: minidlna
|
||||||
|
-
|
||||||
|
tag: component
|
||||||
|
value: health
|
||||||
|
triggers:
|
||||||
|
-
|
||||||
|
uuid: a0d3475de9004a98aee62338a881656e
|
||||||
|
expression: 'last(/MiniDLNA by HTTP/net.tcp.service[{$MINIDLNA.STATUS.SCHEME},"{HOST.CONN}","{$MINIDLNA.STATUS.PORT}"])=0'
|
||||||
|
name: 'MiniDLNA: Service is down'
|
||||||
|
priority: AVERAGE
|
||||||
|
manual_close: 'YES'
|
||||||
|
tags:
|
||||||
|
-
|
||||||
|
tag: Application
|
||||||
|
value: minidlna
|
||||||
|
-
|
||||||
|
tag: scope
|
||||||
|
value: availability
|
||||||
|
discovery_rules:
|
||||||
|
-
|
||||||
|
uuid: 4cb5ba7f8f114923a40e9329f70cd398
|
||||||
|
name: 'Clients discovery'
|
||||||
|
type: DEPENDENT
|
||||||
|
key: minidlna.clients.discovery
|
||||||
|
delay: '0'
|
||||||
|
description: 'The discovery of clients'
|
||||||
|
item_prototypes:
|
||||||
|
-
|
||||||
|
uuid: 80f0a4c297124d0daa0f8aa8a67da8b0
|
||||||
|
name: 'MiniDLNA client "{#MINIDLNA_CLIENT_IPADDR}" connections'
|
||||||
|
type: DEPENDENT
|
||||||
|
key: 'minidlna.client.connections[{#MINIDLNA_CLIENT_IPADDR}]'
|
||||||
|
delay: '0'
|
||||||
|
history: 14d
|
||||||
|
description: 'Number of connections from client'
|
||||||
|
preprocessing:
|
||||||
|
-
|
||||||
|
type: JSONPATH
|
||||||
|
parameters:
|
||||||
|
- '$.data.[?(@.ip_address=="{#MINIDLNA_CLIENT_IPADDR}")].connections.first()'
|
||||||
|
master_item:
|
||||||
|
key: minidlna.get_status
|
||||||
|
tags:
|
||||||
|
-
|
||||||
|
tag: Application
|
||||||
|
value: minidlna
|
||||||
|
-
|
||||||
|
tag: 'MiniDLNA client'
|
||||||
|
value: '{#MINIDLNA_CLIENT_IPADDR}'
|
||||||
|
-
|
||||||
|
uuid: 4b17636e80314c689375d07ee400be87
|
||||||
|
name: 'MiniDLNA client "{#MINIDLNA_CLIENT_IPADDR}" MAC address'
|
||||||
|
type: DEPENDENT
|
||||||
|
key: 'minidlna.client.hw_address[{#MINIDLNA_CLIENT_IPADDR}]'
|
||||||
|
delay: '0'
|
||||||
|
history: 14d
|
||||||
|
trends: '0'
|
||||||
|
value_type: CHAR
|
||||||
|
preprocessing:
|
||||||
|
-
|
||||||
|
type: JSONPATH
|
||||||
|
parameters:
|
||||||
|
- '$.data.[?(@.ip_address=="{#MINIDLNA_CLIENT_IPADDR}")].hw_address.first()'
|
||||||
|
master_item:
|
||||||
|
key: minidlna.get_status
|
||||||
|
tags:
|
||||||
|
-
|
||||||
|
tag: Application
|
||||||
|
value: minidlna
|
||||||
|
-
|
||||||
|
tag: 'MiniDLNA client'
|
||||||
|
value: '{#MINIDLNA_CLIENT_IPADDR}'
|
||||||
|
graph_prototypes:
|
||||||
|
-
|
||||||
|
uuid: 0ae432fabda0492cb27e946614d13d2d
|
||||||
|
name: 'MiniDLNA client "{#MINIDLNA_CLIENT_IPADDR}" connections'
|
||||||
|
graph_items:
|
||||||
|
-
|
||||||
|
color: 0080FF
|
||||||
|
item:
|
||||||
|
host: 'MiniDLNA by HTTP'
|
||||||
|
key: 'minidlna.client.connections[{#MINIDLNA_CLIENT_IPADDR}]'
|
||||||
|
master_item:
|
||||||
|
key: minidlna.get_status
|
||||||
|
lld_macro_paths:
|
||||||
|
-
|
||||||
|
lld_macro: '{#MINIDLNA_CLIENT_IPADDR}'
|
||||||
|
path: $..ip_address.first()
|
||||||
|
-
|
||||||
|
lld_macro: '{#MINIDLNA_CLIENT_HWADDR}'
|
||||||
|
path: $..hw_address.first()
|
||||||
|
-
|
||||||
|
lld_macro: '{#MINIDLNA_CLIENT_CONNECTIONS}'
|
||||||
|
path: $..connections.first()
|
||||||
|
tags:
|
||||||
|
-
|
||||||
|
tag: Application
|
||||||
|
value: minidlna
|
||||||
|
macros:
|
||||||
|
-
|
||||||
|
macro: '{$MINIDLNA.STATUS.PORT}'
|
||||||
|
value: '8200'
|
||||||
|
-
|
||||||
|
macro: '{$MINIDLNA.STATUS.SCHEME}'
|
||||||
|
value: http
|
||||||
|
dashboards:
|
||||||
|
-
|
||||||
|
uuid: 2f2247d32fc34e8ab9a9911175f40933
|
||||||
|
name: MiniDLNA
|
||||||
|
auto_start: 'NO'
|
||||||
|
pages:
|
||||||
|
-
|
||||||
|
widgets:
|
||||||
|
-
|
||||||
|
type: ITEM
|
||||||
|
width: '4'
|
||||||
|
hide_header: 'YES'
|
||||||
|
fields:
|
||||||
|
-
|
||||||
|
type: ITEM
|
||||||
|
name: itemid
|
||||||
|
value:
|
||||||
|
host: 'MiniDLNA by HTTP'
|
||||||
|
key: minidlna.audio_files
|
||||||
|
-
|
||||||
|
type: ITEM
|
||||||
|
x: '4'
|
||||||
|
width: '4'
|
||||||
|
hide_header: 'YES'
|
||||||
|
fields:
|
||||||
|
-
|
||||||
|
type: ITEM
|
||||||
|
name: itemid
|
||||||
|
value:
|
||||||
|
host: 'MiniDLNA by HTTP'
|
||||||
|
key: minidlna.image_files
|
||||||
|
-
|
||||||
|
type: ITEM
|
||||||
|
x: '8'
|
||||||
|
width: '4'
|
||||||
|
hide_header: 'YES'
|
||||||
|
fields:
|
||||||
|
-
|
||||||
|
type: ITEM
|
||||||
|
name: itemid
|
||||||
|
value:
|
||||||
|
host: 'MiniDLNA by HTTP'
|
||||||
|
key: minidlna.video_files
|
||||||
|
-
|
||||||
|
type: GRAPH_PROTOTYPE
|
||||||
|
x: '12'
|
||||||
|
width: '12'
|
||||||
|
height: '5'
|
||||||
|
fields:
|
||||||
|
-
|
||||||
|
type: INTEGER
|
||||||
|
name: columns
|
||||||
|
value: '1'
|
||||||
|
-
|
||||||
|
type: GRAPH_PROTOTYPE
|
||||||
|
name: graphid
|
||||||
|
value:
|
||||||
|
host: 'MiniDLNA by HTTP'
|
||||||
|
name: 'MiniDLNA client "{#MINIDLNA_CLIENT_IPADDR}" connections'
|
Loading…
Reference in New Issue
Block a user