Name

nstwatchdog — A watchdog script implementation to reboot the NST system upon a test event failure (e.g., ping).

Synopsis

nstwatchdog [ -m TEXT | --mode TEXT ] [ -i DEVICE | --interface DEVICE ] [ -t HOSTNAME|IPv4ADDR|IPv6ADDR | --target-host HOSTNAME|IPv4ADDR|IPv6ADDR ] [ -s NUMBER | --sleep-interval NUMBER ] [ -f INTEGER | --max-failed-events INTEGER ] [ -q [true]|false | --quiet [true]|false ] [ -h [true]|false | --help [true]|false ] [ -H [true]|false | --help-long [true]|false ] [ -v [true]|false | --verbose [true]|false ] [ --version [true]|false ]

Description

The nstwatchdog script is used to reboot an NST system when a configured number of test events have failed. Currently, only a network ping test event has been implemented.

This script typically runs as a systemd service: "/usr/lib/systemd/system/nstwatchdog.service". One configures options for this service in file: "/etc/sysconfig/nstwatchdog".

Logs / Statistics

Since the nstwatchdog runs as a service, one can use the command: "journalctl -f --unit nstwatchdog.service" to monitor its operational behavior.

A statistcs file: "/var/nst/nstwatchdog/nstwatchdog.log" is also used to log various statistics on the operational behavior of nstwatchdog including start, stop, reboot information and failed test event counts. Sending a SIGUSR1 signal to the running systemd nstwatchdog service unit: "systemctl kill -s SIGUSR1 nstwatchdog.service" will also dump its current counters to the statistics file.

Options

The following command line options are available:

[-m TEXT] | [--mode TEXT]

This option specifies an operational nstwatchdog mode. Currently the following modes: 'ping' and 'stats' are supported. The 'ping' mode specifies a network ping test event configuration. If the "--target-host" can not be reached in "--failed-max-events" trys, then the NST system will be rebooted using the systemd command: '/usr/bin/systemctl reboot;'. The 'stats' mode will dump statistics of a running systemd instance of nstwatchdog to file: "/var/nst/nstwatchdog/nstwatchdog.log".

[-i DEVICE] | [--interface DEVICE]

Use this option to select a network interface to use with the ping command. This is an optional argument to be used with mode: "--mode ping".

[-t HOSTNAME|IPv4ADDR|IPv6ADDR] | [--target-host HOSTNAME|IPv4ADDR|IPv6ADDR]

Use this option to select the target host to ping with mode: "--mode ping". The target host can be either a "IPv4 / IPv6 Address" or a "Host Name". This option is required with mode: "--mode ping".

[-s NUMBER] | [--sleep-interval NUMBER]

This option is used to set the sleep interval between each test event. The value can be specified as a real number of seconds (e.g., 1.5 seconds). Default: 1.0 seconds.

[-f INTEGER] | [--max-failed-events INTEGER]

This option is used to set the maximum number of sequential failed test events to occur before the system is rebooted. Default: 30 sequential failures.

[-q [true]|false] | [--quiet [true]|false]

This option is used to bypass the actual rebooting of the system. It's intended use is for testing purposes only.

[-h [true]|false] | [--help [true]|false]

When this option is specified, nstwatchdog will display a short one line description of nstwatchdog, followed by a short description of each of the supported command line options. After displaying this information nstwatchdog will terminate.

[-H [true]|false] | [--help-long [true]|false]

This option will attempt to pull up additional nstwatchdog documentation within a text based web browser. You can force which browser we use setting the environment variable TEXTBROWSER, otherwise, we will search for some common ones.

[-v [true]|false] | [--verbose [true]|false]

When you set this option to true, nstwatchdog will produce additional output. This is typically used for diagnostic purposes to help track down when things go wrong.

[--version [true]|false]

If this option is specified, the version number of the script is displayed.

Files

/etc/sysconfig/nstwatchdog

The environment file containing command line options for the nstwatchdog script used by the systemd unit service file running this script.

/usr/lib/systemd/system/nstwatchdog.service

The systemd unit service file running this script.

/var/nst/nstwatchdog/nstwatchdog.log

A statistics log file generated by the nstwatchdog script.

Environment

TEXTBROWSER

This controls what text based browser is used to display help information about the script. If not set, we will search your system for available text-based browsers (Ex: elinks, lynx ...).

See Also

nstnewscript(1), Network Security Toolkit