Skip to content
Smarter by Design.Simpler for Business

lb hc ​

The lb hc command creates the health checks that measure whether the backends are up or not. A check is bound to a backend or to a backend group; it runs at the determined interval and marks the target as healthy or unhealthy according to the number of consecutive successes or failures. Its panel equivalent is the Health Checks screen.

The first field written is checkType

The protocol of the check is selected first; this selection determines which fields will be asked for. Without the type being written, not even name is listed.

Command Summary ​

TR7 WEB-CLI · lb hc
# Tab after the command
admin@TR7LBWAF01> lb hc
add delete list show update update-many
 
admin@TR7LBWAF01> lb hc list # list all of them
admin@TR7LBWAF01> lb hc show <id> # show one
admin@TR7LBWAF01> lb hc add checkType <type> name <name> …
admin@TR7LBWAF01> lb hc update id <id> … # change
admin@TR7LBWAF01> lb hc update-many target <target> … # bulk change
admin@TR7LBWAF01> lb hc delete <id> # delete
admin@TR7LBWAF01>  

Writing Order ​

Step 1 Select the check type
There are fourteen types: lb hc add checkType http
Step 2 Write the name
name web-denetimi
Step 3 Write the required fields of the type
In DNS the query, in FTP and LDAP the credentials, in Oracle the connection information is asked for.
Step 4 Set the thresholds and bind it to a backend
lb backend update id <backend> --hc <check>

Required Fields ​

OrderFieldStatusValue
1checkTypeRequiredtcp · tcps · ping · http · https · dns · ftp · ftps · ldap · ldaps · smtp · smtps · oracle · udp
2nameRequiredThe name of the check
3queryConditionally requiredOnly dns; the name to be queried
3 · 4ftpUser · ftpPasswordConditionally requiredOnly ftp and ftps; the password is asked for hidden after the command
3 · 4ldapUsername · ldapPasswordConditionally requiredOnly ldap and ldaps; the password is written in the line
3–5oracleUser · oraclePassword · oracleConnectionStringConditionally requiredOnly oracle; the password is asked for hidden after the command
—dnsTextToExpectConditionally requiredOnly when dns and --dnsExpectType text are written; it is written without a prefix right after it

The check type is a discriminator in this command: the required fields specific to the type are written without a prefix even if there is a field starting with -- in the line, and no field starting with -- is accepted until they are all completed.

The target address of the check is not written in this command: the check uses the address of the backend to which it is bound. If a different address will be checked, it is given in the lb backend record with the --useDifferentIp and --differentIp.ip fields.

The Check Types ​

checkTypeWhat it doesThe required fields specific to the type
tcpEstablishes a TCP connection; a step scenario can be written—
tcpsEstablishes a TCP connection with TLS—
pingLooks at the reachability with ICMP—
httpSends an HTTP request and checks the response—
httpsSends an HTTP request with TLS—
dnsSends a DNS queryquery
ftpOpens an FTP sessionftpUser · ftpPassword
ftpsOpens an FTP session with TLSftpUser · ftpPassword
ldapConnects to the directoryldapUsername · ldapPassword
ldapsEstablishes a directory connection with TLSldapUsername · ldapPassword
smtpConnects to the SMTP server—
smtpsEstablishes an SMTP connection with TLS—
oracleConnects to the database and can run a queryoracleUser · oraclePassword · oracleConnectionString
udpSends a UDP packet; a step scenario can be written—

The Threshold Fields Found in Every Type ​

FieldWhat it doesWhat is written after it
--testIntervalDetermines at which interval the check will be repeatedSeconds (default 1)
--timeoutDetermines how long will be waited for the responseSeconds (default 1)
--requiredSuccessDetermines the number of consecutive successes required for the target to be counted as healthyA number (default 3)
--requiredFailureDetermines the number of consecutive failures required for the target to be counted as unhealthyA number (default 2)
--negateReverses the result: a failure is counted as healthytrue · false (default false)

The TLS Fields ​

It is common in the tcps, https, ftps, ldaps, smtp and smtps types.

FieldWhat it doesWhat is written after it
--virtualDomainDetermines the name to be sent as Host and SNI in the connectionA domain name
--verifyCertificateTurns on the verification of the certificate of the servertrue · false (default false)
--tlsVerifyCaSelects the CA profile to be used in the verificationThe lb ca record; it opens only while --verifyCertificate true
--tlsClientCertSelects the client certificate to be presented in the mutual verificationA certificate record

The HTTP and HTTPS Fields ​

FieldWhat it doesWhat is written after it
--uriDetermines the path and the query to be requestedA path, for example /saglik
--methodSelects the request methodAn HTTP method (default GET)
--httpVersionSelects the HTTP version to be used1.1 (default) · 2
--httpHeaders.N.name · --httpHeaders.N.valueAdds a header to the requestThe header name and value; every pair with its own index
--httpBodyWrites the request bodyThe body text to be sent
--expectedStatusCodes.NDetermines the status codes to be counted as a successA status code (default 200); more than one with its own index
--contentCheckModeSelects how the response body will be checkedbasic text matching (default) · jsonata expression
--contentQueryWrites the text to be searched in the responseThe expected text; it is used while --contentCheckMode basic
--jsonataQueryChecks the response with a JSONata expressionA JSONata expression; it is used while --contentCheckMode jsonata

The DNS Fields ​

FieldWhat it doesWhat is written after it
queryDetermines the name to be queriedA domain name; it is required in the dns type
--reverseDnsQueries a PTR record instead of an addresstrue · false (default false); when it is turned on, the record type is not asked for
--rrTypeSelects the record type to be queriedA (default) · AAAA · CAA · CNAME · MX · NAPTR · NS · PTR · SOA · SRV · TXT
--dnsExpectTypeSelects how the response will be checkednone (default) · text · regex
dnsTextToExpectWrites the text to be searched in the responseThe expected text; when --dnsExpectType text is written it becomes required and is written without a prefix
--dnsRegexToExpectWrites the regular expression to be searched in the responseA regular expression; it opens while --dnsExpectType regex

The FTP, LDAP, SMTP and Oracle Fields ​

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
--ftpPathListelenecek dizini belirlerSunucudaki yol
ldapUsername · ldapPasswordCarries the credentials that will connect to the directoryThe user name and the password; they are required in the ldap and ldaps types. The password is asked for hidden
--ldapAuthTries not only the connection but the authentication as welltrue · false (default false)
--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
oracleUser · oraclePasswordCarries the credentials that will connect to the databaseThe user name and the password; they are required in the oracle type
oracleConnectionStringCarries the database connection informationThe connection string; it is required in the oracle type

The 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; 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 sentText; 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 sentData; 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

Examples ​

TR7 WEB-CLI · A) An HTTP check
admin@TR7LBWAF01> lb hc add checkType http name web-check \
--uri /saglik --method GET --expectedStatusCodes.0 200 \
--contentCheckMode basic --contentQuery "ok" --testInterval 5 --timeout 3
admin@TR7LBWAF01>  
TR7 WEB-CLI · B) Checks with TLS verification and with a scenario
admin@TR7LBWAF01> lb hc add checkType https name tls-check \
--virtualDomain portal.kurum.com.tr --verifyCertificate true --tlsVerifyCa <ca>
 
# a two-step TCP scenario: send text, expect the response
admin@TR7LBWAF01> lb hc add checkType tcp name tcp-scenario \
--tcpScenario.0.tcpAction sendText --tcpScenario.0.textToSend "PING" \
--tcpScenario.1.tcpAction expectText --tcpScenario.1.textToExpect "PONG"
admin@TR7LBWAF01>  
TR7 WEB-CLI · C) DNS, LDAP and binding to a backend
admin@TR7LBWAF01> lb hc add checkType dns name dns-check query portal.kurum.com.tr \
--rrType A --dnsExpectType text dnsTextToExpect 10.0.10.21
 
# the password is asked for hidden
admin@TR7LBWAF01> lb hc add checkType ldap name ldap-check ldapUsername cn=probe ldapPassword <password> --ldapAuth true
 
admin@TR7LBWAF01> lb backend update id <backend> --hc <check>
admin@TR7LBWAF01>  

Updating and Deleting ​

TR7 WEB-CLI · update and delete
admin@TR7LBWAF01> lb hc update id <id> --testInterval 10 --requiredFailure 3
 
# removing a scenario step · emptying the step list
admin@TR7LBWAF01> lb hc update id <id> --tcpScenario.1.delete
admin@TR7LBWAF01> lb hc update id <id> --tcpScenario.delete
 
admin@TR7LBWAF01> lb hc delete <id>
admin@TR7LBWAF01>  

Bulk Update ​

update-many applies the same change to many health check records at once. The writing order is the same on every resource.

Step 1 Select the target
The only required field is target: selected for the records selected from the list, all for the entire collection.
Step 2 Add the fields to be written
Only the fields that can be written to many records with the same value are present; the fields specific to the record, such as the id, the name and the check type, do not take place in this command.
Step 3 Mark the targets from the list
When target selected is written and no id is given, a selection list with checkboxes opens.
Step 4 Confirm
A warning stating how many records will be affected appears; nothing is written until the confirmation word is typed.
FieldStatusValue
targetRequiredselected — the records selected from the list · all — the whole collection
--ids.NConditionalThe target ids for target selected. It is not suggested in the Tab list: the targets are marked from the selection list. In a script and in a pipeline it is written manually.
--onErrorOptionalabort (default) — if even one of the targets does not pass the validation, nothing is written · skip — the targets that pass are written

Writable Fields ​

TR7 WEB-CLI · update-many · Tab output
# Tab after the command
admin@TR7LBWAF01> lb hc update-many
--info target
 
# Tab after the target field
admin@TR7LBWAF01> lb hc update-many target
all selected
 
# write -- and Tab: all the writable fields
admin@TR7LBWAF01> lb hc update-many target all --
--contentCheckMode               --contentQuery                   --dnsExpectType
--dnsRegexToExpect               --dnsTextToExpect                --expectedStatusCodes.N
--ftpAction                      --ftpPassword                    --ftpPath
--ftpUser                        --httpBody                       --httpHeaders.N.name
--httpHeaders.N.value            --httpVersion                    --info
--jsonataQuery                   --ldapAuth                       --method
--negate                         --onError                        --oracleConnectionString
--oraclePassword                 --oracleScenario.N.oracleAction  --query
--requiredFailure                --requiredSuccess                --reverseDns
--rrType                         --smtpHelo                       --smtpStartTls
--tcpScenario.N.tcpAction        --testInterval                   --timeout
--tlsClientCert                  --tlsVerifyCa                    --udpScenario.N.udpAction
--uri                            --verifyCertificate              --virtualDomain
admin@TR7LBWAF01>  

There are 39 fields in the command; the list above is the same as what appears when -- is written and Tab is pressed on the device. What each one does and what is written after it is in the table below.

The fields that are condition-bound in the single command (those that open according to the value of another field) are listed here without a condition: in the bulk update every target is validated separately according to its own record, and if the field is not active on a target it is skipped only on that target.

FieldWhat it doesWhat is written after it
--infoWrites what the command will do without running itIt does not take a value; it is written on its own
--onErrorDetermines what will happen if a target does not pass the validationabort writes nothing (default) · skip writes the targets that pass
--testIntervalDetermines at which interval the check will be repeatedSeconds (default 1)
--timeoutDetermines how long will be waited for the responseSeconds (default 1)
--requiredSuccessDetermines the number of consecutive successes required to be counted as healthyA number (default 3)
--requiredFailureDetermines the number of consecutive failures required to be counted as unhealthyA number (default 2)
--negateReverses the result: a failure is counted as healthytrue · false (default false)
--virtualDomainDetermines the name to be sent as Host and SNI in the connectionA domain name
--verifyCertificateTurns on the verification of the certificate of the servertrue · false (default false)
--tlsVerifyCaSelects the CA profile to be used in the verificationThe lb ca record; it is meaningful together with --verifyCertificate true
--tlsClientCertSelects the client certificate to be presented in the mutual verificationA certificate record
--uriDetermines the path and the query to be requested in the HTTP checkA path, for example /saglik
--methodSelects the HTTP request methodAn HTTP method (default GET)
--httpVersionSelects the HTTP version to be used1.1 (default) · 2
--httpHeaders.N.name · --httpHeaders.N.valueAdds a header to the HTTP requestThe header name and value; every pair with its own index
--httpBodyWrites the HTTP request bodyThe body text to be sent
--expectedStatusCodes.NDetermines the status codes to be counted as a successA status code (default 200); more than one with its own index
--contentCheckModeSelects how the response body will be checkedbasic text matching (default) · jsonata expression
--contentQueryWrites the text to be searched in the responseThe expected text; it is used while --contentCheckMode basic
--jsonataQueryChecks the response with a JSONata expressionA JSONata expression; it is used while --contentCheckMode jsonata
--queryDetermines the name to be queried in the DNS checkA domain name
--reverseDnsQueries a PTR record instead of an addresstrue · false (default false)
--rrTypeSelects the DNS record type to be queriedA (default) · AAAA · CAA · CNAME · MX · NAPTR · NS · PTR · SOA · SRV · TXT
--dnsExpectTypeSelects how the DNS response will be checkednone (default) · text · regex
--dnsTextToExpectWrites the text to be searched in the DNS responseThe expected text; it is used while --dnsExpectType text
--dnsRegexToExpectWrites the regular expression to be searched in the DNS responseA regular expression; it is used while --dnsExpectType regex
--ftpUser · --ftpPasswordCarries the credentials that will open the FTP sessionThe user name and the password
--ftpActionSelects how far the FTP check will goonlyLogin only opens a session (default) · loginAndList lists the directory as well
--ftpPathListelenecek dizini belirlerSunucudaki yol
--ldapAuthIn the directory tries not only the connection but the authentication as welltrue · false (default false)
--smtpHeloDetermines the EHLO name to be sent to the serverA domain name
--smtpStartTlsTurns on the encryption of the connection with STARTTLStrue · false (default false)
--oracleConnectionStringCarries the database connection informationThe connection string
--oraclePasswordCarries the password that will connect to the databaseThe password
--tcpScenario.N.tcpActionSelects what the step in the TCP scenario will dosendText · expectText · expectRegex · wait
--udpScenario.N.udpActionSelects what the step in the UDP scenario will dosend · wait · expectText · expectRegex
--oracleScenario.N.oracleActionSelects what the step in the Oracle scenario will doexecuteCmd · wait

Fields that exist in the single command but not here, and the reasons:

FieldWhy it is not here
checkTypeThe type of the check determines the identity of the record; it cannot be changed in bulk
nameThe name is unique; the same value cannot be written to many records
ldapUsernameThe directory user name is specific to the record
ldapPasswordThe password field is not written in bulk
oracleUserThe database user name is specific to the record
tcpScenario.N.textToSendThe content fields of the scenario steps depend on the step id
udpScenario.N.dataToSendIn the same way it is specific to the step
oracleScenario.N.oracleCmdIn the same way it is specific to the step

Target Selection and Confirmation ​

TR7 WEB-CLI · selection list and confirmation
admin@TR7LBWAF01> lb hc update-many target selected --testInterval 10
 
?  Target objects
    space: mark · ctrl+a: all · enter: confirm
    Filter: (filter by typing) · esc: cancel
 
  [x] <record-1>
  [x] <record-2>
  [ ] <record-3>
    2 selected / 3
 
⚠  2 objects will be updated
    <record-1>, <record-2>
 
Type "yes" to confirm: yes
admin@TR7LBWAF01>  
TR7 WEB-CLI · the whole collection and writing in a script
# the whole collection: the list does not open, the confirmation comes directly
admin@TR7LBWAF01> lb hc update-many target all --requiredFailure 3
⚠  This operation will update ALL the objects in the collection
Type "yes" to confirm:
 
# in a script or in a pipeline: the targets are written by hand, the list does not open
admin@TR7LBWAF01> lb hc update-many target selected \
--ids.0 <kimlik-1> --ids.1 <kimlik-2> --testInterval 10 --onError skip
admin@TR7LBWAF01>  

The screen language depends on the user

The texts in the selection list and on the confirmation screen come according to the language preference of the signed-in user. The confirmation word is yes in the English interface and evet in the Turkish interface.

The detailed behavior of bulk update — which fields can be written in bulk and the report returned for each target — is on the API Commands page.

Things to Know ​

  • A check does not work on its own. It starts when it is bound to a backend (lb backend → --hc) or to a backend group.
  • The target address is not written in this command. The check uses the address of the backend to which it is bound; if a different address will be checked, the --useDifferentIp and --differentIp.ip fields in the backend record are given.
  • The type determines the fields. After checkType is selected, only the fields of that type are listed; -- with Tab shows all of that type.
  • The passwords are asked for hidden. The password fields such as ldapPassword are asked for without appearing on the screen and are asked for again in an update.
  • The scenario steps run in order. The steps are executed according to the index order; when a step is removed from the middle, the following indexes shift.