Ad Widget

Collapse

[ZABBIX-API] ExpandDescription Macros

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ParoXysm
    Junior Member
    • Mar 2011
    • 2

    #1

    [ZABBIX-API] ExpandDescription Macros

    Hi,

    I'm using the Zabbix-API to get the active triggers and show them on another website.
    I've managed to make a json-query like this:

    Code:
    {
    	"jsonrpc":"2.0",
    	"id":17,
    	"auth":"8a9bbe31b0c4b9a7680967e975a558e3",
    	"method":"trigger.get",
    	"params":{
    		"extendoutput":true,
    		"limit":1000,
    		"monitored":"1",
    		"active":"1",
    		"only_true":"1",
    		"min_severity":"3",
    		"sortfield":"lastchange",
    		"sortorder":"ASC",
    		"user":"apiuser",
    		"password":"********"
    	}
    }
    And it gives me the results I want:

    Code:
    {
    	"jsonrpc":"2.0",
    	"result":[{
    		"triggerid":"24754",
    		"expression":"{81697}",
    		"description":"3001 No SNMP data {HOSTNAME}",
    		"url":"",
    		"status":"0",
    		"value":"1",
    		"priority":"3",
    		"lastchange":"1325027672",
    		"dep_level":"0",
    		"comments":"",
    		"error":"",
    		"templateid":"30581","type":"0"
    	},{
    		"triggerid":"51135",
    		"expression":"{120611}<1",
    		"description":"5201 Process LDAP not running {HOSTNAME}",
    		"url":"",
    		"status":"0",
    		"value":"1",
    		"priority":"4",
    		"lastchange":"1325059579",
    		"dep_level":"0",
    		"comments":"",
    		"error":"",
    		"templateid":"47017",
    		"type":"0"
    	}],
    	"id":17
    }
    As you can see we use macro's in the trigger description.
    In this case only {HOSTNAME} but we've got many triggers with even more macros.

    Is it possible to convert the Macro to the actual value?

    In the API-Docs I found that there is a property called "expandDescription string Expands trigger description Expands macros" and it accepts a string.
    But I haven't found out what kind of stringvalue to use! The documentation isn't very clear on many of these properties unfortunaly.

    Is it even possible to "expand" theses macros to their actual value?

    Many thanks in advance!
  • ParoXysm
    Junior Member
    • Mar 2011
    • 2

    #2
    Solved it!

    For anyone who is facing the same problem:

    Found that ExpandDescription is broke in 1.8.2, a test on 1.8.10 was succesfull after I've added:
    Code:
    expandData: 1
    expandDescription: 1

    Comment

    Working...