Move apps-related templates to applications dir and add yggdrasil template and helpers.
This commit is contained in:
parent
dd7c04e67a
commit
63192712ed
27
templates/applications/yggdrasil/README.md
Normal file
27
templates/applications/yggdrasil/README.md
Normal file
@ -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!**
|
123
templates/applications/yggdrasil/yggdrasil.xml
Normal file
123
templates/applications/yggdrasil/yggdrasil.xml
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<formatVersion>4</formatVersion>
|
||||||
|
<server>
|
||||||
|
<version>3.6.300</version>
|
||||||
|
<buildTag>3.6-300-g287f599693</buildTag>
|
||||||
|
<operatingSystem>Linux 4.19.0-13-amd64</operatingSystem>
|
||||||
|
</server>
|
||||||
|
<description></description>
|
||||||
|
<events>
|
||||||
|
</events>
|
||||||
|
<templates>
|
||||||
|
<template id="542">
|
||||||
|
<guid>cde6ca5a-ea94-4c50-a67b-432f4af86def</guid>
|
||||||
|
<name>Yggdrasil</name>
|
||||||
|
<flags>0</flags>
|
||||||
|
<comments></comments>
|
||||||
|
<path>
|
||||||
|
<element id="1">Applications</element>
|
||||||
|
</path>
|
||||||
|
<dataCollection>
|
||||||
|
<dci id="5401">
|
||||||
|
<guid>4dcbdcd8-6a16-4f28-a6cc-1e6eee90365e</guid>
|
||||||
|
<name>Yggdrasil.GetBytesReceived()</name>
|
||||||
|
<description>Yggdrasil: bytes received</description>
|
||||||
|
<dataType>8</dataType>
|
||||||
|
<samples>0</samples>
|
||||||
|
<origin>1</origin>
|
||||||
|
<scheduleType>0</scheduleType>
|
||||||
|
<interval></interval>
|
||||||
|
<retentionType>0</retentionType>
|
||||||
|
<retention></retention>
|
||||||
|
<instance></instance>
|
||||||
|
<systemTag></systemTag>
|
||||||
|
<delta>2</delta>
|
||||||
|
<flags>0</flags>
|
||||||
|
<snmpRawValueType>0</snmpRawValueType>
|
||||||
|
<snmpPort>0</snmpPort>
|
||||||
|
<snmpVersion>127</snmpVersion>
|
||||||
|
<instanceDiscoveryMethod>0</instanceDiscoveryMethod>
|
||||||
|
<instanceRetentionTime>-1</instanceRetentionTime>
|
||||||
|
<comments></comments>
|
||||||
|
<isDisabled>false</isDisabled>
|
||||||
|
<transformation></transformation>
|
||||||
|
<perfTabSettings><config>
 <enabled>false</enabled>
 <autoScale>true</autoScale>
 <logScaleEnabled>false</logScaleEnabled>
 <stacked>false</stacked>
 <showLegendAlways>false</showLegendAlways>
 <extendedLegend>true</extendedLegend>
 <minYScaleValue>0.0</minYScaleValue>
 <maxYScaleValue>100.0</maxYScaleValue>
 <timeRange>1</timeRange>
 <timeUnits>1</timeUnits>
 <type>0</type>
 <color>49152</color>
 <title></title>
 <name></name>
 <showThresholds>false</showThresholds>
 <groupName></groupName>
 <order>100</order>
 <parentDciId>0</parentDciId>
 <modifyYBase>false</modifyYBase>
 <invertedValues>false</invertedValues>
</config></perfTabSettings>
|
||||||
|
<instanceDiscoveryData></instanceDiscoveryData>
|
||||||
|
<instanceFilter></instanceFilter>
|
||||||
|
</dci>
|
||||||
|
<dci id="5402">
|
||||||
|
<guid>9f2c0fb1-5d9b-440f-956e-c393b7bed211</guid>
|
||||||
|
<name>Yggdrasil.GetBytesSent()</name>
|
||||||
|
<description>Yggdrasil: bytes sent</description>
|
||||||
|
<dataType>8</dataType>
|
||||||
|
<samples>0</samples>
|
||||||
|
<origin>1</origin>
|
||||||
|
<scheduleType>0</scheduleType>
|
||||||
|
<interval></interval>
|
||||||
|
<retentionType>0</retentionType>
|
||||||
|
<retention></retention>
|
||||||
|
<instance></instance>
|
||||||
|
<systemTag></systemTag>
|
||||||
|
<delta>2</delta>
|
||||||
|
<flags>0</flags>
|
||||||
|
<snmpRawValueType>0</snmpRawValueType>
|
||||||
|
<snmpPort>0</snmpPort>
|
||||||
|
<snmpVersion>127</snmpVersion>
|
||||||
|
<instanceDiscoveryMethod>0</instanceDiscoveryMethod>
|
||||||
|
<instanceRetentionTime>-1</instanceRetentionTime>
|
||||||
|
<comments></comments>
|
||||||
|
<isDisabled>false</isDisabled>
|
||||||
|
<transformation></transformation>
|
||||||
|
<perfTabSettings><config>
 <enabled>false</enabled>
 <autoScale>true</autoScale>
 <logScaleEnabled>false</logScaleEnabled>
 <stacked>false</stacked>
 <showLegendAlways>false</showLegendAlways>
 <extendedLegend>true</extendedLegend>
 <minYScaleValue>0.0</minYScaleValue>
 <maxYScaleValue>100.0</maxYScaleValue>
 <timeRange>1</timeRange>
 <timeUnits>1</timeUnits>
 <type>0</type>
 <color>49152</color>
 <title></title>
 <name></name>
 <showThresholds>false</showThresholds>
 <groupName></groupName>
 <order>100</order>
 <parentDciId>0</parentDciId>
 <modifyYBase>false</modifyYBase>
 <invertedValues>false</invertedValues>
</config></perfTabSettings>
|
||||||
|
<instanceDiscoveryData></instanceDiscoveryData>
|
||||||
|
<instanceFilter></instanceFilter>
|
||||||
|
</dci>
|
||||||
|
<dci id="5403">
|
||||||
|
<guid>dc1efc30-1a8b-4bc0-98c5-a02d0ee44311</guid>
|
||||||
|
<name>Yggdrasil.GetConnectedPeersCount()</name>
|
||||||
|
<description>Yggdrasil: connected peers</description>
|
||||||
|
<dataType>8</dataType>
|
||||||
|
<samples>0</samples>
|
||||||
|
<origin>1</origin>
|
||||||
|
<scheduleType>0</scheduleType>
|
||||||
|
<interval></interval>
|
||||||
|
<retentionType>0</retentionType>
|
||||||
|
<retention></retention>
|
||||||
|
<instance></instance>
|
||||||
|
<systemTag></systemTag>
|
||||||
|
<delta>0</delta>
|
||||||
|
<flags>0</flags>
|
||||||
|
<snmpRawValueType>0</snmpRawValueType>
|
||||||
|
<snmpPort>0</snmpPort>
|
||||||
|
<snmpVersion>127</snmpVersion>
|
||||||
|
<instanceDiscoveryMethod>0</instanceDiscoveryMethod>
|
||||||
|
<instanceRetentionTime>-1</instanceRetentionTime>
|
||||||
|
<comments></comments>
|
||||||
|
<isDisabled>false</isDisabled>
|
||||||
|
<transformation></transformation>
|
||||||
|
<perfTabSettings><config>
 <enabled>false</enabled>
 <autoScale>true</autoScale>
 <logScaleEnabled>false</logScaleEnabled>
 <stacked>false</stacked>
 <showLegendAlways>false</showLegendAlways>
 <extendedLegend>true</extendedLegend>
 <minYScaleValue>0.0</minYScaleValue>
 <maxYScaleValue>100.0</maxYScaleValue>
 <timeRange>1</timeRange>
 <timeUnits>1</timeUnits>
 <type>0</type>
 <color>49152</color>
 <title></title>
 <name></name>
 <showThresholds>false</showThresholds>
 <groupName></groupName>
 <order>100</order>
 <parentDciId>0</parentDciId>
 <modifyYBase>false</modifyYBase>
 <invertedValues>false</invertedValues>
</config></perfTabSettings>
|
||||||
|
<instanceDiscoveryData></instanceDiscoveryData>
|
||||||
|
<instanceFilter></instanceFilter>
|
||||||
|
</dci>
|
||||||
|
</dataCollection>
|
||||||
|
<agentPolicies>
|
||||||
|
</agentPolicies>
|
||||||
|
<filter autoBind="0" autoUnbind="0"></filter>
|
||||||
|
</template>
|
||||||
|
</templates>
|
||||||
|
<traps>
|
||||||
|
</traps>
|
||||||
|
<rules>
|
||||||
|
</rules>
|
||||||
|
<scripts>
|
||||||
|
</scripts>
|
||||||
|
<objectTools>
|
||||||
|
</objectTools>
|
||||||
|
<dciSummaryTables>
|
||||||
|
</dciSummaryTables>
|
||||||
|
<actions>
|
||||||
|
</actions>
|
||||||
|
<webServiceDefinitions>
|
||||||
|
</webServiceDefinitions>
|
||||||
|
</configuration>
|
9
templates/applications/yggdrasil/yggdrasil_peers.sh
Normal file
9
templates/applications/yggdrasil/yggdrasil_peers.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
YGGDRASIL=$(which yggdrasilctl)
|
||||||
|
|
||||||
|
if [ "${YGGDRASIL}" == "" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $[ $(${YGGDRASIL} getpeers | wc -l) - 1 ]
|
34
templates/applications/yggdrasil/yggdrasil_traffic.sh
Normal file
34
templates/applications/yggdrasil/yggdrasil_traffic.sh
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user