I found the answer to my question, I needed to use hc.tags and not hc_tags as defined in the metatype file (forgot that part).
Alain On Sun, Jun 6, 2021 at 11:16 AM Alain <alpi...@gmail.com> wrote: > Switched from SystemReady to HealthChecks and all is fine with my > services.list and components.list just by changing the PID. > > I added some additional checks from the list of generalchecks like so: > > Dictionary<String, Object> props = new Hashtable<>(); > props.put(HC_TAGS, new String[] {"cpu"}); > String pid = "org.apache.felix.hc.generalchecks.CpuCheck"; > Configuration config = cm.getConfiguration(pid, "?"); > config.update(props); > > and I have an HealthCheckMonitor configured: > private void registerHealthMonitor() throws IOException { > Set<String> tags2Check = new HashSet<>(); > tags2Check.add("systemalive"); > tags2Check.add("cpu"); > Dictionary<String, Object> props = new Hashtable<>(); > props.put("tags", tags2Check); > props.put("intervalInSec", Long.valueOf(5)); > String pid = "org.apache.felix.hc.core.impl.monitor.HealthCheckMonitor"; > Configuration config = cm.getConfiguration(pid, "?"); > config.update(props); > } > > which is working fine with my event handler. > Received event: org/apache/felix/health/tag/cpu/STATUS_CHANGED > previousStatus: null > status: TEMPORARILY_UNAVAILABLE > executionResult: CombinedExecutionResult [size=0 overall > status=TEMPORARILY_UNAVAILABLE, finishedAt=null, elapsedTimeInMs=0, > timedOut=false] > result: Result [status=TEMPORARILY_UNAVAILABLE, resultLog=ResultLog: > [TEMPORARILY_UNAVAILABLE Overall status TEMPORARILY_UNAVAILABLE]] > > Now if I run: > hc:exec cpu > It doesn't pick up the tag. > > Running hc:list -v only shows the systemalive health checks: > hc:list -v > OSGi Framework Ready Check systemalive > org.apache.felix.healthcheck.generalchecks > DS Components Ready Check systemalive > org.apache.felix.healthcheck.generalchecks > Services Ready Check systemalive > org.apache.felix.healthcheck.generalchecks > > Why is this happening and how can I target those tags, like my cpu here ? > > Thanks > Alain > >