User-defined Junos Telemetry Interface YANG file to stream 'show system users'
/* | |
Example yang for generating OC equivalent of show system users | |
Requirements: | |
Junos Openconfig and na telemetry packages loaded: | |
- junos-openconfig-x86-32-0.0.0.8.tgz | |
- network-agent-x86-32-17.4R1.16-C1.tgz | |
Installation: | |
1) Load this file in Junos (17.3R1 or newer) with | |
request system yang add package sysusers proxy-xml module xmlproxyd_sysusers.yang | |
2) Enable gRPC (without authentication) in Junos configuration: | |
set system services extension-service request-response grpc clear-text port 50051 | |
set system services extension-service request-response grpc skip-authentication | |
Check https://www.juniper.net/documentation/en_US/junos/topics/task/configuration/yang-xmlproxy-junos-telemetry-interface-configuring.html for background information. | |
*/ | |
module sysusers { | |
yang-version 1; | |
namespace "http://juniper.net/yang/software"; | |
prefix "sys"; | |
import drend { | |
prefix dr; | |
} | |
grouping system-users-information-grouping { | |
container uptime-information { | |
dr:source "uptime-information"; | |
leaf date-time { | |
type string; | |
dr:source date-time; | |
} | |
leaf up-time { | |
type string; | |
dr:source up-time; | |
} | |
leaf active-user-count { | |
type int32; | |
dr:source active-user-count; | |
} | |
leaf load-average-1 { | |
type string; | |
dr:source load-average-1; | |
} | |
leaf load-average-5 { | |
type string; | |
dr:source load-average-5; | |
} | |
leaf load-average-15 { | |
type string; | |
dr:source load-average-15; | |
} | |
container user-table { | |
dr:source "user-table"; | |
list user-entry { | |
key "user"; | |
dr:source "user-entry"; | |
leaf user { | |
dr:source user; | |
type string; | |
} | |
leaf tty { | |
dr:source tty; | |
type string; | |
} | |
leaf from { | |
dr:source from; | |
type string; | |
} | |
leaf login-time { | |
dr:source login-time; | |
type string; | |
} | |
leaf idle-time { | |
dr:source idle-time; | |
type string; | |
} | |
leaf command { | |
dr:source command; | |
type string; | |
} | |
} | |
} | |
} | |
} | |
dr:command-app "xmlproxyd"; | |
rpc juniper-netconf-get { | |
dr:command-top-of-output "/junos"; | |
dr:command-full-name "drend juniper-netconf-get"; | |
dr:cli-command "show system users"; | |
dr:command-help "default <get> rpc"; | |
output { | |
container junos { | |
container system-users-information { | |
dr:source "/system-users-information"; | |
uses system-users-information-grouping; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment