determine type of monitor for REST API call
Hi all.
I need to get the settings (timeout, send string, etc.) for a specific monitor that is bound to a pool and which can basically be of any type. When querying the pool through a REST call, I get for example the following reply:
{
"allowNat": "yes",
"allowSnat": "yes",
"fullPath": "/Partition-1/testPool2",
"generation": 9744,
"ignorePersistedWeight": "disabled",
"ipTosToClient": "pass-through",
"ipTosToServer": "pass-through",
"kind": "tm:ltm:pool:poolstate",
"linkQosToClient": "pass-through",
"linkQosToServer": "pass-through",
"loadBalancingMode": "round-robin",
"membersReference": {
"isSubcollection": true,
"link": "https://localhost/mgmt/tm/ltm/pool/~Partition-1~testPool2/members?ver=11.6.0"
},
"minActiveMembers": 0,
"minUpMembers": 0,
"minUpMembersAction": "failover",
"minUpMembersChecking": "disabled",
"monitor": "/Partition-1/test2",
"name": "testPool2",
"partition": "Partition-1",
"queueDepthLimit": 0,
"queueOnConnectionLimit": "disabled",
"queueTimeLimit": 0,
"reselectTries": 0,
"selfLink": "https://localhost/mgmt/tm/ltm/pool/~Partition-1~testPool2?ver=11.6.0",
"serviceDownAction": "none",
"slowRampTime": 10
}
Now, I know the monitor name and its partition, but not its type. When trying to query the settings of this specific monitor, I need to provide its type as part of the query path, e.g.: /mgmt/tm/ltm/monitor/http/~Partition-1~test2
Since I do not know its type at that time, my idea was to subsequentially query the most common types of monitors (like http, https, tcp and so on), check the replies for the only one that has returned valid values and derive the monitor type from that. Unexpectedly, the BigIP will answer all of those queries with a valid reply, and will even return the settings, even if the "type" part of the URI is wrong.
For example, when querying an http monitor that is defined as
ltm monitor http test2 {
adaptive disabled
defaults-from /Common/http
destination *:*
interval 5
ip-dscp 0
partition Partition-1
recv "200 OK"
send "GET /\r\n"
time-until-up 0
timeout 16
}
through the iControl REST API, I get a valid reply even when using the path /mgmt/tm/ltm/monitor/tcp/~Partition-1~test2 ,although it is not a TCP monitor:
{
"adaptive": "disabled",
"adaptiveDivergenceType": "relative",
"adaptiveDivergenceValue": 25,
"adaptiveLimit": 200,
"adaptiveSamplingTimespan": 300,
"defaultsFrom": "/Common/http",
"destination": "*:*",
"fullPath": "/Partition-1/test2",
"generation": 0,
"interval": 5,
"ipDscp": 0,
"kind": "tm:ltm:monitor:tcp:tcpstate",
"manualResume": "disabled",
"name": "test2",
"partition": "Partition-1",
"recv": "200 OK",
"reverse": "disabled",
"selfLink": "https://localhost/mgmt/tm/ltm/monitor/tcp/~Partition-1~test2?ver=11.6.0",
"send": "GET /\\r\\n",
"timeUntilUp": 0,
"timeout": 16,
"transparent": "disabled",
"upInterval": 0
}
I don't see any means of getting the type of monitor from those replies besides forcing all admins to include the type in the name, which is not a good solution. I cannot derive the type from the path, nor from the "kind" field, nor from the "defaultsFrom" setting, because that one does not necessarily contain the type (it does in the example above, though).
I suppose this to be a bug. Has anybody run into the same issue and would like to share his/her experience? Any suggestions on how to address that? Many thanks in advance!