diff options
author | B Stack <bgstack15@gmail.com> | 2017-01-10 13:55:17 -0500 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2017-01-10 13:55:17 -0500 |
commit | dd9977e7a46e2b45ea93d27d92c9492256cdc975 (patch) | |
tree | 82e1639251036d7b50842886966dd60693e37b53 /usr/share | |
download | nagios-plugins-apache-threads-master.tar.gz nagios-plugins-apache-threads-master.tar.bz2 nagios-plugins-apache-threads-master.zip |
Diffstat (limited to 'usr/share')
6 files changed, 178 insertions, 0 deletions
diff --git a/usr/share/nagios-plugins-apache-threads/README.txt b/usr/share/nagios-plugins-apache-threads/README.txt new file mode 100644 index 0000000..3ba27c6 --- /dev/null +++ b/usr/share/nagios-plugins-apache-threads/README.txt @@ -0,0 +1,12 @@ +### README for nagios-plugins-apache-threads + +You can use this check by configuring in nconf/nagios a checkcommand with a check command line of: +$USER1$/check_by_ssh -H $HOSTADDRESS$ -C "$USER1$/check_apache_threads -w $ARG1$ -c $ARG2$" + +Some sample default values for -w and -c are 50 and 150, respectively. + +### LICENSE +CC-BY-SA 4.0 + +### INSTALL +Nothing special. diff --git a/usr/share/nagios-plugins-apache-threads/files-for-versioning.txt b/usr/share/nagios-plugins-apache-threads/files-for-versioning.txt new file mode 100644 index 0000000..9c46ce6 --- /dev/null +++ b/usr/share/nagios-plugins-apache-threads/files-for-versioning.txt @@ -0,0 +1,2 @@ +nagios-plugins-apache-threads.spec +README.txt diff --git a/usr/share/nagios-plugins-apache-threads/localize_git.sh b/usr/share/nagios-plugins-apache-threads/localize_git.sh new file mode 100755 index 0000000..8359329 --- /dev/null +++ b/usr/share/nagios-plugins-apache-threads/localize_git.sh @@ -0,0 +1,2 @@ +#!/bin/sh +\cp -pRf /home/work/nagios-plugins-apache-threads.clean/.git /home/bgstack15/rpmbuild/SOURCES/nagios-plugins-apache-threads-0.0-1 diff --git a/usr/share/nagios-plugins-apache-threads/nagios-plugins-apache-threads.spec b/usr/share/nagios-plugins-apache-threads/nagios-plugins-apache-threads.spec new file mode 100644 index 0000000..4e15516 --- /dev/null +++ b/usr/share/nagios-plugins-apache-threads/nagios-plugins-apache-threads.spec @@ -0,0 +1,39 @@ +Name: nagios-plugins-apache-threads +Version: 0.0 +#Release: 1%{?dist} +Release: 1 +Summary: Nagios Plugin - check_apache_threads + +Group: Applications/Systems +License: CC-BY-SA 4.0 +URL: https://bgstack15.wordpress.com/ +Source0: nagios-plugins-apache-threads.tgz + +#BuildRequires: +Requires: nagios-plugins + +%description +Provides check_apache_threads support for Nagios. +In nagios/nconf, use this checkcommand check command line: $USER1$/check_by_ssh -H $HOSTADDRESS$ -C "$USER1$/check_apache_threads -w $ARG1$ -c $ARG2$" + +%prep +%setup -q + +%build + +%install +#make install DESTDIR=%{buildroot} +rm -rf %{buildroot} +rsync -a . %{buildroot}/ --exclude='**/.*.swp' + +%files +%doc %attr(0444, -, -) /usr/share/nagios-plugins-apache-threads/README.txt +/usr/share/nagios-plugins-apache-threads/nagios-plugins-apache-threads.spec +/usr/share/nagios-plugins-apache-threads/pack +/usr/share/nagios-plugins-apache-threads/localize_git.sh +%doc %attr(0444, -, -) /usr/share/nagios-plugins-apache-threads/scrub.txt +%doc %attr(0444, -, -) /usr/share/nagios-plugins-apache-threads/files-for-versioning.txt +%attr(0755, root, root) /usr/lib/nagios/plugins/check_apache_threads +%changelog +* Tue Jan 10 2017 B Stack <bgstack15@gmail.com> 0.0-1 +- Initial build diff --git a/usr/share/nagios-plugins-apache-threads/pack b/usr/share/nagios-plugins-apache-threads/pack new file mode 100755 index 0000000..3b13e75 --- /dev/null +++ b/usr/share/nagios-plugins-apache-threads/pack @@ -0,0 +1,105 @@ +#!/bin/bash +. /usr/bgscripts/bgscripts.bashrc --noclear --nodeps + +type=""; + +case "${thisflavor}" in + redhat|rhel|centos|fedora|korora) type=rpm;; + debian|ubuntu) type=dpkg;; + *) type=targz;; +esac + +echo " $@ " | grep -qiE -- "help|usage|\B-h\s|\B-\?" 1>/dev/null 2>&1 && { + # display help and exit + less -F <<EOF +pack utility version nagios-plugins-apache-threads-2017-01-10a +usage: pack [ rpm | deb | tar | scrub ] [ --debug | -d {0-10} ] +Provides a single command for building a package. This script is customized to each package. +optional arguments: + [ rpm | deb | tar | scrub ] Build that type of package. Scrub calls the scrub.py script. + The default depends on the local os flavor. This system is "${thisflavor}" + [ --debug {0-10} | -d {0-10} ] Display package type to build and exit. Debuglev not implemented here. +EOF +exit 1 +} + +# Derive package name and version number, for my simple package versions only. +fullname="$( pwd | sed -e 's/.*\(SOURCES\|deb\)\///;s/\/.*//;' )" +version="$( echo "${fullname}" | grep -oiE -- "-[0-9]{0,3}\.[0-9a-zA-Z]{0,5}-[0-9]{0,4}" | sed -e 's/^-//;' )" +shortversion="$( echo "${version}" | sed -e 's/-.*//;' )" +package="$( echo "${fullname}" | sed -e "s/-${version}//;" )" + +echo " $@ " | grep -qiE -- "rpm|rhel|redhat|centos|fedora|korora" 1>/dev/null 2>&1 && type=rpm +echo " $@ " | grep -qiE -- "debian|ubuntu|deb\s|dpkg" 1>/dev/null 2>&1 && type=dpkg +echo " $@ " | grep -qiE -- "tar|tgz|gz" 1>/dev/null 2>&1 && type=targz +echo " $@ " | grep -qiE -- "scrub" 1>/dev/null 2>&1 && type=scrub + +# Display information +echo "packaging ${package}-${version} as ${type}" +echo " $@ " | grep -qiE -- "debug|\B-d[ 0-9]{0,3}\s" 1>/dev/null 2>&1 && exit 0 + +case "${type}" in + rpm) + +########## PACKAGING for rhel/centos +# if you copy-paste this, be sure to define package, version, shortversion +rpmbuilddir=~/rpmbuild/ +packagespecfile="${package}-${version}/usr/share/${package}/${package}.spec" +sed -n -e '1,/^\%files$/p;' "${rpmbuilddir}/SOURCES/${packagespecfile}" > "${rpmbuilddir}/SOURCES/${packagespecfile}.swp.$$" #removes files and changelog +cd ${rpmbuilddir}/SOURCES/"${package}-${version}" +{ find * ! -type d ! -regex '.*.swp.*' ! -regex '.*?DEBIAN.*?' | sed -e 's/^/\//;s/\(.*\.txt\)/%doc %attr(0444, -, -) \1/;' -e 's/\(.*\)\.py$/\1\.py\n\1\.pyc\n\1\.pyo/;' -e 's/\(.*check_apache_threads\)/%attr(0755, root, root) \1/;' ; } >> "${rpmbuilddir}/SOURCES/${packagespecfile}.swp.$$" +sed -n -e '/^\%changelog/,$p' "${rpmbuilddir}/SOURCES/${packagespecfile}" >> "${rpmbuilddir}/SOURCES/${packagespecfile}.swp.$$" +mv -f "${rpmbuilddir}/SOURCES/${packagespecfile}.swp.$$" "${rpmbuilddir}/SOURCES/${packagespecfile}" +rm -rf ${rpmbuilddir}/SOURCES/"${package}-${shortversion}"; cp -prf ${rpmbuilddir}/SOURCES/"${package}-${version}" ${rpmbuilddir}/SOURCES/"${package}-${shortversion}" +rm -rf ${rpmbuilddir}/SOURCES/"${package}-${shortversion}"/DEBIAN +cd "${rpmbuilddir}/SOURCES" +rm -rf "${package}.tgz"; tar -zc --exclude='.git' -f "${package}.tgz" "${package}-${shortversion}" +cp -p "${rpmbuilddir}/SOURCES/${packagespecfile}" "${rpmbuilddir}/SPECS" +cd "${rpmbuilddir}/RPMS/x86_64" 1>/dev/null 2>&1 +rpmbuild -bb "${rpmbuilddir}/SPECS/${package}.spec" +rm -rf "${rpmbuilddir}/SOURCES/${package}-${shortversion}/" "${rpmbuilddir}/SOURCES/${package}.tgz" + + ;; + dpkg) + +########## PACKAGING for ubuntu +# You need package dpkg-dev to build packages. +# if you copy-paste this, be sure to define package, version +#packagedebfilesdir="${package}-${version}/usr/${package}/docs/debian" +#cd ~/deb/"${package}-${version}"/usr/bin +#for word in beep bup fl lecho newscript plecho send treesize; do ln -sf ../bgscripts/${word}.sh ${word}; done; ln -sf ../bgscripts/bgscripts.bashrc bp +#cd ~/deb/"${package}-${version}" +#find . -type f ! -regex '.*.hg.*' ! -regex '.*?debian-binary.*' ! -regex '.*?DEBIAN.*' ! -regex '.*?.swp' ! -regex '.*\.git.*' -printf '%P ' | xargs md5sum > ~/deb/"${packagedebfilesdir}"/md5sums +#rm -rf ~/deb/"${package}-${version}"/DEBIAN/ 2>/dev/null; mkdir -p ~/deb/"${package}-${version}"/DEBIAN/ +#cp -pf ~/deb/"${packagedebfilesdir}"/* ~/deb/"${package}-${version}"/DEBIAN/ +#cd ~/deb +#rm -rf ~/deb/"${package}-${version}.a" +#cp -pR ~/deb/"${package}-${version}" ~/deb/"${package}-${version}.a" +#mv ~/deb/"${package}-${version}/.git" ~/deb/".git$$" +#fakeroot dpkg-deb -b ~/deb/"${package}-${version}" +#mv ~/deb/".git$$" ~/deb/"${package}-${version}/.git" +[ ] + + ;; + targz) + +########## PACKAGING in a master.tgz +# if you copy-paste this, be sure to define package, version +cd ~/deb 2>/dev/null || cd ~/rpmbuild/SOURCES +rm -rf ./"${package}-${version}".master.tgz +tar -zcf "${package}-${version}".master.tgz "${package}-${version}"/ + + ;; + scrub) + +########## SCRUB for publication +# if you copy-paste this, be sure to define package, version +cd ~/deb 2>/dev/null || cd ~/rpmbuild/SOURCES +cd "$( find . -name "*scrub.txt" | grep -iE "${package}-${version}\/" | xargs dirname )" +/usr/bgscripts/scrub.py + + ;; + unknown) + echo "error: check $0 for errors on type ${type}." 1>&2 + ;; +esac diff --git a/usr/share/nagios-plugins-apache-threads/scrub.txt b/usr/share/nagios-plugins-apache-threads/scrub.txt new file mode 100644 index 0000000..59ca5c5 --- /dev/null +++ b/usr/share/nagios-plugins-apache-threads/scrub.txt @@ -0,0 +1,18 @@ +# scrubpyversion 2016-11-16a or newer +source /home/bgstack15/rpmbuild/SOURCES/nagios-plugins-apache-threads-0.0-1 +target /home/work/nagios-plugins-apache-threads.clean +ignore "tgz png gif jpg git swp ico ini" +BGSTACK15 BGSTACK15 +Bgstack15 Bgstack15 +bgstack15 bgstack15 +BNAME BNAME +Bname Bname +bname bname +STACK STACK +Stack Stack +stack stack +EXAMPLE EXAMPLE +example example +".COM" ".COM" +".com" ".com" +"203.0." "203.0." |