No project description provided
Project description
kubemon
A tool for distributed container monitoring over Kubernetes.
Translations
Table of contents
- Environment Requirements
- Application Requirements
- Illustrations
- Main Functionalities
- Installation
- Running
- References
Environment requirements
- Ubuntu 18.04
- Kubernetes v1.19
- Docker v19.03.13
- Python 3.8
Application requirements
Illustrations
Basic diagram
Main functionalities
- Collects metrics from operating system, Docker containers and processes created by the container
- Send the collected metrics to the
collectormodule, which saves the data in a CSV file - Can be controlled remotely by a basic CLI
Collected metrics
For more information about the collected metrics, please refer to:
- Operating System Metrics: These metrics are collected from linux
/procfilesystem using bothpsutilPython API and/sys/block/<dev>/stat. - Docker: These metrics are collected from linux
cgroups. - Docker Processes: These metrics are collected from linux
/procfilesystem usingpsutilPython API.
Operating System
| Type | Unit | Metric |
|---|---|---|
| CPU | Quantity Quantity Quantity Quantity Clock Ticks Clock Ticks Clock Ticks Clock Ticks Clock Ticks Clock Ticks Clock Ticks Clock Ticks Clock Ticks |
Context Switches Interrupts Soft Interrupts Syscalls Times User Times System Times Nice Times Softirq Times IRQ Times IOWait Times Guest Times Guest Nice Times Idle |
| Memory | Quantity Quantity Quantity Quantity Quantity KB KB Quantity Quantity Quantity Quantity |
Active (Anon) Inactive (Anon) Inactive (file) Active (file) Mapped Pages KB Paged In Since Boot (pgpgin) KB Paged Out Since Boot (pgpgout) Pages Free (pgfree) Page Faults (pgfault) Major Page Faults (pgmajfault) Pages Reused (pgreuse) |
| Disk | Requests Requests Sectors Milliseconds Requests Requests Sectors Milliseconds Requests Milliseconds Milliseconds Requests Requests Sectors Milliseconds Requests Milliseconds |
Read I/O Read I/O Merged with In-queue I/O Read Sectors Total Wait Time for Read Requests Write I/O Write I/O Merged with In-Queue I/O Write Sectors Total Wait Time for Write Requests I/O in Flight Total Time This Block Device Has Been Active Total Wait Time for All Requests Discard I/O Processed Discard I/O Processed with In-Queue I/O Discard Sectors Total Wait Time for Discard Requests Flush I/O Processed Total Wait Time for Flush Requests |
| Network | Bytes Bytes Packets Packets |
Sent Received Sent Received |
Docker Processes
| Type | Unit | Metric |
|---|---|---|
| CPU | Clock Ticks Clock Ticks Clock Ticks Clock Ticks Clock Ticks |
User Time System Time Children User Children System IOWait |
| Memory | Pages Pages Pages Pages Pages Pages Pages |
Total Program Size (size) Resident Set Size (resident) Resident Shared Pages (shared) Text (text) Data + Stack (data) |
| Disk | Requests Requests Bytes Bytes Chars Chars |
Read Write Read Write Read Write |
| Network | Bytes Bytes Packets Packets |
Sent Received Sent Received |
Docker
| Type | Unit | Metric |
|---|---|---|
| CPU | Clock Ticks Clock Ticks Quantity Quantity Clock Ticks |
User System Periods Throttled Throttled Time |
| Memory | Pages Pages Pages Pages Pages Pages Pages Pages Pages Pages Pages Pages |
Resident Set Size (rss) Chached Mapped (mapped_file) Paged In (pgpgin) Paged Out (pgpgout) Page Faults (pgfault) Major Page Faults (pgmajfault) Active (active_anon) Inactive (inactive_anon) Active File (active_file) Inactive File (inactive_file) Unevictable |
| Disk | Bytes Bytes Bytes Bytes Bytes Bytes |
Read Write Sync Async Discard Total |
| Network | Bytes Bytes Packets Packets |
Sent Received Sent Received |
Installation
Before installing the tool, make sure Kubernetes and Docker are properly installed in the system. Besides, the tool must be downloaded and extracted in each Kubernetes node to properly monitor the metrics of the cluster.
-
Download the latest version here: kubemon v2.0.0
-
Extract the zip file and go on the extracted directory
-
Create a virtual environment and activate it
$ python3 -m venv venv $ source venv/bin/activate
-
Install packages
(venv) $ pip install .
Running
The collected metrics will be saved in the client machine (See Client in the diagram) by default in /tmp/data. This setting can be changed in ./kubemon/constants.py by changing ROOT_DIR variable value.
Example:
# Before
ROOT_DIR = "/tmp/data"
# After
ROOT_DIR = "/home/user/Documents/data"
In the further subsections will be teaching how to execute this tool.
A brief command list:
usage: kubemon [-h] [-l] [-t TYPE] [-H IP] [-p PORT] [-f FILE1 FILE2] [-c [COMMAND ...]] [-i INTERVAL]
Kubemon commands
optional arguments:
-h, --help show this help message and exit
-l, --list Lists all available modules
-t TYPE, --type TYPE Functionality of sys-monitor. E.g. collector, monitor, merge...
-H IP, --host IP Host that any of sys-monitor functions will be connecting
-p PORT, --port PORT Port of the host
-f FILE1 FILE2, --files FILE1 FILE2
Files for merge
-c [COMMAND ...], --command [COMMAND ...]
Command for be executing on CollectorClient
-i INTERVAL, --interval INTERVAL
Data collection rate by monitors
Collector
(venv) $ make collector
[ Collector ] Started collector CLI at 0.0.0.0:9880
[ Collector ] Started collector at 0.0.0.0:9822
Monitor
Assuming that the collector IP is 192.168.0.3, let's connect the monitors to it.
There are three types of monitors:
- OSMonitor - Collects Operating System metrics
- DockerMonitor - Collects Docker metrics
- ProcessMonitor - Collects container processes metrics
The tool must be executed as sudo because some metrics (e.g. network, disk, ...) are available only for super users.
In this case, let's run all the monitors at once:
(venv) $ sudo python -m kubemon -t all -H 192.168.0.3
Connected OSMonitor_192_168_0_3_node_0 monitor to collector
...
CLI
Assuming the same IP address for the collector in the section Monitor, the port to communicate with the collector via CLI is 9880.
There are two commands available so far:
/instances- Number of monitor instances connected to thecollectorobject./start <output_dir>- Start the monitors and setting up the output directory to save the files
Checking how many instances are connected
(venv) $ python -m kubemon -t cli -H 192.168.0.3 -c /instances
Connected instances: 5
Starting monitors. In this case the CSV files will be saved at /tmp/data/test00/
(venv) $ python -m kubemon -t cli -H 192.168.0.3 -c /start "test00"
Started 5 monitors
References
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kubemon-2.2.0.tar.gz.
File metadata
- Download URL: kubemon-2.2.0.tar.gz
- Upload date:
- Size: 29.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cccae20fab5a0e601d0049a8dfad8786b9806df6cf82a598082673c04b33cd4d
|
|
| MD5 |
704d14cd894310c7185f7461bb43f6c6
|
|
| BLAKE2b-256 |
668aa97305349ba960e2675de56327ed2081daaca6542c1f9ee41d992d18967b
|
File details
Details for the file kubemon-2.2.0-py3-none-any.whl.
File metadata
- Download URL: kubemon-2.2.0-py3-none-any.whl
- Upload date:
- Size: 37.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9bb64ec16191568af4536986ce66ce156f828c3a37aab335470c1b1579d2018
|
|
| MD5 |
db539346f289143ac12a143789fc9c20
|
|
| BLAKE2b-256 |
0aaaa72a3a6044ea117ad1eabcf6b953457b0a4cd87a014ccd3b3e43f38a8928
|