pub struct Chart<'a> {
pub type_id: &'a str,
pub name: &'a str,
pub title: &'a str,
pub units: &'a str,
pub familiy: &'a str,
pub context: &'a str,
pub charttype: Option<ChartType>,
pub priority: Option<u64>,
pub update_every: Option<u64>,
pub options: Vec<ChartOption>,
pub plugin: &'a str,
pub module: &'a str,
}Expand description
This structure defines a new chart.
The template of this instruction looks like:
CHART type.id name title units [family [context [charttype [priority [update_every [options [plugin [module]]]]]]]]
See also: https://learn.netdata.cloud/docs/agent/collectors/plugins.d#chart
Use the formating features provided by the Display trait or to_string()
to generate the final command string output.
Example:
let c = Chart {
type_id: "test_type.id",
name: "test_name",
title: "caption_text",
units: "test_units",
..Chart::default()
};
assert_eq!(
c.to_string(),
r#"CHART "test_type.id" "test_name" "caption_text" "test_units""#
);See also: https://learn.netdata.cloud/docs/agent/collectors/plugins.d#chart
Fields§
§type_id: &'a strA dot-separated compound of type.id identifier strings.
The type part controls the menu the charts will appear in.
Id Uniquely identifies the chart, this is what will be needed to add values to the chart.
Use validate() to test the formal correctness.
name: &'a strThe name that will be presented to the user instead of id in type.id.
This means that only the id part of type.id is changed. When a name has been given,
the chart is index (and can be referred) as both type.id and type.name.
You can set name to "" to disable it.
title: &'a strThe text above the chart.
units: &'a strThe label of the vertical axis of the chart, all dimensions added to a chart should have the same units of measurement.
familiy: &'a strThis entry is used to group charts together (for example all eth0 charts should say:
eth0), if empty or missing, the id part of type.id will be used.
This controls the sub-menu on the dashboard.
context: &'a strThe context is giving the template of the chart. For example, if multiple charts present
the same information for a different family, they should have the same context.
This is used for looking up rendering information for the chart (colors, sizes, informational texts) and also apply alarms to it.
charttype: Option<ChartType>§priority: Option<u64>The relative priority of the charts as rendered on the web page,
lower numbers make the charts appear before the ones with higher numbers,
if empty or missing, 1000 will be used.
update_every: Option<u64>Overwrite the update frequency set by the server.
Note: To force fields with strong typing, a numeric value of 1 is inserted as the default
when subsequent given fields require such an output.
options: Vec<ChartOption>List of options. 4 options are currently supported:
obsolete to mark a chart as obsolete (Netdata will hide
it and delete it after some time), detail to mark a
chart as insignificant (this may be used by dashboards to make the charts smaller,
or somehow visualize properly a less important chart),
store_first to make Netdata
store the first collected value, assuming there was an invisible previous value
set to zero (this is used by statsd charts - if the first data collected value
of incremental dimensions is not zero based, unrealistic spikes will appear with
this option set) and hidden to perform all operations on a chart,
but do not offer it on dashboards (the chart will be send to external databases).
plugin: &'a strLet the user identify the plugin that generated the chart. If plugin is unset or empty, Netdata will automatically set the filename of the plugin that generated the chart.
module: &'a strLet the user identify the module that generated the chart. Module has not default.