Debian Codegraph @

travis-test-1

raw
1 #!/bin/bash
2
3 # Integration test for nrpe/check_nrpe
4 # Should be run only on machines which do NOT have Nagios installed
5 # and which do not have an enabled firewall.
6 cd sample-config
7 echo >> nrpe.cfg # Hopefully this is a newline! I think nrpe.cfg ends in a newling anyways.
8 echo 'command[check_test]=/tmp/check_yes.sh' >> nrpe.cfg
9
10 # Make sure the directory exists such that nrpe can create the nrpe.pid file in the default location
11 mkdir /usr/ || true
12 mkdir /usr/local || true
13 mkdir /usr/local/nagios || true
14 mkdir /usr/local/nagios/var || true
15
16 # Make sure nagios user exists
17 useradd nagios
18
19 # Make a plugin
20 touch /tmp/check_yes.sh
21 echo 'echo OK' >> /tmp/check_yes.sh
22
23 # Give nagios control of plugins
24 chown nagios /tmp/check_yes.sh
25 chmod +x /tmp/check_yes.sh
26
27 # Start running the NRPE daemon to accept commands
28 cd ../src
29 ./nrpe -c ../sample-config/nrpe.cfg -d
30
31 # Try to check_nrpe with our check_test command/check_yes.sh plugin
32 ./check_nrpe -H 127.0.0.1 -c check_test
33
34 exit 0