Site /
Njmon4LinuxCommandLine
+njmon for Linux Command Line and njmon -? output version 92
./njmon_v92: help information. Version:njmon4_v92.c (Jan 5 2026)
- Performance stats collector outputting JSON or Influx Line Protocol format.
- If the command starts with njmon it runs in NJMON mode
- If the command starts with nimon it runs in NIJMON mode
- -J forces NJMON mode regardless of the command name. Must be the 1st option.
- -I forces NIMON mode regardless of the command name. Must be the 1st option.
- Note:njmon & nimon data are exactly the same, so use one database.
- Default is stdout
- Core syntax : ./njmon_Ubuntu24_x86_64_v92 -s seconds -c count
- File output : -m directory -f
- Check & restart: -k and -K filename
- Data options: -A alias -H -P -PP -t % -b -d -D -F -n -r -R -W
- Argument file: -a file (do not include the command name)
- NJMON Network connection: -i njmond_host -p port
- NIMON Network connection: -i InfluxDB_host -p port
NIMON InfluxDB Details : -x database [-y username [-x password]]
NIMON InfluxDB 2+ : -x bucket -O Org -T <token>
NIMON Prometheus/telegraf mode: -w
skips HTTP REST API data (POST, content, length) in the NIMON output stream.
Good when using telegraf and/or Prometheus
-! : Output Version details & immediate exit
-? or -h : This help information
-a file : Command line arguments are in the file (hides passwords). Do not include the command name
> Use the same arguments, all on the first line, space separated
> Only have the -a option on the actual command line
-A alias : User-defined alias hostname to work around crazy duplicate hostnames
-b : Switch off adding pid to the process names: "ksh_76927" -> "ksh"
-B : Switch on Better Filesystem stats (BTRFS). data from /proc/diskstats) popular with SAP
-c count : number of snapshots (default forever)
-d : Switch on debug tracing (output no longer JSON/line protocol format)
-D : Add diskstats measurement includes all devices in /proc/diskstats
-e : elastic/elasticSearch alternative JSON format, measurement subsection uses array format "[" & "]"
-f : Output to file (not stdout) to two files below
> NJMON mode output file: hostname_<year><month><day>_<hour><minutes>.json
> NIMON mode output file: hostname_<year><month><day>_<hour><minutes>.influxlp
> Errors file: hostname_<year><month><day>_<hour><minutes>.err
-ff : NJMON mode - "-ff" or "-f -f" places each JSON record in a different file & adds a sequence number to the filename.
-ff : NIMON mode - "-ff" or "-f -f" see the preferred option -S
-F : Switch off filesystem stats (autofs and tmpfs can cause issues)
-H : NIMON mode - Force host tag to be a Fully Qualified Domain Name
-I : Force to NIMON mode. Saving InfluxDB Line Protocol data or telegraf
-J : Force to NJMON mode. Saving JSON format file or using njmond.py or other Time-Series (elastic, Splunk)
-k : NIMON mode - Read /tmp/nimon.pid for a running nimon PID
-k : NJMON mode - Read /tmp/njmon.pid for a running njmon PID
> If that PID is still running, then this new process exits quietly
> Good for using cron to restart njmon/nimon in case of a reboot or crash
-K filename : User-defined pid filename (implies -k). Allows not using /tmp
> Allows multiple concurrent data captures
> If using root user, suggest /etc/njmon.conf or /etc/nimon.conf
-m directory : Program will cd to the directory before output
-M : Filesystems listed by mount point (like AIX njmon) and not filesystem name
-n : No PID printed out at startup.
-o : Experimental light-weight "Only Processes" mode.
-p : Network port number of the remote server
-P : Add process stats (takes more CPU cycles and enlarges volume of data)
-P or -PP : A 2nd -P or -PP adds capturing command line arguments
: Default max 256 characters from /proc/PID/cmdline. For kernel processes=command name
: Or set NJMON_ARGS_MAX shell variable 16 to 16384 before starting njmon/nimon
-r : Random start pause. Stops cron from making every program send data in sync
-R : Reduced stats - skip logical CPU stats for SMT threads.
-s seconds : seconds between snapshots of data (default 60 seconds)
-S : NIMON mode appends a Line Protocol timestamp to the end of every line
: When saving to a file, the data can be added to InfluxDB later.
: Not needed if sending to InfluxDB (it adds timestamps itself).
: Might help other databases like VictoriaMetrics.
-t percent : Set ignore process CPU use percentage threshold (default 0.01%)
-W : Switch off warning messages in the error output stream
--- NIMON mode options ---
-q more_tags : Add additional static tags for useful information, NIMON only
> For example: nimon ... -q dept=foobar,site=42,rack=6,app=XXX
> Up to 250 characters, no spaces, comma-separated.
> Good for filtering, diags etc. Follow InfluxDB tag rules, see docs.
- Sent data to InfluxDB (all of these are important for InfluxDB):
-i hostname : Hostname or IP address of the InfluxDB server
-p port : InfluxDB port (default is 8086)
-x njmon : InfluxDB database name created with influx > create database njmon. (default is njmon)
-y user : Mandatory InfluxDB username - if you have set a username for the API (otherwise ignored)
-z pass : Mandatory InfluxDB password - if you have set a password for the API (otherwise ignored)
-w : For output to Telegraf. Don't send POST, message type or packet size
-v : Show data + response to InfluxDB on stderr
Currently, SSL certificates are not implemented
REST API Prefix: Set shell variable NJMON_INFLUX_API_PREFIX before starting nimon.
: This string is added before the REST API "/write" command.
: Example: export NJMON_INFLUX_API_PREFIX=/ABC/def then start nimon
: And "POST /write?db..." becomes "POST /ABC/def/write?db..."
: Requested by VictoriaMetrics users using proxy servers.
Serial Number: If njmon can't find a serial number it will use this.
: export NJMON_SN=123ABC then start njmon or nimon.
--- NIMON with InfluxDB 2.0 options ---
Don't use :-y user or -z password options.
Use:-x bucket: InfluxDB 1 term is a database. InfluxDB 2 term is a bucket.
-O org : InfluxDB 2.0 uses Organisations for data, users, dashboards etc. Default is "default".
-T token : Security Token from InfluxDB 2.0 GUI & switch to 2.0 mode
NIMON Examples:
1 Take a look at the Line Protocol data
/usr/local/bin/nimon -s 2 -c 3 -f then edit <hostname>_<date>_<time>.influxlp
2 Every 1 minute all day using the default port of 8086
/usr/local/bin/nimon -s 30 -c 2880 -i influxbox -x njmon -y Nigel -z passwd
3 Add process stats & use IP address
/usr/local/bin/nimon -s 60 -c 1440 -P -i 9.137.62.12 -p 8086 -x njmon
4 Crontab run 1 day - start 1 minute after midnight, save local data every 30 seconds
1 0 * * * /usr/local/bin/nimon -s 30 -c 2880 -i influxbox -p 8086 -x njmon -y Nigel -z passwd
5 Crontab - hourly check/restart nimon (if nimon is not running)
0 * * * * /usr/lbin/nimon -k -s 60 -i influxbox -p 8086 -x njmon
6 Crontab - as 5 but output for telegraf
0 * * * * /usr/lbin/nimon -w -k -s 60 -i influxbox -p 8086 -x njmon
7 InfluxDB 2+ using default port 8086 & default bucket njmon
/usr/lbin/nimon -k -s 60 -i influx2box -O IBM -T Ptf$g4...==
7 VictoriaMetrics port 8428 with TimeStamps (-S)
/usr/lbin/nimon -s 30 -c 2880 -i victoria -p 8428 -S
-- Save data remotely to njmond, telegraf, VictoriaMetrics or other Time-Series DB --
Push data to a central daemon:
-i ip/host : IP address or Hostname of the central daemon
-p port : Port number of the daemon
NJMON Examples:
1 Every 5 mins all day
/usr/local/bin/njmon -s 300 -c 288 -f -m /home/perf
2 Piping to a data handler all day at 30-second intervals
/usr/local/bin/njmon -s 30 -c 1440 | myprog
3 Use the defaults (-s 60 forever) and save to a file
./njmon > my_server_today.json
4 Send data to the central daemon with no password
./njmon -s 30 -c 2880 -i admin.acme.com -p 8181
5 Send data to the central daemon with process stats and with password
./njmon -s 60 -c 1440 -P -i admin.acme.com -p 8181 -X password
Crontab options:
6 Crontab only save to a file (2 minutes past midnight)
2 0 * * * /usr/local/bin/njmon -s 60 -c 1440 -f -m /home/perf
7 Crontab daily at midnight starts sending data to a central server
0 0 * * * /usr/local/bin/njmon -s 30 -c 2880 -i admin.acme.com -p 8181
8 Crontab sends data to a central server, check hourly (if njmon is not running)
0 * * * * /usr/local/bin/njmon -k -s 30 -i admin.acme.com -p 8181
9 Crontab uses SSH on an Influx server to start njmon, send data back via a network socket to
a local InfluxDB "injector" program
0 0 * * * ssh root@endpoint /usr/local/bin/njmon -s 30 -c 2880 -i admin.acme.com -p 8181 | injector
