• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP itemName函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中itemName函数的典型用法代码示例。如果您正苦于以下问题:PHP itemName函数的具体用法?PHP itemName怎么用?PHP itemName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了itemName函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: addItem

 public function addItem($itemid, $calc_fnc = CALC_FNC_AVG, $color = null, $type = null)
 {
     $this->items[$this->num] = get_item_by_itemid($itemid);
     $this->items[$this->num]['name'] = itemName($this->items[$this->num]);
     $host = get_host_by_hostid($this->items[$this->num]['hostid']);
     $this->items[$this->num]['host'] = $host['name'];
     $this->items[$this->num]['color'] = is_null($color) ? 'Dark Green' : $color;
     $this->items[$this->num]['calc_fnc'] = is_null($calc_fnc) ? CALC_FNC_AVG : $calc_fnc;
     $this->items[$this->num]['calc_type'] = is_null($type) ? GRAPH_ITEM_SIMPLE : $type;
     $this->num++;
 }
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:11,代码来源:class.cpie.php


示例2: get

 /**
  * Process screen.
  *
  * @return CDiv (screen inside container)
  */
 public function get()
 {
     // if screen is defined in template, then 'real_resourceid' is defined and should be used
     if (!empty($this->screenitem['real_resourceid'])) {
         $this->screenitem['resourceid'] = $this->screenitem['real_resourceid'];
     }
     if ($this->screenitem['dynamic'] == SCREEN_DYNAMIC_ITEM && !empty($this->hostid)) {
         $newitemid = get_same_item_for_host($this->screenitem['resourceid'], $this->hostid);
         $this->screenitem['resourceid'] = !empty($newitemid) ? $newitemid : 0;
     }
     if ($this->screenitem['resourceid'] == 0) {
         $table = new CTableInfo(_('No data defined.'));
         $table->setHeader(array(_('Timestamp'), _('Item')));
         return $this->getOutput($table);
     }
     $item = get_item_by_itemid($this->screenitem['resourceid']);
     switch ($item['value_type']) {
         case ITEM_VALUE_TYPE_TEXT:
         case ITEM_VALUE_TYPE_LOG:
             $orderField = 'id';
             break;
         case ITEM_VALUE_TYPE_FLOAT:
         case ITEM_VALUE_TYPE_UINT64:
         default:
             $orderField = array('itemid', 'clock');
     }
     $host = get_host_by_itemid($this->screenitem['resourceid']);
     $table = new CTableInfo(_('No data defined.'));
     $table->setHeader(array(_('Timestamp'), $host['name'] . ': ' . itemName($item)));
     $stime = zbxDateToTime($this->timeline['stime']);
     $histories = API::History()->get(array('history' => $item['value_type'], 'itemids' => $this->screenitem['resourceid'], 'output' => API_OUTPUT_EXTEND, 'sortorder' => ZBX_SORT_DOWN, 'sortfield' => $orderField, 'limit' => $this->screenitem['elements'], 'time_from' => $stime, 'time_till' => $stime + $this->timeline['period']));
     foreach ($histories as $history) {
         switch ($item['value_type']) {
             case ITEM_VALUE_TYPE_FLOAT:
                 sscanf($history['value'], '%f', $value);
                 break;
             case ITEM_VALUE_TYPE_TEXT:
             case ITEM_VALUE_TYPE_STR:
             case ITEM_VALUE_TYPE_LOG:
                 $value = $this->screenitem['style'] ? new CJSscript($history['value']) : $history['value'];
                 break;
             default:
                 $value = $history['value'];
                 break;
         }
         if ($item['valuemapid'] > 0) {
             $value = applyValueMap($value, $item['valuemapid']);
         }
         $table->addRow(array(zbx_date2str(_('d M Y H:i:s'), $history['clock']), new CCol($value, 'pre')));
     }
     return $this->getOutput($table);
 }
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:57,代码来源:CScreenPlainText.php


示例3: get_request

     $type = get_request('type', 0);
     $priority = get_request('priority', 0);
     $comments = get_request('comments', '');
     $url = get_request('url', '');
     $status = get_request('status', 0);
 }
 $keys = get_request('keys', array());
 $frmTRLog->addRow(_('Description'), new CTextBox('description', $description, 80));
 $item = '';
 $db_items = DBselect('SELECT DISTINCT * FROM items WHERE itemid=' . $itemid);
 while ($db_item = DBfetch($db_items)) {
     if ($db_item['templateid']) {
         $template_host = get_realhost_by_itemid($db_item['templateid']);
         $item = $template_host['host'] . ':';
     }
     $item .= itemName($db_item, $db_item['key_']);
 }
 $ctb = new CTextBox('item', $item, 80);
 $ctb->setAttribute('id', 'item');
 $ctb->setAttribute('disabled', 'disabled');
 $script = "javascript: return PopUp('popup.php?dstfrm=" . $frmTRLog->getName() . "&dstfld1=itemid&dstfld2=item&srctbl=items&srcfld1=itemid&srcfld2=name',800,450);";
 $cbtn = new CSubmit('select_item', _('Select'), $script);
 $frmTRLog->addRow(_('Item'), array($ctb, $cbtn));
 $frmTRLog->addVar('itemid', $itemid);
 $exp_select = new CComboBox('expr_type');
 $exp_select->setAttribute('id', 'expr_type');
 $exp_select->addItem(REGEXP_INCLUDE, _('Include'));
 $exp_select->addItem(REGEXP_EXCLUDE, _('Exclude'));
 $ctb = new CTextBox('expression', '', 80);
 $ctb->setAttribute('id', 'logexpr');
 $cb = new CButton('add_exp', _('Add'), 'javascript: add_logexpr();');
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:tr_logform.php


示例4: fillItemsWithChildTemplates

 }
 // set values for subfilters, if any of subfilters = false then item shouldnt be shown
 if (!empty($data['items'])) {
     // fill template host
     fillItemsWithChildTemplates($data['items']);
     $dbHostItems = DBselect('SELECT i.itemid,h.name,h.hostid' . ' FROM hosts h,items i' . ' WHERE i.hostid=h.hostid' . ' AND ' . dbConditionInt('i.itemid', zbx_objectValues($data['items'], 'templateid')));
     while ($dbHostItem = DBfetch($dbHostItems)) {
         foreach ($data['items'] as $itemid => $item) {
             if ($item['templateid'] == $dbHostItem['itemid']) {
                 $data['items'][$itemid]['template_host'] = $dbHostItem;
             }
         }
     }
     foreach ($data['items'] as &$item) {
         $item['hostids'] = zbx_objectValues($item['hosts'], 'hostid');
         $item['name_expanded'] = itemName($item);
         if (empty($data['filter_hostname'])) {
             $host = reset($item['hosts']);
             $item['host'] = $host['name'];
         }
         $item['subfilters'] = array('subfilter_hosts' => empty($_REQUEST['subfilter_hosts']) || (bool) array_intersect($_REQUEST['subfilter_hosts'], $item['hostids']), 'subfilter_types' => empty($_REQUEST['subfilter_types']) || uint_in_array($item['type'], $_REQUEST['subfilter_types']), 'subfilter_value_types' => empty($_REQUEST['subfilter_value_types']) || uint_in_array($item['value_type'], $_REQUEST['subfilter_value_types']), 'subfilter_status' => empty($_REQUEST['subfilter_status']) || uint_in_array($item['status'], $_REQUEST['subfilter_status']), 'subfilter_templated_items' => empty($_REQUEST['subfilter_templated_items']) || ($item['templateid'] == 0 && uint_in_array(0, $_REQUEST['subfilter_templated_items']) || $item['templateid'] > 0 && uint_in_array(1, $_REQUEST['subfilter_templated_items'])), 'subfilter_with_triggers' => empty($_REQUEST['subfilter_with_triggers']) || count($item['triggers']) == 0 && uint_in_array(0, $_REQUEST['subfilter_with_triggers']) || count($item['triggers']) > 0 && uint_in_array(1, $_REQUEST['subfilter_with_triggers']), 'subfilter_history' => empty($_REQUEST['subfilter_history']) || uint_in_array($item['history'], $_REQUEST['subfilter_history']), 'subfilter_trends' => empty($_REQUEST['subfilter_trends']) || uint_in_array($item['trends'], $_REQUEST['subfilter_trends']), 'subfilter_interval' => empty($_REQUEST['subfilter_interval']) || uint_in_array($item['delay'], $_REQUEST['subfilter_interval']), 'subfilter_apps' => empty($_REQUEST['subfilter_apps']));
         if (!empty($_REQUEST['subfilter_apps'])) {
             foreach ($item['applications'] as $application) {
                 if (str_in_array($application['name'], $_REQUEST['subfilter_apps'])) {
                     $item['subfilters']['subfilter_apps'] = true;
                     break;
                 }
             }
         }
         if (!empty($item['applications'])) {
             order_result($item['applications'], 'name');
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:items.php


示例5: CTextArea

 }
 if ($hostInventoryTable['fields'][$inventoryInfo['db_field']]['type'] == DB::FIELD_TYPE_TEXT) {
     $input = new CTextArea('host_inventory[' . $inventoryInfo['db_field'] . ']', $host_inventory[$inventoryInfo['db_field']]);
     $input->addStyle('width: 64em;');
 } else {
     $fieldLength = $hostInventoryTable['fields'][$inventoryInfo['db_field']]['length'];
     $input = new CTextBox('host_inventory[' . $inventoryInfo['db_field'] . ']', $host_inventory[$inventoryInfo['db_field']]);
     $input->setAttribute('maxlength', $fieldLength);
     $input->addStyle('width: ' . ($fieldLength > 64 ? 64 : $fieldLength) . 'em;');
 }
 if ($inventory_mode == HOST_INVENTORY_DISABLED) {
     $input->setAttribute('disabled', 'disabled');
 }
 // link to populating item at the right side (if any)
 if (isset($hostItemsToInventory[$inventoryNo])) {
     $itemName = itemName($hostItemsToInventory[$inventoryNo]);
     $populatingLink = new CLink($itemName, 'items.php?form=update&itemid=' . $hostItemsToInventory[$inventoryNo]['itemid']);
     $populatingLink->setAttribute('title', _s('This field is automatically populated by item "%s".', $itemName));
     $populatingItemCell = array(' ← ', $populatingLink);
     $input->addClass('linked_to_item');
     // this will be used for disabling fields via jquery
     if ($inventory_mode == HOST_INVENTORY_AUTOMATIC) {
         $input->setAttribute('disabled', 'disabled');
     }
 } else {
     $populatingItemCell = '';
 }
 $input->addStyle('float: left;');
 $populatingItem = new CSpan($populatingItemCell, 'populating_item');
 if ($inventory_mode != HOST_INVENTORY_AUTOMATIC) {
     // those links are visible only in automatic mode
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:configuration.host.edit.php


示例6: get_items_data_overview

/**
 * Retrieve overview table object for items.
 *
 * @param $hostids
 * @param null $view_style
 *
 * @return CTableInfo
 */
function get_items_data_overview($hostids, $view_style)
{
    global $USER_DETAILS;
    $db_items = DBselect('SELECT DISTINCT h.hostid,h.name AS hostname,i.itemid,i.key_,i.value_type,i.lastvalue,i.units,i.lastclock,' . 'i.name,t.priority,i.valuemapid,t.value AS tr_value,t.triggerid' . ' FROM hosts h,items i' . ' LEFT JOIN functions f ON f.itemid=i.itemid' . ' LEFT JOIN triggers t ON t.triggerid=f.triggerid AND t.status=' . TRIGGER_STATUS_ENABLED . ' WHERE ' . dbConditionInt('h.hostid', $hostids) . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND h.hostid=i.hostid' . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND ' . dbConditionInt('i.flags', array(ZBX_FLAG_DISCOVERY_NORMAL, ZBX_FLAG_DISCOVERY_CREATED)) . ' ORDER BY i.name,i.itemid');
    $options = array('output' => array('name', 'hostid'), 'monitored_hosts' => true, 'hostids' => $hostids, 'with_monitored_items' => true, 'preservekeys' => true);
    if ($view_style == STYLE_LEFT) {
        $options['selectScreens'] = API_OUTPUT_COUNT;
        $options['selectInventory'] = array('hostid');
    }
    // fetch data for the host JS menu
    $hosts = API::Host()->get($options);
    $items = array();
    while ($row = DBfetch($db_items)) {
        $descr = itemName($row);
        $row['hostname'] = get_node_name_by_elid($row['hostid'], null, ': ') . $row['hostname'];
        $hostnames[$row['hostid']] = $row['hostname'];
        // a little tricky check for attempt to overwrite active trigger (value=1) with
        // inactive or active trigger with lower priority.
        if (!isset($items[$descr][$row['hostname']]) || ($items[$descr][$row['hostname']]['tr_value'] == TRIGGER_VALUE_FALSE && $row['tr_value'] == TRIGGER_VALUE_TRUE || ($items[$descr][$row['hostname']]['tr_value'] == TRIGGER_VALUE_FALSE || $row['tr_value'] == TRIGGER_VALUE_TRUE) && $row['priority'] > $items[$descr][$row['hostname']]['severity'])) {
            $items[$descr][$row['hostname']] = array('itemid' => $row['itemid'], 'value_type' => $row['value_type'], 'lastvalue' => $row['lastvalue'], 'lastclock' => $row['lastclock'], 'units' => $row['units'], 'name' => $row['name'], 'valuemapid' => $row['valuemapid'], 'severity' => $row['priority'], 'tr_value' => $row['tr_value'], 'triggerid' => $row['triggerid']);
        }
    }
    $table = new CTableInfo(_('No items defined.'));
    if (empty($hostnames)) {
        return $table;
    }
    $table->makeVerticalRotation();
    order_result($hostnames);
    if ($view_style == STYLE_TOP) {
        $header = array(new CCol(_('Items'), 'center'));
        foreach ($hostnames as $hostname) {
            $header[] = new CCol($hostname, 'vertical_rotation');
        }
        $table->setHeader($header, 'vertical_header');
        foreach ($items as $descr => $ithosts) {
            $tableRow = array(nbsp($descr));
            foreach ($hostnames as $hostname) {
                $tableRow = get_item_data_overview_cells($tableRow, $ithosts, $hostname);
            }
            $table->addRow($tableRow);
        }
    } else {
        $hostScripts = API::Script()->getScriptsByHosts(zbx_objectValues($hosts, 'hostid'));
        foreach ($hostScripts as $hostid => $scripts) {
            $hosts[$hostid]['scripts'] = $scripts;
        }
        $header = array(new CCol(_('Hosts'), 'center'));
        foreach ($items as $descr => $ithosts) {
            $header[] = new CCol($descr, 'vertical_rotation');
        }
        $table->setHeader($header, 'vertical_header');
        foreach ($hostnames as $hostid => $hostname) {
            $host = $hosts[$hostid];
            // host js menu link
            $hostSpan = new CSpan(nbsp($host['name']), 'link_menu menu-host');
            $hostSpan->setAttribute('data-menu', hostMenuData($host, $hostScripts[$host['hostid']]));
            $tableRow = array(new CCol($hostSpan));
            foreach ($items as $ithosts) {
                $tableRow = get_item_data_overview_cells($tableRow, $ithosts, $hostname);
            }
            $table->addRow($tableRow);
        }
    }
    return $table;
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:73,代码来源:items.inc.php


示例7: getUserGroupsByUserId

    $userid = CWebUser::$data['userid'];
    $userGroups = getUserGroupsByUserId($userid);
    $sql .= ' AND EXISTS (' . 'SELECT NULL' . ' FROM functions f,items i,hosts_groups hgg' . ' JOIN rights r' . ' ON r.id=hgg.groupid' . ' AND ' . dbConditionInt('r.groupid', $userGroups) . ' WHERE t.triggerid=f.triggerid' . ' AND f.itemid=i.itemid' . ' AND i.hostid=hgg.hostid' . ' GROUP BY f.triggerid' . ' HAVING MIN(r.permission)>' . PERM_DENY . ')';
}
$sql .= ' AND ' . dbConditionInt('t.flags', array(ZBX_FLAG_DISCOVERY_NORMAL, ZBX_FLAG_DISCOVERY_CREATED)) . ' GROUP BY e.objectid' . ' ORDER BY cnt_event desc';
$result = DBselect($sql, 100);
while ($row = DBfetch($result)) {
    $triggersEventCount[$row['objectid']] = $row['cnt_event'];
}
$triggers = API::Trigger()->get(array('triggerids' => array_keys($triggersEventCount), 'output' => array('triggerid', 'description', 'expression', 'priority', 'flags', 'url', 'lastchange'), 'selectItems' => array('hostid', 'name', 'value_type', 'key_'), 'selectHosts' => array('hostid'), 'expandDescription' => true, 'expandData' => true, 'preservekeys' => true, 'nopermissions' => true));
$hostIds = array();
foreach ($triggers as $triggerId => $trigger) {
    $hostIds[$trigger['hostid']] = $trigger['hostid'];
    $triggerItems = array();
    foreach ($trigger['items'] as $item) {
        $triggerItems[] = array('name' => itemName($item), 'params' => array('itemid' => $item['itemid'], 'action' => in_array($item['value_type'], array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64)) ? 'showgraph' : 'showvalues'));
    }
    $triggers[$triggerId]['items'] = $triggerItems;
    $triggers[$triggerId]['cnt_event'] = $triggersEventCount[$triggerId];
}
CArrayHelper::sort($triggers, array(array('field' => 'cnt_event', 'order' => ZBX_SORT_DOWN), 'host', 'description', 'priority'));
$hosts = API::Host()->get(array('output' => array('hostid'), 'hostids' => $hostIds, 'selectScreens' => API_OUTPUT_COUNT, 'preservekeys' => true));
$scripts = API::Script()->getScriptsByHosts($hostIds);
foreach ($triggers as $trigger) {
    $hostId = $trigger['hostid'];
    $hostName = new CSpan($trigger['hostname'], 'link_menu');
    $hostName->setMenuPopup(getMenuPopupHost($hosts[$hostId], $scripts[$hostId]));
    $triggerDescription = new CSpan($trigger['description'], 'link_menu');
    $triggerDescription->setMenuPopup(getMenuPopupTrigger($trigger, $trigger['items']));
    $table->addRow(array(get_node_name_by_elid($trigger['triggerid']), $hostName, $triggerDescription, getSeverityCell($trigger['priority']), $trigger['cnt_event']));
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:report5.php


示例8: getEventActionsStatus

 }
 // actions
 $actions = getEventActionsStatus(zbx_objectValues($events, 'eventid'));
 // events
 foreach ($events as $enum => $event) {
     $trigger = $triggers[$event['objectid']];
     $host = reset($trigger['hosts']);
     $host = $hosts[$host['hostid']];
     $items = array();
     foreach ($trigger['items'] as $item) {
         $i = array();
         $i['itemid'] = $item['itemid'];
         $i['value_type'] = $item['value_type'];
         // ZBX-3059: So it would be possible to show different caption for history for chars and numbers (KB)
         $i['action'] = str_in_array($item['value_type'], array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64)) ? 'showgraph' : 'showvalues';
         $i['name'] = itemName($item);
         $items[] = $i;
     }
     $ack = getEventAckState($event, true);
     $description = CEventHelper::expandDescription(zbx_array_merge($trigger, array('clock' => $event['clock'], 'ns' => $event['ns'])));
     $tr_desc = new CSpan($description, 'pointer');
     $tr_desc->addAction('onclick', "create_mon_trigger_menu(event, " . " [{'triggerid': '" . $trigger['triggerid'] . "', 'lastchange': '" . $event['clock'] . "'}]," . zbx_jsvalue($items, true) . ");");
     // duration
     if ($nextEvent = get_next_event($event, $events, $_REQUEST['showUnknown'])) {
         $event['duration'] = zbx_date2age($event['clock'], $nextEvent['clock']);
     } else {
         $event['duration'] = zbx_date2age($event['clock']);
     }
     $statusSpan = new CSpan(trigger_value2str($event['value']));
     // add colors and blinking to span depending on configuration and trigger parameters
     addTriggerValueStyle($statusSpan, $event['value'], $event['clock'], $event['acknowledged']);
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:events.php


示例9: CFormTable

// create filter
if ($this->data['action'] == 'showvalues' || $this->data['action'] == 'showlatest') {
    if (isset($this->data['iv_string'][$this->data['item']['value_type']])) {
        $filterForm = new CFormTable(null, null, 'get');
        $filterForm->setAttribute('name', 'zbx_filter');
        $filterForm->setAttribute('id', 'zbx_filter');
        $filterForm->addVar('action', $this->data['action']);
        $filterForm->addVar('itemid', zbx_toHash($_REQUEST['itemid']));
        $itemListbox = new CListBox('cmbitemlist[]');
        foreach ($this->data['items'] as $itemid => $item) {
            if (!isset($this->data['iv_string'][$item['value_type']])) {
                unset($this->data['items'][$itemid]);
                continue;
            }
            $host = reset($item['hosts']);
            $itemListbox->addItem($itemid, $host['name'] . ': ' . itemName($item));
        }
        $addItemButton = new CButton('add_log', _('Add'), "return PopUp('popup.php?multiselect=1&real_hosts=1" . '&reference=itemid&srctbl=items&value_types[]=' . $this->data['item']['value_type'] . "&srcfld1=itemid');");
        $deleteItemButton = null;
        if (count($this->data['items']) > 1) {
            insert_js_function('removeSelectedItems');
            $deleteItemButton = new CSubmit('remove_log', _('Remove selected'), "javascript: removeSelectedItems('cmbitemlist_', 'itemid')");
        }
        $filterForm->addRow(_('Items list'), array($itemListbox, BR(), $addItemButton, $deleteItemButton));
        $filterForm->addRow(_('Select rows with value like'), new CTextBox('filter', get_request('filter', ''), ZBX_TEXTBOX_FILTER_SIZE));
        $filterTask = get_request('filter_task', 0);
        $taskComboBox = new CComboBox('filter_task', $filterTask, 'submit()');
        $taskComboBox->addItem(FILTER_TASK_SHOW, _('Show selected'));
        $taskComboBox->addItem(FILTER_TASK_HIDE, _('Hide selected'));
        $taskComboBox->addItem(FILTER_TASK_MARK, _('Mark selected'));
        $taskComboBox->addItem(FILTER_TASK_INVERT_MARK, _('Mark others'));
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:monitoring.history.php


示例10: EXISTS

    $sql .= ' AND EXISTS (' . 'SELECT NULL' . ' FROM functions f,items i,hosts_groups hgg' . ' JOIN rights r' . ' ON r.id=hgg.groupid' . ' AND ' . dbConditionInt('r.groupid', $userGroups) . ' WHERE t.triggerid=f.triggerid' . ' AND f.itemid=i.itemid' . ' AND i.hostid=hgg.hostid' . ' GROUP BY f.triggerid' . ' HAVING MIN(r.permission)>=' . PERM_READ_ONLY . ')';
}
$sql .= ' AND ' . dbConditionInt('t.flags', array(ZBX_FLAG_DISCOVERY_NORMAL, ZBX_FLAG_DISCOVERY_CREATED)) . ' GROUP BY e.objectid' . ' ORDER BY cnt_event desc';
$result = DBselect($sql, 100);
while ($row = DBfetch($result)) {
    $triggersEventCount[$row['objectid']] = $row['cnt_event'];
}
$triggers = API::Trigger()->get(array('triggerids' => array_keys($triggersEventCount), 'output' => array('triggerid', 'description', 'expression', 'priority', 'flags', 'lastchange'), 'selectItems' => array('hostid', 'name', 'value_type', 'key_'), 'expandDescription' => true, 'expandData' => true, 'preservekeys' => true, 'nopermissions' => true));
$hosts = array();
foreach ($triggers as $tid => $trigger) {
    $hosts[$trigger['hostid']] = $trigger['hostid'];
    $trigger['cnt_event'] = $triggersEventCount[$tid];
    $items = $trigger['items'];
    $trigger['items'] = array();
    foreach ($items as $item) {
        $trigger['items'][$item['itemid']] = array('itemid' => $item['itemid'], 'action' => str_in_array($item['value_type'], array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64)) ? 'showgraph' : 'showvalues', 'name' => itemName($item), 'value_type' => $item['value_type']);
    }
    $triggers[$tid] = $trigger;
}
CArrayHelper::sort($triggers, array(array('field' => 'cnt_event', 'order' => ZBX_SORT_DOWN), 'host', 'description', 'priority'));
$scripts_by_hosts = API::Script()->getScriptsByHosts($hosts);
foreach ($triggers as $trigger) {
    $menus = '';
    $host_nodeid = id2nodeid($trigger['hostid']);
    foreach ($scripts_by_hosts[$trigger['hostid']] as $script) {
        $script_nodeid = id2nodeid($script['scriptid']);
        if (bccomp($host_nodeid, $script_nodeid) == 0) {
            $menus .= "['" . $script['name'] . "',\"javascript: openWinCentered('scripts_exec.php?execute=1&hostid=" . $trigger['hostid'] . "&scriptid=" . $script['scriptid'] . "','Global script',760,540,'titlebar=no, resizable=yes, scrollbars=yes, dialog=no');\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
        }
    }
    $menus .= "['" . _('URLs') . "',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:report5.php


示例11: getSeverityCell

            $table->addRow(array($proxy['host'], getSeverityCell(TRIGGER_SEVERITY_NOT_CLASSIFIED, $sec_10[$proxyid], !$sec_10[$proxyid]), getSeverityCell(TRIGGER_SEVERITY_INFORMATION, $sec_30[$proxyid], !$sec_30[$proxyid]), getSeverityCell(TRIGGER_SEVERITY_WARNING, $sec_60[$proxyid], !$sec_60[$proxyid]), getSeverityCell(TRIGGER_SEVERITY_AVERAGE, $sec_300[$proxyid], !$sec_300[$proxyid]), getSeverityCell(TRIGGER_SEVERITY_HIGH, $sec_600[$proxyid], !$sec_600[$proxyid]), getSeverityCell(TRIGGER_SEVERITY_DISASTER, $sec_rest[$proxyid], !$sec_rest[$proxyid])));
        }
    } else {
        if ($_REQUEST['config'] == 2) {
            $arr = array();
            $table->setHeader(array(_('Next check'), _('Delayed by'), is_show_all_nodes() ? _('Node') : null, _('Host'), _('Name')));
            while ($row = DBfetch($result)) {
                $res = calculateItemNextcheck($row['interfaceid'], $row['itemid'], $row['type'], $row['delay'], $row['delay_flex'], $row['lastclock']);
                if (0 != $row['proxy_hostid'] && 0 != $res['delay']) {
                    $res['nextcheck'] = $row['lastclock'] + $res['delay'];
                }
                $diff = $now - $res['nextcheck'];
                if ($diff <= 5) {
                    continue;
                }
                $arr[] = array($res['nextcheck'], $row['hostid'], $row['hostname'], itemName($row));
            }
            $rows = 0;
            sort($arr);
            foreach ($arr as $r) {
                $rows++;
                if ($rows > 500) {
                    $truncated = true;
                    break;
                }
                $table->addRow(array(zbx_date2str(QUEUE_NODES_DATE_FORMAT, $r[0]), zbx_date2age($r[0]), get_node_name_by_elid($r[1]), $r[2], $r[3]));
            }
        }
    }
}
$queue_wdgt->addItem($table);
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:queue.php


示例12: getSeverityCell

        }
        $table->addRow(array($proxy['host'], getSeverityCell(TRIGGER_SEVERITY_NOT_CLASSIFIED, $proxyData['delay5'], !$proxyData['delay5']), getSeverityCell(TRIGGER_SEVERITY_INFORMATION, $proxyData['delay10'], !$proxyData['delay10']), getSeverityCell(TRIGGER_SEVERITY_WARNING, $proxyData['delay30'], !$proxyData['delay30']), getSeverityCell(TRIGGER_SEVERITY_AVERAGE, $proxyData['delay60'], !$proxyData['delay60']), getSeverityCell(TRIGGER_SEVERITY_HIGH, $proxyData['delay300'], !$proxyData['delay300']), getSeverityCell(TRIGGER_SEVERITY_DISASTER, $proxyData['delay600'], !$proxyData['delay600'])));
    }
} elseif ($config == QUEUE_DETAILS) {
    $queueData = zbx_toHash($queueData, 'itemid');
    $items = API::Item()->get(array('output' => array('itemid', 'name', 'key_'), 'selectHosts' => array('name'), 'itemids' => array_keys($queueData), 'webitems' => true, 'preservekeys' => true));
    $table->setHeader(array(_('Scheduled check'), _('Delayed by'), is_show_all_nodes() ? _('Node') : null, _('Host'), _('Name')));
    $i = 0;
    foreach ($queueData as $itemData) {
        if (!isset($items[$itemData['itemid']])) {
            continue;
        }
        // display only the first 500 items
        $i++;
        if ($i > QUEUE_DETAIL_ITEM_COUNT) {
            break;
        }
        $item = $items[$itemData['itemid']];
        $host = reset($item['hosts']);
        $table->addRow(array(zbx_date2str(QUEUE_NODES_DATE_FORMAT, $itemData['nextcheck']), zbx_date2age($itemData['nextcheck']), get_node_name_by_elid($item['itemid']), $host['name'], itemName($item)));
    }
}
$queueWidget->addItem($table);
$queueWidget->show();
// display the table footer
if ($config == QUEUE_OVERVIEW_BY_PROXY) {
    show_table_header(_('Total') . ': ' . $table->getNumRows());
} elseif ($config == QUEUE_DETAILS) {
    show_table_header(_('Total') . ': ' . $table->getNumRows() . (count($queueData) > QUEUE_DETAIL_ITEM_COUNT ? ' (' . _('Truncated') . ')' : ''));
}
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:queue.php


示例13: get_trigger_overview_cells

/**
 * Creates and returns a trigger status cell for the trigger overview table.
 *
 * @see get_triggers_overview()
 *
 * @param array $triggerHosts	an array with the data about the trigger for each host
 * @param string $hostName		the name of the cells corresponding host
 * @param string $screenId
 *
 * @return CCol
 */
function get_trigger_overview_cells($triggerHosts, $hostName, $screenId = null)
{
    $ack = null;
    $css_class = null;
    $desc = array();
    $config = select_config();
    // for how long triggers should blink on status change (set by user in administration->general)
    if (isset($triggerHosts[$hostName])) {
        // problem trigger
        if ($triggerHosts[$hostName]['value'] == TRIGGER_VALUE_TRUE) {
            $css_class = getSeverityStyle($triggerHosts[$hostName]['priority']);
            $ack = null;
            if ($config['event_ack_enable'] == 1) {
                $event = get_last_event_by_triggerid($triggerHosts[$hostName]['triggerid']);
                if ($event) {
                    if ($screenId) {
                        global $page;
                        $ack_menu = array(_('Acknowledge'), 'acknow.php?eventid=' . $event['eventid'] . '&screenid=' . $screenId . '&backurl=' . $page['file']);
                    } else {
                        $ack_menu = array(_('Acknowledge'), 'acknow.php?eventid=' . $event['eventid'] . '&backurl=overview.php', array('tw' => '_blank'));
                    }
                    if ($event['acknowledged'] == 1) {
                        $ack = new CImg('images/general/tick.png', 'ack');
                    }
                }
            }
        } else {
            $css_class = 'normal';
        }
        $style = 'cursor: pointer; ';
        // set blinking gif as background if trigger age is less then $config['blink_period']
        if ($config['blink_period'] > 0 && time() - $triggerHosts[$hostName]['lastchange'] < $config['blink_period']) {
            $style .= 'background-image: url(images/gradients/blink.gif); background-position: top left; background-repeat: repeat;';
        }
        unset($item_menu);
        $tr_ov_menu = array(array(_('Trigger'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(_('Events'), 'events.php?triggerid=' . $triggerHosts[$hostName]['triggerid'], array('tw' => '_blank')));
        if (isset($ack_menu)) {
            $tr_ov_menu[] = $ack_menu;
        }
        $dbItems = DBselect('SELECT DISTINCT i.itemid,i.name,i.key_,i.value_type' . ' FROM items i,functions f' . ' WHERE f.itemid=i.itemid' . ' AND f.triggerid=' . $triggerHosts[$hostName]['triggerid']);
        while ($item = DBfetch($dbItems)) {
            $description = itemName($item);
            switch ($item['value_type']) {
                case ITEM_VALUE_TYPE_UINT64:
                case ITEM_VALUE_TYPE_FLOAT:
                    $action = 'showgraph';
                    $status_bar = _('Show graph of item') . ' \'' . $description . '\'';
                    break;
                case ITEM_VALUE_TYPE_LOG:
                case ITEM_VALUE_TYPE_STR:
                case ITEM_VALUE_TYPE_TEXT:
                default:
                    $action = 'showlatest';
                    $status_bar = _('Show values of item') . ' \'' . $description . '\'';
                    break;
            }
            if (zbx_strlen($description) > 25) {
                $description = zbx_substr($description, 0, 22) . '...';
            }
            $item_menu[$action][] = array($description, 'history.php?action=' . $action . '&itemid=' . $item['itemid'] . '&period=3600', array('tw' => '', 'sb' => $status_bar));
        }
        if (isset($item_menu['showgraph'])) {
            $tr_ov_menu[] = array(_('Graphs'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader')));
            $tr_ov_menu = array_merge($tr_ov_menu, $item_menu['showgraph']);
        }
        if (isset($item_menu['showlatest'])) {
            $tr_ov_menu[] = array(_('Values'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader')));
            $tr_ov_menu = array_merge($tr_ov_menu, $item_menu['showlatest']);
        }
        unset($item_menu);
        // dependency: triggers on which depends this
        $triggerid = !empty($triggerHosts[$hostName]['triggerid']) ? $triggerHosts[$hostName]['triggerid'] : 0;
        $dep_table = new CTableInfo();
        $dep_table->setAttribute('style', 'width: 200px;');
        $dep_table->addRow(bold(_('Depends on') . ':'));
        $dependency = false;
        $dep_res = DBselect('SELECT td.* FROM trigger_depends td WHERE td.triggerid_down=' . $triggerid);
        while ($dep_row = DBfetch($dep_res)) {
            $dep_table->addRow(SPACE . '-' . SPACE . CTriggerHelper::expandDescriptionById($dep_row['triggerid_up']));
            $dependency = true;
        }
        if ($dependency) {
            $img = new Cimg('images/general/arrow_down2.png', 'DEP_DOWN');
            $img->setAttribute('style', 'vertical-align: middle; border: 0px;');
            $img->setHint($dep_table, '', '', false);
            array_push($desc, $img);
        }
        unset($img, $dep_table, $dependency);
        // triggers that depend on this
//.........这里部分代码省略.........
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:101,代码来源:triggers.inc.php


示例14: get_request

$dstfld1 = get_request('dstfld1', '');
$itemid = get_request('itemid', 0);
$value = get_request('value', 0);
$param = get_request('param', 0);
$paramtype = get_request('paramtype');
if (!isset($function)) {
    $function = 'last[=]';
    $expr_type = $function;
}
if ($itemid) {
    $items_data = API::Item()->get(array('output' => API_OUTPUT_EXTEND, 'itemids' => $itemid, 'webitems' => true, 'selectHosts' => API_OUTPUT_EXTEND, 'filter' => array('flags' => null)));
    $item_data = reset($items_data);
    $item_key = $item_data['key_'];
    $item_host = reset($item_data['hosts']);
    $item_host = $item_host['host'];
    $description = $item_host . ':' . itemName($item_data);
} else {
    $item_key = $item_host = $description = '';
}
if (is_null($paramtype) && isset($functions[$expr_type]['params']['M'])) {
    $paramtype = is_array($functions[$expr_type]['params']['M']) ? reset($functions[$expr_type]['params']['M']) : $functions[$expr_type]['params']['M'];
} elseif (is_null($paramtype)) {
    $paramtype = PARAM_TYPE_SECONDS;
}
if (!is_array($param)) {
    if (isset($functions[$expr_type]['params'])) {
        $param = explode(',', $param, count($functions[$expr_type]['params']));
    } else {
        $param = array($param);
    }
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:popup_trexpr.php


示例15: array

    $graphFormList->addRow(_('Y axis MIN value'), $yaxisMinData);
    $yaxisMaxData = array();
    $yTypeComboBox = new CComboBox('ymax_type', $this->data['ymax_type'], 'submit()');
    $yTypeComboBox->addItem(GRAPH_YAXIS_TYPE_CALCULATED, _('Calculated'));
    $yTypeComboBox->addItem(GRAPH_YAXIS_TYPE_FIXED, _('Fixed'));
    $yTypeComboBox->addItem(GRAPH_YAXIS_TYPE_ITEM_VALUE, _('Item'));
    $yaxisMaxData[] = $yTypeComboBox;
    if ($this->data['ymax_type'] == GRAPH_YAXIS_TYPE_FIXED) {
        $yaxisMaxData[] = new CTextBox('yaxismax', $this->data['yaxismax'], 7);
    } elseif ($this->data['ymax_type'] == GRAPH_YAXIS_TYPE_ITEM_VALUE) {
        $graphForm->addVar('yaxismax', $this->data['yaxismax']);
        $ymax_name = '';
        if (!empty($this->data['ymax_itemid'])) {
            $max_host = get_host_by_itemid($this->data['ymax_itemid']);
            $max_item = get_item_by_itemid($this->data['ymax_itemid']);
            $ymax_name = $max_host['name'] . NAME_DELIMITER . itemName($max_item);
        }
        $yaxisMaxData[] = new CTextBox('ymax_name', $ymax_name, 36, 'yes');
        $yaxisMaxData[] = new CButton('yaxis_max', _('Select'), 'javascript: ' . 'return PopUp("popup.php?dstfrm=' . $graphForm->getName() . '&dstfld1=ymax_itemid' . '&dstfld2=ymax_name' . '&srctbl=items' . '&srcfld1=itemid' . '&srcfld2=name' . '&numeric=1' . '&writeonly=1" + getOnlyHostParam(), 0, 0, "zbx_popup_item");', 'formlist');
        // select prototype button
        if (!empty($this->data['parent_discoveryid'])) {
            $yaxisMaxData[] = new CButton('yaxis_max_prototype', _('Select prototype'), 'javascript: ' . 'return PopUp("popup.php?dstfrm=' . $graphForm->getName() . '&parent_discoveryid=' . $this->data['parent_discoveryid'] . '&dstfld1=ymax_itemid' . '&dstfld2=ymax_name' . '&srctbl=prototypes' . '&srcfld1=itemid' . '&srcfld2=name' . '&numeric=1", 0, 0, "zbx_popup_item");', 'formlist');
        }
    } else {
        $graphForm->addVar('yaxismax', $this->data['yaxismax']);
    }
    $graphFormList->addRow(_('Y axis MAX value'), $yaxisMaxData);
} else {
    $graphFormList->addRow(_('3D view'), new CCheckBox('show_3d', $this->data['show_3d'], null, 1));
}
$graphFormList->addRow(_('Items'), new CDiv($itemsTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:configuration.graph.edit.php


示例16: get_request

$dstfld1 = get_request('dstfld1', '');
$itemId = get_request('itemid', 0);
$value = get_request('value', 0);
$param = get_request('param', 0);
$paramType = get_request('paramtype');
if (!isset($function)) {
    $function = 'last[=]';
    $exprType = $function;
}
if ($itemId) {
    $items = API::Item()->get(array('output' => array('itemid', 'key_', 'name'), 'itemids' => $itemId, 'webitems' => true, 'selectHosts' => array('host'), 'filter' => array('flags' => null)));
    $item = reset($items);
    $itemKey = $item['key_'];
    $itemHost = reset($item['hosts']);
    $itemHost = $itemHost['host'];
    $description = $itemHost . NAME_DELIMITER . itemName($item);
} else {
    $itemKey = $itemHost = $description = '';
}
if (is_null($paramType) && isset($functions[$exprType]['params']['M'])) {
    $paramType = is_array($functions[$exprType]['params']['M']) ? reset($functions[$exprType]['params']['M']) : $functions[$exprType]['params']['M'];
} elseif (is_null($paramType)) {
    $paramType = PARAM_TYPE_TIME;
}
if (!is_array($param)) {
    if (isset($functions[$exprType]['params'])) {
        $param = explode(',', $param, count($functions[$exprType]['params']));
    } else {
        $param = array($param);
    }
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:popup_trexpr.php


示例17: CTableInfo

$discoveryForm->setName('discovery');
$discoveryForm->addVar('hostid', $this->data['hostid']);
// create table
$discoveryTable = new CTableInfo(_('No discovery rules found.'));
$sortLink = new CUrl();
$sortLink->setArgument('hostid', $this->data['hostid']);
$sortLink = $sortLink->getUrl();
$discoveryTable->setHeader(array(new CCheckBox('all_items', null, "checkAll('" . $discoveryForm->getName() . "', 'all_items', 'g_hostdruleid');"), make_sorting_header(_('Name'), 'name', $sortLink), _('Items'), _('Triggers'), _('Graphs'), $data['host']['flags'] == ZBX_FLAG_DISCOVERY_NORMAL ? _('Hosts') : null, make_sorting_header(_('Key'), 'key_', $sortLink), make_sorting_header(_('Interval'), 'delay', $sortLink), make_sorting_header(_('Type'), 'type', $sortLink), make_sorting_header(_('Status'), 'status', $sortLink), $data['showErrorColumn'] ? _('Error') : null));
foreach ($data['discoveries'] as $discovery) {
    $description = array();
    if ($discovery['templateid']) {
        $template_host = get_realhost_by_itemid($discovery['templateid']);
        $description[] = new CLink($template_host['name'], '?hostid=' . $template_host['hostid'], 'unknown');
        $description[] = NAME_DELIMITER;
    }
    $discovery['name_expanded'] = itemName($discovery);
    $description[] = new CLink($discovery['name_expanded'], '?form=update&itemid=' . $discovery['itemid']);
    $status = new CLink(itemIndicator($discovery['status'], $discovery['state']), '?hostid=' . $_REQUEST['hostid'] . '&g_hostdruleid=' . $discovery['itemid'] . '&go=' . ($discovery['status'] ? 'activate' : 'disable'), itemIndicatorStyle($discovery['status'], $discovery['state']));
    if ($data['showErrorColumn']) {
        $error = '';
        if ($discovery['status'] == ITEM_STATUS_ACTIVE) {
            if (zbx_empty($discovery['error'])) {
                $error = new CDiv(SPACE, 'status_icon iconok');
            } else {
                $error = new CDiv(SPACE, 'status_icon iconerror');
                $error->setHint($discovery['error'], '', 'on');
            }
        }
    }
    // host prototype link
    $hostPrototypeLink = null;
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:configuration.host.discovery.list.php


示例18: array

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP item_description函数代码示例发布时间:2022-05-15
下一篇:
PHP item函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap