travis-test-1 981 B

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