Can I programmatically get the root uri of a NiFi flow? - apache-nifi

I'm programmatically creating a NiFi flow using the NiFi api.
I created a process group (I'll call it PG) inside the root process group.
Inside the PG I want a Remote Process Group pointing to the root.
The Remote Process Group request-payload requires the target uri of the process group it is pointing to (in this case the uri of the root).
Is there a way to get that uri programmatically via the api?
In other words, can I somehow programmatically get the uri of the root?
Thanks in advance

Related

nifi Could not find Process Group with ID

After installing nifi, I am trying to create a flow to test hdfs-nifi connectivity. But I am getting following error continuously for every click on the dashboard.
I am the root. so I have complete access to the components.
Did you copy a flow.xml.gz file from an existing instance of NiFi, or have controller services, reporting tasks, or other components which reference a group that no longer exists?
Try searching for the UUID using the search bar in the top right, or shut down NiFi, and use the following terminal commands to look for any references to this process group ID (double check or copy/paste the UUID because I typed it from looking at your screenshot):
cd $NIFI_HOME
gunzip -k conf/flow.xml.gz
grep '1861df7a-0168-1000-3931-028d9eb92cbd' conf/flow.xml
You should remove the referenced process group (you can back up the flow.xml.gz first if you are concerned about data loss (this would be the flow definition, not any flowfiles, content, or provenance data).

How to list all Websphere installed applications for a given Middleware server using jython

I have a Websphere 8.5.5.12 installation with multiple applications running on it. For a given Middleware Server, I'd like to be able to list all applications associated with it using Jython.
I have gone as far as writing this code:
wsadmin>print AdminApp.list("WebSphere:cell=myCell,node=myNode")
However this is retrieving applications for a different Dynamic Cluster
If I add a specific server, it errors out
wsadmin>print AdminApp.list("WebSphere:cell=myCell,server=myServer")
ADMA0184E: myServer is not a valid target.
Your query should look like:
wsadmin>AdminApp.list("WebSphere:cell=myCell,node=myNode,server=server1")
It appears you're missing the node identifier in your query. And if wsadmin still returns "myServer is not a valid target", then the server name is wrong, try looking at your app server profile directory structure to double check it.

Using localhost in a NiFi Remote Processor Group URL

I have a clustered NiFi setup (2-nodes) and have gotten Remote Process Groups to work when I explicitly list the IP address of one of the nodes in the RPG URL (http://:8080/nifi). The problem is with the use of RPG's in templates, I need to recreate these RPG's with the new node information for that cluster environment (Test->Stage->Prod). Is it possible to somehow use localhost as the address for this URL so that templates that include RPG's remain portable throughout environments?
I know this does not address your immediate question, but there is a JIRA that has been completed and tagged for the next release of NiFi which makes the RPG URL editable:
https://issues.apache.org/jira/browse/NIFI-4526
This would make it so that the value in your template doesn't really matter because you can change it after import.

Share Nifi Controller Service

How can I share a Controller Service between process groups? I built a DBCPConnectionPool and use it in a process group. I need it in another process group. In a nutshell, I want one DBCPConnectionPool at root and use it in process groups.
Create the process group in the parent process group of the groups you want to share it in. For example, if you create it on the root group (top-level canvas), it would be usable by any sub-process groups.

OpenNMS alert when a folder is not empty?

I'm trying to create an OpenNMS alert when a certain folder ISN'T empty but can't seem to find a way of doing it. Any ideas?
I assume you have a service which goes down if your folder is empty. See the short video. By default notifications are turned off. Every service down event will be notified by default. You can be more granular by filtering on nodes and services. The default setting will send a mail to the admin user. You set a mail address in the user of the admin. To configure the access to your mail server, configure the javamail-configuration.properties. I just tried to figure out where you stuck exactly.
One approach could be to poll the certain directory for the empty condition with an agent on your host system and expose the status, e.g. Net-SNMP. You can create a service by using the SNMP Monitor to poll the status of the exposed OID and create a mail notification for this particular service.
Yes, this can be done. I have performed similar tasks using simple perl and bash scripts on Linux.
OpenNMS allows you to create polling configurations based on scripts. Your script is expected to output "0" or "1", with 0 representing "OK" and 1 representing "Not OK".
You could use the GeneralPurposePoller:
https://wiki.opennms.org/wiki/GeneralPurposePoller
However, it seems that you should instead use the SystemExecuteMonitor:
https://wiki.opennms.org/wiki/SystemExecuteMonitor

Resources