Ad Widget

Collapse

python and zabbix macro update (host.update)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jardel
    Junior Member
    • Jun 2015
    • 13

    #1

    python and zabbix macro update (host.update)

    I have a scenario where zabbix is ​​integrated with an Aruba controller, and the oauth token expires in 2 hours. Then I set up a python script that requests the refresh_token, generates the token and calls the zabbix API to update the macros of my problem host.
    Until then, everything is ok! But for some reason Zabbix is ​​not understanding the refresh_token strings, it is only updating if it is an integer, how do I solve this?
    I'm using # host.update
    update_macro = zapi.host.update ({

    "hostid": host_id,
    "macros": [
    {
    "macro": "{$ CLIENT_ID}",
    "value": client_id
    },
    {
    "macro": "{$ REVOKEN}",
    "value": refresh_token
    },
    {
    "macro": "{$ ACCESS_TOKEN}",
    "value": access_token
    },
    {
    "macro": "{$ MSP_ID}",
    "value": msp_id
    },
    {
    "macro": "{$ CLIENT_SECRET}",
    "value": client_secret
    },
    ]
    }),
    Update host macros
    zabbix 5.0.4


    only updated because I tested it, and had to insert str ("token")
    #access_token = ("yonuV6w4aKuCp7DaWlVze7Fr0T3pxtMl")
    but I lost reference to the / token variable
    What can I do?
    Python is correct, however, the zabbix macro only accepts updating in integers (numbers), not the token string
Working...