Service: {{ service.service }}
{% if service.staticly_configured %}
{% endif %}
{% if not service.staticly_configured %}
Modify
Delete
{% else %}
This service is staticly configured, to edit or delete it, you have to modify the
configuration file on the server.
{% endif %}
Show in Icinga
Submit manual OK
{% if status_list | length > 0 %}
{{ status_list[0].status }} submitted on {{ status_list[0].human_date() }}
{% else %}
No status for this service submitted
{% endif %}
Timeout: {{ service.timeout }} days
Owner: {{ service.owner }}
Secret Token: {{ service.token }}
{% if service.special_type == "SMART" %}
Smart Monitor {% if smart %} for: {{ smart.model_number }} {% endif %}
Example below requires smartmontools ("smartctl") in PATH.
On Linux this is usually available via the package manager,
on Windows install it from the
offical page .
{% endif %}
{% if service.special_type == "SMART" %}
Linux
{% else %}
Curl
{% endif %}
{% if service.special_type == "SMART" %}
SMART='{
"service" : "{{ service.service }}",
"token" : "{{ service.token }}",
"status" : "N/A",
"smart" : '$(/sbin/smartctl -a /dev/nvme0n1 --json)'
}'
curl -X POST -H "Content-Type: application/json" \
--data "${SMART}" \
{{ flask.request.url_root.replace("http://", "https://" )}}report
{% else %}
curl -X POST \
-H "Content-Type: application/json" \
-d '{ "service" : "{{ service.service }}",
"token" : "{{ service.token }}",
"status" : "OK", "info" : "Free Text Information here" }' \
{{ flask.request.url_root.replace("http://", "https://" )}}report
{% endif %}
{% if service.special_type == "SMART" %}
Windows
$SMART = @{
service = "{{ service.service }}"
token = "{{ service.token }}"
status = "N/A"
smart = "$(smartctl -a C: --json | Out-String)"
} | ConvertTo-Json
Invoke-RestMethod -TimeoutSec 2 -Uri "{{ flask.request.url_root.replace("http://", "https://" )}}report" -Method Post -Headers @{"Content-Type"="application/json"} -Body $SMART
Windows (as hourly task)
$ScriptPath = Join-Path $HOME -ChildPath "smart_monitor.ps1"
echo '$SMART = @{
service = "{{ service.service }}"
token = "{{ service.token }}"
status = "N/A"
smart = "$(smartctl -a C: --json | Out-String)"
} | ConvertTo-Json
Invoke-RestMethod -TimeoutSec 2 -Uri "{{ flask.request.url_root.replace("http://", "https://" )}}report" -Method Post -Headers @{"Content-Type"="application/json"} -Body $SMART' > $ScriptPath
schtasks /create /tn SMART_Monitor /tr "powershell.exe -executionpolicy bypass -File '$ScriptPath'" /sc hourly /mo 1
echo "Done"
{% else %}
Python
import requests
requests.post("{{ flask.request.url_root.replace("http://", "https://")}}report",
json= { "service" : "{{ service.service }}",
"token" : "{{ service.token }}",
"status" : "OK",
"info" : "additional information" })
{% endif %}
Date
Status
Info
{% for status in status_list %}
{{ status.human_date() }}
{{ status.status }}
{{ status.info_text }}
{% endfor %}