For each supported DB type there is a configuration file delivered together with the SHA located in the directory /usr/sap/hostctrl/exe/config.d.
For Hana DB the configuration file is named "dbmetric.definition.hdb.cimobj", for MSSQL it is named "dbmetric.definition.mss.cimobj", for Oracle it is named "dbmetric.definition.ora.cimobj", etc.
These files contain actually the definition of SQL statements per metric. The parameter KEY_FIG in the metric definition holds the key (identifier) of the metric within the dbmetric file.
Therefore, to add a custom metric you can use one of the described options.
The easiest one is just to copy a standard metric and replace the KEY_FIG value with own defined one which is not already used for any other metric within the dbmetric file (e.g. by starting the custom metric name with something like “Z”).Afterwards, you can copy the section in the dbmetric file which belongs to the copied SAP metric and replace the corresponding KEY_FIG value everywhere in the copied section. Then you replace the copied SQL statement with the one you want to have, like dbmetric.definition.mss.cimobj.