Site /
NjmonManualPage
njmon(1) (njmon for AIX and VIOS) njmon(1)
NAME
njmon - save performance statistics in JSON format.
BRIEFLY
Performance statistics agent outputting in JSON format for
various Time-Series databases including InfluxDB. Default
is stdout to allow using a shell pipe to other commands.
The ninstall shell script puts njmon into /usr/lbin.
Version
Version: 69
SYNOPSIS
Core options
njmon -s seconds -c count [-m directory -f]
Other options
-a file -b -c count -C -d -D -e -h -k -K pidfile -L -V
-n -o -P -t percent -r -R -u -U -v -? -@
njmon specific options
-i hostname -p portno
DESCRIPTION
These are the njmon command options in alphabetical order.
-a file
Place the command arguments into a config file. Read
the command line arguments from a file (so no passwords
are seen in the ps command output). Use the same
arguments, all on the first line, space separated.
Only have the -a option on the actual command line.
-b Process stats switch off adding pid to the process
names: "ksh_76927" becomes "ksh".
-c count
Number of snapshots then stop (default forever).
-C Shared CPU/Processor Pool, you need to enable
performance data collection on the HMC.
-d Switch on debugging output
-D Skip dangerous libperfstat function that can cause
problems.
-e Switch on elastic (ELK) mode with sub-arrays instead of
Page 1 (printed 11/2/20)
njmon(1) (njmon for AIX and VIOS) njmon(1)
sub-JSON data structures for variable numers of
resources like filesystems, disks, networks etc.
-f file
Output to file (not stdout) to two files below:
Statistics: hostname_<year><month><day>_<hour><minutes>.json
Errors: hostname_<year><month><day>_<hour><minutes>.err
-h Output hints and help details and stop.
-i ip
-i hostname
IP Address or Hostname of the central njmond.py server.
-k If the file /tmp/njmon.pid is not found this njmon
continues running. If the file is found, the process
PID is read from it & if it is found that the process
is running then this njmon exits. If no process is
found running then this njmon continues running. This
allows you to try starting njmon say once an hour from
crontab. This will restart the njmon only if the
previous one stopped. njmon will remove the njmon.pid,
file when it stops normally.
-K pidfile
This is same as the -k option but the user decides the
directory and filename for the file containing the
Process Identity (PID). Also, you can run multiple
njmon processes, using different PID files. Some users
prefer to use a file in, for example, /var/logs but
that requires root access. Others prefer to avoid
/tmp.
-L Don't collect Logical Volume stats (takes extra CPU
cycles). If not the root user then these are silently
switched off.
-m directory
Program will change to the directory before creating
files.
-n No PID printed out at start up.
-o If using Oracle ASM raw disks have zero size, so use
bootinfo -s to find the size.
-p 8086
InfluxDB port. Port 8086 is the default (unless changed
in the InfluxDB config file).
Page 2 (printed 11/2/20)
njmon(1) (njmon for AIX and VIOS) njmon(1)
-P Switch on the collection of process statistics (Note:
these can be very large). Processes using less than
the threshold are ignored. See -t percent option.
-r Random pause at the start. Stops cron starting every
njmon in sync.
-R Reduced mode, don't collect CPU core thread: logical
CPUs like cpu_logical, physical, syscall stats nor
netbuffers.
-s seconds
Seconds between snapshots of data (default 60 seconds).
-t percent
Process CPU cut-off threshold percent. Default 0.001
-v Only available if njmon compiled with VIOS support.
This adds VIOS virtual disk and networks statistics.
-u Only available if njmon compiled with VIOS support.
This adds VIOS Shared Storage Pools (SSP) statistics.
-U Only available if njmon compiled with VIOS support.
This adds VIOS Shared Storage Pools (SSP) statistics
for each node.
-V Don't collect Volume Group stats (takes extra CPU
cycles). If not the root user then these are silently
switched off.
-? Same as the -h Help option.
-@ Output the full version information and stop. For
example: Version njmon4AIX-v69-@01/11/2020-AIX722
EXAMPLES
1 Simple use
Every minute (60 seconds), all day (1440 minutes),
njmond server hostname, default InfluxDB port (8181).
1 Syntax
njmon -s 60 -c 1440 -i centralbox -p 8181
2 Piping the JSON output in to a data handler
Every 1 minute (-c 60) all day (1440 minutes in a day),
InfluxDB server hostname influxbox, default InfluxDB
port (-p 8086) and username /password.
2 Syntax
Page 3 (printed 11/2/20)
njmon(1) (njmon for AIX and VIOS) njmon(1)
njmon -s 60 -c 1440 | myprog
3 Add prosses and remove LVM data
Add process statistics (-P) and remove LV + VG data (-
LV).
3 Syntax
njmon -s60 -c 1440 -PLV -i centralbox -p 8181
4 Every half minute
Collect statistics twice a minute (-s 30) and all day
(2880 half minutes in a day).
4 Syntax
njmon -s30 -c 2880 -i centralbox -p 8181
5 Add VIOS statistics
Adding VIOS extra statistics for virtual resources and
including SSP - requires njmon version with VIOS
compiled in.
5 Syntax
njmon -s30 -c 2880 -vuU -i centralbox -p 8181
6 Crontab
Crontab entry start at 4 minutes after midnight, save
data every 30 seconds for a day.
6 Syntax
4 0 * * * /usr/lbin/njmon -s30 -c 2880 -vuU -i
centralbox -p 8181 2>/dev/null
7 Crontab with kill option
Crontab entry starting hourly and checking if the
previous njmon is still running (if it is this njmon
stops itself). This uses a PID file called
/tmp/njmon.pid.
7 Syntax
0 * * * * /usr/lbin/njmon -s 60 -k -i centralbox -p
8181 2>/dev/null
8 Using a PID file
Naming a PID file so it is not in /tmp which might be
erased
Page 4 (printed 11/2/20)
njmon(1) (njmon for AIX and VIOS) njmon(1)
8 Syntax
0 * * * * /usr/lbin/njmon -s 60 -K /home/nag/njmon.pid
-i centralbox -p 8181 2>/den/null
9 Saving to a local file
Save the njmon data to take a file (-f). This file can
be loaded in to InfluxDB later with njmon2influx.py.
The two files will end .err and .influxlp (lp = Line
Protocol).
9 Syntax
njmon -s 10 -c 30 -f
10 Saving to a file and a specific directory
njmon moves to the directory /tmp before creating any
files. Save the njmon data to take a file (-f). This
can be loaded in to InfluxDB later.
10 Syntax
njmon -s 60 -c 1440 -m /tmp -f
11 Use ssh to start the njmonagent on a remote endpoint,
return the data over ssh and pipe to the InfluxDB
11 Syntax
0 * * * * /usr/bin/ssh /usr/lbin/njmon -s 15 -c 5760 |
/usr/lbin/njmon2influxturbo.py
12 Using a conf file
Using a configuration file to contain the njmon
arguments. This means the arguments are not seen in the
ps command output. Use the -a argument-file option.
12 Syntax
For example command line: /usr/lbin/njmon -a
/etc/njmon.conf
12 An example /etc/njmon.config file contains just the options:
-s 60 -c 1440 -i centralbox -p 8181
FILES
/usr/lbin/njmon
The executable command
Page 5 (printed 11/2/20)
njmon(1) (njmon for AIX and VIOS) njmon(1)
SEE ALSO
nimon(1) nimon is like njmon but outputs InfluxDB Line
Protocol data.
Online njmon Manual website
See
http://nmon.sourceforge.net/pmwiki.php?n=Site.NjmonManualPage
njmon Download Project website
From
http://nmon.sourceforge.net/pmwiki.php?n=Site.Njmon
AIXpert Blog Articles on nimon and njmon
https://ibm.biz/AIXpertBlog
perfstat Library website
This is the source of most of the statistics
documentation
https://www.ibm.com/support/knowledgecenter/ssw_aix_72/filesreference/libperfstat.h.html
AUTHOR
Nigel Griffiths nigelargriffiths@hotmail.com @mr_nmon
BUGS
None, of course. But just in case, please report issues to
the author by email.
