Up_One
Up_One

Reputation: 5271

Apache NiFI ExecuteStreamCommand Wrong Output

I have NiFi flow that runs some shell scripts using the ExecuteStreamCommand processor and the output of the ExecuteStreamCommand is not correct.

The Shell i run is:

if (( $(ps -ef | grep -v grep | grep kibana | wc -l) > 0 )); then echo "1"; else echo "0"; fi;

Is the service is up then 1 if is down then 0, simple but the output is wrong, not matter is the service is up or down the output is always 1.

Here is a demo if the flow:

https://youtu.be/4e00rzerjSQ

Upvotes: 0

Views: 1822

Answers (1)

notNull
notNull

Reputation: 31510

Instead of using original relationship use output stream relationship connect to log attribute processor.

Flow:- enter image description here

if you connect original relation to log attribute that means the contents of generate flowfile is passing to original relationship.

if you connect output stream i.e output of your shell script will be in flowfile content. enter image description here Output:- enter image description here Content:-

enter image description here

Upvotes: 1

Related Questions