custom1.xml
An example metric definition file.
This example is detailed in Metric Definition File. This corresponds to the example metric library custom1.c.
1 <!-- version is the file format version -->
2 <metricdefinitions version="1">
3
4 <!-- id is the internal name for this metric, as used in the .map XML -->
5 <metric id="com.allinea.metrics.custom1.interrupts">
6 <!-- Specify whether this metric is always, default_yes, default_no, or never enabled -->
7 <enabled>default_yes</enabled>
8 <!-- The units this metric is measured in. -->
9 <units>/s</units>
10 <!-- Data type used to store the sample values, uint64_t or double -->
11 <dataType>uint64_t</dataType>
12 <!-- The domain the metric is to be sampled in, only time is supported. -->
13 <domain>time</domain>
14
15 <!-- Example source
16 Specifies the source of data for this metric, i.e. a function in a
17 shared library.
18
19 The function signature depends on the dataType:
20 - uint64_t: int function(metric_id_t metricId,
21 struct timespec* inCurrentSampleTime,
22 uint64_t *outValue);
23 - double: int function(metric_id_t metricId,
24 struct timespec* inCurrentSampleTime,
25 double *outValue);
26
27 If the result is undefined for some reason the function may return
28 the special sentinel value ~0 (unsigned integers) or Nan (floating point)
29
30 Return value is 0 if success, -1 if failure (and set errno)
31
32 If divideBySampleTime is true then the values returned by outValue
33 will be divided by the sample interval to get the final value. -->
34 <source ref="com.allinea.metrics.custom1_src"
35 functionName="sample_interrupts"
36 divideBySampleTime="true"/>
37
38 <!-- Display attributes used by the GUI -->
39 <display>
40 <!-- Display name for the metric as used in the GUI -->
41 <displayName>Interrupts</displayName>
42
43 <!-- Brief description of the metric.. -->
44 <description>Total number of system interrupts taken</description>
45
46 <!-- The type of metric, used by the GUI to group metrics -->
47 <type>interrupts</type>
48
49 <!-- The colour to use for the metric graphs for this metric -->
50 <colour>green</colour>
51 </display>
52
53 </metric>
54
55 <!-- Metric group for interrupt metrics, used in the GUI -->
56 <metricGroup id="Custom1">
57 <!-- Display name for the group as use din the GUI -->
58 <displayName>Custom1</displayName>
59
60 <!-- Brief description of the group -->
61 <description>Interrupt metrics</description>
62
63 <!-- References to all the metrics included in the group -->
64 <metric ref="com.allinea.metrics.custom1.interrupts"/>
65 </metricGroup>
66
67 <!-- Definition of the example source (metric plugin) used for the custom metric -->
68 <source id="com.allinea.metrics.custom1_src">
69 <!-- File name of the sample metric plugin shared library -->
70 <sharedLibrary>libcustom1.so</sharedLibrary>
71 </source>
72
73 </metricdefinitions>