Skip to content

Commit e9df079

Browse files
authored
Add simple migstats weekly cronjob using usagestats.py (#290)
Add simple `migstats` weekly cronjob using `usagestats.py` to generate various usage stats e.g. used on Server Admin page.
2 parents 97a92b2 + 4fdc781 commit e9df079

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
#
3+
# Run usagestats as mig user to generate stats for Server Admin
4+
5+
# We default to include disk use for gluster and lustre mounts and write
6+
# reports in various file formats
7+
su - mig -c "PYTHONPATH=__MIG_BASE__ mig/server/usagestats.py -t 'fuse.glusterfs lustre' -s AUTO -o 'txt json pickle csv'"
8+
9+
exit 0

mig/shared/install.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2341,6 +2341,7 @@ def _generate_confs_writefiles(options, user_dict, insert_list=[], cleanup_list=
23412341
("migcheckssl-template.sh.cronjob", "migcheckssl"),
23422342
("migacctexpire-template.sh.cronjob", "migacctexpire"),
23432343
("migverifyarchives-template.sh.cronjob", "migverifyarchives"),
2344+
("migstats-template.sh.cronjob", "migstats"),
23442345
("miglustrequota-template.sh.cronjob", "miglustrequota"),
23452346
]
23462347
overrides_out_name = {
@@ -2519,15 +2520,18 @@ def _generate_confs_instructions(options, user_dict):
25192520
sudo cp %(destination)s/mig{stateclean,errors,sftpmon,importdoi,notifyexpire} \\
25202521
/etc/cron.daily/
25212522
2522-
The migcheckssl, migverifyarchives, migacctexpire and miglustrequota files
2523-
are cron scripts to automatically check for LetsEncrypt certificate renewal,
2524-
run pending archive verification before sending a copy to tape,
2525-
generate account expire stats and create/update lustre quota.
2523+
The migcheckssl, migverifyarchives, migstats, migacctexpire and miglustrequota
2524+
files are cron scripts to automatically check for LetsEncrypt certificate
2525+
renewal, run pending archive verification before sending a copy to tape, save
2526+
various usage stats, generate account expire stats and create/update lustre
2527+
quota.
25262528
You can install them with:
25272529
chmod 700 %(destination)s/migcheckssl
25282530
sudo cp %(destination)s/migcheckssl /etc/cron.daily/
25292531
chmod 700 %(destination)s/migverifyarchives
25302532
sudo cp %(destination)s/migverifyarchives /etc/cron.hourly/
2533+
chmod 700 %(destination)s/migstats
2534+
sudo cp %(destination)s/migstats /etc/cron.weekly/
25312535
chmod 700 %(destination)s/migacctexpire
25322536
sudo cp %(destination)s/migacctexpire /etc/cron.monthly/
25332537
chmod 700 %(destination)s/miglustrequota
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
#
3+
# Run usagestats as mig user to generate stats for Server Admin
4+
5+
# We default to include disk use for gluster and lustre mounts and write
6+
# reports in various file formats
7+
su - mig -c "PYTHONPATH=/home/mig mig/server/usagestats.py -t 'fuse.glusterfs lustre' -s AUTO -o 'txt json pickle csv'"
8+
9+
exit 0

0 commit comments

Comments
 (0)