Ad Widget

Collapse

Item system.run переменные powershell

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bigpingrail
    Junior Member
    • Feb 2019
    • 2

    #1

    Item system.run переменные powershell

    Добрый день, помогите разобраться с проблемой
    из линуксовой консоли делаю zabbix_get -s <someserver> -k system.run["PowerShell.exe -nologo -command \$(Get-service 'SomeService').status",]
    в ответе получаю статус службы Running или Stopped.

    версия Zabbix 4.0
    создаю item с ключом system.run["PowerShell.exe -nologo -command \$(Get-service 'SomeService').status",]
    тип данных text
    в ответе получаю
    \$(Get-service 'SomeService').status : The term '\$(Get-service 'SomeService').status' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + \$(Get-service 'SomeService').status
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~
    + CategoryInfo : ObjectNotFound: (\$(Get-service SomeService').status:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    Собственно вопрос: как правильно создать item что-бы он отработал данную команду верно(то есть в ответе получить Running/Stopped)?
  • bigpingrail
    Junior Member
    • Feb 2019
    • 2

    #2
    Разобрался.
    При создании item не надо экранировать $

    Comment

    Working...