Ejemplo n.º 1
0
function make_acktab_by_eventid($eventid)
{
    $table = new CTableInfo();
    $table->SetHeader(array(S_TIME, S_USER, S_COMMENTS));
    $acks = get_acknowledges_by_eventid($eventid);
    while ($ack = DBfetch($acks)) {
        $user = get_user_by_userid($ack['userid']);
        $table->AddRow(array(date('d-m-Y h:i:s A', $ack['clock']), $user['alias'], new CCol(zbx_nl2br($ack['message']), 'wraptext')));
    }
    return $table;
}
Ejemplo n.º 2
0
function make_acktab_by_eventid($eventid)
{
    $table = new CTableInfo();
    $table->SetHeader(array(S_TIME, S_USER, S_COMMENTS));
    $acks = get_acknowledges_by_eventid($eventid);
    while ($ack = DBfetch($acks)) {
        //$users = CUser::get(array('userids' => $ack['userid'],  'output' => API_OUTPUT_EXTEND));
        //$user = reset($users);
        $table->addRow(array(zbx_date2str(S_ACKNOWINC_BY_EVENTS_DATE_FORMAT, $ack['clock']), $ack['alias'], new CCol(zbx_nl2br($ack['message']), 'wraptext')));
    }
    return $table;
}
Ejemplo n.º 3
0
function insert_new_message_form($events, $bulk)
{
    global $USER_DETAILS;
    if ($bulk) {
        $title = S_ACKNOWLEDGE_ALARM_BY;
        $btn_txt2 = S_ACKNOWLEDGE . ' ' . S_AND_SYMB . ' ' . S_RETURN;
    } else {
        $temp = get_acknowledges_by_eventid(get_request('eventid', 0));
        if (!DBfetch($temp)) {
            $title = S_ACKNOWLEDGE_ALARM_BY;
            $btn_txt = S_ACKNOWLEDGE;
            $btn_txt2 = S_ACKNOWLEDGE . ' ' . S_AND_SYMB . ' ' . S_RETURN;
        } else {
            $title = S_ADD_COMMENT_BY;
            $btn_txt = S_SAVE;
            $btn_txt2 = S_SAVE . ' ' . S_AND_SYMB . ' ' . S_RETURN;
        }
    }
    $frmMsg = new CFormTable($title . ' "' . $USER_DETAILS["alias"] . '"');
    $frmMsg->SetHelp("manual.php");
    if ($bulk) {
        $frmMsg->addVar('bulkacknowledge', 1);
    }
    foreach ($events as $id => $eventid) {
        $frmMsg->addVar('events[' . $eventid . ']', $eventid);
    }
    $frmMsg->addRow(S_MESSAGE, new CTextArea("message", "", 80, 6));
    $frmMsg->addItemToBottomRow(new CButton("saveandreturn", $btn_txt2));
    isset($btn_txt) ? $frmMsg->addItemToBottomRow(new CButton("save", $btn_txt)) : '';
    $frmMsg->addItemToBottomRow(new CButtonCancel(url_param('eventid')));
    $frmMsg->Show(false);
    SetFocus($frmMsg->GetName(), 'message');
    $frmMsg->Destroy();
}
Ejemplo n.º 4
0
            $last_page = get_last_history_page();
            if (!$last_page) {
                $last_page['url'] = 'tr_status.php?hostid=' . get_profile('web.tr_status.hostid', 0);
            }
            redirect($last_page['url']);
            exit;
        }
    }
}
$msg = $bulk ? ' BULK ACKNOWLEDGE ' : array('"' . expand_trigger_description_by_data($db_data) . '"', BR(), explode_exp($db_data["expression"], 1));
show_table_header(array(S_ALARM_ACKNOWLEDGES_BIG, ' : ', $msg));
echo SBR;
if (!$bulk) {
    $table = new CTable(NULL, "ack_msgs");
    $table->SetAlign("center");
    $db_acks = get_acknowledges_by_eventid($db_data["eventid"]);
    while ($db_ack = DBfetch($db_acks)) {
        $db_user = get_user_by_userid($db_ack["userid"]);
        $table->AddRow(array(new CCol($db_user["alias"], "user"), new CCol(date("d-m-Y h:i:s A", $db_ack["clock"]), "time")), "title");
        $msgCol = new CCol(zbx_nl2br($db_ack['message']));
        $msgCol->SetColspan(2);
        $table->AddRow($msgCol, "msg");
    }
    /**/
    if ($table->GetNumRows() > 0) {
        $table->Show();
        echo SBR;
    }
}
insert_new_message_form($events, $bulk);
?>
Ejemplo n.º 5
0
        add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_TRIGGER, S_ACKNOWLEDGE_ADDED . ' [' . $bulk ? ' BULK ACKNOWLEDGE ' : expand_trigger_description_by_data($event_trigger) . ']' . ' [' . $_REQUEST['message'] . ']');
    }
    if (isset($_REQUEST['saveandreturn'])) {
        $url = new CUrl(urldecode($_REQUEST['backurl']));
        jsRedirect($url->getUrl());
        exit;
    }
}
$msg = $bulk ? ' BULK ACKNOWLEDGE ' : expand_trigger_description_by_data($event_trigger);
show_table_header(array(S_ALARM_ACKNOWLEDGES_BIG . ': ', $msg));
print SBR;
if ($bulk) {
    $title = S_ACKNOWLEDGE_ALARM_BY;
    $btn_txt2 = S_ACKNOWLEDGE . ' ' . S_AND_SYMB . ' ' . S_RETURN;
} else {
    $db_acks = get_acknowledges_by_eventid($_REQUEST['eventid']);
    if ($db_acks) {
        $table = new CTable(null, 'ack_msgs');
        $table->setAlign('center');
        while ($db_ack = DBfetch($db_acks)) {
            //$db_users = CUser::get(array('userids' => $db_ack['userid'], 'output' => API_OUTPUT_EXTEND));
            //$db_user = reset($db_users);
            $table->addRow(array(new CCol($db_ack['alias'], 'user'), new CCol(zbx_date2str(S_ACKNOWLEDGE_DATE_FORMAT, $db_ack['clock']), 'time')), 'title');
            $msgCol = new CCol(zbx_nl2br($db_ack['message']));
            $msgCol->setColspan(2);
            $table->addRow($msgCol, 'msg');
        }
        $table->Show();
    }
    if ($event_acknowledged) {
        $title = S_ADD_COMMENT_BY;
Ejemplo n.º 6
0
function make_small_eventlist($eventid, $trigger_data)
{
    $table = new CTableInfo();
    $table->setHeader(array(S_TIME, S_STATUS, S_DURATION, S_AGE, S_ACK, S_ACTIONS));
    $rows = array();
    $count = 0;
    $sql = 'SELECT * ' . ' FROM events ' . ' WHERE eventid<=' . $eventid . ' ORDER BY eventid DESC';
    $result = DBselect($sql, 100);
    while (($row = DBfetch($result)) && $count < 20) {
        if (!empty($rows) && $rows[$count]['value'] != $row['value']) {
            $count++;
        } else {
            if (!empty($rows) && $rows[$count]['value'] == $row['value'] && $trigger_data['type'] == TRIGGER_MULT_EVENT_ENABLED && $row['value'] == TRIGGER_VALUE_TRUE) {
                $count++;
            }
        }
        $rows[$count] = $row;
    }
    $clock = time();
    foreach ($rows as $id => $row) {
        $lclock = $clock;
        $clock = $row["clock"];
        $duration = zbx_date2age($lclock, $clock);
        $value = new CCol(trigger_value2str($row['value']), get_trigger_value_style($row["value"]));
        $ack = new CSpan(S_NO, 'on');
        if (1 == $row['acknowledged']) {
            $db_acks = get_acknowledges_by_eventid($row['eventid']);
            $rows = 0;
            while ($a = DBfetch($db_acks)) {
                $rows++;
            }
            $ack = array(new CLink(new CSpan(S_YES, 'off'), 'acknow.php?eventid=' . $row['eventid'], 'action'), SPACE . '(' . $rows . ')');
        }
        //actions
        $actions = get_event_actions_stat_hints($row['eventid']);
        //--------
        $table->AddRow(array(new CLink(date('Y.M.d H:i:s', $row['clock']), "tr_events.php?triggerid=" . $trigger_data['triggerid'] . '&eventid=' . $row['eventid'], "action"), $value, $duration, zbx_date2age($row['clock']), $ack, $actions));
    }
    return $table;
}
Ejemplo n.º 7
0
function make_small_eventlist($eventid, $trigger_data)
{
    $config = select_config();
    $table = new CTableInfo();
    $table->setHeader(array(S_TIME, S_STATUS, S_DURATION, S_AGE, $config['event_ack_enable'] ? S_ACK : null, S_ACTIONS));
    $options = array('eventids' => $eventid, 'output' => API_OUTPUT_EXTEND);
    $curevent = CEvent::get($options);
    $curevent = reset($curevent);
    $clock = $curevent['clock'];
    $options = array('triggerids' => $trigger_data['triggerid'], 'eventid_till' => $curevent['eventid'], 'select_triggers' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND, 'sortfield' => 'clock', 'sortorder' => ZBX_SORT_DOWN, 'limit' => 20);
    $events = CEvent::get($options);
    foreach ($events as $enum => $event) {
        $trigger = reset($event['triggers']);
        $event['type'] = $trigger['type'];
        $lclock = $clock;
        $clock = $event['clock'];
        $duration = zbx_date2age($lclock, $clock);
        if ($curevent['eventid'] == $event['eventid'] && ($nextevent = get_next_event($event))) {
            $duration = zbx_date2age($nextevent['clock'], $clock);
        } else {
            if ($curevent['eventid'] == $event['eventid']) {
                $duration = zbx_date2age($clock);
            }
        }
        $value = new CCol(trigger_value2str($event['value']), get_trigger_value_style($event['value']));
        // if acknowledges are not disabled in configuration, let's show them
        if ($config['event_ack_enable']) {
            global $page;
            $backurl = urlencode(urlencode($page['file'] . '?eventid=' . $curevent['eventid'] . '&triggerid=' . $trigger_data['triggerid']));
            if ($event['acknowledged'] == 1) {
                $rows = 0;
                $db_acks = get_acknowledges_by_eventid($event['eventid']);
                while ($a = DBfetch($db_acks)) {
                    $rows++;
                }
                $ack = array(new CLink(S_YES, 'acknow.php?eventid=' . $event['eventid'] . '&backurl=' . $backurl, 'off'), ' (' . $rows . ')');
            } else {
                $ack = array(new CLink(S_NO, 'acknow.php?eventid=' . $event['eventid'] . '&backurl=' . $backurl, 'on'));
            }
        }
        //actions
        $actions = get_event_actions_stat_hints($event['eventid']);
        //--------
        $table->addRow(array(new CLink(zbx_date2str(S_EVENTS_SMALL_EVENT_LIST_DATE_FORMAT, $event['clock']), 'tr_events.php?triggerid=' . $trigger_data['triggerid'] . '&eventid=' . $event['eventid'], 'action'), $value, $duration, zbx_date2age($event['clock']), $config['event_ack_enable'] ? $ack : null, $actions));
    }
    return $table;
}
Ejemplo n.º 8
0
            $last_page = $USER_DETAILS['last_page'];
            if (!$last_page) {
                $last_page['url'] = 'tr_status.php?hostid=' . get_profile('web.tr_status.hostid', 0);
            }
            redirect($last_page['url']);
            exit;
        }
    }
}
$msg = $bulk ? ' BULK ACKNOWLEDGE ' : array('"' . expand_trigger_description_by_data($db_data) . '"', BR(), explode_exp($db_data["expression"], 1));
show_table_header(array(S_ALARM_ACKNOWLEDGES_BIG, ' : ', $msg));
echo SBR;
if (!$bulk) {
    $table = new CTable(NULL, 'ack_msgs');
    $table->setAlign('center');
    $db_acks = get_acknowledges_by_eventid($db_data['eventid']);
    while ($db_ack = DBfetch($db_acks)) {
        $db_user = get_user_by_userid($db_ack['userid']);
        $table->addRow(array(new CCol($db_user['alias'], 'user'), new CCol(date('d-m-Y h:i:s A', $db_ack['clock']), 'time')), 'title');
        $msgCol = new CCol(zbx_nl2br($db_ack['message']));
        $msgCol->setColspan(2);
        $table->addRow($msgCol, 'msg');
    }
    /**/
    if ($table->getNumRows() > 0) {
        $table->Show();
        echo SBR;
    }
}
insert_new_message_form($events, $bulk);
?>