Compare commits

..

9 Commits

Author SHA1 Message Date
d5d964ea8e wip: 2024-01-03 13:40:42 +01:00
8d4882d7c4 wip: 2024-01-03 12:39:16 +01:00
6ca2278838 wip: 2024-01-03 12:25:01 +01:00
8884e924e8 wip: 2024-01-03 12:24:54 +01:00
9eef4b1353 wip: 2024-01-03 01:21:34 +01:00
ebb644fdf2 wip: 2024-01-03 00:48:44 +01:00
c487c769b0 wip: 2024-01-02 13:54:04 +01:00
ff2d8296f3 wip: 2024-01-02 12:31:06 +01:00
ad08f69df1 wip: 2024-01-01 20:41:29 +01:00
5 changed files with 6 additions and 31 deletions

View File

@@ -4,8 +4,6 @@ on:
push:
branches:
- "master"
schedule:
- cron: "0 2 * * 0"
jobs:
docker:

View File

@@ -396,7 +396,7 @@ def record_and_check_smart(service, timestamp, smart):
return ("SMART report prefail disk (wear_level < 20%)", "CRITICAL")
# temp max > X #
if smart_last.temperature > 60:
if smart_last.temperature > 50:
return ("Disk Temperatur {}".format(smart_last.temperature), "CRITICAL")
# available_SSD spare #
@@ -412,12 +412,11 @@ def record_and_check_smart(service, timestamp, smart):
spare_change), "WARNING")
# unsafe_shutdowns +1 #
if(smart_second_last and
smart_second_last.unsafe_shutdowns - smart_last.unsafe_shutdowns >= 1):
if smart_second_last.unsafe_shutdowns - smart_last.unsafe_shutdowns >= 1:
return ("Disk had {} unsafe shutdowns".format(smart_last.unsafe_shutdowns),
"WARNING")
return ("{} - no problems detected".format(smart_last.model_number), "OK")
return ("", "OK")
def create_app():

View File

@@ -34,8 +34,6 @@ def normalize(smart):
elif name == "power_on_hours":
target_name = "power_on_hours"
use_raw = True
elif name == "perc_avail_resrvd_space":
target_name = "available_spare"
# check if metric should be recorded #
if target_name in ret:
@@ -48,7 +46,4 @@ def normalize(smart):
ret[target_name] = value
if ret["critical_warning"] == 0 and "smart_status" in smart:
ret["critical_warning"] = int(not smart["smart_status"]["passed"])
return ret

View File

@@ -1,6 +1,5 @@
body{
background: radial-gradient(ellipse at center, #47918a 0%, #0b3161 100%);
background-attachment: fixed;
color: aliceblue !important;
}

View File

@@ -83,13 +83,13 @@
</div>
{% endif %}
{% if service.special_type == "SMART" %}
{% if smart %}
<h5 class="clear my-4">Linux</h5>
{% else %}
<h5 class="clear my-4">Curl</h5>
{% endif %}
<div class="ml-3 example">
{% if service.special_type == "SMART" %}
{% if smart %}
SMART='{ <br>
<div class="example-indent">
"service" : "{{ service.service }}", <br>
@@ -115,7 +115,7 @@
{% endif %}
</div>
{% if service.special_type == "SMART" %}
{% if smart %}
<h5 class="my-4">Windows</h5>
<div class="ml-3 example">
$SMART = @{ <br>
@@ -128,22 +128,6 @@
} | ConvertTo-Json<br><br>
Invoke-RestMethod -TimeoutSec 2 -Uri "{{ flask.request.url_root.replace("http://", "https://" )}}report" -Method Post -Headers @{"Content-Type"="application/json"} -Body $SMART
</div>
<!-- register task example -->
<h5 class="my-4">Windows Task (requires Admin-Powershell)</h5>
<div class="ml-3 example">
$ScriptPath = Join-Path $HOME -ChildPath "smart_monitor.ps1" <br>
echo '$SMART = @{ <br>
<div class="example-indent">
service = "{{ service.service }}"<br>
token = "{{ service.token }}"<br>
status = "N/A"<br>
smart = "$(smartctl -a C: --json | Out-String)"<br>
</div>
} | ConvertTo-Json<br><br>
Invoke-RestMethod -TimeoutSec 2 -Uri "{{ flask.request.url_root.replace("http://", "https://" )}}report" -Method Post -Headers @{"Content-Type"="application/json"} -Body $SMART' &gt; $ScriptPath <br>
schtasks /create /tn SMART_Monitor /tr "powershell.exe -executionpolicy bypass -File '$ScriptPath'" /sc hourly /mo 1 /ru "Administratoren"<br>
echo "Done" <br>
</div>
{% else %}
<h5 class="my-4">Python</h5>
<div class="ml-3 example">