zbx-smart.ps1: Send output to logger

This makes the script more linux-dependant. Also screen output is now sent to stderr instead of stdout
This commit is contained in:
mh 2020-10-05 22:06:54 +02:00
parent 6283551900
commit 05a0d3f7c0
1 changed files with 5 additions and 5 deletions

View File

@ -178,7 +178,7 @@ function Send-SmartDiscoToZabbix {
$disco = Get-SmartDisco
$jsons=$disco | ConvertTo-Json -Compress
zabbix_sender -vv -k "8o_smartcheck.disco_devs" -o '$jsons' -c /etc/zabbix/zabbix_agentd.conf
zabbix_sender -vv -k "8o_smartcheck.disco_devs" -o '$jsons' -c /etc/zabbix/zabbix_agentd.conf | logger -t zbx_smart
}
@ -197,22 +197,22 @@ function Send-SmartInfosToZabbix {
Write-Output "- 8o_smartcheck.[${dn}.power_cycle_count] $($dev.PowerCycleCount)"
Write-Output "- 8o_smartcheck.[${dn}.temperature] $($dev.Temperature)"
}
} | zabbix_sender -vv -i - -c /etc/zabbix/zabbix_agentd.conf
} | zabbix_sender -vv -i - -c /etc/zabbix/zabbix_agentd.conf | logger -t zbx-smart
}
$exitcode=0
if ( $smart_disco ) {
Write-Output "Doing SMART-Disco "
Write-Output "Doing SMART-Disco " | logger -s -t zbx-smart
Send-SmartDiscoToZabbix
}
if ( $smart_check ) {
Write-Output "Doing SMART-Check withExternal: ${smart_with_external} "
Write-Output "Doing SMART-Check withExternal: ${smart_with_external} " | logger -s -t zbx-smart
Send-SmartInfosToZabbix -withExternalDevs $smart_with_external
}
Write-Output "Done"
Write-Output "Done" | logger -s -t zbx-smart
exit $exitcode