Skip to content

Based on the result of "kubectl top pod" (CPU & Memory), it calculates the average and records the average and maximum consumption recorded in each of the pods of the deployments.app of a namespace of a context.

License

Notifications You must be signed in to change notification settings

RAcl/mon-deployment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

mon-deployment

Description:

Based on the result of "kubectl top pod" (CPU & Memory), it calculates the average and records the average and maximum consumption recorded in each of the pods of the deployments.app of a namespace of a context.

monitor.sh use three simple question, Context, Namespace and Minutes, and start. Then show the temporal file and his cycle number.

Examples:

  • At the run

    Working in namespace "kube-system" of "cluster-dev" by "1440" minutes
    tmp-file: /tmp/tmp.pynyvz7c7p
    ciclo: 94 de 6863
    waiting...
  • At the end:

    DEPLOY             AVG-CPU   AVG-MEM  MAX-CPU  MAX-MEM  PODS
    api-server          176.35  20724.30     1531    26759  4.00
    front                 7.74    163.59      200      185  8.00
    nginxpxy-operator     1.14     27.48        3       29  1.00

view-tmp.sh allows you to view the snapshot of the temporal file, with watch you can view the changes.

Requires:

  • bash
  • bc
  • column
  • kubectl
  • kubectx

Install:

git clone git@github.com:RAcl/mon-deployment.git

Use:

monitor.sh

cd mon-deployment
./monitor.sh

Or

mon-deployment/monitor.sh

view-tmp.sh

cd mon-deployment
./view-tmp.sh tmp-file

Or

mon-deployment/view-tmp.sh tmp-file

Example:

watch -n 5 ./view-tmp.sh /tmp/tmp.pynyvz7c7p

Disclaimer

The scripts were built in Debian and are not fully tested.

While they should not do any harm, execution is at your own risk.

Warning:

This script monitor.sh change the context to the script's work context every cycle (kubectl top pod -n $namespace), then return to the initial context.

I do not recommend using other contexts while the script is running.

About

Based on the result of "kubectl top pod" (CPU & Memory), it calculates the average and records the average and maximum consumption recorded in each of the pods of the deployments.app of a namespace of a context.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages