In DM you can list all the services to see what their IDs are, but these IDs are NOT the IDs that are actually used in the names of the actual MySQL trend tables for the services. Inspecting the actual .xml files for the services and service elements it appears that the actual ID is the Service ID + 1.
Questions:
- Is there a way in DM to get a list of all the actual Service Element IDs as described above?
- Are the Service Element IDs as described above guaranteed to always be the Service ID + 1
Thanks
Hi Jeff,
Services with a protocol internally consist of the actual service and a hidden element with the same name as the service. If you assign the protocol during service creation the ID of the element will typically be the ServiceID + 1 but there is no guarantee due to race conditions, and if you assign a protocol later then the ID will very likely be higher if other elements/services have been created in the mean time.
The code snippet below can be put in an automation script to generate a list of all enhanced services.
using System;
using System.IO;
using System.Linq;
using System.Text;
using Skyline.DataMiner.Automation;
using Skyline.DataMiner.Net;
using Skyline.DataMiner.Net.Messages;
public class Script
{
public void Run(Engine engine)
{
var elements = engine.SendSLNetMessage(
new GetLiteElementInfo() {
IncludeServiceElements = true,
ServiceElementsOnly = true });
var sb = new StringBuilder();
foreach (var e in elements.OfType<LiteServiceElementInfoEvent>().OrderBy(x => x.Name))
sb.AppendLine($"{e.Name},{e.LinkedServiceDmaID}/{e.LinkedServiceID},{e.DataMinerID}/{e.ElementID}");
File.WriteAllText(@"C:\temp\services.txt", sb.ToString());
}
}
Burt,
Thank you for your response and info. I will give your code a try next week after the US holidays.
Cheers