Fortinet black logo

Handbook

Configuring health check scripts

Configuring health check scripts

You can upload or input scripting to run health check on FortiADC. When you set a new pool with the health check script, health check will run this script periodically. The health check will then use the result of the script as its result.

The following should be noted when using the Health Check Script feature:

  • The supported scripting type is shell script.

  • Some commands, such as curl, and ping are supported.

  • You should use a new root file-system to avoid the script accessing your current file-system.

  • You should limit the quantity of the script and not allow too many scripts to run at the same time.

Before you begin:
  • You should have knowledge of some basic concepts of shell scripting, such as variables, if/else statements, and while loop.
To configure a health check script:
  1. Go to Shared Resources > Health Check.
  2. Click the Health Check Script tab.
  3. Configure the health check script, as described below.
    SettingsGuidelines

    Name

    Enter a unique name for the health check script.

    After you initially save the configuration, you cannot edit the name.

    Input

    Type or paste the script.

  4. Click Save.
  5. Go back to the Health Check tab. Create a new health check configuration and select one of the health check scripts you created.
Predefined Health Check Scripts

The following table describes the predefined health check scripts. You can get started with these or create custom scripts.

Predefined script Usage

CURL_HTTP_CODE

Uses curl to check the status of server

ICMP

Uses ping to check the status of server

PORT_STATUS

Uses nc to check status of a port on server.

Health Check Script programs and commands

The following table describes the predefined commands.

Predefined commands Usage

$NODE_IP

The IP address of real server.

$NODE_PORT

The port of the real server.

$UP:

Sets the status of health check to UP.

$DOWN:

Sets the status of health check to DOWN.

The following programs and commands can be used in the health check script:

• hostname

• ipcalc

• stty

• usleep

• busybox

• curl

• ed

• nmeter

• xargs

• tail

• basename

• dirname

• expr

• killall

• mkfif

• pwdx

• shred

• split

• traceroute6

• cat

• date

• egrep

• ifconfig

• iplink

• ln

• mktemp

• nameif

• ping6

• rm

• sleep

• true

• base64

• chmod

• dns domain name

• fgrep

• ip

• ls

• mount

• netstat

• printenv

• rmdir

• stat

• umount

• bash

• cp

• echo

• grep

• ipaddr

• kill

• mkdir

• mpstat

• pidof

• ps

• sed

• uniq

• uptime

• link

• mknod

• mv

• ping

• pwd

• slattach

• touch

• vconfig

• adduser

• arping

• fakeidentd

• inetd

• killall5

• nbd-client

• powertop

• pmap

• pstree

• iproute

• telnet

• seq

• sort

• sum

• test

• tr

• truncate

• unix2dos

• wc

• yes

• cmp

• dos2unix

• find

• lsof

• nc

• nslookup

• pgrep

• printf

• time

• traceroute

• tty

• unlink

• whoami

• awk

• diff

• du

• flock

• md5sum

• netcat

• passwd

• pkill

• pscan

• realpath

• smemcap

• ssl_client

Configuring health check scripts

You can upload or input scripting to run health check on FortiADC. When you set a new pool with the health check script, health check will run this script periodically. The health check will then use the result of the script as its result.

The following should be noted when using the Health Check Script feature:

  • The supported scripting type is shell script.

  • Some commands, such as curl, and ping are supported.

  • You should use a new root file-system to avoid the script accessing your current file-system.

  • You should limit the quantity of the script and not allow too many scripts to run at the same time.

Before you begin:
  • You should have knowledge of some basic concepts of shell scripting, such as variables, if/else statements, and while loop.
To configure a health check script:
  1. Go to Shared Resources > Health Check.
  2. Click the Health Check Script tab.
  3. Configure the health check script, as described below.
    SettingsGuidelines

    Name

    Enter a unique name for the health check script.

    After you initially save the configuration, you cannot edit the name.

    Input

    Type or paste the script.

  4. Click Save.
  5. Go back to the Health Check tab. Create a new health check configuration and select one of the health check scripts you created.
Predefined Health Check Scripts

The following table describes the predefined health check scripts. You can get started with these or create custom scripts.

Predefined script Usage

CURL_HTTP_CODE

Uses curl to check the status of server

ICMP

Uses ping to check the status of server

PORT_STATUS

Uses nc to check status of a port on server.

Health Check Script programs and commands

The following table describes the predefined commands.

Predefined commands Usage

$NODE_IP

The IP address of real server.

$NODE_PORT

The port of the real server.

$UP:

Sets the status of health check to UP.

$DOWN:

Sets the status of health check to DOWN.

The following programs and commands can be used in the health check script:

• hostname

• ipcalc

• stty

• usleep

• busybox

• curl

• ed

• nmeter

• xargs

• tail

• basename

• dirname

• expr

• killall

• mkfif

• pwdx

• shred

• split

• traceroute6

• cat

• date

• egrep

• ifconfig

• iplink

• ln

• mktemp

• nameif

• ping6

• rm

• sleep

• true

• base64

• chmod

• dns domain name

• fgrep

• ip

• ls

• mount

• netstat

• printenv

• rmdir

• stat

• umount

• bash

• cp

• echo

• grep

• ipaddr

• kill

• mkdir

• mpstat

• pidof

• ps

• sed

• uniq

• uptime

• link

• mknod

• mv

• ping

• pwd

• slattach

• touch

• vconfig

• adduser

• arping

• fakeidentd

• inetd

• killall5

• nbd-client

• powertop

• pmap

• pstree

• iproute

• telnet

• seq

• sort

• sum

• test

• tr

• truncate

• unix2dos

• wc

• yes

• cmp

• dos2unix

• find

• lsof

• nc

• nslookup

• pgrep

• printf

• time

• traceroute

• tty

• unlink

• whoami

• awk

• diff

• du

• flock

• md5sum

• netcat

• passwd

• pkill

• pscan

• realpath

• smemcap

• ssl_client