summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt29
-rw-r--r--Makefile2
-rw-r--r--VERSION.txt2
-rwxr-xr-xbin/cephfs-snap56
l---------share/ceph-info/web/bootstrap.min.css1
l---------share/ceph-info/web/bootstrap.min.js1
l---------share/ceph-info/web/font-awesome1
-rw-r--r--share/ceph-info/web/index.html97
-rw-r--r--share/ceph-info/web/navbar.css8
-rw-r--r--share/cron/cephfs-snap1
-rw-r--r--share/doc/examples/storage-tools20
-rw-r--r--share/man/ceph-log.1.txt2
-rw-r--r--share/man/cephfs-snap.1.txt39
-rw-r--r--share/man/storage-tools.7.txt4
14 files changed, 220 insertions, 43 deletions
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 <daniel.baumann@open-infrastructure.net>
+
+ * 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 <locutusofborg@debian.org>.
+ * Updating installation section in storage-tools manpage.
+
2017-04-05 Daniel Baumann <daniel.baumann@open-infrastructure.net>
* 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 @@
-<html>
- <head>
- <title>ceph-info</title>
- <script type="text/javascript" src="jquery.min.js"></script>
- <script type="text/javascript" src="logtail.js"></script>
- <meta http-equiv="refresh" content="300" />
- </head>
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
+ <meta name="description" content="storage-tools: ceph-info">
+ <meta name="author" content="open-infrastructure.net">
+ <link rel="icon" type="image/png" href="favicon.png" />
- <body>
- <h1>ceph-info</h1>
+ <title>storage-tools: ceph-info</title>
- <h2>$ ceph --watch</h2>
- <div id="header"><a id="pause" href='#'>Pause</a></div>
- <pre id="data">Loading...</pre>
+ <!-- Bootstrap core CSS -->
+ <link href="bootstrap.min.css" rel="stylesheet">
- <h2>$ ceph status</h2>
- <p><iframe src="ceph-status.txt" frameborder="0" height="250" width="95%"></iframe></p>
+ <!-- Custom styles for this template -->
+ <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet">
+ <link href="navbar.css" rel="stylesheet">
- <h2>$ ceph df</h2>
- <p><iframe src="ceph-df.txt" frameborder="0" height="250" width="95%"></iframe></p>
+ <meta http-equiv="refresh" content="300" />
+ </head>
- <h2>$ ceph osd df</h2>
- <p><iframe src="ceph-osd-df.txt" frameborder="0" height="250" width="95%"></iframe></p>
+ <body>
- <h2>$ ceph osd tree</h2>
- <p><iframe src="ceph-osd-tree.txt" frameborder="0" height="250" width="95%"></iframe></p>
+ <div class="container">
- <h2>$ ceph version</h2>
- <p><iframe src="ceph-version.txt" frameborder="0" height="25" width="95%"></iframe></p>
+ <!-- Static navbar -->
+ <nav class="navbar navbar-default">
+ <div class="container-fluid">
+ <div class="navbar-header">
+ <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
+ <span class="sr-only">Toggle navigation</span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+ <a class="navbar-brand" href="https://open-infrastructure.net/software/storage-tools" style="color: black;"><b><i class="fa fa-fw fa-hdd-o" style="color: black;"></i> storage-tools: ceph-info</b></a>
+ </div>
+ </div><!--/.container-fluid -->
+ </nav>
- <h3>Last Updated:</h3>
- <p><iframe src="date.txt" frameborder="0" height="25" width="95%"></iframe></p>
- </body>
+ <!-- Content -->
+ <div id="header"><h2>$ ceph --watch <a class="pull-right" id="pause" href='#'>Pause</a></h2></div>
+<pre id="data">Loading...</pre>
+
+ <h2>$ ceph status</h2>
+ <p><iframe src="ceph-status.txt" frameborder="0" height="250" width="95%"></iframe></p>
+
+ <h2>$ ceph df</h2>
+ <p><iframe src="ceph-df.txt" frameborder="0" height="250" width="95%"></iframe></p>
+
+ <h2>$ ceph osd df</h2>
+ <p><iframe src="ceph-osd-df.txt" frameborder="0" height="250" width="95%"></iframe></p>
+
+ <h2>$ ceph osd tree</h2>
+ <p><iframe src="ceph-osd-tree.txt" frameborder="0" height="250" width="95%"></iframe></p>
+
+ <h2>$ ceph version</h2>
+ <p><iframe src="ceph-version.txt" frameborder="0" height="25" width="95%"></iframe></p>
+
+ <h3>Last Updated:</h3>
+ <p><iframe src="date.txt" frameborder="0" height="25" width="95%"></iframe></p>
+ <!-- /Content -->
+
+ <hr />
+
+ <footer>
+ <p><a class="text-muted" href="mailto:software@lists.open-infrastructure.net?subject=storage-tools/ceph-info:%20Bug%20Report"><i class="fa fa-fw fa-bug" style="color: black;"></i> Report a Bug</a> <a class="text-muted pull-right" href="https://sources.open-infrastructure.net/software/storage-tools"><i class="fa fa-fw fa-heart" style="color: #cc0000;"></i> Source Code</a></p>
+ </footer>
+
+ </div> <!-- /container -->
+
+ <!-- Bootstrap core JavaScript -->
+ <script src="jquery.min.js"></script>
+ <script>window.jQuery || document.write('<script src="jquery.min.js"><\/script>')</script>
+ <script src="bootstrap.min.js"></script>
+ <!-- Custom scripts for this template -->
+ <script src="logtail.js"></script>
+ </body>
</html>
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
-----------