本文整理汇总了PHP中get_accessible_triggers函数的典型用法代码示例。如果您正苦于以下问题:PHP get_accessible_triggers函数的具体用法?PHP get_accessible_triggers怎么用?PHP get_accessible_triggers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_accessible_triggers函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: make_latest_issues
function make_latest_issues($params = array())
{
global $USER_DETAILS;
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY);
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, array());
$scripts_by_hosts = get_accessible_scripts_by_hosts($available_hosts);
$config = select_config();
$sql_select = '';
$sql_from = '';
$sql_where = '';
$limit = 20;
if (!empty($params)) {
if (isset($params['limit'])) {
$limit = $params['limit'];
}
if (isset($params['groupid']) && $params['groupid'] > 0) {
$sql_select .= ',g.name ';
$sql_from .= ',groups g ';
$sql_where .= ' AND g.groupid=hg.groupid ' . ' AND hg.groupid=' . $params['groupid'];
}
if (isset($params['hostid']) && $params['hostid'] > 0) {
$sql_where .= ' AND h.hostid=' . $params['hostid'];
}
}
$table = new CTableInfo();
$table->setHeader(array(is_show_all_nodes() ? S_NODE : null, isset($params['groupid']) && $params['groupid'] > 0 ? S_GROUP : null, S_HOST, S_ISSUE, S_LAST_CHANGE, S_AGE, $config['event_ack_enable'] ? S_ACK : NULL, S_ACTIONS));
$sql = 'SELECT DISTINCT t.triggerid,t.status,t.description,t.expression,t.priority,t.lastchange,t.value,h.host,h.hostid ' . $sql_select . ' FROM triggers t,hosts h,items i,functions f,hosts_groups hg ' . $sql_from . ' WHERE f.itemid=i.itemid ' . ' AND h.hostid=i.hostid ' . ' AND hg.hostid=h.hostid ' . ' AND t.triggerid=f.triggerid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND ' . DBcondition('t.triggerid', $available_triggers) . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND t.value=' . TRIGGER_VALUE_TRUE . $sql_where . ' ORDER BY t.lastchange DESC';
$result = DBselect($sql, $limit);
while ($row = DBfetch($result)) {
// Check for dependencies
if (trigger_dependent($row["triggerid"])) {
continue;
}
$host = null;
$menus = '';
$host_nodeid = id2nodeid($row['hostid']);
foreach ($scripts_by_hosts[$row['hostid']] as $id => $script) {
$script_nodeid = id2nodeid($script['scriptid']);
if (bccomp($host_nodeid, $script_nodeid) == 0) {
$menus .= "['" . $script['name'] . "',\"javascript: openWinCentered('scripts_exec.php?execute=1&hostid=" . $row['hostid'] . "&scriptid=" . $script['scriptid'] . "','" . S_TOOLS . "',760,540,'titlebar=no, resizable=yes, scrollbars=yes, dialog=no');\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
}
}
$menus .= "[" . zbx_jsvalue(S_LINKS) . ",null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
$menus .= "['" . S_LATEST_DATA . "',\"javascript: redirect('latest.php?groupid=0&hostid=" . $row['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
$menus = rtrim($menus, ',');
$menus = "show_popup_menu(event,[[" . zbx_jsvalue(S_TOOLS) . ",null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}]," . $menus . "],180);";
$host = new CSpan($row['host'], 'link');
$host->setAttribute('onclick', 'javascript: ' . $menus);
$host->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
$event_sql = 'SELECT DISTINCT e.eventid, e.value, e.clock, e.objectid as triggerid, e.acknowledged, t.type, t.url ' . ' FROM events e, triggers t ' . ' WHERE e.object=' . EVENT_SOURCE_TRIGGERS . ' AND e.objectid=' . $row['triggerid'] . ' AND t.triggerid=e.objectid ' . ' AND e.value=' . TRIGGER_VALUE_TRUE . ' ORDER by e.object DESC, e.objectid DESC, e.eventid DESC';
$res_events = DBSelect($event_sql, 1);
while ($row_event = DBfetch($res_events)) {
$ack = NULL;
if ($config['event_ack_enable']) {
if ($row_event['acknowledged'] == 1) {
$ack_info = make_acktab_by_eventid($row_event['eventid']);
$ack_info->setAttribute('style', 'width: auto;');
$ack = new CLink(S_YES, 'acknow.php?eventid=' . $row_event['eventid'], 'action');
$ack->setHint($ack_info);
} else {
$ack = new CLink(S_NO, 'acknow.php?eventid=' . $row_event['eventid'], 'on');
}
}
// $description = expand_trigger_description($row['triggerid']);
$description = expand_trigger_description_by_data(array_merge($row, array('clock' => $row_event['clock'])), ZBX_FLAG_EVENT);
//actions
$actions = get_event_actions_stat_hints($row_event['eventid']);
$clock = new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS, $row_event['clock']), 'events.php?triggerid=' . $row['triggerid'] . '&source=0&show_unknown=1&nav_time=' . $row_event['clock'], 'action');
if ($row_event['url']) {
$description = new CLink($description, $row_event['url'], 'action', null, true);
} else {
$description = new CSpan($description, 'pointer');
}
$description = new CCol($description, get_severity_style($row["priority"]));
$description->setHint(make_popup_eventlist($row_event['eventid'], $row['type']));
$table->addRow(array(get_node_name_by_elid($row['triggerid']), $host, $description, $clock, zbx_date2age($row_event['clock']), $ack, $actions));
}
unset($row, $description, $actions, $alerts, $hint);
}
$table->setFooter(new CCol(S_UPDATED . ': ' . date("H:i:s", time())));
return $table;
}
开发者ID:phedders,项目名称:zabbix,代码行数:82,代码来源:blocks.inc.php
示例2: array
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = array("msg" => array(T_ZBX_STR, O_OPT, null, null, NULL), 'favobj' => array(T_ZBX_STR, O_OPT, P_ACT, IN("'hat'"), NULL), 'favref' => array(T_ZBX_STR, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})'), 'state' => array(T_ZBX_INT, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})'));
check_fields($fields);
/* AJAX */
if (isset($_REQUEST['favobj'])) {
if ('hat' == $_REQUEST['favobj']) {
CProfile::update('web.services.hats.' . $_REQUEST['favref'] . '.state', $_REQUEST['state'], PROFILE_TYPE_INT);
}
}
if (PAGE_TYPE_JS == $page['type'] || PAGE_TYPE_HTML_BLOCK == $page['type']) {
include_once 'include/page_footer.php';
exit;
}
//--------
//--------------------------------------------------------------------------
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, array());
$sql = 'SELECT DISTINCT s.serviceid, sl.servicedownid, sl_p.serviceupid as serviceupid, s.triggerid, ' . ' s.name as caption, s.algorithm, t.description, t.expression, s.sortorder, sl.linkid, s.showsla, s.goodsla, s.status ' . ' FROM services s ' . ' LEFT JOIN triggers t ON s.triggerid = t.triggerid ' . ' LEFT JOIN services_links sl ON s.serviceid = sl.serviceupid and NOT(sl.soft=0) ' . ' LEFT JOIN services_links sl_p ON s.serviceid = sl_p.servicedownid and sl_p.soft=0 ' . ' WHERE ' . DBin_node('s.serviceid') . ' AND (t.triggerid IS NULL OR ' . DBcondition('t.triggerid', $available_triggers) . ') ' . ' ORDER BY s.sortorder, sl_p.serviceupid, s.serviceid';
$result = DBSelect($sql);
$services = array();
$row = array('id' => 0, 'serviceid' => 0, 'serviceupid' => 0, 'caption' => S_ROOT_SMALL, 'status' => SPACE, 'algorithm' => SPACE, 'description' => SPACE, 'soft' => 0, 'linkid' => '');
$services[0] = $row;
while ($row = DBFetch($result)) {
$row['id'] = $row['serviceid'];
empty($row['serviceupid']) ? $row['serviceupid'] = '0' : '';
empty($row['triggerid']) ? $row['description'] = 'None' : ($row['description'] = expand_trigger_description($row['triggerid']));
if (isset($services[$row['serviceid']])) {
$services[$row['serviceid']] = zbx_array_merge($services[$row['serviceid']], $row);
} else {
$services[$row['serviceid']] = $row;
}
if (isset($row['serviceupid'])) {
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:services.php
示例3: get_triggers_overview
function get_triggers_overview($hostids, $view_style = null)
{
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, $hostids);
if (is_null($view_style)) {
$view_style = get_profile('web.overview.view.style', STYLE_TOP);
}
$table = new CTableInfo(S_NO_TRIGGERS_DEFINED);
$result = DBselect('SELECT DISTINCT t.triggerid,t.description,t.expression,t.value,t.priority,t.lastchange,h.hostid,h.host' . ' FROM hosts h,items i,triggers t, functions f ' . ' WHERE h.status=' . HOST_STATUS_MONITORED . ' AND h.hostid=i.hostid ' . ' AND i.itemid=f.itemid ' . ' AND f.triggerid=t.triggerid' . ' AND ' . DBcondition('t.triggerid', $available_triggers) . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' ORDER BY t.description');
unset($triggers);
unset($hosts);
$triggers = array();
while ($row = DBfetch($result)) {
if (trigger_dependent($row['triggerid'])) {
continue;
}
$row['host'] = get_node_name_by_elid($row['hostid']) . $row['host'];
$row['description'] = expand_trigger_description_constants($row['description'], $row);
$hosts[strtolower($row['host'])] = $row['host'];
// A little tricky check for attempt to overwrite active trigger (value=1) with
// inactive or active trigger with lower priority.
if (!isset($triggers[$row['description']][$row['host']]) || ($triggers[$row['description']][$row['host']]['value'] == TRIGGER_VALUE_FALSE && $row['value'] == TRIGGER_VALUE_TRUE || ($triggers[$row['description']][$row['host']]['value'] == TRIGGER_VALUE_FALSE || $row['value'] == TRIGGER_VALUE_TRUE) && $row['priority'] > $triggers[$row['description']][$row['host']]['priority'])) {
$triggers[$row['description']][$row['host']] = array('hostid' => $row['hostid'], 'triggerid' => $row['triggerid'], 'value' => $row['value'], 'lastchange' => $row['lastchange'], 'priority' => $row['priority']);
}
}
if (!isset($hosts)) {
return $table;
}
ksort($hosts);
if ($view_style == STYLE_TOP) {
$header = array(new CCol(S_TRIGGERS, 'center'));
foreach ($hosts as $hostname) {
$header = array_merge($header, array(new CImg('vtext.php?text=' . $hostname)));
}
$table->setHeader($header, 'vertical_header');
foreach ($triggers as $descr => $trhosts) {
$table_row = array(nbsp($descr));
foreach ($hosts as $hostname) {
$table_row = get_trigger_overview_cells($table_row, $trhosts, $hostname);
}
$table->AddRow($table_row);
}
} else {
$header = array(new CCol(S_HOSTS, 'center'));
foreach ($triggers as $descr => $trhosts) {
$descr = array(new CImg('vtext.php?text=' . $descr));
array_push($header, $descr);
}
$table->SetHeader($header, 'vertical_header');
foreach ($hosts as $hostname) {
$table_row = array(nbsp($hostname));
foreach ($triggers as $descr => $trhosts) {
$table_row = get_trigger_overview_cells($table_row, $trhosts, $hostname);
}
$table->AddRow($table_row);
}
}
return $table;
}
开发者ID:rennhak,项目名称:zabbix,代码行数:58,代码来源:triggers.inc.php
示例4: get_viewed_hosts
$PAGE_HOSTS = get_viewed_hosts(PERM_READ_ONLY, $PAGE_GROUPS['selected'], $params);
//SDI($_REQUEST['groupid'].' : '.$_REQUEST['hostid']);
validate_group_with_host($PAGE_GROUPS, $PAGE_HOSTS);
//SDI($_REQUEST['groupid'].' : '.$_REQUEST['hostid']);
$mute = get_profile('web.tr_status.mute', 0);
if (isset($audio) && !$mute) {
play_sound($audio);
}
$trigg_wdgt = new CWidget();
$r_form = new CForm();
$r_form->setMethod('get');
// $available_groups = get_accessible_groups_by_user($USER_DETAILS,PERM_READ_ONLY);
// $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY);
$available_groups = $PAGE_GROUPS['groupids'];
$available_hosts = $PAGE_HOSTS['hostids'];
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, $PAGE_HOSTS['hostids']);
$scripts_by_hosts = get_accessible_scripts_by_hosts($PAGE_HOSTS['hostids']);
$cmbGroups = new CComboBox('groupid', $PAGE_GROUPS['selected'], 'javascript: submit();');
$cmbHosts = new CComboBox('hostid', $PAGE_HOSTS['selected'], 'javascript: submit();');
foreach ($PAGE_GROUPS['groups'] as $groupid => $name) {
$cmbGroups->addItem($groupid, get_node_name_by_elid($groupid) . $name);
}
foreach ($PAGE_HOSTS['hosts'] as $hostid => $name) {
$cmbHosts->addItem($hostid, get_node_name_by_elid($hostid) . $name);
}
$r_form->addItem(array(S_GROUP . SPACE, $cmbGroups));
$r_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts));
$r_form->addVar('fullscreen', $_REQUEST['fullscreen']);
$url = 'tr_status.php' . ($_REQUEST['fullscreen'] ? '' : '?fullscreen=1');
$fs_icon = new CDiv(SPACE, 'fullscreen');
$fs_icon->setAttribute('title', $_REQUEST['fullscreen'] ? S_NORMAL . ' ' . S_VIEW : S_FULLSCREEN);
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:tr_status.php
示例5: get_actions_hint_by_eventid
function get_actions_hint_by_eventid($eventid, $status = NULL)
{
$hostids = array();
$sql = 'SELECT DISTINCT i.hostid ' . ' FROM events e, functions f, items i ' . ' WHERE e.eventid=' . $eventid . ' AND e.objectid=' . EVENT_SOURCE_TRIGGERS . ' AND f.triggerid=' . $_REQUEST['triggerid'] . ' AND i.itemid=f.itemid';
if ($host = DBfetch(DBselect($sql, 1))) {
$hostids[$host['hostid']] = $host['hostid'];
}
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, $hostids);
$tab_hint = new CTableInfo(S_NO_ACTIONS_FOUND);
$tab_hint->addOption('style', 'width: 300px;');
$tab_hint->SetHeader(array(is_show_subnodes() ? S_NODES : null, S_USER, S_DETAILS, S_STATUS));
/*
$sql = 'SELECT DISTINCT a.alertid,mt.description,a.sendto,a.status,u.alias,a.retries '.
' FROM events e,users u,alerts a'.
' left join media_type mt on mt.mediatypeid=a.mediatypeid'.
' WHERE a.eventid='.$eventid.
(is_null($status)?'':' AND a.status='.$status).
' AND e.eventid = a.eventid'.
' AND a.alerttype IN ('.ALERT_TYPE_MESSAGE.','.ALERT_TYPE_COMMAND.')'.
' AND '.DBcondition('e.objectid',$available_triggers).
' AND '.DBin_node('a.alertid').
' AND u.userid=a.userid '.
' ORDER BY mt.description';
//*/
$sql = 'SELECT DISTINCT a.alertid,mt.description,u.alias,a.subject,a.message,a.sendto,a.status,a.retries,a.alerttype ' . ' FROM events e,alerts a ' . ' LEFT JOIN users u ON u.userid=a.userid ' . ' LEFT JOIN media_type mt ON mt.mediatypeid=a.mediatypeid' . ' WHERE a.eventid=' . $eventid . (is_null($status) ? '' : ' AND a.status=' . $status) . ' AND e.eventid = a.eventid' . ' AND a.alerttype IN (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . ' AND ' . DBcondition('e.objectid', $available_triggers) . ' AND ' . DBin_node('a.alertid') . ' ORDER BY a.alertid';
$result = DBselect($sql, 30);
while ($row = DBfetch($result)) {
if ($row["status"] == ALERT_STATUS_SENT) {
$status = new CSpan(S_SENT, "green");
$retries = new CSpan(SPACE, "green");
} else {
if ($row["status"] == ALERT_STATUS_NOT_SENT) {
$status = new CSpan(S_IN_PROGRESS, "orange");
$retries = new CSpan(ALERT_MAX_RETRIES - $row["retries"], "orange");
} else {
$status = new CSpan(S_NOT_SENT, "red");
$retries = new CSpan(0, "red");
}
}
switch ($row['alerttype']) {
case ALERT_TYPE_MESSAGE:
$message = empty($row['description']) ? '-' : $row['description'];
break;
case ALERT_TYPE_COMMAND:
$message = array(bold(S_COMMAND . ':'));
$msg = explode("\n", $row['message']);
foreach ($msg as $m) {
array_push($message, BR(), $m);
}
break;
default:
$message = '-';
}
$tab_hint->addRow(array(get_node_name_by_elid($row['alertid']), empty($row['alias']) ? ' - ' : $row['alias'], $message, $status));
}
return $tab_hint;
}
开发者ID:rennhak,项目名称:zabbix,代码行数:57,代码来源:actions.inc.php
示例6: array
}
} else {
// $_REQUEST['triggerid'] = 0;
}
}
$params = array();
$options = array('with_items', 'only_current_node');
foreach ($options as $option) {
$params[$option] = 1;
}
$PAGE_GROUPS = get_viewed_groups(PERM_READ_WRITE, $params);
$PAGE_HOSTS = get_viewed_hosts(PERM_READ_WRITE, $PAGE_GROUPS['selected'], $params);
validate_group_with_host($PAGE_GROUPS, $PAGE_HOSTS);
$available_groups = $PAGE_GROUPS['groupids'];
$available_hosts = $PAGE_HOSTS['hostids'];
$available_triggers = get_accessible_triggers(PERM_READ_WRITE, $PAGE_HOSTS['hostids'], PERM_RES_IDS_ARRAY, null, 0);
$form = new CForm();
$form->setMethod('get');
$form->addItem(new CButton('form', S_CREATE_TRIGGER));
show_table_header(S_CONFIGURATION_OF_TRIGGERS_BIG, $form);
echo SBR;
if (isset($_REQUEST['massupdate']) && isset($_REQUEST['g_triggerid'])) {
insert_mass_update_trigger_form();
} else {
if (isset($_REQUEST['form'])) {
/* FORM */
insert_trigger_form();
} else {
if (isset($_REQUEST['form_copy_to']) && isset($_REQUEST['g_triggerid'])) {
insert_copy_elements_to_forms('g_triggerid');
} else {
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:triggers.php
示例7: bodyToString
public function bodyToString()
{
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, array(), PERM_RES_IDS_ARRAY, get_current_nodeid(true));
foreach ($available_triggers as $id => $triggerid) {
if (trigger_dependent($triggerid)) {
unset($available_triggers[$id]);
}
}
$this->cleanItems();
$ok = $uncn = $info = $warn = $avg = $high = $dis = 0;
$sql_from = '';
$sql_where = '';
if ($this->groupid > 0) {
$sql_from = ', hosts_groups hg ';
$sql_where = ' AND hg.groupid=' . $this->groupid . ' AND h.hostid=hg.hostid ';
}
$db_priority = DBselect('SELECT t.priority,t.value,count(DISTINCT t.triggerid) as cnt ' . ' FROM triggers t,hosts h,items i,functions f ' . $sql_from . ' WHERE t.status=' . TRIGGER_STATUS_ENABLED . ' AND f.itemid=i.itemid ' . ' AND h.hostid=i.hostid ' . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND t.triggerid=f.triggerid ' . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND ' . DBcondition('t.triggerid', $available_triggers) . $sql_where . ' GROUP BY t.priority,t.value');
while ($row = DBfetch($db_priority)) {
switch ($row["value"]) {
case TRIGGER_VALUE_TRUE:
switch ($row["priority"]) {
case TRIGGER_SEVERITY_INFORMATION:
$info += $row["cnt"];
break;
case TRIGGER_SEVERITY_WARNING:
$warn += $row["cnt"];
break;
case TRIGGER_SEVERITY_AVERAGE:
$avg += $row["cnt"];
break;
case TRIGGER_SEVERITY_HIGH:
$high += $row["cnt"];
break;
case TRIGGER_SEVERITY_DISASTER:
$dis += $row["cnt"];
break;
default:
$uncn += $row["cnt"];
break;
}
break;
case TRIGGER_VALUE_FALSE:
$ok += $row["cnt"];
break;
default:
$uncn += $row["cnt"];
break;
}
}
if ($this->show_header) {
$header = new CCol(S_TRIGGERS_INFO, "header");
if ($this->style == STYLE_HORISONTAL) {
$header->SetColspan(7);
}
$this->addRow($header);
}
$trok = new CCol($ok . SPACE . S_OK, get_severity_style('ok', false));
$uncn = new CCol($uncn . SPACE . S_NOT_CLASSIFIED, get_severity_style(TRIGGER_SEVERITY_NOT_CLASSIFIED, $uncn));
$info = new CCol($info . SPACE . S_INFORMATION, get_severity_style(TRIGGER_SEVERITY_INFORMATION, $info));
$warn = new CCol($warn . SPACE . S_WARNING, get_severity_style(TRIGGER_SEVERITY_WARNING, $warn));
$avg = new CCol($avg . SPACE . S_AVERAGE, get_severity_style(TRIGGER_SEVERITY_AVERAGE, $avg));
$high = new CCol($high . SPACE . S_HIGH, get_severity_style(TRIGGER_SEVERITY_HIGH, $high));
$dis = new CCol($dis . SPACE . S_DISASTER, get_severity_style(TRIGGER_SEVERITY_DISASTER, $dis));
if (STYLE_HORISONTAL == $this->style) {
$this->addRow(array($trok, $uncn, $info, $warn, $avg, $high, $dis));
} else {
$this->addRow($trok);
$this->addRow($uncn);
$this->addRow($info);
$this->addRow($warn);
$this->addRow($avg);
$this->addRow($high);
$this->addRow($dis);
}
return parent::BodyToString();
}
开发者ID:rennhak,项目名称:zabbix,代码行数:76,代码来源:class.ctriggersinfo.php
示例8: isset
include_once "include/page_header.php";
$bulk = isset($_REQUEST['bulkacknowledge']);
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = array('eventid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'events' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'message' => array(T_ZBX_STR, O_OPT, NULL, $bulk ? NULL : NOT_EMPTY, 'isset({save})||isset({saveandreturn})'), 'bulkacknowledge' => array(T_ZBX_STR, O_OPT, P_ACT | P_SYS, NULL, NULL), "saveandreturn" => array(T_ZBX_STR, O_OPT, P_ACT | P_SYS, NULL, NULL), "save" => array(T_ZBX_STR, O_OPT, P_ACT | P_SYS, NULL, NULL), "cancel" => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null));
check_fields($fields);
if (!isset($_REQUEST['events']) && !isset($_REQUEST['eventid'])) {
show_message(S_NO_EVENTS_TO_ACKNOWLEDGE);
include_once "include/page_footer.php";
}
if (isset($_REQUEST['eventid'])) {
$events[$_REQUEST['eventid']] = $_REQUEST['eventid'];
} else {
$events = $_REQUEST['events'];
}
//$bulk = (count($events) > 1);
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, array(), PERM_RES_IDS_ARRAY, get_current_nodeid());
$db_data = DBfetch(DBselect('SELECT COUNT(DISTINCT e.eventid) as cnt' . ' FROM events e' . ' WHERE ' . DBcondition('e.eventid', $events) . ' AND ' . DBcondition('e.objectid', $available_triggers) . ' AND e.object=' . EVENT_OBJECT_TRIGGER . ' AND ' . DBin_node('e.eventid')));
if ($db_data['cnt'] != count($events)) {
access_deny();
}
$db_data = DBfetch(DBselect('SELECT DISTINCT e.*,t.triggerid,t.expression,t.description,t.expression,h.host,h.hostid ' . ' FROM hosts h, items i, functions f, events e, triggers t' . ' WHERE h.hostid=i.hostid ' . ' AND i.itemid=f.itemid ' . ' AND f.triggerid=t.triggerid ' . ' AND ' . DBcondition('e.eventid', $events) . ' AND e.object=' . EVENT_OBJECT_TRIGGER . ' AND e.objectid=t.triggerid ' . ' AND ' . DBcondition('t.triggerid', $available_triggers) . ' AND ' . DBin_node('e.eventid')));
if (isset($_REQUEST['save']) && !$bulk) {
$result = add_acknowledge_coment($db_data['eventid'], $USER_DETAILS['userid'], $_REQUEST['message']);
show_messages($result, S_COMMENT_ADDED, S_CANNOT_ADD_COMMENT);
if ($result) {
add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_TRIGGER, S_ACKNOWLEDGE_ADDED . ' [' . expand_trigger_description_by_data($db_data) . ']' . ' [' . $_REQUEST["message"] . ']');
}
} else {
if (isset($_REQUEST["saveandreturn"])) {
$result = true;
if ($bulk) {
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:acknow.php
示例9: array_push
if (!$ZBX_WITH_ALL_NODES) {
array_push($options, 'only_current_node');
}
//SDI($_REQUEST['groupid'].' : '.$_REQUEST['hostid']);
$params = array();
foreach ($options as $option) {
$params[$option] = 1;
}
$PAGE_GROUPS = get_viewed_groups(PERM_READ_ONLY, $params);
$PAGE_HOSTS = get_viewed_hosts(PERM_READ_ONLY, $PAGE_GROUPS['selected'], $params);
//SDI($_REQUEST['groupid'].' : '.$_REQUEST['hostid']);
validate_group_with_host($PAGE_GROUPS, $PAGE_HOSTS);
//SDI($_REQUEST['groupid'].' : '.$_REQUEST['hostid']);
$available_groups = $PAGE_GROUPS['groupids'];
$available_hosts = $PAGE_HOSTS['hostids'];
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, $PAGE_HOSTS['hostids'], PERM_RES_DATA_ARRAY, get_current_nodeid());
if (isset($_REQUEST['triggerid']) && $_REQUEST['triggerid'] > 0 && !isset($available_triggers[$_REQUEST['triggerid']])) {
unset($_REQUEST['triggerid']);
}
$cmbGroups = new CComboBox('groupid', $PAGE_GROUPS['selected'], 'javascript: submit();');
$cmbHosts = new CComboBox('hostid', $PAGE_HOSTS['selected'], 'javascript: submit();');
foreach ($PAGE_GROUPS['groups'] as $groupid => $name) {
$cmbGroups->addItem($groupid, get_node_name_by_elid($groupid) . $name);
}
foreach ($PAGE_HOSTS['hosts'] as $hostid => $name) {
$cmbHosts->addItem($hostid, get_node_name_by_elid($hostid) . $name);
}
$r_form->addItem(array(S_GROUP . SPACE, $cmbGroups));
$r_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts));
}
if ($allow_discovery) {
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:events.php
示例10: get_screen
//.........这里部分代码省略.........
$item = $image_map;
// $item = new CLink($image_map, $action);
}
} else {
if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_PLAIN_TEXT) {
// Host feature
if ($dynamic == SCREEN_DYNAMIC_ITEM && isset($_REQUEST['hostid']) && $_REQUEST['hostid'] > 0) {
if ($newitemid = get_same_item_for_host($resourceid, $_REQUEST['hostid'])) {
$resourceid = $newitemid;
} else {
$resourceid = 0;
}
}
//-------------
$item = array(get_screen_plaintext($resourceid, $elements, $style));
if ($editmode == 1) {
array_push($item, new CLink(S_CHANGE, $action));
}
} else {
if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_STATUS_OF_TRIGGERS) {
$params = array();
$params['groupid'] = get_request('tr_groupid', get_profile('web.screens.tr_groupid', 0));
$params['hostid'] = get_request('tr_hostid', get_profile('web.screens.tr_hostid', 0));
$params['limit'] = $elements;
update_profile('web.screens.tr_groupid', $params['groupid'], PROFILE_TYPE_ID);
update_profile('web.screens.tr_hostid', $params['hostid'], PROFILE_TYPE_ID);
$tr_form = new CForm();
$cmbGroup = new CComboBox('tr_groupid', $params['groupid'], 'submit()');
$cmbHosts = new CComboBox('tr_hostid', $params['hostid'], 'submit()');
$cmbGroup->addItem(0, S_ALL_SMALL);
$cmbHosts->addItem(0, S_ALL_SMALL);
$available_groups = get_accessible_groups_by_user($USER_DETAILS, PERM_READ_ONLY);
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY);
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, PERM_RES_IDS_ARRAY);
$sql = 'SELECT DISTINCT g.groupid,g.name ' . ' FROM groups g, hosts_groups hg, hosts h ' . ' WHERE ' . DBcondition('g.groupid', $available_groups) . ' AND hg.groupid=g.groupid ' . ' AND h.hostid=hg.hostid ' . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND EXISTS(SELECT i.itemid FROM items i WHERE i.status=' . ITEM_STATUS_ACTIVE . ' AND i.hostid=h.hostid ) ' . ' ORDER BY g.name';
$tresult = DBselect($sql);
while ($tr_row = DBfetch($tresult)) {
$cmbGroup->addItem($tr_row['groupid'], get_node_name_by_elid($tr_row['groupid']) . $tr_row['name']);
}
$tr_form->addItem(array(S_GROUP . SPACE, $cmbGroup));
$sql_from = '';
$sql_where = '';
if ($params['groupid'] > 0) {
$sql_from .= ',hosts_groups hg ';
$sql_where .= ' AND hg.hostid=h.hostid AND hg.groupid=' . $params['groupid'];
}
$sql = 'SELECT DISTINCT h.hostid,h.host ' . ' FROM hosts h, items i, functions f, triggers t ' . $sql_from . ' WHERE h.status=' . HOST_STATUS_MONITORED . $sql_where . ' AND h.hostid=i.hostid ' . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND i.itemid=f.itemid ' . ' AND f.triggerid=t.triggerid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' ORDER BY h.host';
$tresult = DBselect($sql);
while ($tr_row = DBfetch($tresult)) {
$cmbHosts->addItem($tr_row['hostid'], get_node_name_by_elid($tr_row['hostid']) . $tr_row['host']);
}
$tr_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts));
$item = array(get_table_header(array(S_STATUS_OF_TRIGGERS_BIG, SPACE, date('[H:i:s]', time())), $tr_form));
//*/
// $item = array();
$item[] = make_latest_issues($params);
if ($editmode == 1) {
array_push($item, new CLink(S_CHANGE, $action));
}
} else {
if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_SYSTEM_STATUS) {
$item = array(get_table_header(array(S_SYSTEM_STATUSBIG, SPACE, date('[H:i:s]', time()))));
$item[] = make_system_summary();
if ($editmode == 1) {
array_push($item, new CLink(S_CHANGE, $action));
}
开发者ID:phedders,项目名称:zabbix,代码行数:67,代码来源:screens.inc.php
示例11: DBselect
$table->SetHeader(array(S_KEY, S_DESCRIPTION));
$result = DBselect("select * from help_items where itemtype=" . $itemtype . " ORDER BY key_");
while ($row = DBfetch($result)) {
$name = new CLink($row["key_"], "#", "action");
if (isset($_REQUEST['reference']) && $_REQUEST['reference'] == 'dashboard') {
$action = get_window_opener($dstfrm, $dstfld1, $srcfld2) . get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]) . "window.opener.setTimeout('add2favorites();', 1000);";
} else {
$action = get_window_opener($dstfrm, $dstfld1, html_entity_decode($row[$srcfld1])) . (isset($srcfld2) ? get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]) : '');
}
$name->SetAction($action . " close_window(); return false;");
$table->addRow(array($name, $row["description"]));
}
$table->Show();
} else {
if ($srctbl == 'triggers') {
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, $available_hosts, PERM_RES_IDS_ARRAY, $nodeid);
$form = new CForm();
$form->setAttribute('id', S_TRIGGERS);
$table = new CTableInfo(S_NO_TRIGGERS_DEFINED);
if ($multiselect) {
insert_js_function('add_selected_values');
insert_js_function('check_all');
$header = array(new CCol(array(new CCheckBox("check", NULL, 'check_all("' . S_TRIGGERS . '", this.checked);'), S_NAME)), S_SEVERITY, S_STATUS);
$button = new CButton('select', S_SELECT, 'add_selected_values("' . S_TRIGGERS . '", "' . $dstfrm . '", "' . $dstfld1 . '", "' . $dstact . '")');
$button->setType('button');
$table->setFooter(new CCol($button, 'right'));
} else {
insert_js_function('add_value');
$header = array(S_NAME, S_SEVERITY, S_STATUS);
}
$table->SetHeader($header);
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:popup.php
示例12: get_viewed_hosts
$PAGE_HOSTS = get_viewed_hosts(PERM_READ_ONLY, $PAGE_GROUPS['selected'], $params);
//SDI($_REQUEST['groupid'].' : '.$_REQUEST['hostid']);
validate_group_with_host($PAGE_GROUPS, $PAGE_HOSTS);
//SDI($_REQUEST['groupid'].' : '.$_REQUEST['hostid']);
if (0 == $config) {
$available_groups = $PAGE_GROUPS['groupids'];
$available_hosts = $PAGE_HOSTS['hostids'];
} else {
$available_groups = get_accessible_groups_by_user($USER_DETAILS, PERM_READ_ONLY);
if ($PAGE_HOSTS['selected'] != 0) {
$PAGE_HOSTS['hostids'] = $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY);
} else {
$available_hosts = $PAGE_HOSTS['hostids'];
}
}
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, $available_hosts);
show_report2_header($config, $PAGE_GROUPS, $PAGE_HOSTS);
if (isset($_REQUEST['triggerid'])) {
if (isset($available_triggers[$_REQUEST['triggerid']])) {
$sql = 'SELECT DISTINCT t.*, h.host, h.hostid ' . ' FROM triggers t, functions f, items i, hosts h ' . ' WHERE t.triggerid=' . $_REQUEST['triggerid'] . ' AND t.triggerid=f.triggerid ' . ' AND f.itemid=i.itemid ' . ' AND i.hostid=h.hostid ';
$trigger_data = DBfetch(DBselect($sql));
} else {
unset($_REQUEST['triggerid']);
}
}
if (isset($_REQUEST['triggerid'])) {
show_table_header(array(new CLink($trigger_data['host'], '?hostid=' . $trigger_data['hostid']), ' : "', expand_trigger_description_by_data($trigger_data), '"'));
$table = new CTableInfo(null, 'graph');
$table->addRow(new CImg('chart4.php?triggerid=' . $_REQUEST['triggerid']));
$table->show();
} else {
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:report2.php
示例13: sysmap_accessible
function sysmap_accessible($sysmapid, $perm)
{
global $USER_DETAILS;
$result = false;
$sql = 'SELECT * ' . ' FROM sysmaps_elements ' . ' WHERE sysmapid=' . $sysmapid . ' AND ' . DBin_node('sysmapid', get_current_nodeid(null, $perm));
if ($db_result = DBselect($sql)) {
$result = true;
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS, $perm, PERM_RES_IDS_ARRAY, get_current_nodeid(true));
//SDI($available_hosts);
while (($se_data = DBfetch($db_result)) && $result) {
switch ($se_data['elementtype']) {
case SYSMAP_ELEMENT_TYPE_HOST:
if (!isset($available_hosts[$se_data['elementid']])) {
$result = false;
}
break;
case SYSMAP_ELEMENT_TYPE_MAP:
$result = sysmap_accessible($se_data['elementid'], $perm);
break;
case SYSMAP_ELEMENT_TYPE_TRIGGER:
$available_triggers = get_accessible_triggers($perm, array(), PERM_RES_IDS_ARRAY);
if (!isset($available_triggers[$se_data['elementid']])) {
$result = false;
}
break;
case SYSMAP_ELEMENT_TYPE_HOST_GROUP:
$available_groups = get_accessible_groups_by_user($USER_DETAILS, $perm);
if (!isset($available_groups[$se_data['elementid']])) {
$result = false;
}
break;
}
}
//SDI($se_data['elementid']);
} else {
if (DBselect('SELECT sysmapid FROM sysmaps WHERE sysmapid=' . $sysmapid . ' AND ' . DBin_node('sysmapid', get_current_nodeid($perm)))) {
$result = true;
}
}
return $result;
}
开发者ID:rennhak,项目名称:zabbix,代码行数:41,代码来源:maps.inc.php
示例14: get_history_of_triggers_events
function get_history_of_triggers_events($start, $num, $groupid = 0, $hostid = 0)
{
global $USER_DETAILS;
$config = select_config();
$show_unknown = get_profile('web.events.filter.show_unknown', 0);
$sql_from = $sql_cond = '';
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_LIST);
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, array(), PERM_RES_DATA_ARRAY, get_current_nodeid());
if ($hostid > 0) {
$sql_cond = ' AND h.hostid=' . $hostid;
} else {
if ($groupid > 0) {
$sql_from = ', hosts_groups hg ';
$sql_cond = ' AND h.hostid=hg.hostid AND hg.groupid=' . $groupid;
} else {
$sql_from = '';
$sql_cond = ' AND ' . DBcondition('h.hostid', $available_hosts);
}
}
//---
$triggers = array();
$trigger_list = array();
$sql = 'SELECT DISTINCT t.triggerid,t.priority,t.description,t.expression,h.host,t.type ' . ' FROM triggers t, functions f, items i, hosts h ' . $sql_from . ' WHERE ' . DBcondition('t.triggerid', $available_triggers) . ' AND t.triggerid=f.triggerid ' . ' AND f.itemid=i.itemid ' . ' AND i.hostid=h.hostid ' . ' AND h.status=' . HOST_STATUS_MONITORED . $sql_cond;
$rez = DBselect($sql);
while ($rowz = DBfetch($rez)) {
$triggers[$rowz['triggerid']] = $rowz;
array_push($trigger_list, $rowz['triggerid']);
}
$sql_cond = $show_unknown == 0 ? ' AND e.value<>' . TRIGGER_VALUE_UNKNOWN . ' ' : '';
$table = new CTableInfo(S_NO_EVENTS_FOUND);
$table->SetHeader(array(S_TIME, is_show_all_nodes() ? S_NODE : null, $hostid == 0 ? S_HOST : null, S_DESCRIPTION, S_VALUE, S_SEVERITY));
if (!empty($triggers)) {
$sql = 'SELECT e.eventid, e.objectid as triggerid, e.clock, e.value, e.acknowledged ' . ' FROM events e ' . ' WHERE e.object=' . EVENT_OBJECT_TRIGGER . ' AND ' . DBcondition('e.objectid', $trigger_list) . $sql_cond . ' ORDER BY e.eventid DESC';
$result = DBselect($sql, 10 * ($start + $num));
}
$col = 0;
$skip = $start;
while (!empty($triggers) && $col < $num && ($row = DBfetch($result))) {
if ($skip > 0) {
if ($show_unknown == 0 && $row['value'] == TRIGGER_VALUE_UNKNOWN) {
continue;
}
$skip--;
continue;
}
$value = new CCol(trigger_value2str($row['value']), get_trigger_value_style($row['value']));
$row = array_merge($triggers[$row['triggerid']], $row);
if (0 == $show_unknown && !event_initial_time($row, $show_unknown)) {
continue;
}
$table->AddRow(array(date("Y.M.d H:i:s", $row["clock"]), get_node_name_by_elid($row['triggerid']), $hostid == 0 ? $row['host'] : null, new CLink(expand_trigger_description_by_data($row, ZBX_FLAG_EVENT), 'tr_events.php?triggerid=' . $row['triggerid'] . '&eventid=' . $row['eventid'], 'action'), $value, new CCol(get_severity_description($row["priority"]), get_severity_style($row["priority"]))));
$col++;
}
return $table;
}
开发者ID:phedders,项目名称:zabbix,代码行数:55,代码来源:events.inc.php
示例15: array
//---------------------------------- CHECKS ------------------------------------
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = array("msg" => array(T_ZBX_STR, O_OPT, null, null, NULL), 'favobj' => array(T_ZBX_STR, O_OPT, P_ACT, IN("'hat'"), NULL), 'favid' => array(T_ZBX_STR, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})'), 'state' => array(T_ZBX_INT, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})'));
check_fields($fields);
/* AJAX */
if (isset($_REQUEST['favobj'])) {
if ('hat' == $_REQUEST['favobj']) {
update_profile('web.services.hats.' . $_REQUEST['favid'] . '.state', $_REQUEST['state'], PROFILE_TYPE_INT);
}
}
if (PAGE_TYPE_JS == $page['type'] || PAGE_TYPE_HTML_BLOCK == $page['type']) {
exit;
}
//--------
//--------------------------------------------------------------------------
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, array(), PERM_RES_IDS_ARRAY);
$query = 'SELECT DISTINCT s.serviceid, sl.servicedownid, sl_p.serviceupid as serviceupid, s.triggerid, ' . ' s.name as caption, s.algorithm, t.description, t.expression, s.sortorder, sl.linkid, s.showsla, s.goodsla, s.status ' . ' FROM services s ' . ' LEFT JOIN triggers t ON s.triggerid = t.triggerid ' . ' LEFT JOIN services_links sl ON s.serviceid = sl.serviceupid and NOT(sl.soft=0) ' . ' LEFT JOIN services_links sl_p ON s.serviceid = sl_p.servicedownid and sl_p.soft=0 ' . ' WHERE ' . DBin_node('s.serviceid') . ' AND (t.triggerid IS NULL OR ' . DBcondition('t.triggerid', $available_triggers) . ') ' . ' ORDER BY s.sortorder, sl_p.serviceupid, s.serviceid';
$result = DBSelect($query);
$services = array();
$row = array('id' => 0, 'serviceid' => 0, 'serviceupid' => 0, 'caption' => S_ROOT_SMALL, 'status' => SPACE, 'algorithm' => SPACE, 'description' => SPACE, 'soft' => 0, 'linkid' => '');
$services[0] = $row;
while ($row = DBFetch($result)) {
$row['id'] = $row['serviceid'];
empty($row['serviceupid']) ? $row['serviceupid'] = '0' : '';
empty($row['triggerid']) ? $row['description'] = 'None' : ($row['description'] = expand_trigger_description($row['triggerid']));
if (isset($services[$row['serviceid']])) {
$services[$row['serviceid']] = array_merge($services[$row['serviceid']], $row);
} else {
$services[$row['serviceid']] = $row;
}
if (isset($row['serviceupid'])) {
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:services.php
示例16: insert_map_element_form
|
请发表评论