added new plugin: "kernel_same_page_merging" (#1271)

This commit is contained in:
Michael Grote 2021-12-21 12:13:42 +01:00 committed by GitHub
parent db27ad4597
commit adcc2f54e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 73 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

View File

@ -0,0 +1,73 @@
#!/bin/bash
#%# family=auto
: << EOF
=head1 NAME
kernel_same_page_merging - Outputs various metrics about same page merging.
=head1 AUTHOR
=over 4
=item * Michael Grote
=back
=head1 LICENSE
GPLv3 or later
SPDX-License-Identifier: GPL-3.0-or-later
=head1 MAGIC MARKERS
=begin comment
These magic markers are used by munin-node-configure when installing
munin-node.
=end comment
#%# family=auto
=cut
EOF
#
# Variablen
ksm_dir_run="/sys/kernel/mm/ksm/run"
function print_labels {
cat << EOF
graph_title kernel same page merging
graph_category system
graph_order pages_unshared pages_volatile pages_shared pages_sharing
pages_shared.info how many shared pages are being used
pages_sharing.info how many more sites are sharing them i.e. how much saved
pages_unshared.info how many pages unique but repeatedly checked for merging
pages_volatile.info how many pages changing too fast to be placed in a tree
pages_shared.label pages shared
pages_sharing.label pages sharing
pages_unshared.label pages unshared
pages_volatile.label pages volatile
pages_shared.draw AREASTACK
pages_sharing.draw AREASTACK
pages_unshared.draw AREASTACK
pages_volatile.draw AREASTACK
EOF
}
# wenn parameter = ...
if [ "$1" = "autoconf" ]; then
# prüfe ob ksm aktiviert ist
if [ ! -f "$ksm_dir_run" ]; then
echo "no ($ksm_dir_run not found)"
exit 0
fi
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
# setze label
print_labels
exit 0
fi
echo pages_shared.value $(cat "/sys/kernel/mm/ksm/pages_shared")
echo pages_sharing.value $(cat "/sys/kernel/mm/ksm/pages_sharing")
echo pages_unshared.value $(cat "/sys/kernel/mm/ksm/pages_unshared")
echo pages_volatile.value $(cat "/sys/kernel/mm/ksm/pages_volatile")