Quick processes monitoring solution and README update.

This commit is contained in:
Stanislav Nikitin 2020-10-27 04:03:09 +05:00
parent 11182d4caa
commit 7496431da3
No known key found for this signature in database
GPG Key ID: 106900B32F8192EE
4 changed files with 296 additions and 0 deletions

View File

@ -3,3 +3,13 @@
This repository contains a collection of useful things for NetXMS, like templates and helper scripts. Each template is suitable to be imported into NetXMS server using "Tools" -> "Import configuration".
Each subdirectory might contain own README file.
## What is here
| Name | Description |
| -------------------- | ----------- |
| [MySQL - generic data](/templates/mysql/generic) | Monitors generic MySQL things. |
| [MySQL - InnoDB](/templates/mysql/innodb) | Monitors InnoDB-related parameters. |
| [MySQL - MyISAM](/templates/mysql/myisam) | Monitors MyISAM-related parameters. |
| [PostgreSQL](/templates/postgresql) | Monitors PostgreSQL server and databases. |
| [Processes - monitor by ProcessesToMonitor list](/templates/processes/monitor-by-processestomonitor-list) | Quick start with processes monitoring using helper script. |

View File

@ -0,0 +1,27 @@
# Monitor processes using custom "ProcessesToMonitor" list
This directory contains everything that is needed to start monitoring your processes quick.
## A warning about regular expressions
Template is using regular expressions instead of binary's name. Keep in mind that your regular expression might capture unneeded data!
## Helper script
Copy script to your server and made it executable with `chmod +x /path/to/script`.
Fix `PROCESSES` array to contain everything you need to monitor (**while keeping in mind a warning about regular expressions above!**)
## Configure nxagent
To export data produced by helper script as list into NetXMS you should add this line into `/etc/nxagentd.conf`:
```
ExternalList=ProcessesToMonitor:/path/to/script.sh
```
**Don't forget to restart NetXMS agent!**
## Poll
Apply template on node(s) and execute "Instance discovery" polling option.

View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
PROCESSES=("process1", "process2", "a.*process.*with.*regexp")
for process in ${PROCESSES[@]}; do
echo -e "${process}"
done

View File

@ -0,0 +1,252 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<formatVersion>4</formatVersion>
<server>
<version>3.5.136</version>
<buildTag>3.5-136-g37db5ea3c4</buildTag>
<operatingSystem>Linux 4.19.0-12-amd64</operatingSystem>
</server>
<description></description>
<events>
<event id="100023">
<guid>3c9d6c4c-2ad8-40e1-a8e7-e5c865b07052</guid>
<name>OS_PROCESS_NOT_RUNNING</name>
<code>100023</code>
<description></description>
<severity>3</severity>
<flags>1</flags>
<message>Process %6 is not running</message>
<tags></tags>
</event>
</events>
<templates>
<template id="337">
<guid>58732c04-0d81-4ba0-9d1a-97e3e5e53a3b</guid>
<name>Monitor by ProcessesToMonitor list</name>
<flags>0</flags>
<comments></comments>
<path>
<element id="1">Applications</element>
</path>
<dataCollection>
<dci id="4052">
<guid>4bac1972-e179-4467-acc2-7b9dca6c1e6c</guid>
<name>Process.CountEx(,&quot;.*{instance}.*&quot;)</name>
<description>Number of {instance} processes</description>
<dataType>1</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>1</instanceDiscoveryMethod>
<instanceRetentionTime>-1</instanceRetentionTime>
<comments></comments>
<isDisabled>false</isDisabled>
<transformation></transformation>
<thresholds>
<threshold id="1">
<function>0</function>
<condition>0</condition>
<value>1</value>
<activationEvent>OS_PROCESS_NOT_RUNNING</activationEvent>
<deactivationEvent>SYS_THRESHOLD_REARMED</deactivationEvent>
<sampleCount>2</sampleCount>
<repeatInterval>-1</repeatInterval>
<script></script>
</threshold>
</thresholds>
<perfTabSettings>&lt;config&gt;&#x0A; &lt;enabled&gt;false&lt;/enabled&gt;&#x0A; &lt;autoScale&gt;true&lt;/autoScale&gt;&#x0A; &lt;logScaleEnabled&gt;false&lt;/logScaleEnabled&gt;&#x0A; &lt;stacked&gt;false&lt;/stacked&gt;&#x0A; &lt;showLegendAlways&gt;false&lt;/showLegendAlways&gt;&#x0A; &lt;extendedLegend&gt;true&lt;/extendedLegend&gt;&#x0A; &lt;minYScaleValue&gt;0.0&lt;/minYScaleValue&gt;&#x0A; &lt;maxYScaleValue&gt;100.0&lt;/maxYScaleValue&gt;&#x0A; &lt;timeRange&gt;1&lt;/timeRange&gt;&#x0A; &lt;timeUnits&gt;1&lt;/timeUnits&gt;&#x0A; &lt;type&gt;0&lt;/type&gt;&#x0A; &lt;color&gt;49152&lt;/color&gt;&#x0A; &lt;title&gt;&lt;/title&gt;&#x0A; &lt;name&gt;&lt;/name&gt;&#x0A; &lt;showThresholds&gt;false&lt;/showThresholds&gt;&#x0A; &lt;groupName&gt;&lt;/groupName&gt;&#x0A; &lt;order&gt;100&lt;/order&gt;&#x0A; &lt;parentDciId&gt;0&lt;/parentDciId&gt;&#x0A; &lt;modifyYBase&gt;false&lt;/modifyYBase&gt;&#x0A; &lt;invertedValues&gt;false&lt;/invertedValues&gt;&#x0A;&lt;/config&gt;</perfTabSettings>
<instanceDiscoveryData>ProcessesToMonitor</instanceDiscoveryData>
<instanceFilter></instanceFilter>
</dci>
<dci id="4053">
<guid>e75f4a79-a622-4a49-829d-dfdaaede4605</guid>
<name>Process.CPUTime(,,&quot;.*{instance}.*&quot;)</name>
<description>CPU usage for process {instance}</description>
<dataType>5</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>1</instanceDiscoveryMethod>
<instanceRetentionTime>-1</instanceRetentionTime>
<comments></comments>
<isDisabled>false</isDisabled>
<transformation>return $1 / 10.0;</transformation>
<perfTabSettings>&lt;config&gt;&#x0A; &lt;enabled&gt;false&lt;/enabled&gt;&#x0A; &lt;autoScale&gt;true&lt;/autoScale&gt;&#x0A; &lt;logScaleEnabled&gt;false&lt;/logScaleEnabled&gt;&#x0A; &lt;stacked&gt;false&lt;/stacked&gt;&#x0A; &lt;showLegendAlways&gt;false&lt;/showLegendAlways&gt;&#x0A; &lt;extendedLegend&gt;true&lt;/extendedLegend&gt;&#x0A; &lt;minYScaleValue&gt;0.0&lt;/minYScaleValue&gt;&#x0A; &lt;maxYScaleValue&gt;100.0&lt;/maxYScaleValue&gt;&#x0A; &lt;timeRange&gt;1&lt;/timeRange&gt;&#x0A; &lt;timeUnits&gt;1&lt;/timeUnits&gt;&#x0A; &lt;type&gt;0&lt;/type&gt;&#x0A; &lt;color&gt;49152&lt;/color&gt;&#x0A; &lt;title&gt;&lt;/title&gt;&#x0A; &lt;name&gt;&lt;/name&gt;&#x0A; &lt;showThresholds&gt;false&lt;/showThresholds&gt;&#x0A; &lt;groupName&gt;&lt;/groupName&gt;&#x0A; &lt;order&gt;100&lt;/order&gt;&#x0A; &lt;parentDciId&gt;0&lt;/parentDciId&gt;&#x0A; &lt;modifyYBase&gt;false&lt;/modifyYBase&gt;&#x0A; &lt;invertedValues&gt;false&lt;/invertedValues&gt;&#x0A;&lt;/config&gt;</perfTabSettings>
<instanceDiscoveryData>ProcessesToMonitor</instanceDiscoveryData>
<instanceFilter></instanceFilter>
</dci>
<dci id="4054">
<guid>802b241d-f296-4293-bc2d-a4350551e8f2</guid>
<name>Process.Threads(,,&quot;.*{instance}.*&quot;)</name>
<description>Number of threads in process {instance}</description>
<dataType>1</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>1</instanceDiscoveryMethod>
<instanceRetentionTime>-1</instanceRetentionTime>
<comments></comments>
<isDisabled>false</isDisabled>
<transformation></transformation>
<perfTabSettings>&lt;config&gt;&#x0A; &lt;enabled&gt;false&lt;/enabled&gt;&#x0A; &lt;autoScale&gt;true&lt;/autoScale&gt;&#x0A; &lt;logScaleEnabled&gt;false&lt;/logScaleEnabled&gt;&#x0A; &lt;stacked&gt;false&lt;/stacked&gt;&#x0A; &lt;showLegendAlways&gt;false&lt;/showLegendAlways&gt;&#x0A; &lt;extendedLegend&gt;true&lt;/extendedLegend&gt;&#x0A; &lt;minYScaleValue&gt;0.0&lt;/minYScaleValue&gt;&#x0A; &lt;maxYScaleValue&gt;100.0&lt;/maxYScaleValue&gt;&#x0A; &lt;timeRange&gt;1&lt;/timeRange&gt;&#x0A; &lt;timeUnits&gt;1&lt;/timeUnits&gt;&#x0A; &lt;type&gt;0&lt;/type&gt;&#x0A; &lt;color&gt;49152&lt;/color&gt;&#x0A; &lt;title&gt;&lt;/title&gt;&#x0A; &lt;name&gt;&lt;/name&gt;&#x0A; &lt;showThresholds&gt;false&lt;/showThresholds&gt;&#x0A; &lt;groupName&gt;&lt;/groupName&gt;&#x0A; &lt;order&gt;100&lt;/order&gt;&#x0A; &lt;parentDciId&gt;0&lt;/parentDciId&gt;&#x0A; &lt;modifyYBase&gt;false&lt;/modifyYBase&gt;&#x0A; &lt;invertedValues&gt;false&lt;/invertedValues&gt;&#x0A;&lt;/config&gt;</perfTabSettings>
<instanceDiscoveryData>ProcessesToMonitor</instanceDiscoveryData>
<instanceFilter></instanceFilter>
</dci>
<dci id="4055">
<guid>bc02e209-d503-4e2c-a796-d1ba0a374659</guid>
<name>Process.WkSet(,,&quot;.*{instance}.*&quot;)</name>
<description>Physical memory used by process {instance}</description>
<dataType>2</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>1</instanceDiscoveryMethod>
<instanceRetentionTime>-1</instanceRetentionTime>
<comments></comments>
<isDisabled>false</isDisabled>
<transformation></transformation>
<perfTabSettings>&lt;config&gt;&#x0A; &lt;enabled&gt;false&lt;/enabled&gt;&#x0A; &lt;autoScale&gt;true&lt;/autoScale&gt;&#x0A; &lt;logScaleEnabled&gt;false&lt;/logScaleEnabled&gt;&#x0A; &lt;stacked&gt;false&lt;/stacked&gt;&#x0A; &lt;showLegendAlways&gt;false&lt;/showLegendAlways&gt;&#x0A; &lt;extendedLegend&gt;true&lt;/extendedLegend&gt;&#x0A; &lt;minYScaleValue&gt;0.0&lt;/minYScaleValue&gt;&#x0A; &lt;maxYScaleValue&gt;100.0&lt;/maxYScaleValue&gt;&#x0A; &lt;timeRange&gt;1&lt;/timeRange&gt;&#x0A; &lt;timeUnits&gt;1&lt;/timeUnits&gt;&#x0A; &lt;type&gt;0&lt;/type&gt;&#x0A; &lt;color&gt;49152&lt;/color&gt;&#x0A; &lt;title&gt;&lt;/title&gt;&#x0A; &lt;name&gt;&lt;/name&gt;&#x0A; &lt;showThresholds&gt;false&lt;/showThresholds&gt;&#x0A; &lt;groupName&gt;&lt;/groupName&gt;&#x0A; &lt;order&gt;100&lt;/order&gt;&#x0A; &lt;parentDciId&gt;0&lt;/parentDciId&gt;&#x0A; &lt;modifyYBase&gt;false&lt;/modifyYBase&gt;&#x0A; &lt;invertedValues&gt;false&lt;/invertedValues&gt;&#x0A;&lt;/config&gt;</perfTabSettings>
<instanceDiscoveryData>ProcessesToMonitor</instanceDiscoveryData>
<instanceFilter></instanceFilter>
</dci>
<dci id="4092">
<guid>f0786788-b285-45b8-9a1f-7aec7546220e</guid>
<name>Process.Handles(,,&quot;.*{instance}.*&quot;)</name>
<description>Number of handles in process {instance}</description>
<dataType>1</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>1</instanceDiscoveryMethod>
<instanceRetentionTime>-1</instanceRetentionTime>
<comments></comments>
<isDisabled>false</isDisabled>
<transformation></transformation>
<perfTabSettings>&lt;config&gt;&#x0A; &lt;enabled&gt;false&lt;/enabled&gt;&#x0A; &lt;autoScale&gt;true&lt;/autoScale&gt;&#x0A; &lt;logScaleEnabled&gt;false&lt;/logScaleEnabled&gt;&#x0A; &lt;stacked&gt;false&lt;/stacked&gt;&#x0A; &lt;showLegendAlways&gt;false&lt;/showLegendAlways&gt;&#x0A; &lt;extendedLegend&gt;true&lt;/extendedLegend&gt;&#x0A; &lt;minYScaleValue&gt;0.0&lt;/minYScaleValue&gt;&#x0A; &lt;maxYScaleValue&gt;100.0&lt;/maxYScaleValue&gt;&#x0A; &lt;timeRange&gt;1&lt;/timeRange&gt;&#x0A; &lt;timeUnits&gt;1&lt;/timeUnits&gt;&#x0A; &lt;type&gt;0&lt;/type&gt;&#x0A; &lt;color&gt;49152&lt;/color&gt;&#x0A; &lt;title&gt;&lt;/title&gt;&#x0A; &lt;name&gt;&lt;/name&gt;&#x0A; &lt;showThresholds&gt;false&lt;/showThresholds&gt;&#x0A; &lt;groupName&gt;&lt;/groupName&gt;&#x0A; &lt;order&gt;100&lt;/order&gt;&#x0A; &lt;parentDciId&gt;0&lt;/parentDciId&gt;&#x0A; &lt;modifyYBase&gt;false&lt;/modifyYBase&gt;&#x0A; &lt;invertedValues&gt;false&lt;/invertedValues&gt;&#x0A;&lt;/config&gt;</perfTabSettings>
<instanceDiscoveryData>ProcessesToMonitor</instanceDiscoveryData>
<instanceFilter></instanceFilter>
</dci>
<dci id="4093">
<guid>b93c5f59-e6f5-47b9-ae12-d14e48ac9fc5</guid>
<name>Process.PageFaults(,,&quot;.*{instance}.*&quot;)</name>
<description>Page faults for process {instance}</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>1</instanceDiscoveryMethod>
<instanceRetentionTime>-1</instanceRetentionTime>
<comments></comments>
<isDisabled>false</isDisabled>
<transformation></transformation>
<perfTabSettings>&lt;config&gt;&#x0A; &lt;enabled&gt;false&lt;/enabled&gt;&#x0A; &lt;autoScale&gt;true&lt;/autoScale&gt;&#x0A; &lt;logScaleEnabled&gt;false&lt;/logScaleEnabled&gt;&#x0A; &lt;stacked&gt;false&lt;/stacked&gt;&#x0A; &lt;showLegendAlways&gt;false&lt;/showLegendAlways&gt;&#x0A; &lt;extendedLegend&gt;true&lt;/extendedLegend&gt;&#x0A; &lt;minYScaleValue&gt;0.0&lt;/minYScaleValue&gt;&#x0A; &lt;maxYScaleValue&gt;100.0&lt;/maxYScaleValue&gt;&#x0A; &lt;timeRange&gt;1&lt;/timeRange&gt;&#x0A; &lt;timeUnits&gt;1&lt;/timeUnits&gt;&#x0A; &lt;type&gt;0&lt;/type&gt;&#x0A; &lt;color&gt;49152&lt;/color&gt;&#x0A; &lt;title&gt;&lt;/title&gt;&#x0A; &lt;name&gt;&lt;/name&gt;&#x0A; &lt;showThresholds&gt;false&lt;/showThresholds&gt;&#x0A; &lt;groupName&gt;&lt;/groupName&gt;&#x0A; &lt;order&gt;100&lt;/order&gt;&#x0A; &lt;parentDciId&gt;0&lt;/parentDciId&gt;&#x0A; &lt;modifyYBase&gt;false&lt;/modifyYBase&gt;&#x0A; &lt;invertedValues&gt;false&lt;/invertedValues&gt;&#x0A;&lt;/config&gt;</perfTabSettings>
<instanceDiscoveryData>ProcessesToMonitor</instanceDiscoveryData>
<instanceFilter></instanceFilter>
</dci>
<dci id="4094">
<guid>a71a7551-eb87-4579-9cc8-7561d38c04f6</guid>
<name>Process.VMSize(,,&quot;.*{instance}.*&quot;)</name>
<description>Virtual memory used by process {instance}</description>
<dataType>2</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>1</instanceDiscoveryMethod>
<instanceRetentionTime>-1</instanceRetentionTime>
<comments></comments>
<isDisabled>false</isDisabled>
<transformation></transformation>
<perfTabSettings>&lt;config&gt;&#x0A; &lt;enabled&gt;false&lt;/enabled&gt;&#x0A; &lt;autoScale&gt;true&lt;/autoScale&gt;&#x0A; &lt;logScaleEnabled&gt;false&lt;/logScaleEnabled&gt;&#x0A; &lt;stacked&gt;false&lt;/stacked&gt;&#x0A; &lt;showLegendAlways&gt;false&lt;/showLegendAlways&gt;&#x0A; &lt;extendedLegend&gt;true&lt;/extendedLegend&gt;&#x0A; &lt;minYScaleValue&gt;0.0&lt;/minYScaleValue&gt;&#x0A; &lt;maxYScaleValue&gt;100.0&lt;/maxYScaleValue&gt;&#x0A; &lt;timeRange&gt;1&lt;/timeRange&gt;&#x0A; &lt;timeUnits&gt;1&lt;/timeUnits&gt;&#x0A; &lt;type&gt;0&lt;/type&gt;&#x0A; &lt;color&gt;49152&lt;/color&gt;&#x0A; &lt;title&gt;&lt;/title&gt;&#x0A; &lt;name&gt;&lt;/name&gt;&#x0A; &lt;showThresholds&gt;false&lt;/showThresholds&gt;&#x0A; &lt;groupName&gt;&lt;/groupName&gt;&#x0A; &lt;order&gt;100&lt;/order&gt;&#x0A; &lt;parentDciId&gt;0&lt;/parentDciId&gt;&#x0A; &lt;modifyYBase&gt;false&lt;/modifyYBase&gt;&#x0A; &lt;invertedValues&gt;false&lt;/invertedValues&gt;&#x0A;&lt;/config&gt;</perfTabSettings>
<instanceDiscoveryData>ProcessesToMonitor</instanceDiscoveryData>
<instanceFilter></instanceFilter>
</dci>
</dataCollection>
<agentPolicies>
</agentPolicies>
</template>
</templates>
<traps>
</traps>
<rules>
</rules>
<scripts>
</scripts>
<objectTools>
</objectTools>
<dciSummaryTables>
</dciSummaryTables>
<actions>
</actions>
<webServiceDefinitions>
</webServiceDefinitions>
</configuration>