Skip to content

Global flags

address#

The address flag [-a | --address] is used to specify the target's gNMI server address in address:port format, for e.g: 192.168.113.11:57400

Multiple target addresses can be specified, either as comma separated values:

gnmic --address 192.168.113.11:57400,192.168.113.12:57400 
or by using the --address flag multiple times:
gnmic -a 192.168.113.11:57400 --address 192.168.113.12:57400

config#

The --config flag specifies the location of a configuration file that gnmic will read. Defaults to $HOME/.gnmic.yaml.

debug#

The debug flag [-d | --debug] enables the printing of extra information when sending/receiving an RPC

encoding#

The encoding flag [-e | --encoding] is used to specify the gNMI encoding of the Update part of a Notification message.

It is case insensitive and must be one of: JSON, BYTES, PROTO, ASCII, JSON_IETF

format#

Five output formats can be configured by means of the --format flag. [proto, protojson, prototext, json, event] The default format is json.

The proto format outputs the gnmi message as raw bytes, this value is not allowed when the output type is file (file system, stdout or stderr) see outputs

The prototext and protojson formats are the message representation as defined in prototext and protojson

The event format emits the received gNMI SubscribeResponse updates and deletes as a list of events tagged with the keys present in the subscribe path (as well as some metadata) and a timestamp

Here goes an example of the same response emitted to stdout in the respective formats:

{
  "update": {
  "timestamp": "1595584408456503938",
  "prefix": {
    "elem": [
      {
        "name": "state"
      },
      {
        "name": "system"
      },
      {
        "name": "version"
      }
    ]
  },
    "update": [
      {
        "path": {
          "elem": [
            {
             "name": "version-string"
           }
          ]
        },
        "val": {
          "stringVal": "TiMOS-B-20.5.R1 both/x86_64 Nokia 7750 SR Copyright (c) 2000-2020 Nokia.\r\nAll rights reserved. All use subject to applicable license agreements.\r\nBuilt on Wed May 13 14:08:50 PDT 2020 by builder in /builds/c/205B/R1/panos/main/sros"
        }
      }
    ]
  }
}
update: {
  timestamp: 1595584168675434221
  prefix: {
    elem: {
      name: "state"
    }
    elem: {
      name: "system"
    }
    elem: {
      name: "version"
    }
  }
  update: {
    path: {
      elem: {
        name: "version-string"
      }
    }
    val: {
      string_val: "TiMOS-B-20.5.R1 both/x86_64 Nokia 7750 SR Copyright (c) 2000-2020 Nokia.\r\nAll rights reserved. All use subject to applicable license agreements.\r\nBuilt on Wed May 13 14:08:50 PDT 2020 by builder in /builds/c/205B/R1/panos/main/sros"
    }
  }
}
{
  "source": "172.17.0.100:57400",
  "subscription-name": "default",
  "timestamp": 1595584326775141151,
  "time": "2020-07-24T17:52:06.775141151+08:00",
  "prefix": "state/system/version",
  "updates": [
    {
      "Path": "version-string",
      "values": {
        "version-string": "TiMOS-B-20.5.R1 both/x86_64 Nokia 7750 SR Copyright (c) 2000-2020 Nokia.\r\nAll rights reserved. All use subject to applicable license agreements.\r\nBuilt on Wed May 13 14:08:50 PDT 2020 by builder in /builds/c/205B/R1/panos/main/sros"
      }
    }
  ]
}
[
  {
    "name": "default",
    "timestamp": 1595584587725708234,
    "tags": {
      "source": "172.17.0.100:57400",
      "subscription-name": "default"
    },
    "values": {
      "/state/system/version/version-string": "TiMOS-B-20.5.R1 both/x86_64 Nokia 7750 SR Copyright (c) 2000-2020 Nokia.\r\nAll rights reserved. All use subject to applicable license agreements.\r\nBuilt on Wed May 13 14:08:50 PDT 2020 by builder in /builds/c/205B/R1/panos/main/sros"
    }
  }
]

insecure#

The insecure flag [--insecure] is used to indicate that the client wishes to establish an non-TLS enabled gRPC connection.

To disable certificate validation in a TLS-enabled connection use skip-verify flag.

log#

The --log flag enables log messages to appear on stderr output. By default logging is disabled.

log-file#

The log-file flag [--log-file <path>] sets the log output to a file referenced by the path. This flag supersede the --log flag

no-prefix#

The no prefix flag [--no-prefix] disables prefixing the json formatted responses with [ip:port] string.

Note that in case a single target is specified, the prefix is not added.

password#

The password flag [-p | --password] is used to specify the target password as part of the user credentials. If omitted, the password input prompt is used to provide the password.

Note that in case multiple targets are used, all should use the same credentials.

proxy-from-env#

The proxy-from-env flag [--proxy-from-env] indicates that the gnmic should use the HTTP/HTTPS proxy addresses defined in the environment variables http_proxy and https_proxy to reach the targets specified using the --address flag.

skip-verify#

The skip verify flag [--skip-verify] indicates that the target should skip the signature verification steps, in case a secure connection is used.

timeout#

The timeout flag [--timeout] specifies the gRPC timeout after which the connection attempt fails.

Valid formats: 10s, 1m30s, 1h. Defaults to 10s

tls-ca#

The TLS CA flag [--tls-ca] specifies the root certificates for verifying server certificates encoded in PEM format.

tls-cert#

The tls cert flag [--tls-cert] specifies the public key for the client encoded in PEM format

tls-key#

The tls key flag [--tls-key] specifies the private key for the client encoded in PEM format

username#

The username flag [-u | --username] is used to specify the target username as part of the user credentials. If omitted, the input prompt is used to provide the username.