-
Notifications
You must be signed in to change notification settings - Fork 281
check_uptime: Add option to report uptime in days instead of seconds #1750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Looks good. Could you please add a help entry as well? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine. Except, please add a help entry for the new option.
9681e24
to
70a17f8
Compare
Dear Sven, thank you for the quick reply. I've just amended this patch according to your suggestions and also added a corresponding test case. Fixing a one-letter typo has been diverted to #1751. With kind regards, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix the last typo
plugins-scripts/check_uptime.pl
Outdated
@@ -262,6 +274,7 @@ () | |||
print "-c (--critical) = Min. number of uptime to generate critical alert ( w < c )\n"; | |||
print "-f (--for) = Show uptime in a pretty format (Running for x weeks, x days, ...)\n"; | |||
print "-s (--since) = Show last boot in yyyy-mm-dd HH:MM:SS format (output from 'uptime -s')\n"; | |||
print "-s (--days) = Show uptime in days\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be -d
i guess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh my, it was late at night ;]. Thanks. Fixed!
Currently, the plugin output is: CRITICAL: Uptime is 38829029 seconds. When using the proposed `--days|-d` option, it will be: CRITICAL: Uptime is 449 days.
70a17f8
to
3b79309
Compare
great, thanks. |
Dear community. Dear @wopfel and @sni.
Firsts things first: Thanks a stack for conceiving and maintaining this excellent collection of monitoring plugins.
This is a humble patch for the
check_uptime.pl
sensor to make it report the system uptime in days instead of seconds. It has been wired to a new--days
option, in order not to change its default behavior.The rationale is to reduce mental load for humans, when looking at the textual output of the sensor. While the "pretty" format already implemented by
check_uptime.pl
has good intentions, it didn't quite nail it for us.With kind regards,
Andreas.
Previous situation
Currently, the baseline plugin output, with no way to change it, is:
We also tried using both options
--for
and--since
. However, we still have not been happy with the corresponding output.New situation
When using the proposed
--days|-d
option, the output will be:In our opinion, this is much more pleasant.