diff --git a/Applications/Template_App_Speedtest_Wan/7.0/README.md b/Applications/Template_App_Speedtest_Wan/7.0/README.md new file mode 100644 index 000000000..8e3c7df34 --- /dev/null +++ b/Applications/Template_App_Speedtest_Wan/7.0/README.md @@ -0,0 +1,91 @@ +# Template_App_Speedtest_Wan +To store information from the ookla speedtest cli command into Zabbix. +# Author +Todd Blake +# Requirements: +* Zabbix version 6.4 or later +* the speedtest cli app from speedtest.net - https://www.speedtest.net/apps/cli (NOT the one from pypi) +* the timeout command to timeout a hanging speedtest command +* the zabbix_sender command for sending the data to zabbix +# Installation: +1. Import the Template_App_Speedtest_Wan.yaml template into your Zabbix instance (Configuration --> Templates --> Import), and apply the template to a host +2. Copy the record_speedtest.sh script to somewhere on your system, e.g. /usr/local/bin/record_speedtest.sh +3. Set the script to be executable, e.g. `chmod +x /usr/local/bin/record_speedtest.sh` +4. Edit the record_speedtest.sh script: + - Set the SPDHOST variable to the name of the host you've applied the template too within Zabbix + - Set the ZABSRV variable to the name/IP of your Zabbix server or proxy that the host is reporting too + - Optionally, set the PSKID and PSKFILE variables if you're using encryption in your Zabbix environment. + - Optionally, set the SPEEDTESTPARAMS variable to any additional needed speedtest parameters +5. Set the {$NO_SPDTST_DATA_SECS} macro to 300 seconds (5 minutes) more than the frequency of execution, in seconds. i.e. If you run it every 6 hours, set the macro to 21900 (6 hours * 60 minutes per hour * 60 seconds per minute, then add 300 seconds to that.) +6. Install a crontab entry to run this script on a schedule: + + `0 */6 * * * /usr/local/bin/record_speedtest.sh # feed speedtest info into zabbix every 6 hours` + +# Example Dashboard +![Example Dashboard](dashboard.png?raw=true "Example Dashboard") + +## Macros used + +|Macro|Default Value|Description| +|-----|-------------|-----------| +|{$NO_SPDTST_DATA_SECS}|21900 (6 hours and 5 minutes)|The number of seconds that Zabbix will alert when it's received no new speedtest data| +|{$BWIDTH_DL_ALERT}|209715200 (200Mbps)|The threshold for alerting if download bandwidth drops below this value| +|{$BWIDTH_UL_ALERT}|10485760 (10Mbps)|The threshold for alerting if upload bandwidth drops below this value| + +## Template links + +There are no template links in this template. + +## Discovery rules + +There are no discovery rules in this template. + +## Items collected + +|Name|Description|Type|Key and additional info| +|----|-----------|----|----| +|Speedtest - Download Bandwidth|The measured bandwidth in bits per second.|Dependent item|speedtest[download.bandwidth]| +|Speedtest - Download Bytes|The number of bytes downloaded in the test.|Dependent item|speedtest[download.bytes]| +|Speedtest - Download Latency (High)|The highest recorded latency during the download portion of the test.|Dependent item|speedtest[download.latency.high]| +|Speedtest - Download Latency (IQM)|The IQM (interquartile mean) of the latency recorded during the download portion of the test.|Dependent item|speedtest[download.latency.iqm]| +|Speedtest - Download Latency (Jitter)|The jitter recorded during the download portion of the test.|Dependent item|speedtest[download.latency.jitter]| +|Speedtest - Download Latency (Low)|The lowest recorded latency during the download portion of the test.|Dependent item|speedtest[download.latency.low]| +|Speedtest - Download Time Elapsed|The time to execute the download test.|Dependent item|speedtest[download.elapsed]| +|Speedtest - External IP|The external (internet) IP address of the system executing the test.|Dependent item|speedtest[interface.externalIp]| +|Speedtest - ISP|The ISP of the system executing the test.|Dependent item|speedtest[isp]| +|Speedtest - Internal IP|The internal (local) IP address of the system executing the test.|Dependent item|speedtest[interface.internalIp]| +|Speedtest - Is VPN?|Are we on a VPN while executing the test?|Dependent item|speedtest[interface.isVpn]| +|Speedtest - JSON|The raw JSON from the speedtest command. It's parsed out for all of the other fields except the run time.|Zabbix trapper|custom.speedtest[json]| +|Speedtest - MAC Address|The MAC address of the interface used when executing the test|Dependent item|speedtest[interface.macAddr]| +|Speedtest - Network Interface|The network interface used to execute the test|Dependent item|speedtest[interface.name]| +|Speedtest - Packet Loss|Packets lost during the test.|Dependent item|speedtest[packetLoss]| +|Speedtest - Ping Latency (Average)|The average recorded latency during the ping portion of the test.|Dependent item|speedtest[ping.latency]| +|Speedtest - Ping Latency (High)|The highest recorded latency during the ping portion of the test.|Dependent item|speedtest[ping.high]| +|Speedtest - Ping Latency (Jitter)|The recorded jitter during the ping portion of the test.|Dependent item|speedtest[ping.jitter]| +|Speedtest - Ping Latency (Low)|The lowest recorded latency during the ping portion of the test.|Dependent item|speedtest[ping.low]| +|Speedtest - Result ID|The ID at speedtest.net of the results.|Dependent item|speedtest[result.id]| +|Speedtest - Result URL|The URL at speedtest.net of the results.|Dependent item|speedtest[result.url]| +|Speedtest - Run time|The time the record_speedtest.sh script was executed.|Zabbix trapper|custom.speedtest[runtime]| +|Speedtest - Server Country|The country of the selected speedtest server.|Dependent item|speedtest[server.country]| +|Speedtest - Server Host|The hostname of the selected speedtest server.|Dependent item|speedtest[server.host]| +|Speedtest - Server ID|The speedtest ID of the selected speedtest server.|Dependent item|speedtest[server.id]| +|Speedtest - Server IP|The IP address of the selected speedtest server.|Dependent item|speedtest[server.ip]| +|Speedtest - Server Location|The geographical location (City, State in the US for example) of the selected speedtest server.|Dependent item|speedtest[server.location]| +|Speedtest - Server Name|The human readable speedtest.net name of the selected speedtest server.|Dependent item|speedtest[server.name]| +|Speedtest - Server Port|The TCP port used of the selected speedtest server.|Dependent item|speedtest[server.port]| +|Speedtest - Timestamp|The timestamp of the test recorded from speedtest.net.|Dependent item|speedtest[timestamp]| +|Speedtest - Upload Bandwidth|The measured bandwidth in bits per second.|Dependent item|speedtest[upload.bandwidth]| +|Speedtest - Upload Bytes|The number of bytes uploaded in the test.|Dependent item|speedtest[upload.bytes]| +|Speedtest - Upload Latency (High)|The highest recorded latency during the upload portion of the test.|Dependent item|speedtest[upload.latency.high]| +|Speedtest - Upload Latency (IQM)|The IQM (interquartile mean) of the latency recorded during the upload portion of the test.|Dependent item|speedtest[upload.latency.iqm]| +|Speedtest - Upload Latency (Jitter)|The jitter recorded during the upload portion of the test.|Dependent item|speedtest[upload.latency.jitter]| +|Speedtest - Upload Latency (Low)|The lowest recorded latency during the upload portion of the test.|Dependent item|speedtest[upload.latency.low]| +|Speedtest - Upload Time Elapsed|The time to execute the upload test.|Dependent item|speedtest[upload.elapsed]| + +## Triggers + +|Name|Description|Expression|Priority| +|----|-----------|----------|--------| +|No new speed test data received in the last {$NO_SPDTST_DATA_SECS} seconds|We haven't received any new JSON data from speedtest in the last {$NO_SPDTST_DATA_SECS} seconds.|nodata(/Template_App_Speedtest/custom.speedtest[json],{$NO_SPDTST_DATA_SECS})=1|High| +|Download bandwidth is less than {$BWIDTH_DL_ALERT}|The measured download bandwidth has dropped below {$BWIDTH_DL_ALERT}bps.|max(/Template_App_Speedtest_Wan/speedtest[download.bandwidth],#3)<{$BWIDTH_DL_ALERT}|Warning| +|Upload bandwidth is less than {$BWIDTH_UL_ALERT}|The measured upload bandwidth has dropped below {$BWIDTH_UL_ALERT}bps.|max(/Template_App_Speedtest_Wan/speedtest[upload.bandwidth],#3)<{$BWIDTH_UL_ALERT}|Warning| diff --git a/Applications/Template_App_Speedtest_Wan/7.0/Template_App_Speedtest_Wan.yaml b/Applications/Template_App_Speedtest_Wan/7.0/Template_App_Speedtest_Wan.yaml new file mode 100755 index 000000000..fbd27a283 --- /dev/null +++ b/Applications/Template_App_Speedtest_Wan/7.0/Template_App_Speedtest_Wan.yaml @@ -0,0 +1,885 @@ +zabbix_export: + version: '7.0' + template_groups: + - uuid: 7df96b18c230490a9a0a9e2307226338 + name: Templates + templates: + - uuid: 9daa55f388e94272af1cacad9807e847 + template: Template_App_Speedtest_Wan + name: Template_App_Speedtest_Wan + description: | + Template_App_Speedtest_Wan + https://github.com/zabbix/community-templates/tree/main/Applications/Template_App_Speedtest_Wan + + To store information from the ookla speedtest cli command into Zabbix. + + Requirements: + * Zabbix version 6.2 or later + * the speedtest cli app from speedtest.net - https://www.speedtest.net/apps/cli (NOT the one from pypi) + * the timeout command to timeout a hanging speedtest command + * the zabbix_sender command for sending the data to zabbix + groups: + - name: Templates + items: + - uuid: 5b0e301ec100482ba6185e88bea05b23 + name: 'Speedtest - JSON' + type: TRAP + key: 'custom.speedtest[json]' + delay: '0' + history: 1d + value_type: TEXT + trends: '0' + description: 'The raw JSON from the speedtest command. It''s parsed out for all of the other fields except the run time.' + tags: + - tag: Application + value: Speedtest + triggers: + - uuid: da54732cbc06492da25873a4617e6916 + expression: 'nodata(/Template_App_Speedtest_Wan/custom.speedtest[json],{$NO_SPDTST_DATA_SECS})=1' + name: 'No new speed test data received in the last {$NO_SPDTST_DATA_SECS} seconds' + priority: HIGH + description: 'We haven''t received any new JSON data from speedtest in the last {$NO_SPDTST_DATA_SECS} seconds.' + - uuid: d9bbc7332f7d418c9f446d0112e0d9a8 + name: 'Speedtest - Run time' + type: TRAP + key: 'custom.speedtest[runtime]' + delay: '0' + history: 1w + units: unixtime + description: 'The time the record_speedtest.sh script was executed.' + tags: + - tag: Application + value: Speedtest + - uuid: 2c14c429e1c94f06826c6dff2a667b8e + name: 'Speedtest - Download Bandwidth' + type: DEPENDENT + key: 'speedtest[download.bandwidth]' + delay: '0' + history: 1w + units: bps + description: 'The measured bandwidth in bits per second.' + preprocessing: + - type: JSONPATH + parameters: + - $.download.bandwidth + error_handler: CUSTOM_VALUE + error_handler_params: '0' + - type: MULTIPLIER + parameters: + - '8' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + triggers: + - uuid: cbd066fd1ebb4357878aa45397012853 + expression: 'max(/Template_App_Speedtest_Wan/speedtest[download.bandwidth],{$BWIDTH_LOW_COUNT})<{$BWIDTH_DL_ALERT}' + name: 'Download bandwidth is less than {$BWIDTH_DL_ALERT}' + priority: WARNING + description: 'The measured download bandwidth has dropped below {$BWIDTH_DL_ALERT}bps.' + manual_close: 'YES' + - uuid: 74e02f936ec54eac82e79be3f8e514aa + name: 'Speedtest - Download Bytes' + type: DEPENDENT + key: 'speedtest[download.bytes]' + delay: '0' + history: 1w + units: B + description: 'The number of bytes downloaded in the test.' + preprocessing: + - type: JSONPATH + parameters: + - $.download.bytes + error_handler: CUSTOM_VALUE + error_handler_params: '0' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: 45bcc7edea6749d18322504cb98fe197 + name: 'Speedtest - Download Time Elapsed' + type: DEPENDENT + key: 'speedtest[download.elapsed]' + delay: '0' + history: 1w + value_type: FLOAT + units: s + description: 'The time to execute the download test.' + preprocessing: + - type: JSONPATH + parameters: + - $.download.elapsed + error_handler: CUSTOM_VALUE + error_handler_params: '0' + - type: MULTIPLIER + parameters: + - '.001' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: 3706056ef63a44d1a29f98d281e94c3e + name: 'Speedtest - Download Latency (High)' + type: DEPENDENT + key: 'speedtest[download.latency.high]' + delay: '0' + history: 1w + value_type: FLOAT + units: s + description: 'The highest recorded latency during the download portion of the test.' + preprocessing: + - type: JSONPATH + parameters: + - $.download.latency.high + error_handler: CUSTOM_VALUE + error_handler_params: '0' + - type: MULTIPLIER + parameters: + - '.001' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: 227dd77a34b8468c93f47fd825c7e8cf + name: 'Speedtest - Download Latency (IQM)' + type: DEPENDENT + key: 'speedtest[download.latency.iqm]' + delay: '0' + history: 1w + value_type: FLOAT + units: s + description: 'The IQM (interquartile mean) of the latency recorded during the download portion of the test.' + preprocessing: + - type: JSONPATH + parameters: + - $.download.latency.iqm + error_handler: CUSTOM_VALUE + error_handler_params: '0' + - type: MULTIPLIER + parameters: + - '.001' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: 55de48e2814542cb97e4a7792f21b092 + name: 'Speedtest - Download Latency (Jitter)' + type: DEPENDENT + key: 'speedtest[download.latency.jitter]' + delay: '0' + history: 1w + value_type: FLOAT + units: s + description: 'The jitter recorded during the download portion of the test.' + preprocessing: + - type: JSONPATH + parameters: + - $.download.latency.jitter + error_handler: CUSTOM_VALUE + error_handler_params: '0' + - type: MULTIPLIER + parameters: + - '.001' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: 2e9f1bcaf4a44a7cbaef11d6fcd731c2 + name: 'Speedtest - Download Latency (Low)' + type: DEPENDENT + key: 'speedtest[download.latency.low]' + delay: '0' + history: 1w + value_type: FLOAT + units: s + description: 'The lowest recorded latency during the download portion of the test.' + preprocessing: + - type: JSONPATH + parameters: + - $.download.latency.low + error_handler: CUSTOM_VALUE + error_handler_params: '0' + - type: MULTIPLIER + parameters: + - '.001' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: 9104aa05b181443b8ff3d151a10a22ef + name: 'Speedtest - External IP' + type: DEPENDENT + key: 'speedtest[interface.externalIp]' + delay: '0' + history: 1w + value_type: CHAR + trends: '0' + description: 'The external (internet) IP address of the system executing the test.' + preprocessing: + - type: JSONPATH + parameters: + - $.interface.externalIp + error_handler: CUSTOM_VALUE + error_handler_params: '-1.-1.-1.-1' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: 346297b35c9247a28962ca6badeb794a + name: 'Speedtest - Internal IP' + type: DEPENDENT + key: 'speedtest[interface.internalIp]' + delay: '0' + history: 1w + value_type: CHAR + trends: '0' + description: 'The internal (local) IP address of the system executing the test.' + preprocessing: + - type: JSONPATH + parameters: + - $.interface.internalIp + error_handler: CUSTOM_VALUE + error_handler_params: '-1.-1.-1.-1' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: 96a9b03149434db98573f94a0194190e + name: 'Speedtest - Is VPN?' + type: DEPENDENT + key: 'speedtest[interface.isVpn]' + delay: '0' + history: 1w + value_type: CHAR + trends: '0' + description: 'Are we on a VPN while executing the test?' + preprocessing: + - type: JSONPATH + parameters: + - $.interface.isVpn + error_handler: CUSTOM_ERROR + error_handler_params: UNKNOWN + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: e1ec203ec4f24d66a8236cddf9e5902a + name: 'Speedtest - MAC Address' + type: DEPENDENT + key: 'speedtest[interface.macAddr]' + delay: '0' + history: 1w + value_type: CHAR + trends: '0' + description: 'The MAC address of the interface used when executing the test' + preprocessing: + - type: JSONPATH + parameters: + - $.interface.macAddr + error_handler: CUSTOM_VALUE + error_handler_params: UNKNOWN + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: e7685390f36d4ef0bd13e30995052836 + name: 'Speedtest - Network Interface' + type: DEPENDENT + key: 'speedtest[interface.name]' + delay: '0' + history: 1w + value_type: CHAR + trends: '0' + description: 'The network interface used to execute the test' + preprocessing: + - type: JSONPATH + parameters: + - $.interface.name + error_handler: CUSTOM_VALUE + error_handler_params: UNKNOWN + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: 28218e064cd743e9bfacba18082c00b0 + name: 'Speedtest - ISP' + type: DEPENDENT + key: 'speedtest[isp]' + delay: '0' + history: 1w + value_type: CHAR + trends: '0' + description: 'The ISP of the system executing the test.' + preprocessing: + - type: JSONPATH + parameters: + - $.isp + error_handler: CUSTOM_VALUE + error_handler_params: UNKNOWN + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: ff6e570e13644ff59193ea48fb4e02e4 + name: 'Speedtest - Packet Loss' + type: DEPENDENT + key: 'speedtest[packetLoss]' + delay: '0' + history: 1w + value_type: FLOAT + units: '%' + description: 'Packets lost during the test.' + preprocessing: + - type: JSONPATH + parameters: + - $.packetLoss + error_handler: CUSTOM_VALUE + error_handler_params: '0' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: ca669dc101f342d78b4a995d1c56f443 + name: 'Speedtest - Ping Latency (High)' + type: DEPENDENT + key: 'speedtest[ping.high]' + delay: '0' + history: 1w + value_type: FLOAT + units: s + description: 'The highest recorded latency during the ping portion of the test.' + preprocessing: + - type: JSONPATH + parameters: + - $.ping.high + error_handler: CUSTOM_VALUE + error_handler_params: '0' + - type: MULTIPLIER + parameters: + - '.001' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: bb175a8af753409084491b212ac1dd76 + name: 'Speedtest - Ping Latency (Jitter)' + type: DEPENDENT + key: 'speedtest[ping.jitter]' + delay: '0' + history: 1w + value_type: FLOAT + units: s + description: 'The recorded jitter during the ping portion of the test.' + preprocessing: + - type: JSONPATH + parameters: + - $.ping.jitter + error_handler: CUSTOM_VALUE + error_handler_params: '0' + - type: MULTIPLIER + parameters: + - '.001' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: 858dfc9a191a44deafdf0f79fd23284c + name: 'Speedtest - Ping Latency (Average)' + type: DEPENDENT + key: 'speedtest[ping.latency]' + delay: '0' + history: 1w + value_type: FLOAT + units: s + description: 'The average recorded latency during the ping portion of the test.' + preprocessing: + - type: JSONPATH + parameters: + - $.ping.latency + error_handler: CUSTOM_VALUE + error_handler_params: '0' + - type: MULTIPLIER + parameters: + - '.001' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: 0b2834e0f7f242a4aa4701f1053b9322 + name: 'Speedtest - Ping Latency (Low)' + type: DEPENDENT + key: 'speedtest[ping.low]' + delay: '0' + history: 1w + value_type: FLOAT + units: s + description: 'The lowest recorded latency during the ping portion of the test.' + preprocessing: + - type: JSONPATH + parameters: + - $.ping.low + error_handler: CUSTOM_VALUE + error_handler_params: '0' + - type: MULTIPLIER + parameters: + - '.001' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: 949003e3f0a6421c9d66bf4333eb80d1 + name: 'Speedtest - Result ID' + type: DEPENDENT + key: 'speedtest[result.id]' + delay: '0' + history: 1w + value_type: CHAR + trends: '0' + description: 'The ID at speedtest.net of the results.' + preprocessing: + - type: JSONPATH + parameters: + - $.result.id + error_handler: CUSTOM_VALUE + error_handler_params: UNKNOWN + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: 3b09b2b31ca4447cb0482045de690a95 + name: 'Speedtest - Result URL' + type: DEPENDENT + key: 'speedtest[result.url]' + delay: '0' + history: 1w + value_type: CHAR + trends: '0' + description: 'The URL at speedtest.net of the results.' + preprocessing: + - type: JSONPATH + parameters: + - $.result.url + error_handler: CUSTOM_VALUE + error_handler_params: 'https://www.speedtest.net/' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: a9e6160c1f004fe7aca063bebf065c6d + name: 'Speedtest - Server Country' + type: DEPENDENT + key: 'speedtest[server.country]' + delay: '0' + history: 1w + value_type: CHAR + trends: '0' + description: 'The country of the selected speedtest server.' + preprocessing: + - type: JSONPATH + parameters: + - $.server.country + error_handler: CUSTOM_VALUE + error_handler_params: UNKNOWN + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: f5a1c26278a9485697d9a1482db4c15e + name: 'Speedtest - Server Host' + type: DEPENDENT + key: 'speedtest[server.host]' + delay: '0' + history: 1w + value_type: CHAR + trends: '0' + description: 'The hostname of the selected speedtest server.' + preprocessing: + - type: JSONPATH + parameters: + - $.server.host + error_handler: CUSTOM_VALUE + error_handler_params: UNKNOWN + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: 32df3f9d535943189e03aeb85822a7cb + name: 'Speedtest - Server ID' + type: DEPENDENT + key: 'speedtest[server.id]' + delay: '0' + history: 1w + value_type: CHAR + trends: '0' + description: 'The speedtest ID of the selected speedtest server.' + preprocessing: + - type: JSONPATH + parameters: + - $.server.id + error_handler: CUSTOM_VALUE + error_handler_params: UNKNOWN + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: d9f33a38e35f49f1bef47f5b3e1fef8d + name: 'Speedtest - Server IP' + type: DEPENDENT + key: 'speedtest[server.ip]' + delay: '0' + history: 1w + value_type: CHAR + trends: '0' + description: 'The IP address of the selected speedtest server.' + preprocessing: + - type: JSONPATH + parameters: + - $.server.ip + error_handler: CUSTOM_VALUE + error_handler_params: '-1.-1.-1.-1' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: e5a2ed142f684f798c9af57e0e2dfcbc + name: 'Speedtest - Server Location' + type: DEPENDENT + key: 'speedtest[server.location]' + delay: '0' + history: 1w + value_type: CHAR + trends: '0' + description: 'The geographical location (City, State in the US for example) of the selected speedtest server.' + preprocessing: + - type: JSONPATH + parameters: + - $.server.location + error_handler: CUSTOM_VALUE + error_handler_params: UNKNOWN + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: f963f823f08740fc8d7d64ac5438a4cc + name: 'Speedtest - Server Name' + type: DEPENDENT + key: 'speedtest[server.name]' + delay: '0' + history: 1w + value_type: CHAR + trends: '0' + description: 'The human readable speedtest.net name of the selected speedtest server.' + preprocessing: + - type: JSONPATH + parameters: + - $.server.name + error_handler: CUSTOM_VALUE + error_handler_params: UNKNOWN + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: 731abaeccbc24f71a5d9ec439b701c78 + name: 'Speedtest - Server Port' + type: DEPENDENT + key: 'speedtest[server.port]' + delay: '0' + history: 1w + value_type: CHAR + trends: '0' + description: 'The TCP port used of the selected speedtest server.' + preprocessing: + - type: JSONPATH + parameters: + - $.server.port + error_handler: CUSTOM_VALUE + error_handler_params: UNKNOWN + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: 3b79f1537a0946059557cb65fb215b08 + name: 'Speedtest - Timestamp' + type: DEPENDENT + key: 'speedtest[timestamp]' + delay: '0' + history: 1w + units: unixtime + description: 'The timestamp of the test recorded from speedtest.net.' + preprocessing: + - type: JSONPATH + parameters: + - $.timestamp + error_handler: CUSTOM_VALUE + error_handler_params: '0' + - type: JAVASCRIPT + parameters: + - 'return Date.parse(value)' + - type: MULTIPLIER + parameters: + - '.001' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: cfe669566b2c49c6811498ea10507f39 + name: 'Speedtest - Upload Bandwidth' + type: DEPENDENT + key: 'speedtest[upload.bandwidth]' + delay: '0' + history: 1w + units: bps + description: 'The measured bandwidth in bits per second.' + preprocessing: + - type: JSONPATH + parameters: + - $.upload.bandwidth + error_handler: CUSTOM_VALUE + error_handler_params: '0' + - type: MULTIPLIER + parameters: + - '8' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + triggers: + - uuid: e6b2a85551304792ab02cacdb2acaac6 + expression: 'max(/Template_App_Speedtest_Wan/speedtest[upload.bandwidth],#3)<{$BWIDTH_UL_ALERT}' + name: 'Upload bandwidth is less than {$BWIDTH_UL_ALERT}' + priority: WARNING + description: 'The measured upload bandwidth has dropped below {$BWIDTH_UL_ALERT}bps.' + - uuid: a13d7a41d91e43cebd523b61ed3ebb90 + name: 'Speedtest - Upload Bytes' + type: DEPENDENT + key: 'speedtest[upload.bytes]' + delay: '0' + history: 1w + units: B + description: 'The number of bytes uploaded in the test.' + preprocessing: + - type: JSONPATH + parameters: + - $.upload.bytes + error_handler: CUSTOM_VALUE + error_handler_params: '0' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: b208d693bc1145e69718bca9cf1b313c + name: 'Speedtest - Upload Time Elapsed' + type: DEPENDENT + key: 'speedtest[upload.elapsed]' + delay: '0' + history: 1w + value_type: FLOAT + units: s + description: 'The time to execute the upload test.' + preprocessing: + - type: JSONPATH + parameters: + - $.upload.elapsed + error_handler: CUSTOM_VALUE + error_handler_params: '0' + - type: MULTIPLIER + parameters: + - '.001' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: 99c0bdf65f49423ca48e223b48ec59f2 + name: 'Speedtest - Upload Latency (High)' + type: DEPENDENT + key: 'speedtest[upload.latency.high]' + delay: '0' + history: 1w + value_type: FLOAT + units: s + description: 'The highest recorded latency during the upload portion of the test.' + preprocessing: + - type: JSONPATH + parameters: + - $.upload.latency.high + error_handler: CUSTOM_VALUE + error_handler_params: '0' + - type: MULTIPLIER + parameters: + - '.001' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: 9a990fd1fbbe40228eb7fd44729825bf + name: 'Speedtest - Upload Latency (IQM)' + type: DEPENDENT + key: 'speedtest[upload.latency.iqm]' + delay: '0' + history: 1w + value_type: FLOAT + units: s + description: 'The IQM (interquartile mean) of the latency recorded during the upload portion of the test.' + preprocessing: + - type: JSONPATH + parameters: + - $.upload.latency.iqm + error_handler: CUSTOM_VALUE + error_handler_params: '0' + - type: MULTIPLIER + parameters: + - '.001' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: b75e2582d5994a92bdaf7ae810423a3d + name: 'Speedtest - Upload Latency (Jitter)' + type: DEPENDENT + key: 'speedtest[upload.latency.jitter]' + delay: '0' + history: 1w + value_type: FLOAT + units: s + description: 'The jitter recorded during the upload portion of the test.' + preprocessing: + - type: JSONPATH + parameters: + - $.upload.latency.jitter + error_handler: CUSTOM_VALUE + error_handler_params: '0' + - type: MULTIPLIER + parameters: + - '.001' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + - uuid: 4ff34fc06d484b8a96b88cfb3436f579 + name: 'Speedtest - Upload Latency (Low)' + type: DEPENDENT + key: 'speedtest[upload.latency.low]' + delay: '0' + history: 1w + value_type: FLOAT + units: s + description: 'The lowest recorded latency during the upload portion of the test.' + preprocessing: + - type: JSONPATH + parameters: + - $.upload.latency.low + error_handler: CUSTOM_VALUE + error_handler_params: '0' + - type: MULTIPLIER + parameters: + - '.001' + master_item: + key: 'custom.speedtest[json]' + tags: + - tag: Application + value: Speedtest + macros: + - macro: '{$BWIDTH_DL_ALERT}' + value: '209715200' + description: 'The threshold for alerting if download bandwidth drops below this value' + - macro: '{$BWIDTH_LOW_COUNT}' + value: '#3' + description: 'How many times the bandwidth needs to drop below the {$BWIDTH_DL_ALERT} threshold before we alert.' + - macro: '{$BWIDTH_UL_ALERT}' + value: '10485760' + description: 'The threshold for alerting if upload bandwidth drops below this value' + - macro: '{$NO_SPDTST_DATA_SECS}' + value: '21900' + description: 'The number of seconds that Zabbix will alert when it''s received no new speedtest data' + dashboards: + - uuid: 9c9a7a29f56c4b4caae1589dea6c7ad7 + name: 'Internet Bandwidth & Latency' + pages: + - widgets: + - type: graph + width: '72' + height: '5' + fields: + - type: GRAPH + name: graphid + value: + host: Template_App_Speedtest_Wan + name: 'Internet Bandwidth' + - type: STRING + name: reference + value: AAABE + - type: graph + 'y': '5' + width: '72' + height: '5' + fields: + - type: GRAPH + name: graphid + value: + host: Template_App_Speedtest_Wan + name: 'Internet Latency' + - type: STRING + name: reference + value: AAABF + graphs: + - uuid: 893328bbf0d14bcebcee0fbbb66e8086 + name: 'Internet Bandwidth' + graph_items: + - sortorder: '1' + color: 199C0D + item: + host: Template_App_Speedtest_Wan + key: 'speedtest[download.bandwidth]' + - sortorder: '2' + color: F63100 + item: + host: Template_App_Speedtest_Wan + key: 'speedtest[upload.bandwidth]' + - uuid: 6ca6efdc34a14c96bb5a2fe0baab7771 + name: 'Internet Latency' + graph_items: + - color: 2774A4 + yaxisside: RIGHT + item: + host: Template_App_Speedtest_Wan + key: 'speedtest[ping.latency]' + - sortorder: '1' + color: F7941D + yaxisside: RIGHT + item: + host: Template_App_Speedtest_Wan + key: 'speedtest[ping.jitter]' diff --git a/Applications/Template_App_Speedtest_Wan/7.0/dashboard.png b/Applications/Template_App_Speedtest_Wan/7.0/dashboard.png new file mode 100644 index 000000000..4beb8d4c7 Binary files /dev/null and b/Applications/Template_App_Speedtest_Wan/7.0/dashboard.png differ diff --git a/Applications/Template_App_Speedtest_Wan/7.0/record_speedtest.sh b/Applications/Template_App_Speedtest_Wan/7.0/record_speedtest.sh new file mode 100755 index 000000000..091a5f654 --- /dev/null +++ b/Applications/Template_App_Speedtest_Wan/7.0/record_speedtest.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +# Agent Encryption +PSKID="" +PSKFILE="" + +# Zabbix Server hostname or IP address +ZABSRV="x.x.x.x" + +# Speedtest Host, the name of the host you've applied the template too as it's named in the Zabbix web UI +SPDHOST="name of the host you've applied the template too" + +# Optional Speedtest CLI Params +SPEEDTESTPARAMS="" + +# program locations +SPEEDTEST="$(which speedtest)" +TIMEOUT="$(which timeout)" +ZABBIX_SENDER="$(which zabbix_sender)" +DATE="$(which date)" +MKTEMP="$(which mktemp)" +STAT="$(which stat)" +CAT="$(which cat)" +EGREP="$(which egrep)" +RM="$(which rm)" + +# timeout to run speedtest +TIMEOUTTIME=300 + +test -z "$SPEEDTEST" && echo "speedtest binary not found" && exit +test -z "$TIMEOUT" && echo "timeout binary not found" && exit +test -z "$ZABBIX_SENDER" && echo "zabbix_sender binary not found" && exit +test -z "$DATE" && echo "date binary not found" && exit +test -z "$MKTEMP" && echo "mktemp binary not found" && exit +test -z "$STAT" && echo "stat binary not found" && exit +test -z "$CAT" && echo "cat binary not found" && exit +test -z "$EGREP" && echo "egrep binary not found" && exit +test -z "$RM" && echo "rm binary not found" && exit + +if [ "$($SPEEDTEST -V | $EGREP -c 'Speedtest by Ookla')" -lt 1 ];then + echo "The speedtest binary needs to be from Ookla." + echo "Please visit https://www.speedtest.net/apps/cli" + exit +fi + +# Temporary speedtest output +OUTFILE=$($MKTEMP) + +# what time is it? +NOW=$($DATE +%s) + +$TIMEOUT $TIMEOUTTIME $SPEEDTEST $SPEEDTESTPARAMS -f json 2>/dev/null > $OUTFILE +if [ $($STAT -c %s $OUTFILE) -le 100 ];then + echo "ERROR running speedtest - output file too small - $OUTFILE" + echo "You may want to try running $SPEEDTEST -f json manually" + echo "and/or checking the contents of $OUTFILE" + exit +fi + +F="$($CAT $OUTFILE)" + +# do we have PSKID and PSKFILE? +if [ -f "$PSKFILE" -a -n "$PSKID" ];then + $ZABBIX_SENDER --tls-connect psk --tls-psk-identity "$PSKID" --tls-psk-file "$PSKFILE" -z "$ZABSRV" -s "$SPDHOST" -k "custom.speedtest[runtime]" -o "$NOW" > /dev/null 2>&1 + $ZABBIX_SENDER --tls-connect psk --tls-psk-identity "$PSKID" --tls-psk-file "$PSKFILE" -z "$ZABSRV" -s "$SPDHOST" -k "custom.speedtest[json]" -o "$F" > /dev/null 2>&1 +else + $ZABBIX_SENDER -z "$ZABSRV" -s "$SPDHOST" -k "custom.speedtest[runtime]" -o "$NOW" > /dev/null 2>&1 + $ZABBIX_SENDER -z "$ZABSRV" -s "$SPDHOST" -k "custom.speedtest[json]" -o "$F" > /dev/null 2>&1 +fi +$RM -f $OUTFILE diff --git a/Applications/Template_App_Speedtest_Wan/README.md b/Applications/Template_App_Speedtest_Wan/README.md index 446190f54..2e0f3a1d8 100644 --- a/Applications/Template_App_Speedtest_Wan/README.md +++ b/Applications/Template_App_Speedtest_Wan/README.md @@ -1,4 +1,4 @@ # Template_App_Speedtest_Wan -To store speedtest results inside of Zabbix. The latest version is for [Zabbix 6.4](6.4) +To store speedtest results inside of Zabbix. The latest version is for [Zabbix 7.0](7.0) # Author Todd Blake