Hello,
Aside from editing the timeout value directly as shown below, is any other option to do the requested in bulk ? For e.g., using a script ? Thank you.
Another alternative, instead of using an automation script, is to use the element export/import to CSV function.
This allows you to export your element settings to a CSV file, you can change the file to update different settings from several elements and import the file. DataMiner will process this and update all elements from the CSV accordingly.
Looking at the CSV data exported, you will find the time settings you asked for:
Further details can be found: Importing and exporting elements | DataMiner Docs
In this video, there's a step-by-step explanation of this: Rui’s Rapid Recap - Bulk editing via CSV import - DataMiner Dojo
Hi,
Please find below an example of changing the primary connection timeout when is SNMPV2. If your element is different just change accordingly.
using System;
using System.Linq;
using Skyline.DataMiner.Automation;
using Skyline.DataMiner.Library.Automation;
using Skyline.DataMiner.Library.Common;
/// <summary>
/// DataMiner Script Class.
/// </summary>
public class Script
{
/// <summary>
/// The Script entry point.
/// </summary>
/// <param name="engine">Link with SLAutomation process.</param>
public void Run(Engine engine)
{
var dms = engine.GetDms();
var element = dms.GetElement("cn-lab-340-1");
var connection = element.Connections.FirstOrDefault() as SnmpV2Connection;
connection.Timeout = TimeSpan.FromMilliseconds(1500);
element.Update();
}
}
You need the following references/nuget packages:
<Param type="ref">C:\Skyline DataMiner\ProtocolScripts\DllImport\slc.lib.automation\1.3.0.2\lib\net462\SLC.Lib.Automation.dll</Param>
<Param type="ref">C:\Skyline DataMiner\ProtocolScripts\DllImport\slc.lib.common\1.3.0.2\lib\net462\SLC.Lib.Common.dll</Param>
Hi Arunkrishna,
In addition to the answer from Jarno, below you can find an example by using the Class Library.
private void ConfigureHubGateway(IDmsElement hubGatewayElement)
{
foreach (var connection in hubGatewayElement.Connections)
{
if (connection is HttpConnection http)
{
http.Timeout = TimeSpan.FromSeconds(5);
}
}hubGatewayElement.Update();
}
Hi Arun,
Yes, this is possible through an SLNET call, however, I think it should also be possible to do it in the Class Library which is prefered. I don't have an off-the-shelf example though with the Class Library.
Example with SLNET call:
public void ChangeNimbraCommunity(Engine engine, Element myElement, int timeoutTime)
{
LiteElementInfoEvent leimyElement = GetElementLiteInfo(engine, myElement);
if(!string.IsNullOrWhiteSpace(leimyElement.Name))
{
if (leimyElement.PortInfo.Length == 2)
{
leimyElement.PortInfo[0].TimeoutTime = timeoutTime;
}
AddElementMessage aemRequest = new AddElementMessage
{
AlarmTemplate = leimyElement.AlarmTemplate,
CreateDVEs = leimyElement.CreateDVEs,
DataMinerID = leimyElement.DataMinerID,
Description = leimyElement.Description,
ElementID = leimyElement.ElementID,
ElementName = leimyElement.Name,
HostingDataMinerID = leimyElement.HostingAgentID,
IsHidden = leimyElement.Hidden,
IsReadOnly = leimyElement.IsReadOnly,
IsReplicationActive = leimyElement.IsReplicated,
KeepOnline = leimyElement.KeepOnline,
Ports = leimyElement.PortInfo,
ProtocolName = leimyElement.Protocol,
ProtocolVersion = leimyElement.ProtocolVersion,
State = leimyElement.State,
TrendTemplate = leimyElement.TrendTemplate,
Type = leimyElement.Type,
};
engine.SendSLNetSingleResponseMessage(aemRequest);
}
}