-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ajoute des graphes Munin pour la taille de certains dossiers
- Loading branch information
1 parent
10f13d7
commit d344419
Showing
4 changed files
with
125 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/bin/bash | ||
|
||
: <<=cut | ||
=head1 NAME | ||
du - Size of directories | ||
=head1 CONFIGURATION | ||
Put this file in "/usr/local/share/munin/plugins/du_". Then, create a symbolic | ||
link to this file called, for instance, "du_work". "work" will be the name of | ||
the graph. | ||
The configuration should look like the following: | ||
[du_work] | ||
env.directories /path/to/dir1 /path/to/dir2 | ||
env.prefix /path/to/ | ||
env.critical 1073741824 | ||
- "directories" contains a space-separated list of directories to report size of. | ||
- "prefix" (optionnal) is the prefix of directories to hide in graph labels. | ||
- "critical" (optionnal) is the critical size (in bytes) for all directories. | ||
=cut | ||
|
||
GRAPH_NAME=${0##*du_} | ||
DIRECTORIES=${directories:-UNSET} | ||
CRITICAL=${critical:-UNSET} | ||
PREFIX=${prefix:-UNSET} | ||
|
||
|
||
case $1 in | ||
config) | ||
echo "graph_title Directory size $GRAPH_NAME" | ||
echo "graph_category disk" | ||
echo "graph_args --base 1024 -l 0" | ||
echo "graph_vlabel Size" | ||
echo "graph_info Graph of size occupied by directories" | ||
|
||
if [ "$DIRECTORIES" != "UNSET" ]; then | ||
for d in $DIRECTORIES | ||
do | ||
slug=$(echo $d | sed 's/\//_/g') | ||
|
||
if [ "$PREFIX" != "UNSET" ]; then | ||
echo "${slug}.label ${d#"$PREFIX"}" | ||
else | ||
echo "${slug}.label $d" | ||
fi | ||
echo "${slug}.type GAUGE" | ||
echo "${slug}.draw LINE1" | ||
|
||
if [ "$CRITICAL" != "UNSET" ]; then | ||
echo "${slug}.critical $CRITICAL" | ||
fi | ||
done | ||
fi | ||
|
||
exit 0;; | ||
esac | ||
|
||
if [ "$DIRECTORIES" != "UNSET" ]; then | ||
for d in $DIRECTORIES | ||
do | ||
slug=$(echo $d | sed 's/\//_/g') | ||
echo "${slug}.value $(du -sb $d | cut -f 1)" | ||
done | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[du_backup] | ||
user root | ||
env.directories {{ backupdir }}/data {{ backupdir }}/db {{ backupdir }}/matomo {{ backupdir }}/vaultwarden | ||
env.prefix {{ backupdir }}/ | ||
env.critical 161061273600 # 150 Go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[du_mysql-backup] | ||
user root | ||
env.directories /var/backups/mysql | ||
|
||
[du_zds-data] | ||
user root | ||
env.directories {{ datadir }}/contents-private {{ datadir }}/contents-public {{ datadir }}/media {{ datadir }}/static | ||
env.prefix {{ datadir }} | ||
|
||
[du_zds-db] | ||
user root | ||
env.directories /var/lib/mysql/prod |