NGQL Custom Monitoring
From Custom Monitoring, you are familiar with how to customize types, Metrics, protocols, etc. Here we will introduce in detail how to use JDBC(support mysql,mariadb,postgresql,sqlserver at present) to customize Metric monitoring. NGQL custom monitoring allows us to easily query metric data from the NebulaGraph graph database using NGQL or OpenCypher, supporting NebulaGraph 3.X versions.
Data Parsing Methods
Mapping the fields returned by NGQL queries to the metrics we need allows us to obtain corresponding metric data. Currently, there are four mapping and parsing methods: filterCount, oneRow, multiRow, columns.
filterCount
Counts the number of results returned by a query based on specified fields, usually used in
SHOW ...statements. If NGQL statements can directly return the count, it is recommended to use NGQL statements for counting.
Syntax for thecommandsfield: aliasField#NGQL#filterName#filterValue
aliasField: corresponds to the value in thealiasFieldsin the monitoring template
NGQL: query statement
filterName: filter attribute name (optional)
filterValue: filter attribute value (optional)
For example:
- online_meta_count#SHOW HOSTS META#Status#ONLINE
Counts the number of rows returned bySHOW HOSTS METAwhere Status equals ONLINE. - online_meta_count#SHOW HOSTS META##
Counts the number of rows returned bySHOW HOSTS META.
oneRow
Queries a single row of data by mapping the column names of the query result set to the queried fields.
For example:
- Metrics fields: a, b
- NGQL query: match (v:metrics) return v.metrics.a as a, v.metrics.b as b;
Here, the metric fields can be mapped to the response data row by row.
Notes:
- When using the
oneRowmethod, if a single query statement returns multiple rows of results, only the first row of results will be mapped to the metric fields. - When the
commandsfield contains two or more query statements and the returned fields of multiple query statements are the same, the fields returned by the subsequent statement will overwrite those returned by the previous statement. - It is recommended to use the limit statement to limit the number of rows returned in the result set when defining
commands.
multiRow
Queries multiple rows of data by mapping the column names of the query result set to the queried fields.
For example:
- Metrics fields: a, b
- NGQL query: match (v:metrics) return v.metrics.a as a, v.metrics.b as b;
Here, the metric fields can be mapped to the response data row by row. Notes:
- When using the
multiRowmethod, thecommandsfield can only contain one query statement.
columns
Collects a single row of metric data by mapping two columns of data (key-value), where the key matches the queried fields and the value is the value of the queried field.
Notes:
- When using the
columnsmethod, the first two columns of the result set are mapped to collect data by default, where the first column corresponds to the metric name and the second column corresponds to the metric value. - When the
commandsfield contains two or more query statements and the first column of data returned by multiple query statements is duplicated, the result of the last statement will be retained.
Customization Steps
HertzBeat Page -> Monitoring Template Menu -> Add Monitoring Type -> Configure Custom Monitoring Template YML -> Click Save Application -> Use the New Monitoring Type to Add Monitoring

Configuration usages of the monitoring templates yml are detailed below.