3ecommunications.net

Home > Windows Update > Nagios Powershell Script

Nagios Powershell Script

Contents

Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. If any events match the level (default is warning, error, and c Download Check-EventLog.ps1 Ratings (0) Downloaded 381 times Favorites Add to favorites Category Interoperability and That's all fine and well but how do we do that? Thanks CT 9 years ago Joel "Jaykul" Bennett Check out Get-ExitCode.ps1 on http://huddledmasses.org/jaykul/register-dll-calling-regsvr32-without-messageboxes-in-powershell/ 10 years ago alemyis Try running the script like this: PowerShell –Command “& { c:ts.ps1; exit $LASTEXITCODE}” echo

sixarm Posts: 12Joined: Sat Apr 07, 2012 5:05 am Top Re: check_nrpe - NSClient - Exit Codes always showing 'Warni by yancy » Mon Jun 25, 2012 9:52 am Hi From the local machine, I can get an output like: "Updates: 0 critical, 1 optional" but getting Unable to read plugin output from the Nagios side. :( Any help is appreciated. The NSclient version is 0.4.3.143 and im getting Unknown command. First we will need to add a service check to a host object in order to try this out for real. https://support.nagios.com/forum/viewtopic.php?t=6196&p=28327

Nagios Powershell Script

Putting newlines into update string: $criticalTitles += $update.Title + " " Changed to: $criticalTitles += $update.Title + " `n" 3. A tweak to handle "important"?bySoccan, July 29, 2015 This is really a great and smooth running script, only adjusted the $returnStateOptionalUpdates parameter and then deployed it by Puppet to our windows https://github.com/ypid-bot/check_mk/pull/7 https://github.com/ypid/check_mk/blob/feature/windows_updates.ps1/agents/windows/plugins/windows_updates.ps1 Can this work with winrpe?byFractalSystems, December 3, 2015 I had a similar issue running cmd /c echo on a .wsf when the example showed using Nsclient, but I was Bug: $critialTitles = ""; should read: $criticalTitles = ""; The script works anyway despite the error. 2.

agriffin Posts: 876Joined: Mon May 09, 2011 9:36 am Top Re: check_nrpe - NSClient - Exit Codes always showing 'Warni by sixarm » Tue Jun 19, 2012 3:58 am Sadly Privacy Policy Trademarks Terms of Use Yet another tech blog about *nix, virtualization, monitoring and other stuff Skip to content Home « How to install and set up logwatch on Debian agriffin Posts: 876Joined: Mon May 09, 2011 9:36 am Top Re: check_nrpe - NSClient - Exit Codes always showing 'Warni by sixarm » Thu Jun 21, 2012 3:28 am Of Powershell Check Windows Updates Remotely If I were to change the line within NSC.ini to the below would that solve this issue?Code: Select allcheck_exqueue=cmd /c echo scripts\ExchangeQueueHealth.ps1; exit($lastexitcode) | powershell.exe -command -
sixarm Posts:

Open your favourite guinnea pig host's config and enter the following: # monitor stuff define service { use generic-service host_name lab_rat service_description stuff check_command check_nrpe!check_stuff } Save the config file and Powershell Script To Check For Windows Updates In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for Provided that there were no syntax errors in your config files, what does that command really do? my company Can anyone help me to overcome this issue please?

The focus of the talk was how to write NRPE checks to check obscure things in your IT environment. Powershell Check Windows Update Installed For example if you use Win32_processor and return LoadPercentage, you'd have a script thats monitor CPU load thresholds. $p = Get-WMIObject -q "Select LoadPercentage from Win32_Processor" echo $p.LoadPercentage NSClient Config Now should read: "check_updates=cmd /c echo scripts\check_windows_updates.ps1; exit $LastExitCode | powershell.exe -command -" ... Ive been trying something like this but it doesnt seem to quite work… powershell -noprofile -command "icm MyServer {c:windowssystem32inetsrvappcmd.exe start site MyWebsite; exit $lastexitcode}" I've also tried creating a new session

Powershell Script To Check For Windows Updates

This and the following examples assumes that you have NSClient++ v0.3.9.328. http://serverfault.com/questions/576287/passing-arguments-to-a-powershell-script-using-nagios-nrpe Website Copyright © 2009-2017 Nagios Enterprises, LLC. Nagios Powershell Script So why is there a difference between using the -file and -command switches to invoke a script? 7 years ago Tadlock Enterprises How would you extend this example to executing commands Nsclient++ Powershell Restart the client service to make it re-read its config file and thus applying the changes.

I've truncated the host and services definition by leaving out all the other variables used to define them; yours will differ. All rights reserved. Anyone know how to define the command in nrpe.cfg using winrpe? Nothing therer. Powershell Windows Update Status

nullhausNetworking & SecurityHome Archives @nullhausNagios - Powershell August 30, 2013 by Drew Leave a Comment There are many great Nagios plugins to provide monitoring for your printers; the purpose of this If you try it and find that it works on another platform, please add a note to the script discussion to let others know. The zero or one indicated to me that Powershell was merely reporting whether it exited normally or not. Until next time… Tagged nagios, nrpe, powershell, script, windows.

The article assumes that you have set up Nagios with NRPE and won't go into how to do that, I have however written an article on the subject previously which is Nrpe Powershell Right, it's time to get down to the actual article. i.e.

Have anyone found an solution for this problem??? 10 years ago mdexch I was wondering how can I check exit code from a PS script. # filename: tp.ps1 $s = get-service

This is the format Nagios expects for a single line return: Disk D: - total: 273.40 Gb - used: 144.10 Gb (53%) - free 129.31 Gb (47%)| 'd:\ Used Space'=144.10Gb;246.06;259.73;0.00;273.40 The I don't have NRPE installed though because I'm trying to avoid that if possible because I don't want to have to A) Run around installing it on every server if I In this case we've decided to throw a warning when the queue reaches 5 jobs and throw a critical when it hits 10. Nagios Check Windows Updates So what's next?

Locate the [External Scripts] section, this is where we will add our command alias like this: check_stuff=cmd /c echo scripts\check_stuff.ps1; exit($lastexitcode) | powershell.exe -command - What the referenced script contains is Attachments sixarm Posts: 12Joined: Sat Apr 07, 2012 5:05 am Top Re: check_nrpe - NSClient - Exit Codes always showing 'Warni by agriffin » Tue Jun 19, 2012 3:37 A thought thou, obviously Microsoft decided to list updates according to "Important" and "Optional", maybe one should let this script class updates in the same manor. To avoid this I recommend setting an extended timeout in the command definition: define command { command_name check_nrpe_wu command_line /usr/lib64/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -t 60 -p 5666 -c $ARG1$ } IMPORTANT: Please

It does the same as this would have: check_nrpe -H lab_rat -p 5666 -c check_stuff Remember those words with dollar signs on each side of them? Finally, I stumbled upon this idea [NRPE Handlers] check_sitesign=cmd /c echo check_sitesign.ps1; exit($lastexitcode)|powershell.exe -command - This tells Powershell to run two commands. RSS Feeds New Listings Updated Listings Directory Quicklinks Home All Categories Add Listing New Listings Recently Updated Listings Most Favoured Listings Featured Listing Most Popular Listings Most Rated Listings Top Rated It has been some time since I last wrote an article but that pesky thing commonly referred to as "life" has gotten in the way time and time again.

Search Tags ACL ASA Capture Cisco Cisco 1800 Deep Packet Inspection DenyHosts DMZ DPI Firewall FortiGate Fortinet FortiOS 5 FreeBSD HP HP MSM HP Networking IOS 12.4 IPsec Load balancing Monitoring The most common error seems to be: No handler for command 'check_stuff' This means that there is most likely a typo in the "check_stuff" external command entry in NSC.ini, either that Log in Username: Password: CapsLock is on. Nagios We have a script and we've configured NSClient to be able to call it with the required arguments.

Powershell C:ts.ps1 echo %errorlrvel% This prints 1 to console and not 99. I for example had a machine reporting 15 critical ant 18 optional by the script, in the Windows update GUI all 33 were listed as Important... Commands In your commands file we create an entry for our new command. Well, we know the host's IP address or DNS name (right? :)) and we know what command the client responds to so we will use check_NRPE like this: /usr/local/nagios/libexec/check_nrpe -H [hostname or

Thanks!bycarekapt, October 27, 2011 Just created an account to thank you for this fine script! I've tried many variations. Best regards, Peter Some additions to the scriptbyshades4321, October 18, 2015 The script does a good job, I'm not quite sure if this is the latest version of the script, but These 3 lines are used twice in if statements and ideally would be in a function, just for neatness and brevity. $updateSession = new-object -com "Microsoft.Update.Session" $updates=$updateSession.CreateupdateSearcher().Search(("IsInstalled=0 and Type='Software'")).Updates Export-Clixml -InputObject

The goal is to provide fresh perspective on established subjects and insight into new technologies. sixarm Posts: 12Joined: Sat Apr 07, 2012 5:05 am Top Re: check_nrpe - NSClient - Exit Codes always showing 'Warni by agriffin » Mon Jun 18, 2012 10:39 am Are