Ad Widget

Collapse

Trigger description is changed via API, but in the GUI remains the old one

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Melon Mollusk
    Junior Member
    • Feb 2020
    • 7

    #1

    Trigger description is changed via API, but in the GUI remains the old one

    (Zabbix Version 5.0.12)
    Hi, In the code below I try to change the description of the trigger, if the description thats arriving is different from the one in Zabbix,
    then check if the new description is in the trigger,
    and then send an event via Zabbix_sender,
    it works, but despite I check the change via api in the script and is correct, when the problem is shown in the GUI still has the old name, any clues on how to solve this?

    Click image for larger version

Name:	image.png
Views:	141
Size:	80.7 KB
ID:	491176

    Code:
    trigger_description_from_event_trim=B
    trigger_description_from_zabbix_trim=A
    ### if trigger descriptions are not the same, update trigger
    '[' B '!=' A ']'
     wget -O- https://my-zabbix.com/zabbix/api_jsonrpc.php -o /dev/null --no-check-certificate --header 'Content-Type: application/json-rpc' --post-data '{
                  "jsonrpc": "2.0",
                  "method": "trigger.update",
                  "params": {
                      "triggerid": "49957",
                      "description": "B"
                  },
                  "auth": "XXXXXXXXX",
                  "id": 1
              }'
    update_trigger='{"jsonrpc":"2.0","result":{"triggerids":["49957"]},"id":1}'
    trigger_description_from_z_trim=
    #### while trigger description is not the same
    '[' B '!=' '' ']'
     wget -O- https://my-zabbix.com/zabbix/api_jsonrpc.php -o /dev/null --no-check-certificate --header 'Content-Type: application/json-rpc' --post-data '{
                "jsonrpc": "2.0",
                "method": "trigger.get",
                "params": {
                    "output": ["description"],
                    "triggerids": ["49957"]
                },
                "auth": "XXXXXXXXX",
                "id": 1
            }'
     jq -r '.result[0].description'
     trigger_description_from_zabbix=B
     echo B
     sed 's/ //g'
    trigger_description_from_zabbix_trim=B
    sleep 1
    #### Off the while loop
    '[' B '!=' B ']'
    #### Send problem to zabbix with the new description
     zabbix_sender -vv -z my-zabbix.com -s decal -k 127.0.0.1.SNMP_Carga_de_CPU_13826_down -o 1
    Last edited by Melon Mollusk; 12-09-2024, 17:33.
Working...