diff --git a/templates/mysql/generic/README.md b/templates/applications/mysql/generic/README.md similarity index 100% rename from templates/mysql/generic/README.md rename to templates/applications/mysql/generic/README.md diff --git a/templates/mysql/generic/mysql-generic.xml b/templates/applications/mysql/generic/mysql-generic.xml similarity index 100% rename from templates/mysql/generic/mysql-generic.xml rename to templates/applications/mysql/generic/mysql-generic.xml diff --git a/templates/mysql/innodb/README.md b/templates/applications/mysql/innodb/README.md similarity index 100% rename from templates/mysql/innodb/README.md rename to templates/applications/mysql/innodb/README.md diff --git a/templates/mysql/innodb/mysql-innodb.xml b/templates/applications/mysql/innodb/mysql-innodb.xml similarity index 100% rename from templates/mysql/innodb/mysql-innodb.xml rename to templates/applications/mysql/innodb/mysql-innodb.xml diff --git a/templates/mysql/myisam/README.md b/templates/applications/mysql/myisam/README.md similarity index 100% rename from templates/mysql/myisam/README.md rename to templates/applications/mysql/myisam/README.md diff --git a/templates/mysql/myisam/mysql-myisam.xml b/templates/applications/mysql/myisam/mysql-myisam.xml similarity index 100% rename from templates/mysql/myisam/mysql-myisam.xml rename to templates/applications/mysql/myisam/mysql-myisam.xml diff --git a/templates/postgresql/README.md b/templates/applications/postgresql/README.md similarity index 100% rename from templates/postgresql/README.md rename to templates/applications/postgresql/README.md diff --git a/templates/postgresql/postgresql.xml b/templates/applications/postgresql/postgresql.xml similarity index 100% rename from templates/postgresql/postgresql.xml rename to templates/applications/postgresql/postgresql.xml diff --git a/templates/processes/monitor-by-processestomonitor-list/README.md b/templates/applications/processes/monitor-by-processestomonitor-list/README.md similarity index 100% rename from templates/processes/monitor-by-processestomonitor-list/README.md rename to templates/applications/processes/monitor-by-processestomonitor-list/README.md diff --git a/templates/processes/monitor-by-processestomonitor-list/helper_script.sh b/templates/applications/processes/monitor-by-processestomonitor-list/helper_script.sh similarity index 100% rename from templates/processes/monitor-by-processestomonitor-list/helper_script.sh rename to templates/applications/processes/monitor-by-processestomonitor-list/helper_script.sh diff --git a/templates/processes/monitor-by-processestomonitor-list/monitor-by-processestomonitor-list.xml b/templates/applications/processes/monitor-by-processestomonitor-list/monitor-by-processestomonitor-list.xml similarity index 100% rename from templates/processes/monitor-by-processestomonitor-list/monitor-by-processestomonitor-list.xml rename to templates/applications/processes/monitor-by-processestomonitor-list/monitor-by-processestomonitor-list.xml diff --git a/templates/applications/yggdrasil/README.md b/templates/applications/yggdrasil/README.md new file mode 100644 index 0000000..8e3fe07 --- /dev/null +++ b/templates/applications/yggdrasil/README.md @@ -0,0 +1,27 @@ +# Yggdrasil monitoring things + +This directory contains everything you need to monitor status of your Yggdrasil +node. + +## Helper scripts + +There are two helper scripts that should be placed somewhere. Don't forget about +`+x`! + +* yggdrasil_peers.sh - returns number of connected peers. +* yggdrasil_traffic.sh - returns traffic calculation. Accepts `incoming` or `outgoing` +as first parameter. + +Both scripts use `yggdrasilctl` binary and parse it's output. + +## Configure nxagent + +Add this to `/etc/nxagentd.conf`: + +``` +ExternalParameterShellExec=Yggdrasil.GetBytesReceived():/usr/local/bin/yggdrasil_traffic.sh incoming +ExternalParameterShellExec=Yggdrasil.GetBytesSent():usr/local/bin/yggdrasil_traffic.sh outgoing +ExternalParameterShellExec=Yggdrasil.GetConnectedPeersCount():/usr/local/bin/yggdrasil_peers.sh +``` + +**Don't forget to restart NetXMS agent!** diff --git a/templates/applications/yggdrasil/yggdrasil.xml b/templates/applications/yggdrasil/yggdrasil.xml new file mode 100644 index 0000000..1574acb --- /dev/null +++ b/templates/applications/yggdrasil/yggdrasil.xml @@ -0,0 +1,123 @@ + + + 4 + + 3.6.300 + 3.6-300-g287f599693 + Linux 4.19.0-13-amd64 + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/applications/yggdrasil/yggdrasil_peers.sh b/templates/applications/yggdrasil/yggdrasil_peers.sh new file mode 100644 index 0000000..78600bb --- /dev/null +++ b/templates/applications/yggdrasil/yggdrasil_peers.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +YGGDRASIL=$(which yggdrasilctl) + +if [ "${YGGDRASIL}" == "" ]; then + exit 1 +fi + +echo $[ $(${YGGDRASIL} getpeers | wc -l) - 1 ] diff --git a/templates/applications/yggdrasil/yggdrasil_traffic.sh b/templates/applications/yggdrasil/yggdrasil_traffic.sh new file mode 100644 index 0000000..ed998de --- /dev/null +++ b/templates/applications/yggdrasil/yggdrasil_traffic.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +YGGDRASIL=$(which yggdrasilctl) +if [ "${YGGDRASIL}" == "" ]; then + exit 1 +fi + +incoming=0 +outgoing=0 + +KNOWN=$(${YGGDRASIL} getpeers | tail -n +2) + +export IFS=$'\n' +for line in ${KNOWN[@]}; do + if [ "$1" == "incoming" ]; then + incoming=$[ ${incoming}+$(echo ${line} | awk {' print $2 '}) ] + fi + + if [ "$1" == "outgoing" ]; then + outgoing=$[ ${outgoing}+$(echo ${line} | awk {' print $3 '}) ] + fi +done + +case $1 in + incoming) + echo $incoming + ;; + outgoing) + echo $outgoing + ;; + *) + echo "First parameter should be 'incoming' or 'outgoing'!" + ;; +esac