For convenience, we will get use of [monitor-promise-base]
already defined at https://lab.nexedi.com/nexedi/slapos/blob/master/stack/monitor/instance-monitor.cfg.jinja2.in:
[monitor-promise-base]
recipe = slapos.cookbook:promise.plugin
eggs =
slapos.toolbox
content =
from slapos.promise.plugin.${:module} import RunPromise
mode = 600
output = ${directory:plugins}/${:name}
Because of extends = {{ template_monitor }}
present in your instance profile (check that it is there) we can utilize it really easily. In your instance profile, add the following code (feel free to check any other site instead of erp.com):
# url checking promise
[url-promise]
<= monitor-promise-base
module = check_url_available
name = check_some_url.py
config-url = https://erp5.com
config-check-secure = 1
Note <=
syntax being used to extend a section already defined elsewhere, in our case [monitor-promise-base] shown above.
Don't forget to add url-promise to the parts
section.
This will fetch the promise check_url_available.py
from https://lab.nexedi.com/nexedi/slapos.toolbox/tree/master/slapos/promise/plugin and generate an executable ${directory:plugins}/check_some_url.py
that when run, will try to connect to the url provided. Save the file, update the MD5 sum and rebuild.