Juniper / jtimon

Junos Telemetry Interface (JTI) client
Apache License 2.0
31 stars 10 forks source link

added csv stats knob #37

Closed amohit1315 closed 5 months ago

amohit1315 commented 5 months ago

Related Issue(s): https://github.com/Juniper/jtimon/issues/31

35

Added csv-stats to output pre-gnmi and gnmi telemetry data in csv format. Moved few print statements to stream log file

Example: ./jtimon-linux-amd64 --config test.json --no-per-packet-goroutines --stats-handler

csv-stats.csv

sensor-path,sequence-number,component-id,sub-component-id,packet-size,p-ts,e-ts,re-stream-creation-ts,re-payload-get-ts
sensor_1005_2_1:/system/processes/process/state/:/system/processes/process/state/:jkdsd,2097152,65535,0,503,1717034713088980419,1717034713110000000,0,0
sensor_1005_2_1:/system/processes/process/state/:/system/processes/process/state/:jkdsd,2097153,65535,0,500,1717034713089246396,1717034713110000000,0,0
sensor_1005_2_1:/system/processes/process/state/:/system/processes/process/state/:jkdsd,2097154,65535,0,508,1717034713089452536,1717034713110000000,0,0
sensor_1005_2_1:/system/processes/process/state/:/system/processes/process/state/:jkdsd,2097155,65535,0,506,1717034713089691411,1717034713110000000,0,0
sensor_1005_2_1:/system/processes/process/state/:/system/processes/process/state/:jkdsd,2097156,65535,0,495,1717034713089904642,1717034713110000000,0,0

To get the csv file, need to set to true within internal-jtimon configuration. csv output file path can also be specified in internal-jtimon but its not mandatory.

Sample Configuration:

{
    "host": "10.54.130.1",
    "port": 32767,
    "user": "root",
    "cid": "external2",
    "password": "Embe1mpls",
    "vendor": {
        "gnmi": {
          "encoding": "protobuf"
        }
    },    
    "internal-jtimon" : {
        "data-log-file": "/homes/regress/test/gnmidatata.log",
    "csv-log-file": "/homes/regress/test/test.csv"
    },
    "eos": true,
    "vendor": {
        "gnmi": {
          "encoding": "protobuf"
        }
    },
    "paths": [{
        "path": "/system/processes/process/state/",
        "freq": 10000
    },
    {
    "path": "/components/",
        "freq": 10000,
    "pre-gnmi": true
    },
    {
        "path": "/system/alarms/",
        "freq": 10000
    }],
    "log" : {
        "file": "/tmp/test-jtimon.log",
        "verbose": false
    }
}