``edgetest`` is a special software type of monitor software release used for website monitoring by using bots.
It uses `surykatka <https://lab.nexedi.com/nexedi/surykatka>`_ and `check_surykatka_json <https://lab.nexedi.com/nexedi/slapos.toolbox/blob/master/slapos/promise/plugin/check_surykatka_json.py>`_ to monitor websites.
``surykatka`` provides a bot to query list of hosts and a JSON reporting system.
``check_surykatka_json`` is used in promises to provide monitoring information about the websites.
In order to monitor an url one need to:
* request a monitor software release with ``edgetest`` software type, configured as described in ``instance-edgetest-input-schema.json``,
* request a slave to monitor with ``edgetest`` software type, configured as described in ``instance-edgetest-slave-input-schema.json``.
"description":"State of the node of the region. Can be used to destroy not needed regions.",
"type":"string",
"default":"started",
"enum":[
"started",
"stopped",
"destroyed"
]
},
"sla-computer_guid":{
"title":"GUID of the computer on which this region shall be deployed",
"description":"Unique identifier of the computer, like \"COMP-1234\". By default, let Master choose a computer.",
"type":"string",
"default":""
},
"nameserver-list":{
"default":[],
"title":"Nameservers",
"description":"List of nameservers to use.",
"type":"array"
},
"check-frontend-ip-list":{
"default":[],
"title":"Default Frontend IPs to check",
"description":"List of default frontend IPs to check, if empty no constraint is used.",
"type":"array"
}
},
"type":"object"
}
},
"type":"object"
},
"nameserver-list":{
"default":[],
"title":"Nameservers (backward compatibility)",
"description":"List of nameservers to use. Note: This is backward compatibility, use region-dict for full configuration control.",
"type":"array"
},
"check-frontend-ip-list":{
"default":[],
"title":"Default Frontend IPs to check (backward compatibility)",
"description":"List of default frontend IPs to check, if empty no constraint is used. Note: This is backward compatibility, use region-dict for full configuration control.",
"description":"URL to check, like https://example.com/",
"type":"string"
},
"region-dict":{
"title":"Applicable Regions",
"description":"Puts the check on the defined regions. No definition will result with presence in all regions.",
"patternProperties":{
".*":{
"properties":{
"state":{
"title":"State",
"description":"State of the check of the region. Used only to make it correctly visible in the SlapOS Master UI if no other parameters are defined.",
"type":"string",
"default":"present",
"enum":[
"present"
]
},
"check-frontend-ip-list":{
"default":[],
"title":"Frontend IPs to check",
"description":"List of default frontend IPs to check, if empty no constraint is used. Defaults to region configuration.",
"type":"array"
}
},
"type":"object"
}
},
"type":"object",
"default":{}
},
"check-status-code":{
"title":"HTTP Code Check",
"description":"Expected response HTTP Code.",
"type":"number",
"default":200,
"minimum":100,
"maximum":599
},
"check-certificate-expiration-days":{
"title":"Certificate Expiration Check (days)",
"description":"Amount of days to consider certificate as being to-be-expired.",
"type":"number",
"default":15,
"minimum":1
},
"check-maximum-elapsed-time":{
"title":"Maximum Elapsed Check (seconds)",
"description":"Maximum elapsed time for a site to reply to be considered good.",
"type":"number",
"default":2,
"minimum":1
},
"check-http-header-dict":{
"title":"HTTP Header Check",
"description":"JSON object of expected HTTP header, like {\"Cache-Control\": \"max-age=3600, public\", \"Vary\": \"Accept-Encoding\"}. Note: Shall be expressed directly as object, without any additional qouting.",
"type":"object",
"default":{}
},
"failure-amount":{
"title":"Failure Amount",
"description":"Amount of failures to consider URL as in bad state, can be set to higher value for endpoints with accepted short outages.",
"type":"number",
"default":2,
"minimum":1
},
"check-frontend-ip-list":{
"title":"Frontend IPs to check (backward compatibility)",
"description":"List of Frontend IPs to check, if empty no constraint is used. Defaults to region configuration. Note: Use region-dict's check-frontend-ip-list to ensure specific check on each region.",
{%- for region_name in sorted(slapparameter_dict['region-dict']) %}
{%- set region_parameter_dict = slapparameter_dict['region-dict'][region_name] %}
{%- if region_parameter_dict.get('state', 'started') == 'started' %}
{%- do active_region_list.append(region_name) %}
{%- endif %}
{%- endfor %}
{%- set authorized_slave_dict = {} %}
{%- set publish_slave_dict_dict = {} %}
{%- for slave in slave_instance_list | sort(attribute='slave_title') %}
{%- set slave_reference = slave.pop('slave_reference') %}
{%- set publish_dict = {'assigned-region-dict': {}} %}
{%- if '_' in slave %}
{%- set base_slave_dict = json_module.loads(slave.pop('_')) %} {#- XXX: Unsafe! #}
{%- do base_slave_dict.__setitem__('-slave-title', slave['slave_title']) %}
{%- do base_slave_dict.__setitem__('-slave-reference', slave_reference) %}
{%- set slave_region_dict = base_slave_dict.pop('region-dict', {}) %}
{%- if slave_region_dict == {} %}
{%- for region in active_region_list %}
{%- do slave_region_dict.__setitem__(region, {}) %}
{%- endfor %}
{%- endif %}
{%- for region in slave_region_dict %}
{%- if region in active_region_list %}
{%- set region_info = {
'nameserver-list': slapparameter_dict['region-dict'][region].get('nameserver-list') or slapparameter_dict.get('slapparameter_dict') or [],
'check-frontend-ip-list': slave_region_dict[region].get('check-frontend-ip-list') or base_slave_dict.get('check-frontend-ip-list') or slapparameter_dict['region-dict'][region].get('check-frontend-ip-list') or slapparameter_dict.get('check-frontend-ip-list') or [],
} %}
{%- do publish_dict['assigned-region-dict'].__setitem__(region, region_info) %}
{%- set slave_dict = base_slave_dict.copy() %}
{%- do slave_dict.update(region_info) %}
{%- if region not in authorized_slave_dict %}
{%- do authorized_slave_dict.__setitem__(region, [slave_dict]) %}
{%- else %}
{%- do authorized_slave_dict[region].append(slave_dict) %}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- endif %}
{%- do publish_slave_dict_dict.__setitem__(slave_reference, publish_dict) %}
{%- endfor %}
{%- set monitor_base_port = int(slap_configuration['configuration.monitor-base-port']) %}
{%- set number = {'i': 1} %}
{%- for region_name in sorted(slapparameter_dict['region-dict']) %}
{%- set region_parameter_dict = slapparameter_dict['region-dict'][region_name] %}
{%- set edgebot_name = "%s-%s" % (namebase, region_name) %}
{%- set request_section_title = 'request-%s' % (hashlib_module.md5(edgebot_name.encode('utf-8')).hexdigest(),) %}
{%- do part_list.append(request_section_title) %}
{#- Note: monitor-httpd-port will vary on regions being added and removed,
but this is accepted, as it's only internal trick #}