Skip to main content
5-Regular Member
Oct 30, 2023 9:27 AM UTC
Solved

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

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 

 

19-Tanzanite
Oct 31, 2023 8:58 PM UTC

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.

 

3 replies

24-Ruby IV
Oct 31, 2023 7:49 AM UTC
5-Regular Member
Oct 31, 2023 7:59 AM UTC

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.  

Translate
19-Tanzanite
Oct 31, 2023 8:58 PM UTC

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.

 

Translate