• daemon - execute xsysguardd processes

  • env - get environment variables

  • exec - execute processes and read from their stdout

  • file - read regular files

  • inostat - get file status using inotify

  • inotail - tail files in follow mode (tail -F) using inotify

  • iw - libiw (wireless extension library)

  • lstat - get symbolic link status

  • number - get a fixed number

  • random - random number generator

  • sensors - libsensors (lm-sensors - Linux hardware monitoring)

  • stat - get file status

  • statgrab - libstatgrab (get system statistics)

  • string - get a fixed string

  • tail - tail files in follow mode (tail -F)

  • tick - get current tick

  • time - date and time functions

  • uname - get name and information about current kernel

Return types
N returns a number
S returns a string
X returns both

daemon - execute xsysguardd processes

The daemon module will read from stdout and write to stdin of a child process (xsysguardd).

A common use is to forward stdin and stdout over a ssh connection using public key authentication.

N daemon:<command>:number:<rpn>
S daemon:<command>:string:<rpn>
command command executed by /bin/sh -c
rpn a string containing a remote RPN expression

Environment variables

XSYSGUARD_DAEMON_TIMEOUT timeout in ticks until the daemon process will be restarted (default: 16)
XSYSGUARD_DAEMON_MAXBUFLEN maximum buffer length for received strings and log messages (default: 262144)

Example

SetEnv "XSYSGUARD_DAEMON_TIMEOUT"       16
SetEnv "XSYSGUARD_DAEMON_MAXBUFLEN"     262144

SetEnv "localhost" "xsysguardd" Overwrite
SetEnv "remotehost" "ssh login@server xsysguardd" Overwrite

+ daemon:${localhost}:str:"uname:nodename"
+ daemon:${remotehost}:str:"uname:nodename"
+ daemon:${remotehost}:num:"statgrab:network_io_stats:eth0:tx,1024,DIV"
+ daemon:${remotehost}:num:"statgrab:network_io_stats:eth0:rx,1024,DIV"

env - get environment variables

S env:<name>:read:all
S env:<name>:read:scanf:string:<format>
N env:<name>:read:scanf:number:<format>
N env:<name>:read:scanf:counter:<format>
S env:<name>:read:grep:<pattern>:<index>
S env:<name>:read:igrep:<pattern>:<index>
S env:<name>:readline:<number>:all
S env:<name>:readline:<number>:scanf:string:<format>
N env:<name>:readline:<number>:scanf:number:<format>
N env:<name>:readline:<number>:scanf:counter:<format>
S env:<name>:readline:<number>:grep:<pattern>:<index>
S env:<name>:readline:<number>:igrep:<pattern>:<index>
name environment variable name
format a scanf(3) format string
pattern a regex(7) extended regular expression
index a negative number (matching line/buffer), zero (matching string) or a positive number (matching substring index)
number zero (each line) or a positive number (line number number)

exec - execute processes and read from their stdout

S exec:<command>:read:all
S exec:<command>:read:scanf:string:<format>
N exec:<command>:read:scanf:number:<format>
N exec:<command>:read:scanf:counter:<format>
S exec:<command>:read:grep:<pattern>:<index>
S exec:<command>:read:igrep:<pattern>:<index>
S exec:<command>:readline:<number>:all
S exec:<command>:readline:<number>:scanf:string:<format>
N exec:<command>:readline:<number>:scanf:number:<format>
N exec:<command>:readline:<number>:scanf:counter:<format>
S exec:<command>:readline:<number>:grep:<pattern>:<index>
S exec:<command>:readline:<number>:igrep:<pattern>:<index>
command command executed by /bin/sh -c
format a scanf(3) format string
pattern a regex(7) extended regular expression
index a negative number (matching line/buffer), zero (matching string) or a positive number (matching substring index)
number zero (each line) or a positive number (line number number)

Example

+ exec:"ping localhost":readline:0:all

file - read regular files

S file:<filename>:read:all
S file:<filename>:read:scanf:string:<format>
N file:<filename>:read:scanf:number:<format>
N file:<filename>:read:scanf:counter:<format>
S file:<filename>:read:grep:<pattern>:<index>
S file:<filename>:read:igrep:<pattern>:<index>
S file:<filename>:readline:<number>:all
S file:<filename>:readline:<number>:scanf:string:<format>
N file:<filename>:readline:<number>:scanf:number:<format>
N file:<filename>:readline:<number>:scanf:counter:<format>
S file:<filename>:readline:<number>:grep:<pattern>:<index>
S file:<filename>:readline:<number>:igrep:<pattern>:<index>
format a scanf(3) format string
pattern a regex(7) extended regular expression
index a negative number (matching line/buffer), zero (matching string) or a positive number (matching substring index)
number zero (each line) or a positive number (line number number)

Example

SetEnv "user"   "cpu %d"                Overwrite
SetEnv "nice"   "cpu %*d %d"            Overwrite
SetEnv "system" "cpu %*d %*d %d"        Overwrite
SetEnv "idle"   "cpu %*d %*d %*d %d"    Overwrite

+ file:/proc/stat:readline:1:scanf:counter:${user}
+ file:/proc/stat:readline:1:scanf:counter:${nice}
+ file:/proc/stat:readline:1:scanf:counter:${system}
+ file:/proc/stat:readline:1:scanf:counter:${idle}

inostat - get file status using inotify

N inostat:<filename>:dev
N inostat:<filename>:ino
N inostat:<filename>:mode
N inostat:<filename>:nlink
N inostat:<filename>:uid
N inostat:<filename>:gid
N inostat:<filename>:rdev
N inostat:<filename>:size
N inostat:<filename>:blksize
N inostat:<filename>:blocks
N inostat:<filename>:atime
N inostat:<filename>:mtime
N inostat:<filename>:ctime
N inostat:<filename>:isreg
N inostat:<filename>:isdir
N inostat:<filename>:ischr
N inostat:<filename>:isblk
N inostat:<filename>:isfifo
N inostat:<filename>:islnk
N inostat:<filename>:issock
N inostat:<filename>:isuid
N inostat:<filename>:isgid
N inostat:<filename>:isvtx
N inostat:<filename>:irusr
N inostat:<filename>:iwusr
N inostat:<filename>:ixusr
N inostat:<filename>:irgrp
N inostat:<filename>:iwgrp
N inostat:<filename>:ixgrp
N inostat:<filename>:iroth
N inostat:<filename>:iwoth
N inostat:<filename>:ixoth

inotail - tail files in follow mode (tail -F) using inotify

Inotail module is a replacement for the tail module. It makes use of the inotify infrastructure in recent versions of the Linux kernel to speed up tailing files. Standard tail module polls the file every tick while inotail module listens to special events sent by the kernel through the inotify API to determine whether a file needs to be reread.

Inotail module will not work on systems running a kernel without inotify. To enable inotify, please set CONFIG_INOTIFY=y in your Linux kernel configuration and recompile it.

S inotail:<filename>:read:all
S inotail:<filename>:read:scanf:string:<format>
N inotail:<filename>:read:scanf:number:<format>
N inotail:<filename>:read:scanf:counter:<format>
S inotail:<filename>:read:grep:<pattern>:<index>
S inotail:<filename>:read:igrep:<pattern>:<index>
S inotail:<filename>:readline:<number>:all
S inotail:<filename>:readline:<number>:scanf:string:<format>
N inotail:<filename>:readline:<number>:scanf:number:<format>
N inotail:<filename>:readline:<number>:scanf:counter:<format>
S inotail:<filename>:readline:<number>:grep:<pattern>:<index>
S inotail:<filename>:readline:<number>:igrep:<pattern>:<index>
format a scanf(3) format string
pattern a regex(7) extended regular expression
index a negative number (matching line/buffer), zero (matching string) or a positive number (matching substring index)
number zero (each line) or a positive number (line number number)

iw - libiw (wireless extension library)

Library Homepage

S iw:<interface>:config:name
N iw:<interface>:config:nwid
X iw:<interface>:config:freq
N iw:<interface>:config:channel
S iw:<interface>:config:key
N iw:<interface>:config:keyid
S iw:<interface>:config:essid
X iw:<interface>:config:mode
N iw:<interface>:info:sensitivity
S iw:<interface>:info:nickname
S iw:<interface>:info:access_point
X iw:<interface>:info:bitrate
X iw:<interface>:info:rts
X iw:<interface>:info:fragment
S iw:<interface>:info:power_management
N iw:<interface>:info:txpower:dbm
N iw:<interface>:info:txpower:mw
S iw:<interface>:info:retry
N iw:<interface>:stats:quality:quality
N iw:<interface>:stats:quality:signal
N iw:<interface>:stats:quality:noise
N iw:<interface>:stats:discarded:nwid
N iw:<interface>:stats:discarded:code
N iw:<interface>:stats:discarded:fragment
N iw:<interface>:stats:discarded:retries
N iw:<interface>:stats:discarded:misc
N iw:<interface>:stats:missed:beacon
N iw:<interface>:range:sensitivity
N iw:<interface>:range:max_quality:quality

ModuleEnv variables

IW_INTERFACE0, IW_INTERFACE1, …

Example

+ iw:*:stats:quality:quality,iw:*:range:max_quality:quality,DIV,100,MUL
+ iw:*:config:essid

lstat - get symbolic link status

N lstat:<filename>:dev
N lstat:<filename>:ino
N lstat:<filename>:mode
N lstat:<filename>:nlink
N lstat:<filename>:uid
N lstat:<filename>:gid
N lstat:<filename>:rdev
N lstat:<filename>:size
N lstat:<filename>:blksize
N lstat:<filename>:blocks
N lstat:<filename>:atime
N lstat:<filename>:mtime
N lstat:<filename>:ctime
N lstat:<filename>:isreg
N lstat:<filename>:isdir
N lstat:<filename>:ischr
N lstat:<filename>:isblk
N lstat:<filename>:isfifo
N lstat:<filename>:islnk
N lstat:<filename>:issock
N lstat:<filename>:isuid
N lstat:<filename>:isgid
N lstat:<filename>:isvtx
N lstat:<filename>:irusr
N lstat:<filename>:iwusr
N lstat:<filename>:ixusr
N lstat:<filename>:irgrp
N lstat:<filename>:iwgrp
N lstat:<filename>:ixgrp
N lstat:<filename>:iroth
N lstat:<filename>:iwoth
N lstat:<filename>:ixoth

number - get a fixed number

N number:<number>

random - random number generator

N random

sensors - libsensors (lm-sensors - Linux hardware monitoring)

Library Homepage

N sensors:<chip>:<sensor>
chip sensors chip name or *
sensor e.g. temp1, temp2, temp3, fan1, fan2, fan3, …

ModuleEnv variables

SENSORS_CHIP0, SENSORS_CHIP1, …

stat - get file status

N stat:<filename>:dev
N stat:<filename>:ino
N stat:<filename>:mode
N stat:<filename>:nlink
N stat:<filename>:uid
N stat:<filename>:gid
N stat:<filename>:rdev
N stat:<filename>:size
N stat:<filename>:blksize
N stat:<filename>:blocks
N stat:<filename>:atime
N stat:<filename>:mtime
N stat:<filename>:ctime
N stat:<filename>:isreg
N stat:<filename>:isdir
N stat:<filename>:ischr
N stat:<filename>:isblk
N stat:<filename>:isfifo
N stat:<filename>:islnk
N stat:<filename>:issock
N stat:<filename>:isuid
N stat:<filename>:isgid
N stat:<filename>:isvtx
N stat:<filename>:irusr
N stat:<filename>:iwusr
N stat:<filename>:ixusr
N stat:<filename>:irgrp
N stat:<filename>:iwgrp
N stat:<filename>:ixgrp
N stat:<filename>:iroth
N stat:<filename>:iwoth
N stat:<filename>:ixoth

statgrab - libstatgrab (get system statistics)

Library Homepage

Get general operating system statistics

sg_get_host_info(3)

S statgrab:host_info:os_name
S statgrab:host_info:os_release
S statgrab:host_info:os_version
S statgrab:host_info:platform
S statgrab:host_info:hostname
N statgrab:host_info:uptime
os_name the operating system name (e.g. SunOS or Linux)
os_release the operating system release (e.g. 5.8 or 5.9 or Solaris)
os_version the version level of the OS
platform the hardware platform (architecture) the OS runs on
hostname the name of the machine
uptime the uptime of the machine in seconds

Get cpu usage

sg_get_cpu_stats(3)

N statgrab:cpu_stats:user
N statgrab:cpu_stats:kernel
N statgrab:cpu_stats:idle
N statgrab:cpu_stats:iowait
N statgrab:cpu_stats:swap
N statgrab:cpu_stats:nice
N statgrab:cpu_stats:total

N statgrab:cpu_stats_diff:user
N statgrab:cpu_stats_diff:kernel
N statgrab:cpu_stats_diff:idle
N statgrab:cpu_stats_diff:iowait
N statgrab:cpu_stats_diff:swap
N statgrab:cpu_stats_diff:nice
N statgrab:cpu_stats_diff:total

N statgrab:cpu_percents:user
N statgrab:cpu_percents:kernel
N statgrab:cpu_percents:idle
N statgrab:cpu_percents:iowait
N statgrab:cpu_percents:swap
N statgrab:cpu_percents:nice

Avoid statgrab:cpu_percents:* on linux/unix systems. Instead:

+ statgrab:cpu_stats_diff:user,statgrab:cpu_stats_diff:total,DIV,100,MUL

Get VM statistics

sg_get_mem_stats(3)

N statgrab:mem_stats:total
N statgrab:mem_stats:free
N statgrab:mem_stats:used
N statgrab:mem_stats:cache

N statgrab:swap_stats:total
N statgrab:swap_stats:used
N statgrab:swap_stats:free

Get system load

sg_get_load_stats(3)

N statgrab:load_stats:min1
N statgrab:load_stats:min5
N statgrab:load_stats:min15

Get the current logged in users

sg_get_user_stats(3)

S statgrab:user_stats:name_list
N statgrab:user_stats:num_entries
name_list a space separated list of the currently logged in users
num_entries the number of users currently logged in

Get filesystem statistics

sg_get_fs_stats(3)

S statgrab:fs_stats:<device_name|mnt_point>:device_name
S statgrab:fs_stats:<device_name|mnt_point>:fs_type
S statgrab:fs_stats:<device_name|mnt_point>:mnt_point
N statgrab:fs_stats:<device_name|mnt_point>:size
N statgrab:fs_stats:<device_name|mnt_point>:used
N statgrab:fs_stats:<device_name|mnt_point>:avail
N statgrab:fs_stats:<device_name|mnt_point>:total_inodes
N statgrab:fs_stats:<device_name|mnt_point>:used_inodes
N statgrab:fs_stats:<device_name|mnt_point>:free_inodes
N statgrab:fs_stats:<device_name|mnt_point>:avail_inodes
N statgrab:fs_stats:<device_name|mnt_point>:io_size
N statgrab:fs_stats:<device_name|mnt_point>:block_size
N statgrab:fs_stats:<device_name|mnt_point>:total_blocks
N statgrab:fs_stats:<device_name|mnt_point>:free_blocks
N statgrab:fs_stats:<device_name|mnt_point>:used_blocks
N statgrab:fs_stats:<device_name|mnt_point>:avail_blocks
device_name the name known to the operating system (eg. on linux it might be hda)
fs_type the type of the filesystem
mnt_point the mount point of the file system
size the size, in bytes, of the file system
used the amount of space, in bytes, used on the filesystem
avail the amount of space, in bytes, available on the filesystem
total_inodes the total number of inodes in the filesystem
used_inodes the number of used inodes in the filesystem
free_inodes the number of free inodes in the filesystem
avail_inodes the number of free inodes available to non-privileged processes
io_size a suggested optimal block size for IO operations
block_size how big blocks actually are on the underlying filesystem
total_blocks the total number of blocks in the filesystem
free_blocks the number of free blocks in the filesystem
used_blocks the number of used blocks in the filesystem
avail_blocks the number of free blocks available to non-privileged processes

Get disk io statistics

sg_get_disk_io_stats(3)

N statgrab:disk_io_stats:<disk_name>:read_bytes
N statgrab:disk_io_stats:<disk_name>:write_bytes

N statgrab:disk_io_stats_diff:<disk_name>:read_bytes
N statgrab:disk_io_stats_diff:<disk_name>:write_bytes

Get network statistics

sg_get_network_io_stats(3)

N statgrab:network_io_stats:<interface_name>:tx
N statgrab:network_io_stats:<interface_name>:rx
N statgrab:network_io_stats:<interface_name>:ipackets
N statgrab:network_io_stats:<interface_name>:opackets
N statgrab:network_io_stats:<interface_name>:ierrors
N statgrab:network_io_stats:<interface_name>:oerrors
N statgrab:network_io_stats:<interface_name>:collisions

N statgrab:network_io_stats_diff:<interface_name>:tx
N statgrab:network_io_stats_diff:<interface_name>:rx
N statgrab:network_io_stats_diff:<interface_name>:ipackets
N statgrab:network_io_stats_diff:<interface_name>:opackets
N statgrab:network_io_stats_diff:<interface_name>:ierrors
N statgrab:network_io_stats_diff:<interface_name>:oerrors
N statgrab:network_io_stats_diff:<interface_name>:collisions
interface_name the name known to the operating system (eg. on linux it might be eth0)
tx the number of bytes transmitted
rx the number of bytes received
ipackets the number of packets received
opackets the number of packets transmitted
ierrors the number of receive errors
oerrors the number of transmit errors
collisions the number of collisions

Get network interface statistics

sg_get_network_iface_stats(3)

N statgrab:network_iface_stats:<interface_name>:speed
X statgrab:network_iface_stats:<interface_name>:duplex:<full>:<half>:<unknown>

Get paging statistics

sg_get_page_stats(3)

N statgrab:page_stats:pages_pagein
N statgrab:page_stats:pages_pageout

N statgrab:page_stats_diff:pages_pagein
N statgrab:page_stats_diff:pages_pageout

Get process statistics

sg_get_process_stats(3)

S statgrab:process_stats:process_name:<sortby>:{ascending|descending}:<number>
S statgrab:process_stats:proctitle:<sortby>:{ascending|descending}:<number>
N statgrab:process_stats:pid:<sortby>:{ascending|descending}:<number>
N statgrab:process_stats:parent:<sortby>:{ascending|descending}:<number>
N statgrab:process_stats:pgid:<sortby>:{ascending|descending}:<number>
N statgrab:process_stats:uid:<sortby>:{ascending|descending}:<number>
N statgrab:process_stats:euid:<sortby>:{ascending|descending}:<number>
N statgrab:process_stats:gid:<sortby>:{ascending|descending}:<number>
N statgrab:process_stats:egid:<sortby>:{ascending|descending}:<number>
N statgrab:process_stats:proc_size:<sortby>:{ascending|descending}:<number>
N statgrab:process_stats:proc_resident:<sortby>:{ascending|descending}:<number>
N statgrab:process_stats:time_spent:<sortby>:{ascending|descending}:<number>
N statgrab:process_stats:cpu_percent:<sortby>:{ascending|descending}:<number>
N statgrab:process_stats:nice:<sortby>:{ascending|descending}:<number>
X statgrab:process_stats:state:<sortby>:{ascending|descending}:<number>:<running>:<sleeping>:<stopped>:<zombie>:<unknown>

N statgrab:process_count:total
N statgrab:process_count:running
N statgrab:process_count:sleeping
N statgrab:process_count:stopped
N statgrab:process_count:zombie
sortby one of name, pid, uid, gid, size, res, cpu or time
process_name the name of the command that was run
proctitle the command line of the process; take note - this can be modified by the process, so isn't guaranteed to be the original command line
pid the process ID
parent the parent process ID
pgid the process ID of the process group leader
uid the UID the process is running as
euid the effective UID the process is running as
gid the GID the process is running as
egid the effective GID the process is running as
proc_size the size of the process in bytes
proc_resident the size of the process that's resident in memory
time_spent the number of seconds the process has been running
cpu_percent the current percentage of CPU the process is using
nice the nice value of the process
state the current state of the process

ModuleEnv variables

STATGRAB_DEVICE0, STATGRAB_DEVICE1, …

STATGRAB_MNTPOINT0, STATGRAB_MNTPOINT1, …

STATGRAB_DISK0, STATGRAB_DISK1, …

STATGRAB_INTERFACE0, STATGRAB_INTERFACE1, …

string - get a fixed string

S string:<string>

tail - tail files in follow mode (tail -F)

Poll files every tick.

See also: inotail

S tail:<filename>:read:all
S tail:<filename>:read:scanf:string:<format>
N tail:<filename>:read:scanf:number:<format>
N tail:<filename>:read:scanf:counter:<format>
S tail:<filename>:read:grep:<pattern>:<index>
S tail:<filename>:read:igrep:<pattern>:<index>
S tail:<filename>:readline:<number>:all
S tail:<filename>:readline:<number>:scanf:string:<format>
N tail:<filename>:readline:<number>:scanf:number:<format>
N tail:<filename>:readline:<number>:scanf:counter:<format>
S tail:<filename>:readline:<number>:grep:<pattern>:<index>
S tail:<filename>:readline:<number>:igrep:<pattern>:<index>
format a scanf(3) format string
pattern a regex(7) extended regular expression
index a negative number (matching line/buffer), zero (matching string) or a positive number (matching substring index)
number zero (each line) or a positive number (line number number)

tick - get current tick

N tick

time - date and time functions

S time:{gm|local}:strftime:<timeformat>

N time:{gm|local}:sec
N time:{gm|local}:usec

N time:{gm|local}:tm_sec
N time:{gm|local}:tm_min
N time:{gm|local}:tm_hour
N time:{gm|local}:tm_mday
N time:{gm|local}:tm_mon
N time:{gm|local}:tm_year
N time:{gm|local}:tm_wday
N time:{gm|local}:tm_yday
N time:{gm|local}:tm_isdst

Select timezone:

gm Coordinated Universal Time (UTC)
local time relative to the user's specified time zone

Format date and time:

strftime format date and time according to the format specification timeformat; for conversion details see strftime(3)

The number of seconds and microseconds since 00:00:00, January 1, 1970:

sec seconds
usec microseconds

Broken-down time representation:

tm_sec the number of seconds after the minute, normally in the range 0 to 59, but can be up to 60 to allow for leap seconds
tm_min the number of minutes after the hour, in the range 0 to 59
tm_hour the number of hours past midnight, in the range 0 to 23
tm_mday the day of the month, in the range 1 to 31
tm_mon the number of months since January, in the range 0 to 11
tm_year the number of years since 1900
tm_wday the number of days since Sunday, in the range 0 to 6
tm_yday the number of days since January 1, in the range 0 to 365
tm_isdst a flag that indicates wheter daylight saving time is in effect at the time described; the value is positive if daylight saving time is in effect, zero if it is not, and negative if the information is not available

Example

+ time:local:strftime:"%a %b %e / %H:%M:%S"

uname - get name and information about current kernel

S uname:sysname
S uname:nodename
S uname:release
S uname:version
S uname:machine