Hello,
I have a server that works with an application with port 10000 and I have it monitored and when this application is blocked it stops listening to port 10000 and I get a drop mail from nagios.
I want to kill the application process when nagios detects that it is down.
Information:
Nagios® Core™ 4.2.3
define service{
use generic-srv ;
hostgroup_name check;
service_description check 10000
check_command check_tcp!10000
}
Server Windows Server 2008 R2 with nsclient monitor CPU, HDD and everything is correct.
kill the application process
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: kill the application process
You would need an agent installed on this server, and then call a script on an event handler that kills the process.
The below article is how to restart a service using nsclient and XI, but most of the information transfers, you will just be modifying config files instead of using the GUI
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
The below article is how to restart a service using nsclient and XI, but most of the information transfers, you will just be modifying config files instead of using the GUI
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
-
- Posts: 3
- Joined: Wed Apr 19, 2017 8:34 am
Re: kill the application process
Hello,
I have configured everything and it works and I can restart the service and the process.
But how do I set it so that when the alert pops up, launch the script?
Sorry for my English.
I have configured everything and it works and I can restart the service and the process.
But how do I set it so that when the alert pops up, launch the script?
Sorry for my English.
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: kill the application process
You need to create a command in nagios for the script, and then add the command as a event_handler for this service
-
- Posts: 3
- Joined: Wed Apr 19, 2017 8:34 am
Re: kill the application process
I can restart a service but I can not finish a process.
Example:
@echo off
net stop service
taskkill / f / t / im Name_process.exe
timeout / t 5
net start service
Alert_MAIL.vbs
@exit 0
Example:
@echo off
net stop service
taskkill / f / t / im Name_process.exe
timeout / t 5
net start service
Alert_MAIL.vbs
@exit 0
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: kill the application process
looks like you have extra spaces in there, shouldn't be spaces after the /
Code: Select all
@echo off
net stop service
taskkill /f /t /im Name_process.exe
timeout /t 5
net start service
Alert_MAIL.vbs
@exit 0