Ad Widget

Collapse

UserParameter is parsed wrongly

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • IteaAgain
    Junior Member
    • Mar 2018
    • 13

    #1

    UserParameter is parsed wrongly

    Hello,

    i have a template and some easy scripts for doing RAID checks on multiple machines.
    the Problem is related in a UserParameter that does nothing more then a "cat" on a text-file

    in Zabbix i got a "Unsupported Item" and a "Permission denied"


    Code:
    UserParameter=RAIDVolume.json,/usr/bin/cat /home/iteanova/RAIDVolumes.json
    this is for a discovery-rule and gives just the hardcoded list of RAID Volumes to zabbix.

    Zabbix-Server is Version is 3.0.4.stable
    this works fine on debian (Zabbix 3.0.7), but not on CentOS (Zabbix 4.2.8)
    result in logfile on CentOS
    Code:
    6988:20200429:105415.860 Requested [RAIDVolume.json]
    6988:20200429:105415.860 In zbx_popen() command:'/usr/bin/cat /home/iteanova/RAIDVolumes.json'
    6988:20200429:105415.863 EXECUTE_STR() command:'/usr/bin/cat /home/iteanova/RAIDVolumes.json' len:64 cmd_result:'/usr/bin/cat: /home/'
    6988:20200429:105415.863 Sending back [/usr/bin/cat: /home/iteanova/RAIDVolumes.json: Permission denied]
    result in debian
    Code:
    30841:20200428:173905.739 Requested [RAIDVolume.json]
    30841:20200428:173905.739 In zbx_popen() command:'cat /home/iteanova/RAIDVolumes.json.log'
    30841:20200428:173905.742 EXECUTE_STR() command:'cat /home/iteanova/RAIDVolumes.json.log' len:57 cmd_result:'{
    { "{#RAIDV}":"md0"},
    { "{#RAIDV}":"md127"}
    the permissions of the json-file are the same on both systems. Zabbix User can read.

    The problem seems to be realted to the parsing of the "/usr/bin/cat FILE" which is in debian executed while in CentOS is given back a "/usr/bin/cat: file"

    Can someone help me? Is this a bug?
    Last edited by IteaAgain; 29-04-2020, 11:31.
  • IteaAgain
    Junior Member
    • Mar 2018
    • 13

    #2
    on the CentOS machine with the problem i got
    Code:
    [iteanova@iteanova004 ~]$ zabbix_agentd -t RAIDVolume.json
    RAIDVolume.json                               [t|{
    "data":[
    { "{#RAIDV}":"md124"},
    { "{#RAIDV}":"md125"},
    { "{#RAIDV}":"md126"},
    { "{#RAIDV}":"md127"}
    ]
    }]
    but zabbix shows me a
    Code:
    Invalid discovery rule value: cannot parse as a valid JSON object: invalid object format, expected opening character '{' or '[' at: '/usr/bin/cat: /home/iteanova/RAIDVolumes.json.log: Permission denied'
    i really don't get it :-(
    The zabbix-server logs shows me nothing when i do a
    Code:
    cat  /var/log/zabbix/zabbix_server.log | grep -i raid
    , even it shows me all other items that are called from the machine.

    Comment

    • dimir
      Zabbix developer
      • Apr 2011
      • 1080

      #3
      Try
      Code:
      [FONT=arial]sudo -u zabbix zabbix_agentd -t RAIDVolume.json[/FONT]
      [FONT=arial][/FONT]

      Comment

      Working...