- alarmgo cli commands are used
- review comments incorporated
- robot cases removed
- UT fixes corrected
Change-Id: I4b274f9953796067630e03b470c1aa67e93f2691
Signed-off-by: vipin <vipin.mavila@nokia.com>
#
export RMR_SEED_RT=$PWD/config/uta_rtg.rt
export RMR_SRC_ID="service-ricplt-alarmmanager-rmr.ricplt"
#
export RMR_SEED_RT=$PWD/config/uta_rtg.rt
export RMR_SRC_ID="service-ricplt-alarmmanager-rmr.ricplt"
+export DEF_FILE=$PWD/definitions/alarm-definition.json
$PWD/manager/alarm-manager -f $PWD/config/config-file.json
$PWD/manager/alarm-manager -f $PWD/config/config-file.json
import (
"encoding/json"
"fmt"
import (
"encoding/json"
"fmt"
"gerrit.o-ran-sc.org/r/ric-plt/alarm-go/alarm"
app "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
clientruntime "github.com/go-openapi/runtime/client"
"gerrit.o-ran-sc.org/r/ric-plt/alarm-go/alarm"
app "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
clientruntime "github.com/go-openapi/runtime/client"
"github.com/prometheus/alertmanager/api/v2/models"
"github.com/spf13/viper"
"io/ioutil"
"github.com/prometheus/alertmanager/api/v2/models"
"github.com/spf13/viper"
"io/ioutil"
)
func (a *AlarmManager) StartAlertTimer() {
)
func (a *AlarmManager) StartAlertTimer() {
if found {
a.alarmHistory = append(a.alarmHistory, *m)
a.activeAlarms = a.RemoveAlarm(a.activeAlarms, idx, "active")
if found {
a.alarmHistory = append(a.alarmHistory, *m)
a.activeAlarms = a.RemoveAlarm(a.activeAlarms, idx, "active")
+ if len(a.alarmHistory) >= a.maxAlarmHistory {
+ app.Logger.Error("alarm history count exceeded maxAlarmHistory threshold")
+ histAlarm := a.alarmClient.NewAlarm(alarm.ALARM_HISTORY_EXCEED_MAX_THRESHOLD, alarm.SeverityWarning, "threshold", "history")
+ histAlarmMessage := alarm.AlarmMessage{Alarm: histAlarm, AlarmAction: alarm.AlarmActionRaise, AlarmTime: (time.Now().UnixNano())}
+ a.activeAlarms = append(a.activeAlarms, histAlarmMessage)
+ a.alarmHistory = append(a.alarmHistory, histAlarmMessage)
+ }
if a.postClear {
return a.PostAlert(a.GenerateAlertLabels(m.Alarm, AlertStatusResolved, m.AlarmTime))
}
if a.postClear {
return a.PostAlert(a.GenerateAlertLabels(m.Alarm, AlertStatusResolved, m.AlarmTime))
}
The attempt to raise the alarm next time will be supressed when found as duplicate. */
if len(a.activeAlarms) >= a.maxActiveAlarms {
app.Logger.Error("active alarm count exceeded maxActiveAlarms threshold")
The attempt to raise the alarm next time will be supressed when found as duplicate. */
if len(a.activeAlarms) >= a.maxActiveAlarms {
app.Logger.Error("active alarm count exceeded maxActiveAlarms threshold")
- actAlarm := a.alarmClient.NewAlarm(alarm.ACTIVE_ALARM_EXCEED_MAX_THRESHOLD, alarm.SeverityWarning, "clear alarms or raise threshold", "active alarms full")
+ actAlarm := a.alarmClient.NewAlarm(alarm.ACTIVE_ALARM_EXCEED_MAX_THRESHOLD, alarm.SeverityWarning, "threshold", "active")
actAlarmMessage := alarm.AlarmMessage{Alarm: actAlarm, AlarmAction: alarm.AlarmActionRaise, AlarmTime: (time.Now().UnixNano())}
a.activeAlarms = append(a.activeAlarms, actAlarmMessage)
a.alarmHistory = append(a.alarmHistory, actAlarmMessage)
actAlarmMessage := alarm.AlarmMessage{Alarm: actAlarm, AlarmAction: alarm.AlarmActionRaise, AlarmTime: (time.Now().UnixNano())}
a.activeAlarms = append(a.activeAlarms, actAlarmMessage)
a.alarmHistory = append(a.alarmHistory, actAlarmMessage)
if len(a.alarmHistory) >= a.maxAlarmHistory {
app.Logger.Error("alarm history count exceeded maxAlarmHistory threshold")
if len(a.alarmHistory) >= a.maxAlarmHistory {
app.Logger.Error("alarm history count exceeded maxAlarmHistory threshold")
- histAlarm := a.alarmClient.NewAlarm(alarm.ALARM_HISTORY_EXCEED_MAX_THRESHOLD, alarm.SeverityWarning, "clear alarms or raise threshold", "alarm history full")
+ histAlarm := a.alarmClient.NewAlarm(alarm.ALARM_HISTORY_EXCEED_MAX_THRESHOLD, alarm.SeverityWarning, "threshold", "history")
histAlarmMessage := alarm.AlarmMessage{Alarm: histAlarm, AlarmAction: alarm.AlarmActionRaise, AlarmTime: (time.Now().UnixNano())}
a.activeAlarms = append(a.activeAlarms, histAlarmMessage)
a.alarmHistory = append(a.alarmHistory, histAlarmMessage)
histAlarmMessage := alarm.AlarmMessage{Alarm: histAlarm, AlarmAction: alarm.AlarmActionRaise, AlarmTime: (time.Now().UnixNano())}
a.activeAlarms = append(a.activeAlarms, histAlarmMessage)
a.alarmHistory = append(a.alarmHistory, histAlarmMessage)