Auto detecting a website is down & restore

Discussion in 'Proxmox VE: Installation and configuration' started by Cyril HSIAO, Sep 13, 2018.

  1. Cyril HSIAO

    Cyril HSIAO New Member

    Joined:
    Sep 13, 2018
    Messages:
    3
    Likes Received:
    0
    Hello.

    I like to know if we have any existing service or plugins for Proxmox that...

    1. Can detect when a website is down (when returning status other than 200, 201, 202)
    2. When receiving error codes like 404, it auto-recovers the VM from the last snapshot
    Also would be nice if we could also cron the following too...

    1. Auto-create snapshots on hourly / daily basis

    This would save tons of hours & human-resource on this, any suggestions given are appreciated.
     
  2. raku

    raku New Member

    Joined:
    Apr 16, 2016
    Messages:
    29
    Likes Received:
    3
    You've got dedicated software for site's monitoring (nagios, zabbix, prometheus, etc.). Requesting to have it in Proxmox wastes tons of hours & human-resource in Proxmox dev team ;-)
     
  3. CharlesErickT

    CharlesErickT Member

    Joined:
    Mar 15, 2017
    Messages:
    47
    Likes Received:
    3
    You can easily create bash scripts that do all this stuff and run them on your host using the crontab
     
  4. Cyril HSIAO

    Cyril HSIAO New Member

    Joined:
    Sep 13, 2018
    Messages:
    3
    Likes Received:
    0
    I was thinking of that, do you have any existing scripts or documents that could point me in the right direction?

    Greatly appreciated.
     
  5. guletz

    guletz Active Member

    Joined:
    Apr 19, 2017
    Messages:
    567
    Likes Received:
    87
    Monit, something like this:

    check process squid3 with pidfile /var/run/squid3.pid
    group proxy
    start program = "/etc/init.d/squid3 start"
    stop program = "/etc/init.d/squid3 stop"
    if failed host localhost port 3128
    send "GET /monit-check HTTP/1.0\r\n\r\n"
    expect "HTTP/[0-9\.]{3} 400 .*\r\n"
    for 5 cycles then restart

    Se here more eaxamples:

    https://mmonit.com/wiki/Monit/ConfigurationExamples
     
  6. CharlesErickT

    CharlesErickT Member

    Joined:
    Mar 15, 2017
    Messages:
    47
    Likes Received:
    3
    Unfortunately I don't have any existing scrips that does that but it's pretty easy. Depending on the file system you are using on your host you can use curl to probe the site and if it returns a certain code then restore the snapshot.

    I found this link maybe it can help.

    The automatic snapshot is pretty easy and you can create the snapshot name based on the current time then delete the ones where the name includes a date older than X days.

    Hope it helps
     
  7. Cyril HSIAO

    Cyril HSIAO New Member

    Joined:
    Sep 13, 2018
    Messages:
    3
    Likes Received:
    0
    thanks guys for the great help :)
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice