protected function doAction()
 {
     $sortField = $this->getInput('sort', CProfile::get('web.proxies.php.sort', 'host'));
     $sortOrder = $this->getInput('sortorder', CProfile::get('web.proxies.php.sortorder', ZBX_SORT_UP));
     CProfile::update('web.proxies.php.sort', $sortField, PROFILE_TYPE_STR);
     CProfile::update('web.proxies.php.sortorder', $sortOrder, PROFILE_TYPE_STR);
     $config = select_config();
     $data = ['uncheck' => $this->hasInput('uncheck'), 'sort' => $sortField, 'sortorder' => $sortOrder, 'config' => ['max_in_table' => $config['max_in_table']]];
     $data['proxies'] = API::Proxy()->get(['output' => ['proxyid', 'host', 'status', 'lastaccess', 'tls_connect', 'tls_accept'], 'selectHosts' => ['hostid', 'name', 'status'], 'sortfield' => $sortField, 'limit' => $config['search_limit'] + 1, 'editable' => true, 'preservekeys' => true]);
     // sorting & paging
     order_result($data['proxies'], $sortField, $sortOrder);
     $url = (new CUrl('zabbix.php'))->setArgument('action', 'proxy.list');
     $data['paging'] = getPagingLine($data['proxies'], $sortOrder, $url);
     foreach ($data['proxies'] as &$proxy) {
         order_result($proxy['hosts'], 'name');
     }
     unset($proxy);
     // get proxy IDs for a *selected* page
     $proxyIds = array_keys($data['proxies']);
     if ($proxyIds) {
         // calculate performance
         $dbPerformance = DBselect('SELECT h.proxy_hostid,SUM(1.0/i.delay) AS qps' . ' FROM hosts h,items i' . ' WHERE h.hostid=i.hostid' . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND i.delay<>0' . ' AND i.flags<>' . ZBX_FLAG_DISCOVERY_PROTOTYPE . ' AND ' . dbConditionInt('h.proxy_hostid', $proxyIds) . ' GROUP BY h.proxy_hostid');
         while ($performance = DBfetch($dbPerformance)) {
             $data['proxies'][$performance['proxy_hostid']]['perf'] = round($performance['qps'], 2);
         }
         // get items
         $items = API::Item()->get(['proxyids' => $proxyIds, 'groupCount' => true, 'countOutput' => true, 'webitems' => true, 'monitored' => true]);
         foreach ($items as $item) {
             $data['proxies'][$item['proxy_hostid']]['item_count'] = $item['rowscount'];
         }
     }
     $response = new CControllerResponseData($data);
     $response->setTitle(_('Configuration of proxies'));
     $this->setResponse($response);
 }
 protected function doAction()
 {
     $sortField = $this->getInput('sort', CProfile::get('web.media_types.php.sort', 'description'));
     $sortOrder = $this->getInput('sortorder', CProfile::get('web.media_types.php.sortorder', ZBX_SORT_UP));
     CProfile::update('web.media_type.php.sort', $sortField, PROFILE_TYPE_STR);
     CProfile::update('web.media_types.php.sortorder', $sortOrder, PROFILE_TYPE_STR);
     $config = select_config();
     $data = ['uncheck' => $this->hasInput('uncheck'), 'sort' => $sortField, 'sortorder' => $sortOrder];
     // get media types
     $data['mediatypes'] = API::Mediatype()->get(['output' => ['mediatypeid', 'description', 'type', 'smtp_server', 'smtp_helo', 'smtp_email', 'exec_path', 'gsm_modem', 'username', 'status'], 'limit' => $config['search_limit'] + 1, 'editable' => true, 'preservekeys' => true]);
     if ($data['mediatypes']) {
         // get media types used in actions
         $actions = API::Action()->get(['output' => ['actionid', 'name'], 'selectOperations' => ['operationtype', 'opmessage'], 'mediatypeids' => array_keys($data['mediatypes'])]);
         foreach ($data['mediatypes'] as &$mediaType) {
             $mediaType['typeid'] = $mediaType['type'];
             $mediaType['type'] = media_type2str($mediaType['type']);
             $mediaType['listOfActions'] = [];
             foreach ($actions as $action) {
                 foreach ($action['operations'] as $operation) {
                     if ($operation['operationtype'] == OPERATION_TYPE_MESSAGE && $operation['opmessage']['mediatypeid'] == $mediaType['mediatypeid']) {
                         $mediaType['listOfActions'][$action['actionid']] = ['actionid' => $action['actionid'], 'name' => $action['name']];
                     }
                 }
             }
             order_result($mediaType['listOfActions'], 'name');
         }
         unset($mediaType);
         order_result($data['mediatypes'], $sortField, $sortOrder);
     }
     $url = (new CUrl('zabbix.php'))->setArgument('action', 'mediatype.list');
     $data['paging'] = getPagingLine($data['mediatypes'], $sortOrder, $url);
     $response = new CControllerResponseData($data);
     $response->setTitle(_('Configuration of media types'));
     $this->setResponse($response);
 }
 protected function doAction()
 {
     $sortField = $this->getInput('sort', CProfile::get('web.scripts.php.sort', 'name'));
     $sortOrder = $this->getInput('sortorder', CProfile::get('web.scripts.php.sortorder', ZBX_SORT_UP));
     CProfile::update('web.scripts.php.sort', $sortField, PROFILE_TYPE_STR);
     CProfile::update('web.scripts.php.sortorder', $sortOrder, PROFILE_TYPE_STR);
     $config = select_config();
     $data = ['uncheck' => $this->hasInput('uncheck'), 'sort' => $sortField, 'sortorder' => $sortOrder];
     // list of scripts
     $data['scripts'] = API::Script()->get(['output' => ['scriptid', 'name', 'command', 'host_access', 'usrgrpid', 'groupid', 'type', 'execute_on'], 'editable' => true, 'limit' => $config['search_limit'] + 1]);
     // sorting & paging
     order_result($data['scripts'], $sortField, $sortOrder);
     $url = (new CUrl('zabbix.php'))->setArgument('action', 'script.list');
     $data['paging'] = getPagingLine($data['scripts'], $sortOrder, $url);
     // find script host group name and user group name. set to '' if all host/user groups used.
     $usrgrpids = [];
     $groupids = [];
     foreach ($data['scripts'] as &$script) {
         $script['userGroupName'] = null;
         // all user groups
         $script['hostGroupName'] = null;
         // all host groups
         if ($script['usrgrpid'] != 0) {
             $usrgrpids[] = $script['usrgrpid'];
         }
         if ($script['groupid'] != 0) {
             $groupids[] = $script['groupid'];
         }
     }
     unset($script);
     if ($usrgrpids) {
         $userGroups = API::UserGroup()->get(['output' => ['name'], 'usrgrpids' => $usrgrpids, 'preservekeys' => true]);
         foreach ($data['scripts'] as &$script) {
             if ($script['usrgrpid'] != 0 && array_key_exists($script['usrgrpid'], $userGroups)) {
                 $script['userGroupName'] = $userGroups[$script['usrgrpid']]['name'];
             }
             unset($script['usrgrpid']);
         }
         unset($script);
     }
     if ($groupids) {
         $hostGroups = API::HostGroup()->get(['output' => ['name'], 'groupids' => $groupids, 'preservekeys' => true]);
         foreach ($data['scripts'] as &$script) {
             if ($script['groupid'] != 0 && array_key_exists($script['groupid'], $hostGroups)) {
                 $script['hostGroupName'] = $hostGroups[$script['groupid']]['name'];
             }
             unset($script['groupid']);
         }
         unset($script);
     }
     $response = new CControllerResponseData($data);
     $response->setTitle(_('Configuration of scripts'));
     $this->setResponse($response);
 }
Beispiel #4
0
    $maintenanceView = new CView('configuration.maintenance.edit', $data);
    $maintenanceView->render();
    $maintenanceView->show();
} else {
    $sortfield = getPageSortField('name');
    $sortorder = getPageSortOrder();
    // get only maintenance IDs for paging
    $options = array('output' => array('maintenanceid', $sortfield), 'editable' => true, 'sortfield' => $sortfield, 'limit' => $config['search_limit'] + 1);
    if ($pageFilter->groupsSelected && $pageFilter->groupid > 0) {
        $options['groupids'] = $pageFilter->groupid;
    } else {
        $options['groupids'] = $config['dropdown_first_entry'] ? null : array();
    }
    $data['maintenances'] = API::Maintenance()->get($options);
    order_result($data['maintenances'], $sortfield, $sortorder);
    $data['paging'] = getPagingLine($data['maintenances'], array('maintenanceid'));
    // get list of maintenances
    $data['maintenances'] = API::Maintenance()->get(array('maintenanceids' => zbx_objectValues($data['maintenances'], 'maintenanceid'), 'output' => API_OUTPUT_EXTEND));
    foreach ($data['maintenances'] as $number => $maintenance) {
        if ($maintenance['active_till'] < time()) {
            $data['maintenances'][$number]['status'] = MAINTENANCE_STATUS_EXPIRED;
        } elseif ($maintenance['active_since'] > time()) {
            $data['maintenances'][$number]['status'] = MAINTENANCE_STATUS_APPROACH;
        } else {
            $data['maintenances'][$number]['status'] = MAINTENANCE_STATUS_ACTIVE;
        }
    }
    order_result($data['maintenances'], $sortfield, $sortorder);
    $data['pageFilter'] = $pageFilter;
    // nodes
    if ($data['displayNodes']) {
Beispiel #5
0
    $data = array('sort' => $sortField, 'sortorder' => $sortOrder);
    // list of scripts
    $data['scripts'] = API::Script()->get(array('output' => array('scriptid', 'name', 'command', 'host_access', 'usrgrpid', 'groupid', 'type', 'execute_on'), 'editable' => true, 'selectGroups' => API_OUTPUT_EXTEND));
    // find script host group name and user group name. set to '' if all host/user groups used.
    foreach ($data['scripts'] as $key => $script) {
        $scriptId = $script['scriptid'];
        if ($script['usrgrpid'] > 0) {
            $userGroup = API::UserGroup()->get(array('usrgrpids' => $script['usrgrpid'], 'output' => API_OUTPUT_EXTEND));
            $userGroup = reset($userGroup);
            $data['scripts'][$key]['userGroupName'] = $userGroup['name'];
        } else {
            $data['scripts'][$key]['userGroupName'] = '';
            // all user groups
        }
        if ($script['groupid'] > 0) {
            $group = array_pop($script['groups']);
            $data['scripts'][$key]['hostGroupName'] = $group['name'];
        } else {
            $data['scripts'][$key]['hostGroupName'] = '';
            // all host groups
        }
    }
    // sorting & paging
    order_result($data['scripts'], $sortField, $sortOrder);
    $data['paging'] = getPagingLine($data['scripts']);
    // render view
    $scriptView = new CView('administration.script.list', $data);
    $scriptView->render();
    $scriptView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
    $data['mediatypes'] = API::Mediatype()->get(array('output' => API_OUTPUT_EXTEND, 'preservekeys' => true, 'editable' => true, 'limit' => $config['search_limit'] + 1));
    if ($data['mediatypes']) {
        // get media types used in actions
        $actions = API::Action()->get(array('mediatypeids' => zbx_objectValues($data['mediatypes'], 'mediatypeid'), 'output' => array('actionid', 'name'), 'selectOperations' => array('operationtype', 'opmessage'), 'preservekeys' => true));
        foreach ($data['mediatypes'] as $key => $mediaType) {
            $data['mediatypes'][$key]['typeid'] = $data['mediatypes'][$key]['type'];
            $data['mediatypes'][$key]['type'] = media_type2str($data['mediatypes'][$key]['type']);
            $data['mediatypes'][$key]['listOfActions'] = array();
            if ($actions) {
                foreach ($actions as $actionId => $action) {
                    foreach ($action['operations'] as $operation) {
                        if ($operation['operationtype'] == OPERATION_TYPE_MESSAGE && $operation['opmessage']['mediatypeid'] == $mediaType['mediatypeid']) {
                            $data['mediatypes'][$key]['listOfActions'][$actionId] = array('actionid' => $actionId, 'name' => $action['name']);
                        }
                    }
                }
                order_result($data['mediatypes'][$key]['listOfActions'], 'name');
            }
        }
        order_result($data['mediatypes'], $sortField, $sortOrder);
        $data['paging'] = getPagingLine($data['mediatypes'], $sortOrder);
    } else {
        $arr = array();
        $data['paging'] = getPagingLine($arr, $sortOrder);
    }
    // render view
    $mediaTypeView = new CView('administration.mediatypes.list', $data);
    $mediaTypeView->render();
    $mediaTypeView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
Beispiel #7
0
        $db_slides = DBselect('SELECT s.* FROM slides s WHERE s.slideshowid=' . zbx_dbstr($data['slideshowid']) . ' ORDER BY s.step');
        while ($slide = DBfetch($db_slides)) {
            $data['slides'][$slide['step']] = array('slideid' => $slide['slideid'], 'screenid' => $slide['screenid'], 'delay' => $slide['delay']);
        }
    }
    // get slides without delay
    $data['slides_without_delay'] = $data['slides'];
    for ($i = 0, $size = count($data['slides_without_delay']); $i < $size; $i++) {
        unset($data['slides_without_delay'][$i]['delay']);
    }
    // render view
    $slideshowView = new CView('configuration.slideconf.edit', $data);
    $slideshowView->render();
    $slideshowView->show();
} else {
    $data['slides'] = DBfetchArray(DBselect('SELECT s.slideshowid,s.name,s.delay,COUNT(sl.slideshowid) AS cnt' . ' FROM slideshows s' . ' LEFT JOIN slides sl ON sl.slideshowid=s.slideshowid' . whereDbNode('s.slideshowid') . ' GROUP BY s.slideshowid,s.name,s.delay'));
    order_result($data['slides'], getPageSortField('name'), getPageSortOrder());
    $data['paging'] = getPagingLine($data['slides'], array('slideshowid'));
    // nodes
    if ($data['displayNodes'] = is_array(get_current_nodeid())) {
        foreach ($data['slides'] as &$slide) {
            $slide['nodename'] = get_node_name_by_elid($slide['slideshowid'], true);
        }
        unset($slide);
    }
    // render view
    $slideshowView = new CView('configuration.slideconf.list', $data);
    $slideshowView->render();
    $slideshowView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
                    $haystack = mb_strtolower($data['hosts'][$num]['inventory'][$data['filterField']]);
                    if ($haystack !== $needle) {
                        unset($data['hosts'][$num]);
                    }
                }
            }
            $sort_fields = ['pr_name' => 'name', 'pr_type' => 'type', 'pr_os' => 'os', 'pr_serialno_a' => 'serialno_a', 'pr_tag' => 'tag', 'pr_macaddress_a' => 'macaddress_a'];
            if (array_key_exists($sortField, $sort_fields)) {
                // copying an inventory field into the upper array level for sorting
                foreach ($data['hosts'] as &$host) {
                    $host[$sortField] = $host['inventory'][$sort_fields[$sortField]];
                }
                unset($host);
            }
            $limit = $data['config']['search_limit'] + 1;
            order_result($data['hosts'], $sortField, $sortOrder);
            if ($sortOrder == ZBX_SORT_UP) {
                $data['hosts'] = array_slice($data['hosts'], 0, $limit);
            } else {
                $data['hosts'] = array_slice($data['hosts'], -$limit, $limit);
            }
            order_result($data['hosts'], $sortField, $sortOrder);
        }
    }
    $url = (new CUrl('hostinventories.php'))->setArgument('groupid', $data['pageFilter']->groupid);
    $data['paging'] = getPagingLine($data['hosts'], $sortOrder, $url);
    $hostinventoriesView = new CView('inventory.host.list', $data);
    $hostinventoriesView->render();
    $hostinventoriesView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
Beispiel #9
0
if ($ack_status == ZBX_ACK_STS_WITH_UNACK) {
    $options['withUnacknowledgedEvents'] = 1;
}
if ($ack_status == ZBX_ACK_STS_WITH_LAST_UNACK) {
    $options['withLastEventUnacknowledged'] = 1;
}
if ($show_severity > -1) {
    $options['min_severity'] = $show_severity;
}
if ($_REQUEST['status_change']) {
    $options['lastChangeSince'] = time() - $_REQUEST['status_change_days'] * 86400;
}
$triggers = CTrigger::get($options);
// sorting && paging
order_result($triggers, $sortfield, $sortorder);
$paging = getPagingLine($triggers);
$options = array('nodeids' => get_current_nodeid(), 'triggerids' => zbx_objectValues($triggers, 'triggerid'), 'output' => API_OUTPUT_EXTEND, 'select_hosts' => array('hostid', 'host', 'maintenance_status', 'maintenance_type', 'maintenanceid'), 'select_items' => API_OUTPUT_EXTEND, 'select_dependencies' => API_OUTPUT_EXTEND);
$triggers = CTrigger::get($options);
$triggers = zbx_toHash($triggers, 'triggerid');
order_result($triggers, $sortfield, $sortorder);
//---------
if ($config['event_ack_enable']) {
    foreach ($triggers as $tnum => $trigger) {
        $options = array('countOutput' => 1, 'triggerids' => $trigger['triggerid'], 'object' => EVENT_OBJECT_TRIGGER, 'acknowledged' => 0, 'value' => TRIGGER_VALUE_TRUE, 'nopermissions' => 1);
        $triggers[$tnum]['event_count'] = CEvent::get($options);
    }
}
$tr_hostids = array();
foreach ($triggers as $tnum => $trigger) {
    $triggers[$tnum]['events'] = array();
    //getting all host ids and names
Beispiel #10
0
            // 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
    $discoveryView = new CView('configuration.discovery.list', $data);
    $discoveryView->render();
    $discoveryView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
Beispiel #11
0
             if ($pageFilter->groupid > 0) {
                 $trigOpt['groupids'] = $pageFilter->groupid;
             }
         }
     }
     $triggers = CTrigger::get($trigOpt);
 }
 $options = array('nodeids' => get_current_nodeid(), 'object' => EVENT_OBJECT_TRIGGER, 'time_from' => $from, 'time_till' => $till, 'output' => API_OUTPUT_SHORTEN, 'sortfield' => 'clock', 'sortorder' => ZBX_SORT_DOWN, 'limit' => $config['search_limit'] + 1);
 if ($_REQUEST['hide_unknown']) {
     $options['hide_unknown'] = 1;
 }
 if (!empty($triggers)) {
     $options['triggerids'] = zbx_objectValues($triggers, 'triggerid');
 }
 $events = CEvent::get($options);
 $paging = getPagingLine($events);
 $options = array('nodeids' => get_current_nodeid(), 'eventids' => zbx_objectValues($events, 'eventid'), 'output' => API_OUTPUT_EXTEND, 'sortfield' => 'eventid', 'sortorder' => ZBX_SORT_DOWN, 'nopermissions' => 1);
 $events = CEvent::get($options);
 order_result($events, 'clock', ZBX_SORT_DOWN);
 $triggersOptions = array('triggerids' => zbx_objectValues($events, 'objectid'), 'select_hosts' => API_OUTPUT_EXTEND, 'select_triggers' => API_OUTPUT_EXTEND, 'select_items' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND);
 $triggers = CTrigger::get($triggersOptions);
 $triggers = zbx_toHash($triggers, 'triggerid');
 foreach ($events as $enum => $event) {
     $trigger = $triggers[$event['objectid']];
     $host = reset($trigger['hosts']);
     $items = array();
     foreach ($trigger['items'] as $inum => $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)
Beispiel #12
0
    $usersView->render();
    $usersView->show();
} else {
    $sortField = getRequest('sort', CProfile::get('web.' . $page['file'] . '.sort', 'alias'));
    $sortOrder = getRequest('sortorder', CProfile::get('web.' . $page['file'] . '.sortorder', ZBX_SORT_UP));
    CProfile::update('web.' . $page['file'] . '.sort', $sortField, PROFILE_TYPE_STR);
    CProfile::update('web.' . $page['file'] . '.sortorder', $sortOrder, PROFILE_TYPE_STR);
    $data = array('config' => $config, 'sort' => $sortField, 'sortorder' => $sortOrder);
    // get user groups
    $data['userGroups'] = API::UserGroup()->get(array('output' => API_OUTPUT_EXTEND));
    order_result($data['userGroups'], 'name');
    // get users
    $data['users'] = API::User()->get(array('usrgrpids' => $_REQUEST['filter_usrgrpid'] > 0 ? $_REQUEST['filter_usrgrpid'] : null, 'output' => API_OUTPUT_EXTEND, 'selectUsrgrps' => API_OUTPUT_EXTEND, 'getAccess' => 1, 'limit' => $config['search_limit'] + 1));
    // sorting & paging
    order_result($data['users'], $sortField, $sortOrder);
    $data['paging'] = getPagingLine($data['users'], $sortOrder);
    // set default lastaccess time to 0
    foreach ($data['users'] as $user) {
        $data['usersSessions'][$user['userid']] = array('lastaccess' => 0);
    }
    $dbSessions = DBselect('SELECT s.userid,MAX(s.lastaccess) AS lastaccess,s.status' . ' FROM sessions s' . ' WHERE ' . dbConditionInt('s.userid', zbx_objectValues($data['users'], 'userid')) . ' GROUP BY s.userid,s.status');
    while ($session = DBfetch($dbSessions)) {
        if ($data['usersSessions'][$session['userid']]['lastaccess'] < $session['lastaccess']) {
            $data['usersSessions'][$session['userid']] = $session;
        }
    }
    // render view
    $usersView = new CView('administration.users.list', $data);
    $usersView->render();
    $usersView->show();
}
    $triggersView->render();
    $triggersView->show();
} elseif (isset($_REQUEST['form'])) {
    $triggersView = new CView('configuration.triggers.edit', getTriggerFormData($exprAction));
    $triggersView->render();
    $triggersView->show();
} else {
    $sortField = getRequest('sort', CProfile::get('web.' . $page['file'] . '.sort', 'description'));
    $sortOrder = getRequest('sortorder', CProfile::get('web.' . $page['file'] . '.sortorder', ZBX_SORT_UP));
    CProfile::update('web.' . $page['file'] . '.sort', $sortField, PROFILE_TYPE_STR);
    CProfile::update('web.' . $page['file'] . '.sortorder', $sortOrder, PROFILE_TYPE_STR);
    $data = array('parent_discoveryid' => getRequest('parent_discoveryid'), 'showInfoColumn' => false, 'discovery_rule' => $discovery_rule, 'hostid' => getRequest('hostid'), 'showdisabled' => getRequest('showdisabled', 1), 'triggers' => array(), 'sort' => $sortField, 'sortorder' => $sortOrder);
    CProfile::update('web.triggers.showdisabled', $data['showdisabled'], PROFILE_TYPE_INT);
    // get triggers
    $options = array('editable' => true, 'output' => array('triggerid'), 'discoveryids' => $data['parent_discoveryid'], 'sortfield' => $sortField, 'limit' => $config['search_limit'] + 1);
    if (empty($data['showdisabled'])) {
        $options['filter']['status'] = TRIGGER_STATUS_ENABLED;
    }
    $data['triggers'] = API::TriggerPrototype()->get($options);
    // paging
    $data['paging'] = getPagingLine($data['triggers']);
    $data['triggers'] = API::TriggerPrototype()->get(array('triggerids' => zbx_objectValues($data['triggers'], 'triggerid'), 'output' => API_OUTPUT_EXTEND, 'selectHosts' => API_OUTPUT_EXTEND, 'selectItems' => array('itemid', 'hostid', 'key_', 'type', 'flags', 'status'), 'selectFunctions' => API_OUTPUT_EXTEND));
    order_result($data['triggers'], $sortField, $sortOrder);
    // get real hosts
    $data['realHosts'] = getParentHostsByTriggers($data['triggers']);
    // render view
    $triggersView = new CView('configuration.triggers.list', $data);
    $triggersView->render();
    $triggersView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
    $discoveryView->show();
} else {
    $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'] . ':');
            }
        }
        order_result($data['drules'], getPageSortOrder());
    }
    // get paging
    $data['paging'] = getPagingLine($data['drules']);
    // render view
    $discoveryView = new CView('configuration.discovery.list', $data);
    $discoveryView->render();
    $discoveryView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
 $dscry_wdgt->addHeader(S_DISCOVERY_BIG);
 $dscry_wdgt->addHeader($numrows);
 /* table */
 $form = new CForm();
 $form->setName('frmdrules');
 $tblDiscovery = new CTableInfo(S_NO_DISCOVERY_RULES_DEFINED);
 $tblDiscovery->setHeader(array(new CCheckBox('all_drules', null, "checkAll('" . $form->GetName() . "','all_drules','g_druleid');"), make_sorting_header(S_NAME, 'd.name'), make_sorting_header(S_IP_RANGE, 'd.iprange'), make_sorting_header(S_DELAY, 'd.delay'), S_CHECKS, S_STATUS));
 $sql = 'SELECT d.* ' . ' FROM drules d' . ' WHERE ' . DBin_node('druleid') . order_by('d.name,d.iprange,d.delay', 'd.druleid');
 $db_rules = DBselect($sql);
 // Discovery rules will be gathered here, so we can feed this array to pagination function
 $rules_arr = array();
 while ($rule_data = DBfetch($db_rules)) {
     $rules_arr[] = $rule_data;
 }
 // getting paging element
 $paging = getPagingLine($rules_arr);
 foreach ($rules_arr as $rule_data) {
     $checks = array();
     $sql = 'SELECT type FROM dchecks WHERE druleid=' . $rule_data['druleid'] . ' ORDER BY type, ports';
     $db_checks = DBselect($sql);
     while ($check_data = DBfetch($db_checks)) {
         if (!isset($checks[$check_data['type']])) {
             $checks[$check_data['type']] = discovery_check_type2str($check_data['type']);
         }
     }
     order_result($checks);
     $status = new CCol(new CLink(discovery_status2str($rule_data["status"]), '?g_druleid%5B%5D=' . $rule_data['druleid'] . ($rule_data["status"] == DRULE_STATUS_ACTIVE ? '&go=disable' : '&go=activate'), discovery_status2style($rule_data['status'])));
     $description = array();
     if ($rule_data["proxy_hostid"]) {
         $proxy = get_host_by_hostid($rule_data["proxy_hostid"]);
         array_push($description, $proxy["host"], ":");
Beispiel #16
0
 $frmGroup = new CForm('get');
 $frmGroup->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB()));
 $templateWidget->addHeader(_('Templates'), $frmGroup);
 $templateWidget->addHeaderRowNumber();
 $form = new CForm();
 $form->setName('templates');
 $table = new CTableInfo(_('No templates found.'));
 $table->setHeader(array(new CCheckBox('all_templates', null, "checkAll('" . $form->getName() . "', 'all_templates', 'templates');"), make_sorting_header(_('Templates'), 'name', $sortField, $sortOrder), _('Applications'), _('Items'), _('Triggers'), _('Graphs'), _('Screens'), _('Discovery'), _('Web'), _('Linked templates'), _('Linked to')));
 // get templates
 $templates = array();
 if ($pageFilter->groupsSelected) {
     $templates = API::Template()->get(array('output' => array('templateid', 'name'), 'groupids' => $pageFilter->groupid > 0 ? $pageFilter->groupid : null, 'editable' => true, 'sortfield' => $sortField, 'limit' => $config['search_limit'] + 1));
 }
 // sorting && paging
 order_result($templates, $sortField, $sortOrder);
 $paging = getPagingLine($templates);
 $templates = API::Template()->get(array('templateids' => zbx_objectValues($templates, 'templateid'), 'editable' => true, 'output' => array('name', 'proxy_hostid'), 'selectHosts' => array('hostid', 'name', 'status'), 'selectTemplates' => array('hostid', 'name', 'status'), 'selectParentTemplates' => array('hostid', 'name', 'status'), 'selectItems' => API_OUTPUT_COUNT, 'selectTriggers' => API_OUTPUT_COUNT, 'selectGraphs' => API_OUTPUT_COUNT, 'selectApplications' => API_OUTPUT_COUNT, 'selectDiscoveries' => API_OUTPUT_COUNT, 'selectScreens' => API_OUTPUT_COUNT, 'selectHttpTests' => API_OUTPUT_COUNT, 'nopermissions' => true));
 order_result($templates, $sortField, $sortOrder);
 foreach ($templates as $template) {
     $templatesOutput = array();
     if ($template['proxy_hostid']) {
         $proxy = get_host_by_hostid($template['proxy_hostid']);
         $templatesOutput[] = $proxy['host'] . NAME_DELIMITER;
     }
     $templatesOutput[] = new CLink($template['name'], 'templates.php?form=update&templateid=' . $template['templateid'] . url_param('groupid'));
     $applications = array(new CLink(_('Applications'), 'applications.php?groupid=' . $_REQUEST['groupid'] . '&hostid=' . $template['templateid']), ' (' . $template['applications'] . ')');
     $items = array(new CLink(_('Items'), 'items.php?filter_set=1&groupid=' . $_REQUEST['groupid'] . '&hostid=' . $template['templateid']), ' (' . $template['items'] . ')');
     $triggers = array(new CLink(_('Triggers'), 'triggers.php?groupid=' . $_REQUEST['groupid'] . '&hostid=' . $template['templateid']), ' (' . $template['triggers'] . ')');
     $graphs = array(new CLink(_('Graphs'), 'graphs.php?groupid=' . $_REQUEST['groupid'] . '&hostid=' . $template['templateid']), ' (' . $template['graphs'] . ')');
     $screens = array(new CLink(_('Screens'), 'screenconf.php?templateid=' . $template['templateid']), ' (' . $template['screens'] . ')');
     $discoveries = array(new CLink(_('Discovery'), 'host_discovery.php?&hostid=' . $template['templateid']), ' (' . $template['discoveries'] . ')');
Beispiel #17
0
        $data['vsize'] = get_request('vsize', 1);
    }
    // render view
    $screenView = new CView('configuration.screen.edit', $data);
    $screenView->render();
    $screenView->show();
} else {
    $data = array('templateid' => get_request('templateid', null));
    $sortfield = getPageSortField('name');
    $options = array('editable' => true, 'output' => API_OUTPUT_EXTEND, 'templateids' => $data['templateid'], 'sortfield' => $sortfield, 'limit' => $config['search_limit']);
    if (!empty($data['templateid'])) {
        $data['screens'] = API::TemplateScreen()->get($options);
    } else {
        $data['screens'] = API::Screen()->get($options);
    }
    order_result($data['screens'], $sortfield, getPageSortOrder());
    // paging
    $data['paging'] = getPagingLine($data['screens'], array('screenid'), array('templateid' => get_request('templateid')));
    // nodes
    if ($data['displayNodes'] = is_array(get_current_nodeid())) {
        foreach ($data['screens'] as &$screen) {
            $screen['nodename'] = get_node_name_by_elid($screen['screenid'], true);
        }
        unset($screen);
    }
    // render view
    $screenView = new CView('configuration.screen.list', $data);
    $screenView->render();
    $screenView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
 $form = new CForm();
 $form->setName('hosts');
 $table = new CTableInfo(_('No hosts found.'));
 $table->setHeader(array(new CCheckBox('all_hosts', null, "checkAll('" . $form->getName() . "', 'all_hosts', 'hosts');"), $displayNodes ? _('Node') : null, make_sorting_header(_('Name'), 'name'), _('Applications'), _('Items'), _('Triggers'), _('Graphs'), _('Discovery'), _('Web'), _('Interface'), _('Templates'), make_sorting_header(_('Status'), 'status'), _('Availability')));
 // get Hosts
 $hosts = array();
 $sortfield = getPageSortField('name');
 $sortorder = getPageSortOrder();
 if ($pageFilter->groupsSelected) {
     $hosts = API::Host()->get(array('groupids' => $pageFilter->groupid > 0 ? $pageFilter->groupid : null, 'editable' => true, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'limit' => $config['search_limit'] + 1, 'search' => array('name' => empty($_REQUEST['filter_host']) ? null : $_REQUEST['filter_host'], 'ip' => empty($_REQUEST['filter_ip']) ? null : $_REQUEST['filter_ip'], 'dns' => empty($_REQUEST['filter_dns']) ? null : $_REQUEST['filter_dns']), 'filter' => array('port' => empty($_REQUEST['filter_port']) ? null : $_REQUEST['filter_port'])));
 } else {
     $hosts = array();
 }
 // sorting && paging
 order_result($hosts, $sortfield, $sortorder);
 $paging = getPagingLine($hosts, array('hostid'));
 $hosts = API::Host()->get(array('hostids' => zbx_objectValues($hosts, 'hostid'), 'output' => API_OUTPUT_EXTEND, 'selectParentTemplates' => array('hostid', 'name'), 'selectInterfaces' => API_OUTPUT_EXTEND, 'selectItems' => API_OUTPUT_COUNT, 'selectDiscoveries' => API_OUTPUT_COUNT, 'selectTriggers' => API_OUTPUT_COUNT, 'selectGraphs' => API_OUTPUT_COUNT, 'selectApplications' => API_OUTPUT_COUNT, 'selectHttpTests' => API_OUTPUT_COUNT, 'selectDiscoveryRule' => array('itemid', 'name'), 'selectHostDiscovery' => array('ts_delete')));
 order_result($hosts, $sortfield, $sortorder);
 // selecting linked templates to templates linked to hosts
 $templateIds = array();
 foreach ($hosts as $host) {
     $templateIds = array_merge($templateIds, zbx_objectValues($host['parentTemplates'], 'templateid'));
 }
 $templateIds = array_unique($templateIds);
 $templates = API::Template()->get(array('templateids' => $templateIds, 'selectParentTemplates' => array('hostid', 'name')));
 $templates = zbx_toHash($templates, 'templateid');
 // get proxy host IDs that that are not 0
 $proxyHostIds = array();
 foreach ($hosts as $host) {
     if ($host['proxy_hostid']) {
         $proxyHostIds[$host['proxy_hostid']] = $host['proxy_hostid'];
                $hosts[$num]['pr_type'] = $host['inventory']['type'];
                $hosts[$num]['pr_os'] = $host['inventory']['os'];
                $hosts[$num]['pr_serialno_a'] = $host['inventory']['serialno_a'];
                $hosts[$num]['pr_tag'] = $host['inventory']['tag'];
                $hosts[$num]['pr_macaddress_a'] = $host['inventory']['macaddress_a'];
                // if we are filtering by inventory field
                if (!empty($_REQUEST['filter_field']) && !empty($_REQUEST['filter_field_value'])) {
                    // must we filter exactly or using a substring (both are case insensitive)
                    $match = $_REQUEST['filter_exact'] ? zbx_strtolower($hosts[$num]['inventory'][$_REQUEST['filter_field']]) === zbx_strtolower($_REQUEST['filter_field_value']) : zbx_strpos(zbx_strtolower($hosts[$num]['inventory'][$_REQUEST['filter_field']]), zbx_strtolower($_REQUEST['filter_field_value'])) !== false;
                    if (!$match) {
                        unset($hosts[$num]);
                    }
                }
            }
            order_result($hosts, getPageSortField('name'), getPageSortOrder());
            $paging = getPagingLine($hosts);
            foreach ($hosts as $host) {
                $host_groups = array();
                foreach ($host['groups'] as $group) {
                    $host_groups[] = $group['name'];
                }
                natsort($host_groups);
                $host_groups = implode(', ', $host_groups);
                $row = array(get_node_name_by_elid($host['hostid']), new CLink($host['name'], '?hostid=' . $host['hostid'] . url_param('groupid')), $host_groups, zbx_str2links($host['inventory']['name']), zbx_str2links($host['inventory']['type']), zbx_str2links($host['inventory']['os']), zbx_str2links($host['inventory']['serialno_a']), zbx_str2links($host['inventory']['tag']), zbx_str2links($host['inventory']['macaddress_a']));
                $table->addRow($row);
            }
        }
    }
    $table = array($paging, $table, $paging);
    $hostinvent_wdgt->addItem($table);
}
                $item['applications_list'] = '';
            }
        }
        unset($item);
    }
    $data['flicker'] = getItemFilterForm($data['items']);
    // remove subfiltered items
    if (!empty($data['items'])) {
        foreach ($data['items'] as $number => $item) {
            foreach ($item['subfilters'] as $subfilter => $value) {
                if (!$value) {
                    unset($data['items'][$number]);
                    break;
                }
            }
        }
    }
    order_result($data['items'], $data['sortfield'], getPageSortOrder());
    $data['paging'] = getPagingLine($data['items']);
    $itemTriggerIds = array();
    foreach ($data['items'] as $item) {
        $itemTriggerIds = array_merge($itemTriggerIds, zbx_objectValues($item['triggers'], 'triggerid'));
    }
    $data['itemTriggers'] = API::Trigger()->get(array('triggerids' => $itemTriggerIds, 'output' => API_OUTPUT_EXTEND, 'selectHosts' => array('hostid', 'name', 'host'), 'selectFunctions' => API_OUTPUT_EXTEND, 'selectItems' => API_OUTPUT_EXTEND, 'preservekeys' => true));
    $data['triggerRealHosts'] = getParentHostsByTriggers($data['itemTriggers']);
    // render view
    $itemView = new CView('configuration.item.list', $data);
    $itemView->render();
    $itemView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
} else {
    $data['pageFilter'] = $pageFilter;
    $data['showDisabled'] = $showDisabled;
    $data['showAllApps'] = $showAllApps;
    $data['db_apps'] = array();
    $db_app_result = DBselect('SELECT DISTINCT h.name AS hostname,a.*' . ' FROM applications a,hosts h' . ' WHERE a.hostid=h.hostid' . ($data['hostid'] > 0 ? ' AND h.hostid=' . $data['hostid'] : '') . ' AND ' . dbConditionInt('h.hostid', $pageFilter->hostsSelected ? array_keys($pageFilter->hosts) : array()));
    while ($db_app = DBfetch($db_app_result)) {
        $db_app['scenarios_cnt'] = 0;
        $data['db_apps'][$db_app['applicationid']] = $db_app;
    }
    // get http tests
    $data['db_httptests'] = array();
    $dbHttpTests_result = DBselect('SELECT wt.*,a.name AS application,h.name AS hostname,h.hostid' . ' FROM httptest wt,applications a,hosts h' . ' WHERE wt.applicationid=a.applicationid' . ' AND a.hostid=h.hostid' . ' AND ' . dbConditionInt('a.applicationid', array_keys($data['db_apps'])) . ($showDisabled == 0 ? ' AND wt.status=' . HTTPTEST_STATUS_ACTIVE : ''));
    while ($httptest_data = DBfetch($dbHttpTests_result)) {
        $data['db_apps'][$httptest_data['applicationid']]['scenarios_cnt']++;
        $httptest_data['step_count'] = null;
        $data['db_httptests'][$httptest_data['httptestid']] = $httptest_data;
    }
    // get http steps
    $httpstep_res = DBselect('SELECT hs.httptestid,COUNT(hs.httpstepid) AS cnt' . ' FROM httpstep hs' . ' WHERE ' . dbConditionInt('hs.httptestid', array_keys($data['db_httptests'])) . ' GROUP BY hs.httptestid');
    while ($step_count = DBfetch($httpstep_res)) {
        $data['db_httptests'][$step_count['httptestid']]['step_count'] = $step_count['cnt'];
    }
    order_result($data['db_httptests'], getPageSortField('host'), getPageSortOrder());
    $data['paging'] = getPagingLine($data['db_httptests']);
    // render view
    $httpView = new CView('configuration.httpconf.list', $data);
    $httpView->render();
    $httpView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
        case AUDIT_ACTION_ENABLE:
            $action = _('Enabled');
            break;
        case AUDIT_ACTION_DISABLE:
            $action = _('Disabled');
            break;
        default:
            $action = _('Unknown action');
    }
    $audit['action'] = $action;
    $audit['resourcetype'] = audit_resource2str($audit['resourcetype']);
    if (empty($audit['details'])) {
        $audit['details'] = DBfetchArray(DBselect('SELECT ad.table_name,ad.field_name,ad.oldvalue,ad.newvalue' . ' FROM auditlog_details ad' . ' WHERE ad.auditid=' . $audit['auditid']));
    }
    $data['actions'][$audit['auditid']] = $audit;
}
if (!empty($data['actions'])) {
    order_result($data['actions'], 'clock', ZBX_SORT_DOWN);
}
// get paging
$data['paging'] = getPagingLine($data['actions']);
// get timeline
unset($sqlWhere['from'], $sqlWhere['till']);
$sql = 'SELECT a.auditid,a.clock' . ' FROM auditlog a,users u' . ' WHERE u.userid=a.userid' . implode('', $sqlWhere) . ' AND ' . DBin_node('u.userid', get_current_nodeid(null, PERM_READ_ONLY)) . ' ORDER BY a.clock';
$firstAudit = DBfetch(DBselect($sql, $config['search_limit'] + 1));
$data['timeline'] = array('period' => $effectivePeriod, 'starttime' => date('YmdHis', !empty($firstAudit) ? $firstAudit['clock'] : null), 'usertime' => isset($_REQUEST['stime']) ? date('YmdHis', zbxDateToTime($data['stime']) + $effectivePeriod) : null);
// render view
$auditView = new CView('administration.auditlogs.list', $data);
$auditView->render();
$auditView->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
    // render view
    $itemView = new CView('configuration.item.prototype.edit', $data);
    $itemView->render();
    $itemView->show();
} else {
    $sortField = getRequest('sort', CProfile::get('web.' . $page['file'] . '.sort', 'name'));
    $sortOrder = getRequest('sortorder', CProfile::get('web.' . $page['file'] . '.sortorder', ZBX_SORT_UP));
    CProfile::update('web.' . $page['file'] . '.sort', $sortField, PROFILE_TYPE_STR);
    CProfile::update('web.' . $page['file'] . '.sortorder', $sortOrder, PROFILE_TYPE_STR);
    $config = select_config();
    $data = ['form' => getRequest('form'), 'parent_discoveryid' => getRequest('parent_discoveryid'), 'hostid' => $discoveryRule['hostid'], 'sort' => $sortField, 'sortorder' => $sortOrder];
    $data['items'] = API::ItemPrototype()->get(['discoveryids' => $data['parent_discoveryid'], 'output' => API_OUTPUT_EXTEND, 'editable' => true, 'selectApplications' => API_OUTPUT_EXTEND, 'sortfield' => $sortField, 'limit' => $config['search_limit'] + 1]);
    foreach ($data['items'] as &$item) {
        if ($item['value_type'] == ITEM_VALUE_TYPE_STR || $item['value_type'] == ITEM_VALUE_TYPE_LOG || $item['value_type'] == ITEM_VALUE_TYPE_TEXT) {
            $item['trends'] = '';
        }
        if ($item['type'] == ITEM_TYPE_TRAPPER || $item['type'] == ITEM_TYPE_SNMPTRAP) {
            $item['delay'] = '';
        }
    }
    unset($item);
    $data['items'] = CMacrosResolverHelper::resolveItemNames($data['items']);
    order_result($data['items'], $sortField, $sortOrder);
    $url = (new CUrl('disc_prototypes.php'))->setArgument('parent_discoveryid', $data['parent_discoveryid']);
    $data['paging'] = getPagingLine($data['items'], $sortOrder, $url);
    // render view
    $itemView = new CView('configuration.item.prototype.list', $data);
    $itemView->render();
    $itemView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
Beispiel #24
0
        case AUDIT_ACTION_ENABLE:
            $action = _('Enabled');
            break;
        case AUDIT_ACTION_DISABLE:
            $action = _('Disabled');
            break;
        default:
            $action = _('Unknown action');
    }
    $audit['action'] = $action;
    $audit['resourcetype'] = audit_resource2str($audit['resourcetype']);
    if (empty($audit['details'])) {
        $audit['details'] = DBfetchArray(DBselect('SELECT ad.table_name,ad.field_name,ad.oldvalue,ad.newvalue' . ' FROM auditlog_details ad' . ' WHERE ad.auditid=' . zbx_dbstr($audit['auditid'])));
    }
    $data['actions'][$audit['auditid']] = $audit;
}
if (!empty($data['actions'])) {
    order_result($data['actions'], 'clock', ZBX_SORT_DOWN);
}
// get paging
$data['paging'] = getPagingLine($data['actions'], ZBX_SORT_DOWN, new CUrl('auditlogs.php'));
// get timeline
unset($sqlWhere['from'], $sqlWhere['till']);
$sql = 'SELECT MIN(a.clock) AS clock' . ' FROM auditlog a,users u' . ' WHERE a.userid=u.userid' . implode('', $sqlWhere);
$firstAudit = DBfetch(DBselect($sql, $config['search_limit'] + 1));
$data['timeline'] = ['period' => $effectivePeriod, 'starttime' => date(TIMESTAMP_FORMAT, $firstAudit ? $firstAudit['clock'] : null), 'usertime' => isset($_REQUEST['stime']) ? date(TIMESTAMP_FORMAT, zbxDateToTime($data['stime']) + $effectivePeriod) : null];
// render view
$auditView = new CView('administration.auditlogs.list', $data);
$auditView->render();
$auditView->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
        $data['applications'] = API::Application()->get(array('applicationids' => $applicationIds, 'output' => API_OUTPUT_EXTEND, 'selectItems' => array('itemid'), 'selectHost' => array('hostid', 'name')));
        order_result($data['applications'], $sortField, $sortOrder);
        // fetch template application source parents
        $applicationSourceParentIds = getApplicationSourceParentIds($applicationIds);
        $parentAppIds = array();
        foreach ($applicationSourceParentIds as $applicationParentIds) {
            foreach ($applicationParentIds as $parentId) {
                $parentAppIds[$parentId] = $parentId;
            }
        }
        if ($parentAppIds) {
            $parentTemplates = DBfetchArrayAssoc(DBselect('SELECT a.applicationid,h.hostid,h.name' . ' FROM applications a,hosts h' . ' WHERE a.hostid=h.hostid' . ' AND ' . dbConditionInt('a.applicationid', $parentAppIds)), 'applicationid');
            foreach ($data['applications'] as &$application) {
                if ($application['templateids'] && isset($applicationSourceParentIds[$application['applicationid']])) {
                    foreach ($applicationSourceParentIds[$application['applicationid']] as $parentAppId) {
                        $application['sourceTemplates'][] = $parentTemplates[$parentAppId];
                    }
                }
            }
        }
    } else {
        $data['applications'] = array();
    }
    // get paging
    $data['paging'] = getPagingLine($data['applications'], $sortOrder);
    // render view
    $applicationView = new CView('configuration.application.list', $data);
    $applicationView->render();
    $applicationView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
Beispiel #26
0
        case AUDIT_ACTION_ENABLE:
            $action = S_ENABLED;
            break;
        case AUDIT_ACTION_DISABLE:
            $action = S_DISABLED;
            break;
        default:
            $action = S_UNKNOWN_ACTION;
    }
    $row['action'] = $action;
    $row['resourcetype'] = audit_resource2str($row['resourcetype']);
    $actions[$row['auditid']] = $row;
}
// sorting && paging
order_result($actions, 'clock', ZBX_SORT_DOWN);
$paging = getPagingLine($actions);
//---------
foreach ($actions as $num => $row) {
    if (empty($row['details'])) {
        $details = array();
        $sql = 'SELECT table_name,field_name,oldvalue,newvalue ' . ' FROM auditlog_details ' . ' WHERE auditid=' . $row['auditid'];
        $db_details = DBselect($sql);
        while ($db_detail = DBfetch($db_details)) {
            $details[] = array($db_detail['table_name'] . '.' . $db_detail['field_name'] . ': ' . $db_detail['oldvalue'] . ' => ' . $db_detail['newvalue'], BR());
        }
    } else {
        $details = $row['details'];
    }
    $table->addRow(array(zbx_date2str(S_AUDITLOGS_RECORD_DATE_FORMAT, $row['clock']), $row['alias'], $row['ip'], $row['resourcetype'], $row['action'], $row['resourceid'], $row['resourcename'], new CCol($details, 'wraptext')));
}
// PAGING FOOTER
Beispiel #27
0
    clearCookies($goResult, $_REQUEST['hostid']);
}
/*
 * Display
 */
if (isset($_REQUEST['form'])) {
    $data = getItemFormData(array('is_discovery_rule' => true));
    $data['page_header'] = _('CONFIGURATION OF DISCOVERY RULES');
    // render view
    $itemView = new CView('configuration.item.edit', $data);
    $itemView->render();
    $itemView->show();
} else {
    $data = array('hostid' => get_request('hostid', 0), 'host' => $host, 'showErrorColumn' => $host['status'] != HOST_STATUS_TEMPLATE);
    $sortfield = getPageSortField('name');
    // discoveries
    $data['discoveries'] = API::DiscoveryRule()->get(array('hostids' => $data['hostid'], 'output' => API_OUTPUT_EXTEND, 'editable' => true, 'selectItems' => API_OUTPUT_COUNT, 'selectGraphs' => API_OUTPUT_COUNT, 'selectTriggers' => API_OUTPUT_COUNT, 'selectHostPrototypes' => API_OUTPUT_COUNT, 'sortfield' => $sortfield, 'limit' => $config['search_limit'] + 1));
    $data['discoveries'] = CMacrosResolverHelper::resolveItemNames($data['discoveries']);
    if ($sortfield === 'status') {
        orderItemsByStatus($data['discoveries'], getPageSortOrder());
    } else {
        order_result($data['discoveries'], $sortfield, getPageSortOrder());
    }
    // paging
    $data['paging'] = getPagingLine($data['discoveries'], array('itemid'), array('hostid' => get_request('hostid')));
    // render view
    $discoveryView = new CView('configuration.host.discovery.list', $data);
    $discoveryView->render();
    $discoveryView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
Beispiel #28
0
    }
    // new operation
    if (!empty($data['new_operation'])) {
        if (!is_array($data['new_operation'])) {
            $data['new_operation'] = array('action' => 'create', 'operationtype' => 0, 'esc_period' => 0, 'esc_step_from' => 1, 'esc_step_to' => 1, 'evaltype' => 0);
        }
    }
    // render view
    $actionView = new CView('configuration.action.edit', $data);
    $actionView->render();
    $actionView->show();
} else {
    $data = array('eventsource' => getRequest('eventsource', CProfile::get('web.actionconf.eventsource', EVENT_SOURCE_TRIGGERS)), 'displayNodes' => is_array(get_current_nodeid()));
    $sortfield = getPageSortField('name');
    $data['actions'] = API::Action()->get(array('output' => API_OUTPUT_EXTEND, 'filter' => array('eventsource' => array($data['eventsource'])), 'selectConditions' => API_OUTPUT_EXTEND, 'selectOperations' => API_OUTPUT_EXTEND, 'editable' => true, 'sortfield' => $sortfield, 'limit' => $config['search_limit'] + 1));
    // sorting && paging
    order_result($data['actions'], $sortfield, getPageSortOrder());
    $data['paging'] = getPagingLine($data['actions'], array('actionid'));
    // nodes
    if ($data['displayNodes']) {
        foreach ($data['actions'] as &$action) {
            $action['nodename'] = get_node_name_by_elid($action['actionid'], true);
        }
        unset($action);
    }
    // render view
    $actionView = new CView('configuration.action.list', $data);
    $actionView->render();
    $actionView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
Beispiel #29
0
    order_result($httpTests, getPageSortField('name'), getPageSortOrder());
    // fetch the latest results of the web scenario
    $lastHttpTestData = Manager::HttpTest()->getLastData(array_keys($httpTests));
    foreach ($httpTests as $httpTest) {
        $lastData = isset($lastHttpTestData[$httpTest['httptestid']]) ? $lastHttpTestData[$httpTest['httptestid']] : null;
        // test has history data
        if ($lastData) {
            $lastcheck = zbx_date2str(_('d M Y H:i:s'), $lastData['lastcheck']);
            if ($lastData['lastfailedstep'] != 0) {
                $step_data = get_httpstep_by_no($httpTest['httptestid'], $lastData['lastfailedstep']);
                $status['msg'] = _s('Step "%1$s" [%2$s of %3$s] failed: %4$s', $step_data['name'], $lastData['lastfailedstep'], $httpTest['steps'], $lastData['error']);
                $status['style'] = 'disabled';
            } else {
                $status['msg'] = _('OK');
                $status['style'] = 'enabled';
            }
        } else {
            $lastcheck = _('Never');
            $status['msg'] = _('Unknown');
            $status['style'] = 'unknown';
        }
        $cpsan = new CSpan($httpTest['hostname'], $httpTest['host']['status'] == HOST_STATUS_NOT_MONITORED ? 'not-monitored' : '');
        $table->addRow(new CRow(array($displayNodes ? get_node_name_by_elid($httpTest['httptestid'], true) : null, $_REQUEST['hostid'] > 0 ? null : $cpsan, new CLink($httpTest['name'], 'httpdetails.php?httptestid=' . $httpTest['httptestid']), $httpTest['steps'], $lastcheck, new CSpan($status['msg'], $status['style']))));
    }
} else {
    $tmp = array();
    getPagingLine($tmp);
}
$httpmon_wdgt->addItem(array($paging, $table, $paging));
$httpmon_wdgt->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
} else {
    $sortField = getRequest('sort', CProfile::get('web.' . $page['file'] . '.sort', 'name'));
    $sortOrder = getRequest('sortorder', CProfile::get('web.' . $page['file'] . '.sortorder', ZBX_SORT_UP));
    CProfile::update('web.' . $page['file'] . '.sort', $sortField, PROFILE_TYPE_STR);
    CProfile::update('web.' . $page['file'] . '.sortorder', $sortOrder, PROFILE_TYPE_STR);
    $config = select_config();
    $data = ['hostid' => getRequest('hostid', 0), 'host' => $host, 'showInfoColumn' => $host['status'] != HOST_STATUS_TEMPLATE, 'sort' => $sortField, 'sortorder' => $sortOrder];
    // discoveries
    $data['discoveries'] = API::DiscoveryRule()->get(['hostids' => $data['hostid'], 'output' => API_OUTPUT_EXTEND, 'editable' => true, 'selectItems' => API_OUTPUT_COUNT, 'selectGraphs' => API_OUTPUT_COUNT, 'selectTriggers' => API_OUTPUT_COUNT, 'selectHostPrototypes' => API_OUTPUT_COUNT, 'sortfield' => $sortField, 'limit' => $config['search_limit'] + 1]);
    // hide zeroes for trapper and SNMP trap items
    foreach ($data['discoveries'] as &$discovery) {
        if ($discovery['type'] == ITEM_TYPE_TRAPPER || $discovery['type'] == ITEM_TYPE_SNMPTRAP) {
            $discovery['delay'] = '';
        }
    }
    unset($discovery);
    $data['discoveries'] = CMacrosResolverHelper::resolveItemNames($data['discoveries']);
    if ($sortField === 'status') {
        orderItemsByStatus($data['discoveries'], $sortOrder);
    } else {
        order_result($data['discoveries'], $sortField, $sortOrder);
    }
    // paging
    $url = (new CUrl('host_discovery.php'))->setArgument('hostid', $data['hostid']);
    $data['paging'] = getPagingLine($data['discoveries'], $sortOrder, $url);
    // render view
    $discoveryView = new CView('configuration.host.discovery.list', $data);
    $discoveryView->render();
    $discoveryView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';