예제 #1
0
                drop_domain($dname);
                $s_domains_valid = FALSE;
            }
        }
    }
}
//
// trigger stuff
//
if (have_panel_permissions($s_login['user'], 'acc_trigger', TRUE)) {
    include './inc/triggers.inc.php';
    // include the javascript for detail requests
    $js_stack .= js_request_details();
    // init the array $triggers[]
    if ($s_triggers_valid == FALSE || isset($_POST['acc_trigger_reload'])) {
        $s_triggers = get_triggers($s_triggers);
        $s_triggers_valid = TRUE;
    }
    // 'Open All' button
    if (isset($_POST['acc_trigger_open'])) {
        $s_triggers = toggle_all_triggers($s_triggers, 'open');
    }
    // 'Close All' button
    if (isset($_POST['acc_trigger_close'])) {
        $s_triggers = toggle_all_triggers($s_triggers, 'close');
    }
    // the Create button on the Triggers panel was pushed
    if (isset($_POST['acc_trigger_create'])) {
        $trigger_add_flag = TRUE;
        $s_triggerdefs = array('table' => NULL, 'type' => NULL, 'status' => NULL, 'source' => "BEGIN\n\nEND !!");
    }
예제 #2
0
function make_ipmistat_summary($preloading = false)
{
    $form_name = 'ipmi_control';
    $table = new CTableInfo();
    $ipmicontrol_form = new CForm();
    $ipmicontrol_form->setName('ipmi_control');
    $ipmicontrol_form->setAttribute('id', 'ipmi_control');
    $ipmicontrol_form->addVar('driver', 'ipmi');
    $script_itemkey = 'push_message.py[{$HYCLOPS_SERVER},{$HYCLOPS_PORT},ipmi,{HOST.HOST}]';
    $table->setHeader(array(is_show_all_nodes() ? S_NODE : null, new CCheckBox('all_physical_hosts', null, "checkAllHosts('" . $ipmicontrol_form->getName() . "', 'all_physical_hosts', '');"), _('Host name'), _('IPMI interface'), _('Status'), _('Problems')));
    $hosts = get_ipmi_hosts();
    if (empty($hosts)) {
        return null;
    }
    foreach ($hosts as $host) {
        $triggers = get_triggers($host['hostid']);
        $trigger_count = count($triggers);
        // get State
        if (!$preloading) {
            if (is_script_success($host['hostid'], $script_itemkey)) {
                $state = strtolower(get_item_value($host['hostid'], "ipmi.state.text"));
            } else {
                $state = _('script failed');
            }
        } else {
            $state = _('loading...');
        }
        // Check box
        $checkbox_col = new CCheckBox("hostids[]", null, null, $host['hostid']);
        if (!is_operation_available("ipmi", $state)) {
            $checkbox_col->attributes['disabled'] = 'disabled';
        }
        // Host name
        if ($trigger_count == 0) {
            $hostname_col = new CCol(new CSpan($host['host']));
        } else {
            $hostname_col = new CLink(new CSpan($host['host']), 'tr_status.php?&hostid=' . $host['hostid'] . '&show_triggers=' . TRIGGERS_OPTION_ONLYTRUE);
        }
        // IPMI Interfaces
        $ipmi_addresses = get_addresses($host['hostid'], INTERFACE_TYPE_IPMI);
        $ipmi_ip_col = new CCol(reset($ipmi_addresses));
        // Status
        $state_col = new CCol($state, get_item_level($state));
        // Problem
        if ($trigger_count == 0) {
            $problem_col = new CCol($trigger_count, 'normal');
        } else {
            $problem_col = new CCol($trigger_count, 'high');
            $problem_col->setHint(make_trigger_table($triggers, $hostname_col));
        }
        $r = new CRow();
        $r->addItem($checkbox_col);
        $r->addItem($hostname_col);
        $r->addItem($ipmi_ip_col);
        $r->addItem($state_col);
        $r->addItem($problem_col);
        $table->addRow($r);
    }
    $table->setFooter(new CCol(make_operation_box_footer(zbx_objectValues($hosts, 'hostid'), $form_name)));
    $ipmicontrol_form->addItem($table);
    $script = new CJSScript(get_js("jQuery('#hat_ipmistat_footer').html('" . _s('Updated: %s', zbx_date2str(_('H:i:s'))) . "')"));
    return new CDiv(array($ipmicontrol_form, $script));
}