Kapacitor Sideload

I’m not quite clear how SideloadNode works in Kapacitor. I am able to get default value added to my stream, but cannot do proper data lookup. What are the rules for structuring lookup data that we specify in source()?

dbrp "snmp_trap"."default"

stream
	|from()
		.measurement('snmp_trap')
	|sideload()
		.source('file:/tmp/aging_conf')
		.order('{{.name}}')
		.field('aging_duration', 69)
	|alert()
		.info(lambda: TRUE)
		.log('/tmp/enhanced.log')

results in aging_duration set to 69, even though in /tmp/aging_conf/netSnmpExampleHeartbeatNotification file I have “77”. This is what gets into enhanced.log:

{
	"id": "snmp_trap:nil",
	"message": "snmp_trap:nil is INFO",
	"details": "{\u0026#34;Name\u0026#34;:\u0026#34;snmp_trap\u0026#34;,\u0026#34;TaskName\u0026#34;:\u0026#34;aging\u0026#34;,\u0026#34;Group\u0026#34;:\u0026#34;nil\u0026#34;,\u0026#34;Tags\u0026#34;:{\u0026#34;host\u0026#34;:\u0026#34;trap-snmp-kafka\u0026#34;,\u0026#34;mib\u0026#34;:\u0026#34;NET-SNMP-EXAMPLES-MIB\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;netSnmpExampleHeartbeatNotification\u0026#34;,\u0026#34;oid\u0026#34;:\u0026#34;.1.3.6.1.4.1.8072.2.3.0.1\u0026#34;,\u0026#34;source\u0026#34;:\u0026#34;10.240.15.0\u0026#34;,\u0026#34;version\u0026#34;:\u0026#34;2c\u0026#34;},\u0026#34;ServerInfo\u0026#34;:{\u0026#34;Hostname\u0026#34;:\u0026#34;tick-kapacitor-enterprise-0\u0026#34;,\u0026#34;ClusterID\u0026#34;:\u0026#34;9bd0e098-64ed-4d1f-9d33-0fbb4ec64351\u0026#34;,\u0026#34;ServerID\u0026#34;:\u0026#34;9bd0e098-64ed-4d1f-9d33-0fbb4ec64352\u0026#34;},\u0026#34;ID\u0026#34;:\u0026#34;snmp_trap:nil\u0026#34;,\u0026#34;Fields\u0026#34;:{\u0026#34;aging_duration\u0026#34;:69,\u0026#34;netSnmpExampleHeartbeatRate\u0026#34;:12349,\u0026#34;sysUpTimeInstance\u0026#34;:649511},\u0026#34;Level\u0026#34;:\u0026#34;INFO\u0026#34;,\u0026#34;Time\u0026#34;:\u0026#34;2020-10-12T19:53:57.651001618Z\u0026#34;,\u0026#34;Duration\u0026#34;:1040591469872,\u0026#34;Message\u0026#34;:\u0026#34;snmp_trap:nil is INFO\u0026#34;}\n",
	"time": "2020-10-12T19:53:57.651001618Z",
	"duration": 1040591469872,
	"level": "INFO",
	"data": {
		"series": [{
				"name": "snmp_trap",
				"tags": {
					"host": "trap-snmp-kafka",
					"mib": "NET-SNMP-EXAMPLES-MIB",
					"name": "netSnmpExampleHeartbeatNotification",
					"oid": ".1.3.6.1.4.1.8072.2.3.0.1",
					"source": "10.240.15.0",
					"version": "2c"
				},
				"columns": ["time", "aging_duration", "netSnmpExampleHeartbeatRate", "sysUpTimeInstance"],
				"values": [["2020-10-12T19:53:57.651001618Z", 69, 12349, 649511]]
			}
		]
	},
	"previousLevel": "INFO",
	"recoverable": true
}

Hello @nekrassov,
I’m not sure. Is the type in your source also an int? Can you share your file content?
I think this documentation is pretty useful. Have you seen it?

Thank you Anais!

It is working now. I suggest https://docs.influxdata.com/kapacitor/v1.5/nodes/sideload_node/ is updated to include
The contents of the file should contain one or more key-value pairs. The key is the field or tag key that will be set on each matching point. The value is the field or tag value that will be set on matching points.
and the file example from https://docs.influxdata.com/kapacitor/v1.5/guides/scheduled-downtime/

I also noticed that “.yml” file extension is required; the lookup doesn’t work for me if the file is named simply netSnmpExampleHeartbeatNotification

Thanks again!

Hi @nekrassov, Were you trying this on Windows OS?

I cannot seem to load the file using sideload, can you share your script as an example?

I am using Ubuntu. The script:

// add aging information

dbrp "snmp_trap"."default"

stream
        |from()
                .measurement('snmp_trap')
        |sideload()
                .source('file:///tmp/aging_conf')
                .order('{{.name}}.yml')
                .field('aging_duration', 69)
        |alert()
                .info(lambda: TRUE)
                .log('/tmp/enhanced.log')

// kapacitor define aging -tick aging.tick
// kapacitor enable aging
// kapacitor list tasks
// kapacitor show aging

I have configuration in a file with the name matching what I get in “name” field in my point/alarm:

cat /tmp/aging_conf/netSnmpExampleHeartbeatNotification.yml
aging_duration: 77
1 Like

I see, will try to make some changes to get around this.
Thanks a lot @nekrassov for the pointer and sharing the output.

1 Like