Hi,
I have a requirement that I want to know when router reboots, it should ECHO in LOG that when was last time router rebooted or powered off and how much time it was off by comparing it with current date/time.
Example the script should show in LOGs as following
Router last reboot (Value-A) : xx-date-time
Powered back on (Values-B): xx-date-time
Total downtime difference in hours between values A &B) : ???
I have idea that script can create a variable of last online time and update time in it after very minute, and when router reboots, it should get this value and calculate with current time value and also shows the downtime in hours (or days). I know how can I get value-a and value-B, but how to calculate difference of time in between both values to show in hours and if its in days it should days/hours ?
Well yes you can do this but would require some scripting i would separate the values first basically get data hours minutes ect each into their own variable then convert each to seconds so if you do this for your two date time samples you should have two seconds values which you can then subtract and get the difference in seconds you can then convert the seconds back to hours
How can I print Specific Environment value only?
Example I have script which updates an environemtn variable with current date time, now i want to print this variable only (without other details.
for example if i try to get value from varibale it shows 3 lines and then in logs it doens’t show any thing i want only VALUE
print value where name=Lastseen
user: admin
name: Lastseen
value: 13:32:47 jun/14/2015
Result will appear in LOG window in blue color. or you can use the result in your email or whatever is required. I will post little script for you once i will be in the office
actually what i want is to see the last tie when was router ok. so something like lastseen value and the current one on RB. so i can calculate difference for how long the RB was down.
How can I display total time of downtime? example above script shows only from - till time, how can i show lets say “router was down for 36 hours” or “router was down for 1 day 16 hours”?