ONTAP Discussions

Getting interface CRC errors using NMSDK/API

nvidia-india
10,590 Views

Hi all,

I am working on automation to monitor all 7mode/cmode storage systems we have by checking for netport port status. Through the automation, we want to check if the ports part of ifgroup are up and working, MTU settings and if there are any CRC errors. 

 

Using NMSDK, i can get ifgroup and MTU details of the interfaces. I found no option to get CRC errors listed for an interface in the system. Is there any option we have to get CRC error details from netapp API? 

 

RECEIVE
Frames/second: 25446 | Bytes/second: 16472k | Errors/minute: 0
Discards/minute: 0 | Total frames: 137g | Total bytes: 281t
Total errors: 0 | Total discards: 0 | Multi/broadcast: 0
No buffers: 0 | Non-primary u/c: 0 | L2 terminate: 0
Tag drop: 0 | Vlan tag drop: 0 | Vlan untag drop: 0
Vlan forwards: 0 | Vlan broadcasts: 0 | Vlan unicasts: 0
CRC errors: 0 | Runt frames: 0 | Fragment: 0
Long frames: 0 | Jabber: 0 | Bus overruns: 0
Queue drop: 0 | Xon: 0 | Xoff: 0
Jumbo: 2833m

8 REPLIES 8

gaurav_verma
10,477 Views

Try this. I am using this for my environment, but I only print where error count is more than 1000. You can change it as you need.

 

import sys
from NaServer import *
import xmltodict
import json


filer_name = sys.argv[1]

filer = NaServer(filer_name,1,6)
filer.set_admin_user("admin","*********")
cmd = NaElement("perf-object-get-instances")
cmd1 = NaElement("net-port-get-iter")
port = filer.invoke_elem(cmd1)


obj = xmltodict.parse(port.sprintf())
jdump = json.dumps(obj)
jload = json.loads(jdump)


xi = NaElement("counters")
cmd.child_add(xi)
xi.child_add_string("counter","rx_total_errors")
xi2 = NaElement("instances")
cmd.child_add(xi2)

for h in jload['results']['attributes-list']['net-port-info']:
        if h['port-type'] == 'physical':
                xi2.child_add_string("instance",h['port'])
                cmd.child_add_string("objectname","nic_common")
                err = filer.invoke_elem(cmd)
                a = xmltodict.parse(err.sprintf())
                jd = json.dumps(a)
                jl = json.loads(jd)
                for x in jl['results']['instances']['instance-data']:

                        n = int(x['counters']['counter-data']['value'])

                        if n > 1000:
                                print x['uuid'],
                                print x['counters']['counter-data']['value']
                        else:
                                pass

nvidia-india
10,438 Views

I am able to retrieve the interface errors using NMSDK. But, i am looking at retrieving CRC errors from the interface.

 

Ifstat provided CRC error details. Looking for a way to retrieve this info from NMSDK

 

 

-- interface e0f (2 days, 15 hours, 54 minutes, 40 seconds) --

RECEIVE
Frames/second: 0 | Bytes/second: 0 | Errors/minute: 0
Discards/minute: 0 | Total frames: 0 | Total bytes: 0
Total errors: 0 | Total discards: 0 | Multi/broadcast: 0
No buffers: 0 | Non-primary u/c: 0 | Tag drop: 0
Vlan tag drop: 0 | Vlan untag drop: 0 | Vlan forwards: 0
Vlan broadcasts: 0 | Vlan unicasts: 0 | CRC errors: 0
Runt frames: 0 | Fragment: 0 | Long frames: 0
Jabber: 0 | Bus overruns: 0 | Queue drop: 0
Xon: 0 | Xoff: 0 | Jumbo: 0
TRANSMIT
Frames/second: 0 | Bytes/second: 0 | Errors/minute: 0
Discards/minute: 0 | Total frames: 0 | Total bytes: 0
Total errors: 0 | Total discards: 0 | Multi/broadcast: 0
Queue overflows: 0 | No buffers: 0 | Xon: 0
Xoff: 0 | Jumbo: 0 | Pktlen: 0
Timeout: 0 | Timeout1: 0
LINK_INFO
Current state: down | Up to downs: 1 | Speed: 10000k
Duplex: full | Flowcontrol: none

asulliva
10,419 Views

I don't *know*, but I believe that the CRC errors is the sum of TCP and UDP frames with bad checksums.  Assuming that's true, you can get the values using @gaurav_verma's code, but looking for these counters:

 

  • rx_tcp_bad_cksum
  • rx_udp_bad_cksum

Hope that helps.

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

asulliva
10,412 Views

For reference, here is an example using PowerShell:

 

Get-NcNetPort -Query @{ LinkStatus = "up"; IsAdministrativeUp = $true; PortType = "physical" } | %{
    
    $instance = Get-NcPerfInstance -Name nic_common -Query @{ Name = $_.Name; Uuid = "$($_.Node)*" }
    
    Get-NcPerfData -Name nic_common -Counter rx_tcp_bad_cksum,rx_udp_bad_cksum -InstanceUuid $instance.Uuid | `
        Select Uuid, `
            @{'N'="rx_tcp_bad_cksum";'E'={ ($_.Counters | ?{ $_.Name -eq "rx_tcp_bad_cksum" }).Value }}, `
            @{'N'="rx_udp_bad_cksum";'E'={ ($_.Counters | ?{ $_.Name -eq "rx_udp_bad_cksum" }).Value }} 
}
If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

ryan123
7,324 Views

hay,

 

i know this is an old post . i am trying to use this code you have for powershell and i keep getting 

 

not sure how this is getting the $instance or do i need to specify a variable for this . every other part is working just this part of the code for me is not working .

 

if i run this it does show me all of the active lifs on the filer and it shows the UUid's . so i assumed that the code would work from the main script . but somehow it will not finish as it gets the $instance error

Get-NcPerfInstance -Name lif -Query @{ Name = $_.Name; Uuid = "$($_.Node)*" }

 

 

Get-NcPerfData : Cannot bind argument to parameter 'InstanceUuid' because it is null.
At line:5 char:87
+ ... er rx_tcp_bad_cksum,rx_udp_bad_cksum -InstanceUuid $instance.Uuid | `
+                                                        ~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Get-NcPerfData], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,DataONTAP.C.PowerShell.SDK.Cmdlets.Perf.GetNcPerfData

 

gaurav_verma
10,411 Views

I am not sure if you are gone through my post or not but in NMSDK use API perf-object-get-instances and for an element net-port-get-iter out grep for ['counters']['counter-data']['value'].

If you run my script in python it should give you the output. It works for 832P4.

nvidia-india
10,365 Views

i am not seeing any counters by name "rx_tcp_bad_cksum" or "rx_udp_bad_cksum". Below is all the counters available for physical port. I am connecting to CDOT running 8.3.2P6 version.

 

Below is the dump of (perf-object-get-instances + instance['e0g'] + objectname['nic_common']) api invoke. 

 

{

"instance_name": "e0g",
"instance_uuid": "clus1:kernel:e0g",
"link_current_state": "up",
"link_duplex": "full",
"link_flowcontrol": "non",
"link_speed": "10000000000",
"link_up_to_downs": "2",
"nic_type": "nic_qla",
"node_name": "i-cdot1-02",
"node_uuid": "d8c4b111-6dc7-11e5-a733-dbf023ba2127",
"process_name": "",
"rss_enabled": "Yes",
"rss_hash_errors": "0",
"rss_itable_updates": "4233",
"rss_matrix": "125777990,10821627070,24725585853,48011025587300,24655563124,15061878857,115254853830560,22503576089,46153308888239,6380327470,8692952395,77572496479647,15880730042,33600031094202,6175549897,7815508522,69552986191060,4769431160,9722708563989,42709401,8095239514,73164196456409,9940303892,19620112917984,1046220668,8428048361,78124787836762,11382325871,21676295517771,4241897293,7718261858,68401695986393,4695439075,8112729189790,1209640683,6711436648,60086029145859,8343591698,15918156002276,1149384539,8130174202,68196270650004,8609248936,16844599877082,2063968433,8092964822,67059827042043,7743387468,15202091800378,1212824058,7679280235,67999677420929,12049081251,23688761916627,4675126654,7068030829,62945332363185,2744709766,5429709608912,3498666,6328123970,61092456517439,6507188307,12699174259166,7060718,7265914087,62745132412681,4660763991,8424439892492,5098586,7349230633,66446352261404,14706921323,27315523063065,6688568520,9307481036,74159758796566,7864872746,15225202770287,20638862",
"rss_num_of_queues_used": "16",
"recv_bytes": "327480408770662",
"recv_bytes_per_sec": "2037352550",
"recv_bytes_rate": "2037352550",
"recv_discards": "29040",
"recv_discards_per_min": "0",
"recv_discards_rate": "29040",
"recv_errors": "124725850275840",
"recv_errors_per_min": "0",
"recv_errors_rate": "0",
"recv_frames": "167011914883",
"recv_frames_per_sec": "3803157635",
"recv_frames_rate": "3803157635",
"recv_lro_bytes": "251421468894785",
"recv_lro_segments": "49754853225",
"recv_multi_broadcast": "0",
"recv_no_buffers": "0",
"recv_non_primary_uc": "0",
"recv_tag_drop": "0",
"recv_total_bytes": "327480408770662",
"recv_total_discards": "29040",
"recv_total_errors": "0",
"recv_total_frames": "167011914883",
"recv_vlan_broadcasts": "0",
"recv_vlan_forwards": "0",
"recv_vlan_tag_drop": "0",
"recv_vlan_unicasts": "0",
"recv_vlan_untag_drop": "0",
"send_buffer_coalesces": "10882",
"send_bytes": "1072812675018011",
"send_bytes_per_sec": "2858921243",
"send_bytes_rate": "2858921243",
"send_discards": "1535609722109952",
"send_discards_per_min": "0",
"send_discards_rate": "0",
"send_errors": "0",
"send_errors_per_min": "0",
"send_errors_rate": "0",
"send_frames": "123870303959",
"send_frames_per_sec": "3611219671",
"send_frames_queued": "0",
"send_frames_rate": "3611219671",
"send_ltm_busy_calls": "0",
"send_ltm_fastp_calls": "3494113764",
"send_ltm_total_calls": "123793178441",
"send_ltm_update_calls": "170761467",
"send_ltm_yield_calls": "0",
"send_mtus_too_big": "0",
"send_multi_broadcast": "357537",
"send_no_buffers": "0",
"send_queue_overflows": "0",
"send_total_bytes": "1072812675018011",
"send_total_discards": "0",
"send_total_errors": "0",
"send_total_frames": "123870303959",
"send_tso6_bytes": "0",
"send_tso6_segments": "0",
"send_tso_bytes": "1004556752418755",
"send_tso_segments": "428832230"
}

 

AllenTR
9,530 Views

Hi I have in interest in this effort.  I have been attempting to pull the "rx_total_errors" for all the interfaces.  How could I use a wild card to do that.  I have tried multiple items

like just having "api.child_add_string("objectname","nic_common")", it fails, or placeing a splat (xi2.child_add_string("instance","*") or with the uuid.  Nothing seems to work.

Also how was ("counter","rx_total_errors") found?  It would be nice to see a list of all the counters.  this would be in Python.

Anyone have any ideas?

 

 

Public