Anchor | ||||
---|---|---|---|---|
|
Include Page | ||||
---|---|---|---|---|
|
...
Charon-AXP/VAX/PDP come with the logmond (Log Monitor & Dispatcher) utility. This utility can monitor the emulator log for events indicating that the license has been removed. The knowledge base article
Please refer to CHARON Log monitoring on Windows (logmond) describes the use of this tool in detail. This section will provide an example for one possible use. It contains detailed descriptions for using this tool on all supported Charon product versions.
Currently, there is no comparable utility for the Charon-AXP/SMA product.
...
|
Basic Information About Log Monitor & Dispatcher
Info |
---|
Location of the Log Monitor & Dispatcher: Charon-AXP/VAX versions before version 4.8: Depending on the type of host system (x64 or x86) used, the program will be located in the x86 or the x64 subdirectory in the C:\Program Files\CHARON\Utilities_<version>\ directory. Charon-AXP/VAX versions 4.8 and higher: The installation directories for all the utilities and Charon executables are C:\Program Files\CHARON\Build_<version>\x86 and C:\Program Files\CHARON\Build_<version>\x64 depending on the architecture of the host system. The examples in this chapter use the x64 architecture. |
The program runs in the background either as a normal program or as a Windows service and monitors the emulator log files for events indicating the removal of the license (message code 0000002A, 00000351, or 00000424 - depending on Charon-AXP/VAX version).
When such an event is detected, logmond runs a file named nolicense.bat. This file contains the custom actions to be performed when the event is detected. For example, it can be used to create an entry in the Windows event log or to send an email.
Starting with version 4.9 of Charon-AXP/VAX, logmond will also monitor messages with code 0000040B in the log file (indicating that the emulator has started to use a different license). If such a message occurs, it will run a file called license_changed.bat. The examples in this section refer to the nolicense.bat file.
...
> “C:\Program Files\CHARON\Build_<version>\x64\logmond”
This will display a list program options in a separate window, similar to the one below:
...
class | pagebreak |
---|
Working with the Log Monitor & Dispatcher
The logmond program can be started manually in background mode for the log files of individual emulator instances or as a Windows service. If started as a service, it will detect all emulator instances that also run as Windows services.
Recommendations:
Make sure that the nolicense.bat file is located in the home directory of the Charon emulator instance you want to monitor.
Use the rotating log files mechanism or use a single log file with append mode.
Install your emulator instances as services, they will then be able to start when the Charon Windows server boots. Then install and start the Charon log monitor also as a Windows service (named EmulatorLogMonitor). This eliminates the need to start logmond manually and newly added emulator services will be automatically taken into account.
Starting and Stopping the Log Monitor & Dispatcher in Background Mode
Starting logmond
To start logmond as a normal program running in the background:
Press WIN+R and enter cmd.exe or start the command window via the Start menu.
Change the current directory to the folder containing the Charon log file and the nolicense.bat file.
Start the Log Monitor & Dispatcher to work with one log file or rotating log files, as shown below.
...
Description
...
Commands to Start logmond as a Background Application
...
Start logmond for a single log file.
...
> “C:\Program Files\CHARON\
Build_<version>
\x64\logmond” <logfile>
...
or
...
Start logmond for a rotating log file.
...
> “C:\Program Files\CHARON\
Build_<version>
\x64\logmond” -l <log-directory> -p <log-prefix>
...
<log-directory> is the directory where the rotating log files are stored
<log-prefix> is the same as the configuration_name value in corresponding Charon configuration file (or hw_model if configuration_name is not specified).
Info |
---|
Several Log Monitor & Dispatcher processes can run simultaneously. |
Stopping logmond
To stop the Log Monitor & Dispatcher application, open the Task Manager, find the logmond.exe process and terminate it.
Starting and Stopping the Log Monitor & Dispatcher as a Windows Service
Info |
---|
When the Log Monitor & Dispatcher runs as a Windows service, it will detect Charon instances that also run as Windows services. It cannot detect Charon instances that are manually started or started via the Charon Launcher. To monitor the log files of manually started instances, use logmond in background mode as described above. |
...
class | pagebreak |
---|
Adding and Starting logmond as a Service
To add logmond as a Windows service named EmulatorLogMonitor and to start it, open the command window (cmd.exe) via the Start menu using the Run as Administrator option.
Install the Log Monitor & Dispatcher as a Windows service using the commands shown below.
...
Step
...
Description
...
Commands to Install logmond as a Windows Service
...
1
...
Remove an existing service, if needed.
...
> “C:\Program Files\CHARON\
Build_<version>
\x64\logmond” -r
...
2
...
Install logmond as a service
...
> “C:\Program Files\CHARON\
Build_<version>
\x64\logmond” -i
...
3
...
Start the service
...
> “C:\Program Files\CHARON\
Build_<version>
\x64\logmond” -u
Note |
---|
By default, the service configuration is set for manual startup. To start it automatically at system startup, modify the setting in the Windows Service management tool. |
Stopping the Service
You can stop the service using the Windows Service management tool, or you can enter the following command in a command window (as Administrator):
...
> “C:\Program Files\CHARON\
Build_<version>
\x64\logmond” -d
The nolicense.bat File
If the Log Monitor & Dispatcher detects that a license was removed, it executes the file nolicense.bat. This file contains the command needed to alert the user to the fact that the Charon license was removed from the system.
Note |
---|
The script cannot execute interactive applications. |
Path Considerations with Respect to nolicense.bat
To start nolicense.bat, logmond checks its current directory for the existence of nolicense.bat.
The current directory for this purpose depends on how logmond was started:
If logmond is started with only the path to the log file, the current directory will be the one in which the user is while starting the background process. Change your current working directory to the one containing nolicense.bat before starting logmond.
If logmond is started as a service with a specific log file path passed to it, it will also consider the directory from which the user performs the command as the current directory. So, change your current working directory to the one containing nolicense.bat before starting the service.
If you start logmond providing the Charon service name, the program will use the home directory of the Charon service as its current directory. So, the nolicense.bat file has to be in this directory as well.
If you start logmond with the -e parameter (automatically assumed when creating a Windows service as described in the section above), a slave process will be created for each additional Charon service and the home directory of this service will be the current working directory of the slave process. This is where the nolicense.bat file should be kept.
To find the home directory of a specific Charon service, open the CHARON service manager, right-click on the emulator name in question and select View Configuration from the menu. The picture below shows an example.
...
class | pagebreak |
---|
Example: Create a Windows Event
A variety of mechanisms can be implemented in nolicense.bat to inform the user about the license problem. Examples:
Create a Windows event.
Send an email or perform other actions using a PowerShell script.
The following example shows a one line nolicense.bat file to create a Windows event:
...
Sample content of nolicense.bat file to create a Windows event
...
powershell -command "New-Eventlog -Logname application -Source CHARON -Erroraction silentlycontinue;Write-Eventlog -Logname application -Source CHARON -Entrytype Error -Eventid 314 -Message 'CHARON license dongle disconnected'"
Stromasys recommends using the PowerShell command to write events instead of the "eventcreate" program as some other events are created with PowerShell scripts. Using the eventcreate command in this case will fail as the source, Charon, will not be accepted.
This example will create the following event if the license is removed:
The parameters set in the nolicense.bat file are highlighted in the screenshot above.
Using the Windows Event viewer and the Windows Task Manager, it is also possible to attach an action to the event, such as running a program.
...
License Expiration Check on Windows
...