Skip to content

Latest commit

 

History

History
117 lines (95 loc) · 1.89 KB

perseo.md

File metadata and controls

117 lines (95 loc) · 1.89 KB

NGSI Go tutorial for Perseo

Get settings of alias

ngsi server get --host perseo
serverType perseo
serverHost http://perseo:9090

Print version

ngsi version --host perseo --pretty
{
  "error": null,
  "data": {
    "name": "perseo",
    "description": "IOT CEP front End",
    "version": "1.12.1"
  }
}

List rules

ngsi rules list --verbose --pretty

```json
[]

Create rules

ngsi rules --host perseo create \
--data '{
    "name": "blood_rule_update",
    "text": "select *, *, ev.BloodPressure? as Pressure, ev.id? as Meter from pattern [every ev=iotEvent(cast(cast(BloodPressure?,String),float)>1.5 and type=\"BloodMeter\")]",
    "action": {
        "type": "update",
        "parameters": {
            "attributes": [
                {
                    "name": "abnormal",
                    "value": "true",
                    "type": "boolean"
                }
            ]
        }
    }
}'

List rules

ngsi rules list
blood_rule_update

Get rule

ngsi rules get --name blood_rule_update --pretty
{
  "error": null,
  "data": {
    "_id": "6024c00a8e2bfc0012c77486",
    "name": "blood_rule_update",
    "text": "select \"blood_rule_update\" as ruleName, *, *, ev.BloodPressure? as Pressure, ev.id? as Meter from pattern [every ev=iotEvent(cast(cast(BloodPressure?,String),float)>1.5 and type=\"BloodMeter\")]",
    "action": {
      "type": "update",
      "parameters": {
        "attributes": [
          {
            "name": "abnormal",
            "value": "true",
            "type": "boolean"
          }
        ]
      }
    },
    "subservice": "/",
    "service": "unknownt"
  }
}

Delete rule

ngsi rules delete --name blood_rule_update

Print number of rules

ngsi rules list --count
0