Ad Widget

Collapse

Get all on dashboard displayed triggers with Java / Zabbix API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DarkDecipio
    Junior Member
    • Dec 2013
    • 1

    #1

    Get all on dashboard displayed triggers with Java / Zabbix API

    I need to get all active triggers which are on my dashboard. Here a small screenshot of the dashboard with only one trigger in it:


    This is my Code which I already wrote:
    HTML Code:
    int count = 2;
        while (count <= 5){
        	jsonObj.put("jsonrpc", "2.0");
        	jsonObj.put("method", "trigger.get");
        	// Value: 0 = OK | 1 = PROBLEM | 2 = UNKNOWN
        	// Priority: 0 = Not classified | 1 = Information | 2 = Warning | 3 =
        	// Average | 4 = High | 5 = Disaster
        
        	// count = priority. It start with two and end with 5
        	jsonObj.put("params", (new JSONObject().put("filter", new JSONObject().put("priority", count).put("group", "WZU-Server").put("value", 1)).put("output", "extend")));
        	jsonObj.put("id", 0);
        	jsonObj.put("auth", "8ba6b9f29dd68e0c98cdea9ee01f2614");
        	
        	putMethod.setRequestEntity(new StringRequestEntity(jsonObj.toString(), "application/json", "UTF-8"));
        }
    At this time, my dashboard is empty. So I shouldn't get any Objects of this code.
    "Warning" is empty, so it is okay.
    "Average returns 8 Objects. All of the objects are older than a week. Bad!
    "High" is empty, so it is okay.
    "Disaster" returns 1 Objects. This object is over one week old. Bad!

    So how can I achieve that I only get the entrys of my dashboard?
Working...