Page 1 of 1
I/O Wait Checks
Posted: Tue Aug 24, 2021 3:29 am
by andyb4u
Hi,
I've been asked to find out how the command check_xi_nagiosxiserver using --mode=iowait calculates I/O wait and is this any different from how I/O wait is calculated by using check_nrpe with check_cpu_stats?
Re: I/O Wait Checks
Posted: Tue Aug 24, 2021 1:51 pm
by dchurch
check_xi_nagiosxiserver ultimately queries the recorded value in the database (xi_systat table).
IO Wait is collected on a delay and stored in a single record in the database that gets overwritten. How this is collected can be seen in
/usr/local/nagiosxi/cron/sysstat.php around line 232:
Code: Select all
/usr/bin/iostat -c 5 2 | grep -v '^ *$' | tail -1 | awk '{ print $1,$2,$3,$4,$5,$6 }'
This is then split into component parts, serialized and stored in the database.
check_nrpe with check_cpu_stats calls the script at /usr/local/nagios/libexec/check_cpu_stats.sh
This collects IO Wait data around line 118:
Code: Select all
Linux ) CPU_REPORT=`iostat -c 5 2 | tr -s ' ' ';' | sed '/^$/d' | tail -1`
CPU_USER=`echo $CPU_REPORT | cut -d ";" -f 2`
CPU_SYSTEM=`echo $CPU_REPORT | cut -d ";" -f 4`
CPU_IOWAIT=`echo $CPU_REPORT | cut -d ";" -f 5`
CPU_IDLE=`echo $CPU_REPORT | cut -d ";" -f 7`
Since NRPE isn't dependent on a database, the method of retrieval is necessarily different.