diff options
author | Jun Kuriyama <kuriyama@FreeBSD.org> | 2010-04-29 11:18:25 +0000 |
---|---|---|
committer | Jun Kuriyama <kuriyama@FreeBSD.org> | 2010-04-29 11:18:25 +0000 |
commit | 91f1b886d039e2aa511f3ecfd0a526913d420879 (patch) | |
tree | 947d0338aa735154f7abff0122eba60cf9ca628b | |
parent | c9d5849d07d30191c0652660bf03c32829b9b32b (diff) | |
download | ports-91f1b886d039e2aa511f3ecfd0a526913d420879.tar.gz ports-91f1b886d039e2aa511f3ecfd0a526913d420879.zip |
Notes
-rw-r--r-- | net-mgmt/Makefile | 1 | ||||
-rw-r--r-- | net-mgmt/nagios-check_kumofs/Makefile | 35 | ||||
-rw-r--r-- | net-mgmt/nagios-check_kumofs/files/check_kumomgr.in | 65 | ||||
-rw-r--r-- | net-mgmt/nagios-check_kumofs/files/check_kumosvr.in | 52 | ||||
-rw-r--r-- | net-mgmt/nagios-check_kumofs/pkg-descr | 4 |
5 files changed, 157 insertions, 0 deletions
diff --git a/net-mgmt/Makefile b/net-mgmt/Makefile index 207f9a9b0fb1..3aec0b4d84b1 100644 --- a/net-mgmt/Makefile +++ b/net-mgmt/Makefile @@ -113,6 +113,7 @@ SUBDIR += nagios-check_bacula SUBDIR += nagios-check_clamav SUBDIR += nagios-check_ice + SUBDIR += nagios-check_kumofs SUBDIR += nagios-check_nick SUBDIR += nagios-check_ports SUBDIR += nagios-check_puppet diff --git a/net-mgmt/nagios-check_kumofs/Makefile b/net-mgmt/nagios-check_kumofs/Makefile new file mode 100644 index 000000000000..bb91a354312b --- /dev/null +++ b/net-mgmt/nagios-check_kumofs/Makefile @@ -0,0 +1,35 @@ +# New ports collection makefile for: nagios-check_kumofs +# Date created: 29 Apr 2010 +# Whom: Jun Kuriyama <kuriyama@FreeBSD.org> +# +# $FreeBSD$ +# + +PORTNAME= check_kumofs +PORTVERSION= 0.20100118 +CATEGORIES= net-mgmt +MASTER_SITES= # none +PKGNAMEPREFIX= nagios- +DISTFILES= # none + +MAINTAINER= kuriyama@FreeBSD.org +COMMENT= Nagios plugin for kumofs manager/server + +RUN_DEPENDS= \ + nagios-plugins>0:${PORTSDIR}/net-mgmt/nagios-plugins \ + kumoctl:${PORTSDIR}/databases/kumofs + +PLIST_FILES= libexec/nagios/check_kumomgr libexec/nagios/check_kumosvr + +do-build: + ${MKDIR} ${WRKSRC} +.for f in check_kumomgr check_kumosvr + ${SED} -e 's|/usr/local|${PREFIX}|' ${FILESDIR}/${f}.in > ${WRKSRC}/${f} +.endfor + +do-install: +.for f in check_kumomgr check_kumosvr + ${INSTALL_SCRIPT} ${WRKSRC}/${f} ${PREFIX}/libexec/nagios/${f} +.endfor + +.include <bsd.port.mk> diff --git a/net-mgmt/nagios-check_kumofs/files/check_kumomgr.in b/net-mgmt/nagios-check_kumofs/files/check_kumomgr.in new file mode 100644 index 000000000000..61084edb852a --- /dev/null +++ b/net-mgmt/nagios-check_kumofs/files/check_kumomgr.in @@ -0,0 +1,65 @@ +#!/usr/bin/env ruby +# +# Copyright (C) Etolabo Corp. 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. +# + +# search kumoctl and load +[ + "/usr/local/bin", + File.dirname(__FILE__), +].map {|x| x+"/kumoctl"}.each do |ks| + if File::file?(ks) + load ks + break + end +end + +def usage + puts "Usage: #{File.basename($0)} address[:port=#{KumoRPC::MANAGER_DEFAULT_PORT}] command [options]" + puts "command:" + puts " status get status" + exit 1 +end + +$now = Time.now.strftime("%Y%m%d") + +if ARGV.length < 2 + usage +end + +addr = ARGV.shift +host, port = addr.split(':', 2) +port ||= KumoRPC::MANAGER_DEFAULT_PORT + +cmd = ARGV.shift + +case cmd +when "stat", "status" + usage if ARGV.length != 0 + attached, not_attached, date, clock = + KumoManager.new(host, port).GetStatus + puts "not attached node: #{not_attached.size}" + puts "attached node : #{attached.size}" + puts "hash space timestamp: #{date} clock #{clock}" + if not_attached.size == 0 + exit 0 + else + exit 1 + end +else + puts "unknown command #{cmd}" + puts "" + usage +end diff --git a/net-mgmt/nagios-check_kumofs/files/check_kumosvr.in b/net-mgmt/nagios-check_kumofs/files/check_kumosvr.in new file mode 100644 index 000000000000..5f3a56c652fe --- /dev/null +++ b/net-mgmt/nagios-check_kumofs/files/check_kumosvr.in @@ -0,0 +1,52 @@ +#!/usr/bin/env ruby +# +# Copyright (C) Etolabo Corp. 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. +# + +# search kumostat and load +[ + "/usr/local/bin", + File.dirname(__FILE__), +].map {|x| x+"/kumostat"}.each do |ks| + if File::file?(ks) + load ks + break + end +end + +NUMBER_OF_LOWEST_ITEMS = 500 + +def usage + puts "Usage: #{File.basename($0)} address[:port=#{KumoRPC::SERVER_DEFAULT_PORT}]" + exit 1 +end + +if ARGV.length != 1 + usage +end + +addr = ARGV.shift +host, port = addr.split(':', 2) +port ||= KumoRPC::SERVER_DEFAULT_PORT + +cmd = ARGV.shift + +n = KumoServer.new(host, port).GetStatus(KumoServer::STAT_DB_ITEMS) +puts "items: #{n}" +if n < NUMBER_OF_LOWEST_ITEMS + exit 1 +else + exit 0 +end diff --git a/net-mgmt/nagios-check_kumofs/pkg-descr b/net-mgmt/nagios-check_kumofs/pkg-descr new file mode 100644 index 000000000000..c4a3be13c699 --- /dev/null +++ b/net-mgmt/nagios-check_kumofs/pkg-descr @@ -0,0 +1,4 @@ +This "check_kumofs" is Nagios plugin for monitoring kumofs server node +and manager node. + +WWW: http://github.com/etolabo/nagios-check_kumofs |