1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2026-02-13 02:20:57 +01:00

Compare commits

..

4 Commits

Author SHA1 Message Date
Richard Allen
74c1f3ebfd Fixing url 2016-12-21 12:36:01 +00:00
Richard Allen
45361e4606 Fixing spec a bit 2016-12-21 11:53:52 +00:00
Richard Allen
471d0fd2a2 Fixing things found in the review. Started work on rpm spec file 2016-12-21 11:47:04 +00:00
Richard Allen
802da30b9b Initial commit of check_firewall_active 2016-12-21 10:17:12 +00:00
9 changed files with 5 additions and 81 deletions

BIN
.copr.enc

Binary file not shown.

View File

@@ -1,47 +0,0 @@
#sudo: required
#env:
# matrix:
# - OS_TYPE=centos OS_VERSION=6
# - OS_TYPE=centos OS_VERSION=7
#
#services:
# - docker
#
#before_install:
# - sudo apt-get update
# - echo 'DOCKER_OPTS="-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock -s devicemapper"' | sudo tee /etc/default/docker > /dev/null
# - sudo service docker restart
# - sleep 5
# - sudo docker pull centos:centos${OS_VERSION}
#
#
#script:
# # Run tests in Container
# - tests/setup_tests.sh ${OS_VERSION}
#
sudo: required
language: python
env:
global:
- DOCKER_IMAGE=alectolytic/rpmbuilder
- COPR_REPOSITORY=opinkerfi/nagios-plugins
- OS_ARCH=x86_64
matrix:
# - OS_TYPE=fedora OS_DIST=fedora OS_VERSION=24
- OS_TYPE=centos OS_DIST=epel OS_VERSION=7
services:
- docker
install: true
script:
- docker run -v ${PWD}/check_firewall_active:/sources -v ${PWD}:/output:Z -e "SRPM_ONLY=1" ${DOCKER_IMAGE}:${OS_TYPE}-${OS_VERSION}
# - docker run -v ${PWD}/check_firewall_active:/sources:ro -v ${PWD}:/output:rw -v ${PWD}/workspace:/workspace:rw -v ${PWD}/rpmbuild:/rpmbuild:rw -e "SRPM_ONLY=1" ${DOCKER_IMAGE}:${OS_TYPE}-${OS_VERSION}
after_success:
- pip install copr-cli simplejson
- openssl aes-256-cbc -K $encrypted_f965aefb5778_key -iv $encrypted_f965aefb5778_iv -in .copr.enc -out .copr -d
- if [ ! -z "${TRAVIS_TAG}" ]; then copr-cli --config .copr build -r ${OS_DIST}-${OS_VERSION}-${OS_ARCH} ${COPR_REPOSITORY} *.src.rpm; fi

View File

@@ -2,7 +2,7 @@
Summary: A Nagios plugin to check if iptables are actually enforcing rules
Name: nagios-okplugin-check_firewall_active
Version: 1.0.2
Version: 1.0.0
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
@@ -46,7 +46,5 @@ rm -rf %{buildroot}
restorecon -v %{_libdir}/nagios/plugins/check_firewall_active.sh /etc/nrpe.d/check_firewall_active.cfg /etc/sudoers.d/check_firewall_active
%changelog
* Thu Dec 21 2016 Gardar Thorsteinsson <gardart@gmail.com> 1.0.1-1
* Thu Dec 21 2016 Gardar Thorsteinsson <gardart@gmail.com> 1.0.0-3
* Thu Dec 20 2016 Richard Allen <ra@ok.is> 0.1-1
- Initial packaging

View File

@@ -48,9 +48,9 @@ print_help() {
echo "Add this to your sudoers file by running visudo to add access:"
if [ -r /proc/modules ]; then
echo "Cmnd_Alias MULTIPATH=$MULTIPATH -ll"
echo "Cmnd_Alias MULTIPATH=$MULTIPATH -l"
else
echo "Cmnd_Alias MULTIPATH=$MULTIPATH -ll, $SUDO"
echo "Cmnd_Alias MULTIPATH=$MULTIPATH -l, $SUDO"
fi
echo "nagios ALL= NOPASSWD: MULTIPATH"
echo "The user nagios may very well be nobody or someone else depending on your configuration"
@@ -98,7 +98,7 @@ if [ $(id -un) != "root" ]; then
fi
fi
OUTPUT=$($MULTIPATH -ll 2>/dev/null)
OUTPUT=$($MULTIPATH -l 2>/dev/null)
if [ $? != 0 ]; then
# Failed. grab more info why
if [ $(id -un) != "root" ] && [ `$SUDO -l | grep -c multipath` -eq 0 ]; then
@@ -112,7 +112,7 @@ if [ $? != 0 ]; then
exit $STATE_UNKNOWN
fi
echo "MULTIPATH: $($MULTIPATH -ll 2>&1)"
echo "MULTIPATH: $(MULTIPATH -l 2>&1)"
exit $STATE_UNKNOWN
fi
@@ -137,7 +137,6 @@ if [ "$NUMPATHS" ]; then
/^ \\/ {targets++; next} # count targets (lenny)
/[0-9]+:[0-9]+:[0-9]+:[0-9]+/ {
if (/active undef running/) { targets++ } # count targets (squeeze)
if (/active ready running/) { targets++ } # count targets (RHEL6)
next
}
{

View File

View File

View File

@@ -1,24 +0,0 @@
#!/bin/sh -xe
# This script starts docker and systemd (if el7)
# Version of CentOS/RHEL
el_version=$1
# Run tests in Container
if [ "$el_version" = "6" ]; then
sudo docker run --rm=true -v `pwd`:/nagios-plugins:rw centos:centos${OS_VERSION} /bin/bash -c "bash -xe /nagios-plugins/tests/test_inside_docker.sh ${OS_VERSION}"
elif [ "$el_version" = "7" ]; then
docker run --privileged -d -ti -e "container=docker" -v /sys/fs/cgroup:/sys/fs/cgroup -v `pwd`:/nagios-plugins:rw centos:centos${OS_VERSION} /usr/sbin/init
DOCKER_CONTAINER_ID=$(docker ps | grep centos | awk '{print $1}')
docker logs $DOCKER_CONTAINER_ID
docker exec -ti $DOCKER_CONTAINER_ID /bin/bash -xec "bash -xe /nagios-plugins/tests/test_inside_docker.sh ${OS_VERSION};
echo -ne \"------\nEND NAGIOS-PLUGINS TESTS\n\";"
docker ps -a
docker stop $DOCKER_CONTAINER_ID
docker rm -v $DOCKER_CONTAINER_ID
fi

View File

@@ -1,2 +0,0 @@
echo "Keyrsla fyrir CentOS $1"
ls -l /

View File