Config Info
Name Monitor Page Generator
Version 1.0

About

This Python-bases tool processes an .exp file and generates output files in different formats based on templates. It processes the .exp file thank to the ElementTree library, and uses jinja2 templates for the generation.

It is used with the .wiki template to generate the Code contents of Custom Monitors pages.

Usage

You can use directly the Python version as follow :

python MonitorPageGen.py [filter_for_files_to_export] 

or as the .exe file :

MonitorPageGen [filter_for_files_to_export] 

where filter_for_files_to_export allows to select which files should be used as the root for replication:

  • .\*.exp (default) : all the .exp files in the current directory
  • .\myMonitor.exp : one monitor file in concrete
  • T*.exp : all the monitor file that start with T
  • C:\toto\*.exp : all the monitor exportation files in folder C:\toto

Files

In order to work properly, this tools need :

  • some .exp files : they contain the data that will be used to generate the output files
  • templates in the templates folder : templates are plain-text files that contain instructions understood by the jinja2 template engine. Only file with a name that looks like [NAME_OF_THE_TEMPLATE].template.[EXTENSION_OF_THE_TEMPLATE] are processed. That is, MonitorExport.template.html , MonitorFile.template.txt would be processed.

Behaviour

When executed, the following happens :

  1. The program looks for .exp files that matches the filter passed as parameters
  2. for each file [MONITOR_FILE].exp that matches the filter :
    • the program processes the content of the exp file and make the data available for the templates
    • for each template [NAME_OF_THE_TEMPLATE].template.[EXTENSION_OF_THE_TEMPLATE] in the templates folder
      1. instantiante the template
      2. store it as [MONITOR_FILE].exp.[EXTENSION_OF_THE_TEMPLATE]

Example

If you have the following .exp files:

  • Windows_CPU_Monitor.exp
  • Windows_Disk_Monitor.exp
  • Linux_CPU_Monitor.exp

and the following templates in the templates folder :

  • MonitorConfig.template.txt
  • MonitorConfig.template.html
  • MonitorConfig.template.csv
  • AnotherFile.txt

and run the tool as :

python MonitorPageGen.py Windows_*.exp 

This will generate the following files, based on the templates :

  • Windows_CPU_Monitor.exp.txt
  • Windows_CPU_Monitor.exp.html
  • Windows_CPU_Monitor.exp.csv
  • Windows_Disk_Monitor.txt
  • Windows_Disk_Monitor.html
  • Windows_Disk_Monitor.csv

Still have questions? We can help. Submit a case to Technical Support.

Last Modified On: October 24, 2018