Results 1 to 2 of 2

Thread: Websense Service watch using Nagios

  1. #1
    Member
    Join Date
    Sep 2009
    Posts
    59
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Rep Power
    5

    Default Websense Service watch using Nagios

    Hello

    Can we watch Websense Service (Websense EIM Server) up down status using Nagios ?

  2. #2
    Senior Member ananth_ak's Avatar
    Join Date
    May 2010
    Location
    Vault 101
    Posts
    191
    Thanks
    23
    Thanked 19 Times in 17 Posts
    Rep Power
    6

    Default

    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.



    Code:
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' "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>
    in your nrpe.cfg

    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.

    Code:
    define command {
            command_name check_ntproc
            command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c ntproc
            }
    open /etc/nagios/services.cfg or wherever you have all services configured.

    add the following

    Code:
    define service{
         use                                 local_service
         host_name                       EIM
         service_description            EIM Service
         check_command                check_ntproc
          }
    Reload nagios server

    Restart nrpe on the windows box
    Last edited by ananth_ak; 6th September 2010 at 04:32 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Tomcat Service in Nagios
    By shahid78 in forum CentOS / RHEL / Fedora
    Replies: 3
    Last Post: 12th August 2010, 12:09 AM
  2. Scripts watch ports
    By cant in forum Shell scripting
    Replies: 12
    Last Post: 22nd July 2010, 01:01 AM
  3. looking for a unix command for hpux - watch
    By mr_manny in forum HP-UX
    Replies: 4
    Last Post: 23rd December 2009, 07:24 AM
  4. Replies: 1
    Last Post: 31st August 2009, 05:53 AM
  5. How to watch television on Linux computer
    By tom in forum Getting started tutorials
    Replies: 0
    Last Post: 8th December 2005, 12:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •