What is xsysstats?
xsysstats
is a rpc.rstatd
client which graphically displays near real time performance statistics of the running unix kernel. The following statistics are available:
- cpu
- packets
- ipackets (packets in)
- opackets (packets out)
- pagei (page in)
- pageo (page out)
- apagei (average page in per second)
- apageo (average page out per second)
- swap
- swapi (swap in)
- swapo (swap out)
- interrupts
- disk
- context
- load1 (1 minute)
- load5 (5 minute)
- load15 (15 minute)
- collisions
- errors
These statistics are collected and served out by the rpc.rstatd
daemon.
What is rpc.rstatd?
rpc.rstatd
is a remote procedure call (RPC) daemon which runs on the UNIX/Linux server and collects kernel statistics to hand off to a client.
rpc.rstatd installation
Installing the software is very OS specific. Table below shows what package contains rpc.rstatd
:
OS Package Notes Solaris 8 SUNWcsu Base OS Package Solaris 9 and 10 SUNWrcmds FreeBSD Part of the base OS RedHat/Fedora/CentOS rusers-server
FreeBSD & Solaris 8/9
Once you have the software installed, rpc.rstatd
is usually started through inetd
. Edit the /etc/inetd.conf
(or /etc/inet/inetd.conf
on Solaris), look for a line similar to the line below and enable it (the FreeBSD version is here):
rstatd/1-3 dgram rpc/udp wait root /usr/libexec/rpc.rstatd rpc.rstatd
After the file has been updated, send a HUP signal to the inetd
process:
pkill -HUP inetd
Solaris 10
Edit the inetd.conf
file as in the Solaris 8/9 case but Instead of HUPing the inetd
daemon, run the following:
inetdconv svcadm enable svc:/network/rstatd_2-4/rpc_datagram_v:default
The inetdconv
command will create a SMF service entry.
RedHat/Fedora/CentOS
To enable rpc.rstatd
run the following:
chkconfig rstatd on
No need to edit any configuration files.
Verify installation
To verify a correct rpc.rstatd
installation on all platforms, run rpcinfo -p
command on the server. You should see lines similar this (the port number will be different):
program vers proto port ... 100001 1 udp 61194 rstatd 100001 2 udp 61194 rstatd 100001 3 udp 61194 rstatd
rpc.rstatd security
rpc.rstatd
does not provide any authentication or authorization mechanisms to get to the kernel data. Furthermore, since it is not widely used, there probably exists buffer overflow bugs in code. It is my recommendation that you use a host based firewall and tcp_wrappers
to limit which clients can connect to the port. If you can, limit connections to localhost
.
You may ask yourself: why am I recommending tcp_wrappers
for a UDP based service? RedHat/Fedora/CentOS have added tcp_wrappers
support to rpc.rstatd
. For Solaris and FreeBSD, it is not available.
Since rpc.rstatd
requires the use of rpcbind
, you need to secure rpcbind
. Any client who is going to talk to rpc.rstatd
server will also need to talk to rpcbind
, so add the client to the rpcbind
access list.
Installing xsysstats
FreeBSD ports collection contains xsysstats
, RedHat/Fedora/CentOS fetch the RPM from https://repo.tusk.tufts.edu/extras/ Yum repository, source RPM here.
Using xsysstats
Now we have the server setup and the client installed, we can start using it. If you type xsysstats
, here is the help screen:
XSysStats 1.51 Usage: -allnames Display names of all hosts, even localhost -background color background color -baseline color draw baseline of color 'color' -border number spacing between graphs and window edges -color color color of last graph specified by -type -defcolor graphtype color Sets default color for all types of graphtype -display displayname X server to contact -foreground color foreground color -geometry geom size (in pixels) and position -hidelabels do not display labels at bottom of graph. -hidehosts do not add hostnames to labels. -host string machine to report statistics on -link graph link scale of last graph to graph specified. For graphs on remote hosts, use graph@host from. -min number minimum scale of last graph specified by -type -max number maximum scale of last graph specified by -type -name string Set the X application resource name -ruler number draw a ruler below the baseline, with time markings every 'number' seconds. -samescale Synchronize scales of similar graphs -sample number how many seconds between each update -scale number draw dotted horizontal lines of the last graph at value specified. -showmax show running maximum value -solid Draw a solid graph. -split WxH Split the window into W width and H height sections. -title string Set the window manager title -type string type of graph to display: Choices of cpu, packets, pagei, swap, interrupts, disk, context, load, collisions, errors, ipackets, opackets, apagei, apageo, pageo. -window number Window number to plot graph in. -wtitle name Sets the default short subwindow name.
This is very ugly, so I wrote xsysstats_wrapper
to automate my favorite options. To get the graph at the top of the page you run this:
xsysstats_wrapper -I
If you were to create the same graph using xsysstats
itself, the command would look like this:
xsysstats -background white -baseline blue -title "Remote status of localhost" -split 7x1 -geometry 840x120-0+0 -type cpu@localhost -color DarkRed -type load1@localhost -color DarkOrange -type disk@localhost -color DarkGreen -type packets@localhost -color GoldenRod -type swap@localhost -color black -type pagei@localhost -color purple -type interrupts@localhost -color brown
The xsysstats_wrapper
script requires the use of another helper script, getresolution
. This example assumes you just want to monitor your local workstation. What if you want to monitor other servers? As long as they are set up and your workstation is allowed to get to the rpc.rstatd
UDP port, you would run this:
xsysstats_wrapper -I localhost server1
And you will be monitoring your both server1 and your workstation. xsysstats_wrapper
supports the following options:
Usage: xsysstats_wrapper [-bhIpvn] [-c cols] [-s size] [host ...] -b Black and white screen (default to autodetect) -c columns How many columns across (default is 1 host set) -h This help screen -I Invert the color pallet -n Do not execute the command (useful with -v) -p Portrait mode (default is landscape) -s size Size of each square (default is X / 16) -T Title Window Title (default is "Remote status of ...") -v Verbose, print out the command line host If not specified, then use localhost
1 comment for “xsysstats and rpc.rstatd”