From 7496431da33fe9a7b074d77400743d96ad41f512 Mon Sep 17 00:00:00 2001 From: "Stanislav N. aka pztrn" Date: Tue, 27 Oct 2020 04:03:09 +0500 Subject: [PATCH] Quick processes monitoring solution and README update. --- README.md | 10 + .../README.md | 27 ++ .../helper_script.sh | 7 + .../monitor-by-processestomonitor-list.xml | 252 ++++++++++++++++++ 4 files changed, 296 insertions(+) create mode 100644 templates/processes/monitor-by-processestomonitor-list/README.md create mode 100644 templates/processes/monitor-by-processestomonitor-list/helper_script.sh create mode 100644 templates/processes/monitor-by-processestomonitor-list/monitor-by-processestomonitor-list.xml diff --git a/README.md b/README.md index 562bbac..0b6572c 100644 --- a/README.md +++ b/README.md @@ -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. | diff --git a/templates/processes/monitor-by-processestomonitor-list/README.md b/templates/processes/monitor-by-processestomonitor-list/README.md new file mode 100644 index 0000000..7f94200 --- /dev/null +++ b/templates/processes/monitor-by-processestomonitor-list/README.md @@ -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. diff --git a/templates/processes/monitor-by-processestomonitor-list/helper_script.sh b/templates/processes/monitor-by-processestomonitor-list/helper_script.sh new file mode 100644 index 0000000..2f1a800 --- /dev/null +++ b/templates/processes/monitor-by-processestomonitor-list/helper_script.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +PROCESSES=("process1", "process2", "a.*process.*with.*regexp") + +for process in ${PROCESSES[@]}; do + echo -e "${process}" +done diff --git a/templates/processes/monitor-by-processestomonitor-list/monitor-by-processestomonitor-list.xml b/templates/processes/monitor-by-processestomonitor-list/monitor-by-processestomonitor-list.xml new file mode 100644 index 0000000..8945bf6 --- /dev/null +++ b/templates/processes/monitor-by-processestomonitor-list/monitor-by-processestomonitor-list.xml @@ -0,0 +1,252 @@ + + + 4 + + 3.5.136 + 3.5-136-g37db5ea3c4 + Linux 4.19.0-12-amd64 + + + + + 3c9d6c4c-2ad8-40e1-a8e7-e5c865b07052 + OS_PROCESS_NOT_RUNNING + 100023 + + 3 + 1 + Process %6 is not running + + + + + + + + + + + + + + + + + + + + +