Monitoring with munin

This commit is contained in:
Root srvweb 2020-06-16 10:13:54 +02:00
parent 2b285ac34e
commit 63905850f2
5 changed files with 125 additions and 4 deletions

View File

@ -39,6 +39,10 @@ to
expireCron: cli
### Security
https://github.com/blueimp/jQuery-File-Upload/blob/master/SECURITY.md#secure-file-upload-serving-configurations
## Changelog
- futur
@ -80,6 +84,28 @@ to
- Housekeeping in files expired by cron job or by web traffic on the page
- Personnalize content page with include header-page.php, header.php, footer-page.php, footer.php, start-home.php, end-home.php
# Monitoring with munin
```bash
cd munin
cp file2link_* /etc/munin/plugins/
```
On /etc/munin/plugin-conf.d/munin-node file, add your "files" dir :
```ini
[...]
[file2link_*]
env.dir /var/www/dl.zici.fr/files
```
And restart munin node
```bash
/etc/init.d/munin-node restart
```
# Licence
Beerware : https://en.wikipedia.org/wiki/Beerware

View File

@ -32,7 +32,7 @@ maxUploadPerFile: 30M
minUploadPerFile: 1 # Exemple 100K, 30M, 12G
maxUploadTotal: 90M # Exemple 100K, 30M, 12G
maxUploadNb: 100
acceptFileTypes: '/(\.|\/)(pdf|od[a-z]|doc[a-z]?|xls[a-z]?|csv|ppt[a-z]?|7z|zip|bz|bz2|rar|tar|gz|tgz|txt|md|gif|jpe?g|png|bmp|ico|mp3|aac|mid|wav|ov[a-z]|web.?|avi|mp[a-z]?g|mp.+|wm.+|xml|iso|torrent)$/i'
acceptFileTypes: '/(\.|\/)(pdf|xml|od[a-z]|doc[a-z]?|xls[a-z]?|csv|ppt[a-z]?|7z|zip|bz|bz2|rar|tar|gz|tgz|txt|md|gif|jpe?g|png|svg|bmp|ico|mp3|aac|mid|wav|ov[a-z]|web.?|avi|mp[a-z]?g|mov|mp.+|wm.+|xml|iso|torrent)$/i'
#~ Set to 0 to use the GD library to scale and orient images,
#~ set to 1 to use imagick (if installed, falls back to GD),
#~ set to 2 to use the ImageMagick convert binary directly:

View File

@ -1038,10 +1038,12 @@ if ($passwordForm == false) {
}
},
failed: function (e, data) {
console.log(data);
console.log(e);
// Si un upload est en cours
if (data.loaded > 0) {
//~ console.log(data);
location.href='<?= $config['baseUrl']?>/'+$('#files_id').val()+'/';
//~ location.href='<?= $config['baseUrl']?>/'+$('#files_id').val()+'/';
$('#files_id').val(idGen());
$('#shareUrl').val('<?= $config['baseUrl'] ?>/' + $('#files_id').val() + '/');
var keyGen = Math.floor(Math.random() * (999999999999 - 100000000000) + 100000000000);
@ -1089,8 +1091,7 @@ if ($passwordForm == false) {
setTimeout(redirectToFiles, 1000);
}
});
<?php if ($action == 'html') { ?>
$('#files_id').val('<?= $id ?>');
<?php } else { ?>

47
munin/file2link_count Executable file
View File

@ -0,0 +1,47 @@
#!/bin/sh
if [ -z $dir ]; then
dir='/var/www/file2link/files/'
fi
output_config() {
echo "graph_title File2link Statistic Count"
echo "file2link_nb.label count files hosting"
}
output_values() {
printf "file2link_nb.value %d\n" $(number_of_file)
}
number_of_file() {
ls $dir | wc -l
}
size_of_file() {
du -s $dir/ | cut -f1
}
output_usage() {
printf >&2 "%s - munin plugin to graph file2link\n" ${0##*/}
printf >&2 "Usage: %s [config]\n" ${0##*/}
}
case $# in
0)
output_values
;;
1)
case $1 in
config)
output_config
;;
*)
output_usage
exit 1
;;
esac
;;
*)
output_usage
exit 1
;;
esac

47
munin/file2link_size Executable file
View File

@ -0,0 +1,47 @@
#!/bin/sh
if [ -z $dir ]; then
dir='/var/www/file2link/files/'
fi
output_config() {
echo "graph_title File2link Statistic Size"
echo "file2link_size.label Total size of files hosting"
}
output_values() {
printf "file2link_size.value %d000\n" $(size_of_file)
}
number_of_file() {
ls $dir | wc -l
}
size_of_file() {
du -s $dir/ | cut -f1
}
output_usage() {
printf >&2 "%s - munin plugin to graph file2link\n" ${0##*/}
printf >&2 "Usage: %s [config]\n" ${0##*/}
}
case $# in
0)
output_values
;;
1)
case $1 in
config)
output_config
;;
*)
output_usage
exit 1
;;
esac
;;
*)
output_usage
exit 1
;;
esac