Skip to content

Commit

Permalink
Merge pull request #45 from eslam-gomaa/feat/add-custom-commands-feature
Browse files Browse the repository at this point in the history
custom commands feature: done
  • Loading branch information
eslam-gomaa authored Jun 25, 2024
2 parents 325f4b6 + a0c44c3 commit 2e96f9b
Show file tree
Hide file tree
Showing 10 changed files with 1,029 additions and 254 deletions.
66 changes: 66 additions & 0 deletions command.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
command:
name: Pods Info
description: Kubernetes Pods info of a specific namespace

variables:
- name: pod
default: .*
cliArgument:
enable: true
short: -po
required: false
- name: namespace
default: default
cliArgument:
enable: true
short: -n
required: false

execute:
type: advancedTable
columns:
- memory usage:
metric: |
sort_desc(sum(container_memory_usage_bytes{namespace=~"$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone))
metricUnit: byte
- memory usage %:
metric: |
sort_desc(
(
sum(container_memory_usage_bytes{namespace=~"$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone)
/
sum(container_spec_memory_limit_bytes{namespace=~"$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone)
) * 100
)
metricUnit: percentage
- memory limit:
metric: |
sort_desc(sum(container_spec_memory_limit_bytes{namespace=~"$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone))
metricUnit: byte
- memory cache:
metric: |
sort_desc(sum(container_memory_cache{namespace=~"$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone))
metricUnit: byte
- memory swap:
metric: |
sum(container_memory_swap{namespace=~"$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone)
metricUnit: byte
- memory max usage:
metric: |
sum(container_memory_max_usage_bytes{namespace=~"$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone)
metricUnit: byte
- file descriptors:
metric: |
sort_desc(sum(container_file_descriptors{namespace=~"$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone))
metricUnit: counter
- up time:
metric: |
sum(time() - kube_pod_start_time{namespace=~"$namespace", pod=~"$pod"}) by (pod)
metricUnit: seconds
custom_key: "{{pod}}" # "{{pod}} - {{topology_ebs_csi_aws_com_zone}}"
advancedTableOptions:
tableType: plain # https://github.com/astanin/python-tabulate?tab=readme-ov-file#table-format
headersUppercase: true
autoConvertValue: true
showTableIndex: false
updateIntervalSeconds: 3
74 changes: 74 additions & 0 deletions command2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
command:
name: Pods Info
description: Kubernetes Pods info of a specific namespace

# variables:
# - name: topic
# default: .*
# cliArgument:
# enable: true
# short: -T
# required: true

variables:
- name: pod
default: .*
cliArgument:
enable: true
short: -po
required: false
- name: namespace
default: default
cliArgument:
enable: true
short: -n
required: false

execute:
type: advancedTable
columns:
- memory usage:
metric: |
sort_desc(sum(container_memory_usage_bytes{namespace="$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone))
metricUnit: byte
- memory usage %:
metric: |
sort_desc(
(
sum(container_memory_usage_bytes{namespace="$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone)
/
sum(container_spec_memory_limit_bytes{namespace="$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone)
) * 100
)
metricUnit: percentage
- memory limit:
metric: |
sort_desc(sum(container_spec_memory_limit_bytes{namespace="$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone))
metricUnit: byte
- memory cache:
metric: |
sort_desc(sum(container_memory_cache{namespace="$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone))
metricUnit: byte
- memory swap:
metric: |
sum(container_memory_swap{namespace="$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone)
metricUnit: byte
- memory max usage:
metric: |
sum(container_memory_max_usage_bytes{namespace="$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone)
metricUnit: byte
- file descriptors:
metric: |
sort_desc(sum(container_file_descriptors{namespace="$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone))
metricUnit: counter
- up time:
metric: |
sum(time() - kube_pod_start_time{namespace="$namespace", pod=~"$pod"}) by (pod)
metricUnit: seconds
custom_key: "{{pod}}" # "{{pod}} - {{topology_ebs_csi_aws_com_zone}}"
advancedTableOptions:
tableType: plain # https://github.com/astanin/python-tabulate?tab=readme-ov-file#table-format
headersUppercase: true
autoConvertValue: true
showTableIndex: false
updateIntervalSeconds: 3
17 changes: 13 additions & 4 deletions dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ dashboard:
width: 80
maxHeight: 17
maxWidth: 45
updateIntervalSeconds: 5
updateIntervalSeconds: 2
historyData:
enable: true
time: 5m
Expand All @@ -123,7 +123,7 @@ dashboard:
width: 80
maxHeight: 17
maxWidth: 45
updateIntervalSeconds: 5
updateIntervalSeconds: 2
# historyData:
# enable: true
# time: 5m
Expand Down Expand Up @@ -168,12 +168,21 @@ dashboard:
enable: true
box: left_c
type: advancedTable
metricUnit: byte
advancedTableColumns:
- memory usage:
metric: |
sort_desc(sum(container_memory_usage_bytes{namespace="$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone))
metricUnit: byte
- memory usage %:
metric: |
sort_desc(
(
sum(container_memory_usage_bytes{namespace="$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone)
/
sum(container_spec_memory_limit_bytes{namespace="$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone)
) * 100
)
metricUnit: percentage
- memory limit:
metric: |
sort_desc(sum(container_spec_memory_limit_bytes{namespace="$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone))
Expand All @@ -190,7 +199,7 @@ dashboard:
- file descriptors:
metric: |
sort_desc(sum(container_file_descriptors{namespace="$namespace", pod=~"$pod"}) by (pod, topology_ebs_csi_aws_com_zone))
metricUnit: counter
metricUnit: None
- up time:
metric: |
sum(time() - kube_pod_start_time{namespace="$namespace", pod=~"$pod"}) by (pod)
Expand Down
191 changes: 0 additions & 191 deletions dashboard2.yaml

This file was deleted.

Loading

0 comments on commit 2e96f9b

Please sign in to comment.