Mahesha999
Mahesha999

Reputation: 24721

Is it possible to query processors by some condition and then turn them all off

We had a lot of processors added for debugging. They are named "DebugFlow". Couple of days back, some one right clicked on canvas and clicked start. This must have started some of those DebugFlow processors deep inside all processor groups. (mostly we disable all those processors, but some of them might have left enabled) Now we want to stop all of them. When I search DebugFlow in Nifi search box, it populates huge drop down list. I can go to them one by one and turn them off. But the list is really really big. I am guessing if there is any way to search all running processors with name "DebugFlow" and stop them, something like below in terms of pseudo-sql like words:

UPDATE Processor SET state="stopped" WHERE state="running" and name="DebugFlow"

Upvotes: 0

Views: 145

Answers (1)

Andy
Andy

Reputation: 14184

You can definitely automate this by using a variety of tools:

  1. Use simple Python/Ruby/Groovy/Bash scripting to call the NiFi query API (GET /flow/search-results) to return the list of all DebugFlow processors and then iterate over them, setting their state to stopped (and disable them as well if you want) using HTTP calls via the language or curl.
  2. Use the NiPyAPI tool to do this in Python with the benefit of higher-level functions.
  3. Use the NiFi CLI tool to do this in a scriptable or interactive DSL with the benefit of higher-level functions.

A general rule of thumb is that everything possible in NiFi via the UI is also possible via the API (as the UI is a reference implementation of an API client), so you can always open the Developer Tools of your browser and see which HTTP calls are made as you perform the desired operation manually, then copy those to a repeatable script.

Upvotes: 1

Related Questions