{"id":470,"date":"2020-07-13T12:57:27","date_gmt":"2020-07-13T11:57:27","guid":{"rendered":"https:\/\/zed-network.fr\/?p=470"},"modified":"2020-08-24T19:10:25","modified_gmt":"2020-08-24T18:10:25","slug":"cisco-nexus-telemetry","status":"publish","type":"post","link":"https:\/\/zed-network.fr\/?p=470","title":{"rendered":"How to Stream Telemetry with Grafana and Cisco Nexus"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Usually, SNMP is used to pool network devices. SNMP especially the walk function is very CPU intensive and is often unsecured by using SNMPv1 or SNMPv2.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Telemetry can help you to monitor your devices and not only the CPU\/Memory or interface (in\/out) counter. You can also monitor CRC, Optic budget, etc easily.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We will use Grafana with InfluxDB and Telegraf.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"429\" src=\"https:\/\/zed-network.fr\/wp-content\/uploads\/image-9-1024x429.png\" alt=\"\" class=\"wp-image-484\" srcset=\"https:\/\/zed-network.fr\/wp-content\/uploads\/image-9-1024x429.png 1024w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-9-300x126.png 300w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-9-768x322.png 768w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-9-1536x643.png 1536w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-9-2048x857.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">On Cisco Nexus device you need to enable the feature telemetry.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">feature telemetry<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then you need to configure three others parts:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>A destination group, where is located your NMS tool<\/li><li>A sensor Group, which contains what you want to stream to your NMS tool<\/li><li>A subscription, which associates the destination group and the sensor group.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">telemetry\n  destination-group 1\n    ip address 10.202.2.100 port 57000 protocol gRPC encoding GPB\n    use-vrf management\n  sensor-group 101\n    data-source NX-API\n    path \"show system resources\" depth 0\n  sensor-group 102\n    data-source NX-API\n    path \"show interface transceiver detail\"\n  sensor-group 103\n    data-source NX-API\n    path \"show interface\"\n    path \"show interface e1\/2\"\n  subscription 101\n    dst-grp 1\n    snsr-grp 101 sample-interval 10000\n  subscription 102\n    dst-grp 1\n    snsr-grp 102 sample-interval 60000\n  subscription 103\n    dst-grp 1\n    snsr-grp 103 sample-interval 10000<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In the previous example, we can see one destination group to stream the data to the server 10.202.2.100 port 57000\/tcp. We use gRPC with GPB to send the flow.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The server 10.202.2.100 is a docker server, which runs Grafana with influxDB and telegraf.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># docker ps\nCONTAINER ID        IMAGE                                   COMMAND                  CREATED             STATUS              PORTS                                                    NAMES\n0ea44fcb6359        telegraf                                \"\/entrypoint.sh tele\u2026\"   5 days ago          Up 5 days           8092\/udp, 8125\/udp, 8094\/tcp, 0.0.0.0:57000-&gt;57000\/tcp   telemetry_telegraf_1\n37001630a9aa        grafana\/grafana:latest                  \"\/run.sh\"                5 days ago          Up 5 days           0.0.0.0:3000-&gt;3000\/tcp                                   telemetry_grafana_1\ndb99097a276f        influxdb:latest                         \"\/entrypoint.sh infl\u2026\"   5 days ago          Up 5 days           0.0.0.0:8086-&gt;8086\/tcp                                   telemetry_influxdb_1<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can run this stack with the following docker-compose file. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To start the stack enters the command <code>docker-compose up -d<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># cat docker-compose.yml\nversion: '3'\nservices:\n  grafana:\n    #restart: always\n    image: grafana\/grafana:latest\n    ports:\n     - \"3000:3000\"\n    tty: true\n    privileged: true\n  influxdb:\n    image: influxdb:latest\n    ports:\n      - '8086:8086'\n    environment:\n      - INFLUXDB_DB=db0\n  telegraf:\n    image: telegraf\n    ports:\n      - '57000:57000'\n    #restart: always<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On the telegraf configuration, we just specify where is the influx database and what we used to receive the flow from the Nexus devices.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[global_tags]\n\n[agent]\n  interval = \"10s\"\n  round_interval = true\n  metric_batch_size = 1000\n  metric_buffer_limit = 10000\n  collection_jitter = \"0s\"\n\n  flush_interval = \"10s\"\n  flush_jitter = \"0s\"\n\n  precision = \"\"\n\n  hostname = \"\"\n  omit_hostname = false\n\n[..]\n\n[[outputs.influxdb]]\n  urls = [\"http:\/\/influxdb:8086\"]\n  database = \"db0\"\n\n[[inputs.cisco_telemetry_mdt]]\ntransport = \"grpc\"\nservice_address = \":57000\"\n [inputs.cisco_telemetry_mdt.aliases]\n    ifstats = \"ietf-interfaces:interfaces-state\/interface\/statistics\"\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The data source on Grafana:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"903\" height=\"1024\" src=\"https:\/\/zed-network.fr\/wp-content\/uploads\/image-8-903x1024.png\" alt=\"\" class=\"wp-image-482\" srcset=\"https:\/\/zed-network.fr\/wp-content\/uploads\/image-8-903x1024.png 903w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-8-264x300.png 264w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-8-768x871.png 768w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-8.png 1192w\" sizes=\"(max-width: 903px) 100vw, 903px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now, you should received data to your influxdb via your pipeline telegraf. This is the moment to create a dashboard.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The following example will show how to monitor your optical budget.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"234\" src=\"https:\/\/zed-network.fr\/wp-content\/uploads\/image-1-1024x234.png\" alt=\"\" class=\"wp-image-473\" srcset=\"https:\/\/zed-network.fr\/wp-content\/uploads\/image-1-1024x234.png 1024w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-1-300x68.png 300w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-1-768x175.png 768w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-1-1536x351.png 1536w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-1-2048x467.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>Grafana example<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now you need to create you request to get the value. In this example we want to use the stream with the command &#8220;show interface transceiver detail&#8221; and select one specific interface (Ethernet 1\/16). We can use the parameter Where Table_interface to get all interfaces and select the good one. Finally if you have a lot of Nexus devices you can add a source. The latest part is to select which value you want. Here we get rx_pwr.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"255\" src=\"https:\/\/zed-network.fr\/wp-content\/uploads\/image-2-1024x255.png\" alt=\"\" class=\"wp-image-474\" srcset=\"https:\/\/zed-network.fr\/wp-content\/uploads\/image-2-1024x255.png 1024w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-2-300x75.png 300w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-2-768x191.png 768w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-2-1536x382.png 1536w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-2-2048x509.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>Grafana request<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you need to have the detail before. You can enter the following command on your Cisco Nexus device.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># show interface e1\/16 transceiver details | json-pretty\n{\n    \"TABLE_interface\": {\n        \"ROW_interface\": {\n            \"interface\": \"Ethernet1\/16\",\n            \"sfp\": \"present\",\n            \"type\": \"Fabric Extender Transceiver\",\n            \"name\": \"CISCO-FINISAR\",\n            \"partnum\": \"FTLX8570D3BCL-C2\",\n            \"rev\": \"A\",\n            \"serialnum\": \"FNxxxxxxx\",\n            \"nom_bitrate\": \"10300\",\n            \"len_625\": \"10\",\n            \"len_50_OM3\": \"100\",\n            \"ciscoid\": \"3\",\n            \"ciscoid_1\": \"4\",\n            \"cisco_part_number\": \"10-2566-02\",\n            \"cisco_product_id\": \"FET-10G\",\n            \"cisco_vendor_id\": \"V02\",\n            \"TABLE_lane\": {\n                \"ROW_lane\": {\n                    \"temperature\": \"36.36\",\n                    \"temp_flag\": null,\n                    \"temp_alrm_hi\": \"75.00\",\n                    \"temp_alrm_lo\": \"5.00\",\n                    \"temp_warn_hi\": \"70.00\",\n                    \"temp_warn_lo\": \"10.00\",\n                    \"voltage\": \"3.26\",\n                    \"volt_flag\": null,\n                    \"volt_alrm_hi\": \"3.63\",\n                    \"volt_alrm_lo\": \"2.97\",\n                    \"volt_warn_hi\": \"3.46\",\n                    \"volt_warn_lo\": \"3.13\",\n                    \"current\": \"7.89\",\n                    \"current_flag\": null,\n                    \"current_alrm_hi\": \"11.80\",\n                    \"current_alrm_lo\": \"4.00\",\n                    \"current_warn_hi\": \"10.80\",\n                    \"current_warn_lo\": \"5.00\",\n                    \"tx_pwr\": \"-2.47\",\n                    \"tx_pwr_flag\": null,\n                    \"tx_pwr_alrm_hi\": \"2.69\",\n                    \"tx_pwr_alrm_lo\": \"-11.30\",\n                    \"tx_pwr_warn_hi\": \"-1.30\",\n                    \"tx_pwr_warn_lo\": \"-7.30\",\n                    \"rx_pwr\": \"-2.42\",\n                    \"rx_pwr_flag\": null,\n                    \"rx_pwr_alrm_hi\": \"2.99\",\n                    \"rx_pwr_alrm_lo\": \"-13.97\",\n                    \"rx_pwr_warn_hi\": \"-1.00\",\n                    \"rx_pwr_warn_lo\": \"-9.91\",\n                    \"xmit_faults\": \"0\"\n                }\n            }\n        }\n    }\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can change the title and the units.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"607\" height=\"1024\" src=\"https:\/\/zed-network.fr\/wp-content\/uploads\/image-4-607x1024.png\" alt=\"\" class=\"wp-image-476\" srcset=\"https:\/\/zed-network.fr\/wp-content\/uploads\/image-4-607x1024.png 607w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-4-178x300.png 178w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-4.png 716w\" sizes=\"(max-width: 607px) 100vw, 607px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">You can also define thresholds.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"716\" height=\"692\" src=\"https:\/\/zed-network.fr\/wp-content\/uploads\/image-3.png\" alt=\"\" class=\"wp-image-475\" srcset=\"https:\/\/zed-network.fr\/wp-content\/uploads\/image-3.png 716w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-3-300x290.png 300w\" sizes=\"(max-width: 716px) 100vw, 716px\" \/><figcaption>Grafana Threshold<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The following picture will show you two cases. The Ethernet E1\/15 which has an issue in Rx and the Ethernet E1\/16 where the values are good.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"834\" src=\"https:\/\/zed-network.fr\/wp-content\/uploads\/image-5-1024x834.png\" alt=\"\" class=\"wp-image-477\" srcset=\"https:\/\/zed-network.fr\/wp-content\/uploads\/image-5-1024x834.png 1024w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-5-300x244.png 300w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-5-768x625.png 768w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-5.png 1368w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In CLI :<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">N9K1# show interface e1\/15 transceiver details\nEthernet1\/15\n    transceiver is present\n    type is Fabric Extender Transceiver\n    name is CISCO-JDSU\n    part number is PLRXPL-VC-S43-CG\n    revision is B\n    serial number is JURxxxxxxxx\n    nominal bitrate is 10300 MBit\/sec\n    Link length supported for 62.5\/125um fiber is 10 m\n    Link length supported for 50\/125um OM3 fiber is 100 m\n    cisco id is 3\n    cisco extended id number is 4\n    cisco part number is 10-2566-02\n    cisco product id is FET-10G\n    cisco version id is V02\n\n           SFP Detail Diagnostics Information (internal calibration)\n  ----------------------------------------------------------------------------\n                Current              Alarms                  Warnings\n                Measurement     High        Low         High          Low\n  ----------------------------------------------------------------------------\n  Temperature   37.33 C        75.00 C      5.00 C     70.00 C       10.00 C\n  Voltage        3.26 V         3.63 V      2.97 V      3.46 V        3.13 V\n  Current        4.80 mA       10.00 mA     2.59 mA     8.50 mA       3.00 mA\n  Tx Power      -2.21 dBm       2.69 dBm  -11.30 dBm   -1.30 dBm     -7.30 dBm\n  Rx Power     -26.98 dBm --    2.99 dBm  -13.97 dBm   -1.00 dBm     -9.91 dBm\n  Transmit Fault Count = 0\n  ----------------------------------------------------------------------------\n  Note: ++  high-alarm; +  high-warning; --  low-alarm; -  low-warning\n\nN9K1# show interface e1\/16 transceiver details\nEthernet1\/16\n    transceiver is present\n    type is Fabric Extender Transceiver\n    name is CISCO-FINISAR\n    part number is FTLX8570D3BCL-C2\n    revision is A\n    serial number is FNxxxxxxYS\n    nominal bitrate is 10300 MBit\/sec\n    Link length supported for 62.5\/125um fiber is 10 m\n    Link length supported for 50\/125um OM3 fiber is 100 m\n    cisco id is 3\n    cisco extended id number is 4\n    cisco part number is 10-2566-02\n    cisco product id is FET-10G\n    cisco version id is V02\n\n           SFP Detail Diagnostics Information (internal calibration)\n  ----------------------------------------------------------------------------\n                Current              Alarms                  Warnings\n                Measurement     High        Low         High          Low\n  ----------------------------------------------------------------------------\n  Temperature   36.03 C        75.00 C      5.00 C     70.00 C       10.00 C\n  Voltage        3.27 V         3.63 V      2.97 V      3.46 V        3.13 V\n  Current        7.89 mA       11.80 mA     4.00 mA    10.80 mA       5.00 mA\n  Tx Power      -2.44 dBm       2.69 dBm  -11.30 dBm   -1.30 dBm     -7.30 dBm\n  Rx Power      -2.41 dBm       2.99 dBm  -13.97 dBm   -1.00 dBm     -9.91 dBm\n  Transmit Fault Count = 0\n  ----------------------------------------------------------------------------\n  Note: ++  high-alarm; +  high-warning; --  low-alarm; -  low-warning<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Other example to monitor the CPU with the sensor group: show system resources.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"410\" src=\"https:\/\/zed-network.fr\/wp-content\/uploads\/image-6-1024x410.png\" alt=\"\" class=\"wp-image-478\" srcset=\"https:\/\/zed-network.fr\/wp-content\/uploads\/image-6-1024x410.png 1024w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-6-300x120.png 300w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-6-768x308.png 768w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-6.png 1368w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"204\" src=\"https:\/\/zed-network.fr\/wp-content\/uploads\/image-7-1024x204.png\" alt=\"\" class=\"wp-image-479\" srcset=\"https:\/\/zed-network.fr\/wp-content\/uploads\/image-7-1024x204.png 1024w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-7-300x60.png 300w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-7-768x153.png 768w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-7-1536x306.png 1536w, https:\/\/zed-network.fr\/wp-content\/uploads\/image-7-2048x408.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Usually, SNMP is used to pool network devices. SNMP especially the walk function is very CPU intensive and is often unsecured by using SNMPv1 or SNMPv2. Telemetry can help you to monitor your devices and not only the CPU\/Memory or interface (in\/out) counter. You can also monitor CRC, Optic budget, etc easily. We will use [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"footnotes":""},"categories":[4,13],"tags":[],"class_list":["post-470","post","type-post","status-publish","format-standard","hentry","category-cisco","category-monitoring"],"_links":{"self":[{"href":"https:\/\/zed-network.fr\/index.php?rest_route=\/wp\/v2\/posts\/470","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zed-network.fr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zed-network.fr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zed-network.fr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zed-network.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=470"}],"version-history":[{"count":7,"href":"https:\/\/zed-network.fr\/index.php?rest_route=\/wp\/v2\/posts\/470\/revisions"}],"predecessor-version":[{"id":542,"href":"https:\/\/zed-network.fr\/index.php?rest_route=\/wp\/v2\/posts\/470\/revisions\/542"}],"wp:attachment":[{"href":"https:\/\/zed-network.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=470"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zed-network.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=470"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zed-network.fr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}