Hello all,
I’m looking for assistance with a script development to monitor specific agents for error states. I’m starting with DBLog agents and need to retrieve all available names from the Datasource.
My goal is to access “Adroit.AgentGroup.DBLog.memberNames” and compile these into a DataElementCollection. I attempted this with the script below, but it’s not returning the expected results.
Any guidance on resolving this would be appreciated!
Thank you in advance.
private void CheckStatus() { // Retrieve the list of DBLog member names MethodReturnInfo infoMembers = MyConnection.ReadDataElement("Adroit.AgentGroup.DBLog.memberNames"); DataElement dblogMembersElement = infoMembers.ReturnObject as DataElement; // Ensure the response is valid and contains the expected array of names if (infoMembers.Success) { //I don't know if this is right. string[] dblogMemberNames = dblogMembersElement.Value as string[]; // Create a collection to hold the specific DataElements we're interested in DataElementCollection decdblog = DataElementEngine.NewDataElementCollection(); // Add ConnectionError and lastError elements for each DBLog member foreach (string dblogName in dblogMemberNames) { // Define ConnectionError and lastError elements based on each DBLog name DataElement dedblogError = DataElementEngine.NewDataElement("Adroit.DBLog." + dblogName + ".ConnectionError"); DataElement dedblogErrorMessage = DataElementEngine.NewDataElement("Adroit.DBLog." + dblogName + ".lastError"); decdblog.Add(dedblogError); decdblog.Add(dedblogErrorMessage); } } }