Ad Widget

Collapse

Cannot create item: item with the same key "test[uptime,{#name}]" already exists.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mizan Iftee
    Junior Member
    • Jan 2020
    • 2

    #1

    Cannot create item: item with the same key "test[uptime,{#name}]" already exists.

    I want set a customize discovery rule. the customize file is:

    <?php
    $item = $argv[1];
    $filelocation="/usr/local/testphp/mizan";
    switch($item)
    {
    case "jsonformat":
    $output = "{"data":[ {"{#name}":"".$filelocation.""} ] }";
    echo "$output";
    break;
    case "uptime":
    $id= $argv[2];
    $value=$id;
    $comand=shell_exec('stat ".$value."');
    echo "$comand";
    break;
    default:
    $output = "{"data":[ {"{#name}":"".$item.""} ] }";
    }
    ?>

    Discovery rule key : test[jsonformat] and got the response like below:
    {"data":[ {"{#name}":"/usr/local/testphp/mizan"} ] }[

    i have set item prototype key like this : test[uptime,{#name}] and it showed that item with the same key "test[uptime,{#name}]" already exists.

    Zabbix agent is installed in Linux Server and php is installed also.In Zabbix_agent.conf file i have set the UserParameter like this :

    UserParameter=test[*], php "/usr/local/testphp/test1.php" "$1" "$2"

    **Couldn't Understand where is the problem**
  • gert.derouck
    Member
    • Jan 2020
    • 69

    #2
    Hi,
    do you already have another item key, named 'test[uptime,"/usr/local/testphp/mizan"]', just as a normal item, that is configured for the same host? The item key name must be unique on the host.

    Regards

    Comment

    • HaveDill
      Senior Member
      • Sep 2014
      • 103

      #3
      Try changing your {#name} macro in both your script and in zabbix to {#NAME}. I think it is case sensitive and needs to be in capital letters

      Comment

      • Mizan Iftee
        Junior Member
        • Jan 2020
        • 2

        #4
        Thanks HAVEDill.
        After changing the Macro name , my problem is solved. Thanks a lot

        Comment

        Working...