FIWARE Perseo CEP邮件告警失效及规则存储异常排查求助
Let's work through your three issues step by step to get your threshold-based email alerts working as expected.
1. No Alert Emails Received When Threshold Is Exceeded
This is likely a combination of missing event routing and misconfigured SMTP settings:
Fix SMTP Configuration in Perseo-FE
Your current Docker Compose setsPERSEO_SMTP_SECURE=truewith port25—this is a conflict, as port 25 typically uses unencrypted connections. Adjust this based on your email provider's requirements:- If your provider uses unencrypted SMTP on port 25: Set
PERSEO_SMTP_SECURE=false - If using TLS (port 587) or SSL (port 465): Keep
PERSEO_SMTP_SECURE=trueand update thePERSEO_SMTP_PORTto match your provider's secure port.
Double-check thatPERSEO_SMTP_AUTH_USERandPERSEO_SMTP_AUTH_PASSmatch your email account credentials exactly.
- If your provider uses unencrypted SMTP on port 25: Set
Add an Orion Subscription to Route Events to Perseo
Perseo won't receive events unless Orion is configured to send notifications to it. Run this curl command to create a subscription (adjust entity/attribute filters if needed):curl -X POST http://localhost:1026/v2/subscriptions \ -H "Content-Type: application/json" \ -d '{ "description": "Send AirQualityObserved temperature changes to Perseo", "subject": { "entities": [{"idPattern": ".*", "type": "AirQualityObserved"}], "condition": {"attrs": ["temperature"]} }, "notification": { "http": {"url": "http://perseo-fe:9090/notices"}, "attrs": ["temperature", "id", "type"] } }'Simplify Your Rule's EPL Syntax
Your current EPL has unnecessary nested casts and uses?(left outer join operator) which might cause unexpected behavior. Update the rule to:{ "name": "prueba1", "text": "select *, \"prueba1\" as ruleName, ev.temperature as temperature, ev.id as id from pattern [every ev=iotEvent(cast(temperature as float) > 45.5 and type=\"AirQualityObserved\")]", "action": { "type": "email", "template": "Entity ${id} temperature is ${temperature}", "parameters": { "to": "antonio.moreno@someplace.com", "from": "avisos@someplace.com", "subject": "High Temp" } } }
2. Rule Not Found in MongoDB but Retrievable via API
You're likely looking in the wrong database:
Check the Correct Perseo Database
Perseo stores rules in theperseodatabase (by default), not Orion'soriondatabase. Connect to your MongoDB container and run these commands:# Enter the MongoDB container docker exec -it fiware-mongo-db mongo # Switch to the Perseo database use perseo # Query for your rule db.rules.find({name: "prueba1"})Verify MongoDB Authentication
Your Perseo-FE config setsPERSEO_MONGO_USER="root"andPERSEO_MONGO_PASSWORD="example". Ensure the root user in MongoDB has read/write access to theperseodatabase. If not, create a dedicated Perseo user with appropriate permissions.
3. Docker Compose Correctness & Orion-Perseo Integration
Most of your Compose config is correct, but there are a few tweaks to confirm:
Confirm Network Connectivity
All services are in thesmartcitybridge network, so container-to-container communication (e.g., Orion → Perseo-FE, Perseo-FE → Perseo-Core) should work as expected.Validate Perseo Configuration
PERSEO_ORION_URL=http://orion:1026/(correct, points to Orion's internal address)PERSEO_CORE_URL=http://perseo-core:8080(correct, links front-end to core)PERSEO_NOTICES_PATH='/notices'(matches the subscription URL we created earlier)
Restart Perseo Services
After making SMTP or rule changes, restart the Perseo containers to apply updates:docker-compose restart perseo-fe perseo-core
Once you've applied these fixes, test your workflow by updating an AirQualityObserved entity's temperature above 45.5—you should receive the alert email, and your rule should be visible in the perseo MongoDB database.
内容的提问来源于stack exchange,提问作者Antonio Moreno Borras

