Ad Widget

Collapse

Zabbix agent user parameters Item with quoted parameters.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Yauheni_Sk
    Junior Member
    • Sep 2019
    • 7

    #1

    Zabbix agent user parameters Item with quoted parameters.

    Hello Everyone ,

    I'm trying to set up new item for custom monitoring .
    My item is calling local bash script .
    Main problem is that I have to forward in macros some unique names quoted with "".
    All work fine till moment I forwarding list more then 1 name I'm getting "Invalid item key format."

    agent conf
    UserParameter=newitem[*],/bin/bash /opt/monthly_report "$1" "$2" "$3" "$4" "$5"

    Item :
    newitem["$Param1","$Param2","$Param3","$Param4","$Para m5"]

    For example I'm my macros for $4 I'm string like "Some name 1" "Some name 2"
    I'm getting error [Invalid item key format.]
    At the same time if string contain only 1 phrase - all is working .

    Could you kindly advise how it would be better to solve this problem .

    BR Yauheni
  • 1berto
    Senior Member
    • Sep 2018
    • 182

    #2
    I can't try now, but...
    1) Maybe you need to enable UnsafeParameters on the agent
    2) Can you pass the values using zabbix_get ?
    3) Have you tried single quotes on the item key?
    4) Have you tried to escape quotes on the item key (Like ") ?

    Comment

    • Yauheni_Sk
      Junior Member
      • Sep 2019
      • 7

      #3
      Originally posted by 1berto
      I can't try now, but...
      1) Maybe you need to enable UnsafeParameters on the agent
      2) Can you pass the values using zabbix_get ?
      3) Have you tried single quotes on the item key?
      4) Have you tried to escape quotes on the item key (Like ") ?
      Hi . currently I've resolved this issue using bash (inside script).
      1) Not sure about this option
      2) I've made debug through get
      3) single quotes work bad with array of params - as final solution i sent string with out any quotes and changing internally with bash so it has look like
      "Some name 1,Some name 2" - i'm sure this is specialty of bash interpreter.

      Comment

      Working...