Hello,
I hope this isn't a bother. I've been trying to find a solution to this, but don't seem to see anything on here about it. We have a server that kicks off a scheduled task that opens excel to insert data into a readable form for our Sales Department. However, as of late, Excel has been hanging and I was wondering if it's possible to get Nagios XI to notify me when Multiple copies of excel are open?
Thanks ahead of time.
Monitor if I have several instances of Excel open...
-
snchestnut01
- Posts: 25
- Joined: Mon Feb 29, 2016 2:46 pm
-
avandemore
- Posts: 1597
- Joined: Tue Sep 27, 2016 4:57 pm
Re: Monitor if I have several instances of Excel open...
Developing custom plugins isn't part of support but here are some of the basics:
You'll need nsclient++ or something similar on the Windows system.
Configuring The Windows Agent: NSClient ++
Status's are governed by Return Codes eg 0 is Normal, 2 is Critical
The check_procs plugin does most of this. See https://support.nagios.com/forum/viewto ... 34&t=29045
Remember this only checks processes, not number of threads.
You'll need nsclient++ or something similar on the Windows system.
Configuring The Windows Agent: NSClient ++
Status's are governed by Return Codes eg 0 is Normal, 2 is Critical
The check_procs plugin does most of this. See https://support.nagios.com/forum/viewto ... 34&t=29045
Remember this only checks processes, not number of threads.
Previous Nagios employee
Re: Monitor if I have several instances of Excel open...
This just checks if a process is running, but its close... You just need to dd the count feature.
/usr/local/nagios/libexec/check_nrpe -H host-u -t 45 -c check_process2 -a excel.exe
nsclient.ini:check_process2 = cscript.exe //T:30 //NoLogo scripts\\check_process2.vbs $ARGS"$
/usr/local/nagios/libexec/check_nrpe -H host-u -t 45 -c check_process2 -a excel.exe
nsclient.ini:check_process2 = cscript.exe //T:30 //NoLogo scripts\\check_process2.vbs $ARGS"$
Code: Select all
C:\Users\gormke1\Documents\Nagios>cat C:\Users\gormke1\Documents\Nagios\Nagios.d.windows\Agents\Scripts\check_process2.vbs
' This script is special to find a process in the process list that is running with specific text in the command line
' Takes in 3 Arguments
' 1) name of process
' 2) search text for commandline
' 3) If you just want to warn put a 1 else anything else will be critical
IsTheProcessThere = 0
If NOT WScript.Arguments.Count >= 2 Then
WScript.Echo "This script has three arguments. 1) The process name ; 2) Text looking for in the command 3) Optional = 1 if you want to just WARN"
WScript.Quit 3
Else
ProcessName = WScript.Arguments.Item(0)
TextInCommandLine = WScript.Arguments.Item(1)
If WScript.Arguments.Count = 3 Then
JustWarn = WScript.Arguments.Item(2)
Else
JustWarn = 1111 'whatever you want just not 1
End if
Set Service = GetObject("winmgmts:\\" & ComputerName &"")
for each Process in Service.InstancesOf ("Win32_Process")
If Process.name = ProcessName Then
'OK we pass that test
If NOT InStr(Process.CommandLine, TextInCommandLine) = 0 Then
'We passed all tests so we are good to say we found everything....go report
IsTheProcessThere = 1
End if
End if
next
If IsTheProcessThere = 1 Then
WScript.Echo "OK - Found " & ProcessName & " with a commandline containing '" & TextInCommandLine & "'"
WScript.Quit 0
Else
WScript.Echo "Problem - Process " & ProcessName & " with the commandline search text '" & TextInCommandLine& "' is not running!"
If JustWarn = 1 Then
WScript.Quit 1
Else
WScript.Quit 2
End if
End if
End if
Last edited by gormank on Tue Nov 08, 2016 5:44 pm, edited 1 time in total.
Re: Monitor if I have several instances of Excel open...
Another option is to use the check_process command to check for if Excell is running.
The below example will give a warning if greater than 2 copies are running and a critical for over 3.
Try that and let us know if it works for you.
The below example will give a warning if greater than 2 copies are running and a critical for over 3.
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H xxx.xxx.xxx.xxx -c check_process -a process=EXCEL.exe "warning=count>2" "critical=count>3" show-allBe sure to check out our Knowledgebase for helpful articles and solutions!