Skip to content

Commit

Permalink
Merge pull request #83 from AdamsGH/nodes-summary
Browse files Browse the repository at this point in the history
Nodes summary
  • Loading branch information
george-angel authored Nov 18, 2024
2 parents 71d2a9e + dd14294 commit 13d04b5
Show file tree
Hide file tree
Showing 4 changed files with 281 additions and 301 deletions.
81 changes: 53 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,62 @@ To run exporter locally run `go run ./...`

This will run server on default port `9779`

Visiting http://localhost:9779/node/example-node will return metrics for the
node 'example-node'. App will look for `example-node` in the `current-context`
Visiting http://localhost:9779/node/{node-name} will return metrics for the
specified node. The app will look for the node in the `current-context`
cluster set in kube config.

You can also visit http://localhost:9779/nodes to retrieve metrics for all nodes in the cluster.

[Here's an example scrape config.](manifests/scrape-config.yaml)

## Endpoints

- `/`: Home page with links to other endpoints
- `/nodes`: Metrics for all nodes in the cluster
- `/node/{node}`: Metrics for a specific node
- `/metrics`: Prometheus metrics about the exporter itself

## Command-line Flags

- `--listen-address`: The address to listen on for HTTP requests (default ":9779")
- `--kubeconfig`: Path to a kubeconfig file (if not provided, the app will try $KUBECONFIG, $HOME/.kube/config, or in-cluster config)

## Metrics

| Metric | Description | Labels |
|----------------------------------------------------|----------------------------------------------------------------------|----------------------|
| kube_summary_container_logs_available_bytes | Number of bytes that aren't consumed by the container logs | pod, namespace, name |
| kube_summary_container_logs_capacity_bytes | Number of bytes that can be consumed by the container logs | pod, namespace, name |
| kube_summary_container_logs_inodes | Number of Inodes for logs | pod, namespace, name |
| kube_summary_container_logs_inodes_free | Number of available Inodes for logs | pod, namespace, name |
| kube_summary_container_logs_inodes_used | Number of used Inodes for logs | pod, namespace, name |
| kube_summary_container_logs_used_bytes | Number of bytes that are consumed by the container logs | pod, namespace, name |
| kube_summary_container_rootfs_available_bytes | Number of bytes that aren't consumed by the container | pod, namespace, name |
| kube_summary_container_rootfs_capacity_bytes | Number of bytes that can be consumed by the container | pod, namespace, name |
| kube_summary_container_rootfs_inodes | Number of Inodes | pod, namespace, name |
| kube_summary_container_rootfs_inodes_free | Number of available Inodes | pod, namespace, name |
| kube_summary_container_rootfs_inodes_used | Number of used Inodes | pod, namespace, name |
| kube_summary_container_rootfs_used_bytes | Number of bytes that are consumed by the container | pod, namespace, name |
| kube_summary_node_runtime_imagefs_available_bytes | Number of bytes of node Runtime ImageFS that aren't consumed | node |
| kube_summary_node_runtime_imagefs_capacity_bytes | Number of bytes of node Runtime ImageFS that can be consumed | node |
| kube_summary_node_runtime_imagefs_inodes | Number of Inodes for node Runtime ImageFS | node |
| kube_summary_node_runtime_imagefs_inodes_free | Number of available Inodes for node Runtime ImageFS | node |
| kube_summary_node_runtime_imagefs_inodes_used | Number of used Inodes for node Runtime ImageFS | node |
| kube_summary_node_runtime_imagefs_used_bytes | Number of bytes of node Runtime ImageFS that are consumed | node |
| kube_summary_pod_ephemeral_storage_available_bytes | Number of bytes of Ephemeral storage that aren't consumed by the pod | pod, namespace |
| kube_summary_pod_ephemeral_storage_capacity_bytes | Number of bytes of Ephemeral storage that can be consumed by the pod | pod, namespace |
| kube_summary_pod_ephemeral_storage_inodes | Number of Inodes for pod Ephemeral storage | pod, namespace |
| kube_summary_pod_ephemeral_storage_inodes_free | Number of available Inodes for pod Ephemeral storage | pod, namespace |
| kube_summary_pod_ephemeral_storage_inodes_used | Number of used Inodes for pod Ephemeral storage | pod, namespace |
| kube_summary_pod_ephemeral_storage_used_bytes | Number of bytes of Ephemeral storage that are consumed by the pod | pod, namespace |
| Metric | Description | Labels |
| -------------------------------------------------- | -------------------------------------------------------------------- | -------------------------- |
| kube_summary_container_logs_available_bytes | Number of bytes that aren't consumed by the container logs | node, pod, namespace, name |
| kube_summary_container_logs_capacity_bytes | Number of bytes that can be consumed by the container logs | node, pod, namespace, name |
| kube_summary_container_logs_inodes | Number of Inodes for logs | node, pod, namespace, name |
| kube_summary_container_logs_inodes_free | Number of available Inodes for logs | node, pod, namespace, name |
| kube_summary_container_logs_inodes_used | Number of used Inodes for logs | node, pod, namespace, name |
| kube_summary_container_logs_used_bytes | Number of bytes that are consumed by the container logs | node, pod, namespace, name |
| kube_summary_container_rootfs_available_bytes | Number of bytes that aren't consumed by the container | node, pod, namespace, name |
| kube_summary_container_rootfs_capacity_bytes | Number of bytes that can be consumed by the container | node, pod, namespace, name |
| kube_summary_container_rootfs_inodes | Number of Inodes | node, pod, namespace, name |
| kube_summary_container_rootfs_inodes_free | Number of available Inodes | node, pod, namespace, name |
| kube_summary_container_rootfs_inodes_used | Number of used Inodes | node, pod, namespace, name |
| kube_summary_container_rootfs_used_bytes | Number of bytes that are consumed by the container | node, pod, namespace, name |
| kube_summary_node_runtime_imagefs_available_bytes | Number of bytes of node Runtime ImageFS that aren't consumed | node |
| kube_summary_node_runtime_imagefs_capacity_bytes | Number of bytes of node Runtime ImageFS that can be consumed | node |
| kube_summary_node_runtime_imagefs_inodes | Number of Inodes for node Runtime ImageFS | node |
| kube_summary_node_runtime_imagefs_inodes_free | Number of available Inodes for node Runtime ImageFS | node |
| kube_summary_node_runtime_imagefs_inodes_used | Number of used Inodes for node Runtime ImageFS | node |
| kube_summary_node_runtime_imagefs_used_bytes | Number of bytes of node Runtime ImageFS that are consumed | node |
| kube_summary_pod_ephemeral_storage_available_bytes | Number of bytes of Ephemeral storage that aren't consumed by the pod | node, pod, namespace |
| kube_summary_pod_ephemeral_storage_capacity_bytes | Number of bytes of Ephemeral storage that can be consumed by the pod | node, pod, namespace |
| kube_summary_pod_ephemeral_storage_inodes | Number of Inodes for pod Ephemeral storage | node, pod, namespace |
| kube_summary_pod_ephemeral_storage_inodes_free | Number of available Inodes for pod Ephemeral storage | node, pod, namespace |
| kube_summary_pod_ephemeral_storage_inodes_used | Number of used Inodes for pod Ephemeral storage | node, pod, namespace |
| kube_summary_pod_ephemeral_storage_used_bytes | Number of bytes of Ephemeral storage that are consumed by the pod | node, pod, namespace |

## Development

### Running Tests

To run the tests, use the following command:
```
go test ./...
```

The main test file (`main_test.go`) includes a test for the `collectSummaryMetrics` function, which verifies that the metrics are collected correctly from a sample JSON file (`test-summary.json`).
Loading

0 comments on commit 13d04b5

Please sign in to comment.