Hi I'd like to monitor the output of a command line application via a DataMiner connector, is this possible?
The configuration I currently have in mind would be something like this:
- The connector contains a configuration table with several sets of command line arguments to be sent to this application.
- The timer (e.g. 15 minutes) will start the command line app for each entry in the configuration table. I still need to test if the app can handle multiple calls in parallel or not.
- The command line app can be configured to push the output to either an .html or .json file. These files should be read and relevant data be pushed into a logger table where it will be kept for a limited time, e.g. 3 months.
- The app can run some time for each call (1-2 minutes), so it may be needed to have some kind of mechanism to check when new output files are available.
- Processed output files should be deleted, to avoid filling up the hard drive.
- Data from the logger table should be possible to view in a graph grouped by the entries from the configuration table, e.g. in trending or a dashboard
Is it possible to do something like this? Are there any existing connectors where I can take a look at the code as an example?
The command line application is created by someone else, so I don’t have control over this.
Hi Michiel,
Not yet a straight answer to your question, but I'm also interested because I would need to do the same from an automation script.
I've been checking around, and apparently, we can use the Process class from System.Diagnostics to launch an instance with the command line application. In a simple console application, the following code works, but I haven't tried from DataMiner:
Hi Gelber,
Thanks for your input!
I don’t know if it fits your needs, but from automation there is also the “RunClientProgram” command, which also allows you to pass arguments and wait for completion (see https://help.dataminer.services/dataminer/#t=DataMinerUserGuidepart_7CsharpReferenceEngine_methods.htm&rhsearch=RunClientProgram&rhhlterm=RunClientProgram&rhsyns=)
I would also consider exposing an HTTP API in your command line application, it’s quite easy these days with .NET 5 & 6 and will remove the disk I/O. It’s also more straightforward to create an HTTP connection.