Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Has anyone installed the minifi C2 ( command and control ) . I need some steps to get this working. Do we have an installation document for this.

avatar
Expert Contributor

Has anyone installed the minifi C2 ( command and control ) . I need some steps to get this working. Do we have an installation document for this. I have got my minifi agents on two separate servers which transmit data to the Nifi Server. I plan to create a C2 Server which will co-ordinate with the minifi agents installed on different machines. I have a high level idea of what C2 will do , but in the absence of any documents , its a bit difficult for me to progress. Need some help here .

@Vinicius Higa Murakami , @Shu , @Pierre Villard , @Matt Burgess , @Matt Clarke

Have you worked on this by any chance or provide any inputs to this.

1 ACCEPTED SOLUTION

avatar
Contributor

Hi,

i found the guidelines from "How to build an IIoT system using Apache NiFi, MiNiFi, C2 Server, MQTT and Raspberry Pi" written by Abdelkrim Hadjidj use full

the basic start command : "/bin/c2.sh", make sure you have the configuration correctly

i also found an Jira Issue solution for version 0.4

By removing the file javax.ws.rs-api-2.1.jar from lib directory in 0.4.0 version, it works
as expected.

View solution in original post

19 REPLIES 19

avatar
Contributor

Hi,

i found the guidelines from "How to build an IIoT system using Apache NiFi, MiNiFi, C2 Server, MQTT and Raspberry Pi" written by Abdelkrim Hadjidj use full

the basic start command : "/bin/c2.sh", make sure you have the configuration correctly

i also found an Jira Issue solution for version 0.4

By removing the file javax.ws.rs-api-2.1.jar from lib directory in 0.4.0 version, it works
as expected.

avatar
Expert Contributor

Thanks @Raymond Honderdors . I have started looking into it but i am still struggling to get this sorted. I am not sure which ingestor to use and where should the changed config YML file lie , whether on the C2 server or at the target server where minifi is installed.

avatar
Contributor

If you want to use the http ingestor

update the miNiFi ./conf/bootstrap.conf (C2 section "nifi.minifi.notifier")

update ./conf/minifi-c2-context.xml point the beam to the NiFi server that will hold the templates. Each ingestor has it own constructor.

create/import the template in NiFi

now start the c2 server and test "http://c2-server:10080/c2/config?class=iot-minifi-raspberry-agent&version=1" this should return the config.yml

now when you start miNiFi you will see in the logs that after a short interval miNiFi comes to live.

the how to in my first answer describes a step by step setup

avatar
Expert Contributor

Thanks @Raymond Honderdors . Hey quick question . I think i need to also tweak the authorizations and authorizers.xml to add the CLASS. Do you have any details on that by any chance

avatar
Contributor

Hi @Abinav Joshi

If you mean in miNiFi, you need to set the bootstrap to point to the C2 Server

and set the class # Query string to pull configurations with (no version), "<yourflowname/templatename>" has to match exactly

nifi.minifi.notifier.ingestors.pull.http.query=class=<yourflowname/templatename>

authorizations and authorizers.xml would be a whole new topic, as it will deal with who can do what after sign-in

avatar
Expert Contributor

Thanks @Raymond Honderdors. I think i am now close. I want to first try to test the c2 server. I have already run the script c2.sh and it looks up and running . My template on the remote nifi server is called FROM_CAPLTDA1E. So , if I want the config.yml returned , then would my url look like this ===> http://C2SERVER:8080/c2/config?class=FROM_CAPLTDA1E .

I guess this is the first step that needs to be sorted after which the minifi related settings can be tweaked. Can you please let me know if my approach is correct and also whether the URL mentioned above is right.

Many Many thanks @Raymond Honderdors by the way . The idea is much much clear now

avatar
Expert Contributor

Hi @Raymond Honderdors

I started the C2 server and tried to test the URL below but it keeps on giving me the error --> HTTP ERROR 500

http://C2Server:8080/c2/config?class=CAPLTDA1E

where CAPLTDA1E is the name of the template on the nifi server. I have also updated minifi-c2-context.xml to ppint to the Nifi server. I am on version 0.4 for C2 and also removed the lib file javax.ws.rs-api-2.1.jar.

is there anything I am missing here ?

cheers

Abhi

avatar
Contributor

Hi, @Abhinav Joshi

are you sure you set the C2 Server port to be 8080, the default is 10080

besides that all looks to be fine, if it still does not work please share the snippets from your config

avatar
Expert Contributor

Hi @Raymond Honderdors. Actually I tried using the 10080 port before but it seems this port is already used in my case which is why I was getting an error address already used.I then used 8080 and put that in the c2.properties file as well.

Please also note that my Nifi server is secured . The error that I am getting from my log file is as follows :-

Server returned HTTP response code: 403 for URL: https://capltda23:8443/nifi-api/flow/templates

DEBUG [qtp438135304-15] o.a.n.m.c2.provider.util.HttpConnector Connecting to endpoint: https://capltda23:8443/nifi-api/flow/templates

WARN [qtp438135304-15] o.a.nifi.minifi.c2.service.ConfigService Unable to get configuration. org.apache.nifi.minifi.c2.api.ConfigurationProviderException: Unable to retrieve template list

Didn't find any templates that matched \QFROM_CAPLTDA1E.v\E([0-9+])\Q\E

the above error states that C2 server couldn't get hold of the template name. Not sure why this is occuring.

Thanks again @Raymond Honderdors . I guess I am pretty close now . Let me know of your thoughts.