0

Is there a way to get the unique UUID of the system (Generated using dmidecode) in NiFi and set it as an Attribute to a FlowFile.

Daniccan
  • 2,755
  • 1
  • 18
  • 27

1 Answers1

3

Yeah. It can be done using ExecuteScript. You can use Groovy and execute as simple as the following line to run a shell command.

"dmidecode".execute()

or to read the result generated:

def result = "dmidecode".execute().text

Then when you're done reading the required value/data from the result, you can use something like the following to assign the value as a FlowFile attribute

flowFile = session.get()
if(!flowFile) return
def dmidecodeUuid = ... // your logic to read the UUID from dmidecode
flowFile = session.putAttribute(flowFile, 'dmidecode.uuid', dmidecodeUuid)
session.transfer(flowFile, REL_SUCCESS)

That's just a rough code which was quickly made. More details on ExecuteScript can be found at:

Sivaprasanna Sethuraman
  • 4,014
  • 5
  • 31
  • 60