[ZBX-14682] LLD: Value should be a JSON object on valid json Created: 2018 Aug 03  Updated: 2018 Aug 09  Resolved: 2018 Aug 09

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 3.4.11
Fix Version/s: None

Type: Incident report Priority: Major
Reporter: Néstor Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Docker image zabbix/zabbix-server-mysql ubuntu-3.4-latest


Attachments: PNG File Creation.png     PNG File dicoveryrule.png    

 Description   

We have one userparam for discover cifs mountpoint that returns a json but on discovery rules says "value should be a json object"

Steps to reproduce:

  • Create /etc/zabbix/zabbix_agentd.conf.d/samba.userparams.conf
UserParameter=discoverSMB,echo -n '{"data":['; for i in $(grep -v "^#" /etc/fstab |grep -i -e cifs -e smbfs  | awk '{print $2}'); do echo -n '{"{#MOUNTPOINT}":"'$i'"},';done | sed -e 's/,$//' ; echo -n ']}'
  • Go to webinterface and create a discovery rule on empty template:

Name: CIFSmountpoints
Type: Zabbix agent
Key: discoverSMB

  • Go to server and check what you get:
root@zabbix-server:/var/lib/zabbix# zabbix_get -s x.x.x.x -k discoverSMB
{"data":[{"{#MOUNTPOINT}":"/mnt/winfs/directorioBackup"},{"{#MOUNTPOINT}":"/mnt/winfs/directorioBBDD"}]}
  • Validate json on https://jsonlint.com/
  • Apply the template to a host and check that you get the alert "Value should be a JSON object"

 



 Comments   
Comment by Glebs Ivanovskis [ 2018 Aug 06 ]

For troubleshooting LLD issues it is a good idea to create a regular item with the same key and Data type: Text. xalabin, can you do so and show what's in Latest data?

Comment by Néstor [ 2018 Aug 07 ]

I'm afraid my yesterday last comment  has been lost.

The last Friday that was the situation. This Monday everything working fine without having modified anything.

Yesterday i modified some things on the template and i forgot a double quote, today i found the same error (the missed quote and other minor errors) and i corrected it but the status is again "value should be a json object" and no changes even after i fixed the error.

Maybe the times for reload an LLD from template are too long?
I tried to restart the agents but nothing changes.

My LLD discovery rule has an interval of 60s. If i change the rule, the items, triggers, etc and i restart the agents. i will see the changes after 60s? My first impression is that isn't that simple.

Thanks in advance.

Comment by Glebs Ivanovskis [ 2018 Aug 07 ]

My first impression is that isn't that simple.

It is indeed more complicated. What's your CacheUpdateFrequency in server's config file? Is agent monitored directly by server or by proxy? And so on.

Have you tried my suggestion?

Comment by Néstor [ 2018 Aug 07 ]

I didn't made a item for this, because it's running from one day to another and this monday i modified it .

I used the item trick  on other debugging tests, thanks for it.

For now it's all running, i believe that i had initially an error on json format this friday and it remained a few hours because i had a long update interval. For my part this ticket could be closed.

There are some indications about the best config for develop templates.
I'm learning on the process but for example it would taken me a while to ralize about CacheUpdateFrequency, etc.

Thanks for all.

Comment by Néstor [ 2018 Aug 09 ]

The problem doesn't exists. It was an update times issue due the configuration.

Generated at Tue May 13 08:59:41 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.