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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Deepak KosarajuDevOps EngineerCommented:
uptime command give u that information
on the command console type


Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Distributions

From novice to tech pro — start learning today.