Using FIWARE to start Cygnus as a Service in IoT Solution

0 votes

While creating a solution I tried starting cygnus using RPMs on fiware image CentOS-7-x64 but I am unable to start it as a service, Here is my logs:

[centos@cygnus-mongo conf]$ sudo service cygnus start
Starting cygnus (via systemctl):  Job for cygnus.service failed. See 'systemctl status cygnus.service' and 'journalctl -xn' for details.
[centos@cygnus-mongo conf]$ sudo journalctl -xn
-- Logs begin at mer. 2015-10-07 07:48:29 UTC, end at mer. 2015-10-07 10:02:35 UTC. --
oct. 07 10:02:20 cygnus-mongo.novalocal su[5700]: pam_unix(su:session): session closed for user cygnus
oct. 07 10:02:22 cygnus-mongo.novalocal cygnus[5695]: cat: /var/run/cygnus/ No such file or directory
oct. 07 10:02:22 cygnus-mongo.novalocal cygnus[5695]: [FAILED]
oct. 07 10:02:22 cygnus-mongo.novalocal cygnus[5695]: rm: cannot remove ‘/var/run/cygnus/’: No such file or directory
oct. 07 10:02:22 cygnus-mongo.novalocal systemd[1]: cygnus.service: control process exited, code=exited status=1
oct. 07 10:02:22 cygnus-mongo.novalocal systemd[1]: Failed to start SYSV: cygnus.
-- Subject: Unit cygnus.service has failed
-- Defined-By: systemd
-- Support:
-- Unit cygnus.service has failed.
-- The result is failed.
oct. 07 10:02:22 cygnus-mongo.novalocal systemd[1]: Unit cygnus.service entered failed state.
oct. 07 10:02:34 cygnus-mongo.novalocal dhclient[1064]: DHCPREQUEST on eth0 to port 67 (xid=0x761299ef)
oct. 07 10:02:34 cygnus-mongo.novalocal dhclient[1064]: DHCPACK from (xid=0x761299ef)
oct. 07 10:02:35 cygnus-mongo.novalocal sudo[5774]: centos : TTY=pts/0 ; PWD=/usr/cygnus/conf ; USER=root ; COMMAND=/bin/journalctl -xn

Actually the directory /var/run/cygnus was not created, is it going to be created automatically?

Here is my configuration files:


cygnusagent.sources = http-source
cygnusagent.sinks = mongo-sink 
cygnusagent.channels = mongo-channel 

# source configuration
# channel name where to write the notification events
cygnusagent.sources.http-source.channels = mongo-channel 
# source class, must not be changed
cygnusagent.sources.http-source.type = org.apache.flume.source.http.HTTPSource
# listening port the Flume source will use for receiving incoming notifications
cygnusagent.sources.http-source.port = 5050
# Flume handler that will parse the notifications, must not be changed
cygnusagent.sources.http-source.handler =
# URL target
cygnusagent.sources.http-source.handler.notification_target = /notify
# Default service (service semantic depends on the persistence sink)
cygnusagent.sources.http-source.handler.default_service = def_serv
# Default service path (service path semantic depends on the persistence sink)
cygnusagent.sources.http-source.handler.default_service_path = def_servpath
# Number of channel re-injection retries before a Flume event is definitely discarded (-1 means infinite retries)
cygnusagent.sources.http-source.handler.events_ttl = 10
# Source interceptors, do not change
cygnusagent.sources.http-source.interceptors = ts gi
# TimestampInterceptor, do not change
cygnusagent.sources.http-source.interceptors.ts.type = timestamp
# GroupinInterceptor, do not change =$Builder
# Grouping rules for the GroupingInterceptor, put the right absolute path to the file if necessary
# See the doc/design/interceptors document for more details = /usr/cygnus/conf/grouping_rules.conf

# ============================================
# OrionMongoSink configuration
# sink class, must not be changed
cygnusagent.sinks.mongo-sink.type =
# channel name from where to read notification events = mongo-channel
# FQDN/IP:port where the MongoDB server runs (standalone case) or comma-separated list of FQDN/IP:port pairs where the MongoDB replica set members run
cygnusagent.sinks.mongo-sink.mongo_hosts =
# a valid user in the MongoDB server (or empty if authentication is not enabled in MongoDB)
cygnusagent.sinks.mongo-sink.mongo_username = 
# password for the user above (or empty if authentication is not enabled in MongoDB)
cygnusagent.sinks.mongo-sink.mongo_password =
# prefix for the MongoDB databases
cygnusagent.sinks.mongo-sink.db_prefix = kura_
# prefix pro the MongoDB collections
cygnusagent.sinks.mongo-sink.collection_prefix = kura_
# true is collection names are based on a hash, false for human redable collections
cygnusagent.sinks.mongo-sink.should_hash = false

# mongo-channel configuration
# channel type (must not be changed)
cygnusagent.channels.mongo-channel.type = memory
# capacity of the channel
cygnusagent.channels.mongo-channel.capacity = 1000
# amount of bytes that can be sent per transaction
cygnusagent.channels.mongo-channel.transactionCapacity = 100

cygnus_instance_mongo.conf :

# Who to run cygnus as. Note that you may need to use root if you want
# to run cygnus in a privileged port (<1024)

# Where is the config folder

# Which is the config file

# Name of the agent. The name of the agent is not trivial, since it is the base for the Flume parameters 
# naming conventions, e.g. it appears in .sources.http-source.channels=...

# Name of the logfile located at /var/log/cygnus. It is important to put the extension '.log' in order to the log rotation works properly

# Administration port. Must be unique per instance

# Polling interval (seconds) for the configuration reloading

Edit: add logs after lunching cygnus as a standalone application:

[centos@cygnus-mongo iot]$ ./ 
+ exec /usr/lib/jvm/java-1.6.0-openjdk.x86_64/bin/java -Xmx20m -Dflume.root.logger=INFO,console -cp '/usr/cygnus/conf:/usr/cygnus/lib/*:/usr/cygnus/plugins.d/cygnus/lib/*:/usr/cygnus/plugins.d/cygnus/libext/*' -Djava.library.path= -f /usr/cygnus/conf/agent_mongo.conf -n cygnusagent
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/cygnus/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/cygnus/plugins.d/cygnus/lib/cygnus-0.8.2-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See for an explanation.
2015-10-08 15:50:32,629 (main) [INFO -] Starting a Jetty server listening on port 8081 (Management Interface)
2015-10-08 15:50:32,655 (main) [INFO -] Logging to org.slf4j.impl.Log4jLoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog
2015-10-08 15:50:32,656 (main) [INFO -] Starting Cygnus application
2015-10-08 15:50:32,656 (Thread-1) [INFO -] jetty-6.1.26
2015-10-08 15:50:32,684 (lifecycleSupervisor-1-0) [INFO - org.apache.flume.node.PollingPropertiesFileConfigurationProvider.start(] Configuration provider starting
2015-10-08 15:50:32,694 (conf-file-poller-0) [INFO - org.apache.flume.node.PollingPropertiesFileConfigurationProvider$] Reloading configuration file:/usr/cygnus/conf/agent_mongo.conf
2015-10-08 15:50:32,714 (conf-file-poller-0) [WARN - org.apache.flume.conf.FlumeConfiguration.<init>(] Configuration property ignored: cygnusagent.sinks.mongo-sink.mongo_username = 
2015-10-08 15:50:32,714 (conf-file-poller-0) [INFO - org.apache.flume.conf.FlumeConfiguration$AgentConfiguration.addProperty(] Processing:mongo-sink
2015-10-08 15:50:32,715 (conf-file-poller-0) [INFO - org.apache.flume.conf.FlumeConfiguration$AgentConfiguration.addProperty(] Processing:mongo-sink
2015-10-08 15:50:32,715 (conf-file-poller-0) [WARN - org.apache.flume.conf.FlumeConfiguration.<init>(] Configuration property ignored: cygnusagent.sinks.mongo-sink.mongo_password = 
2015-10-08 15:50:32,715 (conf-file-poller-0) [INFO - org.apache.flume.conf.FlumeConfiguration$AgentConfiguration.addProperty(] Added sinks: mongo-sink Agent: cygnusagent
2015-10-08 15:50:32,716 (conf-file-poller-0) [INFO - org.apache.flume.conf.FlumeConfiguration$AgentConfiguration.addProperty(] Processing:mongo-sink
2015-10-08 15:50:32,716 (conf-file-poller-0) [INFO - org.apache.flume.conf.FlumeConfiguration$AgentConfiguration.addProperty(] Processing:mongo-sink
2015-10-08 15:50:32,716 (conf-file-poller-0) [INFO - org.apache.flume.conf.FlumeConfiguration$AgentConfiguration.addProperty(] Processing:mongo-sink
2015-10-08 15:50:32,716 (conf-file-poller-0) [INFO - org.apache.flume.conf.FlumeConfiguration$AgentConfiguration.addProperty(] Processing:mongo-sink
2015-10-08 15:50:32,731 (Thread-1) [INFO -] Started SocketConnector@
2015-10-08 15:50:32,744 (conf-file-poller-0) [INFO - org.apache.flume.conf.FlumeConfiguration.validateConfiguration(] Post-validation flume configuration contains configuration for agents: [cygnusagent]
2015-10-08 15:50:32,745 (conf-file-poller-0) [INFO - org.apache.flume.node.AbstractConfigurationProvider.loadChannels(] Creating channels
2015-10-08 15:50:32,758 (conf-file-poller-0) [INFO -] Creating instance of channel mongo-channel type memory
2015-10-08 15:50:32,765 (conf-file-poller-0) [INFO - org.apache.flume.node.AbstractConfigurationProvider.loadChannels(] Created channel mongo-channel
2015-10-08 15:50:32,766 (conf-file-poller-0) [INFO - org.apache.flume.source.DefaultSourceFactory.create(] Creating instance of source http-source, type org.apache.flume.source.http.HTTPSource
2015-10-08 15:50:32,782 (conf-file-poller-0) [INFO -<init>(] Cygnus version (0.8.2.UNKNOWN)
2015-10-08 15:50:32,808 (conf-file-poller-0) [INFO -] Startup completed
2015-10-08 15:50:32,836 (conf-file-poller-0) [INFO - org.apache.flume.sink.DefaultSinkFactory.create(] Creating instance of sink: mongo-sink, type:
2015-10-08 15:50:32,856 (conf-file-poller-0) [INFO - org.apache.flume.node.AbstractConfigurationProvider.getConfiguration(] Channel mongo-channel connected to [http-source, mongo-sink]
2015-10-08 15:50:32,872 (conf-file-poller-0) [INFO - org.apache.flume.node.Application.startAllComponents(] Starting new configuration:{ sourceRunners:{http-source=EventDrivenSourceRunner: { source:org.apache.flume.source.http.HTTPSource{name:http-source,state:IDLE} }} sinkRunners:{mongo-sink=SinkRunner: { policy:org.apache.flume.sink.DefaultSinkProcessor@7caba647 counterGroup:{ name:null counters:{} } }} channels:{{name: mongo-channel}} }
2015-10-08 15:50:32,872 (conf-file-poller-0) [INFO - org.apache.flume.node.Application.startAllComponents(] Starting Channel mongo-channel
2015-10-08 15:50:32,968 (lifecycleSupervisor-1-0) [INFO - org.apache.flume.instrumentation.MonitoredCounterGroup.register(] Monitoried counter group for type: CHANNEL, name: mongo-channel, registered successfully.
2015-10-08 15:50:32,968 (lifecycleSupervisor-1-0) [INFO - org.apache.flume.instrumentation
Aug 13, 2018 in IoT (Internet of Things) by Matt
• 2,270 points

edited Aug 14, 2018 by Matt 787 views

1 answer to this question.

0 votes

Cygnus is supposed to create /var/run/cygnus/ when started. You can the path specification, and creation and PID assignement.

I'm wondering which are the permissions of your /var/run... Maybe they are too restrictive for the cygnus user.

Anyway, are you able to run Cygnus as a standalone application (not as a service) with no errors? I mean, executing this command:

$ /usr/cygnus/bin/cygnus-flume-ng agent --conf /usr/cygnus/conf -f /usr/cygnus/conf/agent_mongo.conf -n cygnusagent -Dflume.root.logger=INFO,console
answered Aug 13, 2018 by anonymous2
• 4,280 points

Related Questions In IoT (Internet of Things)

0 votes
1 answer

How to deploy Windows 10 IoT (Rasp Pi image) as a Virtual Machine

The easiest way I found is downloading ...READ MORE

answered Sep 10, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
0 votes
1 answer

Detecting when a sensor is not sending data to Orion CB in FiWARE

Orion in itself has no such mechanism ...READ MORE

answered Nov 22, 2018 in IoT (Internet of Things) by Shubham
• 13,490 points
0 votes
1 answer

Display time in a Windows Core IoT app with a clock!

It is possible, but you should understand ...READ MORE

answered Jul 10, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
0 votes
1 answer
0 votes
1 answer

How do I set variable if a specific package version is installed in CFEngine?

Here is what you can do.Just use packagesmatching to ...READ MORE

answered Jul 12, 2018 in Other DevOps Questions by Atul
• 10,240 points
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Publishing commands to device in IBM IoT using MQTT in Java

If you are publishing from an application, ...READ MORE

answered Jul 27, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP