fiware-perseo CEP 不发送电子邮件,我在 mongo 中看不到规则,但是当我运行时获取规则是的



当我设置一条规则以发送fiware-perseo cep的电子邮件时,当属性更改时,我不会收到电子邮件,如果我在mongo中寻找规则,我可以't看到它,但是如果我执行从API获取的规则,我会看到规则。我使用docker,我不知道我是否已经正确设置了.yml文件以设置perseo-core,perseo-fe和Orion,我遵循了指南:

https://perseo.readthedocs.io/en/latest/admin/

我不知道在猎户座中,我是否必须设置任何东西才能指向Perseo。我在代码部分中提供代码。

来自.yml代码的部分,我已经通过API创建了此规则:

    {
    "name": "prueba1",
    "text": "select *, "prueba1" as ruleName ,ev.temperature? as temperature, ev.id? as id from pattern [every ev=iotEvent(cast(cast(temperature?,String),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"
        }
    }
}
version: "3.1"
services:
  mongo-db:
    image: mongo:3.2
    hostname: mongo-db
    container_name: fiware-mongo-db
    ports:
        - "27017:27017"
    expose:
        - "27017"    
    networks:
        - smartcity
    volumes:
      - "mongo-db:/data"
  mysql-db:
    image: mysql:5.7
    hostname: mysql-db
    container_name: fiware-mysql-db
    expose:
      - "3306"
    ports:
      - "3306:3306"
    networks:
      - smartcity
    environment:
      - "MYSQL_ROOT_PASSWORD=1234"
      - "MYSQL_ROOT_HOST=%"
    volumes:
      - mysql-db:/var/lib/mysql"
  orion:
    image: fiware/orion:latest
    hostname: orion
    container_name: fiware-orion-mongo
    networks:
        - smartcity
    expose:
        - "1026"
    ports:
        - "1026:1026"
    command: -dbhost mongo-db -logLevel DEBUG
    healthcheck:
      test: curl --fail -s http://localhost:1026/version || exit 1
  cygnus:
    image: fiware/cygnus-ngsi:1.10.0
    hostname: cygnus
    container_name: fiware-cygnus
    depends_on:
        - mysql-db
        - mongo-db
    networks:
        - smartcity
    expose:
      - "5080"
    ports:
      - "5050:5050"
      - "5051:5051"
      - "5054:5054"
      - "5080:5080"
    environment:
        - "CYGNUS_MULTIAGENT=true" # Whether to persist data into multiple databases.
        - "CYGNUS_MONGO_HOSTS=mongo-db:27017" # Comma separated list of Mongo-DB servers which Cygnus will contact to persist historical context data
        - "CYGNUS_MONGO_DATA_MODEL=dm-by-service-path" # data_model
        - "CYGNUS_MONGO_ATTR_PERSISTENCE=column" # data_model
        - "CYGNUS_MONGO_DB_PREFIX=sti-"
        - "CYGNUS_MONGO_USER=root"
        - "CYGNUS_MONGO_PASS=example"
        - "CYGNUS_STH_DB_PREFIX=sth-"
        - "CYGNUS_LOG_LEVEL=DEBUG" # The logging level for Cygnus
        - "CYGNUS_SERVICE_PORT=5050" # Notification Port that Cygnus listens when subcribing to context data changes
        - "CYGNUS_API_PORT=5080" # Port that Cygnus listens on for operational reasons
        - "CYGNUS_MYSQL_HOST=mysql-db" # Hostname of the MySQL server used to persist historical context data 
        - "CYGNUS_MYSQL_PORT=3306" # Port that the MySQL server uses to listen to commands
        - "CYGNUS_MYSQL_USER=root" # Username for the MySQL database user
        - "CYGNUS_MYSQL_PASS=1234" # Password for the MySQL database user
        - "CYGNUS_MYSQL_DATA_MODEL=dm-by-service-path" # data_model
        - "CYGNUS_MYSQL_ATTR_PERSISTENCE=row"
    healthcheck:
      test: curl --fail -s http://localhost:5080/v1/version || exit 1
  iot-agent:
    image: fiware/iotagent-ul:1.8.0
    hostname: iot-agent
    container_name: fiware-iot-agent
    networks:
        - smartcity
    ports:
        - "4041:4041"
        - "7896:7896"
    environment:
        - "IOTA_CB_HOST=orion" # name of the context broker to update context
        - "IOTA_CB_PORT=1026" # port the context broker listens on to update context
        - "IOTA_NORTH_PORT=4041"
        - "IOTA_REGISTRY_TYPE=mongodb" #Whether to hold IoT device info in memory or in a database
        - "IOTA_LOG_LEVEL=DEBUG" #The log level of the IoT Agent
        - "IOTA_TIMESTAMP=true"
        - "IOTA_MONGO_HOST=mongo-db" # The host name of ongoDB
        - "IOTA_MONGO_PORT=27017" # The port mongoDB is listening on
        - "IOTA_MONGO_DB=iot-smartcity" # The name of the database used in mongoDB
        - "IOTA_HTTP_PORT=7896" # The port used for device traffic over HTTP
        - "IOTA_PROVIDER_URL=http://iot-agent:4041"
    healthcheck:
      test: curl --fail -s http://localhost:4041/iot/about || exit 1
  sth-comet:
    image: fiware/sth-comet
    hostname: sth-comet
    container_name: fiware-sth-comet
    networks:
        - smartcity
    ports:
        - "8666:8666"
    environment:
        - STH_HOST=0.0.0.0
        - STH_PORT=8666
        - DB_PREFIX=sth-commet-
        - "DB_URI=mongo-db:27017"
        - LOGOPS_LEVEL=DEBUG
  perseo-core:
    image: fiware/perseo-core
    hostname: perseo-core
    container_name: fiware-perseo-core
    depends_on:
        - mongo-db
        - orion
    networks:
        - smartcity
    ports:
        - "8080:8080"
    environment:
        - PERSEO_FE_URL=http://perseo-fe:9090
        - MAX_AGE=6000
  perseo-front:
    image: fiware/perseo
    hostname: perseo-fe
    container_name: fiware-perseo-fe
    networks:
        - smartcity
    ports:
        - "9090:9090"
    depends_on:
         - perseo-core
    environment:
        - PERSEO_ENDPOINT_HOST=perseo-core
        - PERSEO_ENDPOINT_PORT=8080
        - PERSEO_MONGO_HOST=mongo-db
        - PERSEO_MONGO_URL=http://mongo-db:27017
        - PERSEO_MONGO_ENDPOINT=mongo-db:27017  
        - PERSEO_ORION_URL=http://orion:1026/
        - PERSEO_LOG_LEVEL=debug
        - PERSEO_CORE_URL=http://perseo-core:8080
        - PERSEO_SMTP_SECURE=true
        - PERSEO_MONGO_USER:"root"
        - PERSEO_MONGO_PASSWORD:"example"
        - PERSEO_SMTP_HOST=mail.someplace.com
        - PERSEO_SMTP_PORT=25
        - PERSEO_SMTP_AUTH_USER=someplace@someplace.com
        - PERSEO_SMTP_AUTH_PASS=xxxxx
        - PERSEO_NOTICES_PATH='/notices'
        - PERSEO_RULES_PATH='/rules'
    networks:
        - smartcity        
volumes:
  mongo-db: 
  mysql-db:
networks:
  smartcity:
    driver: bridge

我希望能够在属性超过阈值时发送电子邮件,现在它不起作用。

寻求perseo配置,似乎您已经留下了SMTP的配置模板,例如:

- PERSEO_SMTP_HOST=mail.someplace.com

注意mail.someplace.com只是一个示例,但它不是真正的SMTP服务器。您应该调整此(也许还有其他PERSEO_SMTP_xxx参数(配置参数以适合您的SMTP服务器中的配置。

编辑:为了检查规则条件并知道问题是否在规则条件下还是在SMTP配置中,您可以尝试相同的规则条件,但采用更简单的操作(例如,执行HTTP操作,并结合某种回声服务(例如RequestBin(

edit2: msg=missing subservice header, msg=missing service header通常意味着输入请求没有具有多态度的fiware-servicefiware-servicepath HTTP标头。此处描述了Fiware多端模型。

正确的是:http://perseo-fe-ip:9090/ulus,它有效。

将规则存储在mongodb中并正确启动规则。

最新更新