What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

API - One channel from all WindowsUpdate sensors

Votes:

0

Hello,

i was wondering if i could get a list out of the API with one channel for all windows update status sensors available.

So in detail i would need a list with colum 1 "Time since last Update" and colum 2 "Devicename"

Thanks, Raphael

api prtg windows-update

Created on Jul 4, 2018 10:29:24 AM

Last change on Jul 4, 2018 11:35:47 AM by  Luciano Lingnau [Paessler]



5 Replies

Votes:

3

You can do this with PrtgAPI using PowerShell

C:\> Get-Sensor -Tags windowsupdatesstatus | foreach { $_ | Get-Channel time* | Add-Member Device $_.Device -PassThru | select Device,@{N="TimeSinceLastUpdate";E={$_.LastValue} } }

Device  TimeSinceLastUpdate
------  ---------
exch-1  30m
fs-1    81d 28m
one-1   3d 3m
prtg-1  59m
sccm-1  12 h 29 m
...

First we retrieve all Windows Updates Status sensors in the system. For each sensor, we then retrieve the "time since last update" channel and append the "Device" property of the input sensor.

Then, we select only the Device and LastValue properties, specifying a custom expression for the LastValue column, allowing us to give it the custom name "TimeSinceLastUpdate"

You can then pipe these commands to Export-Csv to analyze it in a spreadsheet, or modify it to use different properties such as LastValueNumeric (which will give you the time since last update in seconds, giving you greater flexibility in parsing it in Excel)

Regards,

lordmilko

Created on Jul 4, 2018 12:59:08 PM



Votes:

2

Hi Raphael,

In PRTG you could also create a Factory Sensor that pulls the channel from each device (should not be more than 50 then though), if you want go by API for extracting it, then follow lordmiko's approach using PRTGApi, which would be way faster anyway than creating the Factory Sensor.

Kind regards,

Erhard

P.S.: Thanks for chipping in, lordmilko, appreciated as always.

Created on Jul 4, 2018 1:15:21 PM by  Erhard Mikulik [Paessler Support]



Votes:

0

@lordmilko: Would it be possible to adjust the call to output all channels for each update status sensor per device? I assume the array definition near the end has to be adjusted for that and of course the channel selection, but I haven't gotten my head around it so far.

Just asking, because it might be helpful for this one.

Kind regards,

Erhard

Created on Jul 4, 2018 2:37:06 PM by  Erhard Mikulik [Paessler Support]



Votes:

2

Simply doing Get-Channel without specifying a channel name or ID will retrieve all channels

If you want to analyze all properties of all of your channels in Excel, I would recommend using the following

Get-Sensor -Tags windowsupdatesstatus | foreach { $_ | Get-Channel | Add-Member Device $_.Device -PassThru } | Export-Csv C:\windowsupdates.csv -NoType

Then you can tell Excel to convert it into a table, and exclude all channels in the Name column you don't want to look at

Note the importance of specifying Export-Csv outside of the foreach loop; specifying it inside the loop would overwrite the output file on each iteration

Created on Jul 4, 2018 3:15:46 PM



Votes:

0

Awesome, thank you, lordmilko, it appears I was thinking way too complicated again when it comes to stuff like this.

Thanks again & kind regards,

Erhard

Created on Jul 4, 2018 4:16:26 PM by  Erhard Mikulik [Paessler Support]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.