Written by

Principal Technology Architect at InterSystems
Article Murray Oldfield · 2 hr ago 3m read

Adding `nfsiostat` to SystemPerformance

Already included in SystemPerformance

There are nfs disk commands (including nfsiostat) included with SystemPerformance, but disabled by default. Enable them by running:

$$Enablenfs^SystemPerformance()

Doing so will add the following nfs commands, for example, on Linux:

  1. /usr/sbin/nfsstat -cn
  2. /usr/sbin/nfsiostat [interval] [count]

Ensure the commands are installed and runnable from the OS :)

This can be subsequently disabled via $$Disablenfs^SystemPerformance()


Adding a generic command to SystemPerformance

Adding an arbitrary OS tool creates a "user" command under ^IRIS.SystemPerformance("cmds","user")

For example:

%SYS>set ^IRIS.SystemPerformance("cmds","user",$i(^IRIS.SystemPerformance("cmds","user")))=$lb("nfsiostat","/usr/sbin/nfsiostat ","interval"," ","count"," > ")

Check the existing commands first

Before adding, it's worth seeing what's already there so you understand the existing structure and pick the right profile name:

zwrite ^IRIS.SystemPerformance("cmds")

Adding nfsiostat with date and time stamp to SystemPerformance

Use a script to make implementation easier.

The wrapper script

Save as /usr/local/bin/nfsiostat_ts.sh:

#!/bin/bash
# Usage: nfsiostat_ts.sh <interval> <count>
INTERVAL=${1:-5}
COUNT=${2:-12}

nfsiostat "$INTERVAL" "$COUNT" | awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; fflush() }'

Make it executable:

chmod +x /usr/local/bin/nfsiostat_ts.sh

Add to SystemPerformance

set ^IRIS.SystemPerformance("cmds","30mins",$i(^IRIS.SystemPerformance("cmds","30mins"))) = $lb("nfsiostat","/usr/local/bin/nfsiostat_ts.sh ","interval"," ","count","")

The $lb() structure now passes interval and count as $1 and $2 to the script, so the command executed becomes, for example:

/usr/local/bin/nfsiostat_ts.sh 1 1800

Verify it looks right

zwrite ^IRIS.SystemPerformance("cmds","30mins")

Test the script manually first

Before running a full profile, test with a short run:

/usr/local/bin/nfsiostat_ts.sh 5 3

Expected output:

2026-03-12 14:30:00 nfs-server:/export mounted on /data:
2026-03-12 14:30:00   op/s  rpc bklog
2026-03-12 14:30:00   19.40  0.00
2026-03-12 14:30:05 nfs-server:/export mounted on /data:
...

This way, the timestamps are embedded directly in the SystemPerformance HTML output for that section, and the interval/count always stay in sync with whichever profile is running.

NOTE: I have NOT added support for timestamp format to YASPE. But I will advise when I have.


Non-IRIS Servers

Running an enhanced nfsiostat from the command line

For example, for a web server with no IRIS installed. For example, a 24-hour run. So that it can be matched with mgstatand vmstat in SystemPerformance.

Update the wrapper script to include the date in the log filename

Rather than hardcoding the log path, pass it from cron so the date is captured at launch time:

#!/bin/bash
# Usage: nfsiostat_ts.sh <interval> <count>
INTERVAL=${1:-5}
COUNT=${2:-17268}

nfsiostat "$INTERVAL" "$COUNT" | awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; fflush() }'

The script stays clean — the log filename with date is handled by cron.

Cron entry

crontab -e

Add:

0 0 * * * /usr/local/bin/nfsiostat_ts.sh 5 17268 > /path/to/logs/nfsiostat_$(date +\%Y\%m\%d).log 2>&1

This runs at midnight every day and creates a log file named, for example:

nfsiostat_20260312.log

The \% escaping is required in cron — unescaped % characters are treated as newlines by cron.

Verify the cron job is scheduled

crontab -l

Check the log is being written after midnight

tail -f /path/to/logs/nfsiostat_$(date +%Y%m%d).log

Optional: log rotation

If this runs daily and you want to keep only the last 7 days of logs:

0 0 * * * /usr/local/bin/nfsiostat_ts.sh 5 17268 > /path/to/logs/nfsiostat_$(date +\%Y\%m\%d).log 2>&1
5 0 * * * find /path/to/logs -name "nfsiostat_*.log" -mtime +7 -delete

The cleanup job runs 5 minutes after midnight, after the new log file has been created.