Hello
Can we watch Websense Service (Websense EIM Server) up down status using Nagios ?
Hello
Can we watch Websense Service (Websense EIM Server) up down status using Nagios ?
Yes you can,
Assuming this is a windows system process you want to monitor (did a quick google and it looked like a windows based system)
here is the wsf script: save file as check_process.wsf in the same directory that nrpe.cfg is located on your wins server.
in your nrpe.cfgCode:'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' "check_process.wsf" ' nagios@samurai.inka.de ' ' 02.06.2003 ver 1.1 ' ' -------------------------------------------------------------- ' Checks If at least one defined process Is running. ' <job> <runtime> <description> check_process (nrpe_nt-plugin) 1.1 The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute copies of the plugins under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING. Copyright (c) 1999-2001 Ethan Galstad/Hagen Deike (nagios@samurai.inka.de) Checks If at least one defined process Is running. </description> <named name="h" helpstring="Help" type="simple" required="false" /> <named name="info" helpstring="Returns a list of all processes by ID and name" type="simple" required="false" /> <unnamed name="process" helpstring="The process to watch" many="false" required="true" /> <named name="host" helpstring="Defines the netbios name of the system to monitor" type="string" required="false" /> <example> Example: check_process.wsf /info Will return a list of all processes that are running. The output will look As follows: ID Process ------------------------------- 0 System Idle Process 4 System 1312 smss.exe 1392 csrss.exe 1416 winlogon.exe 1460 services.exe 1472 lsass.exe 1688 svchost.exe [...] To use the plugin you need the string Or the ID that Is returned. In this Case If you wish To monitor the winlogon.exe process you use this command check_process.wsf winlogon.exe Please notice that the String Is Case sensitive </example> </runtime> <script language="VBScript"> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Const's and Var's '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'Cons for return val's Const intOK = 0 Const intWarning = 1 Const intCritical = 2 Const intUnknown = 3 ' Cons for FSO Const ForReading = 1 Const ForWriting = 2 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Help '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' If Wscript.Arguments.Named.Exists("host") Then strComputer = Wscript.Arguments.Named("host") Else strComputer = "." End If If Wscript.Arguments.Named.Exists("info") Then Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\"& strComputer &"\root\cimv2") Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process") Wscript.Echo Vbcrlf &" ID"& vbTab &"Process" Wscript.Echo "------------------------------------------------------------" For Each objProcess In colProcesses Wscript.Echo " "& objProcess.ProcessID & Vbtab & objProcess.Name Next Wscript.Quit(intUnknown) End If If Wscript.Arguments.Named.Exists("h") Or Wscript.Arguments.Unnamed.Count <= 0 Or Wscript.Arguments.Unnamed.Count > 1 Then Wscript.Echo "Plugin help screen:" Wscript.Arguments.ShowUsage() Wscript.Quit(intUnknown) End If ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Main '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'Set objDictionary = CreateObject("Scripting.Dictionary") Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\"& strComputer &"\root\cimv2") Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process") intProcCounter = 0 For Each objProcess In colProcesses ' objDictionary.Add objProcess.ProcessID, objProcess.Name ' Wscript.Echo " "& objProcess.ProcessID & Vbtab & objProcess.Name If objProcess.Name = Wscript.Arguments.Unnamed.Item(0) Then intProcCounter = intProcCounter + 1 End If Next If intProcCounter > 0 Then Wscript.Echo "There are "& intProcCounter &" "& Wscript.Arguments.Unnamed.Item(0) &" processes running." Wscript.Quit(intOK) End If Wscript.Echo "No processes were found." Wscript.Quit(intCritical) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' </script> </job>
command[ntproc]=c:\windows\system32\cscript.exe //NoLogo //T:10 c:\nagios\bin\check_process.wsf EIM.EXE /w:0 /c:0
Note: The process name should be the same name that appears in your task manager. Case sensitive.
on your nagios server,
open /etc/nagios/command.cfg or wherever you have all commands configured.
add the following.
open /etc/nagios/services.cfg or wherever you have all services configured.Code:define command { command_name check_ntproc command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c ntproc }
add the following
Reload nagios serverCode:define service{ use local_service host_name EIM service_description EIM Service check_command check_ntproc }
Restart nrpe on the windows box
Last edited by ananth_ak; 6th September 2010 at 04:32 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)