
Nagios – Monitoring active processes on Windows or Linux
Very good! I leave you with a document that will be of help to us as long as we want to verify that we have a program running on any computer in our organization. We will see the necessary steps to be able to monitor if a remote computer, whether Windows or Linux, has any process running, and alert us in case of its fall. In addition, if we are interested, we could monitor its CPU or RAM consumption., all this only through SNMP!
We start! As we know, the first thing will be to register the Command if we do not have it, “Configuration” > “Commands” > “Add” and we complete the following:
- Command Name: We give you a name, Usually to associate it more easily we put the name of the script, in this example: 'check_centreon_snmp_process_detailed
- Command Type: We mark 'check'.
- Command Line: And here we know that we have to put what will actually execute, Using variables and arguments should look something like this: '$USER 1$/check_centreon_snmp_process_detailed -H $HOSTADDRESS$ -C $USER 2$ -n $ARG 1$ -w $ARG 2$’
Click on “Describe arguments” to define the arguments to remember them more easily when creating the services, ARG1 will be the Process Name and ARG2 will be the Number of Processes. We keep with “Save”.
We're going to “Configuration” > “Services” > “Add” Or we clone one…,and now the interesting part remains, every time we want to monitor a process on Windows or Linux, We must create a service with the following data (at least):
- Description: We clearly indicate something that refers to the process being monitored (e.g: 'Internet Explorer Process', 'Apache Process'…)
- Service Template: Normally we'll select 'generic-service’ so that we configure the generic options.
- Check Command: Select from the combo the Command that we just created in the previous step.
- Args: If everything has been correct, will ask us 2 Arguments, the first as we know we will fill in with the name of the executable, in the examples above 'iexplore.exe’ or 'apache2'… And in the second one we will indicate the number in warning/critical of the processes that may be active: 0,1 (for 1 process), 1,2 (for 2 Processes), 2,3 (for 3 Processes)…
We keep with “Save”,
And as always, We save and export the configuration! And so in the Monitoring tab we can see if we have the processes monitored! One less thing to keep in mind, truth???? Enjoy!!
By the way, If we put the '-m MB_WARNING argument to the command,MB_CRITICAL’ we will be able to monitor your RAM consumption. Just as if we were interested in being alerted when a process exceeds a CPU usage threshold, it would be with '-u %_WARNING,%_CRITICAL'.