Ad Widget

Collapse

powershell - zabbix trapper

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • glardz
    Member
    • Oct 2018
    • 45

    #1

    powershell - zabbix trapper

    hello,

    i try to send data with a powershell command, when i use this comand that work : C:\zabbix\bin\zabbix_sender.exe -vv -z X.X.X.X -p 10051 -s 'server_name' -k test -o 3930

    info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000033"

    but when i use this script, that not work :
    $count = (Get-ChildItem -Path C:\ -recurse -include *.txt).count

    $hostname = hostname

    $test = "C:\zabbix\bin\zabbix_sender.exe -vv -z X.X.X.X -p 10051 -s '$hostname' -k test -o $count"

    info from server: "processed: 0; failed: 1; total: 1; seconds spent: 0.000016" sent: 1; skipped: 0; total: 1

    C:\zabbix_SGCIO\zabbix\bin\zabbix_sender.exe -vv -z X.X.X.X -p 10051 -s '$hostname' -k test -o $count
    but not work, do you have some idea, thanks
  • glardz
    Member
    • Oct 2018
    • 45

    #2
    that works it was not with '' for $hostname, but i have the problem in zabbix
    the item give me :

    Value "zabbix_sender.exe [15280]: DEBUG: answer [{"response":"success","info":"processed: 1; failed: 0; total: 1; seconds spent: 0.000051"}]
    info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000051"
    sent: 1; skipped: 0; total: 1
    1" of type "string" is not suitable for value type "Numeric (unsigned)"

    its the resuly of my powershell script is it possible to not have message like that

    Comment

    Working...