Novaordis-linux: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * Projects =Overview= Linux monitoring and management functionality. =GitHub= {{External|https://github.com/NovaOrdis/novaordis-linux}}...")
 
 
(10 intermediate revisions by the same user not shown)
Line 2: Line 2:


* [[Projects#Projects|Projects]]
* [[Projects#Projects|Projects]]
* [[Linux_Per-Process_CPU_Runtime_Statistics#Overview|Per-Process CPU Runtime Statistics]]


=Overview=
=Overview=


Linux monitoring and management functionality.
Linux monitoring and management functionality:
* /proc/stat parsing.
* a [[#Statistics_Collector|collector]] that can read arbitrary files at high rate and cache them in memory - useful for sampling individual processes.
 
==Statistics Collector==
 
The library includes a CPU statistics collector (/proc/stat, proc/<pid>/stat, etc.) that periodically reads O/S level statistics for the entire system and for a process specified via a
regular expression, and displays those statistics at stdout or writes them in a file. To stop the collection, Ctrl-C.
 
Usage:
 
    java -jar collector.jar \
        [command] \
        [--output-file=/tmp/cpu.csv] \
        [--process-regex='<regex>'] \
        [--sampling-interval-ms=10]
 
Example
 
    java -jar collector.jar --process-regex=' -server ' --sampling-interval-ms=50
 
It is possible to test the regular expression to make sure it correctly selects the process without collecting any statistics:
 
    java -jar collector.jar --process-regex='...' find
 
Metacharacters ([[Java_Regular_Expressions#Metacharacters|Java Regular Expression - Metacharacters]]) can be specified between single quotes, and escaped:
 
  java -jar collector.jar --process-regex='-D\[Standalone\]' find
 
java -jar .collector.jar find --process-regex='java.*-D\[Standalone\].*rest-service-1-bmsqp'


=GitHub=
=GitHub=

Latest revision as of 21:38, 2 March 2018

Internal

Overview

Linux monitoring and management functionality:

  • /proc/stat parsing.
  • a collector that can read arbitrary files at high rate and cache them in memory - useful for sampling individual processes.

Statistics Collector

The library includes a CPU statistics collector (/proc/stat, proc/<pid>/stat, etc.) that periodically reads O/S level statistics for the entire system and for a process specified via a regular expression, and displays those statistics at stdout or writes them in a file. To stop the collection, Ctrl-C.

Usage:

   java -jar collector.jar \
       [command] \
       [--output-file=/tmp/cpu.csv] \
       [--process-regex='<regex>'] \
       [--sampling-interval-ms=10]

Example

   java -jar collector.jar --process-regex=' -server ' --sampling-interval-ms=50

It is possible to test the regular expression to make sure it correctly selects the process without collecting any statistics:

   java -jar collector.jar --process-regex='...' find

Metacharacters (Java Regular Expression - Metacharacters) can be specified between single quotes, and escaped:

 java -jar collector.jar --process-regex='-D\[Standalone\]' find
java -jar .collector.jar find --process-regex='java.*-D\[Standalone\].*rest-service-1-bmsqp'

GitHub

https://github.com/NovaOrdis/novaordis-linux

Maven

<dependency>
    <groupId>io.novaordis.linux</groupId>
    <artifactId>novaordis-linux</artifactId>
    <version>${novaordis.linux.version}</version>
</dependency>