1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-19 08:13:21 +00:00

This "check_kumofs" is Nagios plugin for monitoring kumofs server node

and manager node.

WWW: http://github.com/etolabo/nagios-check_kumofs
This commit is contained in:
Jun Kuriyama 2010-04-29 11:18:25 +00:00
parent c9d5849d07
commit 91f1b886d0
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=253416
5 changed files with 157 additions and 0 deletions

View File

@ -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

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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