lordmilko / PrtgAPI

C#/PowerShell interface for PRTG Network Monitor
MIT License
301 stars 37 forks source link

Unexpected Command Line Results for Object Logs #303

Closed Aln-adm closed 2 years ago

Aln-adm commented 2 years ago

Describe the bug

Hello lordmilko,

I used to run this simple script in order to provide a 2 month report to management with the total number of newly created sensors for that period but it's not working as it used to be for some reason.

No matter my timeframe input the command will not display sensors created earlier than ~14 days from now. e.g.: if I run the command today it will display a list of newly created sensors going back to 19/08, if I will run it tomorrow it will show only sensors created after 20/08 and so on. image

Steps to reproduce

Get-ObjectLog -Status Created -Start (Get-Date).AddDays(0) -End (Get-Date).AddDays(-60) -Count 10000

What is the output of 'Get-PrtgClient -Diagnostic'?

PSVersion      : 5.1.19041.1
PSEdition      : Desktop
OS             : Microsoft Windows 10 Enterprise
PrtgAPIVersion : 0.9.17
Culture        : en-US
CLRVersion     : 528372
PrtgVersion    : 22.3.78.1873
PrtgLanguage   : english.lng

Additional context

Your time and assistance in the matter is greatly appreciated.

lordmilko commented 2 years ago

Hi @Aln-adm,

Are you able to provide the output of Get-ObjectLog -Status Created -Start (Get-Date).AddDays(0) -End (Get-Date).AddDays(-60) -Count 10000 -Verbose. Please obscure your server/username/passhash in the verbose output

Aln-adm commented 2 years ago

Good afternoon,

Sure thing. Please see below the full output of the command: PS Get-ObjectLog -Status Created -Start (Get-Date).AddDays(0) -End (Get-Date).AddDays(-60) -Count 10000

DateTime Id Name Device Status Message


9/2/2022 9:58:46 AM 82017 exchange exchange Created See the history for details. 9/2/2022 9:57:33 AM 82016 Testing Grounds Created See the history for details. 8/31/2022 5:37:14 PM 82015 SL049 - Hall F - AP Probe SL049 - Hall F Created See the history for details. 8/31/2022 4:42:42 PM 82014 SL049 - Hall D - AP Probe SL049 - Hall D Created See the history for details. 8/31/2022 3:24:27 PM 82013 SL049 - Hall E - AP Probe SL049 - Hall E Created See the history for details. 8/31/2022 1:31:10 PM 82012 SL049 - Hall C - AP Probe SL049 - Hall C Created See the history for details. 8/31/2022 12:16:27 PM 82010 SL049 - Hall B - AP Probe SL049 - Hall B Created See the history for details. 8/31/2022 10:43:32 AM 82009 Device SL049 - Hall A -... SL049 - Hall A Created See the history for details. 8/30/2022 4:52:33 PM 82008 Access Points - Outside... SL051 - Access ... Created See the history for details. 8/30/2022 4:11:37 PM 82007 SL051 - Access Points -... SL051 - Access ... Created See the history for details. 8/30/2022 3:36:44 PM 82006 app-live.zzzzzzzzzzcom app-live.broswe... Created See the history for details. 8/30/2022 3:35:14 PM 82005 live..zzzzzzzzzz.com live.browsersta... Created See the history for details. 8/30/2022 3:33:28 PM 82004 app-live..zzzzzzzzzz.com app-live.broswe... Created See the history for details. 8/30/2022 3:33:17 PM 82003 live..zzzzzzzzzz.com live.browsersta... Created See the history for details. 8/30/2022 3:32:34 PM 82002 .zzzzzzzzzz Created See the history for details. 8/30/2022 2:36:28 PM 82001 SL051 - Access Points -... SL051 - Access ... Created See the history for details. 8/30/2022 1:52:38 PM 82000 Report Created See the history for details. 8/30/2022 12:04:45 PM 81999 SL051 - Access Points -... SL051 - Access ... Created See the history for details. 8/30/2022 11:56:43 AM 81998 SL051 - Access Points -... SL051 - Access ... Created See the history for details. 8/30/2022 11:35:15 AM 81997 SL051 - Access Points -... SL051 - Access ... Created See the history for details. 8/30/2022 10:54:58 AM 81996 SL051 - Access Points -... SL051 - Access ... Created See the history for details. 8/29/2022 4:50:58 PM 81995 SL051 - AP - Probe SL051 - Access ... Created See the history for details. 8/29/2022 4:33:38 PM 81994 Business Process SL051 - Access ... Created See the history for details. 8/29/2022 4:02:36 PM 81993 SL051 - AP - Hall B Probe SL051 - Access ... Created See the history for details. 8/29/2022 1:48:35 PM 81992 SL051 - AP - Probe SL051 - Access ... Created See the history for details. 8/29/2022 12:42:40 PM 81991 Business SL041-AP-Probe SL041 - Hall A Created See the history for details. 8/29/2022 11:43:46 AM 81990 SNMP CPU Load Test Monitoring... Created See the history for details. 8/29/2022 11:29:22 AM 81989 Ping Test Monitoring... Created See the history for details. 8/29/2022 11:28:52 AM 81988 Test Monitoring Automation Test Monitoring... Created See the history for details. 8/26/2022 3:50:27 PM 81986 SL005-AP-Probe SL005 - WTT - M... Created See the history for details. 8/26/2022 2:22:57 PM 81984 SL004-AP-Probe SL004 - WTT Created See the history for details. 8/26/2022 1:56:07 PM 81983 Business Process Overall Health Created See the history for details. 8/26/2022 1:49:22 PM 81982 Overall Health Overall Health Created See the history for details. 8/26/2022 1:48:23 PM 81981 Business Process Sensor... Created See the history for details. 8/26/2022 1:46:20 PM 81980 Business Process Sensors Created See the history for details. 8/26/2022 1:34:38 PM 81979 vidaxl.sk - Overall Web... vidaxl.sk Created See the history for details. 8/26/2022 1:31:21 PM 81978 vidaxl.sk vidaxl.sk Created See the history for details. 8/26/2022 1:30:41 PM 81977 vidaxl.si - Overall Web... vidaxl.si Created See the history for details. 8/26/2022 1:26:56 PM 81975 vidaxl.si vidaxl.si Created See the history for details. 8/26/2022 1:26:23 PM 81974 vidaxl.se - Overall Web... vidaxl.se Created See the history for details. 8/26/2022 1:22:59 PM 81973 vidaxl.se vidaxl.se Created See the history for details. 8/26/2022 1:22:30 PM 81972 en.vidaxl.sa.com - Over... en.vidaxl.sa.com Created See the history for details. 8/26/2022 1:19:13 PM 81971 en.vidaxl.sa.com en.vidaxl.sa.com Created See the history for details. 8/26/2022 1:18:14 PM 81970 vidaxl.pt - Overall Web... vidaxl.pt Created See the history for details. 8/26/2022 1:14:57 PM 81969 vidaxl.pt vidaxl.pt Created See the history for details. 8/26/2022 1:14:09 PM 81968 vidaxl.pl - Overall Web... vidaxl.pl Created See the history for details. 8/26/2022 1:11:13 PM 81967 vidaxl.pl vidaxl.pl Created See the history for details. 8/26/2022 1:09:57 PM 81966 vidaxl.no - Overall Web... vidaxl.no Created See the history for details. 8/26/2022 1:06:34 PM 81965 vidaxl.no vidaxl.no Created See the history for details. 8/26/2022 1:05:55 PM 81964 vidaxl.lv - Overall Web... vidaxl.lv Created See the history for details. 8/26/2022 1:02:11 PM 81963 vidaxl.lv vidaxl.lv Created See the history for details. 8/26/2022 1:01:38 PM 81962 vidaxl.lt - Overall Web... vidaxl.lt Created See the history for details. 8/26/2022 12:57:39 PM 81961 vidaxl.lt vidaxl.lt Created See the history for details. 8/26/2022 12:56:29 PM 81960 vidaxl.it - Overall Web... vidaxl.it Created See the history for details. 8/26/2022 12:52:48 PM 81959 vidaxl.it vidaxl.it Created See the history for details. 8/26/2022 12:52:02 PM 81958 vidaxl.is - Overall Web... vidaxl.is Created See the history for details. 8/26/2022 12:48:07 PM 81957 vidaxl.is vidaxl.is Created See the history for details. 8/26/2022 12:47:32 PM 81956 vidaxl.ie - Overall Web... vidaxl.ie Created See the history for details. 8/26/2022 12:44:07 PM 81955 vidaxl.ie vidaxl.ie Created See the history for details. 8/26/2022 12:42:59 PM 81954 vidaxl.hu - Overall Web... vidaxl.hu Created See the history for details. 8/26/2022 12:39:39 PM 81953 vidaxl.hu vidaxl.hu Created See the history for details. 8/26/2022 12:38:13 PM 81952 vidaxl.hr - Overall Web... vidaxl.hr Created See the history for details. 8/26/2022 12:34:31 PM 81951 vidaxl.hr vidaxl.hr Created See the history for details. 8/26/2022 12:33:53 PM 81950 vidaxl.gr - Overall Web... vidaxl.gr Created See the history for details. 8/26/2022 12:30:26 PM 81949 vidaxl.gr vidaxl.gr Created See the history for details. 8/26/2022 12:29:52 PM 81948 vidaxl.fr - Overall Web... vidaxl.fr Created See the history for details. 8/26/2022 12:26:05 PM 81947 vidaxl.fr vidaxl.fr Created See the history for details. 8/26/2022 12:25:24 PM 81946 vidaxl.fi - Overall Web... vidaxl.fi Created See the history for details. 8/26/2022 12:22:03 PM 81945 vidaxl.fi vidaxl.fi Created See the history for details. 8/26/2022 12:21:09 PM 81944 vidaxl.es - Overall Web... vidaxl.es Created See the history for details. 8/26/2022 12:17:45 PM 81943 vidaxl.es vidaxl.es Created See the history for details. 8/26/2022 12:01:17 PM 81942 vidaxl.ee - Overall Web... vidaxl.ee Created See the history for details. 8/26/2022 11:57:38 AM 81941 vidaxl.ee vidaxl.ee Created See the history for details. 8/26/2022 11:56:19 AM 81940 vidaxl.dk - Overall Web... vidaxl.dk Created See the history for details. 8/26/2022 11:52:53 AM 81939 vidaxl.dk vidaxl.dk Created See the history for details. 8/26/2022 11:52:12 AM 81938 vidaxl.cz - Overall Web... vidaxl.cz Created See the history for details. 8/26/2022 11:49:10 AM 81937 vidaxl.cz vidaxl.cz Created See the history for details. 8/26/2022 11:46:56 AM 81936 vidaxl.com.tr - Overall... vidaxl.com.tr Created See the history for details. 8/26/2022 11:43:29 AM 81935 vidaxl.com.tr vidaxl.com.tr Created See the history for details. 8/26/2022 11:42:38 AM 81934 vidaxl.com.au - Overall... vidaxl.com.au Created See the history for details. 8/26/2022 11:39:38 AM 81933 vidaxl.com.au vidaxl.com.au Created See the history for details. 8/26/2022 11:38:11 AM 81932 fr.vidaxl.be - Overall ... fr.vidaxl.be Created See the history for details. 8/26/2022 11:34:42 AM 81931 fr.vidaxl.be fr.vidaxl.be Created See the history for details. 8/26/2022 11:31:55 AM 81930 en.vidaxl.ae - Overall ... en.vidaxl.ae Created See the history for details. 8/26/2022 11:29:07 AM 81929 en.vidaxl.ae en.vidaxl.ae Created See the history for details. 8/26/2022 11:27:00 AM 81928 ar.vidaxl.sa.com - Over... ar.vidaxl.sa.com Created See the history for details. 8/26/2022 11:22:17 AM 81927 ar.vidaxl.sa.com ar.vidaxl.sa.com Created See the history for details. 8/26/2022 10:57:55 AM 81926 vidaxl.com - Overall We... vidaxl.com Created See the history for details. 8/26/2022 10:52:04 AM 81925 vidaxl.com vidaxl.com Created See the history for details. 8/26/2022 10:47:45 AM 81924 vidaxl.co.uk - Overall ... vidaxl.co.uk Created See the history for details. 8/26/2022 10:44:05 AM 81923 vidaxl.co.uk vidaxl.co.uk Created See the history for details. 8/26/2022 10:43:36 AM 81922 vidaxl.bg - Overall Web... vidaxl.bg Created See the history for details. 8/26/2022 10:40:05 AM 81921 vidaxl.bg vidaxl.bg Created See the history for details. 8/26/2022 10:39:20 AM 81920 nl.vidaxl.be - Overall ... nl.vidaxl.be Created See the history for details. 8/26/2022 10:36:00 AM 81918 nl.vidaxl.be nl.vidaxl.be Created See the history for details. 8/26/2022 10:35:25 AM 81917 fr.vidaxl.ch - Overall ... fr.vidaxl.ch Created See the history for details. 8/26/2022 10:32:10 AM 81916 fr.vidaxl.ch fr.vidaxl.ch Created See the history for details. 8/26/2022 10:29:32 AM 81915 de.vidaxl.ch - Overall ... de.vidaxl.ch Created See the history for details. 8/26/2022 10:25:48 AM 81909 de.vidaxl.ch de.vidaxl.ch Created See the history for details. 8/26/2022 10:21:09 AM 81907 vidaxl.de - Overall Web... vidaxl.de Created See the history for details. 8/26/2022 10:19:27 AM 81906 vidaxl.de vidaxl.de Created See the history for details. 8/26/2022 10:15:13 AM 81905 vidaxl.ro - Overall Web... vidaxl.ro Created See the history for details. 8/26/2022 10:14:35 AM 81904 vidaxl.ro vidaxl.ro Created See the history for details. 8/25/2022 4:41:59 PM 81903 Sangamesh Balaji Created See the history for details. 8/25/2022 3:29:35 PM 81902 webshop DownStatus Report Created See the history for details. 8/25/2022 3:20:29 PM 81901 Cloudflare response log... Overall Cloudfl... Created See the history for details. 8/25/2022 3:19:43 PM 81900 Overall Cloudflare resp... Overall Cloudfl... Created See the history for details. 8/25/2022 3:19:09 PM 81899 Business Process Sensor... Created See the history for details. 8/25/2022 3:01:41 PM 81897 vidaxl.at - Overall Web... vidaxl.at Created See the history for details. 8/25/2022 2:52:23 PM 81896 vidaxl.at vidaxl.at Created See the history for details. 8/24/2022 2:58:47 PM 81895 vidaxl.nl - Overall Web... vidaxl.nl Created See the history for details. 8/24/2022 11:33:40 AM 81771 Riversand Probe HTTP Monitoring Created See the history for details. 8/24/2022 11:24:11 AM 81764 Infra Test Created See the history for details. 8/24/2022 11:23:57 AM 81763 Infra Production Created See the history for details. 8/24/2022 11:23:26 AM 81762 Infra Business Domain Created See the history for details. 8/24/2022 9:22:21 AM 81760 vidaxl.nl vidaxl.nl Created See the history for details. 8/24/2022 9:20:22 AM 81759 HTTP Response Overall H... Created See the history for details. 8/23/2022 5:45:10 PM 81757 SL051-AP Test Device Created See the history for details. 8/23/2022 5:00:12 PM 81756 Test 2 Test 2 Created See the history for details. 8/23/2022 4:44:38 PM 81754 Test Device Test Device Created See the history for details. 8/23/2022 4:43:52 PM 81753 Test BPS and SFS Created See the history for details. 8/23/2022 4:07:31 PM 81752 Product Creation E-mail... Created See the history for details. 8/19/2022 1:59:56 PM 81741 Maikel Severins Created See the history for details.

lordmilko commented 2 years ago

Hi @Aln-adm,

Your command did not include the -Verbose parameter listed above. Executing the cmdlet with the -Verbose parameter will show the actual API request that was executed

Aln-adm commented 2 years ago

Apologies, here it is, followed by what I posted before: VERBOSE: Get-ObjectLog: Preparing to serially stream objects VERBOSE: Get-ObjectLog: Synchronously executing request https://xxxx content=messages&columns=objid,name,datetime,parent,status,sensor,device,group,probe,message,priority,type,tags,active&count=500&start=1&filter_status=501&filter_dend=2022-09-02-15-29-02&filter _dstart=2022-07-04-15-29-02&username=xxxxxx&passhash=xxxxx

lordmilko commented 2 years ago

You said it doesn't show records earlier than 14 days from now, however the output posted above shows records from August 31st, etc

Aln-adm commented 2 years ago

Well, August 31 was 3 days ago. And there were hundred of sensors created between July until now which are not displayed for some reason. Just to mention that I was using the same command successfully since April.

lordmilko commented 2 years ago

August 31 was 3 days ago

The initial error description was that sensors that were created earlier than 14 days from now were not being returned, however from the output above we can see that sensors created within the last 14 days are being returned.

Are you saying that only some sensors that were created within this timeframe are being returned, or perhaps the inverse that only sensors created within the last 14 days are being returned? Are there potentially 2 issues here, or is there just the one?

Aln-adm commented 2 years ago

One issue:

only sensors created within the last 14 days are being returned. If I will run the command again tomorrow it will not show me the last entry in the list: "8/19/2022 1:59:56 PM 81741 Maikel Severins Created See the history for details."

lordmilko commented 2 years ago
Aln-adm commented 2 years ago

[....] 8/23/2022 4:43:52 PM 81753 Test BPS and SFS Created See the history for details. 8/23/2022 4:07:31 PM 81752 Product Creation E-mail... Created See the history for details. 8/19/2022 1:59:56 PM 81741 Maikel Severins Created See the history for details. VERBOSE: Get-ObjectLog: Synchronously executing request https://content=messages&columns=objid,name,datetime,parent,status,sensor,device,group,probe,message,priority,type,tags,active&count=500&start=501&filter_status=501&filter_drel=30days&username= n&passhash= VERBOSE: Get-ObjectLog: No records were returned. Stream ended at request for record 501/1000001

lordmilko commented 2 years ago
Aln-adm commented 2 years ago

Yes, you nailed it, brilliant.

No matter what device or sensor I check the PRTG UI will not display log events older than 19.08. The full events history can be seen only if I check the PRTG UI "History" Tab on a sensor or device. Guess that I have to check the level of log retention on the servers.

Thank you so much.

Aln-adm commented 2 years ago

image

Topic can be closed.

Best regards, Alin