From 92b39ca3217a0d3643e87553cd72bceac1158066 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 17 Oct 2017 16:11:56 +0200 Subject: Merging upstream version 20171017. Signed-off-by: Daniel Baumann --- CHANGELOG.txt | 11 ++ VERSION.txt | 2 +- bin/ceph-dns | 272 ++++++++++++++++++++++++++++++++++ bin/ceph-info | 2 +- share/ceph-info/web/ceph-version.txt | 1 - share/ceph-info/web/ceph-versions.txt | 1 + share/ceph-info/web/index.html | 8 +- share/logrotate/ceph-log | 2 +- share/logrotate/cephfs-snap | 2 +- 9 files changed, 292 insertions(+), 9 deletions(-) create mode 100755 bin/ceph-dns delete mode 120000 share/ceph-info/web/ceph-version.txt create mode 120000 share/ceph-info/web/ceph-versions.txt diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 21cd523..62e817c 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,14 @@ +2017-10-17 Daniel Baumann + + * Releasing version 20171017. + + [ Daniel Baumann ] + * Harmonizing titles in ceph-info index page. + * Setting rotate interval to 9999 in order to keep old logs by default for a very long time. + * Using new 'ceph versions' command (for luminous and newer) instead of 'ceph version' (up to kraken release) in ceph-info. + * Enlarging iframe for 'ceph status' in ceph-info. + * Adding ceph-dns. + 2017-04-10 Daniel Baumann * Releasing version 20170410. diff --git a/VERSION.txt b/VERSION.txt index 13e4391..47e14c9 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -20170410 +20171017 diff --git a/bin/ceph-dns b/bin/ceph-dns new file mode 100755 index 0000000..4bf7a8f --- /dev/null +++ b/bin/ceph-dns @@ -0,0 +1,272 @@ +#!/bin/sh + +# storage-tools - Additional utilities to manage storage related tasks +# Copyright (C) 2014-2017 Daniel Baumann +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set -e + +PROGRAM="$(basename ${0})" + +Parameters () +{ + GETOPT_LONGOPTIONS="number:,release:,zone:,with-reverse,with-round-robin,master:,mds:,mgr:,mon:,osd:,rgw:," + GETOPT_OPTIONS="n:,r:,z:,f:," + + PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${PROGRAM} --options ${GETOPT_OPTIONS} --shell sh -- ${@})" + + if [ "${?}" != "0" ] + then + echo "'${PROGRAM}': getopt exit" >&2 + exit 1 + fi + + eval set -- "${PARAMETERS}" + + while true + do + case "${1}" in + -n|--number) + NUMBER="${2}" + shift 2 + ;; + + -r|--release) + RELEASE="${2}" + shift 2 + ;; + + -z|--zone) + ZONE="${2}" + shift 2 + ;; + + --with-reverse) + WITH_REVERSE="true" + shift 1 + ;; + + --with-round-robin) + WITH_ROUND_ROBIN="true" + shift 1 + ;; + + --master) + MASTER="${2}" + shift 2 + ;; + + --mds) + MDS="${2}" + shift 2 + ;; + + --mgr) + MGR="${2}" + shift 2 + ;; + + --mon) + MON="${2}" + shift 2 + ;; + + --osd) + OSD="${2}" + shift 2 + ;; + + --rgw) + RGW="${2}" + shift 2 + ;; + + --) + shift 1 + break + ;; + + *) + echo "'${PROGRAM}': getopt error" >&2 + exit 1 + ;; + esac + done +} + +Usage () +{ + echo "Usage: ${PROGRAM} {create|check} [-n|--number NUMBER] [-r|--release RELEASE] [-z|--zone ZONE] [--with-reverse] [--with-round-robin] [--master MASTER_NUMBER] [--mds MDS_NUMBER] [--mgr MGR_NUMBER] [--mon MON_NUMBER] [--osd OSD_NUMBER] [--rgw RGW_NUMBER]" >&2 + exit 1 +} + +case "${1}" in + check) + ACTION="check" + ;; + + create) + ACTION="create" + ;; + + *) + Usage + ;; +esac + +shift 1 + +Parameters "${@}" + +NUMBER="${NUMBER:-3}" +RELEASE="${RELEASE:-luminous}" +ZONE="${ZONE:-ceph.example.net}" + +MASTER="${MASTER:-1}" +MDS="${MDS:-${NUMBER}}" +MGR="${MGR:-${NUMBER}}" +MON="${MON:-${NUMBER}}" +OSD="${OSD:-${NUMBER}}" +RGW="${RGW:-${NUMBER}}" + +RED="$(tput setaf 1)$(tput bold)" +GREEN="$(tput setaf 2)$(tput bold)" +WHITE="$(tput setaf 7)$(tput bold)" +NORMAL="$(tput sgr0)" + +STATUS_GOOD="${GREEN}✔${NORMAL}" +STATUS_BAD="${RED}✘${NORMAL}" +STATUS_UGLY="${WHITE}○${NORMAL}" + +cat << EOF +; Ceph DNS: Forward Entries for ${ZONE} +EOF + +# Run forward zone +for SERVICE in master mds mgr mon osd rgw +do + NUMBERS="$(eval "echo \$$(echo "${SERVICE}" | tr [a-z] [A-Z])")" + + for NUMBER in $(seq 1 ${NUMBERS}) + do + case "${SERVICE}" in + master) + CONTAINER="master" + ;; + + *) + CONTAINER="${SERVICE}${NUMBER}" + ;; + esac + + case "${CHECK}" in + true) + IP_ADDRESS="$(dig +short ${CONTAINER}.${RELEASE}.${ZONE} | tail -n1)" + + if [ -n "${IP_ADDRESS}" ] + then + IP_ADDRESS="${IP_ADDRESS} ${STATUS_GOOD}" + else + IP_ADDRESS="${STATUS_BAD}" + fi + ;; + + *) + IP_ADDRESS="FIXME" + ;; + esac + +cat << EOF + +${CONTAINER}.${RELEASE}.${ZONE} IN A ${IP_ADDRESS} +${CONTAINER}.${ZONE} IN CNAME ${CONTAINER}.${RELEASE}.${ZONE}. +EOF + + case "${SERVICE}" in + master) + ;; + + *) + if [ "${WITH_ROUND_ROBIN}" = "true" ] + then + +cat << EOF +${SERVICE}.${RELEASE}.${ZONE} IN A ${IP_ADDRESS} +${SERVICE}.${ZONE} IN A ${IP_ADDRESS} +EOF + + fi + ;; + esac + done +done + +case "${WITH_REVERSE}" in + true) + +cat << EOF + +; Ceph DNS: Reverse Entries for ${ZONE} + +EOF + + # Run reverse zone + for SERVICE in master mds mgr mon osd rgw + do + NUMBERS="$(eval "echo \$$(echo "${SERVICE}" | tr [a-z] [A-Z])")" + + for NUMBER in $(seq 1 ${NUMBERS}) + do + case "${SERVICE}" in + master) + CONTAINER="master" + ;; + + *) + CONTAINER="${SERVICE}${NUMBER}" + ;; + esac + + case "${CHECK}" in + true) + IP_ADDRESS="$(dig +short ${CONTAINER}.${RELEASE}.${ZONE} | tail -n1)" + + if [ -n "${IP_ADDRESS}" ] + then + HOST="$(dig +short -x ${IP_ADDRESS} | tail -n1)" + if [ -n "${HOST}" ] + then + STATUS="${STATUS_GOOD}" + else + STATUS="${STATUS_BAD}" + fi + else + STATUS="${STATUS_BAD}" + IP_ADDRESS="Nil" + fi + ;; + *) + IP_ADDRESS="FIXME" + ;; + esac + +cat << EOF +${IP_ADDRESS} IN PTR ${CONTAINER}.${RELEASE}.${ZONE}. ${STATUS} +EOF + + done + done + ;; +esac diff --git a/bin/ceph-info b/bin/ceph-info index 4a504b2..782772a 100755 --- a/bin/ceph-info +++ b/bin/ceph-info @@ -40,7 +40,7 @@ HOST="$(hostname -f)" mkdir -p "/var/log/${SOFTWARE}/${PROGRAM}" -for INFORMATION in ceph-status ceph-df ceph-osd-df ceph-osd-tree ceph-version +for INFORMATION in ceph-status ceph-df ceph-osd-df ceph-osd-tree ceph-versions do COMMAND="$(echo ${INFORMATION} | sed -e 's|-| |g')" diff --git a/share/ceph-info/web/ceph-version.txt b/share/ceph-info/web/ceph-version.txt deleted file mode 120000 index f440f1b..0000000 --- a/share/ceph-info/web/ceph-version.txt +++ /dev/null @@ -1 +0,0 @@ -/var/log/storage-tools/ceph-info/ceph-version.txt \ No newline at end of file diff --git a/share/ceph-info/web/ceph-versions.txt b/share/ceph-info/web/ceph-versions.txt new file mode 120000 index 0000000..cc77481 --- /dev/null +++ b/share/ceph-info/web/ceph-versions.txt @@ -0,0 +1 @@ +/var/log/storage-tools/ceph-log/ceph-versions.txt \ No newline at end of file diff --git a/share/ceph-info/web/index.html b/share/ceph-info/web/index.html index 95b059d..eeea131 100644 --- a/share/ceph-info/web/index.html +++ b/share/ceph-info/web/index.html @@ -45,7 +45,7 @@
Loading...

$ ceph status

-

+

$ ceph df

@@ -56,10 +56,10 @@

$ ceph osd tree

-

$ ceph version

-

+

$ ceph versions

+

-

Last Updated:

+

Last Updated

diff --git a/share/logrotate/ceph-log b/share/logrotate/ceph-log index cdf8bc7..7bcaf3f 100644 --- a/share/logrotate/ceph-log +++ b/share/logrotate/ceph-log @@ -7,7 +7,7 @@ missingok daily notifempty - rotate 365 + rotate 9999 prerotate service ceph-log stop > /dev/null 2>&1 endscript diff --git a/share/logrotate/cephfs-snap b/share/logrotate/cephfs-snap index e948edf..21aae15 100644 --- a/share/logrotate/cephfs-snap +++ b/share/logrotate/cephfs-snap @@ -7,5 +7,5 @@ missingok monthly notifempty - rotate 12 + rotate 9999 } -- cgit v1.2.3