How to retrieve all alarms in view (which can have sub views) in GQI script, like for example
I want of get all of this table info but in GQI
Hi Apurva,
To filter alarms based on a view, you need to get the elements in that view.
The "Get View Relations" data source can be used to get this data, after which you can join this with the "Get Alarms" data source.
Note that with this approach, you might not get the identical list as in Cube (Services, analytical alarms,...)
That is definitely possible, see for example this GQI Ad-hoc data source that gets alarms based on a public alarm filter: https://github.com/SkylineCommunications/SLC-GQIDS-ActiveAlarmsUsingFilter
I could get but in filter do I need to pass view name like "Event Monitoring" in my case to get all services inside that?
Is there a way wherein I can write an adhoc data GQI script to fetch all this info if I give the view like in the image I provided?
I have this script
DmsAgent agent = new DmsAgent();
GetActiveAlarmsMessage getActiveAlarmsRequest = new GetActiveAlarmsMessage(agent.ID);
var res = _dms.SendMessage(getActiveAlarmsRequest) as ActiveAlarmsResponseMessage;
var activeAlarms = res.ActiveAlarms.WhereNotNull().ToList();
var filteredAlarms = activeAlarms
.Where(alarm => alarm.ViewImpactInfo.Any(x => x.Name == "Event Monitoring"))
.ToList();
foreach (var alarm in filteredAlarms.OrderBy(x => x.Severity))
{
if (alarm.Services != null && alarm.Services.Length > 0)
{
servicesName.Clear();
foreach (var service in alarm.Services)
{
var request = new GetServiceByIDMessage(service);
var serviceInfo = _dms.SendMessage(request) as ServiceInfoEventMessage;
var requestForView = new GetViewsForServiceMessage(agent.ID, serviceInfo.ID);
var viewInfo = _dms.SendMessage(requestForView) as GetViewsForServiceResponse;
var views = viewInfo?.Views;
_logger.Information("VIEWS………");
foreach (var item in views)
{
_logger.Information(item.Name);
}
if (serviceInfo != null)
{
string serviceName = serviceInfo.Name;
servicesName.Add(serviceName);
}
}
}
var key = $"{alarm.AlarmID} – {alarm.ElementID}";
var cells = new[]
{
new GQICell { Value = alarm.ElementName },
new GQICell { Value = alarm.ParameterName },
new GQICell { Value = alarm.Severity },
new GQICell { Value = alarm.Value },
new GQICell { Value = alarm.Type },
new GQICell { Value = string.Join(";", servicesName) },
new GQICell { Value = alarm.Owner },
new GQICell { Value = alarm.TimeOfArrival.ToUniversalTime() },
new GQICell { Value = alarm.AlarmID },
new GQICell { Value = alarm.DataMinerID },
};
rowsToReturn.Add(new GQIRow(key, cells));
}
so is there a way, I can say return all this info for GQI, but for the view name I specify like Event Monitoring in this case, like I see on cube