WMI - Cheking File age

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
bosecorp
Posts: 929
Joined: Thu Jun 26, 2014 1:00 pm

WMI - Cheking File age

Post by bosecorp »

I am trying to get the file age for a file in couple windows servers but is not working. this is the error I get

root@nagmonus1:(11-04 13:44): /root
# /usr/local/nagios/libexec/check_wmi_plus.pl -H myservername.bose.com -u 'myusername' -p 'mypassword' -m checkfileage -a "E:/Scripts/Temp/iDeliver.txt" -c 15min
CRITICAL - [Triggered by _FileAge<0] - Age of File E:/Scripts/Temp/iDeliver.txt is -3114 or -0.86hr(s).|'E:/Scripts/Temp/iDeliver.txt Age'=-0.86hr;0.25;

I checked the file and is less than 15 min old

this was working fine, but stopped working after this past sunday
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: WMI - Cheking File age

Post by rkennedy »

This could be a few different things so I'd like to do some digging -

- Can you verify the time on both your Nagios server, and the remote windows server are in sync time wise?
- What happens if you run the check_wmi_plus local on the Windows machine?
- Lastly, what version of XI are you running?
Former Nagios Employee
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: WMI - Cheking File age

Post by lmiltchev »

I was able to recreate the issue. I am not sure what is causing it but I suspect it's the daylight savings. I would recommend rerunning the check in an hour to see if you are going to get the same output. Meanwhile, we will do some more digging into this.
Be sure to check out our Knowledgebase for helpful articles and solutions!
bosecorp
Posts: 929
Joined: Thu Jun 26, 2014 1:00 pm

Re: WMI - Cheking File age

Post by bosecorp »

You are right. it happened after Sunday, which is when the hour change. I can tell you that waiting will not help. the alert has been there since Sunday and has not gone away since then.

I even tried to create another similar check with another server and immediately saw the same issue
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: WMI - Cheking File age

Post by lmiltchev »

I spent lots of time trying to find a solution/workaround but no luck. Run the following command:

Code: Select all

/usr/local/nagios/libexec/check_wmi_plus.pl -d -H myservername.bose.com -u 'myusername' -p 'mypassword' -m checkfileage -a "E:/Scripts/Temp/iDeliver.txt" -c 15min > debug
and upload the "debug" file that was generated. We will have to pass this to our developers.
Be sure to check out our Knowledgebase for helpful articles and solutions!
bosecorp
Posts: 929
Joined: Thu Jun 26, 2014 1:00 pm

Re: WMI - Cheking File age

Post by bosecorp »

here you go
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: WMI - Cheking File age

Post by lmiltchev »

Update the "iDeliver.txt" file, save it, open a PowerShell prompt, and run:

Code: Select all

$select = 'Select name,lastmodified from CIM_DataFile where name="E:\\Scripts\\Temp\\iDeliver.txt"'
Get-WmiObject -Query $select
Compare the "LastModified" value to the date/time of your Windows box. Is it correct or it is one hour ahead?
Be sure to check out our Knowledgebase for helpful articles and solutions!
bosecorp
Posts: 929
Joined: Thu Jun 26, 2014 1:00 pm

Re: WMI - Cheking File age

Post by bosecorp »

here you go
You do not have the required permissions to view the files attached to this post.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: WMI - Cheking File age

Post by rkennedy »

Can you also run the date command and post the output?
Former Nagios Employee
bosecorp
Posts: 929
Joined: Thu Jun 26, 2014 1:00 pm

Re: WMI - Cheking File age

Post by bosecorp »

here you go
You do not have the required permissions to view the files attached to this post.
Locked