NjmonLinuxV83OnlineHelp


Online "njmon -h" output for njmon for Linux version 83


Access with the regular UNIX/Linux command: njmon -h | less


In this case from Ubuntu 23 running on my Laptop under VirtualBox.

./njmon_Ubuntu23_x86_64_v83: help information. Version:njmon4Linux-v83-Ubuntu-23-x86_64-njmon_linux_v83.c (Jan 28 2024)

- Performance stats collector outputting JSON or Influx Line Protocol format.
- If the commend starts with njmon it runs in NJMON mode
- If the commend starts with nimon it runs in NIJMON mode
- -J forces NJMON mode regardless of the command name
- -I forces NIMON mode regardless of the command name
- Note:njmon & nimondata is exactly the same, so use one database.
- Default is stdout
- Core syntax  :     ./njmon_Ubuntu23_x86_64_v83 -s seconds -c count
- File output  :     -m directory -f
- Check & restart: -k and -K filename
- Data options:    -A alias -H -P -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 InfluxDB2         : -x bucket -O Org -T <token>
  Prometheus/telegraf mode: -w
	  skips HTTP REST API data (POST, content, length) in the output stream.
		Good when using telegraf and/or Prometheus
	-!           : Version check and immediate exit
	-?           : This help informtion
	-s seconds   : seconds between snapshots of data (default 60 seconds)
	-c count     : number of snapshots (default forever)

	-D           : Add diskstats measurement includes all devices in /proc/diskstats
	-m directory : Program will cd to the directory before output
	-M           : Filesystems listed by mount point (like AIX njmon) and not filesystem name
	-f           : Output to file (not stdout) to two files below
	             : NIMON mode - Data:  hostname_<year><month><day>_<hour><minutes>.influxlp
	             : NJMON mode - Data:  hostname_<year><month><day>_<hour><minutes>.json
	             : Error: hostname_<year><month><day>_<hour><minutes>.err
	-ff          : NIMON mode - Note: a second -f adds a timestamp so this data can be added to InfluxDB later
	-A alias     : User defined alias hostname to work around crazy duplicate hostnames
	-a file      : Command line arguments are in the file (hides passwords)
	             : Use the same arguments, all on the first line, space separated
	             : Only have the -a option on the actual command line
	-H           : NIMON mode - Force host tag to be a Fully Qualified Domain Name
	-k           : NIMON mode - Read /tmp/nimon.pid for a running nimon PID & if found
	-k           : NJMON mode - Read /tmp/njmon.pid for a running njmon PID & if found
	               still running then this process exits quietly
	-K filename  : User defined pid filename (implies -k). Allows not using /tmp or
	               multiple concurrent data captures
	-I           : Force to NIMON mode. Saving InfluxDB Line Protocol data or njmond.py or other Timeseries database
	-J           : Force to NJMON mode. Set njmon mode for JSON format for njmond.py or other Timeseries database
	-P           : Add process stats (take CPU cycles and large stats volume)
	-t percent   : Set ignore process CPU use percent threshold (default 0.01%)
	-b           : Switch of adding pid to the process names: "ksh_76927" -> "ksh"
	-? or -h     : This output and stop
	-d           : Switch on debug tracing (output no longer JSON/line protocol format)
	-W           : Switch off warning messages in error output stream
	-r           : Random start pause. Stops cron making every program send data in sync
	-n           : No PID printed out at start up.
	-R           : Reduced stats - skip logical CPU stats for SMT threads.
	-F           : Switch off filesystem stats (autofs and tmpfs can cause issues)
--- NIMON mode options ---
- Sent data to InfluxDB (all of these are inportant for InfluxDB):
	-i hostname  : Hostmane 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. Dont send POST, message type or packet size
	-v           : Show data + response to InfluxDB on stderr
	Currently, InfluxDB security certificates are not implemented
--- NIMON with InfluxDB 2.0 options ---
	-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
	-q additional_tags : additional tags for nimon "-q dept=foobar,area=51"

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...==

--- NJMON mode options or other Time-Series database ---
Push data to central njmond daemon:
	-i ip/host   : IP address or Hostname of the njmond central daemon
	-p port      : Port number on njmond.py host

NJMON Examples:
    1 Every 5 mins all day
	/usr/local/bin/njmon -s 300 -c 288 -f -m /home/perf
    2 Piping to 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 start sending data to central server
	0 0 * * * /usr/local/bin/njmon -s 30 -c 2880 -i admin.acme.com -p 8181
    8 Crontab send data to 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 use ssh on Influx server to start njmon, send data back via 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