I'm aware about the new API

and this in not a problem with the check_command. My check_command corresponds to the name of the template, so I'm pretty sure NagiosXI parses the template file I've intended it to parse.
I've also tried the solutions You've mentioned - it actually works as kinda workaround right now for me
But it also has another deficiency or even problem. For instance: if I have 2 data sources in rrd file, and define def[1], def[2] and def[3] in a template file (of course in a manner You've mentioned - so checking out each time if the DS[x] is actually available) each time NagiosXI will print 2
graphs and third empty placeholder for the DS that actually does not exist. So you never know if you see all the available
graphs or have a problem with on or more of them (that show only empty placeholders) - i.e. due to some data corruption or something else.
It looks to me, that when a particular def[x] appears somewhere in the template file - even in a section, that is surrounded by a condition (for instance an if { }), than even if that condition hasn't been met, the
graphs tab shows an empty placeholder for such a def[x]. For instance, when the template file looks like this:
if(isset($DS[1])) {
$opt[1] = "--vertical-label \"[sec]\" -l0 -u $CRIT[1] --title \"
graph1\" ";
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
$def[1] .= "AREA:var1#00AA00:\"Test1\" " ;
...
}
if(isset($DS[2])) {
$opt[2] = "--vertical-label \"[sec]\" -l0 -u $CRIT[1] --title \"
graph2\" ";
$def[2] = "DEF:var1=$rrdfile:$DS[2]:AVERAGE " ;
$def[2] .= "AREA:var1#AA0000:\"Test2\" " ;
.....
}
and I have only one DS defined in RRD, the performance
graphs tab shows one
graph and another empty placeholder (with datasource caption above) for the not existing one.
Any suggestions about this behavior
Michalux