From 97a1c5c982dff389c205cae1b074cd0f1cd7af60 Mon Sep 17 00:00:00 2001 From: Marno van der Molen Date: Tue, 3 Nov 2015 08:04:55 +0100 Subject: Improve critical/pending/ok logic for nagios check --- extra/nagios_check_failing_nodes.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'extra') diff --git a/extra/nagios_check_failing_nodes.rb b/extra/nagios_check_failing_nodes.rb index 27a5c66..abb34ba 100644 --- a/extra/nagios_check_failing_nodes.rb +++ b/extra/nagios_check_failing_nodes.rb @@ -23,12 +23,12 @@ json.each do |node| end end -if pending - puts '[WARN] Pending backup: ' + pending_nodes.join(',') - exit 1 -elsif critical +if critical puts '[CRIT] Unable to backup: ' + critical_nodes.join(',') exit 2 +elsif pending + puts '[WARN] Pending backup: ' + pending_nodes.join(',') + exit 1 else puts '[OK] Backup of all nodes completed successfully.' exit 0 -- cgit v1.2.1 From eebdc62dfd61e6e43d8374ef669428f4432b0c26 Mon Sep 17 00:00:00 2001 From: Dan Baugher Date: Wed, 11 Nov 2015 23:50:17 -0500 Subject: Added upstart job for ubuntu RVM installs --- extra/rvm.oxidized.upstart | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 extra/rvm.oxidized.upstart (limited to 'extra') diff --git a/extra/rvm.oxidized.upstart b/extra/rvm.oxidized.upstart new file mode 100644 index 0000000..23b5d69 --- /dev/null +++ b/extra/rvm.oxidized.upstart @@ -0,0 +1,18 @@ +start on started networking + +respawn + +setuid oxidized +setgid oxidized + +chdir /home/oxidized + +env HOME=/home/oxidized + +pre-start script + test -x /usr/local/rvm/wrappers/ruby-2.1.2/oxidized || { stop; exit 0; } +end script + +script + exec /usr/local/rvm/wrappers/ruby-2.1.2/oxidized +end script \ No newline at end of file -- cgit v1.2.1 From 18d084a99dad9c49a5123a67b19aad6540f15e11 Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Sun, 27 Dec 2015 19:33:36 +0000 Subject: Added git-to-email script --- extra/oxidized-report-git-commits | 75 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 extra/oxidized-report-git-commits (limited to 'extra') diff --git a/extra/oxidized-report-git-commits b/extra/oxidized-report-git-commits new file mode 100755 index 0000000..40fd2f4 --- /dev/null +++ b/extra/oxidized-report-git-commits @@ -0,0 +1,75 @@ +#!/bin/sh +# +# A script to maintain a local working copy of an oxidized configuration +# repository and mail out diffs for configuration changes +# +# Copyright 2016 Nick Hilliard , All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# usage: add the following hook to the oxidized config file: +# +# hooks: +# email_output: +# type: exec +# events: [post_store, node_fail] +# cmd: 'update-local-repo.sh ~/gitdir/ | mail -s "Oxidized updates for ${OX_NODE_NAME}" update-recipient@example.com' +# async: true +# timeout: 120 +# + +PATH=${PATH}:/usr/local/bin:/usr/local/sbin +export PATH + +gitdir=$1 + +if [ X${OX_REPO_COMMITREF} = "X" ]; then + echo \$OX_REPO_COMMITREF not set + exit 64 +fi + +if [ X${OX_REPO_NAME} = "X" ]; then + echo \$OX_REPO_NAME not set + exit 64 +fi + +if [ ! -d ${gitdir}/.git ]; then + git clone -q ${OX_REPO_NAME} ${gitdir} + + ret=$? + if [ X"${ret}" != X0 ] && [ X"${ret}" != X1 ]; then + echo git clone failed: aborting. + exit 128 + fi +fi + +cd ${gitdir} + +git pull -q > /dev/null 2>&1 +ret=$? +if [ X"${ret}" != X0 ] && [ X"${ret}" != X1 ]; then + echo git pull failed: aborting. + exit 128 +fi + +# Git is probably working at this stage, so safe to emit more info + +echo "Node name: ${OX_NODE_NAME}" +echo "Group Name: ${OX_NODE_GROUP}" +echo "Job Time: ${OX_JOB_TIME}" +echo "Git Commit ID: ${OX_REPO_COMMITREF}" +echo "Git Repo: ${OX_REPO_NAME}" +echo "Local working dir: ${gitdir}" +echo "" + +git diff --no-color ${OX_REPO_COMMITREF}~1..${OX_REPO_COMMITREF} -- cgit v1.2.1 From 1300400441870f0caad1f01f447a4d887c67b330 Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Sun, 27 Dec 2015 19:45:12 +0000 Subject: added warning not to set the staging directory to be the same as the git repo --- extra/oxidized-report-git-commits | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'extra') diff --git a/extra/oxidized-report-git-commits b/extra/oxidized-report-git-commits index 40fd2f4..2b1a2d7 100755 --- a/extra/oxidized-report-git-commits +++ b/extra/oxidized-report-git-commits @@ -27,6 +27,11 @@ # async: true # timeout: 120 # +# +# The script takes a single argument, namely a git working directory name, +# e.g. "~/gitdir/". This is only used as a staging directory and should +# not be set to be the same as the git repo directory. +# PATH=${PATH}:/usr/local/bin:/usr/local/sbin export PATH -- cgit v1.2.1