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

PHP get_host_by_hostid函数代码示例

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

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



在下文中一共展示了get_host_by_hostid函数的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: addItem

 public function addItem($itemid, $calc_fnc = CALC_FNC_AVG, $color = null, $type = null)
 {
     $items = CMacrosResolverHelper::resolveItemNames(array(get_item_by_itemid($itemid)));
     $this->items[$this->num] = reset($items);
     $host = get_host_by_hostid($this->items[$this->num]['hostid']);
     $this->items[$this->num]['host'] = $host['host'];
     $this->items[$this->num]['hostname'] = $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:itnihao,项目名称:zatree-2.2,代码行数:12,代码来源:CPieGraphDraw.php


示例3: addItem

 public function addItem($itemid, $axis = GRAPH_YAXIS_SIDE_RIGHT, $calc_fnc = CALC_FNC_AVG, $color = null, $drawtype = null, $type = null, $periods_cnt = null)
 {
     if ($this->type == GRAPH_TYPE_STACKED) {
         $drawtype = GRAPH_ITEM_DRAWTYPE_FILLED_REGION;
     }
     $this->items[$this->num] = get_item_by_itemid($itemid);
     $this->items[$this->num]['description'] = item_description($this->items[$this->num]);
     $host = get_host_by_hostid($this->items[$this->num]['hostid']);
     $this->items[$this->num]['host'] = $host['host'];
     $this->items[$this->num]['color'] = is_null($color) ? 'Dark Green' : $color;
     $this->items[$this->num]['drawtype'] = is_null($drawtype) ? GRAPH_ITEM_DRAWTYPE_LINE : $drawtype;
     $this->items[$this->num]['axisside'] = is_null($axis) ? GRAPH_YAXIS_SIDE_RIGHT : $axis;
     $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->items[$this->num]['periods_cnt'] = is_null($periods_cnt) ? 0 : $periods_cnt;
     if ($this->items[$this->num]['axisside'] == GRAPH_YAXIS_SIDE_LEFT) {
         $this->yaxisleft = 1;
     }
     if ($this->items[$this->num]['axisside'] == GRAPH_YAXIS_SIDE_RIGHT) {
         $this->yaxisright = 1;
     }
     //		SDI($this->items);
     $this->num++;
 }
开发者ID:phedders,项目名称:zabbix,代码行数:24,代码来源:class.cchart.php


示例4: get_resource_name

function get_resource_name($permission, $id)
{
    $res = '-';
    if ($permission == 'Graph') {
        if (isset($id) && $id != 0) {
            if ($graph = get_graph_by_graphid($id)) {
                $res = $graph['name'];
            }
        } else {
            if (!isset($id) || $id == 0) {
                $res = 'All graphs';
            }
        }
    } else {
        if ($permission == 'Host') {
            if (isset($id) && $id != 0) {
                if ($host = get_host_by_hostid($id)) {
                    $res = $host['host'];
                }
            } else {
                if (!isset($id) || $id == 0) {
                    $res = 'All hosts';
                }
            }
        } else {
            if ($permission == 'Screen') {
                if (isset($id) && $id != 0) {
                    if ($screen = get_screen_by_screenid($id)) {
                        $res = $screen['name'];
                    }
                } else {
                    if (!isset($id) || $id == 0) {
                        $res = 'All screens';
                    }
                }
            } else {
                if ($permission == 'Item') {
                    if (isset($id) && $id != 0) {
                        if ($item = get_item_by_itemid($id)) {
                            if ($host = get_host_by_hostid($item['hostid'])) {
                                $res = $host['host'] . ':' . $item['description'];
                            }
                        }
                    } else {
                        if (!isset($id) || $id == 0) {
                            $res = 'All items';
                        }
                    }
                } else {
                    if ($permission == 'User') {
                        if (isset($id) && $id != 0) {
                            if ($user = get_user_by_userid($id)) {
                                $res = $user['alias'];
                            }
                        } else {
                            if (!isset($id) || $id == 0) {
                                $res = 'All users';
                            }
                        }
                    } else {
                        if ($permission == 'Network map') {
                            if (isset($id) && $id != 0) {
                                if ($user = get_sysmap_by_sysmapid($id)) {
                                    $res = $user['name'];
                                }
                            } else {
                                if (!isset($id) || $id == 0) {
                                    $res = 'All maps';
                                }
                            }
                        } else {
                            if ($permission == 'Application') {
                                if (isset($id) && $id > 0) {
                                    if ($app = get_application_by_applicationid($id)) {
                                        $res = $app['name'];
                                    }
                                } else {
                                    if (!isset($id) || $id == 0) {
                                        $res = 'All applications';
                                    }
                                }
                            } else {
                                if ($permission == 'Service') {
                                    if (isset($id) && $id > 0) {
                                        if ($service = get_service_by_serviceid($id)) {
                                            $res = $service['name'];
                                        }
                                    } else {
                                        if (!isset($id) || $id == 0) {
                                            $res = 'All services';
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
//.........这里部分代码省略.........
开发者ID:rennhak,项目名称:zabbix,代码行数:101,代码来源:config.inc.php


示例5: dirname

    require_once dirname(__FILE__) . '/include/page_footer.php';
    exit;
}
/*
 * Display
 */
$data = array('hostid' => getRequest('hostid', 0), 'fullscreen' => $_REQUEST['fullscreen'], 'screenid' => getRequest('screenid', CProfile::get('web.hostscreen.screenid', null)), 'period' => getRequest('period'), 'stime' => getRequest('stime'));
CProfile::update('web.hostscreen.screenid', $data['screenid'], PROFILE_TYPE_ID);
// get screen list
$data['screens'] = API::TemplateScreen()->get(array('hostids' => $data['hostid'], 'output' => API_OUTPUT_EXTEND));
$data['screens'] = zbx_toHash($data['screens'], 'screenid');
order_result($data['screens'], 'name');
// get screen
$screenid = null;
if (!empty($data['screens'])) {
    $screen = !isset($data['screens'][$data['screenid']]) ? reset($data['screens']) : $data['screens'][$data['screenid']];
    if (!empty($screen['screenid'])) {
        $screenid = $screen['screenid'];
    }
}
$data['screen'] = API::TemplateScreen()->get(array('screenids' => $screenid, 'hostids' => $data['hostid'], 'output' => API_OUTPUT_EXTEND, 'selectScreenItems' => API_OUTPUT_EXTEND));
$data['screen'] = reset($data['screen']);
// get host
if (!empty($data['screen']['hostid'])) {
    $data['host'] = get_host_by_hostid($data['screen']['hostid']);
}
// render view
$screenView = new CView('monitoring.hostscreen', $data);
$screenView->render();
$screenView->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:host_screen.php


示例6: Exception

            $httpTest['http_password'] = '';
        }
        if (isset($_REQUEST['httptestid'])) {
            $httpTest['httptestid'] = $httptestid = $_REQUEST['httptestid'];
            $result = API::WebCheck()->update($httpTest);
            if (!$result) {
                throw new Exception();
            }
        } else {
            $result = API::WebCheck()->create($httpTest);
            if (!$result) {
                throw new Exception();
            }
            $httptestid = reset($result['httptestids']);
        }
        $host = get_host_by_hostid($_REQUEST['hostid']);
        add_audit($action, AUDIT_RESOURCE_SCENARIO, _('Scenario') . ' [' . $_REQUEST['name'] . '] [' . $httptestid . '] ' . _('Host') . ' [' . $host['host'] . ']');
        unset($_REQUEST['httptestid'], $_REQUEST['form']);
        show_messages(true, $message_true);
        DBend(true);
    } catch (Exception $e) {
        DBend(false);
        show_messages(false, null, $message_false);
    }
} elseif ($_REQUEST['go'] == 'activate' && isset($_REQUEST['group_httptestid'])) {
    $go_result = false;
    $group_httptestid = $_REQUEST['group_httptestid'];
    foreach ($group_httptestid as $id) {
        if (!($httptest_data = get_httptest_by_httptestid($id))) {
            continue;
        }
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:httpconf.php


示例7: DBend

                    				}*/
                }
                $result = DBend($result);
                show_messages(true, S_GROUP_DELETED, S_CANNOT_DELETE_GROUP);
            } else {
                if (str_in_array($_REQUEST['go'], array('activate', 'disable'))) {
                    $result = true;
                    $status = $_REQUEST['go'] == 'activate' ? HOST_STATUS_MONITORED : HOST_STATUS_NOT_MONITORED;
                    $groups = get_request('groups', array());
                    $db_hosts = DBselect('select h.hostid, hg.groupid ' . ' from hosts_groups hg, hosts h' . ' where h.hostid=hg.hostid ' . ' and h.status in (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ')' . ' and ' . DBin_node('h.hostid'));
                    DBstart();
                    while ($db_host = DBfetch($db_hosts)) {
                        if (!uint_in_array($db_host['groupid'], $groups)) {
                            continue;
                        }
                        $host = get_host_by_hostid($db_host['hostid']);
                        $result &= update_host_status($db_host['hostid'], $status);
                        /*			add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_HOST,
                        				'Old status ['.$host['status'].'] '.'New status ['.$status.']');*/
                    }
                    $result = DBend($result);
                    show_messages($result, S_HOST_STATUS_UPDATED, S_CANNOT_UPDATE_HOST);
                    unset($_REQUEST['activate']);
                }
            }
        }
    }
}
/*** --->>> ACTIONS <<<--- ***/
$frmForm = new CForm();
$frmForm->setMethod('get');
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:hostgroups.php


示例8: show_messages

        }
        show_messages($result, _('Application deleted'), _('Cannot delete application'));
    }
} elseif (hasRequest('action') && getRequest('action') == 'application.massdelete' && hasRequest('applications')) {
    $result = true;
    $applications = getRequest('applications');
    $deleted = 0;
    DBstart();
    $dbApplications = DBselect('SELECT a.applicationid,a.name,a.hostid' . ' FROM applications a' . ' WHERE ' . dbConditionInt('a.applicationid', $applications));
    while ($dbApplication = DBfetch($dbApplications)) {
        if (!isset($applications[$dbApplication['applicationid']])) {
            continue;
        }
        $result &= (bool) API::Application()->delete(array($dbApplication['applicationid']));
        if ($result) {
            $host = get_host_by_hostid($dbApplication['hostid']);
            add_audit(AUDIT_ACTION_DELETE, AUDIT_RESOURCE_APPLICATION, 'Application [' . $dbApplication['name'] . '] from host [' . $host['host'] . ']');
        }
        $deleted++;
    }
    $result = DBend($result);
    if ($result) {
        uncheckTableRows($pageFilter->hostid);
    }
    show_messages($result, _n('Application deleted', 'Applications deleted', $deleted), _n('Cannot delete application', 'Cannot delete applications', $deleted));
} elseif (hasRequest('applications') && str_in_array(getRequest('action'), array('application.massenable', 'application.massdisable'))) {
    $enableApplicationItems = getRequest('action') === 'application.massenable';
    $applications = API::Application()->get(array('output' => array(), 'applicationids' => getRequest('applications', array()), 'selectItems' => array('itemid'), 'hostids' => $pageFilter->hostid > 0 ? $pageFilter->hostid : null));
    $actionSuccessful = true;
    $updatedItemCount = 0;
    DBstart();
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:applications.php


示例9: copyItemsToHosts

        $go_result = copyItemsToHosts($_REQUEST['group_itemid'], $hosts_ids);
        $go_result = DBend($go_result);
        show_messages($go_result, _('Items copied'), _('Cannot copy items'));
        $_REQUEST['go'] = 'none2';
    } else {
        show_error_message(_('No target selected.'));
    }
} elseif ($_REQUEST['go'] == 'clean_history' && isset($_REQUEST['group_itemid'])) {
    DBstart();
    $go_result = delete_history_by_itemid($_REQUEST['group_itemid']);
    DBexecute('UPDATE items SET lastvalue=null,lastclock=null,prevvalue=null WHERE ' . dbConditionInt('itemid', $_REQUEST['group_itemid']));
    foreach ($_REQUEST['group_itemid'] as $id) {
        if (!($item = get_item_by_itemid($id))) {
            continue;
        }
        $host = get_host_by_hostid($item['hostid']);
        add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_ITEM, _('Item') . ' [' . $item['key_'] . '] [' . $id . '] ' . _('Host') . ' [' . $host['host'] . '] ' . _('History cleared'));
    }
    $go_result = DBend($go_result);
    show_messages($go_result, _('History cleared'), $go_result);
} elseif ($_REQUEST['go'] == 'delete' && isset($_REQUEST['group_itemid'])) {
    DBstart();
    $group_itemid = $_REQUEST['group_itemid'];
    $itemsToDelete = API::Item()->get(array('output' => array('key_', 'itemid'), 'selectHosts' => array('name'), 'itemids' => $group_itemid, 'preservekeys' => true));
    $go_result = API::Item()->delete($group_itemid);
    if ($go_result) {
        foreach ($itemsToDelete as $item) {
            $host = reset($item['hosts']);
            add_audit(AUDIT_ACTION_DELETE, AUDIT_RESOURCE_ITEM, _('Item') . ' [' . $item['key_'] . '] [' . $item['itemid'] . '] ' . _('Host') . ' [' . $host['name'] . ']');
        }
    }
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:items.php


示例10: getItemListFormat

 public function getItemListFormat($list = array())
 {
     $itemList = $list['list_item'];
     $parame = $list['parame'];
     $search_key = $parame['item_name_search'];
     $order_result_list = array();
     $search = 0;
     if (empty($search_key)) {
         $search_key_list = array();
     } else {
         $search_key_list = explode(",", $search_key);
     }
     if (count($search_key_list) >= 1) {
         $search = 1;
     }
     foreach ($itemList as $each_item) {
         $each_item = (array) $each_item;
         $item = get_item_by_itemid($each_item['itemid']);
         $newItem = $item;
         // $newItem['name'] = itemName($item);
         $newItem['name'] = $item['name'];
         $newItem['delay'] = getItemDelay($item['delay'], $item['delay_flex']);
         $host = get_host_by_hostid($item['hostid']);
         $newItem['hostname'] = $host['name'];
         if (strpos($item['units'], ',') !== false) {
             list($newItem['units'], $newItem['unitsLong']) = explode(',', $item['units']);
         } else {
             $newItem['unitsLong'] = '';
         }
         if ($search == 0) {
             $newItem['graphid'] = $each_item['graphid'];
             $order_result_list[$newItem['graphid']] = array("graphid" => $newItem['graphid'], "itemname" => $newItem['name'], "lastvalue" => 0, 'min' => 0, 'avg' => 0, 'max' => 0, 'hostname' => $newItem['hostname'], 'chazhi' => 0);
         } else {
             foreach ($search_key_list as $each_search_key) {
                 $each_search_key = trim($each_search_key);
                 //按关键字进行筛选
                 if (strpos(strtolower($newItem['name']), strtolower($each_search_key)) === false) {
                     //echo "bupipei<br>";
                 } else {
                     $newItem['calc_fnc'] = is_null($each_item['calc_fnc']) ? CALC_FNC_AVG : $each_item->calc_fnc;
                     $newItem['calc_type'] = GRAPH_ITEM_SIMPLE;
                     $newItem['graphid'] = $each_item['graphid'];
                     $item_info_new = array_merge($newItem, $parame);
                     $data = self::GetItemValues($item_info_new);
                     if (isset($data) && isset($data['min'])) {
                         $lastvalue = convert_units(self::getLastValueBy($data), $newItem['units'], ITEM_CONVERT_NO_UNITS);
                         $min = convert_units(min($data['min']), $newItem['units'], ITEM_CONVERT_NO_UNITS);
                         $avg = convert_units($data['avg_orig'], $newItem['units'], ITEM_CONVERT_NO_UNITS);
                         $max = convert_units(max($data['max']), $newItem['units'], ITEM_CONVERT_NO_UNITS);
                         //return array("lastvalue"=>$lastvalue,'min'=>$min,'avg'=>$avg,'max'=>$max);
                         $order_result_list[$each_search_key][$newItem['graphid']] = array("graphid" => $newItem['graphid'], "itemname" => $newItem['name'], "lastvalue" => self::getLastValueBy($data), 'min' => min($data['min']), 'avg' => $data['avg_orig'], 'max' => max($data['max']), 'hostname' => $newItem['hostname'], 'chazhi' => max($data['max']) - min($data['min']));
                     } else {
                         $order_result_list[$each_search_key][$newItem['graphid']] = array("graphid" => $newItem['graphid'], "itemname" => $newItem['name'], "lastvalue" => 0, 'min' => 0, 'avg' => 0, 'max' => 0, 'hostname' => $newItem['hostname'], 'chazhi' => 0);
                     }
                     break;
                 }
             }
         }
     }
     return $order_result_list;
 }
开发者ID:h3llowor1d,项目名称:zabbix,代码行数:61,代码来源:CItemValue.php


示例11: addItem

 public function addItem($itemid, $axis = GRAPH_YAXIS_SIDE_DEFAULT, $calc_fnc = CALC_FNC_AVG, $color = null, $drawtype = null)
 {
     if ($this->type == GRAPH_TYPE_STACKED) {
         $drawtype = GRAPH_ITEM_DRAWTYPE_FILLED_REGION;
     }
     $items = CMacrosResolverHelper::resolveItemNames(array(get_item_by_itemid($itemid)));
     $item = reset($items);
     $item['name'] = $item['name_expanded'];
     $this->items[$this->num] = $item;
     $this->items[$this->num]['delay'] = getItemDelay($item['delay'], $item['delay_flex']);
     if (strpos($item['units'], ',') === false) {
         $this->items[$this->num]['unitsLong'] = '';
     } else {
         list($this->items[$this->num]['units'], $this->items[$this->num]['unitsLong']) = explode(',', $item['units']);
     }
     $host = get_host_by_hostid($item['hostid']);
     $this->items[$this->num]['host'] = $host['host'];
     $this->items[$this->num]['hostname'] = $host['name'];
     $this->items[$this->num]['color'] = is_null($color) ? 'Dark Green' : $color;
     $this->items[$this->num]['drawtype'] = is_null($drawtype) ? GRAPH_ITEM_DRAWTYPE_LINE : $drawtype;
     $this->items[$this->num]['axisside'] = is_null($axis) ? GRAPH_YAXIS_SIDE_DEFAULT : $axis;
     $this->items[$this->num]['calc_fnc'] = is_null($calc_fnc) ? CALC_FNC_AVG : $calc_fnc;
     $this->items[$this->num]['calc_type'] = GRAPH_ITEM_SIMPLE;
     if ($this->items[$this->num]['axisside'] == GRAPH_YAXIS_SIDE_LEFT) {
         $this->yaxisleft = 1;
     }
     if ($this->items[$this->num]['axisside'] == GRAPH_YAXIS_SIDE_RIGHT) {
         $this->yaxisright = 1;
     }
     $this->num++;
 }
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:CLineGraphDraw.php


示例12: copy_graph_to_host

function copy_graph_to_host($graphid, $hostid, $copy_mode = false)
{
    $result = false;
    $gitems = array();
    $db_graph_items = get_graphitems_by_graphid($graphid);
    while ($db_gitem = DBfetch($db_graph_items)) {
        $gitems[] = array('itemid' => $db_gitem['itemid'], 'color' => $db_gitem['color'], 'drawtype' => $db_gitem['drawtype'], 'sortorder' => $db_gitem['sortorder'], 'yaxisside' => $db_gitem['yaxisside'], 'calc_fnc' => $db_gitem['calc_fnc'], 'type' => $db_gitem['type'], 'periods_cnt' => $db_gitem['periods_cnt']);
    }
    $db_graph = get_graph_by_graphid($graphid);
    if ($new_gitems = get_same_graphitems_for_host($gitems, $hostid)) {
        unset($chd_graphid);
        $chd_graphs = get_graphs_by_hostid($hostid);
        while (!isset($chd_graphid) && ($chd_graph = DBfetch($chd_graphs))) {
            /* compare graphs */
            if ($chd_graph['templateid'] != 0) {
                continue;
            }
            unset($equal);
            $chd_gitems = get_graphitems_by_graphid($chd_graph["graphid"]);
            while ($chd_gitem = DBfetch($chd_gitems)) {
                unset($gitem_equal);
                foreach ($new_gitems as $new_gitem) {
                    if (cmp_graphitems($new_gitem, $chd_gitem)) {
                        continue;
                    }
                    $gitem_equal = true;
                    break;
                }
                if (!isset($gitem_equal)) {
                    unset($equal);
                    break;
                }
                /* founded equal graph item */
                if (!isset($equal)) {
                    $equal = 0;
                }
                $equal++;
            }
            if (isset($equal) && count($new_gitems) == $equal) {
                /* founded equal graph */
                $chd_graphid = $chd_graph['graphid'];
                break;
            }
        }
        if (isset($chd_graphid)) {
            $result = update_graph_with_items($chd_graphid, $db_graph['name'], $db_graph['width'], $db_graph['height'], $db_graph['ymin_type'], $db_graph['ymax_type'], $db_graph['yaxismin'], $db_graph['yaxismax'], $db_graph['ymin_itemid'], $db_graph['ymax_itemid'], $db_graph['show_work_period'], $db_graph['show_triggers'], $db_graph['graphtype'], $db_graph['show_legend'], $db_graph['show_3d'], $db_graph['percent_left'], $db_graph['percent_right'], $new_gitems, $copy_mode ? 0 : $db_graph['graphid']);
        } else {
            $result = add_graph_with_items($db_graph['name'], $db_graph['width'], $db_graph['height'], $db_graph['ymin_type'], $db_graph['ymax_type'], $db_graph['yaxismin'], $db_graph['yaxismax'], $db_graph['ymin_itemid'], $db_graph['ymax_itemid'], $db_graph['show_work_period'], $db_graph['show_triggers'], $db_graph['graphtype'], $db_graph['show_legend'], $db_graph['show_3d'], $db_graph['percent_left'], $db_graph['percent_right'], $new_gitems, $copy_mode ? 0 : $db_graph['graphid']);
        }
    } else {
        $host = get_host_by_hostid($hostid);
        info('Skipped coping of graph "' . $db_graph["name"] . '" to host "' . $host['host'] . '"');
    }
    return $result;
}
开发者ID:phedders,项目名称:zabbix,代码行数:55,代码来源:graphs.inc.php


示例13: insert_map_link_form

function insert_map_link_form()
{
    $frmCnct = new CFormTable('New connector', 'sysmap.php');
    $frmCnct->SetHelp('web.sysmap.connector.php');
    $frmCnct->addVar('sysmapid', $_REQUEST['sysmapid']);
    if (isset($_REQUEST['linkid']) && !isset($_REQUEST['form_refresh'])) {
        $frmCnct->addVar('linkid', $_REQUEST['linkid']);
        $db_links = DBselect('SELECT * FROM sysmaps_links WHERE linkid=' . $_REQUEST['linkid']);
        $db_link = DBfetch($db_links);
        $selementid1 = $db_link['selementid1'];
        $selementid2 = $db_link['selementid2'];
        $triggers = array();
        $drawtype = $db_link['drawtype'];
        $color = $db_link['color'];
        $res = DBselect('SELECT * FROM sysmaps_link_triggers WHERE linkid=' . $_REQUEST['linkid']);
        while ($rows = DBfetch($res)) {
            $triggers[] = $rows;
        }
    } else {
        if (isset($_REQUEST['linkid'])) {
            $frmCnct->addVar('linkid', $_REQUEST['linkid']);
        }
        $selementid1 = get_request('selementid1', 0);
        $selementid2 = get_request('selementid2', 0);
        $triggers = get_request('triggers', array());
        $drawtype = get_request('drawtype', 0);
        $color = get_request('color', 0);
    }
    /* START comboboxes preparations */
    $cmbElements1 = new CComboBox('selementid1', $selementid1);
    $cmbElements2 = new CComboBox('selementid2', $selementid2);
    $db_selements = DBselect('SELECT selementid,label,elementid,elementtype ' . ' FROM sysmaps_elements ' . ' WHERE sysmapid=' . $_REQUEST['sysmapid']);
    while ($db_selement = DBfetch($db_selements)) {
        $label = $db_selement['label'];
        if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST) {
            $db_host = get_host_by_hostid($db_selement['elementid']);
            $label .= ':' . $db_host['host'];
        } else {
            if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_MAP) {
                $db_map = get_sysmap_by_sysmapid($db_selement['elementid']);
                $label .= ':' . $db_map['name'];
            } else {
                if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_TRIGGER) {
                    if ($db_selement['elementid'] > 0) {
                        $label .= ':' . expand_trigger_description($db_selement['elementid']);
                    }
                } else {
                    if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST_GROUP) {
                        if ($db_selement['elementid'] > 0) {
                            $db_group = DBfetch(DBselect('SELECT name FROM groups WHERE groupid=' . $db_selement['elementid']));
                            $label .= ':' . $db_group['name'];
                        }
                    }
                }
            }
        }
        $cmbElements1->addItem($db_selement['selementid'], $label);
        $cmbElements2->addItem($db_selement['selementid'], $label);
    }
    $cmbType = new CComboBox('drawtype', $drawtype);
    foreach (map_link_drawtypes() as $i) {
        $value = map_link_drawtype2str($i);
        $cmbType->addItem($i, $value);
    }
    /* END preparation */
    $frmCnct->addRow(S_ELEMENT_1, $cmbElements1);
    $frmCnct->addRow(S_ELEMENT_2, $cmbElements2);
    //trigger links
    foreach ($triggers as $id => $trigger) {
        if (isset($trigger['triggerid'])) {
            $triggers[$id]['description'] = expand_trigger_description($trigger['triggerid']);
        }
    }
    $table = new CTable();
    $table->SetClass('tableinfo');
    $table->setOddRowClass('even_row');
    $table->setEvenRowClass('even_row');
    $table->options['cellpadding'] = 3;
    $table->options['cellspacing'] = 1;
    $table->headerClass = 'header';
    $table->footerClass = 'footer';
    $table->SetHeader(array(new CCheckBox('all_triggers', null, "CheckAll('" . $frmCnct->GetName() . "','all_triggers','triggers');"), S_TRIGGERS, S_TYPE, S_COLOR));
    $table->addOption('id', 'link_triggers');
    foreach ($triggers as $id => $trigger) {
        if (!isset($trigger['triggerid'])) {
            continue;
        }
        $colorbox = new CSpan(SPACE . SPACE . SPACE);
        $colorbox->addOption('style', 'text-decoration: none; outline-color: black; outline-style: solid; outline-width: 1px; background-color: #' . $trigger['color'] . ';');
        $table->addRow(array(array(new CCheckBox('triggers[' . $trigger['triggerid'] . '][triggerid]', null, null, $trigger['triggerid']), new CVar('triggers[' . $trigger['triggerid'] . '][triggerid]', $trigger['triggerid'])), array(new CLink($trigger['description'], "javascript: openWinCentered('popup_link_tr.php?form=1&dstfrm=" . $frmCnct->GetName() . "&triggerid=" . $trigger['triggerid'] . url_param('linkid') . "','ZBX_Link_Indicator',560,260,'scrollbars=1, toolbar=0, menubar=0, resizable=0');"), new CVar('triggers[' . $trigger['triggerid'] . '][description]', $trigger['description'])), array(map_link_drawtype2str($trigger['drawtype']), new CVar('triggers[' . $trigger['triggerid'] . '][drawtype]', $trigger['drawtype'])), array($colorbox, new CVar('triggers[' . $trigger['triggerid'] . '][color]', $trigger['color']))));
    }
    $btnadd = new CButton('btn1', S_ADD, "javascript: openWinCentered('popup_link_tr.php?form=1&dstfrm=" . $frmCnct->GetName() . url_param('linkid') . "','ZBX_Link_Indicator',560,180,'scrollbars=1, toolbar=0, menubar=0, resizable=0');", 'T');
    $btnRemove = new CButton('btn1', S_REMOVE, "javascript: remove_childs('" . $frmCnct->GetName() . "','triggers','tr');", 'T');
    $btnadd->SetType('button');
    $frmCnct->addRow(S_LINK_STATUS_INDICATORS, array($table, BR(), $btnadd, $btnRemove));
    //----------
    $frmCnct->addRow(S_TYPE . ' (' . S_OK_BIG . ')', $cmbType);
    $frmCnct->addRow(S_COLOR . ' (' . S_OK_BIG . ')', new CColor('color', $color));
    $frmCnct->addItemToBottomRow(new CButton("save_link", S_SAVE));
    if (isset($_REQUEST["linkid"])) {
//.........这里部分代码省略.........
开发者ID:rennhak,项目名称:zabbix,代码行数:101,代码来源:forms.inc.php


示例14: addItem

 public function addItem($itemid, $axis = GRAPH_YAXIS_SIDE_DEFAULT, $calc_fnc = CALC_FNC_AVG, $color = null, $drawtype = null, $type = null)
 {
     if ($this->type == GRAPH_TYPE_STACKED) {
         $drawtype = GRAPH_ITEM_DRAWTYPE_FILLED_REGION;
     }
     // TODO: graphs shouldn't retrieve items and resolve macros themselves
     // all of the data must be passed as parameters
     $items = CMacrosResolverHelper::resolveItemNames([get_item_by_itemid($itemid)]);
     $item = reset($items);
     $item['name'] = $item['name_expanded'];
     $this->items[$this->num] = $item;
     $parser = new CItemDelayFlexParser($item['delay_flex']);
     $this->items[$this->num]['delay'] = getItemDelay($item['delay'], $parser->getFlexibleIntervals());
     $this->items[$this->num]['intervals'] = $parser->getIntervals();
     if (strpos($item['units'], ',') === false) {
         $this->items[$this->num]['unitsLong'] = '';
     } else {
         list($this->items[$this->num]['units'], $this->items[$this->num]['unitsLong']) = explode(',', $item['units']);
     }
     $host = get_host_by_hostid($item['hostid']);
     $this->items[$this->num]['host'] = $host['host'];
     $this->items[$this->num]['hostname'] = $host['name'];
     $this->items[$this->num]['color'] = is_null($color) ? 'Dark Green' : $color;
     $this->items[$this->num]['drawtype'] = is_null($drawtype) ? GRAPH_ITEM_DRAWTYPE_LINE : $drawtype;
     $this->items[$this->num]['axisside'] = is_null($axis) ? GRAPH_YAXIS_SIDE_DEFAULT : $axis;
     $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;
     if ($this->items[$this->num]['axisside'] == GRAPH_YAXIS_SIDE_LEFT) {
         $this->yaxisleft = 1;
     }
     if ($this->items[$this->num]['axisside'] == GRAPH_YAXIS_SIDE_RIGHT) {
         $this->yaxisright = 1;
     }
     $this->num++;
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:35,代码来源:CLineGraphDraw.php


示例15: CForm

$frmForm = new CForm();
$cmbConf = new CComboBox('config', 'proxies.php', 'javascript: redirect(this.options[this.selectedIndex].value);');
$cmbConf->addItem('nodes.php', S_NODES);
$cmbConf->addItem('proxies.php', S_PROXIES);
$frmForm->addItem($cmbConf);
if (!isset($_REQUEST['form'])) {
    $frmForm->addItem(new CButton('form', S_CREATE_PROXY));
}
$proxies_wdgt->addPageHeader(S_CONFIGURATION_OF_PROXIES, $frmForm);
if (isset($_REQUEST['form'])) {
    $_REQUEST['hostid'] = get_request('hostid', 0);
    $frm_title = S_PROXY;
    $frmHostG = new CFormTable($frm_title, 'proxies.php');
    $frmHostG->setHelp('web.proxy.php');
    if ($_REQUEST['hostid'] > 0) {
        $proxy = get_host_by_hostid($_REQUEST['hostid']);
        $frm_title = S_PROXY . ' [' . $proxy['host'] . ']';
        $frmHostG->addVar('hostid', $_REQUEST['hostid']);
    }
    if ($_REQUEST['hostid'] > 0 && !isset($_REQUEST['form_refresh'])) {
        $name = $proxy['host'];
        $status = $proxy['status'];
        if ($status == HOST_STATUS_PROXY_PASSIVE) {
            $useip = $proxy['useip'];
            $dns = $proxy['dns'];
            $ip = $proxy['ip'];
            $port = $proxy['port'];
        } else {
            $useip = get_request('useip', 1);
            $dns = get_request('dns', '');
            $ip = get_request('ip', '0.0.0.0');
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:proxies.php


示例16: array

 $data = array();
 // get drules
 $data['drules'] = API::DRule()->get(array('output' => API_OUTPUT_EXTEND, 'sortfield' => getPageSortField('name'), 'selectDChecks' => API_OUTPUT_EXTEND, 'editable' => true));
 if (!empty($data['drules'])) {
     foreach ($data['drules'] as $druleid => $drule) {
         // checks
         $checks = array();
         foreach ($drule['dchecks'] as $check) {
             $checks[$check['type']] = discovery_check_type2str($check['type']);
         }
         order_result($checks);
         $data['drules'][$druleid]['checks'] = $checks;
         // description
         $data['drules'][$druleid]['description'] = array();
         if (!empty($drule['proxy_hostid'])) {
             $proxy = get_host_by_hostid($drule['proxy_hostid']);
             array_push($data['drules'][$druleid]['description'], $proxy['host'] . NAME_DELIMITER);
         }
     }
     order_result($data['drules'], getPageSortOrder());
 }
 // get paging
 $data['paging'] = getPagingLine($data['drules'], array('druleid'));
 // nodes
 if ($data['displayNodes'] = is_array(get_current_nodeid())) {
     foreach ($data['drules'] as &$drule) {
         $drule['nodename'] = get_node_name_by_elid($drule['druleid'], true);
     }
     unset($drule);
 }
 // render view
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:discoveryconf.php


示例17: condition_value2str

function condition_value2str($conditiontype, $value)
{
    switch ($conditiontype) {
        case CONDITION_TYPE_HOST_GROUP:
            $groups = API::HostGroup()->get(array('groupids' => $value, 'output' => array('name'), 'nodeids' => get_current_nodeid(true), 'limit' => 1));
            if ($groups) {
                $group = reset($groups);
                $str_val = '';
                if (id2nodeid($value) != get_current_nodeid()) {
                    $str_val = get_node_name_by_elid($value, true, NAME_DELIMITER);
                }
                $str_val .= $group['name'];
            } else {
                return _('Unknown');
            }
            break;
        case CONDITION_TYPE_TRIGGER:
            $trigs = API::Trigger()->get(array('triggerids' => $value, 'expandDescription' => true, 'output' => array('description'), 'selectHosts' => array('name'), 'nodeids' => get_current_nodeid(true), 'limit' => 1));
            if ($trigs) {
                $trig = reset($trigs);
                $host = reset($trig['hosts']);
                $str_val = '';
                if (id2nodeid($value) != get_current_nodeid()) {
                    $str_val = get_node_name_by_elid($value, true, NAME_DELIMITER);
                }
                $str_val .= $host['name'] . NAME_DELIMITER . $trig['description'];
            } else {
                return _('Unknown');
            }
            break;
        case CONDITION_TYPE_HOST:
        case CONDITION_TYPE_TEMPLATE:
            if ($host = get_host_by_hostid($value)) {
                $str_val = '';
                if (id2nodeid($value) != get_current_nodeid()) {
                    $str_val = get_node_name_by_elid($value, true, NAME_DELIMITER);
                }
                $str_val .= $host['name'];
            } else {
                return _('Unknown');
            }
            break;
        case CONDITION_TYPE_TRIGGER_NAME:
        case CONDITION_TYPE_HOST_METADATA:
        case CONDITION_TYPE_HOST_NAME:
            $str_val = $value;
            break;
        case CONDITION_TYPE_TRIGGER_VALUE:
            $str_val = trigger_value2str($value);
            break;
        case CONDITION_TYPE_TRIGGER_SEVERITY:
            $str_val = getSeverityCaption($value);
            break;
        case CONDITION_TYPE_TIME_PERIOD:
            $str_val = $value;
            break;
        case CONDITION_TYPE_MAINTENANCE:
            $str_val = _('maintenance');
            break;
        case CONDITION_TYPE_NODE:
            if ($node = get_node_by_nodeid($value)) {
                $str_val = $node['name'];
            } else {
                return _('Unknown');
            }
            break;
        case CONDITION_TYPE_DRULE:
            if ($drule = get_discovery_rule_by_druleid($value)) {
                $str_val = $drule['name'];
            } else {
                return _('Unknown');
            }
            break;
        case CONDITION_TYPE_DCHECK:
            $row = DBfetch(DBselect('SELECT dr.name,c.dcheckid,c.type,c.key_,c.ports' . ' FROM drules dr,dchecks c' . ' WHERE dr.druleid=c.druleid' . ' AND c.dcheckid=' . zbx_dbstr($value)));
            if ($row) {
                $str_val = $row['name'] . NAME_DELIMITER . discovery_check2str($row['type'], $row['key_'], $row['ports']);
            } else {
                return _('Unknown');
            }
            break;
        case CONDITION_TYPE_DOBJECT:
            $str_val = discovery_object2str($value);
            break;
        case CONDITION_TYPE_PROXY:
            if ($host = get_host_by_hostid($value)) {
                $str_val = $host['host'];
            } else {
                return _('Unknown');
            }
            break;
        case CONDITION_TYPE_DHOST_IP:
            $str_val = $value;
            break;
        case CONDITION_TYPE_DSERVICE_TYPE:
            $str_val = discovery_check_type2str($value);
            break;
        case CONDITION_TYPE_DSERVICE_PORT:
            $str_val = $value;
            break;
//.........这里部分代码省略.........
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:101,代码来源:actions.inc.php


示例18: get_header_host_table

/**
 * Create CDiv with host/template information and references to it's elements
 *
 * @param string $currentElement
 * @param int $hostid
 * @param int $discoveryid
 *
 * @return object
 */
function get_header_host_table($currentElement, $hostid, $discoveryid = null)
{
    // LLD rule header
    if ($discoveryid) {
        $elements = array('items' => 'items', 'triggers' => 'triggers', 'graphs' => 'graphs', 'hosts' => 'hosts');
    } else {
        $elements = array('items' => 'items', 'triggers' => 'trig 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_host_by_itemid函数代码示例发布时间:2022-05-15
下一篇:
PHP get_host函数代码示例发布时间: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