Windows Service Check With Action

This commit is contained in:
marco.locatelli@steamware.net
2024-10-01 13:22:30 +02:00
parent 23fee5e969
commit 3a7976779d
3 changed files with 22 additions and 6 deletions
-6
View File
@@ -1,6 +0,0 @@
#Eseguo Get-Service per ottenere informazioni riguardo il servizio desiderato
$Response = Get-Service "NomeServizio"
#Se il servizio ha status = stopped faccio qualcosa tipo inviare a zabbix informazioni
if ($Response.Status -eq "Stopped" ) {
#& "C:\Program Files\Zabbix Agent\zabbix_sender.exe" -z zabproxy.ovh -s "WIN2019IIS.OVH" -k RedisSentinel.Failure -o 1
}
+11
View File
@@ -0,0 +1,11 @@
#Eseguo Get-Service per ottenere informazioni riguardo il servizio desiderato
$Response = Get-Service "Redis Sentinel"
#Se il servizio ha status = stopped faccio qualcosa tipo inviare a zabbix informazioni
if ($Response.Status -eq "Running" ) {
& "C:\Program Files\Zabbix Agent\zabbix_sender.exe" -z zabproxy.ovh -s "WIN2019IIS.OVH" -k RedisSentinel.Failure -o 0
echo 0
}
else {
& "C:\Program Files\Zabbix Agent\zabbix_sender.exe" -z zabproxy.ovh -s "WIN2019IIS.OVH" -k RedisSentinel.Failure -o 1
echo 1
}
+11
View File
@@ -0,0 +1,11 @@
#Eseguo Get-Service per ottenere informazioni riguardo il servizio desiderato
$Response = Get-Service "Redis"
#Se il servizio ha status = stopped faccio qualcosa tipo inviare a zabbix informazioni
if ($Response.Status -eq "Running" ) {
& "C:\Program Files\Zabbix Agent\zabbix_sender.exe" -z zabproxy.ovh -s "WIN2019IIS.OVH" -k Redis.Failure -o 0
echo 0
}
else {
& "C:\Program Files\Zabbix Agent\zabbix_sender.exe" -z zabproxy.ovh -s "WIN2019IIS.OVH" -k Redis.Failure -o 1
echo 1
}