Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnixPB: Add Docker Overlay Check Plugin Script For Nagios #3825

Merged
merged 3 commits into from
Nov 27, 2024

Conversation

steelhead31
Copy link
Contributor

@steelhead31 steelhead31 commented Nov 27, 2024

Ref: #3797

Add a new script to be used by nagios for monitoring the size of the /var/lib/docker/overlay2 folder, and ensure it is installed alongside the other nagios plugins.

Checklist

VPC OK : https://ci.adoptium.net/job/VagrantPlaybookCheck/2008/

…ins/tasks/additional_plugins/check_docker_overlay2_size.sh

Co-authored-by: Stewart X Addison <[email protected]>
@steelhead31
Copy link
Contributor Author

Done, once this is merged and rolled out via the weekly updates, I'll add the monitoring into nagios.

@steelhead31 steelhead31 requested a review from sxa November 27, 2024 12:12
Copy link
Member

@sxa sxa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving on the assumption you check whether you agree with my symlink comment before merging :-)

fi

# Convert size to GB for display
FOLDER_SIZE_GB=$(echo "scale=2; $FOLDER_SIZE_BYTES / (1024 * 1024 * 1024)" | bc)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't see bc used often enough these days ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I based it on an existing script, but I wanted the parameters to be simple, rather than in bytes/kilobytes/megabytes :)

FOLDER_SIZE_GB=$(echo "scale=2; $FOLDER_SIZE_BYTES / (1024 * 1024 * 1024)" | bc)

# Determine Nagios status
if (( FOLDER_SIZE_BYTES > CRIT_THRESHOLD_BYTES )); then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that this needed $ prefxes but apparently not.
Also noting that while these two numbers are calculated within the script, this syntax prevents the issues described in https://yossarian.net/til/post/some-surprising-code-execution-sources-in-bash/ with using -gt and similar constructs, which is giong to take a bit of getting used to

…ins/tasks/additional_plugins/check_docker_overlay2_size.sh

Co-authored-by: Stewart X Addison <[email protected]>
@steelhead31 steelhead31 merged commit e23e780 into adoptium:master Nov 27, 2024
11 of 12 checks passed
@steelhead31 steelhead31 self-assigned this Nov 27, 2024
mahdipub pushed a commit to mahdipub/infrastructure that referenced this pull request Dec 5, 2024
)

* UnixPB: Add Docker Overlay Check Script For Nagios

* Update ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Nagios_Plugins/tasks/additional_plugins/check_docker_overlay2_size.sh

Co-authored-by: Stewart X Addison <[email protected]>

* Update ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Nagios_Plugins/tasks/additional_plugins/check_docker_overlay2_size.sh

Co-authored-by: Stewart X Addison <[email protected]>

---------

Co-authored-by: Stewart X Addison <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants