Skip to content

Commit

Permalink
Doc
Browse files Browse the repository at this point in the history
Add readme and json format of container
  • Loading branch information
YLonely committed Nov 10, 2019
1 parent 2f2d0e3 commit 2608d17
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# sysdig-monitor

sysdig-monitor uses [sysdig](https://github.com/draios/sysdig) to track container events and exports information about running containers(file system, network, system call)

## Install

Before using this tool, you have to [install sysdig](https://github.com/draios/sysdig/wiki/How-to-Install-Sysdig-for-Linux) first.

To use sysdig-monitor, you can just build it from source:
```
go build -mod vendor
```
Or you can download from release page.

## Usage

Use `./sysdig-monitor` to start the monitor, now sysdig-monitor is running on **http://localhost:port**, or use can use `--port` flag to set another port.

Now you can start some containers on your host as you wish.

To list all containers running on the host, you can visit **localhost:port/container/** (not **localhost:port/container**) in your web browser, or use `curl` to fetch the result. The result will be in json format as below
```json
{
container-id: name,
...
}
```

To get all the information about a container, visit **localhost:port/container/:id** in your web browser or use `curl localhost:port/container/:id | jq` to get a more user-friendly result. The result will be in json format. Visit [here](/docs/format.md) to read about the format.

API **localhost:port/metrics** is also available, which exports some useful metrics in promethuse-style
56 changes: 56 additions & 0 deletions docs/format.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# container status json format

```json
{
"id": id, //container id
"name": name, //container name
"individual_calls": { //different types of system call
"name1": {
"calls": 123, // total invoke times
"total_time" : 456 // total latency in nanoseconds
},
...
},
"total_calls": 123, // total system calls
"io_calls_more_than_1ms": [
{
"file_name": "/home/test.txt",
"latency": 123 // also nanoseconds
}
...
],
"io_calls_more_than_10ms":[],
"io_calls_more_than_100ms":[],
"file_total_read_in": 222, //Total bytes the container read from file system
"file_total_write_out": 222,
"net_total_read_in": 333, //Total bytes the container read from network
"net_total_write_out": 333,
"active_connections": [
{
"source_ip": ,
"dest_ip": ,
"source_port": ,
"dest_port": ,
"type": "ipv4",
"write_out": ,
"read_in":
},
...
],
"accessed_layers": [
{
"dir": "/var/lib/docker/overlay2/40f635eb604ff721234ddd0c10433377dd487419b85a1ed0c292d697b01a64a7/diff",
"accessed_files": {
"/etc/bash.bashrc": {
"write_out": ,
"read_in":
}
...
},
"layer_write_out": ,
"layer_read_in":
}
...
]
}
```

0 comments on commit 2608d17

Please sign in to comment.