Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

Commit

Permalink
move ncd to root dir, remove separate send_check dir
Browse files Browse the repository at this point in the history
  • Loading branch information
pjjw committed Jul 12, 2011
1 parent d521e1d commit 3063623
Show file tree
Hide file tree
Showing 18 changed files with 95 additions and 57 deletions.
35 changes: 10 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
# A sample top level Makefile for multi package Go projects.

include $(GOROOT)/src/Make.inc

CMDS=\
send_check\
ncd

all: make

make: $(addsuffix .make, $(CMDS))
clean: $(addsuffix .clean, $(CMDS))

%.install:
$(MAKE) -C $* install

# compile all packages before any command
%.make:
$(MAKE) -C $*

# establish dependancies between packages
#package-2.install: package-1.install
#package-1.install package-2.install: package-3.install
TARG=ncd

%.clean:
$(MAKE) -C $* clean
GOFILES=\
ncd.go\
checkresult.pb.go\
spoolfile.go\
templates.go\
send_check.go\
nagios.go

%.nuke:
$(MAKE) -C $* nuke
include $(GOROOT)/src/Make.cmd
include $(GOROOT)/src/pkg/goprotobuf.googlecode.com/hg/Make.protobuf
File renamed without changes.
6 changes: 3 additions & 3 deletions misc/ncd.init
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# chkconfig: - 50 50
# description: Nagios Check Daemon
#
# processname: /usr/sbin/ncd
# processname: /usr/bin/ncd

# source function library
. /etc/init.d/functions
Expand All @@ -18,15 +18,15 @@ fi

RETVAL=0
prog="ncd"
bindir="/usr/sbin"
bindir="/usr/bin"

start() {
echo -n $"Starting $prog: "
if [ $UID -ne 0 ]; then
RETVAL=1
failure
else
daemon --pidfile=/var/run/ncd.pid /usr/sbin/daemonize -u ${NCD_USER} -p /var/run/ncd.pid $bindir/$prog $OPTIONS
daemon --pidfile=/var/run/ncd.pid /usr/sbin/daemonize -u ${NCD_USER} -p /var/run/ncd.pid $bindir/$prog -server $OPTIONS
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
fi;
Expand Down
32 changes: 32 additions & 0 deletions misc/ncd.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

require 'json/ext'
require 'json/add/core'

class CheckResultSet
attr_accessor :results

@results = []

def to_json(*a)
{'json_class' => self.class.name,
'results' => results
}.to_json(*a)
end

end

class CheckResult
attr_accessor :hostname, :servicename, :status, :checkpassive, :checkscheduled, :checkoutput, :start_timestamp, :end_timestamp


def initialize
@hostname = "ahost"
end

end

f = CheckResultSet.new
f.results = [CheckResult.new]

puts f
puts f.to_json
4 changes: 1 addition & 3 deletions misc/ncd.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Packager: peter woodman <[email protected]>
Source0: ncd
Source1: ncd.init
Source2: ncd.options
Source3: send_check

BuildRoot: %{_tmppath}/%{name}-%{version}-root

Expand All @@ -35,8 +34,7 @@ pair of utilities to inject checks into nagios' checkresult spool
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT
install -D -m 755 %{_sourcedir}/ncd %{buildroot}/usr/sbin/ncd
install -D -m 755 %{_sourcedir}/send_check %{buildroot}/usr/bin/send_check
install -D -m 755 %{_sourcedir}/ncd %{buildroot}/usr/bin/ncd
install -D -m 755 %{_sourcedir}/ncd.init %{buildroot}/etc/init.d/ncd
install -D -m 644 %{_sourcedir}/ncd.options %{buildroot}/etc/sysconfig/ncd

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 0 additions & 14 deletions ncd/Makefile

This file was deleted.

File renamed without changes.
11 changes: 0 additions & 11 deletions send_check/Makefile

This file was deleted.

1 change: 0 additions & 1 deletion send_check/checkresult.proto

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions test/cert.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-----BEGIN CERTIFICATE-----
MIICKTCCAZICCQCHSyaol5klUTANBgkqhkiG9w0BAQUFADBZMQswCQYDVQQGEwJB
VTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0
cyBQdHkgTHRkMRIwEAYDVQQDEwkxMjcuMC4wLjEwHhcNMTEwNzA5MDE1ODA5WhcN
MTIwNzA4MDE1ODA5WjBZMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0
ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRIwEAYDVQQDEwkx
MjcuMC4wLjEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMxc61wc+VaHfHUQ
Aash/Y+x57CIncGfRO2X+BNbS0I+zd7iTjbsYNzr6zQzz27IF3nTzWQq93P1sAcp
1bfFmJLeGkVQT19/8pKt34ViowA36jwq+dRBk166CazaI3jmNBS5SNcFVqXu6xnk
BPlVrtzAmRrhHuQ3pDhsnxcLZJGvAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAwTQj
mhwhgB3cIywPQb5sjOJjHu/sZtajbtry47rdoFN0pmujLxz1srYtciORuGjlD4Iu
ss/K6lgVyG4uVsJ/OUgpvZSoFBSKCnD92MQVrH0NOHfMPbFjqAc2XAtyhwu2ttpW
3M06BF2+0K0bAYmCytVkQP0d/pmhwweNNTonxDY=
-----END CERTIFICATE-----
15 changes: 15 additions & 0 deletions test/key.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-----BEGIN RSA PRIVATE KEY-----
MIICXgIBAAKBgQDMXOtcHPlWh3x1EAGrIf2PseewiJ3Bn0Ttl/gTW0tCPs3e4k42
7GDc6+s0M89uyBd5081kKvdz9bAHKdW3xZiS3hpFUE9ff/KSrd+FYqMAN+o8KvnU
QZNeugms2iN45jQUuUjXBVal7usZ5AT5Va7cwJka4R7kN6Q4bJ8XC2SRrwIDAQAB
AoGBALrk832/JawjpgdsxwnZwQlL+wZwOk3buW7MP1x8blw8EYyXTE5gaMlBnE2W
YEsBBK8uqzTDMqDC/OPgN4qkU73CSENZCfSIxfqzhjDppVKcmuOTpnmALNouNZ0q
7cuPddNSCIU/fwC3xTHkbHipHdsfUlKnUHf4JenmOT25sbeJAkEA7ybsIhApRvEm
bjenSsDbQwxtd77zTBS2VfLgh5W0rjiTp/nyzc7id+1nMKHTM91HtE8/ScLaYwsd
Ceuz+VfU6wJBANrClI8Ta4iq0gF8zXCyBMKCkDIrGZXCv806UzzN9BGjK6RwFjZb
4jTOxDo8GbVraW7dIdEwJB81pCJ8SZr21U0CQQDHHhshSV90x7f9sKzDWsu0iZZj
S0N7JwuhiDVV7lmfbU/TXhLBNO3ueGWgYjxdRHI9OHYzTd9S85/b8LnKc0y9AkBH
hcSyfqPy2/6rU9WLWfiqa6ufa24DA9hXzhD22VNKDPIw4iCxBxuPLmcDrzCsmwCu
qYfr7/Rva8dNKxuZmcglAkEAn9iLNb/l8+virowEGrhvXBzBUS7xnxxmJCuZgW+N
Whyxn9xmXnujmJiOi9ctvxTd3SuWw52fYhqqqZoulE1Dew==
-----END RSA PRIVATE KEY-----
20 changes: 20 additions & 0 deletions test/result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

{
"Results":
[
{
"Hostname":"testhost.foo.bar",
"ServiceName":"test-service",
"Status":0,
"CheckPassive":null,
"CheckScheduled":null,
"CheckOutput":null,
"StartTimestamp":151892832,
"EndTimestamp":151895000,
"Perfdata":
[{"Name":"frob","Data":"100"}
]
}
]
}

0 comments on commit 3063623

Please sign in to comment.