Skip to main content
5-Regular Member
October 30, 2023
Solved

How to use Edge MicroServer (EMS) to monitor Event view logs and communicate back to ThingWorx

  • October 30, 2023
  • 1 reply
  • 1638 views

Hi Team,

 

We are trying to leverage on the Edge MicroServer (EMS) which when hosted on remote server and communicate back to ThingWorx on situation like Services are running or monitor event viewer logs and alert on particular exception etc 

 

Looking forward to hear from the community 

 

Best answer by VladimirRosu_116627

Hi @SC_10151701 ,

I'm guessing you probably need to raise something called Remote Events in EMS.

There is a file called "example.lua" in the /etc/custom/templates EMS folder that should give you idea on how to fire such an event, in the Remote Service "FireExampleEvent".

Now on when to trigger such an event, that is not something very sophisticated, since you'll probably need to do a polling to the event viewer logs to see if you want to raise such an event. You should use a task concept (basically a local edge timer) to check on that, then raise the event if needed.

Another point is that the code you'll write to check that will need to either be in LUA (don't know how familiar you're with that) or, as I did it many times, you can create a program that does that in your favorite programming language, then execute it from LUA.

Looking on your requirements, I do have the feeling you're using Windows as the source device, so I must advise to check on the .NET SDK, as probably it will be easier to interact with Windows' subsystems - lots of wrappers out there in .NET grace of Microsoft.

 

1 reply

24-Ruby III
October 31, 2023
5-Regular Member
October 31, 2023

Hi Vladimir,

 

Thank you for your response. My question is about how EMS can communicate back to thingworx on situation like Services are running or monitor event viewer logs and alert on particular exception. My question is not about how use EMS to connect to ThingWorx rather after that, how to leverage EMS connection to notify thingworx on on such special situations where EMS is running.  

19-Tanzanite
October 31, 2023

Hi @SC_10151701 ,

I'm guessing you probably need to raise something called Remote Events in EMS.

There is a file called "example.lua" in the /etc/custom/templates EMS folder that should give you idea on how to fire such an event, in the Remote Service "FireExampleEvent".

Now on when to trigger such an event, that is not something very sophisticated, since you'll probably need to do a polling to the event viewer logs to see if you want to raise such an event. You should use a task concept (basically a local edge timer) to check on that, then raise the event if needed.

Another point is that the code you'll write to check that will need to either be in LUA (don't know how familiar you're with that) or, as I did it many times, you can create a program that does that in your favorite programming language, then execute it from LUA.

Looking on your requirements, I do have the feeling you're using Windows as the source device, so I must advise to check on the .NET SDK, as probably it will be easier to interact with Windows' subsystems - lots of wrappers out there in .NET grace of Microsoft.