-1

I was wondering if there's any way to configure a vSphere uptime alert for a linux server. For example, when the server has 168 hours of uptime we want an alert to generate indicating this fact.

I've searched through the alerts that I could possibly configure but found no uptime related ones. Is this possible? thank you

DSKyo
  • 153
  • 3
  • 6
  • 15
  • Why do you need this? – ewwhite May 26 '16 at 10:34
  • I have two linux machines that need to be rebooted every 4 months but discussing with the supplier this cannot be done (for some reason). I've tried with crontab -e 00 12 01 */4 * bash -c "reboot" but it does not work, nothing happens.(tried to modify the interval to 5 minutes - nothing happens) Also I cannot implement this task in vSphere because the version of linux we have does not support VMware tools and this would mean the machines will get RESETTED and not gracefully rebooted which we dont want – DSKyo May 26 '16 at 10:36
  • 2
    What version of Linux are you using? – ewwhite May 26 '16 at 10:41
  • Instead of adding relevant details in comments where they can easily be missed, you should [edit your question](https://serverfault.com/posts/779151/edit) to improve its quality. That way, you’ll have a much better chance of getting a good answer. – Anthony Geoghegan May 28 '16 at 21:13

1 Answers1

2

You should set the alert from within the guest operating system.

You can use a tool like Monit to check the uptime of a process. A simple script could also check the uptime of the Linux virtual machine.

Rebooting a server every four months seems heavy-handed and wrong; there's probably an issue with the application. Would it make more sense to restart the application/service or fix the root cause of the problem?

ewwhite
  • 194,921
  • 91
  • 434
  • 799
  • We need to reboot the VM every 4 months as high uptime has caused problems in the past with "Kernel Panic" error. `check process myapp with pidfile /var/run/myapp.pid start program = "/etc/init.d/myapp start" stop program = "/etc/init.d/myapp stop" if uptime > 3 days then restart` found this in the link you posted. Any idea how can I modify it to be something like if uptime > 3 days then restart VM, not just a service? – DSKyo May 26 '16 at 12:01
  • You're fixing the wrong problem by doing it this way. Can you provide actual information about the Linux version and distribution? – ewwhite May 26 '16 at 12:02