array(T_ZBX_STR, O_OPT, P_SYS|P_NZERO, IN('"day","week","month","year"'), NULL) ); check_fields($fields); ?> SetMethod('get'); $cmbPeriod = new CComboBox("period",$_REQUEST["period"],"submit()"); $cmbPeriod->AddItem("day",S_DAY); $cmbPeriod->AddItem("week",S_WEEK); $cmbPeriod->AddItem("month",S_MONTH); $cmbPeriod->AddItem("year",S_YEAR); $form->AddItem($cmbPeriod); show_table_header(S_TRIGGERS_TOP_100_BIG, $form); ?> setHeader(array( is_show_subnodes() ? S_NODE : null, S_HOST, S_TRIGGER, S_SEVERITY, S_NUMBER_OF_STATUS_CHANGES )); switch($_REQUEST["period"]){ case "week": $time_dif=7*24*3600; break; case "month": $time_dif=10*24*3600; break; case "year": $time_dif=365*24*3600; break; case "day": default: $time_dif=24*3600; break; } $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY,PERM_RES_IDS_ARRAY); $sql = 'SELECT h.host, t.triggerid, t.description, t.expression, t.priority, count(distinct e.eventid) as cnt_event '. ' FROM hosts h, triggers t, functions f, items i, events e'. ' WHERE h.hostid = i.hostid '. ' and i.itemid = f.itemid '. ' and t.triggerid=f.triggerid '. ' and t.triggerid=e.objectid '. ' and e.object='.EVENT_OBJECT_TRIGGER. ' and e.clock>'.(time()-$time_dif). ' and '.DBcondition('h.hostid',$available_hosts). ' and '.DBin_node('t.triggerid'). ' GROUP BY h.host,t.triggerid,t.description,t.expression,t.priority '. ' ORDER BY cnt_event desc, h.host, t.description, t.triggerid'; $result=DBselect($sql, 100); while($row=DBfetch($result)){ if(!check_right_on_trigger_by_triggerid(null, $row['triggerid'], $available_hosts)) continue; $table->addRow(array( get_node_name_by_elid($row['triggerid']), $row["host"], expand_trigger_description_by_data($row), new CCol(get_severity_description($row["priority"]),get_severity_style($row["priority"])), $row["cnt_event"], )); } $table->show(); ?>