Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Last VPS Reboot
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Last VPS Reboot

plumbergplumberg Veteran

My OpenVZ vps had a good uptime of more than 40+ days. Suddenly, I am see that the uptime is 2 days. It seems that the server restarted or something. I checked with the provider, they said hypervisor was not down, so something else must have gone wrong.

a. How can I get any alerts if the system is going down for shutdown/ reboot?
b. How can I check what caused the system to go down? This is a VPS which no one is currently accessing except myself
c. Could it be that the memory limit was exhausted or something which triggered the restart?

I am running Cent OS 6 (64 bit). Please advise.

Comments

  • CoreyCorey Member

    @plumberg said:
    My OpenVZ vps had a good uptime of more than 40+ days. Suddenly, I am see that the uptime is 2 days. It seems that the server restarted or something. I checked with the provider, they said hypervisor was not down, so something else must have gone wrong.

    a. How can I get any alerts if the system is going down for shutdown/ reboot?
    b. How can I check what caused the system to go down? This is a VPS which no one is currently accessing except myself
    c. Could it be that the memory limit was exhausted or something which triggered the restart?

    I am running Cent OS 6 (64 bit). Please advise.

    Sounds fishy. The vps would just have processes killed if OOM.

  • @Corey said:
    Sounds fishy. The vps would just have processes killed if OOM.

    Hmm, can I check any logs to see what caused the system to go down?

  • CoreyCorey Member

    Yes check in /var/log

  • plumbergplumberg Veteran
    edited July 2013

    Any thoughts which one will be a good start?

  • perennateperennate Member, Host Rep

    a. How can I get any alerts if the system is going down for shutdown/ reboot?

    Many ways. You can install monit, that should say monit reloaded when VPS starts up. You can also have monit pinging the VPS on separate server that will give notice when it goes offline and then back online (but if it restarts too quickly, might miss it). If you already have some cron job, you could add something to check uptime command or /proc/uptime.

    Lightest solution would be to add /etc/init.d script, see http://www.debian-administration.org/articles/28


  • -rw------- 1 root user12 0 Apr 11 2012 boot.log
    -rw------- 1 root utmp 7983744 Jul 27 22:07 btmp
    -rw------- 1 root utmp 2464896 Jun 30 22:33 btmp-20130701
    drwxr-xr-x 2 clam clam 4096 Jul 21 04:25 clamav
    -rw------- 1 root user12 195516 Jul 27 22:28 cron
    -rw------- 1 root user12 109347 Jun 30 04:25 cron-20130630
    -rw------- 1 root user12 211947 Jul 7 04:25 cron-20130707
    -rw------- 1 root user12 209283 Jul 14 04:25 cron-20130714
    -rw------- 1 root user12 208860 Jul 21 04:25 cron-20130721
    -rw-r--r-- 1 root root 0 Jul 23 20:52 dmesg
    -rw-r--r-- 1 root root 0 Jul 3 23:49 dmesg.old
    -rw-r--r-- 1 root root 143389 Jun 27 20:13 dracut.log
    drwx------ 2 root root 4096 Jul 21 04:25 httpd
    -rw-r--r-- 1 root root 150088 Jul 27 22:14 lastlog
    drwxr-xr-x 2 root root 4096 Feb 17 2012 mail
    -rw------- 1 root root 9118521 Jul 27 22:28 maillog
    -rw------- 1 root root 226880 Jun 30 01:10 maillog-20130630
    -rw------- 1 root root 14409597 Jul 7 04:25 maillog-20130707
    -rw------- 1 root root 9477997 Jul 14 04:21 maillog-20130714
    -rw------- 1 root root 9905873 Jul 21 04:24 maillog-20130721
    drwxrwsr-x 2 root mailman 4096 Jul 21 04:25 mailman
    -rw------- 1 root root 222157 Jul 27 22:23 messages
    -rw------- 1 root root 137692035 Jun 30 04:25 messages-20130630
    -rw------- 1 root root 48498858 Jul 7 04:25 messages-20130707
    -rw------- 1 root root 151394 Jul 14 04:25 messages-20130714
    -rw------- 1 root root 124537 Jul 21 04:25 messages-20130721
    -rw-r----- 1 mysql mysql 7897 Jul 26 11:32 mysqld.log
    -rw-r--r-- 1 root root 0 Jul 27 04:25 procmail.log
    -rw-r--r-- 1 root root 384 Jul 23 04:25 procmail.log-20130723.gz
    -rw-r--r-- 1 root root 371 Jul 24 04:25 procmail.log-20130724.gz
    -rw-r--r-- 1 root root 382 Jul 25 04:25 procmail.log-20130725.gz
    -rw-r--r-- 1 root root 375 Jul 26 04:25 procmail.log-20130726.gz
    -rw-r--r-- 1 root root 372 Jul 27 04:25 procmail.log-20130727.gz
    drwxr-x--- 2 root root 4096 Jan 18 2013 proftpd
    drwx------ 3 root root 4096 Feb 21 23:09 samba
    -rw-r--r-- 1 root root 0 Jun 9 20:10 sa-update.log
    -rw------- 1 root root 2715164 Jul 27 22:25 secure
    -rw------- 1 root root 1354484 Jun 30 04:25 secure-20130630
    -rw------- 1 root root 6063933 Jul 7 04:25 secure-20130707
    -rw------- 1 root root 2819366 Jul 14 04:25 secure-20130714
    -rw------- 1 root root 2775995 Jul 21 04:25 secure-20130721
    -rw------- 1 root root 0 Jul 21 04:25 spooler
    -rw------- 1 root root 0 Jun 27 04:26 spooler-20130630
    -rw------- 1 root root 0 Jun 30 04:25 spooler-20130707
    -rw------- 1 root root 0 Jul 7 04:25 spooler-20130714
    -rw------- 1 root root 0 Jul 14 04:25 spooler-20130721
    -rw------- 1 root root 0 Feb 17 2012 tallylog
    drwx--x--x 2 root root 4096 Jul 21 04:25 virtualmin
    -rw-rw-r-- 1 root utmp 56448 Jul 27 22:14 wtmp
    -rw-r--r-- 1 root root 0 Jul 7 04:25 xferlog
    -rw-r--r-- 1 root root 225 Jun 30 04:25 xferlog-20130630.gz
    -rw-r--r-- 1 root root 127 Jul 7 04:25 xferlog-20130707.gz
    -rw------- 1 root root 26597 Jul 15 14:55 yum.log

  • I checked messages. Couldn't find any thing incriminating to say that's why the system restarted.

    Any monitors or scripts that I can use to send an alert before system restart?

  • @plumberg I don't mean to be presumptuous But IMHO the larger the host the less one might find attention to such notices.


    I think about 9/10 times that's a host restart done probably without a Network alert

  • nixcomnixcom Member

    Could be an admin that restarted the wrong vps in console...

  • The host says that the hyper visor was not shut down. So, I am not sure what caused it to go down. I am not saying I need a foolproof system where if something goes down, i need ot be notified, but, I would say atleast 7/10 cases, I should be notified/ aware of whats going on.

  • ATHKATHK Member

    Make a init.d script or an @reboot cron to email you or at least report the time in a text file.

  • @ATHK said:
    Make a init.d script or an reboot cron to email you or at least report the time in a text file.

    Any pointers / example script please?

  • ATHKATHK Member
    edited July 2013

    @reboot somescript.sh

    http://bit.ly/1cfuVhM

    Don't really have the time to help you out sorry!

  • LESLES Member
    @reboot echo "Server 12345 restarted" | mail -s "Reboot" [email protected]
    
    Thanked by 1Adduc
  • NeoonNeoon Community Contributor, Veteran

    Just install fail2ban, enable mail function, install postfix and you get e-mails when fail2ban has been stopped and started. So you can see when your VPS has been restarted.

  • Use the last command. It will tell you when the last reboot occurred. Why it occurred is another matter entirely.

  • well, id like to really know why the reboot happened. What are some scripts/ programs which will allow me to monitor the same? I am no expert sys-admin, so, this is a learning curve for me.

Sign In or Register to comment.