NetApp / harvest

Open-metrics endpoint for ONTAP and StorageGRID
https://netapp.github.io/harvest/latest
Apache License 2.0
150 stars 37 forks source link

Feature request for NAS connections and iscsi sessions counts metric #3136

Closed summertony15 closed 1 month ago

summertony15 commented 1 month ago

Describe the solution you'd like NetApp has the limitation of Maximum number of connection -- NAS per node, Here is the HWU example: https://hwu.netapp.com/Controller/Index?platformTypeId=30310846&platform=29266985&os=34942206#none 截圖 2024-09-10 15 06 17 And here is the description: Maximum number of NAS (SMB and NFS) TCP connections that a node can support

Also, we have a maximum number of iSCSI sessions, 截圖 2024-09-10 15 51 12

We want to monitor these two value, in case they reach the limits. I need both of them, thanks Best to have both ZAPI and REST templates.

rahulguptajss commented 1 month ago

Discord discussion here

summertony15 commented 1 month ago

Update the request which needs two values mapping to the values shown in HWU as the description.

rahulguptajss commented 1 month ago

@summertony15

Could you share the time taken and the number of records returned by the following commands in the relevant environment you want to track?

Make sure to replace USER, PASS, and CLUSTER_IP with the appropriate values.

  1. NFS Connected Clients (without records):

    curl -w "Total time: %{time_total}\n" -s -k -u USER:PASS 'https://CLUSTER_IP/api/protocols/nfs/connected-clients?return_records=false'
  2. NFS Connected Clients (with records):

    curl -w "Total time: %{time_total}\n" -s -k -u USER:PASS 'https://CLUSTER_IP/api/protocols/nfs/connected-clients?return_records=true&fields=client_ip,node.name,protocol,server_ip,svm.name,volume.name'
  3. iSCSI Sessions (without records):

    curl -w "Total time: %{time_total}\n" -s -k -u USER:PASS 'https://CLUSTER_IP/api/protocols/san/iscsi/sessions?return_records=false'
  4. iSCSI Sessions (with records):

    curl -w "Total time: %{time_total}\n" -s -k -u USER:PASS 'https://CLUSTER_IP/api/protocols/san/iscsi/sessions?return_records=true&fields=tsih,target_portal_group,initiator.name,isid,svm.name'

Thanks.

summertony15 commented 1 month ago

Hi @rahulguptajss

command1 command2 command3 command4
rahulguptajss commented 1 month ago

Thanks @summertony15 . So, if we export NFS and iSCSI connection counts at the cluster level, will that be good? CIFS (node_cifs_connections) is already present which includes all relevant protocols.

summertony15 commented 1 month ago

I think node level is better, since the limitation is by node. We can count the cluster level, by sum up by each node

rahulguptajss commented 1 month ago

Sure Thanks.

rahulguptajss commented 1 month ago

ISCSI seems to be at svm level. I don't see any node information in API api/protocols/san/iscsi/sessions.

rahulguptajss commented 1 month ago

@summertony15 Could you also run the commands shared in this comment on an ONTAP system with a large number of connections?

The reason for this request is that we want to measure the time taken for these calls.

rahulguptajss commented 1 month ago

@summertony15 We currently do not plan to enable these metrics in Harvest by default. I have provided a document detailing the steps to enable these metrics manually. Please follow the instructions outlined here and let us know if they work for you. Thank you!

summertony15 commented 1 month ago

@rahulguptajss These works, So we have to sum "node_nfs_clients_count" and "node_cifs_connections" to compare the Maximum number of NAS (SMB and NFS), right?

summertony15 commented 1 month ago

ISCSI seems to be at svm level. I don't see any node information in API api/protocols/san/iscsi/sessions.

From the CLI, in diagnostic mode, we can get the node count by using "iscsi session show -fields node"

rahulguptajss commented 1 month ago

ISCSI seems to be at svm level. I don't see any node information in API api/protocols/san/iscsi/sessions.

From the CLI, in diagnostic mode, we can get the node count by using "iscsi session show -fields node"

Yes, That is correct.

rahulguptajss commented 1 month ago

@rahulguptajss These works, So we have to sum "node_nfs_clients_count" and "node_cifs_connections" to compare the Maximum number of NAS (SMB and NFS), right?

Thanks. Yes, That is correct.

summertony15 commented 1 month ago

@rahulguptajss So we cannot have the iscsi session count by node level? Since we have to compare to the limitation of each node

rahulguptajss commented 1 month ago

We cannot as the API api/protocols/san/iscsi/sessions and the CLI command iscsi session show do not provide a node field.

summertony15 commented 1 month ago

But when set to diag mode, CLI can provide node field

截圖 2024-09-24 17 47 02
rahulguptajss commented 1 month ago

Thanks. In that case, Could you try below iscsi template and check metric node_iscsi_sessions_count?

name:             ISCSISessions
query:            api/private/cli/iscsi/session
object:           iscsi_sessions

counters:
  - ^^tsih                         => tsih
  - ^^tpgroup                      => target_portal_group
  - ^^initiator-name               => initiator
  - ^^isid                         => isid
  - ^^node                         => node
  - ^^vserver                      => svm

plugins:
  - LabelAgent:
      value_to_num_regex:
        - count initiator .* .* `0`
  - Aggregator:
      # plugin will create summary/average for each object
      # any names after the object names will be treated as
      # label names that will be added to instances
      - svm
      - node

# only export node/aggr aggregations from plugin
# set this true or comment, to get data for each lock
export_data: false
summertony15 commented 1 month ago

Since these two templates are added under 9.12, do we need ONTAP version 9.12 or above to support these metrics? custom_iscsi_sessions.yaml and custom_nfs_clients_connection.yaml

rahulguptajss commented 1 month ago

It doesn't matter, the template will be invoked regardless by lower ONTAP versions as well. For more information, please refer to this documentation.

The api/protocols/nfs/connected-clients endpoint is available since ONTAP 9.7, and the private CLI endpoint api/private/cli/iscsi/session should work in ONTAP 9.6 as well.

summertony15 commented 1 month ago

If user is using ONTAP 9.11, will the template in rest/9.12 be taken ?

rahulguptajss commented 1 month ago

If user is using ONTAP 9.11, will the template in rest/9.12 be taken ?

Yes