0

I have dedicated server running centos 6.0, and apache and the mysql

all of a sudden for some reason server has gone down, so i had to reboot the server and it all worked back to normal,

However i am wondering how do i get following information, I tried to use "uptime" command this only gives me the time that the server is running what i need to find out is

1. Actual time the server went down ?
2. How long the server has been down ?

...etc

any ideas?

mahen3d
  • 3,905
  • 12
  • 34
  • 55

3 Answers3

6

You look through the in files /var/log.

Even if you don't find the errors that caused the outage outright, most of the files will have timestamps so you'll see a big gap in them - from the time the outage started, until you rebooted it.

Of course, this only works if the server actually stopped running - such as a kernel panic. If it was something like a misconfigured network card, it would still have been writing to the logs.

If it's a fairly busy webserver, you can also look through the access logs to see when it was last accessed before the reboot.

Grant
  • 17,671
  • 14
  • 69
  • 101
  • 1
    /var/log/messages is probably going to be the best to start with, but it would be wise to get familiar with all the log files in there so you know what gets logged where. – floodpants Mar 08 '13 at 02:14
6

This is why you need a monitoring system.


Check your logs. There should be a gap in timestamps when your server was down. From that gap, you can get the approximate time when it went down as well as the duration.

EEAA
  • 108,414
  • 18
  • 172
  • 242
-2

Please execute the below command at shell.

last | grep down

jscott
  • 24,204
  • 8
  • 77
  • 99
JIjo
  • 11