-
-
Notifications
You must be signed in to change notification settings - Fork 778
Closed
Description
wen I test sensor linux.FileWatchSensor:
root@6206c3910cd6:/opt/stackstorm/packs/linux/sensors# st2 sensor get linux.FileWatchSensor
+---------------+--------------------------------------------------------------+
| Property | Value |
+---------------+--------------------------------------------------------------+
| id | 5c2d8324d28ef50172db13e9 |
| uid | sensor_type:linux:FileWatchSensor |
| ref | linux.FileWatchSensor |
| pack | linux |
| name | FileWatchSensor |
| enabled | True |
| entry_point | sensors.file_watch_sensor.FileWatchSensor |
| artifact_uri | file:///opt/stackstorm/packs/linux/sensors/file_watch_sensor |
| | .py |
| trigger_types | [ |
| | "linux.file_watch.line" |
| | ] |
| description | Sensor which monitors files for new lines |
| metadata_file | sensors/file_watch_sensor.yaml |
+---------------+--------------------------------------------------------------+I use rule as follow:
root@6206c3910cd6:/opt/stackstorm/packs/examples/rules# cat sample_rule_file_watch.yaml
---
name: sample_rule_file_watch
pack: "examples"
description: Sample rule custom trigger type - add a file to be watched by file_watch_sensor in linux pack.
enabled: true
trigger:
parameters:
file_path: /tmp/st2_test
type: linux.file_watch.line
criteria: {}
action:
parameters:
cmd: echo "{{trigger}}"
ref: core.localI execute cmd, like this:
echo >> liucong /tmp/st2_test
and err log in /var/log/st2/st2sensorcontainer.log as follows:
2019-01-03 03:39:07,046 139683133441840 INFO tail [-] Tailing /tmp/st2_test
2019-01-03 03:39:07,047 139683133441840 INFO file_watch_sensor [-] Added file "/tmp/st2_test"
2019-01-03 03:41:00,852 139683181345520 WARNING trigger_dispatcher [-] Failed to validate payload ({'file_name': u'st2_test', 'line': u'liucong', 'file_path': u'/tmp/st2_test'}) for trigger "linux.cd875f82-58d6-47ff-9eff-11bd81493bf7": Trigger type with reference "linux.cd875f82-58d6-47ff-9eff-11bd81493bf7" doesn't exist in the database
Metadata
Metadata
Assignees
Labels
No labels