Junos에서 NETCONF 프록시 텔레메트리 센서 구성
Junos Telemetry Streaming을 사용하면 XML 프록시 기능을 통해 사용 가능한 모든 상태 정보를 텔레메트리 센서로 전환할 수 있습니다. NETCONF XML 관리 프로토콜 및 Junos XML API는 지원되는 모든 Junos OS 운영 요청에 대한 모든 옵션을 완벽하게 문서화합니다. XML 프록시 센서를 구성한 후 NETCONF "get" 원격 절차 호출(RPC)을 통해 데이터에 액세스할 수 있습니다.
이 작업은 Junos OS 운영 모드 명령의 출력을 스트리밍하는 방법을 보여줍니다.
광범위하거나 상세한 출력이 있거나 출력 생성이 느린 Junos OS 운영 명령에 매핑되는 YANG 파일은 사용하지 않는 것이 좋습니다. YANG 파일에서 현저한 지연이 있는 명령은 피해야 합니다. 이러한 명령을 포함하면 다른 xmlproxyd 센서와 xmlproxyd의 성능에 영향을 줄 수 있습니다.
일부 운영 모드 명령의 출력은 동적이며 상세 수준은 구성 및 하드웨어와 같은 요인에 따라 달라집니다. 이러한 명령의 예로는 , show route, show arp, show bfd, show bgpshow ddos-protection및 의 show interfaces변형이 있습니다.
명령의 세부 정보 표시 수준을 확인하려면 | display xml | count 명령을 실행합니다command-name. 줄 수가 4000줄 값을 초과하는 경우 이 명령은 XML 프록시 스트리밍에 권장되지 않습니다. 이 값은 내부 기준선을 기반으로 한 근사치에 가깝습니다. 장치 유형, 장치의 처리 능력 및 기존 CPU 부하와 같은 다양한 요인에 따라 더 적을 수 있습니다. 따라서 이 기능은 장치의 성능에 따라 신중하게 사용해야 합니다.
Junos OS 또는 Junos OS Evolved 운영 모드 명령에 매핑되는 YANG 파일을 사용하기 전에 명령 command-name| display xml 을(를) 실행하여 명령이 유효한 XML 출력을 생성하는지, 잘못된 태그, 데이터 또는 형식이 포함되어 있지 않은지 확인할 수 있습니다.
verbose 명령에 매핑되는 YANG 파일을 사용하면 다음 중 하나 이상이 발생합니다.
-
xmlproxyd 프로세스 CPU 사용률이 높게 유지됩니다. xmlproxyd에 추적이 사용 가능한 경우 CPU 사용률은 훨씬 더 높습니다.
-
xmlproxyd 프로세스 메모리 사용률의 증가입니다.
-
xmlproxyd 프로세스 상태는, 명령 출력이 상세하고, xmlproxyd (이)가 명령의 원격 프로시저 호출(RPC)의 출력을 읽는 데 상당한 시간을 소비하고 있는 것을 나타내는 (으)로 표시될
sbwait수 있습니다. -
xmlproxyd 센서 데이터가 랩을 완료하지 않습니다.
-
xmlproxyd는 센서에 대한 데이터를 부분적으로 스트리밍하거나 스트리밍하지 않습니다.
-
xmlproxyd는 reporting-interval 주기를 누락합니다. 명령의 자세한 정보 출력으로 인해 간격이 겹치기 시작하여 xmlproxyd의 센서 스트리밍 데이터가 느리거나 지연됩니다.
-
verbose 명령의 RPC를 제공하는 프로세스 또는 애플리케이션은 높은 CPU 수를 표시하거나 기본 태스크를 수행하는 데 지연을 표시할 수 있습니다. 이 동작은 프로세스 또는 애플리케이션이 자세한 출력이 있는 RPC를 제공 중일 때 발생합니다.
이 작업에는 다음이 필요합니다.
-
Junos OS 릴리스 17.3R2 이상에서 작동하는 MX 시리즈, vMX 시리즈 또는 PTX 시리즈 라우터.
-
원격 분석 센서의 적절한 작동을 확인하기 위한 OpenNTI와 같은 원격 분석 데이터 수신기.
이 작업에서는 Junos OS 명령 show system users의 내용을 스트리밍합니다.
show system users(vMX 시리즈)
user@switch> show system users USER TTY FROM LOGIN@ IDLE WHAT user1 pts/0 172.31.12.36 12:40PM 39 -cli (cli) user2 pts/1 172,16.03.25 3:01AM - -cli (cli)
현재 로그인한 사용자의 예상 목록 외에도 출력은 show system users 평균 시스템 로드를 1, 5, 15분으로 제공합니다. 명령을 사용하여 show system users | display xml 출력 필드에 대한 XML 태그 지정을 보면 부하 평균을 찾을 수 있습니다. 아래의 XML 태깅 출력에서, <load-average-5>및 <load-average-15> 를 참조하십시오<load-average-1>.
user@switch> show system users | display xml
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/17.4R1/junos">
<system-users-information xmlns="http://xml.juniper.net/junos/17.4R1/junos">
<uptime-information>
<date-time junos:seconds="1520170982">1:43PM</date-time>
<up-time junos:seconds="86460">1 day, 40 mins</up-time>
<active-user-count junos:format="2 users">2</active-user-count>
<load-average-1>0.70</load-average-1>
<load-average-5>0.58</load-average-5>
<load-average-15>0.55</load-average-15>
<user-table>
<user-entry>
<user>root</user>
<tty>pts/0</tty>
<from>172.21.0.1</from>
<login-time junos:seconds="1520167202">12:40PM</login-time>
<idle-time junos:seconds="0">-</idle-time>
<command>cli</command>
</user-entry>
<user-entry>
<user>mwiget</user>
<tty>pts/1</tty>
<from>66.129.241.10</from>
<login-time junos:seconds="1520170862">1:41PM</login-time>
<idle-time junos:seconds="60">1</idle-time>
<command>cli</command>
</user-entry>
</user-table>
</uptime-information>
</system-users-information>
<cli>
<banner></banner>
</cli>
</rpc-reply>
앞의 uptime-information 출력에 표시된 태그는 , up-time, active-user-count. 및 load-average-1와 같은 date-time리프를 포함하는 컨테이너입니다. 다음은 이 컨테이너에 대한 샘플 YANG 파일입니다.
container uptime-information {
dr:source "uptime-information"; // Exact name of the XML tag
leaf date-time { // YANG model leaf
type string; // Type of value
dr:source date-time; // Exact name of the XML tag
}
leaf up-time { // YANG model leaf
type string; // Type of value
dr:source up-time; // Exact name of the XML tag
}
leaf active-user-count { // YANG model leaf
type int32; // Type of value
dr:source active-user-count; // Exact name of the XML tag
}
leaf load-average-1 { // YANG model leaf
type string; // Type of value
dr:source load-average-1; // Exact name of the XML tag
}
...
태그에는 uptime-information 사용자 항목 목록이 포함된 라는 user-table 또 다른 컨테이너도 있습니다.
다음은 이 컨테이너에 대한 샘플 YANG 파일입니다.
container user-table { // "user-table" container which contains list of user-entry
dr:source "user-table"; // Exact name of the XML tag
list user-entry { // "user-entry" list which contains the users' details in form of leafs
key "user"; // Key for the list "user-entry" which is a leaf in the list "user-entry"
dr:source "user-entry"; // Source of the list "user-entry" which is the exact name of the XML tag
leaf user { // YANG model leaf
dr:source user; // A leaf in the list "user-entry", exact name of the XML tag
type string; // Type of value
}
leaf tty { // YANG model leaf
dr:source tty; // A leaf in the list "user-entry", exact name of the XML tag
type string; // Type of value
}
leaf from { // YANG model leaf
dr:source from; // A leaf in the list "user-entry", exact name of the XML tag
type string; // Type of value
}
leaf login-time { // YANG model leaf
dr:source login-time; // A leaf in the list "user-entry", exact name of the XML tag
type string; // Type of value
}
leaf idle-time { // YANG model leaf
dr:source idle-time; // A leaf in the list "user-entry", exact name of the XML tag
type string; // Type of value
}
leaf command { // YANG model leaf
dr:source command; // A leaf in the list "user-entry", exact name of the XML tag
type string; // Type of value
}
}
}
사용자 정의 YANG 파일 생성
YANG 파일은 실행할 Junos CLI 명령, 센서가 배치되는 리소스 경로, 일치하는 XML 태그에서 가져온 키 값 쌍을 정의합니다.
Junos OS용 사용자 지정 YANG 파일은 RFC 6020, YANG 1.0, YANG - NETCONF(Data Modeling Language for the Network Configuration Protocol) 및 RFC 7950, YANG 1.1 데이터 모델링 언어에 정의된 YANG 언어 구문을 준수합니다. XML 프록시를 구성하는 파일에 특정 지시문이 있어야 합니다.
프로세스를 사용하여 xmlproxyd 원격 분석 데이터를 변환하려면 파일을 만듭니다 render.yang . 이 파일에서 은 dr:command-app (는) 로 xmlproxyd설정됩니다.
XML 프록시 YANG 파일 이름 및 모듈 이름은 다음으로 시작해야 합니다.xmlproxyd_
XML 프록시 YANG 파일 이름의 경우 확장
.yang자 (예: )를 추가합니다.xmlproxyd_sysusers.yang모듈 이름의 경우 확장자
.yang없이 파일 이름을 사용합니다(예:xmlproxyd_sysusers
YANG 파일 생성을 단순화하려면 작업 예제를 수정하여 시작하는 것이 가장 쉽습니다.
Junos에서 Yang 파일 로드
YANG 파일이 완료된 후 YANG 파일을 업로드하고 모듈이 생성되었는지 확인합니다.
센서 데이터 수집
즐겨 찾는 수집기를 사용하여 디바이스에서 새로 생성된 원격 측정 센서 데이터를 가져옵니다.
센서를 시작하기 전에 리소스 제약 조건을 고려하십시오.
-
다중 XML 프록시 센서에 대해 동일한 보고 간격을 지정하지 마십시오.
-
xmlproxyd는 XML 및 텍스트 처리를 수행하므로 디바이스에는 CPU 사용률 범위 내에서 실행되는 XML 프록시 센서만 포함되어야 합니다.
플랫폼별 센서 데이터 수집 동작
기능 탐색기를 사용하여 특정 기능에 대한 플랫폼 및 릴리스 지원을 확인할 수 있습니다.
다음 표를 사용하여 플랫폼에 대한 플랫폼별 동작을 검토할 수 있습니다.
| 플랫폼 |
다름 |
|---|---|
| PTX10008 |
Evolved Junos OS 작동하는 PTX10008 라우터의 경우, 텔레메트리 RPC를 위해 라우터당 10개 이상의 컬렉터를 연결하지 마십시오. |
다음 지침에서는 수집기 jtimon을 사용합니다. jtimon 설정에 대한 자세한 내용은 Junos Telemetry Interface 클라이언트를 참조하십시오.
센서에 대한 구독이 이미 존재하고 중복 구독이 구성된 경우, 수집기와 장치 간의 연결이 오류 메시지 AlreadyExists와 함께 닫힙니다.
사용자 정의 YANG 파일 설치
Junos Telemetry Interface용 XML 프록시에 대한 사용자 정의 YANG 파일을 추가, 검증, 수정 또는 삭제하려면 운영 모드에서 명령 세트를 사용하십시오 request system yang .
텔레메트리 센서 문제 해결
문제
묘사
다음 방법을 사용하여 사용자 정의 원격 측정 센서 문제를 해결합니다.
-
gRPC 요청이 발생한 인터페이스에 대해 tcpdump를 실행합니다(이 작업의 경우 인터페이스
fxp0가 사용됨).user@switch>monitor traffic interface fxp0 no-resolve matching "tcp port 32767"
-
명령을 사용하여 traceoptions를 활성화합니다 set services analytics traceoptions flag xmlproxy .
xmlproxyd로그 파일에서 CLI 명령의 RPC가 전송되었는지 여부와 응답을 수신했는지 확인합니다.
show log xmlproxyd 명령을 실행하여 xmlproxyd 로그를 표시합니다. 필드
xmlproxy_execute_cli_command:값은 RPC가 전송되었는지 여부를 나타냅니다. 필드xmlproxy_build_context값은 명령을 나타냅니다.
user@switch>show log xmlproxyd Mar 4 18:52:46 vmxdockerlight_vmx1_1 clear-log[52495]: logfile cleared Mar 4 18:52:51 xmlproxy_telemetry_start_streaming: sensor /junos/system-users-information/ Mar 4 18:52:51 xmlproxy_build_context: command show system users merge-tag: Mar 4 18:52:51 <command format="xml">show system users</command> Mar 4 18:52:51 xmlproxy_execute_cli_command: Sent RPC.. Mar 4 18:52:51 <system-users-information xmlns="http://xml.juniper.net/junos/17.4R1/junos" xmlns:junos="http://xml.juniper.net/junos/*/junos"> <uptime-information> <date-time junos:seconds="1520189571"> 6:52PM </date-time> <up-time junos:seconds="107400"> 1 day, 5:50 </up-time> <active-user-count junos:format="1 users"> 1 </active-user-count> <load-average-1> 0.94 </load-average-1> <load-average-5> 0.73 </load-average-5> <load-average-15> 0.65