Automatic Dreamhost PS reboot

Dreamhost tiene sus cosas buenas y sus cosas malas, y no es la primera vez que me encuentro que mi PS está medio atontado porque se ha quedado sin memoria o que tiene uno o dos procesos zombie porque soy un mal programador :)

La cuestión es la forma más rápida de arreglarlo es reiniciando el PS, y ésto solo se puede hacer manualmente desde el panel de control.

Dreamhost PS

Como no puedo estar todo el día comprobando el estado de mi PS, ni tampoco voy a duplicar lo que pago por él, abrí un ticket con el soporte para ver si existía la posibilidad de automatizarlo:

Hi,

Is there any chance I could automate reboots on my Dreamhost PS?

For example, if the number of zombie process is above 5 -> reboot PS

The hard way it’s coding the Perl LWP script that logs in this panel and does the same thing at your form, but that’s too crappy and I’d prefer to not take that path :D

Best regards.

Antonio.

y la respuesta:

Hello Antonio,

> Is there any chance I could automate reboots on my Dreamhost PS?

Sorry! We currently do not have an option to easily reboot your Dreamhost
PS via the console. You will need to (unfortunately) write the script the
access the panel in order to setup this automated reboot process.

If we add anything in the near future I will be glad to let you know, but
right now there is no easy method to automate these reboots.

Thanks!

Pues ni corto ni perezoso como dice el dicho, en menos de 30 minutos me hice el script en Perl que hace exactamente eso :)

perl vpsreboot.pl
13:23:04: Logging at panel…
13:23:09: Logged in succesfully!
13:23:09: Requesting reboot of xxxxxx PS …
13:23:11: Reboot pending!

El script una vez ejecutado solicita el reinicio, no tienen ningún tipo de lógica para decidir si es necesario reiniciar o no (de momento).

Se me ocurren muchas mejoras como por ejemplo:

  • Enviar un email cada vez que se solicite un reboot
  • Añadir un delay entre solicitud y solicitud para evitar que sea invocado por error múltiples veces.
  • Funcionalidad de monitorización de URLs o puertos del propio PS, y si después N errores acumulados ejecutar reboot del PS
  • Recoger otras informaciones del propio panel y enviarlas por email o publicarlas en otra web. Por ejemplo las gráficas de uso de CPU y memoria (https://panel.dreamhost.com/index.cgi?command=png&machine=PSNAME&period=1+day y https://panel.dreamhost.com/index.cgi?command=png&machine=PSNAME&period=1+month)

4 Responses to “Automatic Dreamhost PS reboot”


Leave a Reply

CommentLuv Enabled