Uptime for a Redhat Linux based OS?

Is there a way that you can find the Up-time for a Redhat linux based OS? I'm actually trying to find that for VMWare ESX server which is based on redhat (Service Console)
Who is Participating?
Deepak KosarajuDevOps EngineerCommented:
uptime command give u that information
on the command console type


Open in new window

datacomsmtAuthor Commented:
it looks like "uptime" as a command has no switchs with it, the man pages say

       uptime - Tell how long the system has been running.

       uptime [-V]

       uptime gives a one line display of the following information.  The cur-
       rent time, how long the system has been running,  how  many  users  are
       currently  logged  on,  and the system load averages for the past 1, 5,
       and 15 minutes.

       This is the same information contained in the header line displayed  by

       /var/run/utmp  information about who is currently logged on
       /proc     process information

when I tried running just "uptime", it gave me the total uptime since the last reboot (see below), I'm looking for uptime since a specific number of days.

16:12:15  up 17 days, 20:10,  1 user,  load average: 0.00, 0.00, 0.00
Deepak KosarajuDevOps EngineerCommented:
I have no Idea what other commands you have in linux for your requirement, except this uptime to know system uptime since last reboot.
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

To achieve what you want to do would require a script to use something like date to do the conversion.  The command uptime displays exactly what it should, the uptime since the server / node was booted.

If you can explain with an example what you are looking for I can assist with writing the script for you.
datacomsmtAuthor Commented:

what I exactly need is the total uptime in the last 30 days regardless of how many times the server was rebooted.
i need to run this script once a month so that it gives me the uptime in the previous 30 days.

In that case, there isn't a "command" that can be ran on Linux to provide this for you.  You will need to look at something like Nagios which has historical reporting.  You would be able to group between servers, individual servers or even ever server showing their uptime for the past day, 7 days, 30 days, 3 months or custom reporting.

http://www.nagios.org/ - Simply add all of your hosts and it will automatically monitor their uptime.  Turn off reporting and you will be ready to start "logging" for lack of a better word the uptime of these servers.

This won't work exactly as needed if the monitoring server goes offline for any reason so I would suggest a UPS to help you through.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.