Site /
Njmon4LinuxCommandLine
njmon for Linux Command Line and njmon -? output
$ ./njmon_linux -h
/njmon: help information. Version:30@16/07/2019
- Performance stats collector outputing JSON format. Default is stdout
- Core syntax: /usr/local/bin/njmon -s seconds -c count
- JSON style: -M (default) or older style -S or -O
- File output: -m directory -f
- njmon collector output: -i host -p port -X secret
- Other options: -?
-s seconds : seconds between snapshots of data (default 60 seconds)
-c count : number of snapshots (default forever)
-S : Single level output format - section names form part of the value names
-M : Multiple level output format - section & subsection names (default)
-O : Old Multiple level output format - like -M but identity before samples
-m directory : Program will cd to the directory before output
-f : Output to file (not stdout) to two files below
: Data: hostname_<year><month><day>_<hour><minutes>.json
: Error: hostname_<year><month><day>_<hour><minutes>.err
-k : Read /tmp/njmon.pid for a running njmon PID & if found running then this copy exits
-P : Add process stats (take CPU cycles and large stats volume)
-I percent : Set ignore proceiss percent threshold (default 0.01%)
-? or -h : This output and stop
-d : Switch on debugging
Push data to collector: add -h hostname -p port
-i ip : IP address or hostname of the njmon central collector
-p port : port number on collector host
-X secret : Set the remote collector secret or use shell NJMON_SECRET
Examples:
1 Every 5 mins all day
/home/nag/njmon -s 300 -c 288 -f -m /home/perf
2 Piping to data handler using half a day
/home/nag/njmon -s 30 -c 1440 | myprog
3 Use the defaults (-s 60 forever) and save to a file
./njmon > my_server_today.json
4 Crontab entry
0 4 * * * /home/nag/njmon -s 300 -c 288 -f -m /home/perf
5 Crontab - hourly check/restart remote njmon, pipe stats back & insert into local DB
* 0 * * * /usr/bin/ssh nigel@server /usr/lbin/njmon -s 300 -c 288 | /lbin/injector
6 Crontab - for pumping data to the njmon central collector
* 0 * * * /usr/local/bin/njmon -s 300 -c 288 -i admin.acme.com -p 8181 -X SECRET42
$
