Check Windows Process memory

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
JohnFLi
Posts: 559
Joined: Mon Jun 17, 2013 3:11 pm

Re: Check Windows Process memory

Post by JohnFLi »

same result

Code: Select all

Current Status:	  CRITICAL   (for 2d 20h 29m 29s)
Status Information:	CRITICAL: Memory for W3WP has passed 1,000 meg 194.66796875
Performance Data:	
CLI

Code: Select all

# ./check_nrpe -H g1vpfms02 -c check_w3wp -a '200 1000'
OK: Everything seems to be fine 194.72265625

Code: Select all

define service {
	host_name			G1VPFMS02
	service_description		W3WP Memory
	check_command			check_nrpe!check_w3wp!'200 1000'!!!!!!
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		5
	first_notification_delay	0
	notification_period		xi_timeperiod_24x7
	notification_options		w,c,u,
	contacts			My Name
	register			1
	}	
Powershell script

Code: Select all

param($warn, $crit)
    $LastExitCode = 3
    $output = ""
    $myW3WP = Get-Process w3wp |  Sort -Descending WS| select -first 1 | Measure-Object WS -Sum
    $myW3WP = $myW3WP.sum / 1mb


    if ($myW3WP -gt $crit)
            {
                $output = "CRITICAL: Memory for W3WP has passed 1,000 meg $myW3WP"
                $LastExitCode = 2
         }   
        elseif ($myW3WP -gt $warn)
            {
                $output = "WARN: Memory for W3WP is getting close to 1,000 meg $myW3WP"
                $LastExitCode = 1
            }
        else
            {
                $output = "OK: Everything seems to be fine $myW3WP"
            $LastExitCode = 0
            }

   Write-Host $output
   exit $LastExitCode
ini

Code: Select all

[/settings/external scripts/scripts]
check_w3wp=cmd /c echo C:\scripts\checkW3WP.ps1 $ARG1$; exit $LastExitCode | powershell.exe -command -
Everybody is somebody else’s weirdo
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Check Windows Process memory

Post by tgriep »

On your Nagios Server, go to Core Config Manager > Services, edit the W3WP Memory service.
Change your $ARG2$ from

Code: Select all

'200 1000'
to

Code: Select all

-a '200 1000'
You need to add the -a to the $ARG2$ also.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
JohnFLi
Posts: 559
Joined: Mon Jun 17, 2013 3:11 pm

Re: Check Windows Process memory

Post by JohnFLi »

the pesky -a

XI seems to like it now.
Everybody is somebody else’s weirdo
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Check Windows Process memory

Post by rkennedy »

:D Glad to see this script made it's full course through, and that you didn't stick with my one liner!

Did the -a flag end up fixing it then? Are we good to close this thread out?
Former Nagios Employee
User avatar
JohnFLi
Posts: 559
Joined: Mon Jun 17, 2013 3:11 pm

Re: Check Windows Process memory

Post by JohnFLi »

yes, the -a did fix it. now I'm facing another issue.
as you could see i was trying to get this to work on the machine named fms02. Seems to be working fine. SO I copied all the settings and applied to FMS01. restart the nsclient service etc. and I get the "no handler" error message.

just for fun, I stopped the nsclient service on fms01.... all the nagios checks on fms02 started going off. the nagios server pings the right machines, I checked the managed host button, everything is correct. wierd.

but anyway, for this thread, you can close it.

Thank you guys yet again.
Everybody is somebody else’s weirdo
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Check Windows Process memory

Post by rkennedy »

The configuration may have just needed a reload. Sounds good, I'll close this out now.

If you ever need any assistance in the future, feel free to open a new thread!
Former Nagios Employee
Locked