AM
Size: a a a
AM
AM
D
D
ВК
3
ВЗ
D
D
EL
3
3
D
D
3
D
D
3
D
#Импорт данных устройств, которые надо опрашивать по SNMP
$data = import-csv -Path C:\tools\snmp\cfg.txt -Encoding utf8 -Delimiter ";" -Header "site","oid","ip","community","maxtemp"
$info = $data | % {
$ip = $_.ip
$site = $_.site
$maxtemp = $_.maxtemp
Invoke-SnmpGet -Version Ver1 -OID $_.oid -ipaddress $ip -Community $_.community | Select @{'n'="location";'e'={$site}},@{'n'="ip address";'e'={$ip}},@{'n'="temperature";'e'={ [int]([float]($_.Value -replace "[a-z\s]")) }}, @{'n'="maxtemp";'e'={$maxtemp}}
}
$info | % {
if ($($_.temperature) -gt $([int]$_.maxtemp)){
. "C:\Tools\Telegram\scom2telegram.ps1" -AlertName "[[$(get-date -format 'HH:mm, dd.MM.yyyy')]] Внимание! Перегрев!" -AlertDescription "В ЦОД *$($_.location)* превышение температуры: *$($_.temperature)*C"
}
}
D
MOS (Netbotz);"1.3.6.1.4.1.5528.100.4.1.1.1.7.2641473744";"192.168.1.1";"HrLGaxQuGW";"35"