Ad Widget

Collapse

Testing an item with a macro in it: error: 'Character "{" is not allowed'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • elyograg
    Member
    • Aug 2021
    • 37

    #1

    Testing an item with a macro in it: error: 'Character "{" is not allowed'

    I have a custom script that I wrote with a custom UserParameter on the zabbix agent. When I go to the item and try to test it, it fails, with
    error: 'Character "{" is not allowed'
    . It is not substituting the macro, it is sending the text name of the macro. Should it be subsitituting the value?

    UserParameter line:

    UserParameter=large_deleted_open_file_count[*],sudo /etc/zabbix/scripts/count_large_deleted_open_files.sh "$1"
    Key definition in item:

    large_deleted_open_file_count[{$DELETED_FILES_SIZE_THRESHOLD}]
    The host definition does have that macro defined.

    DebugLevel=4 logs:

    2024/04/25 13:26:27.153288 [1] processing update request (1 requests)
    2024/04/25 13:26:27.153308 [1] adding new request for key: 'large_deleted_open_file_count[{$DELETED_FILES_SIZE_THRESHOLD}]'
    2024/04/25 13:26:27.153320 [1] created direct exporter task for plugin 'UserParameter' itemid:0 key 'large_deleted_open_file_count[{$DELETED_FILES_SIZE_THRESHOLD}]'
    2024/04/25 13:26:27.153367 executing direct exporter task for key 'large_deleted_open_file_count[{$DELETED_FILES_SIZE_THRESHOLD}]'
    2024/04/25 13:26:27.153413 failed to execute direct exporter task for key 'large_deleted_open_file_count[[{$DELETED_FILES_SIZE_THRESHOLD}]]' error: 'Character "{" is not allowed'
    Both zabbix agent and zabbix server are 7.0.0~beta3 from the official zabbix repo on Ubuntu Server 22.

    Click image for larger version  Name:	custom_item_definition.png Views:	2 Size:	65.5 KB ID:	483047
    Click image for larger version  Name:	custom_item_error.png Views:	3 Size:	40.2 KB ID:	483046
    Last edited by elyograg; 25-04-2024, 22:18.
  • elyograg
    Member
    • Aug 2021
    • 37

    #2
    If I do "Execute Now" instead of "Test" then it works.

    Comment

    • elyograg
      Member
      • Aug 2021
      • 37

      #3
      TL;DR:

      I was investigating this because there were holes in the graph for the item. That turned out to be the script taking slightly longer than 10 seconds sometimes and the default timeout in zabbix being 10 seconds. Overriding the timeout in the template to 20 seconds has made the graph stable.

      Comment

      Working...