Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Latest commit

 

History

History
 
 

connect-snmp-source

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

SNMP Trap Source connector

asciinema

Objective

Quickly test SNMP Trap Source connector.

How to run

Simply run:

$ ./snmp-trap-source.sh

Details of what the script is doing

Creating SNMP Trap Source connector

$ curl -X PUT \
     -H "Content-Type: application/json" \
     --data '{
               "tasks.max": "1",
                    "connector.class": "io.confluent.connect.snmp.SnmpTrapSourceConnector",
                    "kafka.topic": "snmp-kafka-topic",
                    "snmp.v3.enabled": "true",
                    "snmp.batch.size": "50",
                    "snmp.listen.address": "0.0.0.0",
                    "snmp.listen.port": "10161",
                    "auth.password":"myauthpassword",
                    "privacy.password":"myprivacypassword",
                    "security.name":"mysecurityname",
                    "confluent.license": "",
                    "confluent.topic.bootstrap.servers": "broker:9092",
                    "confluent.topic.replication.factor": "1"
          }' \
     http://localhost:8083/connectors/snmp-source/config | jq .

Test with SNMP v3 trap

$ docker exec snmptrap snmptrap -v 3 -c public -u mysecurityname -a MD5 -A myauthpassword -x DES -X myprivacypassword connect:10161 '' 1.3.6.1.4.1.8072.2.3.0.1 1.3.6.1.4.1.8072.2.3.2.1 i 123456

Verify we have received the data in snmp-kafka-topic topic

$ docker exec connect kafka-avro-console-consumer -bootstrap-server broker:9092 --property schema.registry.url=http://schema-registry:8081 --topic snmp-kafka-topic --property schema.registry.url=http://schema-registry:8081 --from-beginning --max-messages 1

Results:

{
    "peerAddress": "172.19.0.5/46028",
    "securityName": "mysecurityname",
    "variables": [
        {
            "counter32": null,
            "counter64": null,
            "gauge32": null,
            "integer": null,
            "ipaddress": null,
            "metadata": {
                "string": "39243974"
            },
            "null": null,
            "objectIdentifier": null,
            "octetString": null,
            "oid": "1.3.6.1.2.1.1.3.0",
            "opaque": null,
            "timeticks": null,
            "type": "timeticks"
        },
        {
            "counter32": null,
            "counter64": null,
            "gauge32": null,
            "integer": null,
            "ipaddress": null,
            "metadata": {
                "string": "1.3.6.1.4.1.8072.2.3.0.1"
            },
            "null": null,
            "objectIdentifier": null,
            "octetString": null,
            "oid": "1.3.6.1.6.3.1.1.4.1.0",
            "opaque": null,
            "timeticks": null,
            "type": "objectIdentifier"
        },
        {
            "counter32": null,
            "counter64": null,
            "gauge32": null,
            "integer": null,
            "ipaddress": null,
            "metadata": {
                "string": "123456"
            },
            "null": null,
            "objectIdentifier": null,
            "octetString": null,
            "oid": "1.3.6.1.4.1.8072.2.3.2.1",
            "opaque": null,
            "timeticks": null,
            "type": "integer"
        }
    ]
}

N.B: Control Center is reachable at http://127.0.0.1:9021