NjmonLinuxManualPage

njmon(1) General Commands Manual njmon(1)

NAME

       njmon - capture Linux Performance stats in JSON format - default is stdout

SYNOPSIS

       Output njmon version and stop:

       njmon -@

       Output this help information and stop:

       njmon -h or -?

       The command line options are in the file:

       njmon -a file

       Collect performance statistics to a file:

       njmon -s seconds -c count -m dir -f [-k | -K pidfile] -n -P -t percent -e -b -d -R -F

       Collect performance statistics for a central njmon.py service:

       njmon -s seconds -c count -m dir [-k | -K pidfile] -n -P -t percent -e -b -d -r -R -F -i hostname -p port
       -X secret

       Collect performance statistics for a central njmon.py service using a shell variable:

       export NMON_SECRET=secret

       njmon -s seconds -c count -m dir -k -n -P -t percent -e -b -d -r -R -F -i hostname -p port

OPTIONS

       -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

       -s seconds
              seconds between snapshots of data (default 60 seconds)

       -c count
              number of snapshots (default forever)

       -m directory
              The program will change to the directory before output or creating a file

       -f     Output the statistics to following files (instead of stdout), "lp" for line protocal:
              Data:  hostname_<year><month><day>_<hour><minutes>.json
              Error: hostname_<year><month><day>_<hour><minutes>.err
              Note:  problems  can  occur  if using this option and the -i option as the data can't go both to a
              file and to a socket.


       -k     If the file /tmp/nimon.pid is not found this nimon 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 nimon exits.
              If no process is found running then this nimon continues running.  This allows you to try starting
              nimon  say  once  an  hour  from  crontab.   This  will restart the nimon only if the previous one
              stopped.  nimon will remove the nimon.pid, file when it stops normally.
              If the /tmp/njmon.pid is found but can't be accessed, nimon will print a  warning  and  stop.  The
              file could be owned by a different user or no read permission.


       -K pidfile
              This  is  same  as the -k option but the user decides the directory and filename for the file con\u2010
              taining the Process ID(PID_.  Plus you can run  multiple  nimon  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.
              Alternative, if you need to  use  a  different  filename  then  set  the  shell  environemnt  NJI\u2010
              MON_PID_FILE, before starting njmon.
              If  the  .pid  file  is found but can't be accessed, nimon will print a warning and stop. The file
              could be owned by a different user or no read permission.


       -P     Add individual process stats. If the systems has hudored or more processes this option cat drasti\u2010
              cally  increase njmon CPU time and drastically increase the number of stats. This has implications
              on database sizes.

       -t percent
              Set ignore process CPU use percent threshold (default 0.01%)

       -e     Switch on "elastic" (also called ElasticSearch) sub-sections are arrays rather  than  JSON  struc\u2010
              tures for example: disks, networks & filesystems

       -b     Switch off adding pid to the process names: "ksh_76927" -> "ksh"

       -d     Switch  on  debug tracing (output may no longer be JSON or InfluxDB Line Protocol format). This is
              only useful for debugging the njmon code where the output has a problem.
              Used this with the -f option to save the debug output to the .err file.  This  can  be  useful  to
              determine why some features are getting turned off like GPFS or socket issues.

       -W     Switch off warning messages in error output stream. Use this once you are confident that the warn\u2010
              ings are ignorable. This includes badly behaved file systems like mounted but without root access.


       -n     No PID printed out at start up.

       -r     Random start pause. Stops cron making every program send data in sync.

       -R     Reduced stats - skip logical CPU stats for SMT threads.

       -F     Switch off filesystem stats (autofs and tmpfs can cause issues)

       -i IP address or hostname
              IP address or Hostname of the njmon central njmond.py daemon

       -p port
              port number of the central njmond.py host

       -X secret
              Depreciated: Set the remote collector secret or use shell NJMON_SECRET. This only is accepted  but
              ignored.


       Notes on Spectrum Scale (GPFS)
              njmon  automatically  collects  GPFS  if  /usr/lpp/mmfs/bin/mmksh and /usr/lpp/mmfs/bin/mmpmon are
              found on you systems.  However, if GPFS is present but off  it  can  get  confused.   Use:  export
              NOGPFS=1  to set a shell variable before running njmon will disable GPFS stats.  You can also com\u2010
              pile out GPFS support with -D NOGPFS

EXAMPLES

       Assuming njmon is found at /usr/local/bin and in our $PATH

       1      Collect stats every 5 mins for 24 hours and save the file in /home/perf

              njmon -s 300 -c 288 -f -m /home/perf

       2      Piping the stats to data handler program (perhaps in Python) all day at 30 second intervals

              njmon -s 30 -c 1440 | myprog

       3      Use the defaults (-s 60 -c forever) and save to a file. Assumes njmon is in your $PATH.

              njmon > my_server_today.json

       4      Send data to the central njmond.py daemon with no password

              njmon -s 30 -c 2880 -i admin.acme.com -p 8181

       5      Send data to the central njmond.py daemon with process stats and with password

              njmon -s 60 -c 1440 -P -i admin.acme.com -p 8181 -X password

       6      Crontab entry to only save to a file (2 minutes past midnight) in the /home/perf directory

              2 0 * * * /usr/local/bin/njmon -s 60 -c 1440 -f -m /home/perf >/dev/null

       7      Crontab entry to start daily at midnight and sending data to central server

              0 0 * * * /usr/local/bin/njmon -s 30 -c 2880 -i admin.acme.com -p 8181 >/dev/null

       8      Crontab entry to send data to central server, every hour of the day (if njmon is found to be  run\u2010
              ning already this invokation stops quitely)


              0 * * * * /usr/local/bin/njmon -k -s 30 -i admin.acme.com -p 8181 >/dev/null

       9      Crontab use ssh 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 >/dev/null

VERSIONS

       Version 70 - New support for Mainframe / IBM Z platform.
              Include -D MAINFRAME in the compile line of the Makfile.
              Tested only of RHEL, so far.

AUTHOR

       Developer Nigel Griffiths (nigelargriffiths@hotmail.com)

COPYRIGHT

       License GPLv3+: GNU GPL version 3

SEE ALSO

       nimon




                                       Version:njmon4Linux-v71-@016/12/2020                              njmon(1)