Community discussions

MikroTik App
 
ycar
just joined
Topic Author
Posts: 10
Joined: Thu Jan 27, 2011 3:04 pm

Compare time of 2 device

Thu Jan 27, 2011 3:17 pm

I all,

I want to compare time of a device with my time server(other device) and if they are not synchronize I want to know how much time. I already know what is the oid for the windows time (1.3.6.1.2.1.25.1.2.0). I just want to know how I compare the 2 device, probably with a functions but I am not very good with that.

Thanks
 
lebowski
Forum Guru
Forum Guru
Posts: 1616
Joined: Wed Aug 27, 2008 5:17 pm

Re: Compare time of 2 device

Thu Jan 27, 2011 4:55 pm

I looked at the oid for windows time and it is in the format of "2011-1-27,7:42:10.9" The field is updated every 10th of a second.
It will be hard to build a probe that compares times, maybe just put the time on the device label of each device and visually compare them?

Time:[oid("1.3.6.1.2.1.25.1.2.0")]

Here is how OID works; returns value of given snmp OID. Only first parameter mandatory. First parameter - oid string, second - cache time - default 5 seconds (5.0), third - negative cache time - default 5 minutes (300.0), forth - ip address (overrides context device), fifth - snmp profile (overrides context device)

So you might put this on a device label;
Time:[oid("1.3.6.1.2.1.25.1.2.0",,,192.168.0.1)]
Time:[oid("1.3.6.1.2.1.25.1.2.0",,,192.168.0.2)]

If you don't mind me asking what do you need to know the difference in time for? Maybe there is some other thing that should be focused on.
 
pcpolo
just joined
Posts: 21
Joined: Wed Jul 15, 2009 8:41 pm

Re: Compare time of 2 device

Thu Jan 27, 2011 4:58 pm

I could see a use for a function or probe like this.

We have a cluster of Access Points that need to have the same uptime. I would like to be alerted if one reboots for whatever reason and comparing the time seems like the easiest way. It's too time consuming to look through all the towers though just to compare times, I'd rather be alerted if it happens.
 
ycar
just joined
Topic Author
Posts: 10
Joined: Thu Jan 27, 2011 3:04 pm

Re: Compare time of 2 device

Thu Jan 27, 2011 5:45 pm

I,

Thanks lebowski for your reply it was very helpful, I just have a question for the format of the time oid with the ip address.

I write that [oid("1.3.6.1.2.1.25.1.2.0",,,192.1.1.227)] but it didn't works.
The dude.png
Regards
You do not have the required permissions to view the files attached to this post.
 
ycar
just joined
Topic Author
Posts: 10
Joined: Thu Jan 27, 2011 3:04 pm

Re: Compare time of 2 device

Thu Jan 27, 2011 10:03 pm

I all,

I don't know if is useful but i found that.
the dude time.png
There show us only the time and not the date.
Can we Find the code of this variable? If we can it will probably be more easy to compare with my time server device.

Regards
You do not have the required permissions to view the files attached to this post.
 
User avatar
gsandul
Member Candidate
Member Candidate
Posts: 154
Joined: Mon Oct 19, 2009 1:42 pm

Re: Compare time of 2 device

Fri Jan 28, 2011 9:36 am

Hi, All.
I write that [oid("1.3.6.1.2.1.25.1.2.0",,,192.1.1.227)] but it didn't works.
You should put IP address in quotes "" the code should be
[oid(oid("1.3.6.1.2.1.25.1.2.0",,,"192.168.0.244"))]
I don't know if is useful but i found that.
This is useless because it will show your workstation (workstation you are connetcted to The Dude server from) time.
I would like to be alerted if one reboots for whatever reason and comparing the time seems like the easiest way
This task is easy to solve with The dude. You can check sysUpTimeInstance OID = "1.3.6.1.2.1.1.3.0" on cluster devices and compare it. This OID returns number of seconds from last system startup.

I'll post a sample probe in a few hours.
 
ycar
just joined
Topic Author
Posts: 10
Joined: Thu Jan 27, 2011 3:04 pm

Re: Compare time of 2 device

Fri Jan 28, 2011 3:09 pm

I all,

I will explain my issue. I have a time server but sometimes I have some device that are not synchronizes with it. Now I want to know which device are not synchronizes. I don't want to do the command net time on each device and I don't want to put the date (oid) on each device in the dude because it will take to much place. I want to view quickly if some device are not synchronizes. If someone have any idea it will be appreciate.


Regards
 
lebowski
Forum Guru
Forum Guru
Posts: 1616
Joined: Wed Aug 27, 2008 5:17 pm

Re: Compare time of 2 device

Fri Jan 28, 2011 4:40 pm

Gsandul is the master, I can imagine what he is going to build but he will build it in 1/5 of the time.
 
ycar
just joined
Topic Author
Posts: 10
Joined: Thu Jan 27, 2011 3:04 pm

Re: Compare time of 2 device

Fri Jan 28, 2011 7:31 pm

I found something it not perfect but it work find for what I need.

here is my code.

[if(string_substring(oid("1.3.6.1.2.1.25.1.2.0",5,300,"192.1.1.235","v2-public"),(string_find(oid("1.3.6.1.2.1.25.1.2.0",5,300,"192.1.1.235","v2-public"),":")+1),2)=string_substring(oid("1.3.6.1.2.1.25.1.2.0"),(string_find(oid("1.3.6.1.2.1.25.1.2.0"),":")+1),2),"true","false")]

I search in the string the minute position after I compare them and if its equal the result return true and if not equal return false.

Who is online

Users browsing this forum: No registered users and 7 guests