View iSCSI sessions
The iSCSI sessions endpoints provide detailed information about active connections between iSCSI initiators and targets within your ONTAP environment. Use these endpoints to monitor session activity, including control, data, and status messages exchanged over established TCP connections.
Overview
An iSCSI session is one or more TCP connections that link an iSCSI initiator with an iSCSI target. TCP connections can be added and removed from an iSCSI session by the iSCSI initiator. Across all TCP connections within an iSCSI session, an initiator sees one and the same target. After the connection is established, iSCSI control, data, and status messages are communicated over the session.
The iSCSI sessions REST API provides information about iSCSI initiators that have successfully logged in to ONTAP.
Examples
Retrieving all iSCSI sessions
# The API:
GET /api/protocols/san/iscsi/sessions
# The call:
curl -X GET "https://<mgmt-ip>/api/protocols/san/iscsi/sessions" -H "accept: application/hal+json"
# The response:
{
"records": [
{
"svm": {
"uuid": "a009a9e7-4081-b576-7575-ada21efcaf16",
"name": "svm1",
"_links": {
"self": {
"href": "/api/svm/svms/a009a9e7-4081-b576-7575-ada21efcaf16"
}
}
},
"target_portal_group": "iscsi_lif1",
"tsih": 10,
"_links": {
"self": {
"href": "/api/protocols/san/iscsi/sessions/a009a9e7-4081-b576-7575-ada21efcaf16/iscsi_lif1/10"
}
}
},
{
"svm": {
"uuid": "b009a9e7-4081-b576-7575-ada21efcaf16",
"name": "svm2",
"_links": {
"self": {
"href": "/api/svm/svms/b009a9e7-4081-b576-7575-ada21efcaf16"
}
}
},
"target_portal_group": "iscsi_lif2",
"tsih": 11,
"_links": {
"self": {
"href": "/api/protocols/san/iscsi/sessions/b009a9e7-4081-b576-7575-ada21efcaf16/iscsi_lif2/11"
}
}
}
],
"num_records": 2,
"_links": {
"self": {
"href": "/api/protocols/san/iscsi/sessions"
}
}
}
Retrieving all of the iSCSI sessions under the target portal group iscsi_lif1
The tpgroup query parameter is used to perform the query.
# The API:
GET /api/protocols/san/iscsi/sessions
# The call:
curl -X GET "https://<mgmt-ip>/api/protocols/san/iscsi/sessions?tpgroup=iscsi_lif1" -H "accept: application/hal+json"
# The response:
{
"records": [
{
"svm": {
"uuid": "a009a9e7-4081-b576-7575-ada21efcaf16",
"name": "svm1",
"_links": {
"self": {
"href": "/api/svm/svms/a009a9e7-4081-b576-7575-ada21efcaf16"
}
}
},
"target_portal_group": "iscsi_lif1",
"tsih": 10,
"_links": {
"self": {
"href": "/api/protocols/san/iscsi/sessions/a009a9e7-4081-b576-7575-ada21efcaf16/iscsi_lif1/10"
}
}
}
],
"num_records": 1,
"_links": {
"self": {
"href": "/api/protocols/san/iscsi/sessions"
}
}
}
Retrieving an iSCSI session
# The API:
GET /api/protocols/san/iscsi/sessions/{svm.uuid}/{target_portal_group}/{tsih}
# The call:
curl -X GET "https://<mgmt-ip>/api/protocols/san/iscsi/sessions/a009a9e7-4081-b576-7575-ada21efcaf16/iscsi_lif1/10" -H "accept: application/hal+json"
# The response:
{
"svm": {
"uuid": "a009a9e7-4081-b576-7575-ada21efcaf16",
"name": "svm1",
"_links": {
"self": {
"href": "/api/svm/svms/a009a9e7-4081-b576-7575-ada21efcaf16"
}
}
},
"target_portal_group": "iscsi_lif1",
"tsih": 10,
"initiator": {
"name": "iqn.1994-05.com.example:string",
"comment": "Example information about this initiator"
},
"isid": "61:62:63:64:65:00",
"target_portal_group_tag": 1027,
"connections": [
{
"cid": 1,
"authentication_type": "chap",
"initiator_address": {
"address": "10.224.123.85",
"port": 43827
},
"interface": {
"name": "iscsi_lif1",
"uuid": "c15439b4-dbb4-11e8-90ac-005056bba882",
"ip": {
"address": "192.168.0.1",
"port": 3260
},
"_links": {
"self": {
"href": "/api/network/ip/interfaces/c15439b4-dbb4-11e8-90ac-005056bba882"
}
}
}
}
],
"igroups": [
{
"uuid": "af7838cd-f993-4faf-90b7-5524787ae1e8",
"name": "igroup1",
"_links": {
"self": {
"href": "/api/protocols/san/igroups/af7838cd-f993-4faf-90b7-5524787ae1e8"
}
}
},
{
"uuid": "bf7838cd-f993-4faf-90b7-5524787ae1e8",
"name": "igroup2",
"_links": {
"self": {
"href": "/api/protocols/san/igroups/bf7838cd-f993-4faf-90b7-5524787ae1e8"
}
}
}
],
"_links": {
"self": {
"href": "/api/protocols/san/iscsi/sessions/a009a9e7-4081-b576-7575-ada21efcaf16/iscsi_lif1/10"
}
}
}