I had couple of collectd conf files each loading the GenericJmx plugin and found the following in the logs. Although, the metrics were pulled from both jmx connections.
Dec 21 10:49:17 poc-vm collectd[27737]: java plugin: All `JVMArg' options MUST appear before all `LoadPlugin' options! The JVM is already started and I have to ignore this argument: -Djava.class.path=/opt/stackdriver/collectd/share/collectd/java/collectd-api.jar:/opt/stackdriver/collectd/share/collectd/java/generic-jmx.jar
Dec 21 10:49:17 poc-vm collectd[27737]: The read function "GenericJMX" is already registered. Check for duplicates in your configuration!
I could guess this is because of the following being present in both .conf files.
LoadPlugin java
LoadPlugin match_regex
LoadPlugin target_set
LoadPlugin target_replace
<Plugin "java">
JVMARG "-Djava.class.path=/opt/stackdriver/collectd/share/collectd/java/collectd-api.jar:/opt/stackdriver/collectd/share/collectd/java/generic-jmx.jar"
LoadPlugin "org.collectd.java.GenericJMX"
<Plugin "GenericJMX">
<MBean "SomeMbean">
.....
But is this a guaranteed behavior? Can we have multiple conf files using GenericJMX plugin?
Yes, those logs are just harmless warnings. Collectd loads each plugin when it first encounters the LoadPlugin directive. Since that directive may have options, it also warns when it encounters multiple ones - so you know it will only use the options from the first one it sees.
The GenericJmx plugin is loaded via the java binding. so in this case you're also being warned that the options for the second attempt to load the java binding will be ignored.
To avoid these warnings :
Note :
Here the "path" is
/opt/stackdriver/collectd/etc/collect.d/Refer the bottom of the file :
/etc/stackdriver/collectd.confFrom https://collectd.org/documentation/manpages/collectd.conf.5.shtml#global_options :
If more than one file is included by a single Include option, the files will be included in lexicographical order (as defined by the strcmp function). Thus, you can e. g. use numbered prefixes to specify the order in which the files are loaded.