Компьютерный форум OSzone.net  

Компьютерный форум OSzone.net (http://forum.oszone.net/index.php)
-   Скриптовые языки администрирования Windows (http://forum.oszone.net/forumdisplay.php?f=102)
-   -   Проверка переменной цикла for (http://forum.oszone.net/showthread.php?t=309761)

nanervax 29-12-2015 12:54 2589477

Проверка переменной цикла for
 
Здравствуйте, развернул zabbix, теперь мониторю параметры S.M.A.R.T.
В конфиг добавил несколько параметров

Скрытый текст

UserParameter=hdd.smart.temperature[*],for /F "tokens=10" %a in ('C:\"Program Files"\smartmontools\bin\smartctl.exe -A $1 ^| find "Temperature_Celsius"') do @echo %a
UserParameter=hdd.smart.raw_read_error_rate[*],for /F "tokens=10" %a in ('C:\"Program Files"\smartmontools\bin\smartctl.exe -A $1 ^| find "Raw_Read_Error_Rate"') do @echo %a
UserParameter=hdd.smart.spin_up_time[*],for /F "tokens=10" %a in ('C:\"Program Files"\smartmontools\bin\smartctl.exe -A $1 ^| find "Spin_Up_Time"') do @echo %a
UserParameter=hdd.smart.reallocated_sector_count[*],for /F "tokens=10" %a in ('C:\"Program Files"\smartmontools\bin\smartctl.exe -A $1 ^| find "Reallocated_Sector_Ct"') do @echo %a
UserParameter=hdd.smart.seek_error_rate[*],for /F "tokens=10" %a in ('C:\"Program Files"\smartmontools\bin\smartctl.exe -A $1 ^| find "Seek_Error_Rate"') do @echo %a
UserParameter=hdd.smart.spin_up_retry_count[*],for /F "tokens=10" %a in ('C:\"Program Files"\smartmontools\bin\smartctl.exe -A $1 ^| find "Spin_Retry_Count"') do @echo %a
UserParameter=hdd.smart.reallocated_event_count[*],for /F "tokens=10" %a in ('C:\"Program Files"\smartmontools\bin\smartctl.exe -A $1 ^| find "Reallocated_Event_Count"') do @echo %a
UserParameter=hdd.smart.current_pending_sector_count[*],for /F "tokens=10" %a in ('C:\"Program Files"\smartmontools\bin\smartctl.exe -A $1 ^| find "Current_Pending_Sector"') do @echo %a
UserParameter=hdd.smart.uncorrectable_sector_count[*],for /F "tokens=10" %a in ('C:\"Program Files"\smartmontools\bin\smartctl.exe -A $1 ^| find "Offline_Uncorrectable"') do @echo %a


S.M.A.R.T. некоторых HDD не поддерживает некоторые параметры, и вот хотелось бы проверять переменную %a за циклом и выводить некое значение по дефолту вместо пустоты (zabbix ругается)


Время: 18:33.

Время: 18:33.
© OSzone.net 2001-