Add possibility to get sync service status from command line

Aliaksei Valko 2 years ago in ADAM Core • updated by Dieter De Doncker 2 years ago 0

Dear ADAM Team,

We would like to have a way include sync service into our monitoring system. In order to do that we need to get status of sync process somehow from Adam.CommandLine. Currently, if process fails, windows service continue to work and monitoring system cannot see that sync service is not working anymore.

After a restart of windows service usually everything works fine, but it is not possible to understand when we need to do this restart. 

For more details please navigate to https://support.adamsoftware.net/requests/9465

Thank you a lot!



scalability monitoring

Hey Aliaksei,

The sync service exposes its state via a small non-documented REST API (non-documented here means that it is publicly exposed but we don't provide backwards compatibility support for it). We could write a Knowledge Base Article for you giving detailed instructions on extracting the sync service status via a Powershell script. As a brief example of this, I've included this small working snippet (you need to change the registration/session/synUrl to match your environment):

$reg = 'adamnet'
$session = '5EF8B35F-FB82-40F6-9A39-CF8E18E4E991'
$synUrl = 'http://localhost:9001/status/synchronization'

$result = Invoke-WebRequest $synUrl -Headers @{"registration"="$reg";"sessionId"="$session"} -UseBasicParsing
return $result -match '"status":"Started"'

Would something along these lines be a good solution for you? If so, we could definitely expand upon the above snippet to extract the session id and the sync service settings from Powershell and provide more detailed instructions for its use.

Any feedback welcome,


Dear David,

Thank you for your response. 

The snippet you've provided looks very promising for me. I am going to pass it to our monitoring engineers and give it a try. Of course, I will keep you informed about a result we get.

Best regards,


Hey Aliaksei,

I'm glad it might be useful. We will try to flesh this snippet out into a full KB article for you to help you, please allow us some time to get something ready.

In the mean time if you want to use the above snippet now, you'll have to work out your session id yourself (which can be done using ADAMs .Net API or the REST API).



Dear David,

I've found a very similar solution via C#, that works as good as provided one. It is no longer an issue to identify the status of the sync process.

private const string SYNCHRONIZATION_SERVICE_STATUS_STARTED = "Started";
private const string SYNCHRONIZATION_SERVICE_STATUS_IDLE = "Idle";

private static void Main(string[] args)

var app = GetApplication(Environment.Dev);

if (app == null)

var synchronizationHelper = new Adam.Core.EnterpriseSearch.Rest.Client.EnterpriseSearchSynchronizationHelper(app);
var status = synchronizationHelper.GetStatus();

string.Format("Enterprise search is unavailable. Synchronization service status: '{0}'",


var newStatus = synchronizationHelper.GetStatus();

   Console.WriteLine("Status after call to StartSynchronization():" + newStatus.Status);





Sorry for using of incorrect {code} snippet. Could somebody please fix that? 

Hi Aliaksei

I've removed the {code} snippet for you. Thank you for this contribution, nicely found :)

I'll add one note to that. Using the EnterpriseSearchSynchronizationHelper is allowed as it's public API.

It's however undocumented, which also means it can change between versions without notice.

Best regards