Skip to content
Smarter by Design.Simpler for Business

gtm hc ​

The gtm hc command manages the health checks GTM uses to monitor the data centers and the targets. The check results become an input to the scenarios; and the scenarios determine whether the DNS records will take part in the answer or not. Its panel equivalent is the Health Checks screen.

Command Summary ​

TR7 WEB-CLI · gtm hc
admin@TR7LBWAF01> gtm hc list # list them all
admin@TR7LBWAF01> gtm hc show <id> # show one
admin@TR7LBWAF01> gtm hc add name <name> checkType <type> … # a new check
admin@TR7LBWAF01> gtm hc update id <id> … # change
admin@TR7LBWAF01> gtm hc delete <id> # delete
admin@TR7LBWAF01>  

Writing Order ​

Step 1 Write the name
gtm hc add name web-check
Step 2 Select the check type
checkType http

It takes fifteen values. After the type is selected, only the fields of that type are asked for.
Step 3 Write the required fields of the type
In most of the types the address and the port to be checked; in the types that have authentication, additionally the user and the password.
Step 4 Add the thresholds and the details
The trial interval, the timeout and the numbers of consecutive results needed for a state change are optional.

Required Fields ​

The CLI asks for the required fields in the following order, one by one; it does not show the next one before one is written. What comes after the third order changes according to the selected check type.

OrderFieldStatusValue
1nameRequiredThe name of the check
2checkTypeRequiredOne of the fifteen types below
3addr.ipConditionally requiredIn all the types other than dcCheck; the address to be checked. It is written without a prefix even if there is a -- on the line
4addr.portConditionally requiredIn the types other than ping and dcCheck; the port to be checked
5queryConditionally requiredOnly dns; the name to be queried
5 · 6ftpUser · ftpPasswordConditionally requiredOnly ftp and ftps; the password is asked for hidden after the command
5 · 6ldapUsername · ldapPasswordConditionally requiredOnly ldap and ldaps; the password is written on the line
5–7oracleUser · oraclePassword · oracleConnectionStringConditionally requiredOnly oracle; the password is asked for hidden after the command
3dcIdConditionally requiredOnly dcCheck; the data center whose measure will be taken
4criterion.valConditionally requiredOnly dcCheck; the comparison value. It is written without a prefix even if there is a -- on the line
5poolIdConditionally requiredOnly dcCheck and in the criteria bound to a vService; the vService to be measured

The -- writing: If there is no field that starts with -- on the line, all the fields in the table are written without a prefix. When a -- field is added to the line, the conditionally required fields (addr.port, query, ftpUser, ldapUsername, ldapPassword, oracleUser, oracleConnectionString, dcId, poolId) are written with the -- prefix; addr.ip and criterion.val, on the other hand, are again without a prefix and have to be written before the fields that start with --.

The Check Types ​

checkTypeIt checksThe additional required fields
pingThe reachability of the address— (the port is not asked for)
tcp · tcpsWhether a connection can be set upaddr.port
udpThe UDP targetaddr.port
http · httpsThe web server answeraddr.port
dnsThe DNS server answeraddr.port · query
ftp · ftpsThe FTP sessionaddr.port · ftpUser · ftpPassword
ldap · ldapsThe directory connectionaddr.port · ldapUsername · ldapPassword
smtp · smtpsThe mail serveraddr.port
oracleThe database connectionaddr.port · oracleUser · oraclePassword · oracleConnectionString
dcCheckThe measures of a data centerdcId · criterion.val (+ poolId in the vService criteria)

Some of the passwords are asked for hidden

The oraclePassword and ftpPassword are not written on the command line; after the command is run, they are asked for on the screen without being seen. The ldapPassword, on the other hand, is written directly on the line and falls into the command history.

The Common Fields ​

FieldDefaultValue
addr.ip—The address to be checked (required in all the types other than dcCheck)
addr.port—The port to be checked (required except in ping and dcCheck)
--testInterval1The repetition interval of the check
--timeout1The duration to be waited for an answer
--requiredSuccess3The consecutive successes needed to pass to healthy
--requiredFailure2The consecutive failures needed to pass to unhealthy
--negatefalseIt negates the result: a failure counts as healthy
--v-device · --namespaceThe Host device · the default route tableFrom which context the check will be done

The --v-device, --namespace, --testInterval and --timeout fields are not present in the dcCheck type.

The HTTP and HTTPS Check ​

FieldDefaultValue
--uri—The path and the query to be requested
--methodGETThe request method
--httpVersion1.11.1 or 2
--httpBody—The request body
--httpHeaders.0.name · --httpHeaders.0.value—The request headers
--expectedStatusCodes.0200The status codes that count as a success
--contentCheckModebasicThe content check form: basic or jsonata
--virtualDomain—The domain name to be sent as the Host and the SNI
--verifyCertificatefalseIt verifies the server certificate
--contentQuery—The text to be searched for in the answer body; it is used while --contentCheckMode basic
--jsonataQuery—The JSONata expression that will check the answer body; it is used while --contentCheckMode jsonata
--tlsClientCert—The client certificate to be presented in the mutual authentication
--tlsVerifyCa—The CA profile against which the server certificate will be verified; it opens only while --verifyCertificate true

The certificate fields can be used in the https, tcps, smtp, smtps, ftps and ldaps types as well.

The DNS Check ​

FieldDefaultValue
query—The name to be queried
--reverseDnsfalseIt queries the PTR record instead of the address; when it is turned on, the record type is not asked for
--rrTypeAThe record type to be queried: A · AAAA · CAA · CNAME · MX · NAPTR · NS · PTR · SOA · SRV · TXT. It does not open while --reverseDns true
--dnsExpectTypenoneHow the answer will be checked: none · text · regex
dnsTextToExpect · dnsRegexToExpect—The expected answer; one of them becomes required according to the selected check form

The Checks with Scenario Steps ​

In the tcp, tcps, udp and oracle types the check consists of steps that run in order. Every step takes its own index: in the --tcpScenario.0.…, --tcpScenario.1.… form. First what the step will do is selected, then the fields of that step are written.

tcp and tcps ​

FieldWhat it doesWhat is written after it
--tcpScenario.N.tcpActionSelects what the step will dosendText sends data · expectText expects text · expectRegex expects a regular expression · wait waits
--tcpScenario.N.textToSendWrites the data to be sentThe text to be sent; it opens while tcpAction sendText
--tcpScenario.N.dataFormatSelects the format of the sent datatext (default) · hex · base64; it opens while tcpAction sendText
--tcpScenario.N.textToExpectWrites the text to be searched in the responseThe expected text; it opens while tcpAction expectText
--tcpScenario.N.regexToExpectWrites the regular expression to be searched in the responseA regular expression; it opens while tcpAction expectRegex
--tcpScenario.N.tcpWaitMsDetermines how long the step will waitMilliseconds; it opens while tcpAction wait

udp ​

FieldWhat it doesWhat is written after it
--udpScenario.N.udpActionSelects what the step will dosend sends data · wait waits · expectText expects text · expectRegex expects a regular expression
--udpScenario.N.dataToSendWrites the data to be sentThe data to be sent; it opens while udpAction send
--udpScenario.N.dataFormatSelects the format of the sent datatext (default) · hex · base64; it opens while udpAction send
--udpScenario.N.textToExpectWrites the text to be searched in the responseThe expected text; it opens while udpAction expectText
--udpScenario.N.regexToExpectWrites the regular expression to be searched in the responseA regular expression; it opens while udpAction expectRegex
--udpScenario.N.udpWaitMsDetermines how long the step will waitMilliseconds; it opens while udpAction wait

oracle ​

FieldWhat it doesWhat is written after it
--oracleScenario.N.oracleActionSelects what the step will doexecuteCmd runs a query · wait waits
--oracleScenario.N.oracleCmdWrites the query to be runAn SQL statement; it opens while oracleAction executeCmd
--oracleScenario.N.oracleExpectedTextWrites the text to be searched in the resultThe expected text; it opens while oracleAction executeCmd
--oracleScenario.N.oracleExpectedMinRowsDetermines at least how many rows the result has to returnThe number of rows; it opens while oracleAction executeCmd
--oracleScenario.N.oracleWaitMsDetermines how long the step will waitMilliseconds; it opens while oracleAction wait

The FTP, SMTP and LDAP Checks ​

FieldWhat it doesWhat is written after it
ftpUser · ftpPasswordCarries the credentials that will open the FTP sessionThe user name and the password; they are required in the ftp and ftps types
--ftpActionSelects how far the check will goonlyLogin only opens a session (default) · loginAndList lists the directory as well
--ftpPathDetermines the directory to be listedThe path on the server; it is written in the ftp and ftps types
--smtpHeloDetermines the EHLO name to be sent to the serverA domain name; it is written in the smtp and smtps types
--smtpStartTlsTurns on the encryption of the connection with STARTTLStrue · false (default false); it opens only in the smtp type
ldapUsername · ldapPasswordCarries the credentials that will connect to the directoryThe user name and the password; they are required in the ldap and ldaps types
--ldapAuthTurns on not only the connection but also the authentication being triedtrue · false (the default is false); it is written in the ldap and ldaps types

The Data Center Check ​

The dcCheck type is not bound to a target; it compares the measures of the selected data center with a threshold.

FieldDefaultValue
dcId—The data center whose measure will be taken; if there is a -- field on the line, --dcId is written
--dcCheckTypepool_statusWhich measure will be taken
poolId—Required in the vService criteria; the vService to be measured. If there is a -- field on the line, --poolId is written
criterion.val—The comparison value; under every condition it is without a prefix and is written before the -- fields
--criterion.op>The comparison operator: >, <, = or - for a range. Since it contains a sign, it is written with double quotes
--criterion.val2—The upper limit of the range; it is used only when --criterion.op "-" is written

The --dcCheckType values: pool_status, pool_session_new, pool_request, pool_connection, pool_cpu, pool_bw, cpu, bw, upPools, downPools. The first six are bound to a vService and ask for poolId.

Examples ​

TR7 WEB-CLI · A) The TCP and ping check
admin@TR7LBWAF01> gtm hc add name web-tcp checkType tcp addr.ip 10.0.0.10 addr.port 443
# in the ping type the port is not asked for
admin@TR7LBWAF01> gtm hc add name net-ping checkType ping addr.ip 10.0.0.1
admin@TR7LBWAF01>  
TR7 WEB-CLI · B) The HTTPS check, the path and the status code
admin@TR7LBWAF01> gtm hc add name portal-https checkType https addr.ip 10.0.0.10 --addr.port 443 \
--uri /health --expectedStatusCodes.0 200 --virtualDomain portal.kurum.com.tr \
--verifyCertificate true --timeout 3
admin@TR7LBWAF01>  
TR7 WEB-CLI · C) The DNS check and the password asked for hidden
admin@TR7LBWAF01> gtm hc add name dns-check checkType dns addr.ip 10.0.0.53 --addr.port 53 \
--query www.kurum.com.tr --rrType A
# in the ftp type the password is asked for after the run
admin@TR7LBWAF01> gtm hc add name ftp-check checkType ftp addr.ip 10.0.0.21 addr.port 21 ftpUser check
FTP password: ••••••••
admin@TR7LBWAF01>  
TR7 WEB-CLI · D) The data center measure check
# unhealthy if the vService processor usage exceeds 80%
admin@TR7LBWAF01> gtm hc add name dc-cpu checkType dcCheck criterion.val 80 \
--dcId <center> --poolId <vService> --dcCheckType pool_cpu --criterion.op ">"
admin@TR7LBWAF01>  

Updating and Deleting ​

TR7 WEB-CLI · update and delete
admin@TR7LBWAF01> gtm hc update id <id> --testInterval 5 --requiredFailure 3
admin@TR7LBWAF01> gtm hc update id <id> --httpHeaders.delete # remove the headers
admin@TR7LBWAF01> gtm hc delete <id>
admin@TR7LBWAF01>  

Things to Know ​

  • A check does not give a decision on its own. Unless its result is bound to a scenario, it does not affect the DNS answers; the scenarios are set up with gtm scenario.
  • The thresholds are two-way. Three consecutive results for the passage to healthy and two for the passage to unhealthy are the default; the two are set separately.
  • The comparison operator requires quotes. Since the --criterion.op values contain signs such as >, they are written with double quotes.
  • dcCheck does not carry the context fields. In this type the virtual device, route table, interval and timeout fields are not present.