Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 06-05-2018 02:43 PM
I have implemented a custom reporting task, very simple one to start with, which just logs all details that come in the context of `onTrigger` method. I see the nar being unpacked and the reporting task being started when I start from the settings, but nothing logs after that.
My Run Schedule is 30 sec (I also tried changing this to 1 mins and 5 mins), but nothing ever logs, but reporting task shows as running. No errors in logs whatsoever.
Only log lines I see in nifi-app.log are these
org.apache.nifi.metrics.reporting.task.MetricsReportingTask
org.apache.nifi:nifi-metrics-reporting-nar:1.6.0-SNAPSHOT || ./work/nar/extensions/nifi-metrics-reporting-nar-1.6.0-SNAPSHOT.nar-unpacked
org.apache.nifi.reporting.ambari.AmbariReportingTask
org.apache.nifi:nifi-ambari-nar:1.6.0-SNAPSHOT || ./work/nar/extensions/nifi-ambari-nar-1.6.0-SNAPSHOT.nar-unpacked
org.apache.nifi.reporting.datadog.DataDogReportingTask
org.apache.nifi:nifi-datadog-nar:1.6.0-SNAPSHOT || ./work/nar/extensions/nifi-datadog-nar-1.6.0-SNAPSHOT.nar-unpacked
org.apache.nifi.controller.ControllerStatusReportingTask
org.apache.nifi:nifi-standard-nar:1.6.0-SNAPSHOT || ./work/nar/extensions/nifi-standard-nar-1.6.0-SNAPSHOT.nar-unpacked
org.apache.nifi.controller.MonitorDiskUsage
org.apache.nifi:nifi-standard-nar:1.6.0-SNAPSHOT || ./work/nar/extensions/nifi-standard-nar-1.6.0-SNAPSHOT.nar-unpacked
com.blah.cloud.datamanager.tasks.CSReportingTask
com.blah.cloud.datamanager:nifi-csreporting-nar:1.0-SNAPSHOT || ./work/nar/extensions/nifi-csreporting-nar-1.0-SNAPSHOT.nar-unpacked<br>2018-06-05 04:03:29,056 INFO [Timer-Driven Process Thread-9] o.a.n.c.s.TimerDrivenSchedulingAgent CSReportingTask[id=ce15e357-0163-1000-0000-0000139a1779] started.
My Reporting Task code
public class CSReportingTask extends AbstractReportingTask {
@Override
public void onTrigger(ReportingContext context) {
EventAccess eventAccess = context.getEventAccess();
ProcessGroupStatus groupStatus = eventAccess.getControllerStatus();
Collection<ProcessorStatus> processorStatus = groupStatus.getProcessorStatus();
String nodeId = context.getClusterNodeIdentifier();
for (ProcessorStatus status : statuses) {
String groupID = status.getGroupId();
String name = status.getName();
String execNode = status.getExecutionNode().name();
String id = status.getId();
String type = status.getType();
String runStatus = status.getRunStatus().name();
getLogger().info("id: {}; name: {}; groupID: {}; execNode: {}; type: {}; runStatus: {}; nodeID: {}", new Object[]{id, name, groupID, execNode, type, runStatus, nodeId});
}
}
}
Created 06-05-2018 07:05 PM
Your getLogger.info(...) statement is inside a for loop over "statuses" and I don't see a variable called statuses so it is hard to say what is in the variable, but if that is an empty collection then you might not be executing your for loop. I would try putting a logging statement right at the beginning of onTrigger to see if the reporting task is even executed.
Created 06-05-2018 07:05 PM
Your getLogger.info(...) statement is inside a for loop over "statuses" and I don't see a variable called statuses so it is hard to say what is in the variable, but if that is an empty collection then you might not be executing your for loop. I would try putting a logging statement right at the beginning of onTrigger to see if the reporting task is even executed.
Created 06-06-2018 04:16 PM
statuses variable not in code is a copy paste error. I did add more logging and I see the statuses is empty which is why nothing logs.
Created 06-06-2018 10:30 PM
Similar question along same lines. I want to report metrics from nifi at the processor level and processor group level and I was able to get this metrics from the rest API, but I am when I get aggregate snapshot I am worried that all nodes will send exactly the same metrics which might show wrong values after aggregation in graphite or I planned to use node level metrics snapshot, if I can compare the node which is sending data can only send its specific metrcis not all nodes metrics.
Is this possible ? or there is a better solution to get fine level metrics ?
Created 06-07-2018 05:09 PM
I don't know that much about the internals of NiFi's metrics, but when you use the REST API it should be making a federated request to all the nodes, which is different from a reporting task which should only have the metrics for the given node it is running on.