From c942987a96449cc168c1b50397680c73998932ab Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 11 Apr 2017 00:07:56 +0200 Subject: Merging upstream version 20170410. Signed-off-by: Daniel Baumann --- CHANGELOG.txt | 29 +++++++++++ Makefile | 2 +- VERSION.txt | 2 +- bin/cephfs-snap | 56 +++++++++++++++----- share/ceph-info/web/bootstrap.min.css | 1 + share/ceph-info/web/bootstrap.min.js | 1 + share/ceph-info/web/font-awesome | 1 + share/ceph-info/web/index.html | 97 ++++++++++++++++++++++++++--------- share/ceph-info/web/navbar.css | 8 +++ share/cron/cephfs-snap | 1 + share/doc/examples/storage-tools | 20 ++++++++ share/man/ceph-log.1.txt | 2 +- share/man/cephfs-snap.1.txt | 39 +++++++++++++- share/man/storage-tools.7.txt | 4 ++ 14 files changed, 220 insertions(+), 43 deletions(-) create mode 120000 share/ceph-info/web/bootstrap.min.css create mode 120000 share/ceph-info/web/bootstrap.min.js create mode 120000 share/ceph-info/web/font-awesome create mode 100644 share/ceph-info/web/navbar.css create mode 100644 share/doc/examples/storage-tools diff --git a/CHANGELOG.txt b/CHANGELOG.txt index c216033..21cd523 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,32 @@ +2017-04-10 Daniel Baumann + + * Releasing version 20170410. + * Backward incompatible changes: + - cephfs-snap changed name of snapshots: + + old: ${TYPE}_${YEAR}-${MONTH}-${DAY}_${HOUR}${MINUTES}${TIMEZONE} + + new: ${YEAR}-${MONTH}-${DAY}_${HOUR}${MINUTES}${SECONDS}${TIMEZONE}_${TYPE} + - cephfs-snap changed logfile location, now in /var/log/storage-tools/cephfs-snap/cephfs-snap.log + + [ Daniel Baumann ] + * Adding support for snapshot rotation in cephfs-snap. + * Adding support for manual snapshots cephfs-snap. + * Adding seconds to snapshot names in cephfs-snap. + * Changing name of snapshots from TYPE_TIME to TIME_TYPE in cephfs-snap for better sorting. + * Moving cephfs-snap logfile from /var/log/storage-tools/cephfs-snap.log to /var/log/storage-tools/cephfs-snap/cephfs-snap.log. + * Correcting typo in cephfs-snap usage message. + * Adding yearly snapshot interval in cephfs-snap. + * Moving notification in cephfs-snap to the end. + * Adding cron reference in cephfs-snap manpage. + * Adding logfile reference in cephfs-snap manpage. + * Adding configuration file section in cephfs-snap manpage. + * Adding example configuration file. + * Updating naming of cephfs-snap variables to consistent namespace. + * Adding ceph-info symlinks for twitter-bootstrap3. + * Adding ceph-info symlink for fonts-font-awesome. + * Updating ceph-info html to use twitter-bootstrap3 and fonts-font-awesome. + * Correcting spelling typo in ceph-log manpage, thanks to Gianfranco Costamagna . + * Updating installation section in storage-tools manpage. + 2017-04-05 Daniel Baumann * Releasing version 20170405. diff --git a/Makefile b/Makefile index c150a59..c73b61e 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ install: build cp -r share/ceph-info $(DESTDIR)/usr/share/$(SOFTWARE) mkdir -p $(DESTDIR)/usr/share/doc/$(SOFTWARE) - cp -r CHANGELOG.txt LICENSE.txt README.txt $(DESTDIR)/usr/share/doc/$(SOFTWARE) + cp -r CHANGELOG.txt LICENSE.txt README.txt share/doc/* $(DESTDIR)/usr/share/doc/$(SOFTWARE) mkdir -p $(DESTDIR)/etc/apache2/conf-available cp -a share/apache/conf/* $(DESTDIR)/etc/apache2/conf-available diff --git a/VERSION.txt b/VERSION.txt index 68b5226..13e4391 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -20170405 +20170410 diff --git a/bin/cephfs-snap b/bin/cephfs-snap index d846ef4..52548d3 100755 --- a/bin/cephfs-snap +++ b/bin/cephfs-snap @@ -21,11 +21,11 @@ set -e SOFTWARE="storage-tools" PROGRAM="cephfs-snap" -ACTION="${1}" +ACTION="${1:-manual}" Usage () { - echo "Usage: ${PROGRAM} {hourly|daily|weekly|hourly}" >&2 + echo "Usage: ${PROGRAM} {hourly|daily|weekly|monthly|yearly}" >&2 exit 1 } @@ -43,15 +43,24 @@ case "${CEPHFS_SNAP}" in ;; esac -if [ -z "${CEPHFS_DIRECTORIES}" ] +if [ -z "${CEPHFS_SNAP_DIRECTORIES}" ] then echo "E: no cephfs directories defined in /etc/default/${SOFTWARE}" >&2 exit 1 fi case "${ACTION}" in - hourly|daily|weekly|monthly) + hourly|daily|weekly|monthly|yearly) + ROTATION="$(eval "echo \${CEPHFS_SNAP_$(echo "${ACTION}" | tr [a-z] [A-Z])}")" + + if [ -z "${ROTATION}" ] + then + echo "E: no cephfs snapshot rotation for ${ACTION} defined in /etc/default/${SOFTWARE}" >&2 + exit 1 + fi + ;; + manual) ;; *) @@ -60,14 +69,39 @@ case "${ACTION}" in esac # Run +TIME="$(date +%Y-%m-%d_%H%M%S%z)" +SNAPSHOT="${TIME}_${ACTION}" + +for CEPHFS_SNAP_DIRECTORY in ${CEPHFS_SNAP_DIRECTORIES} +do + cd "${CEPHFS_SNAP_DIRECTORY}"/.snap + mkdir "${SNAPSHOT}" + + case "${ACTION}" in + manual) + ;; + + *) + if [ "$(ls -d *_"${ACTION}" | wc -l)" -gt "${ROTATION}" ] + then + # more snapshots available than configured to keep + SNAPS="$(ls -d *_"${ACTION}" | sort -r | tail -n +$((${ROTATION} + 1)))" + + for SNAP in ${SNAPS} + do + rmdir "${SNAP}" + done + fi + ;; + esac +done + DATE="$(date +%Y-%m-%d\ %H:%M:%S)" HOST="$(hostname -f)" -TIME="$(date +%Y-%m-%d_%H%M%z)" -SNAPSHOT="${ACTION}_${TIME}" - # logfile -echo "${DATE} ${HOST} ${PROGRAM} creating ${ACTION} snapshots" >> "/var/log/${SOFTWARE}/${PROGRAM}.log" +mkdir -p "/var/log/${SOFTWARE}/${PROGRAM}" +echo "${DATE} ${HOST} ${PROGRAM} creating ${ACTION} snapshots" >> "/var/log/${SOFTWARE}/${PROGRAM}/${PROGRAM}.log" # irc if [ -e /usr/bin/irk ] && [ -e "/etc/default/${SOFTWARE}" ] @@ -80,9 +114,3 @@ then done fi fi - -for CEPHFS_DIRECTORY in ${CEPHFS_DIRECTORIES} -do - cd "${CEPHFS_DIRECTORY}"/.snap - mkdir "${SNAPSHOT}" -done diff --git a/share/ceph-info/web/bootstrap.min.css b/share/ceph-info/web/bootstrap.min.css new file mode 120000 index 0000000..ca97db2 --- /dev/null +++ b/share/ceph-info/web/bootstrap.min.css @@ -0,0 +1 @@ +/usr/share/javascript/bootstrap/css/bootstrap.min.css \ No newline at end of file diff --git a/share/ceph-info/web/bootstrap.min.js b/share/ceph-info/web/bootstrap.min.js new file mode 120000 index 0000000..22d433b --- /dev/null +++ b/share/ceph-info/web/bootstrap.min.js @@ -0,0 +1 @@ +/usr/share/javascript/bootstrap/js/bootstrap.min.js \ No newline at end of file diff --git a/share/ceph-info/web/font-awesome b/share/ceph-info/web/font-awesome new file mode 120000 index 0000000..3437336 --- /dev/null +++ b/share/ceph-info/web/font-awesome @@ -0,0 +1 @@ +/usr/share/fonts-font-awesome \ No newline at end of file diff --git a/share/ceph-info/web/index.html b/share/ceph-info/web/index.html index b55f637..95b059d 100644 --- a/share/ceph-info/web/index.html +++ b/share/ceph-info/web/index.html @@ -1,34 +1,81 @@ - - - ceph-info - - - - + + + + + + + + + + - -

ceph-info

+ storage-tools: ceph-info -

$ ceph --watch

- -
Loading...
+ + -

$ ceph status

-

+ + + -

$ ceph df

-

+ + -

$ ceph osd df

-

+ -

$ ceph osd tree

-

+
-

$ ceph version

-

+ + -

Last Updated:

-

- + + +
Loading...
+ +

$ ceph status

+

+ +

$ ceph df

+

+ +

$ ceph osd df

+

+ +

$ ceph osd tree

+

+ +

$ ceph version

+

+ +

Last Updated:

+

+ + +
+ + + +
+ + + + + + + + diff --git a/share/ceph-info/web/navbar.css b/share/ceph-info/web/navbar.css new file mode 100644 index 0000000..d219524 --- /dev/null +++ b/share/ceph-info/web/navbar.css @@ -0,0 +1,8 @@ +body { + padding-top: 20px; + padding-bottom: 20px; +} + +.navbar { + margin-bottom: 20px; +} diff --git a/share/cron/cephfs-snap b/share/cron/cephfs-snap index 40340b6..ced26c7 100644 --- a/share/cron/cephfs-snap +++ b/share/cron/cephfs-snap @@ -2,3 +2,4 @@ 0 0 * * * root [ -e /usr/bin/cephfs-snap ] && /usr/bin/cephfs-snap daily 0 0 * * 1 root [ -e /usr/bin/cephfs-snap ] && /usr/bin/cephfs-snap weekly 0 0 * 1 * root [ -e /usr/bin/cephfs-snap ] && /usr/bin/cephfs-snap monthly +0 0 1 1 * root [ -e /usr/bin/cephfs-snap ] && /usr/bin/cephfs-snap yearly diff --git a/share/doc/examples/storage-tools b/share/doc/examples/storage-tools new file mode 100644 index 0000000..c74cb78 --- /dev/null +++ b/share/doc/examples/storage-tools @@ -0,0 +1,20 @@ +# /etc/default/storage-tools + +CEPH_INFO="true" +CEPH_LOG="true" + +CEPHFS_SNAP="true" +CEPHFS_SNAP_DIRECTORIES="" + +# keep hourly snapshots for 1 week: (24 * 7) + 1 +CEPHFS_SNAP_HOURLY="169" +# keep daily snapshots for 1 month: (31) + 1 +CEPHFS_SNAP_DAILY="32" +# keep weekly snapshots for 6 months: (4 * 6) + 1 +CEPHFS_SNAP_WEEKLY="25" +# keep monthly snapshots for 1 year: (12) + 1 +CEPHFS_SNAP_MONTHLY="13" +# keep yearly snapshots for 10 year: (10) + 1 +CEPHFS_SNAP_YEARLY="11" + +IRK_TARGETS="" diff --git a/share/man/ceph-log.1.txt b/share/man/ceph-log.1.txt index c3fe237..997db04 100644 --- a/share/man/ceph-log.1.txt +++ b/share/man/ceph-log.1.txt @@ -39,7 +39,7 @@ administrator watch everything that is happening in a ceph cluster, such as the health state of the cluster, any cluster changes and any commands and mounts from clients that are happening. -Unfortunatly the 'ceph -w' command is a tool that a system administrator uses +Unfortunately the 'ceph -w' command is a tool that a system administrator uses for real time information, means there is no history or looking backward what happened at a given time. diff --git a/share/man/cephfs-snap.1.txt b/share/man/cephfs-snap.1.txt index 972bcd0..06b1ab7 100644 --- a/share/man/cephfs-snap.1.txt +++ b/share/man/cephfs-snap.1.txt @@ -29,7 +29,9 @@ cephfs-snap - create CephFS snapshots periodically SYNOPSIS -------- -*cephfs-snap* {hourly|daily|weekly|monthly} +*cephfs-snap* + +*cephfs-snap* [hourly|daily|weekly|monthly] DESCRIPTION @@ -40,13 +42,48 @@ backups. The cephfs-snap program is a simple tool to do this periodically. +CONFIGURATION +------------- +cephfs-snap is configured in /etc/default/storage-tools. The following variables are used: + +*CEPHFS_SNAP*:: + Boolean, either true or false. If set to false (default), cephfs will do nothing. + +*CEPHFS_SNAP_DIRECTORIES*:: + List of one or more space separated directories. If no directory is specified, cephfs-snap will do nothing. + +*CEPHFS_SNAP_HOURLY*:: + Integer, number of how many most recent hourly snapshots are to be kept at any given time. Any older snapshots will be removed. Note: specify one more than you wan to keep, e.g. 25 for one day of hourly snapshots alongside the most current one. + +*CEPHFS_SNAP_DAILY*:: + Integer, number of how many most recent daily snapshots are to be kept at any given time. + +*CEPHFS_SNAP_WEEKLY*:: + Integer, number of how many most recent weekly snapshots are to be kept at any given time. + +*CEPHFS_SNAP_MONTHLY*:: + Integer, number of how many most recent monthly snapshots are to be kept at any given time. + +*CEPHFS_SNAP_YEARLY*:: + Integer, number of how many most recent yearly snapshots are to be kept at any given time. + +*IRK_TARGETS*:: + List of space separated IRC channels to send notifications to, e.g.: irc://irc.oftc.net:6668/open-infrastructure + + FILES ----- The following files are used: +*/etc/cron.d/cephfs-snap*:: + Cron file. + */etc/default/storage-tools*:: Configuration file. +*/var/log/storage-tools/cephfs-snap*:: + Log files. + SEE ALSO -------- diff --git a/share/man/storage-tools.7.txt b/share/man/storage-tools.7.txt index 20bae0b..a5133d1 100644 --- a/share/man/storage-tools.7.txt +++ b/share/man/storage-tools.7.txt @@ -54,6 +54,10 @@ SOURCE 2. git clone https://sources.open-infrastructure.net/software/storage-tools 3. cd storage-tools && sudo make install +DEBIAN 10 (BUSTER) AND NEWER +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * sudo apt install storage-tools + DEVELOPMENT ----------- -- cgit v1.2.3