Mchart

From MidasWiki
Jump to navigation Jump to search


Links

Purpose

mchart is a MIDAS utility that assembles data from the ODB for a stripchart graphics program.

Features

mchart is a periodic data retriever of a specific path in the ODB, which can be used in conjunction with a stripchart graphic program. The mchart/stripchart feature has been largely superceded by the MIDAS History System.

In a two-step procedure

  1. a specific path in the ODB can be scanned for composing a configuration file by extracting all numerical data references. The filename (e.g. filename.conf) is specified with the -f filename argument.
  2. mchart will produce (at a fixed time interval) a refreshed data file containing the values of the numerical data specified in the configuration file.

This file is then available for a stripchart program to be used for a chart-recording type of graph. Two possible stripcharts are available:

gstripchart
The configuration file generated by mchart is compatible with the GNOME stripchart which permits sophisticated data equation manipulation. On the other hand, the data display is not very fancy and provides just a basic chart recorder.
stripchart
This tcl/tk graphical stripchart data display application written by Gertjan Hofman (see stripchart) provides a far better graphical chart recorder display tool, it also permits history save-set display, but the equation scheme is not implemented.

Arguments

       [-h ] : help
       [-h hostname ] : host name.
       [-e exptname ] : experiment name.
       [-D ] : start program as a daemon (prevented if -c or -q) 
               requires MCHART_DIR
       [-u time] : data update periodicity (def:5s).
       [-f file] :  configuration or data file name
       [-q <ODBpath> ] : equipment ODB path
       [-b lower_value] : sets general lower limit for all variables (only with -q)
       [-t upper_value] : sets general upper limit for all variables (only with -q)
       [-c ] : create config only
       [-k ] : keep spawned stripchart or gstripchart
       [-g ] : spawn Hofman stripchart or gstripchart if possible
       [-gg ] : force the spawning of gstripchart for graphic.
       [-gh ] : force the spawning stripchart (tcl/tk) for graphic.

Usage

   Creation  : mchart -e myexpt -h myhost -c
               -f mydata -q /equipement/myeqp/variables
   Running   : mchart -e myexpt -h myhost -f mydata
   Run/Graph : mchart -e myexpt -h myhost -f mydata -g
   MCHART_DIR: environment variable for mchar directory

The configuration contains one entry for each variable found under the <ODBpath>requested. The format is described in the gstripchart documentation.

Once the configuration file has been created, it is possible to apply any valid operation (equation) to the parameters of the file following the gstripchart syntax. In the case of the use of the stripchart from G.Hofman, only the "filename", "pattern", "maximum", "minimum" fields are used.

When using mchart with the -D Argument, it is necessary to have the MIDAS environment variable MCHART_DIR defined in order to allow the daemon to find the location of the configuration and data files.

Example Configuration File

chaos:~/chart> more trigger.conf 
 #Equipment:            >/equipment/kos_trigger/statistics
menu:                   on
slider:                 on
type:                   gtk
minor_ticks:            12
major_ticks:            6
chart-interval:         1.000
chart-filter:           0.500
slider-interval:        0.200
slider-filter:          0.200
begin:        Events_sent
 filename:     /home/chaos/chart/trigger
 fields:       2
 pattern:      Events_sent
 equation:     \$2
 color:        \$blue
 maximum:      1083540.00
 minimum:      270885.00
 id_char:      1
end:            Events_sent
begin:        Events_per_sec.
 filename:     /home/chaos/chart/trigger
 fields:       2
 pattern:      Events_per_sec.
 equation:     $2
 color:        \$red
 maximum:      1305.56
 minimum:      326.39
 id_char:      1
end:            Events_per_sec.
begin:        kBytes_per_sec.
 filename:     /home/chaos/chart/trigger
 fields:       2
 pattern:      kBytes_per_sec.
 equation:     $2
 color:        \$brown
 maximum:      898.46
 minimum:      224.61
 id_char:      1
end:            kBytes_per_sec.

Example Data File

A second file (data file) will be updated a fixed interval by the mchart utility.

 chaos:~/chart> more trigger
   Events_sent 6.620470e+05
   Events_per_sec. 6.463608e+02
   kBytes_per_sec. 4.424778e+02

Example

  • Creation with <ODBpath> being one array of 2 elements in the /Variables subdirectory :
     chaos:~/chart> mchart -f chvv -q  /equipment/chv/variables/chvv -c
     chaos:~/chart> ls -l chvv*
     -rw-r--r--   1 chaos    users         474 Apr 18 14:37 chvv
     -rw-r--r--   1 chaos    users        4656 Apr 18 14:37 chvv.conf
  • Creation of all the sub-keys in the /Variables subdirectory :
     mchart -e myexpt -h myhost -f chv -q /equipment/chv/variables -c
  • Creation and running in debug:
     chaos:~/chart> mchart -f chv -q /equipment/chv/variables -d
     CHVV : size:68
     #name:17 #Values:17
     CHVI : size:68
  • Running a pre-existing conf file (chv.conf) debug:
     chaos:~/chart> mchart -f chv.conf -d
     CHVV : size:68
     #name:17 #Values:17
     CHVI : size:68
     #name:17 #Values:17
  • Running a pre-existing configuration file and spawning gstripchart :
     chaos:~/chart> mchart -f chv.conf -gg
     spawning graph with gstripchart -g 500x200-200-800 -f /home/chaos/chart/chv.conf ...
     chaos:~/chart> mchart -f chv.conf -gh
     spawning graph with stripchart /home/chaos/chart/chv.conf ...