Rush not working on my Orion Context Broker - fiware

I have deployed an Orion Context Broker v0.20.0 instance using AWS. I'm trying to show an entity from it on the MapViewer widget of the Fiware Lab Wirecloud Mashup.
It seems like I'm having some kind of trouble with the NGSI source operator. I have configured it with:
NGSI server URL: http://MyORionInstanceIP:1026
NGSI proxy URL: https://ngsiproxy.lab.fi-ware.org (I have also tried ngsiproxy.lab.fiware.org)
I run my Conntext broker instance like this: contextBroker -port 1026 -logDir /var/log/contextBroker -pidpath /var/run/contextBroker/contextBroker.pid -dbhost localhost -db orion -t 0-255 -rush localhost:5001, and it works, but when I accept the operator configuration to create the subscription, this is what I read on my Context Broker:
DEBUG#12:07:40 senderThread.cpp[47]: sending to: host='ngsiproxy.lab.fi-ware.org', port=443, verb=POST, tenant='', service-path: '', xauthToken: '', path='/callbacks/14:27:47-1:15:08:34-1', content-type: application/xml
DEBUG#12:07:40 sem.cpp[124]: transactionIdSet taking the 'trans' semaphore for 'changing the transaction id'
DEBUG#12:07:40 sem.cpp[126]: transactionIdSet has the 'trans' semaphore
DEBUG#12:07:40 sem.cpp[181]: transactionIdSet gives the 'trans' semaphore for 'changing the transaction id'
INFO#12:07:40 clientSocketHttp.cpp[154]: Starting transaction to ngsiproxy.lab.fi-ware.org:443/callbacks/14:27:47-1:15:08:34-1
DEBUG#12:07:40 clientSocketHttp.cpp[240]: HTTP-HEADERS: 'X-relayer-host: ngsiproxy.lab.fi-ware.org:443'
DEBUG#12:07:40 clientSocketHttp.cpp[247]: HTTP-HEADERS: 'X-relayer-protocol: https'
DEBUG#12:07:40 clientSocketHttp.cpp[260]: HTTP-HEADERS: 'User-Agent: orion/0.20.0 libcurl/7.19.7'
DEBUG#12:07:40 clientSocketHttp.cpp[268]: HTTP-HEADERS: 'Host: localhost:5001'
DEBUG#12:07:40 clientSocketHttp.cpp[305]: HTTP-HEADERS: 'Content-length: 1141'
DEBUG#12:07:40 clientSocketHttp.cpp[353]: Sending message 18 to HTTP server: sending message of 1370 bytes to HTTP server
WARNING#12:07:40 clientSocketHttp.cpp[358]: Notification failure for localhost:5001 (curl_easy_perform failed: Couldn't connect to server)
INFO#12:07:40 clientSocketHttp.cpp[375]: Transaction ended
I know there is a similar question here, but it hasn't solved my problem so far, neither the Orion documentation.
I really appreciate any help you can provide.
EDIT:
It looks like that rush wasn't event installed, so I did it.
But everytime I try to run the listener it gives me this error:
time=2015-05-07T13:56:17.331Z | lvl=ERROR | op=RESPUSH BUCKET TASKS | msg=Error getting bucket elements | corr=N/A | trans=N/A | hostname=***** | component=retryBuckets | error=[Error: ERR unknown command 'evalsha']
Now, when I accept the operator, this are the traces:
-ORION:
DEBUG#15:04:28 senderThread.cpp[47]: sending to: host='ngsiproxy.lab.fi-ware.org', port=443, verb=POST, tenant='', service-path: '', xauthToken: '', path='/callbacks/13:35:20-1:18:05:22-1', content-type: application/xml
DEBUG#15:04:28 sem.cpp[124]: transactionIdSet taking the 'trans' semaphore for 'changing the transaction id'
DEBUG#15:04:28 sem.cpp[126]: transactionIdSet has the 'trans' semaphore
DEBUG#15:04:28 sem.cpp[181]: transactionIdSet gives the 'trans' semaphore for 'changing the transaction id'
INFO#15:04:28 clientSocketHttp.cpp[154]: Starting transaction to ngsiproxy.lab.fi-ware.org:443/callbacks/13:35:20-1:18:05:22-1
DEBUG#15:04:28 clientSocketHttp.cpp[240]: HTTP-HEADERS: 'X-relayer-host: ngsiproxy.lab.fi-ware.org:443'
DEBUG#15:04:28 clientSocketHttp.cpp[247]: HTTP-HEADERS: 'X-relayer-protocol: https'
DEBUG#15:04:28 clientSocketHttp.cpp[260]: HTTP-HEADERS: 'User-Agent: orion/0.20.0 libcurl/7.19.7'
DEBUG#15:04:28 clientSocketHttp.cpp[268]: HTTP-HEADERS: 'Host: localhost:5001'
DEBUG#15:04:28 clientSocketHttp.cpp[305]: HTTP-HEADERS: 'Content-length: 1141'
DEBUG#15:04:28 clientSocketHttp.cpp[353]: Sending message 1 to HTTP server: sending message of 1370 bytes to HTTP server
INFO#15:04:28 clientSocketHttp.cpp[364]: Notification Successfully Sent to localhost:5001/callbacks/13:35:20-1:18:05:22-1
INFO#15:04:28 clientSocketHttp.cpp[375]: Transaction ended
-Listener:
time=2015-05-07T15:08:12.803Z | lvl=INFO | op=RELAY REQUEST | msg=Relay Request received | corr=N/A | trans=N/A | hostname=Orion-Njoy | component=listener | userID='127.0.0.1' | reqInfo={ url: '/callbacks/13:35:20-1:18:09:06-1', method: 'POST', remoteAddress: '127.0.0.1', headers: { 'x-relayer-host': 'ngsiproxy.lab.fi-ware.org:443', 'x-relayer-protocol': 'https', 'x-relayer-proxy': undefined, 'x-relayer-retry': undefined, 'x-relayer-httpcallback': undefined, 'x-relayer-persistence': undefined, 'x-relayer-traceid': undefined, 'x-relayer-encoding': undefined, 'content-type': 'application/xml' }, responseTime: 1, statusCode: 500, bodyLength: 1141, id: { exceptionId: 'SVR1000', exceptionText: 'Generic Server Error: Error: ERR unknown command \'evalsha\'' } }
time=2015-05-07T15:08:12.803Z | lvl=INFO | op=PERSISTENCE | msg=Persistence Completed | corr=N/A | trans=e1467620-f4ca-11e4-a50f-ebe0dffc0e2e | hostname=Orion-Njoy | component=evPersistence | userID='127.0.0.1' | state='error'
-Consumer:
time=2015-05-07T13:56:17.331Z | lvl=ERROR | op=RESPUSH BUCKET TASKS | msg=Error getting bucket elements | corr=N/A | trans=N/A | hostname=Orion-Njoy | component=retryBuckets | error=[Error: ERR unknown command 'evalsha']
Any ideas, please?
EDIT 2:
I've manage to get it working thanks to the responses. The problem was that I was using redis 2.4, and it's required the 2.6 or supperior version. Now I can see my entities in the Map Viewer.
In case someone runs with the same problem, don't forget to install Rush and follow this instructions to install Redis 2.6:
Thank you all for your assistance.

Maybe the redis version is too old. EVAL/EVALSHA commands were introduced in redis 2.6.
I would check the redis version (>2.6.0)

It seems like the broker is unable to connect to rush, running in the same host and accepting connections on port 5001.
Are you sure rush is running? (and that it is on port 5001?).
The broker doesn't implement notifications (yet) in https itself, but needs rush for this purpose. But of course, rush must be running for this to work ...

Related

How to enable NGSIv2 in iotagent-ul helmchart?

I received {"name":"BAD_REQUEST","message":"Request error connecting to the Context Broker: 501"} error when when I send a POST to iotagent-ul deployed via iotagent-ul helm chart.
time=2022-10-08T09:03:18.182Z | lvl=DEBUG | corr=d7ed414d-a132-45ea-b4a3-38ee14a828dc | trans=d7ed414d-a132-45ea-b4a3-38ee14a828dc | op=IoTAgentNGSI.Request | from=n/a | srv=openiot | subsrv=/ | msg=Response {
"error": "NotImplemented",
"description": "Only NGSIv1-based forwarding supported at the present moment. Set explictely legacyForwarding to true"
}
Following the iotagent-ul documentation to enable NGSIv2, it must be set ngsiVersion in contextBroker:
{
host: '192.168.56.101',
port: '1026',
ngsiVersion: 'v2'
}
Since I am using the official fiware helm-chart, I have updated the configmap.yaml to include the ngsiVersion
contextBroker: {
/**
* Host where the Context Broker is located.
*/
host: '{{ .Values.iota.contextBroker.host }}',
/**
* Port where the Context Broker is listening.
*/
port: '{{ .Values.iota.contextBroker.port }}',
/**
* ngsiVersion supported by the Context Broker.
*/
ngsiVersion: '{{ .Values.iota.contextBroker.ngsiVersion }}'
}
Now, I get this error:
time=2022-10-08T18:17:24.614Z | lvl=ERROR | corr=841d2b61-463e-42ff-acd7-d0f4b867b7b3 | trans=841d2b61-463e-42ff-acd7-d0f4b867b7b3 | op=IoTAgentNGSI.DeviceService | srv=openiot | subsrv=/ | msg=Registration error connecting to the Context Broker: {"code":"400","reasonPhrase":"Bad Request","details":"missing isDomain value for registration attribute"} | comp=IoTAgent
According to comments on the question, you are using Orion-LD instead of official Orion. The Orion-LD support to NGSIv2 is limited, so I'd suggest to change your context broker to official Orion newest version (3.7.0 at the moment of writing this).

ETIMEDOUT connecting to MySql from Lambda

I am trying to connect to a MySql RDS instance from a Lambda function and getting an ETIMEDOUT error
The Lambda is not part of a VPC
The RDS instance is available publicly, I can connect to it from my laptop using MySqlWorkbench
The RDS instance's security group has inbound rules configured for all ports and 0.0.0.0/0
The Lambda's execution role has many policies (probably too many) including RDSFullAccess, LambdaVPCAccessExecutionRole, ec2:*, even AdministratorAccess!)
Again, the code executes locally, connects to and queries the RDS instance just fine. Executing the same code in Lambda throws the ETIMEDOUT error
Similar posts are resolved by adding the Lambda to the RDS instance's VPC, or by configuring the inbound rules on the database's security group. Nothing seems to work.
Since I can connect to the database from my laptop just fine, my hunch is that it's a problem with the Lambda
Are there additional policies I should attach to the Lambda's execution role?
Is there any other reason the Lambda would time out connecting to a publicly available database?
Additional info:
The Lambda is not running in a VPC. It runs on Node and connects to MySql using the mysql package v2.18.1 and is deployed using Serverless with the following config:
foo:
handler: functions/handlers.foo
timeout: 20
events:
- http:
path: /path/{pathParameter}/foo
method: get
cors: true
caching:
enabled: true
ttlInSeconds: 3600
cacheKeyParameters:
- name: request.path.pathParameter
In the Lambda I try connecting with this function (which, again, works fine when I execute the function on my laptop):
function openDbConnection() {
let connection = mysql.createConnection({
host: 'db-name.cgwxrjuo6oyd.us-east-1.rds.amazonaws.com',
user: process.env.DB_USER,
password: process.env.DB_PASS,
database: 'db-name'
});
try {
connection.connect(function(err) {
console.log("Database is ", connection.state)
if (err) {
return console.error('error: ' + err.message);
}
console.log('Connected to the MySQL server.');
});
} catch (error) {
console.log("Database is ", connection.state)
console.log("Error connecting to MySql: ", error);
}
return connection;
}
The database username and password are retrieved from environment variables that are published to the Lambda with Serverless using a .env.yml file:
provider:
name: aws
runtime: nodejs12.x
lambdaHashingVersion: '20201221'
environment: ${file(.env.yml):}
Below are the Cloudwatch logs for a single execution, which I'm having trouble making sense of. Entries appear out of sequence:
| timestamp | message |
|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1626209636788 | START RequestId: e3e3ceb7-bb55-4c3e-8392-38e08401f679 Version: $LATEST |
| 1626209636791 | 2021-07-13T20:53:56.790Z adfc1cd5-e4be-40b7-970c-d38acabeb199 INFO Database is disconnected |
| 1626209636791 | 2021-07-13T20:53:56.791Z adfc1cd5-e4be-40b7-970c-d38acabeb199 ERROR error: connect ETIMEDOUT |
| 1626209636791 | 2021-07-13T20:53:56.791Z adfc1cd5-e4be-40b7-970c-d38acabeb199 INFO An error occured querying MySql: connect ETIMEDOUT |
| 1626209636792 | 2021-07-13T20:53:56.792Z adfc1cd5-e4be-40b7-970c-d38acabeb199 INFO Database is disconnected |
| 1626209636792 | 2021-07-13T20:53:56.792Z adfc1cd5-e4be-40b7-970c-d38acabeb199 ERROR error: Connection lost: The server closed the connection. |
| 1626209636793 | 2021-07-13T20:53:56.792Z adfc1cd5-e4be-40b7-970c-d38acabeb199 INFO An error occured querying MySql: Connection lost: The server closed the connection. | 1626209636803 | END RequestId: e3e3ceb7-bb55-4c3e-8392-38e08401f679 |
| 1626209636803 | REPORT RequestId: e3e3ceb7-bb55-4c3e-8392-38e08401f679 Duration: 9.32 ms Billed Duration: 10 ms Memory Size: 1024 MB Max Memory Used: 79 MB |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

ContextBroker subscriptions Error

I've updated cygnus from version 0.13 to 1.7.0 by installing NGSI following this tutorial:
https://github.com/telefonicaid/fiware-cygnus/tree/master/cygnus-ngsi
Error the subscription
[
{
"id": "59d38a92dbaa1e477aef9c00",
"description": "A subscription to get info about pruebas",
"status": "failed",
"subject": {
"entities": [
{
"id": "pruebas",
"type": "pruebas"
}
],
"condition": {
"attrs": [
"pressure"
]
}
},
"notification": {
"timesSent": 2,
"lastNotification": "2017-10-03T13:03:43.00Z",
"attrs": [
"temperature",
"pressure"
],
"attrsFormat": "legacy",
"http": {
"url": "http://localhost:5050/notify"
},
"lastFailure": "2017-10-03T13:03:43.00Z"
}
}
]
viewing the contextBroker log gives the following:
$pp[328]:notificationError | msg=Raising alarm NotificationError http://localhost:5050/notify: (curl_easy_perform failed: Couldn't connect to server)
I have contextBroker on the same machine as cygnus so I have already tried to change the notify ip for the server and for localhost and it does not work for any of it.
with version 0.13 if it works with localhost.
What could be the problem?
It does not even come to cygnus configuration files because it can not access from the contextBroker.
Greetings and thank you.
EDIT1:
I am tested with the fiwareLab machines and removing cygnus 0.13 that comes pre installed with YUM REMOVE CYGNUS. Then I installed 1.7 with YUM INSTALL CYGNUS-NGSI and installed two packages ngsi and common.
Restarting the service with service cygnus restart indicates the following:
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
cygnus-ngsi x86_64 1.7.1-0.g9df0d4d fiware 74 M
Installing for dependencies:
cygnus-common x86_64 1.7.1-0.g9df0d4d fiware 128 M
Transaction Summary
================================================================================
Install 2 Package(s)
Total size: 202 M
Installed size: 223 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
[INFO] Creating cygnus user
Installing : cygnus-common-1.7.1-0.g9df0d4d.x86_64 1/2
[INFO] Creating log directory
Done
Installing : cygnus-ngsi-1.7.1-0.g9df0d4d.x86_64 2/2
Verifying : cygnus-common-1.7.1-0.g9df0d4d.x86_64 1/2
Verifying : cygnus-ngsi-1.7.1-0.g9df0d4d.x86_64 2/2
Installed:
cygnus-ngsi.x86_64 0:1.7.1-0.g9df0d4d
Dependency Installed:
cygnus-common.x86_64 0:1.7.1-0.g9df0d4d
Complete!
[centos#centos6 cygnus]$ sudo service cygnus restart
There aren't any instance of Cygnus running [ OK ]
Starting Cygnus 1... [ OK ]
When I try on my server I do the same steps but when doing the service cygnus restart has two cygnus the 1 and 2 not as in vuesta machine that only has one and therefore indicates that the port 8081 is already in use.
Dependencias resueltas
============================================================================================================================================================================
Paquete Arquitectura Versión Repositorio Tamaño
============================================================================================================================================================================
Instalando:
cygnus-ngsi x86_64 1.7.1-0.g9df0d4d fiware 74 M
Instalando para las dependencias:
cygnus-common x86_64 1.7.1-0.g9df0d4d fiware 128 M
Resumen de la transacción
============================================================================================================================================================================
Instalar 2 Paquete(s)
Tamaño total de la descarga: 202 M
Tamaño instalado: 223 M
Está de acuerdo [s/N]:s
Descargando paquetes:
(1/2): cygnus-common_hadoopcore_1.2.1-1.7.1-0.g9df0d4d.x86_64.rpm | 128 MB 00:14
(2/2): cygnus-ngsi-1.7.1-0.g9df0d4d.x86_64.rpm | 74 MB 00:07
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 8.9 MB/s | 202 MB 00:22
Ejecutando el rpm_check_debug
Ejecutando prueba de transacción
La prueba de transacción ha sido exitosa
Ejecutando transacción
[INFO] Creating cygnus user
Instalando : cygnus-common-1.7.1-0.g9df0d4d.x86_64 1/2
[INFO] Creating log directory
Done
Instalando : cygnus-ngsi-1.7.1-0.g9df0d4d.x86_64 2/2
Verifying : cygnus-common-1.7.1-0.g9df0d4d.x86_64 1/2
Verifying : cygnus-ngsi-1.7.1-0.g9df0d4d.x86_64 2/2
Instalado:
cygnus-ngsi.x86_64 0:1.7.1-0.g9df0d4d
Dependencia(s) instalada(s):
cygnus-common.x86_64 0:1.7.1-0.g9df0d4d
¡Listo!
[root#UAL-IoF2020 conf]# ls
agent_1.conf agent_ngsi.conf.template cygnus_instance_2.conf grouping_rules_2.conf krb5_login.conf README-cygnus-common.md
agent_3.conf cartodb_keys.conf.template cygnus_instance.conf.template grouping_rules.conf.template log4j.properties README-cygnus-ngsi.md
agent.conf.template cygnus_instance_1.conf flume-env.sh.template krb5.conf.template name_mappings.conf.template
[root#UAL-IoF2020 conf]# service cygnus restart
There aren't any instance of Cygnus running [ OK ]
Starting Cygnus 1... [ OK ]
Starting Cygnus 2... [ OK ]
[root#UAL-IoF2020 conf]#
Is it possible that this is the problem and that is not recognizing my NGSI and this occupying the 8081 the common? or is this normal?
Log cygnus :
time=2017-10-03T21:51:09.326Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=main | msg=com.telefonica.iot.cygnus.nodes.CygnusApplication[301] : Starting a Jetty server listening on 0.0.0.0:8081 (Management Interface)
time=2017-10-03T21:51:09.381Z | lvl=WARN | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=warn | msg=org.mortbay.log.Slf4jLog[76] : failed SelectChannelConnector#0.0.0.0:8081: java.net.BindException: La dirección ya se está usando
time=2017-10-03T21:51:09.381Z | lvl=WARN | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=warn | msg=org.mortbay.log.Slf4jLog[76] : failed Server#52992ace: java.net.BindException: La dirección ya se está usando
time=2017-10-03T21:51:09.381Z | lvl=FATAL | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=run | msg=com.telefonica.iot.cygnus.http.JettyServer[90] : Fatal error running the Management Interface. Details=La dirección ya se está usando
EDIT2
I have already solved the problem of two cygnus, had two agent_1 and agent_2 created. I have deleted one of them and already performing service cygnus restart appears only one cygnus. We are getting better.
But I still have the same problem with the subscriptions:
The contextBroker log indicates:
 
msg = Raising alarm NotificationError http: // localhost: 5050 / notify: (curl_easy_perform failed: could not connect to server)
When I try:
[root # UAL-IoF2020 conf] # netstat -np | grep 5050
I do not think anything.
When I launch this:
[root # UAL-IoF2020 conf] # netstat -np | grep 1026
tcp 0 0 150.XXX.XXX.XXX:1026 XXX.XXX.XXX.XXX:50348 ESTABLISHED 5169 / contextBroker
I am trying to launch a Test of your page.
./notification-json-simple.sh http: // localhost: 5050 / notify myservice myservicepath
and gives me the following error:
[root # UAL-IoF2020 ngsi-examples] # ./notification-json-simple.sh http: // localhost: 5050 / notify myservice myservicepath
* About to connect () to localhost port 5050 (# 0)
* Trying :: 1 ... Connection refused
* Trying 127.0.0.1 ... Connection refused
* could not connect to host
* Closing connection # 0
curl: (7) could not connect to host
It gives the impression that in the 5050 I have nothing listening.
Any clue what that might be?
cygnus-ngsi.sources = http-source
cygnus-ngsi.sinks = mysql-sink
cygnus-ngsi.channels = mysql-channel
#=============================================
# source configuration
# channel name where to write the notification events
cygnus-ngsi.sources.http-source.channels = mysql-channel
# source class, must not be changed
cygnus-ngsi.sources.http-source.type = org.apache.flume.source.http.HTTPSource
# listening port the Flume source will use for receiving incoming notifications
cygnus-ngsi.sources.http-source.port = 5050
# Flume handler that will parse the notifications, must not be changed
cygnus-ngsi.sources.http-source.handler = com.telefonica.iot.cygnus.handlers.NGSIRestHandler
# URL target
cygnus-ngsi.sources.http-source.handler.notification_target = /notify
# default service (service semantic depends on the persistence sink)
cygnus-ngsi.sources.http-source.handler.default_service = default
# default service path (service path semantic depends on the persistence sink)
cygnus-ngsi.sources.http-source.handler.default_service_path = /
# source interceptors, do not change
cygnus-ngsi.sources.http-source.interceptors = ts gi
# TimestampInterceptor, do not change
cygnus-ngsi.sources.http-source.interceptors.ts.type = timestamp
# GroupingInterceptor, do not change
cygnus-ngsi.sources.http-source.interceptors.gi.type = com.telefonica.iot.cygnus.interceptors.NGSIGroupingInterceptor$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
cygnus-ngsi.sources.http-source.interceptors.gi.grouping_rules_conf_file = /usr/cygnus/conf/grouping_rules.conf
Do I have to install cygnus-common manual?
Reading the documentation (https://github.com/telefonicaid/fiware-cygnus/tree/master/cygnus-ngsi) it's wrote:
Cygnus NGSI is based on Apache Flume, which is used through cygnus-common and which Cygnus NGSI depends on.
I think you need to install cygnus-common.
I have already solved the problem.
It was in the configuration file of cygnus_instance_1.conf, you had to rename the cygnusagent agent by cygnus-ngsi.
For installation, I have simply followed these steps.
Install ContextBroker.
Install MongoDB (for contextBroker to
work).
Install cygnus-ngsi, this in turn installed automatically
cygnus-common.
Copy the agent_ngsi.conf.template and rename it with
agent_1.conf
Copy the cygnus_instance.conf.template to cygnus_instance_1.conf
Rename the agent from cygnus_instance_1.conf to cygnus-ngsi and the configuration file created above (agent_1.conf)
All this has been with Yum Install, with RPM, I have not had to install apache flume or anything, this way it does everything automatically.
I hope this helps and thanks.
The last error log you have posted is the key: there is another running process listening on TCP/5050 port. Most probably, a previous run of Cygnus not stopped/killed properly.

Encrypting Nagios report mails with GnuPG fails with empty mails, why?

I am trying to crytp using gpg2 the mails sent by Nagios3. For that, I have create this custom command on /etc/nagios3/commands.cfg :
/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/gpg2 --armor --encrypt --recipient toto#titi.com | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
Some points:
The e-mail is sent but it is "empty":
Sep 19 14:35:25 tutu nagios3: Finished daemonizing... (New PID=4313)
Sep 19 14:36:15 tutu nagios3: SERVICE ALERT:
tete_vm;HTTP;OK;HARD;4;HTTP OK: HTTP/1.1 200 OK - 347 bytes in 0.441
second response time Sep 19 14:36:15 tutu nagios3: SERVICE
NOTIFICATION: tata;tete_vm;HTTP;OK;notify-service-by-email;HTTP OK:
HTTP/1.1 200 OK - 347 bytes in 0.441 second response time
The command:
/usr/bin/gpg2 --armor --encrypt --recipient toto#titi.com | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$</code>
works very well on command line
I have tested this command:
/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/gpg2 --armor --encrypt --recipient toto#titi.com >> /tmp/toto.txt
The file /tmp/toto.txt is created but "empty".
So, it seems to be a problem using /usr/bin/gpg2 on this file, but I cannot find why!
The most common mistake when encrypting from within services using GnuPG is that the recipient's key was imported by another (system) user than the one the service is running under, for example imported by root, but the service runs as nagios.
GnuPG maintains per-user "GnuPG home directories" (usually ~/.gnupg) with per-user keyrings in them. If you imported as root, other service accounts don't know anything about the keys in there.
The first step for debugging the issue would be to redirect gpg's stderr to a file, so you can read the error message by adding 2>>/tmp/gpg-error.log to the GnuPG call:
/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/gpg2 --armor --encrypt --recipient toto#titi.com 2>>/tmp/gpg-error.log | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
If the issue is something like "key not found" or similar, you've got two possibilities to resolve the issue:
Import to the service's user account. Switch to the service's user, and import the key again.
Hard-code the GnuPG home directory to somewhere else using the --homedir [directory] option, for example in a place you also store your Nagios plugins.
Be aware of using appropriate, restrictive permissions. GnuPG is very picky if other users than the owner are allowed to read the files!

mapViewer widget doesn't show map markers

Following my previous question Rush installation and integration with Orion Context Broker I have Rush Relayer working properly, but it still doesn't let me show the markers on the mapViewer.
What I get in my instance is:
INFO#21:01:23 clientSocketHttp.cpp[348]: Notification Successfully Sent to localhost:5001/callbacks/23:01:42-1:23:01:45-1
INFO#21:01:23 clientSocketHttp.cpp[359]: Transaction ended
time=2015-01-14T21:01:23.305Z | lvl=INFO | op=RELAY REQUEST | msg=Relay Request received | corr=N/A | trans=7f1d7e00-9c30-11e4-b26a-090df9e0789f | hostname=fiware | component=listener | userID='127.0.0.1' | reqInfo={ url: '/callbacks/23:01:42-1:23:01:45-1', method: 'POST', remoteAddress: '127.0.0.1', headers: { 'x-relayer-host': 'ngsiproxy.lab.fi-ware.org:443', 'x-relayer-protocol': 'https', 'x-relayer-proxy': undefined, 'x-relayer-retry': undefined, 'x-relayer-httpcallback': undefined, 'x-relayer-persistence': undefined, 'x-relayer-traceid': undefined, 'x-relayer-encoding': undefined, 'content-type': 'application/xml' }, responseTime: 8, statusCode: 201, bodyLength: 3323, id: { id: '7f1d7e00-9c30-11e4-b26a-090df9e0789f' } }
Everything seems to work well but I can't see the markers on the mapViewer.
As far as it is Rush related, it would be important to have the traces at the Consumer process, there we could see if there is any problem with the relay itself. The listener just tell us that Rush has created a relay task.
Could you please post that traces?