initResult(); $outForm->formatElement(OutputFormatter::FC_BEG, "sysal"); $outForm->formatElement(OutputFormatter::FC_SGL, "query"); $outForm->formatElement(OutputFormatter::FC_BEG, "result"); $outForm->formatElement(OutputFormatter::FC_BEG, "balmonlist"); // read all monitors $balmons = AlarmBalanceMonitorQuery::create()->find(); // add balmons to output foreach ($balmons as $balmon) { $fattrs = array ('id' => $balmon->getId()); $outForm->formatElement(OutputFormatter::FC_BEG, "balmon", null, $fattrs); $outForm->formatElement(OutputFormatter::FC_SGL, "name", $balmon->getName()); $outForm->formatElement(OutputFormatter::FC_SGL, "uncfd_asta_bal", $balmon->getUncfdAstaBal()); $outForm->formatElement(OutputFormatter::FC_SGL, "cfd_asta_bal", $balmon->getCfdAstaBal()); $outForm->formatElement(OutputFormatter::FC_END); } $outForm->formatElement(OutputFormatter::FC_END); $outForm->formatElement(OutputFormatter::FC_END); $outForm->formatElement(OutputFormatter::FC_END); } /** * Get Alarms related to an ABM instance * * @param OutputFormatter $outForm * @param string $abm_name * @param out: $ret_val (ComCON::RC_NOT_EXIST, if requested ABM does not EXIST) */ static function getMonitorAlarms (OutputFormatter $outForm, $abm_id, &$ret_val) { // initialize result list $ret_val = ComCon::RC_OK; $outForm->initResult(); $outForm->formatElement(OutputFormatter::FC_BEG, "sysal"); $outForm->formatElement(OutputFormatter::FC_SGL, "query"); $outForm->formatElement(OutputFormatter::FC_BEG, "result"); $outForm->formatElement(OutputFormatter::FC_BEG, "alarmlist"); // read needed data $balmon = AlarmBalanceMonitorQuery::create()->findPk($abm_id); if ($balmon == null) { $ret_val = ComCon::RC_NOT_EXIST; return; } // alarm conditions have to be ordered by alarming objects $almcons = $balmon->getRelatedAlarms(); // add almobjs and almcons to outout $almobjId = 0; foreach ($almcons as $almcon) { // check if alarming object has changed if ($almobjId != $almcon->getAmoId()) { if ($almobjId != 0) { $outForm->formatElement(OutputFormatter::FC_END); } $almobjId = $almcon->getAmoId(); // add almobj to outout $almobj = $almcon->getAlarmingManagedObject(); $fattrs = array ('id' => $almobjId); $outForm->formatElement(OutputFormatter::FC_BEG, "almobj", null, $fattrs); $outForm->formatElement(OutputFormatter::FC_SGL, "addr", $almobj->getInstAddr()); $outForm->formatElement(OutputFormatter::FC_SGL, "name", $almobj->getName()); } // add almcon to outout $almevt = $almcon->getAlarmEventDescriptor(); $fattrs = array ('id' => $almcon->getId()); $outForm->formatElement(OutputFormatter::FC_BEG, "alarm", null, $fattrs); $outForm->formatElement(OutputFormatter::FC_SGL, "alm_spec", $almevt->getEvtSpec()); $outForm->formatElement(OutputFormatter::FC_SGL, "evt_time", $almcon->getEvtTime()); $outForm->formatElement(OutputFormatter::FC_SGL, "rec_date", $almcon->getRecDate()); $outForm->formatElement(OutputFormatter::FC_SGL, "alm_stat", $almcon->getAlmStat()); $outForm->formatElement(OutputFormatter::FC_SGL, "serv_infl", $almcon->getServInfl()); $outForm->formatElement(OutputFormatter::FC_END); } // close last element if any alarm was present if ($almobjId != 0) { $outForm->formatElement(OutputFormatter::FC_END); } $outForm->formatElement(OutputFormatter::FC_END); $outForm->formatElement(OutputFormatter::FC_END); $outForm->formatElement(OutputFormatter::FC_END); } static function confirmMonitor($abm_id, &$esc_inf, &$ret_val) { // initialize output $ret_val = ComCon::RC_OK; // read needed data $abm = AlarmBalanceMonitorQuery::create()->findPk($abm_id); if ($abm == null) { $ret_val = ComCon::RC_NOT_EXIST; return; } $cfd_bal = $abm->getCfdAstaBal(); $abm->setCfdAstaBal($cfd_bal->join($abm->getUncfdAstaBal())); $abm->setUncfdAstaBal(new AlarmBalance()); $abm->save(); // prepare escalation info: alarm clearance $host_lst = array(); if (count($esc_host_sel = $abm->getEscHostSel()) > 0) { $amh_lst = AlarmingManagementHostQuery::create()->find(); foreach ($amh_lst as $amh) { if (in_array($amh->getId(), $esc_host_sel)) { $host_lst[] = $amh; } } } $esc_inf = array( 'tgt_hosts' => $host_lst, 'inst' => new InstAddr(InstAddrSel::FREE_FORM, "alarm_balance_monitor:" . $abm->getName()), 'event' => new EventSpec(EventSel::FREE_FORM, 'alarm_balancing_escalation'), 'sevty' => new AlarmSevty(AlarmSevty::AS_CLEAR) ); } }