diff options
| author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-09-30 00:03:24 +0200 |
|---|---|---|
| committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-09-30 00:03:24 +0200 |
| commit | 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 (patch) | |
| tree | 1c2b6b21704a294940f87c7892676998d8371707 /web | |
| download | site-0b6423f9c99d9edf8c96fefd0f6c453859395aa1.tar.gz | |
Import Nagios Plugins site
Import the Nagios Plugins web site, Cronjobs, infrastructure scripts,
and configuration files.
Diffstat (limited to 'web')
627 files changed, 81295 insertions, 0 deletions
diff --git a/web/attachments/101025-check_ntp.patch b/web/attachments/101025-check_ntp.patch new file mode 100644 index 0000000..373d521 --- /dev/null +++ b/web/attachments/101025-check_ntp.patch | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | Index: check_ntp.pl | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins-scripts/check_ntp.pl,v | ||
| 4 | retrieving revision 1.19 | ||
| 5 | diff -u -w -r1.19 check_ntp.pl | ||
| 6 | --- check_ntp.pl 14 Oct 2003 02:40:31 -0000 1.19 | ||
| 7 | +++ check_ntp.pl 10 Sep 2004 15:01:45 -0000 | ||
| 8 | @@ -358,13 +358,13 @@ | ||
| 9 | } elsif( !$have_ntpq ) { # no errors from ntpdate and no ntpq or ntpq timed out | ||
| 10 | if (abs($offset) > $ocrit) { | ||
| 11 | $state = $ERRORS{'CRITICAL'}; | ||
| 12 | - $answer = "Offset $offset msec > +/- $ocrit sec\n"; | ||
| 13 | + $answer = "Offset $offset sec > +/- $ocrit sec\n"; | ||
| 14 | } elsif (abs($offset) > $owarn) { | ||
| 15 | $state = $ERRORS{'WARNING'}; | ||
| 16 | - $answer = "Offset $offset msec > +/- $owarn sec\n"; | ||
| 17 | + $answer = "Offset $offset sec > +/- $owarn sec\n"; | ||
| 18 | } elsif (( abs($offset) > $owarn) && $def_jitter ) { | ||
| 19 | $state = $ERRORS{'WARNING'}; | ||
| 20 | - $answer = "Offset $offset msec > +/- $owarn sec, ntpq timed out\n"; | ||
| 21 | + $answer = "Offset $offset sec > +/- $owarn sec, ntpq timed out\n"; | ||
| 22 | } elsif ( $def_jitter ) { | ||
| 23 | $state = $ERRORS{'WARNING'}; | ||
| 24 | $answer = "Offset $offset secs, ntpq timed out\n"; | ||
| 25 | @@ -378,13 +378,13 @@ | ||
| 26 | } else { # no errors from ntpdate or ntpq | ||
| 27 | if (abs($offset) > $ocrit) { | ||
| 28 | $state = $ERRORS{'CRITICAL'}; | ||
| 29 | - $answer = "Offset $offset msec > +/- $ocrit sec, jitter $jitter msec\n"; | ||
| 30 | + $answer = "Offset $offset sec > +/- $ocrit sec, jitter $jitter msec\n"; | ||
| 31 | } elsif (abs($jitter) > $jcrit ) { | ||
| 32 | $state = $ERRORS{'CRITICAL'}; | ||
| 33 | $answer = "Jitter $jitter msec> +/- $jcrit msec, offset $offset sec \n"; | ||
| 34 | } elsif (abs($offset) > $owarn) { | ||
| 35 | $state = $ERRORS{'WARNING'}; | ||
| 36 | - $answer = "Offset $offset msec > +/- $owarn sec, jitter $jitter msec\n"; | ||
| 37 | + $answer = "Offset $offset sec > +/- $owarn sec, jitter $jitter msec\n"; | ||
| 38 | } elsif (abs($jitter) > $jwarn ) { | ||
| 39 | $state = $ERRORS{'WARNING'}; | ||
| 40 | $answer = "Jitter $jitter msec> +/- $jwarn msec, offset $offset sec \n"; | ||
diff --git a/web/attachments/101069-check_swap.diff.txt b/web/attachments/101069-check_swap.diff.txt new file mode 100644 index 0000000..24cfdad --- /dev/null +++ b/web/attachments/101069-check_swap.diff.txt | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | 49c49 | ||
| 2 | < char tmp_status[MAX_INPUT_BUFFER]; | ||
| 3 | --- | ||
| 4 | > | ||
| 5 | 197c197 | ||
| 6 | < printf (_("total=%llu, free=%llu\n"), dsktotal, | ||
| 7 | dskfree); | ||
| 8 | --- | ||
| 9 | > printf (_("total=%d, free=%d\n"), dsktotal, dskf | ||
| 10 | ree); | ||
| 11 | 314,315c314,315 | ||
| 12 | < sprintf (tmp_status, _(" %d%% free (%llu MB out of %llu MB)"), | ||
| 13 | < (100 - percent_used), free_swap, | ||
| 14 | total_swap); | ||
| 15 | --- | ||
| 16 | > asprintf (&tmp_status, _(" %d%% free (%llu MB out of %llu MB)"), | ||
| 17 | > (100 - percent_used), free_swap, | ||
| 18 | total_swap); | ||
diff --git a/web/attachments/101436-check_oracle b/web/attachments/101436-check_oracle new file mode 100644 index 0000000..16fb473 --- /dev/null +++ b/web/attachments/101436-check_oracle | |||
| @@ -0,0 +1,284 @@ | |||
| 1 | #! /bin/bash | ||
| 2 | # | ||
| 3 | # latigid010@yahoo.com | ||
| 4 | # 01/06/2000 | ||
| 5 | # | ||
| 6 | # This Nagios plugin was created to check Oracle status | ||
| 7 | # | ||
| 8 | |||
| 9 | PROGNAME=`basename $0` | ||
| 10 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` | ||
| 11 | REVISION=`echo '$Revision: 1.12 $' | sed -e 's/[^0-9.]//g'` | ||
| 12 | |||
| 13 | . $PROGPATH/utils.sh | ||
| 14 | |||
| 15 | |||
| 16 | print_usage() { | ||
| 17 | echo "Usage:" | ||
| 18 | echo " $PROGNAME --tns <Oracle Sid or Hostname/IP address>" | ||
| 19 | echo " $PROGNAME --db <ORACLE_SID>" | ||
| 20 | echo " $PROGNAME --login <ORACLE_SID>" | ||
| 21 | echo " $PROGNAME --cache <ORACLE_SID> <USER> <PASS> <CRITICAL> <WARNING>" | ||
| 22 | echo " $PROGNAME --tablespace <ORACLE_SID> <USER> <PASS> <TABLESPACE> <CRITICAL> <WARNING>" | ||
| 23 | echo " $PROGNAME --oranames <Hostname>" | ||
| 24 | echo " $PROGNAME --help" | ||
| 25 | echo " $PROGNAME --version" | ||
| 26 | } | ||
| 27 | |||
| 28 | print_help() { | ||
| 29 | print_revision $PROGNAME $REVISION | ||
| 30 | echo "" | ||
| 31 | print_usage | ||
| 32 | echo "" | ||
| 33 | echo "Check Oracle status" | ||
| 34 | echo "" | ||
| 35 | echo "--tns SID/IP Address" | ||
| 36 | echo " Check remote TNS server" | ||
| 37 | echo "--db SID" | ||
| 38 | echo " Check local database (search /bin/ps for PMON process) and check" | ||
| 39 | echo " filesystem for sgadefORACLE_SID.dbf" | ||
| 40 | echo "--login SID" | ||
| 41 | echo " Attempt a dummy login and alert if not ORA-01017: invalid username/password" | ||
| 42 | echo "--cache" | ||
| 43 | echo " Check local database for library and buffer cache hit ratios" | ||
| 44 | echo " ---> Requires Oracle user/password and SID specified." | ||
| 45 | echo " ---> Requires select on v_$sysstat and v_$librarycache" | ||
| 46 | echo "--tablespace" | ||
| 47 | echo " Check local database for tablespace capacity in ORACLE_SID" | ||
| 48 | echo " ---> Requires Oracle user/password specified." | ||
| 49 | echo " ---> Requires select on dba_data_files and dba_free_space" | ||
| 50 | echo "--oranames Hostname" | ||
| 51 | echo " Check remote Oracle Names server" | ||
| 52 | echo "--help" | ||
| 53 | echo " Print this help screen" | ||
| 54 | echo "--version" | ||
| 55 | echo " Print version and license information" | ||
| 56 | echo "" | ||
| 57 | echo "If the plugin doesn't work, check that the ORACLE_HOME environment" | ||
| 58 | echo "variable is set, that ORACLE_HOME/bin is in your PATH, and the" | ||
| 59 | echo "tnsnames.ora file is locatable and is properly configured." | ||
| 60 | echo "" | ||
| 61 | echo "When checking local database status your ORACLE_SID is case sensitive." | ||
| 62 | echo "" | ||
| 63 | echo "If you want to use a default Oracle home, add in your oratab file:" | ||
| 64 | echo "*:/opt/app/oracle/product/7.3.4:N" | ||
| 65 | echo "" | ||
| 66 | support | ||
| 67 | } | ||
| 68 | |||
| 69 | case "$1" in | ||
| 70 | 1) | ||
| 71 | cmd='--tns' | ||
| 72 | ;; | ||
| 73 | 2) | ||
| 74 | cmd='--db' | ||
| 75 | ;; | ||
| 76 | *) | ||
| 77 | cmd="$1" | ||
| 78 | ;; | ||
| 79 | esac | ||
| 80 | |||
| 81 | # Information options | ||
| 82 | case "$cmd" in | ||
| 83 | --help) | ||
| 84 | print_help | ||
| 85 | exit $STATE_OK | ||
| 86 | ;; | ||
| 87 | -h) | ||
| 88 | print_help | ||
| 89 | exit $STATE_OK | ||
| 90 | ;; | ||
| 91 | --version) | ||
| 92 | print_revision $PLUGIN $REVISION | ||
| 93 | exit $STATE_OK | ||
| 94 | ;; | ||
| 95 | -V) | ||
| 96 | print_revision $PLUGIN $REVISION | ||
| 97 | exit $STATE_OK | ||
| 98 | ;; | ||
| 99 | esac | ||
| 100 | |||
| 101 | # Hunt down a reasonable ORACLE_HOME | ||
| 102 | if [ -z "$ORACLE_HOME" ] ; then | ||
| 103 | # Adjust to taste | ||
| 104 | for oratab in /var/opt/oracle/oratab /etc/oratab | ||
| 105 | do | ||
| 106 | [ ! -f $oratab ] && continue | ||
| 107 | ORACLE_HOME=`IFS=: | ||
| 108 | while read SID ORACLE_HOME junk; | ||
| 109 | do | ||
| 110 | if [ "$SID" = "$2" -o "$SID" = "*" ] ; then | ||
| 111 | echo $ORACLE_HOME; | ||
| 112 | exit; | ||
| 113 | fi; | ||
| 114 | done < $oratab` | ||
| 115 | [ -n "$ORACLE_HOME" ] && break | ||
| 116 | done | ||
| 117 | fi | ||
| 118 | # Last resort | ||
| 119 | [ -z "$ORACLE_HOME" -a -d $PROGPATH/oracle ] && ORACLE_HOME=$PROGPATH/oracle | ||
| 120 | |||
| 121 | if [ -z "$ORACLE_HOME" -o ! -d "$ORACLE_HOME" ] ; then | ||
| 122 | echo "Cannot determine ORACLE_HOME for sid $2" | ||
| 123 | exit $STATE_UNKNOWN | ||
| 124 | fi | ||
| 125 | PATH=$PATH:$ORACLE_HOME/bin | ||
| 126 | LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib | ||
| 127 | export ORACLE_HOME PATH LD_LIBRARY_PATH | ||
| 128 | |||
| 129 | case "$cmd" in | ||
| 130 | --tns) | ||
| 131 | tnschk=` tnsping $2` | ||
| 132 | tnschk2=` echo $tnschk | grep -c OK` | ||
| 133 | if [ ${tnschk2} -eq 1 ] ; then | ||
| 134 | tnschk3=` echo $tnschk | sed -e 's/.*(//' -e 's/).*//'` | ||
| 135 | echo "OK - reply time ${tnschk3} from $2" | ||
| 136 | exit $STATE_OK | ||
| 137 | else | ||
| 138 | echo "No TNS Listener on $2" | ||
| 139 | exit $STATE_CRITICAL | ||
| 140 | fi | ||
| 141 | ;; | ||
| 142 | --oranames) | ||
| 143 | namesctl status $2 | awk ' | ||
| 144 | /Server has been running for:/ { | ||
| 145 | msg = "OK: Up" | ||
| 146 | for (i = 6; i <= NF; i++) { | ||
| 147 | msg = msg " " $i | ||
| 148 | } | ||
| 149 | status = '$STATE_OK' | ||
| 150 | } | ||
| 151 | /error/ { | ||
| 152 | msg = "CRITICAL: " $0 | ||
| 153 | status = '$STATE_CRITICAL' | ||
| 154 | } | ||
| 155 | END { | ||
| 156 | print msg | ||
| 157 | exit status | ||
| 158 | }' | ||
| 159 | ;; | ||
| 160 | --db) | ||
| 161 | pmonchk=`ps -ef | grep -v grep | grep ${2} | grep -c pmon` | ||
| 162 | if [ ${pmonchk} -ge 1 ] ; then | ||
| 163 | echo "${2} OK - ${pmonchk} PMON process(es) running" | ||
| 164 | exit $STATE_OK | ||
| 165 | #if [ -f $ORACLE_HOME/dbs/sga*${2}* ] ; then | ||
| 166 | #if [ ${pmonchk} -eq 1 ] ; then | ||
| 167 | #utime=`ls -la $ORACLE_HOME/dbs/sga*$2* | cut -c 43-55` | ||
| 168 | #echo "${2} OK - running since ${utime}" | ||
| 169 | #exit $STATE_OK | ||
| 170 | #fi | ||
| 171 | else | ||
| 172 | echo "${2} Database is DOWN" | ||
| 173 | exit $STATE_CRITICAL | ||
| 174 | fi | ||
| 175 | ;; | ||
| 176 | --login) | ||
| 177 | loginchk=`sqlplus dummy/user@$2 < /dev/null` | ||
| 178 | loginchk2=` echo $loginchk | grep -c ORA-01017` | ||
| 179 | if [ ${loginchk2} -eq 1 ] ; then | ||
| 180 | echo "OK - dummy login connected" | ||
| 181 | exit $STATE_OK | ||
| 182 | else | ||
| 183 | loginchk3=` echo "$loginchk" | grep "ORA-" | head -1` | ||
| 184 | echo "CRITICAL - $loginchk3" | ||
| 185 | exit $STATE_CRITICAL | ||
| 186 | fi | ||
| 187 | ;; | ||
| 188 | --cache) | ||
| 189 | if [ ${5} -gt ${6} ] ; then | ||
| 190 | echo "UNKNOWN - Warning level is less then Crit" | ||
| 191 | exit $STATE_UNKNOWN | ||
| 192 | fi | ||
| 193 | result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 194 | set pagesize 0 | ||
| 195 | set numf '9999999.99' | ||
| 196 | select (1-(pr.value/(dbg.value+cg.value)))*100 | ||
| 197 | from v\\$sysstat pr, v\\$sysstat dbg, v\\$sysstat cg | ||
| 198 | where pr.name='physical reads' | ||
| 199 | and dbg.name='db block gets' | ||
| 200 | and cg.name='consistent gets'; | ||
| 201 | EOF` | ||
| 202 | |||
| 203 | if [ -n "`echo $result | grep ORA-`" ] ; then | ||
| 204 | error=` echo "$result" | grep "ORA-" | head -1` | ||
| 205 | echo "CRITICAL - $error" | ||
| 206 | exit $STATE_CRITICAL | ||
| 207 | fi | ||
| 208 | |||
| 209 | buf_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` | ||
| 210 | buf_hrx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'` | ||
| 211 | result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 212 | set pagesize 0 | ||
| 213 | set numf '9999999.99' | ||
| 214 | select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 | ||
| 215 | from v\\$librarycache lc; | ||
| 216 | EOF` | ||
| 217 | |||
| 218 | if [ -n "`echo $result | grep ORA-`" ] ; then | ||
| 219 | error=` echo "$result" | grep "ORA-" | head -1` | ||
| 220 | echo "CRITICAL - $error" | ||
| 221 | exit $STATE_CRITICAL | ||
| 222 | fi | ||
| 223 | |||
| 224 | lib_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` | ||
| 225 | lib_hrx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'` | ||
| 226 | |||
| 227 | if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then | ||
| 228 | echo "${2} CRITICAL - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" | ||
| 229 | exit $STATE_CRITICAL | ||
| 230 | fi | ||
| 231 | if [ $buf_hr -le ${6} -o $lib_hr -le ${6} ] ; then | ||
| 232 | echo "${2} WARNING - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" | ||
| 233 | exit $STATE_WARNING | ||
| 234 | fi | ||
| 235 | echo "${2} OK - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" | ||
| 236 | |||
| 237 | exit $STATE_OK | ||
| 238 | ;; | ||
| 239 | --tablespace) | ||
| 240 | if [ ${6} -lt ${7} ] ; then | ||
| 241 | echo "UNKNOWN - Warning level is more then Crit" | ||
| 242 | exit $STATE_UNKNOWN | ||
| 243 | fi | ||
| 244 | result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 245 | set pagesize 0 | ||
| 246 | set numf '9999999.99' | ||
| 247 | select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc | ||
| 248 | from ( | ||
| 249 | select tablespace_name,sum(bytes)/1024/1024 total | ||
| 250 | from dba_data_files group by tablespace_name) A, | ||
| 251 | ( select tablespace_name,sum(bytes)/1024/1024 free | ||
| 252 | from dba_free_space group by tablespace_name) B | ||
| 253 | where a.tablespace_name=b.tablespace_name and a.tablespace_name='${5}'; | ||
| 254 | EOF` | ||
| 255 | |||
| 256 | if [ -n "`echo $result | grep ORA-`" ] ; then | ||
| 257 | error=` echo "$result" | grep "ORA-" | head -1` | ||
| 258 | echo "CRITICAL - $error" | ||
| 259 | exit $STATE_CRITICAL | ||
| 260 | fi | ||
| 261 | |||
| 262 | ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}'` | ||
| 263 | ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}'` | ||
| 264 | ts_pct=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'` | ||
| 265 | ts_pctx=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print $3}'` | ||
| 266 | if [ "$ts_free" -eq 0 -a "$ts_total" -eq 0 -a "$ts_pct" -eq 0 ] ; then | ||
| 267 | echo "No data returned by Oracle - tablespace $5 not found?" | ||
| 268 | exit $STATE_UNKNOWN | ||
| 269 | fi | ||
| 270 | if [ "$ts_pct" -ge ${6} ] ; then | ||
| 271 | echo "${2} : ${5} CRITICAL - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | ||
| 272 | exit $STATE_CRITICAL | ||
| 273 | fi | ||
| 274 | if [ "$ts_pct" -ge ${7} ] ; then | ||
| 275 | echo "${2} : ${5} WARNING - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | ||
| 276 | exit $STATE_WARNING | ||
| 277 | fi | ||
| 278 | echo "${2} : ${5} OK - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | ||
| 279 | exit $STATE_OK | ||
| 280 | ;; | ||
| 281 | *) | ||
| 282 | print_usage | ||
| 283 | exit $STATE_UNKNOWN | ||
| 284 | esac | ||
diff --git a/web/attachments/101482-nagios-plugins-1.3.1-check_ldap.patchTLS b/web/attachments/101482-nagios-plugins-1.3.1-check_ldap.patchTLS new file mode 100644 index 0000000..66046e3 --- /dev/null +++ b/web/attachments/101482-nagios-plugins-1.3.1-check_ldap.patchTLS | |||
| @@ -0,0 +1,195 @@ | |||
| 1 | diff -r -p nagios-plugins-1.3.1/configure.in nagios-plugins-1.3.1-patchTLS/configure.in | ||
| 2 | *** nagios-plugins-1.3.1/configure.in Fri Jul 11 08:12:23 2003 | ||
| 3 | --- nagios-plugins-1.3.1-patchTLS/configure.in Tue Sep 14 15:07:12 2004 | ||
| 4 | *************** if test "$ac_cv_lib_ldap_main" = "yes"; | ||
| 5 | *** 165,170 **** | ||
| 6 | --- 165,171 ---- | ||
| 7 | AC_SUBST(LDAPLIBS) | ||
| 8 | AC_SUBST(LDAPINCLUDE) | ||
| 9 | EXTRAS="$EXTRAS check_ldap" | ||
| 10 | + AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s) | ||
| 11 | else | ||
| 12 | AC_MSG_WARN([Skipping LDAP plugin]) | ||
| 13 | AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).]) | ||
| 14 | diff -r -p nagios-plugins-1.3.1/plugins/Makefile.am nagios-plugins-1.3.1-patchTLS/plugins/Makefile.am | ||
| 15 | *** nagios-plugins-1.3.1/plugins/Makefile.am Fri Jul 11 08:11:06 2003 | ||
| 16 | --- nagios-plugins-1.3.1-patchTLS/plugins/Makefile.am Sat Sep 11 01:59:42 2004 | ||
| 17 | *************** $(check_tcp_programs): check_tcp | ||
| 18 | *** 132,138 **** | ||
| 19 | |||
| 20 | install-exec-hook: | ||
| 21 | cd $(DESTDIR)$(libexecdir) && \ | ||
| 22 | ! for i in $(check_tcp_programs) ; do rm -f $$i; ln -s -f check_tcp $$i ; done | ||
| 23 | |||
| 24 | clean-local: | ||
| 25 | rm -f $(check_tcp_programs) | ||
| 26 | --- 132,139 ---- | ||
| 27 | |||
| 28 | install-exec-hook: | ||
| 29 | cd $(DESTDIR)$(libexecdir) && \ | ||
| 30 | ! for i in $(check_tcp_programs) ; do rm -f $$i; ln -s -f check_tcp $$i ; done ;\ | ||
| 31 | ! rm -f check_ldaps ; ln -s -f check_ldap check_ldaps | ||
| 32 | |||
| 33 | clean-local: | ||
| 34 | rm -f $(check_tcp_programs) | ||
| 35 | diff -r -p nagios-plugins-1.3.1/plugins/check_ldap.c nagios-plugins-1.3.1-patchTLS/plugins/check_ldap.c | ||
| 36 | *** nagios-plugins-1.3.1/plugins/check_ldap.c Wed Jan 29 07:16:15 2003 | ||
| 37 | --- nagios-plugins-1.3.1-patchTLS/plugins/check_ldap.c Tue Sep 14 15:16:05 2004 | ||
| 38 | *************** | ||
| 39 | *** 20,26 **** | ||
| 40 | * | ||
| 41 | *****************************************************************************/ | ||
| 42 | |||
| 43 | ! const char *progname = "check_ldap"; | ||
| 44 | const char *revision = "$Revision: 1.4 $"; | ||
| 45 | |||
| 46 | #include "config.h" | ||
| 47 | --- 20,26 ---- | ||
| 48 | * | ||
| 49 | *****************************************************************************/ | ||
| 50 | |||
| 51 | ! char *progname = "check_ldap"; | ||
| 52 | const char *revision = "$Revision: 1.4 $"; | ||
| 53 | |||
| 54 | #include "config.h" | ||
| 55 | *************** char *ld_binddn = NULL; | ||
| 56 | *** 50,55 **** | ||
| 57 | --- 50,56 ---- | ||
| 58 | unsigned int ld_port = DEFAULT_PORT; | ||
| 59 | int warn_time = UNDEFINED; | ||
| 60 | int crit_time = UNDEFINED; | ||
| 61 | + char *SERVICE = "LDAP"; | ||
| 62 | |||
| 63 | int | ||
| 64 | main (int argc, char *argv[]) | ||
| 65 | *************** main (int argc, char *argv[]) | ||
| 66 | *** 60,65 **** | ||
| 67 | --- 61,73 ---- | ||
| 68 | |||
| 69 | int t_diff; | ||
| 70 | time_t time0, time1; | ||
| 71 | + int tls; | ||
| 72 | + | ||
| 73 | + int version=3; | ||
| 74 | + | ||
| 75 | + if (strstr(argv[0],"check_ldaps")) { | ||
| 76 | + asprintf (&progname, "check_ldaps"); | ||
| 77 | + } | ||
| 78 | |||
| 79 | if (process_arguments (argc, argv) == ERROR) | ||
| 80 | usage ("check_ldap: could not parse arguments\n"); | ||
| 81 | *************** main (int argc, char *argv[]) | ||
| 82 | *** 74,84 **** | ||
| 83 | time (&time0); | ||
| 84 | |||
| 85 | /* initialize ldap */ | ||
| 86 | if (!(ld = ldap_open (ld_host, ld_port))) { | ||
| 87 | - /*ldap_perror(ld, "ldap_open"); */ | ||
| 88 | printf ("Could not connect to the server at port %i\n", ld_port); | ||
| 89 | return STATE_CRITICAL; | ||
| 90 | } | ||
| 91 | |||
| 92 | /* bind to the ldap server */ | ||
| 93 | if (ldap_bind_s (ld, ld_binddn, ld_passwd, LDAP_AUTH_SIMPLE) != | ||
| 94 | --- 82,145 ---- | ||
| 95 | time (&time0); | ||
| 96 | |||
| 97 | /* initialize ldap */ | ||
| 98 | + #ifdef HAVE_LDAP_INIT | ||
| 99 | + if (!(ld = ldap_init (ld_host, ld_port))) { | ||
| 100 | + printf ("Could not connect to the server at port %i\n", ld_port); | ||
| 101 | + return STATE_CRITICAL; | ||
| 102 | + } | ||
| 103 | + #else | ||
| 104 | if (!(ld = ldap_open (ld_host, ld_port))) { | ||
| 105 | printf ("Could not connect to the server at port %i\n", ld_port); | ||
| 106 | return STATE_CRITICAL; | ||
| 107 | } | ||
| 108 | + #endif /* HAVE_LDAP_INIT */ | ||
| 109 | + | ||
| 110 | + #if defined(HAVE_LDAP_SET_OPTION) && defined(LDAP_OPT_PROTOCOL_VERSION) | ||
| 111 | + ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &version); | ||
| 112 | + #endif /* LDAP_OPT_PROTOCOL_VERSION */ | ||
| 113 | + | ||
| 114 | + if (strstr(argv[0],"check_ldaps")) { | ||
| 115 | + /* with TLS */ | ||
| 116 | + if ( ld_port == LDAPS_PORT ) { | ||
| 117 | + asprintf (&SERVICE, "LDAPS"); | ||
| 118 | + #if defined(HAVE_LDAP_SET_OPTION) && defined(LDAP_OPT_X_TLS) | ||
| 119 | + /* ldaps: set option tls */ | ||
| 120 | + tls = LDAP_OPT_X_TLS_HARD; | ||
| 121 | + if (ldap_set_option (ld, LDAP_OPT_X_TLS, &tls) != LDAP_SUCCESS) | ||
| 122 | + { | ||
| 123 | + /*ldap_perror(ld, "ldaps_option"); */ | ||
| 124 | + printf ("Could not init TLS at port %i!\n", ld_port); | ||
| 125 | + return STATE_CRITICAL; | ||
| 126 | + } | ||
| 127 | + #else | ||
| 128 | + printf ("TLS not supported by the libraries!\n", ld_port); | ||
| 129 | + return STATE_CRITICAL; | ||
| 130 | + #endif /* LDAP_OPT_X_TLS */ | ||
| 131 | + } else { | ||
| 132 | + asprintf (&SERVICE, "LDAP-TLS"); | ||
| 133 | + #if defined(HAVE_LDAP_SET_OPTION) && defined(HAVE_LDAP_START_TLS_S) | ||
| 134 | + /* ldap with startTLS: set option version */ | ||
| 135 | + if (ldap_get_option(ld,LDAP_OPT_PROTOCOL_VERSION, &version) == LDAP_OPT_SUCCESS ) | ||
| 136 | + { | ||
| 137 | + if (version < LDAP_VERSION3) | ||
| 138 | + { | ||
| 139 | + version = LDAP_VERSION3; | ||
| 140 | + ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &version); | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + /* call start_tls */ | ||
| 144 | + if (ldap_start_tls_s(ld, NULL, NULL) != LDAP_SUCCESS) | ||
| 145 | + { | ||
| 146 | + /*ldap_perror(ld, "ldap_start_tls"); */ | ||
| 147 | + printf ("Could not init startTLS at port %i!\n", ld_port); | ||
| 148 | + return STATE_CRITICAL; | ||
| 149 | + } | ||
| 150 | + #else | ||
| 151 | + printf ("startTLS not supported by the library, needs LDAPv3!\n"); | ||
| 152 | + return STATE_CRITICAL; | ||
| 153 | + #endif /* HAVE_LDAP_START_TLS_S */ | ||
| 154 | + } | ||
| 155 | + } | ||
| 156 | |||
| 157 | /* bind to the ldap server */ | ||
| 158 | if (ldap_bind_s (ld, ld_binddn, ld_passwd, LDAP_AUTH_SIMPLE) != | ||
| 159 | *************** main (int argc, char *argv[]) | ||
| 160 | *** 109,125 **** | ||
| 161 | t_diff = time1 - time0; | ||
| 162 | |||
| 163 | if (crit_time!=UNDEFINED && t_diff>=crit_time) { | ||
| 164 | ! printf ("LDAP critical - %i seconds response time\n", t_diff); | ||
| 165 | return STATE_CRITICAL; | ||
| 166 | } | ||
| 167 | |||
| 168 | if (warn_time!=UNDEFINED && t_diff>=warn_time) { | ||
| 169 | ! printf ("LDAP warning - %i seconds response time\n", t_diff); | ||
| 170 | return STATE_WARNING; | ||
| 171 | } | ||
| 172 | |||
| 173 | /* print out the result */ | ||
| 174 | ! printf ("LDAP ok - %i seconds response time\n", t_diff); | ||
| 175 | |||
| 176 | return STATE_OK; | ||
| 177 | } | ||
| 178 | --- 170,186 ---- | ||
| 179 | t_diff = time1 - time0; | ||
| 180 | |||
| 181 | if (crit_time!=UNDEFINED && t_diff>=crit_time) { | ||
| 182 | ! printf ("%s critical - %i seconds response time\n", SERVICE, t_diff); | ||
| 183 | return STATE_CRITICAL; | ||
| 184 | } | ||
| 185 | |||
| 186 | if (warn_time!=UNDEFINED && t_diff>=warn_time) { | ||
| 187 | ! printf ("%s warning - %i seconds response time\n", SERVICE, t_diff); | ||
| 188 | return STATE_WARNING; | ||
| 189 | } | ||
| 190 | |||
| 191 | /* print out the result */ | ||
| 192 | ! printf ("%s ok - %i seconds response time\n", SERVICE, t_diff); | ||
| 193 | |||
| 194 | return STATE_OK; | ||
| 195 | } | ||
diff --git a/web/attachments/101495-nagios-plugins-1.3.1-check_ldap.patchTLS b/web/attachments/101495-nagios-plugins-1.3.1-check_ldap.patchTLS new file mode 100644 index 0000000..66046e3 --- /dev/null +++ b/web/attachments/101495-nagios-plugins-1.3.1-check_ldap.patchTLS | |||
| @@ -0,0 +1,195 @@ | |||
| 1 | diff -r -p nagios-plugins-1.3.1/configure.in nagios-plugins-1.3.1-patchTLS/configure.in | ||
| 2 | *** nagios-plugins-1.3.1/configure.in Fri Jul 11 08:12:23 2003 | ||
| 3 | --- nagios-plugins-1.3.1-patchTLS/configure.in Tue Sep 14 15:07:12 2004 | ||
| 4 | *************** if test "$ac_cv_lib_ldap_main" = "yes"; | ||
| 5 | *** 165,170 **** | ||
| 6 | --- 165,171 ---- | ||
| 7 | AC_SUBST(LDAPLIBS) | ||
| 8 | AC_SUBST(LDAPINCLUDE) | ||
| 9 | EXTRAS="$EXTRAS check_ldap" | ||
| 10 | + AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s) | ||
| 11 | else | ||
| 12 | AC_MSG_WARN([Skipping LDAP plugin]) | ||
| 13 | AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).]) | ||
| 14 | diff -r -p nagios-plugins-1.3.1/plugins/Makefile.am nagios-plugins-1.3.1-patchTLS/plugins/Makefile.am | ||
| 15 | *** nagios-plugins-1.3.1/plugins/Makefile.am Fri Jul 11 08:11:06 2003 | ||
| 16 | --- nagios-plugins-1.3.1-patchTLS/plugins/Makefile.am Sat Sep 11 01:59:42 2004 | ||
| 17 | *************** $(check_tcp_programs): check_tcp | ||
| 18 | *** 132,138 **** | ||
| 19 | |||
| 20 | install-exec-hook: | ||
| 21 | cd $(DESTDIR)$(libexecdir) && \ | ||
| 22 | ! for i in $(check_tcp_programs) ; do rm -f $$i; ln -s -f check_tcp $$i ; done | ||
| 23 | |||
| 24 | clean-local: | ||
| 25 | rm -f $(check_tcp_programs) | ||
| 26 | --- 132,139 ---- | ||
| 27 | |||
| 28 | install-exec-hook: | ||
| 29 | cd $(DESTDIR)$(libexecdir) && \ | ||
| 30 | ! for i in $(check_tcp_programs) ; do rm -f $$i; ln -s -f check_tcp $$i ; done ;\ | ||
| 31 | ! rm -f check_ldaps ; ln -s -f check_ldap check_ldaps | ||
| 32 | |||
| 33 | clean-local: | ||
| 34 | rm -f $(check_tcp_programs) | ||
| 35 | diff -r -p nagios-plugins-1.3.1/plugins/check_ldap.c nagios-plugins-1.3.1-patchTLS/plugins/check_ldap.c | ||
| 36 | *** nagios-plugins-1.3.1/plugins/check_ldap.c Wed Jan 29 07:16:15 2003 | ||
| 37 | --- nagios-plugins-1.3.1-patchTLS/plugins/check_ldap.c Tue Sep 14 15:16:05 2004 | ||
| 38 | *************** | ||
| 39 | *** 20,26 **** | ||
| 40 | * | ||
| 41 | *****************************************************************************/ | ||
| 42 | |||
| 43 | ! const char *progname = "check_ldap"; | ||
| 44 | const char *revision = "$Revision: 1.4 $"; | ||
| 45 | |||
| 46 | #include "config.h" | ||
| 47 | --- 20,26 ---- | ||
| 48 | * | ||
| 49 | *****************************************************************************/ | ||
| 50 | |||
| 51 | ! char *progname = "check_ldap"; | ||
| 52 | const char *revision = "$Revision: 1.4 $"; | ||
| 53 | |||
| 54 | #include "config.h" | ||
| 55 | *************** char *ld_binddn = NULL; | ||
| 56 | *** 50,55 **** | ||
| 57 | --- 50,56 ---- | ||
| 58 | unsigned int ld_port = DEFAULT_PORT; | ||
| 59 | int warn_time = UNDEFINED; | ||
| 60 | int crit_time = UNDEFINED; | ||
| 61 | + char *SERVICE = "LDAP"; | ||
| 62 | |||
| 63 | int | ||
| 64 | main (int argc, char *argv[]) | ||
| 65 | *************** main (int argc, char *argv[]) | ||
| 66 | *** 60,65 **** | ||
| 67 | --- 61,73 ---- | ||
| 68 | |||
| 69 | int t_diff; | ||
| 70 | time_t time0, time1; | ||
| 71 | + int tls; | ||
| 72 | + | ||
| 73 | + int version=3; | ||
| 74 | + | ||
| 75 | + if (strstr(argv[0],"check_ldaps")) { | ||
| 76 | + asprintf (&progname, "check_ldaps"); | ||
| 77 | + } | ||
| 78 | |||
| 79 | if (process_arguments (argc, argv) == ERROR) | ||
| 80 | usage ("check_ldap: could not parse arguments\n"); | ||
| 81 | *************** main (int argc, char *argv[]) | ||
| 82 | *** 74,84 **** | ||
| 83 | time (&time0); | ||
| 84 | |||
| 85 | /* initialize ldap */ | ||
| 86 | if (!(ld = ldap_open (ld_host, ld_port))) { | ||
| 87 | - /*ldap_perror(ld, "ldap_open"); */ | ||
| 88 | printf ("Could not connect to the server at port %i\n", ld_port); | ||
| 89 | return STATE_CRITICAL; | ||
| 90 | } | ||
| 91 | |||
| 92 | /* bind to the ldap server */ | ||
| 93 | if (ldap_bind_s (ld, ld_binddn, ld_passwd, LDAP_AUTH_SIMPLE) != | ||
| 94 | --- 82,145 ---- | ||
| 95 | time (&time0); | ||
| 96 | |||
| 97 | /* initialize ldap */ | ||
| 98 | + #ifdef HAVE_LDAP_INIT | ||
| 99 | + if (!(ld = ldap_init (ld_host, ld_port))) { | ||
| 100 | + printf ("Could not connect to the server at port %i\n", ld_port); | ||
| 101 | + return STATE_CRITICAL; | ||
| 102 | + } | ||
| 103 | + #else | ||
| 104 | if (!(ld = ldap_open (ld_host, ld_port))) { | ||
| 105 | printf ("Could not connect to the server at port %i\n", ld_port); | ||
| 106 | return STATE_CRITICAL; | ||
| 107 | } | ||
| 108 | + #endif /* HAVE_LDAP_INIT */ | ||
| 109 | + | ||
| 110 | + #if defined(HAVE_LDAP_SET_OPTION) && defined(LDAP_OPT_PROTOCOL_VERSION) | ||
| 111 | + ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &version); | ||
| 112 | + #endif /* LDAP_OPT_PROTOCOL_VERSION */ | ||
| 113 | + | ||
| 114 | + if (strstr(argv[0],"check_ldaps")) { | ||
| 115 | + /* with TLS */ | ||
| 116 | + if ( ld_port == LDAPS_PORT ) { | ||
| 117 | + asprintf (&SERVICE, "LDAPS"); | ||
| 118 | + #if defined(HAVE_LDAP_SET_OPTION) && defined(LDAP_OPT_X_TLS) | ||
| 119 | + /* ldaps: set option tls */ | ||
| 120 | + tls = LDAP_OPT_X_TLS_HARD; | ||
| 121 | + if (ldap_set_option (ld, LDAP_OPT_X_TLS, &tls) != LDAP_SUCCESS) | ||
| 122 | + { | ||
| 123 | + /*ldap_perror(ld, "ldaps_option"); */ | ||
| 124 | + printf ("Could not init TLS at port %i!\n", ld_port); | ||
| 125 | + return STATE_CRITICAL; | ||
| 126 | + } | ||
| 127 | + #else | ||
| 128 | + printf ("TLS not supported by the libraries!\n", ld_port); | ||
| 129 | + return STATE_CRITICAL; | ||
| 130 | + #endif /* LDAP_OPT_X_TLS */ | ||
| 131 | + } else { | ||
| 132 | + asprintf (&SERVICE, "LDAP-TLS"); | ||
| 133 | + #if defined(HAVE_LDAP_SET_OPTION) && defined(HAVE_LDAP_START_TLS_S) | ||
| 134 | + /* ldap with startTLS: set option version */ | ||
| 135 | + if (ldap_get_option(ld,LDAP_OPT_PROTOCOL_VERSION, &version) == LDAP_OPT_SUCCESS ) | ||
| 136 | + { | ||
| 137 | + if (version < LDAP_VERSION3) | ||
| 138 | + { | ||
| 139 | + version = LDAP_VERSION3; | ||
| 140 | + ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &version); | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + /* call start_tls */ | ||
| 144 | + if (ldap_start_tls_s(ld, NULL, NULL) != LDAP_SUCCESS) | ||
| 145 | + { | ||
| 146 | + /*ldap_perror(ld, "ldap_start_tls"); */ | ||
| 147 | + printf ("Could not init startTLS at port %i!\n", ld_port); | ||
| 148 | + return STATE_CRITICAL; | ||
| 149 | + } | ||
| 150 | + #else | ||
| 151 | + printf ("startTLS not supported by the library, needs LDAPv3!\n"); | ||
| 152 | + return STATE_CRITICAL; | ||
| 153 | + #endif /* HAVE_LDAP_START_TLS_S */ | ||
| 154 | + } | ||
| 155 | + } | ||
| 156 | |||
| 157 | /* bind to the ldap server */ | ||
| 158 | if (ldap_bind_s (ld, ld_binddn, ld_passwd, LDAP_AUTH_SIMPLE) != | ||
| 159 | *************** main (int argc, char *argv[]) | ||
| 160 | *** 109,125 **** | ||
| 161 | t_diff = time1 - time0; | ||
| 162 | |||
| 163 | if (crit_time!=UNDEFINED && t_diff>=crit_time) { | ||
| 164 | ! printf ("LDAP critical - %i seconds response time\n", t_diff); | ||
| 165 | return STATE_CRITICAL; | ||
| 166 | } | ||
| 167 | |||
| 168 | if (warn_time!=UNDEFINED && t_diff>=warn_time) { | ||
| 169 | ! printf ("LDAP warning - %i seconds response time\n", t_diff); | ||
| 170 | return STATE_WARNING; | ||
| 171 | } | ||
| 172 | |||
| 173 | /* print out the result */ | ||
| 174 | ! printf ("LDAP ok - %i seconds response time\n", t_diff); | ||
| 175 | |||
| 176 | return STATE_OK; | ||
| 177 | } | ||
| 178 | --- 170,186 ---- | ||
| 179 | t_diff = time1 - time0; | ||
| 180 | |||
| 181 | if (crit_time!=UNDEFINED && t_diff>=crit_time) { | ||
| 182 | ! printf ("%s critical - %i seconds response time\n", SERVICE, t_diff); | ||
| 183 | return STATE_CRITICAL; | ||
| 184 | } | ||
| 185 | |||
| 186 | if (warn_time!=UNDEFINED && t_diff>=warn_time) { | ||
| 187 | ! printf ("%s warning - %i seconds response time\n", SERVICE, t_diff); | ||
| 188 | return STATE_WARNING; | ||
| 189 | } | ||
| 190 | |||
| 191 | /* print out the result */ | ||
| 192 | ! printf ("%s ok - %i seconds response time\n", SERVICE, t_diff); | ||
| 193 | |||
| 194 | return STATE_OK; | ||
| 195 | } | ||
diff --git a/web/attachments/102274-check_upsv2.c b/web/attachments/102274-check_upsv2.c new file mode 100644 index 0000000..f238c7d --- /dev/null +++ b/web/attachments/102274-check_upsv2.c | |||
| @@ -0,0 +1,593 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | |||
| 3 | This program is free software; you can redistribute it and/or modify | ||
| 4 | it under the terms of the GNU General Public License as published by | ||
| 5 | the Free Software Foundation; either version 2 of the License, or (at | ||
| 6 | your option) any later version. | ||
| 7 | |||
| 8 | This program is distributed in the hope that it will be useful, but | ||
| 9 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 11 | General Public License for more details. | ||
| 12 | |||
| 13 | You should have received a copy of the GNU General Public License | ||
| 14 | along with this program; if not, write to the Free Software | ||
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 16 | |||
| 17 | ******************************************************************************/ | ||
| 18 | |||
| 19 | const char *progname = "check_ups"; | ||
| 20 | const char *revision = "$Revision: 1.13 $"; | ||
| 21 | const char *copyright = "2000-2002"; | ||
| 22 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 23 | |||
| 24 | #include <locale.h> | ||
| 25 | #include "common.h" | ||
| 26 | #include "netutils.h" | ||
| 27 | #include "utils.h" | ||
| 28 | |||
| 29 | enum { | ||
| 30 | PORT = 3493 | ||
| 31 | }; | ||
| 32 | |||
| 33 | #define CHECK_NONE 0 | ||
| 34 | |||
| 35 | #define UPS_NONE 0 /* no supported options */ | ||
| 36 | #define UPS_UTILITY 1 /* supports utility line voltage */ | ||
| 37 | #define UPS_BATTPCT 2 /* supports percent battery remaining */ | ||
| 38 | #define UPS_STATUS 4 /* supports UPS status */ | ||
| 39 | #define UPS_TEMP 8 /* supports UPS temperature */ | ||
| 40 | #define UPS_LOADPCT 16 /* supports load percent */ | ||
| 41 | |||
| 42 | #define UPSSTATUS_NONE 0 | ||
| 43 | #define UPSSTATUS_OFF 1 | ||
| 44 | #define UPSSTATUS_OL 2 | ||
| 45 | #define UPSSTATUS_OB 4 | ||
| 46 | #define UPSSTATUS_LB 8 | ||
| 47 | #define UPSSTATUS_CAL 16 | ||
| 48 | #define UPSSTATUS_RB 32 /*Replace Battery */ | ||
| 49 | #define UPSSTATUS_UNKOWN 64 | ||
| 50 | |||
| 51 | enum { NOSUCHVAR = ERROR-1 }; | ||
| 52 | |||
| 53 | int server_port = PORT; | ||
| 54 | char *server_address; | ||
| 55 | char *ups_name = NULL; | ||
| 56 | double warning_value = 0.0; | ||
| 57 | double critical_value = 0.0; | ||
| 58 | int check_warn = FALSE; | ||
| 59 | int check_crit = FALSE; | ||
| 60 | int check_variable = UPS_NONE; | ||
| 61 | int supported_options = UPS_NONE; | ||
| 62 | int status = UPSSTATUS_NONE; | ||
| 63 | |||
| 64 | double ups_utility_voltage = 0.0; | ||
| 65 | double ups_battery_percent = 0.0; | ||
| 66 | double ups_load_percent = 0.0; | ||
| 67 | double ups_temperature = 0.0; | ||
| 68 | char *ups_status; | ||
| 69 | |||
| 70 | int determine_status (void); | ||
| 71 | int get_ups_variable (const char *, char *, size_t); | ||
| 72 | |||
| 73 | int process_arguments (int, char **); | ||
| 74 | int validate_arguments (void); | ||
| 75 | void print_help (void); | ||
| 76 | void print_usage (void); | ||
| 77 | |||
| 78 | int | ||
| 79 | main (int argc, char **argv) | ||
| 80 | { | ||
| 81 | int result = STATE_OK; | ||
| 82 | char *message; | ||
| 83 | char *data; | ||
| 84 | char temp_buffer[MAX_INPUT_BUFFER]; | ||
| 85 | double ups_utility_deviation = 0.0; | ||
| 86 | int res; | ||
| 87 | |||
| 88 | setlocale (LC_ALL, ""); | ||
| 89 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 90 | textdomain (PACKAGE); | ||
| 91 | |||
| 92 | ups_status = strdup ("N/A"); | ||
| 93 | data = strdup (""); | ||
| 94 | message = strdup (""); | ||
| 95 | |||
| 96 | if (process_arguments (argc, argv) != OK) | ||
| 97 | usage ("Invalid command arguments supplied\n"); | ||
| 98 | |||
| 99 | /* initialize alarm signal handling */ | ||
| 100 | signal (SIGALRM, socket_timeout_alarm_handler); | ||
| 101 | |||
| 102 | /* set socket timeout */ | ||
| 103 | alarm (socket_timeout); | ||
| 104 | |||
| 105 | /* get the ups status if possible */ | ||
| 106 | if (determine_status () != OK) | ||
| 107 | return STATE_CRITICAL; | ||
| 108 | if (supported_options & UPS_STATUS) { | ||
| 109 | |||
| 110 | ups_status = strdup (""); | ||
| 111 | result = STATE_OK; | ||
| 112 | |||
| 113 | if (status & UPSSTATUS_OFF) { | ||
| 114 | asprintf (&ups_status, "Off"); | ||
| 115 | result = STATE_CRITICAL; | ||
| 116 | } | ||
| 117 | else if ((status & (UPSSTATUS_OB | UPSSTATUS_LB)) == | ||
| 118 | (UPSSTATUS_OB | UPSSTATUS_LB)) { | ||
| 119 | asprintf (&ups_status, "On Battery, Low Battery"); | ||
| 120 | result = STATE_CRITICAL; | ||
| 121 | } | ||
| 122 | else { | ||
| 123 | if (status & UPSSTATUS_OL) { | ||
| 124 | asprintf (&ups_status, "%s%s", ups_status, "Online"); | ||
| 125 | } | ||
| 126 | if (status & UPSSTATUS_OB) { | ||
| 127 | asprintf (&ups_status, "%s%s", ups_status, "On Battery"); | ||
| 128 | result = STATE_WARNING; | ||
| 129 | } | ||
| 130 | if (status & UPSSTATUS_LB) { | ||
| 131 | asprintf (&ups_status, "%s%s", ups_status, ", Low Battery"); | ||
| 132 | result = STATE_WARNING; | ||
| 133 | } | ||
| 134 | if (status & UPSSTATUS_CAL) { | ||
| 135 | asprintf (&ups_status, "%s%s", ups_status, ", Calibrating"); | ||
| 136 | } | ||
| 137 | if (status & UPSSTATUS_RB) { | ||
| 138 | asprintf (&ups_status, "%s%s", ups_status, ", Replace Battery"); | ||
| 139 | result = STATE_WARNING; | ||
| 140 | } | ||
| 141 | if (status & UPSSTATUS_UNKOWN) { | ||
| 142 | asprintf (&ups_status, "%s%s", ups_status, ", Unknown"); | ||
| 143 | } | ||
| 144 | } | ||
| 145 | asprintf (&message, "%sStatus=%s ", message, ups_status); | ||
| 146 | } | ||
| 147 | |||
| 148 | /* get the ups utility voltage if possible */ | ||
| 149 | res=get_ups_variable ("input.voltage", temp_buffer, sizeof (temp_buffer)); | ||
| 150 | if (res == NOSUCHVAR) supported_options &= ~UPS_UTILITY; | ||
| 151 | else if (res != OK) | ||
| 152 | return STATE_CRITICAL; | ||
| 153 | else { | ||
| 154 | supported_options |= UPS_UTILITY; | ||
| 155 | |||
| 156 | ups_utility_voltage = atof (temp_buffer); | ||
| 157 | asprintf (&message, "%sUtility=%3.1fV ", message, ups_utility_voltage); | ||
| 158 | |||
| 159 | if (ups_utility_voltage > 120.0) | ||
| 160 | ups_utility_deviation = 120.0 - ups_utility_voltage; | ||
| 161 | else | ||
| 162 | ups_utility_deviation = ups_utility_voltage - 120.0; | ||
| 163 | |||
| 164 | if (check_variable == UPS_UTILITY) { | ||
| 165 | if (check_crit==TRUE && ups_utility_deviation>=critical_value) { | ||
| 166 | result = STATE_CRITICAL; | ||
| 167 | } | ||
| 168 | else if (check_warn==TRUE && ups_utility_deviation>=warning_value) { | ||
| 169 | result = max_state (result, STATE_WARNING); | ||
| 170 | } | ||
| 171 | asprintf (&data, "%s", | ||
| 172 | perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", | ||
| 173 | check_warn, (long)(1000*warning_value), | ||
| 174 | check_crit, (long)(1000*critical_value), | ||
| 175 | TRUE, 0, FALSE, 0)); | ||
| 176 | } else { | ||
| 177 | asprintf (&data, "%s", | ||
| 178 | perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", | ||
| 179 | FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); | ||
| 180 | } | ||
| 181 | } | ||
| 182 | |||
| 183 | /* get the ups battery percent if possible */ | ||
| 184 | res=get_ups_variable ("battery.charge", temp_buffer, sizeof (temp_buffer)); | ||
| 185 | if (res == NOSUCHVAR) supported_options &= ~UPS_BATTPCT; | ||
| 186 | else if ( res != OK) | ||
| 187 | return STATE_CRITICAL; | ||
| 188 | else { | ||
| 189 | supported_options |= UPS_BATTPCT; | ||
| 190 | ups_battery_percent = atof (temp_buffer); | ||
| 191 | asprintf (&message, "%sBatt=%3.1f%% ", message, ups_battery_percent); | ||
| 192 | |||
| 193 | if (check_variable == UPS_BATTPCT) { | ||
| 194 | if (check_crit==TRUE && ups_battery_percent <= critical_value) { | ||
| 195 | result = STATE_CRITICAL; | ||
| 196 | } | ||
| 197 | else if (check_warn==TRUE && ups_battery_percent<=warning_value) { | ||
| 198 | result = max_state (result, STATE_WARNING); | ||
| 199 | } | ||
| 200 | asprintf (&data, "%s %s", data, | ||
| 201 | perfdata ("battery", (long)ups_battery_percent, "%", | ||
| 202 | check_warn, (long)(1000*warning_value), | ||
| 203 | check_crit, (long)(1000*critical_value), | ||
| 204 | TRUE, 0, TRUE, 100)); | ||
| 205 | } else { | ||
| 206 | asprintf (&data, "%s %s", data, | ||
| 207 | perfdata ("battery", (long)ups_battery_percent, "%", | ||
| 208 | FALSE, 0, FALSE, 0, TRUE, 0, TRUE, 100)); | ||
| 209 | } | ||
| 210 | } | ||
| 211 | |||
| 212 | /* get the ups load percent if possible */ | ||
| 213 | res=get_ups_variable ("ups.load", temp_buffer, sizeof (temp_buffer)); | ||
| 214 | if ( res == NOSUCHVAR ) supported_options &= ~UPS_LOADPCT; | ||
| 215 | else if ( res != OK) | ||
| 216 | return STATE_CRITICAL; | ||
| 217 | else { | ||
| 218 | supported_options |= UPS_LOADPCT; | ||
| 219 | ups_load_percent = atof (temp_buffer); | ||
| 220 | asprintf (&message, "%sLoad=%3.1f%% ", message, ups_load_percent); | ||
| 221 | |||
| 222 | if (check_variable == UPS_LOADPCT) { | ||
| 223 | if (check_crit==TRUE && ups_load_percent>=critical_value) { | ||
| 224 | result = STATE_CRITICAL; | ||
| 225 | } | ||
| 226 | else if (check_warn==TRUE && ups_load_percent>=warning_value) { | ||
| 227 | result = max_state (result, STATE_WARNING); | ||
| 228 | } | ||
| 229 | asprintf (&data, "%s %s", data, | ||
| 230 | perfdata ("load", (long)ups_load_percent, "%", | ||
| 231 | check_warn, (long)(1000*warning_value), | ||
| 232 | check_crit, (long)(1000*critical_value), | ||
| 233 | TRUE, 0, TRUE, 100)); | ||
| 234 | } else { | ||
| 235 | asprintf (&data, "%s %s", data, | ||
| 236 | perfdata ("load", (long)ups_load_percent, "%", | ||
| 237 | FALSE, 0, FALSE, 0, TRUE, 0, TRUE, 100)); | ||
| 238 | } | ||
| 239 | } | ||
| 240 | |||
| 241 | /* get the ups temperature if possible */ | ||
| 242 | res=get_ups_variable ("ups.temperature", temp_buffer, sizeof (temp_buffer)); | ||
| 243 | if ( res == NOSUCHVAR ) supported_options &= ~UPS_TEMP; | ||
| 244 | else if ( res != OK) | ||
| 245 | return STATE_CRITICAL; | ||
| 246 | else { | ||
| 247 | supported_options |= UPS_TEMP; | ||
| 248 | ups_temperature = (atof (temp_buffer) * 1.8) + 32; | ||
| 249 | asprintf (&message, "%sTemp=%3.1fF", message, ups_temperature); | ||
| 250 | |||
| 251 | if (check_variable == UPS_TEMP) { | ||
| 252 | if (check_crit==TRUE && ups_temperature>=critical_value) { | ||
| 253 | result = STATE_CRITICAL; | ||
| 254 | } | ||
| 255 | else if (check_warn == TRUE && ups_temperature>=warning_value) { | ||
| 256 | result = max_state (result, STATE_WARNING); | ||
| 257 | } | ||
| 258 | asprintf (&data, "%s %s", data, | ||
| 259 | perfdata ("temp", (long)ups_temperature, "degF", | ||
| 260 | check_warn, (long)(1000*warning_value), | ||
| 261 | check_crit, (long)(1000*critical_value), | ||
| 262 | TRUE, 0, FALSE, 0)); | ||
| 263 | } else { | ||
| 264 | asprintf (&data, "%s %s", data, | ||
| 265 | perfdata ("temp", (long)ups_temperature, "degF", | ||
| 266 | FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); | ||
| 267 | } | ||
| 268 | } | ||
| 269 | |||
| 270 | /* if the UPS does not support any options we are looking for, report an error */ | ||
| 271 | if (supported_options == UPS_NONE) { | ||
| 272 | result = STATE_CRITICAL; | ||
| 273 | asprintf (&message, "UPS does not support any available options\n"); | ||
| 274 | } | ||
| 275 | |||
| 276 | /* reset timeout */ | ||
| 277 | alarm (0); | ||
| 278 | |||
| 279 | printf ("UPS %s - %s|%s\n", state_text(result), message, data); | ||
| 280 | return result; | ||
| 281 | } | ||
| 282 | |||
| 283 | |||
| 284 | |||
| 285 | /* determines what options are supported by the UPS */ | ||
| 286 | int | ||
| 287 | determine_status (void) | ||
| 288 | { | ||
| 289 | char recv_buffer[MAX_INPUT_BUFFER]; | ||
| 290 | char temp_buffer[MAX_INPUT_BUFFER]; | ||
| 291 | char *ptr; | ||
| 292 | int res; | ||
| 293 | |||
| 294 | res=get_ups_variable ("ups.status", recv_buffer, sizeof (recv_buffer)); | ||
| 295 | if (res == NOSUCHVAR) return OK; | ||
| 296 | if (res != STATE_OK) { | ||
| 297 | printf ("Invalid response received from hostn"); | ||
| 298 | return ERROR; | ||
| 299 | } | ||
| 300 | |||
| 301 | supported_options |= UPS_STATUS; | ||
| 302 | |||
| 303 | strcpy (temp_buffer, recv_buffer); | ||
| 304 | for (ptr = (char *) strtok (temp_buffer, " "); ptr != NULL; | ||
| 305 | ptr = (char *) strtok (NULL, " ")) { | ||
| 306 | if (!strcmp (ptr, "OFF")) | ||
| 307 | status |= UPSSTATUS_OFF; | ||
| 308 | else if (!strcmp (ptr, "OL")) | ||
| 309 | status |= UPSSTATUS_OL; | ||
| 310 | else if (!strcmp (ptr, "OB")) | ||
| 311 | status |= UPSSTATUS_OB; | ||
| 312 | else if (!strcmp (ptr, "LB")) | ||
| 313 | status |= UPSSTATUS_LB; | ||
| 314 | else if (!strcmp (ptr, "CAL")) | ||
| 315 | status |= UPSSTATUS_CAL; | ||
| 316 | else if (!strcmp (ptr, "RB")) | ||
| 317 | status |= UPSSTATUS_RB; | ||
| 318 | else | ||
| 319 | status |= UPSSTATUS_UNKOWN; | ||
| 320 | } | ||
| 321 | |||
| 322 | return OK; | ||
| 323 | } | ||
| 324 | |||
| 325 | |||
| 326 | /* gets a variable value for a specific UPS */ | ||
| 327 | int | ||
| 328 | get_ups_variable (const char *varname, char *buf, size_t buflen) | ||
| 329 | { | ||
| 330 | /* char command[MAX_INPUT_BUFFER]; */ | ||
| 331 | char temp_buffer[MAX_INPUT_BUFFER]; | ||
| 332 | char send_buffer[MAX_INPUT_BUFFER]; | ||
| 333 | char *ptr; | ||
| 334 | int len; | ||
| 335 | |||
| 336 | *buf=0; | ||
| 337 | |||
| 338 | /* create the command string to send to the UPS daemon */ | ||
| 339 | sprintf (send_buffer, "GET VAR %s %s\n", ups_name, varname); | ||
| 340 | |||
| 341 | /* send the command to the daemon and get a response back */ | ||
| 342 | if (process_tcp_request | ||
| 343 | (server_address, server_port, send_buffer, temp_buffer, | ||
| 344 | sizeof (temp_buffer)) != STATE_OK) { | ||
| 345 | printf ("Invalid response received from host\n"); | ||
| 346 | return ERROR; | ||
| 347 | } | ||
| 348 | |||
| 349 | ptr = temp_buffer; | ||
| 350 | len = strlen(ptr); | ||
| 351 | if (len > 0 && ptr[len-1] == '\n') ptr[len-1]=0; | ||
| 352 | if (strcmp (ptr, "ERR UNKNOWN-UPS") == 0) { | ||
| 353 | printf ("Error: no such ups '%s' on that host\n", ups_name); | ||
| 354 | return ERROR; | ||
| 355 | } | ||
| 356 | |||
| 357 | if (strcmp (ptr, "ERR VAR-NOT-SUPPORTED") == 0) { | ||
| 358 | //printf ("Error: Variable '%s' is not supported\n", varname); | ||
| 359 | return NOSUCHVAR; | ||
| 360 | } | ||
| 361 | |||
| 362 | if (strcmp (ptr, "ERR DATA-STALE") == 0) { | ||
| 363 | printf ("Error: UPS data is stale\n"); | ||
| 364 | return ERROR; | ||
| 365 | } | ||
| 366 | |||
| 367 | if (strncmp (ptr, "ERR", 3) == 0) { | ||
| 368 | printf ("Unkown error: %s\n", ptr); | ||
| 369 | return ERROR; | ||
| 370 | } | ||
| 371 | |||
| 372 | ptr = temp_buffer + strlen (varname) + strlen (ups_name) + 6; | ||
| 373 | len = strlen(ptr); | ||
| 374 | if (len < 2 || ptr[0] != '"' || ptr[len-1] != '"') { | ||
| 375 | printf ("Error: unable to parse variable\n"); | ||
| 376 | return ERROR; | ||
| 377 | } | ||
| 378 | strncpy (buf, ptr+1, len - 2); | ||
| 379 | buf[len - 2] = 0; | ||
| 380 | |||
| 381 | return OK; | ||
| 382 | } | ||
| 383 | |||
| 384 | |||
| 385 | /* Command line: CHECK_UPS -H <host_address> -u ups [-p port] [-v variable] | ||
| 386 | [-wv warn_value] [-cv crit_value] [-to to_sec] */ | ||
| 387 | |||
| 388 | |||
| 389 | /* process command-line arguments */ | ||
| 390 | int | ||
| 391 | process_arguments (int argc, char **argv) | ||
| 392 | { | ||
| 393 | int c; | ||
| 394 | |||
| 395 | int option = 0; | ||
| 396 | static struct option longopts[] = { | ||
| 397 | {"hostname", required_argument, 0, 'H'}, | ||
| 398 | {"ups", required_argument, 0, 'u'}, | ||
| 399 | {"port", required_argument, 0, 'p'}, | ||
| 400 | {"critical", required_argument, 0, 'c'}, | ||
| 401 | {"warning", required_argument, 0, 'w'}, | ||
| 402 | {"timeout", required_argument, 0, 't'}, | ||
| 403 | {"variable", required_argument, 0, 'v'}, | ||
| 404 | {"version", no_argument, 0, 'V'}, | ||
| 405 | {"help", no_argument, 0, 'h'}, | ||
| 406 | {0, 0, 0, 0} | ||
| 407 | }; | ||
| 408 | |||
| 409 | if (argc < 2) | ||
| 410 | return ERROR; | ||
| 411 | |||
| 412 | for (c = 1; c < argc; c++) { | ||
| 413 | if (strcmp ("-to", argv[c]) == 0) | ||
| 414 | strcpy (argv[c], "-t"); | ||
| 415 | else if (strcmp ("-wt", argv[c]) == 0) | ||
| 416 | strcpy (argv[c], "-w"); | ||
| 417 | else if (strcmp ("-ct", argv[c]) == 0) | ||
| 418 | strcpy (argv[c], "-c"); | ||
| 419 | } | ||
| 420 | |||
| 421 | while (1) { | ||
| 422 | c = getopt_long (argc, argv, "hVH:u:p:v:c:w:t:", longopts, | ||
| 423 | &option); | ||
| 424 | |||
| 425 | if (c == -1 || c == EOF) | ||
| 426 | break; | ||
| 427 | |||
| 428 | switch (c) { | ||
| 429 | case '?': /* help */ | ||
| 430 | usage3 ("Unknown option", optopt); | ||
| 431 | case 'H': /* hostname */ | ||
| 432 | if (is_host (optarg)) { | ||
| 433 | server_address = optarg; | ||
| 434 | } | ||
| 435 | else { | ||
| 436 | usage2 ("Invalid host name", optarg); | ||
| 437 | } | ||
| 438 | break; | ||
| 439 | case 'u': /* ups name */ | ||
| 440 | ups_name = optarg; | ||
| 441 | break; | ||
| 442 | case 'p': /* port */ | ||
| 443 | if (is_intpos (optarg)) { | ||
| 444 | server_port = atoi (optarg); | ||
| 445 | } | ||
| 446 | else { | ||
| 447 | usage2 ("Server port must be a positive integer", optarg); | ||
| 448 | } | ||
| 449 | break; | ||
| 450 | case 'c': /* critical time threshold */ | ||
| 451 | if (is_intnonneg (optarg)) { | ||
| 452 | critical_value = atoi (optarg); | ||
| 453 | check_crit = TRUE; | ||
| 454 | } | ||
| 455 | else { | ||
| 456 | usage2 ("Critical time must be a nonnegative integer", optarg); | ||
| 457 | } | ||
| 458 | break; | ||
| 459 | case 'w': /* warning time threshold */ | ||
| 460 | if (is_intnonneg (optarg)) { | ||
| 461 | warning_value = atoi (optarg); | ||
| 462 | check_warn = TRUE; | ||
| 463 | } | ||
| 464 | else { | ||
| 465 | usage2 ("Warning time must be a nonnegative integer", optarg); | ||
| 466 | } | ||
| 467 | break; | ||
| 468 | case 'v': /* variable */ | ||
| 469 | if (!strcmp (optarg, "LINE")) | ||
| 470 | check_variable = UPS_UTILITY; | ||
| 471 | else if (!strcmp (optarg, "TEMP")) | ||
| 472 | check_variable = UPS_TEMP; | ||
| 473 | else if (!strcmp (optarg, "BATTPCT")) | ||
| 474 | check_variable = UPS_BATTPCT; | ||
| 475 | else if (!strcmp (optarg, "LOADPCT")) | ||
| 476 | check_variable = UPS_LOADPCT; | ||
| 477 | else | ||
| 478 | usage2 ("Unrecognized UPS variable", optarg); | ||
| 479 | break; | ||
| 480 | case 't': /* timeout */ | ||
| 481 | if (is_intnonneg (optarg)) { | ||
| 482 | socket_timeout = atoi (optarg); | ||
| 483 | } | ||
| 484 | else { | ||
| 485 | usage ("Time interval must be a nonnegative integer\n"); | ||
| 486 | } | ||
| 487 | break; | ||
| 488 | case 'V': /* version */ | ||
| 489 | print_revision (progname, "$Revision: 1.13 $"); | ||
| 490 | exit (STATE_OK); | ||
| 491 | case 'h': /* help */ | ||
| 492 | print_help (); | ||
| 493 | exit (STATE_OK); | ||
| 494 | } | ||
| 495 | } | ||
| 496 | |||
| 497 | |||
| 498 | if (server_address == NULL && argc > optind) { | ||
| 499 | if (is_host (argv[optind])) | ||
| 500 | server_address = argv[optind++]; | ||
| 501 | else | ||
| 502 | usage ("Invalid host name"); | ||
| 503 | } | ||
| 504 | |||
| 505 | if (server_address == NULL) | ||
| 506 | server_address = strdup("127.0.0.1"); | ||
| 507 | |||
| 508 | return validate_arguments(); | ||
| 509 | } | ||
| 510 | |||
| 511 | |||
| 512 | |||
| 513 | |||
| 514 | |||
| 515 | int | ||
| 516 | validate_arguments (void) | ||
| 517 | { | ||
| 518 | if (! ups_name) { | ||
| 519 | printf ("Error : no ups indicated\n"); | ||
| 520 | return ERROR; | ||
| 521 | } | ||
| 522 | return OK; | ||
| 523 | } | ||
| 524 | |||
| 525 | |||
| 526 | |||
| 527 | |||
| 528 | |||
| 529 | |||
| 530 | void | ||
| 531 | print_help (void) | ||
| 532 | { | ||
| 533 | char *myport; | ||
| 534 | asprintf (&myport, "%d", PORT); | ||
| 535 | |||
| 536 | print_revision (progname, revision); | ||
| 537 | |||
| 538 | printf (_("Copyright (c) 2000 Tom Shields")); | ||
| 539 | printf (_(COPYRIGHT), copyright, email); | ||
| 540 | |||
| 541 | printf (_("This plugin tests the UPS service on the specified host.\n\ | ||
| 542 | Network UPS Tools from www.exploits.org must be running for this plugin to\n\ | ||
| 543 | work.\n\n")); | ||
| 544 | |||
| 545 | print_usage (); | ||
| 546 | |||
| 547 | printf (_(UT_HELP_VRSN)); | ||
| 548 | |||
| 549 | printf (_(UT_HOST_PORT), 'p', myport); | ||
| 550 | |||
| 551 | printf (_("\ | ||
| 552 | -u, --ups=STRING\n\ | ||
| 553 | Name of UPS\n")); | ||
| 554 | |||
| 555 | printf (_(UT_WARN_CRIT)); | ||
| 556 | |||
| 557 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
| 558 | |||
| 559 | printf (_(UT_VERBOSE)); | ||
| 560 | |||
| 561 | printf (_("\ | ||
| 562 | This plugin attempts to determine the status of a UPS (Uninterruptible Power\n\ | ||
| 563 | Supply) on a local or remote host. If the UPS is online or calibrating, the\n\ | ||
| 564 | plugin will return an OK state. If the battery is on it will return a WARNING\n\ | ||
| 565 | state. If the UPS is off or has a low battery the plugin will return a CRITICAL\n\ | ||
| 566 | state.\n\n")); | ||
| 567 | |||
| 568 | printf (_("\ | ||
| 569 | You may also specify a variable to check [such as temperature, utility voltage,\n\ | ||
| 570 | battery load, etc.] as well as warning and critical thresholds for the value of\n\ | ||
| 571 | that variable. If the remote host has multiple UPS that are being monitored you\n\ | ||
| 572 | will have to use the [ups] option to specify which UPS to check.\n\n")); | ||
| 573 | |||
| 574 | printf (_("Notes:\n\n\ | ||
| 575 | This plugin requires that the UPSD daemon distributed with Russel Kroll's\n\ | ||
| 576 | Smart UPS Tools be installed on the remote host. If you do not have the\n\ | ||
| 577 | package installed on your system, you can download it from\n\ | ||
| 578 | http://www.exploits.org/nut\n\n")); | ||
| 579 | |||
| 580 | printf (_(UT_SUPPORT)); | ||
| 581 | } | ||
| 582 | |||
| 583 | |||
| 584 | |||
| 585 | |||
| 586 | void | ||
| 587 | print_usage (void) | ||
| 588 | { | ||
| 589 | printf (_("\ | ||
| 590 | Usage: %s -H host -u ups [-p port] [-v variable] [-wv warn_value] [-cv crit_value] [-to to_sec]\n"), progname); | ||
| 591 | printf (_(UT_HLP_VRS), progname, progname); | ||
| 592 | } | ||
| 593 | |||
diff --git a/web/attachments/103460-check_ups-NUT2.0.diff b/web/attachments/103460-check_ups-NUT2.0.diff new file mode 100644 index 0000000..e28c718 --- /dev/null +++ b/web/attachments/103460-check_ups-NUT2.0.diff | |||
| @@ -0,0 +1,588 @@ | |||
| 1 | diff -ru nagiosplug/AUTHORS nagiosplug_AQ/AUTHORS | ||
| 2 | --- nagiosplug/AUTHORS 2004-08-23 23:59:37.000000000 +0200 | ||
| 3 | +++ nagiosplug_AQ/AUTHORS 2004-09-30 10:23:42.000000000 +0200 | ||
| 4 | @@ -119,3 +119,5 @@ | ||
| 5 | Sean Finney | ||
| 6 | Bill Kunkel | ||
| 7 | Paulo Afonso Graner Fessel | ||
| 8 | +Alain Richard | ||
| 9 | +Arnaud Quette | ||
| 10 | diff -ru nagiosplug/command.cfg.in nagiosplug_AQ/command.cfg.in | ||
| 11 | --- nagiosplug/command.cfg.in 2003-06-12 06:46:10.000000000 +0200 | ||
| 12 | +++ nagiosplug_AQ/command.cfg.in 2004-10-01 12:31:15.000000000 +0200 | ||
| 13 | @@ -91,6 +91,7 @@ | ||
| 14 | command[check_procs_zombie]=@libexecdir@/check_procs -w $ARG1$ -c $ARG2$ -s Z | ||
| 15 | command[check_procs_httpd]=@libexecdir@/check_procs -w 5:$ARG1$ -c 1:$ARG2$ -C httpd | ||
| 16 | command[check_procs_vsz]=@libexecdir@/check_procs -w 8096 -c 16182 -C httpd --metric VSZ | ||
| 17 | +command[check_ups]=@libexecdir@/check_ups -H $HOSTADDRESS$ -u $UPS$ | ||
| 18 | |||
| 19 | # An example of using check_by_ssh as an active service check | ||
| 20 | command[ssh_disk]=@libexecdir@/check_by_ssh -H $HOSTADDRESS$ -C '@libexecdir@/check_disk -w 85% -c 95% -p $ARG1$' | ||
| 21 | diff -ru nagiosplug/plugins/check_ups.c nagiosplug_AQ/plugins/check_ups.c | ||
| 22 | --- nagiosplug/plugins/check_ups.c 2004-03-14 05:09:19.000000000 +0100 | ||
| 23 | +++ nagiosplug_AQ/plugins/check_ups.c 2004-10-01 11:35:19.000000000 +0200 | ||
| 24 | @@ -1,26 +1,35 @@ | ||
| 25 | /****************************************************************************** | ||
| 26 | - | ||
| 27 | - This program is free software; you can redistribute it and/or modify | ||
| 28 | - it under the terms of the GNU General Public License as published by | ||
| 29 | - the Free Software Foundation; either version 2 of the License, or (at | ||
| 30 | - your option) any later version. | ||
| 31 | - | ||
| 32 | - This program is distributed in the hope that it will be useful, but | ||
| 33 | - WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 34 | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 35 | - General Public License for more details. | ||
| 36 | - | ||
| 37 | - You should have received a copy of the GNU General Public License | ||
| 38 | - along with this program; if not, write to the Free Software | ||
| 39 | - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 40 | - | ||
| 41 | -******************************************************************************/ | ||
| 42 | + * | ||
| 43 | + * check_ups | ||
| 44 | + * | ||
| 45 | + * Program: Network UPS Tools plugin for Nagios | ||
| 46 | + * License: GPL | ||
| 47 | + * Copyright (c) 2000 Tom Shields | ||
| 48 | + * 2004 Alain Richard <alain.richard@equation.fr> | ||
| 49 | + * 2004 Arnaud Quette <arnaud.quette@mgeups.com> | ||
| 50 | + * | ||
| 51 | + * This program is free software; you can redistribute it and/or modify | ||
| 52 | + * it under the terms of the GNU General Public License as published by | ||
| 53 | + * the Free Software Foundation; either version 2 of the License, or (at | ||
| 54 | + * your option) any later version. | ||
| 55 | + * | ||
| 56 | + * This program is distributed in the hope that it will be useful, but | ||
| 57 | + * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 58 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 59 | + * General Public License for more details. | ||
| 60 | + * | ||
| 61 | + * You should have received a copy of the GNU General Public License | ||
| 62 | + * along with this program; if not, write to the Free Software | ||
| 63 | + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 64 | + * | ||
| 65 | + ******************************************************************************/ | ||
| 66 | |||
| 67 | const char *progname = "check_ups"; | ||
| 68 | -const char *revision = "$Revision: 1.14 $"; | ||
| 69 | -const char *copyright = "2000-2002"; | ||
| 70 | +const char *revision = "$Revision: 1.20 $"; | ||
| 71 | +const char *copyright = "2000-2004"; | ||
| 72 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 73 | |||
| 74 | +#include <locale.h> | ||
| 75 | #include "common.h" | ||
| 76 | #include "netutils.h" | ||
| 77 | #include "utils.h" | ||
| 78 | @@ -38,14 +47,22 @@ | ||
| 79 | #define UPS_TEMP 8 /* supports UPS temperature */ | ||
| 80 | #define UPS_LOADPCT 16 /* supports load percent */ | ||
| 81 | |||
| 82 | -#define UPSSTATUS_NONE 0 | ||
| 83 | -#define UPSSTATUS_OFF 1 | ||
| 84 | -#define UPSSTATUS_OL 2 | ||
| 85 | -#define UPSSTATUS_OB 4 | ||
| 86 | -#define UPSSTATUS_LB 8 | ||
| 87 | -#define UPSSTATUS_CAL 16 | ||
| 88 | -#define UPSSTATUS_RB 32 /*Replace Battery */ | ||
| 89 | -#define UPSSTATUS_UNKOWN 64 | ||
| 90 | +#define UPSSTATUS_NONE 0 | ||
| 91 | +#define UPSSTATUS_OFF 1 | ||
| 92 | +#define UPSSTATUS_OL 2 | ||
| 93 | +#define UPSSTATUS_OB 4 | ||
| 94 | +#define UPSSTATUS_LB 8 | ||
| 95 | +#define UPSSTATUS_CAL 16 | ||
| 96 | +#define UPSSTATUS_RB 32 /*Replace Battery */ | ||
| 97 | +#define UPSSTATUS_BYPASS 64 | ||
| 98 | +#define UPSSTATUS_OVER 128 | ||
| 99 | +#define UPSSTATUS_TRIM 256 | ||
| 100 | +#define UPSSTATUS_BOOST 512 | ||
| 101 | +#define UPSSTATUS_CHRG 1024 | ||
| 102 | +#define UPSSTATUS_DISCHRG 2048 | ||
| 103 | +#define UPSSTATUS_UNKOWN 4096 | ||
| 104 | + | ||
| 105 | +enum { NOSUCHVAR = ERROR-1 }; | ||
| 106 | |||
| 107 | int server_port = PORT; | ||
| 108 | char *server_address; | ||
| 109 | @@ -63,9 +80,9 @@ | ||
| 110 | double ups_load_percent = 0.0; | ||
| 111 | double ups_temperature = 0.0; | ||
| 112 | char *ups_status; | ||
| 113 | +int temp_output_c = 0; | ||
| 114 | |||
| 115 | int determine_status (void); | ||
| 116 | -int determine_supported_vars (void); | ||
| 117 | int get_ups_variable (const char *, char *, size_t); | ||
| 118 | |||
| 119 | int process_arguments (int, char **); | ||
| 120 | @@ -73,7 +90,7 @@ | ||
| 121 | void print_help (void); | ||
| 122 | void print_usage (void); | ||
| 123 | |||
| 124 | -int | ||
| 125 | + int | ||
| 126 | main (int argc, char **argv) | ||
| 127 | { | ||
| 128 | int result = STATE_OK; | ||
| 129 | @@ -81,6 +98,7 @@ | ||
| 130 | char *data; | ||
| 131 | char temp_buffer[MAX_INPUT_BUFFER]; | ||
| 132 | double ups_utility_deviation = 0.0; | ||
| 133 | + int res; | ||
| 134 | |||
| 135 | setlocale (LC_ALL, ""); | ||
| 136 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 137 | @@ -88,6 +106,7 @@ | ||
| 138 | |||
| 139 | ups_status = strdup ("N/A"); | ||
| 140 | data = strdup (""); | ||
| 141 | + message = strdup (""); | ||
| 142 | |||
| 143 | if (process_arguments (argc, argv) != OK) | ||
| 144 | usage ("Invalid command arguments supplied\n"); | ||
| 145 | @@ -98,15 +117,11 @@ | ||
| 146 | /* set socket timeout */ | ||
| 147 | alarm (socket_timeout); | ||
| 148 | |||
| 149 | - /* determine what variables the UPS supports */ | ||
| 150 | - if (determine_supported_vars () != OK) | ||
| 151 | - return STATE_CRITICAL; | ||
| 152 | - | ||
| 153 | /* get the ups status if possible */ | ||
| 154 | + if (determine_status () != OK) | ||
| 155 | + return STATE_CRITICAL; | ||
| 156 | if (supported_options & UPS_STATUS) { | ||
| 157 | |||
| 158 | - if (determine_status () != OK) | ||
| 159 | - return STATE_CRITICAL; | ||
| 160 | ups_status = strdup (""); | ||
| 161 | result = STATE_OK; | ||
| 162 | |||
| 163 | @@ -138,6 +153,24 @@ | ||
| 164 | asprintf (&ups_status, "%s%s", ups_status, ", Replace Battery"); | ||
| 165 | result = STATE_WARNING; | ||
| 166 | } | ||
| 167 | + if (status & UPSSTATUS_BYPASS) { | ||
| 168 | + asprintf (&ups_status, "%s%s", ups_status, ", On Bypass"); | ||
| 169 | + } | ||
| 170 | + if (status & UPSSTATUS_OVER) { | ||
| 171 | + asprintf (&ups_status, "%s%s", ups_status, ", Overload"); | ||
| 172 | + } | ||
| 173 | + if (status & UPSSTATUS_TRIM) { | ||
| 174 | + asprintf (&ups_status, "%s%s", ups_status, ", Trimming"); | ||
| 175 | + } | ||
| 176 | + if (status & UPSSTATUS_BOOST) { | ||
| 177 | + asprintf (&ups_status, "%s%s", ups_status, ", Boosting"); | ||
| 178 | + } | ||
| 179 | + if (status & UPSSTATUS_CHRG) { | ||
| 180 | + asprintf (&ups_status, "%s%s", ups_status, ", Charging"); | ||
| 181 | + } | ||
| 182 | + if (status & UPSSTATUS_DISCHRG) { | ||
| 183 | + asprintf (&ups_status, "%s%s", ups_status, ", Discharging"); | ||
| 184 | + } | ||
| 185 | if (status & UPSSTATUS_UNKOWN) { | ||
| 186 | asprintf (&ups_status, "%s%s", ups_status, ", Unknown"); | ||
| 187 | } | ||
| 188 | @@ -146,10 +179,12 @@ | ||
| 189 | } | ||
| 190 | |||
| 191 | /* get the ups utility voltage if possible */ | ||
| 192 | - if (supported_options & UPS_UTILITY) { | ||
| 193 | - | ||
| 194 | - if (get_ups_variable ("UTILITY", temp_buffer, sizeof (temp_buffer)) != OK) | ||
| 195 | - return STATE_CRITICAL; | ||
| 196 | + res=get_ups_variable ("input.voltage", temp_buffer, sizeof (temp_buffer)); | ||
| 197 | + if (res == NOSUCHVAR) supported_options &= ~UPS_UTILITY; | ||
| 198 | + else if (res != OK) | ||
| 199 | + return STATE_CRITICAL; | ||
| 200 | + else { | ||
| 201 | + supported_options |= UPS_UTILITY; | ||
| 202 | |||
| 203 | ups_utility_voltage = atof (temp_buffer); | ||
| 204 | asprintf (&message, "%sUtility=%3.1fV ", message, ups_utility_voltage); | ||
| 205 | @@ -167,23 +202,24 @@ | ||
| 206 | result = max_state (result, STATE_WARNING); | ||
| 207 | } | ||
| 208 | asprintf (&data, "%s", | ||
| 209 | - fperfdata ("voltage", ups_utility_voltage, "V", | ||
| 210 | - check_warn, warning_value, | ||
| 211 | - check_crit, critical_value, | ||
| 212 | + perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", | ||
| 213 | + check_warn, (long)(1000*warning_value), | ||
| 214 | + check_crit, (long)(1000*critical_value), | ||
| 215 | TRUE, 0, FALSE, 0)); | ||
| 216 | } else { | ||
| 217 | asprintf (&data, "%s", | ||
| 218 | - fperfdata ("voltage", ups_utility_voltage, "V", | ||
| 219 | + perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", | ||
| 220 | FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); | ||
| 221 | } | ||
| 222 | } | ||
| 223 | |||
| 224 | /* get the ups battery percent if possible */ | ||
| 225 | - if (supported_options & UPS_BATTPCT) { | ||
| 226 | - | ||
| 227 | - if (get_ups_variable ("BATTPCT", temp_buffer, sizeof (temp_buffer)) != OK) | ||
| 228 | - return STATE_CRITICAL; | ||
| 229 | - | ||
| 230 | + res=get_ups_variable ("battery.charge", temp_buffer, sizeof (temp_buffer)); | ||
| 231 | + if (res == NOSUCHVAR) supported_options &= ~UPS_BATTPCT; | ||
| 232 | + else if ( res != OK) | ||
| 233 | + return STATE_CRITICAL; | ||
| 234 | + else { | ||
| 235 | + supported_options |= UPS_BATTPCT; | ||
| 236 | ups_battery_percent = atof (temp_buffer); | ||
| 237 | asprintf (&message, "%sBatt=%3.1f%% ", message, ups_battery_percent); | ||
| 238 | |||
| 239 | @@ -207,11 +243,12 @@ | ||
| 240 | } | ||
| 241 | |||
| 242 | /* get the ups load percent if possible */ | ||
| 243 | - if (supported_options & UPS_LOADPCT) { | ||
| 244 | - | ||
| 245 | - if (get_ups_variable ("LOADPCT", temp_buffer, sizeof (temp_buffer)) != OK) | ||
| 246 | - return STATE_CRITICAL; | ||
| 247 | - | ||
| 248 | + res=get_ups_variable ("ups.load", temp_buffer, sizeof (temp_buffer)); | ||
| 249 | + if ( res == NOSUCHVAR ) supported_options &= ~UPS_LOADPCT; | ||
| 250 | + else if ( res != OK) | ||
| 251 | + return STATE_CRITICAL; | ||
| 252 | + else { | ||
| 253 | + supported_options |= UPS_LOADPCT; | ||
| 254 | ups_load_percent = atof (temp_buffer); | ||
| 255 | asprintf (&message, "%sLoad=%3.1f%% ", message, ups_load_percent); | ||
| 256 | |||
| 257 | @@ -235,13 +272,20 @@ | ||
| 258 | } | ||
| 259 | |||
| 260 | /* get the ups temperature if possible */ | ||
| 261 | - if (supported_options & UPS_TEMP) { | ||
| 262 | - | ||
| 263 | - if (get_ups_variable ("UPSTEMP", temp_buffer, sizeof (temp_buffer)) != OK) | ||
| 264 | - return STATE_CRITICAL; | ||
| 265 | - | ||
| 266 | - ups_temperature = (atof (temp_buffer) * 1.8) + 32; | ||
| 267 | - asprintf (&message, "%sTemp=%3.1fF", message, ups_temperature); | ||
| 268 | + res=get_ups_variable ("ups.temperature", temp_buffer, sizeof (temp_buffer)); | ||
| 269 | + if ( res == NOSUCHVAR ) supported_options &= ~UPS_TEMP; | ||
| 270 | + else if ( res != OK) | ||
| 271 | + return STATE_CRITICAL; | ||
| 272 | + else { | ||
| 273 | + supported_options |= UPS_TEMP; | ||
| 274 | + if (temp_output_c) { | ||
| 275 | + ups_temperature = atof (temp_buffer); | ||
| 276 | + asprintf (&message, "%sTemp=%3.1fC", message, ups_temperature); | ||
| 277 | + } | ||
| 278 | + else { | ||
| 279 | + ups_temperature = (atof (temp_buffer) * 1.8) + 32; | ||
| 280 | + asprintf (&message, "%sTemp=%3.1fF", message, ups_temperature); | ||
| 281 | + } | ||
| 282 | |||
| 283 | if (check_variable == UPS_TEMP) { | ||
| 284 | if (check_crit==TRUE && ups_temperature>=critical_value) { | ||
| 285 | @@ -284,15 +328,17 @@ | ||
| 286 | char recv_buffer[MAX_INPUT_BUFFER]; | ||
| 287 | char temp_buffer[MAX_INPUT_BUFFER]; | ||
| 288 | char *ptr; | ||
| 289 | - | ||
| 290 | - if (get_ups_variable ("STATUS", recv_buffer, sizeof (recv_buffer)) != | ||
| 291 | - STATE_OK) { | ||
| 292 | + int res; | ||
| 293 | + | ||
| 294 | + res=get_ups_variable ("ups.status", recv_buffer, sizeof (recv_buffer)); | ||
| 295 | + if (res == NOSUCHVAR) return OK; | ||
| 296 | + if (res != STATE_OK) { | ||
| 297 | printf ("Invalid response received from hostn"); | ||
| 298 | return ERROR; | ||
| 299 | } | ||
| 300 | - | ||
| 301 | - recv_buffer[strlen (recv_buffer) - 1] = 0; | ||
| 302 | - | ||
| 303 | + | ||
| 304 | + supported_options |= UPS_STATUS; | ||
| 305 | + | ||
| 306 | strcpy (temp_buffer, recv_buffer); | ||
| 307 | for (ptr = (char *) strtok (temp_buffer, " "); ptr != NULL; | ||
| 308 | ptr = (char *) strtok (NULL, " ")) { | ||
| 309 | @@ -308,6 +354,18 @@ | ||
| 310 | status |= UPSSTATUS_CAL; | ||
| 311 | else if (!strcmp (ptr, "RB")) | ||
| 312 | status |= UPSSTATUS_RB; | ||
| 313 | + else if (!strcmp (ptr, "BYPASS")) | ||
| 314 | + status |= UPSSTATUS_BYPASS; | ||
| 315 | + else if (!strcmp (ptr, "OVER")) | ||
| 316 | + status |= UPSSTATUS_OVER; | ||
| 317 | + else if (!strcmp (ptr, "TRIM")) | ||
| 318 | + status |= UPSSTATUS_TRIM; | ||
| 319 | + else if (!strcmp (ptr, "BOOST")) | ||
| 320 | + status |= UPSSTATUS_BOOST; | ||
| 321 | + else if (!strcmp (ptr, "CHRG")) | ||
| 322 | + status |= UPSSTATUS_CHRG; | ||
| 323 | + else if (!strcmp (ptr, "DISCHRG")) | ||
| 324 | + status |= UPSSTATUS_DISCHRG; | ||
| 325 | else | ||
| 326 | status |= UPSSTATUS_UNKOWN; | ||
| 327 | } | ||
| 328 | @@ -316,55 +374,6 @@ | ||
| 329 | } | ||
| 330 | |||
| 331 | |||
| 332 | -/* determines what options are supported by the UPS */ | ||
| 333 | -int | ||
| 334 | -determine_supported_vars (void) | ||
| 335 | -{ | ||
| 336 | - char send_buffer[MAX_INPUT_BUFFER]; | ||
| 337 | - char recv_buffer[MAX_INPUT_BUFFER]; | ||
| 338 | - char temp_buffer[MAX_INPUT_BUFFER]; | ||
| 339 | - char *ptr; | ||
| 340 | - | ||
| 341 | - | ||
| 342 | - /* get the list of variables that this UPS supports */ | ||
| 343 | - if (ups_name) | ||
| 344 | - sprintf (send_buffer, "LISTVARS %s\r\n", ups_name); | ||
| 345 | - else | ||
| 346 | - sprintf (send_buffer, "LISTVARS\r\n"); | ||
| 347 | - if (process_tcp_request | ||
| 348 | - (server_address, server_port, send_buffer, recv_buffer, | ||
| 349 | - sizeof (recv_buffer)) != STATE_OK) { | ||
| 350 | - printf ("Invalid response received from host\n"); | ||
| 351 | - return ERROR; | ||
| 352 | - } | ||
| 353 | - | ||
| 354 | - recv_buffer[strlen (recv_buffer) - 1] = 0; | ||
| 355 | - | ||
| 356 | - if (ups_name) | ||
| 357 | - ptr = recv_buffer + 5 + strlen (ups_name) + 2; | ||
| 358 | - else | ||
| 359 | - ptr = recv_buffer + 5; | ||
| 360 | - | ||
| 361 | - strcpy (temp_buffer, recv_buffer); | ||
| 362 | - | ||
| 363 | - for (ptr = (char *) strtok (temp_buffer, " "); ptr != NULL; | ||
| 364 | - ptr = (char *) strtok (NULL, " ")) { | ||
| 365 | - if (!strcmp (ptr, "UTILITY")) | ||
| 366 | - supported_options |= UPS_UTILITY; | ||
| 367 | - else if (!strcmp (ptr, "BATTPCT")) | ||
| 368 | - supported_options |= UPS_BATTPCT; | ||
| 369 | - else if (!strcmp (ptr, "LOADPCT")) | ||
| 370 | - supported_options |= UPS_LOADPCT; | ||
| 371 | - else if (!strcmp (ptr, "STATUS")) | ||
| 372 | - supported_options |= UPS_STATUS; | ||
| 373 | - else if (!strcmp (ptr, "UPSTEMP")) | ||
| 374 | - supported_options |= UPS_TEMP; | ||
| 375 | - } | ||
| 376 | - | ||
| 377 | - return OK; | ||
| 378 | -} | ||
| 379 | - | ||
| 380 | - | ||
| 381 | /* gets a variable value for a specific UPS */ | ||
| 382 | int | ||
| 383 | get_ups_variable (const char *varname, char *buf, size_t buflen) | ||
| 384 | @@ -373,12 +382,12 @@ | ||
| 385 | char temp_buffer[MAX_INPUT_BUFFER]; | ||
| 386 | char send_buffer[MAX_INPUT_BUFFER]; | ||
| 387 | char *ptr; | ||
| 388 | + int len; | ||
| 389 | |||
| 390 | + *buf=0; | ||
| 391 | + | ||
| 392 | /* create the command string to send to the UPS daemon */ | ||
| 393 | - if (ups_name) | ||
| 394 | - sprintf (send_buffer, "REQ %s@%s\n", varname, ups_name); | ||
| 395 | - else | ||
| 396 | - sprintf (send_buffer, "REQ %s\n", varname); | ||
| 397 | + sprintf (send_buffer, "GET VAR %s %s\n", ups_name, varname); | ||
| 398 | |||
| 399 | /* send the command to the daemon and get a response back */ | ||
| 400 | if (process_tcp_request | ||
| 401 | @@ -388,40 +397,43 @@ | ||
| 402 | return ERROR; | ||
| 403 | } | ||
| 404 | |||
| 405 | - if (ups_name) | ||
| 406 | - ptr = temp_buffer + strlen (varname) + 5 + strlen (ups_name) + 1; | ||
| 407 | - else | ||
| 408 | - ptr = temp_buffer + strlen (varname) + 5; | ||
| 409 | - | ||
| 410 | - if (!strcmp (ptr, "NOT-SUPPORTED")) { | ||
| 411 | - printf ("Error: Variable '%s' is not supported\n", varname); | ||
| 412 | + ptr = temp_buffer; | ||
| 413 | + len = strlen(ptr); | ||
| 414 | + if (len > 0 && ptr[len-1] == '\n') ptr[len-1]=0; | ||
| 415 | + if (strcmp (ptr, "ERR UNKNOWN-UPS") == 0) { | ||
| 416 | + printf ("Error: no such ups '%s' on that host\n", ups_name); | ||
| 417 | return ERROR; | ||
| 418 | } | ||
| 419 | |||
| 420 | - if (!strcmp (ptr, "DATA-STALE")) { | ||
| 421 | + if (strcmp (ptr, "ERR VAR-NOT-SUPPORTED") == 0) { | ||
| 422 | + //printf ("Error: Variable '%s' is not supported\n", varname); | ||
| 423 | + return NOSUCHVAR; | ||
| 424 | + } | ||
| 425 | + | ||
| 426 | + if (strcmp (ptr, "ERR DATA-STALE") == 0) { | ||
| 427 | printf ("Error: UPS data is stale\n"); | ||
| 428 | return ERROR; | ||
| 429 | } | ||
| 430 | |||
| 431 | - if (!strcmp (ptr, "UNKNOWN-UPS")) { | ||
| 432 | - if (ups_name) | ||
| 433 | - printf ("Error: UPS '%s' is unknown\n", ups_name); | ||
| 434 | - else | ||
| 435 | - printf ("Error: UPS is unknown\n"); | ||
| 436 | + if (strncmp (ptr, "ERR", 3) == 0) { | ||
| 437 | + printf ("Unkown error: %s\n", ptr); | ||
| 438 | return ERROR; | ||
| 439 | } | ||
| 440 | |||
| 441 | - strncpy (buf, ptr, buflen - 1); | ||
| 442 | - buf[buflen - 1] = 0; | ||
| 443 | + ptr = temp_buffer + strlen (varname) + strlen (ups_name) + 6; | ||
| 444 | + len = strlen(ptr); | ||
| 445 | + if (len < 2 || ptr[0] != '"' || ptr[len-1] != '"') { | ||
| 446 | + printf ("Error: unable to parse variable\n"); | ||
| 447 | + return ERROR; | ||
| 448 | + } | ||
| 449 | + strncpy (buf, ptr+1, len - 2); | ||
| 450 | + buf[len - 2] = 0; | ||
| 451 | |||
| 452 | return OK; | ||
| 453 | } | ||
| 454 | |||
| 455 | |||
| 456 | - | ||
| 457 | - | ||
| 458 | - | ||
| 459 | -/* Command line: CHECK_UPS <host_address> [-u ups] [-p port] [-v variable] | ||
| 460 | +/* Command line: CHECK_UPS -H <host_address> -u ups [-p port] [-v variable] | ||
| 461 | [-wv warn_value] [-cv crit_value] [-to to_sec] */ | ||
| 462 | |||
| 463 | |||
| 464 | @@ -439,6 +451,7 @@ | ||
| 465 | {"critical", required_argument, 0, 'c'}, | ||
| 466 | {"warning", required_argument, 0, 'w'}, | ||
| 467 | {"timeout", required_argument, 0, 't'}, | ||
| 468 | + {"temperature", no_argument, 0, 'T'}, | ||
| 469 | {"variable", required_argument, 0, 'v'}, | ||
| 470 | {"version", no_argument, 0, 'V'}, | ||
| 471 | {"help", no_argument, 0, 'h'}, | ||
| 472 | @@ -458,7 +471,7 @@ | ||
| 473 | } | ||
| 474 | |||
| 475 | while (1) { | ||
| 476 | - c = getopt_long (argc, argv, "hVH:u:p:v:c:w:t:", longopts, | ||
| 477 | + c = getopt_long (argc, argv, "hVTH:u:p:v:c:w:t:", longopts, | ||
| 478 | &option); | ||
| 479 | |||
| 480 | if (c == -1 || c == EOF) | ||
| 481 | @@ -475,6 +488,9 @@ | ||
| 482 | usage2 ("Invalid host name", optarg); | ||
| 483 | } | ||
| 484 | break; | ||
| 485 | + case 'T': /* FIXME: to be improved (ie "-T C" for Celsius or "-T F" for Farenheit) */ | ||
| 486 | + temp_output_c = 1; | ||
| 487 | + break; | ||
| 488 | case 'u': /* ups name */ | ||
| 489 | ups_name = optarg; | ||
| 490 | break; | ||
| 491 | @@ -525,7 +541,7 @@ | ||
| 492 | } | ||
| 493 | break; | ||
| 494 | case 'V': /* version */ | ||
| 495 | - print_revision (progname, "$Revision: 1.14 $"); | ||
| 496 | + print_revision (progname, revision); | ||
| 497 | exit (STATE_OK); | ||
| 498 | case 'h': /* help */ | ||
| 499 | print_help (); | ||
| 500 | @@ -548,20 +564,17 @@ | ||
| 501 | } | ||
| 502 | |||
| 503 | |||
| 504 | - | ||
| 505 | - | ||
| 506 | - | ||
| 507 | int | ||
| 508 | validate_arguments (void) | ||
| 509 | { | ||
| 510 | - return OK; | ||
| 511 | + if (! ups_name) { | ||
| 512 | + printf ("Error : no ups indicated\n"); | ||
| 513 | + return ERROR; | ||
| 514 | + } | ||
| 515 | + return OK; | ||
| 516 | } | ||
| 517 | |||
| 518 | |||
| 519 | - | ||
| 520 | - | ||
| 521 | - | ||
| 522 | - | ||
| 523 | void | ||
| 524 | print_help (void) | ||
| 525 | { | ||
| 526 | @@ -571,11 +584,13 @@ | ||
| 527 | print_revision (progname, revision); | ||
| 528 | |||
| 529 | printf (_("Copyright (c) 2000 Tom Shields")); | ||
| 530 | + printf (_("Copyright (c) 2004 Alain Richard <alain.richard@equation.fr>\n")); | ||
| 531 | + printf (_("Copyright (c) 2004 Arnaud Quette <arnaud.quette@mgeups.com>\n")); | ||
| 532 | printf (_(COPYRIGHT), copyright, email); | ||
| 533 | |||
| 534 | printf (_("This plugin tests the UPS service on the specified host.\n\ | ||
| 535 | -Network UPS Tools from www.exploits.org must be running for this plugin to\n\ | ||
| 536 | -work.\n\n")); | ||
| 537 | +Network UPS Tools from www.networkupstools.org must be running for this \n\ | ||
| 538 | +plugin to work.\n\n")); | ||
| 539 | |||
| 540 | print_usage (); | ||
| 541 | |||
| 542 | @@ -587,6 +602,9 @@ | ||
| 543 | -u, --ups=STRING\n\ | ||
| 544 | Name of UPS\n")); | ||
| 545 | |||
| 546 | + printf (_("-T, --temperature\n\ | ||
| 547 | + Output of temperatures in Celsius\n")); | ||
| 548 | + | ||
| 549 | printf (_(UT_WARN_CRIT)); | ||
| 550 | |||
| 551 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
| 552 | @@ -607,10 +625,10 @@ | ||
| 553 | will have to use the [ups] option to specify which UPS to check.\n\n")); | ||
| 554 | |||
| 555 | printf (_("Notes:\n\n\ | ||
| 556 | -This plugin requires that the UPSD daemon distributed with Russel Kroll's\n\ | ||
| 557 | -Smart UPS Tools be installed on the remote host. If you do not have the\n\ | ||
| 558 | +This plugin requires that the UPSD daemon distributed with the NUT - Network\n\ | ||
| 559 | +UPS Tools to be installed on the remote host. If you do not have the\n\ | ||
| 560 | package installed on your system, you can download it from\n\ | ||
| 561 | -http://www.exploits.org/nut\n\n")); | ||
| 562 | +http://www.networkupstools.org\n\n")); | ||
| 563 | |||
| 564 | printf (_(UT_SUPPORT)); | ||
| 565 | } | ||
| 566 | @@ -622,7 +640,7 @@ | ||
| 567 | print_usage (void) | ||
| 568 | { | ||
| 569 | printf (_("\ | ||
| 570 | -Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit]\n\ | ||
| 571 | - [-t timeout] [-v]\n"), progname); | ||
| 572 | +Usage: %s -H host -u ups [-p port] [-v variable] [-wv warn_value] [-cv crit_value] [-to to_sec] [-T]\n"), progname); | ||
| 573 | printf (_(UT_HLP_VRS), progname, progname); | ||
| 574 | } | ||
| 575 | + | ||
| 576 | diff -ru nagiosplug/REQUIREMENTS nagiosplug_AQ/REQUIREMENTS | ||
| 577 | --- nagiosplug/REQUIREMENTS 2004-04-29 13:12:20.000000000 +0200 | ||
| 578 | +++ nagiosplug_AQ/REQUIREMENTS 2004-10-01 12:42:55.000000000 +0200 | ||
| 579 | @@ -65,6 +65,9 @@ | ||
| 580 | - Requires NSClient to run on the NT server to monitor | ||
| 581 | http://nsclient.ready2run.nl/ | ||
| 582 | |||
| 583 | +check_ups: | ||
| 584 | + - Requires Network UPS Tools (>= 1.4) to run on the server to monitor | ||
| 585 | + http://www.networkupstools.org/ | ||
| 586 | |||
| 587 | OS Specific Issues | ||
| 588 | ------------------ | ||
diff --git a/web/attachments/104058-check_tcp.c.patch b/web/attachments/104058-check_tcp.c.patch new file mode 100644 index 0000000..d9c435e --- /dev/null +++ b/web/attachments/104058-check_tcp.c.patch | |||
| @@ -0,0 +1,272 @@ | |||
| 1 | *** check_tcp.c Tue Jun 10 00:56:47 2003 | ||
| 2 | --- /usr/local/projects/nagios-plugins-1.3.1/plugins//check_tcp.c Wed Sep 29 15:14:33 2004 | ||
| 3 | *************** | ||
| 4 | *** 50,62 **** | ||
| 5 | --- 50,67 ---- | ||
| 6 | #include <openssl/ssl.h> | ||
| 7 | #include <openssl/err.h> | ||
| 8 | #endif | ||
| 9 | |||
| 10 | #ifdef HAVE_SSL | ||
| 11 | + int check_cert = FALSE; | ||
| 12 | + int days_till_exp; | ||
| 13 | + char *randbuff = ""; | ||
| 14 | SSL_CTX *ctx; | ||
| 15 | SSL *ssl; | ||
| 16 | + X509 *server_cert; | ||
| 17 | int connect_SSL (void); | ||
| 18 | + int check_certificate (X509 **); | ||
| 19 | #endif | ||
| 20 | |||
| 21 | enum { | ||
| 22 | TCP_PROTOCOL = 1, | ||
| 23 | UDP_PROTOCOL = 2, | ||
| 24 | *************** | ||
| 25 | *** 74,83 **** | ||
| 26 | --- 79,89 ---- | ||
| 27 | char *EXPECT = NULL; | ||
| 28 | char *QUIT = NULL; | ||
| 29 | int PROTOCOL = 0; | ||
| 30 | int PORT = 0; | ||
| 31 | |||
| 32 | + char timestamp[17] = ""; | ||
| 33 | int server_port = 0; | ||
| 34 | char *server_address = NULL; | ||
| 35 | char *server_send = NULL; | ||
| 36 | char *server_quit = NULL; | ||
| 37 | char **server_expect = NULL; | ||
| 38 | *************** | ||
| 39 | *** 193,202 **** | ||
| 40 | --- 199,224 ---- | ||
| 41 | asprintf (&server_expect[server_expect_count - 1], "201"); | ||
| 42 | asprintf (&QUIT, "QUIT\r\n"); | ||
| 43 | PROTOCOL = TCP_PROTOCOL; | ||
| 44 | PORT = 119; | ||
| 45 | } | ||
| 46 | + #ifdef HAVE_SSL | ||
| 47 | + else if (strstr (argv[0], "check_nntps")) { | ||
| 48 | + asprintf (&progname, "check_nntps"); | ||
| 49 | + asprintf (&SERVICE, "NNTPS"); | ||
| 50 | + SEND = NULL; | ||
| 51 | + EXPECT = NULL; | ||
| 52 | + server_expect = realloc (server_expect, ++server_expect_count); | ||
| 53 | + asprintf (&server_expect[server_expect_count - 1], "200"); | ||
| 54 | + server_expect = realloc (server_expect, ++server_expect_count); | ||
| 55 | + asprintf (&server_expect[server_expect_count - 1], "201"); | ||
| 56 | + asprintf (&QUIT, "QUIT\r\n"); | ||
| 57 | + PROTOCOL = TCP_PROTOCOL; | ||
| 58 | + use_ssl=TRUE; | ||
| 59 | + PORT = 563; | ||
| 60 | + } | ||
| 61 | + #endif | ||
| 62 | else { | ||
| 63 | usage ("ERROR: Generic check_tcp called with unknown service\n"); | ||
| 64 | } | ||
| 65 | |||
| 66 | asprintf (&server_address, "127.0.0.1"); | ||
| 67 | *************** | ||
| 68 | *** 220,230 **** | ||
| 69 | alarm (socket_timeout); | ||
| 70 | |||
| 71 | /* try to connect to the host at the given port number */ | ||
| 72 | gettimeofday (&tv, NULL); | ||
| 73 | #ifdef HAVE_SSL | ||
| 74 | ! if (use_ssl) | ||
| 75 | result = connect_SSL (); | ||
| 76 | else | ||
| 77 | #endif | ||
| 78 | { | ||
| 79 | if (PROTOCOL == UDP_PROTOCOL) | ||
| 80 | --- 242,270 ---- | ||
| 81 | alarm (socket_timeout); | ||
| 82 | |||
| 83 | /* try to connect to the host at the given port number */ | ||
| 84 | gettimeofday (&tv, NULL); | ||
| 85 | #ifdef HAVE_SSL | ||
| 86 | ! if (use_ssl && check_cert == TRUE) { | ||
| 87 | ! if (connect_SSL () != OK) | ||
| 88 | ! terminate (STATE_CRITICAL, | ||
| 89 | ! "TCP CRITICAL - Could not make SSL connection\n"); | ||
| 90 | ! if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) { | ||
| 91 | ! result = check_certificate (&server_cert); | ||
| 92 | ! X509_free(server_cert); | ||
| 93 | ! } | ||
| 94 | ! else { | ||
| 95 | ! printf("ERROR: Cannot retrieve server certificate.\n"); | ||
| 96 | ! result = STATE_CRITICAL; | ||
| 97 | ! } | ||
| 98 | ! SSL_shutdown (ssl); | ||
| 99 | ! SSL_free (ssl); | ||
| 100 | ! SSL_CTX_free (ctx); | ||
| 101 | ! close (sd); | ||
| 102 | ! return result; | ||
| 103 | ! } | ||
| 104 | ! else if (use_ssl) | ||
| 105 | result = connect_SSL (); | ||
| 106 | else | ||
| 107 | #endif | ||
| 108 | { | ||
| 109 | if (PROTOCOL == UDP_PROTOCOL) | ||
| 110 | *************** | ||
| 111 | *** 354,363 **** | ||
| 112 | --- 394,404 ---- | ||
| 113 | {"quit", required_argument, 0, 'q'}, | ||
| 114 | {"delay", required_argument, 0, 'd'}, | ||
| 115 | {"verbose", no_argument, 0, 'v'}, | ||
| 116 | {"version", no_argument, 0, 'V'}, | ||
| 117 | {"help", no_argument, 0, 'h'}, | ||
| 118 | + {"certificate", required_argument, 0, 'C'}, | ||
| 119 | {0, 0, 0, 0} | ||
| 120 | }; | ||
| 121 | #endif | ||
| 122 | |||
| 123 | if (argc < 2) | ||
| 124 | *************** | ||
| 125 | *** 421,434 **** | ||
| 126 | --- 462,477 ---- | ||
| 127 | if (!is_intnonneg (optarg)) | ||
| 128 | usage ("Warning threshold must be a nonnegative integer\n"); | ||
| 129 | warning_time = strtod (optarg, NULL); | ||
| 130 | check_warning_time = TRUE; | ||
| 131 | break; | ||
| 132 | + /* | ||
| 133 | case 'C': | ||
| 134 | crit_codes = realloc (crit_codes, ++crit_codes_count); | ||
| 135 | crit_codes[crit_codes_count - 1] = optarg; | ||
| 136 | break; | ||
| 137 | + */ | ||
| 138 | case 'W': | ||
| 139 | warn_codes = realloc (warn_codes, ++warn_codes_count); | ||
| 140 | warn_codes[warn_codes_count - 1] = optarg; | ||
| 141 | break; | ||
| 142 | case 't': /* timeout */ | ||
| 143 | *************** | ||
| 144 | *** 470,479 **** | ||
| 145 | --- 513,533 ---- | ||
| 146 | terminate (STATE_UNKNOWN, | ||
| 147 | "SSL support not available. Install OpenSSL and recompile."); | ||
| 148 | #endif | ||
| 149 | use_ssl = TRUE; | ||
| 150 | break; | ||
| 151 | + case 'C': /* Check SSL cert validity */ | ||
| 152 | + #ifdef HAVE_SSL | ||
| 153 | + if (!is_intnonneg (optarg)) | ||
| 154 | + usage2 ("invalid certificate expiration period", optarg); | ||
| 155 | + days_till_exp = atoi (optarg); | ||
| 156 | + check_cert = TRUE; | ||
| 157 | + #else | ||
| 158 | + terminate (STATE_UNKNOWN, | ||
| 159 | + "SSL support not available. Install OpenSSL and recompile."); | ||
| 160 | + #endif | ||
| 161 | + break; | ||
| 162 | } | ||
| 163 | } | ||
| 164 | |||
| 165 | if (server_address == NULL) | ||
| 166 | usage ("You must provide a server address\n"); | ||
| 167 | *************** | ||
| 168 | *** 532,541 **** | ||
| 169 | --- 586,600 ---- | ||
| 170 | " Seconds before connection times out (default: %d)\n" | ||
| 171 | " -v, --verbose" | ||
| 172 | " Show details for command-line debugging (do not use with nagios server)\n" | ||
| 173 | " -h, --help\n" | ||
| 174 | " Print detailed help screen\n" | ||
| 175 | + #ifdef HAVE_SSL | ||
| 176 | + " -C, --certificate=INTEGER\n" | ||
| 177 | + "Minimum number of days a certificate has to be valid.\n" | ||
| 178 | + "(when this option is used the banner is not checked.)\n" | ||
| 179 | + #endif | ||
| 180 | " -V, --version\n" | ||
| 181 | " Print version information\n", DEFAULT_SOCKET_TIMEOUT); | ||
| 182 | } | ||
| 183 | |||
| 184 | /* | ||
| 185 | *************** | ||
| 186 | *** 593,603 **** | ||
| 187 | --- 652,736 ---- | ||
| 188 | |||
| 189 | return STATE_CRITICAL; | ||
| 190 | } | ||
| 191 | #endif | ||
| 192 | |||
| 193 | + #ifdef HAVE_SSL | ||
| 194 | + int | ||
| 195 | + check_certificate (X509 ** certificate) | ||
| 196 | + { | ||
| 197 | + ASN1_STRING *tm; | ||
| 198 | + int offset; | ||
| 199 | + struct tm stamp; | ||
| 200 | + int days_left; | ||
| 201 | |||
| 202 | + | ||
| 203 | + /* Retrieve timestamp of certificate */ | ||
| 204 | + tm = X509_get_notAfter (*certificate); | ||
| 205 | + | ||
| 206 | + /* Generate tm structure to process timestamp */ | ||
| 207 | + if (tm->type == V_ASN1_UTCTIME) { | ||
| 208 | + if (tm->length < 10) { | ||
| 209 | + printf ("ERROR: Wrong time format in certificate.\n"); | ||
| 210 | + return STATE_CRITICAL; | ||
| 211 | + } | ||
| 212 | + else { | ||
| 213 | + stamp.tm_year = (tm->data[0] - '0') * 10 + (tm->data[1] - '0'); | ||
| 214 | + if (stamp.tm_year < 50) | ||
| 215 | + stamp.tm_year += 100; | ||
| 216 | + offset = 0; | ||
| 217 | + } | ||
| 218 | + } | ||
| 219 | + else { | ||
| 220 | + if (tm->length < 12) { | ||
| 221 | + printf ("ERROR: Wrong time format in certificate.\n"); | ||
| 222 | + return STATE_CRITICAL; | ||
| 223 | + } | ||
| 224 | + else { | ||
| 225 | + stamp.tm_year = | ||
| 226 | + (tm->data[0] - '0') * 1000 + (tm->data[1] - '0') * 100 + | ||
| 227 | + (tm->data[2] - '0') * 10 + (tm->data[3] - '0'); | ||
| 228 | + stamp.tm_year -= 1900; | ||
| 229 | + offset = 2; | ||
| 230 | + } | ||
| 231 | + } | ||
| 232 | + stamp.tm_mon = | ||
| 233 | + (tm->data[2 + offset] - '0') * 10 + (tm->data[3 + offset] - '0') - 1; | ||
| 234 | + stamp.tm_mday = | ||
| 235 | + (tm->data[4 + offset] - '0') * 10 + (tm->data[5 + offset] - '0'); | ||
| 236 | + stamp.tm_hour = | ||
| 237 | + (tm->data[6 + offset] - '0') * 10 + (tm->data[7 + offset] - '0'); | ||
| 238 | + stamp.tm_min = | ||
| 239 | + (tm->data[8 + offset] - '0') * 10 + (tm->data[9 + offset] - '0'); | ||
| 240 | + stamp.tm_sec = 0; | ||
| 241 | + stamp.tm_isdst = -1; | ||
| 242 | + | ||
| 243 | + days_left = (mktime (&stamp) - time (NULL)) / 86400; | ||
| 244 | + snprintf | ||
| 245 | + (timestamp, 16, "%02d/%02d/%04d %02d:%02d", | ||
| 246 | + stamp.tm_mon + 1, | ||
| 247 | + stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min); | ||
| 248 | + | ||
| 249 | + if (days_left > 0 && days_left <= days_till_exp) { | ||
| 250 | + printf ("Certificate expires in %d day(s) (%s).\n", days_left, timestamp); | ||
| 251 | + return STATE_WARNING; | ||
| 252 | + } | ||
| 253 | + if (days_left < 0) { | ||
| 254 | + printf ("Certificate expired on %s.\n", timestamp); | ||
| 255 | + return STATE_CRITICAL; | ||
| 256 | + } | ||
| 257 | + | ||
| 258 | + if (days_left == 0) { | ||
| 259 | + printf ("Certificate expires today (%s).\n", timestamp); | ||
| 260 | + return STATE_WARNING; | ||
| 261 | + } | ||
| 262 | + | ||
| 263 | + printf ("Certificate will expire on %s.\n", timestamp); | ||
| 264 | + | ||
| 265 | + return STATE_OK; | ||
| 266 | + } | ||
| 267 | + #endif | ||
| 268 | |||
| 269 | int | ||
| 270 | my_recv (void) | ||
| 271 | { | ||
| 272 | int i; | ||
diff --git a/web/attachments/104059-check_smtp.c.patch b/web/attachments/104059-check_smtp.c.patch new file mode 100644 index 0000000..4977bcc --- /dev/null +++ b/web/attachments/104059-check_smtp.c.patch | |||
| @@ -0,0 +1,491 @@ | |||
| 1 | *** check_smtp.c Fri Mar 7 02:15:40 2003 | ||
| 2 | --- /usr/local/projects/nagios-plugins-1.3.1/plugins//check_smtp.c Wed Sep 29 15:14:33 2004 | ||
| 3 | *************** | ||
| 4 | *** 37,46 **** | ||
| 5 | --- 37,64 ---- | ||
| 6 | #include "config.h" | ||
| 7 | #include "common.h" | ||
| 8 | #include "netutils.h" | ||
| 9 | #include "utils.h" | ||
| 10 | |||
| 11 | + #ifdef HAVE_SSL | ||
| 12 | + #include <openssl/ssl.h> | ||
| 13 | + #include <openssl/x509.h> | ||
| 14 | + #include <openssl/err.h> | ||
| 15 | + #include <openssl/rand.h> | ||
| 16 | + #endif | ||
| 17 | + | ||
| 18 | + #ifdef HAVE_SSL | ||
| 19 | + int check_cert = FALSE; | ||
| 20 | + int days_till_exp; | ||
| 21 | + SSL_CTX *ctx; | ||
| 22 | + SSL *ssl; | ||
| 23 | + X509 *server_cert; | ||
| 24 | + int connect_SSL (void); | ||
| 25 | + int check_certificate (X509 **); | ||
| 26 | + #endif | ||
| 27 | + | ||
| 28 | + | ||
| 29 | const char *progname = "check_smtp"; | ||
| 30 | |||
| 31 | #define SMTP_PORT 25 | ||
| 32 | #define SMTP_EXPECT "220" | ||
| 33 | #define SMTP_HELO "HELO " | ||
| 34 | *************** | ||
| 35 | *** 57,66 **** | ||
| 36 | --- 75,85 ---- | ||
| 37 | */ | ||
| 38 | |||
| 39 | #define SMTP_DUMMYCMD "MAIL " | ||
| 40 | #define SMTP_USE_DUMMYCMD 1 | ||
| 41 | #define SMTP_QUIT "QUIT\r\n" | ||
| 42 | + #define SMTP_STARTTLS "STARTTLS\r\n" | ||
| 43 | |||
| 44 | int process_arguments (int, char **); | ||
| 45 | int validate_arguments (void); | ||
| 46 | void print_help (void); | ||
| 47 | void print_usage (void); | ||
| 48 | *************** | ||
| 49 | *** 72,88 **** | ||
| 50 | int warning_time = 0; | ||
| 51 | int check_warning_time = FALSE; | ||
| 52 | int critical_time = 0; | ||
| 53 | int check_critical_time = FALSE; | ||
| 54 | int verbose = FALSE; | ||
| 55 | |||
| 56 | int | ||
| 57 | main (int argc, char **argv) | ||
| 58 | { | ||
| 59 | ! int sd; | ||
| 60 | int result = STATE_UNKNOWN; | ||
| 61 | - char buffer[MAX_INPUT_BUFFER] = ""; | ||
| 62 | char *from_str = NULL; | ||
| 63 | char *helocmd = NULL; | ||
| 64 | |||
| 65 | if (process_arguments (argc, argv) != OK) | ||
| 66 | usage ("Invalid command arguments supplied\n"); | ||
| 67 | --- 91,116 ---- | ||
| 68 | int warning_time = 0; | ||
| 69 | int check_warning_time = FALSE; | ||
| 70 | int critical_time = 0; | ||
| 71 | int check_critical_time = FALSE; | ||
| 72 | int verbose = FALSE; | ||
| 73 | + int use_ssl = FALSE; | ||
| 74 | + int sd; | ||
| 75 | + char timestamp[17] = ""; | ||
| 76 | + //char *buffer = ""; | ||
| 77 | + char buffer[MAX_INPUT_BUFFER] = ""; | ||
| 78 | + enum { | ||
| 79 | + TCP_PROTOCOL = 1, | ||
| 80 | + UDP_PROTOCOL = 2, | ||
| 81 | + MAXBUF = 1024 | ||
| 82 | + }; | ||
| 83 | |||
| 84 | int | ||
| 85 | main (int argc, char **argv) | ||
| 86 | { | ||
| 87 | ! | ||
| 88 | int result = STATE_UNKNOWN; | ||
| 89 | char *from_str = NULL; | ||
| 90 | char *helocmd = NULL; | ||
| 91 | |||
| 92 | if (process_arguments (argc, argv) != OK) | ||
| 93 | usage ("Invalid command arguments supplied\n"); | ||
| 94 | *************** | ||
| 95 | *** 114,130 **** | ||
| 96 | /* we connected, so close connection before exiting */ | ||
| 97 | if (result == STATE_OK) { | ||
| 98 | |||
| 99 | /* watch for the SMTP connection string and */ | ||
| 100 | /* return a WARNING status if we couldn't read any data */ | ||
| 101 | ! if (recv (sd, buffer, MAX_INPUT_BUFFER - 1, 0) == -1) { | ||
| 102 | ! printf ("recv() failed\n"); | ||
| 103 | result = STATE_WARNING; | ||
| 104 | } | ||
| 105 | else { | ||
| 106 | /* strip the buffer of carriage returns */ | ||
| 107 | ! strip (buffer); | ||
| 108 | /* make sure we find the response we are looking for */ | ||
| 109 | if (!strstr (buffer, server_expect)) { | ||
| 110 | if (server_port == SMTP_PORT) | ||
| 111 | printf ("Invalid SMTP response received from host\n"); | ||
| 112 | else | ||
| 113 | --- 142,158 ---- | ||
| 114 | /* we connected, so close connection before exiting */ | ||
| 115 | if (result == STATE_OK) { | ||
| 116 | |||
| 117 | /* watch for the SMTP connection string and */ | ||
| 118 | /* return a WARNING status if we couldn't read any data */ | ||
| 119 | ! if (recv(sd, buffer, MAX_INPUT_BUFFER-1, 0) == -1) { | ||
| 120 | ! printf ("my_recv() failed\n"); | ||
| 121 | result = STATE_WARNING; | ||
| 122 | } | ||
| 123 | else { | ||
| 124 | /* strip the buffer of carriage returns */ | ||
| 125 | ! strip (buffer); | ||
| 126 | /* make sure we find the response we are looking for */ | ||
| 127 | if (!strstr (buffer, server_expect)) { | ||
| 128 | if (server_port == SMTP_PORT) | ||
| 129 | printf ("Invalid SMTP response received from host\n"); | ||
| 130 | else | ||
| 131 | *************** | ||
| 132 | *** 132,162 **** | ||
| 133 | server_port); | ||
| 134 | result = STATE_WARNING; | ||
| 135 | } | ||
| 136 | } | ||
| 137 | |||
| 138 | /* send the HELO command */ | ||
| 139 | send(sd, helocmd, strlen(helocmd), 0); | ||
| 140 | |||
| 141 | /* allow for response to helo command to reach us */ | ||
| 142 | ! recv(sd, buffer, MAX_INPUT_BUFFER-1, 0); | ||
| 143 | ! | ||
| 144 | #ifdef SMTP_USE_DUMMYCMD | ||
| 145 | send(sd, from_str, strlen(from_str), 0); | ||
| 146 | |||
| 147 | /* allow for response to DUMMYCMD to reach us */ | ||
| 148 | ! recv(sd, buffer, MAX_INPUT_BUFFER-1, 0); | ||
| 149 | |||
| 150 | if (verbose == TRUE) | ||
| 151 | printf("DUMMYCMD: %s\n%s\n",from_str,buffer); | ||
| 152 | #endif /* SMTP_USE_DUMMYCMD */ | ||
| 153 | ! | ||
| 154 | /* tell the server we're done */ | ||
| 155 | send (sd, SMTP_QUIT, strlen (SMTP_QUIT), 0); | ||
| 156 | |||
| 157 | /* finally close the connection */ | ||
| 158 | ! close (sd); | ||
| 159 | } | ||
| 160 | |||
| 161 | /* reset the alarm */ | ||
| 162 | alarm (0); | ||
| 163 | |||
| 164 | --- 160,228 ---- | ||
| 165 | server_port); | ||
| 166 | result = STATE_WARNING; | ||
| 167 | } | ||
| 168 | } | ||
| 169 | |||
| 170 | + #ifdef HAVE_SSL | ||
| 171 | + if(use_ssl) { | ||
| 172 | + /* send the STARTTLS command */ | ||
| 173 | + send(sd, SMTP_STARTTLS, strlen(SMTP_STARTTLS), 0); | ||
| 174 | + | ||
| 175 | + recv(sd, buffer, MAX_INPUT_BUFFER-1, 0); // wait for it | ||
| 176 | + if(connect_STARTTLS() != OK) { | ||
| 177 | + printf ("ERROR: Cannot create SSL context.\n"); | ||
| 178 | + return STATE_CRITICAL; | ||
| 179 | + } | ||
| 180 | + if ( check_cert ) { | ||
| 181 | + if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) { | ||
| 182 | + result = check_certificate (&server_cert); | ||
| 183 | + X509_free(server_cert); | ||
| 184 | + } | ||
| 185 | + else { | ||
| 186 | + printf("ERROR: Cannot retrieve server certificate.\n"); | ||
| 187 | + result = STATE_CRITICAL; | ||
| 188 | + } | ||
| 189 | + my_close (); | ||
| 190 | + return result; | ||
| 191 | + } | ||
| 192 | + } | ||
| 193 | + #endif | ||
| 194 | + | ||
| 195 | /* send the HELO command */ | ||
| 196 | + #ifdef HAVE_SSL | ||
| 197 | + if (use_ssl) | ||
| 198 | + SSL_write(ssl, helocmd, strlen (helocmd)); | ||
| 199 | + else | ||
| 200 | + #endif | ||
| 201 | send(sd, helocmd, strlen(helocmd), 0); | ||
| 202 | |||
| 203 | /* allow for response to helo command to reach us */ | ||
| 204 | ! my_recv(); | ||
| 205 | ! #if defined(SMTP_USE_DUMMYCMD) && defined(HAVE_SSL) | ||
| 206 | ! if (use_ssl) | ||
| 207 | ! SSL_write(ssl,from_str, strlen(from_str)); | ||
| 208 | ! else | ||
| 209 | ! #endif | ||
| 210 | #ifdef SMTP_USE_DUMMYCMD | ||
| 211 | send(sd, from_str, strlen(from_str), 0); | ||
| 212 | |||
| 213 | /* allow for response to DUMMYCMD to reach us */ | ||
| 214 | ! my_recv(); | ||
| 215 | |||
| 216 | if (verbose == TRUE) | ||
| 217 | printf("DUMMYCMD: %s\n%s\n",from_str,buffer); | ||
| 218 | #endif /* SMTP_USE_DUMMYCMD */ | ||
| 219 | ! #ifdef HAVE_SSL | ||
| 220 | ! if (use_ssl) | ||
| 221 | ! SSL_write(ssl,SMTP_QUIT,strlen (SMTP_QUIT)); | ||
| 222 | ! else | ||
| 223 | ! #endif | ||
| 224 | /* tell the server we're done */ | ||
| 225 | send (sd, SMTP_QUIT, strlen (SMTP_QUIT), 0); | ||
| 226 | |||
| 227 | /* finally close the connection */ | ||
| 228 | ! my_close (); | ||
| 229 | } | ||
| 230 | |||
| 231 | /* reset the alarm */ | ||
| 232 | alarm (0); | ||
| 233 | |||
| 234 | *************** | ||
| 235 | *** 197,206 **** | ||
| 236 | --- 263,274 ---- | ||
| 237 | {"port", required_argument, 0, 'p'}, | ||
| 238 | {"from", required_argument, 0, 'f'}, | ||
| 239 | {"verbose", no_argument, 0, 'v'}, | ||
| 240 | {"version", no_argument, 0, 'V'}, | ||
| 241 | {"help", no_argument, 0, 'h'}, | ||
| 242 | + {"starttls",no_argument,0,'S'}, | ||
| 243 | + {"certificate",required_argument,0,'C'}, | ||
| 244 | {0, 0, 0, 0} | ||
| 245 | }; | ||
| 246 | #endif | ||
| 247 | |||
| 248 | if (argc < 2) | ||
| 249 | *************** | ||
| 250 | *** 216,229 **** | ||
| 251 | } | ||
| 252 | |||
| 253 | while (1) { | ||
| 254 | #ifdef HAVE_GETOPT_H | ||
| 255 | c = | ||
| 256 | ! getopt_long (argc, argv, "+hVvt:p:f:e:c:w:H:", long_options, | ||
| 257 | &option_index); | ||
| 258 | #else | ||
| 259 | ! c = getopt (argc, argv, "+?hVvt:p:f:e:c:w:H:"); | ||
| 260 | #endif | ||
| 261 | if (c == -1 || c == EOF) | ||
| 262 | break; | ||
| 263 | |||
| 264 | switch (c) { | ||
| 265 | --- 284,297 ---- | ||
| 266 | } | ||
| 267 | |||
| 268 | while (1) { | ||
| 269 | #ifdef HAVE_GETOPT_H | ||
| 270 | c = | ||
| 271 | ! getopt_long (argc, argv, "+hVvt:p:f:e:c:w:H:SC:", long_options, | ||
| 272 | &option_index); | ||
| 273 | #else | ||
| 274 | ! c = getopt (argc, argv, "+?hVvt:p:f:e:c:w:H:SC:"); | ||
| 275 | #endif | ||
| 276 | if (c == -1 || c == EOF) | ||
| 277 | break; | ||
| 278 | |||
| 279 | switch (c) { | ||
| 280 | *************** | ||
| 281 | *** 276,285 **** | ||
| 282 | --- 344,369 ---- | ||
| 283 | } | ||
| 284 | else { | ||
| 285 | usage ("Time interval must be a nonnegative integer\n"); | ||
| 286 | } | ||
| 287 | break; | ||
| 288 | + case 'S': | ||
| 289 | + /* starttls */ | ||
| 290 | + use_ssl = TRUE; | ||
| 291 | + break; | ||
| 292 | + case 'C': /* Check SSL cert validity */ | ||
| 293 | + #ifdef HAVE_SSL | ||
| 294 | + if (!is_intnonneg (optarg)) | ||
| 295 | + usage2 ("invalid certificate expiration period", optarg); | ||
| 296 | + days_till_exp = atoi (optarg); | ||
| 297 | + check_cert = TRUE; | ||
| 298 | + use_ssl = TRUE; | ||
| 299 | + #else | ||
| 300 | + terminate (STATE_UNKNOWN, | ||
| 301 | + "SSL support not available. Install OpenSSL and recompile."); | ||
| 302 | + #endif | ||
| 303 | + break; | ||
| 304 | case 'V': /* version */ | ||
| 305 | print_revision (progname, "$Revision: 1.9.2.2 $"); | ||
| 306 | exit (STATE_OK); | ||
| 307 | case 'h': /* help */ | ||
| 308 | print_help (); | ||
| 309 | *************** | ||
| 310 | *** 344,353 **** | ||
| 311 | --- 428,443 ---- | ||
| 312 | " Seconds necessary to result in a warning status\n" | ||
| 313 | " -c, --critical=INTEGER\n" | ||
| 314 | " Seconds necessary to result in a critical status\n" | ||
| 315 | " -t, --timeout=INTEGER\n" | ||
| 316 | " Seconds before connection attempt times out (default: %d)\n" | ||
| 317 | + #ifdef HAVE_SSL | ||
| 318 | + " -S, --starttls\n" | ||
| 319 | + " Use starttls for connection\n" | ||
| 320 | + " -C, --certificate\n" | ||
| 321 | + " Check certificate\n" | ||
| 322 | + #endif | ||
| 323 | " -v, --verbose\n" | ||
| 324 | " Print extra information (command-line use only)\n" | ||
| 325 | " -h, --help\n" | ||
| 326 | " Print detailed help screen\n" | ||
| 327 | " -V, --version\n" | ||
| 328 | *************** | ||
| 329 | *** 365,370 **** | ||
| 330 | --- 455,615 ---- | ||
| 331 | { | ||
| 332 | printf | ||
| 333 | ("Usage: %s -H host [-e expect] [-p port] [-f from addr] [-w warn] [-c crit] [-t timeout] [-v]\n" | ||
| 334 | " %s --help\n" | ||
| 335 | " %s --version\n", progname, progname, progname); | ||
| 336 | + } | ||
| 337 | + | ||
| 338 | + #ifdef HAVE_SSL | ||
| 339 | + int | ||
| 340 | + connect_STARTTLS (void) | ||
| 341 | + { | ||
| 342 | + SSL_METHOD *meth; | ||
| 343 | + | ||
| 344 | + /* Initialize SSL context */ | ||
| 345 | + SSLeay_add_ssl_algorithms (); | ||
| 346 | + meth = SSLv2_client_method (); | ||
| 347 | + SSL_load_error_strings (); | ||
| 348 | + if ((ctx = SSL_CTX_new (meth)) == NULL) | ||
| 349 | + { | ||
| 350 | + printf ("ERROR: Cannot create SSL context.\n"); | ||
| 351 | + return STATE_CRITICAL; | ||
| 352 | + } | ||
| 353 | + /* Do the SSL handshake */ | ||
| 354 | + if ((ssl = SSL_new (ctx)) != NULL) | ||
| 355 | + { | ||
| 356 | + SSL_set_fd (ssl, sd); | ||
| 357 | + /* original version checked for -1 | ||
| 358 | + I look for success instead (1) */ | ||
| 359 | + if (SSL_connect (ssl) == 1) | ||
| 360 | + return OK; | ||
| 361 | + ERR_print_errors_fp (stderr); | ||
| 362 | + } | ||
| 363 | + else | ||
| 364 | + { | ||
| 365 | + printf ("ERROR: Cannot initiate SSL handshake.\n"); | ||
| 366 | + } | ||
| 367 | + /* this causes a seg fault | ||
| 368 | + not sure why, being sloppy | ||
| 369 | + and commenting it out */ | ||
| 370 | + // SSL_free (ssl); | ||
| 371 | + | ||
| 372 | + | ||
| 373 | + SSL_CTX_free (ctx); | ||
| 374 | + my_close (); | ||
| 375 | + | ||
| 376 | + return STATE_CRITICAL; | ||
| 377 | + } | ||
| 378 | + #endif | ||
| 379 | + | ||
| 380 | + #ifdef HAVE_SSL | ||
| 381 | + int | ||
| 382 | + check_certificate (X509 ** certificate) | ||
| 383 | + { | ||
| 384 | + ASN1_STRING *tm; | ||
| 385 | + int offset; | ||
| 386 | + struct tm stamp; | ||
| 387 | + int days_left; | ||
| 388 | + | ||
| 389 | + | ||
| 390 | + /* Retrieve timestamp of certificate */ | ||
| 391 | + tm = X509_get_notAfter (*certificate); | ||
| 392 | + | ||
| 393 | + /* Generate tm structure to process timestamp */ | ||
| 394 | + if (tm->type == V_ASN1_UTCTIME) { | ||
| 395 | + if (tm->length < 10) { | ||
| 396 | + printf ("ERROR: Wrong time format in certificate.\n"); | ||
| 397 | + return STATE_CRITICAL; | ||
| 398 | + } | ||
| 399 | + else { | ||
| 400 | + stamp.tm_year = (tm->data[0] - '0') * 10 + (tm->data[1] - '0'); | ||
| 401 | + if (stamp.tm_year < 50) | ||
| 402 | + stamp.tm_year += 100; | ||
| 403 | + offset = 0; | ||
| 404 | + } | ||
| 405 | + } | ||
| 406 | + else { | ||
| 407 | + if (tm->length < 12) { | ||
| 408 | + printf ("ERROR: Wrong time format in certificate.\n"); | ||
| 409 | + return STATE_CRITICAL; | ||
| 410 | + } | ||
| 411 | + else { | ||
| 412 | + stamp.tm_year = | ||
| 413 | + (tm->data[0] - '0') * 1000 + (tm->data[1] - '0') * 100 + | ||
| 414 | + (tm->data[2] - '0') * 10 + (tm->data[3] - '0'); | ||
| 415 | + stamp.tm_year -= 1900; | ||
| 416 | + offset = 2; | ||
| 417 | + } | ||
| 418 | + } | ||
| 419 | + stamp.tm_mon = | ||
| 420 | + (tm->data[2 + offset] - '0') * 10 + (tm->data[3 + offset] - '0') - 1; | ||
| 421 | + stamp.tm_mday = | ||
| 422 | + (tm->data[4 + offset] - '0') * 10 + (tm->data[5 + offset] - '0'); | ||
| 423 | + stamp.tm_hour = | ||
| 424 | + (tm->data[6 + offset] - '0') * 10 + (tm->data[7 + offset] - '0'); | ||
| 425 | + stamp.tm_min = | ||
| 426 | + (tm->data[8 + offset] - '0') * 10 + (tm->data[9 + offset] - '0'); | ||
| 427 | + stamp.tm_sec = 0; | ||
| 428 | + stamp.tm_isdst = -1; | ||
| 429 | + | ||
| 430 | + days_left = (mktime (&stamp) - time (NULL)) / 86400; | ||
| 431 | + snprintf | ||
| 432 | + (timestamp, 16, "%02d/%02d/%04d %02d:%02d", | ||
| 433 | + stamp.tm_mon + 1, | ||
| 434 | + stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min); | ||
| 435 | + | ||
| 436 | + if (days_left > 0 && days_left <= days_till_exp) { | ||
| 437 | + printf ("Certificate expires in %d day(s) (%s).\n", days_left, timestamp); | ||
| 438 | + return STATE_WARNING; | ||
| 439 | + } | ||
| 440 | + if (days_left < 0) { | ||
| 441 | + printf ("Certificate expired on %s.\n", timestamp); | ||
| 442 | + return STATE_CRITICAL; | ||
| 443 | + } | ||
| 444 | + | ||
| 445 | + if (days_left == 0) { | ||
| 446 | + printf ("Certificate expires today (%s).\n", timestamp); | ||
| 447 | + return STATE_WARNING; | ||
| 448 | + } | ||
| 449 | + | ||
| 450 | + printf ("Certificate will expire on %s.\n", timestamp); | ||
| 451 | + | ||
| 452 | + return STATE_OK; | ||
| 453 | + } | ||
| 454 | + #endif | ||
| 455 | + | ||
| 456 | + int | ||
| 457 | + my_recv (void) | ||
| 458 | + { | ||
| 459 | + int i; | ||
| 460 | + | ||
| 461 | + #ifdef HAVE_SSL | ||
| 462 | + if (use_ssl) { | ||
| 463 | + i = SSL_read (ssl, buffer, MAXBUF - 1); | ||
| 464 | + } | ||
| 465 | + else { | ||
| 466 | + #endif | ||
| 467 | + i = read (sd, buffer, MAXBUF - 1); | ||
| 468 | + #ifdef HAVE_SSL | ||
| 469 | + } | ||
| 470 | + #endif | ||
| 471 | + | ||
| 472 | + return i; | ||
| 473 | + } | ||
| 474 | + | ||
| 475 | + int | ||
| 476 | + my_close (void) | ||
| 477 | + { | ||
| 478 | + #ifdef HAVE_SSL | ||
| 479 | + if (use_ssl == TRUE) { | ||
| 480 | + SSL_shutdown (ssl); | ||
| 481 | + SSL_free (ssl); | ||
| 482 | + SSL_CTX_free (ctx); | ||
| 483 | + return 0; | ||
| 484 | + } | ||
| 485 | + else { | ||
| 486 | + #endif | ||
| 487 | + return close (sd); | ||
| 488 | + #ifdef HAVE_SSL | ||
| 489 | + } | ||
| 490 | + #endif | ||
| 491 | } | ||
diff --git a/web/attachments/105911-check_tcp.c.patch b/web/attachments/105911-check_tcp.c.patch new file mode 100644 index 0000000..d080c65 --- /dev/null +++ b/web/attachments/105911-check_tcp.c.patch | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | --- check_tcp.c.orig Thu Sep 16 13:03:28 2004 | ||
| 2 | +++ check_tcp.c Wed Oct 20 12:52:06 2004 | ||
| 3 | @@ -553,8 +553,9 @@ | ||
| 4 | |||
| 5 | /* Initialize SSL context */ | ||
| 6 | SSLeay_add_ssl_algorithms (); | ||
| 7 | - meth = SSLv2_client_method (); | ||
| 8 | + meth = SSLv23_client_method (); | ||
| 9 | SSL_load_error_strings (); | ||
| 10 | + OpenSSL_add_all_algorithms(); | ||
| 11 | if ((ctx = SSL_CTX_new (meth)) == NULL) | ||
| 12 | { | ||
| 13 | printf ("ERROR: Cannot create SSL context.\n"); | ||
| 14 | @@ -577,7 +578,7 @@ | ||
| 15 | if ((ssl = SSL_new (ctx)) != NULL) | ||
| 16 | { | ||
| 17 | SSL_set_fd (ssl, sd); | ||
| 18 | - if (SSL_connect (ssl) != -1) | ||
| 19 | + if (SSL_connect(ssl) == 1) | ||
| 20 | return OK; | ||
| 21 | ERR_print_errors_fp (stderr); | ||
| 22 | } | ||
diff --git a/web/attachments/106626-check_nwstat.c.patch b/web/attachments/106626-check_nwstat.c.patch new file mode 100644 index 0000000..28ac31d --- /dev/null +++ b/web/attachments/106626-check_nwstat.c.patch | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | --- check_nwstat.c.orig Tue Oct 26 15:38:55 2004 | ||
| 2 | +++ check_nwstat.c Tue Oct 26 15:40:36 2004 | ||
| 3 | @@ -178,13 +178,13 @@ | ||
| 4 | if(result!=STATE_OK) | ||
| 5 | return result; | ||
| 6 | if(!strcmp(recv_buffer,"-1\n")) | ||
| 7 | - asprintf(&netware_version,""); | ||
| 8 | + netware_version = strdup(""); | ||
| 9 | else { | ||
| 10 | recv_buffer[strlen(recv_buffer)-1]=0; | ||
| 11 | asprintf(&netware_version,"NetWare %s: ",recv_buffer); | ||
| 12 | } | ||
| 13 | } else | ||
| 14 | - asprintf(&netware_version,""); | ||
| 15 | + netware_version = strdup(""); | ||
| 16 | |||
| 17 | |||
| 18 | |||
diff --git a/web/attachments/106646-check_nwstat.c.patch b/web/attachments/106646-check_nwstat.c.patch new file mode 100644 index 0000000..28ac31d --- /dev/null +++ b/web/attachments/106646-check_nwstat.c.patch | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | --- check_nwstat.c.orig Tue Oct 26 15:38:55 2004 | ||
| 2 | +++ check_nwstat.c Tue Oct 26 15:40:36 2004 | ||
| 3 | @@ -178,13 +178,13 @@ | ||
| 4 | if(result!=STATE_OK) | ||
| 5 | return result; | ||
| 6 | if(!strcmp(recv_buffer,"-1\n")) | ||
| 7 | - asprintf(&netware_version,""); | ||
| 8 | + netware_version = strdup(""); | ||
| 9 | else { | ||
| 10 | recv_buffer[strlen(recv_buffer)-1]=0; | ||
| 11 | asprintf(&netware_version,"NetWare %s: ",recv_buffer); | ||
| 12 | } | ||
| 13 | } else | ||
| 14 | - asprintf(&netware_version,""); | ||
| 15 | + netware_version = strdup(""); | ||
| 16 | |||
| 17 | |||
| 18 | |||
diff --git a/web/attachments/106647-check_tcp.c.patch b/web/attachments/106647-check_tcp.c.patch new file mode 100644 index 0000000..d080c65 --- /dev/null +++ b/web/attachments/106647-check_tcp.c.patch | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | --- check_tcp.c.orig Thu Sep 16 13:03:28 2004 | ||
| 2 | +++ check_tcp.c Wed Oct 20 12:52:06 2004 | ||
| 3 | @@ -553,8 +553,9 @@ | ||
| 4 | |||
| 5 | /* Initialize SSL context */ | ||
| 6 | SSLeay_add_ssl_algorithms (); | ||
| 7 | - meth = SSLv2_client_method (); | ||
| 8 | + meth = SSLv23_client_method (); | ||
| 9 | SSL_load_error_strings (); | ||
| 10 | + OpenSSL_add_all_algorithms(); | ||
| 11 | if ((ctx = SSL_CTX_new (meth)) == NULL) | ||
| 12 | { | ||
| 13 | printf ("ERROR: Cannot create SSL context.\n"); | ||
| 14 | @@ -577,7 +578,7 @@ | ||
| 15 | if ((ssl = SSL_new (ctx)) != NULL) | ||
| 16 | { | ||
| 17 | SSL_set_fd (ssl, sd); | ||
| 18 | - if (SSL_connect (ssl) != -1) | ||
| 19 | + if (SSL_connect(ssl) == 1) | ||
| 20 | return OK; | ||
| 21 | ERR_print_errors_fp (stderr); | ||
| 22 | } | ||
diff --git a/web/attachments/109117-check_dns.c.patch b/web/attachments/109117-check_dns.c.patch new file mode 100644 index 0000000..9546cd6 --- /dev/null +++ b/web/attachments/109117-check_dns.c.patch | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | --- check_dns.c.old 2004-11-17 13:18:35.000000000 -0700 | ||
| 2 | +++ check_dns.c 2004-11-17 12:53:21.000000000 -0700 | ||
| 3 | @@ -38,6 +38,7 @@ | ||
| 4 | #define ADDRESS_LENGTH 256 | ||
| 5 | char query_address[ADDRESS_LENGTH] = ""; | ||
| 6 | char dns_server[ADDRESS_LENGTH] = ""; | ||
| 7 | +int dns_server_port = 53; | ||
| 8 | char ptr_server[ADDRESS_LENGTH] = ""; | ||
| 9 | int verbose = FALSE; | ||
| 10 | char expected_address[ADDRESS_LENGTH] = ""; | ||
| 11 | @@ -76,7 +77,7 @@ | ||
| 12 | } | ||
| 13 | |||
| 14 | /* get the command to run */ | ||
| 15 | - asprintf (&command_line, "%s %s %s", NSLOOKUP_COMMAND, query_address, dns_server); | ||
| 16 | + asprintf (&command_line, "%s %s %s -port=%d", NSLOOKUP_COMMAND, query_address, dns_server, dns_server_port); | ||
| 17 | |||
| 18 | alarm (timeout_interval); | ||
| 19 | gettimeofday (&tv, NULL); | ||
| 20 | @@ -275,6 +276,7 @@ | ||
| 21 | {"timeout", required_argument, 0, 't'}, | ||
| 22 | {"hostname", required_argument, 0, 'H'}, | ||
| 23 | {"server", required_argument, 0, 's'}, | ||
| 24 | + {"port", required_argument, 0, 'p'}, | ||
| 25 | {"reverse-server", required_argument, 0, 'r'}, | ||
| 26 | {"expected-address", required_argument, 0, 'a'}, | ||
| 27 | {"expect-authority", no_argument, 0, 'A'}, | ||
| 28 | @@ -289,7 +291,7 @@ | ||
| 29 | strcpy (argv[c], "-t"); | ||
| 30 | |||
| 31 | while (1) { | ||
| 32 | - c = getopt_long (argc, argv, "hVvAt:H:s:r:a:", long_opts, &opt_index); | ||
| 33 | + c = getopt_long (argc, argv, "hVvAt:H:p:s:r:a:", long_opts, &opt_index); | ||
| 34 | |||
| 35 | if (c == -1 || c == EOF) | ||
| 36 | break; | ||
| 37 | @@ -316,6 +318,9 @@ | ||
| 38 | die (STATE_UNKNOWN, _("Input buffer overflow\n")); | ||
| 39 | strcpy (query_address, optarg); | ||
| 40 | break; | ||
| 41 | + case 'p': /* hostname */ | ||
| 42 | + dns_server_port = atoi(optarg); | ||
| 43 | + break; | ||
| 44 | case 's': /* server name */ | ||
| 45 | /* TODO: this is_host check is probably unnecessary. */ | ||
| 46 | /* Better to confirm nslookup response matches */ | ||
| 47 | @@ -403,6 +408,8 @@ | ||
| 48 | The name or address you want to query\n\ | ||
| 49 | -s, --server=HOST\n\ | ||
| 50 | Optional DNS server you want to use for the lookup\n\ | ||
| 51 | +-p, --port=HOST\n\ | ||
| 52 | + Optional DNS server port, defaults to 53\n\ | ||
| 53 | -a, --expected-address=IP-ADDRESS\n\ | ||
| 54 | Optional IP address you expect the DNS server to return\n\ | ||
| 55 | -A, --expect-authority\n\ | ||
| 56 | @@ -426,7 +433,7 @@ | ||
| 57 | print_usage (void) | ||
| 58 | { | ||
| 59 | printf (_("\ | ||
| 60 | -Usage: %s -H host [-s server] [-a expected-address] [-A] [-t timeout]\n\ | ||
| 61 | +Usage: %s -H host [-s server] [-p port] [-a expected-address] [-A] [-t timeout]\n\ | ||
| 62 | %s --help\n\ | ||
| 63 | %s --version\n"), progname, progname, progname); | ||
| 64 | } | ||
diff --git a/web/attachments/110840-check_snmp_disk_monitor.pl.patch b/web/attachments/110840-check_snmp_disk_monitor.pl.patch new file mode 100644 index 0000000..b617909 --- /dev/null +++ b/web/attachments/110840-check_snmp_disk_monitor.pl.patch | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | --- check_snmp_disk_monitor.pl.orig 2004-12-01 16:20:14.502241047 +0300 | ||
| 2 | +++ check_snmp_disk_monitor.pl 2004-12-01 16:20:34.524424531 +0300 | ||
| 3 | @@ -37,8 +37,8 @@ | ||
| 4 | 'H:s' => \$opt_host, 'hostname:s' => \$opt_host, | ||
| 5 | 'p:i' => \$opt_port, 'port:i' => \$opt_port, | ||
| 6 | 'C:s' => \$opt_community, 'community:s' => \$opt_community, | ||
| 7 | - 'c:i' => \$opt_crit, 'critical:i' => \$opt_crit, | ||
| 8 | - 'w:i' => \$opt_warn, 'warning:i' => \$opt_warn, | ||
| 9 | + 'c:i' => \$opt_critical, 'critical:i' => \$opt_critical, | ||
| 10 | + 'w:i' => \$opt_warning, 'warning:i' => \$opt_warning, | ||
| 11 | 't:i' => \$TIMEOUT, 'timeout:i' => \$TIMEOUT, | ||
| 12 | 'm:s' => \$opt_mountpoint, 'mountpoint:s'=> \$opt_mountpoint | ||
| 13 | ); | ||
diff --git a/web/attachments/111261-nagiosplug-prototypes_-Wall-cleanup.diff b/web/attachments/111261-nagiosplug-prototypes_-Wall-cleanup.diff new file mode 100644 index 0000000..43b3e43 --- /dev/null +++ b/web/attachments/111261-nagiosplug-prototypes_-Wall-cleanup.diff | |||
| @@ -0,0 +1,1311 @@ | |||
| 1 | diff -urN ../nagiosplug.orig/plugins/Makefile.in plugins/Makefile.in | ||
| 2 | --- ../nagiosplug.orig/plugins/Makefile.in 1970-01-01 01:00:00.000000000 +0100 | ||
| 3 | +++ plugins/Makefile.in 2004-12-04 16:20:36.000000000 +0100 | ||
| 4 | @@ -0,0 +1,945 @@ | ||
| 5 | +# Makefile.in generated by automake 1.9.3 from Makefile.am. | ||
| 6 | +# @configure_input@ | ||
| 7 | + | ||
| 8 | +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, | ||
| 9 | +# 2003, 2004 Free Software Foundation, Inc. | ||
| 10 | +# This Makefile.in is free software; the Free Software Foundation | ||
| 11 | +# gives unlimited permission to copy and/or distribute it, | ||
| 12 | +# with or without modifications, as long as this notice is preserved. | ||
| 13 | + | ||
| 14 | +# This program is distributed in the hope that it will be useful, | ||
| 15 | +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without | ||
| 16 | +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
| 17 | +# PARTICULAR PURPOSE. | ||
| 18 | + | ||
| 19 | +@SET_MAKE@ | ||
| 20 | + | ||
| 21 | +SOURCES = check_by_ssh.c check_dig.c check_disk.c check_dns.c check_dummy.c check_fping.c check_game.c check_hpjd.c check_http.c check_icmp.c check_ide-smart.c check_ldap.c check_load.c check_mrtg.c check_mrtgtraf.c check_mysql.c check_nagios.c check_nt.c check_nwstat.c check_overcr.c check_pgsql.c check_ping.c check_procs.c check_radius.c check_real.c check_smtp.c check_snmp.c check_ssh.c check_swap.c check_tcp.c check_time.c check_udp.c check_ups.c check_users.c negate.c urlize.c | ||
| 22 | + | ||
| 23 | +srcdir = @srcdir@ | ||
| 24 | +top_srcdir = @top_srcdir@ | ||
| 25 | +pkgdatadir = $(datadir)/@PACKAGE@ | ||
| 26 | +pkglibdir = $(libdir)/@PACKAGE@ | ||
| 27 | +pkgincludedir = $(includedir)/@PACKAGE@ | ||
| 28 | +top_builddir = .. | ||
| 29 | +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd | ||
| 30 | +install_sh_DATA = $(install_sh) -c -m 644 | ||
| 31 | +install_sh_PROGRAM = $(install_sh) -c | ||
| 32 | +install_sh_SCRIPT = $(install_sh) -c | ||
| 33 | +INSTALL_HEADER = $(INSTALL_DATA) | ||
| 34 | +transform = $(program_transform_name) | ||
| 35 | +NORMAL_INSTALL = : | ||
| 36 | +PRE_INSTALL = : | ||
| 37 | +POST_INSTALL = : | ||
| 38 | +NORMAL_UNINSTALL = : | ||
| 39 | +PRE_UNINSTALL = : | ||
| 40 | +POST_UNINSTALL = : | ||
| 41 | +build_triplet = @build@ | ||
| 42 | +host_triplet = @host@ | ||
| 43 | +libexec_PROGRAMS = check_disk$(EXEEXT) check_dummy$(EXEEXT) \ | ||
| 44 | + check_http$(EXEEXT) check_load$(EXEEXT) check_mrtg$(EXEEXT) \ | ||
| 45 | + check_mrtgtraf$(EXEEXT) check_nwstat$(EXEEXT) \ | ||
| 46 | + check_overcr$(EXEEXT) check_ping$(EXEEXT) check_real$(EXEEXT) \ | ||
| 47 | + check_smtp$(EXEEXT) check_ssh$(EXEEXT) check_tcp$(EXEEXT) \ | ||
| 48 | + check_time$(EXEEXT) check_udp$(EXEEXT) check_ups$(EXEEXT) \ | ||
| 49 | + check_users$(EXEEXT) negate$(EXEEXT) urlize$(EXEEXT) \ | ||
| 50 | + check_icmp$(EXEEXT) @EXTRAS@ | ||
| 51 | +EXTRA_PROGRAMS = check_mysql$(EXEEXT) check_radius$(EXEEXT) \ | ||
| 52 | + check_pgsql$(EXEEXT) check_snmp$(EXEEXT) check_hpjd$(EXEEXT) \ | ||
| 53 | + check_swap$(EXEEXT) check_fping$(EXEEXT) check_ldap$(EXEEXT) \ | ||
| 54 | + check_game$(EXEEXT) check_dig$(EXEEXT) check_nagios$(EXEEXT) \ | ||
| 55 | + check_by_ssh$(EXEEXT) check_dns$(EXEEXT) check_nt$(EXEEXT) \ | ||
| 56 | + check_ide-smart$(EXEEXT) check_procs$(EXEEXT) | ||
| 57 | +subdir = plugins | ||
| 58 | +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in | ||
| 59 | +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | ||
| 60 | +am__aclocal_m4_deps = $(top_srcdir)/lib/codeset.m4 \ | ||
| 61 | + $(top_srcdir)/lib/error.m4 $(top_srcdir)/lib/fstypename.m4 \ | ||
| 62 | + $(top_srcdir)/lib/fsusage.m4 $(top_srcdir)/lib/gettext.m4 \ | ||
| 63 | + $(top_srcdir)/lib/glibc21.m4 $(top_srcdir)/lib/iconv.m4 \ | ||
| 64 | + $(top_srcdir)/lib/intdiv0.m4 $(top_srcdir)/lib/inttypes-pri.m4 \ | ||
| 65 | + $(top_srcdir)/lib/inttypes.m4 $(top_srcdir)/lib/inttypes_h.m4 \ | ||
| 66 | + $(top_srcdir)/lib/lcmessage.m4 $(top_srcdir)/lib/lib-ld.m4 \ | ||
| 67 | + $(top_srcdir)/lib/lib-link.m4 $(top_srcdir)/lib/lib-prefix.m4 \ | ||
| 68 | + $(top_srcdir)/lib/ls-mntd-fs.m4 $(top_srcdir)/lib/onceonly.m4 \ | ||
| 69 | + $(top_srcdir)/lib/progtest.m4 $(top_srcdir)/lib/stdint_h.m4 \ | ||
| 70 | + $(top_srcdir)/lib/uintmax_t.m4 $(top_srcdir)/lib/ulonglong.m4 \ | ||
| 71 | + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in | ||
| 72 | +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ | ||
| 73 | + $(ACLOCAL_M4) | ||
| 74 | +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs | ||
| 75 | +CONFIG_HEADER = $(top_builddir)/config.h | ||
| 76 | +CONFIG_CLEAN_FILES = | ||
| 77 | +am__installdirs = "$(DESTDIR)$(libexecdir)" | ||
| 78 | +libexecPROGRAMS_INSTALL = $(INSTALL_PROGRAM) | ||
| 79 | +PROGRAMS = $(libexec_PROGRAMS) | ||
| 80 | +check_by_ssh_SOURCES = check_by_ssh.c | ||
| 81 | +check_by_ssh_OBJECTS = check_by_ssh.$(OBJEXT) | ||
| 82 | +am__DEPENDENCIES_1 = utils.o ../lib/libnagiosplug.a | ||
| 83 | +am__DEPENDENCIES_2 = | ||
| 84 | +am__DEPENDENCIES_3 = netutils.o $(am__DEPENDENCIES_1) \ | ||
| 85 | + $(am__DEPENDENCIES_2) | ||
| 86 | +am__DEPENDENCIES_4 = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) | ||
| 87 | +check_dig_SOURCES = check_dig.c | ||
| 88 | +check_dig_OBJECTS = check_dig.$(OBJEXT) | ||
| 89 | +check_disk_SOURCES = check_disk.c | ||
| 90 | +check_disk_OBJECTS = check_disk.$(OBJEXT) | ||
| 91 | +check_dns_SOURCES = check_dns.c | ||
| 92 | +check_dns_OBJECTS = check_dns.$(OBJEXT) | ||
| 93 | +check_dummy_SOURCES = check_dummy.c | ||
| 94 | +check_dummy_OBJECTS = check_dummy.$(OBJEXT) | ||
| 95 | +check_fping_SOURCES = check_fping.c | ||
| 96 | +check_fping_OBJECTS = check_fping.$(OBJEXT) | ||
| 97 | +check_game_SOURCES = check_game.c | ||
| 98 | +check_game_OBJECTS = check_game.$(OBJEXT) | ||
| 99 | +check_hpjd_SOURCES = check_hpjd.c | ||
| 100 | +check_hpjd_OBJECTS = check_hpjd.$(OBJEXT) | ||
| 101 | +check_http_SOURCES = check_http.c | ||
| 102 | +check_http_OBJECTS = check_http.$(OBJEXT) | ||
| 103 | +check_icmp_SOURCES = check_icmp.c | ||
| 104 | +check_icmp_OBJECTS = check_icmp.$(OBJEXT) | ||
| 105 | +check_icmp_LDADD = $(LDADD) | ||
| 106 | +check_ide_smart_SOURCES = check_ide-smart.c | ||
| 107 | +check_ide_smart_OBJECTS = check_ide-smart.$(OBJEXT) | ||
| 108 | +check_ide_smart_LDADD = $(LDADD) | ||
| 109 | +check_ldap_SOURCES = check_ldap.c | ||
| 110 | +check_ldap_OBJECTS = check_ldap.$(OBJEXT) | ||
| 111 | +check_load_SOURCES = check_load.c | ||
| 112 | +check_load_OBJECTS = check_load.$(OBJEXT) | ||
| 113 | +check_mrtg_SOURCES = check_mrtg.c | ||
| 114 | +check_mrtg_OBJECTS = check_mrtg.$(OBJEXT) | ||
| 115 | +check_mrtgtraf_SOURCES = check_mrtgtraf.c | ||
| 116 | +check_mrtgtraf_OBJECTS = check_mrtgtraf.$(OBJEXT) | ||
| 117 | +check_mysql_SOURCES = check_mysql.c | ||
| 118 | +check_mysql_OBJECTS = check_mysql.$(OBJEXT) | ||
| 119 | +check_nagios_SOURCES = check_nagios.c | ||
| 120 | +check_nagios_OBJECTS = check_nagios.$(OBJEXT) | ||
| 121 | +check_nt_SOURCES = check_nt.c | ||
| 122 | +check_nt_OBJECTS = check_nt.$(OBJEXT) | ||
| 123 | +check_nwstat_SOURCES = check_nwstat.c | ||
| 124 | +check_nwstat_OBJECTS = check_nwstat.$(OBJEXT) | ||
| 125 | +check_overcr_SOURCES = check_overcr.c | ||
| 126 | +check_overcr_OBJECTS = check_overcr.$(OBJEXT) | ||
| 127 | +check_pgsql_SOURCES = check_pgsql.c | ||
| 128 | +check_pgsql_OBJECTS = check_pgsql.$(OBJEXT) | ||
| 129 | +check_ping_SOURCES = check_ping.c | ||
| 130 | +check_ping_OBJECTS = check_ping.$(OBJEXT) | ||
| 131 | +check_procs_SOURCES = check_procs.c | ||
| 132 | +check_procs_OBJECTS = check_procs.$(OBJEXT) | ||
| 133 | +check_radius_SOURCES = check_radius.c | ||
| 134 | +check_radius_OBJECTS = check_radius.$(OBJEXT) | ||
| 135 | +check_real_SOURCES = check_real.c | ||
| 136 | +check_real_OBJECTS = check_real.$(OBJEXT) | ||
| 137 | +check_smtp_SOURCES = check_smtp.c | ||
| 138 | +check_smtp_OBJECTS = check_smtp.$(OBJEXT) | ||
| 139 | +check_snmp_SOURCES = check_snmp.c | ||
| 140 | +check_snmp_OBJECTS = check_snmp.$(OBJEXT) | ||
| 141 | +check_ssh_SOURCES = check_ssh.c | ||
| 142 | +check_ssh_OBJECTS = check_ssh.$(OBJEXT) | ||
| 143 | +check_swap_SOURCES = check_swap.c | ||
| 144 | +check_swap_OBJECTS = check_swap.$(OBJEXT) | ||
| 145 | +check_tcp_SOURCES = check_tcp.c | ||
| 146 | +check_tcp_OBJECTS = check_tcp.$(OBJEXT) | ||
| 147 | +check_time_SOURCES = check_time.c | ||
| 148 | +check_time_OBJECTS = check_time.$(OBJEXT) | ||
| 149 | +check_udp_SOURCES = check_udp.c | ||
| 150 | +check_udp_OBJECTS = check_udp.$(OBJEXT) | ||
| 151 | +check_ups_SOURCES = check_ups.c | ||
| 152 | +check_ups_OBJECTS = check_ups.$(OBJEXT) | ||
| 153 | +check_users_SOURCES = check_users.c | ||
| 154 | +check_users_OBJECTS = check_users.$(OBJEXT) | ||
| 155 | +negate_SOURCES = negate.c | ||
| 156 | +negate_OBJECTS = negate.$(OBJEXT) | ||
| 157 | +urlize_SOURCES = urlize.c | ||
| 158 | +urlize_OBJECTS = urlize.$(OBJEXT) | ||
| 159 | +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) | ||
| 160 | +depcomp = $(SHELL) $(top_srcdir)/depcomp | ||
| 161 | +am__depfiles_maybe = depfiles | ||
| 162 | +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ | ||
| 163 | + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) | ||
| 164 | +CCLD = $(CC) | ||
| 165 | +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ | ||
| 166 | +SOURCES = check_by_ssh.c check_dig.c check_disk.c check_dns.c \ | ||
| 167 | + check_dummy.c check_fping.c check_game.c check_hpjd.c \ | ||
| 168 | + check_http.c check_icmp.c check_ide-smart.c check_ldap.c \ | ||
| 169 | + check_load.c check_mrtg.c check_mrtgtraf.c check_mysql.c \ | ||
| 170 | + check_nagios.c check_nt.c check_nwstat.c check_overcr.c \ | ||
| 171 | + check_pgsql.c check_ping.c check_procs.c check_radius.c \ | ||
| 172 | + check_real.c check_smtp.c check_snmp.c check_ssh.c \ | ||
| 173 | + check_swap.c check_tcp.c check_time.c check_udp.c check_ups.c \ | ||
| 174 | + check_users.c negate.c urlize.c | ||
| 175 | +DIST_SOURCES = check_by_ssh.c check_dig.c check_disk.c check_dns.c \ | ||
| 176 | + check_dummy.c check_fping.c check_game.c check_hpjd.c \ | ||
| 177 | + check_http.c check_icmp.c check_ide-smart.c check_ldap.c \ | ||
| 178 | + check_load.c check_mrtg.c check_mrtgtraf.c check_mysql.c \ | ||
| 179 | + check_nagios.c check_nt.c check_nwstat.c check_overcr.c \ | ||
| 180 | + check_pgsql.c check_ping.c check_procs.c check_radius.c \ | ||
| 181 | + check_real.c check_smtp.c check_snmp.c check_ssh.c \ | ||
| 182 | + check_swap.c check_tcp.c check_time.c check_udp.c check_ups.c \ | ||
| 183 | + check_users.c negate.c urlize.c | ||
| 184 | +ETAGS = etags | ||
| 185 | +CTAGS = ctags | ||
| 186 | +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) | ||
| 187 | +VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plugins/t | ||
| 188 | +INSTALL = @INSTALL@ | ||
| 189 | +ACLOCAL = @ACLOCAL@ | ||
| 190 | +ALLOCA = @ALLOCA@ | ||
| 191 | +AMDEP_FALSE = @AMDEP_FALSE@ | ||
| 192 | +AMDEP_TRUE = @AMDEP_TRUE@ | ||
| 193 | +AMTAR = @AMTAR@ | ||
| 194 | +AUTOCONF = @AUTOCONF@ | ||
| 195 | +AUTOHEADER = @AUTOHEADER@ | ||
| 196 | +AUTOMAKE = @AUTOMAKE@ | ||
| 197 | +AWK = @AWK@ | ||
| 198 | +BASENAME = @BASENAME@ | ||
| 199 | +BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ | ||
| 200 | +CATOBJEXT = @CATOBJEXT@ | ||
| 201 | +CC = @CC@ | ||
| 202 | +CCDEPMODE = @CCDEPMODE@ | ||
| 203 | +CFLAGS = @CFLAGS@ | ||
| 204 | +CPP = @CPP@ | ||
| 205 | +CPPFLAGS = @CPPFLAGS@ | ||
| 206 | +CYGPATH_W = @CYGPATH_W@ | ||
| 207 | +DATADIRNAME = @DATADIRNAME@ | ||
| 208 | +DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ | ||
| 209 | +DEPDIR = @DEPDIR@ | ||
| 210 | +DEPLIBS = @DEPLIBS@ | ||
| 211 | +ECHO_C = @ECHO_C@ | ||
| 212 | +ECHO_N = @ECHO_N@ | ||
| 213 | +ECHO_T = @ECHO_T@ | ||
| 214 | +EGREP = @EGREP@ | ||
| 215 | +EXEEXT = @EXEEXT@ | ||
| 216 | +EXTRAS = @EXTRAS@ | ||
| 217 | +EXTRA_NETOBJS = @EXTRA_NETOBJS@ | ||
| 218 | +GENCAT = @GENCAT@ | ||
| 219 | +GETLOADAVG_LIBS = @GETLOADAVG_LIBS@ | ||
| 220 | +GLIBC21 = @GLIBC21@ | ||
| 221 | +GMSGFMT = @GMSGFMT@ | ||
| 222 | +HOSTNAME = @HOSTNAME@ | ||
| 223 | +INSTALL_DATA = @INSTALL_DATA@ | ||
| 224 | +INSTALL_OPTS = @INSTALL_OPTS@ | ||
| 225 | +INSTALL_PROGRAM = @INSTALL_PROGRAM@ | ||
| 226 | +INSTALL_SCRIPT = @INSTALL_SCRIPT@ | ||
| 227 | +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ | ||
| 228 | +INSTOBJEXT = @INSTOBJEXT@ | ||
| 229 | +INTLBISON = @INTLBISON@ | ||
| 230 | +INTLLIBS = @INTLLIBS@ | ||
| 231 | +INTLOBJS = @INTLOBJS@ | ||
| 232 | +INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ | ||
| 233 | +KMEM_GROUP = @KMEM_GROUP@ | ||
| 234 | +KRBINCLUDE = @KRBINCLUDE@ | ||
| 235 | +LDAPINCLUDE = @LDAPINCLUDE@ | ||
| 236 | +LDAPLIBS = @LDAPLIBS@ | ||
| 237 | +LDFLAGS = @LDFLAGS@ | ||
| 238 | +LIBICONV = @LIBICONV@ | ||
| 239 | +LIBINTL = @LIBINTL@ | ||
| 240 | +LIBOBJS = @LIBOBJS@ | ||
| 241 | +LIBS = @LIBINTL@ @LIBS@ | ||
| 242 | +LTLIBICONV = @LTLIBICONV@ | ||
| 243 | +LTLIBINTL = @LTLIBINTL@ | ||
| 244 | +LTLIBOBJS = @LTLIBOBJS@ | ||
| 245 | +MAKEINFO = @MAKEINFO@ | ||
| 246 | +MKINSTALLDIRS = @MKINSTALLDIRS@ | ||
| 247 | +MSGFMT = @MSGFMT@ | ||
| 248 | +MSGMERGE = @MSGMERGE@ | ||
| 249 | +MYSQLINCLUDE = @MYSQLINCLUDE@ | ||
| 250 | +MYSQLLIBS = @MYSQLLIBS@ | ||
| 251 | +NEED_SETGID = @NEED_SETGID@ | ||
| 252 | +NEED_VA_LIST = @NEED_VA_LIST@ | ||
| 253 | +OBJEXT = @OBJEXT@ | ||
| 254 | +OPENSSL = @OPENSSL@ | ||
| 255 | +PACKAGE = @PACKAGE@ | ||
| 256 | +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ | ||
| 257 | +PACKAGE_NAME = @PACKAGE_NAME@ | ||
| 258 | +PACKAGE_STRING = @PACKAGE_STRING@ | ||
| 259 | +PACKAGE_TARNAME = @PACKAGE_TARNAME@ | ||
| 260 | +PACKAGE_VERSION = @PACKAGE_VERSION@ | ||
| 261 | +PATH_SEPARATOR = @PATH_SEPARATOR@ | ||
| 262 | +PATH_TO_DIG = @PATH_TO_DIG@ | ||
| 263 | +PATH_TO_FPING = @PATH_TO_FPING@ | ||
| 264 | +PATH_TO_HOST = @PATH_TO_HOST@ | ||
| 265 | +PATH_TO_LMSTAT = @PATH_TO_LMSTAT@ | ||
| 266 | +PATH_TO_LSPS = @PATH_TO_LSPS@ | ||
| 267 | +PATH_TO_MAILQ = @PATH_TO_MAILQ@ | ||
| 268 | +PATH_TO_NSLOOKUP = @PATH_TO_NSLOOKUP@ | ||
| 269 | +PATH_TO_NTPDATE = @PATH_TO_NTPDATE@ | ||
| 270 | +PATH_TO_NTPDC = @PATH_TO_NTPDC@ | ||
| 271 | +PATH_TO_NTPQ = @PATH_TO_NTPQ@ | ||
| 272 | +PATH_TO_PING = @PATH_TO_PING@ | ||
| 273 | +PATH_TO_PING6 = @PATH_TO_PING6@ | ||
| 274 | +PATH_TO_PS = @PATH_TO_PS@ | ||
| 275 | +PATH_TO_QMAIL_QSTAT = @PATH_TO_QMAIL_QSTAT@ | ||
| 276 | +PATH_TO_QSTAT = @PATH_TO_QSTAT@ | ||
| 277 | +PATH_TO_QUAKESTAT = @PATH_TO_QUAKESTAT@ | ||
| 278 | +PATH_TO_RPCINFO = @PATH_TO_RPCINFO@ | ||
| 279 | +PATH_TO_SMBCLIENT = @PATH_TO_SMBCLIENT@ | ||
| 280 | +PATH_TO_SNMPGET = @PATH_TO_SNMPGET@ | ||
| 281 | +PATH_TO_SNMPGETNEXT = @PATH_TO_SNMPGETNEXT@ | ||
| 282 | +PATH_TO_SSH = @PATH_TO_SSH@ | ||
| 283 | +PATH_TO_SWAP = @PATH_TO_SWAP@ | ||
| 284 | +PATH_TO_SWAPINFO = @PATH_TO_SWAPINFO@ | ||
| 285 | +PATH_TO_UPTIME = @PATH_TO_UPTIME@ | ||
| 286 | +PATH_TO_WHO = @PATH_TO_WHO@ | ||
| 287 | +PERL = @PERL@ | ||
| 288 | +PGINCLUDE = @PGINCLUDE@ | ||
| 289 | +PGLIBS = @PGLIBS@ | ||
| 290 | +PKG_ARCH = @PKG_ARCH@ | ||
| 291 | +PLUGIN_TEST = @PLUGIN_TEST@ | ||
| 292 | +POSUB = @POSUB@ | ||
| 293 | +POW_LIB = @POW_LIB@ | ||
| 294 | +PYTHON = @PYTHON@ | ||
| 295 | +RADIUSLIBS = @RADIUSLIBS@ | ||
| 296 | +RANLIB = @RANLIB@ | ||
| 297 | +RELEASE = @RELEASE@ | ||
| 298 | +REV_DATESTAMP = @REV_DATESTAMP@ | ||
| 299 | +REV_TIMESTAMP = @REV_TIMESTAMP@ | ||
| 300 | +SCRIPT_TEST = @SCRIPT_TEST@ | ||
| 301 | +SET_MAKE = @SET_MAKE@ | ||
| 302 | +SH = @SH@ | ||
| 303 | +SHELL = @SHELL@ | ||
| 304 | +SOCKETLIBS = @SOCKETLIBS@ | ||
| 305 | +SSLINCLUDE = @SSLINCLUDE@ | ||
| 306 | +SSLLIBS = @SSLLIBS@ | ||
| 307 | +STRIP = @STRIP@ | ||
| 308 | +SUPPORT = @SUPPORT@ | ||
| 309 | +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ | ||
| 310 | +USE_NLS = @USE_NLS@ | ||
| 311 | +VERSION = @VERSION@ | ||
| 312 | +WARRANTY = @WARRANTY@ | ||
| 313 | +XGETTEXT = @XGETTEXT@ | ||
| 314 | +ac_ct_CC = @ac_ct_CC@ | ||
| 315 | +ac_ct_RANLIB = @ac_ct_RANLIB@ | ||
| 316 | +ac_ct_STRIP = @ac_ct_STRIP@ | ||
| 317 | +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ | ||
| 318 | +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ | ||
| 319 | +am__include = @am__include@ | ||
| 320 | +am__leading_dot = @am__leading_dot@ | ||
| 321 | +am__quote = @am__quote@ | ||
| 322 | +am__tar = @am__tar@ | ||
| 323 | +am__untar = @am__untar@ | ||
| 324 | +bindir = @bindir@ | ||
| 325 | +build = @build@ | ||
| 326 | +build_alias = @build_alias@ | ||
| 327 | +build_cpu = @build_cpu@ | ||
| 328 | +build_os = @build_os@ | ||
| 329 | +build_vendor = @build_vendor@ | ||
| 330 | +check_mysql_LDFLAGS = @check_mysql_LDFLAGS@ | ||
| 331 | +check_tcp_ssl = @check_tcp_ssl@ | ||
| 332 | +datadir = @datadir@ | ||
| 333 | +exec_prefix = @exec_prefix@ | ||
| 334 | +host = @host@ | ||
| 335 | +host_alias = @host_alias@ | ||
| 336 | +host_cpu = @host_cpu@ | ||
| 337 | +host_os = @host_os@ | ||
| 338 | +host_vendor = @host_vendor@ | ||
| 339 | +includedir = @includedir@ | ||
| 340 | +infodir = @infodir@ | ||
| 341 | +install_sh = @install_sh@ | ||
| 342 | +libdir = @libdir@ | ||
| 343 | +libexecdir = @libexecdir@ | ||
| 344 | +localstatedir = @localstatedir@ | ||
| 345 | +mandir = @mandir@ | ||
| 346 | +mkdir_p = @mkdir_p@ | ||
| 347 | +oldincludedir = @oldincludedir@ | ||
| 348 | +prefix = @prefix@ | ||
| 349 | +program_transform_name = @program_transform_name@ | ||
| 350 | +sbindir = @sbindir@ | ||
| 351 | +sharedstatedir = @sharedstatedir@ | ||
| 352 | +sysconfdir = @sysconfdir@ | ||
| 353 | +target_alias = @target_alias@ | ||
| 354 | +with_nagios_group = @with_nagios_group@ | ||
| 355 | +with_nagios_user = @with_nagios_user@ | ||
| 356 | +with_trusted_path = @with_trusted_path@ | ||
| 357 | +INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/intl \ | ||
| 358 | +@LDAPINCLUDE@ @PGINCLUDE@ @SSLINCLUDE@ | ||
| 359 | + | ||
| 360 | +localedir = $(datadir)/locale | ||
| 361 | +check_tcp_programs = check_ftp check_imap check_nntp check_pop check_udp2 \ | ||
| 362 | + @check_tcp_ssl@ | ||
| 363 | + | ||
| 364 | +EXTRA_DIST = t utils.c netutils.c popen.c utils.h netutils.h popen.h common.h \ | ||
| 365 | + getaddrinfo.c getaddrinfo.h gethostbyname.c gethostbyname.h | ||
| 366 | + | ||
| 367 | +PLUGINHDRS = common.h | ||
| 368 | +BASEOBJS = utils.o ../lib/libnagiosplug.a | ||
| 369 | +NETOBJS = netutils.o $(BASEOBJS) $(EXTRA_NETOBJS) | ||
| 370 | +NETLIBS = $(NETOBJS) $(SOCKETLIBS) | ||
| 371 | +TESTS_ENVIRONMENT = perl -I $(top_builddir) -I $(top_srcdir) | ||
| 372 | +TESTS = @PLUGIN_TEST@ | ||
| 373 | +AM_INSTALL_PROGRAM_FLAGS = @INSTALL_OPTS@ | ||
| 374 | + | ||
| 375 | +############################################################################## | ||
| 376 | +# the actual targets | ||
| 377 | +check_dig_LDADD = $(NETLIBS) popen.o | ||
| 378 | +check_disk_LDADD = $(BASEOBJS) popen.o | ||
| 379 | +check_dns_LDADD = $(NETLIBS) popen.o | ||
| 380 | +check_dummy_LDADD = $(BASEOBJS) | ||
| 381 | +check_fping_LDADD = $(NETLIBS) popen.o | ||
| 382 | +check_game_LDADD = $(BASEOBJS) popen.o | ||
| 383 | +check_http_LDADD = $(NETLIBS) $(SSLLIBS) | ||
| 384 | +check_hpjd_LDADD = $(NETLIBS) popen.o | ||
| 385 | +check_ldap_LDADD = $(NETLIBS) $(LDAPLIBS) | ||
| 386 | +check_load_LDADD = $(BASEOBJS) popen.o | ||
| 387 | +check_mrtg_LDADD = $(BASEOBJS) | ||
| 388 | +check_mrtgtraf_LDADD = $(BASEOBJS) | ||
| 389 | +check_mysql_LDADD = $(NETLIBS) $(MYSQLLIBS) | ||
| 390 | +check_nagios_LDADD = $(BASEOBJS) popen.o | ||
| 391 | +check_nt_LDADD = $(NETLIBS) | ||
| 392 | +check_nwstat_LDADD = $(NETLIBS) | ||
| 393 | +check_overcr_LDADD = $(NETLIBS) | ||
| 394 | +check_pgsql_LDADD = $(NETLIBS) $(PGLIBS) | ||
| 395 | +check_ping_LDADD = $(NETLIBS) popen.o | ||
| 396 | +check_procs_LDADD = $(BASEOBJS) popen.o | ||
| 397 | +check_radius_LDADD = $(NETLIBS) $(RADIUSLIBS) | ||
| 398 | +check_real_LDADD = $(NETLIBS) | ||
| 399 | +check_snmp_LDADD = $(BASEOBJS) popen.o | ||
| 400 | +check_smtp_LDADD = $(NETLIBS) | ||
| 401 | +check_ssh_LDADD = $(NETLIBS) | ||
| 402 | +check_swap_LDADD = $(BASEOBJS) popen.o | ||
| 403 | +check_tcp_LDADD = $(NETLIBS) $(SSLLIBS) | ||
| 404 | +check_time_LDADD = $(NETLIBS) | ||
| 405 | +check_udp_LDADD = $(NETLIBS) | ||
| 406 | +check_ups_LDADD = $(NETLIBS) | ||
| 407 | +check_users_LDADD = $(BASEOBJS) popen.o | ||
| 408 | +check_by_ssh_LDADD = $(NETLIBS) popen.o | ||
| 409 | +negate_LDADD = $(BASEOBJS) popen.o | ||
| 410 | +urlize_LDADD = $(BASEOBJS) popen.o | ||
| 411 | +check_dig_DEPENDENCIES = check_dig.c $(NETOBJS) popen.o $(DEPLIBS) | ||
| 412 | +check_disk_DEPENDENCIES = check_disk.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 413 | +check_dns_DEPENDENCIES = check_dns.c $(NETOBJS) popen.o $(DEPLIBS) | ||
| 414 | +check_dummy_DEPENDENCIES = check_dummy.c $(DEPLIBS) | ||
| 415 | +check_fping_DEPENDENCIES = check_fping.c $(NETOBJS) popen.o $(DEPLIBS) | ||
| 416 | +check_game_DEPENDENCIES = check_game.c $(DEPLIBS) | ||
| 417 | +check_http_DEPENDENCIES = check_http.c $(NETOBJS) $(DEPLIBS) | ||
| 418 | +check_hpjd_DEPENDENCIES = check_hpjd.c $(NETOBJS) popen.o $(DEPLIBS) | ||
| 419 | +check_ldap_DEPENDENCIES = check_ldap.c $(NETOBJS) $(DEPLIBS) | ||
| 420 | +check_load_DEPENDENCIES = check_load.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 421 | +check_mrtg_DEPENDENCIES = check_mrtg.c $(DEPLIBS) | ||
| 422 | +check_mrtgtraf_DEPENDENCIES = check_mrtgtraf.c $(DEPLIBS) | ||
| 423 | +check_mysql_DEPENDENCIES = check_mysql.c $(NETOBJS) $(DEPLIBS) | ||
| 424 | +check_nagios_DEPENDENCIES = check_nagios.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 425 | +check_nt_DEPENDENCIES = check_nt.c $(NETOBJS) $(DEPLIBS) | ||
| 426 | +check_nwstat_DEPENDENCIES = check_nwstat.c $(NETOBJS) $(DEPLIBS) | ||
| 427 | +check_overcr_DEPENDENCIES = check_overcr.c $(NETOBJS) $(DEPLIBS) | ||
| 428 | +check_pgsql_DEPENDENCIES = check_pgsql.c $(NETOBJS) $(DEPLIBS) | ||
| 429 | +check_ping_DEPENDENCIES = check_ping.c $(NETOBJS) popen.o $(DEPLIBS) | ||
| 430 | +check_procs_DEPENDENCIES = check_procs.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 431 | +check_radius_DEPENDENCIES = check_radius.c $(NETOBJS) $(DEPLIBS) | ||
| 432 | +check_real_DEPENDENCIES = check_real.c $(NETOBJS) $(DEPLIBS) | ||
| 433 | +check_snmp_DEPENDENCIES = check_snmp.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 434 | +check_smtp_DEPENDENCIES = check_smtp.c $(NETOBJS) $(DEPLIBS) | ||
| 435 | +check_ssh_DEPENDENCIES = check_ssh.c $(NETOBJS) $(DEPLIBS) | ||
| 436 | +check_swap_DEPENDENCIES = check_swap.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 437 | +check_tcp_DEPENDENCIES = check_tcp.c $(NETOBJS) $(DEPLIBS) | ||
| 438 | +check_time_DEPENDENCIES = check_time.c $(NETOBJS) $(DEPLIBS) | ||
| 439 | +check_udp_DEPENDENCIES = check_udp.c $(NETOBJS) $(DEPLIBS) | ||
| 440 | +check_ups_DEPENDENCIES = check_ups.c $(NETOBJS) $(DEPLIBS) | ||
| 441 | +check_users_DEPENDENCIES = check_users.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 442 | +check_by_ssh_DEPENDENCIES = check_by_ssh.c $(NETOBJS) popen.o $(DEPLIBS) | ||
| 443 | +negate_DEPENDENCIES = negate.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 444 | +urlize_DEPENDENCIES = urlize.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 445 | +check_icmp_DEPENDENCIES = check_icmp.c $(DEPLIBS) | ||
| 446 | +all: all-am | ||
| 447 | + | ||
| 448 | +.SUFFIXES: | ||
| 449 | +.SUFFIXES: .c .o .obj | ||
| 450 | +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) | ||
| 451 | + @for dep in $?; do \ | ||
| 452 | + case '$(am__configure_deps)' in \ | ||
| 453 | + *$$dep*) \ | ||
| 454 | + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ | ||
| 455 | + && exit 0; \ | ||
| 456 | + exit 1;; \ | ||
| 457 | + esac; \ | ||
| 458 | + done; \ | ||
| 459 | + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/Makefile'; \ | ||
| 460 | + cd $(top_srcdir) && \ | ||
| 461 | + $(AUTOMAKE) --gnu plugins/Makefile | ||
| 462 | +.PRECIOUS: Makefile | ||
| 463 | +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | ||
| 464 | + @case '$?' in \ | ||
| 465 | + *config.status*) \ | ||
| 466 | + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ | ||
| 467 | + *) \ | ||
| 468 | + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ | ||
| 469 | + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ | ||
| 470 | + esac; | ||
| 471 | + | ||
| 472 | +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) | ||
| 473 | + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
| 474 | + | ||
| 475 | +$(top_srcdir)/configure: $(am__configure_deps) | ||
| 476 | + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
| 477 | +$(ACLOCAL_M4): $(am__aclocal_m4_deps) | ||
| 478 | + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
| 479 | +install-libexecPROGRAMS: $(libexec_PROGRAMS) | ||
| 480 | + @$(NORMAL_INSTALL) | ||
| 481 | + test -z "$(libexecdir)" || $(mkdir_p) "$(DESTDIR)$(libexecdir)" | ||
| 482 | + @list='$(libexec_PROGRAMS)'; for p in $$list; do \ | ||
| 483 | + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ | ||
| 484 | + if test -f $$p \ | ||
| 485 | + ; then \ | ||
| 486 | + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ | ||
| 487 | + echo " $(INSTALL_PROGRAM_ENV) $(libexecPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(libexecdir)/$$f'"; \ | ||
| 488 | + $(INSTALL_PROGRAM_ENV) $(libexecPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(libexecdir)/$$f" || exit 1; \ | ||
| 489 | + else :; fi; \ | ||
| 490 | + done | ||
| 491 | + | ||
| 492 | +uninstall-libexecPROGRAMS: | ||
| 493 | + @$(NORMAL_UNINSTALL) | ||
| 494 | + @list='$(libexec_PROGRAMS)'; for p in $$list; do \ | ||
| 495 | + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ | ||
| 496 | + echo " rm -f '$(DESTDIR)$(libexecdir)/$$f'"; \ | ||
| 497 | + rm -f "$(DESTDIR)$(libexecdir)/$$f"; \ | ||
| 498 | + done | ||
| 499 | + | ||
| 500 | +clean-libexecPROGRAMS: | ||
| 501 | + -test -z "$(libexec_PROGRAMS)" || rm -f $(libexec_PROGRAMS) | ||
| 502 | +check_by_ssh$(EXEEXT): $(check_by_ssh_OBJECTS) $(check_by_ssh_DEPENDENCIES) | ||
| 503 | + @rm -f check_by_ssh$(EXEEXT) | ||
| 504 | + $(LINK) $(check_by_ssh_LDFLAGS) $(check_by_ssh_OBJECTS) $(check_by_ssh_LDADD) $(LIBS) | ||
| 505 | +check_dig$(EXEEXT): $(check_dig_OBJECTS) $(check_dig_DEPENDENCIES) | ||
| 506 | + @rm -f check_dig$(EXEEXT) | ||
| 507 | + $(LINK) $(check_dig_LDFLAGS) $(check_dig_OBJECTS) $(check_dig_LDADD) $(LIBS) | ||
| 508 | +check_disk$(EXEEXT): $(check_disk_OBJECTS) $(check_disk_DEPENDENCIES) | ||
| 509 | + @rm -f check_disk$(EXEEXT) | ||
| 510 | + $(LINK) $(check_disk_LDFLAGS) $(check_disk_OBJECTS) $(check_disk_LDADD) $(LIBS) | ||
| 511 | +check_dns$(EXEEXT): $(check_dns_OBJECTS) $(check_dns_DEPENDENCIES) | ||
| 512 | + @rm -f check_dns$(EXEEXT) | ||
| 513 | + $(LINK) $(check_dns_LDFLAGS) $(check_dns_OBJECTS) $(check_dns_LDADD) $(LIBS) | ||
| 514 | +check_dummy$(EXEEXT): $(check_dummy_OBJECTS) $(check_dummy_DEPENDENCIES) | ||
| 515 | + @rm -f check_dummy$(EXEEXT) | ||
| 516 | + $(LINK) $(check_dummy_LDFLAGS) $(check_dummy_OBJECTS) $(check_dummy_LDADD) $(LIBS) | ||
| 517 | +check_fping$(EXEEXT): $(check_fping_OBJECTS) $(check_fping_DEPENDENCIES) | ||
| 518 | + @rm -f check_fping$(EXEEXT) | ||
| 519 | + $(LINK) $(check_fping_LDFLAGS) $(check_fping_OBJECTS) $(check_fping_LDADD) $(LIBS) | ||
| 520 | +check_game$(EXEEXT): $(check_game_OBJECTS) $(check_game_DEPENDENCIES) | ||
| 521 | + @rm -f check_game$(EXEEXT) | ||
| 522 | + $(LINK) $(check_game_LDFLAGS) $(check_game_OBJECTS) $(check_game_LDADD) $(LIBS) | ||
| 523 | +check_hpjd$(EXEEXT): $(check_hpjd_OBJECTS) $(check_hpjd_DEPENDENCIES) | ||
| 524 | + @rm -f check_hpjd$(EXEEXT) | ||
| 525 | + $(LINK) $(check_hpjd_LDFLAGS) $(check_hpjd_OBJECTS) $(check_hpjd_LDADD) $(LIBS) | ||
| 526 | +check_http$(EXEEXT): $(check_http_OBJECTS) $(check_http_DEPENDENCIES) | ||
| 527 | + @rm -f check_http$(EXEEXT) | ||
| 528 | + $(LINK) $(check_http_LDFLAGS) $(check_http_OBJECTS) $(check_http_LDADD) $(LIBS) | ||
| 529 | +check_icmp$(EXEEXT): $(check_icmp_OBJECTS) $(check_icmp_DEPENDENCIES) | ||
| 530 | + @rm -f check_icmp$(EXEEXT) | ||
| 531 | + $(LINK) $(check_icmp_LDFLAGS) $(check_icmp_OBJECTS) $(check_icmp_LDADD) $(LIBS) | ||
| 532 | +check_ide-smart$(EXEEXT): $(check_ide_smart_OBJECTS) $(check_ide_smart_DEPENDENCIES) | ||
| 533 | + @rm -f check_ide-smart$(EXEEXT) | ||
| 534 | + $(LINK) $(check_ide_smart_LDFLAGS) $(check_ide_smart_OBJECTS) $(check_ide_smart_LDADD) $(LIBS) | ||
| 535 | +check_ldap$(EXEEXT): $(check_ldap_OBJECTS) $(check_ldap_DEPENDENCIES) | ||
| 536 | + @rm -f check_ldap$(EXEEXT) | ||
| 537 | + $(LINK) $(check_ldap_LDFLAGS) $(check_ldap_OBJECTS) $(check_ldap_LDADD) $(LIBS) | ||
| 538 | +check_load$(EXEEXT): $(check_load_OBJECTS) $(check_load_DEPENDENCIES) | ||
| 539 | + @rm -f check_load$(EXEEXT) | ||
| 540 | + $(LINK) $(check_load_LDFLAGS) $(check_load_OBJECTS) $(check_load_LDADD) $(LIBS) | ||
| 541 | +check_mrtg$(EXEEXT): $(check_mrtg_OBJECTS) $(check_mrtg_DEPENDENCIES) | ||
| 542 | + @rm -f check_mrtg$(EXEEXT) | ||
| 543 | + $(LINK) $(check_mrtg_LDFLAGS) $(check_mrtg_OBJECTS) $(check_mrtg_LDADD) $(LIBS) | ||
| 544 | +check_mrtgtraf$(EXEEXT): $(check_mrtgtraf_OBJECTS) $(check_mrtgtraf_DEPENDENCIES) | ||
| 545 | + @rm -f check_mrtgtraf$(EXEEXT) | ||
| 546 | + $(LINK) $(check_mrtgtraf_LDFLAGS) $(check_mrtgtraf_OBJECTS) $(check_mrtgtraf_LDADD) $(LIBS) | ||
| 547 | +check_mysql$(EXEEXT): $(check_mysql_OBJECTS) $(check_mysql_DEPENDENCIES) | ||
| 548 | + @rm -f check_mysql$(EXEEXT) | ||
| 549 | + $(LINK) $(check_mysql_LDFLAGS) $(check_mysql_OBJECTS) $(check_mysql_LDADD) $(LIBS) | ||
| 550 | +check_nagios$(EXEEXT): $(check_nagios_OBJECTS) $(check_nagios_DEPENDENCIES) | ||
| 551 | + @rm -f check_nagios$(EXEEXT) | ||
| 552 | + $(LINK) $(check_nagios_LDFLAGS) $(check_nagios_OBJECTS) $(check_nagios_LDADD) $(LIBS) | ||
| 553 | +check_nt$(EXEEXT): $(check_nt_OBJECTS) $(check_nt_DEPENDENCIES) | ||
| 554 | + @rm -f check_nt$(EXEEXT) | ||
| 555 | + $(LINK) $(check_nt_LDFLAGS) $(check_nt_OBJECTS) $(check_nt_LDADD) $(LIBS) | ||
| 556 | +check_nwstat$(EXEEXT): $(check_nwstat_OBJECTS) $(check_nwstat_DEPENDENCIES) | ||
| 557 | + @rm -f check_nwstat$(EXEEXT) | ||
| 558 | + $(LINK) $(check_nwstat_LDFLAGS) $(check_nwstat_OBJECTS) $(check_nwstat_LDADD) $(LIBS) | ||
| 559 | +check_overcr$(EXEEXT): $(check_overcr_OBJECTS) $(check_overcr_DEPENDENCIES) | ||
| 560 | + @rm -f check_overcr$(EXEEXT) | ||
| 561 | + $(LINK) $(check_overcr_LDFLAGS) $(check_overcr_OBJECTS) $(check_overcr_LDADD) $(LIBS) | ||
| 562 | +check_pgsql$(EXEEXT): $(check_pgsql_OBJECTS) $(check_pgsql_DEPENDENCIES) | ||
| 563 | + @rm -f check_pgsql$(EXEEXT) | ||
| 564 | + $(LINK) $(check_pgsql_LDFLAGS) $(check_pgsql_OBJECTS) $(check_pgsql_LDADD) $(LIBS) | ||
| 565 | +check_ping$(EXEEXT): $(check_ping_OBJECTS) $(check_ping_DEPENDENCIES) | ||
| 566 | + @rm -f check_ping$(EXEEXT) | ||
| 567 | + $(LINK) $(check_ping_LDFLAGS) $(check_ping_OBJECTS) $(check_ping_LDADD) $(LIBS) | ||
| 568 | +check_procs$(EXEEXT): $(check_procs_OBJECTS) $(check_procs_DEPENDENCIES) | ||
| 569 | + @rm -f check_procs$(EXEEXT) | ||
| 570 | + $(LINK) $(check_procs_LDFLAGS) $(check_procs_OBJECTS) $(check_procs_LDADD) $(LIBS) | ||
| 571 | +check_radius$(EXEEXT): $(check_radius_OBJECTS) $(check_radius_DEPENDENCIES) | ||
| 572 | + @rm -f check_radius$(EXEEXT) | ||
| 573 | + $(LINK) $(check_radius_LDFLAGS) $(check_radius_OBJECTS) $(check_radius_LDADD) $(LIBS) | ||
| 574 | +check_real$(EXEEXT): $(check_real_OBJECTS) $(check_real_DEPENDENCIES) | ||
| 575 | + @rm -f check_real$(EXEEXT) | ||
| 576 | + $(LINK) $(check_real_LDFLAGS) $(check_real_OBJECTS) $(check_real_LDADD) $(LIBS) | ||
| 577 | +check_smtp$(EXEEXT): $(check_smtp_OBJECTS) $(check_smtp_DEPENDENCIES) | ||
| 578 | + @rm -f check_smtp$(EXEEXT) | ||
| 579 | + $(LINK) $(check_smtp_LDFLAGS) $(check_smtp_OBJECTS) $(check_smtp_LDADD) $(LIBS) | ||
| 580 | +check_snmp$(EXEEXT): $(check_snmp_OBJECTS) $(check_snmp_DEPENDENCIES) | ||
| 581 | + @rm -f check_snmp$(EXEEXT) | ||
| 582 | + $(LINK) $(check_snmp_LDFLAGS) $(check_snmp_OBJECTS) $(check_snmp_LDADD) $(LIBS) | ||
| 583 | +check_ssh$(EXEEXT): $(check_ssh_OBJECTS) $(check_ssh_DEPENDENCIES) | ||
| 584 | + @rm -f check_ssh$(EXEEXT) | ||
| 585 | + $(LINK) $(check_ssh_LDFLAGS) $(check_ssh_OBJECTS) $(check_ssh_LDADD) $(LIBS) | ||
| 586 | +check_swap$(EXEEXT): $(check_swap_OBJECTS) $(check_swap_DEPENDENCIES) | ||
| 587 | + @rm -f check_swap$(EXEEXT) | ||
| 588 | + $(LINK) $(check_swap_LDFLAGS) $(check_swap_OBJECTS) $(check_swap_LDADD) $(LIBS) | ||
| 589 | +check_tcp$(EXEEXT): $(check_tcp_OBJECTS) $(check_tcp_DEPENDENCIES) | ||
| 590 | + @rm -f check_tcp$(EXEEXT) | ||
| 591 | + $(LINK) $(check_tcp_LDFLAGS) $(check_tcp_OBJECTS) $(check_tcp_LDADD) $(LIBS) | ||
| 592 | +check_time$(EXEEXT): $(check_time_OBJECTS) $(check_time_DEPENDENCIES) | ||
| 593 | + @rm -f check_time$(EXEEXT) | ||
| 594 | + $(LINK) $(check_time_LDFLAGS) $(check_time_OBJECTS) $(check_time_LDADD) $(LIBS) | ||
| 595 | +check_udp$(EXEEXT): $(check_udp_OBJECTS) $(check_udp_DEPENDENCIES) | ||
| 596 | + @rm -f check_udp$(EXEEXT) | ||
| 597 | + $(LINK) $(check_udp_LDFLAGS) $(check_udp_OBJECTS) $(check_udp_LDADD) $(LIBS) | ||
| 598 | +check_ups$(EXEEXT): $(check_ups_OBJECTS) $(check_ups_DEPENDENCIES) | ||
| 599 | + @rm -f check_ups$(EXEEXT) | ||
| 600 | + $(LINK) $(check_ups_LDFLAGS) $(check_ups_OBJECTS) $(check_ups_LDADD) $(LIBS) | ||
| 601 | +check_users$(EXEEXT): $(check_users_OBJECTS) $(check_users_DEPENDENCIES) | ||
| 602 | + @rm -f check_users$(EXEEXT) | ||
| 603 | + $(LINK) $(check_users_LDFLAGS) $(check_users_OBJECTS) $(check_users_LDADD) $(LIBS) | ||
| 604 | +negate$(EXEEXT): $(negate_OBJECTS) $(negate_DEPENDENCIES) | ||
| 605 | + @rm -f negate$(EXEEXT) | ||
| 606 | + $(LINK) $(negate_LDFLAGS) $(negate_OBJECTS) $(negate_LDADD) $(LIBS) | ||
| 607 | +urlize$(EXEEXT): $(urlize_OBJECTS) $(urlize_DEPENDENCIES) | ||
| 608 | + @rm -f urlize$(EXEEXT) | ||
| 609 | + $(LINK) $(urlize_LDFLAGS) $(urlize_OBJECTS) $(urlize_LDADD) $(LIBS) | ||
| 610 | + | ||
| 611 | +mostlyclean-compile: | ||
| 612 | + -rm -f *.$(OBJEXT) | ||
| 613 | + | ||
| 614 | +distclean-compile: | ||
| 615 | + -rm -f *.tab.c | ||
| 616 | + | ||
| 617 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_by_ssh.Po@am__quote@ | ||
| 618 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_dig.Po@am__quote@ | ||
| 619 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_disk.Po@am__quote@ | ||
| 620 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_dns.Po@am__quote@ | ||
| 621 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_dummy.Po@am__quote@ | ||
| 622 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_fping.Po@am__quote@ | ||
| 623 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_game.Po@am__quote@ | ||
| 624 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_hpjd.Po@am__quote@ | ||
| 625 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_http.Po@am__quote@ | ||
| 626 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_icmp.Po@am__quote@ | ||
| 627 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_ide-smart.Po@am__quote@ | ||
| 628 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_ldap.Po@am__quote@ | ||
| 629 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_load.Po@am__quote@ | ||
| 630 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_mrtg.Po@am__quote@ | ||
| 631 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_mrtgtraf.Po@am__quote@ | ||
| 632 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_mysql.Po@am__quote@ | ||
| 633 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_nagios.Po@am__quote@ | ||
| 634 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_nt.Po@am__quote@ | ||
| 635 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_nwstat.Po@am__quote@ | ||
| 636 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_overcr.Po@am__quote@ | ||
| 637 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_pgsql.Po@am__quote@ | ||
| 638 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_ping.Po@am__quote@ | ||
| 639 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_procs.Po@am__quote@ | ||
| 640 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_radius.Po@am__quote@ | ||
| 641 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_real.Po@am__quote@ | ||
| 642 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_smtp.Po@am__quote@ | ||
| 643 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_snmp.Po@am__quote@ | ||
| 644 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_ssh.Po@am__quote@ | ||
| 645 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_swap.Po@am__quote@ | ||
| 646 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_tcp.Po@am__quote@ | ||
| 647 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_time.Po@am__quote@ | ||
| 648 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_udp.Po@am__quote@ | ||
| 649 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_ups.Po@am__quote@ | ||
| 650 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_users.Po@am__quote@ | ||
| 651 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/negate.Po@am__quote@ | ||
| 652 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urlize.Po@am__quote@ | ||
| 653 | + | ||
| 654 | +.c.o: | ||
| 655 | +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ | ||
| 656 | +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi | ||
| 657 | +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
| 658 | +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
| 659 | +@am__fastdepCC_FALSE@ $(COMPILE) -c $< | ||
| 660 | + | ||
| 661 | +.c.obj: | ||
| 662 | +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ | ||
| 663 | +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi | ||
| 664 | +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
| 665 | +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
| 666 | +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` | ||
| 667 | +uninstall-info-am: | ||
| 668 | + | ||
| 669 | +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) | ||
| 670 | + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
| 671 | + unique=`for i in $$list; do \ | ||
| 672 | + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
| 673 | + done | \ | ||
| 674 | + $(AWK) ' { files[$$0] = 1; } \ | ||
| 675 | + END { for (i in files) print i; }'`; \ | ||
| 676 | + mkid -fID $$unique | ||
| 677 | +tags: TAGS | ||
| 678 | + | ||
| 679 | +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ | ||
| 680 | + $(TAGS_FILES) $(LISP) | ||
| 681 | + tags=; \ | ||
| 682 | + here=`pwd`; \ | ||
| 683 | + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
| 684 | + unique=`for i in $$list; do \ | ||
| 685 | + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
| 686 | + done | \ | ||
| 687 | + $(AWK) ' { files[$$0] = 1; } \ | ||
| 688 | + END { for (i in files) print i; }'`; \ | ||
| 689 | + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ | ||
| 690 | + test -n "$$unique" || unique=$$empty_fix; \ | ||
| 691 | + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | ||
| 692 | + $$tags $$unique; \ | ||
| 693 | + fi | ||
| 694 | +ctags: CTAGS | ||
| 695 | +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ | ||
| 696 | + $(TAGS_FILES) $(LISP) | ||
| 697 | + tags=; \ | ||
| 698 | + here=`pwd`; \ | ||
| 699 | + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
| 700 | + unique=`for i in $$list; do \ | ||
| 701 | + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
| 702 | + done | \ | ||
| 703 | + $(AWK) ' { files[$$0] = 1; } \ | ||
| 704 | + END { for (i in files) print i; }'`; \ | ||
| 705 | + test -z "$(CTAGS_ARGS)$$tags$$unique" \ | ||
| 706 | + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ | ||
| 707 | + $$tags $$unique | ||
| 708 | + | ||
| 709 | +GTAGS: | ||
| 710 | + here=`$(am__cd) $(top_builddir) && pwd` \ | ||
| 711 | + && cd $(top_srcdir) \ | ||
| 712 | + && gtags -i $(GTAGS_ARGS) $$here | ||
| 713 | + | ||
| 714 | +distclean-tags: | ||
| 715 | + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags | ||
| 716 | + | ||
| 717 | +check-TESTS: $(TESTS) | ||
| 718 | + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ | ||
| 719 | + srcdir=$(srcdir); export srcdir; \ | ||
| 720 | + list='$(TESTS)'; \ | ||
| 721 | + if test -n "$$list"; then \ | ||
| 722 | + for tst in $$list; do \ | ||
| 723 | + if test -f ./$$tst; then dir=./; \ | ||
| 724 | + elif test -f $$tst; then dir=; \ | ||
| 725 | + else dir="$(srcdir)/"; fi; \ | ||
| 726 | + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ | ||
| 727 | + all=`expr $$all + 1`; \ | ||
| 728 | + case " $(XFAIL_TESTS) " in \ | ||
| 729 | + *" $$tst "*) \ | ||
| 730 | + xpass=`expr $$xpass + 1`; \ | ||
| 731 | + failed=`expr $$failed + 1`; \ | ||
| 732 | + echo "XPASS: $$tst"; \ | ||
| 733 | + ;; \ | ||
| 734 | + *) \ | ||
| 735 | + echo "PASS: $$tst"; \ | ||
| 736 | + ;; \ | ||
| 737 | + esac; \ | ||
| 738 | + elif test $$? -ne 77; then \ | ||
| 739 | + all=`expr $$all + 1`; \ | ||
| 740 | + case " $(XFAIL_TESTS) " in \ | ||
| 741 | + *" $$tst "*) \ | ||
| 742 | + xfail=`expr $$xfail + 1`; \ | ||
| 743 | + echo "XFAIL: $$tst"; \ | ||
| 744 | + ;; \ | ||
| 745 | + *) \ | ||
| 746 | + failed=`expr $$failed + 1`; \ | ||
| 747 | + echo "FAIL: $$tst"; \ | ||
| 748 | + ;; \ | ||
| 749 | + esac; \ | ||
| 750 | + else \ | ||
| 751 | + skip=`expr $$skip + 1`; \ | ||
| 752 | + echo "SKIP: $$tst"; \ | ||
| 753 | + fi; \ | ||
| 754 | + done; \ | ||
| 755 | + if test "$$failed" -eq 0; then \ | ||
| 756 | + if test "$$xfail" -eq 0; then \ | ||
| 757 | + banner="All $$all tests passed"; \ | ||
| 758 | + else \ | ||
| 759 | + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ | ||
| 760 | + fi; \ | ||
| 761 | + else \ | ||
| 762 | + if test "$$xpass" -eq 0; then \ | ||
| 763 | + banner="$$failed of $$all tests failed"; \ | ||
| 764 | + else \ | ||
| 765 | + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ | ||
| 766 | + fi; \ | ||
| 767 | + fi; \ | ||
| 768 | + dashes="$$banner"; \ | ||
| 769 | + skipped=""; \ | ||
| 770 | + if test "$$skip" -ne 0; then \ | ||
| 771 | + skipped="($$skip tests were not run)"; \ | ||
| 772 | + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ | ||
| 773 | + dashes="$$skipped"; \ | ||
| 774 | + fi; \ | ||
| 775 | + report=""; \ | ||
| 776 | + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ | ||
| 777 | + report="Please report to $(PACKAGE_BUGREPORT)"; \ | ||
| 778 | + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ | ||
| 779 | + dashes="$$report"; \ | ||
| 780 | + fi; \ | ||
| 781 | + dashes=`echo "$$dashes" | sed s/./=/g`; \ | ||
| 782 | + echo "$$dashes"; \ | ||
| 783 | + echo "$$banner"; \ | ||
| 784 | + test -z "$$skipped" || echo "$$skipped"; \ | ||
| 785 | + test -z "$$report" || echo "$$report"; \ | ||
| 786 | + echo "$$dashes"; \ | ||
| 787 | + test "$$failed" -eq 0; \ | ||
| 788 | + else :; fi | ||
| 789 | + | ||
| 790 | +distdir: $(DISTFILES) | ||
| 791 | + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ | ||
| 792 | + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ | ||
| 793 | + list='$(DISTFILES)'; for file in $$list; do \ | ||
| 794 | + case $$file in \ | ||
| 795 | + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ | ||
| 796 | + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ | ||
| 797 | + esac; \ | ||
| 798 | + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ | ||
| 799 | + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ | ||
| 800 | + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ | ||
| 801 | + dir="/$$dir"; \ | ||
| 802 | + $(mkdir_p) "$(distdir)$$dir"; \ | ||
| 803 | + else \ | ||
| 804 | + dir=''; \ | ||
| 805 | + fi; \ | ||
| 806 | + if test -d $$d/$$file; then \ | ||
| 807 | + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ | ||
| 808 | + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ | ||
| 809 | + fi; \ | ||
| 810 | + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ | ||
| 811 | + else \ | ||
| 812 | + test -f $(distdir)/$$file \ | ||
| 813 | + || cp -p $$d/$$file $(distdir)/$$file \ | ||
| 814 | + || exit 1; \ | ||
| 815 | + fi; \ | ||
| 816 | + done | ||
| 817 | +check-am: all-am | ||
| 818 | + $(MAKE) $(AM_MAKEFLAGS) check-TESTS | ||
| 819 | +check: check-am | ||
| 820 | +all-am: Makefile $(PROGRAMS) all-local | ||
| 821 | +installdirs: | ||
| 822 | + for dir in "$(DESTDIR)$(libexecdir)"; do \ | ||
| 823 | + test -z "$$dir" || $(mkdir_p) "$$dir"; \ | ||
| 824 | + done | ||
| 825 | +install: install-am | ||
| 826 | +install-exec: install-exec-am | ||
| 827 | +install-data: install-data-am | ||
| 828 | +uninstall: uninstall-am | ||
| 829 | + | ||
| 830 | +install-am: all-am | ||
| 831 | + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am | ||
| 832 | + | ||
| 833 | +installcheck: installcheck-am | ||
| 834 | +install-strip: | ||
| 835 | + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ | ||
| 836 | + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ | ||
| 837 | + `test -z '$(STRIP)' || \ | ||
| 838 | + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install | ||
| 839 | +mostlyclean-generic: | ||
| 840 | + | ||
| 841 | +clean-generic: | ||
| 842 | + | ||
| 843 | +distclean-generic: | ||
| 844 | + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) | ||
| 845 | + | ||
| 846 | +maintainer-clean-generic: | ||
| 847 | + @echo "This command is intended for maintainers to use" | ||
| 848 | + @echo "it deletes files that may require special tools to rebuild." | ||
| 849 | +clean: clean-am | ||
| 850 | + | ||
| 851 | +clean-am: clean-generic clean-libexecPROGRAMS clean-local \ | ||
| 852 | + mostlyclean-am | ||
| 853 | + | ||
| 854 | +distclean: distclean-am | ||
| 855 | + -rm -rf ./$(DEPDIR) | ||
| 856 | + -rm -f Makefile | ||
| 857 | +distclean-am: clean-am distclean-compile distclean-generic \ | ||
| 858 | + distclean-tags | ||
| 859 | + | ||
| 860 | +dvi: dvi-am | ||
| 861 | + | ||
| 862 | +dvi-am: | ||
| 863 | + | ||
| 864 | +html: html-am | ||
| 865 | + | ||
| 866 | +info: info-am | ||
| 867 | + | ||
| 868 | +info-am: | ||
| 869 | + | ||
| 870 | +install-data-am: | ||
| 871 | + | ||
| 872 | +install-exec-am: install-libexecPROGRAMS | ||
| 873 | + @$(NORMAL_INSTALL) | ||
| 874 | + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook | ||
| 875 | + | ||
| 876 | +install-info: install-info-am | ||
| 877 | + | ||
| 878 | +install-man: | ||
| 879 | + | ||
| 880 | +installcheck-am: | ||
| 881 | + | ||
| 882 | +maintainer-clean: maintainer-clean-am | ||
| 883 | + -rm -rf ./$(DEPDIR) | ||
| 884 | + -rm -f Makefile | ||
| 885 | +maintainer-clean-am: distclean-am maintainer-clean-generic | ||
| 886 | + | ||
| 887 | +mostlyclean: mostlyclean-am | ||
| 888 | + | ||
| 889 | +mostlyclean-am: mostlyclean-compile mostlyclean-generic | ||
| 890 | + | ||
| 891 | +pdf: pdf-am | ||
| 892 | + | ||
| 893 | +pdf-am: | ||
| 894 | + | ||
| 895 | +ps: ps-am | ||
| 896 | + | ||
| 897 | +ps-am: | ||
| 898 | + | ||
| 899 | +uninstall-am: uninstall-info-am uninstall-libexecPROGRAMS \ | ||
| 900 | + uninstall-local | ||
| 901 | + | ||
| 902 | +.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \ | ||
| 903 | + clean clean-generic clean-libexecPROGRAMS clean-local ctags \ | ||
| 904 | + distclean distclean-compile distclean-generic distclean-tags \ | ||
| 905 | + distdir dvi dvi-am html html-am info info-am install \ | ||
| 906 | + install-am install-data install-data-am install-exec \ | ||
| 907 | + install-exec-am install-exec-hook install-info install-info-am \ | ||
| 908 | + install-libexecPROGRAMS install-man install-strip installcheck \ | ||
| 909 | + installcheck-am installdirs maintainer-clean \ | ||
| 910 | + maintainer-clean-generic mostlyclean mostlyclean-compile \ | ||
| 911 | + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ | ||
| 912 | + uninstall-am uninstall-info-am uninstall-libexecPROGRAMS \ | ||
| 913 | + uninstall-local | ||
| 914 | + | ||
| 915 | + | ||
| 916 | +test: | ||
| 917 | + perl -I $(top_builddir) -I $(top_srcdir) ../test.pl | ||
| 918 | + | ||
| 919 | +############################################################################## | ||
| 920 | +# secondary dependencies | ||
| 921 | + | ||
| 922 | +popen.o: popen.c popen.h $(PLUGINHDRS) | ||
| 923 | + | ||
| 924 | +utils.o: utils.c utils.h $(PLUGINHDRS) | ||
| 925 | + | ||
| 926 | +netutils.o: netutils.c netutils.h $(PLUGINHDRS) | ||
| 927 | + | ||
| 928 | +getaddrinfo.o: getaddrinfo.h $(PLUGINHDRS) | ||
| 929 | + | ||
| 930 | +gethostbyname.o: gethostbyname.h $(PLUGINHDRS) | ||
| 931 | + | ||
| 932 | +all-local: $(check_tcp_programs) | ||
| 933 | + | ||
| 934 | +$(check_tcp_programs): check_tcp | ||
| 935 | + rm -f $@ | ||
| 936 | + ln -s check_tcp $@ | ||
| 937 | + | ||
| 938 | +install-exec-hook: | ||
| 939 | + cd $(DESTDIR)$(libexecdir) && \ | ||
| 940 | + for i in $(check_tcp_programs) ; do rm -f $$i; ln -s check_tcp $$i ; done | ||
| 941 | + | ||
| 942 | +clean-local: | ||
| 943 | + rm -f $(check_tcp_programs) | ||
| 944 | + | ||
| 945 | +uninstall-local: | ||
| 946 | + cd $(DESTDIR)$(libexecdir) && rm -f $(check_tcp_programs) | ||
| 947 | +# Tell versions [3.59,3.63) of GNU make to not export all variables. | ||
| 948 | +# Otherwise a system limit (for SysV at least) may be exceeded. | ||
| 949 | +.NOEXPORT: | ||
| 950 | diff -urN ../nagiosplug.orig/plugins/check_http.c plugins/check_http.c | ||
| 951 | --- ../nagiosplug.orig/plugins/check_http.c 2004-12-04 00:55:28.000000000 +0100 | ||
| 952 | +++ plugins/check_http.c 2004-12-04 16:57:05.000000000 +0100 | ||
| 953 | @@ -676,17 +676,17 @@ | ||
| 954 | } else if (!document_date || !*document_date) { | ||
| 955 | die (STATE_CRITICAL, _("Document modification date unknown\n")); | ||
| 956 | } else { | ||
| 957 | - time_t sd = parse_time_string (server_date); | ||
| 958 | - time_t dd = parse_time_string (document_date); | ||
| 959 | + time_t srv_data = parse_time_string (server_date); | ||
| 960 | + time_t doc_data = parse_time_string (document_date); | ||
| 961 | |||
| 962 | - if (sd <= 0) { | ||
| 963 | + if (srv_data <= 0) { | ||
| 964 | die (STATE_CRITICAL, _("CRITICAL - Server date \"%100s\" unparsable"), server_date); | ||
| 965 | - } else if (dd <= 0) { | ||
| 966 | + } else if (doc_data <= 0) { | ||
| 967 | die (STATE_CRITICAL, _("CRITICAL - Document date \"%100s\" unparsable"), document_date); | ||
| 968 | - } else if (dd > sd + 30) { | ||
| 969 | - die (STATE_CRITICAL, _("CRITICAL - Document is %d seconds in the future\n"), dd - sd); | ||
| 970 | - } else if (dd < sd - maximum_age) { | ||
| 971 | - int n = (sd - dd); | ||
| 972 | + } else if (doc_data > srv_data + 30) { | ||
| 973 | + die (STATE_CRITICAL, _("CRITICAL - Document is %d seconds in the future\n"), (int)doc_data - (int)srv_data); | ||
| 974 | + } else if (doc_data < srv_data - maximum_age) { | ||
| 975 | + int n = (srv_data - doc_data); | ||
| 976 | if (n > (60 * 60 * 24 * 2)) | ||
| 977 | die (STATE_CRITICAL, | ||
| 978 | _("CRITICAL - Last modified %.1f days ago\n"), | ||
| 979 | diff -urN ../nagiosplug.orig/plugins/check_icmp.c plugins/check_icmp.c | ||
| 980 | --- ../nagiosplug.orig/plugins/check_icmp.c 2004-12-02 09:44:36.000000000 +0100 | ||
| 981 | +++ plugins/check_icmp.c 2004-12-04 17:04:18.000000000 +0100 | ||
| 982 | @@ -1,6 +1,8 @@ | ||
| 983 | /* | ||
| 984 | - * check_icmp - A hack of fping2 to work with nagios. | ||
| 985 | - * This way we don't have to use the output parser. | ||
| 986 | + * $Id: check_icmp.c,v 1.9 2004/09/24 10:07:23 exon Exp $ | ||
| 987 | + * | ||
| 988 | + * This is a hack of fping2 made to work with nagios. | ||
| 989 | + * It's fast and removes the necessity of parsing another programs output. | ||
| 990 | * | ||
| 991 | * VIEWING NOTES: | ||
| 992 | * This file was formatted with tab indents at a tab stop of 4. | ||
| 993 | @@ -40,14 +42,8 @@ | ||
| 994 | #include <netinet/in_systm.h> | ||
| 995 | #include <netinet/in.h> | ||
| 996 | |||
| 997 | -/* Linux has bizarre ip.h and ip_icmp.h */ | ||
| 998 | -/* Taken from the fping distro. Thank you. */ | ||
| 999 | -#if defined( __linux__ ) | ||
| 1000 | -#include "linux.h" | ||
| 1001 | -#else | ||
| 1002 | #include <netinet/ip.h> | ||
| 1003 | #include <netinet/ip_icmp.h> | ||
| 1004 | -#endif /* defined(__linux__) */ | ||
| 1005 | |||
| 1006 | #include <arpa/inet.h> | ||
| 1007 | #include <netdb.h> | ||
| 1008 | @@ -70,9 +66,8 @@ | ||
| 1009 | extern int optind, opterr; | ||
| 1010 | |||
| 1011 | /*** Constants ***/ | ||
| 1012 | -#define REV_DATE "2004-09-06" | ||
| 1013 | #define EMAIL "ae@op5.se" | ||
| 1014 | -#define VERSION "0.8" | ||
| 1015 | +#define VERSION "0.8.1" | ||
| 1016 | |||
| 1017 | #ifndef INADDR_NONE | ||
| 1018 | # define INADDR_NONE 0xffffffU | ||
| 1019 | @@ -441,7 +436,7 @@ | ||
| 1020 | break; | ||
| 1021 | |||
| 1022 | case 'v': | ||
| 1023 | - printf("%s: Version %s $Date: 2004/12/02 08:44:36 $\n", prog, VERSION, REV_DATE); | ||
| 1024 | + printf("%s: Version %s $Date: 2004/09/24 10:07:23 $\n", prog, VERSION); | ||
| 1025 | printf("%s: comments to %s\n", prog, EMAIL); | ||
| 1026 | exit(STATE_OK); | ||
| 1027 | |||
| 1028 | @@ -1275,7 +1270,7 @@ | ||
| 1029 | * crash on any other errrors | ||
| 1030 | ************************************************************/ | ||
| 1031 | /* TODO: add MSG_DONTWAIT to recvfrom flags (currently 0) */ | ||
| 1032 | -int recvfrom_wto(int sock, char *buf, int len, struct sockaddr *saddr, int timo) | ||
| 1033 | +int recvfrom_wto(int lsock, char *buf, int len, struct sockaddr *saddr, int timo) | ||
| 1034 | { | ||
| 1035 | int nfound = 0, slen, n; | ||
| 1036 | struct timeval to; | ||
| 1037 | @@ -1289,8 +1284,8 @@ | ||
| 1038 | |||
| 1039 | FD_ZERO(&readset); | ||
| 1040 | FD_ZERO(&writeset); | ||
| 1041 | - FD_SET(sock, &readset); | ||
| 1042 | - nfound = select(sock + 1, &readset, &writeset, NULL, &to); | ||
| 1043 | + FD_SET(lsock, &readset); | ||
| 1044 | + nfound = select(lsock + 1, &readset, &writeset, NULL, &to); | ||
| 1045 | if(nfound < 0) crash("select() in recvfrom_wto"); | ||
| 1046 | |||
| 1047 | if(nfound == 0) return -1; /* timeout */ | ||
| 1048 | diff -urN ../nagiosplug.orig/plugins/check_nt.c plugins/check_nt.c | ||
| 1049 | --- ../nagiosplug.orig/plugins/check_nt.c 2004-12-04 00:55:29.000000000 +0100 | ||
| 1050 | +++ plugins/check_nt.c 2004-12-04 17:05:20.000000000 +0100 | ||
| 1051 | @@ -86,7 +86,7 @@ | ||
| 1052 | int return_code = STATE_UNKNOWN; | ||
| 1053 | char *send_buffer=NULL; | ||
| 1054 | char *output_message=NULL; | ||
| 1055 | - char *perfdata=NULL; | ||
| 1056 | + char *perf_data=NULL; | ||
| 1057 | char *temp_string=NULL; | ||
| 1058 | char *temp_string_perf=NULL; | ||
| 1059 | char *description=NULL,*counter_unit = NULL; | ||
| 1060 | @@ -103,7 +103,7 @@ | ||
| 1061 | unsigned long utilization; | ||
| 1062 | unsigned long uptime; | ||
| 1063 | unsigned long age_in_minutes; | ||
| 1064 | - double counter_value; | ||
| 1065 | + double counter_value = 0.0; | ||
| 1066 | int offset=0; | ||
| 1067 | int updays=0; | ||
| 1068 | int uphours=0; | ||
| 1069 | @@ -174,15 +174,15 @@ | ||
| 1070 | |||
| 1071 | asprintf(&output_message,_(" %lu%% (%lu min average)"), utilization, lvalue_list[0+offset]); | ||
| 1072 | asprintf(&temp_string,"%s%s",temp_string,output_message); | ||
| 1073 | - asprintf(&perfdata,_(" '%lu min avg Load'=%lu%%;%lu;%lu;0;100"), lvalue_list[0+offset], utilization, | ||
| 1074 | + asprintf(&perf_data,_(" '%lu min avg Load'=%lu%%;%lu;%lu;0;100"), lvalue_list[0+offset], utilization, | ||
| 1075 | lvalue_list[1+offset], lvalue_list[2+offset]); | ||
| 1076 | - asprintf(&temp_string_perf,"%s%s",temp_string_perf,perfdata); | ||
| 1077 | + asprintf(&temp_string_perf,"%s%s",temp_string_perf,perf_data); | ||
| 1078 | offset+=3; /* move across the array */ | ||
| 1079 | } | ||
| 1080 | |||
| 1081 | if (strlen(temp_string)>10) { /* we had at least one loop */ | ||
| 1082 | output_message = strdup (temp_string); | ||
| 1083 | - perfdata = temp_string_perf; | ||
| 1084 | + perf_data = temp_string_perf; | ||
| 1085 | } else | ||
| 1086 | output_message = strdup (_("not enough values for -l parameters")); | ||
| 1087 | } | ||
| 1088 | @@ -231,7 +231,7 @@ | ||
| 1089 | return_code=STATE_OK; | ||
| 1090 | |||
| 1091 | output_message = strdup (temp_string); | ||
| 1092 | - perfdata = temp_string_perf; | ||
| 1093 | + perf_data = temp_string_perf; | ||
| 1094 | } else { | ||
| 1095 | output_message = strdup (_("Free disk space : Invalid drive ")); | ||
| 1096 | return_code=STATE_UNKNOWN; | ||
| 1097 | @@ -270,7 +270,7 @@ | ||
| 1098 | asprintf(&output_message,_("Memory usage: total:%.2f Mb - used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)"), | ||
| 1099 | mem_commitLimit / 1048567, mem_commitByte / 1048567, percent_used_space, | ||
| 1100 | (mem_commitLimit - mem_commitByte) / 1048567, (mem_commitLimit - mem_commitByte) / mem_commitLimit * 100); | ||
| 1101 | - asprintf(&perfdata,_("'Memory usage'=%.2fMb;%.2f;%.2f;0.00;%.2f"), mem_commitByte / 1048567, | ||
| 1102 | + asprintf(&perf_data,_("'Memory usage'=%.2fMb;%.2f;%.2f;0.00;%.2f"), mem_commitByte / 1048567, | ||
| 1103 | warning_used_space / 1048567, critical_used_space / 1048567, mem_commitLimit / 1048567); | ||
| 1104 | |||
| 1105 | return_code=STATE_OK; | ||
| 1106 | @@ -285,11 +285,11 @@ | ||
| 1107 | |||
| 1108 | |||
| 1109 | /* | ||
| 1110 | - CHECK_COUNTER has been modified to provide extensive perfdata information. | ||
| 1111 | + CHECK_COUNTER has been modified to provide extensive perf_data information. | ||
| 1112 | In order to do this, some modifications have been done to the code | ||
| 1113 | and some constraints have been introduced. | ||
| 1114 | |||
| 1115 | - 1) For the sake of simplicity of the code, perfdata information will only be | ||
| 1116 | + 1) For the sake of simplicity of the code, perf_data information will only be | ||
| 1117 | provided when the "description" field is added. | ||
| 1118 | |||
| 1119 | 2) If the counter you're going to measure is percent-based, the code will detect | ||
| 1120 | @@ -426,10 +426,10 @@ | ||
| 1121 | /* reset timeout */ | ||
| 1122 | alarm(0); | ||
| 1123 | |||
| 1124 | - if (perfdata==NULL) | ||
| 1125 | + if (perf_data==NULL) | ||
| 1126 | printf("%s\n",output_message); | ||
| 1127 | else | ||
| 1128 | - printf("%s | %s\n",output_message,perfdata); | ||
| 1129 | + printf("%s | %s\n",output_message,perf_data); | ||
| 1130 | return return_code; | ||
| 1131 | } | ||
| 1132 | |||
| 1133 | diff -urN ../nagiosplug.orig/plugins/check_nwstat.c plugins/check_nwstat.c | ||
| 1134 | --- ../nagiosplug.orig/plugins/check_nwstat.c 2004-12-04 00:55:29.000000000 +0100 | ||
| 1135 | +++ plugins/check_nwstat.c 2004-12-04 16:57:52.000000000 +0100 | ||
| 1136 | @@ -909,8 +909,7 @@ | ||
| 1137 | |||
| 1138 | printf (_("\ | ||
| 1139 | This plugin attempts to contact the MRTGEXT NLM running on a\n\ | ||
| 1140 | -Novell server to gather the requested system information.\n\n"), | ||
| 1141 | - progname); | ||
| 1142 | +Novell server to gather the requested system information.\n\n")); | ||
| 1143 | |||
| 1144 | print_usage(); | ||
| 1145 | |||
| 1146 | diff -urN ../nagiosplug.orig/plugins/check_smtp.c plugins/check_smtp.c | ||
| 1147 | --- ../nagiosplug.orig/plugins/check_smtp.c 2004-12-04 00:55:29.000000000 +0100 | ||
| 1148 | +++ plugins/check_smtp.c 2004-12-04 16:58:37.000000000 +0100 | ||
| 1149 | @@ -218,11 +218,12 @@ | ||
| 1150 | microsec = deltime (tv); | ||
| 1151 | elapsed_time = (double)microsec / 1.0e6; | ||
| 1152 | |||
| 1153 | - if (result == STATE_OK) | ||
| 1154 | + if (result == STATE_OK) { | ||
| 1155 | if (check_critical_time && elapsed_time > (double) critical_time) | ||
| 1156 | result = STATE_CRITICAL; | ||
| 1157 | else if (check_warning_time && elapsed_time > (double) warning_time) | ||
| 1158 | result = STATE_WARNING; | ||
| 1159 | + } | ||
| 1160 | |||
| 1161 | printf (_("SMTP %s - %.3f sec. response time%s%s|%s\n"), | ||
| 1162 | state_text (result), elapsed_time, | ||
| 1163 | diff -urN ../nagiosplug.orig/plugins/check_ssh.c plugins/check_ssh.c | ||
| 1164 | --- ../nagiosplug.orig/plugins/check_ssh.c 2004-12-04 00:55:29.000000000 +0100 | ||
| 1165 | +++ plugins/check_ssh.c 2004-12-04 16:51:10.000000000 +0100 | ||
| 1166 | @@ -44,7 +44,7 @@ | ||
| 1167 | void print_help (void); | ||
| 1168 | void print_usage (void); | ||
| 1169 | |||
| 1170 | -int ssh_connect (char *haddr, int hport, char *remote_version); | ||
| 1171 | +int ssh_connect (char *, int); | ||
| 1172 | |||
| 1173 | |||
| 1174 | |||
| 1175 | @@ -66,7 +66,7 @@ | ||
| 1176 | alarm (socket_timeout); | ||
| 1177 | |||
| 1178 | /* ssh_connect exits if error is found */ | ||
| 1179 | - result = ssh_connect (server_name, port, remote_version); | ||
| 1180 | + result = ssh_connect (server_name, port); | ||
| 1181 | |||
| 1182 | alarm (0); | ||
| 1183 | |||
| 1184 | @@ -197,7 +197,7 @@ | ||
| 1185 | |||
| 1186 | |||
| 1187 | int | ||
| 1188 | -ssh_connect (char *haddr, int hport, char *remote_version) | ||
| 1189 | +ssh_connect (char *haddr, int hport) | ||
| 1190 | { | ||
| 1191 | int sd; | ||
| 1192 | int result; | ||
| 1193 | diff -urN ../nagiosplug.orig/plugins/check_swap.c plugins/check_swap.c | ||
| 1194 | --- ../nagiosplug.orig/plugins/check_swap.c 2004-12-04 01:23:41.000000000 +0100 | ||
| 1195 | +++ plugins/check_swap.c 2004-12-04 17:02:41.000000000 +0100 | ||
| 1196 | @@ -56,10 +56,10 @@ | ||
| 1197 | int result = STATE_UNKNOWN; | ||
| 1198 | char input_buffer[MAX_INPUT_BUFFER]; | ||
| 1199 | char *perf; | ||
| 1200 | - int conv_factor = SWAP_CONVERSION; | ||
| 1201 | #ifdef HAVE_PROC_MEMINFO | ||
| 1202 | FILE *fp; | ||
| 1203 | #else | ||
| 1204 | + int conv_factor = SWAP_CONVERSION; | ||
| 1205 | # ifdef HAVE_SWAP | ||
| 1206 | char *temp_buffer; | ||
| 1207 | char *swap_command; | ||
| 1208 | diff -urN ../nagiosplug.orig/plugins/utils.h plugins/utils.h | ||
| 1209 | --- ../nagiosplug.orig/plugins/utils.h 2004-12-03 18:48:53.000000000 +0100 | ||
| 1210 | +++ plugins/utils.h 2004-12-04 16:40:13.000000000 +0100 | ||
| 1211 | @@ -16,9 +16,9 @@ | ||
| 1212 | /* $Id: utils.h,v 1.21 2004/12/03 17:48:53 opensides Exp $ */ | ||
| 1213 | |||
| 1214 | void support (void); | ||
| 1215 | -char *clean_revstring (const char *revstring); | ||
| 1216 | +char *clean_revstring (const char *); | ||
| 1217 | void print_revision (const char *, const char *); | ||
| 1218 | -void die (int result, const char *fmt, ...) __attribute__((noreturn,format(printf, 2, 3))); | ||
| 1219 | +void die (int, const char *, ...) __attribute__((noreturn,format(printf, 2, 3))); | ||
| 1220 | |||
| 1221 | /* Handle timeouts */ | ||
| 1222 | |||
| 1223 | @@ -57,7 +57,7 @@ | ||
| 1224 | #endif | ||
| 1225 | |||
| 1226 | #ifndef HAVE_GETTIMEOFDAY | ||
| 1227 | -int gettimeofday(struct timeval *tv, struct timezone *tz); | ||
| 1228 | +int gettimeofday(struct timeval *, struct timezone *); | ||
| 1229 | #endif | ||
| 1230 | |||
| 1231 | double delta_time (struct timeval tv); | ||
| 1232 | @@ -65,46 +65,47 @@ | ||
| 1233 | |||
| 1234 | /* Handle strings safely */ | ||
| 1235 | |||
| 1236 | -void strip (char *buffer); | ||
| 1237 | -char *strscpy (char *dest, const char *src); | ||
| 1238 | -char *strnl (char *str); | ||
| 1239 | -char *strpcpy (char *dest, const char *src, const char *str); | ||
| 1240 | -char *strpcat (char *dest, const char *src, const char *str); | ||
| 1241 | +void strip (char *); | ||
| 1242 | +char *strscpy (char *, const char *); | ||
| 1243 | +char *strnl (char *); | ||
| 1244 | +char *strpcpy (char *, const char *, const char *); | ||
| 1245 | +char *strpcat (char *, const char *, const char *); | ||
| 1246 | |||
| 1247 | int max_state (int a, int b); | ||
| 1248 | |||
| 1249 | -void usage (const char *msg) __attribute__((noreturn)); | ||
| 1250 | -void usage2(const char *msg, const char *arg) __attribute__((noreturn)); | ||
| 1251 | -void usage3(const char *msg, int arg) __attribute__((noreturn)); | ||
| 1252 | +void usage (const char *) __attribute__((noreturn)); | ||
| 1253 | +void usage2(const char *, const char *) __attribute__((noreturn)); | ||
| 1254 | +void usage3(const char *, int) __attribute__((noreturn)); | ||
| 1255 | +void usage4(const char *); | ||
| 1256 | |||
| 1257 | -const char *state_text (int result); | ||
| 1258 | +const char *state_text (int); | ||
| 1259 | |||
| 1260 | #define max(a,b) (((a)>(b))?(a):(b)) | ||
| 1261 | #define min(a,b) (((a)<(b))?(a):(b)) | ||
| 1262 | |||
| 1263 | -char *perfdata (const char *label, | ||
| 1264 | - long int val, | ||
| 1265 | - const char *uom, | ||
| 1266 | - int warnp, | ||
| 1267 | - long int warn, | ||
| 1268 | - int critp, | ||
| 1269 | - long int crit, | ||
| 1270 | - int minp, | ||
| 1271 | - long int minv, | ||
| 1272 | - int maxp, | ||
| 1273 | - long int maxv); | ||
| 1274 | - | ||
| 1275 | -char *fperfdata (const char *label, | ||
| 1276 | - double val, | ||
| 1277 | - const char *uom, | ||
| 1278 | - int warnp, | ||
| 1279 | - double warn, | ||
| 1280 | - int critp, | ||
| 1281 | - double crit, | ||
| 1282 | - int minp, | ||
| 1283 | - double minv, | ||
| 1284 | - int maxp, | ||
| 1285 | - double maxv); | ||
| 1286 | +char *perfdata (const char *, | ||
| 1287 | + long int, | ||
| 1288 | + const char *, | ||
| 1289 | + int, | ||
| 1290 | + long int, | ||
| 1291 | + int, | ||
| 1292 | + long int, | ||
| 1293 | + int, | ||
| 1294 | + long int, | ||
| 1295 | + int, | ||
| 1296 | + long int); | ||
| 1297 | + | ||
| 1298 | +char *fperfdata (const char *, | ||
| 1299 | + double, | ||
| 1300 | + const char *, | ||
| 1301 | + int, | ||
| 1302 | + double, | ||
| 1303 | + int, | ||
| 1304 | + double, | ||
| 1305 | + int, | ||
| 1306 | + double, | ||
| 1307 | + int, | ||
| 1308 | + double); | ||
| 1309 | |||
| 1310 | /* The idea here is that, although not every plugin will use all of these, | ||
| 1311 | most will or should. Therefore, for consistency, these very common | ||
diff --git a/web/attachments/111856-check_tcp.c.mismatch.diff b/web/attachments/111856-check_tcp.c.mismatch.diff new file mode 100644 index 0000000..d3a32c6 --- /dev/null +++ b/web/attachments/111856-check_tcp.c.mismatch.diff | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | --- check_tcp.c.orig Thu Dec 9 13:01:37 2004 | ||
| 2 | +++ check_tcp.c Thu Dec 9 16:52:52 2004 | ||
| 3 | @@ -97,6 +97,7 @@ | ||
| 4 | int use_ssl = FALSE; | ||
| 5 | int sd = 0; | ||
| 6 | char *buffer; | ||
| 7 | +int expect_mismatch_state = STATE_WARNING; | ||
| 8 | |||
| 9 | |||
| 10 | |||
| 11 | @@ -333,7 +334,7 @@ | ||
| 12 | if (verbose) | ||
| 13 | printf ("%d %d\n", i, (int)server_expect_count); | ||
| 14 | if (i >= (int)server_expect_count) | ||
| 15 | - die (STATE_WARNING, _("Invalid response from host\n")); | ||
| 16 | + die (expect_mismatch_state, _("Unexpected response from host: %s\n"), status); | ||
| 17 | if (strstr (status, server_expect[i])) | ||
| 18 | break; | ||
| 19 | } | ||
| 20 | @@ -416,6 +417,7 @@ | ||
| 21 | {"jail", required_argument, 0, 'j'}, | ||
| 22 | {"delay", required_argument, 0, 'd'}, | ||
| 23 | {"refuse", required_argument, 0, 'r'}, | ||
| 24 | + {"mismatch", required_argument, 0, 'M'}, | ||
| 25 | {"use-ipv4", no_argument, 0, '4'}, | ||
| 26 | {"use-ipv6", no_argument, 0, '6'}, | ||
| 27 | {"verbose", no_argument, 0, 'v'}, | ||
| 28 | @@ -548,7 +550,17 @@ | ||
| 29 | else if (!strncmp(optarg,"crit",4)) | ||
| 30 | econn_refuse_state = STATE_CRITICAL; | ||
| 31 | else | ||
| 32 | - usage (_("Refuse mut be one of ok, warn, crit\n")); | ||
| 33 | + usage (_("Refuse must be one of ok, warn, crit\n")); | ||
| 34 | + break; | ||
| 35 | + case 'M': | ||
| 36 | + if (!strncmp(optarg,"ok",2)) | ||
| 37 | + expect_mismatch_state = STATE_OK; | ||
| 38 | + else if (!strncmp(optarg,"warn",4)) | ||
| 39 | + expect_mismatch_state = STATE_WARNING; | ||
| 40 | + else if (!strncmp(optarg,"crit",4)) | ||
| 41 | + expect_mismatch_state = STATE_CRITICAL; | ||
| 42 | + else | ||
| 43 | + usage (_("Mismatch must be one of ok, warn, crit\n")); | ||
| 44 | break; | ||
| 45 | case 'd': | ||
| 46 | if (is_intpos (optarg)) | ||
| 47 | @@ -764,6 +776,8 @@ | ||
| 48 | printf (_("\ | ||
| 49 | -r, --refuse=ok|warn|crit\n\ | ||
| 50 | Accept tcp refusals with states ok, warn, crit (default: crit)\n\ | ||
| 51 | + -M, --mismatch=ok|warn|crit\n\ | ||
| 52 | + Accept expect mismatches with states ok, warn, crit (default: warn)\n\ | ||
| 53 | -j, --jail\n\ | ||
| 54 | Hide output from TCP socket\n\ | ||
| 55 | -m, --maxbytes=INTEGER\n\ | ||
| 56 | @@ -798,8 +812,8 @@ | ||
| 57 | Usage: %s -H host -p port [-w <warning time>] [-c <critical time>]\n\ | ||
| 58 | [-s <send string>] [-e <expect string>] [-q <quit string>]\n\ | ||
| 59 | [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\ | ||
| 60 | - [-r <refuse state>] [-v] [-4|-6] [-j] [-D <days to cert expiry>]\n\ | ||
| 61 | - [-S <use SSL>]\n"), progname); | ||
| 62 | + [-r <refuse state>] [-M <mismatch state>] [-v] [-4|-6] [-j]\n\ | ||
| 63 | + [-D <days to cert expiry>] [-S <use SSL>]\n"), progname); | ||
| 64 | printf (" %s (-h|--help)\n", progname); | ||
| 65 | printf (" %s (-V|--version)\n", progname); | ||
| 66 | } | ||
diff --git a/web/attachments/112577-check_smtp.c.patch.cvs.HEAD.20041215 b/web/attachments/112577-check_smtp.c.patch.cvs.HEAD.20041215 new file mode 100644 index 0000000..8dedb8c --- /dev/null +++ b/web/attachments/112577-check_smtp.c.patch.cvs.HEAD.20041215 | |||
| @@ -0,0 +1,504 @@ | |||
| 1 | *** check_smtp.c.orig 2004-12-15 13:08:34.000000000 -0500 | ||
| 2 | --- check_smtp.c 2004-12-15 14:35:05.521604150 -0500 | ||
| 3 | *************** | ||
| 4 | *** 25,45 **** | ||
| 5 | --- 25,77 ---- | ||
| 6 | |||
| 7 | #include "common.h" | ||
| 8 | #include "netutils.h" | ||
| 9 | #include "utils.h" | ||
| 10 | |||
| 11 | + #ifdef HAVE_SSL_H | ||
| 12 | + # include <rsa.h> | ||
| 13 | + # include <crypto.h> | ||
| 14 | + # include <x509.h> | ||
| 15 | + # include <pem.h> | ||
| 16 | + # include <ssl.h> | ||
| 17 | + # include <err.h> | ||
| 18 | + #else | ||
| 19 | + # ifdef HAVE_OPENSSL_SSL_H | ||
| 20 | + # include <openssl/rsa.h> | ||
| 21 | + # include <openssl/crypto.h> | ||
| 22 | + # include <openssl/x509.h> | ||
| 23 | + # include <openssl/pem.h> | ||
| 24 | + # include <openssl/ssl.h> | ||
| 25 | + # include <openssl/err.h> | ||
| 26 | + # endif | ||
| 27 | + #endif | ||
| 28 | + | ||
| 29 | + #ifdef HAVE_SSL | ||
| 30 | + | ||
| 31 | + int check_cert = FALSE; | ||
| 32 | + int days_till_exp; | ||
| 33 | + SSL_CTX *ctx; | ||
| 34 | + SSL *ssl; | ||
| 35 | + X509 *server_cert; | ||
| 36 | + int connect_STARTTLS (void); | ||
| 37 | + int check_certificate (X509 **); | ||
| 38 | + #endif | ||
| 39 | + | ||
| 40 | enum { | ||
| 41 | SMTP_PORT = 25 | ||
| 42 | }; | ||
| 43 | const char *SMTP_EXPECT = "220"; | ||
| 44 | const char *SMTP_HELO = "HELO "; | ||
| 45 | const char *SMTP_QUIT = "QUIT\r\n"; | ||
| 46 | + const char *SMTP_STARTTLS = "STARTTLS\r\n"; | ||
| 47 | |||
| 48 | int process_arguments (int, char **); | ||
| 49 | int validate_arguments (void); | ||
| 50 | void print_help (void); | ||
| 51 | void print_usage (void); | ||
| 52 | + int myrecv(void); | ||
| 53 | + int my_close(void); | ||
| 54 | |||
| 55 | #ifdef HAVE_REGEX_H | ||
| 56 | #include <regex.h> | ||
| 57 | char regex_expect[MAX_INPUT_BUFFER] = ""; | ||
| 58 | regex_t preg; | ||
| 59 | *************** | ||
| 60 | *** 66,87 **** | ||
| 61 | int warning_time = 0; | ||
| 62 | int check_warning_time = FALSE; | ||
| 63 | int critical_time = 0; | ||
| 64 | int check_critical_time = FALSE; | ||
| 65 | int verbose = 0; | ||
| 66 | ! | ||
| 67 | ! | ||
| 68 | |||
| 69 | int | ||
| 70 | main (int argc, char **argv) | ||
| 71 | { | ||
| 72 | ! int sd; | ||
| 73 | int n = 0; | ||
| 74 | double elapsed_time; | ||
| 75 | long microsec; | ||
| 76 | int result = STATE_UNKNOWN; | ||
| 77 | - char buffer[MAX_INPUT_BUFFER]; | ||
| 78 | char *cmd_str = NULL; | ||
| 79 | char *helocmd = NULL; | ||
| 80 | struct timeval tv; | ||
| 81 | |||
| 82 | setlocale (LC_ALL, ""); | ||
| 83 | --- 98,124 ---- | ||
| 84 | int warning_time = 0; | ||
| 85 | int check_warning_time = FALSE; | ||
| 86 | int critical_time = 0; | ||
| 87 | int check_critical_time = FALSE; | ||
| 88 | int verbose = 0; | ||
| 89 | ! int use_ssl = FALSE; | ||
| 90 | ! int sd; | ||
| 91 | ! char buffer[MAX_INPUT_BUFFER]; | ||
| 92 | ! enum { | ||
| 93 | ! TCP_PROTOCOL = 1, | ||
| 94 | ! UDP_PROTOCOL = 2, | ||
| 95 | ! MAXBUF = 1024 | ||
| 96 | ! }; | ||
| 97 | |||
| 98 | int | ||
| 99 | main (int argc, char **argv) | ||
| 100 | { | ||
| 101 | ! | ||
| 102 | int n = 0; | ||
| 103 | double elapsed_time; | ||
| 104 | long microsec; | ||
| 105 | int result = STATE_UNKNOWN; | ||
| 106 | char *cmd_str = NULL; | ||
| 107 | char *helocmd = NULL; | ||
| 108 | struct timeval tv; | ||
| 109 | |||
| 110 | setlocale (LC_ALL, ""); | ||
| 111 | *************** | ||
| 112 | *** 138,153 **** | ||
| 113 | printf (_("Invalid SMTP response received from host on port %d\n"), | ||
| 114 | server_port); | ||
| 115 | result = STATE_WARNING; | ||
| 116 | } | ||
| 117 | } | ||
| 118 | ! | ||
| 119 | /* send the HELO command */ | ||
| 120 | send(sd, helocmd, strlen(helocmd), 0); | ||
| 121 | |||
| 122 | /* allow for response to helo command to reach us */ | ||
| 123 | ! recv(sd, buffer, MAX_INPUT_BUFFER-1, 0); | ||
| 124 | |||
| 125 | /* sendmail will syslog a "NOQUEUE" error if session does not attempt | ||
| 126 | * to do something useful. This can be prevented by giving a command | ||
| 127 | * even if syntax is illegal (MAIL requires a FROM:<...> argument) | ||
| 128 | * | ||
| 129 | --- 175,223 ---- | ||
| 130 | printf (_("Invalid SMTP response received from host on port %d\n"), | ||
| 131 | server_port); | ||
| 132 | result = STATE_WARNING; | ||
| 133 | } | ||
| 134 | } | ||
| 135 | ! #ifdef HAVE_SSL | ||
| 136 | ! if(use_ssl) { | ||
| 137 | ! /* send the STARTTLS command */ | ||
| 138 | ! send(sd, SMTP_STARTTLS, strlen(SMTP_STARTTLS), 0); | ||
| 139 | ! | ||
| 140 | ! recv(sd,buffer, MAX_INPUT_BUFFER-1, 0); // wait for it | ||
| 141 | ! if (!strstr (buffer, server_expect)) { | ||
| 142 | ! printf (_("Server does not support STARTTLS\n")); | ||
| 143 | ! return STATE_UNKNOWN; | ||
| 144 | ! } | ||
| 145 | ! if(connect_STARTTLS() != OK) { | ||
| 146 | ! printf (_("ERROR: Cannot create SSL context.\n")); | ||
| 147 | ! return STATE_CRITICAL; | ||
| 148 | ! } | ||
| 149 | ! if ( check_cert ) { | ||
| 150 | ! if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) { | ||
| 151 | ! result = check_certificate (&server_cert); | ||
| 152 | ! X509_free(server_cert); | ||
| 153 | ! } | ||
| 154 | ! else { | ||
| 155 | ! printf (_("ERROR: Cannot retrieve server certificate.\n")); | ||
| 156 | ! result = STATE_CRITICAL; | ||
| 157 | ! | ||
| 158 | ! } | ||
| 159 | ! my_close(); | ||
| 160 | ! return result; | ||
| 161 | ! } | ||
| 162 | ! } | ||
| 163 | ! #endif | ||
| 164 | /* send the HELO command */ | ||
| 165 | + #ifdef HAVE_SSL | ||
| 166 | + if (use_ssl) | ||
| 167 | + SSL_write(ssl, helocmd, strlen(helocmd)); | ||
| 168 | + else | ||
| 169 | + #endif | ||
| 170 | send(sd, helocmd, strlen(helocmd), 0); | ||
| 171 | |||
| 172 | /* allow for response to helo command to reach us */ | ||
| 173 | ! myrecv(); | ||
| 174 | |||
| 175 | /* sendmail will syslog a "NOQUEUE" error if session does not attempt | ||
| 176 | * to do something useful. This can be prevented by giving a command | ||
| 177 | * even if syntax is illegal (MAIL requires a FROM:<...> argument) | ||
| 178 | * | ||
| 179 | *************** | ||
| 180 | *** 156,175 **** | ||
| 181 | * | ||
| 182 | * You can disable sending mail_command with '--nocommand' | ||
| 183 | * Use the -f option to provide a FROM address | ||
| 184 | */ | ||
| 185 | if (smtp_use_dummycmd) { | ||
| 186 | ! send(sd, cmd_str, strlen(cmd_str), 0); | ||
| 187 | ! recv(sd, buffer, MAX_INPUT_BUFFER-1, 0); | ||
| 188 | ! if (verbose) | ||
| 189 | ! printf("%s", buffer); | ||
| 190 | } | ||
| 191 | |||
| 192 | while (n < ncommands) { | ||
| 193 | asprintf (&cmd_str, "%s%s", commands[n], "\r\n"); | ||
| 194 | send(sd, cmd_str, strlen(cmd_str), 0); | ||
| 195 | ! recv(sd, buffer, MAX_INPUT_BUFFER-1, 0); | ||
| 196 | if (verbose) | ||
| 197 | printf("%s", buffer); | ||
| 198 | strip (buffer); | ||
| 199 | if (n < nresponses) { | ||
| 200 | #ifdef HAVE_REGEX_H | ||
| 201 | --- 226,255 ---- | ||
| 202 | * | ||
| 203 | * You can disable sending mail_command with '--nocommand' | ||
| 204 | * Use the -f option to provide a FROM address | ||
| 205 | */ | ||
| 206 | if (smtp_use_dummycmd) { | ||
| 207 | ! #ifdef HAVE_SSL | ||
| 208 | ! if (use_ssl) | ||
| 209 | ! SSL_write(ssl, cmd_str, strlen(cmd_str)); | ||
| 210 | ! else | ||
| 211 | ! #endif | ||
| 212 | ! send(sd, cmd_str, strlen(cmd_str), 0); | ||
| 213 | ! myrecv(); | ||
| 214 | ! if (verbose) | ||
| 215 | ! printf("%s", buffer); | ||
| 216 | } | ||
| 217 | |||
| 218 | while (n < ncommands) { | ||
| 219 | asprintf (&cmd_str, "%s%s", commands[n], "\r\n"); | ||
| 220 | + #ifdef HAVE_SSL | ||
| 221 | + if (use_ssl) | ||
| 222 | + SSL_write(ssl,cmd_str, strlen(cmd_str)); | ||
| 223 | + else | ||
| 224 | + #endif | ||
| 225 | send(sd, cmd_str, strlen(cmd_str), 0); | ||
| 226 | ! myrecv(); | ||
| 227 | if (verbose) | ||
| 228 | printf("%s", buffer); | ||
| 229 | strip (buffer); | ||
| 230 | if (n < nresponses) { | ||
| 231 | #ifdef HAVE_REGEX_H | ||
| 232 | *************** | ||
| 233 | *** 204,213 **** | ||
| 234 | --- 284,298 ---- | ||
| 235 | } | ||
| 236 | n++; | ||
| 237 | } | ||
| 238 | |||
| 239 | /* tell the server we're done */ | ||
| 240 | + #ifdef HAVE_SSL | ||
| 241 | + if (use_ssl) | ||
| 242 | + SSL_write(ssl,SMTP_QUIT, strlen (SMTP_QUIT)); | ||
| 243 | + else | ||
| 244 | + #endif | ||
| 245 | send (sd, SMTP_QUIT, strlen (SMTP_QUIT), 0); | ||
| 246 | |||
| 247 | /* finally close the connection */ | ||
| 248 | close (sd); | ||
| 249 | } | ||
| 250 | *************** | ||
| 251 | *** 259,268 **** | ||
| 252 | --- 344,355 ---- | ||
| 253 | {"verbose", no_argument, 0, 'v'}, | ||
| 254 | {"version", no_argument, 0, 'V'}, | ||
| 255 | {"use-ipv4", no_argument, 0, '4'}, | ||
| 256 | {"use-ipv6", no_argument, 0, '6'}, | ||
| 257 | {"help", no_argument, 0, 'h'}, | ||
| 258 | + {"starttls",no_argument,0,'S'}, | ||
| 259 | + {"certificate",required_argument,0,'D'}, | ||
| 260 | {0, 0, 0, 0} | ||
| 261 | }; | ||
| 262 | |||
| 263 | if (argc < 2) | ||
| 264 | return ERROR; | ||
| 265 | *************** | ||
| 266 | *** 275,285 **** | ||
| 267 | else if (strcmp ("-ct", argv[c]) == 0) | ||
| 268 | strcpy (argv[c], "-c"); | ||
| 269 | } | ||
| 270 | |||
| 271 | while (1) { | ||
| 272 | ! c = getopt_long (argc, argv, "+hVv46t:p:f:e:c:w:H:C:R:", | ||
| 273 | longopts, &option); | ||
| 274 | |||
| 275 | if (c == -1 || c == EOF) | ||
| 276 | break; | ||
| 277 | |||
| 278 | --- 362,372 ---- | ||
| 279 | else if (strcmp ("-ct", argv[c]) == 0) | ||
| 280 | strcpy (argv[c], "-c"); | ||
| 281 | } | ||
| 282 | |||
| 283 | while (1) { | ||
| 284 | ! c = getopt_long (argc, argv, "+hVv46t:p:f:e:c:w:H:C:R:SD:", | ||
| 285 | longopts, &option); | ||
| 286 | |||
| 287 | if (c == -1 || c == EOF) | ||
| 288 | break; | ||
| 289 | |||
| 290 | *************** | ||
| 291 | *** 352,361 **** | ||
| 292 | --- 439,464 ---- | ||
| 293 | } | ||
| 294 | else { | ||
| 295 | usage4 (_("Time interval must be a positive integer")); | ||
| 296 | } | ||
| 297 | break; | ||
| 298 | + case 'S': | ||
| 299 | + /* starttls */ | ||
| 300 | + use_ssl = TRUE; | ||
| 301 | + break; | ||
| 302 | + case 'D': | ||
| 303 | + /* Check SSL cert validity */ | ||
| 304 | + #ifdef HAVE_SSL | ||
| 305 | + if (!is_intnonneg (optarg)) | ||
| 306 | + usage2 ("invalid certificate expiration period",optarg); | ||
| 307 | + days_till_exp = atoi (optarg); | ||
| 308 | + check_cert = TRUE; | ||
| 309 | + #else | ||
| 310 | + terminate (STATE_UNKNOWN, | ||
| 311 | + "SSL support not available. Install OpenSSL and recompile."); | ||
| 312 | + #endif | ||
| 313 | + break; | ||
| 314 | case '4': | ||
| 315 | address_family = AF_INET; | ||
| 316 | break; | ||
| 317 | case '6': | ||
| 318 | #ifdef USE_IPV6 | ||
| 319 | *************** | ||
| 320 | *** 443,452 **** | ||
| 321 | --- 546,562 ---- | ||
| 322 | -R, --command=STRING\n\ | ||
| 323 | Expected response to command (may be used repeatedly)\n\ | ||
| 324 | -f, --from=STRING\n\ | ||
| 325 | FROM-address to include in MAIL command, required by Exchange 2000\n"), | ||
| 326 | SMTP_EXPECT); | ||
| 327 | + #ifdef HAVE_SSL | ||
| 328 | + printf (_("\ | ||
| 329 | + -D, --certificate=INTEGER\n\ | ||
| 330 | + Minimum number of days a certificate has to be valid.\n\ | ||
| 331 | + -S, --starttls\n\ | ||
| 332 | + Use STARTTLS for the connection.\n")); | ||
| 333 | + #endif | ||
| 334 | |||
| 335 | printf (_(UT_WARN_CRIT)); | ||
| 336 | |||
| 337 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
| 338 | |||
| 339 | *************** | ||
| 340 | *** 466,472 **** | ||
| 341 | void | ||
| 342 | print_usage (void) | ||
| 343 | { | ||
| 344 | printf ("\ | ||
| 345 | Usage: %s -H host [-p port] [-e expect] [-C command] [-f from addr]\n\ | ||
| 346 | ! [-w warn] [-c crit] [-t timeout] [-n] [-v] [-4|-6]\n", progname); | ||
| 347 | } | ||
| 348 | --- 576,731 ---- | ||
| 349 | void | ||
| 350 | print_usage (void) | ||
| 351 | { | ||
| 352 | printf ("\ | ||
| 353 | Usage: %s -H host [-p port] [-e expect] [-C command] [-f from addr]\n\ | ||
| 354 | ! [-w warn] [-c crit] [-t timeout] [-S] [-D days] [-n] [-v] [-4|-6]\n", progname); | ||
| 355 | ! } | ||
| 356 | ! | ||
| 357 | ! #ifdef HAVE_SSL | ||
| 358 | ! int | ||
| 359 | ! connect_STARTTLS (void) | ||
| 360 | ! { | ||
| 361 | ! SSL_METHOD *meth; | ||
| 362 | ! | ||
| 363 | ! /* Initialize SSL context */ | ||
| 364 | ! SSLeay_add_ssl_algorithms (); | ||
| 365 | ! meth = SSLv2_client_method (); | ||
| 366 | ! SSL_load_error_strings (); | ||
| 367 | ! if ((ctx = SSL_CTX_new (meth)) == NULL) | ||
| 368 | ! { | ||
| 369 | ! printf(_("ERROR: Cannot create SSL context.\n")); | ||
| 370 | ! return STATE_CRITICAL; | ||
| 371 | ! } | ||
| 372 | ! /* do the SSL handshake */ | ||
| 373 | ! if ((ssl = SSL_new (ctx)) != NULL) | ||
| 374 | ! { | ||
| 375 | ! SSL_set_fd (ssl, sd); | ||
| 376 | ! /* original version checked for -1 | ||
| 377 | ! I look for success instead (1) */ | ||
| 378 | ! if (SSL_connect (ssl) == 1) | ||
| 379 | ! return OK; | ||
| 380 | ! ERR_print_errors_fp (stderr); | ||
| 381 | ! } | ||
| 382 | ! else | ||
| 383 | ! { | ||
| 384 | ! printf (_("ERROR: Cannot initiate SSL handshake.\n")); | ||
| 385 | ! } | ||
| 386 | ! /* this causes a seg faul | ||
| 387 | ! not sure why, being sloppy | ||
| 388 | ! and commenting it out */ | ||
| 389 | ! // SSL_free (ssl); | ||
| 390 | ! SSL_CTX_free(ctx); | ||
| 391 | ! my_close(); | ||
| 392 | ! | ||
| 393 | ! return STATE_CRITICAL; | ||
| 394 | ! } | ||
| 395 | ! | ||
| 396 | ! int | ||
| 397 | ! check_certificate (X509 ** certificate) | ||
| 398 | ! { | ||
| 399 | ! ASN1_STRING *tm; | ||
| 400 | ! int offset; | ||
| 401 | ! struct tm stamp; | ||
| 402 | ! int days_left; | ||
| 403 | ! | ||
| 404 | ! /* Retrieve timestamp of certificate */ | ||
| 405 | ! tm = X509_get_notAfter (*certificate); | ||
| 406 | ! | ||
| 407 | ! /* Generate tm structure to process timestamp */ | ||
| 408 | ! if (tm->type == V_ASN1_UTCTIME) { | ||
| 409 | ! if (tm->length < 10) { | ||
| 410 | ! printf (_("ERROR: Wrong time format in certificate.\n")); | ||
| 411 | ! return STATE_CRITICAL; | ||
| 412 | ! } | ||
| 413 | ! else { | ||
| 414 | ! stamp.tm_year = (tm->data[0] - '0') * 10 + (tm->data[1] - '0'); | ||
| 415 | ! if (stamp.tm_year < 50) | ||
| 416 | ! stamp.tm_year += 100; | ||
| 417 | ! offset = 0; | ||
| 418 | ! } | ||
| 419 | ! } | ||
| 420 | ! else { | ||
| 421 | ! if (tm->length < 12) { | ||
| 422 | ! printf (_("ERROR: Wrong time format in certificate.\n")); | ||
| 423 | ! return STATE_CRITICAL; | ||
| 424 | ! } | ||
| 425 | ! else { | ||
| 426 | ! stamp.tm_year = | ||
| 427 | ! (tm->data[0] - '0') * 1000 + (tm->data[1] - '0') * 100 + | ||
| 428 | ! (tm->data[2] - '0') * 10 + (tm->data[3] - '0'); | ||
| 429 | ! stamp.tm_year -= 1900; | ||
| 430 | ! offset = 2; | ||
| 431 | ! } | ||
| 432 | ! } | ||
| 433 | ! stamp.tm_mon = | ||
| 434 | ! (tm->data[2 + offset] - '0') * 10 + (tm->data[3 + offset] - '0') - 1; | ||
| 435 | ! stamp.tm_mday = | ||
| 436 | ! (tm->data[4 + offset] - '0') * 10 + (tm->data[5 + offset] - '0'); | ||
| 437 | ! stamp.tm_hour = | ||
| 438 | ! (tm->data[6 + offset] - '0') * 10 + (tm->data[7 + offset] - '0'); | ||
| 439 | ! stamp.tm_min = | ||
| 440 | ! (tm->data[8 + offset] - '0') * 10 + (tm->data[9 + offset] - '0'); | ||
| 441 | ! stamp.tm_sec = 0; | ||
| 442 | ! stamp.tm_isdst = -1; | ||
| 443 | ! | ||
| 444 | ! days_left = (mktime (&stamp) - time (NULL)) / 86400; | ||
| 445 | ! snprintf | ||
| 446 | ! (timestamp, 16, "%02d/%02d/%04d %02d:%02d", | ||
| 447 | ! stamp.tm_mon + 1, | ||
| 448 | ! stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min); | ||
| 449 | ! | ||
| 450 | ! if (days_left > 0 && days_left <= days_till_exp) { | ||
| 451 | ! printf ("Certificate expires in %d day(s) (%s).\n", days_left, timestamp); | ||
| 452 | ! return STATE_WARNING; | ||
| 453 | ! } | ||
| 454 | ! if (days_left < 0) { | ||
| 455 | ! printf ("Certificate expired on %s.\n", timestamp); | ||
| 456 | ! return STATE_CRITICAL; | ||
| 457 | ! } | ||
| 458 | ! | ||
| 459 | ! if (days_left == 0) { | ||
| 460 | ! printf ("Certificate expires today (%s).\n", timestamp); | ||
| 461 | ! return STATE_WARNING; | ||
| 462 | ! } | ||
| 463 | ! | ||
| 464 | ! printf ("Certificate will expire on %s.\n", timestamp); | ||
| 465 | ! | ||
| 466 | ! return STATE_OK; | ||
| 467 | ! } | ||
| 468 | ! #endif | ||
| 469 | ! | ||
| 470 | ! int | ||
| 471 | ! myrecv (void) | ||
| 472 | ! { | ||
| 473 | ! int i; | ||
| 474 | ! | ||
| 475 | ! #ifdef HAVE_SSL | ||
| 476 | ! if (use_ssl) { | ||
| 477 | ! i = SSL_read (ssl, buffer, MAXBUF - 1); | ||
| 478 | ! } | ||
| 479 | ! else { | ||
| 480 | ! #endif | ||
| 481 | ! i = read (sd, buffer, MAXBUF - 1); | ||
| 482 | ! #ifdef HAVE_SSL | ||
| 483 | ! } | ||
| 484 | ! #endif | ||
| 485 | ! return i; | ||
| 486 | ! } | ||
| 487 | ! | ||
| 488 | ! int | ||
| 489 | ! my_close (void) | ||
| 490 | ! { | ||
| 491 | ! #ifdef HAVE_SSL | ||
| 492 | ! if (use_ssl == TRUE) { | ||
| 493 | ! SSL_shutdown (ssl); | ||
| 494 | ! SSL_free (ssl); | ||
| 495 | ! SSL_CTX_free (ctx); | ||
| 496 | ! return 0; | ||
| 497 | ! } | ||
| 498 | ! else { | ||
| 499 | ! #endif | ||
| 500 | ! return close(sd); | ||
| 501 | ! #ifdef HAVE_SSL | ||
| 502 | ! } | ||
| 503 | ! #endif | ||
| 504 | } | ||
diff --git a/web/attachments/112620-check_range.patch b/web/attachments/112620-check_range.patch new file mode 100644 index 0000000..2ddd8a3 --- /dev/null +++ b/web/attachments/112620-check_range.patch | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | ? plugins-scripts/t/utils.pm.t | ||
| 2 | Index: test.pl.in | ||
| 3 | =================================================================== | ||
| 4 | RCS file: /cvsroot/nagiosplug/nagiosplug/test.pl.in,v | ||
| 5 | retrieving revision 1.2 | ||
| 6 | diff -u -w -u -r1.2 test.pl.in | ||
| 7 | --- test.pl.in 25 Nov 2004 05:06:24 -0000 1.2 | ||
| 8 | +++ test.pl.in 15 Dec 2004 23:59:46 -0000 | ||
| 9 | @@ -69,7 +69,7 @@ | ||
| 10 | $tstdir = './t' unless ($tstdir); | ||
| 11 | opendir(DIR, $tstdir) || die "can't opendir $tstdir: $!"; | ||
| 12 | while ($file = readdir(DIR)) { | ||
| 13 | - push @dots, "$tstdir/$file" if ($file =~ m/^[^\.]+\.t$/); | ||
| 14 | + push @dots, "$tstdir/$file" if ($file =~ m/^[^\.]+.*\.t$/); | ||
| 15 | } | ||
| 16 | closedir DIR; | ||
| 17 | } | ||
| 18 | Index: plugins-scripts/utils.pm.in | ||
| 19 | =================================================================== | ||
| 20 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins-scripts/utils.pm.in,v | ||
| 21 | retrieving revision 1.7 | ||
| 22 | diff -u -w -u -r1.7 utils.pm.in | ||
| 23 | --- plugins-scripts/utils.pm.in 13 Apr 2003 04:25:36 -0000 1.7 | ||
| 24 | +++ plugins-scripts/utils.pm.in 15 Dec 2004 23:59:46 -0000 | ||
| 25 | @@ -25,13 +25,14 @@ | ||
| 26 | |||
| 27 | require Exporter; | ||
| 28 | @ISA = qw(Exporter); | ||
| 29 | -@EXPORT_OK = qw($TIMEOUT %ERRORS &print_revision &support &usage); | ||
| 30 | +@EXPORT_OK = qw($TIMEOUT %ERRORS &print_revision &support &usage &check_range); | ||
| 31 | |||
| 32 | #use strict; | ||
| 33 | #use vars($TIMEOUT %ERRORS); | ||
| 34 | sub print_revision ($$); | ||
| 35 | sub usage; | ||
| 36 | sub support(); | ||
| 37 | +sub check_range($$); | ||
| 38 | sub is_hostname; | ||
| 39 | |||
| 40 | ## updated by autoconf | ||
| 41 | @@ -80,4 +81,75 @@ | ||
| 42 | } | ||
| 43 | } | ||
| 44 | |||
| 45 | +sub check_range ($$) | ||
| 46 | +{ | ||
| 47 | + # Takes two parameters. The first is a metric. The second is | ||
| 48 | + # a range using Nagios plugin range syntax. | ||
| 49 | + # No explicit checking is done that the metric or the range consists | ||
| 50 | + # of non-numeric values - they will be treated as zero. | ||
| 51 | + | ||
| 52 | + # Accepts ranges of the following form: | ||
| 53 | + # | ||
| 54 | + # min:max (between min and max inclusive) | ||
| 55 | + # min: (equivalent to min:infinity) | ||
| 56 | + # :max (equivalent to 0:max) | ||
| 57 | + # max (equivalent :max which is equivalent to 0:max) | ||
| 58 | + # 0 (equivalent to 0:infinity) | ||
| 59 | + # | ||
| 60 | + # The symbol ~ may be specified as the minimum portion of a range | ||
| 61 | + # to represent -infinity. The range may be prefixed by @ to negate | ||
| 62 | + # the result (so the metric is critical if within the range). | ||
| 63 | + # Note that ~:~ is treated as an invalid range | ||
| 64 | + | ||
| 65 | + my($metric) = shift(@_); | ||
| 66 | + my($range) = shift(@_); | ||
| 67 | + | ||
| 68 | + # Take third and any subsequent parameters and concatenate with spaces | ||
| 69 | + # to form the name of the range for use in error messages. | ||
| 70 | + my($range_name) = join(' ', @_); | ||
| 71 | + $range_name = " for $range_name." if ($range_name); | ||
| 72 | + | ||
| 73 | + # Use strict doesn't let us do string/numeric conversions, so turn | ||
| 74 | + # off warnings to get around that problem and the problem of undefined | ||
| 75 | + # variables from the regex below. | ||
| 76 | + local($^W) = 0; | ||
| 77 | + | ||
| 78 | + my($range_ok) = 0; | ||
| 79 | + | ||
| 80 | + # Split the range into the optional 'invert range' prefix (@), minimum | ||
| 81 | + # bound and upper bound, allowing all the variations. | ||
| 82 | + my($invert_range, $lower, $upper) = $range =~ /^(\@)?(?:([^:])*:)?(.*)?$/; | ||
| 83 | + | ||
| 84 | + # The above regex has problems with 0 (which means 0:infinity), so | ||
| 85 | + # we have to correct for that (but not for :0, which means 0:0 and is | ||
| 86 | + # handled correctly by the regex). | ||
| 87 | + ($lower, $upper) = ($upper, $lower) if | ||
| 88 | + (($upper eq '0' and not $lower) and $range !~ /:/); | ||
| 89 | + | ||
| 90 | + # Check that upper >= lower, including the case when lower or upper is | ||
| 91 | + # ~ (negative infinity). | ||
| 92 | + if ($upper eq '~' or ($lower ne '~' and $upper ne '' and $lower > $upper )) | ||
| 93 | + { | ||
| 94 | + return -1; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + # If the lower bound is not ~ (negative infinity) then check that the | ||
| 98 | + # metric is greater than or equal to the lower bound. If the lower bound | ||
| 99 | + # is ~ then the metric has to be OK because any metric has to be higher | ||
| 100 | + # than negative infinity. | ||
| 101 | + if ($lower ne '~') | ||
| 102 | + { | ||
| 103 | + $range_ok++ if ($metric >= $lower + 0); | ||
| 104 | + } | ||
| 105 | + else | ||
| 106 | + { | ||
| 107 | + $range_ok++; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + $range_ok = 0 if ($upper ne '' and $metric > $upper + 0); | ||
| 111 | + $range_ok ^= 1 if ($invert_range); | ||
| 112 | + | ||
| 113 | + return($range_ok); | ||
| 114 | +} | ||
| 115 | + | ||
| 116 | 1; | ||
diff --git a/web/attachments/112621-utils.pm.t b/web/attachments/112621-utils.pm.t new file mode 100644 index 0000000..630985c --- /dev/null +++ b/web/attachments/112621-utils.pm.t | |||
| @@ -0,0 +1,141 @@ | |||
| 1 | #! /usr/bin/perl -w | ||
| 2 | BEGIN {use File::Basename; use lib(dirname($0) . "/.."); } | ||
| 3 | |||
| 4 | use strict; | ||
| 5 | use Test::Simple tests => 80; | ||
| 6 | use utils qw(&check_range); | ||
| 7 | |||
| 8 | |||
| 9 | my @tests = | ||
| 10 | ( | ||
| 11 | # Format: [metric, range, name, expected result] | ||
| 12 | # | ||
| 13 | # 'Expected result' is the result expected from check_range: 0 if | ||
| 14 | # check_range should return 0 (metric is outside of range), 1 if | ||
| 15 | # check_range should return 1 (metric is inside range). The expected | ||
| 16 | # result can also be -1, indicating that check_range should exit with | ||
| 17 | # plugin error code of 'UNKNOWN' after a usage error (caused by an | ||
| 18 | # invalid range). | ||
| 19 | |||
| 20 | # Check min:max ranges | ||
| 21 | [-1, '2:4', 'Test 1', 0], | ||
| 22 | [0, '2:4', 'Test 2', 0], | ||
| 23 | [1, '2:4', 'Test 3', 0], | ||
| 24 | [2, '2:4', 'Test 4', 1], | ||
| 25 | [3, '2:4', 'Test 5', 1], | ||
| 26 | [4, '2:4', 'Test 6', 1], | ||
| 27 | [5, '2:4', 'Test 7', 0], | ||
| 28 | |||
| 29 | # Check max ranges | ||
| 30 | [-1, 2, 'Test 8', 0], | ||
| 31 | [0, 2, 'Test 9', 1], | ||
| 32 | [1, 2, 'Test 10', 1], | ||
| 33 | [2, 2, 'Test 11', 1], | ||
| 34 | [3, 2, 'Test 12', 0], | ||
| 35 | |||
| 36 | # Check :max ranges | ||
| 37 | [-1, ':2', 'Test 13', 0], | ||
| 38 | [0, ':2', 'Test 14', 1], | ||
| 39 | [1, ':2', 'Test 15', 1], | ||
| 40 | [2, ':2', 'Test 16', 1], | ||
| 41 | [3, ':2', 'Test 17', 0], | ||
| 42 | [-1, '1:', 'Test 18', 0], | ||
| 43 | |||
| 44 | # Check min: ranges | ||
| 45 | [0, '1:', 'Test 19', 0], | ||
| 46 | [1, '1:', 'Test 20', 1], | ||
| 47 | [2, '1:', 'Test 21', 1], | ||
| 48 | |||
| 49 | # Check 0 | ||
| 50 | [-1, 0, 'Test 22', 0], | ||
| 51 | [0, 0, 'Test 23', 1], | ||
| 52 | [1, 0, 'Test 24', 1], | ||
| 53 | |||
| 54 | # Check ~:max ranges | ||
| 55 | [-1, '~:1', 'Test 25', 1], | ||
| 56 | [0, '~:1', 'Test 26', 1], | ||
| 57 | [1, '~:1', 'Test 27', 1], | ||
| 58 | [2, '~:1', 'Test 28', 0], | ||
| 59 | |||
| 60 | # Check min:max ranges where min and max are the same, including :0 | ||
| 61 | # which should be equivalent to 0:0. | ||
| 62 | [-1, '1:1', 'Test 29', 0], | ||
| 63 | [0, '1:1', 'Test 30', 0], | ||
| 64 | [1, '1:1', 'Test 31', 1], | ||
| 65 | [2, '1:1', 'Test 32', 0], | ||
| 66 | [-1, '0:0', 'Test 33', 0], | ||
| 67 | [0, '0:0', 'Test 34', 1], | ||
| 68 | [1, '0:0', 'Test 35', 0], | ||
| 69 | [-1, ':0', 'Test 36', 0], | ||
| 70 | [0, ':0', 'Test 37', 1], | ||
| 71 | [1, ':0', 'Test 38', 0], | ||
| 72 | |||
| 73 | # Check min:max ranges which are invalid | ||
| 74 | [1, '4:2', 'Test 39', -1], | ||
| 75 | [1, '~:~', 'Test 40', -1], | ||
| 76 | |||
| 77 | # Check @min:max ranges | ||
| 78 | [-1, '@2:4', 'Test 1', 1], | ||
| 79 | [0, '@2:4', 'Test 2', 1], | ||
| 80 | [1, '@2:4', 'Test 3', 1], | ||
| 81 | [2, '@2:4', 'Test 4', 0], | ||
| 82 | [3, '@2:4', 'Test 5', 0], | ||
| 83 | [4, '@2:4', 'Test 6', 0], | ||
| 84 | [5, '@2:4', 'Test 7', 1], | ||
| 85 | |||
| 86 | # Check @max ranges | ||
| 87 | [-1, '@2', 'Test 8', 1], | ||
| 88 | [0, '@2', 'Test 9', 0], | ||
| 89 | [1, '@2', 'Test 10', 0], | ||
| 90 | [2, '@2', 'Test 11', 0], | ||
| 91 | [3, '@2', 'Test 12', 1], | ||
| 92 | |||
| 93 | # Check @:max ranges | ||
| 94 | [-1, '@:2', 'Test 13', 1], | ||
| 95 | [0, '@:2', 'Test 14', 0], | ||
| 96 | [1, '@:2', 'Test 15', 0], | ||
| 97 | [2, '@:2', 'Test 16', 0], | ||
| 98 | [3, '@:2', 'Test 17', 1], | ||
| 99 | [-1, '@1:', 'Test 18', 1], | ||
| 100 | |||
| 101 | # Check @min: ranges | ||
| 102 | [0, '@1:', 'Test 19', 1], | ||
| 103 | [1, '@1:', 'Test 20', 0], | ||
| 104 | [2, '@1:', 'Test 21', 0], | ||
| 105 | |||
| 106 | # Check @0 | ||
| 107 | [-1, '@0', 'Test 22', 1], | ||
| 108 | [0, '@0', 'Test 23', 0], | ||
| 109 | [1, '@0', 'Test 24', 0], | ||
| 110 | |||
| 111 | # Check @~:max ranges | ||
| 112 | [-1, '@~:1', 'Test 25', 0], | ||
| 113 | [0, '@~:1', 'Test 26', 0], | ||
| 114 | [1, '@~:1', 'Test 27', 0], | ||
| 115 | [2, '@~:1', 'Test 28', 1], | ||
| 116 | |||
| 117 | # Check @min:max ranges where min and max are the same, including @:0 | ||
| 118 | # which should be equivalent to @0:0. | ||
| 119 | [-1, '@1:1', 'Test 29', 1], | ||
| 120 | [0, '@1:1', 'Test 30', 1], | ||
| 121 | [1, '@1:1', 'Test 31', 0], | ||
| 122 | [2, '@1:1', 'Test 32', 1], | ||
| 123 | [-1, '@0:0', 'Test 33', 1], | ||
| 124 | [0, '@0:0', 'Test 34', 0], | ||
| 125 | [1, '@0:0', 'Test 35', 1], | ||
| 126 | [-1, '@:0', 'Test 36', 1], | ||
| 127 | [0, '@:0', 'Test 37', 0], | ||
| 128 | [1, '@:0', 'Test 38', 1], | ||
| 129 | |||
| 130 | # Check @min:max ranges which are invalid | ||
| 131 | [1, '@4:2', 'Test 39', -1], | ||
| 132 | [1, '@~:~', 'Test 40', -1], | ||
| 133 | ); | ||
| 134 | |||
| 135 | foreach my $test (@tests) | ||
| 136 | { | ||
| 137 | ok(check_range($test->[0], $test->[1]) == $test->[3],$test->[2]); | ||
| 138 | } | ||
| 139 | |||
| 140 | exit; | ||
| 141 | |||
diff --git a/web/attachments/112910-check_mysql_slave b/web/attachments/112910-check_mysql_slave new file mode 100644 index 0000000..9b1e3c8 --- /dev/null +++ b/web/attachments/112910-check_mysql_slave | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | # Check that a mysql-slave is running | ||
| 4 | # | ||
| 5 | # usage: check_mysql_slave host user password | ||
| 6 | # | ||
| 7 | # @author peter.romianowski@optivo.net | ||
| 8 | # @version 1.0 19.12.2004 | ||
| 9 | |||
| 10 | IO=`mysql -h$1 -u$2 -p$3 -B -e "SHOW SLAVE STATUS" | cut -f 10 | tr "\n" " "` | ||
| 11 | |||
| 12 | if [ "$IO" != "Slave_IO_Running Yes " ] ; then | ||
| 13 | echo "CRITICAL Slave IO-Thread is not running (response was: $IO)" | ||
| 14 | exit 1 | ||
| 15 | fi | ||
| 16 | |||
| 17 | SQL=`mysql -h$1 -u$2 -p$3 -B -e "SHOW SLAVE STATUS" | cut -f 11 | tr "\n" " "` | ||
| 18 | |||
| 19 | if [ "$SQL" != "Slave_SQL_Running Yes " ] ; then | ||
| 20 | echo "CRITICAL Slave SQL-Thread is not running (response was: $SQL)" | ||
| 21 | exit 2 | ||
| 22 | fi | ||
| 23 | |||
| 24 | echo "OK Slave IO- and SQL-Thread are running" | ||
| 25 | exit 0 \ No newline at end of file | ||
diff --git a/web/attachments/112982-config.log.gz b/web/attachments/112982-config.log.gz new file mode 100644 index 0000000..d7291df --- /dev/null +++ b/web/attachments/112982-config.log.gz | |||
| Binary files differ | |||
diff --git a/web/attachments/113107-config.log.gz b/web/attachments/113107-config.log.gz new file mode 100644 index 0000000..e48e30f --- /dev/null +++ b/web/attachments/113107-config.log.gz | |||
| Binary files differ | |||
diff --git a/web/attachments/113111-config.log.gz b/web/attachments/113111-config.log.gz new file mode 100644 index 0000000..883038a --- /dev/null +++ b/web/attachments/113111-config.log.gz | |||
| Binary files differ | |||
diff --git a/web/attachments/113160-check_http.diff b/web/attachments/113160-check_http.diff new file mode 100644 index 0000000..c2b1a45 --- /dev/null +++ b/web/attachments/113160-check_http.diff | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | --- check_http.c.old 2004-12-01 15:57:08.000000000 +0100 | ||
| 2 | +++ check_http.c 2004-12-06 11:56:11.000000000 +0100 | ||
| 3 | @@ -112,6 +112,7 @@ | ||
| 4 | char *http_method; | ||
| 5 | char *http_post_data; | ||
| 6 | char buffer[MAX_INPUT_BUFFER]; | ||
| 7 | +int do_soap = FALSE; | ||
| 8 | |||
| 9 | int process_arguments (int, char **); | ||
| 10 | static char *base64 (const char *bin, size_t len); | ||
| 11 | @@ -210,6 +211,7 @@ | ||
| 12 | {"min", required_argument, 0, 'm'}, | ||
| 13 | {"use-ipv4", no_argument, 0, '4'}, | ||
| 14 | {"use-ipv6", no_argument, 0, '6'}, | ||
| 15 | + {"soap", no_argument, 0, 'W'}, | ||
| 16 | {0, 0, 0, 0} | ||
| 17 | }; | ||
| 18 | |||
| 19 | @@ -230,7 +232,7 @@ | ||
| 20 | } | ||
| 21 | |||
| 22 | while (1) { | ||
| 23 | - c = getopt_long (argc, argv, "Vvh46t:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLSm:", longopts, &option); | ||
| 24 | + c = getopt_long (argc, argv, "Vvh46tW:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLSm:", longopts, &option); | ||
| 25 | if (c == -1 || c == EOF) | ||
| 26 | break; | ||
| 27 | |||
| 28 | @@ -384,6 +386,9 @@ | ||
| 29 | case 'm': /* min_page_length */ | ||
| 30 | min_page_len = atoi (optarg); | ||
| 31 | break; | ||
| 32 | + case 'W': /* use SOAP mode */ | ||
| 33 | + do_soap = TRUE; | ||
| 34 | + break; | ||
| 35 | } | ||
| 36 | } | ||
| 37 | |||
| 38 | @@ -519,9 +524,16 @@ | ||
| 39 | |||
| 40 | /* either send http POST data */ | ||
| 41 | if (http_post_data) { | ||
| 42 | - asprintf (&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf); | ||
| 43 | - asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, strlen (http_post_data)); | ||
| 44 | - asprintf (&buf, "%s%s%s", buf, http_post_data, CRLF); | ||
| 45 | + if (do_soap) { | ||
| 46 | + asprintf (&buf, "%sSOAPAction:\r\n", buf); | ||
| 47 | + asprintf (&buf, "%sContent-Type: text/xml; charset=utf-8\r\n", buf); | ||
| 48 | + asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, strlen (http_post_data)); | ||
| 49 | + asprintf (&buf, "%s%s%s", buf, http_post_data, CRLF); | ||
| 50 | + } else { | ||
| 51 | + asprintf (&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf); | ||
| 52 | + asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, strlen (http_post_data)); | ||
| 53 | + asprintf (&buf, "%s%s%s", buf, http_post_data, CRLF); | ||
| 54 | + } | ||
| 55 | } | ||
| 56 | else { | ||
| 57 | /* or just a newline so the server knows we're done with the request */ | ||
| 58 | @@ -1214,6 +1226,6 @@ | ||
| 59 | [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\ | ||
| 60 | [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\ | ||
| 61 | [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\ | ||
| 62 | - [-P string] [-m min_pg_size] [-4|-6]\n"), progname); | ||
| 63 | + [-P string] [-m min_pg_size] [-4|-6] [-W]\n"), progname); | ||
| 64 | printf (_(UT_HLP_VRS), progname, progname); | ||
| 65 | } | ||
diff --git a/web/attachments/113191-config.log.nagios-plugins-HEAD-200412210547.gz b/web/attachments/113191-config.log.nagios-plugins-HEAD-200412210547.gz new file mode 100644 index 0000000..e5f2cd7 --- /dev/null +++ b/web/attachments/113191-config.log.nagios-plugins-HEAD-200412210547.gz | |||
| Binary files differ | |||
diff --git a/web/attachments/113337-config.log.nagios-plugins-HEAD-200412221747.gz b/web/attachments/113337-config.log.nagios-plugins-HEAD-200412221747.gz new file mode 100644 index 0000000..b00c693 --- /dev/null +++ b/web/attachments/113337-config.log.nagios-plugins-HEAD-200412221747.gz | |||
| Binary files differ | |||
diff --git a/web/attachments/113402-check_disk.diff b/web/attachments/113402-check_disk.diff new file mode 100644 index 0000000..5d87ebe --- /dev/null +++ b/web/attachments/113402-check_disk.diff | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | 31,32d30 | ||
| 2 | < * - patched by Tim Wootton 08032004 to ignore zero size fs, useful for multi | ||
| 3 | < * disk checks on solaris (tim.wootton@emea.telerate.com) | ||
| 4 | 111,115d108 | ||
| 5 | < if (total_disk==0){ | ||
| 6 | < if (verbose>0) | ||
| 7 | < printf ("ignoring zero size fs %s.", file_system); | ||
| 8 | < continue; | ||
| 9 | < } | ||
| 10 | 277d269 | ||
| 11 | < printf ("patched with 0 size fs patch by Tim Wootton 08032004"); | ||
diff --git a/web/attachments/113590-config.log.nagios-plugins-HEAD-200412231747.gz b/web/attachments/113590-config.log.nagios-plugins-HEAD-200412231747.gz new file mode 100644 index 0000000..1626bad --- /dev/null +++ b/web/attachments/113590-config.log.nagios-plugins-HEAD-200412231747.gz | |||
| Binary files differ | |||
diff --git a/web/attachments/114200-hpux swapinfo.txt b/web/attachments/114200-hpux swapinfo.txt new file mode 100644 index 0000000..1f4a47e --- /dev/null +++ b/web/attachments/114200-hpux swapinfo.txt | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | d40:/# swapinfo -dfM | ||
| 2 | Kb Kb Kb PCT START/ Kb | ||
| 3 | TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME | ||
| 4 | dev 1572864 0 1572864 0% 0 - 1 /dev/vg00/lvol2 | ||
| 5 | dev 17776640 0 17776640 0% 0 - 1 /dev/vgswap/lvol1 | ||
| 6 | memory 2185432 1637604 547828 75% | ||
diff --git a/web/attachments/114314-check_dhcp.c.patch.1.4-beta1 b/web/attachments/114314-check_dhcp.c.patch.1.4-beta1 new file mode 100644 index 0000000..9556f39 --- /dev/null +++ b/web/attachments/114314-check_dhcp.c.patch.1.4-beta1 | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | *** check_dhcp.c.orig Mon Jan 3 13:27:56 2005 | ||
| 2 | --- check_dhcp.c Mon Jan 3 13:40:28 2005 | ||
| 3 | *************** | ||
| 4 | *** 60,70 **** | ||
| 5 | |||
| 6 | #include <netinet/if_ether.h> | ||
| 7 | #include <sys/sysctl.h> | ||
| 8 | #include <net/if_dl.h> | ||
| 9 | |||
| 10 | ! #elif defined(__sun__) || defined(__solaris__) || defined(__hpux__) | ||
| 11 | |||
| 12 | #define INSAP 22 | ||
| 13 | #define OUTSAP 24 | ||
| 14 | |||
| 15 | #include <signal.h> | ||
| 16 | --- 60,70 ---- | ||
| 17 | |||
| 18 | #include <netinet/if_ether.h> | ||
| 19 | #include <sys/sysctl.h> | ||
| 20 | #include <net/if_dl.h> | ||
| 21 | |||
| 22 | ! #elif defined(__sun) || defined(__solaris__) || defined(__hpux__) | ||
| 23 | |||
| 24 | #define INSAP 22 | ||
| 25 | #define OUTSAP 24 | ||
| 26 | |||
| 27 | #include <signal.h> | ||
diff --git a/web/attachments/115229-check_tcp.c.diff b/web/attachments/115229-check_tcp.c.diff new file mode 100644 index 0000000..bd40d79 --- /dev/null +++ b/web/attachments/115229-check_tcp.c.diff | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | --- check_tcp.c.orig Thu Jan 6 12:20:54 2005 | ||
| 2 | +++ check_tcp.c Thu Jan 6 12:31:24 2005 | ||
| 3 | @@ -63,6 +63,11 @@ | ||
| 4 | MAXBUF = 1024 | ||
| 5 | }; | ||
| 6 | |||
| 7 | +enum { | ||
| 8 | + CRLF = 1, | ||
| 9 | + LF = 2 | ||
| 10 | +}; | ||
| 11 | + | ||
| 12 | int process_arguments (int, char **); | ||
| 13 | int my_recv (void); | ||
| 14 | void print_help (void); | ||
| 15 | @@ -100,6 +105,7 @@ | ||
| 16 | int sd = 0; | ||
| 17 | char *buffer; | ||
| 18 | int expect_mismatch_state = STATE_WARNING; | ||
| 19 | +int lineterm = CRLF; | ||
| 20 | int exact_matching = TRUE; | ||
| 21 | |||
| 22 | int | ||
| 23 | @@ -312,7 +318,9 @@ | ||
| 24 | while ((i = my_recv ()) > 0) { | ||
| 25 | buffer[i] = '\0'; | ||
| 26 | asprintf (&status, "%s%s", status, buffer); | ||
| 27 | - if (buffer[i-2] == '\r' && buffer[i-1] == '\n') | ||
| 28 | + if (buffer[i-2] == '\r' && buffer[i-1] == '\n' && lineterm == CRLF) | ||
| 29 | + break; | ||
| 30 | + if (buffer[i-1] == '\n' && lineterm == LF) | ||
| 31 | break; | ||
| 32 | if (maxbytes>0 && strlen(status) >= (unsigned)maxbytes) | ||
| 33 | break; | ||
| 34 | @@ -421,6 +429,7 @@ | ||
| 35 | {"delay", required_argument, 0, 'd'}, | ||
| 36 | {"refuse", required_argument, 0, 'r'}, | ||
| 37 | {"mismatch", required_argument, 0, 'M'}, | ||
| 38 | + {"lineterm", required_argument, 0, 'l'}, | ||
| 39 | {"use-ipv4", no_argument, 0, '4'}, | ||
| 40 | {"use-ipv6", no_argument, 0, '6'}, | ||
| 41 | {"verbose", no_argument, 0, 'v'}, | ||
| 42 | @@ -454,7 +463,7 @@ | ||
| 43 | } | ||
| 44 | |||
| 45 | while (1) { | ||
| 46 | - c = getopt_long (argc, argv, "+hVv46H:s:e:q:m:c:w:t:p:C:W:d:Sr:jD:M:", | ||
| 47 | + c = getopt_long (argc, argv, "+hVv46H:s:e:q:m:c:w:t:p:C:W:d:Sr:jD:M:l:", | ||
| 48 | longopts, &option); | ||
| 49 | |||
| 50 | if (c == -1 || c == EOF || c == 1) | ||
| 51 | @@ -566,13 +575,31 @@ | ||
| 52 | else | ||
| 53 | usage4 (_("Mismatch must be one of ok, warn, crit")); | ||
| 54 | break; | ||
| 55 | + case 'l': | ||
| 56 | + if (is_intpos (optarg)) { | ||
| 57 | + int num = atoi(optarg); | ||
| 58 | + | ||
| 59 | + switch (num) { | ||
| 60 | + case 1: | ||
| 61 | + lineterm = CRLF; | ||
| 62 | + break; | ||
| 63 | + case 2: | ||
| 64 | + lineterm = LF; | ||
| 65 | + break; | ||
| 66 | + default: | ||
| 67 | + usage4 (_("Line termination must be 1 (CRLF) or 2 (LF)")); | ||
| 68 | + break; | ||
| 69 | + } | ||
| 70 | + } else | ||
| 71 | + usage4 (_("Line termination must be a positive integer")); | ||
| 72 | + break; | ||
| 73 | case 'd': | ||
| 74 | if (is_intpos (optarg)) | ||
| 75 | delay = atoi (optarg); | ||
| 76 | else | ||
| 77 | usage4 (_("Delay must be a positive integer")); | ||
| 78 | break; | ||
| 79 | - case 'D': /* Check SSL cert validity - days 'til certificate expiration */ | ||
| 80 | + case 'D': /* Check SSL cert validity - days 'til certificate expiration */ | ||
| 81 | #ifdef HAVE_SSL | ||
| 82 | if (!is_intnonneg (optarg)) | ||
| 83 | usage2 ("invalid certificate expiration period", optarg); | ||
| 84 | @@ -784,6 +811,8 @@ | ||
| 85 | Accept tcp refusals with states ok, warn, crit (default: crit)\n\ | ||
| 86 | -M, --mismatch=ok|warn|crit\n\ | ||
| 87 | Accept expected string mismatches with states ok, warn, crit (default: warn)\n\ | ||
| 88 | + -l, --lineterm=1|2\r\ | ||
| 89 | + Line termination expected from remote peer (1 is CRLF; 2 is LF only)\n\ | ||
| 90 | -j, --jail\n\ | ||
| 91 | Hide output from TCP socket\n\ | ||
| 92 | -m, --maxbytes=INTEGER\n\ | ||
| 93 | @@ -817,6 +846,7 @@ | ||
| 94 | Usage: %s -H host -p port [-w <warning time>] [-c <critical time>]\n\ | ||
| 95 | [-s <send string>] [-e <expect string>] [-q <quit string>]\n\ | ||
| 96 | [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\ | ||
| 97 | - [-r <refuse state>] [-M <mismatch state>] [-v] [-4|-6] [-j]\n\ | ||
| 98 | - [-D <days to cert expiry>] [-S <use SSL>]\n", progname); | ||
| 99 | + [-r <refuse state>] [-M <mismatch state>] [-l <1|2>] [-v]\n\ | ||
| 100 | + [-4|-6] [-j] [-D <days to cert expiry>] [-S <use SSL>]\n", | ||
| 101 | + progname); | ||
| 102 | } | ||
diff --git a/web/attachments/115753-check_disk.patch b/web/attachments/115753-check_disk.patch new file mode 100644 index 0000000..aafe4dc --- /dev/null +++ b/web/attachments/115753-check_disk.patch | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | diff -u check_disk.c-orig check_disk.c | ||
| 2 | --- check_disk.c-orig 2005-01-14 10:14:18.650350000 +1100 | ||
| 3 | +++ check_disk.c 2005-01-14 10:19:13.238477000 +1100 | ||
| 4 | @@ -20,6 +20,7 @@ | ||
| 5 | * error. | ||
| 6 | * | ||
| 7 | * Notes: | ||
| 8 | + * - Fixed logic error with -e switch where result not set (DA, 14/1/2005) | ||
| 9 | * - IRIX support added by Charlie Cook 4-16-1999 | ||
| 10 | * - Modifications by Karl DeBisschop 1999-11-24 | ||
| 11 | * reformat code to 80 char screen width | ||
| 12 | @@ -118,6 +119,8 @@ | ||
| 13 | if (strcmp (file_system, "none") == 0) | ||
| 14 | strncpy (file_system, mntp, MAX_INPUT_BUFFER-1); | ||
| 15 | |||
| 16 | + result = max_state (result, disk_result); | ||
| 17 | + | ||
| 18 | if (disk_result==STATE_OK && erronly && !verbose) | ||
| 19 | continue; | ||
| 20 | |||
| 21 | @@ -125,7 +128,6 @@ | ||
| 22 | asprintf (&output, "%s [%.0f kB (%d%%) free on %s]", output, | ||
| 23 | free_disk, 100 - usp, display_mntp ? mntp : file_system); | ||
| 24 | |||
| 25 | - result = max_state (result, disk_result); | ||
| 26 | } | ||
| 27 | |||
| 28 | else { | ||
diff --git a/web/attachments/115805-check_sybase-0.2_0.3.diff b/web/attachments/115805-check_sybase-0.2_0.3.diff new file mode 100644 index 0000000..e3c37de --- /dev/null +++ b/web/attachments/115805-check_sybase-0.2_0.3.diff | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-10 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378820419" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378820419" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378820419" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378820419" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378820419'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1102230&group_id=29880&atid=397599&file_id=115805" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/115806-check_sybase-0.2_0.3.diff b/web/attachments/115806-check_sybase-0.2_0.3.diff new file mode 100644 index 0000000..50c3f54 --- /dev/null +++ b/web/attachments/115806-check_sybase-0.2_0.3.diff | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-4 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378820419" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378820419" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378820419" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378820419" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378820419'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1102230&group_id=29880&atid=397599&file_id=115806" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/116237-check_snmp.tar.gz b/web/attachments/116237-check_snmp.tar.gz new file mode 100644 index 0000000..737e8c4 --- /dev/null +++ b/web/attachments/116237-check_snmp.tar.gz | |||
| Binary files differ | |||
diff --git a/web/attachments/116575-check_nt.c.patch.1.39 b/web/attachments/116575-check_nt.c.patch.1.39 new file mode 100644 index 0000000..de85bad --- /dev/null +++ b/web/attachments/116575-check_nt.c.patch.1.39 | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-10 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378820350" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378820350" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378820350" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378820350" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378820350'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1106390&group_id=29880&atid=397599&file_id=116575" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/116576-check_nt.c.patch b/web/attachments/116576-check_nt.c.patch new file mode 100644 index 0000000..30a4653 --- /dev/null +++ b/web/attachments/116576-check_nt.c.patch | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | --- plugins/check_nt.c.orig 2005-01-20 17:17:40.000000000 -0500 | ||
| 2 | +++ plugins/check_nt.c 2005-01-20 18:01:43.000000000 -0500 | ||
| 3 | @@ -43,6 +43,7 @@ | ||
| 4 | #define CHECK_MEMUSE 7 | ||
| 5 | #define CHECK_COUNTER 8 | ||
| 6 | #define CHECK_FILEAGE 9 | ||
| 7 | +#define CHECK_FREEDISKSPACE 10 | ||
| 8 | #define MAX_VALUE_LIST 30 | ||
| 9 | |||
| 10 | #define PORT 1248 | ||
| 11 | @@ -185,7 +186,7 @@ | ||
| 12 | return_code=STATE_OK; | ||
| 13 | } | ||
| 14 | |||
| 15 | - else if(vars_to_check==CHECK_USEDDISKSPACE){ | ||
| 16 | + else if(vars_to_check==CHECK_USEDDISKSPACE || vars_to_check==CHECK_FREEDISKSPACE){ | ||
| 17 | |||
| 18 | return_code=STATE_UNKNOWN; | ||
| 19 | if (check_value_list==TRUE) { | ||
| 20 | @@ -210,9 +211,13 @@ | ||
| 21 | free_disk_space / 1073741824, (free_disk_space / total_disk_space)*100); | ||
| 22 | |||
| 23 | |||
| 24 | - if(check_critical_value==TRUE && percent_used_space >= critical_value) | ||
| 25 | + if(check_critical_value==TRUE && ( | ||
| 26 | + (vars_to_check==CHECK_USEDDISKSPACE && percent_used_space >= critical_value) || | ||
| 27 | + (vars_to_check==CHECK_FREEDISKSPACE && free_disk_space / 1048576 <= critical_value))) | ||
| 28 | return_code=STATE_CRITICAL; | ||
| 29 | - else if (check_warning_value==TRUE && percent_used_space >= warning_value) | ||
| 30 | + else if (check_warning_value==TRUE && ( | ||
| 31 | + (vars_to_check==CHECK_USEDDISKSPACE && percent_used_space >= warning_value) || | ||
| 32 | + (vars_to_check==CHECK_FREEDISKSPACE && free_disk_space / 1048576 <= warning_value))) | ||
| 33 | return_code=STATE_WARNING; | ||
| 34 | else | ||
| 35 | return_code=STATE_OK; | ||
| 36 | @@ -477,6 +482,8 @@ | ||
| 37 | vars_to_check=CHECK_COUNTER; | ||
| 38 | else if(!strcmp(optarg,"FILEAGE")) | ||
| 39 | vars_to_check=CHECK_FILEAGE; | ||
| 40 | + else if(!strcmp(optarg,"FREEDISKSPACE")) | ||
| 41 | + vars_to_check=CHECK_FREEDISKSPACE; | ||
| 42 | else | ||
| 43 | return ERROR; | ||
| 44 | break; | ||
| 45 | @@ -541,7 +548,9 @@ | ||
| 46 | " Thresholds are percentage and up to 10 requests can be done in one shot. ie: -l 60,90,95,120,90,95\n" | ||
| 47 | " UPTIME = Get the uptime of the machine. No specific parameters. No warning or critical threshold\n" | ||
| 48 | " USEDDISKSPACE = Size and percentage of disk use. Request a -l parameter containing the drive letter only.\n" | ||
| 49 | - " Warning and critical thresholds can be specified with -w and -c.\n" | ||
| 50 | + " Warning and critical thresholds can be specified (in percentage used) with -w and -c.\n" | ||
| 51 | + " FREEDISKSPACE = Size and percentage of disk use. Request a -l parameter containing the drive letter only.\n" | ||
| 52 | + " Warning and critical thresholds can be specified (in megabytes free) with -w and -c.\n" | ||
| 53 | " MEMUSE = Memory use. Warning and critical thresholds can be specified with -w and -c.\n" | ||
| 54 | " SERVICESTATE = Check the state of one or several services. Request a -l parameters with the following syntax:\n" | ||
| 55 | " -l <service1>,<service2>,<service3>,... You can specify -d SHOWALL in case you want to see working services\n" | ||
diff --git a/web/attachments/116577-check_nt.c.patch b/web/attachments/116577-check_nt.c.patch new file mode 100644 index 0000000..0d2daba --- /dev/null +++ b/web/attachments/116577-check_nt.c.patch | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | --- plugins/check_nt.c.orig 2005-01-20 17:27:47.000000000 -0500 | ||
| 2 | +++ plugins/check_nt.c 2005-01-20 18:01:41.000000000 -0500 | ||
| 3 | @@ -49,7 +49,8 @@ | ||
| 4 | CHECK_PROCSTATE, | ||
| 5 | CHECK_MEMUSE, | ||
| 6 | CHECK_COUNTER, | ||
| 7 | - CHECK_FILEAGE | ||
| 8 | + CHECK_FILEAGE, | ||
| 9 | + CHECK_FREEDISKSPACE | ||
| 10 | }; | ||
| 11 | |||
| 12 | enum { | ||
| 13 | @@ -201,6 +202,7 @@ | ||
| 14 | break; | ||
| 15 | |||
| 16 | case CHECK_USEDDISKSPACE: | ||
| 17 | + case CHECK_FREEDISKSPACE: | ||
| 18 | |||
| 19 | if (value_list==NULL) | ||
| 20 | output_message = strdup (_("missing -l parameters")); | ||
| 21 | @@ -212,8 +214,8 @@ | ||
| 22 | free_disk_space=atof(strtok(recv_buffer,"&")); | ||
| 23 | total_disk_space=atof(strtok(NULL,"&")); | ||
| 24 | percent_used_space = ((total_disk_space - free_disk_space) / total_disk_space) * 100; | ||
| 25 | - warning_used_space = ((float)warning_value / 100) * total_disk_space; | ||
| 26 | - critical_used_space = ((float)critical_value / 100) * total_disk_space; | ||
| 27 | + warning_used_space = (vars_to_check==CHECK_FREEDISKSPACE)?(float)warning_value:((float)warning_value / 100) * total_disk_space; | ||
| 28 | + critical_used_space = (vars_to_check==CHECK_FREEDISKSPACE)?(float)critical_value:((float)critical_value / 100) * total_disk_space; | ||
| 29 | |||
| 30 | if (free_disk_space>=0) { | ||
| 31 | asprintf(&temp_string,_("%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)"), | ||
| 32 | @@ -223,9 +225,9 @@ | ||
| 33 | (total_disk_space - free_disk_space) / 1073741824, warning_used_space / 1073741824, | ||
| 34 | critical_used_space / 1073741824, total_disk_space / 1073741824); | ||
| 35 | |||
| 36 | - if(check_critical_value==TRUE && percent_used_space >= critical_value) | ||
| 37 | + if(check_critical_value==TRUE && free_disk_space <= critical_used_space) | ||
| 38 | return_code=STATE_CRITICAL; | ||
| 39 | - else if (check_warning_value==TRUE && percent_used_space >= warning_value) | ||
| 40 | + else if (check_warning_value==TRUE && free_disk_space <= warning_used_space) | ||
| 41 | return_code=STATE_WARNING; | ||
| 42 | else | ||
| 43 | return_code=STATE_OK; | ||
| 44 | @@ -527,6 +529,8 @@ | ||
| 45 | vars_to_check=CHECK_COUNTER; | ||
| 46 | else if(!strcmp(optarg,"FILEAGE")) | ||
| 47 | vars_to_check=CHECK_FILEAGE; | ||
| 48 | + else if(!strcmp(optarg,"FREEDISKSPACE")) | ||
| 49 | + vars_to_check=CHECK_FREEDISKSPACE; | ||
| 50 | else | ||
| 51 | return ERROR; | ||
| 52 | break; | ||
| 53 | @@ -656,7 +660,11 @@ | ||
| 54 | printf (_("\ | ||
| 55 | USEDDISKSPACE = Size and percentage of disk use.\n\ | ||
| 56 | Request a -l parameter containing the drive letter only.\n\ | ||
| 57 | - Warning and critical thresholds can be specified with -w and -c.\n")); | ||
| 58 | + Thresholds can be specified (in precentage used) with -w and -c.\n")); | ||
| 59 | + printf (_("\ | ||
| 60 | + FREEDISKSPACE = Size and percentage of disk use.\n\ | ||
| 61 | + Request a -l parameter containing the drive letter only.\n\ | ||
| 62 | + Thresholds can be specified (in megabytes free) with -w and -c.\n")); | ||
| 63 | printf (_("\ | ||
| 64 | MEMUSE = Memory use.\n\ | ||
| 65 | Warning and critical thresholds can be specified with -w and -c.\n")); | ||
diff --git a/web/attachments/116583-check_snmp.c b/web/attachments/116583-check_snmp.c new file mode 100644 index 0000000..e2695e1 --- /dev/null +++ b/web/attachments/116583-check_snmp.c | |||
| @@ -0,0 +1,963 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | |||
| 3 | This program is free software; you can redistribute it and/or modify | ||
| 4 | it under the terms of the GNU General Public License as published by | ||
| 5 | the Free Software Foundation; either version 2 of the License, or | ||
| 6 | (at your option) any later version. | ||
| 7 | |||
| 8 | This program is distributed in the hope that it will be useful, | ||
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | GNU General Public License for more details. | ||
| 12 | |||
| 13 | You should have received a copy of the GNU General Public License | ||
| 14 | along with this program; if not, write to the Free Software | ||
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 16 | |||
| 17 | $Id: check_snmp.c,v 1.52 2004/12/30 00:41:39 opensides Exp $ | ||
| 18 | |||
| 19 | ******************************************************************************/ | ||
| 20 | |||
| 21 | const char *progname = "check_snmp"; | ||
| 22 | const char *revision = "$Revision: 1.52 $"; | ||
| 23 | const char *copyright = "1999-2004"; | ||
| 24 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 25 | |||
| 26 | #include "common.h" | ||
| 27 | #include "utils.h" | ||
| 28 | #include "popen.h" | ||
| 29 | |||
| 30 | #define DEFAULT_COMMUNITY "public" | ||
| 31 | #define DEFAULT_PORT "161" | ||
| 32 | #define DEFAULT_MIBLIST "ALL" | ||
| 33 | #define DEFAULT_PROTOCOL "1" | ||
| 34 | #define DEFAULT_TIMEOUT 1 | ||
| 35 | #define DEFAULT_RETRIES 5 | ||
| 36 | #define DEFAULT_AUTH_PROTOCOL "MD5" | ||
| 37 | #define DEFAULT_DELIMITER "=" | ||
| 38 | #define DEFAULT_OUTPUT_DELIMITER " " | ||
| 39 | |||
| 40 | #define mark(a) ((a)!=0?"*":"") | ||
| 41 | |||
| 42 | #define CHECK_UNDEF 0 | ||
| 43 | #define CRIT_PRESENT 1 | ||
| 44 | #define CRIT_STRING 2 | ||
| 45 | #define CRIT_REGEX 4 | ||
| 46 | #define CRIT_GT 8 | ||
| 47 | #define CRIT_LT 16 | ||
| 48 | #define CRIT_GE 32 | ||
| 49 | #define CRIT_LE 64 | ||
| 50 | #define CRIT_EQ 128 | ||
| 51 | #define CRIT_NE 256 | ||
| 52 | #define CRIT_RANGE 512 | ||
| 53 | #define WARN_PRESENT 1024 | ||
| 54 | #define WARN_STRING 2048 | ||
| 55 | #define WARN_REGEX 4096 | ||
| 56 | #define WARN_GT 8192 | ||
| 57 | #define WARN_LT 16384 | ||
| 58 | #define WARN_GE 32768 | ||
| 59 | #define WARN_LE 65536 | ||
| 60 | #define WARN_EQ 131072 | ||
| 61 | #define WARN_NE 262144 | ||
| 62 | #define WARN_RANGE 524288 | ||
| 63 | |||
| 64 | #define MAX_OIDS 8 | ||
| 65 | #define MAX_DELIM_LENGTH 8 | ||
| 66 | |||
| 67 | int process_arguments (int, char **); | ||
| 68 | int validate_arguments (void); | ||
| 69 | char *clarify_message (char *); | ||
| 70 | int check_num (int); | ||
| 71 | int lu_getll (unsigned long *, char *); | ||
| 72 | int lu_getul (unsigned long *, char *); | ||
| 73 | char *thisarg (char *str); | ||
| 74 | char *nextarg (char *str); | ||
| 75 | void print_usage (void); | ||
| 76 | void print_help (void); | ||
| 77 | |||
| 78 | #ifdef HAVE_REGEX_H | ||
| 79 | #include <regex.h> | ||
| 80 | char regex_expect[MAX_INPUT_BUFFER] = ""; | ||
| 81 | regex_t preg; | ||
| 82 | regmatch_t pmatch[10]; | ||
| 83 | char timestamp[10] = ""; | ||
| 84 | char errbuf[MAX_INPUT_BUFFER]; | ||
| 85 | int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; | ||
| 86 | int eflags = 0; | ||
| 87 | int errcode, excode; | ||
| 88 | #endif | ||
| 89 | |||
| 90 | char *server_address = NULL; | ||
| 91 | char *community = NULL; | ||
| 92 | char *authpriv = NULL; | ||
| 93 | char *proto = NULL; | ||
| 94 | char *seclevel = NULL; | ||
| 95 | char *secname = NULL; | ||
| 96 | char *authproto = NULL; | ||
| 97 | char *authpasswd = NULL; | ||
| 98 | char *privpasswd = NULL; | ||
| 99 | char *oid; | ||
| 100 | char *label; | ||
| 101 | char *units; | ||
| 102 | char *port; | ||
| 103 | char string_value[MAX_INPUT_BUFFER] = ""; | ||
| 104 | char **labels = NULL; | ||
| 105 | char **unitv = NULL; | ||
| 106 | size_t nlabels = 0; | ||
| 107 | size_t labels_size = 8; | ||
| 108 | size_t nunits = 0; | ||
| 109 | size_t unitv_size = 8; | ||
| 110 | int verbose = FALSE; | ||
| 111 | unsigned long lower_warn_lim[MAX_OIDS]; | ||
| 112 | unsigned long upper_warn_lim[MAX_OIDS]; | ||
| 113 | unsigned long lower_crit_lim[MAX_OIDS]; | ||
| 114 | unsigned long upper_crit_lim[MAX_OIDS]; | ||
| 115 | unsigned long response_value[MAX_OIDS]; | ||
| 116 | int check_warning_value = FALSE; | ||
| 117 | int check_critical_value = FALSE; | ||
| 118 | int retries = 0; | ||
| 119 | unsigned long eval_method[MAX_OIDS]; | ||
| 120 | char *delimiter; | ||
| 121 | char *output_delim; | ||
| 122 | char *miblist; | ||
| 123 | |||
| 124 | int | ||
| 125 | main (int argc, char **argv) | ||
| 126 | { | ||
| 127 | int i = 0; | ||
| 128 | int iresult = STATE_UNKNOWN; | ||
| 129 | int found = 0; | ||
| 130 | int result = STATE_DEPENDENT; | ||
| 131 | char input_buffer[MAX_INPUT_BUFFER]; | ||
| 132 | char *command_line = NULL; | ||
| 133 | char *response = NULL; | ||
| 134 | char *outbuff; | ||
| 135 | char *output; | ||
| 136 | char *ptr = NULL; | ||
| 137 | char *p2 = NULL; | ||
| 138 | char *show = NULL; | ||
| 139 | |||
| 140 | setlocale (LC_ALL, ""); | ||
| 141 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 142 | textdomain (PACKAGE); | ||
| 143 | |||
| 144 | labels = malloc (labels_size); | ||
| 145 | unitv = malloc (unitv_size); | ||
| 146 | for (i = 0; i < MAX_OIDS; i++) | ||
| 147 | eval_method[i] = CHECK_UNDEF; | ||
| 148 | i = 0; | ||
| 149 | |||
| 150 | oid = strdup (""); | ||
| 151 | label = strdup ("SNMP"); | ||
| 152 | units = strdup (""); | ||
| 153 | port = strdup (DEFAULT_PORT); | ||
| 154 | outbuff = strdup (""); | ||
| 155 | output = strdup (""); | ||
| 156 | delimiter = strdup (DEFAULT_DELIMITER); | ||
| 157 | output_delim = strdup (DEFAULT_OUTPUT_DELIMITER); | ||
| 158 | miblist = strdup (DEFAULT_MIBLIST); | ||
| 159 | timeout_interval = DEFAULT_TIMEOUT; | ||
| 160 | retries = DEFAULT_RETRIES; | ||
| 161 | |||
| 162 | if (process_arguments (argc, argv) == ERROR) | ||
| 163 | usage4 (_("Could not parse arguments")); | ||
| 164 | |||
| 165 | /* create the command line to execute */ | ||
| 166 | asprintf (&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s", | ||
| 167 | PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto, | ||
| 168 | authpriv, server_address, port, oid); | ||
| 169 | if (verbose) | ||
| 170 | printf ("%s\n", command_line); | ||
| 171 | |||
| 172 | /* run the command */ | ||
| 173 | child_process = spopen (command_line); | ||
| 174 | if (child_process == NULL) { | ||
| 175 | printf (_("Could not open pipe: %s\n"), command_line); | ||
| 176 | exit (STATE_UNKNOWN); | ||
| 177 | } | ||
| 178 | |||
| 179 | child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 180 | if (child_stderr == NULL) { | ||
| 181 | printf (_("Could not open stderr for %s\n"), command_line); | ||
| 182 | } | ||
| 183 | |||
| 184 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) | ||
| 185 | asprintf (&output, "%s%s", output, input_buffer); | ||
| 186 | |||
| 187 | if (verbose) | ||
| 188 | printf ("%s\n", output); | ||
| 189 | |||
| 190 | ptr = output; | ||
| 191 | |||
| 192 | while (ptr) { | ||
| 193 | |||
| 194 | ptr = strstr (ptr, delimiter); | ||
| 195 | if (ptr == NULL) | ||
| 196 | break; | ||
| 197 | |||
| 198 | ptr += strlen (delimiter); | ||
| 199 | ptr += strspn (ptr, " "); | ||
| 200 | |||
| 201 | found++; | ||
| 202 | |||
| 203 | if (ptr[0] == '"') { | ||
| 204 | ptr++; | ||
| 205 | response = strpcpy (response, ptr, "\""); | ||
| 206 | ptr = strpbrk (ptr, "\""); | ||
| 207 | ptr += strspn (ptr, "\"\n"); | ||
| 208 | } | ||
| 209 | else { | ||
| 210 | response = strpcpy (response, ptr, "\n"); | ||
| 211 | ptr = strpbrk (ptr, "\n"); | ||
| 212 | ptr += strspn (ptr, "\n"); | ||
| 213 | while | ||
| 214 | (strstr (ptr, delimiter) && | ||
| 215 | strstr (ptr, "\n") && strstr (ptr, "\n") < strstr (ptr, delimiter)) { | ||
| 216 | response = strpcat (response, ptr, "\n"); | ||
| 217 | ptr = strpbrk (ptr, "\n"); | ||
| 218 | } | ||
| 219 | if (ptr && strstr (ptr, delimiter) == NULL) { | ||
| 220 | asprintf (&response, "%s%s", response, ptr); | ||
| 221 | ptr = NULL; | ||
| 222 | } | ||
| 223 | } | ||
| 224 | |||
| 225 | /* We strip out the datatype indicator for PHBs */ | ||
| 226 | if (strstr (response, "Gauge: ")) | ||
| 227 | show = strstr (response, "Gauge: ") + 7; | ||
| 228 | else if (strstr (response, "Gauge32: ")) | ||
| 229 | show = strstr (response, "Gauge32: ") + 9; | ||
| 230 | else if (strstr (response, "Counter32: ")) | ||
| 231 | show = strstr (response, "Counter32: ") + 11; | ||
| 232 | else if (strstr (response, "INTEGER: ")) | ||
| 233 | show = strstr (response, "INTEGER: ") + 9; | ||
| 234 | else if (strstr (response, "STRING: ")) | ||
| 235 | show = strstr (response, "STRING: ") + 8; | ||
| 236 | else | ||
| 237 | show = response; | ||
| 238 | p2 = show; | ||
| 239 | |||
| 240 | iresult = STATE_DEPENDENT; | ||
| 241 | |||
| 242 | /* Process this block for integer comparisons */ | ||
| 243 | if (eval_method[i] & CRIT_GT || | ||
| 244 | eval_method[i] & CRIT_LT || | ||
| 245 | eval_method[i] & CRIT_GE || | ||
| 246 | eval_method[i] & CRIT_LE || | ||
| 247 | eval_method[i] & CRIT_EQ || | ||
| 248 | eval_method[i] & CRIT_NE || | ||
| 249 | eval_method[i] & WARN_GT || | ||
| 250 | eval_method[i] & WARN_LT || | ||
| 251 | eval_method[i] & WARN_GE || | ||
| 252 | eval_method[i] & WARN_LE || | ||
| 253 | eval_method[i] & WARN_EQ || | ||
| 254 | eval_method[i] & WARN_NE) { | ||
| 255 | p2 = strpbrk (p2, "0123456789"); | ||
| 256 | if (p2 == NULL) | ||
| 257 | die (STATE_UNKNOWN,_("No valid data returned")); | ||
| 258 | response_value[i] = strtoul (p2, NULL, 10); | ||
| 259 | iresult = check_num (i); | ||
| 260 | asprintf (&show, "%lu", response_value[i]); | ||
| 261 | } | ||
| 262 | |||
| 263 | /* Process this block for string matching */ | ||
| 264 | else if (eval_method[i] & CRIT_STRING) { | ||
| 265 | if (strcmp (show, string_value)) | ||
| 266 | iresult = STATE_CRITICAL; | ||
| 267 | else | ||
| 268 | iresult = STATE_OK; | ||
| 269 | } | ||
| 270 | |||
| 271 | /* Process this block for regex matching */ | ||
| 272 | else if (eval_method[i] & CRIT_REGEX) { | ||
| 273 | #ifdef HAVE_REGEX_H | ||
| 274 | excode = regexec (&preg, response, 10, pmatch, eflags); | ||
| 275 | if (excode == 0) { | ||
| 276 | iresult = STATE_OK; | ||
| 277 | } | ||
| 278 | else if (excode != REG_NOMATCH) { | ||
| 279 | regerror (excode, &preg, errbuf, MAX_INPUT_BUFFER); | ||
| 280 | printf (_("Execute Error: %s\n"), errbuf); | ||
| 281 | exit (STATE_CRITICAL); | ||
| 282 | } | ||
| 283 | else { | ||
| 284 | iresult = STATE_CRITICAL; | ||
| 285 | } | ||
| 286 | #else | ||
| 287 | printf (_("Call for regex which was not a compiled option")); | ||
| 288 | exit (STATE_UNKNOWN); | ||
| 289 | #endif | ||
| 290 | } | ||
| 291 | |||
| 292 | /* Process this block for existence-nonexistence checks */ | ||
| 293 | else { | ||
| 294 | if (eval_method[i] & CRIT_PRESENT) | ||
| 295 | iresult = STATE_CRITICAL; | ||
| 296 | else if (eval_method[i] & WARN_PRESENT) | ||
| 297 | iresult = STATE_WARNING; | ||
| 298 | else if (response && iresult == STATE_DEPENDENT) | ||
| 299 | iresult = STATE_OK; | ||
| 300 | } | ||
| 301 | |||
| 302 | /* Result is the worst outcome of all the OIDs tested */ | ||
| 303 | result = max_state (result, iresult); | ||
| 304 | |||
| 305 | /* Prepend a label for this OID if there is one */ | ||
| 306 | if (nlabels > (size_t)1 && (size_t)i < nlabels && labels[i] != NULL) | ||
| 307 | asprintf (&outbuff, "%s%s%s %s%s%s", outbuff, | ||
| 308 | (i == 0) ? " " : output_delim, | ||
| 309 | labels[i], mark (iresult), show, mark (iresult)); | ||
| 310 | else | ||
| 311 | asprintf (&outbuff, "%s%s%s%s%s", outbuff, (i == 0) ? " " : output_delim, | ||
| 312 | mark (iresult), show, mark (iresult)); | ||
| 313 | |||
| 314 | /* Append a unit string for this OID if there is one */ | ||
| 315 | if (nunits > (size_t)0 && (size_t)i < nunits && unitv[i] != NULL) | ||
| 316 | asprintf (&outbuff, "%s %s", outbuff, unitv[i]); | ||
| 317 | |||
| 318 | i++; | ||
| 319 | |||
| 320 | } /* end while (ptr) */ | ||
| 321 | |||
| 322 | if (found == 0) | ||
| 323 | die (STATE_UNKNOWN, | ||
| 324 | _("%s problem - No data received from host\nCMD: %s\n"), | ||
| 325 | label, | ||
| 326 | command_line); | ||
| 327 | |||
| 328 | /* WARNING if output found on stderr */ | ||
| 329 | if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) | ||
| 330 | result = max_state (result, STATE_WARNING); | ||
| 331 | |||
| 332 | /* close stderr */ | ||
| 333 | (void) fclose (child_stderr); | ||
| 334 | |||
| 335 | /* close the pipe */ | ||
| 336 | if (spclose (child_process)) | ||
| 337 | result = max_state (result, STATE_WARNING); | ||
| 338 | |||
| 339 | /* if (nunits == 1 || i == 1) */ | ||
| 340 | /* printf ("%s %s -%s %s\n", label, state_text (result), outbuff, units); */ | ||
| 341 | /* else */ | ||
| 342 | printf ("%s %s -%s\n", label, state_text (result), outbuff); | ||
| 343 | |||
| 344 | return result; | ||
| 345 | } | ||
| 346 | |||
| 347 | |||
| 348 | |||
| 349 | /* process command-line arguments */ | ||
| 350 | int | ||
| 351 | process_arguments (int argc, char **argv) | ||
| 352 | { | ||
| 353 | char *ptr; | ||
| 354 | int c = 1; | ||
| 355 | int j = 0, jj = 0, ii = 0; | ||
| 356 | |||
| 357 | int option = 0; | ||
| 358 | static struct option longopts[] = { | ||
| 359 | STD_LONG_OPTS, | ||
| 360 | {"community", required_argument, 0, 'C'}, | ||
| 361 | {"oid", required_argument, 0, 'o'}, | ||
| 362 | {"object", required_argument, 0, 'o'}, | ||
| 363 | {"delimiter", required_argument, 0, 'd'}, | ||
| 364 | {"output-delimiter", required_argument, 0, 'D'}, | ||
| 365 | {"string", required_argument, 0, 's'}, | ||
| 366 | {"timeout", required_argument, 0, 't'}, | ||
| 367 | {"regex", required_argument, 0, 'r'}, | ||
| 368 | {"ereg", required_argument, 0, 'r'}, | ||
| 369 | {"eregi", required_argument, 0, 'R'}, | ||
| 370 | {"label", required_argument, 0, 'l'}, | ||
| 371 | {"units", required_argument, 0, 'u'}, | ||
| 372 | {"port", required_argument, 0, 'p'}, | ||
| 373 | {"retries", required_argument, 0, 'e'}, | ||
| 374 | {"miblist", required_argument, 0, 'm'}, | ||
| 375 | {"protocol", required_argument, 0, 'P'}, | ||
| 376 | {"seclevel", required_argument, 0, 'L'}, | ||
| 377 | {"secname", required_argument, 0, 'U'}, | ||
| 378 | {"authproto", required_argument, 0, 'a'}, | ||
| 379 | {"authpasswd", required_argument, 0, 'A'}, | ||
| 380 | {"privpasswd", required_argument, 0, 'X'}, | ||
| 381 | {0, 0, 0, 0} | ||
| 382 | }; | ||
| 383 | |||
| 384 | if (argc < 2) | ||
| 385 | return ERROR; | ||
| 386 | |||
| 387 | /* reverse compatibility for very old non-POSIX usage forms */ | ||
| 388 | for (c = 1; c < argc; c++) { | ||
| 389 | if (strcmp ("-to", argv[c]) == 0) | ||
| 390 | strcpy (argv[c], "-t"); | ||
| 391 | if (strcmp ("-wv", argv[c]) == 0) | ||
| 392 | strcpy (argv[c], "-w"); | ||
| 393 | if (strcmp ("-cv", argv[c]) == 0) | ||
| 394 | strcpy (argv[c], "-c"); | ||
| 395 | } | ||
| 396 | |||
| 397 | while (1) { | ||
| 398 | c = getopt_long (argc, argv, "hvVt:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:L:U:a:A:X:", | ||
| 399 | longopts, &option); | ||
| 400 | |||
| 401 | if (c == -1 || c == EOF) | ||
| 402 | break; | ||
| 403 | |||
| 404 | switch (c) { | ||
| 405 | case '?': /* usage */ | ||
| 406 | usage2 (_("Unknown argument"), optarg); | ||
| 407 | case 'h': /* help */ | ||
| 408 | print_help (); | ||
| 409 | exit (STATE_OK); | ||
| 410 | case 'V': /* version */ | ||
| 411 | print_revision (progname, revision); | ||
| 412 | exit (STATE_OK); | ||
| 413 | case 'v': /* verbose */ | ||
| 414 | verbose = TRUE; | ||
| 415 | break; | ||
| 416 | |||
| 417 | /* Connection info */ | ||
| 418 | case 'C': /* group or community */ | ||
| 419 | community = optarg; | ||
| 420 | break; | ||
| 421 | case 'H': /* Host or server */ | ||
| 422 | server_address = optarg; | ||
| 423 | break; | ||
| 424 | case 'p': /* TCP port number */ | ||
| 425 | port = optarg; | ||
| 426 | break; | ||
| 427 | case 'm': /* List of MIBS */ | ||
| 428 | miblist = optarg; | ||
| 429 | break; | ||
| 430 | case 'P': /* SNMP protocol version */ | ||
| 431 | proto = optarg; | ||
| 432 | break; | ||
| 433 | case 'L': /* security level */ | ||
| 434 | seclevel = optarg; | ||
| 435 | break; | ||
| 436 | case 'U': /* security username */ | ||
| 437 | secname = optarg; | ||
| 438 | break; | ||
| 439 | case 'a': /* auth protocol */ | ||
| 440 | authproto = optarg; | ||
| 441 | break; | ||
| 442 | case 'A': /* auth passwd */ | ||
| 443 | authpasswd = optarg; | ||
| 444 | break; | ||
| 445 | case 'X': /* priv passwd */ | ||
| 446 | privpasswd = optarg; | ||
| 447 | break; | ||
| 448 | case 't': /* timeout period */ | ||
| 449 | if (!is_integer (optarg)) | ||
| 450 | usage2 (_("Timeout interval must be a positive integer"), optarg); | ||
| 451 | else | ||
| 452 | timeout_interval = atoi (optarg); | ||
| 453 | break; | ||
| 454 | |||
| 455 | /* Test parameters */ | ||
| 456 | case 'c': /* critical time threshold */ | ||
| 457 | if (strspn (optarg, "0123456789:,") < strlen (optarg)) | ||
| 458 | usage2 (_("Invalid critical threshold: %s\n"), optarg); | ||
| 459 | for (ptr = optarg; ptr && jj < MAX_OIDS; jj++) { | ||
| 460 | if (lu_getll (&lower_crit_lim[jj], ptr) == 1) | ||
| 461 | eval_method[jj] |= CRIT_LT; | ||
| 462 | if (lu_getul (&upper_crit_lim[jj], ptr) == 1) | ||
| 463 | eval_method[jj] |= CRIT_GT; | ||
| 464 | (ptr = index (ptr, ',')) ? ptr++ : ptr; | ||
| 465 | } | ||
| 466 | break; | ||
| 467 | case 'w': /* warning time threshold */ | ||
| 468 | if (strspn (optarg, "0123456789:,") < strlen (optarg)) | ||
| 469 | usage2 (_("Invalid warning threshold: %s\n"), optarg); | ||
| 470 | for (ptr = optarg; ptr && ii < MAX_OIDS; ii++) { | ||
| 471 | if (lu_getll (&lower_warn_lim[ii], ptr) == 1) | ||
| 472 | eval_method[ii] |= WARN_LT; | ||
| 473 | if (lu_getul (&upper_warn_lim[ii], ptr) == 1) | ||
| 474 | eval_method[ii] |= WARN_GT; | ||
| 475 | (ptr = index (ptr, ',')) ? ptr++ : ptr; | ||
| 476 | } | ||
| 477 | break; | ||
| 478 | case 'e': /* PRELIMINARY - may change */ | ||
| 479 | case 'E': /* PRELIMINARY - may change */ | ||
| 480 | if (!is_integer (optarg)) | ||
| 481 | usage2 (_("Retries interval must be a positive integer"), optarg); | ||
| 482 | else | ||
| 483 | retries = atoi(optarg); | ||
| 484 | break; | ||
| 485 | case 'o': /* object identifier */ | ||
| 486 | for (ptr = optarg; (ptr = index (ptr, ',')); ptr++) | ||
| 487 | ptr[0] = ' '; /* relpace comma with space */ | ||
| 488 | for (ptr = optarg; (ptr = index (ptr, ' ')); ptr++) | ||
| 489 | j++; /* count OIDs */ | ||
| 490 | asprintf (&oid, "%s %s", (oid?oid:""), optarg); | ||
| 491 | if (c == 'E' || c == 'e') { | ||
| 492 | jj++; | ||
| 493 | ii++; | ||
| 494 | } | ||
| 495 | if (c == 'E') | ||
| 496 | eval_method[j+1] |= WARN_PRESENT; | ||
| 497 | else if (c == 'e') | ||
| 498 | eval_method[j+1] |= CRIT_PRESENT; | ||
| 499 | break; | ||
| 500 | case 's': /* string or substring */ | ||
| 501 | strncpy (string_value, optarg, sizeof (string_value) - 1); | ||
| 502 | string_value[sizeof (string_value) - 1] = 0; | ||
| 503 | eval_method[jj++] = CRIT_STRING; | ||
| 504 | ii++; | ||
| 505 | break; | ||
| 506 | case 'R': /* regex */ | ||
| 507 | #ifdef HAVE_REGEX_H | ||
| 508 | cflags = REG_ICASE; | ||
| 509 | #endif | ||
| 510 | case 'r': /* regex */ | ||
| 511 | #ifdef HAVE_REGEX_H | ||
| 512 | cflags |= REG_EXTENDED | REG_NOSUB | REG_NEWLINE; | ||
| 513 | strncpy (regex_expect, optarg, sizeof (regex_expect) - 1); | ||
| 514 | regex_expect[sizeof (regex_expect) - 1] = 0; | ||
| 515 | errcode = regcomp (&preg, regex_expect, cflags); | ||
| 516 | if (errcode != 0) { | ||
| 517 | regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER); | ||
| 518 | printf (_("Could Not Compile Regular Expression")); | ||
| 519 | return ERROR; | ||
| 520 | } | ||
| 521 | eval_method[jj++] = CRIT_REGEX; | ||
| 522 | ii++; | ||
| 523 | #else | ||
| 524 | printf (_("call for regex which was not a compiled option")); | ||
| 525 | exit (STATE_UNKNOWN); | ||
| 526 | #endif | ||
| 527 | break; | ||
| 528 | |||
| 529 | /* Format */ | ||
| 530 | case 'd': /* delimiter */ | ||
| 531 | delimiter = strscpy (delimiter, optarg); | ||
| 532 | break; | ||
| 533 | case 'D': /* output-delimiter */ | ||
| 534 | output_delim = strscpy (output_delim, optarg); | ||
| 535 | break; | ||
| 536 | case 'l': /* label */ | ||
| 537 | label = optarg; | ||
| 538 | nlabels++; | ||
| 539 | if (nlabels >= labels_size) { | ||
| 540 | labels_size += 8; | ||
| 541 | labels = realloc (labels, labels_size); | ||
| 542 | if (labels == NULL) | ||
| 543 | die (STATE_UNKNOWN, _("Could not reallocate labels[%d]"), nlabels); | ||
| 544 | } | ||
| 545 | labels[nlabels - 1] = optarg; | ||
| 546 | ptr = thisarg (optarg); | ||
| 547 | labels[nlabels - 1] = ptr; | ||
| 548 | if (strstr (ptr, "'") == ptr) | ||
| 549 | labels[nlabels - 1] = ptr + 1; | ||
| 550 | while (ptr && (ptr = nextarg (ptr))) { | ||
| 551 | if (nlabels >= labels_size) { | ||
| 552 | labels_size += 8; | ||
| 553 | labels = realloc (labels, labels_size); | ||
| 554 | if (labels == NULL) | ||
| 555 | die (STATE_UNKNOWN, _("Could not reallocate labels\n")); | ||
| 556 | } | ||
| 557 | labels++; | ||
| 558 | ptr = thisarg (ptr); | ||
| 559 | if (strstr (ptr, "'") == ptr) | ||
| 560 | labels[nlabels - 1] = ptr + 1; | ||
| 561 | else | ||
| 562 | labels[nlabels - 1] = ptr; | ||
| 563 | } | ||
| 564 | break; | ||
| 565 | case 'u': /* units */ | ||
| 566 | units = optarg; | ||
| 567 | nunits++; | ||
| 568 | if (nunits >= unitv_size) { | ||
| 569 | unitv_size += 8; | ||
| 570 | unitv = realloc (unitv, unitv_size); | ||
| 571 | if (unitv == NULL) | ||
| 572 | die (STATE_UNKNOWN, _("Could not reallocate units [%d]\n"), nunits); | ||
| 573 | } | ||
| 574 | unitv[nunits - 1] = optarg; | ||
| 575 | ptr = thisarg (optarg); | ||
| 576 | unitv[nunits - 1] = ptr; | ||
| 577 | if (strstr (ptr, "'") == ptr) | ||
| 578 | unitv[nunits - 1] = ptr + 1; | ||
| 579 | while (ptr && (ptr = nextarg (ptr))) { | ||
| 580 | if (nunits >= unitv_size) { | ||
| 581 | unitv_size += 8; | ||
| 582 | unitv = realloc (unitv, unitv_size); | ||
| 583 | if (units == NULL) | ||
| 584 | die (STATE_UNKNOWN, _("Could not realloc() units\n")); | ||
| 585 | } | ||
| 586 | nunits++; | ||
| 587 | ptr = thisarg (ptr); | ||
| 588 | if (strstr (ptr, "'") == ptr) | ||
| 589 | unitv[nunits - 1] = ptr + 1; | ||
| 590 | else | ||
| 591 | unitv[nunits - 1] = ptr; | ||
| 592 | } | ||
| 593 | break; | ||
| 594 | |||
| 595 | } | ||
| 596 | } | ||
| 597 | |||
| 598 | if (server_address == NULL) | ||
| 599 | server_address = argv[optind]; | ||
| 600 | |||
| 601 | if (community == NULL) | ||
| 602 | community = strdup (DEFAULT_COMMUNITY); | ||
| 603 | |||
| 604 | return validate_arguments (); | ||
| 605 | } | ||
| 606 | |||
| 607 | |||
| 608 | /****************************************************************************** | ||
| 609 | |||
| 610 | @@- | ||
| 611 | <sect3> | ||
| 612 | <title>validate_arguments</title> | ||
| 613 | |||
| 614 | <para>&PROTO_validate_arguments;</para> | ||
| 615 | |||
| 616 | <para>Given a database name, this function returns TRUE if the string | ||
| 617 | is a valid PostgreSQL database name, and returns false if it is | ||
| 618 | not.</para> | ||
| 619 | |||
| 620 | <para>Valid PostgreSQL database names are less than &NAMEDATALEN; | ||
| 621 | characters long and consist of letters, numbers, and underscores. The | ||
| 622 | first character cannot be a number, however.</para> | ||
| 623 | |||
| 624 | </sect3> | ||
| 625 | -@@ | ||
| 626 | ******************************************************************************/ | ||
| 627 | |||
| 628 | |||
| 629 | |||
| 630 | int | ||
| 631 | validate_arguments () | ||
| 632 | { | ||
| 633 | |||
| 634 | /* Need better checks to verify seclevel and authproto choices */ | ||
| 635 | |||
| 636 | if (seclevel == NULL) | ||
| 637 | asprintf (&seclevel, "noAuthNoPriv"); | ||
| 638 | |||
| 639 | |||
| 640 | if (authproto == NULL ) | ||
| 641 | asprintf(&authproto, DEFAULT_AUTH_PROTOCOL); | ||
| 642 | |||
| 643 | |||
| 644 | |||
| 645 | if (proto == NULL || (strcmp(proto,DEFAULT_PROTOCOL) == 0) ) { /* default protocol version */ | ||
| 646 | asprintf(&proto, DEFAULT_PROTOCOL); | ||
| 647 | asprintf(&authpriv, "%s%s", "-c ", community); | ||
| 648 | } | ||
| 649 | else if ( strcmp (proto, "3") == 0 ) { /* snmpv3 args */ | ||
| 650 | asprintf(&proto, "%s", "3"); | ||
| 651 | |||
| 652 | if ( (strcmp(seclevel, "noAuthNoPriv") == 0) || seclevel == NULL ) { | ||
| 653 | asprintf(&authpriv, "%s", "-l noAuthNoPriv" ); | ||
| 654 | } | ||
| 655 | else if ( strcmp(seclevel, "authNoPriv") == 0 ) { | ||
| 656 | if ( secname == NULL || authpasswd == NULL) { | ||
| 657 | printf (_("Missing secname (%s) or authpassword (%s) ! \n"),secname, authpasswd ); | ||
| 658 | print_usage (); | ||
| 659 | exit (STATE_UNKNOWN); | ||
| 660 | } | ||
| 661 | asprintf(&authpriv, "-l authNoPriv -a %s -u %s -A %s ", authproto, secname, authpasswd); | ||
| 662 | } | ||
| 663 | else if ( strcmp(seclevel, "authPriv") == 0 ) { | ||
| 664 | if ( secname == NULL || authpasswd == NULL || privpasswd == NULL ) { | ||
| 665 | printf (_("Missing secname (%s), authpassword (%s), or privpasswd (%s)! \n"),secname, authpasswd,privpasswd ); | ||
| 666 | print_usage (); | ||
| 667 | exit (STATE_UNKNOWN); | ||
| 668 | } | ||
| 669 | asprintf(&authpriv, "-l authPriv -a %s -u %s -A %s -x DES -X %s ", authproto, secname, authpasswd, privpasswd); | ||
| 670 | } | ||
| 671 | |||
| 672 | } | ||
| 673 | else { | ||
| 674 | usage2 (_("Invalid SNMP version"), proto); | ||
| 675 | } | ||
| 676 | |||
| 677 | return OK; | ||
| 678 | } | ||
| 679 | |||
| 680 | |||
| 681 | |||
| 682 | char * | ||
| 683 | clarify_message (char *msg) | ||
| 684 | { | ||
| 685 | int i = 0; | ||
| 686 | int foo; | ||
| 687 | char tmpmsg_c[MAX_INPUT_BUFFER]; | ||
| 688 | char *tmpmsg = (char *) &tmpmsg_c; | ||
| 689 | tmpmsg = strcpy (tmpmsg, msg); | ||
| 690 | if (!strncmp (tmpmsg, " Hex:", 5)) { | ||
| 691 | tmpmsg = strtok (tmpmsg, ":"); | ||
| 692 | while ((tmpmsg = strtok (NULL, " "))) { | ||
| 693 | foo = strtol (tmpmsg, NULL, 16); | ||
| 694 | /* Translate chars that are not the same value in the printers | ||
| 695 | * character set. | ||
| 696 | */ | ||
| 697 | switch (foo) { | ||
| 698 | case 208: | ||
| 699 | { | ||
| 700 | foo = 197; | ||
| 701 | break; | ||
| 702 | } | ||
| 703 | case 216: | ||
| 704 | { | ||
| 705 | foo = 196; | ||
| 706 | break; | ||
| 707 | } | ||
| 708 | } | ||
| 709 | msg[i] = foo; | ||
| 710 | i++; | ||
| 711 | } | ||
| 712 | msg[i] = 0; | ||
| 713 | } | ||
| 714 | return (msg); | ||
| 715 | } | ||
| 716 | |||
| 717 | |||
| 718 | |||
| 719 | int | ||
| 720 | check_num (int i) | ||
| 721 | { | ||
| 722 | int result; | ||
| 723 | result = STATE_OK; | ||
| 724 | if (eval_method[i] & WARN_GT && eval_method[i] & WARN_LT && | ||
| 725 | lower_warn_lim[i] > upper_warn_lim[i]) { | ||
| 726 | if (response_value[i] <= lower_warn_lim[i] && | ||
| 727 | response_value[i] >= upper_warn_lim[i]) { | ||
| 728 | result = STATE_WARNING; | ||
| 729 | } | ||
| 730 | } | ||
| 731 | else if | ||
| 732 | ((eval_method[i] & WARN_GT && response_value[i] > upper_warn_lim[i]) || | ||
| 733 | (eval_method[i] & WARN_GE && response_value[i] >= upper_warn_lim[i]) || | ||
| 734 | (eval_method[i] & WARN_LT && response_value[i] < lower_warn_lim[i]) || | ||
| 735 | (eval_method[i] & WARN_LE && response_value[i] <= lower_warn_lim[i]) || | ||
| 736 | (eval_method[i] & WARN_EQ && response_value[i] == upper_warn_lim[i]) || | ||
| 737 | (eval_method[i] & WARN_NE && response_value[i] != upper_warn_lim[i])) { | ||
| 738 | result = STATE_WARNING; | ||
| 739 | } | ||
| 740 | |||
| 741 | if (eval_method[i] & CRIT_GT && eval_method[i] & CRIT_LT && | ||
| 742 | lower_crit_lim[i] > upper_crit_lim[i]) { | ||
| 743 | if (response_value[i] <= lower_crit_lim[i] && | ||
| 744 | response_value[i] >= upper_crit_lim[i]) { | ||
| 745 | result = STATE_CRITICAL; | ||
| 746 | } | ||
| 747 | } | ||
| 748 | else if | ||
| 749 | ((eval_method[i] & CRIT_GT && response_value[i] > upper_crit_lim[i]) || | ||
| 750 | (eval_method[i] & CRIT_GE && response_value[i] >= upper_crit_lim[i]) || | ||
| 751 | (eval_method[i] & CRIT_LT && response_value[i] < lower_crit_lim[i]) || | ||
| 752 | (eval_method[i] & CRIT_LE && response_value[i] <= lower_crit_lim[i]) || | ||
| 753 | (eval_method[i] & CRIT_EQ && response_value[i] == upper_crit_lim[i]) || | ||
| 754 | (eval_method[i] & CRIT_NE && response_value[i] != upper_crit_lim[i])) { | ||
| 755 | result = STATE_CRITICAL; | ||
| 756 | } | ||
| 757 | |||
| 758 | return result; | ||
| 759 | } | ||
| 760 | |||
| 761 | |||
| 762 | |||
| 763 | int | ||
| 764 | lu_getll (unsigned long *ll, char *str) | ||
| 765 | { | ||
| 766 | char tmp[100]; | ||
| 767 | if (strchr (str, ':') == NULL) | ||
| 768 | return 0; | ||
| 769 | if (strchr (str, ',') != NULL && (strchr (str, ',') < strchr (str, ':'))) | ||
| 770 | return 0; | ||
| 771 | if (sscanf (str, "%lu%[:]", ll, tmp) == 2) | ||
| 772 | return 1; | ||
| 773 | return 0; | ||
| 774 | } | ||
| 775 | |||
| 776 | |||
| 777 | |||
| 778 | int | ||
| 779 | lu_getul (unsigned long *ul, char *str) | ||
| 780 | { | ||
| 781 | char tmp[100]; | ||
| 782 | if (sscanf (str, "%lu%[^,]", ul, tmp) == 1) | ||
| 783 | return 1; | ||
| 784 | if (sscanf (str, ":%lu%[^,]", ul, tmp) == 1) | ||
| 785 | return 1; | ||
| 786 | if (sscanf (str, "%*u:%lu%[^,]", ul, tmp) == 1) | ||
| 787 | return 1; | ||
| 788 | return 0; | ||
| 789 | } | ||
| 790 | |||
| 791 | |||
| 792 | |||
| 793 | /* trim leading whitespace | ||
| 794 | if there is a leading quote, make sure it balances */ | ||
| 795 | |||
| 796 | char * | ||
| 797 | thisarg (char *str) | ||
| 798 | { | ||
| 799 | str += strspn (str, " \t\r\n"); /* trim any leading whitespace */ | ||
| 800 | if (strstr (str, "'") == str) { /* handle SIMPLE quoted strings */ | ||
| 801 | if (strlen (str) == 1 || !strstr (str + 1, "'")) | ||
| 802 | die (STATE_UNKNOWN, _("Unbalanced quotes\n")); | ||
| 803 | } | ||
| 804 | return str; | ||
| 805 | } | ||
| 806 | |||
| 807 | |||
| 808 | |||
| 809 | /* if there's a leading quote, advance to the trailing quote | ||
| 810 | set the trailing quote to '\x0' | ||
| 811 | if the string continues, advance beyond the comma */ | ||
| 812 | |||
| 813 | char * | ||
| 814 | nextarg (char *str) | ||
| 815 | { | ||
| 816 | if (strstr (str, "'") == str) { | ||
| 817 | str[0] = 0; | ||
| 818 | if (strlen (str) > 1) { | ||
| 819 | str = strstr (str + 1, "'"); | ||
| 820 | return (++str); | ||
| 821 | } | ||
| 822 | else { | ||
| 823 | return NULL; | ||
| 824 | } | ||
| 825 | } | ||
| 826 | if (strstr (str, ",") == str) { | ||
| 827 | str[0] = 0; | ||
| 828 | if (strlen (str) > 1) { | ||
| 829 | return (++str); | ||
| 830 | } | ||
| 831 | else { | ||
| 832 | return NULL; | ||
| 833 | } | ||
| 834 | } | ||
| 835 | if ((str = strstr (str, ",")) && strlen (str) > 1) { | ||
| 836 | str[0] = 0; | ||
| 837 | return (++str); | ||
| 838 | } | ||
| 839 | return NULL; | ||
| 840 | } | ||
| 841 | |||
| 842 | |||
| 843 | |||
| 844 | void | ||
| 845 | print_help (void) | ||
| 846 | { | ||
| 847 | print_revision (progname, revision); | ||
| 848 | |||
| 849 | printf (COPYRIGHT, copyright, email); | ||
| 850 | |||
| 851 | printf (_("\ | ||
| 852 | Check status of remote machines and obtain sustem information via SNMP\n\n")); | ||
| 853 | |||
| 854 | print_usage (); | ||
| 855 | |||
| 856 | printf (_(UT_HELP_VRSN)); | ||
| 857 | |||
| 858 | printf (_(UT_HOST_PORT), 'p', DEFAULT_PORT); | ||
| 859 | |||
| 860 | /* SNMP and Authentication Protocol */ | ||
| 861 | printf (_("\ | ||
| 862 | -P, --protocol=[1|3]\n\ | ||
| 863 | SNMP protocol version\n\ | ||
| 864 | -L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]\n\ | ||
| 865 | SNMPv3 securityLevel\n\ | ||
| 866 | -a, --authproto=[MD5|SHA]\n\ | ||
| 867 | SNMPv3 auth proto\n")); | ||
| 868 | |||
| 869 | /* Authentication Tokens*/ | ||
| 870 | printf (_("\ | ||
| 871 | -C, --community=STRING\n\ | ||
| 872 | Optional community string for SNMP communication\n\ | ||
| 873 | (default is \"%s\")\n\ | ||
| 874 | -U, --secname=USERNAME\n\ | ||
| 875 | SNMPv3 username\n\ | ||
| 876 | -A, --authpassword=PASSWORD\n\ | ||
| 877 | SNMPv3 authentication password\n\ | ||
| 878 | -X, --privpasswd=PASSWORD\n\ | ||
| 879 | SNMPv3 crypt passwd (DES)\n"), DEFAULT_COMMUNITY); | ||
| 880 | |||
| 881 | /* OID Stuff */ | ||
| 882 | printf (_("\ | ||
| 883 | -o, --oid=OID(s)\n\ | ||
| 884 | Object identifier(s) whose value you wish to query\n\ | ||
| 885 | -m, --miblist=STRING\n\ | ||
| 886 | List of MIBS to be loaded (default = ALL)\n -d, --delimiter=STRING\n\ | ||
| 887 | Delimiter to use when parsing returned data. Default is \"%s\"\n\ | ||
| 888 | Any data on the right hand side of the delimiter is considered\n\ | ||
| 889 | to be the data that should be used in the evaluation.\n"), DEFAULT_DELIMITER); | ||
| 890 | |||
| 891 | /* Tests Against Integers */ | ||
| 892 | printf (_("\ | ||
| 893 | -w, --warning=INTEGER_RANGE(s)\n\ | ||
| 894 | Range(s) which will not result in a WARNING status\n\ | ||
| 895 | -c, --critical=INTEGER_RANGE(s)\n\ | ||
| 896 | Range(s) which will not result in a CRITICAL status\n")); | ||
| 897 | |||
| 898 | /* Tests Against Strings */ | ||
| 899 | printf (_("\ | ||
| 900 | -s, --string=STRING\n\ | ||
| 901 | Return OK state (for that OID) if STRING is an exact match\n\ | ||
| 902 | -r, --ereg=REGEX\n\ | ||
| 903 | Return OK state (for that OID) if extended regular expression REGEX matches\n\ | ||
| 904 | -R, --eregi=REGEX\n\ | ||
| 905 | Return OK state (for that OID) if case-insensitive extended REGEX matches\n\ | ||
| 906 | -l, --label=STRING\n\ | ||
| 907 | Prefix label for output from plugin (default -s 'SNMP')\n")); | ||
| 908 | |||
| 909 | /* Output Formatting */ | ||
| 910 | printf (_("\ | ||
| 911 | -u, --units=STRING\n\ | ||
| 912 | Units label(s) for output data (e.g., 'sec.').\n\ | ||
| 913 | -D, --output-delimiter=STRING\n\ | ||
| 914 | Separates output on multiple OID requests\n")); | ||
| 915 | |||
| 916 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
| 917 | |||
| 918 | printf (_(UT_VERBOSE)); | ||
| 919 | |||
| 920 | printf (_("\n\ | ||
| 921 | - This plugin uses the 'snmpget' command included with the NET-SNMP package.\n\ | ||
| 922 | If you don't have the package installed, you will need to download it from\n\ | ||
| 923 | http://net-snmp.sourceforge.net before you can use this plugin.\n")); | ||
| 924 | |||
| 925 | printf (_("\ | ||
| 926 | - Multiple OIDs may be indicated by a comma- or space-delimited list (lists with\n\ | ||
| 927 | internal spaces must be quoted) [max 8 OIDs]\n")); | ||
| 928 | |||
| 929 | printf (_("\ | ||
| 930 | - Ranges are inclusive and are indicated with colons. When specified as\n\ | ||
| 931 | 'min:max' a STATE_OK will be returned if the result is within the indicated\n\ | ||
| 932 | range or is equal to the upper or lower bound. A non-OK state will be\n\ | ||
| 933 | returned if the result is outside the specified range.\n")); | ||
| 934 | |||
| 935 | printf (_("\ | ||
| 936 | - If specified in the order 'max:min' a non-OK state will be returned if the\n\ | ||
| 937 | result is within the (inclusive) range.\n")); | ||
| 938 | |||
| 939 | printf (_("\ | ||
| 940 | - Upper or lower bounds may be omitted to skip checking the respective limit.\n\ | ||
| 941 | - Bare integers are interpreted as upper limits.\n\ | ||
| 942 | - When checking multiple OIDs, separate ranges by commas like '-w 1:10,1:,:20'\n\ | ||
| 943 | - Note that only one string and one regex may be checked at present\n\ | ||
| 944 | - All evaluation methods other than PR, STR, and SUBSTR expect that the value\n\ | ||
| 945 | returned from the SNMP query is an unsigned integer.\n")); | ||
| 946 | |||
| 947 | printf (_(UT_SUPPORT)); | ||
| 948 | } | ||
| 949 | |||
| 950 | |||
| 951 | |||
| 952 | void | ||
| 953 | print_usage (void) | ||
| 954 | { | ||
| 955 | printf ("\ | ||
| 956 | Usage: %s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range] \n\ | ||
| 957 | [-C community] [-s string] [-r regex] [-R regexi]\n\ | ||
| 958 | [-t timeout] [-e retries]\n\ | ||
| 959 | [-l label] [-u units] [-p port-number] [-d delimiter]\n\ | ||
| 960 | [-D output-delimiter] [-m miblist] [-P snmp version]\n\ | ||
| 961 | [-L seclevel] [-U secname] [-a authproto] [-A authpasswd]\n\ | ||
| 962 | [-X privpasswd]\n", progname); | ||
| 963 | } | ||
diff --git a/web/attachments/116587-diffs.txt b/web/attachments/116587-diffs.txt new file mode 100644 index 0000000..f685d0d --- /dev/null +++ b/web/attachments/116587-diffs.txt | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | 34c34 | ||
| 2 | < -H <ip_address> -o <OID> [-n] [-w warn_range] [-c crit_range] \n\ | ||
| 3 | --- | ||
| 4 | > -H <ip_address> -o <OID> [-w warn_range] [-c crit_range] \n\ | ||
| 5 | 46,47d45 | ||
| 6 | < -n\n\ | ||
| 7 | < Use snmpgetnext instead of snmpget\n\ | ||
| 8 | 199d196 | ||
| 9 | < int usesnmpgetnext = FALSE; | ||
| 10 | 239,244c236 | ||
| 11 | < if (usesnmpgetnext == TRUE) { | ||
| 12 | < asprintf (&command_line, "%s -t 1 -r %d -m %s -v %s %s %s:%s %s", | ||
| 13 | < PATH_TO_SNMPGETNEXT, timeout_interval - 1, miblist, proto, | ||
| 14 | < authpriv, server_address, port, oid); | ||
| 15 | < } else { | ||
| 16 | < asprintf (&command_line, "%s -t 1 -r %d -m %s -v %s %s %s:%s %s", | ||
| 17 | --- | ||
| 18 | > asprintf (&command_line, "%s -t 1 -r %d -m %s -v %s %s %s:%s %s", | ||
| 19 | 247d238 | ||
| 20 | < } | ||
| 21 | 477c468 | ||
| 22 | < getopt_long (argc, argv, "nhvVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:m:P:L:U:a:A:X:", | ||
| 23 | --- | ||
| 24 | > getopt_long (argc, argv, "hvVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:m:P:L:U:a:A:X:", | ||
| 25 | 480c471 | ||
| 26 | < c = getopt (argc, argv, "nhvVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:m:P:L:U:a:A:X:"); | ||
| 27 | --- | ||
| 28 | > c = getopt (argc, argv, "hvVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:m:P:L:U:a:A:X:"); | ||
| 29 | 498,500d488 | ||
| 30 | < case 'n': /* usesnmpgetnext */ | ||
| 31 | < usesnmpgetnext = TRUE; | ||
| 32 | < break; | ||
diff --git a/web/attachments/116649-check_procs_perfdata.diff b/web/attachments/116649-check_procs_perfdata.diff new file mode 100644 index 0000000..94bcddf --- /dev/null +++ b/web/attachments/116649-check_procs_perfdata.diff | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | --- nagios-plugins-HEAD-200501200547/plugins/check_procs.c 2004-12-29 22:41:39.000000000 -0200 | ||
| 2 | +++ check_procs.c 2005-01-20 14:37:19.000000000 -0200 | ||
| 3 | @@ -54,6 +54,9 @@ | ||
| 4 | #define ELAPSED 512 | ||
| 5 | /* Different metrics */ | ||
| 6 | char *metric_name; | ||
| 7 | +char *perf_procs; | ||
| 8 | +char *perf_metric; | ||
| 9 | + | ||
| 10 | enum metric { | ||
| 11 | METRIC_PROCS, | ||
| 12 | METRIC_VSZ, | ||
| 13 | @@ -290,6 +293,36 @@ | ||
| 14 | } | ||
| 15 | printf (ngettext ("%d process", "%d processes", (unsigned long) procs), procs); | ||
| 16 | |||
| 17 | + perf_procs = NULL; | ||
| 18 | + perf_metric = NULL; | ||
| 19 | + | ||
| 20 | + if (metric == METRIC_PROCS) { | ||
| 21 | + perf_procs = strscpy(perf_procs,perfdata("Processes", procs, "", | ||
| 22 | + (wmax > 0), wmax , (cmax > 0), cmax , | ||
| 23 | + 0, 0, 0, 0)); | ||
| 24 | + } else { | ||
| 25 | + perf_metric = strscpy(perf_metric, "Processes: Normal "); | ||
| 26 | + perf_metric = strcat(perf_metric, metric_name); | ||
| 27 | + perf_procs = strscpy(perf_procs, perfdata(perf_metric, procs, "", | ||
| 28 | + 0, 0, 0, 0, | ||
| 29 | + 0, 0, 0, 0)); | ||
| 30 | + perf_metric = strscpy(perf_metric, "Processes: Warning "); | ||
| 31 | + perf_metric = strcat(perf_metric, metric_name); | ||
| 32 | + perf_procs = strcat(perf_procs, " "); | ||
| 33 | + perf_procs = strcat(perf_procs, perfdata(perf_metric, warn, "", | ||
| 34 | + 0, 0, 0, 0, | ||
| 35 | + 0, 0, 0, 0)); | ||
| 36 | + perf_metric = strscpy(perf_metric, "Processes: Critical "); | ||
| 37 | + perf_metric = strcat(perf_metric, metric_name); | ||
| 38 | + perf_procs = strcat(perf_procs, " "); | ||
| 39 | + perf_procs = strcat(perf_procs, perfdata(perf_metric, crit, "", | ||
| 40 | + 0, 0, 0, 0, | ||
| 41 | + 1, 0, 0, 0)); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + printf (" | %s", perf_procs); | ||
| 45 | + | ||
| 46 | + | ||
| 47 | if (strcmp(fmt,"") != 0) { | ||
| 48 | printf (_(" with %s"), fmt); | ||
| 49 | } | ||
diff --git a/web/attachments/116760-nagiosplug-check_nt.diff b/web/attachments/116760-nagiosplug-check_nt.diff new file mode 100644 index 0000000..0d1a578 --- /dev/null +++ b/web/attachments/116760-nagiosplug-check_nt.diff | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | --- check_nt.c 2005-01-22 05:16:38.000000000 -0500 | ||
| 2 | +++ check_nt.c.1.4snapshot 2005-01-22 03:26:29.000000000 -0500 | ||
| 3 | @@ -32,7 +32,7 @@ | ||
| 4 | |||
| 5 | const char *progname = "check_nt"; | ||
| 6 | const char *revision = "$Revision: 1.39 $"; | ||
| 7 | -const char *copyright = "2003-2005"; | ||
| 8 | +const char *copyright = "2003-2004"; | ||
| 9 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 10 | |||
| 11 | #include "common.h" | ||
| 12 | @@ -392,7 +392,7 @@ | ||
| 13 | case CHECK_FILEAGE: | ||
| 14 | |||
| 15 | if (value_list==NULL) | ||
| 16 | - output_message = strdup (_("No file specified")); | ||
| 17 | + output_message = strdup (_("No counter specified")); | ||
| 18 | else { | ||
| 19 | preparelist(value_list); /* replace , between services with & to send the request */ | ||
| 20 | asprintf(&send_buffer,"%s&9&%s", req_password,value_list); | ||
| 21 | @@ -573,7 +573,7 @@ | ||
| 22 | die (result, _("could not fetch information from server\n")); | ||
| 23 | |||
| 24 | if (!strncmp(recv_buffer,"ERROR",5)) | ||
| 25 | - die (STATE_UNKNOWN, "Client - %s\n",recv_buffer); /*changed from NSClient to be inclsive of NC_Net*/ | ||
| 26 | + die (STATE_UNKNOWN, "NSClient - %s\n",recv_buffer); | ||
| 27 | } | ||
| 28 | |||
| 29 | int strtoularray(unsigned long *array, char *string, const char *delim) { | ||
| 30 | @@ -614,7 +614,7 @@ | ||
| 31 | printf ("Copyright (c) 2000 Yves Rubin (rubiyz@yahoo.com)\n"); | ||
| 32 | printf (COPYRIGHT, copyright, email); | ||
| 33 | |||
| 34 | - printf (_("This plugin collects data from the NSClient or NC_Net service running on a\n\ | ||
| 35 | + printf (_("This plugin collects data from the NSClient service running on a\n\ | ||
| 36 | Windows NT/2000/XP/2003 server.\n\n")); | ||
| 37 | |||
| 38 | print_usage(); | ||
| 39 | @@ -665,32 +665,24 @@ | ||
| 40 | Request a -l parameters with the following syntax:\n\ | ||
| 41 | -l <service1>,<service2>,<service3>,...\n\ | ||
| 42 | You can specify -d SHOWALL in case you want to see working services\n\ | ||
| 43 | - in the returned string.\n")); | ||
| 44 | + in the returned string.\n")); | ||
| 45 | printf (_("\ | ||
| 46 | PROCSTATE = Check if one or several process are running.\n\ | ||
| 47 | Same syntax as SERVICESTATE.\n")); | ||
| 48 | printf (_("\ | ||
| 49 | COUNTER = Check any performance counter of Windows NT/2000.\n\ | ||
| 50 | Request a -l parameters with the following syntax:\n\ | ||
| 51 | - -l \"\\\\<performance object>\\\\counter\",\"<description>\n\ | ||
| 52 | + -l \"\\\\<performance object>\\\\counter\",\"<description>\n\ | ||
| 53 | The <description> parameter is optional and \n\ | ||
| 54 | is given to a printf output command which requires a float parameter.\n\ | ||
| 55 | If <description> does not include \"%%\", it is used as a label.\n\ | ||
| 56 | Some examples:\n\ | ||
| 57 | \"Paging file usage is %%.2f %%%%\"\n\ | ||
| 58 | \"%%.f %%%% paging file used.\"\n")); | ||
| 59 | - printf (_("\ | ||
| 60 | - FILEAGE = Checks how old a file is .\n\ | ||
| 61 | - Request a -l parameters with the following syntax:\n\ | ||
| 62 | - -l \"<File path>\\\\<File Name>\" | ||
| 63 | - Warning and critical thresholds can be specified with -w and -c.\n")); | ||
| 64 | - | ||
| 65 | printf (_("Notes:\n\ | ||
| 66 | - - The NSClient service should be running on the server to get any information\n\ | ||
| 67 | - (http://nsclient.ready2run.nl).\n\ | ||
| 68 | - or NC_Net should be running. DO not run both at the same time.\n\ | ||
| 69 | - (http://www.shatterit.com/NC_Net).\n\ | ||
| 70 | - - Critical thresholds should be lower than warning thresholds\n")); | ||
| 71 | + - The NSClient service should be running on the server to get any information\n\ | ||
| 72 | + (http://nsclient.ready2run.nl).\n\ | ||
| 73 | + - Critical thresholds should be lower than warning thresholds\n")); | ||
| 74 | } | ||
| 75 | |||
| 76 | |||
diff --git a/web/attachments/116765-nagiosplug-check_nt.diff b/web/attachments/116765-nagiosplug-check_nt.diff new file mode 100644 index 0000000..9aaef28 --- /dev/null +++ b/web/attachments/116765-nagiosplug-check_nt.diff | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | --- check_nt.c 2005-01-22 07:01:52.000000000 -0500 | ||
| 2 | +++ check_nt.c.1.4snapshot 2005-01-22 03:26:29.000000000 -0500 | ||
| 3 | @@ -49,8 +49,7 @@ | ||
| 4 | CHECK_PROCSTATE, | ||
| 5 | CHECK_MEMUSE, | ||
| 6 | CHECK_COUNTER, | ||
| 7 | - CHECK_FILEAGE, | ||
| 8 | - CHECK_INSTANCES | ||
| 9 | + CHECK_FILEAGE | ||
| 10 | }; | ||
| 11 | |||
| 12 | enum { | ||
| 13 | @@ -421,19 +420,6 @@ | ||
| 14 | } | ||
| 15 | break; | ||
| 16 | |||
| 17 | - case CHECK_INSTANCES: | ||
| 18 | - | ||
| 19 | - if (value_list==NULL) | ||
| 20 | - output_message = strdup (_("No Perfomance counter Category specified")); | ||
| 21 | - else { | ||
| 22 | - preparelist(value_list); /* replace , between services with & to send the request */ | ||
| 23 | - asprintf(&send_buffer,"%s&10&%s", req_password,value_list); | ||
| 24 | - fetch_data (server_address, server_port, send_buffer); | ||
| 25 | - asprintf (&output_message, "%s", recv_buffer); | ||
| 26 | - return_code = STATE_OK; | ||
| 27 | - } | ||
| 28 | - break; | ||
| 29 | - | ||
| 30 | case CHECK_NONE: | ||
| 31 | default: | ||
| 32 | usage4 (_("Please specify a variable to check")); | ||
| 33 | @@ -541,8 +527,6 @@ | ||
| 34 | vars_to_check=CHECK_COUNTER; | ||
| 35 | else if(!strcmp(optarg,"FILEAGE")) | ||
| 36 | vars_to_check=CHECK_FILEAGE; | ||
| 37 | - else if(!strcmp(optarg,"INSTANCES")) | ||
| 38 | - vars_to_check=CHECK_INSTANCES; | ||
| 39 | else | ||
| 40 | return ERROR; | ||
| 41 | break; | ||
| 42 | @@ -695,14 +679,6 @@ | ||
| 43 | Some examples:\n\ | ||
| 44 | \"Paging file usage is %%.2f %%%%\"\n\ | ||
| 45 | \"%%.f %%%% paging file used.\"\n")); | ||
| 46 | - printf (_("\ | ||
| 47 | - CHECK_INSTANCES = Check any performance counter Category for availible instances.\n\ | ||
| 48 | - Request a -l parameters with the following syntax:\n\ | ||
| 49 | - -l <Perfomance Counter Category>,<Perfomance Counter Category>,...\n\ | ||
| 50 | - Does not use -w or -c, \n\ | ||
| 51 | - returns a list of Instances for each Category in the list of categories.\n\ | ||
| 52 | - example: \n\ | ||
| 53 | - -l \"Memory,Process,Print Queue\"\n")); | ||
| 54 | printf (_("Notes:\n\ | ||
| 55 | - The NSClient service should be running on the server to get any information\n\ | ||
| 56 | (http://nsclient.ready2run.nl).\n\ | ||
diff --git a/web/attachments/116832-check_dig_tabspatch.diff b/web/attachments/116832-check_dig_tabspatch.diff new file mode 100644 index 0000000..552c6b9 --- /dev/null +++ b/web/attachments/116832-check_dig_tabspatch.diff | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | Index: check_dig.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_dig.c,v | ||
| 4 | retrieving revision 1.39 | ||
| 5 | diff -c -r1.39 check_dig.c | ||
| 6 | *** check_dig.c 25 Dec 2004 23:17:38 -0000 1.39 | ||
| 7 | --- check_dig.c 23 Jan 2005 05:00:19 -0000 | ||
| 8 | *************** | ||
| 9 | *** 124,129 **** | ||
| 10 | --- 124,133 ---- | ||
| 11 | result = STATE_OK; | ||
| 12 | } | ||
| 13 | |||
| 14 | + /* rmo: 050122 - Translate output TAB -> SPACE */ | ||
| 15 | + char *t = output; | ||
| 16 | + while ((t = index(t, '\t')) != NULL) {*t = ' ';} | ||
| 17 | + | ||
| 18 | } while (!strstr (input_buffer, ";; ")); | ||
| 19 | |||
| 20 | if (result == STATE_UNKNOWN) { | ||
| 21 | *************** | ||
| 22 | *** 334,340 **** | ||
| 23 | |||
| 24 | printf (_("\ | ||
| 25 | -a, --expected_address=STRING\n\ | ||
| 26 | ! an address expected to be in the asnwer section.\n\ | ||
| 27 | if not set, uses whatever was in -l\n")); | ||
| 28 | |||
| 29 | printf (_(UT_WARN_CRIT)); | ||
| 30 | --- 338,344 ---- | ||
| 31 | |||
| 32 | printf (_("\ | ||
| 33 | -a, --expected_address=STRING\n\ | ||
| 34 | ! an address expected to be in the answer section.\n\ | ||
| 35 | if not set, uses whatever was in -l\n")); | ||
| 36 | |||
| 37 | printf (_(UT_WARN_CRIT)); | ||
| 38 | |||
diff --git a/web/attachments/116909-nagiosplug-check_nt.diff b/web/attachments/116909-nagiosplug-check_nt.diff new file mode 100644 index 0000000..c9426b8 --- /dev/null +++ b/web/attachments/116909-nagiosplug-check_nt.diff | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | --- check_nt.c 2005-01-24 03:18:40.000000000 -0500 | ||
| 2 | +++ check_nt.c.1.4snapshot 2005-01-22 03:26:29.000000000 -0500 | ||
| 3 | @@ -49,8 +49,7 @@ | ||
| 4 | CHECK_PROCSTATE, | ||
| 5 | CHECK_MEMUSE, | ||
| 6 | CHECK_COUNTER, | ||
| 7 | - CHECK_FILEAGE, | ||
| 8 | - CHECK_EVENTLOG | ||
| 9 | + CHECK_FILEAGE | ||
| 10 | }; | ||
| 11 | |||
| 12 | enum { | ||
| 13 | @@ -421,18 +420,6 @@ | ||
| 14 | } | ||
| 15 | break; | ||
| 16 | |||
| 17 | - case CHECK_EVENTLOG: | ||
| 18 | - if (value_list==NULL) | ||
| 19 | - asprintf(&send_buffer,"%s&11", req_password); | ||
| 20 | - else { | ||
| 21 | - asprintf(&send_buffer,"%s&11&%s", req_password,value_list); | ||
| 22 | - } | ||
| 23 | - fetch_data (server_address, server_port, send_buffer); | ||
| 24 | - return_code=atoi(strtok(recv_buffer,"&")); | ||
| 25 | - temp_string=strtok(NULL,"&"); | ||
| 26 | - output_message = strdup (temp_string); | ||
| 27 | - break; | ||
| 28 | - | ||
| 29 | case CHECK_NONE: | ||
| 30 | default: | ||
| 31 | usage4 (_("Please specify a variable to check")); | ||
| 32 | @@ -540,8 +527,6 @@ | ||
| 33 | vars_to_check=CHECK_COUNTER; | ||
| 34 | else if(!strcmp(optarg,"FILEAGE")) | ||
| 35 | vars_to_check=CHECK_FILEAGE; | ||
| 36 | - else if(!strcmp(optarg,"EVENTLOG")) | ||
| 37 | - vars_to_check=CHECK_EVENTLOG; | ||
| 38 | else | ||
| 39 | return ERROR; | ||
| 40 | break; | ||
| 41 | @@ -694,42 +679,6 @@ | ||
| 42 | Some examples:\n\ | ||
| 43 | \"Paging file usage is %%.2f %%%%\"\n\ | ||
| 44 | \"%%.f %%%% paging file used.\"\n")); | ||
| 45 | - printf (_("\ | ||
| 46 | - EVENTLOG = Check any Event Log in Windows for any entry.\n\ | ||
| 47 | - Request a -l parameters with the following syntax:\n\ | ||
| 48 | - -l \"<Event Log>,<Event Type>,<minutes range>,\n\ | ||
| 49 | - <Source Filter list>,<Message Filter List>,<Event ID Filter List>\"\n\ | ||
| 50 | - <Event Log> - any, System, Application, Security \n\ | ||
| 51 | - or any other non-standard Event Log. 'any' will check all logs.\n\ | ||
| 52 | - <Event Type> - any, Information, Warning, Error,\n\ | ||
| 53 | - or other non-standard Event Type. 'any' will check all Types.\n\ | ||
| 54 | - <minutes range> - Maximum age in minutes of event entries to check.\n\ | ||
| 55 | - Use 0 to check all event Entries in log.\n\ | ||
| 56 | - <Source Filter List> Use 0 to diable the Source Filter.\n\ | ||
| 57 | - Otherwise enter a comma seperated list \n\ | ||
| 58 | - with the first element being the number of items in the list.\n\ | ||
| 59 | - Use a negitive number to Exclude matching entries.\n\ | ||
| 60 | - Use a positive number to Include only matching entries.\n\ | ||
| 61 | - <Message Filter List> Use 0 to diable the Message Filter.\n\ | ||
| 62 | - (Message Filter accepts Regular Expressions) \n\ | ||
| 63 | - Otherwise enter a comma seperated list \n\ | ||
| 64 | - with the first element being the number of items in the list.\n\ | ||
| 65 | - Use a negitive number to Exclude matching entries.\n\ | ||
| 66 | - Use a Positive number to Include only matching entries.\n\ | ||
| 67 | - <Event ID Filter List> Use 0 to diable the Event ID Filter.\n\ | ||
| 68 | - Otherwise enter a comma seperated list with the first element\n\ | ||
| 69 | - being the number of items in the list.\n\ | ||
| 70 | - Use a negitive sign to Exclude matching entries.\n\ | ||
| 71 | - Use a positive number to Include only matching entries.\n\ | ||
| 72 | - Examples:\n\ | ||
| 73 | - The Following examples will list all events in the System Event Log\n\ | ||
| 74 | - that have a source of eventlog and have the word start or stop\n\ | ||
| 75 | - withing the event message.\n\ | ||
| 76 | - -l \"System,any,0,1,eventlog,2,start,stop,0\"\n\ | ||
| 77 | - -l \"System,any,0,1,eventlog,1,(start|stop),0\"\n\ | ||
| 78 | - \n")); | ||
| 79 | - | ||
| 80 | - | ||
| 81 | printf (_("Notes:\n\ | ||
| 82 | - The NSClient service should be running on the server to get any information\n\ | ||
| 83 | (http://nsclient.ready2run.nl).\n\ | ||
diff --git a/web/attachments/117424-check_log.sh.patch b/web/attachments/117424-check_log.sh.patch new file mode 100644 index 0000000..6d6fdb8 --- /dev/null +++ b/web/attachments/117424-check_log.sh.patch | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | --- check_log.sh 2002-10-28 13:05:07.000000000 +0000 | ||
| 2 | +++ check_log.sh.new 2005-01-27 18:51:26.000000000 +0000 | ||
| 3 | @@ -164,8 +164,8 @@ | ||
| 4 | |||
| 5 | # If the source log file doesn't exist, exit | ||
| 6 | |||
| 7 | -if [ ! -e $logfile ]; then | ||
| 8 | - $ECHO "Log check error: Log file $logfile does not exist!\n" | ||
| 9 | +if [ ! -r $logfile ]; then | ||
| 10 | + $ECHO "Log check error: Log file $logfile does not exist or you do not have read permission!\n" | ||
| 11 | exit $STATE_UNKNOWN | ||
| 12 | fi | ||
| 13 | |||
diff --git a/web/attachments/117526-cel.diff b/web/attachments/117526-cel.diff new file mode 100644 index 0000000..f205f63 --- /dev/null +++ b/web/attachments/117526-cel.diff | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | *** /tools/nagios/libexec/check_email_loop.pl.orig Fri Jan 28 08:08:29 2005 | ||
| 2 | --- /tools/nagios/libexec/check_email_loop.pl Fri Jan 28 08:38:01 2005 | ||
| 3 | *************** | ||
| 4 | *** 42,51 **** | ||
| 5 | my $state = "UNKNOWN"; | ||
| 6 | my ($sender,$receiver, $pophost, $popuser, $poppasswd, $smtphost); | ||
| 7 | my ($poptimeout,$smtptimeout,$pinginterval)=(60,60,5); | ||
| 8 | ! my ($lostwarn, $lostcrit,$pendwarn, $pendcrit); | ||
| 9 | |||
| 10 | # Internal Vars | ||
| 11 | my ($pop,$msgcount,@msglines,$statinfo,@messageids,$newestid); | ||
| 12 | my ($matchcount,$statfile) = (0,"check_email_loop.stat"); | ||
| 13 | |||
| 14 | # Subs declaration | ||
| 15 | --- 42,52 ---- | ||
| 16 | my $state = "UNKNOWN"; | ||
| 17 | my ($sender,$receiver, $pophost, $popuser, $poppasswd, $smtphost); | ||
| 18 | my ($poptimeout,$smtptimeout,$pinginterval)=(60,60,5); | ||
| 19 | ! my ($lostwarn, $lostcrit,$pendwarn, $pendcrit, $debug); | ||
| 20 | |||
| 21 | # Internal Vars | ||
| 22 | my ($pop,$msgcount,@msglines,$statinfo,@messageids,$newestid); | ||
| 23 | + my(%other_smtp_opts); | ||
| 24 | my ($matchcount,$statfile) = (0,"check_email_loop.stat"); | ||
| 25 | |||
| 26 | # Subs declaration | ||
| 27 | *************** | ||
| 28 | *** 65,70 **** | ||
| 29 | --- 66,72 ---- | ||
| 30 | my $status = GetOptions( | ||
| 31 | "from=s",\$sender, | ||
| 32 | "to=s",\$receiver, | ||
| 33 | + "debug", \$debug, | ||
| 34 | "pophost=s",\$pophost, | ||
| 35 | "popuser=s",\$popuser, | ||
| 36 | "passwd=s",\$poppasswd, | ||
| 37 | *************** | ||
| 38 | *** 101,108 **** | ||
| 39 | my $serial = time(); | ||
| 40 | $serial = "ID#" . $serial . "#$$"; | ||
| 41 | |||
| 42 | # sending new ping email | ||
| 43 | ! my $smtp = Net::SMTP->new($smtphost,Timeout=>$smtptimeout) | ||
| 44 | || nsexit("SMTP connect timeout ($smtptimeout s)",'CRITICAL'); | ||
| 45 | ($smtp->mail($sender) && | ||
| 46 | $smtp->to($receiver) && | ||
| 47 | --- 103,116 ---- | ||
| 48 | my $serial = time(); | ||
| 49 | $serial = "ID#" . $serial . "#$$"; | ||
| 50 | |||
| 51 | + | ||
| 52 | # sending new ping email | ||
| 53 | ! %other_smtp_opts={}; | ||
| 54 | ! if ( $debug == 1 ) { | ||
| 55 | ! $other_smtp_opts{'Debug'} = 1; | ||
| 56 | ! } | ||
| 57 | ! | ||
| 58 | ! my $smtp = Net::SMTP->new($smtphost,Timeout=>$smtptimeout, %other_smtp_opts) | ||
| 59 | || nsexit("SMTP connect timeout ($smtptimeout s)",'CRITICAL'); | ||
| 60 | ($smtp->mail($sender) && | ||
| 61 | $smtp->to($receiver) && | ||
| 62 | *************** | ||
| 63 | *** 216,221 **** | ||
| 64 | --- 224,230 ---- | ||
| 65 | print " -lostcrit=num CRITICAL \n"; | ||
| 66 | print " -pendwarn=num WARNING-state if more than num pending emails\n"; | ||
| 67 | print " -pendcrit=num CRITICAL \n"; | ||
| 68 | + print " -debug send SMTP tranaction info to stderr\n"; | ||
| 69 | print " Options may abbreviated!\n"; | ||
| 70 | print " LOST mails are mails, being sent before the last mail arrived back.\n"; | ||
| 71 | print " PENDING mails are those, which are not. (supposed to be on the way)\n"; | ||
diff --git a/web/attachments/118230-check_http.c.diff b/web/attachments/118230-check_http.c.diff new file mode 100644 index 0000000..336ea2e --- /dev/null +++ b/web/attachments/118230-check_http.c.diff | |||
| @@ -0,0 +1,133 @@ | |||
| 1 | *** nagios-plugins-1.4-beta1/plugins/check_http.c 2004-12-24 03:54:24.000000000 +0900 | ||
| 2 | --- check_http.c 2005-01-26 15:31:53.374334612 +0900 | ||
| 3 | *************** | ||
| 4 | *** 66,71 **** | ||
| 5 | --- 66,73 ---- | ||
| 6 | X509 *server_cert; | ||
| 7 | int connect_SSL (void); | ||
| 8 | int check_certificate (X509 **); | ||
| 9 | + # define VERIFY_CERTIFICATE 10 | ||
| 10 | + # define CAFILE 11 | ||
| 11 | #endif | ||
| 12 | int no_body = FALSE; | ||
| 13 | int maximum_age = -1; | ||
| 14 | *************** | ||
| 15 | *** 111,116 **** | ||
| 16 | --- 113,123 ---- | ||
| 17 | char *http_opt_headers; | ||
| 18 | int onredirect = STATE_OK; | ||
| 19 | int use_ssl = FALSE; | ||
| 20 | + int verify_certificate = FALSE; | ||
| 21 | + int use_cafile = FALSE; | ||
| 22 | + int CAfile = FALSE; | ||
| 23 | + int cert_verify_result; | ||
| 24 | + char *trusted_ca_file=NULL; | ||
| 25 | int verbose = FALSE; | ||
| 26 | int sd; | ||
| 27 | int min_page_len = 0; | ||
| 28 | *************** | ||
| 29 | *** 206,211 **** | ||
| 30 | --- 213,220 ---- | ||
| 31 | {"link", no_argument, 0, 'L'}, | ||
| 32 | {"nohtml", no_argument, 0, 'n'}, | ||
| 33 | {"ssl", no_argument, 0, 'S'}, | ||
| 34 | + {"certverify", no_argument, 0, VERIFY_CERTIFICATE}, | ||
| 35 | + {"CAfile", required_argument, 0, CAFILE}, | ||
| 36 | {"verbose", no_argument, 0, 'v'}, | ||
| 37 | {"post", required_argument, 0, 'P'}, | ||
| 38 | {"IP-address", required_argument, 0, 'I'}, | ||
| 39 | *************** | ||
| 40 | *** 315,320 **** | ||
| 41 | --- 324,351 ---- | ||
| 42 | usage4 (_("Invalid option - SSL is not available")); | ||
| 43 | #endif | ||
| 44 | break; | ||
| 45 | + #ifdef HAVE_SSL | ||
| 46 | + case VERIFY_CERTIFICATE : | ||
| 47 | + use_ssl = TRUE; | ||
| 48 | + verify_certificate = TRUE; | ||
| 49 | + if (specify_port == FALSE) | ||
| 50 | + server_port = HTTPS_PORT; | ||
| 51 | + #else | ||
| 52 | + usage4 (_("Invalid option - SSL is not available")); | ||
| 53 | + #endif | ||
| 54 | + break; | ||
| 55 | + | ||
| 56 | + #ifdef HAVE_SSL | ||
| 57 | + case CAFILE : | ||
| 58 | + if (!verify_certificate) usage2(_("Verify Certificate option not enabled"),optarg); | ||
| 59 | + use_cafile = TRUE; | ||
| 60 | + trusted_ca_file = strdup (optarg); | ||
| 61 | + #else | ||
| 62 | + usage4 (_("Invalid option - SSL is not available")); | ||
| 63 | + #endif | ||
| 64 | + break; | ||
| 65 | + | ||
| 66 | + | ||
| 67 | case 'f': /* onredirect */ | ||
| 68 | if (!strcmp (optarg, "follow")) | ||
| 69 | onredirect = STATE_DEPENDENT; | ||
| 70 | *************** | ||
| 71 | *** 732,738 **** | ||
| 72 | --- 763,771 ---- | ||
| 73 | die (STATE_CRITICAL, _("Unable to open TCP socket\n")); | ||
| 74 | } | ||
| 75 | |||
| 76 | + SSL_get_peer_cert_chain(ssl); /* We don't really mind if there is no cert chain as only the peer cert is needed */ | ||
| 77 | if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) { | ||
| 78 | + cert_verify_result = SSL_get_verify_result( ssl ); | ||
| 79 | X509_free (server_cert); | ||
| 80 | } | ||
| 81 | else { | ||
| 82 | *************** | ||
| 83 | *** 740,745 **** | ||
| 84 | --- 773,785 ---- | ||
| 85 | return STATE_CRITICAL; | ||
| 86 | } | ||
| 87 | |||
| 88 | + if (verify_certificate) { | ||
| 89 | + if (cert_verify_result != X509_V_OK) { | ||
| 90 | + printf ("CRITICAL - Certificate error : %s\n", X509_verify_cert_error_string(cert_verify_result) ); | ||
| 91 | + return STATE_CRITICAL; | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | } | ||
| 96 | else { | ||
| 97 | #endif | ||
| 98 | *************** | ||
| 99 | *** 1191,1196 **** | ||
| 100 | --- 1231,1246 ---- | ||
| 101 | return STATE_CRITICAL; | ||
| 102 | } | ||
| 103 | |||
| 104 | + if (use_cafile) { | ||
| 105 | + SSL_CTX_set_client_CA_list(ctx,SSL_load_client_CA_file(trusted_ca_file)); | ||
| 106 | + if (!SSL_CTX_load_verify_locations(ctx, trusted_ca_file, NULL)) { | ||
| 107 | + printf (_("CRITICAL - Cannot load CAfile.\n")); | ||
| 108 | + }else { | ||
| 109 | + SSL_CTX_set_default_verify_paths(ctx); | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + | ||
| 114 | /* Initialize alarm signal handling */ | ||
| 115 | signal (SIGALRM, socket_timeout_alarm_handler); | ||
| 116 | |||
| 117 | *************** | ||
| 118 | *** 1477,1482 **** | ||
| 119 | --- 1527,1540 ---- | ||
| 120 | STATE_OK is returned. When the certificate is still valid, but for less than\n\ | ||
| 121 | 14 days, a STATE_WARNING is returned. A STATE_CRITICAL will be returned when\n\ | ||
| 122 | the certificate is expired.\n")); | ||
| 123 | + | ||
| 124 | + printf (_("\n\ | ||
| 125 | + CHECK CERTIFICATE VALIDITY: check_http www.myhost.com --certverify \n\n\ | ||
| 126 | + Checks to see the validity of a certificate, will return a critical on any \n\ | ||
| 127 | + certificate error including self signed, untrusted issuer, decryption errors\n\ | ||
| 128 | + or certificate revocation.\n\ | ||
| 129 | + Full list : http://www.openssl.org/docs/apps/verify.html#DIAGNOSTICS\n\n")); | ||
| 130 | + | ||
| 131 | #endif | ||
| 132 | |||
| 133 | printf (_(UT_SUPPORT)); | ||
diff --git a/web/attachments/119194-check_procs.patch b/web/attachments/119194-check_procs.patch new file mode 100644 index 0000000..3510483 --- /dev/null +++ b/web/attachments/119194-check_procs.patch | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | *** check_procs.c.orig Wed Dec 29 16:41:39 2004 | ||
| 2 | --- check_procs.c Tue Feb 8 10:42:34 2005 | ||
| 3 | *************** | ||
| 4 | *** 187,197 **** | ||
| 5 | procppid, procpcpu, procstat, | ||
| 6 | procetime, procprog, procargs); | ||
| 7 | |||
| 8 | ! /* Ignore self */ | ||
| 9 | if (strcmp (procprog, progname) == 0) { | ||
| 10 | continue; | ||
| 11 | } | ||
| 12 | |||
| 13 | if ((options & STAT) && (strstr (statopts, procstat))) | ||
| 14 | resultsum |= STAT; | ||
| 15 | if ((options & ARGS) && procargs && (strstr (procargs, args) != NULL)) | ||
| 16 | --- 187,204 ---- | ||
| 17 | procppid, procpcpu, procstat, | ||
| 18 | procetime, procprog, procargs); | ||
| 19 | |||
| 20 | ! /* Ignore command line self */ | ||
| 21 | ! | ||
| 22 | if (strcmp (procprog, progname) == 0) { | ||
| 23 | continue; | ||
| 24 | } | ||
| 25 | |||
| 26 | + /* Ignore self in process arguments to prevent problems when | ||
| 27 | + check_procs is called via shell (i.e. check_nrpe) */ | ||
| 28 | + | ||
| 29 | + if (strstr (procargs, progname) != NULL) | ||
| 30 | + continue; | ||
| 31 | + | ||
| 32 | if ((options & STAT) && (strstr (statopts, procstat))) | ||
| 33 | resultsum |= STAT; | ||
| 34 | if ((options & ARGS) && procargs && (strstr (procargs, args) != NULL)) | ||
diff --git a/web/attachments/119417-check_ntp-diff b/web/attachments/119417-check_ntp-diff new file mode 100644 index 0000000..11d424d --- /dev/null +++ b/web/attachments/119417-check_ntp-diff | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | 10,19c10 | ||
| 2 | < # $Id: check_ntp.pl,v 1.30 2005/02/09 11:15 mevertse Exp $ | ||
| 3 | < # | ||
| 4 | < # (c) 2005 Merijn Evertse, SARA Computing and Networking Services | ||
| 5 | < # 9-2-2005, 11:15 | ||
| 6 | < # | ||
| 7 | < # Modified the script to accept parameters -4, -6 to choose between the ipv4 and ipv6 protocol. | ||
| 8 | < # When no parameter is specified ipv4 is chosen as the default. | ||
| 9 | < # | ||
| 10 | < # (c) 2004 Matthew Kent | ||
| 11 | < # 19-11-2004, 04:00 | ||
| 12 | --- | ||
| 13 | > # $Id: check_ntp.pl,v 1.20 2004/11/19 03:59:43 mattkent Exp $ | ||
| 14 | 73,74c64,65 | ||
| 15 | < use vars qw($opt_V $opt_h $opt_H $opt_t $opt_w $opt_c $opt_j $opt_k $verbose $PROGNAME $def_jitter $ipv4 $ipv6); | ||
| 16 | < use lib utils.pm; | ||
| 17 | --- | ||
| 18 | > use vars qw($opt_V $opt_h $opt_H $opt_t $opt_w $opt_c $opt_j $opt_k $verbose $PROGNAME $def_jitter); | ||
| 19 | > use lib utils.pm; | ||
| 20 | 97,99c88 | ||
| 21 | < "v" => \$verbose, "verbose" => \$verbose, | ||
| 22 | < "4" => \$ipv4, "use-ipv4" => \$ipv4, | ||
| 23 | < "6" => \$ipv6, "use-ipv6" => \$ipv6, | ||
| 24 | --- | ||
| 25 | > "v" => \$verbose, "verbose" => \$verbose, | ||
| 26 | 191,206d179 | ||
| 27 | < # Determine protocol te be used for ntpdate and ntpq | ||
| 28 | < my $ntpdate; | ||
| 29 | < my $ntpq; | ||
| 30 | < if ($ipv4) { | ||
| 31 | < $ntpdate = $utils::PATH_TO_NTPDATE . " -4"; | ||
| 32 | < $ntpq = $utils::PATH_TO_NTPQ . " -4"; | ||
| 33 | < } | ||
| 34 | < elsif ($ipv6) { | ||
| 35 | < $ntpdate = $utils::PATH_TO_NTPDATE . " -6"; | ||
| 36 | < $ntpq = $utils::PATH_TO_NTPQ . " -6"; | ||
| 37 | < } | ||
| 38 | < else { | ||
| 39 | < # Use IPv4 as the default value | ||
| 40 | < $ntpdate = $utils::PATH_TO_NTPDATE . " -4"; | ||
| 41 | < $ntpq = $utils::PATH_TO_NTPQ . " -4"; | ||
| 42 | < } | ||
| 43 | 214c187 | ||
| 44 | < if (!open (NTPDATE, $ntpdate . " -q $host 2>&1 |")) { | ||
| 45 | --- | ||
| 46 | > if (!open (NTPDATE, "$utils::PATH_TO_NTPDATE -q $host 2>&1 |")) { | ||
| 47 | 289c262 | ||
| 48 | < if ( open(NTPQ, $ntpq . " -np $host 2>&1 |") ) { | ||
| 49 | --- | ||
| 50 | > if ( open(NTPQ,"$utils::PATH_TO_NTPQ -np $host 2>&1 |") ) { | ||
| 51 | 439c412 | ||
| 52 | < print "Usage: $PROGNAME -H <host> [-46] [-w <warn>] [-c <crit>] [-j <warn>] [-k <crit>] [-v verbose]\n"; | ||
| 53 | --- | ||
| 54 | > print "Usage: $PROGNAME -H <host> [-w <warn>] [-c <crit>] [-j <warn>] [-k <crit>] [-v verbose]\n"; | ||
| 55 | 457c430 | ||
| 56 | < Clock jitter in milliseconds at which a warning message will be generated.\n Defaults to $DEFAULT_JITTER_CRIT. | ||
| 57 | --- | ||
| 58 | > Clock jitter in milliseconds at which a warning message will be generated.\n Defaults to $DEFAULT_JITTER_CRIT.\n | ||
| 59 | 460,465c433,434 | ||
| 60 | < warning is returned.\n | ||
| 61 | < -4 (--use-ipv4) | ||
| 62 | < Use IPv4 connection | ||
| 63 | < -6 (--use-ipv6) | ||
| 64 | < Use IPv6 connection | ||
| 65 | < \n"; | ||
| 66 | --- | ||
| 67 | > warning is returned. | ||
| 68 | > "; | ||
diff --git a/web/attachments/119444-nagios-plugins-1.4_mysql41-slave-fix.patch b/web/attachments/119444-nagios-plugins-1.4_mysql41-slave-fix.patch new file mode 100644 index 0000000..fb4f11e --- /dev/null +++ b/web/attachments/119444-nagios-plugins-1.4_mysql41-slave-fix.patch | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | diff -rNu nagios-plugins-1.4/plugins/check_mysql.c nagios-plugins-1.4_mysql41-slave-fix/plugins/check_mysql.c | ||
| 2 | --- nagios-plugins-1.4/plugins/check_mysql.c Sun Dec 26 00:17:44 2004 | ||
| 3 | +++ nagios-plugins-1.4_mysql41-slave-fix/plugins/check_mysql.c Thu Feb 10 13:27:13 2005 | ||
| 4 | @@ -12,6 +12,11 @@ | ||
| 5 | * Description: | ||
| 6 | * | ||
| 7 | * This plugin is for testing a mysql server. | ||
| 8 | +* | ||
| 9 | +****************************************************************************** | ||
| 10 | +* Modified by wouter@widexs.nl: | ||
| 11 | +* - Changed static column numbers in the slave-check, to dynamic, | ||
| 12 | +* so newer MySQL versions (eg. 4.1.x) are supported as well (09-02-2005) | ||
| 13 | ******************************************************************************/ | ||
| 14 | |||
| 15 | const char *progname = "check_mysql"; | ||
| 16 | @@ -49,12 +54,19 @@ | ||
| 17 | MYSQL mysql; | ||
| 18 | MYSQL_RES *res; | ||
| 19 | MYSQL_ROW row; | ||
| 20 | + MYSQL_FIELD *field; | ||
| 21 | |||
| 22 | /* should be status */ | ||
| 23 | |||
| 24 | char *result = NULL; | ||
| 25 | char slaveresult[SLAVERESULTSIZE]; | ||
| 26 | |||
| 27 | + int local_mysql_server_version = 0; | ||
| 28 | + int local_mysql_client_version = 0; | ||
| 29 | + int col_slave_err = 0; | ||
| 30 | + int col_slave_run = 0; | ||
| 31 | + int col_slave_sql_run = 0; | ||
| 32 | + | ||
| 33 | setlocale (LC_ALL, ""); | ||
| 34 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 35 | textdomain (PACKAGE); | ||
| 36 | @@ -107,6 +119,21 @@ | ||
| 37 | die (STATE_CRITICAL, _("slave store_result error: %s\n"), mysql_error (&mysql)); | ||
| 38 | } | ||
| 39 | |||
| 40 | + /* Get client & server version */ | ||
| 41 | + local_mysql_client_version = mysql_get_client_version(); | ||
| 42 | + local_mysql_server_version = (local_mysql_client_version >= 40000 ? mysql_get_server_version(&mysql) : local_mysql_get_server_version()); | ||
| 43 | + | ||
| 44 | + /* Fetch column names */ | ||
| 45 | + while((field = mysql_fetch_field(res))) | ||
| 46 | + { | ||
| 47 | + if(strcmp (field->name, (local_mysql_server_version >= 40000 ? "Slave_IO_Running" : "Slave_Running")) == 0) { | ||
| 48 | + col_slave_run = (mysql_field_tell(res) -1); | ||
| 49 | + } | ||
| 50 | + if(strcmp (field->name, "Slave_SQL_Running") == 0) { | ||
| 51 | + col_slave_sql_run = (mysql_field_tell(res) -1); | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | /* fetch the first row */ | ||
| 56 | if ( (row = mysql_fetch_row (res)) == NULL) { | ||
| 57 | mysql_free_result (res); | ||
| 58 | @@ -114,27 +141,38 @@ | ||
| 59 | die (STATE_CRITICAL, _("slave fetch row error: %s\n"), mysql_error (&mysql)); | ||
| 60 | } | ||
| 61 | |||
| 62 | - if (mysql_field_count (&mysql) == 12) { | ||
| 63 | - /* mysql 3.23.x */ | ||
| 64 | - snprintf (slaveresult, SLAVERESULTSIZE, _("Slave running: %s"), row[6]); | ||
| 65 | - if (strcmp (row[6], "Yes") != 0) { | ||
| 66 | - mysql_free_result (res); | ||
| 67 | - mysql_close (&mysql); | ||
| 68 | - die (STATE_CRITICAL, "%s\n", slaveresult); | ||
| 69 | + if (local_mysql_server_version >= 40000) { | ||
| 70 | + /* mysql 4.x.x */ | ||
| 71 | + if ((col_slave_run > 0) && (col_slave_sql_run > 0)) { | ||
| 72 | + snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s", row[col_slave_run], row[col_slave_sql_run]); | ||
| 73 | + if (strcmp (row[col_slave_run], "Yes") != 0 || strcmp (row[col_slave_sql_run], "Yes") != 0) { | ||
| 74 | + col_slave_err = 1; | ||
| 75 | + } | ||
| 76 | + } else { | ||
| 77 | + snprintf (slaveresult, SLAVERESULTSIZE, "Required Slave columns not found"); | ||
| 78 | + col_slave_err = 1; | ||
| 79 | } | ||
| 80 | - | ||
| 81 | } else { | ||
| 82 | - /* mysql 4.x.x */ | ||
| 83 | - snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s", row[9], row[10]); | ||
| 84 | - if (strcmp (row[9], "Yes") != 0 || strcmp (row[10], "Yes") != 0) { | ||
| 85 | - mysql_free_result (res); | ||
| 86 | - mysql_close (&mysql); | ||
| 87 | - die (STATE_CRITICAL, "%s\n", slaveresult); | ||
| 88 | + /* mysql 3.23.x */ | ||
| 89 | + if (col_slave_run > 0) { | ||
| 90 | + snprintf (slaveresult, SLAVERESULTSIZE, _("Slave running: %s"), row[col_slave_run]); | ||
| 91 | + if (strcmp (row[col_slave_run], "Yes") != 0) { | ||
| 92 | + col_slave_err = 1; | ||
| 93 | + } | ||
| 94 | + } else { | ||
| 95 | + snprintf (slaveresult, SLAVERESULTSIZE, "Required Slave column not found"); | ||
| 96 | + col_slave_err = 1; | ||
| 97 | } | ||
| 98 | } | ||
| 99 | |||
| 100 | /* free the result */ | ||
| 101 | mysql_free_result (res); | ||
| 102 | + | ||
| 103 | + /* Check for trouble */ | ||
| 104 | + if(col_slave_err > 0) { | ||
| 105 | + mysql_close (&mysql); | ||
| 106 | + die (STATE_CRITICAL, "%s\n", slaveresult); | ||
| 107 | + } | ||
| 108 | } | ||
| 109 | |||
| 110 | /* close the connection */ | ||
| 111 | @@ -150,6 +188,16 @@ | ||
| 112 | return STATE_OK; | ||
| 113 | } | ||
| 114 | |||
| 115 | +/* Get version number for server */ | ||
| 116 | +local_mysql_get_server_version(MYSQL *mysql) | ||
| 117 | +{ | ||
| 118 | + uint major, minor, version; | ||
| 119 | + char *pos= mysql->server_version, *end_pos; | ||
| 120 | + major= (uint) strtoul(pos, &end_pos, 10); pos=end_pos+1; | ||
| 121 | + minor= (uint) strtoul(pos, &end_pos, 10); pos=end_pos+1; | ||
| 122 | + version= (uint) strtoul(pos, &end_pos, 10); | ||
| 123 | + return (ulong) major*10000L+(ulong) (minor*100+version); | ||
| 124 | +} | ||
| 125 | |||
| 126 | /* process command-line arguments */ | ||
| 127 | int | ||
diff --git a/web/attachments/119447-check_by_ssh.diff b/web/attachments/119447-check_by_ssh.diff new file mode 100644 index 0000000..a915d9f --- /dev/null +++ b/web/attachments/119447-check_by_ssh.diff | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | --- check_by_ssh.c.orig 2005-02-08 18:17:08.000000000 +0300 | ||
| 2 | +++ check_by_ssh.c 2005-02-08 18:13:37.000000000 +0300 | ||
| 3 | @@ -191,6 +191,7 @@ | ||
| 4 | {"user", required_argument, 0, 'u'}, | ||
| 5 | {"logname", required_argument, 0, 'l'}, | ||
| 6 | {"command", required_argument, 0, 'C'}, | ||
| 7 | + {"quiet", required_argument, 0, 'q'}, | ||
| 8 | {"use-ipv4", no_argument, 0, '4'}, | ||
| 9 | {"use-ipv6", no_argument, 0, '6'}, | ||
| 10 | {0, 0, 0, 0} | ||
| 11 | @@ -207,10 +208,10 @@ | ||
| 12 | while (1) { | ||
| 13 | #ifdef HAVE_GETOPT_H | ||
| 14 | c = | ||
| 15 | - getopt_long (argc, argv, "Vvh46ft:H:O:p:i:u:l:C:n:s:", long_options, | ||
| 16 | + getopt_long (argc, argv, "Vvhq46ft:H:O:p:i:u:l:C:n:s:", long_options, | ||
| 17 | &option_index); | ||
| 18 | #else | ||
| 19 | - c = getopt (argc, argv, "Vvh46ft:H:O:p:i:u:l:C:n:s:"); | ||
| 20 | + c = getopt (argc, argv, "Vvhq46ft:H:O:p:i:u:l:C:n:s:"); | ||
| 21 | #endif | ||
| 22 | |||
| 23 | if (c == -1 || c == EOF) | ||
| 24 | @@ -268,6 +269,7 @@ | ||
| 25 | case 'i': /* identity */ | ||
| 26 | asprintf (&comm, "%s -%c %s", comm, c, optarg); | ||
| 27 | break; | ||
| 28 | + case 'q': /* quiet */ | ||
| 29 | case '4': /* Pass these switches directly to ssh */ | ||
| 30 | case '6': /* -4 for IPv4, -6 for IPv6 */ | ||
| 31 | case 'f': /* fork to background */ | ||
| 32 | @@ -364,6 +366,8 @@ | ||
| 33 | " list of nagios service names, separated by ':' [optional]\n" | ||
| 34 | "-n, --name=NAME\n" | ||
| 35 | " short name of host in nagios configuration [optional]\n" | ||
| 36 | + "-q, --quiet\n" | ||
| 37 | + " tell ssh to run in quiet mode\n" | ||
| 38 | "-4, --use-ipv4\n" | ||
| 39 | " tell ssh to use IPv4\n" | ||
| 40 | "-6, --use-ipv6\n" | ||
| 41 | @@ -391,7 +395,7 @@ | ||
| 42 | { | ||
| 43 | printf | ||
| 44 | ("Usage:\n" | ||
| 45 | - "check_by_ssh [-f46] [-t timeout] [-i identity] [-l user] -H <host> -C <command>\n" | ||
| 46 | + "check_by_ssh [-fq46] [-t timeout] [-i identity] [-l user] -H <host> -C <command>\n" | ||
| 47 | " [-n name] [-s servicelist] [-O outputfile] [-p port]\n" | ||
| 48 | "check_by_ssh -V prints version info\n" | ||
| 49 | "check_by_ssh -h prints more detailed help\n"); | ||
diff --git a/web/attachments/119648-check_disk.c.diff b/web/attachments/119648-check_disk.c.diff new file mode 100644 index 0000000..1e0e5fc --- /dev/null +++ b/web/attachments/119648-check_disk.c.diff | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | --- check_disk.c.orig 2005-02-11 17:37:48.254928480 +0300 | ||
| 2 | +++ check_disk.c 2005-02-11 17:37:44.193545904 +0300 | ||
| 3 | @@ -118,8 +118,11 @@ | ||
| 4 | if (strcmp (file_system, "none") == 0) | ||
| 5 | strncpy (file_system, mntp, MAX_INPUT_BUFFER-1); | ||
| 6 | |||
| 7 | - if (disk_result==STATE_OK && erronly && !verbose) | ||
| 8 | + /* FIX: If everything is ok set result */ | ||
| 9 | + if (disk_result==STATE_OK && erronly && !verbose) { | ||
| 10 | + result = max_state (result, disk_result); | ||
| 11 | continue; | ||
| 12 | + } | ||
| 13 | |||
| 14 | if (disk_result!=STATE_OK || verbose>=0) | ||
| 15 | asprintf (&output, "%s [%.0f kB (%d%%) free on %s]", output, | ||
diff --git a/web/attachments/121772-nagiosplug-cvs-timeout_status.diff b/web/attachments/121772-nagiosplug-cvs-timeout_status.diff new file mode 100644 index 0000000..cf1e66a --- /dev/null +++ b/web/attachments/121772-nagiosplug-cvs-timeout_status.diff | |||
| @@ -0,0 +1,208 @@ | |||
| 1 | diff -urN ./plugins/check_nt.c ../plugins/plugins/check_nt.c | ||
| 2 | --- ./plugins/check_nt.c 2005-01-24 08:29:53.000000000 +0100 | ||
| 3 | +++ ../plugins/plugins/check_nt.c 2005-02-17 12:26:57.000000000 +0100 | ||
| 4 | @@ -35,6 +35,9 @@ | ||
| 5 | const char *copyright = "2003-2004"; | ||
| 6 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 7 | |||
| 8 | +extern const char *status_strings; | ||
| 9 | +extern int timeout_status; | ||
| 10 | + | ||
| 11 | #include "common.h" | ||
| 12 | #include "netutils.h" | ||
| 13 | #include "utils.h" | ||
| 14 | @@ -454,6 +457,7 @@ | ||
| 15 | {"hostname", required_argument,0,'H'}, | ||
| 16 | {"version", no_argument, 0,'V'}, | ||
| 17 | {"help", no_argument, 0,'h'}, | ||
| 18 | + {"timeout-status", required_argument, 0, 'T'}, | ||
| 19 | {0,0,0,0} | ||
| 20 | }; | ||
| 21 | |||
| 22 | @@ -478,7 +482,7 @@ | ||
| 23 | } | ||
| 24 | |||
| 25 | while (1){ | ||
| 26 | - c = getopt_long(argc,argv,"+hVH:t:c:w:p:v:l:s:d:",longopts,&option); | ||
| 27 | + c = getopt_long(argc,argv,"+hVH:t:c:w:p:v:l:s:d:T:",longopts,&option); | ||
| 28 | |||
| 29 | if (c==-1||c==EOF||c==1) | ||
| 30 | break; | ||
| 31 | @@ -549,8 +553,11 @@ | ||
| 32 | socket_timeout=atoi(optarg); | ||
| 33 | if(socket_timeout<=0) | ||
| 34 | return ERROR; | ||
| 35 | + break; | ||
| 36 | + case 'T': | ||
| 37 | + if(set_timeout_status(optarg) == ERROR) return ERROR; | ||
| 38 | + break; | ||
| 39 | } | ||
| 40 | - | ||
| 41 | } | ||
| 42 | |||
| 43 | if (vars_to_check==CHECK_NONE) | ||
| 44 | diff -urN ./plugins/common.h ../plugins/plugins/common.h | ||
| 45 | --- ./plugins/common.h 2004-12-10 11:42:00.000000000 +0100 | ||
| 46 | +++ ../plugins/plugins/common.h 2005-02-17 12:26:57.000000000 +0100 | ||
| 47 | @@ -157,8 +157,13 @@ | ||
| 48 | ERROR = -1 | ||
| 49 | }; | ||
| 50 | |||
| 51 | -/* AIX seems to have this defined somewhere else */ | ||
| 52 | -#ifndef FALSE | ||
| 53 | +/* AIX seems to have FALSE defined somewhere else, so make sure | ||
| 54 | + * TRUE means something else (we assume it does if it's already defined) */ | ||
| 55 | +#ifdef FALSE | ||
| 56 | +# ifndef TRUE | ||
| 57 | +# define TRUE (FALSE ^ 1) | ||
| 58 | +# endif | ||
| 59 | +#else | ||
| 60 | enum { | ||
| 61 | FALSE, | ||
| 62 | TRUE | ||
| 63 | @@ -170,7 +175,8 @@ | ||
| 64 | STATE_WARNING, | ||
| 65 | STATE_CRITICAL, | ||
| 66 | STATE_UNKNOWN, | ||
| 67 | - STATE_DEPENDENT | ||
| 68 | + STATE_DEPENDENT, | ||
| 69 | + STATE_OOB /* result out of bounds (keep last in list!) */ | ||
| 70 | }; | ||
| 71 | |||
| 72 | enum { | ||
| 73 | diff -urN ./plugins/netutils.c ../plugins/plugins/netutils.c | ||
| 74 | --- ./plugins/netutils.c 2005-01-05 21:53:22.000000000 +0100 | ||
| 75 | +++ ../plugins/plugins/netutils.c 2005-02-17 12:34:23.000000000 +0100 | ||
| 76 | @@ -38,18 +38,23 @@ | ||
| 77 | int econn_refuse_state = STATE_CRITICAL; | ||
| 78 | int was_refused = FALSE; | ||
| 79 | int address_family = AF_UNSPEC; | ||
| 80 | +extern char *status_strings; | ||
| 81 | +extern int timeout_status; | ||
| 82 | |||
| 83 | static int my_connect(const char *address, int port, int *sd, int proto); | ||
| 84 | /* handles socket timeouts */ | ||
| 85 | void | ||
| 86 | socket_timeout_alarm_handler (int sig) | ||
| 87 | { | ||
| 88 | - if (sig == SIGALRM) | ||
| 89 | - printf (_("CRITICAL - Socket timeout after %d seconds\n"), socket_timeout); | ||
| 90 | - else | ||
| 91 | - printf (_("CRITICAL - Abnormal timeout after %d seconds\n"), socket_timeout); | ||
| 92 | + /* this can only happen with poorly written plugins, so chalk | ||
| 93 | + * it up as input validation error and return STATE_UNKNOWN */ | ||
| 94 | + if(timeout_status < 0 || timeout_status >= STATE_OOB) | ||
| 95 | + timeout_status = STATE_UNKNOWN; | ||
| 96 | |||
| 97 | - exit (STATE_CRITICAL); | ||
| 98 | + printf (_("%s - Socket timeout after %d seconds\n"), | ||
| 99 | + status_strings[timeout_status], socket_timeout); | ||
| 100 | + | ||
| 101 | + exit (timeout_status); | ||
| 102 | } | ||
| 103 | |||
| 104 | |||
| 105 | diff -urN ./plugins/utils.c ../plugins/plugins/utils.c | ||
| 106 | --- ./plugins/utils.c 2005-01-05 21:53:23.000000000 +0100 | ||
| 107 | +++ ../plugins/plugins/utils.c 2005-02-17 12:26:57.000000000 +0100 | ||
| 108 | @@ -23,6 +23,20 @@ | ||
| 109 | extern void print_usage (void); | ||
| 110 | extern const char *progname; | ||
| 111 | |||
| 112 | +/* NULL-terminate these arrays just to be prudent | ||
| 113 | + * It's a bit faster and a lot more portable to use two separate | ||
| 114 | + * arrays for this, as we don't need to rely on strcasecmp being available | ||
| 115 | + */ | ||
| 116 | +const char *status_strings[] = { | ||
| 117 | + "OK", "WARNING", "CRITICAL", "UNKNOWN", "DEPENDENT", NULL | ||
| 118 | +}; | ||
| 119 | +const char *lowercase_status_strings[] = { | ||
| 120 | + "ok", "warning", "critical", "unknown", "dependent", NULL | ||
| 121 | +}; | ||
| 122 | +/* plugins may set this themselves, so export it from here | ||
| 123 | + * and have the plugins import it explicitly as extern */ | ||
| 124 | +int timeout_status = STATE_CRITICAL; | ||
| 125 | + | ||
| 126 | #define STRLEN 64 | ||
| 127 | #define TXTBLK 128 | ||
| 128 | |||
| 129 | @@ -105,18 +119,10 @@ | ||
| 130 | const char * | ||
| 131 | state_text (int result) | ||
| 132 | { | ||
| 133 | - switch (result) { | ||
| 134 | - case STATE_OK: | ||
| 135 | - return "OK"; | ||
| 136 | - case STATE_WARNING: | ||
| 137 | - return "WARNING"; | ||
| 138 | - case STATE_CRITICAL: | ||
| 139 | - return "CRITICAL"; | ||
| 140 | - case STATE_DEPENDENT: | ||
| 141 | - return "DEPENDENT"; | ||
| 142 | - default: | ||
| 143 | + if(result < 0 || result >= STATE_OOB) | ||
| 144 | return "UNKNOWN"; | ||
| 145 | - } | ||
| 146 | + | ||
| 147 | + return status_strings[result]; | ||
| 148 | } | ||
| 149 | |||
| 150 | void | ||
| 151 | @@ -129,14 +135,54 @@ | ||
| 152 | exit (result); | ||
| 153 | } | ||
| 154 | |||
| 155 | +int | ||
| 156 | +set_timeout_status(const char *arg) | ||
| 157 | +{ | ||
| 158 | + int i; | ||
| 159 | + | ||
| 160 | + timeou_status = -1; | ||
| 161 | + for(i = 0; status_strings[i],lowercase_status_strings[i]; i++) { | ||
| 162 | + if(status_strings[i][0] = arg[0] || | ||
| 163 | + lowercase_status_strings[i][0] = arg[0]) | ||
| 164 | + { | ||
| 165 | + timeout_status = i; | ||
| 166 | + break; | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + if(timeout_status != -1) return OK; | ||
| 170 | + | ||
| 171 | + errno = 0; | ||
| 172 | + timeout_status = (int)strtol(arg, NULL, 0); | ||
| 173 | + if(timeout_status < STATE_OK || timeout_status >= STATE_OOB || | ||
| 174 | + (!timeout_status && errno)) | ||
| 175 | + { | ||
| 176 | + timeout_status = STATE_UNKNOWN; | ||
| 177 | + return ERROR; | ||
| 178 | + } | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + return OK; | ||
| 182 | +} | ||
| 183 | + | ||
| 184 | + | ||
| 185 | void | ||
| 186 | timeout_alarm_handler (int signo) | ||
| 187 | { | ||
| 188 | + /* don't segfault if someone stupid has set this arbitrarily */ | ||
| 189 | + if(timeout_status < 0 || timeout_status >= STATE_OOB) | ||
| 190 | + timeout_status = STATE_UNKNOWN; | ||
| 191 | + | ||
| 192 | if (signo == SIGALRM) { | ||
| 193 | - printf (_("CRITICAL - Plugin timed out after %d seconds\n"), | ||
| 194 | - timeout_interval); | ||
| 195 | - exit (STATE_CRITICAL); | ||
| 196 | + printf (_("%s - Plugin timed out after %d seconds\n"), | ||
| 197 | + status_strings[timeout_status], timeout_interval); | ||
| 198 | + exit (timeout_status); | ||
| 199 | } | ||
| 200 | + | ||
| 201 | + /* fallthrough so we print something in case some stupid plugin | ||
| 202 | + * contributor has set this function to the catch-all sighandler */ | ||
| 203 | + printf(_("Caught signal %d in timeout_alarm_handler (bad coding).\n"), | ||
| 204 | + signo); | ||
| 205 | + exit(STATE_UNKNOWN); | ||
| 206 | } | ||
| 207 | |||
| 208 | int | ||
diff --git a/web/attachments/121773-check_icmp-bundled.diff b/web/attachments/121773-check_icmp-bundled.diff new file mode 100644 index 0000000..4bb56b4 --- /dev/null +++ b/web/attachments/121773-check_icmp-bundled.diff | |||
| @@ -0,0 +1,742 @@ | |||
| 1 | diff -urN ../plugins/plugins/check_icmp.c ./plugins/check_icmp.c | ||
| 2 | --- ../plugins/plugins/check_icmp.c 2005-02-01 15:31:11.000000000 +0100 | ||
| 3 | +++ ./plugins/check_icmp.c 2005-02-18 15:57:08.000000000 +0100 | ||
| 4 | @@ -1,5 +1,5 @@ | ||
| 5 | /* | ||
| 6 | - * $Id: check_icmp.c,v 1.5 2005/02/01 07:33:13 stanleyhopcroft Exp $ | ||
| 7 | + * $Id: check_icmp.c,v 1.12 2005/01/29 23:23:23 exon Exp $ | ||
| 8 | * | ||
| 9 | * Author: Andreas Ericsson <ae@op5.se> | ||
| 10 | * | ||
| 11 | @@ -14,6 +14,15 @@ | ||
| 12 | * redundant routes. The only remainders of fping is currently a few | ||
| 13 | * function names. | ||
| 14 | * | ||
| 15 | + * Kudos to; | ||
| 16 | + * Joe Rhett | ||
| 17 | + * Wickus Botha | ||
| 18 | + * Aaron Carr | ||
| 19 | + * Harper Mann | ||
| 20 | + * Phil Costelloe | ||
| 21 | + * Carsten Schmitz | ||
| 22 | + * for lending me system resources, testing and feedback | ||
| 23 | + * | ||
| 24 | */ | ||
| 25 | |||
| 26 | #include <sys/time.h> | ||
| 27 | @@ -84,7 +93,7 @@ | ||
| 28 | char *msg; /* icmp error message, if any */ | ||
| 29 | struct sockaddr_in saddr_in; /* the address of this host */ | ||
| 30 | struct in_addr error_addr; /* stores address of error replies */ | ||
| 31 | - unsigned long long time_waited; /* total time waited, in usecs */ | ||
| 32 | + unsigned long int time_waited; /* total time waited, in usecs */ | ||
| 33 | unsigned int icmp_sent, icmp_recv, icmp_lost; /* counters */ | ||
| 34 | unsigned char icmp_type, icmp_code; /* type and code from errors */ | ||
| 35 | unsigned short flags; /* control/status flags */ | ||
| 36 | @@ -137,18 +146,19 @@ | ||
| 37 | #define IP_HDR_SIZE 20 | ||
| 38 | #define MAX_PING_DATA (MAX_IP_PKT_SIZE - IP_HDR_SIZE - ICMP_MINLEN) | ||
| 39 | #define DEFAULT_PING_DATA_SIZE (MIN_PING_DATA_SIZE + 44) | ||
| 40 | +#define DEFAULT_TTL 64 | ||
| 41 | |||
| 42 | -/* various target states */ | ||
| 43 | -#define TSTATE_INACTIVE 0x01 /* don't ping this host anymore */ | ||
| 44 | -#define TSTATE_WAITING 0x02 /* unanswered packets on the wire */ | ||
| 45 | -#define TSTATE_ALIVE 0x04 /* target is alive (has answered something) */ | ||
| 46 | -#define TSTATE_UNREACH 0x08 | ||
| 47 | +#define MIN_PKT_INTERVAL 25000 /* min pkt_interval, microsecs */ | ||
| 48 | +#define NOFORCE_WAIT 0 | ||
| 49 | +#define FORCE_WAIT 1 | ||
| 50 | |||
| 51 | /** prototypes **/ | ||
| 52 | -static void usage(unsigned char, char *); | ||
| 53 | +static void usage(unsigned char, char *, ...); | ||
| 54 | static u_int get_timevar(const char *); | ||
| 55 | static u_int get_timevaldiff(struct timeval *, struct timeval *); | ||
| 56 | -static int wait_for_reply(int, u_int); | ||
| 57 | +static int reap_replies(int, u_int, int); | ||
| 58 | +void u_sleep(u_int u_sec); | ||
| 59 | +static u_int wait_for_reply(int, u_int); | ||
| 60 | static int recvfrom_wto(int, char *, unsigned int, struct sockaddr *, u_int *); | ||
| 61 | static int send_icmp_ping(int, struct rta_host *); | ||
| 62 | static int get_threshold(char *str, threshold *th); | ||
| 63 | @@ -162,6 +172,7 @@ | ||
| 64 | |||
| 65 | /** external **/ | ||
| 66 | extern int optind, opterr, optopt; | ||
| 67 | +/* extern int h_errno; */ | ||
| 68 | extern char *optarg; | ||
| 69 | extern char **environ; | ||
| 70 | |||
| 71 | @@ -173,15 +184,15 @@ | ||
| 72 | static unsigned short icmp_pkt_size, icmp_data_size = DEFAULT_PING_DATA_SIZE; | ||
| 73 | static unsigned int icmp_sent = 0, icmp_recv = 0, icmp_lost = 0; | ||
| 74 | #define icmp_pkts_en_route (icmp_sent - (icmp_recv + icmp_lost)) | ||
| 75 | -static unsigned short targets_down = 0, targets = 0, packets = 0; | ||
| 76 | +static unsigned int targets_down = 0, targets = 0, packets = 0; | ||
| 77 | #define targets_alive (targets - targets_down) | ||
| 78 | static unsigned int retry_interval, pkt_interval, target_interval; | ||
| 79 | static int icmp_sock, tcp_sock, udp_sock, status = STATE_OK; | ||
| 80 | static pid_t pid; | ||
| 81 | static struct timezone tz; | ||
| 82 | static struct timeval prog_start; | ||
| 83 | -static unsigned long long max_completion_time = 0; | ||
| 84 | -static unsigned char ttl = 0; /* outgoing ttl */ | ||
| 85 | +static unsigned long int max_completion_time = 0; | ||
| 86 | +static unsigned char ttl = 64; /* outgoing ttl */ | ||
| 87 | static unsigned int warn_down = 1, crit_down = 1; /* host down threshold values */ | ||
| 88 | float pkt_backoff_factor = 1.5; | ||
| 89 | float target_backoff_factor = 1.5; | ||
| 90 | @@ -210,7 +221,8 @@ | ||
| 91 | { | ||
| 92 | char *msg = "unreachable"; | ||
| 93 | |||
| 94 | - if(debug > 1) printf("get_icmp_error_msg(%u, %u)\n", icmp_type, icmp_code); | ||
| 95 | + if(debug > 3) printf("get_icmp_error_msg(%u, %u) called\n", | ||
| 96 | + icmp_type, icmp_code); | ||
| 97 | switch(icmp_type) { | ||
| 98 | case ICMP_UNREACH: | ||
| 99 | switch(icmp_code) { | ||
| 100 | @@ -269,7 +281,7 @@ | ||
| 101 | unsigned char *ptr; | ||
| 102 | |||
| 103 | if(p->icmp_type == ICMP_ECHO && p->icmp_id == pid) { | ||
| 104 | - /* echo request from us to us (pinging localhost) */ | ||
| 105 | + if(debug > 2) printf("echo request from us to us (pinging localhost)\n"); | ||
| 106 | return 0; | ||
| 107 | } | ||
| 108 | |||
| 109 | @@ -286,9 +298,13 @@ | ||
| 110 | * TIMXCEED actually sends a proper icmp response we will have passed | ||
| 111 | * too many hops to have a hope of reaching it later, in which case it | ||
| 112 | * indicates overconfidence in the network, poor routing or both. */ | ||
| 113 | + if(debug > 2) printf("random ICMP response type: %u, code: %u\n", | ||
| 114 | + p->icmp_type, p->icmp_code); | ||
| 115 | if(p->icmp_type != ICMP_UNREACH && p->icmp_type != ICMP_TIMXCEED && | ||
| 116 | p->icmp_type != ICMP_SOURCEQUENCH && p->icmp_type != ICMP_PARAMPROB) | ||
| 117 | { | ||
| 118 | + if(debug > 1) printf("Unsafe to handle unknown type %u, returning\n", | ||
| 119 | + p->icmp_type); | ||
| 120 | return 0; | ||
| 121 | } | ||
| 122 | |||
| 123 | @@ -298,7 +314,7 @@ | ||
| 124 | if(sent_icmp->icmp_type != ICMP_ECHO || sent_icmp->icmp_id != pid || | ||
| 125 | sent_icmp->icmp_seq >= targets) | ||
| 126 | { | ||
| 127 | - if(debug) printf("Packet is no response to a packet we sent\n"); | ||
| 128 | + if(debug) printf("not a response to a packet we sent, or target failed to duplicate request\n"); | ||
| 129 | return 0; | ||
| 130 | } | ||
| 131 | |||
| 132 | @@ -394,12 +410,12 @@ | ||
| 133 | } | ||
| 134 | else if(!strcmp(progname, "check_host")) { | ||
| 135 | mode = MODE_HOSTCHECK; | ||
| 136 | - pkt_interval = 1000000; | ||
| 137 | + pkt_interval = 200000; | ||
| 138 | packets = 5; | ||
| 139 | crit.rta = warn.rta = 1000000; | ||
| 140 | crit.pl = warn.pl = 100; | ||
| 141 | } | ||
| 142 | - else if(!strcmp(progname, "check_rta_multi")) { | ||
| 143 | + else if(!strcmp(progname, "check_icmp_multi")) { | ||
| 144 | mode = MODE_ALL; | ||
| 145 | target_interval = 0; | ||
| 146 | pkt_interval = 50000; | ||
| 147 | @@ -408,6 +424,8 @@ | ||
| 148 | |||
| 149 | /* parse the arguments */ | ||
| 150 | for(i = 1; i < argc; i++) { | ||
| 151 | + /* the leading '-' of the optstring makes non-argument options | ||
| 152 | + * return with arg 1, meaning it's */ | ||
| 153 | while((arg = getopt(argc, argv, "vhVw:c:n:p:t:H:i:b:I:l:")) != EOF) { | ||
| 154 | switch(arg) { | ||
| 155 | case 'v': | ||
| 156 | @@ -436,7 +454,8 @@ | ||
| 157 | timeout = strtoul(optarg, NULL, 0); | ||
| 158 | if(!timeout) timeout = 10; | ||
| 159 | break; | ||
| 160 | - case 'H': | ||
| 161 | + case 'H': case 1: /* 1 is default for non-option arguments */ | ||
| 162 | + /* printf("arg: %ld, optarg: %s\n", arg, optarg); */ | ||
| 163 | add_target(optarg); | ||
| 164 | break; | ||
| 165 | case 'l': | ||
| 166 | @@ -460,11 +479,10 @@ | ||
| 167 | add_target(*argv); | ||
| 168 | argv++; | ||
| 169 | } | ||
| 170 | - if(!targets) { | ||
| 171 | - errno = 0; | ||
| 172 | - crash("No hosts to check"); | ||
| 173 | - exit(3); | ||
| 174 | - } | ||
| 175 | + if(!targets) usage('h', "No hosts to check"); | ||
| 176 | + | ||
| 177 | + if(getuid() && pkt_interval < MIN_PKT_INTERVAL) | ||
| 178 | + pkt_interval = MIN_PKT_INTERVAL; | ||
| 179 | |||
| 180 | if(!sockets) { | ||
| 181 | if(icmp_sock == -1) { | ||
| 182 | @@ -486,10 +504,12 @@ | ||
| 183 | if(!ttl) ttl = 64; | ||
| 184 | |||
| 185 | if(icmp_sock) { | ||
| 186 | + errno = 0; | ||
| 187 | result = setsockopt(icmp_sock, SOL_IP, IP_TTL, &ttl, sizeof(ttl)); | ||
| 188 | if(debug) { | ||
| 189 | - if(result == -1) printf("setsockopt failed\n"); | ||
| 190 | - else printf("ttl set to %u\n", ttl); | ||
| 191 | + printf("setsockopt(icmp_sock, SOL_IP, IP_TTL, %u) = %d (%s)\n", | ||
| 192 | + ttl, result, strerror(errno)); | ||
| 193 | + if(result != -1) printf("outgoing ttl set to %u\n", ttl); | ||
| 194 | } | ||
| 195 | } | ||
| 196 | |||
| 197 | @@ -505,7 +525,7 @@ | ||
| 198 | signal(SIGHUP, finish); | ||
| 199 | signal(SIGTERM, finish); | ||
| 200 | signal(SIGALRM, finish); | ||
| 201 | - if(debug) printf("Setting alarm timeout to %u seconds\n", timeout); | ||
| 202 | + if(debug > 1) printf("Setting alarm timeout to %u seconds\n", timeout); | ||
| 203 | alarm(timeout); | ||
| 204 | |||
| 205 | /* make sure we don't wait any longer than necessary */ | ||
| 206 | @@ -514,10 +534,9 @@ | ||
| 207 | ((targets * packets * pkt_interval) + (targets * target_interval)) + | ||
| 208 | (targets * packets * crit.rta) + crit.rta; | ||
| 209 | |||
| 210 | - if(debug) { | ||
| 211 | + if(debug > 1) { | ||
| 212 | printf("packets: %u, targets: %u\n" | ||
| 213 | - "target_interval: %0.3f, pkt_interval %0.3f\n" | ||
| 214 | - "crit.rta: %0.3f\n" | ||
| 215 | + "target_interval: %0.3f, pkt_interval %0.3f, crit.rta: %0.3f\n" | ||
| 216 | "max_completion_time: %0.3f\n", | ||
| 217 | packets, targets, | ||
| 218 | (float)target_interval / 1000, (float)pkt_interval / 1000, | ||
| 219 | @@ -527,9 +546,9 @@ | ||
| 220 | |||
| 221 | if(debug) { | ||
| 222 | if(max_completion_time > (u_int)timeout * 1000000) { | ||
| 223 | - printf("max_completion_time: %llu timeout: %u\n", | ||
| 224 | + printf("max_completion_time: %lu timeout: %u\n", | ||
| 225 | max_completion_time, timeout); | ||
| 226 | - printf("Timout must be at lest %llu\n", | ||
| 227 | + printf("Timout must be at lest %lu\n", | ||
| 228 | max_completion_time / 1000000 + 1); | ||
| 229 | } | ||
| 230 | } | ||
| 231 | @@ -579,24 +598,27 @@ | ||
| 232 | u_int i, t, result; | ||
| 233 | u_int final_wait, time_passed; | ||
| 234 | |||
| 235 | - /* this loop might actually violate the pkt_interval or target_interval | ||
| 236 | - * settings, but only if there aren't any packets on the wire which | ||
| 237 | - * indicates that the target can handle an increased packet rate */ | ||
| 238 | - for(i = 0; i < packets; i++) { | ||
| 239 | - for(t = 0; t < targets; t++) { | ||
| 240 | + /* send the packets */ | ||
| 241 | + for(t = 0; t < targets; t++) { | ||
| 242 | + for(i = 0; i < packets; i++) { | ||
| 243 | + | ||
| 244 | /* don't send useless packets */ | ||
| 245 | - if(!targets_alive) finish(0); | ||
| 246 | if(table[t]->flags & FLAG_LOST_CAUSE) { | ||
| 247 | if(debug) printf("%s is a lost cause. not sending any more\n", | ||
| 248 | table[t]->name); | ||
| 249 | continue; | ||
| 250 | } | ||
| 251 | - | ||
| 252 | + | ||
| 253 | /* we're still in the game, so send next packet */ | ||
| 254 | (void)send_icmp_ping(icmp_sock, table[t]); | ||
| 255 | - result = wait_for_reply(icmp_sock, target_interval); | ||
| 256 | + | ||
| 257 | + /* pause for a while so we don't flood the network */ | ||
| 258 | + result = reap_replies(icmp_sock, pkt_interval, FORCE_WAIT); | ||
| 259 | } | ||
| 260 | - result = wait_for_reply(icmp_sock, pkt_interval * targets); | ||
| 261 | + | ||
| 262 | + /* wait for all incoming packets from all hosts */ | ||
| 263 | + if(target_interval > pkt_interval) | ||
| 264 | + result = reap_replies(icmp_sock, target_interval - pkt_interval, FORCE_WAIT); | ||
| 265 | } | ||
| 266 | |||
| 267 | if(icmp_pkts_en_route && targets_alive) { | ||
| 268 | @@ -604,7 +626,7 @@ | ||
| 269 | final_wait = max_completion_time - time_passed; | ||
| 270 | |||
| 271 | if(debug) { | ||
| 272 | - printf("time_passed: %u final_wait: %u max_completion_time: %llu\n", | ||
| 273 | + printf("time_passed: %u final_wait: %u max_completion_time: %lu\n", | ||
| 274 | time_passed, final_wait, max_completion_time); | ||
| 275 | } | ||
| 276 | if(time_passed > max_completion_time) { | ||
| 277 | @@ -616,8 +638,61 @@ | ||
| 278 | * haven't yet */ | ||
| 279 | if(debug) printf("Waiting for %u micro-seconds (%0.3f msecs)\n", | ||
| 280 | final_wait, (float)final_wait / 1000); | ||
| 281 | - result = wait_for_reply(icmp_sock, final_wait); | ||
| 282 | + result = reap_replies(icmp_sock, final_wait, NOFORCE_WAIT); | ||
| 283 | + } | ||
| 284 | +} | ||
| 285 | + | ||
| 286 | +/* | ||
| 287 | + * select() is posix, so we expect it to be around | ||
| 288 | + */ | ||
| 289 | +void | ||
| 290 | +u_sleep(u_int u_sec) | ||
| 291 | +{ | ||
| 292 | + int nfound; | ||
| 293 | + struct timeval to; | ||
| 294 | + fd_set readset, writeset; | ||
| 295 | + | ||
| 296 | + if(debug > 3) printf("sleeping for %u microseconds\n", u_sec); | ||
| 297 | + if(!u_sec) return; | ||
| 298 | + | ||
| 299 | + to.tv_sec = u_sec / 1000000; | ||
| 300 | + to.tv_usec = u_sec % 1000000; | ||
| 301 | + FD_ZERO(&writeset); | ||
| 302 | + FD_ZERO(&readset); | ||
| 303 | + nfound = select(0, &readset, &writeset, NULL, &to); | ||
| 304 | + if(nfound < 0) | ||
| 305 | + crash("select() in u_sleep"); | ||
| 306 | + | ||
| 307 | + return; | ||
| 308 | +} /* u_sleep() */ | ||
| 309 | + | ||
| 310 | +static int | ||
| 311 | +reap_replies(int sock, u_int t, int wait_forced) | ||
| 312 | +{ | ||
| 313 | + /* wrap up if all targets are declared dead */ | ||
| 314 | + if(debug > 3) printf("reap_replies(%d, %u, %d) called\n", sock, t, wait_forced); | ||
| 315 | + | ||
| 316 | + if(!targets_alive || | ||
| 317 | + get_timevaldiff(&prog_start, NULL) >= max_completion_time) | ||
| 318 | + { | ||
| 319 | + finish(0); | ||
| 320 | + } | ||
| 321 | + | ||
| 322 | + /* listen til timeout while there are packets en route (rhymes!) ;) */ | ||
| 323 | + while(t && icmp_pkts_en_route) { | ||
| 324 | + t = wait_for_reply(sock, t); | ||
| 325 | + | ||
| 326 | + /* the dead won't sing to us */ | ||
| 327 | + if(!targets_alive) finish(0); | ||
| 328 | } | ||
| 329 | + | ||
| 330 | + if(icmp_recv == (targets_alive * (int)packets)) finish(0); | ||
| 331 | + | ||
| 332 | + if(!t || !wait_forced) return 0; | ||
| 333 | + | ||
| 334 | + u_sleep(t); | ||
| 335 | + | ||
| 336 | + return 0; | ||
| 337 | } | ||
| 338 | |||
| 339 | /* response structure: | ||
| 340 | @@ -625,126 +700,98 @@ | ||
| 341 | * icmp header : 28 bytes | ||
| 342 | * icmp echo reply : the rest | ||
| 343 | */ | ||
| 344 | -static int | ||
| 345 | +static u_int | ||
| 346 | wait_for_reply(int sock, u_int t) | ||
| 347 | { | ||
| 348 | int n, hlen; | ||
| 349 | static char buf[4096]; | ||
| 350 | struct sockaddr_in resp_addr; | ||
| 351 | struct ip *ip; | ||
| 352 | - struct icmp *icp, *sent_icmp; | ||
| 353 | + struct icmp *icp; | ||
| 354 | struct rta_host *host; | ||
| 355 | struct icmp_ping_data *data; | ||
| 356 | struct timeval wait_start, now; | ||
| 357 | - u_int tdiff, i, per_pkt_wait; | ||
| 358 | - | ||
| 359 | - /* if we can't listen or don't have anything to listen to, just return */ | ||
| 360 | - if(!t || !icmp_pkts_en_route) return 0; | ||
| 361 | + u_int tdiff, timo = t; | ||
| 362 | |||
| 363 | gettimeofday(&wait_start, &tz); | ||
| 364 | |||
| 365 | - i = t; | ||
| 366 | - per_pkt_wait = t / icmp_pkts_en_route; | ||
| 367 | - while(icmp_pkts_en_route && get_timevaldiff(&wait_start, NULL) < i) { | ||
| 368 | - t = per_pkt_wait; | ||
| 369 | - | ||
| 370 | - /* wrap up if all targets are declared dead */ | ||
| 371 | - if(!targets_alive || | ||
| 372 | - get_timevaldiff(&prog_start, NULL) >= max_completion_time || | ||
| 373 | - (mode == MODE_HOSTCHECK && targets_down)) | ||
| 374 | - { | ||
| 375 | - finish(0); | ||
| 376 | - } | ||
| 377 | + n = recvfrom_wto(sock, buf, sizeof(buf), (struct sockaddr *)&resp_addr, &timo); | ||
| 378 | + if(!n) { /* timeout */ | ||
| 379 | + if(debug > 2) printf("recvfrom_wto() timed out during a %u usecs wait\n", t); | ||
| 380 | + return 0; /* no time left, so return just that */ | ||
| 381 | + } | ||
| 382 | |||
| 383 | - /* reap responses until we hit a timeout */ | ||
| 384 | - n = recvfrom_wto(sock, buf, sizeof(buf), | ||
| 385 | - (struct sockaddr *)&resp_addr, &t); | ||
| 386 | - if(!n) { | ||
| 387 | - if(debug > 1) { | ||
| 388 | - printf("recvfrom_wto() timed out during a %u usecs wait\n", | ||
| 389 | - per_pkt_wait); | ||
| 390 | - } | ||
| 391 | - continue; /* timeout for this one, so keep trying */ | ||
| 392 | - } | ||
| 393 | - if(n < 0) { | ||
| 394 | - if(debug) printf("recvfrom_wto() returned errors\n"); | ||
| 395 | - return n; | ||
| 396 | - } | ||
| 397 | + gettimeofday(&now, &tz); | ||
| 398 | + tdiff = get_timevaldiff(&wait_start, &now); | ||
| 399 | + /* make sure we can return time left */ | ||
| 400 | + if(t > tdiff) t -= tdiff; | ||
| 401 | + else t = 0; | ||
| 402 | |||
| 403 | - ip = (struct ip *)buf; | ||
| 404 | - if(debug > 1) printf("received %u bytes from %s\n", | ||
| 405 | + ip = (struct ip *)buf; | ||
| 406 | + if(debug > 1) printf("received %u bytes from %s\n", | ||
| 407 | ntohs(ip->ip_len), inet_ntoa(resp_addr.sin_addr)); | ||
| 408 | |||
| 409 | -/* obsolete. alpha on tru64 provides the necessary defines, but isn't broken */ | ||
| 410 | +/* obsolete, or at least not globally applicable */ | ||
| 411 | /* #if defined( __alpha__ ) && __STDC__ && !defined( __GLIBC__ ) */ | ||
| 412 | /* alpha headers are decidedly broken. Using an ansi compiler, | ||
| 413 | * they provide ip_vhl instead of ip_hl and ip_v, so we mask | ||
| 414 | * off the bottom 4 bits */ | ||
| 415 | /* hlen = (ip->ip_vhl & 0x0f) << 2; */ | ||
| 416 | /* #else */ | ||
| 417 | - hlen = ip->ip_hl << 2; | ||
| 418 | + hlen = ip->ip_hl << 2; | ||
| 419 | /* #endif */ | ||
| 420 | |||
| 421 | - if(n < (hlen + ICMP_MINLEN)) { | ||
| 422 | - crash("received packet too short for ICMP (%d bytes, expected %d) from %s\n", | ||
| 423 | - n, hlen + icmp_pkt_size, inet_ntoa(resp_addr.sin_addr)); | ||
| 424 | - } | ||
| 425 | - /* else if(debug) { */ | ||
| 426 | - /* printf("ip header size: %u, packet size: %u (expected %u, %u)\n", */ | ||
| 427 | - /* hlen, ntohs(ip->ip_len) - hlen, */ | ||
| 428 | - /* sizeof(struct ip), icmp_pkt_size); */ | ||
| 429 | - /* } */ | ||
| 430 | - | ||
| 431 | - /* check the response */ | ||
| 432 | - icp = (struct icmp *)(buf + hlen); | ||
| 433 | - sent_icmp = (struct icmp *)(buf + hlen + ICMP_MINLEN); | ||
| 434 | - /* printf("buf: %p, icp: %p, distance: %u (expected %u)\n", */ | ||
| 435 | - /* buf, icp, */ | ||
| 436 | - /* (u_int)icp - (u_int)buf, hlen); */ | ||
| 437 | - /* printf("buf: %p, sent_icmp: %p, distance: %u (expected %u)\n", */ | ||
| 438 | - /* buf, sent_icmp, */ | ||
| 439 | - /* (u_int)sent_icmp - (u_int)buf, hlen + ICMP_MINLEN); */ | ||
| 440 | - | ||
| 441 | - if(icp->icmp_id != pid) { | ||
| 442 | - handle_random_icmp(icp, &resp_addr); | ||
| 443 | - continue; | ||
| 444 | - } | ||
| 445 | - | ||
| 446 | - if(icp->icmp_type != ICMP_ECHOREPLY || icp->icmp_seq >= targets) { | ||
| 447 | - if(debug > 2) printf("not a proper ICMP_ECHOREPLY\n"); | ||
| 448 | - handle_random_icmp(icp, &resp_addr); | ||
| 449 | - continue; | ||
| 450 | - } | ||
| 451 | - | ||
| 452 | - /* this is indeed a valid response */ | ||
| 453 | - data = (struct icmp_ping_data *)(icp->icmp_data); | ||
| 454 | - | ||
| 455 | - host = table[icp->icmp_seq]; | ||
| 456 | - gettimeofday(&now, &tz); | ||
| 457 | - tdiff = get_timevaldiff(&data->stime, &now); | ||
| 458 | + if(n < (hlen + ICMP_MINLEN)) { | ||
| 459 | + crash("received packet too short for ICMP (%d bytes, expected %d) from %s\n", | ||
| 460 | + n, hlen + icmp_pkt_size, inet_ntoa(resp_addr.sin_addr)); | ||
| 461 | + } | ||
| 462 | + else if(debug > 2) { | ||
| 463 | + printf("ip header size: %u, packet size: %u (expected %u, %u)\n", | ||
| 464 | + hlen, ntohs(ip->ip_len) - hlen, | ||
| 465 | + sizeof(struct ip), (u_int)icmp_pkt_size); | ||
| 466 | + } | ||
| 467 | |||
| 468 | - host->time_waited += tdiff; | ||
| 469 | - host->icmp_recv++; | ||
| 470 | - icmp_recv++; | ||
| 471 | + /* check the response */ | ||
| 472 | + icp = (struct icmp *)(buf + hlen); | ||
| 473 | |||
| 474 | + if(icp->icmp_id != pid || icp->icmp_type != ICMP_ECHOREPLY || icp->icmp_seq >= targets) { | ||
| 475 | if(debug) { | ||
| 476 | - printf("%0.3f ms rtt from %s, outgoing ttl: %u, incoming ttl: %u\n", | ||
| 477 | - (float)tdiff / 1000, inet_ntoa(resp_addr.sin_addr), | ||
| 478 | - ttl, ip->ip_ttl); | ||
| 479 | - } | ||
| 480 | + printf("inbound packet is:\n"); | ||
| 481 | + if(icp->icmp_id != pid) printf("\tnot marked by me\n"); | ||
| 482 | + if(icp->icmp_type != ICMP_ECHOREPLY) printf("\tnot an echo reply\n"); | ||
| 483 | + if(icp->icmp_seq >= targets) printf("\ttagged with a too high seq number\n"); | ||
| 484 | + } | ||
| 485 | + handle_random_icmp(icp, &resp_addr); | ||
| 486 | + return t; | ||
| 487 | + } | ||
| 488 | + if(debug > 2) puts("inbound packet is a valid ICMP_ECHOREPLY to a packet we sent"); | ||
| 489 | + | ||
| 490 | + /* this is indeed a valid response */ | ||
| 491 | + data = (struct icmp_ping_data *)(icp->icmp_data); | ||
| 492 | + host = table[icp->icmp_seq]; | ||
| 493 | + tdiff = get_timevaldiff(&data->stime, &now); | ||
| 494 | + | ||
| 495 | + host->time_waited += tdiff; | ||
| 496 | + host->icmp_recv++; | ||
| 497 | + icmp_recv++; | ||
| 498 | |||
| 499 | - /* if we're in hostcheck mode, exit with limited printouts */ | ||
| 500 | - if(mode == MODE_HOSTCHECK) { | ||
| 501 | - printf("OK - %s responds to ICMP. Packet %u, rta %0.3fms|" | ||
| 502 | - "pkt=%u;;0;%u rta=%0.3f;%0.3f;%0.3f;;\n", | ||
| 503 | - host->name, icmp_recv, (float)tdiff / 1000, | ||
| 504 | - icmp_recv, packets, (float)tdiff / 1000, | ||
| 505 | - (float)warn.rta / 1000, (float)crit.rta / 1000); | ||
| 506 | - exit(STATE_OK); | ||
| 507 | - } | ||
| 508 | + if(debug) { | ||
| 509 | + printf("%0.3f ms rtt from %s, outgoing ttl: %u, incoming ttl: %u\n", | ||
| 510 | + (float)tdiff / 1000, inet_ntoa(resp_addr.sin_addr), | ||
| 511 | + ttl, ip->ip_ttl); | ||
| 512 | + } | ||
| 513 | + | ||
| 514 | + /* if we're in hostcheck mode, exit with limited printouts */ | ||
| 515 | + if(mode == MODE_HOSTCHECK) { | ||
| 516 | + printf("OK - %s responds to ICMP. Packet %u, rta %0.3fms|" | ||
| 517 | + "pkt=%u;;0;%u rta=%0.3f;%0.3f;%0.3f;;\n", | ||
| 518 | + host->name, icmp_recv, (float)tdiff / 1000, | ||
| 519 | + icmp_recv, packets, (float)tdiff / 1000, | ||
| 520 | + (float)warn.rta / 1000, (float)crit.rta / 1000); | ||
| 521 | + exit(STATE_OK); | ||
| 522 | } | ||
| 523 | |||
| 524 | - return 0; | ||
| 525 | + return t; | ||
| 526 | } | ||
| 527 | |||
| 528 | /* the ping functions */ | ||
| 529 | @@ -776,8 +823,6 @@ | ||
| 530 | } | ||
| 531 | memset(buf, 0, icmp_pkt_size + sizeof(struct ip)); | ||
| 532 | |||
| 533 | - if((gettimeofday(&tv, &tz)) == -1) return -1; | ||
| 534 | - | ||
| 535 | icp = (struct icmp *)buf; | ||
| 536 | icp->icmp_type = ICMP_ECHO; | ||
| 537 | icp->icmp_code = 0; | ||
| 538 | @@ -785,7 +830,9 @@ | ||
| 539 | icp->icmp_id = pid; | ||
| 540 | icp->icmp_seq = host->id; | ||
| 541 | data = (struct icmp_ping_data *)icp->icmp_data; | ||
| 542 | - data->ping_id = 10; /* host->icmp.icmp_sent; */ | ||
| 543 | + data->ping_id = host->icmp_sent; | ||
| 544 | + | ||
| 545 | + if((gettimeofday(&tv, &tz)) == -1) return -1; | ||
| 546 | memcpy(&data->stime, &tv, sizeof(struct timeval)); | ||
| 547 | icp->icmp_cksum = icmp_checksum((u_short *)icp, icmp_pkt_size); | ||
| 548 | |||
| 549 | @@ -798,6 +845,7 @@ | ||
| 550 | return -1; | ||
| 551 | } | ||
| 552 | |||
| 553 | + /* increment the counters */ | ||
| 554 | icmp_sent++; | ||
| 555 | host->icmp_sent++; | ||
| 556 | |||
| 557 | @@ -809,7 +857,7 @@ | ||
| 558 | u_int *timo) | ||
| 559 | { | ||
| 560 | u_int slen; | ||
| 561 | - int n; | ||
| 562 | + int n, result; | ||
| 563 | struct timeval to, then, now; | ||
| 564 | fd_set rd, wr; | ||
| 565 | |||
| 566 | @@ -835,7 +883,10 @@ | ||
| 567 | |||
| 568 | slen = sizeof(struct sockaddr); | ||
| 569 | |||
| 570 | - return recvfrom(sock, buf, len, 0, saddr, &slen); | ||
| 571 | + result = recvfrom(sock, buf, len, 0, saddr, &slen); | ||
| 572 | + if(result < 0) crash("recvfrom in recvfrom_wto"); | ||
| 573 | + | ||
| 574 | + return result; | ||
| 575 | } | ||
| 576 | |||
| 577 | static void | ||
| 578 | @@ -849,7 +900,7 @@ | ||
| 579 | {"OK", "WARNING", "CRITICAL", "UNKNOWN", "DEPENDENT"}; | ||
| 580 | |||
| 581 | alarm(0); | ||
| 582 | - if(debug > 1) printf("finish(%d) called\n", sig); | ||
| 583 | + if(debug > 2) printf("finish(%d) called\n", sig); | ||
| 584 | |||
| 585 | if(icmp_sock != -1) close(icmp_sock); | ||
| 586 | if(udp_sock != -1) close(udp_sock); | ||
| 587 | @@ -1016,23 +1067,20 @@ | ||
| 588 | struct hostent *he; | ||
| 589 | struct in_addr *in, ip; | ||
| 590 | |||
| 591 | - /* don't resolve if we don't have to */ | ||
| 592 | - if((ip.s_addr = inet_addr(arg)) != INADDR_NONE) { | ||
| 593 | - /* don't add all ip's if we were given a specific one */ | ||
| 594 | - return add_target_ip(arg, &ip); | ||
| 595 | - /* he = gethostbyaddr((char *)in, sizeof(struct in_addr), AF_INET); */ | ||
| 596 | - /* if(!he) return add_target_ip(arg, in); */ | ||
| 597 | - } | ||
| 598 | - else { | ||
| 599 | - errno = 0; | ||
| 600 | + /* don't resolve if we don't have to, don't add all ip's if we were | ||
| 601 | + * given a specific one, even if we're in hostcheck mode */ | ||
| 602 | + if(inet_aton(arg, &ip)) return add_target_ip(arg, &ip); | ||
| 603 | + | ||
| 604 | + /* not an IP, so resolve */ | ||
| 605 | + errno = 0; | ||
| 606 | + he = gethostbyname(arg); | ||
| 607 | + if(!he && h_errno == TRY_AGAIN) { | ||
| 608 | + u_sleep(500000); | ||
| 609 | he = gethostbyname(arg); | ||
| 610 | - if(!he) { | ||
| 611 | - errno = 0; | ||
| 612 | - crash("Failed to resolve %s", arg); | ||
| 613 | - return -1; | ||
| 614 | - } | ||
| 615 | } | ||
| 616 | |||
| 617 | + if(!he) usage(0, "Failed to resolve %s: %s", arg, hstrerror(h_errno)); | ||
| 618 | + | ||
| 619 | /* possibly add all the IP's as targets */ | ||
| 620 | for(i = 0; he->h_addr_list[i]; i++) { | ||
| 621 | in = (struct in_addr *)he->h_addr_list[i]; | ||
| 622 | @@ -1040,7 +1088,7 @@ | ||
| 623 | |||
| 624 | /* this is silly, but it works */ | ||
| 625 | if(mode == MODE_HOSTCHECK || mode == MODE_ALL) { | ||
| 626 | - printf("mode: %d\n", mode); | ||
| 627 | + if(debug) printf("mode: %d\n", mode); | ||
| 628 | continue; | ||
| 629 | } | ||
| 630 | break; | ||
| 631 | @@ -1048,6 +1096,7 @@ | ||
| 632 | |||
| 633 | return 0; | ||
| 634 | } | ||
| 635 | + | ||
| 636 | /* | ||
| 637 | * u = micro | ||
| 638 | * m = milli | ||
| 639 | @@ -1073,12 +1122,12 @@ | ||
| 640 | if(len >= 2 && !isdigit((int)str[len - 2])) p = str[len - 2]; | ||
| 641 | if(p && u == 's') u = p; | ||
| 642 | else if(!p) p = u; | ||
| 643 | - if(debug > 2) printf("evaluating %s, u: %c, p: %c\n", str, u, p); | ||
| 644 | + if(debug > 3) printf("evaluating %s, u: %c, p: %c\n", str, u, p); | ||
| 645 | |||
| 646 | if(u == 'u') factor = 1; /* microseconds */ | ||
| 647 | else if(u == 'm') factor = 1000; /* milliseconds */ | ||
| 648 | else if(u == 's') factor = 1000000; /* seconds */ | ||
| 649 | - if(debug > 2) printf("factor is %u\n", factor); | ||
| 650 | + if(debug > 3) printf("factor is %u\n", factor); | ||
| 651 | |||
| 652 | i = strtoul(str, &ptr, 0); | ||
| 653 | if(!ptr || *ptr != '.' || strlen(ptr) < 2 || factor == 1) | ||
| 654 | @@ -1149,51 +1198,58 @@ | ||
| 655 | |||
| 656 | /* make core plugin developers happy (silly, really) */ | ||
| 657 | static void | ||
| 658 | -usage(unsigned char arg, char *msg) | ||
| 659 | +usage(unsigned char arg, char *fmt, ...) | ||
| 660 | { | ||
| 661 | - if(msg) printf("%s: %s\n", progname, msg); | ||
| 662 | + if(fmt) { | ||
| 663 | + va_list ap; | ||
| 664 | + | ||
| 665 | + printf("%s: ", progname); | ||
| 666 | + | ||
| 667 | + va_start(ap, fmt); | ||
| 668 | + vprintf(fmt, ap); | ||
| 669 | + va_end(ap); | ||
| 670 | + puts("\n"); | ||
| 671 | + } | ||
| 672 | |||
| 673 | if(arg == 'V') { | ||
| 674 | - printf("$Id: check_icmp.c,v 1.5 2005/02/01 07:33:13 stanleyhopcroft Exp $\n"); | ||
| 675 | + printf("$Id: check_icmp.c,v 1.12 2005/01/29 23:23:23 exon Exp $\n"); | ||
| 676 | exit(STATE_UNKNOWN); | ||
| 677 | } | ||
| 678 | |||
| 679 | printf("Usage: %s [options] [-H] host1 host2 hostn\n\n", progname); | ||
| 680 | |||
| 681 | - if(arg != 'h') exit(3); | ||
| 682 | + if(arg != 'h') { | ||
| 683 | + printf("%s -h for details\n", progname); | ||
| 684 | + exit(3); | ||
| 685 | + } | ||
| 686 | |||
| 687 | printf("Where options are any combination of:\n" | ||
| 688 | - " * -H | --host specify a target\n" | ||
| 689 | - " * -w | --warn warning threshold (currently %0.3fms,%u%%)\n" | ||
| 690 | - " * -c | --crit critical threshold (currently %0.3fms,%u%%)\n" | ||
| 691 | - " * -n | --packets number of packets to send (currently %u)\n" | ||
| 692 | - " * -i | --interval max packet interval (currently %0.3fms)\n" | ||
| 693 | - " * -I | --hostint max target interval (currently %0.3fms)\n" | ||
| 694 | - " * -l | --ttl TTL on outgoing packets (currently %u)\n" | ||
| 695 | - " * -t | --timeout timeout value (seconds, currently %u)\n" | ||
| 696 | - " * -b | --bytes icmp packet size (currenly ignored)\n" | ||
| 697 | - " -v | --verbose verbosity++\n" | ||
| 698 | - " -h | --help this cruft\n", | ||
| 699 | + " * -H | --host specify a target\n" | ||
| 700 | + " * -w | --warn warning threshold (currently %0.3fms,%u%%)\n" | ||
| 701 | + " * -c | --crit critical threshold (currently %0.3fms,%u%%)\n" | ||
| 702 | + " * -n | --packets number of packets to send (currently %u)\n" | ||
| 703 | + " * -i | --interval max packet interval (currently %0.3fms)\n" | ||
| 704 | + " * -I | --hostint max target interval (currently %0.3fms)\n", | ||
| 705 | (float)warn.rta / 1000, warn.pl, (float)crit.rta / 1000, crit.pl, | ||
| 706 | packets, | ||
| 707 | - (float)pkt_interval / 1000, (float)target_interval / 1000, | ||
| 708 | + (float)pkt_interval / 1000, (float)target_interval / 1000); | ||
| 709 | + | ||
| 710 | + printf(" * -l | --ttl outgoing TTL (currently %u, not supported on all platforms)\n" | ||
| 711 | + " * -t | --timeout timeout value (seconds, currently %u)\n" | ||
| 712 | + " * -b | --bytes icmp packet size (currenly ignored)\n" | ||
| 713 | + " -v | --verbose verbosity++ (4 is sort of max)\n" | ||
| 714 | + " -h | --help this cruft\n", | ||
| 715 | ttl, timeout); | ||
| 716 | |||
| 717 | - puts("\nThe -H switch is optional. Naming a host (or several) to check is not.\n\n" | ||
| 718 | - "Threshold format for -w and -c is 200.25,60% for 200.25 msec RTA and 60%\n" | ||
| 719 | - "packet loss. The default values should work well for most users.\n" | ||
| 720 | + puts("\nThreshold format for -w and -c is 200.25,60% for 200.25 msec RTA and 60%\n" | ||
| 721 | + "packet loss. All threshold values match inclusively.\n" | ||
| 722 | "You can specify different RTA factors using the standardized abbreviations\n" | ||
| 723 | - "us (microseconds), ms (milliseconds, default) or just plain s for seconds.\n\n" | ||
| 724 | - "Threshold format for -d is warn,crit. 12,14 means WARNING if >= 12 hops\n" | ||
| 725 | - "are spent and CRITICAL if >= 14 hops are spent.\n" | ||
| 726 | - "NOTE: Some systems decrease TTL when forming ICMP_ECHOREPLY, others do not.\n\n" | ||
| 727 | - "The -v switch can be specified several times for increased verbosity.\n\n" | ||
| 728 | - "Long options are currently unsupported.\n\n" | ||
| 729 | - "Options marked with * require an argument\n"); | ||
| 730 | - | ||
| 731 | - puts("The latest version of this plugin can be found at http://oss.op5.se/nagios\n" | ||
| 732 | - "or https://devel.op5.se/oss until the day it is included in the official\n" | ||
| 733 | - "plugin distribution.\n"); | ||
| 734 | + "us (microseconds), ms (milliseconds, default) or just plain s for seconds.\n"); | ||
| 735 | + puts("Long options are currently unsupported.\n"); | ||
| 736 | + puts("Options marked with * require an argument\n"); | ||
| 737 | + puts("If this program is invoked as check_host (with a symlink, preferrably), it will exit with status\n" | ||
| 738 | + "OK upon the first properly received ICMP_ECHOREPLY, making it ideal\n" | ||
| 739 | + "for hostchecks (less network load and much, much faster on OK)\n"); | ||
| 740 | |||
| 741 | exit(3); | ||
| 742 | } | ||
diff --git a/web/attachments/121775-nagiosplug-cvs-ansiC.diff b/web/attachments/121775-nagiosplug-cvs-ansiC.diff new file mode 100644 index 0000000..ba408b6 --- /dev/null +++ b/web/attachments/121775-nagiosplug-cvs-ansiC.diff | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-5 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378820455" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378820455" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378820455" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378820455" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378820455'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1143849&group_id=29880&atid=397599&file_id=121775" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/121776-nagiosplug-cvs-ansiC.diff b/web/attachments/121776-nagiosplug-cvs-ansiC.diff new file mode 100644 index 0000000..58d67fd --- /dev/null +++ b/web/attachments/121776-nagiosplug-cvs-ansiC.diff | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | diff -urN ./plugins/check_by_ssh.c ../plugins/plugins/check_by_ssh.c | ||
| 2 | --- ./plugins/check_by_ssh.c 2005-01-05 21:53:11.000000000 +0100 | ||
| 3 | +++ ../plugins/plugins/check_by_ssh.c 2005-02-17 13:19:35.000000000 +0100 | ||
| 4 | @@ -246,7 +246,7 @@ | ||
| 5 | case 's': /* description of service to check */ | ||
| 6 | service = realloc (service, (++services) * sizeof(char *)); | ||
| 7 | p1 = optarg; | ||
| 8 | - while ((p2 = index (p1, ':'))) { | ||
| 9 | + while ((p2 = strchr (p1, ':'))) { | ||
| 10 | *p2 = '\0'; | ||
| 11 | asprintf (&service[services-1], "%s", p1); | ||
| 12 | service = realloc (service, (++services) * sizeof(char *)); | ||
| 13 | diff -urN ./plugins/check_dig.c ../plugins/plugins/check_dig.c | ||
| 14 | --- ./plugins/check_dig.c 2005-01-28 15:00:58.000000000 +0100 | ||
| 15 | +++ ../plugins/plugins/check_dig.c 2005-02-17 13:55:05.000000000 +0100 | ||
| 16 | @@ -127,7 +127,7 @@ | ||
| 17 | |||
| 18 | /* Translate output TAB -> SPACE */ | ||
| 19 | t = output; | ||
| 20 | - while ((t = index(t, '\t')) != NULL) | ||
| 21 | + while ((t = strchr(t, '\t')) != NULL) | ||
| 22 | *t = ' '; | ||
| 23 | |||
| 24 | } while (!strstr (input_buffer, ";; ")); | ||
| 25 | @@ -149,7 +149,7 @@ | ||
| 26 | result = max_state (result, STATE_WARNING); | ||
| 27 | printf ("%s", input_buffer); | ||
| 28 | if (strlen (output) == 0) | ||
| 29 | - output = strdup (1 + index (input_buffer, ':')); | ||
| 30 | + output = strdup (1 + strchr (input_buffer, ':')); | ||
| 31 | } | ||
| 32 | |||
| 33 | (void) fclose (child_stderr); | ||
diff --git a/web/attachments/121777-nagiosplug-cvs-check_hpjd.diff b/web/attachments/121777-nagiosplug-cvs-check_hpjd.diff new file mode 100644 index 0000000..77d2699 --- /dev/null +++ b/web/attachments/121777-nagiosplug-cvs-check_hpjd.diff | |||
| @@ -0,0 +1,332 @@ | |||
| 1 | diff -urN ./plugins/check_hpjd.c ../plugins/plugins/check_hpjd.c | ||
| 2 | --- ./plugins/check_hpjd.c 2005-01-05 21:53:13.000000000 +0100 | ||
| 3 | +++ ../plugins/plugins/check_hpjd.c 2005-02-18 13:02:58.000000000 +0100 | ||
| 4 | @@ -44,6 +44,7 @@ | ||
| 5 | #define HPJD_GD_DOOR_OPEN ".1.3.6.1.4.1.11.2.3.9.1.1.2.17" | ||
| 6 | #define HPJD_GD_PAPER_OUTPUT ".1.3.6.1.4.1.11.2.3.9.1.1.2.19" | ||
| 7 | #define HPJD_GD_STATUS_DISPLAY ".1.3.6.1.4.1.11.2.3.9.1.1.3" | ||
| 8 | +#define SNMP_VARS 12 | ||
| 9 | |||
| 10 | #define ONLINE 0 | ||
| 11 | #define OFFLINE 1 | ||
| 12 | @@ -61,23 +62,30 @@ | ||
| 13 | { | ||
| 14 | char command_line[1024]; | ||
| 15 | int result = STATE_UNKNOWN; | ||
| 16 | - int line; | ||
| 17 | + int line, val = 0; | ||
| 18 | char input_buffer[MAX_INPUT_BUFFER]; | ||
| 19 | char query_string[512]; | ||
| 20 | char *errmsg; | ||
| 21 | char *temp_buffer; | ||
| 22 | int line_status = ONLINE; | ||
| 23 | - int paper_status = 0; | ||
| 24 | - int intervention_required = 0; | ||
| 25 | - int peripheral_error = 0; | ||
| 26 | - int paper_jam = 0; | ||
| 27 | - int paper_out = 0; | ||
| 28 | - int toner_low = 0; | ||
| 29 | - int page_punt = 0; | ||
| 30 | - int memory_out = 0; | ||
| 31 | - int door_open = 0; | ||
| 32 | - int paper_output = 0; | ||
| 33 | - char display_message[MAX_INPUT_BUFFER]; | ||
| 34 | + int errorflag = 0; /* bitflag error tracker */ | ||
| 35 | + char *display_message; | ||
| 36 | + char *errmsg_strings[11]; | ||
| 37 | + int i; | ||
| 38 | + | ||
| 39 | + /* get the error messages. Will complain about discarded qualifiers | ||
| 40 | + * with --disable-nls, but that doesn't matter since they're immutable */ | ||
| 41 | + errmsg_strings[0] = _("Paper Jam"); | ||
| 42 | + errmsg_strings[1] = _("Out of Paper"); | ||
| 43 | + errmsg_strings[2] = _("Printer Offline"); | ||
| 44 | + errmsg_strings[3] = _("Peripheral Error"); | ||
| 45 | + errmsg_strings[4] = _("Intervention Required"); | ||
| 46 | + errmsg_strings[5] = _("Toner Low"); | ||
| 47 | + errmsg_strings[6] = _("Insufficient Memory"); | ||
| 48 | + errmsg_strings[7] = _("A Door is Open"); | ||
| 49 | + errmsg_strings[8] = _("Output Tray is Full"); | ||
| 50 | + errmsg_strings[9] = _("Data too Slow for Engine"); | ||
| 51 | + errmsg_strings[10] = _("Unknown Paper Error"); | ||
| 52 | |||
| 53 | errmsg = malloc(MAX_INPUT_BUFFER); | ||
| 54 | |||
| 55 | @@ -90,9 +98,12 @@ | ||
| 56 | |||
| 57 | /* removed ' 2>1' at end of command 10/27/1999 - EG */ | ||
| 58 | /* create the query string */ | ||
| 59 | + /* get status display line first, so we can match line status against | ||
| 60 | + * powersave as we parse it */ | ||
| 61 | sprintf | ||
| 62 | (query_string, | ||
| 63 | "%s.0 %s.0 %s.0 %s.0 %s.0 %s.0 %s.0 %s.0 %s.0 %s.0 %s.0 %s.0", | ||
| 64 | + HPJD_GD_STATUS_DISPLAY, | ||
| 65 | HPJD_LINE_STATUS, | ||
| 66 | HPJD_PAPER_STATUS, | ||
| 67 | HPJD_INTERVENTION_REQUIRED, | ||
| 68 | @@ -102,11 +113,11 @@ | ||
| 69 | HPJD_GD_TONER_LOW, | ||
| 70 | HPJD_GD_PAGE_PUNT, | ||
| 71 | HPJD_GD_MEMORY_OUT, | ||
| 72 | - HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY); | ||
| 73 | + HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT); | ||
| 74 | |||
| 75 | /* get the command to run */ | ||
| 76 | - sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET, community, | ||
| 77 | - address, query_string); | ||
| 78 | + sprintf (command_line, "%s -Oqa -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET, community, | ||
| 79 | + address, query_string); | ||
| 80 | |||
| 81 | /* run the command */ | ||
| 82 | child_process = spopen (command_line); | ||
| 83 | @@ -117,170 +128,98 @@ | ||
| 84 | |||
| 85 | child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 86 | if (child_stderr == NULL) { | ||
| 87 | - printf (_("Could not open stderr for %s\n"), command_line); | ||
| 88 | + /* don't print newline here, or we might return OK while | ||
| 89 | + * only printing an error message (highly confusing) */ | ||
| 90 | + printf (_("Could not open stderr for %s :: "), command_line); | ||
| 91 | } | ||
| 92 | |||
| 93 | result = STATE_OK; | ||
| 94 | |||
| 95 | line = 0; | ||
| 96 | + /* end parsing when we have display_message, since we won't know | ||
| 97 | + * what to do with line 13 or more anyway */ | ||
| 98 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 99 | + /* strip the newline character from the end of the input, if any */ | ||
| 100 | + temp_buffer = strrchr(input_buffer, '\n'); | ||
| 101 | + if(temp_buffer) *temp_buffer = '\0'; | ||
| 102 | + | ||
| 103 | + if(line == 0) { | ||
| 104 | + display_message = strdup(input_buffer); | ||
| 105 | + continue; | ||
| 106 | + } | ||
| 107 | + val = (int)strtol(input_buffer, NULL, 0); | ||
| 108 | + if(!val) continue; /* no errors here, so don't handle it */ | ||
| 109 | + errorflag |= 1 << (line - 1); /* set the error flag */ | ||
| 110 | + | ||
| 111 | + /* this switch statement is largely for adding additional | ||
| 112 | + * exception handling (POWERSAVE and such) */ | ||
| 113 | + switch (line) { | ||
| 114 | + case 1: /* line status */ | ||
| 115 | + /* clear the flag if it's powersaving */ | ||
| 116 | + if(!strstr("POWERSAVE ON", display_message) != 0) | ||
| 117 | + errorflag ^= 1 << (line - 1); | ||
| 118 | + break; | ||
| 119 | |||
| 120 | - /* strip the newline character from the end of the input */ | ||
| 121 | - if (input_buffer[strlen (input_buffer) - 1] == '\n') | ||
| 122 | - input_buffer[strlen (input_buffer) - 1] = 0; | ||
| 123 | - | ||
| 124 | - line++; | ||
| 125 | - | ||
| 126 | - temp_buffer = strtok (input_buffer, "="); | ||
| 127 | - temp_buffer = strtok (NULL, "="); | ||
| 128 | - | ||
| 129 | - if (temp_buffer == NULL) { | ||
| 130 | - | ||
| 131 | - result = STATE_UNKNOWN; | ||
| 132 | - strcpy (errmsg, input_buffer); | ||
| 133 | - | ||
| 134 | - } else { | ||
| 135 | - | ||
| 136 | - switch (line) { | ||
| 137 | - | ||
| 138 | - case 1: /* 1st line should contain the line status */ | ||
| 139 | - line_status = atoi (temp_buffer); | ||
| 140 | - break; | ||
| 141 | - case 2: /* 2nd line should contain the paper status */ | ||
| 142 | - paper_status = atoi (temp_buffer); | ||
| 143 | - break; | ||
| 144 | - case 3: /* 3rd line should be intervention required */ | ||
| 145 | - intervention_required = atoi (temp_buffer); | ||
| 146 | - break; | ||
| 147 | - case 4: /* 4th line should be peripheral error */ | ||
| 148 | - peripheral_error = atoi (temp_buffer); | ||
| 149 | - break; | ||
| 150 | - case 5: /* 5th line should contain the paper jam status */ | ||
| 151 | - paper_jam = atoi (temp_buffer); | ||
| 152 | - break; | ||
| 153 | - case 6: /* 6th line should contain the paper out status */ | ||
| 154 | - paper_out = atoi (temp_buffer); | ||
| 155 | - break; | ||
| 156 | - case 7: /* 7th line should contain the toner low status */ | ||
| 157 | - toner_low = atoi (temp_buffer); | ||
| 158 | - break; | ||
| 159 | - case 8: /* did data come too slow for engine */ | ||
| 160 | - page_punt = atoi (temp_buffer); | ||
| 161 | - break; | ||
| 162 | - case 9: /* did we run out of memory */ | ||
| 163 | - memory_out = atoi (temp_buffer); | ||
| 164 | - break; | ||
| 165 | - case 10: /* is there a door open */ | ||
| 166 | - door_open = atoi (temp_buffer); | ||
| 167 | - break; | ||
| 168 | - case 11: /* is output tray full */ | ||
| 169 | - paper_output = atoi (temp_buffer); | ||
| 170 | - break; | ||
| 171 | - case 12: /* display panel message */ | ||
| 172 | - strcpy (display_message, temp_buffer + 1); | ||
| 173 | - break; | ||
| 174 | - default: | ||
| 175 | - break; | ||
| 176 | - } | ||
| 177 | - | ||
| 178 | + case 2: /* paper status */ | ||
| 179 | + case 3: /* intervention required */ | ||
| 180 | + case 4: /* peripheral error */ | ||
| 181 | + case 5: /* paper jam */ | ||
| 182 | + case 6: /* paper out */ | ||
| 183 | + case 7: /* toner low */ | ||
| 184 | + case 8: /* data came too slow for engine */ | ||
| 185 | + case 9: /* out of memory */ | ||
| 186 | + case 10: /* is there a door open */ | ||
| 187 | + case 11: /* is output tray full */ | ||
| 188 | + default: /* notreached */ | ||
| 189 | + break; | ||
| 190 | } | ||
| 191 | |||
| 192 | - /* break out of the read loop if we encounter an error */ | ||
| 193 | - if (result != STATE_OK) | ||
| 194 | + if(++line >= SNMP_VARS) | ||
| 195 | break; | ||
| 196 | } | ||
| 197 | |||
| 198 | - /* WARNING if output found on stderr */ | ||
| 199 | - if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { | ||
| 200 | + /* WARNING if output found on stderr, but only if we | ||
| 201 | + * haven't already found an error condition */ | ||
| 202 | + if (!errorflag && fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { | ||
| 203 | result = max_state (result, STATE_WARNING); | ||
| 204 | /* remove CRLF */ | ||
| 205 | if (input_buffer[strlen (input_buffer) - 1] == '\n') | ||
| 206 | input_buffer[strlen (input_buffer) - 1] = 0; | ||
| 207 | - sprintf (errmsg, "%s", input_buffer ); | ||
| 208 | - | ||
| 209 | + strncpy(errmsg, input_buffer, sizeof(errmsg)); | ||
| 210 | } | ||
| 211 | - | ||
| 212 | + | ||
| 213 | /* close stderr */ | ||
| 214 | (void) fclose (child_stderr); | ||
| 215 | |||
| 216 | - /* close the pipe */ | ||
| 217 | + /* close the pipe. set warning at least if snmpget didn't return 0 */ | ||
| 218 | if (spclose (child_process)) | ||
| 219 | - result = max_state (result, STATE_WARNING); | ||
| 220 | + result = STATE_WARNING; | ||
| 221 | |||
| 222 | /* if there wasn't any output, display an error */ | ||
| 223 | if (line == 0) { | ||
| 224 | - | ||
| 225 | - /* might not be the problem, but most likely is. */ | ||
| 226 | - result = STATE_UNKNOWN ; | ||
| 227 | - asprintf (&errmsg, "%s : Timeout from host %s\n", errmsg, address ); | ||
| 228 | - | ||
| 229 | - } | ||
| 230 | - | ||
| 231 | - /* if we had no read errors, check the printer status results... */ | ||
| 232 | - if (result == STATE_OK) { | ||
| 233 | - | ||
| 234 | - if (paper_jam) { | ||
| 235 | - result = STATE_WARNING; | ||
| 236 | - strcpy (errmsg, _("Paper Jam")); | ||
| 237 | - } | ||
| 238 | - else if (paper_out) { | ||
| 239 | - result = STATE_WARNING; | ||
| 240 | - strcpy (errmsg, _("Out of Paper")); | ||
| 241 | - } | ||
| 242 | - else if (line_status == OFFLINE) { | ||
| 243 | - if (strcmp (errmsg, "POWERSAVE ON") != 0) { | ||
| 244 | - result = STATE_WARNING; | ||
| 245 | - strcpy (errmsg, _("Printer Offline")); | ||
| 246 | - } | ||
| 247 | - } | ||
| 248 | - else if (peripheral_error) { | ||
| 249 | - result = STATE_WARNING; | ||
| 250 | - strcpy (errmsg, _("Peripheral Error")); | ||
| 251 | - } | ||
| 252 | - else if (intervention_required) { | ||
| 253 | - result = STATE_WARNING; | ||
| 254 | - strcpy (errmsg, _("Intervention Required")); | ||
| 255 | - } | ||
| 256 | - else if (toner_low) { | ||
| 257 | - result = STATE_WARNING; | ||
| 258 | - strcpy (errmsg, _("Toner Low")); | ||
| 259 | - } | ||
| 260 | - else if (memory_out) { | ||
| 261 | - result = STATE_WARNING; | ||
| 262 | - strcpy (errmsg, _("Insufficient Memory")); | ||
| 263 | - } | ||
| 264 | - else if (door_open) { | ||
| 265 | - result = STATE_WARNING; | ||
| 266 | - strcpy (errmsg, _("A Door is Open")); | ||
| 267 | - } | ||
| 268 | - else if (paper_output) { | ||
| 269 | - result = STATE_WARNING; | ||
| 270 | - strcpy (errmsg, _("Output Tray is Full")); | ||
| 271 | - } | ||
| 272 | - else if (page_punt) { | ||
| 273 | - result = STATE_WARNING; | ||
| 274 | - strcpy (errmsg, _("Data too Slow for Engine")); | ||
| 275 | - } | ||
| 276 | - else if (paper_status) { | ||
| 277 | - result = STATE_WARNING; | ||
| 278 | - strcpy (errmsg, _("Unknown Paper Error")); | ||
| 279 | - } | ||
| 280 | + /* timeout is not necessarily the problem, and produces wildly | ||
| 281 | + * inaccurate error messages when it isn't, so just say | ||
| 282 | + * the host didn't return anything and return immediately | ||
| 283 | + * (old plugin unconditionally escalated STATE_UNKNOWN to | ||
| 284 | + * STATE_CRITICAL at the end, so this just saves a bit of | ||
| 285 | + * indentation. */ | ||
| 286 | + printf (_("%s : No data returned from %s\n"), errmsg, address ); | ||
| 287 | + return STATE_CRITICAL; | ||
| 288 | } | ||
| 289 | |||
| 290 | - if (result == STATE_OK) | ||
| 291 | + /* obviously no read errors, so check the printer status results... */ | ||
| 292 | + if (!errors) { | ||
| 293 | + result = STATE_OK; | ||
| 294 | printf (_("Printer ok - (%s)\n"), display_message); | ||
| 295 | - | ||
| 296 | - else if (result == STATE_UNKNOWN) { | ||
| 297 | - | ||
| 298 | - printf ("%s\n", errmsg); | ||
| 299 | - | ||
| 300 | - /* if printer could not be reached, escalate to critical */ | ||
| 301 | - if (strstr (errmsg, "Timeout")) | ||
| 302 | - result = STATE_CRITICAL; | ||
| 303 | } | ||
| 304 | - | ||
| 305 | - else if (result == STATE_WARNING) | ||
| 306 | - printf ("%s (%s)\n", errmsg, display_message); | ||
| 307 | + else { | ||
| 308 | + /* some error occured, so print them all */ | ||
| 309 | + while(i < SNMP_VARS) { | ||
| 310 | + printf ("%s (%s)\n", errmsg ? errmsg : "", display_message); | ||
| 311 | + if((errorflag >> i) & 1) /* only print if flag is set */ | ||
| 312 | + printf(":: %s", errmsg_strings[i++]); | ||
| 313 | + } | ||
| 314 | + } | ||
| 315 | |||
| 316 | return result; | ||
| 317 | } | ||
| 318 | @@ -346,12 +285,12 @@ | ||
| 319 | usage2 (_("Invalid hostname/address"), argv[c]); | ||
| 320 | } | ||
| 321 | } | ||
| 322 | - | ||
| 323 | + | ||
| 324 | if (community == NULL) { | ||
| 325 | if (argv[c] != NULL ) | ||
| 326 | community = argv[c]; | ||
| 327 | else | ||
| 328 | - community = strdup (DEFAULT_COMMUNITY); | ||
| 329 | + community = DEFAULT_COMMUNITY; | ||
| 330 | } | ||
| 331 | |||
| 332 | return validate_arguments (); | ||
diff --git a/web/attachments/121778-nagiosplug-cvs-check_mysql-paranoia.diff b/web/attachments/121778-nagiosplug-cvs-check_mysql-paranoia.diff new file mode 100644 index 0000000..6639e29 --- /dev/null +++ b/web/attachments/121778-nagiosplug-cvs-check_mysql-paranoia.diff | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | diff -urN ./plugins/check_mysql.c ../plugins/plugins/check_mysql.c | ||
| 2 | --- ./plugins/check_mysql.c 2005-01-05 21:53:16.000000000 +0100 | ||
| 3 | +++ ../plugins/plugins/check_mysql.c 2005-02-17 16:08:30.000000000 +0100 | ||
| 4 | @@ -155,7 +155,7 @@ | ||
| 5 | int | ||
| 6 | process_arguments (int argc, char **argv) | ||
| 7 | { | ||
| 8 | - int c; | ||
| 9 | + int c, i; | ||
| 10 | |||
| 11 | int option = 0; | ||
| 12 | static struct option longopts[] = { | ||
| 13 | @@ -193,10 +193,19 @@ | ||
| 14 | db = optarg; | ||
| 15 | break; | ||
| 16 | case 'u': /* username */ | ||
| 17 | - db_user = optarg; | ||
| 18 | + if((db_user = strdup(optarg))) { | ||
| 19 | + for(i = 0; i < strlen(argv[optind]); i++) argv[optind][i] = 'x'; | ||
| 20 | + } | ||
| 21 | + else | ||
| 22 | + db_user = optarg; | ||
| 23 | break; | ||
| 24 | case 'p': /* authentication information: password */ | ||
| 25 | - db_pass = optarg; | ||
| 26 | + if((db_pass = strdup(optarg))) { | ||
| 27 | + /* strdup was successful, so obscure passwd from ps view */ | ||
| 28 | + for(i = 0; i < strlen(argv[optind]); i++) argv[optind][i] = 'x'; | ||
| 29 | + } | ||
| 30 | + else /* strdup failed, so point it to password input string */ | ||
| 31 | + db_pass = optarg; | ||
| 32 | break; | ||
| 33 | case 'P': /* critical time threshold */ | ||
| 34 | db_port = atoi (optarg); | ||
| 35 | @@ -219,18 +228,27 @@ | ||
| 36 | |||
| 37 | while ( argc > c ) { | ||
| 38 | |||
| 39 | - if (strlen(db_host) == 0) | ||
| 40 | + if (db_host == NULL || strlen(db_host) == 0) { | ||
| 41 | if (is_host (argv[c])) { | ||
| 42 | db_host = argv[c++]; | ||
| 43 | } | ||
| 44 | else { | ||
| 45 | usage2 (_("Invalid hostname/address"), optarg); | ||
| 46 | } | ||
| 47 | - else if (strlen(db_user) == 0) | ||
| 48 | - db_user = argv[c++]; | ||
| 49 | - else if (strlen(db_pass) == 0) | ||
| 50 | - db_pass = argv[c++]; | ||
| 51 | - else if (strlen(db) == 0) | ||
| 52 | + } | ||
| 53 | + else if (db_user == NULL || strlen(db_user) == 0) { | ||
| 54 | + if((db_user = strdup(argv[c++]))) | ||
| 55 | + for(i = 0; i < strlen(argv[c]); i++) argv[c][i] = 'x'; | ||
| 56 | + else | ||
| 57 | + db_user = argv[c]; | ||
| 58 | + } | ||
| 59 | + else if (db_pass == NULL || strlen(db_pass) == 0) { | ||
| 60 | + if((db_pass = strdup(argv[c++]))) | ||
| 61 | + for(i = 0; i < strlen(argv[c]); i++) argv[c][i] = 'x'; | ||
| 62 | + else | ||
| 63 | + db_pass = argv[c]; | ||
| 64 | + } | ||
| 65 | + else if (db == NULL || strlen(db) == 0) | ||
| 66 | db = argv[c++]; | ||
| 67 | else if (is_intnonneg (argv[c])) | ||
| 68 | db_port = atoi (argv[c++]); | ||
| 69 | @@ -246,16 +264,16 @@ | ||
| 70 | validate_arguments (void) | ||
| 71 | { | ||
| 72 | if (db_user == NULL) | ||
| 73 | - db_user = strdup(""); | ||
| 74 | + db_user = ""; | ||
| 75 | |||
| 76 | if (db_host == NULL) | ||
| 77 | - db_host = strdup(""); | ||
| 78 | + db_host = ""; | ||
| 79 | |||
| 80 | if (db_pass == NULL) | ||
| 81 | - db_pass == strdup(""); | ||
| 82 | + db_pass == ""; | ||
| 83 | |||
| 84 | if (db == NULL) | ||
| 85 | - db = strdup(""); | ||
| 86 | + db = ""; | ||
| 87 | |||
| 88 | return OK; | ||
| 89 | } | ||
diff --git a/web/attachments/121779-nagiosplug-cvs-check_snmp.diff b/web/attachments/121779-nagiosplug-cvs-check_snmp.diff new file mode 100644 index 0000000..d2c1cde --- /dev/null +++ b/web/attachments/121779-nagiosplug-cvs-check_snmp.diff | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | diff -urN ./plugins/check_snmp.c ../plugins/plugins/check_snmp.c | ||
| 2 | --- ./plugins/check_snmp.c 2005-01-24 08:29:54.000000000 +0100 | ||
| 3 | +++ ../plugins/plugins/check_snmp.c 2005-02-17 16:53:58.000000000 +0100 | ||
| 4 | @@ -36,6 +36,7 @@ | ||
| 5 | #define DEFAULT_AUTH_PROTOCOL "MD5" | ||
| 6 | #define DEFAULT_DELIMITER "=" | ||
| 7 | #define DEFAULT_OUTPUT_DELIMITER " " | ||
| 8 | +#define DEFAULT_SEC_LEVEL "noAuthNoPriv" | ||
| 9 | |||
| 10 | #define mark(a) ((a)!=0?"*":"") | ||
| 11 | |||
| 12 | @@ -88,12 +89,12 @@ | ||
| 13 | #endif | ||
| 14 | |||
| 15 | char *server_address = NULL; | ||
| 16 | -char *community = NULL; | ||
| 17 | +char *community = DEFAULT_COMMUNITY; | ||
| 18 | char *authpriv = NULL; | ||
| 19 | -char *proto = NULL; | ||
| 20 | -char *seclevel = NULL; | ||
| 21 | +char *proto = DEFAULT_PROTOCOL; | ||
| 22 | +char *seclevel = DEFAULT_SEC_LEVEL; | ||
| 23 | char *secname = NULL; | ||
| 24 | -char *authproto = NULL; | ||
| 25 | +char *authproto = DEFAULT_AUTH_PROTOCOL; | ||
| 26 | char *authpasswd = NULL; | ||
| 27 | char *privpasswd = NULL; | ||
| 28 | char *oid; | ||
| 29 | @@ -147,15 +148,15 @@ | ||
| 30 | eval_method[i] = CHECK_UNDEF; | ||
| 31 | i = 0; | ||
| 32 | |||
| 33 | - oid = strdup (""); | ||
| 34 | - label = strdup ("SNMP"); | ||
| 35 | - units = strdup (""); | ||
| 36 | - port = strdup (DEFAULT_PORT); | ||
| 37 | - outbuff = strdup (""); | ||
| 38 | - output = strdup (""); | ||
| 39 | - delimiter = strdup (DEFAULT_DELIMITER); | ||
| 40 | - output_delim = strdup (DEFAULT_OUTPUT_DELIMITER); | ||
| 41 | - miblist = strdup (DEFAULT_MIBLIST); | ||
| 42 | + oid = ""; | ||
| 43 | + label = "SNMP"; | ||
| 44 | + units = ""; | ||
| 45 | + port = DEFAULT_PORT; | ||
| 46 | + outbuff = ""; | ||
| 47 | + output = ""; | ||
| 48 | + delimiter = DEFAULT_DELIMITER; | ||
| 49 | + output_delim = DEFAULT_OUTPUT_DELIMITER; | ||
| 50 | + miblist = DEFAULT_MIBLIST; | ||
| 51 | timeout_interval = DEFAULT_TIMEOUT; | ||
| 52 | retries = DEFAULT_RETRIES; | ||
| 53 | |||
| 54 | @@ -598,9 +599,6 @@ | ||
| 55 | if (server_address == NULL) | ||
| 56 | server_address = argv[optind]; | ||
| 57 | |||
| 58 | - if (community == NULL) | ||
| 59 | - community = strdup (DEFAULT_COMMUNITY); | ||
| 60 | - | ||
| 61 | return validate_arguments (); | ||
| 62 | } | ||
| 63 | |||
| 64 | @@ -631,30 +629,28 @@ | ||
| 65 | validate_arguments () | ||
| 66 | { | ||
| 67 | |||
| 68 | - /* Need better checks to verify seclevel and authproto choices */ | ||
| 69 | - | ||
| 70 | - if (seclevel == NULL) | ||
| 71 | - asprintf (&seclevel, "noAuthNoPriv"); | ||
| 72 | + /* Need checks to verify seclevel and authproto choices */ | ||
| 73 | |||
| 74 | + /* default protocol is set in variable declaraion, so this can't | ||
| 75 | + * possibly be NULL any-more. It can, however, be a zero length string | ||
| 76 | + * (if a check_command is specified that can use either v1 or v2c, the | ||
| 77 | + * $ARGx$ macro is quote-escaped and not given in service-description) | ||
| 78 | + * in which case we don't fuss much about it but just set it to default */ | ||
| 79 | + if (!strlen(proto)) | ||
| 80 | + proto = DEFAULT_PROTOCOL; | ||
| 81 | |||
| 82 | - if (authproto == NULL ) | ||
| 83 | - asprintf(&authproto, DEFAULT_AUTH_PROTOCOL); | ||
| 84 | - | ||
| 85 | - | ||
| 86 | - | ||
| 87 | - if (proto == NULL || (strcmp(proto,DEFAULT_PROTOCOL) == 0) ) { /* default protocol version */ | ||
| 88 | - asprintf(&proto, DEFAULT_PROTOCOL); | ||
| 89 | + if (proto[0] == '1' || proto[0] == '2') { /* community based access */ | ||
| 90 | asprintf(&authpriv, "%s%s", "-c ", community); | ||
| 91 | } | ||
| 92 | else if ( strcmp (proto, "3") == 0 ) { /* snmpv3 args */ | ||
| 93 | - asprintf(&proto, "%s", "3"); | ||
| 94 | - | ||
| 95 | + proto = "3"; | ||
| 96 | + | ||
| 97 | if ( (strcmp(seclevel, "noAuthNoPriv") == 0) || seclevel == NULL ) { | ||
| 98 | - asprintf(&authpriv, "%s", "-l noAuthNoPriv" ); | ||
| 99 | + asprintf(&authpriv, "%s %s", "-l", DEFAULT_SEC_LEVEL); | ||
| 100 | } | ||
| 101 | else if ( strcmp(seclevel, "authNoPriv") == 0 ) { | ||
| 102 | if ( secname == NULL || authpasswd == NULL) { | ||
| 103 | - printf (_("Missing secname (%s) or authpassword (%s) ! \n"),secname, authpasswd ); | ||
| 104 | + printf (_("Missing secname or authpassword!\n")); | ||
| 105 | print_usage (); | ||
| 106 | exit (STATE_UNKNOWN); | ||
| 107 | } | ||
| 108 | @@ -662,7 +658,7 @@ | ||
| 109 | } | ||
| 110 | else if ( strcmp(seclevel, "authPriv") == 0 ) { | ||
| 111 | if ( secname == NULL || authpasswd == NULL || privpasswd == NULL ) { | ||
| 112 | - printf (_("Missing secname (%s), authpassword (%s), or privpasswd (%s)! \n"),secname, authpasswd,privpasswd ); | ||
| 113 | + printf (_("Missing secname, authpassword or privpasswd!\n")); | ||
| 114 | print_usage (); | ||
| 115 | exit (STATE_UNKNOWN); | ||
| 116 | } | ||
diff --git a/web/attachments/121780-nagiosplug-cvs-check_tcp.diff b/web/attachments/121780-nagiosplug-cvs-check_tcp.diff new file mode 100644 index 0000000..8f80d0e --- /dev/null +++ b/web/attachments/121780-nagiosplug-cvs-check_tcp.diff | |||
| @@ -0,0 +1,204 @@ | |||
| 1 | diff -urN ./plugins/check_tcp.c ../foo/plugins/check_tcp.c | ||
| 2 | --- ./plugins/check_tcp.c 2005-01-05 21:53:20.000000000 +0100 | ||
| 3 | +++ ../foo/plugins/check_tcp.c 2005-02-18 16:10:17.000000000 +0100 | ||
| 4 | @@ -114,138 +114,105 @@ | ||
| 5 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 6 | textdomain (PACKAGE); | ||
| 7 | |||
| 8 | - if (strstr (argv[0], "check_udp")) { | ||
| 9 | - progname = strdup ("check_udp"); | ||
| 10 | - SERVICE = strdup ("UDP"); | ||
| 11 | - SEND = NULL; | ||
| 12 | - EXPECT = NULL; | ||
| 13 | - QUIT = NULL; | ||
| 14 | + progname = strrchr(argv[0], '/'); | ||
| 15 | + if(progname && strlen(progname) > 1) progname++; | ||
| 16 | + else progname = argv[0]; | ||
| 17 | + | ||
| 18 | + /* determine service, if possible */ | ||
| 19 | + SERVICE = strrchr(progname, '_'); | ||
| 20 | + if(SERVICE && strlen(SERVICE) > 1) { | ||
| 21 | + /* get a unique pointer and upcase it */ | ||
| 22 | + SERVICE++; | ||
| 23 | + SERVICE = strdup(SERVICE); | ||
| 24 | + for(i = 0; i < strlen(SERVICE); i++) | ||
| 25 | + SERVICE[i] = toupper(SERVICE[i]); | ||
| 26 | + } | ||
| 27 | + else SERVICE = "UNKNOWN SERVICE"; | ||
| 28 | + | ||
| 29 | + PROTOCOL = TCP_PROTOCOL; /* majority, so default */ | ||
| 30 | + | ||
| 31 | + if (!strncmp(SERVICE, "UDP", 3)) { /* strncmp to match check_udp2 also */ | ||
| 32 | PROTOCOL = UDP_PROTOCOL; | ||
| 33 | - PORT = 0; | ||
| 34 | } | ||
| 35 | - else if (strstr (argv[0], "check_tcp")) { | ||
| 36 | - progname = strdup ("check_tcp"); | ||
| 37 | - SERVICE = strdup ("TCP"); | ||
| 38 | - SEND = NULL; | ||
| 39 | - EXPECT = NULL; | ||
| 40 | - QUIT = NULL; | ||
| 41 | - PROTOCOL = TCP_PROTOCOL; | ||
| 42 | - PORT = 0; | ||
| 43 | - } | ||
| 44 | - else if (strstr (argv[0], "check_ftp")) { | ||
| 45 | - progname = strdup ("check_ftp"); | ||
| 46 | - SERVICE = strdup ("FTP"); | ||
| 47 | - SEND = NULL; | ||
| 48 | - EXPECT = strdup ("220"); | ||
| 49 | - QUIT = strdup ("QUIT\r\n"); | ||
| 50 | - PROTOCOL = TCP_PROTOCOL; | ||
| 51 | + else if (!strcmp (SERVICE, "FTP")) { | ||
| 52 | + EXPECT = "220"; | ||
| 53 | + QUIT = "QUIT\r\n"; | ||
| 54 | PORT = 21; | ||
| 55 | } | ||
| 56 | - else if (strstr (argv[0], "check_smtp")) { | ||
| 57 | - progname = strdup ("check_smtp"); | ||
| 58 | - SERVICE = strdup ("SMTP"); | ||
| 59 | - SEND = NULL; | ||
| 60 | - EXPECT = strdup ("220"); | ||
| 61 | - QUIT = strdup ("QUIT\r\n"); | ||
| 62 | - PROTOCOL = TCP_PROTOCOL; | ||
| 63 | + else if (!strcmp (SERVICE, "SMTP")) { | ||
| 64 | + EXPECT = "220"; | ||
| 65 | + QUIT = "QUIT\r\n"; | ||
| 66 | PORT = 25; | ||
| 67 | } | ||
| 68 | - else if (strstr (argv[0], "check_pop")) { | ||
| 69 | - progname = strdup ("check_pop"); | ||
| 70 | - SERVICE = strdup ("POP"); | ||
| 71 | - SEND = NULL; | ||
| 72 | - EXPECT = strdup ("+OK"); | ||
| 73 | - QUIT = strdup ("QUIT\r\n"); | ||
| 74 | - PROTOCOL = TCP_PROTOCOL; | ||
| 75 | + else if (!strcmp (SERVICE, "POP")) { | ||
| 76 | PORT = 110; | ||
| 77 | } | ||
| 78 | - else if (strstr (argv[0], "check_imap")) { | ||
| 79 | - progname = strdup ("check_imap"); | ||
| 80 | - SERVICE = strdup ("IMAP"); | ||
| 81 | - SEND = NULL; | ||
| 82 | - EXPECT = strdup ("* OK"); | ||
| 83 | - QUIT = strdup ("a1 LOGOUT\r\n"); | ||
| 84 | - PROTOCOL = TCP_PROTOCOL; | ||
| 85 | + else if (!strcmp (SERVICE, "IMAP")) { | ||
| 86 | + SERVICE = "IMAP"; | ||
| 87 | PORT = 143; | ||
| 88 | } | ||
| 89 | #ifdef HAVE_SSL | ||
| 90 | - else if (strstr(argv[0],"check_simap")) { | ||
| 91 | - progname = strdup ("check_simap"); | ||
| 92 | - SERVICE = strdup ("SIMAP"); | ||
| 93 | - SEND=NULL; | ||
| 94 | - EXPECT = strdup ("* OK"); | ||
| 95 | - QUIT = strdup ("a1 LOGOUT\r\n"); | ||
| 96 | - PROTOCOL=TCP_PROTOCOL; | ||
| 97 | + else if (!strcmp(SERVICE,"SIMAP")) { | ||
| 98 | + SERVICE = "SIMAP"; | ||
| 99 | use_ssl=TRUE; | ||
| 100 | PORT=993; | ||
| 101 | } | ||
| 102 | - else if (strstr(argv[0],"check_spop")) { | ||
| 103 | - progname = strdup ("check_spop"); | ||
| 104 | - SERVICE = strdup ("SPOP"); | ||
| 105 | - SEND=NULL; | ||
| 106 | - EXPECT = strdup ("+OK"); | ||
| 107 | - QUIT = strdup ("QUIT\r\n"); | ||
| 108 | - PROTOCOL=TCP_PROTOCOL; | ||
| 109 | + else if (!strcmp(SERVICE,"SPOP")) { | ||
| 110 | use_ssl=TRUE; | ||
| 111 | PORT=995; | ||
| 112 | } | ||
| 113 | - else if (strstr(argv[0],"check_jabber")) { | ||
| 114 | - progname = strdup("check_jabber"); | ||
| 115 | - SERVICE = strdup("JABBER"); | ||
| 116 | - SEND = strdup("<stream:stream to=\'host\' xmlns=\'jabber:client\' xmlns:stream=\'http://etherx.jabber.org/streams\'>\n"); | ||
| 117 | - EXPECT = strdup("<?xml version=\'1.0\'?><stream:stream xmlns:stream=\'http://etherx.jabber.org/streams\'"); | ||
| 118 | - QUIT = strdup("</stream:stream>\n"); | ||
| 119 | - PROTOCOL=TCP_PROTOCOL; | ||
| 120 | + else if (!strcmp(SERVICE, "JABBER")) { | ||
| 121 | + SEND = "<stream:stream to=\'host\' xmlns=\'jabber:client\' xmlns:stream=\'http://etherx.jabber.org/streams\'>\n"; | ||
| 122 | + EXPECT = "<?xml version=\'1.0\'?><stream:stream xmlns:stream=\'http://etherx.jabber.org/streams\'"; | ||
| 123 | + QUIT = "</stream:stream>\n"; | ||
| 124 | use_ssl=TRUE; | ||
| 125 | PORT = 5222; | ||
| 126 | } | ||
| 127 | - else if (strstr (argv[0], "check_nntps")) { | ||
| 128 | - progname = strdup("check_nntps"); | ||
| 129 | - SERVICE = strdup("NNTPS"); | ||
| 130 | - SEND = NULL; | ||
| 131 | - EXPECT = NULL; | ||
| 132 | - server_expect = realloc (server_expect, ++server_expect_count); | ||
| 133 | - asprintf (&server_expect[server_expect_count - 1], "200"); | ||
| 134 | - server_expect = realloc (server_expect, ++server_expect_count); | ||
| 135 | - asprintf (&server_expect[server_expect_count - 1], "201"); | ||
| 136 | - QUIT = strdup("QUIT\r\n"); | ||
| 137 | - PROTOCOL = TCP_PROTOCOL; | ||
| 138 | + else if (!strcmp (SERVICE, "NNTPS")) { | ||
| 139 | use_ssl=TRUE; | ||
| 140 | PORT = 563; | ||
| 141 | -} | ||
| 142 | - | ||
| 143 | + } | ||
| 144 | #endif | ||
| 145 | - else if (strstr (argv[0], "check_nntp")) { | ||
| 146 | - progname = strdup ("check_nntp"); | ||
| 147 | - SERVICE = strdup ("NNTP"); | ||
| 148 | - SEND = NULL; | ||
| 149 | - EXPECT = NULL; | ||
| 150 | - server_expect = realloc (server_expect, sizeof (char *) * (++server_expect_count)); | ||
| 151 | - asprintf (&server_expect[server_expect_count - 1], "200"); | ||
| 152 | - server_expect = realloc (server_expect, sizeof (char *) * (++server_expect_count)); | ||
| 153 | - asprintf (&server_expect[server_expect_count - 1], "201"); | ||
| 154 | - asprintf (&QUIT, "QUIT\r\n"); | ||
| 155 | - PROTOCOL = TCP_PROTOCOL; | ||
| 156 | + else if (!strcmp (SERVICE, "NNTP")) { | ||
| 157 | PORT = 119; | ||
| 158 | } | ||
| 159 | - else { | ||
| 160 | - progname = strdup ("check_tcp"); | ||
| 161 | + else if (strncmp(SERVICE, "TCP", 3)) { | ||
| 162 | + /* match if NOT called as check_tcp */ | ||
| 163 | usage (_("CRITICAL - Generic check_tcp called with unknown service\n")); | ||
| 164 | } | ||
| 165 | |||
| 166 | - server_address = strdup ("127.0.0.1"); | ||
| 167 | + | ||
| 168 | + /* SSL and plaintext counterparts set here to avoid duplicate code | ||
| 169 | + * (OSI layer 7 stuff here, layer 3-4 goes above unless protocol doesn't | ||
| 170 | + * support SSL, in which case we bundle it above to save LOC count */ | ||
| 171 | + if(!strncmp(SERVICE, "NTTP") || !strcmp(SERVICE, "NNTPS")) { | ||
| 172 | + server_expect = realloc (server_expect, sizeof(char *) * (server_expect_count + 2)); | ||
| 173 | + server_expect[server_expect_count++] = "200"; | ||
| 174 | + server_expect[server_expect_count++] = "201"; | ||
| 175 | + QUIT = "QUIT\r\n"; | ||
| 176 | + } | ||
| 177 | + else if(!strcmp(SERVICE, "IMAP") || !strcmp(SERVICE, "SIMAP")) { | ||
| 178 | + EXPECT = "* OK"; | ||
| 179 | + QUIT = "a1 LOGOUT\r\n"; | ||
| 180 | + } | ||
| 181 | + else if(!strcmp(SERVICE, "POP") || !strcmp(SERVICE, "SPOP")) { | ||
| 182 | + EXPECT = "+OK"; | ||
| 183 | + QUIT = "QUIT\r\n"; | ||
| 184 | + } | ||
| 185 | + | ||
| 186 | + server_address = "127.0.0.1"; | ||
| 187 | server_port = PORT; | ||
| 188 | server_send = SEND; | ||
| 189 | server_quit = QUIT; | ||
| 190 | - status = strdup (""); | ||
| 191 | + status = ""; | ||
| 192 | |||
| 193 | if (process_arguments (argc, argv) == ERROR) | ||
| 194 | usage4 (_("Could not parse arguments")); | ||
| 195 | |||
| 196 | /* use default expect if none listed in process_arguments() */ | ||
| 197 | if (EXPECT && server_expect_count == 0) { | ||
| 198 | - server_expect = malloc (sizeof (char *) * (++server_expect_count)); | ||
| 199 | - server_expect[server_expect_count - 1] = EXPECT; | ||
| 200 | + server_expect = malloc (sizeof (char *)); | ||
| 201 | + server_expect[server_expect_count++] = EXPECT; | ||
| 202 | } | ||
| 203 | |||
| 204 | /* initialize alarm signal handling */ | ||
diff --git a/web/attachments/121781-nagiosplug-cvs-netutils-wrappers.diff b/web/attachments/121781-nagiosplug-cvs-netutils-wrappers.diff new file mode 100644 index 0000000..de98a26 --- /dev/null +++ b/web/attachments/121781-nagiosplug-cvs-netutils-wrappers.diff | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | diff -urN ./plugins/netutils.c ../foo/plugins/netutils.c | ||
| 2 | --- ./plugins/netutils.c 2005-02-18 14:59:29.000000000 +0100 | ||
| 3 | +++ ../foo/plugins/netutils.c 2005-02-18 16:12:35.000000000 +0100 | ||
| 4 | @@ -64,12 +64,8 @@ | ||
| 5 | process_tcp_request (const char *server_address, int server_port, | ||
| 6 | const char *send_buffer, char *recv_buffer, int recv_size) | ||
| 7 | { | ||
| 8 | - int result; | ||
| 9 | - | ||
| 10 | - result = process_request (server_address, server_port, | ||
| 11 | - IPPROTO_TCP, send_buffer, recv_buffer, recv_size); | ||
| 12 | - | ||
| 13 | - return result; | ||
| 14 | + return process_request (server_address, server_port, IPPROTO_TCP, | ||
| 15 | + send_buffer, recv_buffer, recv_size); | ||
| 16 | } | ||
| 17 | |||
| 18 | |||
| 19 | @@ -79,12 +75,8 @@ | ||
| 20 | process_udp_request (const char *server_address, int server_port, | ||
| 21 | const char *send_buffer, char *recv_buffer, int recv_size) | ||
| 22 | { | ||
| 23 | - int result; | ||
| 24 | - | ||
| 25 | - result = process_request (server_address, server_port, | ||
| 26 | - IPPROTO_UDP, send_buffer, recv_buffer, recv_size); | ||
| 27 | - | ||
| 28 | - return result; | ||
| 29 | + return process_request (server_address, server_port, IPPROTO_UDP, | ||
| 30 | + send_buffer, recv_buffer, recv_size); | ||
| 31 | } | ||
| 32 | |||
| 33 | |||
| 34 | @@ -195,11 +187,7 @@ | ||
| 35 | int | ||
| 36 | my_tcp_connect (const char *host_name, int port, int *sd) | ||
| 37 | { | ||
| 38 | - int result; | ||
| 39 | - | ||
| 40 | - result = my_connect (host_name, port, sd, IPPROTO_TCP); | ||
| 41 | - | ||
| 42 | - return result; | ||
| 43 | + return my_connect (host_name, port, sd, IPPROTO_TCP); | ||
| 44 | } | ||
| 45 | |||
| 46 | |||
| 47 | @@ -207,11 +195,7 @@ | ||
| 48 | int | ||
| 49 | my_udp_connect (const char *host_name, int port, int *sd) | ||
| 50 | { | ||
| 51 | - int result; | ||
| 52 | - | ||
| 53 | - result = my_connect (host_name, port, sd, IPPROTO_UDP); | ||
| 54 | - | ||
| 55 | - return result; | ||
| 56 | + return my_connect (host_name, port, sd, IPPROTO_UDP); | ||
| 57 | } | ||
| 58 | |||
| 59 | |||
diff --git a/web/attachments/121782-nagiosplug-cvs-perl-uselib.diff b/web/attachments/121782-nagiosplug-cvs-perl-uselib.diff new file mode 100644 index 0000000..24e128b --- /dev/null +++ b/web/attachments/121782-nagiosplug-cvs-perl-uselib.diff | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | diff -urN ./plugins-scripts/check_file_age.pl ../plugins/plugins-scripts/check_file_age.pl | ||
| 2 | --- ./plugins-scripts/check_file_age.pl 2003-10-21 17:56:35.000000000 +0200 | ||
| 3 | +++ ../plugins/plugins-scripts/check_file_age.pl 2005-02-18 13:08:06.000000000 +0100 | ||
| 4 | @@ -27,7 +27,7 @@ | ||
| 5 | use Getopt::Long; | ||
| 6 | use File::stat; | ||
| 7 | use vars qw($PROGNAME); | ||
| 8 | -use lib "."; | ||
| 9 | +use lib utils.pm; | ||
| 10 | use utils qw (%ERRORS &print_revision &support); | ||
| 11 | |||
| 12 | sub print_help (); | ||
| 13 | diff -urN ./plugins-scripts/check_mssql.pl ../plugins/plugins-scripts/check_mssql.pl | ||
| 14 | --- ./plugins-scripts/check_mssql.pl 2004-04-19 15:10:48.000000000 +0200 | ||
| 15 | +++ ../plugins/plugins-scripts/check_mssql.pl 2005-02-18 13:08:13.000000000 +0100 | ||
| 16 | @@ -30,7 +30,7 @@ | ||
| 17 | use DBI; | ||
| 18 | use DBD::Sybase; | ||
| 19 | use Getopt::Long; | ||
| 20 | -use lib "."; | ||
| 21 | +use lib utils.pm; | ||
| 22 | use utils qw($TIMEOUT %ERRORS &print_revision &support); | ||
| 23 | use strict; | ||
| 24 | |||
diff --git a/web/attachments/121783-nagiosplug-cvs-progname.diff b/web/attachments/121783-nagiosplug-cvs-progname.diff new file mode 100644 index 0000000..8663049 --- /dev/null +++ b/web/attachments/121783-nagiosplug-cvs-progname.diff | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | diff -urN ./plugins/check_ldap.c ../plugins/plugins/check_ldap.c | ||
| 2 | --- ./plugins/check_ldap.c 2005-01-05 21:53:15.000000000 +0100 | ||
| 3 | +++ ../plugins/plugins/check_ldap.c 2005-02-17 15:37:46.000000000 +0100 | ||
| 4 | @@ -19,7 +19,7 @@ | ||
| 5 | ******************************************************************************/ | ||
| 6 | |||
| 7 | /* progname may be check_ldaps */ | ||
| 8 | -char *progname = "check_ldap"; | ||
| 9 | +char *progname; | ||
| 10 | const char *revision = "$Revision: 1.30 $"; | ||
| 11 | const char *copyright = "2000-2004"; | ||
| 12 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 13 | @@ -84,9 +84,9 @@ | ||
| 14 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 15 | textdomain (PACKAGE); | ||
| 16 | |||
| 17 | - if (strstr(argv[0],"check_ldaps")) { | ||
| 18 | - asprintf (&progname, "check_ldaps"); | ||
| 19 | - } | ||
| 20 | + progname = strrchr(argv[0], '/'); | ||
| 21 | + if(progname && strlen(progname > 1)) progname++; | ||
| 22 | + else progname = argv[0]; | ||
| 23 | |||
| 24 | if (process_arguments (argc, argv) == ERROR) | ||
| 25 | usage4 (_("Could not parse arguments")); | ||
diff --git a/web/attachments/121784-nagiosplug-cvs-silly.diff b/web/attachments/121784-nagiosplug-cvs-silly.diff new file mode 100644 index 0000000..a518e81 --- /dev/null +++ b/web/attachments/121784-nagiosplug-cvs-silly.diff | |||
| @@ -0,0 +1,806 @@ | |||
| 1 | diff -urN ./plugins/check_by_ssh.c ../plugins/plugins/check_by_ssh.c | ||
| 2 | --- ./plugins/check_by_ssh.c 2005-01-05 21:53:11.000000000 +0100 | ||
| 3 | +++ ../plugins/plugins/check_by_ssh.c 2005-02-17 13:19:35.000000000 +0100 | ||
| 4 | @@ -59,9 +59,9 @@ | ||
| 5 | time_t local_time; | ||
| 6 | FILE *fp = NULL; | ||
| 7 | |||
| 8 | - remotecmd = strdup (""); | ||
| 9 | - comm = strdup (SSH_COMMAND); | ||
| 10 | - result_text = strdup (""); | ||
| 11 | + remotecmd = ""; | ||
| 12 | + comm = SSH_COMMAND; | ||
| 13 | + result_text = ""; | ||
| 14 | |||
| 15 | setlocale (LC_ALL, ""); | ||
| 16 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 17 | @@ -137,7 +137,7 @@ | ||
| 18 | printf ("%s", result_text); | ||
| 19 | return result; | ||
| 20 | } | ||
| 21 | - asprintf (&output, "%s", result_text); | ||
| 22 | + output = result_text; | ||
| 23 | result_text = strnl (status_text); | ||
| 24 | eol = strpbrk (output, "\r\n"); | ||
| 25 | if (eol != NULL) | ||
| 26 | diff -urN ./plugins/check_dig.c ../plugins/plugins/check_dig.c | ||
| 27 | --- ./plugins/check_dig.c 2005-01-28 15:00:58.000000000 +0100 | ||
| 28 | +++ ../plugins/plugins/check_dig.c 2005-02-17 13:55:05.000000000 +0100 | ||
| 29 | @@ -59,7 +59,7 @@ | ||
| 30 | double elapsed_time; | ||
| 31 | int result = STATE_UNKNOWN; | ||
| 32 | |||
| 33 | - output = strdup (""); | ||
| 34 | + output = ""; | ||
| 35 | |||
| 36 | setlocale (LC_ALL, ""); | ||
| 37 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 38 | @@ -293,7 +293,7 @@ | ||
| 39 | } | ||
| 40 | } | ||
| 41 | else { | ||
| 42 | - dns_server = strdup ("127.0.0.1"); | ||
| 43 | + dns_server = "127.0.0.1"; | ||
| 44 | } | ||
| 45 | } | ||
| 46 | |||
| 47 | diff -urN ./plugins/check_disk.c ../plugins/plugins/check_disk.c | ||
| 48 | --- ./plugins/check_disk.c 2005-01-05 21:53:12.000000000 +0100 | ||
| 49 | +++ ../plugins/plugins/check_disk.c 2005-02-17 13:12:09.000000000 +0100 | ||
| 50 | @@ -153,9 +153,9 @@ | ||
| 51 | struct fs_usage fsp; | ||
| 52 | struct name_list *temp_list; | ||
| 53 | |||
| 54 | - output = strdup (" - free space:"); | ||
| 55 | - details = strdup (""); | ||
| 56 | - perf = strdup (""); | ||
| 57 | + output = " - free space:"; | ||
| 58 | + details = ""; | ||
| 59 | + perf = ""; | ||
| 60 | |||
| 61 | setlocale (LC_ALL, ""); | ||
| 62 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 63 | @@ -283,7 +283,7 @@ | ||
| 64 | return ERROR; | ||
| 65 | |||
| 66 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 67 | - se->name = strdup ("iso9660"); | ||
| 68 | + se->name = "iso9660"; | ||
| 69 | se->name_next = NULL; | ||
| 70 | *fstail = se; | ||
| 71 | fstail = &se->name_next; | ||
| 72 | @@ -346,19 +346,19 @@ | ||
| 73 | free(units); | ||
| 74 | if (! strcmp (optarg, "bytes")) { | ||
| 75 | mult = (uintmax_t)1; | ||
| 76 | - units = strdup ("B"); | ||
| 77 | + units = "B"; | ||
| 78 | } else if (! strcmp (optarg, "kB")) { | ||
| 79 | mult = (uintmax_t)1024; | ||
| 80 | - units = strdup ("kB"); | ||
| 81 | + units = "kB"; | ||
| 82 | } else if (! strcmp (optarg, "MB")) { | ||
| 83 | mult = (uintmax_t)1024 * 1024; | ||
| 84 | - units = strdup ("MB"); | ||
| 85 | + units = "MB"; | ||
| 86 | } else if (! strcmp (optarg, "GB")) { | ||
| 87 | mult = (uintmax_t)1024 * 1024 * 1024; | ||
| 88 | - units = strdup ("GB"); | ||
| 89 | + units = "GB"; | ||
| 90 | } else if (! strcmp (optarg, "TB")) { | ||
| 91 | mult = (uintmax_t)1024 * 1024 * 1024 * 1024; | ||
| 92 | - units = strdup ("TB"); | ||
| 93 | + units = "TB"; | ||
| 94 | } else { | ||
| 95 | die (STATE_UNKNOWN, _("unit type %s not known\n"), optarg); | ||
| 96 | } | ||
| 97 | @@ -369,13 +369,13 @@ | ||
| 98 | mult = 1024; | ||
| 99 | if (units) | ||
| 100 | free(units); | ||
| 101 | - units = strdup ("kB"); | ||
| 102 | + units = "kB"; | ||
| 103 | break; | ||
| 104 | case 'm': /* display mountpoint */ | ||
| 105 | mult = 1024 * 1024; | ||
| 106 | if (units) | ||
| 107 | free(units); | ||
| 108 | - units = strdup ("MB"); | ||
| 109 | + units = "MB"; | ||
| 110 | break; | ||
| 111 | case 'l': | ||
| 112 | show_local_fs = 1; | ||
| 113 | @@ -518,7 +518,7 @@ | ||
| 114 | } | ||
| 115 | |||
| 116 | if (units == NULL) { | ||
| 117 | - units = strdup ("MB"); | ||
| 118 | + units = "MB"; | ||
| 119 | mult = (uintmax_t)1024 * 1024; | ||
| 120 | } | ||
| 121 | return OK; | ||
| 122 | diff -urN ./plugins/check_game.c ../plugins/plugins/check_game.c | ||
| 123 | --- ./plugins/check_game.c 2005-01-05 21:53:13.000000000 +0100 | ||
| 124 | +++ ../plugins/plugins/check_game.c 2005-02-17 13:12:09.000000000 +0100 | ||
| 125 | @@ -110,7 +110,7 @@ | ||
| 126 | |||
| 127 | /* initialize the returned data buffer */ | ||
| 128 | for (i = 0; i < QSTAT_MAX_RETURN_ARGS; i++) | ||
| 129 | - ret[i] = strdup(""); | ||
| 130 | + ret[i] = ""; | ||
| 131 | |||
| 132 | i = 0; | ||
| 133 | p = (char *) strtok (input_buffer, QSTAT_DATA_DELIMITER); | ||
| 134 | diff -urN ./plugins/check_http.c ../plugins/plugins/check_http.c | ||
| 135 | --- ./plugins/check_http.c 2005-01-24 08:29:53.000000000 +0100 | ||
| 136 | +++ ../plugins/plugins/check_http.c 2005-02-17 15:34:59.000000000 +0100 | ||
| 137 | @@ -60,7 +60,6 @@ | ||
| 138 | #ifdef HAVE_SSL | ||
| 139 | int check_cert = FALSE; | ||
| 140 | int days_till_exp; | ||
| 141 | -char *randbuff; | ||
| 142 | SSL_CTX *ctx; | ||
| 143 | SSL *ssl; | ||
| 144 | X509 *server_cert; | ||
| 145 | @@ -357,7 +356,7 @@ | ||
| 146 | break; | ||
| 147 | case 'P': /* HTTP POST data in URL encoded format */ | ||
| 148 | if (http_method || http_post_data) break; | ||
| 149 | - http_method = strdup("POST"); | ||
| 150 | + http_method = "POST"; | ||
| 151 | http_post_data = strdup (optarg); | ||
| 152 | break; | ||
| 153 | case 's': /* string or substring */ | ||
| 154 | @@ -473,7 +472,7 @@ | ||
| 155 | socket_timeout = (int)critical_time + 1; | ||
| 156 | |||
| 157 | if (http_method == NULL) | ||
| 158 | - http_method = strdup ("GET"); | ||
| 159 | + http_method = "GET"; | ||
| 160 | |||
| 161 | return TRUE; | ||
| 162 | } | ||
| 163 | @@ -869,7 +868,7 @@ | ||
| 164 | #endif | ||
| 165 | |||
| 166 | /* fetch the page */ | ||
| 167 | - full_page = strdup(""); | ||
| 168 | + full_page = ""; | ||
| 169 | while ((i = my_recv ()) > 0) { | ||
| 170 | buffer[i] = '\0'; | ||
| 171 | asprintf (&full_page, "%s%s", full_page, buffer); | ||
| 172 | @@ -1250,8 +1249,9 @@ | ||
| 173 | int connect_SSL (void) | ||
| 174 | { | ||
| 175 | SSL_METHOD *meth; | ||
| 176 | - | ||
| 177 | - asprintf (&randbuff, "%s", "qwertyuiopasdfghjklqwertyuiopasdfghjkl"); | ||
| 178 | + char *randbuff; | ||
| 179 | + | ||
| 180 | + randbuff = "qwertyuiopasdfghjklqwertyuiopasdfghjkl"; | ||
| 181 | RAND_seed (randbuff, (int)strlen(randbuff)); | ||
| 182 | if (verbose) | ||
| 183 | printf(_("SSL seeding: %s\n"), (RAND_status()==1 ? _("OK") : _("Failed")) ); | ||
| 184 | diff -urN ./plugins/check_mrtg.c ../plugins/plugins/check_mrtg.c | ||
| 185 | --- ./plugins/check_mrtg.c 2005-01-05 21:53:15.000000000 +0100 | ||
| 186 | +++ ../plugins/plugins/check_mrtg.c 2005-02-17 15:58:02.000000000 +0100 | ||
| 187 | @@ -113,7 +113,7 @@ | ||
| 188 | /* if we couldn't read enough data, return an unknown error */ | ||
| 189 | if (line <= 2) { | ||
| 190 | result = STATE_UNKNOWN; | ||
| 191 | - asprintf (&message, _("Unable to process MRTG log file\n")); | ||
| 192 | + message = _("Unable to process MRTG log file\n"); | ||
| 193 | } | ||
| 194 | |||
| 195 | /* make sure the MRTG data isn't too old */ | ||
| 196 | @@ -122,8 +122,8 @@ | ||
| 197 | if (expire_minutes > 0 | ||
| 198 | && (current_time - timestamp) > (expire_minutes * 60)) { | ||
| 199 | result = STATE_WARNING; | ||
| 200 | - asprintf (&message, _("MRTG data has expired (%d minutes old)\n"), | ||
| 201 | - (int) ((current_time - timestamp) / 60)); | ||
| 202 | + message = _("MRTG data has expired (%d minutes old)\n"), | ||
| 203 | + (int) ((current_time - timestamp) / 60)); | ||
| 204 | } | ||
| 205 | } | ||
| 206 | |||
| 207 | @@ -294,10 +294,10 @@ | ||
| 208 | usage4 (_("You must supply the variable number")); | ||
| 209 | |||
| 210 | if (label == NULL) | ||
| 211 | - label = strdup ("value"); | ||
| 212 | + label = "value"; | ||
| 213 | |||
| 214 | if (units == NULL) | ||
| 215 | - units = strdup (""); | ||
| 216 | + units = ""; | ||
| 217 | |||
| 218 | return OK; | ||
| 219 | } | ||
| 220 | diff -urN ./plugins/check_nt.c ../plugins/plugins/check_nt.c | ||
| 221 | --- ./plugins/check_nt.c 2005-02-17 13:01:02.000000000 +0100 | ||
| 222 | +++ ../plugins/plugins/check_nt.c 2005-02-17 16:18:53.000000000 +0100 | ||
| 223 | @@ -153,7 +153,7 @@ | ||
| 224 | /* -l parameters is present with only integers */ | ||
| 225 | return_code=STATE_OK; | ||
| 226 | temp_string = strdup (_("CPU Load")); | ||
| 227 | - temp_string_perf = strdup (" "); | ||
| 228 | + temp_string_perf = " "; | ||
| 229 | |||
| 230 | /* loop until one of the parameters is wrong or not present */ | ||
| 231 | while (lvalue_list[0+offset]> (unsigned long)0 && | ||
| 232 | @@ -327,7 +327,7 @@ | ||
| 233 | asprintf (&output_message, "%.f", counter_value); | ||
| 234 | else if (isPercent) | ||
| 235 | { | ||
| 236 | - counter_unit = strdup ("%"); | ||
| 237 | + counter_unit = "%"; | ||
| 238 | allRight = TRUE; | ||
| 239 | } | ||
| 240 | |||
| 241 | diff -urN ./plugins/check_nwstat.c ../plugins/plugins/check_nwstat.c | ||
| 242 | --- ./plugins/check_nwstat.c 2005-01-05 21:53:17.000000000 +0100 | ||
| 243 | +++ ../plugins/plugins/check_nwstat.c 2005-02-17 16:24:36.000000000 +0100 | ||
| 244 | @@ -135,18 +135,18 @@ | ||
| 245 | |||
| 246 | /* get OS version string */ | ||
| 247 | if (check_netware_version==TRUE) { | ||
| 248 | - send_buffer = strdup ("S19\r\n"); | ||
| 249 | + send_buffer = "S19\r\n"; | ||
| 250 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 251 | if (result!=STATE_OK) | ||
| 252 | return result; | ||
| 253 | if (!strcmp(recv_buffer,"-1\n")) | ||
| 254 | - netware_version = strdup(""); | ||
| 255 | + netware_version = ""; | ||
| 256 | else { | ||
| 257 | recv_buffer[strlen(recv_buffer)-1]=0; | ||
| 258 | asprintf (&netware_version,_("NetWare %s: "),recv_buffer); | ||
| 259 | } | ||
| 260 | } else | ||
| 261 | - netware_version = strdup(""); | ||
| 262 | + netware_version = ""; | ||
| 263 | |||
| 264 | |||
| 265 | /* check CPU load */ | ||
| 266 | @@ -154,13 +154,13 @@ | ||
| 267 | |||
| 268 | switch(vars_to_check) { | ||
| 269 | case LOAD1: | ||
| 270 | - temp_buffer = strdup ("1"); | ||
| 271 | + temp_buffer = "1"; | ||
| 272 | break; | ||
| 273 | case LOAD5: | ||
| 274 | - temp_buffer = strdup ("5"); | ||
| 275 | + temp_buffer = "5"; | ||
| 276 | break; | ||
| 277 | default: | ||
| 278 | - temp_buffer = strdup ("15"); | ||
| 279 | + temp_buffer = "15"; | ||
| 280 | break; | ||
| 281 | } | ||
| 282 | |||
| 283 | @@ -169,7 +169,7 @@ | ||
| 284 | if (result!=STATE_OK) | ||
| 285 | return result; | ||
| 286 | utilization=strtoul(recv_buffer,NULL,10); | ||
| 287 | - send_buffer = strdup ("UPTIME\r\n"); | ||
| 288 | + send_buffer = "UPTIME\r\n"; | ||
| 289 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 290 | if (result!=STATE_OK) | ||
| 291 | return result; | ||
| 292 | @@ -191,7 +191,7 @@ | ||
| 293 | /* check number of user connections */ | ||
| 294 | } else if (vars_to_check==CONNS) { | ||
| 295 | |||
| 296 | - send_buffer = strdup ("CONNECT\r\n"); | ||
| 297 | + send_buffer = "CONNECT\r\n"; | ||
| 298 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 299 | if (result!=STATE_OK) | ||
| 300 | return result; | ||
| 301 | @@ -210,7 +210,7 @@ | ||
| 302 | /* check % long term cache hits */ | ||
| 303 | } else if (vars_to_check==LTCH) { | ||
| 304 | |||
| 305 | - send_buffer = strdup ("S1\r\n"); | ||
| 306 | + send_buffer = "S1\r\n"; | ||
| 307 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 308 | if (result!=STATE_OK) | ||
| 309 | return result; | ||
| 310 | @@ -229,7 +229,7 @@ | ||
| 311 | /* check cache buffers */ | ||
| 312 | } else if (vars_to_check==CBUFF) { | ||
| 313 | |||
| 314 | - send_buffer = strdup ("S2\r\n"); | ||
| 315 | + send_buffer = "S2\r\n"; | ||
| 316 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 317 | if (result!=STATE_OK) | ||
| 318 | return result; | ||
| 319 | @@ -248,7 +248,7 @@ | ||
| 320 | /* check dirty cache buffers */ | ||
| 321 | } else if (vars_to_check==CDBUFF) { | ||
| 322 | |||
| 323 | - send_buffer = strdup ("S3\r\n"); | ||
| 324 | + send_buffer = "S3\r\n"; | ||
| 325 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 326 | if (result!=STATE_OK) | ||
| 327 | return result; | ||
| 328 | @@ -267,7 +267,7 @@ | ||
| 329 | /* check LRU sitting time in minutes */ | ||
| 330 | } else if (vars_to_check==LRUM) { | ||
| 331 | |||
| 332 | - send_buffer = strdup ("S5\r\n"); | ||
| 333 | + send_buffer = "S5\r\n"; | ||
| 334 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 335 | if (result!=STATE_OK) | ||
| 336 | return result; | ||
| 337 | @@ -344,7 +344,7 @@ | ||
| 338 | /* check to see if DS Database is open or closed */ | ||
| 339 | } else if (vars_to_check==DSDB) { | ||
| 340 | |||
| 341 | - send_buffer = strdup ("S11\r\n"); | ||
| 342 | + send_buffer = "S11\r\n"; | ||
| 343 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 344 | if (result!=STATE_OK) | ||
| 345 | return result; | ||
| 346 | @@ -353,7 +353,7 @@ | ||
| 347 | else | ||
| 348 | result=STATE_WARNING; | ||
| 349 | |||
| 350 | - send_buffer = strdup ("S13\r\n"); | ||
| 351 | + send_buffer = "S13\r\n"; | ||
| 352 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 353 | temp_buffer=strtok(recv_buffer,"\r\n"); | ||
| 354 | |||
| 355 | @@ -362,7 +362,7 @@ | ||
| 356 | /* check to see if logins are enabled */ | ||
| 357 | } else if (vars_to_check==LOGINS) { | ||
| 358 | |||
| 359 | - send_buffer = strdup ("S12\r\n"); | ||
| 360 | + send_buffer = "S12\r\n"; | ||
| 361 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 362 | if (result!=STATE_OK) | ||
| 363 | return result; | ||
| 364 | @@ -617,7 +617,7 @@ | ||
| 365 | /* check LRU sitting time in secondss */ | ||
| 366 | } else if (vars_to_check==LRUS) { | ||
| 367 | |||
| 368 | - send_buffer = strdup ("S4\r\n"); | ||
| 369 | + send_buffer = "S4\r\n"; | ||
| 370 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 371 | if (result!=STATE_OK) | ||
| 372 | return result; | ||
| 373 | @@ -633,7 +633,7 @@ | ||
| 374 | /* check % dirty cacheobuffers as a percentage of the total*/ | ||
| 375 | } else if (vars_to_check==DCB) { | ||
| 376 | |||
| 377 | - send_buffer = strdup ("S6\r\n"); | ||
| 378 | + send_buffer = "S6\r\n"; | ||
| 379 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 380 | if (result!=STATE_OK) | ||
| 381 | return result; | ||
| 382 | @@ -648,7 +648,7 @@ | ||
| 383 | /* check % total cache buffers as a percentage of the original*/ | ||
| 384 | } else if (vars_to_check==TCB) { | ||
| 385 | |||
| 386 | - send_buffer = strdup ("S7\r\n"); | ||
| 387 | + send_buffer = "S7\r\n"; | ||
| 388 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 389 | if (result!=STATE_OK) | ||
| 390 | return result; | ||
| 391 | @@ -695,7 +695,7 @@ | ||
| 392 | |||
| 393 | } else { | ||
| 394 | |||
| 395 | - output_message = strdup (_("Nothing to check!\n")); | ||
| 396 | + output_message = _("Nothing to check!\n"); | ||
| 397 | result=STATE_UNKNOWN; | ||
| 398 | |||
| 399 | } | ||
| 400 | @@ -806,15 +806,15 @@ | ||
| 401 | vars_to_check=LRUS; | ||
| 402 | else if (strncmp(optarg,"VPF",3)==0) { | ||
| 403 | vars_to_check=VPF; | ||
| 404 | - volume_name = strdup (optarg+3); | ||
| 405 | + volume_name = optarg+3; | ||
| 406 | if (!strcmp(volume_name,"")) | ||
| 407 | - volume_name = strdup ("SYS"); | ||
| 408 | + volume_name = "SYS"; | ||
| 409 | } | ||
| 410 | else if (strncmp(optarg,"VKF",3)==0) { | ||
| 411 | vars_to_check=VKF; | ||
| 412 | - volume_name = strdup (optarg+3); | ||
| 413 | + volume_name = optarg+3; | ||
| 414 | if (!strcmp(volume_name,"")) | ||
| 415 | - volume_name = strdup ("SYS"); | ||
| 416 | + volume_name = "SYS"; | ||
| 417 | } | ||
| 418 | else if (!strcmp(optarg,"DSDB")) | ||
| 419 | vars_to_check=DSDB; | ||
| 420 | @@ -835,27 +835,27 @@ | ||
| 421 | vars_to_check=OFILES; | ||
| 422 | else if (strncmp(optarg,"VKP",3)==0) { | ||
| 423 | vars_to_check=VKP; | ||
| 424 | - volume_name = strdup (optarg+3); | ||
| 425 | + volume_name = optarg+3; | ||
| 426 | if (!strcmp(volume_name,"")) | ||
| 427 | - volume_name = strdup ("SYS"); | ||
| 428 | + volume_name = "SYS"; | ||
| 429 | } | ||
| 430 | else if (strncmp(optarg,"VPP",3)==0) { | ||
| 431 | vars_to_check=VPP; | ||
| 432 | - volume_name = strdup (optarg+3); | ||
| 433 | + volume_name = optarg+3; | ||
| 434 | if (!strcmp(volume_name,"")) | ||
| 435 | - volume_name = strdup ("SYS"); | ||
| 436 | + volume_name = "SYS"; | ||
| 437 | } | ||
| 438 | else if (strncmp(optarg,"VKNP",4)==0) { | ||
| 439 | vars_to_check=VKNP; | ||
| 440 | - volume_name = strdup (optarg+4); | ||
| 441 | + volume_name = optarg+4; | ||
| 442 | if (!strcmp(volume_name,"")) | ||
| 443 | - volume_name = strdup ("SYS"); | ||
| 444 | + volume_name = "SYS"; | ||
| 445 | } | ||
| 446 | else if (strncmp(optarg,"VPNP",4)==0) { | ||
| 447 | vars_to_check=VPNP; | ||
| 448 | - volume_name = strdup (optarg+4); | ||
| 449 | + volume_name = optarg+4; | ||
| 450 | if (!strcmp(volume_name,"")) | ||
| 451 | - volume_name = strdup("SYS"); | ||
| 452 | + volume_name = "SYS"; | ||
| 453 | } | ||
| 454 | else if (!strcmp(optarg,"ABENDS")) | ||
| 455 | vars_to_check=ABENDS; | ||
| 456 | @@ -869,7 +869,7 @@ | ||
| 457 | vars_to_check=UPTIME; | ||
| 458 | else if (strncmp(optarg,"NLM:",4)==0) { | ||
| 459 | vars_to_check=NLM; | ||
| 460 | - nlm_name=strdup (optarg+4); | ||
| 461 | + nlm_name = optarg+4; | ||
| 462 | } | ||
| 463 | else | ||
| 464 | return ERROR; | ||
| 465 | diff -urN ./plugins/check_ping.c ../plugins/plugins/check_ping.c | ||
| 466 | --- ./plugins/check_ping.c 2005-01-05 21:53:17.000000000 +0100 | ||
| 467 | +++ ../plugins/plugins/check_ping.c 2005-02-17 16:29:41.000000000 +0100 | ||
| 468 | @@ -93,11 +93,11 @@ | ||
| 469 | |||
| 470 | #ifdef PING6_COMMAND | ||
| 471 | if (is_inet6_addr(addresses[i]) && address_family != AF_INET) | ||
| 472 | - rawcmd = strdup(PING6_COMMAND); | ||
| 473 | + rawcmd = PING6_COMMAND; | ||
| 474 | else | ||
| 475 | - rawcmd = strdup(PING_COMMAND); | ||
| 476 | + rawcmd = PING_COMMAND; | ||
| 477 | #else | ||
| 478 | - rawcmd = strdup(PING_COMMAND); | ||
| 479 | + rawcmd = PING_COMMAND; | ||
| 480 | #endif | ||
| 481 | |||
| 482 | /* does the host address of number of packets argument come first? */ | ||
| 483 | @@ -452,7 +452,7 @@ | ||
| 484 | result = max_state (result, STATE_WARNING); | ||
| 485 | |||
| 486 | if (warn_text == NULL) | ||
| 487 | - warn_text = strdup(""); | ||
| 488 | + warn_text = ""; | ||
| 489 | |||
| 490 | return result; | ||
| 491 | } | ||
| 492 | @@ -473,7 +473,7 @@ | ||
| 493 | |||
| 494 | if (strstr (buf, "(DUP!)") || strstr (buf, "DUPLICATES FOUND")) { | ||
| 495 | if (warn_text == NULL) | ||
| 496 | - warn_text = strdup (_(WARN_DUPLICATES)); | ||
| 497 | + warn_text = _(WARN_DUPLICATES); | ||
| 498 | else if (! strstr (warn_text, _(WARN_DUPLICATES)) && | ||
| 499 | asprintf (&warn_text, "%s %s", warn_text, _(WARN_DUPLICATES)) == -1) | ||
| 500 | die (STATE_UNKNOWN, _("Unable to realloc warn_text")); | ||
| 501 | diff -urN ./plugins/check_procs.c ../plugins/plugins/check_procs.c | ||
| 502 | --- ./plugins/check_procs.c 2005-01-05 21:53:18.000000000 +0100 | ||
| 503 | +++ ../plugins/plugins/check_procs.c 2005-02-17 16:35:49.000000000 +0100 | ||
| 504 | @@ -117,7 +117,7 @@ | ||
| 505 | input_buffer = malloc (MAX_INPUT_BUFFER); | ||
| 506 | procprog = malloc (MAX_INPUT_BUFFER); | ||
| 507 | |||
| 508 | - asprintf (&metric_name, "PROCS"); | ||
| 509 | + metric_name = "PROCS"; | ||
| 510 | metric = METRIC_PROCS; | ||
| 511 | |||
| 512 | if (process_arguments (argc, argv) == ERROR) | ||
| 513 | @@ -147,8 +147,8 @@ | ||
| 514 | while ( input_buffer[strlen(input_buffer)-1] != '\n' ) | ||
| 515 | fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process); | ||
| 516 | |||
| 517 | + input_line = ""; | ||
| 518 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 519 | - asprintf (&input_line, "%s", input_buffer); | ||
| 520 | while ( input_buffer[strlen(input_buffer)-1] != '\n' ) { | ||
| 521 | fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process); | ||
| 522 | asprintf (&input_line, "%s%s", input_line, input_buffer); | ||
| 523 | @@ -157,8 +157,8 @@ | ||
| 524 | if (verbose >= 3) | ||
| 525 | printf ("%s", input_line); | ||
| 526 | |||
| 527 | - strcpy (procprog, ""); | ||
| 528 | - asprintf (&procargs, "%s", ""); | ||
| 529 | + *procprog = '\x0'; | ||
| 530 | + procargs = ""; | ||
| 531 | |||
| 532 | cols = sscanf (input_line, PS_FORMAT, PS_VARLIST); | ||
| 533 | |||
| 534 | @@ -493,7 +493,7 @@ | ||
| 535 | if (cmax == -1 && argv[c]) | ||
| 536 | cmax = atoi (argv[c++]); | ||
| 537 | if (statopts == NULL && argv[c]) { | ||
| 538 | - asprintf (&statopts, "%s", argv[c++]); | ||
| 539 | + statopts = argv[c++]; | ||
| 540 | asprintf (&fmt, _("%s%sSTATE = %s"), (fmt ? fmt : ""), (options ? ", " : ""), statopts); | ||
| 541 | options |= STAT; | ||
| 542 | } | ||
| 543 | @@ -531,19 +531,19 @@ | ||
| 544 | options = ALL; | ||
| 545 | |||
| 546 | if (statopts==NULL) | ||
| 547 | - statopts = strdup(""); | ||
| 548 | + statopts = ""; | ||
| 549 | |||
| 550 | if (prog==NULL) | ||
| 551 | - prog = strdup(""); | ||
| 552 | + prog = ""; | ||
| 553 | |||
| 554 | if (args==NULL) | ||
| 555 | - args = strdup(""); | ||
| 556 | + args = ""; | ||
| 557 | |||
| 558 | if (fmt==NULL) | ||
| 559 | - fmt = strdup(""); | ||
| 560 | + fmt = ""; | ||
| 561 | |||
| 562 | if (fails==NULL) | ||
| 563 | - fails = strdup(""); | ||
| 564 | + fails = ""; | ||
| 565 | |||
| 566 | return options; | ||
| 567 | } | ||
| 568 | diff -urN ./plugins/check_radius.c ../plugins/plugins/check_radius.c | ||
| 569 | --- ./plugins/check_radius.c 2005-01-05 21:53:18.000000000 +0100 | ||
| 570 | +++ ../plugins/plugins/check_radius.c 2005-02-17 13:12:10.000000000 +0100 | ||
| 571 | @@ -116,7 +116,7 @@ | ||
| 572 | if (process_arguments (argc, argv) == ERROR) | ||
| 573 | usage4 (_("Could not parse arguments")); | ||
| 574 | |||
| 575 | - str = strdup ("dictionary"); | ||
| 576 | + str = "dictionary"; | ||
| 577 | if ((config_file && rc_read_config (config_file)) || | ||
| 578 | rc_read_dictionary (rc_conf_str (str))) | ||
| 579 | die (STATE_UNKNOWN, _("Config file error")); | ||
| 580 | diff -urN ./plugins/check_real.c ../plugins/plugins/check_real.c | ||
| 581 | --- ./plugins/check_real.c 2005-01-05 21:53:18.000000000 +0100 | ||
| 582 | +++ ../plugins/plugins/check_real.c 2005-02-17 16:36:39.000000000 +0100 | ||
| 583 | @@ -369,7 +369,7 @@ | ||
| 584 | usage4 (_("You must provide a server to check")); | ||
| 585 | |||
| 586 | if (host_name==NULL) | ||
| 587 | - host_name = strdup (server_address); | ||
| 588 | + host_name = server_address; | ||
| 589 | |||
| 590 | if (server_expect == NULL) | ||
| 591 | server_expect = strdup(EXPECT); | ||
| 592 | diff -urN ./plugins/check_smtp.c ../plugins/plugins/check_smtp.c | ||
| 593 | --- ./plugins/check_smtp.c 2005-01-05 21:53:18.000000000 +0100 | ||
| 594 | +++ ../plugins/plugins/check_smtp.c 2005-02-17 16:38:24.000000000 +0100 | ||
| 595 | @@ -486,18 +486,18 @@ | ||
| 596 | usage2 (_("Invalid hostname/address"), argv[c]); | ||
| 597 | } | ||
| 598 | else { | ||
| 599 | - asprintf (&server_address, "127.0.0.1"); | ||
| 600 | + server_address = "127.0.0.1"; | ||
| 601 | } | ||
| 602 | } | ||
| 603 | |||
| 604 | if (server_expect == NULL) | ||
| 605 | - server_expect = strdup (SMTP_EXPECT); | ||
| 606 | + server_expect = SMTP_EXPECT; | ||
| 607 | |||
| 608 | if (mail_command == NULL) | ||
| 609 | - mail_command = strdup("MAIL "); | ||
| 610 | + mail_command = "MAIL "; | ||
| 611 | |||
| 612 | if (from_arg==NULL) | ||
| 613 | - from_arg = strdup(" "); | ||
| 614 | + from_arg = " "; | ||
| 615 | |||
| 616 | return validate_arguments (); | ||
| 617 | } | ||
| 618 | diff -urN ./plugins/check_swap.c ../plugins/plugins/check_swap.c | ||
| 619 | --- ./plugins/check_swap.c 2005-01-24 08:29:54.000000000 +0100 | ||
| 620 | +++ ../plugins/plugins/check_swap.c 2005-02-17 16:56:09.000000000 +0100 | ||
| 621 | @@ -85,9 +85,9 @@ | ||
| 622 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 623 | textdomain (PACKAGE); | ||
| 624 | |||
| 625 | - status = strdup (""); | ||
| 626 | - tmp_status = strdup (""); | ||
| 627 | - perf = strdup (""); | ||
| 628 | + status = ""; | ||
| 629 | + tmp_status = ""; | ||
| 630 | + perf = ""; | ||
| 631 | |||
| 632 | if (process_arguments (argc, argv) == ERROR) | ||
| 633 | usage4 (_("Could not parse arguments")); | ||
| 634 | @@ -128,15 +128,15 @@ | ||
| 635 | free_swap = dskfree; | ||
| 636 | #else | ||
| 637 | # ifdef HAVE_SWAP | ||
| 638 | - asprintf(&swap_command, "%s", SWAP_COMMAND); | ||
| 639 | - asprintf(&swap_format, "%s", SWAP_FORMAT); | ||
| 640 | + swap_command = SWAP_COMMAND; | ||
| 641 | + swap_format = SWAP_FORMAT; | ||
| 642 | |||
| 643 | /* These override the command used if a summary (and thus ! allswaps) is required */ | ||
| 644 | /* The summary flag returns more accurate information about swap usage on these OSes */ | ||
| 645 | # ifdef _AIX | ||
| 646 | if (!allswaps) { | ||
| 647 | - asprintf(&swap_command, "%s", "/usr/sbin/lsps -s"); | ||
| 648 | - asprintf(&swap_format, "%s", "%f%*s %f"); | ||
| 649 | + swap_command = "/usr/sbin/lsps -s"; | ||
| 650 | + swap_format = "%f%*s %f"; | ||
| 651 | conv_factor = 1; | ||
| 652 | } | ||
| 653 | # endif | ||
| 654 | diff -urN ./plugins/check_udp.c ../plugins/plugins/check_udp.c | ||
| 655 | --- ./plugins/check_udp.c 2005-01-05 21:53:21.000000000 +0100 | ||
| 656 | +++ ../plugins/plugins/check_udp.c 2005-02-17 13:12:10.000000000 +0100 | ||
| 657 | @@ -207,7 +207,7 @@ | ||
| 658 | usage4 (_("Hostname was not supplied")); | ||
| 659 | |||
| 660 | if (server_send == NULL) | ||
| 661 | - server_send = strdup(""); | ||
| 662 | + server_send = ""; | ||
| 663 | |||
| 664 | return c; | ||
| 665 | } | ||
| 666 | diff -urN ./plugins/check_ups.c ../plugins/plugins/check_ups.c | ||
| 667 | --- ./plugins/check_ups.c 2005-01-05 21:53:22.000000000 +0100 | ||
| 668 | +++ ../plugins/plugins/check_ups.c 2005-02-17 18:21:59.000000000 +0100 | ||
| 669 | @@ -106,9 +106,9 @@ | ||
| 670 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 671 | textdomain (PACKAGE); | ||
| 672 | |||
| 673 | - ups_status = strdup ("N/A"); | ||
| 674 | - data = strdup (""); | ||
| 675 | - message = strdup (""); | ||
| 676 | + ups_status = "N/A"; | ||
| 677 | + data = ""; | ||
| 678 | + message = ""; | ||
| 679 | |||
| 680 | if (process_arguments (argc, argv) == ERROR) | ||
| 681 | usage4 (_("Could not parse arguments")); | ||
| 682 | @@ -124,16 +124,16 @@ | ||
| 683 | return STATE_CRITICAL; | ||
| 684 | if (supported_options & UPS_STATUS) { | ||
| 685 | |||
| 686 | - ups_status = strdup (""); | ||
| 687 | + ups_status = ""; | ||
| 688 | result = STATE_OK; | ||
| 689 | |||
| 690 | if (status & UPSSTATUS_OFF) { | ||
| 691 | - asprintf (&ups_status, "Off"); | ||
| 692 | + ups_status = "Off"; | ||
| 693 | result = STATE_CRITICAL; | ||
| 694 | } | ||
| 695 | else if ((status & (UPSSTATUS_OB | UPSSTATUS_LB)) == | ||
| 696 | (UPSSTATUS_OB | UPSSTATUS_LB)) { | ||
| 697 | - asprintf (&ups_status, _("On Battery, Low Battery")); | ||
| 698 | + ups_status = _("On Battery, Low Battery"); | ||
| 699 | result = STATE_CRITICAL; | ||
| 700 | } | ||
| 701 | else { | ||
| 702 | @@ -203,15 +203,13 @@ | ||
| 703 | else if (check_warn==TRUE && ups_utility_deviation>=warning_value) { | ||
| 704 | result = max_state (result, STATE_WARNING); | ||
| 705 | } | ||
| 706 | - asprintf (&data, "%s", | ||
| 707 | - perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", | ||
| 708 | - check_warn, (long)(1000*warning_value), | ||
| 709 | - check_crit, (long)(1000*critical_value), | ||
| 710 | - TRUE, 0, FALSE, 0)); | ||
| 711 | + data = perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", | ||
| 712 | + check_warn, (long)(1000*warning_value), | ||
| 713 | + check_crit, (long)(1000*critical_value), | ||
| 714 | + TRUE, 0, FALSE, 0)); | ||
| 715 | } else { | ||
| 716 | - asprintf (&data, "%s", | ||
| 717 | - perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", | ||
| 718 | - FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); | ||
| 719 | + data = perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", | ||
| 720 | + FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); | ||
| 721 | } | ||
| 722 | } | ||
| 723 | |||
| 724 | @@ -560,7 +558,7 @@ | ||
| 725 | } | ||
| 726 | |||
| 727 | if (server_address == NULL) | ||
| 728 | - server_address = strdup("127.0.0.1"); | ||
| 729 | + server_address = "127.0.0.1"; | ||
| 730 | |||
| 731 | return validate_arguments(); | ||
| 732 | } | ||
| 733 | diff -urN ./plugins/check_users.c ../plugins/plugins/check_users.c | ||
| 734 | --- ./plugins/check_users.c 2005-01-05 21:53:22.000000000 +0100 | ||
| 735 | +++ ../plugins/plugins/check_users.c 2005-02-17 18:22:57.000000000 +0100 | ||
| 736 | @@ -48,7 +48,7 @@ | ||
| 737 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 738 | textdomain (PACKAGE); | ||
| 739 | |||
| 740 | - perf = strdup(""); | ||
| 741 | + perf = ""; | ||
| 742 | |||
| 743 | if (process_arguments (argc, argv) == ERROR) | ||
| 744 | usage4 (_("Could not parse arguments")); | ||
| 745 | @@ -100,11 +100,8 @@ | ||
| 746 | if (result == STATE_UNKNOWN) | ||
| 747 | printf (_("Unable to read output\n")); | ||
| 748 | else { | ||
| 749 | - asprintf(&perf, "%s", perfdata ("users", users, "", | ||
| 750 | - TRUE, wusers, | ||
| 751 | - TRUE, cusers, | ||
| 752 | - TRUE, 0, | ||
| 753 | - FALSE, 0)); | ||
| 754 | + perf = perfdata ("users", users, "", TRUE, wusers, TRUE, cusers, | ||
| 755 | + TRUE, 0, FALSE, 0)); | ||
| 756 | printf (_("USERS %s - %d users currently logged in |%s\n"), state_text (result), | ||
| 757 | users, perf); | ||
| 758 | } | ||
| 759 | diff -urN ./plugins/negate.c ../plugins/plugins/negate.c | ||
| 760 | --- ./plugins/negate.c 2005-01-05 21:53:22.000000000 +0100 | ||
| 761 | +++ ../plugins/plugins/negate.c 2005-02-17 18:24:35.000000000 +0100 | ||
| 762 | @@ -192,7 +192,7 @@ | ||
| 763 | } | ||
| 764 | } | ||
| 765 | |||
| 766 | - asprintf (&command_line, "%s", argv[optind]); | ||
| 767 | + command_line = argv[optind]; | ||
| 768 | for (c = optind+1; c < argc; c++) { | ||
| 769 | asprintf (&command_line, "%s %s", command_line, argv[c]); | ||
| 770 | } | ||
| 771 | diff -urN ./plugins/popen.c ../plugins/plugins/popen.c | ||
| 772 | --- ./plugins/popen.c 2005-01-05 21:53:22.000000000 +0100 | ||
| 773 | +++ ../plugins/plugins/popen.c 2005-02-17 13:12:11.000000000 +0100 | ||
| 774 | @@ -87,7 +87,7 @@ | ||
| 775 | setrlimit (RLIMIT_CORE, &limit); | ||
| 776 | #endif | ||
| 777 | |||
| 778 | - env[0] = strdup("LC_ALL=C"); | ||
| 779 | + env[0] = "LC_ALL=C"; | ||
| 780 | env[1] = '\0'; | ||
| 781 | |||
| 782 | /* if no command was passed, return with no error */ | ||
| 783 | diff -urN ./plugins/urlize.c ../plugins/plugins/urlize.c | ||
| 784 | --- ./plugins/urlize.c 2005-01-05 21:53:23.000000000 +0100 | ||
| 785 | +++ ../plugins/plugins/urlize.c 2005-02-17 18:28:19.000000000 +0100 | ||
| 786 | @@ -67,7 +67,7 @@ | ||
| 787 | exit (EXIT_SUCCESS); | ||
| 788 | break; | ||
| 789 | case 'u': | ||
| 790 | - url = strdup (argv[optind]); | ||
| 791 | + url = argv[optind]; | ||
| 792 | break; | ||
| 793 | case '?': | ||
| 794 | default: | ||
| 795 | @@ -76,9 +76,9 @@ | ||
| 796 | } | ||
| 797 | |||
| 798 | if (url == NULL) | ||
| 799 | - url = strdup (argv[optind++]); | ||
| 800 | + url = argv[optind++]; | ||
| 801 | |||
| 802 | - cmd = strdup (argv[optind++]); | ||
| 803 | + cmd = argv[optind++]; | ||
| 804 | for (c = optind; c < argc; c++) { | ||
| 805 | asprintf (&cmd, "%s %s", cmd, argv[c]); | ||
| 806 | } | ||
diff --git a/web/attachments/122140-diff b/web/attachments/122140-diff new file mode 100644 index 0000000..736b1c1 --- /dev/null +++ b/web/attachments/122140-diff | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | Index: check_tcp.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_tcp.c,v | ||
| 4 | retrieving revision 1.61 | ||
| 5 | diff -r1.61 check_tcp.c | ||
| 6 | 99c99 | ||
| 7 | < int use_ssl = FALSE; | ||
| 8 | --- | ||
| 9 | > int use_ssl = FALSE; | ||
| 10 | 170a171,180 | ||
| 11 | > else if (strstr (argv[0], "check_clamd")) { | ||
| 12 | > progname = strdup ("check_clamd"); | ||
| 13 | > SERVICE = strdup ("CLAMD"); | ||
| 14 | > SEND = strdup ("PING"); | ||
| 15 | > EXPECT = strdup ("PONG"); | ||
| 16 | > QUIT = NULL; | ||
| 17 | > PROTOCOL = TCP_PROTOCOL; | ||
| 18 | > PORT = 3310; | ||
| 19 | > } | ||
| 20 | > | ||
| 21 | 378,379c388,395 | ||
| 22 | < | ||
| 23 | < printf | ||
| 24 | --- | ||
| 25 | > if(server_address[0]=='/') | ||
| 26 | > printf | ||
| 27 | > (_("%s %s%s - %.3f second response on socket %s"), | ||
| 28 | > SERVICE, | ||
| 29 | > state_text (result), | ||
| 30 | > (was_refused) ? " (refused)" : "", | ||
| 31 | > elapsed_time, server_address); | ||
| 32 | > else printf | ||
| 33 | 486c502 | ||
| 34 | < if (is_host (optarg) == FALSE) | ||
| 35 | --- | ||
| 36 | > if (optarg[0]!= '/' && is_host (optarg) == FALSE) | ||
| 37 | 761c777 | ||
| 38 | < printf (_("This plugin tests %s connections with the specified host.\n\n"), | ||
| 39 | --- | ||
| 40 | > printf (_("This plugin tests %s connections with the specified host or unix socket.\n\n"), | ||
| 41 | Index: netutils.c | ||
| 42 | =================================================================== | ||
| 43 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.c,v | ||
| 44 | retrieving revision 1.22 | ||
| 45 | diff -r1.22 netutils.c | ||
| 46 | 221a222 | ||
| 47 | > | ||
| 48 | 227a229 | ||
| 49 | > if (host_name[0] != '/') { | ||
| 50 | 267a270,294 | ||
| 51 | > } | ||
| 52 | > else{ // unix socket | ||
| 53 | > struct sockaddr_un su; | ||
| 54 | > if (strlen(host_name) >= sizeof(su.sun_path)) { | ||
| 55 | > printf("Hostname too long for unix domain socket: %s\n", | ||
| 56 | > host_name); | ||
| 57 | > return STATE_UNKNOWN; | ||
| 58 | > } | ||
| 59 | > memset(&su, 0, sizeof su); | ||
| 60 | > su.sun_family = AF_UNIX; | ||
| 61 | > strncpy(su.sun_path, host_name, sizeof su.sun_path); | ||
| 62 | > *sd = socket(PF_UNIX, SOCK_STREAM, 0); | ||
| 63 | > if ( sd < 0) { | ||
| 64 | > printf ("Socket creation failed\n"); | ||
| 65 | > return STATE_UNKNOWN; | ||
| 66 | > } | ||
| 67 | > result=connect(*sd, (struct sockaddr *)&su, sizeof su); | ||
| 68 | > if (result == -1) { | ||
| 69 | > printf ("Connect to socket failed\n"); | ||
| 70 | > close(*sd); | ||
| 71 | > return STATE_UNKNOWN; | ||
| 72 | > } | ||
| 73 | > | ||
| 74 | > } | ||
| 75 | > | ||
| 76 | Index: netutils.h | ||
| 77 | =================================================================== | ||
| 78 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.h,v | ||
| 79 | retrieving revision 1.10 | ||
| 80 | diff -r1.10 netutils.h | ||
| 81 | 37a38 | ||
| 82 | > #include <sys/un.h> | ||
| 83 | Index: utils.h | ||
| 84 | =================================================================== | ||
| 85 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.h,v | ||
| 86 | retrieving revision 1.22 | ||
| 87 | diff -r1.22 utils.h | ||
| 88 | 139c139 | ||
| 89 | < Host name or IP Address\n\ | ||
| 90 | --- | ||
| 91 | > Host name or IP Address or unix socket (starting with \"/\")\n\ | ||
diff --git a/web/attachments/122868-check_ntp.patch b/web/attachments/122868-check_ntp.patch new file mode 100644 index 0000000..b463ed6 --- /dev/null +++ b/web/attachments/122868-check_ntp.patch | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | *** nagios-plugins-HEAD-200502231747/plugins-scripts/check_ntp.pl Fri Nov 19 14:59:43 2004 | ||
| 2 | --- nagios-plugins-NEW/plugins-scripts/check_ntp.pl Thu Feb 24 16:13:59 2005 | ||
| 3 | *************** | ||
| 4 | *** 200,209 **** | ||
| 5 | if (/(offset|adjust)\s+([-.\d]+)/i) { | ||
| 6 | $offset = $2; | ||
| 7 | |||
| 8 | - # An offset of 0.000000 with an error is probably bogus. Actually, | ||
| 9 | - # it's probably always bogus, but let's be paranoid here. | ||
| 10 | - if ($offset == 0) { undef $offset;} | ||
| 11 | - | ||
| 12 | $ntpdate_error = defined ($offset) ? $ERRORS{"OK"} : $ERRORS{"CRITICAL"}; | ||
| 13 | print "ntperr = $ntpdate_error \n" if $verbose; | ||
| 14 | |||
| 15 | --- 200,205 ---- | ||
diff --git a/web/attachments/123083-check_mysql.diff.gz b/web/attachments/123083-check_mysql.diff.gz new file mode 100644 index 0000000..95f9d1c --- /dev/null +++ b/web/attachments/123083-check_mysql.diff.gz | |||
| Binary files differ | |||
diff --git a/web/attachments/123084-patch-check_mysql.c b/web/attachments/123084-patch-check_mysql.c new file mode 100644 index 0000000..998ad47 --- /dev/null +++ b/web/attachments/123084-patch-check_mysql.c | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | --- plugins/check_mysql.c.orig Sun Dec 26 00:17:44 2004 | ||
| 2 | +++ plugins/check_mysql.c Sun Feb 20 14:12:10 2005 | ||
| 3 | @@ -123,8 +123,16 @@ | ||
| 4 | die (STATE_CRITICAL, "%s\n", slaveresult); | ||
| 5 | } | ||
| 6 | |||
| 7 | + } else if (mysql_field_count (&mysql) == 33) { | ||
| 8 | + /* mysql >= 4.1.1 */ | ||
| 9 | + snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s", row[10], row[11]); | ||
| 10 | + if (strcmp (row[10], "Yes") != 0 || strcmp (row[11], "Yes") != 0) { | ||
| 11 | + mysql_free_result (res); | ||
| 12 | + mysql_close (&mysql); | ||
| 13 | + die (STATE_CRITICAL, "%s\n", slaveresult); | ||
| 14 | + } | ||
| 15 | } else { | ||
| 16 | - /* mysql 4.x.x */ | ||
| 17 | + /* mysql 4.0.x or 4.1.0 */ | ||
| 18 | snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s", row[9], row[10]); | ||
| 19 | if (strcmp (row[9], "Yes") != 0 || strcmp (row[10], "Yes") != 0) { | ||
| 20 | mysql_free_result (res); | ||
diff --git a/web/attachments/123407-long_long_swap.patch b/web/attachments/123407-long_long_swap.patch new file mode 100644 index 0000000..fcd5802 --- /dev/null +++ b/web/attachments/123407-long_long_swap.patch | |||
| @@ -0,0 +1,173 @@ | |||
| 1 | Index: check_swap.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_swap.c,v | ||
| 4 | retrieving revision 1.9 | ||
| 5 | diff -u -r1.9 check_swap.c | ||
| 6 | --- check_swap.c 18 Feb 2003 03:46:15 -0000 1.9 | ||
| 7 | +++ check_swap.c 27 Feb 2005 23:58:43 -0000 | ||
| 8 | @@ -36,6 +36,18 @@ | ||
| 9 | #define EMAIL "kdebisschop@users.sourceforge.net" | ||
| 10 | #define SUMMARY "Check swap space on local server.\n" | ||
| 11 | |||
| 12 | +#ifdef HAVE_LONGLONG | ||
| 13 | +typedef long long unsigned int swapsize_t; | ||
| 14 | +#define SWAPSIZEFORMAT "%llu" | ||
| 15 | +#define SWAPSIZEFORMAT_OUT SWAPSIZEFORMAT | ||
| 16 | +#define atos atoll | ||
| 17 | +#else | ||
| 18 | +typedef float swapsize_t; | ||
| 19 | +#define SWAPSIZEFORMAT "%f" | ||
| 20 | +#define SWAPSIZEFORMAT_OUT "%.0f" | ||
| 21 | +#define atos (float)atof | ||
| 22 | +#endif | ||
| 23 | + | ||
| 24 | int process_arguments (int argc, char **argv); | ||
| 25 | int validate_arguments (void); | ||
| 26 | void print_usage (void); | ||
| 27 | @@ -43,8 +55,8 @@ | ||
| 28 | |||
| 29 | int warn_percent = 200; | ||
| 30 | int crit_percent = 200; | ||
| 31 | -long unsigned int warn_size = 0; | ||
| 32 | -long unsigned int crit_size = 0; | ||
| 33 | +swapsize_t warn_size = 0; | ||
| 34 | +swapsize_t crit_size = 0; | ||
| 35 | int verbose; | ||
| 36 | int allswaps; | ||
| 37 | |||
| 38 | @@ -52,8 +64,8 @@ | ||
| 39 | main (int argc, char **argv) | ||
| 40 | { | ||
| 41 | int percent_used, percent; | ||
| 42 | - long unsigned int total_swap = 0, used_swap = 0, free_swap = 0; | ||
| 43 | - long unsigned int total, used, free; | ||
| 44 | + swapsize_t total_swap = 0, used_swap = 0, free_swap = 0; | ||
| 45 | + swapsize_t total, used, free; | ||
| 46 | int result = STATE_OK; | ||
| 47 | char input_buffer[MAX_INPUT_BUFFER]; | ||
| 48 | #ifdef HAVE_SWAP | ||
| 49 | @@ -61,6 +73,7 @@ | ||
| 50 | #endif | ||
| 51 | #ifdef HAVE_PROC_MEMINFO | ||
| 52 | FILE *fp; | ||
| 53 | + char str_format[32]; | ||
| 54 | #endif | ||
| 55 | char str[32]; | ||
| 56 | char *status = ""; | ||
| 57 | @@ -70,9 +83,10 @@ | ||
| 58 | |||
| 59 | #ifdef HAVE_PROC_MEMINFO | ||
| 60 | fp = fopen (PROC_MEMINFO, "r"); | ||
| 61 | + sprintf (str_format, " %%s %s %s %s", SWAPSIZEFORMAT, SWAPSIZEFORMAT, SWAPSIZEFORMAT); | ||
| 62 | asprintf (&status, "%s", "Swap used:"); | ||
| 63 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, fp)) { | ||
| 64 | - if (sscanf (input_buffer, " %s %lu %lu %lu", str, &total, &used, &free) == 4 && | ||
| 65 | + if (sscanf (input_buffer, str_format, str, &total, &used, &free) == 4 && | ||
| 66 | strstr (str, "Swap")) { | ||
| 67 | total_swap += total; | ||
| 68 | used_swap += used; | ||
| 69 | @@ -83,8 +97,10 @@ | ||
| 70 | result = max_state (STATE_CRITICAL, result); | ||
| 71 | else if (percent >= warn_percent || free <= warn_size) | ||
| 72 | result = max_state (STATE_WARNING, result); | ||
| 73 | - if (verbose) | ||
| 74 | - asprintf (&status, "%s [%lu/%lu]", status, used, total); | ||
| 75 | + if (verbose) { | ||
| 76 | + sprintf (str_format, "%%s [%s/%s]", SWAPSIZEFORMAT_OUT, SWAPSIZEFORMAT_OUT); | ||
| 77 | + asprintf (&status, str_format, status, used, total); | ||
| 78 | + } | ||
| 79 | } | ||
| 80 | } | ||
| 81 | } | ||
| 82 | @@ -93,7 +109,8 @@ | ||
| 83 | result = max_state (STATE_CRITICAL, result); | ||
| 84 | else if (percent_used >= warn_percent || free_swap <= warn_size) | ||
| 85 | result = max_state (STATE_WARNING, result); | ||
| 86 | - asprintf (&status, "%s %2d%% (%lu out of %lu)", status, percent_used, | ||
| 87 | + sprintf (str_format, "%%s %%2d%%%% (%s out of %s)", SWAPSIZEFORMAT_OUT, SWAPSIZEFORMAT_OUT); | ||
| 88 | + asprintf (&status, str_format, status, percent_used, | ||
| 89 | used_swap, total_swap); | ||
| 90 | fclose (fp); | ||
| 91 | #else | ||
| 92 | @@ -137,8 +154,9 @@ | ||
| 93 | result = max_state (STATE_CRITICAL, result); | ||
| 94 | else if (percent >= warn_percent || free <= warn_size) | ||
| 95 | result = max_state (STATE_WARNING, result); | ||
| 96 | - if (verbose) | ||
| 97 | - asprintf (&status, "%s [%lu/%lu]", status, used, total); | ||
| 98 | + if (verbose) { | ||
| 99 | + sprintf (str_format, "%%s [%s/%s]", SWAPSIZEFORMAT_OUT, SWAPSIZEFORMAT_OUT); | ||
| 100 | + asprintf (&status, str_format, status, used, total); | ||
| 101 | } | ||
| 102 | } | ||
| 103 | percent_used = 100 * ((double) used_swap) / ((double) total_swap); | ||
| 104 | @@ -146,8 +164,9 @@ | ||
| 105 | result = max_state (STATE_CRITICAL, result); | ||
| 106 | else if (percent_used >= warn_percent || free_swap <= warn_size) | ||
| 107 | result = max_state (STATE_WARNING, result); | ||
| 108 | - asprintf (&status, "%s %2d%% (%lu out of %lu)", | ||
| 109 | - status, percent_used, used_swap, total_swap); | ||
| 110 | + sprintf (str_format, "%%s %%2d%%%% (%s out of %s)", SWAPSIZEFORMAT_OUT, SWAPSIZEFORMAT_OUT) | ||
| 111 | + asprintf (&status, str_format, | ||
| 112 | + status, percent_used, used_swap, total_swap); | ||
| 113 | |||
| 114 | /* If we get anything on STDERR, at least set warning */ | ||
| 115 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) | ||
| 116 | @@ -198,6 +217,8 @@ | ||
| 117 | int wc = 0; /* warning counter */ | ||
| 118 | int cc = 0; /* critical counter */ | ||
| 119 | |||
| 120 | + char str_format[32]; | ||
| 121 | + | ||
| 122 | #ifdef HAVE_GETOPT_H | ||
| 123 | int option_index = 0; | ||
| 124 | static struct option long_options[] = { | ||
| 125 | @@ -224,15 +245,16 @@ | ||
| 126 | if (c == -1 || c == EOF) | ||
| 127 | break; | ||
| 128 | |||
| 129 | + sprintf (str_format, "%s,%%d%%%%", SWAPSIZEFORMAT); | ||
| 130 | switch (c) { | ||
| 131 | case 'w': /* warning time threshold */ | ||
| 132 | if (is_intnonneg (optarg)) { | ||
| 133 | - warn_size = atoi (optarg); | ||
| 134 | + warn_size = atos (optarg); | ||
| 135 | break; | ||
| 136 | } | ||
| 137 | else if (strstr (optarg, ",") && | ||
| 138 | strstr (optarg, "%") && | ||
| 139 | - sscanf (optarg, "%lu,%d%%", &warn_size, &warn_percent) == 2) { | ||
| 140 | + sscanf (optarg, str_format, &warn_size, &warn_percent) == 2) { | ||
| 141 | break; | ||
| 142 | } | ||
| 143 | else if (strstr (optarg, "%") && | ||
| 144 | @@ -245,12 +267,12 @@ | ||
| 145 | wc++; | ||
| 146 | case 'c': /* critical time threshold */ | ||
| 147 | if (is_intnonneg (optarg)) { | ||
| 148 | - crit_size = atoi (optarg); | ||
| 149 | + crit_size = atos (optarg); | ||
| 150 | break; | ||
| 151 | } | ||
| 152 | else if (strstr (optarg, ",") && | ||
| 153 | strstr (optarg, "%") && | ||
| 154 | - sscanf (optarg, "%lu,%d%%", &crit_size, &crit_percent) == 2) { | ||
| 155 | + sscanf (optarg, str_format, &crit_size, &crit_percent) == 2) { | ||
| 156 | break; | ||
| 157 | } | ||
| 158 | else if (strstr (optarg, "%") && | ||
| 159 | @@ -292,12 +314,12 @@ | ||
| 160 | if (c == argc) | ||
| 161 | return validate_arguments (); | ||
| 162 | if (warn_size < 0 && is_intnonneg (argv[c])) | ||
| 163 | - warn_size = atoi (argv[c++]); | ||
| 164 | + warn_size = atos (argv[c++]); | ||
| 165 | |||
| 166 | if (c == argc) | ||
| 167 | return validate_arguments (); | ||
| 168 | if (crit_size < 0 && is_intnonneg (argv[c])) | ||
| 169 | - crit_size = atoi (argv[c++]); | ||
| 170 | + crit_size = atos (argv[c++]); | ||
| 171 | |||
| 172 | return validate_arguments (); | ||
| 173 | } | ||
diff --git a/web/attachments/123952-check_snmp.c.diff b/web/attachments/123952-check_snmp.c.diff new file mode 100644 index 0000000..9d726bd --- /dev/null +++ b/web/attachments/123952-check_snmp.c.diff | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | diff -ruN nagios-plugins-1.4.orig/plugins/check_snmp.c nagios-plugins-1.4/plugins/check_snmp.c | ||
| 2 | --- nagios-plugins-1.4.orig/plugins/check_snmp.c 2005-01-21 04:03:56.000000000 +0300 | ||
| 3 | +++ nagios-plugins-1.4/plugins/check_snmp.c 2005-03-03 14:18:55.000000000 +0300 | ||
| 4 | @@ -646,6 +646,10 @@ | ||
| 5 | asprintf(&proto, DEFAULT_PROTOCOL); | ||
| 6 | asprintf(&authpriv, "%s%s", "-c ", community); | ||
| 7 | } | ||
| 8 | + else if ( strcmp (proto, "2c") == 0 ) { /* snmpv2c args */ | ||
| 9 | + asprintf(&proto, "%s", "2c"); | ||
| 10 | + asprintf(&authpriv, "%s%s", "-c ", community); | ||
| 11 | + } | ||
| 12 | else if ( strcmp (proto, "3") == 0 ) { /* snmpv3 args */ | ||
| 13 | asprintf(&proto, "%s", "3"); | ||
| 14 | |||
| 15 | @@ -859,7 +863,7 @@ | ||
| 16 | |||
| 17 | /* SNMP and Authentication Protocol */ | ||
| 18 | printf (_("\ | ||
| 19 | - -P, --protocol=[1|3]\n\ | ||
| 20 | + -P, --protocol=[1|2c|3]\n\ | ||
| 21 | SNMP protocol version\n\ | ||
| 22 | -L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]\n\ | ||
| 23 | SNMPv3 securityLevel\n\ | ||
diff --git a/web/attachments/125109-tcp_bin.patch b/web/attachments/125109-tcp_bin.patch new file mode 100644 index 0000000..1ac15e4 --- /dev/null +++ b/web/attachments/125109-tcp_bin.patch | |||
| @@ -0,0 +1,214 @@ | |||
| 1 | diff -rNu nagios_orig/plugins/check_tcp.c nagios-plugins-1.4/plugins/check_tcp.c | ||
| 2 | --- nagios_orig/plugins/check_tcp.c 2004-12-30 01:41:40.000000000 +0100 | ||
| 3 | +++ nagios-plugins-1.4/plugins/check_tcp.c 2005-03-09 15:46:03.000000000 +0100 | ||
| 4 | @@ -80,6 +80,8 @@ | ||
| 5 | char *server_address = NULL; | ||
| 6 | char *server_send = NULL; | ||
| 7 | char *server_quit = NULL; | ||
| 8 | +char *input_file_name = NULL; | ||
| 9 | +char *output_file_name = NULL; | ||
| 10 | char **server_expect = NULL; | ||
| 11 | size_t server_expect_count = 0; | ||
| 12 | int maxbytes = 0; | ||
| 13 | @@ -132,6 +134,15 @@ | ||
| 14 | PROTOCOL = TCP_PROTOCOL; | ||
| 15 | PORT = 0; | ||
| 16 | } | ||
| 17 | + else if (strstr (argv[0], "check_tcp_bin")) { | ||
| 18 | + progname = strdup ("check_tcp_bin"); | ||
| 19 | + SERVICE = strdup ("TCP"); | ||
| 20 | + SEND = NULL; | ||
| 21 | + EXPECT = NULL; | ||
| 22 | + QUIT = NULL; | ||
| 23 | + PROTOCOL = TCP_PROTOCOL; | ||
| 24 | + PORT = 0; | ||
| 25 | + } | ||
| 26 | else if (strstr (argv[0], "check_ftp")) { | ||
| 27 | progname = strdup ("check_ftp"); | ||
| 28 | SERVICE = strdup ("FTP"); | ||
| 29 | @@ -299,6 +310,42 @@ | ||
| 30 | send (sd, server_send, strlen(server_send), 0); | ||
| 31 | } | ||
| 32 | |||
| 33 | + /* send content of input file ? */ | ||
| 34 | + if (input_file_name != NULL) { | ||
| 35 | + struct stat istat; | ||
| 36 | + if (stat(input_file_name, &istat) != 0) { | ||
| 37 | + printf("UNKNOWN - File not found %s\n", input_file_name); | ||
| 38 | + return STATE_UNKNOWN; | ||
| 39 | + } | ||
| 40 | + size_t in_len = istat.st_size; | ||
| 41 | + | ||
| 42 | + FILE * in = fopen(input_file_name, "rb"); | ||
| 43 | + if (in == NULL) { | ||
| 44 | + printf("UNKNOWN - Can not open file: %s\n", input_file_name); | ||
| 45 | + return STATE_UNKNOWN; | ||
| 46 | + } | ||
| 47 | + char * indata = malloc(in_len); | ||
| 48 | + if (indata == NULL) { | ||
| 49 | + printf(_("UNKNOWN - Not enough memory\n")); | ||
| 50 | + return STATE_UNKNOWN; | ||
| 51 | + } | ||
| 52 | + size_t bytes = fread(indata, 1, in_len, in); | ||
| 53 | + if (bytes != in_len) { | ||
| 54 | + printf("UNKNOWN - Error reading file: \n", input_file_name); | ||
| 55 | + free(indata); | ||
| 56 | + fclose(in); | ||
| 57 | + return STATE_UNKNOWN; | ||
| 58 | + } | ||
| 59 | + fclose(in); | ||
| 60 | +#ifdef HAVE_SSL | ||
| 61 | + if (use_ssl) | ||
| 62 | + SSL_write(ssl, indata, in_len); | ||
| 63 | + else | ||
| 64 | +#endif | ||
| 65 | + send (sd, indata, in_len, 0); | ||
| 66 | + free(indata); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | if (delay > 0) { | ||
| 70 | tv.tv_sec += delay; | ||
| 71 | sleep (delay); | ||
| 72 | @@ -345,6 +392,57 @@ | ||
| 73 | } | ||
| 74 | } | ||
| 75 | |||
| 76 | + /* Verify server response */ | ||
| 77 | + if (output_file_name != NULL) { | ||
| 78 | + struct stat ostat; | ||
| 79 | + if (stat(output_file_name, &ostat) != 0) { | ||
| 80 | + printf("UNKNOWN - File not found %s\n", output_file_name); | ||
| 81 | + return STATE_UNKNOWN; | ||
| 82 | + } | ||
| 83 | + size_t out_len = ostat.st_size; | ||
| 84 | + | ||
| 85 | + FILE * out = fopen(output_file_name, "rb"); | ||
| 86 | + if (out == NULL) { | ||
| 87 | + printf("UNKNOWN - Can not open file: %s\n", output_file_name); | ||
| 88 | + return STATE_UNKNOWN; | ||
| 89 | + } | ||
| 90 | + char * outdata = malloc(out_len); | ||
| 91 | + if (outdata == NULL) { | ||
| 92 | + printf(_("UNKNOWN - Not enough memory\n")); | ||
| 93 | + return STATE_UNKNOWN; | ||
| 94 | + } | ||
| 95 | + size_t bytes = fread(outdata, 1, out_len, out); | ||
| 96 | + if (bytes != out_len) { | ||
| 97 | + printf("UNKNOWN - Error reading file: \n", output_file_name); | ||
| 98 | + free(outdata); | ||
| 99 | + fclose(out); | ||
| 100 | + return STATE_UNKNOWN; | ||
| 101 | + } | ||
| 102 | + fclose(out); | ||
| 103 | + | ||
| 104 | + char * rcvbuf = malloc(out_len); | ||
| 105 | + if (rcvbuf != NULL) { | ||
| 106 | + char *p = rcvbuf; | ||
| 107 | + size_t count = 0; | ||
| 108 | + | ||
| 109 | + do { | ||
| 110 | + count += my_bin_recv(p, out_len-count); | ||
| 111 | + p += count; | ||
| 112 | + } while (count < out_len); | ||
| 113 | + | ||
| 114 | + if (memcmp(outdata, rcvbuf, out_len) == 0) { | ||
| 115 | + result = STATE_OK; | ||
| 116 | + } else { | ||
| 117 | + printf(_("WARNING response does not match\n")); | ||
| 118 | + result = expect_mismatch_state; | ||
| 119 | + } | ||
| 120 | + free(rcvbuf); | ||
| 121 | + } else { | ||
| 122 | + result = STATE_UNKNOWN; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | if (server_quit != NULL) { | ||
| 128 | #ifdef HAVE_SSL | ||
| 129 | if (use_ssl) { | ||
| 130 | @@ -417,6 +515,8 @@ | ||
| 131 | {"expect", required_argument, 0, 'e'}, | ||
| 132 | {"maxbytes", required_argument, 0, 'm'}, | ||
| 133 | {"quit", required_argument, 0, 'q'}, | ||
| 134 | + {"inputfile", required_argument, 0, 'i'}, | ||
| 135 | + {"outputfile", required_argument, 0, 'o'}, | ||
| 136 | {"jail", required_argument, 0, 'j'}, | ||
| 137 | {"delay", required_argument, 0, 'd'}, | ||
| 138 | {"refuse", required_argument, 0, 'r'}, | ||
| 139 | @@ -454,8 +554,8 @@ | ||
| 140 | } | ||
| 141 | |||
| 142 | while (1) { | ||
| 143 | - c = getopt_long (argc, argv, "+hVv46H:s:e:q:m:c:w:t:p:C:W:d:Sr:jD:M:", | ||
| 144 | - longopts, &option); | ||
| 145 | + c = getopt_long (argc, argv, | ||
| 146 | + "+hVv46H:s:e:q:m:c:i:o:w:t:p:C:W:d:Sr:jD:M:", longopts, &option); | ||
| 147 | |||
| 148 | if (c == -1 || c == EOF || c == 1) | ||
| 149 | break; | ||
| 150 | @@ -527,6 +627,12 @@ | ||
| 151 | case 's': | ||
| 152 | server_send = optarg; | ||
| 153 | break; | ||
| 154 | + case 'i': | ||
| 155 | + input_file_name = optarg; | ||
| 156 | + break; | ||
| 157 | + case 'o': | ||
| 158 | + output_file_name = optarg; | ||
| 159 | + break; | ||
| 160 | case 'e': /* expect string (may be repeated) */ | ||
| 161 | EXPECT = NULL; | ||
| 162 | exact_matching = FALSE; | ||
| 163 | @@ -748,7 +854,18 @@ | ||
| 164 | return i; | ||
| 165 | } | ||
| 166 | |||
| 167 | - | ||
| 168 | +int my_bin_recv(char * buf, size_t len) { | ||
| 169 | + int i; | ||
| 170 | +#ifdef HAVE_SSL | ||
| 171 | + if (use_ssl) { | ||
| 172 | + i = SSL_read (ssl, buf, len); | ||
| 173 | + } else { | ||
| 174 | +#endif | ||
| 175 | + i = read (sd, buf, len); | ||
| 176 | +#ifdef HAVE_SSL | ||
| 177 | + } | ||
| 178 | +#endif | ||
| 179 | +} | ||
| 180 | |||
| 181 | void | ||
| 182 | print_help (void) | ||
| 183 | @@ -786,6 +903,10 @@ | ||
| 184 | Hide output from TCP socket\n\ | ||
| 185 | -m, --maxbytes=INTEGER\n\ | ||
| 186 | Close connection once more than this number of bytes are received\n\ | ||
| 187 | + -i, --inputfile=file_name\n\ | ||
| 188 | + Input file to send to server\n\ | ||
| 189 | + -o, --outputfile=file_name\n\ | ||
| 190 | + Output file to binary compare with server response\n\ | ||
| 191 | -d, --delay=INTEGER\n\ | ||
| 192 | Seconds to wait between sending string and polling for response\n")); | ||
| 193 | |||
| 194 | @@ -816,5 +937,6 @@ | ||
| 195 | [-s <send string>] [-e <expect string>] [-q <quit string>]\n\ | ||
| 196 | [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\ | ||
| 197 | [-r <refuse state>] [-M <mismatch state>] [-v] [-4|-6] [-j]\n\ | ||
| 198 | + [-i <input file>] [-o <output file>]\n\ | ||
| 199 | [-D <days to cert expiry>] [-S <use SSL>]\n", progname); | ||
| 200 | } | ||
| 201 | diff -rNu nagios_orig/plugins/Makefile.am nagios-plugins-1.4/plugins/Makefile.am | ||
| 202 | --- nagios_orig/plugins/Makefile.am 2005-02-01 13:30:38.000000000 +0100 | ||
| 203 | +++ nagios-plugins-1.4/plugins/Makefile.am 2005-03-09 17:25:07.000000000 +0100 | ||
| 204 | @@ -16,8 +16,8 @@ | ||
| 205 | check_udp check_ups check_users negate urlize check_icmp\ | ||
| 206 | @EXTRAS@ | ||
| 207 | |||
| 208 | -check_tcp_programs = check_ftp check_imap check_nntp check_pop check_udp2 \ | ||
| 209 | - @check_tcp_ssl@ | ||
| 210 | +check_tcp_programs = check_ftp check_imap check_nntp check_pop check_tcp_bin \ | ||
| 211 | + check_udp2 @check_tcp_ssl@ | ||
| 212 | |||
| 213 | EXTRA_PROGRAMS = check_mysql check_radius check_pgsql check_snmp check_hpjd \ | ||
| 214 | check_swap check_fping check_ldap check_game check_dig \ | ||
diff --git a/web/attachments/126077-check_oracle.diff b/web/attachments/126077-check_oracle.diff new file mode 100644 index 0000000..2266ce3 --- /dev/null +++ b/web/attachments/126077-check_oracle.diff | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | --- check_oracle.new 2005-03-17 15:12:05.000000000 +0100 | ||
| 2 | +++ /home/stefan/packages/nagios-plugins-1.4/plugins-scripts/check_oracle.sh 2004-12-01 21:09:59.000000000 +0100 | ||
| 3 | @@ -241,36 +241,17 @@ | ||
| 4 | echo "UNKNOWN - Warning level is more then Crit" | ||
| 5 | exit $STATE_UNKNOWN | ||
| 6 | fi | ||
| 7 | - | ||
| 8 | - | ||
| 9 | - if [ ${5} = 'TEMP' ] ; then | ||
| 10 | - result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 11 | - set pagesize 0 | ||
| 12 | - set numf '9999999.99' | ||
| 13 | - | ||
| 14 | - select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc | ||
| 15 | - from ( | ||
| 16 | - select tablespace_name,sum(bytes)/1024/1024 total | ||
| 17 | - from dba_temp_files group by tablespace_name) A, | ||
| 18 | - ( select tablespace_name,sum(bytes_free)/1024/1024 free | ||
| 19 | - from v\\$temp_space_header group by tablespace_name) B | ||
| 20 | - where a.tablespace_name=b.tablespace_name and a.tablespace_name='${5}'; | ||
| 21 | - EOF` | ||
| 22 | - else | ||
| 23 | - result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 24 | - set pagesize 0 | ||
| 25 | - set numf '9999999.99' | ||
| 26 | - | ||
| 27 | - select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc | ||
| 28 | - from ( | ||
| 29 | - select tablespace_name,sum(bytes)/1024/1024 total | ||
| 30 | - from dba_data_files group by tablespace_name) A, | ||
| 31 | - ( select tablespace_name,sum(bytes)/1024/1024 free | ||
| 32 | - from dba_Free_space group by tablespace_name) B | ||
| 33 | - where a.tablespace_name=b.tablespace_name and a.tablespace_name='${5}'; | ||
| 34 | - EOF` | ||
| 35 | - fi | ||
| 36 | - | ||
| 37 | + result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 38 | +set pagesize 0 | ||
| 39 | +set numf '9999999.99' | ||
| 40 | +select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc | ||
| 41 | +from ( | ||
| 42 | +select tablespace_name,sum(bytes)/1024/1024 total | ||
| 43 | +from dba_data_files group by tablespace_name) A, | ||
| 44 | +( select tablespace_name,sum(bytes)/1024/1024 free | ||
| 45 | +from dba_free_space group by tablespace_name) B | ||
| 46 | +where a.tablespace_name=b.tablespace_name and a.tablespace_name='${5}'; | ||
| 47 | +EOF` | ||
| 48 | |||
| 49 | if [ -n "`echo $result | grep ORA-`" ] ; then | ||
| 50 | error=` echo "$result" | grep "ORA-" | head -1` | ||
diff --git a/web/attachments/127602-check_ntp.diff b/web/attachments/127602-check_ntp.diff new file mode 100644 index 0000000..9c585d0 --- /dev/null +++ b/web/attachments/127602-check_ntp.diff | |||
| @@ -0,0 +1,138 @@ | |||
| 1 | Index: plugins-scripts/check_ntp.pl | ||
| 2 | =================================================================== | ||
| 3 | --- plugins-scripts/check_ntp.pl (revision 18) | ||
| 4 | +++ plugins-scripts/check_ntp.pl (working copy) | ||
| 5 | @@ -270,11 +270,11 @@ | ||
| 6 | if (/^(\*|\+|\#|o])/) { | ||
| 7 | ++$candidate; | ||
| 8 | push (@candidates, $_); | ||
| 9 | - print "Candiate count= $candidate\n" if ($verbose); | ||
| 10 | + print "Candidate count= $candidate\n" if ($verbose); | ||
| 11 | } | ||
| 12 | |||
| 13 | # match sys.peer or pps.peer | ||
| 14 | - if (/^(\*|o)([-0-9.\s]+)\s+([-0-9A-Za-z.]+)\s+([-0-9.]+)\s+([lumb-]+)\s+([-0-9m.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/) { | ||
| 15 | + if (/^(\*|o)([-0-9.]+)\s+(\S+)\s+([-0-9.]+)\s+([lumb-]+)\s+([-0-9m.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/) { | ||
| 16 | $syspeer = $2; | ||
| 17 | $stratum = $4; | ||
| 18 | $jitter = $11; | ||
| 19 | @@ -283,11 +283,14 @@ | ||
| 20 | print "Jitter_crit = $11 :$jcrit\n" if ($verbose); | ||
| 21 | $jitter_error = $ERRORS{'CRITICAL'}; | ||
| 22 | } elsif ($jitter > $jwarn ) { | ||
| 23 | - print "Jitter_warn = $11 :$jwarn \n" if ($verbose); | ||
| 24 | + print "Jitter_warn = $11 :$jwarn\n" if ($verbose); | ||
| 25 | $jitter_error = $ERRORS{'WARNING'}; | ||
| 26 | } else { | ||
| 27 | $jitter_error = $ERRORS{'OK'}; | ||
| 28 | } | ||
| 29 | + } else { | ||
| 30 | + print "No match!\n" if $verbose; | ||
| 31 | + $jitter = '(not parsed)'; | ||
| 32 | } | ||
| 33 | |||
| 34 | } | ||
| 35 | @@ -324,53 +327,53 @@ | ||
| 36 | if ($ntpdate_error != $ERRORS{'OK'}) { | ||
| 37 | $state = $ntpdate_error; | ||
| 38 | if ($ntpdate_error == $ERRORS{'WARNING'} ) { | ||
| 39 | - $answer = $msg . "\n"; | ||
| 40 | + $answer = $msg; | ||
| 41 | } | ||
| 42 | else { | ||
| 43 | - $answer = $msg . "Server for ntp probably down\n"; | ||
| 44 | + $answer = $msg . "Server for ntp probably down"; | ||
| 45 | } | ||
| 46 | |||
| 47 | if (defined($offset) && abs($offset) > $ocrit) { | ||
| 48 | $state = $ERRORS{'CRITICAL'}; | ||
| 49 | - $answer = "Server Error and offset $offset sec > +/- $ocrit sec\n"; | ||
| 50 | + $answer = "Server Error and offset $offset sec > +/- $ocrit sec"; | ||
| 51 | } elsif (defined($offset) && abs($offset) > $owarn) { | ||
| 52 | - $answer = "Server error and offset $offset sec > +/- $owarn sec\n"; | ||
| 53 | + $answer = "Server error and offset $offset sec > +/- $owarn sec"; | ||
| 54 | } elsif (defined($jitter) && abs($jitter) > $jcrit) { | ||
| 55 | - $answer = "Server error and jitter $jitter msec > +/- $jcrit msec\n"; | ||
| 56 | + $answer = "Server error and jitter $jitter msec > +/- $jcrit msec"; | ||
| 57 | } elsif (defined($jitter) && abs($jitter) > $jwarn) { | ||
| 58 | - $answer = "Server error and jitter $jitter msec > +/- $jwarn msec\n"; | ||
| 59 | + $answer = "Server error and jitter $jitter msec > +/- $jwarn msec"; | ||
| 60 | } | ||
| 61 | |||
| 62 | } elsif ($have_ntpq && $jitter_error != $ERRORS{'OK'}) { | ||
| 63 | $state = $jitter_error; | ||
| 64 | - $answer = "Jitter $jitter too high\n"; | ||
| 65 | + $answer = "Jitter $jitter too high"; | ||
| 66 | if (defined($offset) && abs($offset) > $ocrit) { | ||
| 67 | $state = $ERRORS{'CRITICAL'}; | ||
| 68 | - $answer = "Jitter error and offset $offset sec > +/- $ocrit sec\n"; | ||
| 69 | + $answer = "Jitter error and offset $offset sec > +/- $ocrit sec"; | ||
| 70 | } elsif (defined($offset) && abs($offset) > $owarn) { | ||
| 71 | - $answer = "Jitter error and offset $offset sec > +/- $owarn sec\n"; | ||
| 72 | + $answer = "Jitter error and offset $offset sec > +/- $owarn sec"; | ||
| 73 | } elsif (defined($jitter) && abs($jitter) > $jcrit) { | ||
| 74 | - $answer = "Jitter error and jitter $jitter msec > +/- $jcrit msec\n"; | ||
| 75 | + $answer = "Jitter error and jitter $jitter msec > +/- $jcrit msec"; | ||
| 76 | } elsif (defined($jitter) && abs($jitter) > $jwarn) { | ||
| 77 | - $answer = "Jitter error and jitter $jitter msec > +/- $jwarn msec\n"; | ||
| 78 | + $answer = "Jitter error and jitter $jitter msec > +/- $jwarn msec"; | ||
| 79 | } | ||
| 80 | |||
| 81 | } elsif( !$have_ntpq ) { # no errors from ntpdate and no ntpq or ntpq timed out | ||
| 82 | if (abs($offset) > $ocrit) { | ||
| 83 | $state = $ERRORS{'CRITICAL'}; | ||
| 84 | - $answer = "Offset $offset sec > +/- $ocrit sec\n"; | ||
| 85 | + $answer = "Offset $offset sec > +/- $ocrit sec"; | ||
| 86 | } elsif (abs($offset) > $owarn) { | ||
| 87 | $state = $ERRORS{'WARNING'}; | ||
| 88 | - $answer = "Offset $offset sec > +/- $owarn sec\n"; | ||
| 89 | + $answer = "Offset $offset sec > +/- $owarn sec"; | ||
| 90 | } elsif (( abs($offset) > $owarn) && $def_jitter ) { | ||
| 91 | $state = $ERRORS{'WARNING'}; | ||
| 92 | - $answer = "Offset $offset sec > +/- $owarn sec, ntpq timed out\n"; | ||
| 93 | + $answer = "Offset $offset sec > +/- $owarn sec, ntpq timed out"; | ||
| 94 | } elsif ( $def_jitter ) { | ||
| 95 | $state = $ERRORS{'WARNING'}; | ||
| 96 | - $answer = "Offset $offset secs, ntpq timed out\n"; | ||
| 97 | + $answer = "Offset $offset secs, ntpq timed out"; | ||
| 98 | } else{ | ||
| 99 | $state = $ERRORS{'OK'}; | ||
| 100 | - $answer = "Offset $offset secs \n"; | ||
| 101 | + $answer = "Offset $offset secs "; | ||
| 102 | } | ||
| 103 | |||
| 104 | |||
| 105 | @@ -378,27 +381,27 @@ | ||
| 106 | } else { # no errors from ntpdate or ntpq | ||
| 107 | if (abs($offset) > $ocrit) { | ||
| 108 | $state = $ERRORS{'CRITICAL'}; | ||
| 109 | - $answer = "Offset $offset sec > +/- $ocrit sec, jitter $jitter msec\n"; | ||
| 110 | + $answer = "Offset $offset sec > +/- $ocrit sec, jitter $jitter msec"; | ||
| 111 | } elsif (abs($jitter) > $jcrit ) { | ||
| 112 | $state = $ERRORS{'CRITICAL'}; | ||
| 113 | - $answer = "Jitter $jitter msec> +/- $jcrit msec, offset $offset sec \n"; | ||
| 114 | + $answer = "Jitter $jitter msec> +/- $jcrit msec, offset $offset sec"; | ||
| 115 | } elsif (abs($offset) > $owarn) { | ||
| 116 | $state = $ERRORS{'WARNING'}; | ||
| 117 | - $answer = "Offset $offset sec > +/- $owarn sec, jitter $jitter msec\n"; | ||
| 118 | + $answer = "Offset $offset sec > +/- $owarn sec, jitter $jitter msec"; | ||
| 119 | } elsif (abs($jitter) > $jwarn ) { | ||
| 120 | $state = $ERRORS{'WARNING'}; | ||
| 121 | - $answer = "Jitter $jitter msec> +/- $jwarn msec, offset $offset sec \n"; | ||
| 122 | + $answer = "Jitter $jitter msec> +/- $jwarn msec, offset $offset sec"; | ||
| 123 | |||
| 124 | } else { | ||
| 125 | $state = $ERRORS{'OK'}; | ||
| 126 | - $answer = "Offset $offset secs, jitter $jitter msec, peer is stratum $stratum\n"; | ||
| 127 | + $answer = "Offset $offset secs, jitter $jitter msec, peer is stratum $stratum"; | ||
| 128 | } | ||
| 129 | |||
| 130 | } | ||
| 131 | |||
| 132 | foreach my $key (keys %ERRORS) { | ||
| 133 | if ($state==$ERRORS{$key}) { | ||
| 134 | - print ("NTP $key: $answer"); | ||
| 135 | + print ("NTP $key: $answer|offset=$offset, jitter=" . $jitter/1000 . "\n"); | ||
| 136 | last; | ||
| 137 | } | ||
| 138 | } | ||
diff --git a/web/attachments/127924-check_smtp.c b/web/attachments/127924-check_smtp.c new file mode 100644 index 0000000..f86a119 --- /dev/null +++ b/web/attachments/127924-check_smtp.c | |||
| @@ -0,0 +1,739 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | |||
| 3 | This program is free software; you can redistribute it and/or modify | ||
| 4 | it under the terms of the GNU General Public License as published by | ||
| 5 | the Free Software Foundation; either version 2 of the License, or | ||
| 6 | (at your option) any later version. | ||
| 7 | |||
| 8 | This program is distributed in the hope that it will be useful, | ||
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | GNU General Public License for more details. | ||
| 12 | |||
| 13 | You should have received a copy of the GNU General Public License | ||
| 14 | along with this program; if not, write to the Free Software | ||
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 16 | |||
| 17 | $Id: check_smtp.c,v 1.43 2005/01/01 16:15:39 tonvoon Exp $ | ||
| 18 | |||
| 19 | ******************************************************************************/ | ||
| 20 | |||
| 21 | const char *progname = "check_smtp"; | ||
| 22 | const char *revision = "$Revision: 1.43 $"; | ||
| 23 | const char *copyright = "2000-2004"; | ||
| 24 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 25 | |||
| 26 | #include "common.h" | ||
| 27 | #include "netutils.h" | ||
| 28 | #include "utils.h" | ||
| 29 | |||
| 30 | #ifdef HAVE_SSL_H | ||
| 31 | # include <rsa.h> | ||
| 32 | # include <crypto.h> | ||
| 33 | # include <x509.h> | ||
| 34 | # include <pem.h> | ||
| 35 | # include <ssl.h> | ||
| 36 | # include <err.h> | ||
| 37 | #else | ||
| 38 | # ifdef HAVE_OPENSSL_SSL_H | ||
| 39 | # include <openssl/rsa.h> | ||
| 40 | # include <openssl/crypto.h> | ||
| 41 | # include <openssl/x509.h> | ||
| 42 | # include <openssl/pem.h> | ||
| 43 | # include <openssl/ssl.h> | ||
| 44 | # include <openssl/err.h> | ||
| 45 | # endif | ||
| 46 | #endif | ||
| 47 | |||
| 48 | #ifdef HAVE_SSL | ||
| 49 | |||
| 50 | int check_cert = FALSE; | ||
| 51 | int days_till_exp; | ||
| 52 | SSL_CTX *ctx; | ||
| 53 | SSL *ssl; | ||
| 54 | X509 *server_cert; | ||
| 55 | int connect_STARTTLS (void); | ||
| 56 | int check_certificate (X509 **); | ||
| 57 | #endif | ||
| 58 | |||
| 59 | enum { | ||
| 60 | SMTP_PORT = 25 | ||
| 61 | }; | ||
| 62 | const char *SMTP_EXPECT = "220"; | ||
| 63 | const char *SMTP_HELO = "HELO "; | ||
| 64 | const char *SMTP_QUIT = "QUIT\r\n"; | ||
| 65 | const char *SMTP_STARTTLS = "STARTTLS\r\n"; | ||
| 66 | |||
| 67 | int process_arguments (int, char **); | ||
| 68 | int validate_arguments (void); | ||
| 69 | void print_help (void); | ||
| 70 | void print_usage (void); | ||
| 71 | int myrecv(void); | ||
| 72 | int my_close(void); | ||
| 73 | |||
| 74 | #ifdef HAVE_REGEX_H | ||
| 75 | #include <regex.h> | ||
| 76 | char regex_expect[MAX_INPUT_BUFFER] = ""; | ||
| 77 | regex_t preg; | ||
| 78 | regmatch_t pmatch[10]; | ||
| 79 | char timestamp[10] = ""; | ||
| 80 | char errbuf[MAX_INPUT_BUFFER]; | ||
| 81 | int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; | ||
| 82 | int eflags = 0; | ||
| 83 | int errcode, excode; | ||
| 84 | #endif | ||
| 85 | |||
| 86 | int server_port = SMTP_PORT; | ||
| 87 | char *server_address = NULL; | ||
| 88 | char *server_expect = NULL; | ||
| 89 | int smtp_use_dummycmd = 0; | ||
| 90 | char *mail_command = NULL; | ||
| 91 | char *from_arg = NULL; | ||
| 92 | int ncommands=0; | ||
| 93 | int command_size=0; | ||
| 94 | int nresponses=0; | ||
| 95 | int response_size=0; | ||
| 96 | char **commands = NULL; | ||
| 97 | char **responses = NULL; | ||
| 98 | int warning_time = 0; | ||
| 99 | int check_warning_time = FALSE; | ||
| 100 | int critical_time = 0; | ||
| 101 | int check_critical_time = FALSE; | ||
| 102 | int verbose = 0; | ||
| 103 | int use_ssl = FALSE; | ||
| 104 | int sd; | ||
| 105 | char buffer[MAX_INPUT_BUFFER]; | ||
| 106 | enum { | ||
| 107 | TCP_PROTOCOL = 1, | ||
| 108 | UDP_PROTOCOL = 2, | ||
| 109 | MAXBUF = 1024 | ||
| 110 | }; | ||
| 111 | |||
| 112 | int | ||
| 113 | main (int argc, char **argv) | ||
| 114 | { | ||
| 115 | |||
| 116 | int n = 0; | ||
| 117 | double elapsed_time; | ||
| 118 | long microsec; | ||
| 119 | int result = STATE_UNKNOWN; | ||
| 120 | char *cmd_str = NULL; | ||
| 121 | char *helocmd = NULL; | ||
| 122 | struct timeval tv; | ||
| 123 | |||
| 124 | setlocale (LC_ALL, ""); | ||
| 125 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 126 | textdomain (PACKAGE); | ||
| 127 | |||
| 128 | if (process_arguments (argc, argv) == ERROR) | ||
| 129 | usage4 (_("Could not parse arguments")); | ||
| 130 | |||
| 131 | /* initialize the HELO command with the localhostname */ | ||
| 132 | #ifndef HOST_MAX_BYTES | ||
| 133 | #define HOST_MAX_BYTES 255 | ||
| 134 | #endif | ||
| 135 | helocmd = malloc (HOST_MAX_BYTES); | ||
| 136 | gethostname(helocmd, HOST_MAX_BYTES); | ||
| 137 | asprintf (&helocmd, "%s%s%s", SMTP_HELO, helocmd, "\r\n"); | ||
| 138 | |||
| 139 | /* initialize the MAIL command with optional FROM command */ | ||
| 140 | asprintf (&cmd_str, "%sFROM: %s%s", mail_command, from_arg, "\r\n"); | ||
| 141 | |||
| 142 | if (verbose && smtp_use_dummycmd) | ||
| 143 | printf ("FROM CMD: %s", cmd_str); | ||
| 144 | |||
| 145 | /* initialize alarm signal handling */ | ||
| 146 | (void) signal (SIGALRM, socket_timeout_alarm_handler); | ||
| 147 | |||
| 148 | /* set socket timeout */ | ||
| 149 | (void) alarm (socket_timeout); | ||
| 150 | |||
| 151 | /* start timer */ | ||
| 152 | gettimeofday (&tv, NULL); | ||
| 153 | |||
| 154 | /* try to connect to the host at the given port number */ | ||
| 155 | result = my_tcp_connect (server_address, server_port, &sd); | ||
| 156 | |||
| 157 | if (result == STATE_OK) { /* we connected */ | ||
| 158 | |||
| 159 | /* watch for the SMTP connection string and */ | ||
| 160 | /* return a WARNING status if we couldn't read any data */ | ||
| 161 | if (recv (sd, buffer, MAX_INPUT_BUFFER - 1, 0) == -1) { | ||
| 162 | printf (_("recv() failed\n")); | ||
| 163 | result = STATE_WARNING; | ||
| 164 | } | ||
| 165 | else { | ||
| 166 | if (verbose) | ||
| 167 | printf ("%s", buffer); | ||
| 168 | /* strip the buffer of carriage returns */ | ||
| 169 | strip (buffer); | ||
| 170 | /* make sure we find the response we are looking for */ | ||
| 171 | if (!strstr (buffer, server_expect)) { | ||
| 172 | if (server_port == SMTP_PORT) | ||
| 173 | printf (_("Invalid SMTP response received from host\n")); | ||
| 174 | else | ||
| 175 | printf (_("Invalid SMTP response received from host on port %d\n"), | ||
| 176 | server_port); | ||
| 177 | result = STATE_WARNING; | ||
| 178 | } | ||
| 179 | } | ||
| 180 | #ifdef HAVE_SSL | ||
| 181 | if(use_ssl) { | ||
| 182 | |||
| 183 | send(sd, helocmd, strlen(helocmd), 0); | ||
| 184 | recv(sd,buffer, MAX_INPUT_BUFFER-1, 0); // wait for it | ||
| 185 | /* send the STARTTLS command */ | ||
| 186 | send(sd, SMTP_STARTTLS, strlen(SMTP_STARTTLS), 0); | ||
| 187 | |||
| 188 | recv(sd,buffer, MAX_INPUT_BUFFER-1, 0); // wait for it | ||
| 189 | if (!strstr (buffer, server_expect)) { | ||
| 190 | printf (_("Server does not support STARTTLS : %s \n"),buffer); | ||
| 191 | return STATE_UNKNOWN; | ||
| 192 | } | ||
| 193 | if(connect_STARTTLS() != OK) { | ||
| 194 | printf (_("CRITICAL - Cannot create SSL context.: %s \n"),buffer); | ||
| 195 | return STATE_CRITICAL; | ||
| 196 | } | ||
| 197 | if ( check_cert ) { | ||
| 198 | if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) { | ||
| 199 | result = check_certificate (&server_cert); | ||
| 200 | X509_free(server_cert); | ||
| 201 | } | ||
| 202 | else { | ||
| 203 | printf (_("CRITICAL - Cannot retrieve server certificate.: %s \n"),buffer); | ||
| 204 | result = STATE_CRITICAL; | ||
| 205 | |||
| 206 | } | ||
| 207 | my_close(); | ||
| 208 | return result; | ||
| 209 | } | ||
| 210 | } | ||
| 211 | #endif | ||
| 212 | /* send the HELO command */ | ||
| 213 | #ifdef HAVE_SSL | ||
| 214 | if (use_ssl) | ||
| 215 | SSL_write(ssl, helocmd, strlen(helocmd)); | ||
| 216 | else | ||
| 217 | #endif | ||
| 218 | send(sd, helocmd, strlen(helocmd), 0); | ||
| 219 | |||
| 220 | /* allow for response to helo command to reach us */ | ||
| 221 | myrecv(); | ||
| 222 | |||
| 223 | /* sendmail will syslog a "NOQUEUE" error if session does not attempt | ||
| 224 | * to do something useful. This can be prevented by giving a command | ||
| 225 | * even if syntax is illegal (MAIL requires a FROM:<...> argument) | ||
| 226 | * | ||
| 227 | * According to rfc821 you can include a null reversepath in the from command | ||
| 228 | * - but a log message is generated on the smtp server. | ||
| 229 | * | ||
| 230 | * You can disable sending mail_command with '--nocommand' | ||
| 231 | * Use the -f option to provide a FROM address | ||
| 232 | */ | ||
| 233 | if (smtp_use_dummycmd) { | ||
| 234 | #ifdef HAVE_SSL | ||
| 235 | if (use_ssl) | ||
| 236 | SSL_write(ssl, cmd_str, strlen(cmd_str)); | ||
| 237 | else | ||
| 238 | #endif | ||
| 239 | send(sd, cmd_str, strlen(cmd_str), 0); | ||
| 240 | myrecv(); | ||
| 241 | if (verbose) | ||
| 242 | printf("%s", buffer); | ||
| 243 | } | ||
| 244 | |||
| 245 | while (n < ncommands) { | ||
| 246 | asprintf (&cmd_str, "%s%s", commands[n], "\r\n"); | ||
| 247 | #ifdef HAVE_SSL | ||
| 248 | if (use_ssl) | ||
| 249 | SSL_write(ssl,cmd_str, strlen(cmd_str)); | ||
| 250 | else | ||
| 251 | #endif | ||
| 252 | send(sd, cmd_str, strlen(cmd_str), 0); | ||
| 253 | myrecv(); | ||
| 254 | if (verbose) | ||
| 255 | printf("%s", buffer); | ||
| 256 | strip (buffer); | ||
| 257 | if (n < nresponses) { | ||
| 258 | #ifdef HAVE_REGEX_H | ||
| 259 | cflags |= REG_EXTENDED | REG_NOSUB | REG_NEWLINE; | ||
| 260 | //strncpy (regex_expect, responses[n], sizeof (regex_expect) - 1); | ||
| 261 | //regex_expect[sizeof (regex_expect) - 1] = '\0'; | ||
| 262 | errcode = regcomp (&preg, responses[n], cflags); | ||
| 263 | if (errcode != 0) { | ||
| 264 | regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER); | ||
| 265 | printf (_("Could Not Compile Regular Expression")); | ||
| 266 | return ERROR; | ||
| 267 | } | ||
| 268 | excode = regexec (&preg, buffer, 10, pmatch, eflags); | ||
| 269 | if (excode == 0) { | ||
| 270 | result = STATE_OK; | ||
| 271 | } | ||
| 272 | else if (excode == REG_NOMATCH) { | ||
| 273 | result = STATE_WARNING; | ||
| 274 | printf (_("SMTP %s - Invalid response '%s' to command '%s'\n"), state_text (result), buffer, commands[n]); | ||
| 275 | } | ||
| 276 | else { | ||
| 277 | regerror (excode, &preg, errbuf, MAX_INPUT_BUFFER); | ||
| 278 | printf (_("Execute Error: %s\n"), errbuf); | ||
| 279 | result = STATE_UNKNOWN; | ||
| 280 | } | ||
| 281 | #else | ||
| 282 | if (strstr(buffer, responses[n])!=buffer) { | ||
| 283 | result = STATE_WARNING; | ||
| 284 | printf (_("SMTP %s - Invalid response '%s' to command '%s'\n"), state_text (result), buffer, commands[n]); | ||
| 285 | } | ||
| 286 | #endif | ||
| 287 | } | ||
| 288 | n++; | ||
| 289 | } | ||
| 290 | |||
| 291 | /* tell the server we're done */ | ||
| 292 | #ifdef HAVE_SSL | ||
| 293 | if (use_ssl) | ||
| 294 | SSL_write(ssl,SMTP_QUIT, strlen (SMTP_QUIT)); | ||
| 295 | else | ||
| 296 | #endif | ||
| 297 | send (sd, SMTP_QUIT, strlen (SMTP_QUIT), 0); | ||
| 298 | |||
| 299 | /* finally close the connection */ | ||
| 300 | close (sd); | ||
| 301 | } | ||
| 302 | |||
| 303 | /* reset the alarm */ | ||
| 304 | alarm (0); | ||
| 305 | |||
| 306 | microsec = deltime (tv); | ||
| 307 | elapsed_time = (double)microsec / 1.0e6; | ||
| 308 | |||
| 309 | if (result == STATE_OK) { | ||
| 310 | if (check_critical_time && elapsed_time > (double) critical_time) | ||
| 311 | result = STATE_CRITICAL; | ||
| 312 | else if (check_warning_time && elapsed_time > (double) warning_time) | ||
| 313 | result = STATE_WARNING; | ||
| 314 | } | ||
| 315 | |||
| 316 | printf (_("SMTP %s - %.3f sec. response time%s%s|%s\n"), | ||
| 317 | state_text (result), elapsed_time, | ||
| 318 | verbose?", ":"", verbose?buffer:"", | ||
| 319 | fperfdata ("time", elapsed_time, "s", | ||
| 320 | (int)check_warning_time, warning_time, | ||
| 321 | (int)check_critical_time, critical_time, | ||
| 322 | TRUE, 0, FALSE, 0)); | ||
| 323 | |||
| 324 | return result; | ||
| 325 | } | ||
| 326 | |||
| 327 | |||
| 328 | |||
| 329 | /* process command-line arguments */ | ||
| 330 | int | ||
| 331 | process_arguments (int argc, char **argv) | ||
| 332 | { | ||
| 333 | int c; | ||
| 334 | |||
| 335 | int option = 0; | ||
| 336 | static struct option longopts[] = { | ||
| 337 | {"hostname", required_argument, 0, 'H'}, | ||
| 338 | {"expect", required_argument, 0, 'e'}, | ||
| 339 | {"critical", required_argument, 0, 'c'}, | ||
| 340 | {"warning", required_argument, 0, 'w'}, | ||
| 341 | {"timeout", required_argument, 0, 't'}, | ||
| 342 | {"port", required_argument, 0, 'p'}, | ||
| 343 | {"from", required_argument, 0, 'f'}, | ||
| 344 | {"command", required_argument, 0, 'C'}, | ||
| 345 | {"response", required_argument, 0, 'R'}, | ||
| 346 | {"nocommand", required_argument, 0, 'n'}, | ||
| 347 | {"verbose", no_argument, 0, 'v'}, | ||
| 348 | {"version", no_argument, 0, 'V'}, | ||
| 349 | {"use-ipv4", no_argument, 0, '4'}, | ||
| 350 | {"use-ipv6", no_argument, 0, '6'}, | ||
| 351 | {"help", no_argument, 0, 'h'}, | ||
| 352 | {"starttls",no_argument,0,'S'}, | ||
| 353 | {"certificate",required_argument,0,'D'}, | ||
| 354 | {0, 0, 0, 0} | ||
| 355 | }; | ||
| 356 | |||
| 357 | if (argc < 2) | ||
| 358 | return ERROR; | ||
| 359 | |||
| 360 | for (c = 1; c < argc; c++) { | ||
| 361 | if (strcmp ("-to", argv[c]) == 0) | ||
| 362 | strcpy (argv[c], "-t"); | ||
| 363 | else if (strcmp ("-wt", argv[c]) == 0) | ||
| 364 | strcpy (argv[c], "-w"); | ||
| 365 | else if (strcmp ("-ct", argv[c]) == 0) | ||
| 366 | strcpy (argv[c], "-c"); | ||
| 367 | } | ||
| 368 | |||
| 369 | while (1) { | ||
| 370 | c = getopt_long (argc, argv, "+hVv46t:p:f:e:c:w:H:C:R:SD:", | ||
| 371 | longopts, &option); | ||
| 372 | |||
| 373 | if (c == -1 || c == EOF) | ||
| 374 | break; | ||
| 375 | |||
| 376 | switch (c) { | ||
| 377 | case 'H': /* hostname */ | ||
| 378 | if (is_host (optarg)) { | ||
| 379 | server_address = optarg; | ||
| 380 | } | ||
| 381 | else { | ||
| 382 | usage2 (_("Invalid hostname/address"), optarg); | ||
| 383 | } | ||
| 384 | break; | ||
| 385 | case 'p': /* port */ | ||
| 386 | if (is_intpos (optarg)) | ||
| 387 | server_port = atoi (optarg); | ||
| 388 | else | ||
| 389 | usage4 (_("Port must be a positive integer")); | ||
| 390 | break; | ||
| 391 | case 'f': /* from argument */ | ||
| 392 | from_arg = optarg; | ||
| 393 | smtp_use_dummycmd = 1; | ||
| 394 | break; | ||
| 395 | case 'e': /* server expect string on 220 */ | ||
| 396 | server_expect = optarg; | ||
| 397 | break; | ||
| 398 | case 'C': /* commands */ | ||
| 399 | if (ncommands >= command_size) { | ||
| 400 | commands = realloc (commands, command_size+8); | ||
| 401 | if (commands == NULL) | ||
| 402 | die (STATE_UNKNOWN, | ||
| 403 | _("Could not realloc() units [%d]\n"), ncommands); | ||
| 404 | } | ||
| 405 | commands[ncommands] = optarg; | ||
| 406 | ncommands++; | ||
| 407 | break; | ||
| 408 | case 'R': /* server responses */ | ||
| 409 | if (nresponses >= response_size) { | ||
| 410 | responses = realloc (responses, response_size+8); | ||
| 411 | if (responses == NULL) | ||
| 412 | die (STATE_UNKNOWN, | ||
| 413 | _("Could not realloc() units [%d]\n"), nresponses); | ||
| 414 | } | ||
| 415 | responses[nresponses] = optarg; | ||
| 416 | nresponses++; | ||
| 417 | break; | ||
| 418 | case 'c': /* critical time threshold */ | ||
| 419 | if (is_intnonneg (optarg)) { | ||
| 420 | critical_time = atoi (optarg); | ||
| 421 | check_critical_time = TRUE; | ||
| 422 | } | ||
| 423 | else { | ||
| 424 | usage4 (_("Critical time must be a positive integer")); | ||
| 425 | } | ||
| 426 | break; | ||
| 427 | case 'w': /* warning time threshold */ | ||
| 428 | if (is_intnonneg (optarg)) { | ||
| 429 | warning_time = atoi (optarg); | ||
| 430 | check_warning_time = TRUE; | ||
| 431 | } | ||
| 432 | else { | ||
| 433 | usage4 (_("Warning time must be a positive integer")); | ||
| 434 | } | ||
| 435 | break; | ||
| 436 | case 'v': /* verbose */ | ||
| 437 | verbose++; | ||
| 438 | break; | ||
| 439 | case 't': /* timeout */ | ||
| 440 | if (is_intnonneg (optarg)) { | ||
| 441 | socket_timeout = atoi (optarg); | ||
| 442 | } | ||
| 443 | else { | ||
| 444 | usage4 (_("Timeout interval must be a positive integer")); | ||
| 445 | } | ||
| 446 | break; | ||
| 447 | case 'S': | ||
| 448 | /* starttls */ | ||
| 449 | use_ssl = TRUE; | ||
| 450 | break; | ||
| 451 | case 'D': | ||
| 452 | /* Check SSL cert validity */ | ||
| 453 | #ifdef HAVE_SSL | ||
| 454 | if (!is_intnonneg (optarg)) | ||
| 455 | usage2 ("Invalid certificate expiration period",optarg); | ||
| 456 | days_till_exp = atoi (optarg); | ||
| 457 | check_cert = TRUE; | ||
| 458 | #else | ||
| 459 | usage (_("SSL support not available - install OpenSSL and recompile")); | ||
| 460 | #endif | ||
| 461 | break; | ||
| 462 | case '4': | ||
| 463 | address_family = AF_INET; | ||
| 464 | break; | ||
| 465 | case '6': | ||
| 466 | #ifdef USE_IPV6 | ||
| 467 | address_family = AF_INET6; | ||
| 468 | #else | ||
| 469 | usage4 (_("IPv6 support not available")); | ||
| 470 | #endif | ||
| 471 | break; | ||
| 472 | case 'V': /* version */ | ||
| 473 | print_revision (progname, revision); | ||
| 474 | exit (STATE_OK); | ||
| 475 | case 'h': /* help */ | ||
| 476 | print_help (); | ||
| 477 | exit (STATE_OK); | ||
| 478 | case '?': /* help */ | ||
| 479 | usage2 (_("Unknown argument"), optarg); | ||
| 480 | } | ||
| 481 | } | ||
| 482 | |||
| 483 | c = optind; | ||
| 484 | if (server_address == NULL) { | ||
| 485 | if (argv[c]) { | ||
| 486 | if (is_host (argv[c])) | ||
| 487 | server_address = argv[c]; | ||
| 488 | else | ||
| 489 | usage2 (_("Invalid hostname/address"), argv[c]); | ||
| 490 | } | ||
| 491 | else { | ||
| 492 | asprintf (&server_address, "127.0.0.1"); | ||
| 493 | } | ||
| 494 | } | ||
| 495 | |||
| 496 | if (server_expect == NULL) | ||
| 497 | server_expect = strdup (SMTP_EXPECT); | ||
| 498 | |||
| 499 | if (mail_command == NULL) | ||
| 500 | mail_command = strdup("MAIL "); | ||
| 501 | |||
| 502 | if (from_arg==NULL) | ||
| 503 | from_arg = strdup(" "); | ||
| 504 | |||
| 505 | return validate_arguments (); | ||
| 506 | } | ||
| 507 | |||
| 508 | |||
| 509 | |||
| 510 | int | ||
| 511 | validate_arguments (void) | ||
| 512 | { | ||
| 513 | return OK; | ||
| 514 | } | ||
| 515 | |||
| 516 | |||
| 517 | |||
| 518 | void | ||
| 519 | print_help (void) | ||
| 520 | { | ||
| 521 | char *myport; | ||
| 522 | asprintf (&myport, "%d", SMTP_PORT); | ||
| 523 | |||
| 524 | print_revision (progname, revision); | ||
| 525 | |||
| 526 | printf ("Copyright (c) 1999-2001 Ethan Galstad <nagios@nagios.org>\n"); | ||
| 527 | printf (COPYRIGHT, copyright, email); | ||
| 528 | |||
| 529 | printf(_("This plugin will attempt to open an SMTP connection with the host.\n\n")); | ||
| 530 | |||
| 531 | print_usage (); | ||
| 532 | |||
| 533 | printf (_(UT_HELP_VRSN)); | ||
| 534 | |||
| 535 | printf (_(UT_HOST_PORT), 'p', myport); | ||
| 536 | |||
| 537 | printf (_(UT_IPv46)); | ||
| 538 | |||
| 539 | printf (_("\ | ||
| 540 | -e, --expect=STRING\n\ | ||
| 541 | String to expect in first line of server response (default: '%s')\n\ | ||
| 542 | -n, nocommand\n\ | ||
| 543 | Suppress SMTP command\n\ | ||
| 544 | -C, --command=STRING\n\ | ||
| 545 | SMTP command (may be used repeatedly)\n\ | ||
| 546 | -R, --command=STRING\n\ | ||
| 547 | Expected response to command (may be used repeatedly)\n\ | ||
| 548 | -f, --from=STRING\n\ | ||
| 549 | FROM-address to include in MAIL command, required by Exchange 2000\n"), | ||
| 550 | SMTP_EXPECT); | ||
| 551 | #ifdef HAVE_SSL | ||
| 552 | printf (_("\ | ||
| 553 | -D, --certificate=INTEGER\n\ | ||
| 554 | Minimum number of days a certificate has to be valid.\n\ | ||
| 555 | -S, --starttls\n\ | ||
| 556 | Use STARTTLS for the connection.\n")); | ||
| 557 | #endif | ||
| 558 | |||
| 559 | printf (_(UT_WARN_CRIT)); | ||
| 560 | |||
| 561 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
| 562 | |||
| 563 | printf (_(UT_VERBOSE)); | ||
| 564 | |||
| 565 | printf(_("\n\ | ||
| 566 | Successul connects return STATE_OK, refusals and timeouts return\n\ | ||
| 567 | STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful\n\ | ||
| 568 | connects, but incorrect reponse messages from the host result in\n\ | ||
| 569 | STATE_WARNING return values.\n")); | ||
| 570 | |||
| 571 | printf (_(UT_SUPPORT)); | ||
| 572 | } | ||
| 573 | |||
| 574 | |||
| 575 | |||
| 576 | void | ||
| 577 | print_usage (void) | ||
| 578 | { | ||
| 579 | printf ("\ | ||
| 580 | Usage: %s -H host [-p port] [-e expect] [-C command] [-f from addr]\n\ | ||
| 581 | [-w warn] [-c crit] [-t timeout] [-S] [-D days] [-n] [-v] [-4|-6]\n", progname); | ||
| 582 | } | ||
| 583 | |||
| 584 | #ifdef HAVE_SSL | ||
| 585 | int | ||
| 586 | connect_STARTTLS (void) | ||
| 587 | { | ||
| 588 | SSL_METHOD *meth; | ||
| 589 | |||
| 590 | /* Initialize SSL context */ | ||
| 591 | SSLeay_add_ssl_algorithms (); | ||
| 592 | meth = SSLv2_client_method (); | ||
| 593 | SSL_load_error_strings (); | ||
| 594 | if ((ctx = SSL_CTX_new (meth)) == NULL) | ||
| 595 | { | ||
| 596 | printf(_("CRITICAL - Cannot create SSL context.\n")); | ||
| 597 | return STATE_CRITICAL; | ||
| 598 | } | ||
| 599 | /* do the SSL handshake */ | ||
| 600 | if ((ssl = SSL_new (ctx)) != NULL) | ||
| 601 | { | ||
| 602 | SSL_set_fd (ssl, sd); | ||
| 603 | /* original version checked for -1 | ||
| 604 | I look for success instead (1) */ | ||
| 605 | if (SSL_connect (ssl) == 1) | ||
| 606 | return OK; | ||
| 607 | ERR_print_errors_fp (stderr); | ||
| 608 | } | ||
| 609 | else | ||
| 610 | { | ||
| 611 | printf (_("CRITICAL - Cannot initiate SSL handshake.\n")); | ||
| 612 | } | ||
| 613 | /* this causes a seg faul | ||
| 614 | not sure why, being sloppy | ||
| 615 | and commenting it out */ | ||
| 616 | // SSL_free (ssl); | ||
| 617 | SSL_CTX_free(ctx); | ||
| 618 | my_close(); | ||
| 619 | |||
| 620 | return STATE_CRITICAL; | ||
| 621 | } | ||
| 622 | |||
| 623 | int | ||
| 624 | check_certificate (X509 ** certificate) | ||
| 625 | { | ||
| 626 | ASN1_STRING *tm; | ||
| 627 | int offset; | ||
| 628 | struct tm stamp; | ||
| 629 | int days_left; | ||
| 630 | |||
| 631 | /* Retrieve timestamp of certificate */ | ||
| 632 | tm = X509_get_notAfter (*certificate); | ||
| 633 | |||
| 634 | /* Generate tm structure to process timestamp */ | ||
| 635 | if (tm->type == V_ASN1_UTCTIME) { | ||
| 636 | if (tm->length < 10) { | ||
| 637 | printf (_("CRITICAL - Wrong time format in certificate.\n")); | ||
| 638 | return STATE_CRITICAL; | ||
| 639 | } | ||
| 640 | else { | ||
| 641 | stamp.tm_year = (tm->data[0] - '0') * 10 + (tm->data[1] - '0'); | ||
| 642 | if (stamp.tm_year < 50) | ||
| 643 | stamp.tm_year += 100; | ||
| 644 | offset = 0; | ||
| 645 | } | ||
| 646 | } | ||
| 647 | else { | ||
| 648 | if (tm->length < 12) { | ||
| 649 | printf (_("CRITICAL - Wrong time format in certificate.\n")); | ||
| 650 | return STATE_CRITICAL; | ||
| 651 | } | ||
| 652 | else { | ||
| 653 | stamp.tm_year = | ||
| 654 | (tm->data[0] - '0') * 1000 + (tm->data[1] - '0') * 100 + | ||
| 655 | (tm->data[2] - '0') * 10 + (tm->data[3] - '0'); | ||
| 656 | stamp.tm_year -= 1900; | ||
| 657 | offset = 2; | ||
| 658 | } | ||
| 659 | } | ||
| 660 | stamp.tm_mon = | ||
| 661 | (tm->data[2 + offset] - '0') * 10 + (tm->data[3 + offset] - '0') - 1; | ||
| 662 | stamp.tm_mday = | ||
| 663 | (tm->data[4 + offset] - '0') * 10 + (tm->data[5 + offset] - '0'); | ||
| 664 | stamp.tm_hour = | ||
| 665 | (tm->data[6 + offset] - '0') * 10 + (tm->data[7 + offset] - '0'); | ||
| 666 | stamp.tm_min = | ||
| 667 | (tm->data[8 + offset] - '0') * 10 + (tm->data[9 + offset] - '0'); | ||
| 668 | stamp.tm_sec = 0; | ||
| 669 | stamp.tm_isdst = -1; | ||
| 670 | |||
| 671 | days_left = (mktime (&stamp) - time (NULL)) / 86400; | ||
| 672 | snprintf | ||
| 673 | (timestamp, 16, "%02d/%02d/%04d %02d:%02d", | ||
| 674 | stamp.tm_mon + 1, | ||
| 675 | stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min); | ||
| 676 | |||
| 677 | if (days_left > 0 && days_left <= days_till_exp) { | ||
| 678 | printf ("Certificate expires in %d day(s) (%s).\n", days_left, timestamp); | ||
| 679 | return STATE_WARNING; | ||
| 680 | } | ||
| 681 | if (days_left < 0) { | ||
| 682 | printf ("Certificate expired on %s.\n", timestamp); | ||
| 683 | return STATE_CRITICAL; | ||
| 684 | } | ||
| 685 | |||
| 686 | if (days_left == 0) { | ||
| 687 | printf ("Certificate expires today (%s).\n", timestamp); | ||
| 688 | return STATE_WARNING; | ||
| 689 | } | ||
| 690 | |||
| 691 | printf ("Certificate will expire on %s.\n", timestamp); | ||
| 692 | |||
| 693 | return STATE_OK; | ||
| 694 | } | ||
| 695 | #endif | ||
| 696 | |||
| 697 | int | ||
| 698 | myrecv (void) | ||
| 699 | { | ||
| 700 | int i; | ||
| 701 | |||
| 702 | #ifdef HAVE_SSL | ||
| 703 | if (use_ssl) { | ||
| 704 | i = SSL_read (ssl, buffer, MAXBUF - 1); | ||
| 705 | } | ||
| 706 | else { | ||
| 707 | #endif | ||
| 708 | i = read (sd, buffer, MAXBUF - 1); | ||
| 709 | #ifdef HAVE_SSL | ||
| 710 | } | ||
| 711 | #endif | ||
| 712 | return i; | ||
| 713 | } | ||
| 714 | |||
| 715 | int | ||
| 716 | myrecv_norm (void) | ||
| 717 | { | ||
| 718 | int i; | ||
| 719 | i = read (sd, buffer, MAXBUF - 1); | ||
| 720 | return i; | ||
| 721 | } | ||
| 722 | |||
| 723 | int | ||
| 724 | my_close (void) | ||
| 725 | { | ||
| 726 | #ifdef HAVE_SSL | ||
| 727 | if (use_ssl == TRUE) { | ||
| 728 | SSL_shutdown (ssl); | ||
| 729 | SSL_free (ssl); | ||
| 730 | SSL_CTX_free (ctx); | ||
| 731 | return 0; | ||
| 732 | } | ||
| 733 | else { | ||
| 734 | #endif | ||
| 735 | return close(sd); | ||
| 736 | #ifdef HAVE_SSL | ||
| 737 | } | ||
| 738 | #endif | ||
| 739 | } | ||
diff --git a/web/attachments/129978-allow_empty_passwords b/web/attachments/129978-allow_empty_passwords new file mode 100644 index 0000000..f78f247 --- /dev/null +++ b/web/attachments/129978-allow_empty_passwords | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | --- plugins-scripts/check_disk_smb.pl.old 2005-04-15 16:22:18.000000000 +0200 | ||
| 2 | +++ plugins-scripts/check_disk_smb.pl 2005-04-15 16:25:44.000000000 +0200 | ||
| 3 | @@ -76,7 +76,7 @@ | ||
| 4 | my $user = $1 if ($opt_u =~ /^([-_.A-Za-z0-9\\]+)$/); | ||
| 5 | ($user) || usage("Invalid user: $opt_u\n"); | ||
| 6 | |||
| 7 | -($opt_p) || ($opt_p = shift) || ($opt_p = "guest"); | ||
| 8 | +($opt_p) || ($opt_p = shift) || ($opt_p = ""); | ||
| 9 | my $pass = $1 if ($opt_p =~ /(.*)/); | ||
| 10 | |||
| 11 | ($opt_w) || ($opt_w = shift) || ($opt_w = 85); | ||
| 12 | @@ -123,10 +123,10 @@ | ||
| 13 | # Execute an "ls" on the share using smbclient program | ||
| 14 | # get the results into $res | ||
| 15 | if (defined($workgroup)) { | ||
| 16 | - $res = qx/$smbclient \/\/$host\/$share $pass -W $workgroup -U $user $smbclientoptions -c ls/; | ||
| 17 | + $res = qx/$smbclient \/\/$host\/$share -W $workgroup -U $user%$pass $smbclientoptions -c ls/; | ||
| 18 | } else { | ||
| 19 | print "$smbclient " . "\/\/$host\/$share" ." $pass -U $user $smbclientoptions -c ls\n" if ($verbose); | ||
| 20 | - $res = qx/$smbclient \/\/$host\/$share $pass -U $user $smbclientoptions -c ls/; | ||
| 21 | + $res = qx/$smbclient \/\/$host\/$share -U $user%$pass $smbclientoptions -c ls/; | ||
| 22 | } | ||
| 23 | #Turn off alarm | ||
| 24 | alarm(0); | ||
diff --git a/web/attachments/130855-NPTest-Final.tar.gz b/web/attachments/130855-NPTest-Final.tar.gz new file mode 100644 index 0000000..1426e4f --- /dev/null +++ b/web/attachments/130855-NPTest-Final.tar.gz | |||
| Binary files differ | |||
diff --git a/web/attachments/130858-check_time.c.patch b/web/attachments/130858-check_time.c.patch new file mode 100644 index 0000000..a00fb3d --- /dev/null +++ b/web/attachments/130858-check_time.c.patch | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | *** nagios-plugins-1.4/plugins/check_time.c Sat Dec 25 23:17:44 2004 | ||
| 2 | --- nagios-plugins-1.4-fixed/plugins/check_time.c Fri Apr 8 08:15:56 2005 | ||
| 3 | *************** | ||
| 4 | *** 34,38 **** | ||
| 5 | #define UNIX_EPOCH 2208988800UL | ||
| 6 | |||
| 7 | ! unsigned long server_time, raw_server_time; | ||
| 8 | time_t diff_time; | ||
| 9 | int warning_time = 0; | ||
| 10 | --- 34,38 ---- | ||
| 11 | #define UNIX_EPOCH 2208988800UL | ||
| 12 | |||
| 13 | ! uint32_t server_time, raw_server_time; | ||
| 14 | time_t diff_time; | ||
| 15 | int warning_time = 0; | ||
diff --git a/web/attachments/130868-test.pl b/web/attachments/130868-test.pl new file mode 100644 index 0000000..22d0576 --- /dev/null +++ b/web/attachments/130868-test.pl | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | #!/usr/bin/perl -w -I .. -I ../.. | ||
| 2 | # | ||
| 3 | # Wrapper for running the test harnesses | ||
| 4 | # | ||
| 5 | # $Id$ | ||
| 6 | # | ||
| 7 | |||
| 8 | use strict; | ||
| 9 | |||
| 10 | use Getopt::Long; | ||
| 11 | |||
| 12 | use NPTest qw(DetermineTestHarnessDirectory TestsFrom); | ||
| 13 | |||
| 14 | my $tstdir; | ||
| 15 | |||
| 16 | if ( ! GetOptions( "testdir:s" => \$tstdir ) ) | ||
| 17 | { | ||
| 18 | print "Usage: ${0} [--testdir=<directory>] [<test_harness.t> ...]\n"; | ||
| 19 | exit 1; | ||
| 20 | } | ||
| 21 | |||
| 22 | my @tests; | ||
| 23 | |||
| 24 | if ( scalar( @ARGV ) ) | ||
| 25 | { | ||
| 26 | @tests = @ARGV; | ||
| 27 | } | ||
| 28 | else | ||
| 29 | { | ||
| 30 | my $directory = DetermineTestHarnessDirectory( $tstdir ); | ||
| 31 | |||
| 32 | if ( !defined( $directory ) ) | ||
| 33 | { | ||
| 34 | print STDERR "$0: Unable to determine the test harness directory - ABORTING\n"; | ||
| 35 | exit 2; | ||
| 36 | } | ||
| 37 | |||
| 38 | @tests = TestsFrom( $directory, 1 ); | ||
| 39 | } | ||
| 40 | |||
| 41 | if ( ! scalar( @tests ) ) | ||
| 42 | { | ||
| 43 | print STDERR "$0: Unable to determine the test harnesses to run - ABORTING\n"; | ||
| 44 | exit 3; | ||
| 45 | } | ||
| 46 | |||
| 47 | use Test::Harness; | ||
| 48 | |||
| 49 | #$Test::Harness::verbose=1; | ||
| 50 | |||
| 51 | runtests( @tests ); | ||
diff --git a/web/attachments/131422-diff_check_nt b/web/attachments/131422-diff_check_nt new file mode 100644 index 0000000..6d0865d --- /dev/null +++ b/web/attachments/131422-diff_check_nt | |||
| @@ -0,0 +1,230 @@ | |||
| 1 | --- check_nt.c.original 2005-03-05 04:45:05.000000000 -0500 | ||
| 2 | +++ check_nt.c 2005-04-23 08:35:43.000000000 -0400 | ||
| 3 | @@ -282,111 +282,74 @@ | ||
| 4 | break; | ||
| 5 | |||
| 6 | case CHECK_COUNTER: | ||
| 7 | - | ||
| 8 | - | ||
| 9 | - /* | ||
| 10 | - CHECK_COUNTER has been modified to provide extensive perfdata information. | ||
| 11 | - In order to do this, some modifications have been done to the code | ||
| 12 | - and some constraints have been introduced. | ||
| 13 | - | ||
| 14 | - 1) For the sake of simplicity of the code, perfdata information will only be | ||
| 15 | - provided when the "description" field is added. | ||
| 16 | - | ||
| 17 | - 2) If the counter you're going to measure is percent-based, the code will detect | ||
| 18 | - the percent sign in its name and will attribute minimum (0%) and maximum (100%) | ||
| 19 | - values automagically, as well the %" sign to graph units. | ||
| 20 | - | ||
| 21 | - 3) OTOH, if the counter is "absolute", you'll have to provide the following | ||
| 22 | - the counter unit - that is, the dimensions of the counter you're getting. Examples: | ||
| 23 | - pages/s, packets transferred, etc. | ||
| 24 | - | ||
| 25 | - 4) If you want, you may provide the minimum and maximum values to expect. They aren't mandatory, | ||
| 26 | - but once specified they MUST have the same order of magnitude and units of -w and -c; otherwise. | ||
| 27 | - strange things will happen when you make graphs of your data. | ||
| 28 | - */ | ||
| 29 | - | ||
| 30 | - if (value_list == NULL) | ||
| 31 | - output_message = strdup (_("No counter specified")); | ||
| 32 | - else | ||
| 33 | - { | ||
| 34 | - preparelist (value_list); /* replace , between services with & to send the request */ | ||
| 35 | - isPercent = (strchr (value_list, '%') != NULL); | ||
| 36 | - | ||
| 37 | - strtok (value_list, "&"); /* burn the first parameters */ | ||
| 38 | - description = strtok (NULL, "&"); | ||
| 39 | - counter_unit = strtok (NULL, "&"); | ||
| 40 | - asprintf (&send_buffer, "%s&8&%s", req_password, value_list); | ||
| 41 | - fetch_data (server_address, server_port, send_buffer); | ||
| 42 | - counter_value = atof (recv_buffer); | ||
| 43 | - | ||
| 44 | - | ||
| 45 | - if (description == NULL) | ||
| 46 | - asprintf (&output_message, "%.f", counter_value); | ||
| 47 | - else if (isPercent) | ||
| 48 | - { | ||
| 49 | - counter_unit = strdup ("%"); | ||
| 50 | - allRight = TRUE; | ||
| 51 | - } | ||
| 52 | - | ||
| 53 | - if ((counter_unit != NULL) && (!allRight)) | ||
| 54 | - { | ||
| 55 | - minval = strtok (NULL, "&"); | ||
| 56 | - maxval = strtok (NULL, "&"); | ||
| 57 | - | ||
| 58 | - /* All parameters specified. Let's check the numbers */ | ||
| 59 | - | ||
| 60 | - fminval = (minval != NULL) ? strtod (minval, &errcvt) : -1; | ||
| 61 | - fmaxval = (minval != NULL) ? strtod (maxval, &errcvt) : -1; | ||
| 62 | - | ||
| 63 | - if ((fminval == 0) && (minval == errcvt)) | ||
| 64 | - output_message = strdup (_("Minimum value contains non-numbers")); | ||
| 65 | - else | ||
| 66 | - { | ||
| 67 | - if ((fmaxval == 0) && (maxval == errcvt)) | ||
| 68 | - output_message = strdup (_("Maximum value contains non-numbers")); | ||
| 69 | - else | ||
| 70 | - allRight = TRUE; /* Everything is OK. */ | ||
| 71 | - | ||
| 72 | - } | ||
| 73 | - } | ||
| 74 | - else if ((counter_unit == NULL) && (description != NULL)) | ||
| 75 | - output_message = strdup (_("No unit counter specified")); | ||
| 76 | - | ||
| 77 | - if (allRight) | ||
| 78 | - { | ||
| 79 | - /* Let's format the output string, finally... */ | ||
| 80 | - if (strstr(description, "%") == NULL) { | ||
| 81 | - asprintf (&output_message, "%s = %.2f %s", description, counter_value, counter_unit); | ||
| 82 | - } else { | ||
| 83 | - /* has formatting, will segv if wrong */ | ||
| 84 | - asprintf (&output_message, description, counter_value); | ||
| 85 | - } | ||
| 86 | - asprintf (&output_message, "%s |", output_message); | ||
| 87 | - asprintf (&output_message,"%s %s", output_message, | ||
| 88 | - fperfdata (description, counter_value, | ||
| 89 | - counter_unit, 1, warning_value, 1, critical_value, | ||
| 90 | - (!(isPercent) && (minval != NULL)), fminval, | ||
| 91 | - (!(isPercent) && (minval != NULL)), fmaxval)); | ||
| 92 | - } | ||
| 93 | - } | ||
| 94 | - | ||
| 95 | - if (critical_value > warning_value) | ||
| 96 | - { /* Normal thresholds */ | ||
| 97 | - if (check_critical_value == TRUE && counter_value >= critical_value) | ||
| 98 | - return_code = STATE_CRITICAL; | ||
| 99 | - else if (check_warning_value == TRUE && counter_value >= warning_value) | ||
| 100 | - return_code = STATE_WARNING; | ||
| 101 | - else | ||
| 102 | - return_code = STATE_OK; | ||
| 103 | - } | ||
| 104 | - else | ||
| 105 | - { /* inverse thresholds */ | ||
| 106 | - return_code = STATE_OK; | ||
| 107 | - if (check_critical_value == TRUE && counter_value <= critical_value) | ||
| 108 | - return_code = STATE_CRITICAL; | ||
| 109 | - else if (check_warning_value == TRUE && counter_value <= warning_value) | ||
| 110 | - return_code = STATE_WARNING; | ||
| 111 | - } | ||
| 112 | + /* | ||
| 113 | + * Check_Counter has been rewriten for NC_Net now it processes the pref data in | ||
| 114 | + * a more consistent way to the Nagios plug-in development guidelines. | ||
| 115 | + * 1) if no Units of mesurement use a 0 (zero) for the UOM in the check | ||
| 116 | + * and the units will be omited from the output. | ||
| 117 | + * 2) it will do MIN without a MAX | ||
| 118 | + * 3) still processes custom min and max even if it is % | ||
| 119 | + * 4) % has a default of min 0, max 100 | ||
| 120 | + * 5) -w and -c are no longer causing a seg fault. old code said to always | ||
| 121 | + * process both for perf data, but it should have checked that they were in use. | ||
| 122 | + * 6) the description is only a label for perf data not a formatter... | ||
| 123 | + ****************************************************************************/ | ||
| 124 | + if (value_list == NULL) | ||
| 125 | + output_message = strdup (_("No counter specified")); | ||
| 126 | + else { | ||
| 127 | + preparelist (value_list); /* replace , between services with & to send the request */ | ||
| 128 | + | ||
| 129 | + temp_string = strtok (value_list, "&"); | ||
| 130 | + isPercent = (strchr (temp_string, '%') != NULL); | ||
| 131 | + description = strtok (NULL, "&"); | ||
| 132 | + counter_unit = strtok (NULL, "&"); | ||
| 133 | + asprintf (&send_buffer, "%s&8&%s", req_password, value_list); | ||
| 134 | + fetch_data (server_address, server_port, send_buffer); | ||
| 135 | + counter_value = atof (recv_buffer); | ||
| 136 | + if (isPercent) counter_unit = strdup ("%"); | ||
| 137 | + if ( description != NULL && counter_unit == NULL ) | ||
| 138 | + counter_unit = strdup ( "0" ); | ||
| 139 | + if ( counter_unit != NULL && description != NULL) | ||
| 140 | + { | ||
| 141 | + if ( counter_unit[0] == '0' ) counter_unit[0] = '\0'; | ||
| 142 | + minval = strtok (NULL, "&"); | ||
| 143 | + maxval = strtok (NULL, "&"); | ||
| 144 | + if ( minval == NULL && isPercent ) asprintf(&minval,"0"); | ||
| 145 | + if ( minval != NULL ) fminval = strtod ( minval, NULL ) ; | ||
| 146 | + if ( maxval == NULL && isPercent ) asprintf(&maxval,"100"); | ||
| 147 | + if ( maxval != NULL ) fmaxval = strtod (maxval, NULL); | ||
| 148 | + allRight = TRUE; | ||
| 149 | + /* Let's format the output string, finally... */ | ||
| 150 | + asprintf (&output_message, "%s = %.2f %s", description, counter_value, counter_unit); | ||
| 151 | + asprintf (&output_message,"%s | %s", output_message, | ||
| 152 | + fperfdata (description, counter_value, | ||
| 153 | + counter_unit, check_warning_value, warning_value, | ||
| 154 | + check_critical_value, critical_value, | ||
| 155 | + (minval != NULL), fminval, | ||
| 156 | + (maxval != NULL), fmaxval )); | ||
| 157 | + } | ||
| 158 | + else if (isPercent) | ||
| 159 | + asprintf(&output_message, "%s = %.2f %%",temp_string,counter_value); | ||
| 160 | + else | ||
| 161 | + asprintf(&output_message, "%s = %.2f",temp_string,counter_value); | ||
| 162 | + } | ||
| 163 | + if (critical_value > warning_value) | ||
| 164 | + { /* Normal thresholds */ | ||
| 165 | + if (check_critical_value == TRUE && counter_value >= critical_value) | ||
| 166 | + return_code = STATE_CRITICAL; | ||
| 167 | + else if (check_warning_value == TRUE && counter_value >= warning_value) | ||
| 168 | + return_code = STATE_WARNING; | ||
| 169 | + else | ||
| 170 | + return_code = STATE_OK; | ||
| 171 | + } | ||
| 172 | + else | ||
| 173 | + { /* inverse thresholds */ | ||
| 174 | + return_code = STATE_OK; | ||
| 175 | + if (check_critical_value == TRUE && counter_value <= critical_value) | ||
| 176 | + return_code = STATE_CRITICAL; | ||
| 177 | + else if (check_warning_value == TRUE && counter_value <= warning_value) | ||
| 178 | + return_code = STATE_WARNING; | ||
| 179 | + } | ||
| 180 | break; | ||
| 181 | |||
| 182 | case CHECK_FILEAGE: | ||
| 183 | @@ -394,7 +357,7 @@ | ||
| 184 | if (value_list==NULL) | ||
| 185 | output_message = strdup (_("No counter specified")); | ||
| 186 | else { | ||
| 187 | - preparelist(value_list); /* replace , between services with & to send the request */ | ||
| 188 | + preparelist(value_list); /* replace , between services with & to send the request */ | ||
| 189 | asprintf(&send_buffer,"%s&9&%s", req_password,value_list); | ||
| 190 | fetch_data (server_address, server_port, send_buffer); | ||
| 191 | age_in_minutes = atoi(strtok(recv_buffer,"&")); | ||
| 192 | @@ -672,13 +635,32 @@ | ||
| 193 | printf (_("\ | ||
| 194 | COUNTER = Check any performance counter of Windows NT/2000.\n\ | ||
| 195 | Request a -l parameters with the following syntax:\n\ | ||
| 196 | - -l \"\\\\<performance object>\\\\counter\",\"<description>\n\ | ||
| 197 | - The <description> parameter is optional and \n\ | ||
| 198 | - is given to a printf output command which requires a float parameter.\n\ | ||
| 199 | - If <description> does not include \"%%\", it is used as a label.\n\ | ||
| 200 | + -l \"\\\\<performance object>\\\\counter\"[,\"<Label>\"][,<UOM>][,<MIN>][,<MAX>]\n\ | ||
| 201 | + The <label> parameter is optional and is used for performance data\n\ | ||
| 202 | + If <performance object> includes \"%%\", it automaticlly considers %% performanc data.\n\ | ||
| 203 | + label is the label for performance data\n\ | ||
| 204 | + If the label is omited then the performance counter object will be used.\n\ | ||
| 205 | + UOM - Unit of Measurment -if no UOM use a zero 0, \n\ | ||
| 206 | + a zero tells check_nt to ignore the UOM in the output.\n\ | ||
| 207 | + examples of UOM- s,us,ms,%%,B,KB,MB,TB,c \n\ | ||
| 208 | + c- is for continous counter. \n\ | ||
| 209 | + Min and Max are optional but are used by third party program (RRD) for graphing.\n\ | ||
| 210 | Some examples:\n\ | ||
| 211 | - \"Paging file usage is %%.2f %%%%\"\n\ | ||
| 212 | - \"%%.f %%%% paging file used.\"\n")); | ||
| 213 | + -l \"\\Process(_Total)\\Thread Count\",\"Thread Count\",MB,0,1000 -w 5 -c 700\n\ | ||
| 214 | + Thread Count = 534.00 MB | 'Thread Count'=534.000000MB;5.000000;700.000000;0.000000;1000.000000\n\ | ||
| 215 | + -l \"\\Paging File(_Total)\\%% Usage\"\n\ | ||
| 216 | + \\Paging File(_Total)\\%% Usage = 36.61 %%\n\ | ||
| 217 | + -l \"\\paging file(_total)\\%% usage\"\n\ | ||
| 218 | + \\paging File(_total)\\%% usage = 36.61 %%\n\ | ||
| 219 | + -l \"\\paging file(_total)\\%% usage\",\"test1\"\n\ | ||
| 220 | + test1 = 36.60 % | test1=36.599730%;;;0.000000;100.000000\n\ | ||
| 221 | + -l \"\\paging file(_total)\\%% usage\",\"test1\",%%,20\n\ | ||
| 222 | + test1 = 36.60 % | test1=36.599730%;;;20.000000;100.000000\n\ | ||
| 223 | + -l \"\\Server\\Server Sessions\",\"test SS\",%%\n\ | ||
| 224 | + test SS = 1.00 %% | 'test SS'=1.000000%%;;;\n\ | ||
| 225 | + -l \"\\Server\\Server Sessions\",\"Server Sessions\",0,0,50 -w 20 -c 45\n\ | ||
| 226 | + Server Sessions = 1.00 c | 'Server Sessions'=1.000000;20.000000;45.000000;0.000000;50.000000\n")); | ||
| 227 | + | ||
| 228 | printf (_("Notes:\n\ | ||
| 229 | - The NSClient service should be running on the server to get any information\n\ | ||
| 230 | (http://nsclient.ready2run.nl).\n\ | ||
diff --git a/web/attachments/131931-check_jabber.pl b/web/attachments/131931-check_jabber.pl new file mode 100644 index 0000000..1176441 --- /dev/null +++ b/web/attachments/131931-check_jabber.pl | |||
| @@ -0,0 +1,97 @@ | |||
| 1 | #!/usr/bin/perl -w | ||
| 2 | ################################################################## | ||
| 3 | # CHECK_JABBER.PL | ||
| 4 | # | ||
| 5 | # Jabber Plugin for Nagios | ||
| 6 | # License: GPL | ||
| 7 | # C.Doblado (cdoblado@pulsartec.com) | ||
| 8 | # check_jabber.pl, v1.0 2005/04/27 | ||
| 9 | # | ||
| 10 | ################################################################# | ||
| 11 | |||
| 12 | use strict; | ||
| 13 | use Getopt::Std; | ||
| 14 | use Net::Jabber qw(Client); | ||
| 15 | |||
| 16 | use lib "/usr/lib/nagios/plugins/"; | ||
| 17 | use utils qw($TIMEOUT %ERRORS &print_revision); | ||
| 18 | |||
| 19 | sub CheckJabber; | ||
| 20 | sub Help; | ||
| 21 | |||
| 22 | my $PROGNAME = "check_jabber"; | ||
| 23 | |||
| 24 | |||
| 25 | sub CheckJabber | ||
| 26 | { | ||
| 27 | my $host=shift; | ||
| 28 | my $port=shift; | ||
| 29 | my $result; | ||
| 30 | my $con= new Net::Jabber::Client(); | ||
| 31 | $con->Connect(hostname=>$host,port=>$port); | ||
| 32 | if ($con->Connected()){ | ||
| 33 | $result->{NUM}=1; | ||
| 34 | $result->{MSG}="Jabber server OK at port $port \n"; | ||
| 35 | $con->Disconnect(); | ||
| 36 | } | ||
| 37 | else { | ||
| 38 | $result->{NUM}=0; | ||
| 39 | $result->{MSG}="Jabber server Error at port $port \n"; | ||
| 40 | } | ||
| 41 | return $result; | ||
| 42 | } | ||
| 43 | |||
| 44 | |||
| 45 | sub Help | ||
| 46 | { | ||
| 47 | print_revision($PROGNAME, '$Revision: 1.0 $'); | ||
| 48 | print "\nCheckjabber checks the Jabber server status\n"; | ||
| 49 | print "Usage: checkjabber.pl -s server [-p port -v version -h help] \n"; | ||
| 50 | print " (default port is 5222) \n\n"; | ||
| 51 | } | ||
| 52 | |||
| 53 | |||
| 54 | ##### Main ##### | ||
| 55 | |||
| 56 | # TIMEOUT alarm | ||
| 57 | $SIG{'ALRM'} = sub { | ||
| 58 | print ("ERROR: No response from server (alarm timeout)\n"); | ||
| 59 | exit $ERRORS{"UNKNOWN"}; | ||
| 60 | }; | ||
| 61 | alarm($TIMEOUT); | ||
| 62 | |||
| 63 | |||
| 64 | # Arguments | ||
| 65 | my %options=(); | ||
| 66 | getopts("s:p:h:v",\%options); | ||
| 67 | |||
| 68 | |||
| 69 | # Options | ||
| 70 | if (defined $options{s}){ | ||
| 71 | if (not defined $options{p}){ | ||
| 72 | $options{p}='5222'; # default Jabber port | ||
| 73 | } | ||
| 74 | my $status=CheckJabber($options{s},$options{p}); | ||
| 75 | print "$status->{MSG}\n"; | ||
| 76 | if ($status->{NUM}==1) { | ||
| 77 | exit $ERRORS{"OK"}; | ||
| 78 | } | ||
| 79 | elsif ($status->{NUM}==0) { | ||
| 80 | exit $ERRORS{"CRITICAL"}; | ||
| 81 | } | ||
| 82 | else { | ||
| 83 | exit $ERRORS{"UNKNOWN"}; | ||
| 84 | } | ||
| 85 | } | ||
| 86 | elsif ($options{v}) { | ||
| 87 | print_revision($PROGNAME, '$Revision: 1.0 $'); | ||
| 88 | exit $ERRORS{"UNKNOWN"}; | ||
| 89 | } | ||
| 90 | else { | ||
| 91 | Help; | ||
| 92 | exit $ERRORS{"UNKNOWN"}; | ||
| 93 | } | ||
| 94 | |||
| 95 | |||
| 96 | |||
| 97 | |||
diff --git a/web/attachments/133253-patch.diff b/web/attachments/133253-patch.diff new file mode 100644 index 0000000..373743c --- /dev/null +++ b/web/attachments/133253-patch.diff | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | 115,116c115 | ||
| 2 | < print $dn."\n"; | ||
| 3 | < if ( $resp =~ /($dn)/ ) { | ||
| 4 | --- | ||
| 5 | > if ( $resp =~ /($dn)/i ) { | ||
diff --git a/web/attachments/134273-check_cpu_perfdata.diff b/web/attachments/134273-check_cpu_perfdata.diff new file mode 100644 index 0000000..c841234 --- /dev/null +++ b/web/attachments/134273-check_cpu_perfdata.diff | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | --- check_cpu 2005-05-12 15:26:00.273073312 -0700 | ||
| 2 | +++ check_cpu.orig 2005-05-12 15:26:56.617507656 -0700 | ||
| 3 | @@ -146,25 +146,17 @@ | ||
| 4 | ### state, and exit the plugin. | ||
| 5 | |||
| 6 | |||
| 7 | -# if critical or warning is not set on the command line, then set it to zero | ||
| 8 | -# this keeps the performance data from having negative values for warn and crit | ||
| 9 | -if critical == -2: | ||
| 10 | - critical = 0 | ||
| 11 | -if warning == -1: | ||
| 12 | - warning = 0 | ||
| 13 | - | ||
| 14 | - | ||
| 15 | if idleValue <= critical: | ||
| 16 | status = "CPU CRITICAL" | ||
| 17 | - print status + ": CPU is only " + idleCPU + "% idle | CPU_idle=" + idleCPU +"%;" + `warning` + ";" + `critical` + ";" | ||
| 18 | + print status + ": CPU is only " + idleCPU + "% idle" | ||
| 19 | sys.exit(2) | ||
| 20 | elif idleValue <= warning: | ||
| 21 | status = "WARNING" | ||
| 22 | - print status + ": CPU is only " + idleCPU + "% idle | CPU_idle=" + idleCPU +"%;" + `warning` + ";" + `critical` + ";" | ||
| 23 | + print status + ": CPU is only " + idleCPU + "% idle" | ||
| 24 | sys.exit(1) | ||
| 25 | elif warning < idleValue: | ||
| 26 | status = "OK" | ||
| 27 | - print status + ": CPU is " + idleCPU + "% idle | CPU_idle=" + idleCPU +"%;" + `warning` + ";" + `critical` + ";" | ||
| 28 | + print status + ": CPU is " + idleCPU + "% idle" | ||
| 29 | sys.exit(0) | ||
| 30 | else: | ||
| 31 | status = "CPU STATUS UNKNOWN" | ||
diff --git a/web/attachments/134274-check_mem b/web/attachments/134274-check_mem new file mode 100644 index 0000000..ed13f25 --- /dev/null +++ b/web/attachments/134274-check_mem | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | #!/usr/bin/perl -w | ||
| 2 | # | ||
| 3 | # check_mem v1.0 plugin for nagios | ||
| 4 | # | ||
| 5 | # uses the output of `free` to find the percentage of memory used | ||
| 6 | # | ||
| 7 | # Copyright Notice: GPL | ||
| 8 | # | ||
| 9 | # Garrett Honeycutt - gh@3gupload.com | ||
| 10 | # | ||
| 11 | |||
| 12 | my ($mem_percent) = &sys_stats(); | ||
| 13 | print "$mem_percent\% Memory Used | MemUsed=$mem_percent\%;0;0;\n"; | ||
| 14 | exit(0); | ||
| 15 | |||
| 16 | sub sys_stats { | ||
| 17 | |||
| 18 | my ($mem_total, $mem_used); | ||
| 19 | |||
| 20 | chomp($mem_total = `free -mt | grep Mem | awk '{print \$2}'`); | ||
| 21 | chomp($mem_used = `free -mt | grep cache | tail -1 | awk '{print \$3}'`); | ||
| 22 | |||
| 23 | my $mem_percent = ($mem_used / $mem_total) * 100; | ||
| 24 | |||
| 25 | return (sprintf("%.0f",$mem_percent)); | ||
| 26 | } | ||
diff --git a/web/attachments/135799-nagiosplug-wrapper-macros.diff b/web/attachments/135799-nagiosplug-wrapper-macros.diff new file mode 100644 index 0000000..ce0a0c5 --- /dev/null +++ b/web/attachments/135799-nagiosplug-wrapper-macros.diff | |||
| @@ -0,0 +1,197 @@ | |||
| 1 | diff -urN ../nagiosplug.orig/plugins/netutils.c ./plugins/netutils.c | ||
| 2 | --- ../nagiosplug.orig/plugins/netutils.c 2005-01-05 21:53:22.000000000 +0100 | ||
| 3 | +++ ./plugins/netutils.c 2005-05-24 09:25:09.000000000 +0200 | ||
| 4 | @@ -39,7 +39,6 @@ | ||
| 5 | int was_refused = FALSE; | ||
| 6 | int address_family = AF_UNSPEC; | ||
| 7 | |||
| 8 | -static int my_connect(const char *address, int port, int *sd, int proto); | ||
| 9 | /* handles socket timeouts */ | ||
| 10 | void | ||
| 11 | socket_timeout_alarm_handler (int sig) | ||
| 12 | @@ -53,37 +52,6 @@ | ||
| 13 | } | ||
| 14 | |||
| 15 | |||
| 16 | -/* connects to a host on a specified TCP port, sends a string, | ||
| 17 | - and gets a response */ | ||
| 18 | -int | ||
| 19 | -process_tcp_request (const char *server_address, int server_port, | ||
| 20 | - const char *send_buffer, char *recv_buffer, int recv_size) | ||
| 21 | -{ | ||
| 22 | - int result; | ||
| 23 | - | ||
| 24 | - result = process_request (server_address, server_port, | ||
| 25 | - IPPROTO_TCP, send_buffer, recv_buffer, recv_size); | ||
| 26 | - | ||
| 27 | - return result; | ||
| 28 | -} | ||
| 29 | - | ||
| 30 | - | ||
| 31 | -/* connects to a host on a specified UDP port, sends a string, and gets a | ||
| 32 | - response */ | ||
| 33 | -int | ||
| 34 | -process_udp_request (const char *server_address, int server_port, | ||
| 35 | - const char *send_buffer, char *recv_buffer, int recv_size) | ||
| 36 | -{ | ||
| 37 | - int result; | ||
| 38 | - | ||
| 39 | - result = process_request (server_address, server_port, | ||
| 40 | - IPPROTO_UDP, send_buffer, recv_buffer, recv_size); | ||
| 41 | - | ||
| 42 | - return result; | ||
| 43 | -} | ||
| 44 | - | ||
| 45 | - | ||
| 46 | - | ||
| 47 | /* connects to a host on a specified tcp port, sends a string, and gets a | ||
| 48 | response. loops on select-recv until timeout or eof to get all of a | ||
| 49 | multi-packet answer */ | ||
| 50 | @@ -163,6 +131,7 @@ | ||
| 51 | return result; | ||
| 52 | } | ||
| 53 | |||
| 54 | + | ||
| 55 | /* connects to a host on a specified port, sends a string, and gets a | ||
| 56 | response */ | ||
| 57 | int | ||
| 58 | @@ -186,32 +155,8 @@ | ||
| 59 | } | ||
| 60 | |||
| 61 | |||
| 62 | -/* opens a connection to a remote host/tcp port */ | ||
| 63 | -int | ||
| 64 | -my_tcp_connect (const char *host_name, int port, int *sd) | ||
| 65 | -{ | ||
| 66 | - int result; | ||
| 67 | - | ||
| 68 | - result = my_connect (host_name, port, sd, IPPROTO_TCP); | ||
| 69 | - | ||
| 70 | - return result; | ||
| 71 | -} | ||
| 72 | - | ||
| 73 | - | ||
| 74 | -/* opens a connection to a remote host/udp port */ | ||
| 75 | -int | ||
| 76 | -my_udp_connect (const char *host_name, int port, int *sd) | ||
| 77 | -{ | ||
| 78 | - int result; | ||
| 79 | - | ||
| 80 | - result = my_connect (host_name, port, sd, IPPROTO_UDP); | ||
| 81 | - | ||
| 82 | - return result; | ||
| 83 | -} | ||
| 84 | - | ||
| 85 | - | ||
| 86 | /* opens a tcp or udp connection to a remote host */ | ||
| 87 | -static int | ||
| 88 | +int | ||
| 89 | my_connect (const char *host_name, int port, int *sd, int proto) | ||
| 90 | { | ||
| 91 | struct addrinfo hints; | ||
| 92 | @@ -291,20 +236,6 @@ | ||
| 93 | |||
| 94 | |||
| 95 | int | ||
| 96 | -send_tcp_request (int sd, const char *send_buffer, char *recv_buffer, int recv_size) | ||
| 97 | -{ | ||
| 98 | - return send_request (sd, IPPROTO_TCP, send_buffer, recv_buffer, recv_size); | ||
| 99 | -} | ||
| 100 | - | ||
| 101 | - | ||
| 102 | -int | ||
| 103 | -send_udp_request (int sd, const char *send_buffer, char *recv_buffer, int recv_size) | ||
| 104 | -{ | ||
| 105 | - return send_request (sd, IPPROTO_UDP, send_buffer, recv_buffer, recv_size); | ||
| 106 | -} | ||
| 107 | - | ||
| 108 | - | ||
| 109 | -int | ||
| 110 | send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int recv_size) | ||
| 111 | { | ||
| 112 | int result = STATE_OK; | ||
| 113 | @@ -397,28 +328,3 @@ | ||
| 114 | return TRUE; | ||
| 115 | } | ||
| 116 | } | ||
| 117 | - | ||
| 118 | -int | ||
| 119 | -is_inet_addr (const char *address) | ||
| 120 | -{ | ||
| 121 | - return resolve_host_or_addr (address, AF_INET); | ||
| 122 | -} | ||
| 123 | - | ||
| 124 | -#ifdef USE_IPV6 | ||
| 125 | -int | ||
| 126 | -is_inet6_addr (const char *address) | ||
| 127 | -{ | ||
| 128 | - return resolve_host_or_addr (address, AF_INET6); | ||
| 129 | -} | ||
| 130 | -#endif | ||
| 131 | - | ||
| 132 | -int | ||
| 133 | -is_hostname (const char *s1) | ||
| 134 | -{ | ||
| 135 | -#ifdef USE_IPV6 | ||
| 136 | - return resolve_host_or_addr (s1, address_family); | ||
| 137 | -#else | ||
| 138 | - return resolve_host_or_addr (s1, AF_INET); | ||
| 139 | -#endif | ||
| 140 | -} | ||
| 141 | - | ||
| 142 | diff -urN ../nagiosplug.orig/plugins/netutils.h ./plugins/netutils.h | ||
| 143 | --- ../nagiosplug.orig/plugins/netutils.h 2004-12-02 00:54:51.000000000 +0100 | ||
| 144 | +++ ./plugins/netutils.h 2005-05-24 09:25:35.000000000 +0200 | ||
| 145 | @@ -38,30 +38,40 @@ | ||
| 146 | |||
| 147 | RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn)); | ||
| 148 | |||
| 149 | +/* process_request and wrapper macros */ | ||
| 150 | +#define process_tcp_request(addr, port, sbuf, rbuf, rsize) \ | ||
| 151 | + process_request(addr, port, IPPROTO_TCP, sbuf, rbuf, rsize) | ||
| 152 | +#define process_udp_request(addr, port, sbuf, rbuf, rsize) \ | ||
| 153 | + process_request(addr, port, IPPROTO_UDP, sbuf, rbuf, rsize) | ||
| 154 | int process_tcp_request2 (const char *address, int port, | ||
| 155 | const char *sbuffer, char *rbuffer, int rsize); | ||
| 156 | -int process_tcp_request (const char *address, int port, | ||
| 157 | - const char *sbuffer, char *rbuffer, int rsize); | ||
| 158 | -int process_udp_request (const char *address, int port, | ||
| 159 | - const char *sbuffer, char *rbuffer, int rsize); | ||
| 160 | int process_request (const char *address, int port, int proto, | ||
| 161 | const char *sbuffer, char *rbuffer, int rsize); | ||
| 162 | |||
| 163 | -int my_tcp_connect (const char *address, int port, int *sd); | ||
| 164 | -int my_udp_connect (const char *address, int port, int *sd); | ||
| 165 | - | ||
| 166 | -int send_tcp_request (int sd, const char *send_buffer, char *recv_buffer, int recv_size); | ||
| 167 | -int send_udp_request (int sd, const char *send_buffer, char *recv_buffer, int recv_size); | ||
| 168 | +/* my_connect and wrapper macros */ | ||
| 169 | +#define my_tcp_connect(addr, port, s) my_connect(addr, port, s, IPPROTO_TCP) | ||
| 170 | +#define my_udp_connect(addr, port, s) my_connect(addr, port, s, IPPROTO_UDP) | ||
| 171 | +int my_connect(const char *address, int port, int *sd, int proto); | ||
| 172 | + | ||
| 173 | +/* send_request and wrapper macros */ | ||
| 174 | +#define send_tcp_request(s, sbuf, rbuf, rsize) \ | ||
| 175 | + send_request(s, IPPROTO_TCP, sbuf, rbuf, rsize) | ||
| 176 | +#define send_udp_request(s, sbuf, rbuf, rsize) \ | ||
| 177 | + send_request(s, IPPROTO_UDP, sbuf, rbuf, rsize) | ||
| 178 | int send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int recv_size); | ||
| 179 | |||
| 180 | + | ||
| 181 | +/* "is_*" wrapper macros and functions */ | ||
| 182 | int is_host (const char *); | ||
| 183 | int is_addr (const char *); | ||
| 184 | int resolve_host_or_addr (const char *, int); | ||
| 185 | -int is_inet_addr (const char *); | ||
| 186 | +#define is_inet_addr(addr) resolve_host_or_addr(addr, AF_INET) | ||
| 187 | #ifdef USE_IPV6 | ||
| 188 | -int is_inet6_addr (const char *); | ||
| 189 | +# define is_inet6_addr(addr) resolve_host_or_addr(addr, AF_INET6) | ||
| 190 | +# define is_hostname(addr) resolve_host_or_addr(addr, address_family) | ||
| 191 | +#else | ||
| 192 | +# define is_hostname(addr) resolve_host_or_addr(addr, AF_INET) | ||
| 193 | #endif | ||
| 194 | -int is_hostname (const char *); | ||
| 195 | |||
| 196 | extern unsigned int socket_timeout; | ||
| 197 | extern int econn_refuse_state; | ||
diff --git a/web/attachments/135800-nagiosplug-check_tcp-protocol.diff b/web/attachments/135800-nagiosplug-check_tcp-protocol.diff new file mode 100644 index 0000000..ea63efb --- /dev/null +++ b/web/attachments/135800-nagiosplug-check_tcp-protocol.diff | |||
| @@ -0,0 +1,139 @@ | |||
| 1 | diff -urN ../orig.nplg/plugins/check_tcp.c ./plugins/check_tcp.c | ||
| 2 | --- ../orig.nplg/plugins/check_tcp.c 2005-05-23 21:55:06.000000000 +0200 | ||
| 3 | +++ ./plugins/check_tcp.c 2005-05-24 21:13:43.000000000 +0200 | ||
| 4 | @@ -57,11 +57,7 @@ | ||
| 5 | int check_certificate (X509 **); | ||
| 6 | #endif | ||
| 7 | |||
| 8 | -enum { | ||
| 9 | - TCP_PROTOCOL = 1, | ||
| 10 | - UDP_PROTOCOL = 2, | ||
| 11 | - MAXBUF = 1024 | ||
| 12 | -}; | ||
| 13 | +#define MAXBUF 1024 | ||
| 14 | |||
| 15 | int process_arguments (int, char **); | ||
| 16 | int my_recv (void); | ||
| 17 | @@ -120,7 +116,7 @@ | ||
| 18 | SEND = NULL; | ||
| 19 | EXPECT = NULL; | ||
| 20 | QUIT = NULL; | ||
| 21 | - PROTOCOL = UDP_PROTOCOL; | ||
| 22 | + PROTOCOL = IPPROTO_UDP; | ||
| 23 | PORT = 0; | ||
| 24 | } | ||
| 25 | else if (strstr (argv[0], "check_tcp")) { | ||
| 26 | @@ -129,7 +125,7 @@ | ||
| 27 | SEND = NULL; | ||
| 28 | EXPECT = NULL; | ||
| 29 | QUIT = NULL; | ||
| 30 | - PROTOCOL = TCP_PROTOCOL; | ||
| 31 | + PROTOCOL = IPPROTO_TCP; | ||
| 32 | PORT = 0; | ||
| 33 | } | ||
| 34 | else if (strstr (argv[0], "check_ftp")) { | ||
| 35 | @@ -138,7 +134,7 @@ | ||
| 36 | SEND = NULL; | ||
| 37 | EXPECT = strdup ("220"); | ||
| 38 | QUIT = strdup ("QUIT\r\n"); | ||
| 39 | - PROTOCOL = TCP_PROTOCOL; | ||
| 40 | + PROTOCOL = IPPROTO_TCP; | ||
| 41 | PORT = 21; | ||
| 42 | } | ||
| 43 | else if (strstr (argv[0], "check_smtp")) { | ||
| 44 | @@ -147,7 +143,7 @@ | ||
| 45 | SEND = NULL; | ||
| 46 | EXPECT = strdup ("220"); | ||
| 47 | QUIT = strdup ("QUIT\r\n"); | ||
| 48 | - PROTOCOL = TCP_PROTOCOL; | ||
| 49 | + PROTOCOL = IPPROTO_TCP; | ||
| 50 | PORT = 25; | ||
| 51 | } | ||
| 52 | else if (strstr (argv[0], "check_pop")) { | ||
| 53 | @@ -156,7 +152,7 @@ | ||
| 54 | SEND = NULL; | ||
| 55 | EXPECT = strdup ("+OK"); | ||
| 56 | QUIT = strdup ("QUIT\r\n"); | ||
| 57 | - PROTOCOL = TCP_PROTOCOL; | ||
| 58 | + PROTOCOL = IPPROTO_TCP; | ||
| 59 | PORT = 110; | ||
| 60 | } | ||
| 61 | else if (strstr (argv[0], "check_imap")) { | ||
| 62 | @@ -165,7 +161,7 @@ | ||
| 63 | SEND = NULL; | ||
| 64 | EXPECT = strdup ("* OK"); | ||
| 65 | QUIT = strdup ("a1 LOGOUT\r\n"); | ||
| 66 | - PROTOCOL = TCP_PROTOCOL; | ||
| 67 | + PROTOCOL = IPPROTO_TCP; | ||
| 68 | PORT = 143; | ||
| 69 | } | ||
| 70 | #ifdef HAVE_SSL | ||
| 71 | @@ -175,7 +171,7 @@ | ||
| 72 | SEND=NULL; | ||
| 73 | EXPECT = strdup ("* OK"); | ||
| 74 | QUIT = strdup ("a1 LOGOUT\r\n"); | ||
| 75 | - PROTOCOL=TCP_PROTOCOL; | ||
| 76 | + PROTOCOL=IPPROTO_TCP; | ||
| 77 | use_ssl=TRUE; | ||
| 78 | PORT=993; | ||
| 79 | } | ||
| 80 | @@ -185,7 +181,7 @@ | ||
| 81 | SEND=NULL; | ||
| 82 | EXPECT = strdup ("+OK"); | ||
| 83 | QUIT = strdup ("QUIT\r\n"); | ||
| 84 | - PROTOCOL=TCP_PROTOCOL; | ||
| 85 | + PROTOCOL=IPPROTO_TCP; | ||
| 86 | use_ssl=TRUE; | ||
| 87 | PORT=995; | ||
| 88 | } | ||
| 89 | @@ -195,7 +191,7 @@ | ||
| 90 | SEND=NULL; | ||
| 91 | EXPECT = strdup ("220"); | ||
| 92 | QUIT = strdup ("QUIT\r\n"); | ||
| 93 | - PROTOCOL=TCP_PROTOCOL; | ||
| 94 | + PROTOCOL=IPPROTO_TCP; | ||
| 95 | use_ssl=TRUE; | ||
| 96 | PORT=465; | ||
| 97 | } | ||
| 98 | @@ -205,7 +201,7 @@ | ||
| 99 | SEND = strdup("<stream:stream to=\'host\' xmlns=\'jabber:client\' xmlns:stream=\'http://etherx.jabber.org/streams\'>\n"); | ||
| 100 | EXPECT = strdup("<?xml version=\'1.0\'?><stream:stream xmlns:stream=\'http://etherx.jabber.org/streams\'"); | ||
| 101 | QUIT = strdup("</stream:stream>\n"); | ||
| 102 | - PROTOCOL=TCP_PROTOCOL; | ||
| 103 | + PROTOCOL=IPPROTO_TCP; | ||
| 104 | use_ssl=TRUE; | ||
| 105 | PORT = 5222; | ||
| 106 | } | ||
| 107 | @@ -219,7 +215,7 @@ | ||
| 108 | server_expect = realloc (server_expect, ++server_expect_count); | ||
| 109 | asprintf (&server_expect[server_expect_count - 1], "201"); | ||
| 110 | QUIT = strdup("QUIT\r\n"); | ||
| 111 | - PROTOCOL = TCP_PROTOCOL; | ||
| 112 | + PROTOCOL = IPPROTO_TCP; | ||
| 113 | use_ssl=TRUE; | ||
| 114 | PORT = 563; | ||
| 115 | } | ||
| 116 | @@ -235,7 +231,7 @@ | ||
| 117 | server_expect = realloc (server_expect, sizeof (char *) * (++server_expect_count)); | ||
| 118 | asprintf (&server_expect[server_expect_count - 1], "201"); | ||
| 119 | asprintf (&QUIT, "QUIT\r\n"); | ||
| 120 | - PROTOCOL = TCP_PROTOCOL; | ||
| 121 | + PROTOCOL = IPPROTO_TCP; | ||
| 122 | PORT = 119; | ||
| 123 | } | ||
| 124 | else { | ||
| 125 | @@ -288,13 +284,7 @@ | ||
| 126 | result = connect_SSL (); | ||
| 127 | else | ||
| 128 | #endif | ||
| 129 | - { | ||
| 130 | - if (PROTOCOL == UDP_PROTOCOL) | ||
| 131 | - result = my_udp_connect (server_address, server_port, &sd); | ||
| 132 | - else | ||
| 133 | - /* default is TCP */ | ||
| 134 | - result = my_tcp_connect (server_address, server_port, &sd); | ||
| 135 | - } | ||
| 136 | + result = my_connect (server_address, server_port, &sd, PROTOCOL); | ||
| 137 | |||
| 138 | if (result == STATE_CRITICAL) | ||
| 139 | return STATE_CRITICAL; | ||
diff --git a/web/attachments/136223-nagiosplug-check_load.diff b/web/attachments/136223-nagiosplug-check_load.diff new file mode 100644 index 0000000..fcccf43 --- /dev/null +++ b/web/attachments/136223-nagiosplug-check_load.diff | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-3 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378820797" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378820797" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378820797" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378820797" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378820797'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1209978&group_id=29880&atid=397599&file_id=136223" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/136226-nagiosplug-check_load.diff b/web/attachments/136226-nagiosplug-check_load.diff new file mode 100644 index 0000000..2330ab4 --- /dev/null +++ b/web/attachments/136226-nagiosplug-check_load.diff | |||
| @@ -0,0 +1,311 @@ | |||
| 1 | diff -urN ../orig.nplg/plugins/check_load.c ./plugins/check_load.c | ||
| 2 | --- ../orig.nplg/plugins/check_load.c 2005-05-27 15:56:34.000000000 +0200 | ||
| 3 | +++ ./plugins/check_load.c 2005-05-27 18:04:50.000000000 +0200 | ||
| 4 | @@ -39,37 +39,64 @@ | ||
| 5 | #endif /* !defined LOADAVG_1MIN */ | ||
| 6 | |||
| 7 | |||
| 8 | -int process_arguments (int argc, char **argv); | ||
| 9 | -int validate_arguments (void); | ||
| 10 | +static int process_arguments (int argc, char **argv); | ||
| 11 | +static int validate_arguments (void); | ||
| 12 | void print_help (void); | ||
| 13 | void print_usage (void); | ||
| 14 | |||
| 15 | -float wload1 = -1, wload5 = -1, wload15 = -1; | ||
| 16 | -float cload1 = -1, cload5 = -1, cload15 = -1; | ||
| 17 | +/* strictly for pretty-print usage in loops */ | ||
| 18 | +static const int nums[3] = { 1, 5, 15 }; | ||
| 19 | + | ||
| 20 | +/* provide some fairly sane defaults */ | ||
| 21 | +double wload[3] = { 0.0, 0.0, 0.0 }; | ||
| 22 | +double cload[3] = { 0.0, 0.0, 0.0 }; | ||
| 23 | +#define la1 la[0] | ||
| 24 | +#define la5 la[1] | ||
| 25 | +#define la15 la[2] | ||
| 26 | |||
| 27 | char *status_line; | ||
| 28 | |||
| 29 | +static void | ||
| 30 | +get_threshold(char *arg, double *th) | ||
| 31 | +{ | ||
| 32 | + size_t i, n; | ||
| 33 | + char *str = arg, *p; | ||
| 34 | + | ||
| 35 | + n = strlen(arg); | ||
| 36 | + for(i = 0; i < 3; i++) { | ||
| 37 | + th[i] = strtod(str, &p); | ||
| 38 | + if(p == str) break; | ||
| 39 | + | ||
| 40 | + str = p + 1; | ||
| 41 | + if(n <= (size_t)(str - arg)) break; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + /* empty argument or non-floatish, so warn about it and die */ | ||
| 45 | + if(!i) usage (_("Warning threshold must be float or float triplet!\n")); | ||
| 46 | + | ||
| 47 | + if(i != 2) { | ||
| 48 | + /* one or more numbers were given, so fill array with last | ||
| 49 | + * we got (most likely to NOT produce the least expected result) */ | ||
| 50 | + for(n = i; n < 3; n++) th[n] = th[i]; | ||
| 51 | + } | ||
| 52 | +} | ||
| 53 | |||
| 54 | |||
| 55 | int | ||
| 56 | main (int argc, char **argv) | ||
| 57 | { | ||
| 58 | - int result = STATE_UNKNOWN; | ||
| 59 | - | ||
| 60 | -#if HAVE_GETLOADAVG==1 | ||
| 61 | + int result; | ||
| 62 | + int i; | ||
| 63 | + | ||
| 64 | double la[3] = { 0.0, 0.0, 0.0 }; /* NetBSD complains about unitialized arrays */ | ||
| 65 | -#else | ||
| 66 | -# if HAVE_PROC_LOADAVG==1 | ||
| 67 | - FILE *fp; | ||
| 68 | - char input_buffer[MAX_INPUT_BUFFER]; | ||
| 69 | - char *tmp_ptr; | ||
| 70 | -# else | ||
| 71 | +#ifndef HAVE_GETLOADAVG | ||
| 72 | char input_buffer[MAX_INPUT_BUFFER]; | ||
| 73 | +# ifdef HAVE_PROC_LOADAVG | ||
| 74 | + FILE *fp; | ||
| 75 | + char *str, *next; | ||
| 76 | # endif | ||
| 77 | #endif | ||
| 78 | |||
| 79 | - float la1, la5, la15; | ||
| 80 | - | ||
| 81 | setlocale (LC_ALL, ""); | ||
| 82 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 83 | textdomain (PACKAGE); | ||
| 84 | @@ -77,30 +104,24 @@ | ||
| 85 | if (process_arguments (argc, argv) == ERROR) | ||
| 86 | usage4 (_("Could not parse arguments")); | ||
| 87 | |||
| 88 | -#if HAVE_GETLOADAVG==1 | ||
| 89 | +#ifdef HAVE_GETLOADAVG | ||
| 90 | result = getloadavg (la, 3); | ||
| 91 | - if (result == -1) | ||
| 92 | + if (result != 3) | ||
| 93 | return STATE_UNKNOWN; | ||
| 94 | - la1 = la[LOADAVG_1MIN]; | ||
| 95 | - la5 = la[LOADAVG_5MIN]; | ||
| 96 | - la15 = la[LOADAVG_15MIN]; | ||
| 97 | #else | ||
| 98 | -# if HAVE_PROC_LOADAVG==1 | ||
| 99 | +# ifdef HAVE_PROC_LOADAVG | ||
| 100 | fp = fopen (PROC_LOADAVG, "r"); | ||
| 101 | if (fp == NULL) { | ||
| 102 | printf (_("Error opening %s\n"), PROC_LOADAVG); | ||
| 103 | return STATE_UNKNOWN; | ||
| 104 | } | ||
| 105 | |||
| 106 | - la1 = la5 = la15 = -1; | ||
| 107 | - | ||
| 108 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, fp)) { | ||
| 109 | - tmp_ptr = strtok (input_buffer, " "); | ||
| 110 | - la1 = atof (tmp_ptr); | ||
| 111 | - tmp_ptr = strtok (NULL, " "); | ||
| 112 | - la5 = atof (tmp_ptr); | ||
| 113 | - tmp_ptr = strtok (NULL, " "); | ||
| 114 | - la15 = atof (tmp_ptr); | ||
| 115 | + str = (char *)input_buffer; | ||
| 116 | + for(i = 0; i < 3; i++) { | ||
| 117 | + la[i] = strtod(str, &next); | ||
| 118 | + str = next; | ||
| 119 | + } | ||
| 120 | } | ||
| 121 | |||
| 122 | fclose (fp); | ||
| 123 | @@ -125,12 +146,11 @@ | ||
| 124 | # endif | ||
| 125 | #endif | ||
| 126 | |||
| 127 | - | ||
| 128 | - if ((la1 < 0.0) || (la5 < 0.0) || (la15 < 0.0)) { | ||
| 129 | -#if HAVE_GETLOADAVG==1 | ||
| 130 | + if ((la[0] < 0.0) || (la[1] < 0.0) || (la[2] < 0.0)) { | ||
| 131 | +#ifdef HAVE_GETLOADAVG | ||
| 132 | printf (_("Error in getloadavg()\n")); | ||
| 133 | #else | ||
| 134 | -# if HAVE_PROC_LOADAVG==1 | ||
| 135 | +# ifdef HAVE_PROC_LOADAVG | ||
| 136 | printf (_("Error processing %s\n"), PROC_LOADAVG); | ||
| 137 | # else | ||
| 138 | printf (_("Error processing %s\n"), PATH_TO_UPTIME); | ||
| 139 | @@ -139,29 +159,30 @@ | ||
| 140 | return STATE_UNKNOWN; | ||
| 141 | } | ||
| 142 | |||
| 143 | + /* we got this far, so assume OK until we've measured */ | ||
| 144 | + result = STATE_OK; | ||
| 145 | + | ||
| 146 | asprintf(&status_line, _("load average: %.2f, %.2f, %.2f"), la1, la5, la15); | ||
| 147 | |||
| 148 | - if ((la1 >= cload1) || (la5 >= cload5) || (la15 >= cload15)) | ||
| 149 | - result = STATE_CRITICAL; | ||
| 150 | - else if ((la1 >= wload1) || (la5 >= wload5) || (la15 >= wload15)) | ||
| 151 | - result = STATE_WARNING; | ||
| 152 | - else | ||
| 153 | - result = STATE_OK; | ||
| 154 | - | ||
| 155 | - die (result, | ||
| 156 | - "%s - %s|%s %s %s\n", | ||
| 157 | - state_text (result), | ||
| 158 | - status_line, | ||
| 159 | - fperfdata ("load1", la1, "", (int)wload1, wload1, (int)cload1, cload1, TRUE, 0, FALSE, 0), | ||
| 160 | - fperfdata ("load5", la5, "", (int)wload5, wload5, (int)cload5, cload5, TRUE, 0, FALSE, 0), | ||
| 161 | - fperfdata ("load15", la15, "", (int)wload15, wload15, (int)cload15, cload15, TRUE, 0, FALSE, 0)); | ||
| 162 | - return STATE_OK; | ||
| 163 | -} | ||
| 164 | + for(i = 0; i < 3; i++) { | ||
| 165 | + if(la[i] > cload[i]) { | ||
| 166 | + result = STATE_CRITICAL; | ||
| 167 | + break; | ||
| 168 | + } | ||
| 169 | + else if(la[i] > wload[i]) result = STATE_WARNING; | ||
| 170 | + } | ||
| 171 | |||
| 172 | + printf("%s - %s|", state_text(result), status_line); | ||
| 173 | + for(i = 0; i < 3; i++) | ||
| 174 | + printf("load%d=%.3f;%.3f;%.3f;0; ", nums[i], la[i], wload[i], cload[i]); | ||
| 175 | + | ||
| 176 | + putchar('\n'); | ||
| 177 | + return result; | ||
| 178 | +} | ||
| 179 | |||
| 180 | |||
| 181 | /* process command-line arguments */ | ||
| 182 | -int | ||
| 183 | +static int | ||
| 184 | process_arguments (int argc, char **argv) | ||
| 185 | { | ||
| 186 | int c = 0; | ||
| 187 | @@ -185,37 +206,11 @@ | ||
| 188 | break; | ||
| 189 | |||
| 190 | switch (c) { | ||
| 191 | - case 'w': /* warning time threshold */ | ||
| 192 | - if (is_intnonneg (optarg)) { | ||
| 193 | - wload1 = atof (optarg); | ||
| 194 | - wload5 = atof (optarg); | ||
| 195 | - wload15 = atof (optarg); | ||
| 196 | - break; | ||
| 197 | - } | ||
| 198 | - else if (strstr (optarg, ",") && | ||
| 199 | - sscanf (optarg, "%f,%f,%f", &wload1, &wload5, &wload15) == 3) | ||
| 200 | - break; | ||
| 201 | - else if (strstr (optarg, ":") && | ||
| 202 | - sscanf (optarg, "%f:%f:%f", &wload1, &wload5, &wload15) == 3) | ||
| 203 | - break; | ||
| 204 | - else | ||
| 205 | - usage (_("Warning threshold must be float or float triplet!\n")); | ||
| 206 | + case 'w': /* warning time threshold */ | ||
| 207 | + get_threshold(optarg, wload); | ||
| 208 | break; | ||
| 209 | - case 'c': /* critical time threshold */ | ||
| 210 | - if (is_intnonneg (optarg)) { | ||
| 211 | - cload1 = atof (optarg); | ||
| 212 | - cload5 = atof (optarg); | ||
| 213 | - cload15 = atof (optarg); | ||
| 214 | - break; | ||
| 215 | - } | ||
| 216 | - else if (strstr (optarg, ",") && | ||
| 217 | - sscanf (optarg, "%f,%f,%f", &cload1, &cload5, &cload15) == 3) | ||
| 218 | - break; | ||
| 219 | - else if (strstr (optarg, ":") && | ||
| 220 | - sscanf (optarg, "%f:%f:%f", &cload1, &cload5, &cload15) == 3) | ||
| 221 | - break; | ||
| 222 | - else | ||
| 223 | - usage (_("Critical threshold must be float or float triplet!\n")); | ||
| 224 | + case 'c': /* critical time threshold */ | ||
| 225 | + get_threshold(optarg, cload); | ||
| 226 | break; | ||
| 227 | case 'V': /* version */ | ||
| 228 | print_revision (progname, revision); | ||
| 229 | @@ -231,60 +226,38 @@ | ||
| 230 | c = optind; | ||
| 231 | if (c == argc) | ||
| 232 | return validate_arguments (); | ||
| 233 | - if (wload1 < 0 && is_nonnegative (argv[c])) | ||
| 234 | - wload1 = atof (argv[c++]); | ||
| 235 | - | ||
| 236 | - if (c == argc) | ||
| 237 | - return validate_arguments (); | ||
| 238 | - if (cload1 < 0 && is_nonnegative (argv[c])) | ||
| 239 | - cload1 = atof (argv[c++]); | ||
| 240 | - | ||
| 241 | - if (c == argc) | ||
| 242 | - return validate_arguments (); | ||
| 243 | - if (wload5 < 0 && is_nonnegative (argv[c])) | ||
| 244 | - wload5 = atof (argv[c++]); | ||
| 245 | - | ||
| 246 | - if (c == argc) | ||
| 247 | - return validate_arguments (); | ||
| 248 | - if (cload5 < 0 && is_nonnegative (argv[c])) | ||
| 249 | - cload5 = atof (argv[c++]); | ||
| 250 | |||
| 251 | - if (c == argc) | ||
| 252 | - return validate_arguments (); | ||
| 253 | - if (wload15 < 0 && is_nonnegative (argv[c])) | ||
| 254 | - wload15 = atof (argv[c++]); | ||
| 255 | - | ||
| 256 | - if (c == argc) | ||
| 257 | - return validate_arguments (); | ||
| 258 | - if (cload15 < 0 && is_nonnegative (argv[c])) | ||
| 259 | - cload15 = atof (argv[c++]); | ||
| 260 | + /* handle the case if both arguments are missing, | ||
| 261 | + * but not if only one is given without -c or -w flag */ | ||
| 262 | + if(c - argc == 2) { | ||
| 263 | + get_threshold(argv[c++], wload); | ||
| 264 | + get_threshold(argv[c++], cload); | ||
| 265 | + } | ||
| 266 | + else if(c - argc == 1) { | ||
| 267 | + get_threshold(argv[c++], cload); | ||
| 268 | + } | ||
| 269 | |||
| 270 | return validate_arguments (); | ||
| 271 | } | ||
| 272 | |||
| 273 | |||
| 274 | |||
| 275 | -int | ||
| 276 | +static int | ||
| 277 | validate_arguments (void) | ||
| 278 | { | ||
| 279 | - if (wload1 < 0) | ||
| 280 | - usage (_("Warning threshold for 1-minute load average is not specified\n")); | ||
| 281 | - if (wload5 < 0) | ||
| 282 | - usage (_("Warning threshold for 5-minute load average is not specified\n")); | ||
| 283 | - if (wload15 < 0) | ||
| 284 | - usage (_("Warning threshold for 15-minute load average is not specified\n")); | ||
| 285 | - if (cload1 < 0) | ||
| 286 | - usage (_("Critical threshold for 1-minute load average is not specified\n")); | ||
| 287 | - if (cload5 < 0) | ||
| 288 | - usage (_("Critical threshold for 5-minute load average is not specified\n")); | ||
| 289 | - if (cload15 < 0) | ||
| 290 | - usage (_("Critical threshold for 15-minute load average is not specified\n")); | ||
| 291 | - if (wload1 > cload1) | ||
| 292 | - usage (_("Parameter inconsistency: 1-minute \"warning load\" greater than \"critical load\".\n")); | ||
| 293 | - if (wload5 > cload5) | ||
| 294 | - usage (_("Parameter inconsistency: 5-minute \"warning load\" greater than \"critical load\".\n")); | ||
| 295 | - if (wload15 > cload15) | ||
| 296 | - usage (_("Parameter inconsistency: 15-minute \"warning load\" greater than \"critical load\".\n")); | ||
| 297 | + int i = 0; | ||
| 298 | + | ||
| 299 | + /* match cload first, as it will give the most friendly error message | ||
| 300 | + * if user hasn't given the -c switch properly */ | ||
| 301 | + for(i = 0; i < 3; i++) { | ||
| 302 | + if(cload[i] < 0) | ||
| 303 | + die (STATE_UNKNOWN, _("Critical threshold for %d-minute load average is not specified\n"), nums[i]); | ||
| 304 | + if(wload[i] < 0) | ||
| 305 | + die (STATE_UNKNOWN, _("Warning threshold for %d-minute load average is not specified\n"), nums[i]); | ||
| 306 | + if(wload[i] > cload[i]) | ||
| 307 | + die (STATE_UNKNOWN, _("Parameter inconsistency: %d-minute \"warning load\" is greater than \"critical load\"\n"), nums[i]); | ||
| 308 | + } | ||
| 309 | + | ||
| 310 | return OK; | ||
| 311 | } | ||
diff --git a/web/attachments/136573-nagiosplug-check_tcp.diff b/web/attachments/136573-nagiosplug-check_tcp.diff new file mode 100644 index 0000000..0b26f13 --- /dev/null +++ b/web/attachments/136573-nagiosplug-check_tcp.diff | |||
| @@ -0,0 +1,725 @@ | |||
| 1 | --- ../orig.nplg/plugins/check_tcp.c 2005-05-26 14:12:21.000000000 +0200 | ||
| 2 | +++ plugins/check_tcp.c 2005-05-30 23:45:35.000000000 +0200 | ||
| 3 | @@ -47,240 +47,206 @@ | ||
| 4 | #endif | ||
| 5 | |||
| 6 | #ifdef HAVE_SSL | ||
| 7 | -int check_cert = FALSE; | ||
| 8 | -int days_till_exp; | ||
| 9 | -char *randbuff = ""; | ||
| 10 | -SSL_CTX *ctx; | ||
| 11 | -SSL *ssl; | ||
| 12 | -X509 *server_cert; | ||
| 13 | -int connect_SSL (void); | ||
| 14 | -int check_certificate (X509 **); | ||
| 15 | +static int check_cert = FALSE; | ||
| 16 | +static int days_till_exp; | ||
| 17 | +static char *randbuff = ""; | ||
| 18 | +static SSL_CTX *ctx; | ||
| 19 | +static SSL *ssl; | ||
| 20 | +static X509 *server_cert; | ||
| 21 | +static int connect_SSL (void); | ||
| 22 | +static int check_certificate (X509 **); | ||
| 23 | +# define my_recv(buf, len) ((flags & FLAG_SSL) ? SSL_read(ssl, buf, len) : read(sd, buf, len)) | ||
| 24 | +#else | ||
| 25 | +# define my_recv(buf, len) read(sd, buf, len) | ||
| 26 | #endif | ||
| 27 | |||
| 28 | -#define MAXBUF 1024 | ||
| 29 | |||
| 30 | -int process_arguments (int, char **); | ||
| 31 | -int my_recv (void); | ||
| 32 | +/* int my_recv(char *, size_t); */ | ||
| 33 | +static int process_arguments (int, char **); | ||
| 34 | void print_help (void); | ||
| 35 | void print_usage (void); | ||
| 36 | |||
| 37 | -char *SERVICE = NULL; | ||
| 38 | -char *SEND = NULL; | ||
| 39 | -char *EXPECT = NULL; | ||
| 40 | -char *QUIT = NULL; | ||
| 41 | -int PROTOCOL = 0; | ||
| 42 | -int PORT = 0; | ||
| 43 | - | ||
| 44 | -char timestamp[17] = ""; | ||
| 45 | -int server_port = 0; | ||
| 46 | -char *server_address = NULL; | ||
| 47 | -char *server_send = NULL; | ||
| 48 | -char *server_quit = NULL; | ||
| 49 | -char **server_expect = NULL; | ||
| 50 | -size_t server_expect_count = 0; | ||
| 51 | -int maxbytes = 0; | ||
| 52 | -char **warn_codes = NULL; | ||
| 53 | -size_t warn_codes_count = 0; | ||
| 54 | -char **crit_codes = NULL; | ||
| 55 | -size_t crit_codes_count = 0; | ||
| 56 | -unsigned int delay = 0; | ||
| 57 | -double warning_time = 0; | ||
| 58 | -int check_warning_time = FALSE; | ||
| 59 | -double critical_time = 0; | ||
| 60 | -int check_critical_time = FALSE; | ||
| 61 | -int hide_output = FALSE; | ||
| 62 | -double elapsed_time = 0; | ||
| 63 | -long microsec; | ||
| 64 | -int verbose = FALSE; | ||
| 65 | -int use_ssl = FALSE; | ||
| 66 | -int sd = 0; | ||
| 67 | -char *buffer; | ||
| 68 | -int expect_mismatch_state = STATE_WARNING; | ||
| 69 | -int exact_matching = TRUE; | ||
| 70 | +#define EXPECT server_expect[0] | ||
| 71 | +static char *SERVICE = "TCP"; | ||
| 72 | +static char *SEND = NULL | ||
| 73 | +static char *QUIT = NULL; | ||
| 74 | +static int PROTOCOL = IPPROTO_TCP; /* most common is default */ | ||
| 75 | +static int PORT = 0; | ||
| 76 | + | ||
| 77 | +static char timestamp[17] = ""; | ||
| 78 | +static int server_port = 0; | ||
| 79 | +static char *server_address = NULL; | ||
| 80 | +static char *server_send = NULL; | ||
| 81 | +static char *server_quit = NULL; | ||
| 82 | +static char **server_expect; | ||
| 83 | +static size_t server_expect_count = 0; | ||
| 84 | +static size_t maxbytes = 0; | ||
| 85 | +static char **warn_codes = NULL; | ||
| 86 | +static size_t warn_codes_count = 0; | ||
| 87 | +static char **crit_codes = NULL; | ||
| 88 | +static size_t crit_codes_count = 0; | ||
| 89 | +static unsigned int delay = 0; | ||
| 90 | +static double warning_time = 0; | ||
| 91 | +static double critical_time = 0; | ||
| 92 | +static double elapsed_time = 0; | ||
| 93 | +static long microsec; | ||
| 94 | +static int sd = 0; | ||
| 95 | +#define MAXBUF 1024 | ||
| 96 | +static char buffer[MAXBUF]; | ||
| 97 | +static int expect_mismatch_state = STATE_WARNING; | ||
| 98 | + | ||
| 99 | +#define FLAG_SSL 0x01 | ||
| 100 | +#define FLAG_VERBOSE 0x02 | ||
| 101 | +#define FLAG_EXACT_MATCH 0x04 | ||
| 102 | +#define FLAG_TIME_WARN 0x08 | ||
| 103 | +#define FLAG_TIME_CRIT 0x10 | ||
| 104 | +#define FLAG_HIDE_OUTPUT 0x20 | ||
| 105 | +static size_t flags = FLAG_EXACT_MATCH; | ||
| 106 | |||
| 107 | int | ||
| 108 | main (int argc, char **argv) | ||
| 109 | { | ||
| 110 | int result = STATE_UNKNOWN; | ||
| 111 | int i; | ||
| 112 | - char *status; | ||
| 113 | + char *status = NULL; | ||
| 114 | struct timeval tv; | ||
| 115 | + size_t len, match = -1; | ||
| 116 | |||
| 117 | setlocale (LC_ALL, ""); | ||
| 118 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 119 | textdomain (PACKAGE); | ||
| 120 | |||
| 121 | - if (strstr (argv[0], "check_udp")) { | ||
| 122 | - progname = strdup ("check_udp"); | ||
| 123 | - SERVICE = strdup ("UDP"); | ||
| 124 | - SEND = NULL; | ||
| 125 | - EXPECT = NULL; | ||
| 126 | - QUIT = NULL; | ||
| 127 | + /* determine program- and service-name quickly */ | ||
| 128 | + progname = strrchr(argv[0], '/'); | ||
| 129 | + if(progname != NULL) progname++; | ||
| 130 | + else progname = argv[0]; | ||
| 131 | + | ||
| 132 | + len = strlen(progname); | ||
| 133 | + if(len > 6 && !memcmp(progname, "check_", 6)) { | ||
| 134 | + SERVICE = progname + 6; | ||
| 135 | + for(i = 0; i < len - 6; i++) | ||
| 136 | + SERVICE[i] = toupper(SERVICE[i]); | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + /* set up a resonable buffer at first (will be realloc()'ed if | ||
| 140 | + * user specifies other options) */ | ||
| 141 | + server_expect = calloc(sizeof(char *), 2); | ||
| 142 | + | ||
| 143 | + /* determine defaults for this service's protocol */ | ||
| 144 | + if (!strncmp(SERVICE, "UDP", 3)) { | ||
| 145 | PROTOCOL = IPPROTO_UDP; | ||
| 146 | - PORT = 0; | ||
| 147 | } | ||
| 148 | - else if (strstr (argv[0], "check_tcp")) { | ||
| 149 | - progname = strdup ("check_tcp"); | ||
| 150 | - SERVICE = strdup ("TCP"); | ||
| 151 | - SEND = NULL; | ||
| 152 | - EXPECT = NULL; | ||
| 153 | - QUIT = NULL; | ||
| 154 | - PROTOCOL = IPPROTO_TCP; | ||
| 155 | - PORT = 0; | ||
| 156 | - } | ||
| 157 | - else if (strstr (argv[0], "check_ftp")) { | ||
| 158 | - progname = strdup ("check_ftp"); | ||
| 159 | - SERVICE = strdup ("FTP"); | ||
| 160 | - SEND = NULL; | ||
| 161 | - EXPECT = strdup ("220"); | ||
| 162 | - QUIT = strdup ("QUIT\r\n"); | ||
| 163 | - PROTOCOL = IPPROTO_TCP; | ||
| 164 | + else if (!strncmp(SERVICE, "FTP", 3)) { | ||
| 165 | + EXPECT = "220"; | ||
| 166 | + QUIT = "QUIT\r\n"; | ||
| 167 | PORT = 21; | ||
| 168 | } | ||
| 169 | - else if (strstr (argv[0], "check_smtp")) { | ||
| 170 | - progname = strdup ("check_smtp"); | ||
| 171 | - SERVICE = strdup ("SMTP"); | ||
| 172 | - SEND = NULL; | ||
| 173 | - EXPECT = strdup ("220"); | ||
| 174 | - QUIT = strdup ("QUIT\r\n"); | ||
| 175 | - PROTOCOL = IPPROTO_TCP; | ||
| 176 | - PORT = 25; | ||
| 177 | - } | ||
| 178 | - else if (strstr (argv[0], "check_pop")) { | ||
| 179 | - progname = strdup ("check_pop"); | ||
| 180 | - SERVICE = strdup ("POP"); | ||
| 181 | - SEND = NULL; | ||
| 182 | - EXPECT = strdup ("+OK"); | ||
| 183 | - QUIT = strdup ("QUIT\r\n"); | ||
| 184 | - PROTOCOL = IPPROTO_TCP; | ||
| 185 | + else if (!strncmp(SERVICE, "POP", 3) || !strncmp(SERVICE, "POP3", 4)) { | ||
| 186 | + EXPECT = "+OK"; | ||
| 187 | + QUIT = "QUIT\r\n"; | ||
| 188 | PORT = 110; | ||
| 189 | } | ||
| 190 | - else if (strstr (argv[0], "check_imap")) { | ||
| 191 | - progname = strdup ("check_imap"); | ||
| 192 | - SERVICE = strdup ("IMAP"); | ||
| 193 | - SEND = NULL; | ||
| 194 | - EXPECT = strdup ("* OK"); | ||
| 195 | - QUIT = strdup ("a1 LOGOUT\r\n"); | ||
| 196 | - PROTOCOL = IPPROTO_TCP; | ||
| 197 | + else if (!strncmp(SERVICE, "SMTP", 4)) { | ||
| 198 | + EXPECT = "220"; | ||
| 199 | + QUIT = "QUIT\r\n"; | ||
| 200 | + PORT = 25; | ||
| 201 | + } | ||
| 202 | + else if (!strncmp(SERVICE, "IMAP", 4)) { | ||
| 203 | + EXPECT = "* OK"; | ||
| 204 | + QUIT = "a1 LOGOUT\r\n"; | ||
| 205 | PORT = 143; | ||
| 206 | } | ||
| 207 | #ifdef HAVE_SSL | ||
| 208 | - else if (strstr(argv[0],"check_simap")) { | ||
| 209 | - progname = strdup ("check_simap"); | ||
| 210 | - SERVICE = strdup ("SIMAP"); | ||
| 211 | - SEND=NULL; | ||
| 212 | - EXPECT = strdup ("* OK"); | ||
| 213 | - QUIT = strdup ("a1 LOGOUT\r\n"); | ||
| 214 | - PROTOCOL=IPPROTO_TCP; | ||
| 215 | - use_ssl=TRUE; | ||
| 216 | - PORT=993; | ||
| 217 | - } | ||
| 218 | - else if (strstr(argv[0],"check_spop")) { | ||
| 219 | - progname = strdup ("check_spop"); | ||
| 220 | - SERVICE = strdup ("SPOP"); | ||
| 221 | - SEND=NULL; | ||
| 222 | - EXPECT = strdup ("+OK"); | ||
| 223 | - QUIT = strdup ("QUIT\r\n"); | ||
| 224 | - PROTOCOL=IPPROTO_TCP; | ||
| 225 | - use_ssl=TRUE; | ||
| 226 | - PORT=995; | ||
| 227 | - } | ||
| 228 | - else if (strstr(argv[0],"check_ssmtp")) { | ||
| 229 | - progname = strdup ("check_ssmtp"); | ||
| 230 | - SERVICE = strdup ("SSMTP"); | ||
| 231 | - SEND=NULL; | ||
| 232 | - EXPECT = strdup ("220"); | ||
| 233 | - QUIT = strdup ("QUIT\r\n"); | ||
| 234 | - PROTOCOL=IPPROTO_TCP; | ||
| 235 | - use_ssl=TRUE; | ||
| 236 | - PORT=465; | ||
| 237 | - } | ||
| 238 | - else if (strstr(argv[0],"check_jabber")) { | ||
| 239 | - progname = strdup("check_jabber"); | ||
| 240 | - SERVICE = strdup("JABBER"); | ||
| 241 | - SEND = strdup("<stream:stream to=\'host\' xmlns=\'jabber:client\' xmlns:stream=\'http://etherx.jabber.org/streams\'>\n"); | ||
| 242 | - EXPECT = strdup("<?xml version=\'1.0\'?><stream:stream xmlns:stream=\'http://etherx.jabber.org/streams\'"); | ||
| 243 | - QUIT = strdup("</stream:stream>\n"); | ||
| 244 | - PROTOCOL=IPPROTO_TCP; | ||
| 245 | - use_ssl=TRUE; | ||
| 246 | + else if (!strncmp(SERVICE, "SIMAP", 5)) { | ||
| 247 | + EXPECT = "* OK"; | ||
| 248 | + QUIT = "a1 LOGOUT\r\n"; | ||
| 249 | + flags |= FLAG_SSL; | ||
| 250 | + PORT = 993; | ||
| 251 | + } | ||
| 252 | + else if (!strncmp(SERVICE, "SPOP", 4)) { | ||
| 253 | + EXPECT = "+OK"; | ||
| 254 | + QUIT = "QUIT\r\n"; | ||
| 255 | + flags |= FLAG_SSL; | ||
| 256 | + PORT = 995; | ||
| 257 | + } | ||
| 258 | + else if (!strncmp(SERVICE, "SSMTP", 5)) { | ||
| 259 | + EXPECT = "220"; | ||
| 260 | + QUIT = "QUIT\r\n"; | ||
| 261 | + flags |= FLAG_SSL; | ||
| 262 | + PORT = 465; | ||
| 263 | + } | ||
| 264 | + else if (!strncmp(SERVICE, "JABBER", 6)) { | ||
| 265 | + SEND = "<stream:stream to=\'host\' xmlns=\'jabber:client\' xmlns:stream=\'http://etherx.jabber.org/streams\'>\n"; | ||
| 266 | + EXPECT = "<?xml version=\'1.0\'?><stream:stream xmlns:stream=\'http://etherx.jabber.org/streams\'"; | ||
| 267 | + QUIT = "</stream:stream>\n"; | ||
| 268 | + flags |= FLAG_SSL | FLAG_HIDE_OUTPUT; | ||
| 269 | PORT = 5222; | ||
| 270 | } | ||
| 271 | - else if (strstr (argv[0], "check_nntps")) { | ||
| 272 | - progname = strdup("check_nntps"); | ||
| 273 | - SERVICE = strdup("NNTPS"); | ||
| 274 | - SEND = NULL; | ||
| 275 | - EXPECT = NULL; | ||
| 276 | - server_expect = realloc (server_expect, ++server_expect_count); | ||
| 277 | - asprintf (&server_expect[server_expect_count - 1], "200"); | ||
| 278 | - server_expect = realloc (server_expect, ++server_expect_count); | ||
| 279 | - asprintf (&server_expect[server_expect_count - 1], "201"); | ||
| 280 | - QUIT = strdup("QUIT\r\n"); | ||
| 281 | - PROTOCOL = IPPROTO_TCP; | ||
| 282 | - use_ssl=TRUE; | ||
| 283 | + else if (!strncmp (SERVICE, "NNTPS", 5)) { | ||
| 284 | + server_expect_count = 2; | ||
| 285 | + server_expect[0] = "200"; | ||
| 286 | + server_expect[1] = "201"; | ||
| 287 | + QUIT = "QUIT\r\n"; | ||
| 288 | + flags |= FLAG_SSL; | ||
| 289 | PORT = 563; | ||
| 290 | -} | ||
| 291 | - | ||
| 292 | + } | ||
| 293 | #endif | ||
| 294 | - else if (strstr (argv[0], "check_nntp")) { | ||
| 295 | - progname = strdup ("check_nntp"); | ||
| 296 | - SERVICE = strdup ("NNTP"); | ||
| 297 | - SEND = NULL; | ||
| 298 | - EXPECT = NULL; | ||
| 299 | - server_expect = realloc (server_expect, sizeof (char *) * (++server_expect_count)); | ||
| 300 | - asprintf (&server_expect[server_expect_count - 1], "200"); | ||
| 301 | - server_expect = realloc (server_expect, sizeof (char *) * (++server_expect_count)); | ||
| 302 | - asprintf (&server_expect[server_expect_count - 1], "201"); | ||
| 303 | - asprintf (&QUIT, "QUIT\r\n"); | ||
| 304 | - PROTOCOL = IPPROTO_TCP; | ||
| 305 | + else if (!strncmp (SERVICE, "NNTP", 4)) { | ||
| 306 | + server_expect_count = 2; | ||
| 307 | + server_expect = malloc(sizeof(char *) * server_expect_count); | ||
| 308 | + server_expect[0] = strdup("200"); | ||
| 309 | + server_expect[1] = strdup("201"); | ||
| 310 | + QUIT = "QUIT\r\n"; | ||
| 311 | PORT = 119; | ||
| 312 | } | ||
| 313 | - else { | ||
| 314 | - progname = strdup ("check_tcp"); | ||
| 315 | + /* fallthrough check, so it's supposed to use reverse matching */ | ||
| 316 | + else if (strcmp (SERVICE, "TCP")) | ||
| 317 | usage (_("CRITICAL - Generic check_tcp called with unknown service\n")); | ||
| 318 | - } | ||
| 319 | |||
| 320 | - server_address = strdup ("127.0.0.1"); | ||
| 321 | + server_address = "127.0.0.1"; | ||
| 322 | server_port = PORT; | ||
| 323 | server_send = SEND; | ||
| 324 | server_quit = QUIT; | ||
| 325 | - status = strdup (""); | ||
| 326 | + status = NULL; | ||
| 327 | |||
| 328 | if (process_arguments (argc, argv) == ERROR) | ||
| 329 | usage4 (_("Could not parse arguments")); | ||
| 330 | |||
| 331 | - /* use default expect if none listed in process_arguments() */ | ||
| 332 | - if (EXPECT && server_expect_count == 0) { | ||
| 333 | - server_expect = malloc (sizeof (char *) * (++server_expect_count)); | ||
| 334 | - server_expect[server_expect_count - 1] = EXPECT; | ||
| 335 | + if(flags & FLAG_VERBOSE) { | ||
| 336 | + printf("Using service %s\n", SERVICE); | ||
| 337 | + printf("Port: %d\n", PORT); | ||
| 338 | + printf("flags: 0x%x\n", flags); | ||
| 339 | } | ||
| 340 | |||
| 341 | - /* initialize alarm signal handling */ | ||
| 342 | - signal (SIGALRM, socket_timeout_alarm_handler); | ||
| 343 | + if(EXPECT && !server_expect_count) | ||
| 344 | + server_expect_count++; | ||
| 345 | |||
| 346 | - /* set socket timeout */ | ||
| 347 | + /* set up the timer */ | ||
| 348 | + signal (SIGALRM, socket_timeout_alarm_handler); | ||
| 349 | alarm (socket_timeout); | ||
| 350 | |||
| 351 | /* try to connect to the host at the given port number */ | ||
| 352 | gettimeofday (&tv, NULL); | ||
| 353 | #ifdef HAVE_SSL | ||
| 354 | - if (use_ssl && check_cert == TRUE) { | ||
| 355 | - if (connect_SSL () != OK) | ||
| 356 | - die (STATE_CRITICAL,_("CRITICAL - Could not make SSL connection\n")); | ||
| 357 | - if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) { | ||
| 358 | - result = check_certificate (&server_cert); | ||
| 359 | - X509_free(server_cert); | ||
| 360 | - } | ||
| 361 | - else { | ||
| 362 | - printf(_("CRITICAL - Cannot retrieve server certificate.\n")); | ||
| 363 | - result = STATE_CRITICAL; | ||
| 364 | - } | ||
| 365 | - SSL_shutdown (ssl); | ||
| 366 | - SSL_free (ssl); | ||
| 367 | - SSL_CTX_free (ctx); | ||
| 368 | - close (sd); | ||
| 369 | - return result; | ||
| 370 | + if (flags & FLAG_SSL && check_cert == TRUE) { | ||
| 371 | + if (connect_SSL () != OK) | ||
| 372 | + die (STATE_CRITICAL,_("CRITICAL - Could not make SSL connection\n")); | ||
| 373 | + if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) { | ||
| 374 | + result = check_certificate (&server_cert); | ||
| 375 | + X509_free(server_cert); | ||
| 376 | + } | ||
| 377 | + else { | ||
| 378 | + printf(_("CRITICAL - Cannot retrieve server certificate.\n")); | ||
| 379 | + result = STATE_CRITICAL; | ||
| 380 | + } | ||
| 381 | + | ||
| 382 | + SSL_shutdown (ssl); | ||
| 383 | + SSL_free (ssl); | ||
| 384 | + SSL_CTX_free (ctx); | ||
| 385 | + close (sd); | ||
| 386 | + return result; | ||
| 387 | } | ||
| 388 | - else if (use_ssl) | ||
| 389 | + else if (flags & FLAG_SSL) | ||
| 390 | result = connect_SSL (); | ||
| 391 | else | ||
| 392 | #endif | ||
| 393 | @@ -290,9 +256,8 @@ | ||
| 394 | return STATE_CRITICAL; | ||
| 395 | |||
| 396 | if (server_send != NULL) { /* Something to send? */ | ||
| 397 | - asprintf (&server_send, "%s\r\n", server_send); | ||
| 398 | #ifdef HAVE_SSL | ||
| 399 | - if (use_ssl) | ||
| 400 | + if (flags & FLAG_SSL) | ||
| 401 | SSL_write(ssl, server_send, (int)strlen(server_send)); | ||
| 402 | else | ||
| 403 | #endif | ||
| 404 | @@ -304,63 +269,71 @@ | ||
| 405 | sleep (delay); | ||
| 406 | } | ||
| 407 | |||
| 408 | - if (server_send || server_expect_count > 0) { | ||
| 409 | + if(flags & FLAG_VERBOSE) { | ||
| 410 | + printf("server_expect_count: %d\n", server_expect_count); | ||
| 411 | + for(i = 0; i < server_expect_count; i++) | ||
| 412 | + printf("\t%d: %s\n", i, server_expect[i]); | ||
| 413 | + } | ||
| 414 | + | ||
| 415 | + /* if(len) later on, we know we have a non-NULL response */ | ||
| 416 | + len = 0; | ||
| 417 | + if (server_expect_count) { | ||
| 418 | |||
| 419 | - buffer = malloc (MAXBUF); | ||
| 420 | - memset (buffer, '\0', MAXBUF); | ||
| 421 | /* watch for the expect string */ | ||
| 422 | - while ((i = my_recv ()) > 0) { | ||
| 423 | - buffer[i] = '\0'; | ||
| 424 | - asprintf (&status, "%s%s", status, buffer); | ||
| 425 | - if (buffer[i-1] == '\n') { | ||
| 426 | - if (buffer[i-2] == '\r' || i < MAXBUF-1) | ||
| 427 | - break; | ||
| 428 | - } | ||
| 429 | - if (maxbytes>0 && strlen(status) >= (unsigned)maxbytes) | ||
| 430 | + while ((i = my_recv(buffer, sizeof(buffer))) > 0) { | ||
| 431 | + status = realloc(status, len + i + 1); | ||
| 432 | + memcpy(&status[len], buffer, i); | ||
| 433 | + len += i; | ||
| 434 | + | ||
| 435 | + /* stop reading if user-forced or data-starved */ | ||
| 436 | + if(i < sizeof(buffer) || (maxbytes && len >= maxbytes)) | ||
| 437 | + break; | ||
| 438 | + | ||
| 439 | + if (maxbytes && len >= maxbytes) | ||
| 440 | break; | ||
| 441 | } | ||
| 442 | |||
| 443 | - /* return a CRITICAL status if we couldn't read any data */ | ||
| 444 | - if (strlen(status) == 0) | ||
| 445 | + /* no data when expected, so return critical */ | ||
| 446 | + if (len == 0) | ||
| 447 | die (STATE_CRITICAL, _("No data received from host\n")); | ||
| 448 | |||
| 449 | - strip (status); | ||
| 450 | - | ||
| 451 | - if (status && verbose) | ||
| 452 | - printf ("%s\n", status); | ||
| 453 | - | ||
| 454 | - if (server_expect_count > 0) { | ||
| 455 | - for (i = 0;; i++) { | ||
| 456 | - if (verbose) | ||
| 457 | - printf ("%d %d\n", i, (int)server_expect_count); | ||
| 458 | - if (i >= (int)server_expect_count) | ||
| 459 | - die (expect_mismatch_state, _("Unexpected response from host: %s\n"), status); | ||
| 460 | - /* default expect gets exact matching */ | ||
| 461 | - if (exact_matching) { | ||
| 462 | - if (strncmp(status, server_expect[i], strlen(server_expect[i])) == 0) | ||
| 463 | - break; | ||
| 464 | - } else { | ||
| 465 | - if (strstr (status, server_expect[i])) | ||
| 466 | - break; | ||
| 467 | - } | ||
| 468 | + /* force null-termination and strip whitespace from end of output */ | ||
| 469 | + status[len--] = '\0'; | ||
| 470 | + /* print raw output if we're debugging */ | ||
| 471 | + if(flags & FLAG_VERBOSE) | ||
| 472 | + printf("received %d bytes from host\n#-raw-recv-------#\n%s\n#-raw-recv-------#\n", | ||
| 473 | + len + 1, status); | ||
| 474 | + while(isspace(status[len])) status[len--] = '\0'; | ||
| 475 | + | ||
| 476 | + for (i = 0; i < server_expect_count; i++) { | ||
| 477 | + match = -2; /* tag it so we know if we tried and failed */ | ||
| 478 | + if (flags & FLAG_VERBOSE) | ||
| 479 | + printf ("looking for [%s] %s [%s]\n", server_expect[i], | ||
| 480 | + (flags & FLAG_EXACT_MATCH) ? "in beginning of" : "anywhere in", | ||
| 481 | + status); | ||
| 482 | + | ||
| 483 | + /* match it. math first in short-circuit */ | ||
| 484 | + if ((flags & FLAG_EXACT_MATCH && !strncmp(status, server_expect[i], strlen(server_expect[i]))) || | ||
| 485 | + (!(flags & FLAG_EXACT_MATCH) && strstr(status, server_expect[i]))) | ||
| 486 | + { | ||
| 487 | + if(flags & FLAG_VERBOSE) puts("found it"); | ||
| 488 | + match = i; | ||
| 489 | + break; | ||
| 490 | } | ||
| 491 | } | ||
| 492 | } | ||
| 493 | |||
| 494 | if (server_quit != NULL) { | ||
| 495 | #ifdef HAVE_SSL | ||
| 496 | - if (use_ssl) { | ||
| 497 | + if (flags & FLAG_SSL) { | ||
| 498 | SSL_write (ssl, server_quit, (int)strlen(server_quit)); | ||
| 499 | SSL_shutdown (ssl); | ||
| 500 | SSL_free (ssl); | ||
| 501 | SSL_CTX_free (ctx); | ||
| 502 | } | ||
| 503 | - else { | ||
| 504 | + else | ||
| 505 | #endif | ||
| 506 | send (sd, server_quit, strlen (server_quit), 0); | ||
| 507 | -#ifdef HAVE_SSL | ||
| 508 | - } | ||
| 509 | -#endif | ||
| 510 | } | ||
| 511 | |||
| 512 | /* close the connection */ | ||
| 513 | @@ -370,37 +343,53 @@ | ||
| 514 | microsec = deltime (tv); | ||
| 515 | elapsed_time = (double)microsec / 1.0e6; | ||
| 516 | |||
| 517 | - if (check_critical_time == TRUE && elapsed_time > critical_time) | ||
| 518 | + if (flags & FLAG_TIME_CRIT && elapsed_time > critical_time) | ||
| 519 | result = STATE_CRITICAL; | ||
| 520 | - else if (check_warning_time == TRUE && elapsed_time > warning_time) | ||
| 521 | + else if (flags & FLAG_TIME_WARN && elapsed_time > warning_time) | ||
| 522 | + result = STATE_WARNING; | ||
| 523 | + | ||
| 524 | + /* did we get the response we hoped? */ | ||
| 525 | + if(match == -2 && result != STATE_CRITICAL) | ||
| 526 | result = STATE_WARNING; | ||
| 527 | |||
| 528 | /* reset the alarm */ | ||
| 529 | alarm (0); | ||
| 530 | |||
| 531 | - printf | ||
| 532 | - (_("%s %s%s - %.3f second response time on port %d"), | ||
| 533 | - SERVICE, | ||
| 534 | - state_text (result), | ||
| 535 | - (was_refused) ? " (refused)" : "", | ||
| 536 | - elapsed_time, server_port); | ||
| 537 | + /* this is a bit stupid, because we don't want to print the | ||
| 538 | + * response time (which can look ok to the user) if we didn't get | ||
| 539 | + * the response we were looking for. if-else */ | ||
| 540 | + printf(_("%s %s - "), SERVICE, state_text(result)); | ||
| 541 | |||
| 542 | - if (hide_output == FALSE && status && strlen(status) > 0) | ||
| 543 | + if(match == -2 && len && !(flags & FLAG_HIDE_OUTPUT)) | ||
| 544 | + printf("Unexpected response from host: %s", status); | ||
| 545 | + else | ||
| 546 | + printf("%.3f second response time on port %d", | ||
| 547 | + elapsed_time, server_port); | ||
| 548 | + | ||
| 549 | + if (match != -2 && !(flags & FLAG_HIDE_OUTPUT) && len) | ||
| 550 | printf (" [%s]", status); | ||
| 551 | |||
| 552 | - printf (" |%s\n", fperfdata ("time", elapsed_time, "s", | ||
| 553 | - TRUE, warning_time, | ||
| 554 | - TRUE, critical_time, | ||
| 555 | - TRUE, 0, | ||
| 556 | - TRUE, socket_timeout)); | ||
| 557 | + /* perf-data doesn't apply when server doesn't talk properly, | ||
| 558 | + * so print all zeroes on warn and crit */ | ||
| 559 | + if(match == -2) | ||
| 560 | + printf ("|time=%fs;0.0;0.0;0.0;0.0", elapsed_time); | ||
| 561 | + else | ||
| 562 | + printf("|%s", | ||
| 563 | + fperfdata ("time", elapsed_time, "s", | ||
| 564 | + TRUE, warning_time, | ||
| 565 | + TRUE, critical_time, | ||
| 566 | + TRUE, 0, | ||
| 567 | + TRUE, socket_timeout) | ||
| 568 | + ); | ||
| 569 | |||
| 570 | + putchar('\n'); | ||
| 571 | return result; | ||
| 572 | } | ||
| 573 | |||
| 574 | |||
| 575 | |||
| 576 | /* process command-line arguments */ | ||
| 577 | -int | ||
| 578 | +static int | ||
| 579 | process_arguments (int argc, char **argv) | ||
| 580 | { | ||
| 581 | int c; | ||
| 582 | @@ -472,7 +461,7 @@ | ||
| 583 | print_revision (progname, revision); | ||
| 584 | exit (STATE_OK); | ||
| 585 | case 'v': /* verbose mode */ | ||
| 586 | - verbose = TRUE; | ||
| 587 | + flags |= FLAG_VERBOSE; | ||
| 588 | break; | ||
| 589 | case '4': | ||
| 590 | address_family = AF_INET; | ||
| 591 | @@ -494,17 +483,17 @@ | ||
| 592 | usage4 (_("Critical threshold must be a positive integer")); | ||
| 593 | else | ||
| 594 | critical_time = strtod (optarg, NULL); | ||
| 595 | - check_critical_time = TRUE; | ||
| 596 | + flags |= FLAG_TIME_CRIT; | ||
| 597 | break; | ||
| 598 | case 'j': /* hide output */ | ||
| 599 | - hide_output = TRUE; | ||
| 600 | + flags |= FLAG_HIDE_OUTPUT; | ||
| 601 | break; | ||
| 602 | case 'w': /* warning */ | ||
| 603 | if (!is_intnonneg (optarg)) | ||
| 604 | usage4 (_("Warning threshold must be a positive integer")); | ||
| 605 | else | ||
| 606 | warning_time = strtod (optarg, NULL); | ||
| 607 | - check_warning_time = TRUE; | ||
| 608 | + flags |= FLAG_TIME_WARN; | ||
| 609 | break; | ||
| 610 | case 'C': | ||
| 611 | crit_codes = realloc (crit_codes, ++crit_codes_count); | ||
| 612 | @@ -531,7 +520,7 @@ | ||
| 613 | break; | ||
| 614 | case 'e': /* expect string (may be repeated) */ | ||
| 615 | EXPECT = NULL; | ||
| 616 | - exact_matching = FALSE; | ||
| 617 | + flags &= ~FLAG_EXACT_MATCH; | ||
| 618 | if (server_expect_count == 0) | ||
| 619 | server_expect = malloc (sizeof (char *) * (++server_expect_count)); | ||
| 620 | else | ||
| 621 | @@ -542,7 +531,7 @@ | ||
| 622 | if (!is_intpos (optarg)) | ||
| 623 | usage4 (_("Maxbytes must be a positive integer")); | ||
| 624 | else | ||
| 625 | - maxbytes = atoi (optarg); | ||
| 626 | + maxbytes = strtol (optarg, NULL, 0); | ||
| 627 | case 'q': | ||
| 628 | asprintf(&server_quit, "%s\r\n", optarg); | ||
| 629 | break; | ||
| 630 | @@ -572,16 +561,19 @@ | ||
| 631 | else | ||
| 632 | usage4 (_("Delay must be a positive integer")); | ||
| 633 | break; | ||
| 634 | - case 'D': /* Check SSL cert validity - days 'til certificate expiration */ | ||
| 635 | + case 'D': /* Check SSL cert validity - days 'til certificate expiration */ | ||
| 636 | #ifdef HAVE_SSL | ||
| 637 | if (!is_intnonneg (optarg)) | ||
| 638 | usage2 (_("Invalid certificate expiration period"), optarg); | ||
| 639 | days_till_exp = atoi (optarg); | ||
| 640 | check_cert = TRUE; | ||
| 641 | - use_ssl = TRUE; | ||
| 642 | + flags |= FLAG_SSL; | ||
| 643 | break; | ||
| 644 | +#endif | ||
| 645 | + /* fallthrough if we don't have ssl */ | ||
| 646 | case 'S': | ||
| 647 | - use_ssl = TRUE; | ||
| 648 | +#ifdef HAVE_SSL | ||
| 649 | + flags |= FLAG_SSL; | ||
| 650 | #else | ||
| 651 | die (STATE_UNKNOWN, _("Invalid option - SSL is not available")); | ||
| 652 | #endif | ||
| 653 | @@ -596,9 +588,9 @@ | ||
| 654 | } | ||
| 655 | |||
| 656 | |||
| 657 | - | ||
| 658 | +/* SSL-specific functions */ | ||
| 659 | #ifdef HAVE_SSL | ||
| 660 | -int | ||
| 661 | +static int | ||
| 662 | connect_SSL (void) | ||
| 663 | { | ||
| 664 | SSL_METHOD *meth; | ||
| 665 | @@ -649,12 +641,8 @@ | ||
| 666 | |||
| 667 | return STATE_CRITICAL; | ||
| 668 | } | ||
| 669 | -#endif | ||
| 670 | - | ||
| 671 | - | ||
| 672 | |||
| 673 | -#ifdef HAVE_SSL | ||
| 674 | -int | ||
| 675 | +static int | ||
| 676 | check_certificate (X509 ** certificate) | ||
| 677 | { | ||
| 678 | ASN1_STRING *tm; | ||
| 679 | @@ -727,29 +715,7 @@ | ||
| 680 | |||
| 681 | return STATE_OK; | ||
| 682 | } | ||
| 683 | -#endif | ||
| 684 | - | ||
| 685 | - | ||
| 686 | - | ||
| 687 | -int | ||
| 688 | -my_recv (void) | ||
| 689 | -{ | ||
| 690 | - int i; | ||
| 691 | - | ||
| 692 | -#ifdef HAVE_SSL | ||
| 693 | - if (use_ssl) { | ||
| 694 | - i = SSL_read (ssl, buffer, MAXBUF - 1); | ||
| 695 | - } | ||
| 696 | - else { | ||
| 697 | -#endif | ||
| 698 | - i = read (sd, buffer, MAXBUF - 1); | ||
| 699 | -#ifdef HAVE_SSL | ||
| 700 | - } | ||
| 701 | -#endif | ||
| 702 | - | ||
| 703 | - return i; | ||
| 704 | -} | ||
| 705 | - | ||
| 706 | +#endif /* HAVE_SSL */ | ||
| 707 | |||
| 708 | |||
| 709 | void | ||
| 710 | @@ -809,7 +775,6 @@ | ||
| 711 | } | ||
| 712 | |||
| 713 | |||
| 714 | - | ||
| 715 | void | ||
| 716 | print_usage (void) | ||
| 717 | { | ||
| 718 | @@ -818,5 +783,6 @@ | ||
| 719 | [-s <send string>] [-e <expect string>] [-q <quit string>]\n\ | ||
| 720 | [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\ | ||
| 721 | [-r <refuse state>] [-M <mismatch state>] [-v] [-4|-6] [-j]\n\ | ||
| 722 | - [-D <days to cert expiry>] [-S <use SSL>]\n", progname); | ||
| 723 | + [-D <days to cert expiry>] [-S <use SSL>]\n", progname); | ||
| 724 | } | ||
| 725 | + | ||
diff --git a/web/attachments/136655-nagiosplug-common_h-sanity.diff b/web/attachments/136655-nagiosplug-common_h-sanity.diff new file mode 100644 index 0000000..187f298 --- /dev/null +++ b/web/attachments/136655-nagiosplug-common_h-sanity.diff | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | diff -urN ../orig.nplg/plugins/common.h ./plugins/common.h | ||
| 2 | --- ../orig.nplg/plugins/common.h 2004-12-10 11:42:00.000000000 +0100 | ||
| 3 | +++ ./plugins/common.h 2005-05-31 14:34:48.000000000 +0200 | ||
| 4 | @@ -32,7 +32,17 @@ | ||
| 5 | * | ||
| 6 | *****************************************************************************/ | ||
| 7 | |||
| 8 | -#include "config.h" | ||
| 9 | +#ifndef NAGIOSPLUG_COMMON_H | ||
| 10 | +#define NAGIOSPLUG_COMMON_H | ||
| 11 | + | ||
| 12 | +/* For non-GNU compilers to ignore __attribute__ | ||
| 13 | + * This must be here so that imported GNU headers can be used with non-gnu | ||
| 14 | + * compilers and so we can safely (and properly) put prototypes here. */ | ||
| 15 | +#ifndef __GNUC__ | ||
| 16 | +# define __attribute__(x) /* do nothing */ | ||
| 17 | +#endif | ||
| 18 | + | ||
| 19 | +# include "config.h" | ||
| 20 | |||
| 21 | #ifdef HAVE_FEATURES_H | ||
| 22 | #include <features.h> | ||
| 23 | @@ -131,19 +141,25 @@ | ||
| 24 | #endif | ||
| 25 | |||
| 26 | #ifndef HAVE_ASPRINTF | ||
| 27 | -int asprintf(char **strp, const char *fmt, ...); | ||
| 28 | +int asprintf(char **strp, const char *fmt, ...) | ||
| 29 | + __attribute__((__format__(__printf__, 2, 3))); | ||
| 30 | #endif | ||
| 31 | |||
| 32 | +/* | ||
| 33 | #ifndef HAVE_VASPRINTF | ||
| 34 | -/* int vasprintf(char **strp, const char *fmt, va_list ap); */ | ||
| 35 | +int vasprintf(char **strp, const char *fmt, va_list ap) | ||
| 36 | + __attribute__((__format__(__printf__, 2, 0))); | ||
| 37 | #endif | ||
| 38 | +*/ | ||
| 39 | |||
| 40 | #ifndef HAVE_SNPRINTF | ||
| 41 | -int snprintf(char *str, size_t size, const char *format, ...); | ||
| 42 | +int snprintf(char *str, size_t size, const char *format, ...) | ||
| 43 | + __attribute__((__format__(__printf__, 3, 4))); | ||
| 44 | #endif | ||
| 45 | |||
| 46 | #ifndef HAVE_VSNPRINTF | ||
| 47 | -int vsnprintf(char *str, size_t size, const char *format, va_list ap); | ||
| 48 | +int vsnprintf(char *str, size_t size, const char *format, va_list ap) | ||
| 49 | + __attribute__((__format__(__printf__, 3, 0))); | ||
| 50 | #endif | ||
| 51 | |||
| 52 | /* | ||
| 53 | @@ -152,32 +168,31 @@ | ||
| 54 | * | ||
| 55 | */ | ||
| 56 | |||
| 57 | -enum { | ||
| 58 | - OK = 0, | ||
| 59 | - ERROR = -1 | ||
| 60 | -}; | ||
| 61 | +/* These should be macros so they never have to be fetched | ||
| 62 | + * from a different data-segment than the code evaluating it (which is | ||
| 63 | + * bizarrely expensive on some weird architectures). It also makes it | ||
| 64 | + * easier to develop and implement additional API's without mucking about | ||
| 65 | + * with the "official" code (#ifdef STATE_CRITICAL etc). | ||
| 66 | + */ | ||
| 67 | +#define OK 0 | ||
| 68 | +#define ERROR -1 | ||
| 69 | |||
| 70 | /* AIX seems to have this defined somewhere else */ | ||
| 71 | #ifndef FALSE | ||
| 72 | -enum { | ||
| 73 | - FALSE, | ||
| 74 | - TRUE | ||
| 75 | -}; | ||
| 76 | -#endif | ||
| 77 | - | ||
| 78 | -enum { | ||
| 79 | - STATE_OK, | ||
| 80 | - STATE_WARNING, | ||
| 81 | - STATE_CRITICAL, | ||
| 82 | - STATE_UNKNOWN, | ||
| 83 | - STATE_DEPENDENT | ||
| 84 | -}; | ||
| 85 | - | ||
| 86 | -enum { | ||
| 87 | - DEFAULT_SOCKET_TIMEOUT = 10, /* timeout after 10 seconds */ | ||
| 88 | - MAX_INPUT_BUFFER = 1024, /* max size of most buffers we use */ | ||
| 89 | - MAX_HOST_ADDRESS_LENGTH = 256 /* max size of a host address */ | ||
| 90 | -}; | ||
| 91 | +# define FALSE 0 | ||
| 92 | +# define TRUE 1 | ||
| 93 | +#endif | ||
| 94 | + | ||
| 95 | +#define STATE_OK 0 | ||
| 96 | +#define STATE_WARNING 1 | ||
| 97 | +#define STATE_CRITICAL 2 | ||
| 98 | +#define STATE_UNKNOWN 3 | ||
| 99 | +#define STATE_DEPENDENT 4 | ||
| 100 | +#define STATE_OOB 5 /* status out of bounds. Must be last */ | ||
| 101 | + | ||
| 102 | +#define DEFAULT_SOCKET_TIMEOUT 10 /* timeout after 10 seconds */ | ||
| 103 | +#define MAX_INPUT_BUFFER 1024 /* max size of most buffers we use */ | ||
| 104 | +#define MAX_HOST_ADDRESS_LENGTH 256 /* max size of a host address */ | ||
| 105 | |||
| 106 | /* | ||
| 107 | * | ||
| 108 | @@ -187,7 +202,4 @@ | ||
| 109 | #include "gettext.h" | ||
| 110 | #define _(String) gettext (String) | ||
| 111 | |||
| 112 | -/* For non-GNU compilers to ignore __attribute__ */ | ||
| 113 | -#ifndef __GNUC__ | ||
| 114 | -# define __attribute__(x) /* do nothing */ | ||
| 115 | -#endif | ||
| 116 | +#endif /* NAGIOSPLUG_COMMON_H */ | ||
diff --git a/web/attachments/136758-mmmm b/web/attachments/136758-mmmm new file mode 100644 index 0000000..768eb35 --- /dev/null +++ b/web/attachments/136758-mmmm | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | *** check_snmp.c.old Tue May 31 22:09:23 2005 | ||
| 2 | --- check_snmp.c Tue May 31 23:35:45 2005 | ||
| 3 | *************** | ||
| 4 | *** 336,341 **** | ||
| 5 | --- 336,342 ---- | ||
| 6 | |||
| 7 | i++; | ||
| 8 | |||
| 9 | + /* I think this declaration here is bad syntax, and compilation fails */ | ||
| 10 | char *str[MAX_INPUT_BUFFER]; | ||
| 11 | asprintf(str, "=%s%s;;;; ", show, type ? type : ""); | ||
| 12 | strcat(perfstr, *str); | ||
| 13 | *************** | ||
| 14 | *** 376,381 **** | ||
| 15 | --- 377,383 ---- | ||
| 16 | char *ptr; | ||
| 17 | int c = 1; | ||
| 18 | int j = 0, jj = 0, ii = 0; | ||
| 19 | + int needmibs = FALSE; | ||
| 20 | |||
| 21 | int option = 0; | ||
| 22 | static struct option longopts[] = { | ||
| 23 | *************** | ||
| 24 | *** 510,515 **** | ||
| 25 | --- 512,525 ---- | ||
| 26 | retries = atoi(optarg); | ||
| 27 | break; | ||
| 28 | case 'o': /* object identifier */ | ||
| 29 | + if ( strspn( optarg, "0123456789." ) != strlen( optarg ) ) { | ||
| 30 | + /* | ||
| 31 | + * we have something other than digits and periods, so we | ||
| 32 | + * have a mib variable, rather than just an SNMP OID, so | ||
| 33 | + * we have to actually read the mib files | ||
| 34 | + */ | ||
| 35 | + needmibs = TRUE; | ||
| 36 | + } | ||
| 37 | for (ptr = optarg; (ptr = index (ptr, ',')); ptr++) | ||
| 38 | ptr[0] = ' '; /* relpace comma with space */ | ||
| 39 | for (ptr = optarg; (ptr = index (ptr, ' ')); ptr++) | ||
| 40 | *************** | ||
| 41 | *** 628,633 **** | ||
| 42 | --- 638,646 ---- | ||
| 43 | if (community == NULL) | ||
| 44 | community = strdup (DEFAULT_COMMUNITY); | ||
| 45 | |||
| 46 | + if ( ! needmibs ) | ||
| 47 | + miblist = "''"; /* don't read any MIB files */ | ||
| 48 | + | ||
| 49 | return validate_arguments (); | ||
| 50 | } | ||
| 51 | |||
| 52 | *************** | ||
| 53 | *** 913,921 **** | ||
| 54 | /* OID Stuff */ | ||
| 55 | printf (_("\ | ||
| 56 | -o, --oid=OID(s)\n\ | ||
| 57 | ! Object identifier(s) whose value you wish to query\n\ | ||
| 58 | -m, --miblist=STRING\n\ | ||
| 59 | ! List of MIBS to be loaded (default = ALL)\n -d, --delimiter=STRING\n\ | ||
| 60 | Delimiter to use when parsing returned data. Default is \"%s\"\n\ | ||
| 61 | Any data on the right hand side of the delimiter is considered\n\ | ||
| 62 | to be the data that should be used in the evaluation.\n"), DEFAULT_DELIMITER); | ||
| 63 | --- 926,937 ---- | ||
| 64 | /* OID Stuff */ | ||
| 65 | printf (_("\ | ||
| 66 | -o, --oid=OID(s)\n\ | ||
| 67 | ! Object identifier(s) or SNMP variables whose value you wish to query\n\ | ||
| 68 | -m, --miblist=STRING\n\ | ||
| 69 | ! List of MIBS to be loaded (default = ALL)\n\ | ||
| 70 | ! Set empty if polling only OIDs, and not SNMP variables\n\ | ||
| 71 | ! (since no MIB files are needed if we already have the OIDs)\n\ | ||
| 72 | ! -d, --delimiter=STRING\n\ | ||
| 73 | Delimiter to use when parsing returned data. Default is \"%s\"\n\ | ||
| 74 | Any data on the right hand side of the delimiter is considered\n\ | ||
| 75 | to be the data that should be used in the evaluation.\n"), DEFAULT_DELIMITER); | ||
diff --git a/web/attachments/136841-newdiff b/web/attachments/136841-newdiff new file mode 100644 index 0000000..371d0a8 --- /dev/null +++ b/web/attachments/136841-newdiff | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | Index: check_tcp.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_tcp.c,v | ||
| 4 | retrieving revision 1.65 | ||
| 5 | diff -r1.65 check_tcp.c | ||
| 6 | 166a167,176 | ||
| 7 | > else if (strstr (argv[0], "check_clamd")) { | ||
| 8 | > progname = strdup ("check_clamd"); | ||
| 9 | > SERVICE = strdup ("CLAMD"); | ||
| 10 | > SEND = strdup ("PING"); | ||
| 11 | > EXPECT = strdup ("PONG"); | ||
| 12 | > QUIT = NULL; | ||
| 13 | > PROTOCOL = IPPROTO_TCP; | ||
| 14 | > PORT = 3310; | ||
| 15 | > } | ||
| 16 | > | ||
| 17 | 380,381c390,397 | ||
| 18 | < | ||
| 19 | < printf | ||
| 20 | --- | ||
| 21 | > if(server_address[0]=='/') | ||
| 22 | > printf | ||
| 23 | > (_("%s %s%s - %.3f second response on socket %s"), | ||
| 24 | > SERVICE, | ||
| 25 | > state_text (result), | ||
| 26 | > (was_refused) ? " (refused)" : "", | ||
| 27 | > elapsed_time, server_address); | ||
| 28 | > else printf | ||
| 29 | 488c504 | ||
| 30 | < if (is_host (optarg) == FALSE) | ||
| 31 | --- | ||
| 32 | > if (optarg[0]!= '/' && is_host (optarg) == FALSE) | ||
| 33 | 763c779 | ||
| 34 | < printf (_("This plugin tests %s connections with the specified host.\n\n"), | ||
| 35 | --- | ||
| 36 | > printf (_("This plugin tests %s connections with the specified host or unix socket.\n\n"), | ||
| 37 | Index: netutils.c | ||
| 38 | =================================================================== | ||
| 39 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.c,v | ||
| 40 | retrieving revision 1.24 | ||
| 41 | diff -r1.24 netutils.c | ||
| 42 | 166a167 | ||
| 43 | > | ||
| 44 | 172a174 | ||
| 45 | > if (host_name[0] != '/') { | ||
| 46 | 212a215,239 | ||
| 47 | > } | ||
| 48 | > else{ // unix socket | ||
| 49 | > struct sockaddr_un su; | ||
| 50 | > if (strlen(host_name) >= sizeof(su.sun_path)) { | ||
| 51 | > printf("Hostname too long for unix domain socket: %s\n", | ||
| 52 | > host_name); | ||
| 53 | > return STATE_UNKNOWN; | ||
| 54 | > } | ||
| 55 | > memset(&su, 0, sizeof su); | ||
| 56 | > su.sun_family = AF_UNIX; | ||
| 57 | > strncpy(su.sun_path, host_name, sizeof su.sun_path); | ||
| 58 | > *sd = socket(PF_UNIX, SOCK_STREAM, 0); | ||
| 59 | > if ( sd < 0) { | ||
| 60 | > printf ("Socket creation failed\n"); | ||
| 61 | > return STATE_UNKNOWN; | ||
| 62 | > } | ||
| 63 | > result=connect(*sd, (struct sockaddr *)&su, sizeof su); | ||
| 64 | > if (result == -1) { | ||
| 65 | > printf ("Connect to socket failed\n"); | ||
| 66 | > close(*sd); | ||
| 67 | > return STATE_UNKNOWN; | ||
| 68 | > } | ||
| 69 | > | ||
| 70 | > } | ||
| 71 | > | ||
| 72 | Index: netutils.h | ||
| 73 | =================================================================== | ||
| 74 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.h,v | ||
| 75 | retrieving revision 1.12 | ||
| 76 | diff -r1.12 netutils.h | ||
| 77 | 37a38 | ||
| 78 | > #include <sys/un.h> | ||
| 79 | Index: utils.h | ||
| 80 | =================================================================== | ||
| 81 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.h,v | ||
| 82 | retrieving revision 1.22 | ||
| 83 | diff -r1.22 utils.h | ||
| 84 | 139c139 | ||
| 85 | < Host name or IP Address\n\ | ||
| 86 | --- | ||
| 87 | > Host name or IP Address or unix socket (starting with \"/\")\n\ | ||
diff --git a/web/attachments/137019-nagios-plugins-snmp-v2c.patch b/web/attachments/137019-nagios-plugins-snmp-v2c.patch new file mode 100644 index 0000000..c3aaa60 --- /dev/null +++ b/web/attachments/137019-nagios-plugins-snmp-v2c.patch | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | diff -Naur nagios-plugins-1.4.orig/plugins/check_snmp.c nagios-plugins-1.4/plugins/check_snmp.c | ||
| 2 | --- nagios-plugins-1.4.orig/plugins/check_snmp.c 2005-01-20 17:03:56.000000000 -0800 | ||
| 3 | +++ nagios-plugins-1.4/plugins/check_snmp.c 2005-06-02 13:05:51.000000000 -0700 | ||
| 4 | @@ -646,6 +646,9 @@ | ||
| 5 | asprintf(&proto, DEFAULT_PROTOCOL); | ||
| 6 | asprintf(&authpriv, "%s%s", "-c ", community); | ||
| 7 | } | ||
| 8 | + else if ( strcmp (proto, "2c") == 0 ) { /* snmpv2c args */ | ||
| 9 | + asprintf(&authpriv, "%s%s", "-c ", community); | ||
| 10 | + } | ||
| 11 | else if ( strcmp (proto, "3") == 0 ) { /* snmpv3 args */ | ||
| 12 | asprintf(&proto, "%s", "3"); | ||
| 13 | |||
| 14 | @@ -859,7 +862,7 @@ | ||
| 15 | |||
| 16 | /* SNMP and Authentication Protocol */ | ||
| 17 | printf (_("\ | ||
| 18 | - -P, --protocol=[1|3]\n\ | ||
| 19 | + -P, --protocol=[1|2c|3]\n\ | ||
| 20 | SNMP protocol version\n\ | ||
| 21 | -L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]\n\ | ||
| 22 | SNMPv3 securityLevel\n\ | ||
diff --git a/web/attachments/137235-check_ipmi b/web/attachments/137235-check_ipmi new file mode 100644 index 0000000..1d2a5bd --- /dev/null +++ b/web/attachments/137235-check_ipmi | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | # Nagios plugin for IPMI sensors status checking. | ||
| 4 | # | ||
| 5 | # Especially useful on Dell Poweredge servers, and others that | ||
| 6 | # implement the Intelligent Platform Management Interface (IPMI) | ||
| 7 | # interface. | ||
| 8 | # | ||
| 9 | # (C) Chris Wilson <check_ipmi@qwirx.com>, 2005-06-04 | ||
| 10 | # Released under the GNU General Public License (GPL) | ||
| 11 | |||
| 12 | use warnings; | ||
| 13 | use strict; | ||
| 14 | |||
| 15 | open IPMI, "ipmitool sdr |" or die "ipmitool: $!"; | ||
| 16 | |||
| 17 | my %found; | ||
| 18 | my %bad; | ||
| 19 | |||
| 20 | sub trim ($) { | ||
| 21 | my ($v) = @_; | ||
| 22 | $v =~ s/^ +//; | ||
| 23 | $v =~ s/ +$//; | ||
| 24 | return $v; | ||
| 25 | } | ||
| 26 | |||
| 27 | while (my $line = <IPMI>) | ||
| 28 | { | ||
| 29 | chomp $line; | ||
| 30 | unless ($line =~ m'^(.*) \| (.*) \| (\w+)$') | ||
| 31 | { | ||
| 32 | die "Bad format in ipmitool output: $line"; | ||
| 33 | } | ||
| 34 | |||
| 35 | my $name = trim $1; | ||
| 36 | my $value = trim $2; | ||
| 37 | my $state = trim $3; | ||
| 38 | $name =~ tr| |_|; | ||
| 39 | |||
| 40 | my $counter = 1; | ||
| 41 | my $uname = "$name"; | ||
| 42 | while ($found{$uname}) { | ||
| 43 | $uname = $name . $counter++; | ||
| 44 | } | ||
| 45 | |||
| 46 | next if $state eq "ns"; | ||
| 47 | |||
| 48 | if ($state ne "ok") { | ||
| 49 | $bad{$uname} = $state; | ||
| 50 | } | ||
| 51 | |||
| 52 | $found{$uname} = $value; | ||
| 53 | } | ||
| 54 | |||
| 55 | if (keys %bad) { | ||
| 56 | print "IPMI critical: "; | ||
| 57 | my @bad; | ||
| 58 | foreach my $name (sort keys %bad) { | ||
| 59 | push @bad, "$name is $bad{$name}"; | ||
| 60 | } | ||
| 61 | print join(", ", @bad) . " "; | ||
| 62 | } else { | ||
| 63 | print "IPMI ok "; | ||
| 64 | } | ||
| 65 | |||
| 66 | my @out; | ||
| 67 | |||
| 68 | foreach my $name (sort keys %found) { | ||
| 69 | next unless $name =~ m|Fan| or $name =~ m|Temp|; | ||
| 70 | push @out, "$name = $found{$name}"; | ||
| 71 | } | ||
| 72 | |||
| 73 | print "(" . join(", ", @out) . ")\n"; | ||
| 74 | |||
| 75 | if (%bad) { exit 2 } else { exit 0 } | ||
diff --git a/web/attachments/137593-check_hpjd.patch b/web/attachments/137593-check_hpjd.patch new file mode 100644 index 0000000..3c3cc8f --- /dev/null +++ b/web/attachments/137593-check_hpjd.patch | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | --- check_hpjd.orig 2005-06-07 17:57:13.000000000 +0100 | ||
| 2 | +++ check_hpjd.c 2005-06-07 18:19:18.000000000 +0100 | ||
| 3 | @@ -36,8 +36,8 @@ | ||
| 4 | #define HPJD_PAPER_STATUS ".1.3.6.1.4.1.11.2.3.9.1.1.2.2" | ||
| 5 | #define HPJD_INTERVENTION_REQUIRED ".1.3.6.1.4.1.11.2.3.9.1.1.2.3" | ||
| 6 | #define HPJD_GD_PERIPHERAL_ERROR ".1.3.6.1.4.1.11.2.3.9.1.1.2.6" | ||
| 7 | -#define HPJD_GD_PAPER_JAM ".1.3.6.1.4.1.11.2.3.9.1.1.2.8" | ||
| 8 | -#define HPJD_GD_PAPER_OUT ".1.3.6.1.4.1.11.2.3.9.1.1.2.9" | ||
| 9 | +#define HPJD_GD_PAPER_OUT ".1.3.6.1.4.1.11.2.3.9.1.1.2.8" | ||
| 10 | +#define HPJD_GD_PAPER_JAM ".1.3.6.1.4.1.11.2.3.9.1.1.2.9" | ||
| 11 | #define HPJD_GD_TONER_LOW ".1.3.6.1.4.1.11.2.3.9.1.1.2.10" | ||
| 12 | #define HPJD_GD_PAGE_PUNT ".1.3.6.1.4.1.11.2.3.9.1.1.2.11" | ||
| 13 | #define HPJD_GD_MEMORY_OUT ".1.3.6.1.4.1.11.2.3.9.1.1.2.12" | ||
| 14 | @@ -134,7 +134,7 @@ | ||
| 15 | temp_buffer = strtok (input_buffer, "="); | ||
| 16 | temp_buffer = strtok (NULL, "="); | ||
| 17 | |||
| 18 | - if (temp_buffer == NULL) { | ||
| 19 | + if (temp_buffer == NULL && line < 13) { | ||
| 20 | |||
| 21 | result = STATE_UNKNOWN; | ||
| 22 | strcpy (errmsg, input_buffer); | ||
| 23 | @@ -179,8 +179,9 @@ | ||
| 24 | case 12: /* display panel message */ | ||
| 25 | strcpy (display_message, temp_buffer + 1); | ||
| 26 | break; | ||
| 27 | - default: | ||
| 28 | - break; | ||
| 29 | + default: /* fold multiline message */ | ||
| 30 | + strncat (display_message, input_buffer, | ||
| 31 | + sizeof (display_message) - strlen (display_message) - 1); | ||
| 32 | } | ||
| 33 | |||
| 34 | } | ||
diff --git a/web/attachments/137902-nagiosplug-runcmd.diff b/web/attachments/137902-nagiosplug-runcmd.diff new file mode 100644 index 0000000..abebe78 --- /dev/null +++ b/web/attachments/137902-nagiosplug-runcmd.diff | |||
| @@ -0,0 +1,3012 @@ | |||
| 1 | diff -urN ../nplg/plugins/check_by_ssh.c ./plugins/check_by_ssh.c | ||
| 2 | --- ../nplg/plugins/check_by_ssh.c 2005-01-05 21:53:11.000000000 +0100 | ||
| 3 | +++ ./plugins/check_by_ssh.c 2005-06-10 15:01:26.000000000 +0200 | ||
| 4 | @@ -14,19 +14,19 @@ | ||
| 5 | along with this program; if not, write to the Free Software | ||
| 6 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 7 | |||
| 8 | - $Id: check_by_ssh.c,v 1.35 2004/12/25 12:09:19 opensides Exp $ | ||
| 9 | + $Id: check_by_ssh.c,v 1.3 2005/06/06 11:37:06 exon Exp $ | ||
| 10 | |||
| 11 | *****************************************************************************/ | ||
| 12 | |||
| 13 | const char *progname = "check_by_ssh"; | ||
| 14 | -const char *revision = "$Revision: 1.35 $"; | ||
| 15 | +const char *revision = "$Revision: 1.3 $"; | ||
| 16 | const char *copyright = "2000-2004"; | ||
| 17 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 18 | |||
| 19 | #include "common.h" | ||
| 20 | #include "netutils.h" | ||
| 21 | #include "utils.h" | ||
| 22 | -#include "popen.h" | ||
| 23 | +#include "runcmd.h" | ||
| 24 | |||
| 25 | int process_arguments (int, char **); | ||
| 26 | int validate_arguments (void); | ||
| 27 | @@ -49,15 +49,15 @@ | ||
| 28 | main (int argc, char **argv) | ||
| 29 | { | ||
| 30 | |||
| 31 | - char input_buffer[MAX_INPUT_BUFFER]; | ||
| 32 | char *result_text; | ||
| 33 | char *status_text; | ||
| 34 | - char *output; | ||
| 35 | + char *msg; | ||
| 36 | char *eol = NULL; | ||
| 37 | int cresult; | ||
| 38 | int result = STATE_UNKNOWN; | ||
| 39 | time_t local_time; | ||
| 40 | FILE *fp = NULL; | ||
| 41 | + struct output chld_out, chld_err; | ||
| 42 | |||
| 43 | remotecmd = strdup (""); | ||
| 44 | comm = strdup (SSH_COMMAND); | ||
| 45 | @@ -82,48 +82,22 @@ | ||
| 46 | if (verbose) | ||
| 47 | printf ("%s\n", comm); | ||
| 48 | |||
| 49 | - child_process = spopen (comm); | ||
| 50 | - | ||
| 51 | - if (child_process == NULL) { | ||
| 52 | - printf (_("Could not open pipe: %s\n"), comm); | ||
| 53 | - return STATE_UNKNOWN; | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - | ||
| 57 | - /* open STDERR for spopen */ | ||
| 58 | - child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 59 | - if (child_stderr == NULL) { | ||
| 60 | - printf (_("Could not open stderr for %s\n"), SSH_COMMAND); | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | + result = np_runcmd(comm, &chld_out, &chld_err, 0); | ||
| 64 | |||
| 65 | /* build up results from remote command in result_text */ | ||
| 66 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) | ||
| 67 | - asprintf (&result_text, "%s%s", result_text, input_buffer); | ||
| 68 | + if(skip_lines && skip_lines < chld_out.lines) | ||
| 69 | + result_text = chld_out.line[skip_lines]; | ||
| 70 | + else | ||
| 71 | + result_text = chld_out.line[0]; | ||
| 72 | |||
| 73 | /* WARNING if output found on stderr */ | ||
| 74 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { | ||
| 75 | - if (skip_lines > 0) { | ||
| 76 | - if (input_buffer[strlen(input_buffer)-1] == '\n') { | ||
| 77 | - skip_lines--; | ||
| 78 | - } | ||
| 79 | - } else { | ||
| 80 | - printf ("%s", input_buffer); | ||
| 81 | - result = STATE_WARNING; | ||
| 82 | - } | ||
| 83 | + if(chld_err.buflen) { | ||
| 84 | + printf("%s\n", chld_err.line[0]); | ||
| 85 | + return STATE_WARNING; | ||
| 86 | } | ||
| 87 | - (void) fclose (child_stderr); | ||
| 88 | - if (result == STATE_WARNING) | ||
| 89 | - return result; | ||
| 90 | - | ||
| 91 | - | ||
| 92 | - /* close the pipe */ | ||
| 93 | - result = spclose (child_process); | ||
| 94 | - | ||
| 95 | |||
| 96 | /* process output */ | ||
| 97 | if (passive) { | ||
| 98 | - | ||
| 99 | if (!(fp = fopen (outputfile, "a"))) { | ||
| 100 | printf (_("SSH WARNING: could not open %s\n"), outputfile); | ||
| 101 | exit (STATE_UNKNOWN); | ||
| 102 | @@ -137,19 +111,19 @@ | ||
| 103 | printf ("%s", result_text); | ||
| 104 | return result; | ||
| 105 | } | ||
| 106 | - asprintf (&output, "%s", result_text); | ||
| 107 | + asprintf (&msg, "%s", result_text); | ||
| 108 | result_text = strnl (status_text); | ||
| 109 | - eol = strpbrk (output, "\r\n"); | ||
| 110 | + eol = strpbrk (msg, "\r\n"); | ||
| 111 | if (eol != NULL) | ||
| 112 | eol[0] = 0; | ||
| 113 | if (service[commands] && status_text | ||
| 114 | - && sscanf (status_text, "STATUS CODE: %d", &cresult) == 1) { | ||
| 115 | + && sscanf (status_text, "STATUS CODE: %d", &cresult) == 1) | ||
| 116 | + { | ||
| 117 | fprintf (fp, "[%d] PROCESS_SERVICE_CHECK_RESULT;%s;%s;%d;%s\n", | ||
| 118 | - (int) local_time, host_shortname, service[commands++], cresult, | ||
| 119 | - output); | ||
| 120 | + (int) local_time, host_shortname, service[commands++], | ||
| 121 | + cresult, msg); | ||
| 122 | } | ||
| 123 | } | ||
| 124 | - | ||
| 125 | } | ||
| 126 | |||
| 127 | |||
| 128 | @@ -206,7 +180,7 @@ | ||
| 129 | |||
| 130 | while (1) { | ||
| 131 | c = getopt_long (argc, argv, "Vvh1246ft:H:O:p:i:u:l:C:S:n:s:", longopts, | ||
| 132 | - &option); | ||
| 133 | + &option); | ||
| 134 | |||
| 135 | if (c == -1 || c == EOF) | ||
| 136 | break; | ||
| 137 | @@ -244,25 +218,27 @@ | ||
| 138 | passive = TRUE; | ||
| 139 | break; | ||
| 140 | case 's': /* description of service to check */ | ||
| 141 | - service = realloc (service, (++services) * sizeof(char *)); | ||
| 142 | p1 = optarg; | ||
| 143 | + service = realloc (service, (++services) * sizeof(char *)); | ||
| 144 | while ((p2 = index (p1, ':'))) { | ||
| 145 | *p2 = '\0'; | ||
| 146 | - asprintf (&service[services-1], "%s", p1); | ||
| 147 | + service[services - 1] = p1; | ||
| 148 | service = realloc (service, (++services) * sizeof(char *)); | ||
| 149 | p1 = p2 + 1; | ||
| 150 | } | ||
| 151 | - asprintf (&service[services-1], "%s", p1); | ||
| 152 | + service[services - 1] = p1; | ||
| 153 | break; | ||
| 154 | case 'n': /* short name of host in nagios configuration */ | ||
| 155 | host_shortname = optarg; | ||
| 156 | break; | ||
| 157 | + | ||
| 158 | case 'u': | ||
| 159 | c = 'l'; | ||
| 160 | case 'l': /* login name */ | ||
| 161 | case 'i': /* identity */ | ||
| 162 | asprintf (&comm, "%s -%c %s", comm, c, optarg); | ||
| 163 | break; | ||
| 164 | + | ||
| 165 | case '1': /* Pass these switches directly to ssh */ | ||
| 166 | case '2': /* 1 to force version 1, 2 to force version 2 */ | ||
| 167 | case '4': /* -4 for IPv4 */ | ||
| 168 | diff -urN ../nplg/plugins/check_dig.c ./plugins/check_dig.c | ||
| 169 | --- ../nplg/plugins/check_dig.c 2005-01-28 15:00:58.000000000 +0100 | ||
| 170 | +++ ./plugins/check_dig.c 2005-06-10 15:01:26.000000000 +0200 | ||
| 171 | @@ -14,29 +14,33 @@ | ||
| 172 | along with this program; if not, write to the Free Software | ||
| 173 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 174 | |||
| 175 | - $Id: check_dig.c,v 1.40 2005/01/26 21:21:01 tonvoon Exp $ | ||
| 176 | + $Id: check_dig.c,v 1.3 2005/06/06 11:37:06 exon Exp $ | ||
| 177 | |||
| 178 | *****************************************************************************/ | ||
| 179 | |||
| 180 | +/* Hackers note: | ||
| 181 | + * There are typecasts to (char *) from _("foo bar") in this file. | ||
| 182 | + * They prevent compiler warnings. Never (ever), permute strings obtained | ||
| 183 | + * that are typecast from (const char *) (which happens when --disable-nls) | ||
| 184 | + * because on some architectures those strings are in non-writable memory */ | ||
| 185 | + | ||
| 186 | const char *progname = "check_dig"; | ||
| 187 | -const char *revision = "$Revision: 1.40 $"; | ||
| 188 | +const char *revision = "$Revision: 1.3 $"; | ||
| 189 | const char *copyright = "2002-2004"; | ||
| 190 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 191 | |||
| 192 | #include "common.h" | ||
| 193 | #include "netutils.h" | ||
| 194 | #include "utils.h" | ||
| 195 | -#include "popen.h" | ||
| 196 | +#include "runcmd.h" | ||
| 197 | |||
| 198 | int process_arguments (int, char **); | ||
| 199 | int validate_arguments (void); | ||
| 200 | void print_help (void); | ||
| 201 | void print_usage (void); | ||
| 202 | |||
| 203 | -enum { | ||
| 204 | - UNDEFINED = 0, | ||
| 205 | - DEFAULT_PORT = 53 | ||
| 206 | -}; | ||
| 207 | +#define UNDEFINED 0 | ||
| 208 | +#define DEFAULT_PORT 53 | ||
| 209 | |||
| 210 | char *query_address = NULL; | ||
| 211 | char *record_type = "A"; | ||
| 212 | @@ -51,16 +55,15 @@ | ||
| 213 | int | ||
| 214 | main (int argc, char **argv) | ||
| 215 | { | ||
| 216 | - char input_buffer[MAX_INPUT_BUFFER]; | ||
| 217 | char *command_line; | ||
| 218 | - char *output; | ||
| 219 | + output chld_out, chld_err; | ||
| 220 | + char *msg = NULL; | ||
| 221 | + size_t i; | ||
| 222 | char *t; | ||
| 223 | long microsec; | ||
| 224 | double elapsed_time; | ||
| 225 | int result = STATE_UNKNOWN; | ||
| 226 | |||
| 227 | - output = strdup (""); | ||
| 228 | - | ||
| 229 | setlocale (LC_ALL, ""); | ||
| 230 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 231 | textdomain (PACKAGE); | ||
| 232 | @@ -89,100 +92,75 @@ | ||
| 233 | } | ||
| 234 | |||
| 235 | /* run the command */ | ||
| 236 | - child_process = spopen (command_line); | ||
| 237 | - if (child_process == NULL) { | ||
| 238 | - printf (_("Could not open pipe: %s\n"), command_line); | ||
| 239 | - return STATE_UNKNOWN; | ||
| 240 | + if((result = np_runcmd(command_line, &chld_out, &chld_err, 0)) != 0) { | ||
| 241 | + result = STATE_WARNING; | ||
| 242 | + msg = (char *)_("dig returned an error status"); | ||
| 243 | } | ||
| 244 | |||
| 245 | - child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 246 | - if (child_stderr == NULL) | ||
| 247 | - printf (_("Could not open stderr for %s\n"), command_line); | ||
| 248 | - | ||
| 249 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 250 | - | ||
| 251 | + for(i = 0; i < chld_out.lines; i++) { | ||
| 252 | /* the server is responding, we just got the host name... */ | ||
| 253 | - if (strstr (input_buffer, ";; ANSWER SECTION:")) { | ||
| 254 | + if (strstr (chld_out.line[i], ";; ANSWER SECTION:")) { | ||
| 255 | |||
| 256 | /* loop through the whole 'ANSWER SECTION' */ | ||
| 257 | - do { | ||
| 258 | + for(; i < chld_out.lines; i++) { | ||
| 259 | /* get the host address */ | ||
| 260 | - if (!fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) | ||
| 261 | - break; | ||
| 262 | - | ||
| 263 | - if (strpbrk (input_buffer, "\r\n")) | ||
| 264 | - input_buffer[strcspn (input_buffer, "\r\n")] = '\0'; | ||
| 265 | + if (verbose) | ||
| 266 | + printf ("%s\n", chld_out.line[i]); | ||
| 267 | |||
| 268 | - if (verbose && !strstr (input_buffer, ";; ")) | ||
| 269 | - printf ("%s\n", input_buffer); | ||
| 270 | - | ||
| 271 | - if (expected_address==NULL && strstr (input_buffer, query_address) != NULL) { | ||
| 272 | - output = strdup(input_buffer); | ||
| 273 | + if (strstr (chld_out.line[i], (expected_address == NULL ? query_address : expected_address)) != NULL) { | ||
| 274 | + msg = chld_out.line[i]; | ||
| 275 | result = STATE_OK; | ||
| 276 | - } | ||
| 277 | - else if (expected_address != NULL && strstr (input_buffer, expected_address) != NULL) { | ||
| 278 | - output = strdup(input_buffer); | ||
| 279 | - result = STATE_OK; | ||
| 280 | - } | ||
| 281 | |||
| 282 | - /* Translate output TAB -> SPACE */ | ||
| 283 | - t = output; | ||
| 284 | - while ((t = index(t, '\t')) != NULL) | ||
| 285 | - *t = ' '; | ||
| 286 | - | ||
| 287 | - } while (!strstr (input_buffer, ";; ")); | ||
| 288 | + /* Translate output TAB -> SPACE */ | ||
| 289 | + t = msg; | ||
| 290 | + while ((t = strchr(t, '\t')) != NULL) *t = ' '; | ||
| 291 | + break; | ||
| 292 | + } | ||
| 293 | + } | ||
| 294 | |||
| 295 | if (result == STATE_UNKNOWN) { | ||
| 296 | - asprintf (&output, _("Server not found in ANSWER SECTION")); | ||
| 297 | - result = STATE_WARNING; | ||
| 298 | - } | ||
| 299 | - } | ||
| 300 | - | ||
| 301 | - } | ||
| 302 | - | ||
| 303 | - if (result == STATE_UNKNOWN) { | ||
| 304 | - asprintf (&output, _("No ANSWER SECTION found")); | ||
| 305 | - } | ||
| 306 | + msg = (char *)_("Server not found in ANSWER SECTION"); | ||
| 307 | + result = STATE_WARNING; | ||
| 308 | + } | ||
| 309 | |||
| 310 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { | ||
| 311 | - /* If we get anything on STDERR, at least set warning */ | ||
| 312 | - result = max_state (result, STATE_WARNING); | ||
| 313 | - printf ("%s", input_buffer); | ||
| 314 | - if (strlen (output) == 0) | ||
| 315 | - output = strdup (1 + index (input_buffer, ':')); | ||
| 316 | + /* we found the answer section, so break out of the loop */ | ||
| 317 | + break; | ||
| 318 | + } | ||
| 319 | } | ||
| 320 | |||
| 321 | - (void) fclose (child_stderr); | ||
| 322 | + if (result == STATE_UNKNOWN) | ||
| 323 | + msg = (char *)_("No ANSWER SECTION found"); | ||
| 324 | |||
| 325 | - /* close the pipe */ | ||
| 326 | - if (spclose (child_process)) { | ||
| 327 | - result = max_state (result, STATE_WARNING); | ||
| 328 | - if (strlen (output) == 0) | ||
| 329 | - asprintf (&output, _("dig returned an error status")); | ||
| 330 | + /* If we get anything on STDERR, at least set warning */ | ||
| 331 | + if(chld_err.buflen > 0) { | ||
| 332 | + result = max_state(result, STATE_WARNING); | ||
| 333 | + if(!msg) for(i = 0; i < chld_err.lines; i++) { | ||
| 334 | + msg = strchr(chld_err.line[0], ':'); | ||
| 335 | + if(msg) { | ||
| 336 | + msg++; | ||
| 337 | + break; | ||
| 338 | + } | ||
| 339 | + } | ||
| 340 | } | ||
| 341 | |||
| 342 | microsec = deltime (tv); | ||
| 343 | elapsed_time = (double)microsec / 1.0e6; | ||
| 344 | |||
| 345 | - if (output == NULL || strlen (output) == 0) | ||
| 346 | - asprintf (&output, _(" Probably a non-existent host/domain")); | ||
| 347 | - | ||
| 348 | if (critical_interval > UNDEFINED && elapsed_time > critical_interval) | ||
| 349 | result = STATE_CRITICAL; | ||
| 350 | |||
| 351 | else if (warning_interval > UNDEFINED && elapsed_time > warning_interval) | ||
| 352 | result = STATE_WARNING; | ||
| 353 | |||
| 354 | - asprintf (&output, _("%.3f seconds response time (%s)"), elapsed_time, output); | ||
| 355 | - | ||
| 356 | - printf ("DNS %s - %s|%s\n", | ||
| 357 | - state_text (result), output, | ||
| 358 | + printf ("DNS %s - %.3f seconds response time (%s)|%s\n", | ||
| 359 | + state_text (result), elapsed_time, | ||
| 360 | + msg ? msg : _("Probably a non-existent host/domain"), | ||
| 361 | fperfdata("time", elapsed_time, "s", | ||
| 362 | - (warning_interval>UNDEFINED?TRUE:FALSE), | ||
| 363 | - warning_interval, | ||
| 364 | - (critical_interval>UNDEFINED?TRUE:FALSE), | ||
| 365 | - critical_interval, | ||
| 366 | - TRUE, 0, FALSE, 0)); | ||
| 367 | + (warning_interval>UNDEFINED?TRUE:FALSE), | ||
| 368 | + warning_interval, | ||
| 369 | + (critical_interval>UNDEFINED?TRUE:FALSE), | ||
| 370 | + critical_interval, | ||
| 371 | + TRUE, 0, FALSE, 0)); | ||
| 372 | return result; | ||
| 373 | } | ||
| 374 | |||
| 375 | @@ -359,6 +337,6 @@ | ||
| 376 | { | ||
| 377 | printf ("\ | ||
| 378 | Usage: %s -H host -l lookup [-p <server port>] [-T <query type>]\n\ | ||
| 379 | - [-w <warning interval>] [-c <critical interval>] [-t <timeout>]\n\ | ||
| 380 | - [-a <expected answer address>] [-v]\n", progname); | ||
| 381 | + [-w <warning interval>] [-c <critical interval>] [-t <timeout>]\n\ | ||
| 382 | + [-a <expected answer address>] [-v]\n", progname); | ||
| 383 | } | ||
| 384 | diff -urN ../nplg/plugins/check_dns.c ./plugins/check_dns.c | ||
| 385 | --- ../nplg/plugins/check_dns.c 2005-01-05 21:53:12.000000000 +0100 | ||
| 386 | +++ ./plugins/check_dns.c 2005-06-10 15:01:26.000000000 +0200 | ||
| 387 | @@ -17,19 +17,19 @@ | ||
| 388 | LIMITATION: nslookup on Solaris 7 can return output over 2 lines, which will not | ||
| 389 | be picked up by this plugin | ||
| 390 | |||
| 391 | - $Id: check_dns.c,v 1.47 2004/12/30 00:41:39 opensides Exp $ | ||
| 392 | + $Id: check_dns.c,v 1.3 2005/06/06 11:37:06 exon Exp $ | ||
| 393 | |||
| 394 | ******************************************************************************/ | ||
| 395 | |||
| 396 | const char *progname = "check_dns"; | ||
| 397 | -const char *revision = "$Revision: 1.47 $"; | ||
| 398 | +const char *revision = "$Revision: 1.3 $"; | ||
| 399 | const char *copyright = "2000-2004"; | ||
| 400 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 401 | |||
| 402 | #include "common.h" | ||
| 403 | -#include "popen.h" | ||
| 404 | #include "utils.h" | ||
| 405 | #include "netutils.h" | ||
| 406 | +#include "runcmd.h" | ||
| 407 | |||
| 408 | int process_arguments (int, char **); | ||
| 409 | int validate_arguments (void); | ||
| 410 | @@ -51,8 +51,8 @@ | ||
| 411 | { | ||
| 412 | char *command_line = NULL; | ||
| 413 | char input_buffer[MAX_INPUT_BUFFER]; | ||
| 414 | - char *output = NULL; | ||
| 415 | char *address = NULL; | ||
| 416 | + char *msg = NULL; | ||
| 417 | char *temp_buffer = NULL; | ||
| 418 | int non_authoritative = FALSE; | ||
| 419 | int result = STATE_UNKNOWN; | ||
| 420 | @@ -61,6 +61,8 @@ | ||
| 421 | struct timeval tv; | ||
| 422 | int multi_address; | ||
| 423 | int parse_address = FALSE; /* This flag scans for Address: but only after Name: */ | ||
| 424 | + output chld_out, chld_err; | ||
| 425 | + size_t i; | ||
| 426 | |||
| 427 | setlocale (LC_ALL, ""); | ||
| 428 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 429 | @@ -85,37 +87,31 @@ | ||
| 430 | printf ("%s\n", command_line); | ||
| 431 | |||
| 432 | /* run the command */ | ||
| 433 | - child_process = spopen (command_line); | ||
| 434 | - if (child_process == NULL) { | ||
| 435 | - printf (_("Could not open pipe: %s\n"), command_line); | ||
| 436 | - return STATE_UNKNOWN; | ||
| 437 | + if((np_runcmd(command_line, &chld_out, &chld_err, 0)) != 0) { | ||
| 438 | + msg = (char *)_("nslookup returned error status"); | ||
| 439 | + result = STATE_WARNING; | ||
| 440 | } | ||
| 441 | |||
| 442 | - child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 443 | - if (child_stderr == NULL) | ||
| 444 | - printf (_("Could not open stderr for %s\n"), command_line); | ||
| 445 | - | ||
| 446 | /* scan stdout */ | ||
| 447 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 448 | - | ||
| 449 | + for(i = 0; i < chld_out.lines; i++) { | ||
| 450 | if (verbose) | ||
| 451 | - printf ("%s", input_buffer); | ||
| 452 | + printf ("%s", chld_out.line[i]); | ||
| 453 | |||
| 454 | - if (strstr (input_buffer, ".in-addr.arpa")) { | ||
| 455 | - if ((temp_buffer = strstr (input_buffer, "name = "))) | ||
| 456 | + if (strstr (chld_out.line[i], ".in-addr.arpa")) { | ||
| 457 | + if ((temp_buffer = strstr (chld_out.line[i], "name = "))) | ||
| 458 | address = strdup (temp_buffer + 7); | ||
| 459 | else { | ||
| 460 | - output = strdup (_("Warning plugin error")); | ||
| 461 | + msg = (char *)_("Warning plugin error"); | ||
| 462 | result = STATE_WARNING; | ||
| 463 | } | ||
| 464 | } | ||
| 465 | |||
| 466 | /* the server is responding, we just got the host name... */ | ||
| 467 | - if (strstr (input_buffer, "Name:")) | ||
| 468 | + if (strstr (chld_out.line[i], "Name:")) | ||
| 469 | parse_address = TRUE; | ||
| 470 | - else if (parse_address == TRUE && (strstr (input_buffer, "Address:") || | ||
| 471 | - strstr (input_buffer, "Addresses:"))) { | ||
| 472 | - temp_buffer = index (input_buffer, ':'); | ||
| 473 | + else if (parse_address == TRUE && (strstr (chld_out.line[i], "Address:") || | ||
| 474 | + strstr (chld_out.line[i], "Addresses:"))) { | ||
| 475 | + temp_buffer = index (chld_out.line[i], ':'); | ||
| 476 | temp_buffer++; | ||
| 477 | |||
| 478 | /* Strip leading spaces */ | ||
| 479 | @@ -135,59 +131,47 @@ | ||
| 480 | asprintf(&address, "%s,%s", address, temp_buffer); | ||
| 481 | } | ||
| 482 | |||
| 483 | - else if (strstr (input_buffer, _("Non-authoritative answer:"))) { | ||
| 484 | + else if (strstr (chld_out.line[i], _("Non-authoritative answer:"))) { | ||
| 485 | non_authoritative = TRUE; | ||
| 486 | } | ||
| 487 | |||
| 488 | - result = error_scan (input_buffer); | ||
| 489 | + result = error_scan (chld_out.line[i]); | ||
| 490 | if (result != STATE_OK) { | ||
| 491 | - output = strdup (1 + index (input_buffer, ':')); | ||
| 492 | - strip (output); | ||
| 493 | + msg = strchr (chld_out.line[i], ':'); | ||
| 494 | + if(msg) msg++; | ||
| 495 | break; | ||
| 496 | } | ||
| 497 | - | ||
| 498 | } | ||
| 499 | |||
| 500 | /* scan stderr */ | ||
| 501 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { | ||
| 502 | - | ||
| 503 | + for(i = 0; i < chld_err.lines; i++) { | ||
| 504 | if (verbose) | ||
| 505 | - printf ("%s", input_buffer); | ||
| 506 | + printf ("%s", chld_err.line[i]); | ||
| 507 | |||
| 508 | - if (error_scan (input_buffer) != STATE_OK) { | ||
| 509 | - result = max_state (result, error_scan (input_buffer)); | ||
| 510 | - output = strdup (1 + index (input_buffer, ':')); | ||
| 511 | - strip (output); | ||
| 512 | + if (error_scan (chld_err.line[i]) != STATE_OK) { | ||
| 513 | + result = max_state (result, error_scan (chld_err.line[i])); | ||
| 514 | + msg = strchr(input_buffer, ':'); | ||
| 515 | + if(msg) msg++; | ||
| 516 | } | ||
| 517 | } | ||
| 518 | |||
| 519 | - /* close stderr */ | ||
| 520 | - (void) fclose (child_stderr); | ||
| 521 | - | ||
| 522 | - /* close stdout */ | ||
| 523 | - if (spclose (child_process)) { | ||
| 524 | - result = max_state (result, STATE_WARNING); | ||
| 525 | - if (output == NULL || !strcmp (output, "")) | ||
| 526 | - output = strdup (_("nslookup returned error status")); | ||
| 527 | - } | ||
| 528 | - | ||
| 529 | - /* If we got here, we should have an address string, | ||
| 530 | - and we can segfault if we do not */ | ||
| 531 | + /* If we got here, we should have an address string, | ||
| 532 | + * and we can segfault if we do not */ | ||
| 533 | if (address==NULL || strlen(address)==0) | ||
| 534 | die (STATE_CRITICAL, | ||
| 535 | - _("DNS CRITICAL - '%s' output parsing exited with no address\n"), | ||
| 536 | + _("DNS CRITICAL - '%s' msg parsing exited with no address\n"), | ||
| 537 | NSLOOKUP_COMMAND); | ||
| 538 | |||
| 539 | /* compare to expected address */ | ||
| 540 | if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) { | ||
| 541 | result = STATE_CRITICAL; | ||
| 542 | - asprintf(&output, _("expected %s but got %s"), expected_address, address); | ||
| 543 | + asprintf(&msg, _("expected %s but got %s"), expected_address, address); | ||
| 544 | } | ||
| 545 | |||
| 546 | /* check if authoritative */ | ||
| 547 | if (result == STATE_OK && expect_authority && non_authoritative) { | ||
| 548 | result = STATE_CRITICAL; | ||
| 549 | - asprintf(&output, _("server %s is not authoritative for %s"), dns_server, query_address); | ||
| 550 | + asprintf(&msg, _("server %s is not authoritative for %s"), dns_server, query_address); | ||
| 551 | } | ||
| 552 | |||
| 553 | microsec = deltime (tv); | ||
| 554 | @@ -206,13 +190,13 @@ | ||
| 555 | } | ||
| 556 | else if (result == STATE_WARNING) | ||
| 557 | printf (_("DNS WARNING - %s\n"), | ||
| 558 | - !strcmp (output, "") ? _(" Probably a non-existent host/domain") : output); | ||
| 559 | + !strcmp (msg, "") ? _(" Probably a non-existent host/domain") : msg); | ||
| 560 | else if (result == STATE_CRITICAL) | ||
| 561 | printf (_("DNS CRITICAL - %s\n"), | ||
| 562 | - !strcmp (output, "") ? _(" Probably a non-existent host/domain") : output); | ||
| 563 | + !strcmp (msg, "") ? _(" Probably a non-existent host/domain") : msg); | ||
| 564 | else | ||
| 565 | printf (_("DNS UNKNOW - %s\n"), | ||
| 566 | - !strcmp (output, "") ? _(" Probably a non-existent host/domain") : output); | ||
| 567 | + !strcmp (msg, "") ? _(" Probably a non-existent host/domain") : msg); | ||
| 568 | |||
| 569 | return result; | ||
| 570 | } | ||
| 571 | diff -urN ../nplg/plugins/check_fping.c ./plugins/check_fping.c | ||
| 572 | --- ../nplg/plugins/check_fping.c 2005-01-05 21:53:13.000000000 +0100 | ||
| 573 | +++ ./plugins/check_fping.c 2005-06-10 15:01:26.000000000 +0200 | ||
| 574 | @@ -14,26 +14,24 @@ | ||
| 575 | along with this program; if not, write to the Free Software | ||
| 576 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 577 | |||
| 578 | - $Id: check_fping.c,v 1.24 2004/12/25 23:17:44 opensides Exp $ | ||
| 579 | + $Id: check_fping.c,v 1.2 2005/06/05 21:55:26 exon Exp $ | ||
| 580 | |||
| 581 | ******************************************************************************/ | ||
| 582 | |||
| 583 | const char *progname = "check_fping"; | ||
| 584 | -const char *revision = "$Revision: 1.24 $"; | ||
| 585 | +const char *revision = "$Revision: 1.2 $"; | ||
| 586 | const char *copyright = "2000-2004"; | ||
| 587 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 588 | |||
| 589 | #include "common.h" | ||
| 590 | -#include "popen.h" | ||
| 591 | #include "netutils.h" | ||
| 592 | #include "utils.h" | ||
| 593 | +#include "runcmd.h" | ||
| 594 | |||
| 595 | -enum { | ||
| 596 | - PACKET_COUNT = 1, | ||
| 597 | - PACKET_SIZE = 56, | ||
| 598 | - PL = 0, | ||
| 599 | - RTA = 1 | ||
| 600 | -}; | ||
| 601 | +#define PACKET_COUNT 1 | ||
| 602 | +#define PACKET_SIZE 56 | ||
| 603 | +#define PL 0 | ||
| 604 | +#define RTA 1 | ||
| 605 | |||
| 606 | int textscan (char *buf); | ||
| 607 | int process_arguments (int, char **); | ||
| 608 | @@ -59,11 +57,11 @@ | ||
| 609 | { | ||
| 610 | /* normaly should be int result = STATE_UNKNOWN; */ | ||
| 611 | |||
| 612 | - int status = STATE_UNKNOWN; | ||
| 613 | + int result = STATE_UNKNOWN; | ||
| 614 | char *server = NULL; | ||
| 615 | char *command_line = NULL; | ||
| 616 | - char *input_buffer = NULL; | ||
| 617 | - input_buffer = malloc (MAX_INPUT_BUFFER); | ||
| 618 | + output chld_out, chld_err; | ||
| 619 | + size_t i; | ||
| 620 | |||
| 621 | setlocale (LC_ALL, ""); | ||
| 622 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 623 | @@ -79,43 +77,21 @@ | ||
| 624 | packet_size, packet_count, server); | ||
| 625 | |||
| 626 | if (verbose) | ||
| 627 | - printf ("%s\n", command_line); | ||
| 628 | + printf ("command_line: %s\n", command_line); | ||
| 629 | |||
| 630 | /* run the command */ | ||
| 631 | - child_process = spopen (command_line); | ||
| 632 | - if (child_process == NULL) { | ||
| 633 | - printf (_("Could not open pipe: %s\n"), command_line); | ||
| 634 | - return STATE_UNKNOWN; | ||
| 635 | - } | ||
| 636 | - | ||
| 637 | - child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 638 | - if (child_stderr == NULL) { | ||
| 639 | - printf (_("Could not open stderr for %s\n"), command_line); | ||
| 640 | - } | ||
| 641 | + if((np_runcmd(command_line, &chld_out, &chld_err, 0)) || chld_err.buflen) | ||
| 642 | + result = STATE_WARNING; | ||
| 643 | |||
| 644 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 645 | - if (verbose) | ||
| 646 | - printf ("%s", input_buffer); | ||
| 647 | - status = max_state (status, textscan (input_buffer)); | ||
| 648 | - } | ||
| 649 | - | ||
| 650 | - /* If we get anything on STDERR, at least set warning */ | ||
| 651 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { | ||
| 652 | - status = max_state (status, STATE_WARNING); | ||
| 653 | - if (verbose) | ||
| 654 | - printf ("%s", input_buffer); | ||
| 655 | - status = max_state (status, textscan (input_buffer)); | ||
| 656 | - } | ||
| 657 | - (void) fclose (child_stderr); | ||
| 658 | + for(i = 0; i < chld_out.lines; i++) | ||
| 659 | + result = max_state (result, textscan (chld_out.line[i])); | ||
| 660 | |||
| 661 | - /* close the pipe */ | ||
| 662 | - if (spclose (child_process)) | ||
| 663 | - /* need to use max_state not max */ | ||
| 664 | - status = max_state (status, STATE_WARNING); | ||
| 665 | + printf ("FPING %s - %s\n", state_text (result), server_name); | ||
| 666 | |||
| 667 | - printf ("FPING %s - %s\n", state_text (status), server_name); | ||
| 668 | + if (verbose) for(i = 0; i < chld_out.lines; i++) | ||
| 669 | + printf ("%s", chld_out.line[i]); | ||
| 670 | |||
| 671 | - return status; | ||
| 672 | + return result; | ||
| 673 | } | ||
| 674 | |||
| 675 | |||
| 676 | @@ -127,7 +103,7 @@ | ||
| 677 | char *losstr = NULL; | ||
| 678 | double loss; | ||
| 679 | double rta; | ||
| 680 | - int status = STATE_UNKNOWN; | ||
| 681 | + int result = STATE_UNKNOWN; | ||
| 682 | |||
| 683 | if (strstr (buf, "not found")) { | ||
| 684 | die (STATE_CRITICAL, _("FPING UNKNOW - %s not found\n"), server_name); | ||
| 685 | @@ -143,7 +119,7 @@ | ||
| 686 | |||
| 687 | } | ||
| 688 | else if (strstr (buf, "is alive")) { | ||
| 689 | - status = STATE_OK; | ||
| 690 | + result = STATE_OK; | ||
| 691 | |||
| 692 | } | ||
| 693 | else if (strstr (buf, "xmt/rcv/%loss") && strstr (buf, "min/avg/max")) { | ||
| 694 | @@ -156,18 +132,18 @@ | ||
| 695 | loss = strtod (losstr, NULL); | ||
| 696 | rta = strtod (rtastr, NULL); | ||
| 697 | if (cpl_p == TRUE && loss > cpl) | ||
| 698 | - status = STATE_CRITICAL; | ||
| 699 | + result = STATE_CRITICAL; | ||
| 700 | else if (crta_p == TRUE && rta > crta) | ||
| 701 | - status = STATE_CRITICAL; | ||
| 702 | + result = STATE_CRITICAL; | ||
| 703 | else if (wpl_p == TRUE && loss > wpl) | ||
| 704 | - status = STATE_WARNING; | ||
| 705 | + result = STATE_WARNING; | ||
| 706 | else if (wrta_p == TRUE && rta > wrta) | ||
| 707 | - status = STATE_WARNING; | ||
| 708 | + result = STATE_WARNING; | ||
| 709 | else | ||
| 710 | - status = STATE_OK; | ||
| 711 | - die (status, | ||
| 712 | + result = STATE_OK; | ||
| 713 | + die (result, | ||
| 714 | _("FPING %s - %s (loss=%.0f%%, rta=%f ms)|%s %s\n"), | ||
| 715 | - state_text (status), server_name, loss, rta, | ||
| 716 | + state_text (result), server_name, loss, rta, | ||
| 717 | perfdata ("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, TRUE, 0, TRUE, 100), | ||
| 718 | fperfdata ("rta", rta/1.0e3, "s", wrta_p, wrta/1.0e3, crta_p, crta/1.0e3, TRUE, 0, FALSE, 0)); | ||
| 719 | |||
| 720 | @@ -179,24 +155,24 @@ | ||
| 721 | losstr = 1 + strstr (losstr, "/"); | ||
| 722 | loss = strtod (losstr, NULL); | ||
| 723 | if (atoi(losstr) == 100) | ||
| 724 | - status = STATE_CRITICAL; | ||
| 725 | + result = STATE_CRITICAL; | ||
| 726 | else if (cpl_p == TRUE && loss > cpl) | ||
| 727 | - status = STATE_CRITICAL; | ||
| 728 | + result = STATE_CRITICAL; | ||
| 729 | else if (wpl_p == TRUE && loss > wpl) | ||
| 730 | - status = STATE_WARNING; | ||
| 731 | + result = STATE_WARNING; | ||
| 732 | else | ||
| 733 | - status = STATE_OK; | ||
| 734 | + result = STATE_OK; | ||
| 735 | /* loss=%.0f%%;%d;%d;0;100 */ | ||
| 736 | - die (status, _("FPING %s - %s (loss=%.0f%% )|%s\n"), | ||
| 737 | - state_text (status), server_name, loss , | ||
| 738 | + die (result, _("FPING %s - %s (loss=%.0f%% )|%s\n"), | ||
| 739 | + state_text (result), server_name, loss , | ||
| 740 | perfdata ("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, TRUE, 0, TRUE, 100)); | ||
| 741 | |||
| 742 | } | ||
| 743 | else { | ||
| 744 | - status = max_state (status, STATE_WARNING); | ||
| 745 | + result = max_state (result, STATE_WARNING); | ||
| 746 | } | ||
| 747 | |||
| 748 | - return status; | ||
| 749 | + return result; | ||
| 750 | } | ||
| 751 | |||
| 752 | |||
| 753 | diff -urN ../nplg/plugins/check_game.c ./plugins/check_game.c | ||
| 754 | --- ../nplg/plugins/check_game.c 2005-01-05 21:53:13.000000000 +0100 | ||
| 755 | +++ ./plugins/check_game.c 2005-06-10 15:01:26.000000000 +0200 | ||
| 756 | @@ -14,17 +14,17 @@ | ||
| 757 | * along with this program; if not, write to the Free Software | ||
| 758 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 759 | * | ||
| 760 | -* $Id: check_game.c,v 1.22 2004/12/25 23:17:44 opensides Exp $ | ||
| 761 | +* $Id: check_game.c,v 1.2 2005/06/05 21:55:26 exon Exp $ | ||
| 762 | *****************************************************************************/ | ||
| 763 | |||
| 764 | const char *progname = "check_game"; | ||
| 765 | -const char *revision = "$Revision: 1.22 $"; | ||
| 766 | +const char *revision = "$Revision: 1.2 $"; | ||
| 767 | const char *copyright = "2002-2004"; | ||
| 768 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 769 | |||
| 770 | #include "common.h" | ||
| 771 | -#include "popen.h" | ||
| 772 | #include "utils.h" | ||
| 773 | +#include "runcmd.h" | ||
| 774 | |||
| 775 | int process_arguments (int, char **); | ||
| 776 | int validate_arguments (void); | ||
| 777 | @@ -57,9 +57,9 @@ | ||
| 778 | char *command_line; | ||
| 779 | int result = STATE_UNKNOWN; | ||
| 780 | FILE *fp; | ||
| 781 | - char input_buffer[MAX_INPUT_BUFFER]; | ||
| 782 | char *p, *ret[QSTAT_MAX_RETURN_ARGS]; | ||
| 783 | - int i; | ||
| 784 | + size_t i = 0; | ||
| 785 | + output chld_out; | ||
| 786 | |||
| 787 | setlocale (LC_ALL, ""); | ||
| 788 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 789 | @@ -80,17 +80,9 @@ | ||
| 790 | if (verbose > 0) | ||
| 791 | printf ("%s\n", command_line); | ||
| 792 | |||
| 793 | - /* run the command */ | ||
| 794 | - fp = spopen (command_line); | ||
| 795 | - if (fp == NULL) { | ||
| 796 | - printf (_("Could not open pipe: %s\n"), command_line); | ||
| 797 | - return STATE_UNKNOWN; | ||
| 798 | - } | ||
| 799 | - | ||
| 800 | - fgets (input_buffer, MAX_INPUT_BUFFER - 1, fp); /* Only interested in the first line */ | ||
| 801 | - | ||
| 802 | - /* strip the newline character from the end of the input */ | ||
| 803 | - input_buffer[strlen (input_buffer) - 1] = 0; | ||
| 804 | + /* run the command. historically, this plugin ignores output on stderr, | ||
| 805 | + * as well as return status of the qstat program */ | ||
| 806 | + (void)np_runcmd(command_line, &chld_out, NULL, 0); | ||
| 807 | |||
| 808 | /* sanity check */ | ||
| 809 | /* was thinking about running qstat without any options, capturing the | ||
| 810 | @@ -102,18 +94,13 @@ | ||
| 811 | In the end, I figured I'd simply let an error occur & then trap it | ||
| 812 | */ | ||
| 813 | |||
| 814 | - if (!strncmp (input_buffer, "unknown option", 14)) { | ||
| 815 | + if (!strncmp (chld_out.line[0], "unknown option", 14)) { | ||
| 816 | printf (_("CRITICAL - Host type parameter incorrect!\n")); | ||
| 817 | result = STATE_CRITICAL; | ||
| 818 | return result; | ||
| 819 | } | ||
| 820 | |||
| 821 | - /* initialize the returned data buffer */ | ||
| 822 | - for (i = 0; i < QSTAT_MAX_RETURN_ARGS; i++) | ||
| 823 | - ret[i] = strdup(""); | ||
| 824 | - | ||
| 825 | - i = 0; | ||
| 826 | - p = (char *) strtok (input_buffer, QSTAT_DATA_DELIMITER); | ||
| 827 | + p = (char *) strtok (chld_out.line[0], QSTAT_DATA_DELIMITER); | ||
| 828 | while (p != NULL) { | ||
| 829 | ret[i] = p; | ||
| 830 | p = (char *) strtok (NULL, QSTAT_DATA_DELIMITER); | ||
| 831 | @@ -141,17 +128,14 @@ | ||
| 832 | ret[qstat_game_field], | ||
| 833 | ret[qstat_map_field], | ||
| 834 | ret[qstat_ping_field], | ||
| 835 | - perfdata ("players", atol(ret[qstat_game_players]), "", | ||
| 836 | + perfdata ("players", atol(ret[qstat_game_players]), "", | ||
| 837 | FALSE, 0, FALSE, 0, | ||
| 838 | TRUE, 0, TRUE, atol(ret[qstat_game_players_max])), | ||
| 839 | - fperfdata ("ping", strtod(ret[qstat_ping_field], NULL), "", | ||
| 840 | + fperfdata ("ping", strtod(ret[qstat_ping_field], NULL), "", | ||
| 841 | FALSE, 0, FALSE, 0, | ||
| 842 | TRUE, 0, FALSE, 0)); | ||
| 843 | } | ||
| 844 | |||
| 845 | - /* close the pipe */ | ||
| 846 | - spclose (fp); | ||
| 847 | - | ||
| 848 | return result; | ||
| 849 | } | ||
| 850 | |||
| 851 | diff -urN ../nplg/plugins/check_hpjd.c ./plugins/check_hpjd.c | ||
| 852 | --- ../nplg/plugins/check_hpjd.c 2005-01-05 21:53:13.000000000 +0100 | ||
| 853 | +++ ./plugins/check_hpjd.c 2005-06-10 15:01:26.000000000 +0200 | ||
| 854 | @@ -14,24 +14,22 @@ | ||
| 855 | * along with this program; if not, write to the Free Software | ||
| 856 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 857 | * | ||
| 858 | -* $Id: check_hpjd.c,v 1.31 2004/12/25 23:17:44 opensides Exp $ | ||
| 859 | +* $Id: check_hpjd.c,v 1.4 2005/06/06 11:37:06 exon Exp $ | ||
| 860 | *****************************************************************************/ | ||
| 861 | |||
| 862 | const char *progname = "check_hpjd"; | ||
| 863 | -const char *revision = "$Revision: 1.31 $"; | ||
| 864 | +const char *revision = "$Revision: 1.4 $"; | ||
| 865 | const char *copyright = "2000-2004"; | ||
| 866 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 867 | |||
| 868 | #include "common.h" | ||
| 869 | -#include "popen.h" | ||
| 870 | #include "utils.h" | ||
| 871 | #include "netutils.h" | ||
| 872 | +#include "runcmd.h" | ||
| 873 | |||
| 874 | #define DEFAULT_COMMUNITY "public" | ||
| 875 | |||
| 876 | - | ||
| 877 | -const char *option_summary = "-H host [-C community]\n"; | ||
| 878 | - | ||
| 879 | +/* this macro is only avavilable from main() */ | ||
| 880 | #define HPJD_LINE_STATUS ".1.3.6.1.4.1.11.2.3.9.1.1.2.1" | ||
| 881 | #define HPJD_PAPER_STATUS ".1.3.6.1.4.1.11.2.3.9.1.1.2.2" | ||
| 882 | #define HPJD_INTERVENTION_REQUIRED ".1.3.6.1.4.1.11.2.3.9.1.1.2.3" | ||
| 883 | @@ -44,42 +42,50 @@ | ||
| 884 | #define HPJD_GD_DOOR_OPEN ".1.3.6.1.4.1.11.2.3.9.1.1.2.17" | ||
| 885 | #define HPJD_GD_PAPER_OUTPUT ".1.3.6.1.4.1.11.2.3.9.1.1.2.19" | ||
| 886 | #define HPJD_GD_STATUS_DISPLAY ".1.3.6.1.4.1.11.2.3.9.1.1.3" | ||
| 887 | +#define SNMP_VARS 12 | ||
| 888 | |||
| 889 | #define ONLINE 0 | ||
| 890 | #define OFFLINE 1 | ||
| 891 | |||
| 892 | -int process_arguments (int, char **); | ||
| 893 | -int validate_arguments (void); | ||
| 894 | -void print_help (void); | ||
| 895 | +/* make it compile without warnings when internationalization is disabled */ | ||
| 896 | +#ifndef ENABLE_NLS | ||
| 897 | +# ifdef _ | ||
| 898 | +# undef _ | ||
| 899 | +# endif | ||
| 900 | +# define _(x) x | ||
| 901 | +#endif | ||
| 902 | + | ||
| 903 | +static int process_arguments (int, char **); | ||
| 904 | +static int validate_arguments (void); | ||
| 905 | +static void print_help (void); | ||
| 906 | void print_usage (void); | ||
| 907 | |||
| 908 | -char *community = NULL; | ||
| 909 | -char *address = NULL; | ||
| 910 | +static char *community = NULL; | ||
| 911 | +static char *address = NULL; | ||
| 912 | + | ||
| 913 | |||
| 914 | int | ||
| 915 | main (int argc, char **argv) | ||
| 916 | { | ||
| 917 | char command_line[1024]; | ||
| 918 | - int result = STATE_UNKNOWN; | ||
| 919 | - int line; | ||
| 920 | - char input_buffer[MAX_INPUT_BUFFER]; | ||
| 921 | - char query_string[512]; | ||
| 922 | - char *errmsg; | ||
| 923 | - char *temp_buffer; | ||
| 924 | - int line_status = ONLINE; | ||
| 925 | - int paper_status = 0; | ||
| 926 | - int intervention_required = 0; | ||
| 927 | - int peripheral_error = 0; | ||
| 928 | - int paper_jam = 0; | ||
| 929 | - int paper_out = 0; | ||
| 930 | - int toner_low = 0; | ||
| 931 | - int page_punt = 0; | ||
| 932 | - int memory_out = 0; | ||
| 933 | - int door_open = 0; | ||
| 934 | - int paper_output = 0; | ||
| 935 | - char display_message[MAX_INPUT_BUFFER]; | ||
| 936 | - | ||
| 937 | - errmsg = malloc(MAX_INPUT_BUFFER); | ||
| 938 | + int result = STATE_OK; | ||
| 939 | + size_t i, val = 0; | ||
| 940 | + int errorflag = 0; /* bitflag error tracker */ | ||
| 941 | + output chld_out, chld_err; | ||
| 942 | + char *errmsg_strings[11]; | ||
| 943 | + | ||
| 944 | + /* populate the the error message array */ | ||
| 945 | + errmsg_strings[0] = _("Printer Offline"); | ||
| 946 | + errmsg_strings[1] = _("Unknown Paper Error"); | ||
| 947 | + errmsg_strings[2] = _("Intervention Required"); | ||
| 948 | + errmsg_strings[3] = _("Peripheral Error"); | ||
| 949 | + errmsg_strings[4] = _("Paper Jam"); | ||
| 950 | + errmsg_strings[5] = _("Out of Paper"); | ||
| 951 | + errmsg_strings[6] = _("Toner Low"); | ||
| 952 | + errmsg_strings[7] = _("Data too Slow for Engine"); | ||
| 953 | + errmsg_strings[8] = _("Insufficient Memory"); | ||
| 954 | + errmsg_strings[9] = _("A Door is Open"); | ||
| 955 | + errmsg_strings[10] = _("Output Tray is Full"); | ||
| 956 | |||
| 957 | setlocale (LC_ALL, ""); | ||
| 958 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 959 | @@ -88,206 +94,99 @@ | ||
| 960 | if (process_arguments (argc, argv) == ERROR) | ||
| 961 | usage4 (_("Could not parse arguments")); | ||
| 962 | |||
| 963 | - /* removed ' 2>1' at end of command 10/27/1999 - EG */ | ||
| 964 | - /* create the query string */ | ||
| 965 | - sprintf | ||
| 966 | - (query_string, | ||
| 967 | - "%s.0 %s.0 %s.0 %s.0 %s.0 %s.0 %s.0 %s.0 %s.0 %s.0 %s.0 %s.0", | ||
| 968 | - HPJD_LINE_STATUS, | ||
| 969 | - HPJD_PAPER_STATUS, | ||
| 970 | - HPJD_INTERVENTION_REQUIRED, | ||
| 971 | - HPJD_GD_PERIPHERAL_ERROR, | ||
| 972 | - HPJD_GD_PAPER_JAM, | ||
| 973 | - HPJD_GD_PAPER_OUT, | ||
| 974 | - HPJD_GD_TONER_LOW, | ||
| 975 | - HPJD_GD_PAGE_PUNT, | ||
| 976 | - HPJD_GD_MEMORY_OUT, | ||
| 977 | - HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY); | ||
| 978 | - | ||
| 979 | - /* get the command to run */ | ||
| 980 | - sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET, community, | ||
| 981 | - address, query_string); | ||
| 982 | + /* create the command-line. Get status display line first, so we can | ||
| 983 | + * match line status against powersave as we parse it */ | ||
| 984 | + sprintf (command_line, "%s -Oqv -m : -v 1 -c %s %s " | ||
| 985 | + "%s.0 %s.0 %s.0 %s.0 %s.0 %s.0 %s.0 %s.0 %s.0 %s.0 %s.0 %s.0", | ||
| 986 | + PATH_TO_SNMPGET, community, address, | ||
| 987 | + HPJD_GD_STATUS_DISPLAY, | ||
| 988 | + HPJD_LINE_STATUS, | ||
| 989 | + HPJD_PAPER_STATUS, | ||
| 990 | + HPJD_INTERVENTION_REQUIRED, | ||
| 991 | + HPJD_GD_PERIPHERAL_ERROR, | ||
| 992 | + HPJD_GD_PAPER_JAM, | ||
| 993 | + HPJD_GD_PAPER_OUT, | ||
| 994 | + HPJD_GD_TONER_LOW, | ||
| 995 | + HPJD_GD_PAGE_PUNT, | ||
| 996 | + HPJD_GD_MEMORY_OUT, | ||
| 997 | + HPJD_GD_DOOR_OPEN, | ||
| 998 | + HPJD_GD_PAPER_OUTPUT); | ||
| 999 | |||
| 1000 | /* run the command */ | ||
| 1001 | - child_process = spopen (command_line); | ||
| 1002 | - if (child_process == NULL) { | ||
| 1003 | - printf (_("Could not open pipe: %s\n"), command_line); | ||
| 1004 | - return STATE_UNKNOWN; | ||
| 1005 | - } | ||
| 1006 | - | ||
| 1007 | - child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 1008 | - if (child_stderr == NULL) { | ||
| 1009 | - printf (_("Could not open stderr for %s\n"), command_line); | ||
| 1010 | - } | ||
| 1011 | - | ||
| 1012 | - result = STATE_OK; | ||
| 1013 | - | ||
| 1014 | - line = 0; | ||
| 1015 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 1016 | + if((np_runcmd(command_line, &chld_out, &chld_err, 0)) || chld_err.buflen) | ||
| 1017 | + result = STATE_WARNING; | ||
| 1018 | |||
| 1019 | - /* strip the newline character from the end of the input */ | ||
| 1020 | - if (input_buffer[strlen (input_buffer) - 1] == '\n') | ||
| 1021 | - input_buffer[strlen (input_buffer) - 1] = 0; | ||
| 1022 | - | ||
| 1023 | - line++; | ||
| 1024 | - | ||
| 1025 | - temp_buffer = strtok (input_buffer, "="); | ||
| 1026 | - temp_buffer = strtok (NULL, "="); | ||
| 1027 | - | ||
| 1028 | - if (temp_buffer == NULL) { | ||
| 1029 | - | ||
| 1030 | - result = STATE_UNKNOWN; | ||
| 1031 | - strcpy (errmsg, input_buffer); | ||
| 1032 | - | ||
| 1033 | - } else { | ||
| 1034 | - | ||
| 1035 | - switch (line) { | ||
| 1036 | - | ||
| 1037 | - case 1: /* 1st line should contain the line status */ | ||
| 1038 | - line_status = atoi (temp_buffer); | ||
| 1039 | - break; | ||
| 1040 | - case 2: /* 2nd line should contain the paper status */ | ||
| 1041 | - paper_status = atoi (temp_buffer); | ||
| 1042 | - break; | ||
| 1043 | - case 3: /* 3rd line should be intervention required */ | ||
| 1044 | - intervention_required = atoi (temp_buffer); | ||
| 1045 | - break; | ||
| 1046 | - case 4: /* 4th line should be peripheral error */ | ||
| 1047 | - peripheral_error = atoi (temp_buffer); | ||
| 1048 | - break; | ||
| 1049 | - case 5: /* 5th line should contain the paper jam status */ | ||
| 1050 | - paper_jam = atoi (temp_buffer); | ||
| 1051 | - break; | ||
| 1052 | - case 6: /* 6th line should contain the paper out status */ | ||
| 1053 | - paper_out = atoi (temp_buffer); | ||
| 1054 | - break; | ||
| 1055 | - case 7: /* 7th line should contain the toner low status */ | ||
| 1056 | - toner_low = atoi (temp_buffer); | ||
| 1057 | - break; | ||
| 1058 | - case 8: /* did data come too slow for engine */ | ||
| 1059 | - page_punt = atoi (temp_buffer); | ||
| 1060 | - break; | ||
| 1061 | - case 9: /* did we run out of memory */ | ||
| 1062 | - memory_out = atoi (temp_buffer); | ||
| 1063 | - break; | ||
| 1064 | - case 10: /* is there a door open */ | ||
| 1065 | - door_open = atoi (temp_buffer); | ||
| 1066 | - break; | ||
| 1067 | - case 11: /* is output tray full */ | ||
| 1068 | - paper_output = atoi (temp_buffer); | ||
| 1069 | - break; | ||
| 1070 | - case 12: /* display panel message */ | ||
| 1071 | - strcpy (display_message, temp_buffer + 1); | ||
| 1072 | - break; | ||
| 1073 | - default: | ||
| 1074 | - break; | ||
| 1075 | - } | ||
| 1076 | - | ||
| 1077 | - } | ||
| 1078 | - | ||
| 1079 | - /* break out of the read loop if we encounter an error */ | ||
| 1080 | - if (result != STATE_OK) | ||
| 1081 | - break; | ||
| 1082 | - } | ||
| 1083 | + /* if there was none or not enough output, display an error and exit */ | ||
| 1084 | + if (chld_out.buflen == 0 || chld_out.lines != SNMP_VARS - 1) { | ||
| 1085 | + if(chld_err.buflen) printf("%s : ", chld_err.line[0]); | ||
| 1086 | |||
| 1087 | - /* WARNING if output found on stderr */ | ||
| 1088 | - if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { | ||
| 1089 | - result = max_state (result, STATE_WARNING); | ||
| 1090 | - /* remove CRLF */ | ||
| 1091 | - if (input_buffer[strlen (input_buffer) - 1] == '\n') | ||
| 1092 | - input_buffer[strlen (input_buffer) - 1] = 0; | ||
| 1093 | - sprintf (errmsg, "%s", input_buffer ); | ||
| 1094 | + if(chld_out.buflen == 0) | ||
| 1095 | + printf (_("No data returned from %s\n"), address ); | ||
| 1096 | + else | ||
| 1097 | + printf(_("Not enough data returned from %s\n"), address); | ||
| 1098 | |||
| 1099 | - } | ||
| 1100 | - | ||
| 1101 | - /* close stderr */ | ||
| 1102 | - (void) fclose (child_stderr); | ||
| 1103 | - | ||
| 1104 | - /* close the pipe */ | ||
| 1105 | - if (spclose (child_process)) | ||
| 1106 | - result = max_state (result, STATE_WARNING); | ||
| 1107 | - | ||
| 1108 | - /* if there wasn't any output, display an error */ | ||
| 1109 | - if (line == 0) { | ||
| 1110 | - | ||
| 1111 | - /* might not be the problem, but most likely is. */ | ||
| 1112 | - result = STATE_UNKNOWN ; | ||
| 1113 | - asprintf (&errmsg, "%s : Timeout from host %s\n", errmsg, address ); | ||
| 1114 | - | ||
| 1115 | + return STATE_UNKNOWN; | ||
| 1116 | } | ||
| 1117 | |||
| 1118 | - /* if we had no read errors, check the printer status results... */ | ||
| 1119 | - if (result == STATE_OK) { | ||
| 1120 | + for(i = 1; i < chld_out.lines; i++) { | ||
| 1121 | + /* move to next if there's no error tag */ | ||
| 1122 | + if(!(val = (size_t)strtol(chld_out.line[i], NULL, 0))) | ||
| 1123 | + continue; | ||
| 1124 | + | ||
| 1125 | + /* tag the error */ | ||
| 1126 | + errorflag |= 1 << i; | ||
| 1127 | + | ||
| 1128 | + /* this switch statement is only for additional exception handling */ | ||
| 1129 | + switch (i) { | ||
| 1130 | + case 1: /* line status */ | ||
| 1131 | + /* clear this flag if it's powersaving (we know it's set if | ||
| 1132 | + * we get here, so use xor and save 2 instructions) */ | ||
| 1133 | + if(!strstr(chld_out.line[0], "POWERSAVE ON")) | ||
| 1134 | + errorflag ^= 1 << i; | ||
| 1135 | + break; | ||
| 1136 | |||
| 1137 | - if (paper_jam) { | ||
| 1138 | - result = STATE_WARNING; | ||
| 1139 | - strcpy (errmsg, _("Paper Jam")); | ||
| 1140 | - } | ||
| 1141 | - else if (paper_out) { | ||
| 1142 | - result = STATE_WARNING; | ||
| 1143 | - strcpy (errmsg, _("Out of Paper")); | ||
| 1144 | - } | ||
| 1145 | - else if (line_status == OFFLINE) { | ||
| 1146 | - if (strcmp (errmsg, "POWERSAVE ON") != 0) { | ||
| 1147 | - result = STATE_WARNING; | ||
| 1148 | - strcpy (errmsg, _("Printer Offline")); | ||
| 1149 | - } | ||
| 1150 | - } | ||
| 1151 | - else if (peripheral_error) { | ||
| 1152 | - result = STATE_WARNING; | ||
| 1153 | - strcpy (errmsg, _("Peripheral Error")); | ||
| 1154 | - } | ||
| 1155 | - else if (intervention_required) { | ||
| 1156 | - result = STATE_WARNING; | ||
| 1157 | - strcpy (errmsg, _("Intervention Required")); | ||
| 1158 | - } | ||
| 1159 | - else if (toner_low) { | ||
| 1160 | - result = STATE_WARNING; | ||
| 1161 | - strcpy (errmsg, _("Toner Low")); | ||
| 1162 | - } | ||
| 1163 | - else if (memory_out) { | ||
| 1164 | - result = STATE_WARNING; | ||
| 1165 | - strcpy (errmsg, _("Insufficient Memory")); | ||
| 1166 | - } | ||
| 1167 | - else if (door_open) { | ||
| 1168 | - result = STATE_WARNING; | ||
| 1169 | - strcpy (errmsg, _("A Door is Open")); | ||
| 1170 | - } | ||
| 1171 | - else if (paper_output) { | ||
| 1172 | - result = STATE_WARNING; | ||
| 1173 | - strcpy (errmsg, _("Output Tray is Full")); | ||
| 1174 | - } | ||
| 1175 | - else if (page_punt) { | ||
| 1176 | - result = STATE_WARNING; | ||
| 1177 | - strcpy (errmsg, _("Data too Slow for Engine")); | ||
| 1178 | - } | ||
| 1179 | - else if (paper_status) { | ||
| 1180 | - result = STATE_WARNING; | ||
| 1181 | - strcpy (errmsg, _("Unknown Paper Error")); | ||
| 1182 | + case 2: /* paper status */ | ||
| 1183 | + case 3: /* intervention required */ | ||
| 1184 | + case 4: /* peripheral error */ | ||
| 1185 | + case 5: /* paper jam */ | ||
| 1186 | + case 6: /* paper out */ | ||
| 1187 | + case 7: /* toner low */ | ||
| 1188 | + case 8: /* data came too slow for engine */ | ||
| 1189 | + case 9: /* out of memory */ | ||
| 1190 | + case 10: /* door open */ | ||
| 1191 | + case 11: /* output tray full */ | ||
| 1192 | + break; | ||
| 1193 | } | ||
| 1194 | } | ||
| 1195 | |||
| 1196 | - if (result == STATE_OK) | ||
| 1197 | - printf (_("Printer ok - (%s)\n"), display_message); | ||
| 1198 | - | ||
| 1199 | - else if (result == STATE_UNKNOWN) { | ||
| 1200 | + /* if some error occurred, print a starting line and all the errors */ | ||
| 1201 | + if(errorflag) { | ||
| 1202 | + printf ("%s (%s)", chld_err.buflen != 0 ? chld_err.buf : "", | ||
| 1203 | + chld_out.line[0]); | ||
| 1204 | |||
| 1205 | - printf ("%s\n", errmsg); | ||
| 1206 | + for(i = 0; i < SNMP_VARS; i++) { /* loop the error flags */ | ||
| 1207 | + if((errorflag >> i) & 1) /* only print if flag is set */ | ||
| 1208 | + printf(" :: %s", errmsg_strings[i++]); | ||
| 1209 | + } | ||
| 1210 | |||
| 1211 | - /* if printer could not be reached, escalate to critical */ | ||
| 1212 | - if (strstr (errmsg, "Timeout")) | ||
| 1213 | - result = STATE_CRITICAL; | ||
| 1214 | + return STATE_CRITICAL; | ||
| 1215 | } | ||
| 1216 | |||
| 1217 | - else if (result == STATE_WARNING) | ||
| 1218 | - printf ("%s (%s)\n", errmsg, display_message); | ||
| 1219 | + /* set WARNING if output on stderr */ | ||
| 1220 | + if (chld_err.buflen) { | ||
| 1221 | + printf("WARNING - Printer seems ok, but %s printed to stderr (%s)", | ||
| 1222 | + PATH_TO_SNMPGET, chld_err.line[0]); | ||
| 1223 | + return STATE_WARNING; | ||
| 1224 | + } | ||
| 1225 | |||
| 1226 | - return result; | ||
| 1227 | + /* all is well if we end up here */ | ||
| 1228 | + printf (_("Printer ok - (%s)\n"), chld_out.line[0]); | ||
| 1229 | + return STATE_OK; | ||
| 1230 | } | ||
| 1231 | |||
| 1232 | |||
| 1233 | /* process command-line arguments */ | ||
| 1234 | -int | ||
| 1235 | +static int | ||
| 1236 | process_arguments (int argc, char **argv) | ||
| 1237 | { | ||
| 1238 | int c; | ||
| 1239 | @@ -296,9 +195,6 @@ | ||
| 1240 | static struct option longopts[] = { | ||
| 1241 | {"hostname", required_argument, 0, 'H'}, | ||
| 1242 | {"community", required_argument, 0, 'C'}, | ||
| 1243 | -/* {"critical", required_argument,0,'c'}, */ | ||
| 1244 | -/* {"warning", required_argument,0,'w'}, */ | ||
| 1245 | -/* {"port", required_argument,0,'P'}, */ | ||
| 1246 | {"version", no_argument, 0, 'V'}, | ||
| 1247 | {"help", no_argument, 0, 'h'}, | ||
| 1248 | {0, 0, 0, 0} | ||
| 1249 | @@ -307,7 +203,6 @@ | ||
| 1250 | if (argc < 2) | ||
| 1251 | return ERROR; | ||
| 1252 | |||
| 1253 | - | ||
| 1254 | while (1) { | ||
| 1255 | c = getopt_long (argc, argv, "+hVH:C:", longopts, &option); | ||
| 1256 | |||
| 1257 | @@ -317,7 +212,7 @@ | ||
| 1258 | switch (c) { | ||
| 1259 | case 'H': /* hostname */ | ||
| 1260 | if (is_host (optarg)) { | ||
| 1261 | - address = strscpy(address, optarg) ; | ||
| 1262 | + address = strdup(optarg) ; | ||
| 1263 | } | ||
| 1264 | else { | ||
| 1265 | usage2 (_("Invalid hostname/address"), optarg); | ||
| 1266 | @@ -346,26 +241,26 @@ | ||
| 1267 | usage2 (_("Invalid hostname/address"), argv[c]); | ||
| 1268 | } | ||
| 1269 | } | ||
| 1270 | - | ||
| 1271 | + | ||
| 1272 | if (community == NULL) { | ||
| 1273 | if (argv[c] != NULL ) | ||
| 1274 | community = argv[c]; | ||
| 1275 | else | ||
| 1276 | - community = strdup (DEFAULT_COMMUNITY); | ||
| 1277 | + community = DEFAULT_COMMUNITY; | ||
| 1278 | } | ||
| 1279 | |||
| 1280 | return validate_arguments (); | ||
| 1281 | } | ||
| 1282 | |||
| 1283 | |||
| 1284 | -int | ||
| 1285 | +static int | ||
| 1286 | validate_arguments (void) | ||
| 1287 | { | ||
| 1288 | return OK; | ||
| 1289 | } | ||
| 1290 | |||
| 1291 | |||
| 1292 | -void | ||
| 1293 | +static void | ||
| 1294 | print_help (void) | ||
| 1295 | { | ||
| 1296 | print_revision (progname, revision); | ||
| 1297 | @@ -389,7 +284,6 @@ | ||
| 1298 | } | ||
| 1299 | |||
| 1300 | |||
| 1301 | - | ||
| 1302 | void | ||
| 1303 | print_usage (void) | ||
| 1304 | { | ||
| 1305 | diff -urN ../nplg/plugins/check_load.c ./plugins/check_load.c | ||
| 1306 | --- ../nplg/plugins/check_load.c 2005-05-30 17:44:13.000000000 +0200 | ||
| 1307 | +++ ./plugins/check_load.c 2005-06-10 15:01:26.000000000 +0200 | ||
| 1308 | @@ -14,18 +14,18 @@ | ||
| 1309 | along with this program; if not, write to the Free Software | ||
| 1310 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 1311 | |||
| 1312 | - $Id: check_load.c,v 1.28 2005/05/28 01:21:54 seanius Exp $ | ||
| 1313 | + $Id: check_load.c,v 1.3 2005/06/05 21:55:26 exon Exp $ | ||
| 1314 | |||
| 1315 | ******************************************************************************/ | ||
| 1316 | |||
| 1317 | const char *progname = "check_load"; | ||
| 1318 | -const char *revision = "$Revision: 1.28 $"; | ||
| 1319 | +const char *revision = "$Revision: 1.3 $"; | ||
| 1320 | const char *copyright = "1999-2004"; | ||
| 1321 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 1322 | |||
| 1323 | #include "common.h" | ||
| 1324 | #include "utils.h" | ||
| 1325 | -#include "popen.h" | ||
| 1326 | +#include "runcmd.h" | ||
| 1327 | |||
| 1328 | #ifdef HAVE_SYS_LOADAVG_H | ||
| 1329 | #include <sys/loadavg.h> | ||
| 1330 | @@ -47,12 +47,8 @@ | ||
| 1331 | /* strictly for pretty-print usage in loops */ | ||
| 1332 | static const int nums[3] = { 1, 5, 15 }; | ||
| 1333 | |||
| 1334 | -/* provide some fairly sane defaults */ | ||
| 1335 | double wload[3] = { 0.0, 0.0, 0.0 }; | ||
| 1336 | double cload[3] = { 0.0, 0.0, 0.0 }; | ||
| 1337 | -#define la1 la[0] | ||
| 1338 | -#define la5 la[1] | ||
| 1339 | -#define la15 la[2] | ||
| 1340 | |||
| 1341 | char *status_line; | ||
| 1342 | |||
| 1343 | @@ -86,14 +82,16 @@ | ||
| 1344 | main (int argc, char **argv) | ||
| 1345 | { | ||
| 1346 | int result; | ||
| 1347 | - int i; | ||
| 1348 | + size_t i; /* size_t so we can match against chld_out.lines if need be */ | ||
| 1349 | |||
| 1350 | double la[3] = { 0.0, 0.0, 0.0 }; /* NetBSD complains about unitialized arrays */ | ||
| 1351 | #ifndef HAVE_GETLOADAVG | ||
| 1352 | - char input_buffer[MAX_INPUT_BUFFER]; | ||
| 1353 | # ifdef HAVE_PROC_LOADAVG | ||
| 1354 | + char input_buffer[MAX_INPUT_BUFFER]; | ||
| 1355 | FILE *fp; | ||
| 1356 | char *str, *next; | ||
| 1357 | +# else | ||
| 1358 | + output chld_out, chld_err; | ||
| 1359 | # endif | ||
| 1360 | #endif | ||
| 1361 | |||
| 1362 | @@ -126,23 +124,11 @@ | ||
| 1363 | |||
| 1364 | fclose (fp); | ||
| 1365 | # else | ||
| 1366 | - child_process = spopen (PATH_TO_UPTIME); | ||
| 1367 | - if (child_process == NULL) { | ||
| 1368 | - printf (_("Error opening %s\n"), PATH_TO_UPTIME); | ||
| 1369 | - return STATE_UNKNOWN; | ||
| 1370 | - } | ||
| 1371 | - child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 1372 | - if (child_stderr == NULL) { | ||
| 1373 | - printf (_("Could not open stderr for %s\n"), PATH_TO_UPTIME); | ||
| 1374 | - } | ||
| 1375 | - fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process); | ||
| 1376 | - sscanf (input_buffer, "%*[^l]load average: %f, %f, %f", &la1, &la5, &la15); | ||
| 1377 | + if((result = np_runcmd(PATH_TO_UPTIME, &chld_out, &chld_err, 0)) || chld_err.buflen) | ||
| 1378 | + die(STATE_UNKNOWN, _("Error code %d returned in %s\n"), | ||
| 1379 | + result, PATH_TO_UPTIME); | ||
| 1380 | |||
| 1381 | - result = spclose (child_process); | ||
| 1382 | - if (result) { | ||
| 1383 | - printf (_("Error code %d returned in %s\n"), result, PATH_TO_UPTIME); | ||
| 1384 | - return STATE_UNKNOWN; | ||
| 1385 | - } | ||
| 1386 | + sscanf (chld_out.buf, "%*[^l]load average: %f, %f, %f", &la[0], &la[1], &la[2]); | ||
| 1387 | # endif | ||
| 1388 | #endif | ||
| 1389 | |||
| 1390 | @@ -162,17 +148,17 @@ | ||
| 1391 | /* we got this far, so assume OK until we've measured */ | ||
| 1392 | result = STATE_OK; | ||
| 1393 | |||
| 1394 | - asprintf(&status_line, _("load average: %.2f, %.2f, %.2f"), la1, la5, la15); | ||
| 1395 | - | ||
| 1396 | for(i = 0; i < 3; i++) { | ||
| 1397 | if(la[i] > cload[i]) { | ||
| 1398 | result = STATE_CRITICAL; | ||
| 1399 | break; | ||
| 1400 | } | ||
| 1401 | - else if(la[i] > wload[i]) result = STATE_WARNING; | ||
| 1402 | + | ||
| 1403 | + if(la[i] > wload[i]) result = STATE_WARNING; | ||
| 1404 | } | ||
| 1405 | |||
| 1406 | - printf("%s - %s|", state_text(result), status_line); | ||
| 1407 | + printf(_("%s - load average: %.2f, %.2f, %.2f|"), | ||
| 1408 | + state_text(result), la[0], la[1], la[2]); | ||
| 1409 | for(i = 0; i < 3; i++) | ||
| 1410 | printf("load%d=%.3f;%.3f;%.3f;0; ", nums[i], la[i], wload[i], cload[i]); | ||
| 1411 | |||
| 1412 | @@ -248,14 +234,13 @@ | ||
| 1413 | int i = 0; | ||
| 1414 | |||
| 1415 | /* match cload first, as it will give the most friendly error message | ||
| 1416 | - * if user hasn't given the -c switch properly */ | ||
| 1417 | + * if user hasn't given the -c switch properly. Don't make sure wload[i] | ||
| 1418 | + * < cload[i] as it prevents users from forcing a critical state */ | ||
| 1419 | for(i = 0; i < 3; i++) { | ||
| 1420 | - if(cload[i] < 0) | ||
| 1421 | + if(cload[i] == 0.0) | ||
| 1422 | die (STATE_UNKNOWN, _("Critical threshold for %d-minute load average is not specified\n"), nums[i]); | ||
| 1423 | - if(wload[i] < 0) | ||
| 1424 | + if(wload[i] == 0.0) | ||
| 1425 | die (STATE_UNKNOWN, _("Warning threshold for %d-minute load average is not specified\n"), nums[i]); | ||
| 1426 | - if(wload[i] > cload[i]) | ||
| 1427 | - die (STATE_UNKNOWN, _("Parameter inconsistency: %d-minute \"warning load\" is greater than \"critical load\"\n"), nums[i]); | ||
| 1428 | } | ||
| 1429 | |||
| 1430 | return OK; | ||
| 1431 | diff -urN ../nplg/plugins/check_nagios.c ./plugins/check_nagios.c | ||
| 1432 | --- ../nplg/plugins/check_nagios.c 2005-05-26 14:12:21.000000000 +0200 | ||
| 1433 | +++ ./plugins/check_nagios.c 2005-06-10 15:01:26.000000000 +0200 | ||
| 1434 | @@ -14,17 +14,17 @@ | ||
| 1435 | along with this program; if not, write to the Free Software | ||
| 1436 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 1437 | |||
| 1438 | - $Id: check_nagios.c,v 1.26 2005/05/25 00:43:20 seanius Exp $ | ||
| 1439 | + $Id: check_nagios.c,v 1.3 2005/06/06 11:37:06 exon Exp $ | ||
| 1440 | |||
| 1441 | ******************************************************************************/ | ||
| 1442 | |||
| 1443 | const char *progname = "check_nagios"; | ||
| 1444 | -const char *revision = "$Revision: 1.26 $"; | ||
| 1445 | +const char *revision = "$Revision: 1.3 $"; | ||
| 1446 | const char *copyright = "1999-2004"; | ||
| 1447 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 1448 | |||
| 1449 | #include "common.h" | ||
| 1450 | -#include "popen.h" | ||
| 1451 | +#include "runcmd.h" | ||
| 1452 | #include "utils.h" | ||
| 1453 | |||
| 1454 | int process_arguments (int, char **); | ||
| 1455 | @@ -55,6 +55,8 @@ | ||
| 1456 | int procrss = 0; | ||
| 1457 | float procpcpu = 0; | ||
| 1458 | char procstat[8]; | ||
| 1459 | + /* procetime is unused in most configurations, but may be in PS_VAR_LIST | ||
| 1460 | + * so it must be here in spite of it producing compiler warnings */ | ||
| 1461 | char procetime[MAX_INPUT_BUFFER]; | ||
| 1462 | char procprog[MAX_INPUT_BUFFER]; | ||
| 1463 | char *procargs; | ||
| 1464 | @@ -62,6 +64,8 @@ | ||
| 1465 | int expected_cols = PS_COLS - 1; | ||
| 1466 | const char *zombie = "Z"; | ||
| 1467 | char *temp_string; | ||
| 1468 | + output chld_out, chld_err; | ||
| 1469 | + size_t i; | ||
| 1470 | |||
| 1471 | setlocale (LC_ALL, ""); | ||
| 1472 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 1473 | @@ -99,40 +103,30 @@ | ||
| 1474 | printf(_("command: %s\n"), PS_COMMAND); | ||
| 1475 | |||
| 1476 | /* run the command to check for the Nagios process.. */ | ||
| 1477 | - child_process = spopen (PS_COMMAND); | ||
| 1478 | - if (child_process == NULL) { | ||
| 1479 | - printf (_("Could not open pipe: %s\n"), PS_COMMAND); | ||
| 1480 | - return STATE_UNKNOWN; | ||
| 1481 | - } | ||
| 1482 | - | ||
| 1483 | - child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 1484 | - if (child_stderr == NULL) { | ||
| 1485 | - printf (_("Could not open stderr for %s\n"), PS_COMMAND); | ||
| 1486 | - } | ||
| 1487 | - | ||
| 1488 | - fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process); | ||
| 1489 | + if((result = np_runcmd(PS_COMMAND, &chld_out, &chld_err, 0)) != 0) | ||
| 1490 | + result = STATE_WARNING; | ||
| 1491 | |||
| 1492 | /* count the number of matching Nagios processes... */ | ||
| 1493 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 1494 | - cols = sscanf (input_buffer, PS_FORMAT, PS_VARLIST); | ||
| 1495 | - /* Zombie processes do not give a procprog command */ | ||
| 1496 | - if ( cols == (expected_cols - 1) && strstr(procstat, zombie) ) { | ||
| 1497 | - cols = expected_cols; | ||
| 1498 | - /* Set some value for procargs for the strip command further below | ||
| 1499 | - Seen to be a problem on some Solaris 7 and 8 systems */ | ||
| 1500 | - input_buffer[pos] = '\n'; | ||
| 1501 | - input_buffer[pos+1] = 0x0; | ||
| 1502 | - } | ||
| 1503 | + for(i = 0; i < chld_out.lines; i++) { | ||
| 1504 | + cols = sscanf (chld_out.line[i], PS_FORMAT, PS_VARLIST); | ||
| 1505 | + /* Zombie processes do not give a procprog command */ | ||
| 1506 | + if ( cols == (expected_cols - 1) && strstr(procstat, zombie) ) { | ||
| 1507 | + cols = expected_cols; | ||
| 1508 | + /* Set some value for procargs for the strip command further below | ||
| 1509 | + * Seen to be a problem on some Solaris 7 and 8 systems */ | ||
| 1510 | + chld_out.line[i][pos] = '\n'; | ||
| 1511 | + chld_out.line[i][pos+1] = 0x0; | ||
| 1512 | + } | ||
| 1513 | if ( cols >= expected_cols ) { | ||
| 1514 | - asprintf (&procargs, "%s", input_buffer + pos); | ||
| 1515 | + asprintf (&procargs, "%s", chld_out.line[i] + pos); | ||
| 1516 | strip (procargs); | ||
| 1517 | - | ||
| 1518 | + | ||
| 1519 | /* Some ps return full pathname for command. This removes path */ | ||
| 1520 | - temp_string = strtok ((char *)procprog, "/"); | ||
| 1521 | - while (temp_string) { | ||
| 1522 | - strcpy(procprog, temp_string); | ||
| 1523 | - temp_string = strtok (NULL, "/"); | ||
| 1524 | - } | ||
| 1525 | + temp_string = strtok ((char *)procprog, "/"); | ||
| 1526 | + while (temp_string) { | ||
| 1527 | + strcpy(procprog, temp_string); | ||
| 1528 | + temp_string = strtok (NULL, "/"); | ||
| 1529 | + } | ||
| 1530 | |||
| 1531 | /* May get empty procargs */ | ||
| 1532 | if (!strstr(procargs, argv[0]) && strstr(procargs, process_string) && strcmp(procargs,"")) { | ||
| 1533 | @@ -145,14 +139,7 @@ | ||
| 1534 | } | ||
| 1535 | |||
| 1536 | /* If we get anything on stderr, at least set warning */ | ||
| 1537 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) | ||
| 1538 | - result = max_state (result, STATE_WARNING); | ||
| 1539 | - | ||
| 1540 | - /* close stderr */ | ||
| 1541 | - (void) fclose (child_stderr); | ||
| 1542 | - | ||
| 1543 | - /* close the pipe */ | ||
| 1544 | - if (spclose (child_process)) | ||
| 1545 | + if(chld_err.buflen) | ||
| 1546 | result = max_state (result, STATE_WARNING); | ||
| 1547 | |||
| 1548 | /* reset the alarm handler */ | ||
| 1549 | diff -urN ../nplg/plugins/check_ping.c ./plugins/check_ping.c | ||
| 1550 | --- ../nplg/plugins/check_ping.c 2005-05-26 14:12:21.000000000 +0200 | ||
| 1551 | +++ ./plugins/check_ping.c 2005-06-10 15:01:26.000000000 +0200 | ||
| 1552 | @@ -14,18 +14,18 @@ | ||
| 1553 | along with this program; if not, write to the Free Software | ||
| 1554 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 1555 | |||
| 1556 | - $Id: check_ping.c,v 1.44 2005/05/25 14:25:55 sghosh Exp $ | ||
| 1557 | + $Id: check_ping.c,v 1.2 2005/06/05 21:55:26 exon Exp $ | ||
| 1558 | |||
| 1559 | ******************************************************************************/ | ||
| 1560 | |||
| 1561 | const char *progname = "check_ping"; | ||
| 1562 | -const char *revision = "$Revision: 1.44 $"; | ||
| 1563 | +const char *revision = "$Revision: 1.2 $"; | ||
| 1564 | const char *copyright = "2000-2004"; | ||
| 1565 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 1566 | |||
| 1567 | #include "common.h" | ||
| 1568 | #include "netutils.h" | ||
| 1569 | -#include "popen.h" | ||
| 1570 | +#include "runcmd.h" | ||
| 1571 | #include "utils.h" | ||
| 1572 | |||
| 1573 | #define WARN_DUPLICATES "DUPLICATES FOUND! " | ||
| 1574 | @@ -40,7 +40,7 @@ | ||
| 1575 | int get_threshold (char *, float *, int *); | ||
| 1576 | int validate_arguments (void); | ||
| 1577 | int run_ping (const char *cmd, const char *addr); | ||
| 1578 | -int error_scan (char buf[MAX_INPUT_BUFFER], const char *addr); | ||
| 1579 | +int error_scan (const char *buf, const char *addr); | ||
| 1580 | void print_usage (void); | ||
| 1581 | void print_help (void); | ||
| 1582 | |||
| 1583 | @@ -58,7 +58,7 @@ | ||
| 1584 | float rta = UNKNOWN_TRIP_TIME; | ||
| 1585 | int pl = UNKNOWN_PACKET_LOSS; | ||
| 1586 | |||
| 1587 | -char *warn_text; | ||
| 1588 | +char *warn_text = NULL; | ||
| 1589 | |||
| 1590 | |||
| 1591 | |||
| 1592 | @@ -95,10 +95,8 @@ | ||
| 1593 | if (is_inet6_addr(addresses[i]) && address_family != AF_INET) | ||
| 1594 | rawcmd = strdup(PING6_COMMAND); | ||
| 1595 | else | ||
| 1596 | - rawcmd = strdup(PING_COMMAND); | ||
| 1597 | -#else | ||
| 1598 | - rawcmd = strdup(PING_COMMAND); | ||
| 1599 | #endif | ||
| 1600 | + rawcmd = strdup(PING_COMMAND); | ||
| 1601 | |||
| 1602 | /* does the host address of number of packets argument come first? */ | ||
| 1603 | #ifdef PING_PACKETS_FIRST | ||
| 1604 | @@ -119,8 +117,7 @@ | ||
| 1605 | |||
| 1606 | if (pl == UNKNOWN_PACKET_LOSS || rta < 0.0) { | ||
| 1607 | printf ("%s\n", cmd); | ||
| 1608 | - die (STATE_UNKNOWN, | ||
| 1609 | - _("CRITICAL - Could not interpret output from ping command\n")); | ||
| 1610 | + die (STATE_UNKNOWN, _("CRITICAL - Could not interpret output from ping command\n")); | ||
| 1611 | } | ||
| 1612 | |||
| 1613 | if (pl >= cpl || rta >= crta || rta < 0) | ||
| 1614 | @@ -136,11 +133,11 @@ | ||
| 1615 | if (display_html == TRUE) | ||
| 1616 | printf ("<A HREF='%s/traceroute.cgi?%s'>", CGIURL, addresses[i]); | ||
| 1617 | if (pl == 100) | ||
| 1618 | - printf (_("PING %s - %sPacket loss = %d%%"), state_text (this_result), warn_text, | ||
| 1619 | - pl); | ||
| 1620 | + printf (_("PING %s - %sPacket loss = %d%%"), | ||
| 1621 | + state_text(this_result), warn_text ? warn_text : " ", pl); | ||
| 1622 | else | ||
| 1623 | printf (_("PING %s - %sPacket loss = %d%%, RTA = %2.2f ms"), | ||
| 1624 | - state_text (this_result), warn_text, pl, rta); | ||
| 1625 | + state_text (this_result), warn_text ? warn_text : " ", pl, rta); | ||
| 1626 | if (display_html == TRUE) | ||
| 1627 | printf ("</A>"); | ||
| 1628 | printf ("\n"); | ||
| 1629 | @@ -399,42 +396,42 @@ | ||
| 1630 | int | ||
| 1631 | run_ping (const char *cmd, const char *addr) | ||
| 1632 | { | ||
| 1633 | - char buf[MAX_INPUT_BUFFER]; | ||
| 1634 | int result = STATE_UNKNOWN; | ||
| 1635 | - | ||
| 1636 | - if ((child_process = spopen (cmd)) == NULL) | ||
| 1637 | - die (STATE_UNKNOWN, _("Could not open pipe: %s\n"), cmd); | ||
| 1638 | - | ||
| 1639 | - child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 1640 | - if (child_stderr == NULL) | ||
| 1641 | - printf (_("Cannot open stderr for %s\n"), cmd); | ||
| 1642 | - | ||
| 1643 | - while (fgets (buf, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 1644 | - | ||
| 1645 | - result = max_state (result, error_scan (buf, addr)); | ||
| 1646 | - | ||
| 1647 | - /* get the percent loss statistics */ | ||
| 1648 | - if(sscanf(buf,"%*d packets transmitted, %*d packets received, +%*d errors, %d%% packet loss",&pl)==1 || | ||
| 1649 | - sscanf(buf,"%*d packets transmitted, %*d packets received, %d%% packet loss",&pl)==1 || | ||
| 1650 | - sscanf(buf,"%*d packets transmitted, %*d packets received, %d%% loss, time",&pl)==1 || | ||
| 1651 | - sscanf(buf,"%*d packets transmitted, %*d received, %d%% loss, time", &pl)==1 || | ||
| 1652 | - sscanf(buf,"%*d packets transmitted, %*d received, %d%% packet loss, time", &pl)==1 || | ||
| 1653 | - sscanf(buf,"%*d packets transmitted, %*d received, +%*d errors, %d%% packet loss", &pl) == 1 || | ||
| 1654 | - sscanf(buf,"%*d packets transmitted %*d received, +%*d errors, %d%% packet loss", &pl) == 1 | ||
| 1655 | - ) | ||
| 1656 | + output chld_out, chld_err; | ||
| 1657 | + char *p; | ||
| 1658 | + size_t mult = 1, i; | ||
| 1659 | + | ||
| 1660 | + if((result = np_runcmd(cmd, &chld_out, &chld_err, 0)) != 0) | ||
| 1661 | + result = STATE_WARNING; | ||
| 1662 | + | ||
| 1663 | + for(i = 0; i < chld_out.lines; i++) { | ||
| 1664 | + /* get the packet loss. Find the % sign and count backwards */ | ||
| 1665 | + if((p = memchr(chld_out.line[i], '%', chld_out.lens[i]))) { | ||
| 1666 | + p--; | ||
| 1667 | + pl = 0; | ||
| 1668 | + while(p != chld_out.line[i] && isdigit(*p)) { | ||
| 1669 | + pl += *p - '0' * mult; | ||
| 1670 | + mult *= 10; | ||
| 1671 | + p--; | ||
| 1672 | + } | ||
| 1673 | continue; | ||
| 1674 | - | ||
| 1675 | + } | ||
| 1676 | /* get the round trip average */ | ||
| 1677 | - else | ||
| 1678 | - if(sscanf(buf,"round-trip min/avg/max = %*f/%f/%*f",&rta)==1 || | ||
| 1679 | - sscanf(buf,"round-trip min/avg/max/mdev = %*f/%f/%*f/%*f",&rta)==1 || | ||
| 1680 | - sscanf(buf,"round-trip min/avg/max/sdev = %*f/%f/%*f/%*f",&rta)==1 || | ||
| 1681 | - sscanf(buf,"round-trip min/avg/max/stddev = %*f/%f/%*f/%*f",&rta)==1 || | ||
| 1682 | - sscanf(buf,"round-trip min/avg/max/std-dev = %*f/%f/%*f/%*f",&rta)==1 || | ||
| 1683 | - sscanf(buf,"round-trip (ms) min/avg/max = %*f/%f/%*f",&rta)==1 || | ||
| 1684 | - sscanf(buf,"round-trip (ms) min/avg/max/stddev = %*f/%f/%*f/%*f",&rta)==1 || | ||
| 1685 | - sscanf(buf,"rtt min/avg/max/mdev = %*f/%f/%*f/%*f ms",&rta)==1) | ||
| 1686 | - continue; | ||
| 1687 | + else { | ||
| 1688 | + if(sscanf(chld_out.line[i], "round-trip min/avg/max = %*f/%f/%*f", &rta) == 1 || | ||
| 1689 | + sscanf(chld_out.line[i], "round-trip min/avg/max/mdev = %*f/%f/%*f/%*f", &rta) == 1 || | ||
| 1690 | + sscanf(chld_out.line[i], "round-trip min/avg/max/sdev = %*f/%f/%*f/%*f", &rta) == 1 || | ||
| 1691 | + sscanf(chld_out.line[i], "round-trip min/avg/max/stddev = %*f/%f/%*f/%*f", &rta) == 1 || | ||
| 1692 | + sscanf(chld_out.line[i], "round-trip min/avg/max/std-dev = %*f/%f/%*f/%*f", &rta) == 1 || | ||
| 1693 | + sscanf(chld_out.line[i], "round-trip (ms) min/avg/max = %*f/%f/%*f", &rta) == 1 || | ||
| 1694 | + sscanf(chld_out.line[i], "round-trip (ms) min/avg/max/stddev = %*f/%f/%*f/%*f", &rta) == 1 || | ||
| 1695 | + sscanf(chld_out.line[i], "rtt min/avg/max/mdev = %*f/%f/%*f/%*f ms", &rta) == 1) | ||
| 1696 | + { | ||
| 1697 | + continue; | ||
| 1698 | + } | ||
| 1699 | + | ||
| 1700 | + result = max_state (result, error_scan (chld_out.line[i], addr)); | ||
| 1701 | + } | ||
| 1702 | } | ||
| 1703 | |||
| 1704 | /* this is needed because there is no rta if all packets are lost */ | ||
| 1705 | @@ -442,19 +439,10 @@ | ||
| 1706 | rta = crta; | ||
| 1707 | |||
| 1708 | /* check stderr, setting at least WARNING if there is output here */ | ||
| 1709 | - while (fgets (buf, MAX_INPUT_BUFFER - 1, child_stderr)) | ||
| 1710 | - if (! strstr(buf,"WARNING - no SO_TIMESTAMP support, falling back to SIOCGSTAMP")) | ||
| 1711 | - result = max_state (STATE_WARNING, error_scan (buf, addr)); | ||
| 1712 | - | ||
| 1713 | - (void) fclose (child_stderr); | ||
| 1714 | - | ||
| 1715 | - | ||
| 1716 | - /* close the pipe - WARNING if status is set */ | ||
| 1717 | - if (spclose (child_process)) | ||
| 1718 | - result = max_state (result, STATE_WARNING); | ||
| 1719 | - | ||
| 1720 | - if (warn_text == NULL) | ||
| 1721 | - warn_text = strdup(""); | ||
| 1722 | + if(chld_err.buflen > 0) { | ||
| 1723 | + if (! strstr(chld_err.line[0], "WARNING - no SO_TIMESTAMP support, falling back to SIOCGSTAMP")) | ||
| 1724 | + result = max_state (STATE_WARNING, error_scan (chld_err.line[0], addr)); | ||
| 1725 | + } | ||
| 1726 | |||
| 1727 | return result; | ||
| 1728 | } | ||
| 1729 | @@ -462,7 +450,7 @@ | ||
| 1730 | |||
| 1731 | |||
| 1732 | int | ||
| 1733 | -error_scan (char buf[MAX_INPUT_BUFFER], const char *addr) | ||
| 1734 | +error_scan (const char *buf, const char *addr) | ||
| 1735 | { | ||
| 1736 | if (strstr (buf, "Network is unreachable")) | ||
| 1737 | die (STATE_CRITICAL, _("CRITICAL - Network unreachable (%s)"), addr); | ||
| 1738 | diff -urN ../nplg/plugins/check_procs.c ./plugins/check_procs.c | ||
| 1739 | --- ../nplg/plugins/check_procs.c 2005-06-03 19:35:45.000000000 +0200 | ||
| 1740 | +++ ./plugins/check_procs.c 2005-06-10 15:01:26.000000000 +0200 | ||
| 1741 | @@ -14,17 +14,17 @@ | ||
| 1742 | along with this program; if not, write to the Free Software | ||
| 1743 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 1744 | |||
| 1745 | - $Id: check_procs.c,v 1.45 2005/06/03 13:53:43 seanius Exp $ | ||
| 1746 | + $Id: check_procs.c,v 1.3 2005/06/06 11:37:06 exon Exp $ | ||
| 1747 | |||
| 1748 | ******************************************************************************/ | ||
| 1749 | |||
| 1750 | const char *progname = "check_procs"; | ||
| 1751 | -const char *revision = "$Revision: 1.45 $"; | ||
| 1752 | +const char *revision = "$Revision: 1.3 $"; | ||
| 1753 | const char *copyright = "2000-2004"; | ||
| 1754 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 1755 | |||
| 1756 | #include "common.h" | ||
| 1757 | -#include "popen.h" | ||
| 1758 | +#include "runcmd.h" | ||
| 1759 | #include "utils.h" | ||
| 1760 | |||
| 1761 | #include <pwd.h> | ||
| 1762 | @@ -96,7 +96,7 @@ | ||
| 1763 | char procstat[8]; | ||
| 1764 | char procetime[MAX_INPUT_BUFFER] = { '\0' }; | ||
| 1765 | char *procargs; | ||
| 1766 | - char *temp_string; | ||
| 1767 | + output chld_out, chld_err; | ||
| 1768 | |||
| 1769 | const char *zombie = "Z"; | ||
| 1770 | |||
| 1771 | @@ -118,7 +118,7 @@ | ||
| 1772 | input_buffer = malloc (MAX_INPUT_BUFFER); | ||
| 1773 | procprog = malloc (MAX_INPUT_BUFFER); | ||
| 1774 | |||
| 1775 | - asprintf (&metric_name, "PROCS"); | ||
| 1776 | + metric_name = "PROCS"; | ||
| 1777 | metric = METRIC_PROCS; | ||
| 1778 | |||
| 1779 | if (process_arguments (argc, argv) == ERROR) | ||
| 1780 | @@ -136,27 +136,15 @@ | ||
| 1781 | if (verbose >= 2) | ||
| 1782 | printf (_("CMD: %s\n"), PS_COMMAND); | ||
| 1783 | |||
| 1784 | - child_process = spopen (PS_COMMAND); | ||
| 1785 | - if (child_process == NULL) { | ||
| 1786 | - printf (_("Could not open pipe: %s\n"), PS_COMMAND); | ||
| 1787 | - return STATE_UNKNOWN; | ||
| 1788 | - } | ||
| 1789 | - | ||
| 1790 | - child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 1791 | - if (child_stderr == NULL) | ||
| 1792 | - printf (_("Could not open stderr for %s\n"), PS_COMMAND); | ||
| 1793 | - | ||
| 1794 | - /* flush first line */ | ||
| 1795 | - fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process); | ||
| 1796 | - while ( input_buffer[strlen(input_buffer)-1] != '\n' ) | ||
| 1797 | - fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process); | ||
| 1798 | - | ||
| 1799 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 1800 | - asprintf (&input_line, "%s", input_buffer); | ||
| 1801 | - while ( input_buffer[strlen(input_buffer)-1] != '\n' ) { | ||
| 1802 | - fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process); | ||
| 1803 | - asprintf (&input_line, "%s%s", input_line, input_buffer); | ||
| 1804 | - } | ||
| 1805 | + result = np_runcmd(PS_COMMAND, &chld_out, &chld_err, 0); | ||
| 1806 | + if(result) { | ||
| 1807 | + printf (_("System call returned nonzero status\n")); | ||
| 1808 | + result = max_state (result, STATE_WARNING); | ||
| 1809 | + } | ||
| 1810 | + | ||
| 1811 | + /* start parsing on second line */ | ||
| 1812 | + for(i = 1; i < chld_out.lines; i++) { | ||
| 1813 | + input_line = chld_out.line[i]; | ||
| 1814 | |||
| 1815 | if (verbose >= 3) | ||
| 1816 | printf ("%s", input_line); | ||
| 1817 | @@ -177,8 +165,7 @@ | ||
| 1818 | |||
| 1819 | /* Some ps return full pathname for command. This removes path */ | ||
| 1820 | #ifdef HAVE_BASENAME | ||
| 1821 | - temp_string = strdup(procprog); | ||
| 1822 | - procprog = basename(temp_string); | ||
| 1823 | + procprog = strdup(basename(procprog)); | ||
| 1824 | #endif /* HAVE_BASENAME */ | ||
| 1825 | |||
| 1826 | /* we need to convert the elapsed time to seconds */ | ||
| 1827 | @@ -248,27 +235,17 @@ | ||
| 1828 | } | ||
| 1829 | |||
| 1830 | /* If we get anything on STDERR, at least set warning */ | ||
| 1831 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { | ||
| 1832 | - if (verbose) | ||
| 1833 | - printf ("STDERR: %s", input_buffer); | ||
| 1834 | + if(chld_err.buflen > 0) { | ||
| 1835 | result = max_state (result, STATE_WARNING); | ||
| 1836 | printf (_("System call sent warnings to stderr\n")); | ||
| 1837 | } | ||
| 1838 | - | ||
| 1839 | - (void) fclose (child_stderr); | ||
| 1840 | - | ||
| 1841 | - /* close the pipe */ | ||
| 1842 | - if (spclose (child_process)) { | ||
| 1843 | - printf (_("System call returned nonzero status\n")); | ||
| 1844 | - result = max_state (result, STATE_WARNING); | ||
| 1845 | - } | ||
| 1846 | |||
| 1847 | if (found == 0) { /* no process lines parsed so return STATE_UNKNOWN */ | ||
| 1848 | printf (_("Unable to read output\n")); | ||
| 1849 | return result; | ||
| 1850 | } | ||
| 1851 | |||
| 1852 | - if ( result == STATE_UNKNOWN ) | ||
| 1853 | + if ( result == STATE_UNKNOWN ) | ||
| 1854 | result = STATE_OK; | ||
| 1855 | |||
| 1856 | /* Needed if procs found, but none match filter */ | ||
| 1857 | @@ -459,7 +436,7 @@ | ||
| 1858 | } | ||
| 1859 | usage4 (_("PCPU must be a float!")); | ||
| 1860 | case 'm': | ||
| 1861 | - asprintf (&metric_name, "%s", optarg); | ||
| 1862 | + metric_name = optarg; | ||
| 1863 | if ( strcmp(optarg, "PROCS") == 0) { | ||
| 1864 | metric = METRIC_PROCS; | ||
| 1865 | break; | ||
| 1866 | @@ -494,7 +471,7 @@ | ||
| 1867 | if (cmax == -1 && argv[c]) | ||
| 1868 | cmax = atoi (argv[c++]); | ||
| 1869 | if (statopts == NULL && argv[c]) { | ||
| 1870 | - asprintf (&statopts, "%s", argv[c++]); | ||
| 1871 | + statopts = argv[c++]; | ||
| 1872 | asprintf (&fmt, _("%s%sSTATE = %s"), (fmt ? fmt : ""), (options ? ", " : ""), statopts); | ||
| 1873 | options |= STAT; | ||
| 1874 | } | ||
| 1875 | diff -urN ../nplg/plugins/check_snmp.c ./plugins/check_snmp.c | ||
| 1876 | --- ../nplg/plugins/check_snmp.c 2005-06-03 12:07:28.000000000 +0200 | ||
| 1877 | +++ ./plugins/check_snmp.c 2005-06-10 15:01:26.000000000 +0200 | ||
| 1878 | @@ -14,18 +14,18 @@ | ||
| 1879 | along with this program; if not, write to the Free Software | ||
| 1880 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 1881 | |||
| 1882 | - $Id: check_snmp.c,v 1.57 2005/06/01 19:41:01 sghosh Exp $ | ||
| 1883 | + $Id: check_snmp.c,v 1.2 2005/06/05 21:55:26 exon Exp $ | ||
| 1884 | |||
| 1885 | ******************************************************************************/ | ||
| 1886 | |||
| 1887 | const char *progname = "check_snmp"; | ||
| 1888 | -const char *revision = "$Revision: 1.57 $"; | ||
| 1889 | +const char *revision = "$Revision: 1.2 $"; | ||
| 1890 | const char *copyright = "1999-2004"; | ||
| 1891 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 1892 | |||
| 1893 | #include "common.h" | ||
| 1894 | #include "utils.h" | ||
| 1895 | -#include "popen.h" | ||
| 1896 | +#include "runcmd.h" | ||
| 1897 | |||
| 1898 | #define DEFAULT_COMMUNITY "public" | ||
| 1899 | #define DEFAULT_PORT "161" | ||
| 1900 | @@ -136,11 +136,12 @@ | ||
| 1901 | char *command_line = NULL; | ||
| 1902 | char *response = NULL; | ||
| 1903 | char *outbuff; | ||
| 1904 | - char *output; | ||
| 1905 | + char *msg; | ||
| 1906 | char *ptr = NULL; | ||
| 1907 | char *p2 = NULL; | ||
| 1908 | char *show = NULL; | ||
| 1909 | char type[8]; | ||
| 1910 | + output chld_out, chld_err; | ||
| 1911 | |||
| 1912 | setlocale (LC_ALL, ""); | ||
| 1913 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 1914 | @@ -157,7 +158,7 @@ | ||
| 1915 | units = strdup (""); | ||
| 1916 | port = strdup (DEFAULT_PORT); | ||
| 1917 | outbuff = strdup (""); | ||
| 1918 | - output = strdup (""); | ||
| 1919 | + msg = strdup (""); | ||
| 1920 | delimiter = strdup (" = "); | ||
| 1921 | output_delim = strdup (DEFAULT_OUTPUT_DELIMITER); | ||
| 1922 | /* miblist = strdup (DEFAULT_MIBLIST); */ | ||
| 1923 | @@ -168,41 +169,25 @@ | ||
| 1924 | usage4 (_("Could not parse arguments")); | ||
| 1925 | |||
| 1926 | /* create the command line to execute */ | ||
| 1927 | - if(usesnmpgetnext == TRUE) { | ||
| 1928 | - asprintf(&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s", | ||
| 1929 | - PATH_TO_SNMPGETNEXT, timeout_interval, retries, miblist, proto, | ||
| 1930 | - authpriv, server_address, port, oid); | ||
| 1931 | - }else{ | ||
| 1932 | - | ||
| 1933 | - asprintf (&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s", | ||
| 1934 | - PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto, | ||
| 1935 | - authpriv, server_address, port, oid); | ||
| 1936 | - } | ||
| 1937 | - | ||
| 1938 | + asprintf(&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s", | ||
| 1939 | + usesnmpgetnext == TRUE ? PATH_TO_SNMPGETNEXT : PATH_TO_SNMPGET, | ||
| 1940 | + timeout_interval, retries, miblist, proto, | ||
| 1941 | + authpriv, server_address, port, oid); | ||
| 1942 | + | ||
| 1943 | if (verbose) | ||
| 1944 | printf ("%s\n", command_line); | ||
| 1945 | - | ||
| 1946 | |||
| 1947 | /* run the command */ | ||
| 1948 | - child_process = spopen (command_line); | ||
| 1949 | - if (child_process == NULL) { | ||
| 1950 | - printf (_("Could not open pipe: %s\n"), command_line); | ||
| 1951 | - exit (STATE_UNKNOWN); | ||
| 1952 | - } | ||
| 1953 | - | ||
| 1954 | - child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 1955 | - if (child_stderr == NULL) { | ||
| 1956 | - printf (_("Could not open stderr for %s\n"), command_line); | ||
| 1957 | - } | ||
| 1958 | + if((np_runcmd(command_line, &chld_out, &chld_err, 0)) != 0 || chld_err.buflen) | ||
| 1959 | + result = STATE_WARNING; | ||
| 1960 | |||
| 1961 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) | ||
| 1962 | - asprintf (&output, "%s%s", output, input_buffer); | ||
| 1963 | + for(i = 0; (size_t)i < chld_out.lines; i++) | ||
| 1964 | + asprintf (&msg, "%s%s", msg, input_buffer); | ||
| 1965 | |||
| 1966 | if (verbose) | ||
| 1967 | - printf ("%s\n", output); | ||
| 1968 | - | ||
| 1969 | - ptr = output; | ||
| 1970 | + printf ("%s\n", msg); | ||
| 1971 | |||
| 1972 | + ptr = msg; | ||
| 1973 | strcat(perfstr, "| "); | ||
| 1974 | while (ptr) { | ||
| 1975 | char *foo; | ||
| 1976 | @@ -261,18 +246,11 @@ | ||
| 1977 | iresult = STATE_DEPENDENT; | ||
| 1978 | |||
| 1979 | /* Process this block for integer comparisons */ | ||
| 1980 | - if (eval_method[i] & CRIT_GT || | ||
| 1981 | - eval_method[i] & CRIT_LT || | ||
| 1982 | - eval_method[i] & CRIT_GE || | ||
| 1983 | - eval_method[i] & CRIT_LE || | ||
| 1984 | - eval_method[i] & CRIT_EQ || | ||
| 1985 | - eval_method[i] & CRIT_NE || | ||
| 1986 | - eval_method[i] & WARN_GT || | ||
| 1987 | - eval_method[i] & WARN_LT || | ||
| 1988 | - eval_method[i] & WARN_GE || | ||
| 1989 | - eval_method[i] & WARN_LE || | ||
| 1990 | - eval_method[i] & WARN_EQ || | ||
| 1991 | - eval_method[i] & WARN_NE) { | ||
| 1992 | + if (eval_method[i] & (CRIT_GT | CRIT_LT | CRIT_GE | | ||
| 1993 | + CRIT_LE | CRIT_EQ | CRIT_NE | | ||
| 1994 | + WARN_GT | WARN_LT | WARN_GE | | ||
| 1995 | + WARN_LE | WARN_EQ | WARN_NE)) | ||
| 1996 | + { | ||
| 1997 | p2 = strpbrk (p2, "0123456789"); | ||
| 1998 | if (p2 == NULL) | ||
| 1999 | die (STATE_UNKNOWN,_("No valid data returned")); | ||
| 2000 | @@ -350,20 +328,6 @@ | ||
| 2001 | label, | ||
| 2002 | command_line); | ||
| 2003 | |||
| 2004 | - /* WARNING if output found on stderr */ | ||
| 2005 | - if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) | ||
| 2006 | - result = max_state (result, STATE_WARNING); | ||
| 2007 | - | ||
| 2008 | - /* close stderr */ | ||
| 2009 | - (void) fclose (child_stderr); | ||
| 2010 | - | ||
| 2011 | - /* close the pipe */ | ||
| 2012 | - if (spclose (child_process)) | ||
| 2013 | - result = max_state (result, STATE_WARNING); | ||
| 2014 | - | ||
| 2015 | -/* if (nunits == 1 || i == 1) */ | ||
| 2016 | -/* printf ("%s %s -%s %s\n", label, state_text (result), outbuff, units); */ | ||
| 2017 | -/* else */ | ||
| 2018 | printf ("%s %s -%s %s \n", label, state_text (result), outbuff, perfstr); | ||
| 2019 | |||
| 2020 | return result; | ||
| 2021 | diff -urN ../nplg/plugins/check_swap.c ./plugins/check_swap.c | ||
| 2022 | --- ../nplg/plugins/check_swap.c 2005-01-24 08:29:54.000000000 +0100 | ||
| 2023 | +++ ./plugins/check_swap.c 2005-06-10 15:01:26.000000000 +0200 | ||
| 2024 | @@ -21,18 +21,18 @@ | ||
| 2025 | * | ||
| 2026 | * Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net) | ||
| 2027 | * | ||
| 2028 | - * $Id: check_swap.c,v 1.47 2005/01/19 21:14:47 tonvoon Exp $ | ||
| 2029 | + * $Id: check_swap.c,v 1.4 2005/06/06 11:37:06 exon Exp $ | ||
| 2030 | * | ||
| 2031 | *****************************************************************************/ | ||
| 2032 | |||
| 2033 | const char *progname = "check_swap"; | ||
| 2034 | -const char *revision = "$Revision: 1.47 $"; | ||
| 2035 | +const char *revision = "$Revision: 1.4 $"; | ||
| 2036 | const char *copyright = "2000-2004"; | ||
| 2037 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 2038 | |||
| 2039 | #include "common.h" | ||
| 2040 | -#include "popen.h" | ||
| 2041 | #include "utils.h" | ||
| 2042 | +#include "runcmd.h" | ||
| 2043 | |||
| 2044 | int check_swap (int usp, float free_swap); | ||
| 2045 | int process_arguments (int argc, char **argv); | ||
| 2046 | @@ -64,6 +64,8 @@ | ||
| 2047 | char *temp_buffer; | ||
| 2048 | char *swap_command; | ||
| 2049 | char *swap_format; | ||
| 2050 | + output chld_out, chld_err; | ||
| 2051 | + size_t i = 0; | ||
| 2052 | # else | ||
| 2053 | # ifdef HAVE_DECL_SWAPCTL | ||
| 2054 | int i=0, nswaps=0, swapctl_res=0; | ||
| 2055 | @@ -79,14 +81,13 @@ | ||
| 2056 | # endif | ||
| 2057 | #endif | ||
| 2058 | char str[32]; | ||
| 2059 | - char *status, *tmp_status; | ||
| 2060 | + char *status; | ||
| 2061 | |||
| 2062 | setlocale (LC_ALL, ""); | ||
| 2063 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 2064 | textdomain (PACKAGE); | ||
| 2065 | |||
| 2066 | status = strdup (""); | ||
| 2067 | - tmp_status = strdup (""); | ||
| 2068 | perf = strdup (""); | ||
| 2069 | |||
| 2070 | if (process_arguments (argc, argv) == ERROR) | ||
| 2071 | @@ -146,15 +147,9 @@ | ||
| 2072 | if (verbose >= 3) | ||
| 2073 | printf (_("Format: %s\n"), swap_format); | ||
| 2074 | |||
| 2075 | - child_process = spopen (swap_command); | ||
| 2076 | - if (child_process == NULL) { | ||
| 2077 | - printf (_("Could not open pipe: %s\n"), swap_command); | ||
| 2078 | - return STATE_UNKNOWN; | ||
| 2079 | - } | ||
| 2080 | - | ||
| 2081 | - child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 2082 | - if (child_stderr == NULL) | ||
| 2083 | - printf (_("Could not open stderr for %s\n"), swap_command); | ||
| 2084 | + /* run the command. set WARNING if non-zero return or output on stderr */ | ||
| 2085 | + if((np_runcmd(swap_command, &chld_out, &chld_err, 0)) || chld_err.buflen) | ||
| 2086 | + result = STATE_WARNING; | ||
| 2087 | |||
| 2088 | sprintf (str, "%s", ""); | ||
| 2089 | /* read 1st line */ | ||
| 2090 | @@ -210,17 +205,6 @@ | ||
| 2091 | # ifdef _AIX | ||
| 2092 | } | ||
| 2093 | # endif | ||
| 2094 | - | ||
| 2095 | - /* If we get anything on STDERR, at least set warning */ | ||
| 2096 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) | ||
| 2097 | - result = max_state (result, STATE_WARNING); | ||
| 2098 | - | ||
| 2099 | - /* close stderr */ | ||
| 2100 | - (void) fclose (child_stderr); | ||
| 2101 | - | ||
| 2102 | - /* close the pipe */ | ||
| 2103 | - if (spclose (child_process)) | ||
| 2104 | - result = max_state (result, STATE_WARNING); | ||
| 2105 | # else | ||
| 2106 | # ifdef CHECK_SWAP_SWAPCTL_SVR4 | ||
| 2107 | |||
| 2108 | @@ -314,16 +298,19 @@ | ||
| 2109 | percent_used = 100 * ((double) used_swap) / ((double) total_swap); | ||
| 2110 | result = max_state (result, check_swap (percent_used, free_swap)); | ||
| 2111 | /* broken into two steps because of funkiness with builtin asprintf */ | ||
| 2112 | - asprintf (&tmp_status, _(" %d%% free (%.0f MB out of %.0f MB)"), | ||
| 2113 | - (100 - percent_used), free_swap, total_swap); | ||
| 2114 | - asprintf (&status, "%s%s", tmp_status, status); | ||
| 2115 | - | ||
| 2116 | - asprintf (&perf, "%s", perfdata ("swap", (long) free_swap, "MB", | ||
| 2117 | - TRUE, (long) max (warn_size/1024, warn_percent/100.0*total_swap), | ||
| 2118 | - TRUE, (long) max (crit_size/1024, crit_percent/100.0*total_swap), | ||
| 2119 | - TRUE, 0, | ||
| 2120 | - TRUE, (long) total_swap)); | ||
| 2121 | - printf ("SWAP %s:%s |%s\n", state_text (result), status, perf); | ||
| 2122 | + /* the breaking was removed because it was stupid. There's no reason | ||
| 2123 | + * to concatenate a string using asprintf() just to print it to stdout | ||
| 2124 | + * in the next statement. */ | ||
| 2125 | + printf (_("SWAP %s - %d%% free (%.0f MB out of %.0f MB) %s|"), | ||
| 2126 | + state_text (result), | ||
| 2127 | + (100 - percent_used), free_swap, total_swap, status); | ||
| 2128 | + | ||
| 2129 | + puts (perfdata ("swap", (long) free_swap, "MB", | ||
| 2130 | + TRUE, (long) max (warn_size/1024, warn_percent/100.0*total_swap), | ||
| 2131 | + TRUE, (long) max (crit_size/1024, crit_percent/100.0*total_swap), | ||
| 2132 | + TRUE, 0, | ||
| 2133 | + TRUE, (long) total_swap)); | ||
| 2134 | + | ||
| 2135 | return result; | ||
| 2136 | } | ||
| 2137 | |||
| 2138 | @@ -383,7 +370,7 @@ | ||
| 2139 | } | ||
| 2140 | else if (strstr (optarg, ",") && | ||
| 2141 | strstr (optarg, "%") && | ||
| 2142 | - sscanf (optarg, "%.0f,%d%%", &warn_size, &warn_percent) == 2) { | ||
| 2143 | + sscanf (optarg, "%f,%d%%", &warn_size, &warn_percent) == 2) { | ||
| 2144 | break; | ||
| 2145 | } | ||
| 2146 | else if (strstr (optarg, "%") && | ||
| 2147 | @@ -400,7 +387,7 @@ | ||
| 2148 | } | ||
| 2149 | else if (strstr (optarg, ",") && | ||
| 2150 | strstr (optarg, "%") && | ||
| 2151 | - sscanf (optarg, "%.0f,%d%%", &crit_size, &crit_percent) == 2) { | ||
| 2152 | + sscanf (optarg, "%f,%d%%", &crit_size, &crit_percent) == 2) { | ||
| 2153 | break; | ||
| 2154 | } | ||
| 2155 | else if (strstr (optarg, "%") && | ||
| 2156 | diff -urN ../nplg/plugins/check_users.c ./plugins/check_users.c | ||
| 2157 | --- ../nplg/plugins/check_users.c 2005-01-05 21:53:22.000000000 +0100 | ||
| 2158 | +++ ./plugins/check_users.c 2005-06-10 15:01:26.000000000 +0200 | ||
| 2159 | @@ -14,17 +14,17 @@ | ||
| 2160 | along with this program; if not, write to the Free Software | ||
| 2161 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 2162 | |||
| 2163 | - $Id: check_users.c,v 1.19 2004/12/25 23:17:44 opensides Exp $ | ||
| 2164 | + $Id: check_users.c,v 1.2 2005/06/05 21:55:26 exon Exp $ | ||
| 2165 | |||
| 2166 | *****************************************************************************/ | ||
| 2167 | |||
| 2168 | const char *progname = "check_users"; | ||
| 2169 | -const char *revision = "$Revision: 1.19 $"; | ||
| 2170 | +const char *revision = "$Revision: 1.2 $"; | ||
| 2171 | const char *copyright = "2000-2004"; | ||
| 2172 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 2173 | |||
| 2174 | #include "common.h" | ||
| 2175 | -#include "popen.h" | ||
| 2176 | +#include "runcmd.h" | ||
| 2177 | #include "utils.h" | ||
| 2178 | |||
| 2179 | #define possibly_set(a,b) ((a) == 0 ? (b) : 0) | ||
| 2180 | @@ -41,52 +41,28 @@ | ||
| 2181 | { | ||
| 2182 | int users = -1; | ||
| 2183 | int result = STATE_UNKNOWN; | ||
| 2184 | - char input_buffer[MAX_INPUT_BUFFER]; | ||
| 2185 | - char *perf; | ||
| 2186 | + output chld_out, chld_err; | ||
| 2187 | + size_t i; | ||
| 2188 | |||
| 2189 | setlocale (LC_ALL, ""); | ||
| 2190 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 2191 | textdomain (PACKAGE); | ||
| 2192 | |||
| 2193 | - perf = strdup(""); | ||
| 2194 | - | ||
| 2195 | if (process_arguments (argc, argv) == ERROR) | ||
| 2196 | usage4 (_("Could not parse arguments")); | ||
| 2197 | |||
| 2198 | /* run the command */ | ||
| 2199 | - child_process = spopen (WHO_COMMAND); | ||
| 2200 | - if (child_process == NULL) { | ||
| 2201 | - printf (_("Could not open pipe: %s\n"), WHO_COMMAND); | ||
| 2202 | - return STATE_UNKNOWN; | ||
| 2203 | - } | ||
| 2204 | - | ||
| 2205 | - child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 2206 | - if (child_stderr == NULL) | ||
| 2207 | - printf (_("Could not open stderr for %s\n"), WHO_COMMAND); | ||
| 2208 | - | ||
| 2209 | - users = 0; | ||
| 2210 | - | ||
| 2211 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 2212 | - | ||
| 2213 | - /* increment 'users' on all lines except total user count */ | ||
| 2214 | - if (input_buffer[0] != '#') { | ||
| 2215 | - users++; | ||
| 2216 | - continue; | ||
| 2217 | - } | ||
| 2218 | - | ||
| 2219 | - /* get total logged in users */ | ||
| 2220 | - if (sscanf (input_buffer, _("# users=%d"), &users) == 1) | ||
| 2221 | - break; | ||
| 2222 | - | ||
| 2223 | - } | ||
| 2224 | + result = np_runcmd(WHO_COMMAND, &chld_out, &chld_err, 0); | ||
| 2225 | + if(result != 0) | ||
| 2226 | + result = STATE_UNKNOWN; | ||
| 2227 | + | ||
| 2228 | + /* one user is listed per line, except when it begins with '#' */ | ||
| 2229 | + users = chld_out.lines; | ||
| 2230 | + for(i = 0; i < chld_out.lines; i++) | ||
| 2231 | + if (chld_out.line[0][0] == '#') users--; | ||
| 2232 | |||
| 2233 | /* check STDERR */ | ||
| 2234 | - if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) | ||
| 2235 | - result = possibly_set (result, STATE_UNKNOWN); | ||
| 2236 | - (void) fclose (child_stderr); | ||
| 2237 | - | ||
| 2238 | - /* close the pipe */ | ||
| 2239 | - if (spclose (child_process)) | ||
| 2240 | + if(chld_err.buflen > 0) | ||
| 2241 | result = possibly_set (result, STATE_UNKNOWN); | ||
| 2242 | |||
| 2243 | /* else check the user count against warning and critical thresholds */ | ||
| 2244 | @@ -98,16 +74,12 @@ | ||
| 2245 | result = STATE_OK; | ||
| 2246 | |||
| 2247 | if (result == STATE_UNKNOWN) | ||
| 2248 | - printf (_("Unable to read output\n")); | ||
| 2249 | - else { | ||
| 2250 | - asprintf(&perf, "%s", perfdata ("users", users, "", | ||
| 2251 | - TRUE, wusers, | ||
| 2252 | - TRUE, cusers, | ||
| 2253 | - TRUE, 0, | ||
| 2254 | - FALSE, 0)); | ||
| 2255 | - printf (_("USERS %s - %d users currently logged in |%s\n"), state_text (result), | ||
| 2256 | - users, perf); | ||
| 2257 | - } | ||
| 2258 | + die (STATE_UNKNOWN, _("Unable to read output\n")); | ||
| 2259 | + | ||
| 2260 | + printf (_("USERS %s - %d users currently logged in |%s\n"), | ||
| 2261 | + state_text (result), users, | ||
| 2262 | + perfdata("users", users, "", | ||
| 2263 | + TRUE, wusers, TRUE, cusers, TRUE, 0, FALSE, 0)); | ||
| 2264 | |||
| 2265 | return result; | ||
| 2266 | } | ||
| 2267 | @@ -129,8 +101,10 @@ | ||
| 2268 | {0, 0, 0, 0} | ||
| 2269 | }; | ||
| 2270 | |||
| 2271 | - if (argc < 2) | ||
| 2272 | - usage ("\n"); | ||
| 2273 | + if (argc < 2) { | ||
| 2274 | + print_usage (); | ||
| 2275 | + exit(STATE_UNKNOWN); | ||
| 2276 | + } | ||
| 2277 | |||
| 2278 | while (1) { | ||
| 2279 | c = getopt_long (argc, argv, "+hVvc:w:", longopts, &option); | ||
| 2280 | diff -urN ../nplg/plugins/foo ./plugins/foo | ||
| 2281 | --- ../nplg/plugins/foo 1970-01-01 01:00:00.000000000 +0100 | ||
| 2282 | +++ ./plugins/foo 2005-06-10 15:05:25.000000000 +0200 | ||
| 2283 | @@ -0,0 +1,12 @@ | ||
| 2284 | +$Id: check_by_ssh.c,v 1.35 2004/12/25 12:09:19 opensides Exp $ | ||
| 2285 | +$Id: check_dig.c,v 1.40 2005/01/26 21:21:01 tonvoon Exp $ | ||
| 2286 | +$Id: check_dns.c,v 1.47 2004/12/30 00:41:39 opensides Exp $ | ||
| 2287 | +$Id: check_fping.c,v 1.24 2004/12/25 23:17:44 opensides Exp $ | ||
| 2288 | +$Id: check_load.c,v 1.28 2005/05/28 01:21:54 seanius Exp $ | ||
| 2289 | +$Id: check_nagios.c,v 1.26 2005/05/25 00:43:20 seanius Exp $ | ||
| 2290 | +$Id: check_ping.c,v 1.44 2005/05/25 14:25:55 sghosh Exp $ | ||
| 2291 | +$Id: check_procs.c,v 1.45 2005/06/03 13:53:43 seanius Exp $ | ||
| 2292 | +$Id: check_snmp.c,v 1.57 2005/06/01 19:41:01 sghosh Exp $ | ||
| 2293 | +$Id: check_users.c,v 1.19 2004/12/25 23:17:44 opensides Exp $ | ||
| 2294 | +$Id: negate.c,v 1.24 2004/12/25 23:17:44 opensides Exp $ | ||
| 2295 | +$Id: urlize.c,v 1.17 2004/12/25 23:17:44 opensides Exp $ | ||
| 2296 | diff -urN ../nplg/plugins/Makefile.am ./plugins/Makefile.am | ||
| 2297 | --- ../nplg/plugins/Makefile.am 2005-02-15 09:28:36.000000000 +0100 | ||
| 2298 | +++ ./plugins/Makefile.am 2005-06-10 15:01:26.000000000 +0200 | ||
| 2299 | @@ -24,7 +24,8 @@ | ||
| 2300 | check_nagios check_by_ssh check_dns check_nt check_ide_smart \ | ||
| 2301 | check_procs | ||
| 2302 | |||
| 2303 | -EXTRA_DIST = t utils.c netutils.c popen.c utils.h netutils.h popen.h common.h \ | ||
| 2304 | +EXTRA_DIST = t common.h utils.c utils.h netutils.c netutils.h \ | ||
| 2305 | + runcmd.c runcmd.h \ | ||
| 2306 | getaddrinfo.c getaddrinfo.h gethostbyname.c gethostbyname.h | ||
| 2307 | |||
| 2308 | PLUGINHDRS = common.h | ||
| 2309 | @@ -46,85 +47,85 @@ | ||
| 2310 | # the actual targets | ||
| 2311 | |||
| 2312 | check_dhcp_LDADD = $(NETLIBS) | ||
| 2313 | -check_dig_LDADD = $(NETLIBS) popen.o | ||
| 2314 | -check_disk_LDADD = $(BASEOBJS) popen.o | ||
| 2315 | -check_dns_LDADD = $(NETLIBS) popen.o | ||
| 2316 | +check_dig_LDADD = $(NETLIBS) runcmd.o | ||
| 2317 | +check_disk_LDADD = $(BASEOBJS) runcmd.o | ||
| 2318 | +check_dns_LDADD = $(NETLIBS) runcmd.o | ||
| 2319 | check_dummy_LDADD = $(BASEOBJS) | ||
| 2320 | -check_fping_LDADD = $(NETLIBS) popen.o | ||
| 2321 | -check_game_LDADD = $(BASEOBJS) popen.o | ||
| 2322 | +check_fping_LDADD = $(NETLIBS) runcmd.o | ||
| 2323 | +check_game_LDADD = $(BASEOBJS) runcmd.o | ||
| 2324 | check_http_LDADD = $(NETLIBS) $(SSLLIBS) | ||
| 2325 | -check_hpjd_LDADD = $(NETLIBS) popen.o | ||
| 2326 | +check_hpjd_LDADD = $(NETLIBS) runcmd.o | ||
| 2327 | check_icmp_LDADD = $(SOCKETLIBS) | ||
| 2328 | check_ldap_LDADD = $(NETLIBS) $(LDAPLIBS) | ||
| 2329 | -check_load_LDADD = $(BASEOBJS) popen.o | ||
| 2330 | +check_load_LDADD = $(BASEOBJS) runcmd.o | ||
| 2331 | check_mrtg_LDADD = $(BASEOBJS) | ||
| 2332 | check_mrtgtraf_LDADD = $(BASEOBJS) | ||
| 2333 | check_mysql_LDADD = $(NETLIBS) $(MYSQLLIBS) | ||
| 2334 | -check_nagios_LDADD = $(BASEOBJS) popen.o | ||
| 2335 | +check_nagios_LDADD = $(BASEOBJS) runcmd.o | ||
| 2336 | check_nt_LDADD = $(NETLIBS) | ||
| 2337 | check_nwstat_LDADD = $(NETLIBS) | ||
| 2338 | check_overcr_LDADD = $(NETLIBS) | ||
| 2339 | check_pgsql_LDADD = $(NETLIBS) $(PGLIBS) | ||
| 2340 | -check_ping_LDADD = $(NETLIBS) popen.o | ||
| 2341 | -check_procs_LDADD = $(BASEOBJS) popen.o | ||
| 2342 | +check_ping_LDADD = $(NETLIBS) runcmd.o | ||
| 2343 | +check_procs_LDADD = $(BASEOBJS) runcmd.o | ||
| 2344 | check_radius_LDADD = $(NETLIBS) $(RADIUSLIBS) | ||
| 2345 | check_real_LDADD = $(NETLIBS) | ||
| 2346 | -check_snmp_LDADD = $(BASEOBJS) popen.o | ||
| 2347 | +check_snmp_LDADD = $(BASEOBJS) runcmd.o | ||
| 2348 | check_smtp_LDADD = $(NETLIBS) $(SSLLIBS) | ||
| 2349 | check_ssh_LDADD = $(NETLIBS) | ||
| 2350 | -check_swap_LDADD = $(BASEOBJS) popen.o | ||
| 2351 | +check_swap_LDADD = $(BASEOBJS) runcmd.o | ||
| 2352 | check_tcp_LDADD = $(NETLIBS) $(SSLLIBS) | ||
| 2353 | check_time_LDADD = $(NETLIBS) | ||
| 2354 | check_udp_LDADD = $(NETLIBS) | ||
| 2355 | check_ups_LDADD = $(NETLIBS) | ||
| 2356 | -check_users_LDADD = $(BASEOBJS) popen.o | ||
| 2357 | -check_by_ssh_LDADD = $(NETLIBS) popen.o | ||
| 2358 | +check_users_LDADD = $(BASEOBJS) runcmd.o | ||
| 2359 | +check_by_ssh_LDADD = $(NETLIBS) runcmd.o | ||
| 2360 | check_ide_smart_LDADD = $(BASEOBJS) | ||
| 2361 | -negate_LDADD = $(BASEOBJS) popen.o | ||
| 2362 | -urlize_LDADD = $(BASEOBJS) popen.o | ||
| 2363 | +negate_LDADD = $(BASEOBJS) runcmd.o | ||
| 2364 | +urlize_LDADD = $(BASEOBJS) runcmd.o | ||
| 2365 | |||
| 2366 | check_dhcp_DEPENDENCIES = check_dhcp.c $(NETOBJS) $(DEPLIBS) | ||
| 2367 | -check_dig_DEPENDENCIES = check_dig.c $(NETOBJS) popen.o $(DEPLIBS) | ||
| 2368 | -check_disk_DEPENDENCIES = check_disk.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 2369 | -check_dns_DEPENDENCIES = check_dns.c $(NETOBJS) popen.o $(DEPLIBS) | ||
| 2370 | +check_dig_DEPENDENCIES = check_dig.c $(NETOBJS) runcmd.o $(DEPLIBS) | ||
| 2371 | +check_disk_DEPENDENCIES = check_disk.c $(BASEOBJS) runcmd.o $(DEPLIBS) | ||
| 2372 | +check_dns_DEPENDENCIES = check_dns.c $(NETOBJS) runcmd.o $(DEPLIBS) | ||
| 2373 | check_dummy_DEPENDENCIES = check_dummy.c $(DEPLIBS) | ||
| 2374 | -check_fping_DEPENDENCIES = check_fping.c $(NETOBJS) popen.o $(DEPLIBS) | ||
| 2375 | +check_fping_DEPENDENCIES = check_fping.c $(NETOBJS) runcmd.o $(DEPLIBS) | ||
| 2376 | check_game_DEPENDENCIES = check_game.c $(DEPLIBS) | ||
| 2377 | check_http_DEPENDENCIES = check_http.c $(NETOBJS) $(DEPLIBS) | ||
| 2378 | -check_hpjd_DEPENDENCIES = check_hpjd.c $(NETOBJS) popen.o $(DEPLIBS) | ||
| 2379 | +check_hpjd_DEPENDENCIES = check_hpjd.c $(NETOBJS) runcmd.o $(DEPLIBS) | ||
| 2380 | check_icmp_DEPENDENCIES = check_icmp.c | ||
| 2381 | check_ide_smart_DEPENDENCIES = check_ide_smart.c $(BASEOBJS) $(DEPLIBS) | ||
| 2382 | check_ldap_DEPENDENCIES = check_ldap.c $(NETOBJS) $(DEPLIBS) | ||
| 2383 | -check_load_DEPENDENCIES = check_load.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 2384 | +check_load_DEPENDENCIES = check_load.c $(BASEOBJS) runcmd.o $(DEPLIBS) | ||
| 2385 | check_mrtg_DEPENDENCIES = check_mrtg.c $(DEPLIBS) | ||
| 2386 | check_mrtgtraf_DEPENDENCIES = check_mrtgtraf.c $(DEPLIBS) | ||
| 2387 | check_mysql_DEPENDENCIES = check_mysql.c $(NETOBJS) $(DEPLIBS) | ||
| 2388 | -check_nagios_DEPENDENCIES = check_nagios.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 2389 | +check_nagios_DEPENDENCIES = check_nagios.c $(BASEOBJS) runcmd.o $(DEPLIBS) | ||
| 2390 | check_nt_DEPENDENCIES = check_nt.c $(NETOBJS) $(DEPLIBS) | ||
| 2391 | check_nwstat_DEPENDENCIES = check_nwstat.c $(NETOBJS) $(DEPLIBS) | ||
| 2392 | check_overcr_DEPENDENCIES = check_overcr.c $(NETOBJS) $(DEPLIBS) | ||
| 2393 | check_pgsql_DEPENDENCIES = check_pgsql.c $(NETOBJS) $(DEPLIBS) | ||
| 2394 | -check_ping_DEPENDENCIES = check_ping.c $(NETOBJS) popen.o $(DEPLIBS) | ||
| 2395 | -check_procs_DEPENDENCIES = check_procs.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 2396 | +check_ping_DEPENDENCIES = check_ping.c $(NETOBJS) runcmd.o $(DEPLIBS) | ||
| 2397 | +check_procs_DEPENDENCIES = check_procs.c $(BASEOBJS) runcmd.o $(DEPLIBS) | ||
| 2398 | check_radius_DEPENDENCIES = check_radius.c $(NETOBJS) $(DEPLIBS) | ||
| 2399 | check_real_DEPENDENCIES = check_real.c $(NETOBJS) $(DEPLIBS) | ||
| 2400 | -check_snmp_DEPENDENCIES = check_snmp.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 2401 | +check_snmp_DEPENDENCIES = check_snmp.c $(BASEOBJS) runcmd.o $(DEPLIBS) | ||
| 2402 | check_smtp_DEPENDENCIES = check_smtp.c $(NETOBJS) $(DEPLIBS) | ||
| 2403 | check_ssh_DEPENDENCIES = check_ssh.c $(NETOBJS) $(DEPLIBS) | ||
| 2404 | -check_swap_DEPENDENCIES = check_swap.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 2405 | +check_swap_DEPENDENCIES = check_swap.c $(BASEOBJS) runcmd.o $(DEPLIBS) | ||
| 2406 | check_tcp_DEPENDENCIES = check_tcp.c $(NETOBJS) $(DEPLIBS) | ||
| 2407 | check_time_DEPENDENCIES = check_time.c $(NETOBJS) $(DEPLIBS) | ||
| 2408 | check_udp_DEPENDENCIES = check_udp.c $(NETOBJS) $(DEPLIBS) | ||
| 2409 | check_ups_DEPENDENCIES = check_ups.c $(NETOBJS) $(DEPLIBS) | ||
| 2410 | -check_users_DEPENDENCIES = check_users.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 2411 | -check_by_ssh_DEPENDENCIES = check_by_ssh.c $(NETOBJS) popen.o $(DEPLIBS) | ||
| 2412 | -negate_DEPENDENCIES = negate.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 2413 | -urlize_DEPENDENCIES = urlize.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 2414 | +check_users_DEPENDENCIES = check_users.c $(BASEOBJS) runcmd.o $(DEPLIBS) | ||
| 2415 | +check_by_ssh_DEPENDENCIES = check_by_ssh.c $(NETOBJS) runcmd.o $(DEPLIBS) | ||
| 2416 | +negate_DEPENDENCIES = negate.c $(BASEOBJS) runcmd.o $(DEPLIBS) | ||
| 2417 | +urlize_DEPENDENCIES = urlize.c $(BASEOBJS) runcmd.o $(DEPLIBS) | ||
| 2418 | |||
| 2419 | ############################################################################## | ||
| 2420 | # secondary dependencies | ||
| 2421 | |||
| 2422 | -popen.o: popen.c popen.h $(PLUGINHDRS) | ||
| 2423 | +runcmd.o: runcmd.c runcmd.h $(PLUGINHDRS) | ||
| 2424 | |||
| 2425 | utils.o: utils.c utils.h $(PLUGINHDRS) | ||
| 2426 | |||
| 2427 | diff -urN ../nplg/plugins/negate.c ./plugins/negate.c | ||
| 2428 | --- ../nplg/plugins/negate.c 2005-01-05 21:53:22.000000000 +0100 | ||
| 2429 | +++ ./plugins/negate.c 2005-06-10 15:01:26.000000000 +0200 | ||
| 2430 | @@ -14,7 +14,7 @@ | ||
| 2431 | along with this program; if not, write to the Free Software | ||
| 2432 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 2433 | |||
| 2434 | - $Id: negate.c,v 1.24 2004/12/25 23:17:44 opensides Exp $ | ||
| 2435 | + $Id: negate.c,v 1.2 2005/06/05 21:55:26 exon Exp $ | ||
| 2436 | |||
| 2437 | @@-<article> | ||
| 2438 | |||
| 2439 | @@ -54,7 +54,7 @@ | ||
| 2440 | ******************************************************************************/ | ||
| 2441 | |||
| 2442 | const char *progname = "negate"; | ||
| 2443 | -const char *revision = "$Revision: 1.24 $"; | ||
| 2444 | +const char *revision = "$Revision: 1.2 $"; | ||
| 2445 | const char *copyright = "2002-2004"; | ||
| 2446 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 2447 | |||
| 2448 | @@ -62,7 +62,7 @@ | ||
| 2449 | |||
| 2450 | #include "common.h" | ||
| 2451 | #include "utils.h" | ||
| 2452 | -#include "popen.h" | ||
| 2453 | +#include "runcmd.h" | ||
| 2454 | |||
| 2455 | char *command_line; | ||
| 2456 | |||
| 2457 | @@ -76,8 +76,9 @@ | ||
| 2458 | int | ||
| 2459 | main (int argc, char **argv) | ||
| 2460 | { | ||
| 2461 | - int found = 0, result = STATE_UNKNOWN; | ||
| 2462 | - char *buf; | ||
| 2463 | + int result = STATE_UNKNOWN; | ||
| 2464 | + output chld_out, chld_err; | ||
| 2465 | + size_t i; | ||
| 2466 | |||
| 2467 | setlocale (LC_ALL, ""); | ||
| 2468 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 2469 | @@ -92,43 +93,26 @@ | ||
| 2470 | |||
| 2471 | (void) alarm ((unsigned) timeout_interval); | ||
| 2472 | |||
| 2473 | - child_process = spopen (command_line); | ||
| 2474 | - if (child_process == NULL) | ||
| 2475 | - die (STATE_UNKNOWN, _("Could not open pipe: %s\n"), command_line); | ||
| 2476 | - | ||
| 2477 | - child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 2478 | - | ||
| 2479 | - if (child_stderr == NULL) { | ||
| 2480 | - printf (_("Could not open stderr for %s\n"), command_line); | ||
| 2481 | - } | ||
| 2482 | - | ||
| 2483 | - buf = malloc(MAX_INPUT_BUFFER); | ||
| 2484 | - while (fgets (buf, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 2485 | - found++; | ||
| 2486 | - printf ("%s", buf); | ||
| 2487 | - } | ||
| 2488 | - | ||
| 2489 | - if (!found) | ||
| 2490 | + result = np_runcmd(command_line, &chld_out, &chld_err, 0); | ||
| 2491 | + if (!chld_out.buflen) | ||
| 2492 | die (STATE_UNKNOWN, | ||
| 2493 | _("%s problem - No data received from host\nCMD: %s\n"),\ | ||
| 2494 | argv[0], command_line); | ||
| 2495 | |||
| 2496 | - /* close the pipe */ | ||
| 2497 | - result = spclose (child_process); | ||
| 2498 | + for(i = 0; i < chld_out.lines; i++) | ||
| 2499 | + printf("%s", chld_out.line[i]); | ||
| 2500 | |||
| 2501 | /* WARNING if output found on stderr */ | ||
| 2502 | - if (fgets (buf, MAX_INPUT_BUFFER - 1, child_stderr)) | ||
| 2503 | + if (chld_err.buflen != 0) | ||
| 2504 | result = max_state (result, STATE_WARNING); | ||
| 2505 | |||
| 2506 | - /* close stderr */ | ||
| 2507 | - (void) fclose (child_stderr); | ||
| 2508 | - | ||
| 2509 | if (result == STATE_OK) | ||
| 2510 | exit (STATE_CRITICAL); | ||
| 2511 | - else if (result == STATE_CRITICAL) | ||
| 2512 | + | ||
| 2513 | + if (result == STATE_CRITICAL) | ||
| 2514 | exit (EXIT_SUCCESS); | ||
| 2515 | - else | ||
| 2516 | - exit (result); | ||
| 2517 | + | ||
| 2518 | + exit (result); | ||
| 2519 | } | ||
| 2520 | |||
| 2521 | /****************************************************************************** | ||
| 2522 | diff -urN ../nplg/plugins/runcmd.c ./plugins/runcmd.c | ||
| 2523 | --- ../nplg/plugins/runcmd.c 1970-01-01 01:00:00.000000000 +0100 | ||
| 2524 | +++ ./plugins/runcmd.c 2005-06-10 15:01:26.000000000 +0200 | ||
| 2525 | @@ -0,0 +1,339 @@ | ||
| 2526 | +/* | ||
| 2527 | + * $Id: runcmd.c,v 1.1 2005/06/05 21:55:26 exon Exp $ | ||
| 2528 | + * | ||
| 2529 | + * A simple interface to executing programs from other programs, using an | ||
| 2530 | + * optimized and safe popen()-like implementation. It is considered safe | ||
| 2531 | + * in that no shell needs to be spawned and the environment passed to the | ||
| 2532 | + * execve()'d program is essentially empty. | ||
| 2533 | + * | ||
| 2534 | + * | ||
| 2535 | + * The code in this file is a derivative of popen.c which in turn was taken | ||
| 2536 | + * from "Advanced Programming for the Unix Environment" by W. Richard Stevens. | ||
| 2537 | + * | ||
| 2538 | + * Care has been taken to make sure the functions are async-safe. The one | ||
| 2539 | + * function which isn't is np_runcmd_init() which it doesn't make sense to | ||
| 2540 | + * call twice anyway, so the api as a whole should be considered async-safe. | ||
| 2541 | + * | ||
| 2542 | + */ | ||
| 2543 | + | ||
| 2544 | +/** includes **/ | ||
| 2545 | +#include "runcmd.h" | ||
| 2546 | +#ifdef HAVE_SYS_WAIT_H | ||
| 2547 | +# include <sys/wait.h> | ||
| 2548 | +#endif | ||
| 2549 | + | ||
| 2550 | +/** macros **/ | ||
| 2551 | +#ifndef WEXITSTATUS | ||
| 2552 | +# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) | ||
| 2553 | +#endif | ||
| 2554 | + | ||
| 2555 | +#ifndef WIFEXITED | ||
| 2556 | +# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) | ||
| 2557 | +#endif | ||
| 2558 | + | ||
| 2559 | +/* 4.3BSD Reno <signal.h> doesn't define SIG_ERR */ | ||
| 2560 | +#if defined(SIG_IGN) && !defined(SIG_ERR) | ||
| 2561 | +# define SIG_ERR ((Sigfunc *)-1) | ||
| 2562 | +#endif | ||
| 2563 | + | ||
| 2564 | +/* This variable must be global, since there's no way the caller | ||
| 2565 | + * can forcibly slay a dead or ungainly running program otherwise. | ||
| 2566 | + * Multithreading apps and plugins can initialize it (via NP_RUNCMD_INIT) | ||
| 2567 | + * in an async safe manner PRIOR to calling np_runcmd() for the first time. | ||
| 2568 | + * | ||
| 2569 | + * The check for initialized values is atomic and can | ||
| 2570 | + * occur in any number of threads simultaneously. */ | ||
| 2571 | +static pid_t *np_pids = NULL; | ||
| 2572 | + | ||
| 2573 | +/* If OPEN_MAX isn't defined, we try the sysconf syscall first. | ||
| 2574 | + * If that fails, we fall back to an educated guess which is accurate | ||
| 2575 | + * on Linux and some other systems. There's no guarantee that our guess is | ||
| 2576 | + * adequate and the program will die with SIGSEGV if it isn't and the | ||
| 2577 | + * upper boundary is breached. */ | ||
| 2578 | +#ifdef OPEN_MAX | ||
| 2579 | +# define maxfd OPEN_MAX | ||
| 2580 | +#else | ||
| 2581 | +# ifndef _SC_OPEN_MAX /* sysconf macro unavailable, so guess */ | ||
| 2582 | +# define maxfd 256 | ||
| 2583 | +# else | ||
| 2584 | +static int maxfd = 0; | ||
| 2585 | +# endif /* _SC_OPEN_MAX */ | ||
| 2586 | +#endif /* OPEN_MAX */ | ||
| 2587 | + | ||
| 2588 | + | ||
| 2589 | +/** prototypes **/ | ||
| 2590 | +static int np_runcmd_open(const char *, int *, int *) | ||
| 2591 | + __attribute__((__nonnull__(1, 2, 3))); | ||
| 2592 | + | ||
| 2593 | +static int np_fetch_output(int, output *, int) | ||
| 2594 | + __attribute__((__nonnull__(2))); | ||
| 2595 | + | ||
| 2596 | +static int np_runcmd_close(int); | ||
| 2597 | + | ||
| 2598 | +/* imported from utils.h */ | ||
| 2599 | +extern void die (int, const char *, ...) | ||
| 2600 | + __attribute__((__noreturn__,__format__(__printf__, 2, 3))); | ||
| 2601 | + | ||
| 2602 | + | ||
| 2603 | +/* this function is NOT async-safe. It is exported so multithreaded | ||
| 2604 | + * plugins (or other apps) can call it prior to running any commands | ||
| 2605 | + * through this api and thus achieve async-safeness throughout the api */ | ||
| 2606 | +void np_runcmd_init(void) | ||
| 2607 | +{ | ||
| 2608 | +#if !defined(OPEN_MAX) && defined(_SC_OPEN_MAX) | ||
| 2609 | + if(!maxfd) { | ||
| 2610 | + if((maxfd = sysconf(_SC_OPEN_MAX)) < 0) { | ||
| 2611 | + /* possibly log or emit a warning here, since there's no | ||
| 2612 | + * guarantee that our guess at maxfd will be adequate */ | ||
| 2613 | + maxfd = 256; | ||
| 2614 | + } | ||
| 2615 | + } | ||
| 2616 | +#endif | ||
| 2617 | + | ||
| 2618 | + if(!np_pids) np_pids = calloc(maxfd, sizeof(pid_t)); | ||
| 2619 | +} | ||
| 2620 | + | ||
| 2621 | + | ||
| 2622 | +/* Start running a command */ | ||
| 2623 | +static int | ||
| 2624 | +np_runcmd_open(const char *cmdstring, int *pfd, int *pfderr) | ||
| 2625 | +{ | ||
| 2626 | + char *env[2]; | ||
| 2627 | + char *cmd = NULL; | ||
| 2628 | + char **argv = NULL; | ||
| 2629 | + char *str; | ||
| 2630 | + int argc; | ||
| 2631 | + size_t cmdlen; | ||
| 2632 | + pid_t pid; | ||
| 2633 | +#ifdef RLIMIT_CORE | ||
| 2634 | + struct rlimit limit; | ||
| 2635 | +#endif | ||
| 2636 | + | ||
| 2637 | + int i = 0; | ||
| 2638 | + | ||
| 2639 | + if(!np_pids) NP_RUNCMD_INIT; | ||
| 2640 | + | ||
| 2641 | + env[0] = strdup("LC_ALL=C"); | ||
| 2642 | + env[1] = '\0'; | ||
| 2643 | + | ||
| 2644 | + /* if no command was passed, return with no error */ | ||
| 2645 | + if (cmdstring == NULL) | ||
| 2646 | + return -1; | ||
| 2647 | + | ||
| 2648 | + /* make copy of command string so strtok() doesn't silently modify it */ | ||
| 2649 | + /* (the calling program may want to access it later) */ | ||
| 2650 | + cmdlen = strlen(cmdstring); | ||
| 2651 | + cmd = malloc(cmdlen + 1); | ||
| 2652 | + if (cmd == NULL) return -1; | ||
| 2653 | + memcpy(cmd, cmdstring, cmdlen); | ||
| 2654 | + | ||
| 2655 | + /* This is not a shell, so we don't handle "???" */ | ||
| 2656 | + if (strstr (cmdstring, "\"")) return -1; | ||
| 2657 | + | ||
| 2658 | + /* allow single quotes, but only if non-whitesapce doesn't occur on both sides */ | ||
| 2659 | + if (strstr (cmdstring, " ' ") || strstr (cmdstring, "'''")) | ||
| 2660 | + return -1; | ||
| 2661 | + | ||
| 2662 | + /* each arg must be whitespace-separated, so args can be a maximum | ||
| 2663 | + * of (len / 2) + 1. We add 1 extra to the mix for NULL termination */ | ||
| 2664 | + argc = (cmdlen >> 1) + 2; | ||
| 2665 | + argv = calloc(sizeof(char *), argc); | ||
| 2666 | + | ||
| 2667 | + if (argv == NULL) { | ||
| 2668 | + printf (_("Could not malloc argv array in popen()\n")); | ||
| 2669 | + return -1; | ||
| 2670 | + } | ||
| 2671 | + | ||
| 2672 | + /* get command arguments (stupidly, but fairly quickly) */ | ||
| 2673 | + while (cmd) { | ||
| 2674 | + str = cmd; | ||
| 2675 | + str += strspn (str, " \t\r\n"); /* trim any leading whitespace */ | ||
| 2676 | + | ||
| 2677 | + if (strstr (str, "'") == str) { /* handle SIMPLE quoted strings */ | ||
| 2678 | + str++; | ||
| 2679 | + if (!strstr (str, "'")) return -1; /* balanced? */ | ||
| 2680 | + cmd = 1 + strstr (str, "'"); | ||
| 2681 | + str[strcspn (str, "'")] = 0; | ||
| 2682 | + } | ||
| 2683 | + else { | ||
| 2684 | + if (strpbrk (str, " \t\r\n")) { | ||
| 2685 | + cmd = 1 + strpbrk (str, " \t\r\n"); | ||
| 2686 | + str[strcspn (str, " \t\r\n")] = 0; | ||
| 2687 | + } | ||
| 2688 | + else { | ||
| 2689 | + cmd = NULL; | ||
| 2690 | + } | ||
| 2691 | + } | ||
| 2692 | + | ||
| 2693 | + if (cmd && strlen (cmd) == strspn (cmd, " \t\r\n")) | ||
| 2694 | + cmd = NULL; | ||
| 2695 | + | ||
| 2696 | + argv[i++] = str; | ||
| 2697 | + } | ||
| 2698 | + | ||
| 2699 | + if (pipe(pfd) < 0 || pipe(pfderr) < 0 || (pid = fork()) < 0) | ||
| 2700 | + return -1; /* errno set by the failing function */ | ||
| 2701 | + | ||
| 2702 | + /* child runs exceve() and _exit. */ | ||
| 2703 | + if (pid == 0) { | ||
| 2704 | +#ifdef RLIMIT_CORE | ||
| 2705 | + /* the program we execve shouldn't leave core files */ | ||
| 2706 | + getrlimit (RLIMIT_CORE, &limit); | ||
| 2707 | + limit.rlim_cur = 0; | ||
| 2708 | + setrlimit (RLIMIT_CORE, &limit); | ||
| 2709 | +#endif | ||
| 2710 | + close (pfd[0]); | ||
| 2711 | + if (pfd[1] != STDOUT_FILENO) { | ||
| 2712 | + dup2 (pfd[1], STDOUT_FILENO); | ||
| 2713 | + close (pfd[1]); | ||
| 2714 | + } | ||
| 2715 | + close (pfderr[0]); | ||
| 2716 | + if (pfderr[1] != STDERR_FILENO) { | ||
| 2717 | + dup2 (pfderr[1], STDERR_FILENO); | ||
| 2718 | + close (pfderr[1]); | ||
| 2719 | + } | ||
| 2720 | + | ||
| 2721 | + /* close all descriptors in np_pids[] | ||
| 2722 | + * This is executed in a separate address space (pure child), | ||
| 2723 | + * so we don't have to worry about async safety */ | ||
| 2724 | + for (i = 0; i < maxfd; i++) | ||
| 2725 | + if(np_pids[i] > 0) | ||
| 2726 | + close (i); | ||
| 2727 | + | ||
| 2728 | + execve (argv[0], argv, env); | ||
| 2729 | + _exit (0); | ||
| 2730 | + } | ||
| 2731 | + | ||
| 2732 | + /* parent picks up execution here */ | ||
| 2733 | + /* close childs descriptors in our address space */ | ||
| 2734 | + close(pfd[1]); | ||
| 2735 | + close(pfderr[1]); | ||
| 2736 | + | ||
| 2737 | + /* tag our file's entry in the pid-list and return it */ | ||
| 2738 | + np_pids[pfd[0]] = pid; | ||
| 2739 | + | ||
| 2740 | + return pfd[0]; | ||
| 2741 | +} | ||
| 2742 | + | ||
| 2743 | + | ||
| 2744 | +static int | ||
| 2745 | +np_runcmd_close(int fd) | ||
| 2746 | +{ | ||
| 2747 | + int status; | ||
| 2748 | + pid_t pid; | ||
| 2749 | + | ||
| 2750 | + /* make sure this fd was opened by popen() */ | ||
| 2751 | + if(fd < 0 || fd > maxfd || !np_pids || (pid = np_pids[fd]) == 0) | ||
| 2752 | + return -1; | ||
| 2753 | + | ||
| 2754 | + np_pids[fd] = 0; | ||
| 2755 | + if (close (fd) == -1) return -1; | ||
| 2756 | + | ||
| 2757 | + /* EINTR is ok (sort of), everything else is bad */ | ||
| 2758 | + while (waitpid (pid, &status, 0) < 0) | ||
| 2759 | + if (errno != EINTR) return -1; | ||
| 2760 | + | ||
| 2761 | + /* return child's termination status */ | ||
| 2762 | + return (WIFEXITED(status)) ? WEXITSTATUS(status) : -1; | ||
| 2763 | +} | ||
| 2764 | + | ||
| 2765 | + | ||
| 2766 | +void | ||
| 2767 | +popen_timeout_alarm_handler (int signo) | ||
| 2768 | +{ | ||
| 2769 | + size_t i; | ||
| 2770 | + | ||
| 2771 | + if (signo == SIGALRM) | ||
| 2772 | + puts(_("CRITICAL - Plugin timed out while executing system call\n")); | ||
| 2773 | + | ||
| 2774 | + if(np_pids) for(i = 0; i < maxfd; i++) { | ||
| 2775 | + if(np_pids[i] != 0) kill(np_pids[i], SIGKILL); | ||
| 2776 | + } | ||
| 2777 | + | ||
| 2778 | + exit (STATE_CRITICAL); | ||
| 2779 | +} | ||
| 2780 | + | ||
| 2781 | + | ||
| 2782 | +static int | ||
| 2783 | +np_fetch_output(int fd, output *op, int flags) | ||
| 2784 | +{ | ||
| 2785 | + size_t len = 0, i = 0; | ||
| 2786 | + size_t rsf = 6, ary_size = 0; /* rsf = right shift factor, dec'ed uncond once */ | ||
| 2787 | + char *buf = NULL; | ||
| 2788 | + int ret; | ||
| 2789 | + char tmpbuf[4096]; | ||
| 2790 | + | ||
| 2791 | + op->buf = NULL; | ||
| 2792 | + op->buflen = 0; | ||
| 2793 | + while((ret = read(fd, tmpbuf, sizeof(tmpbuf))) > 0) { | ||
| 2794 | + len = (size_t)ret; | ||
| 2795 | + op->buf = realloc(op->buf, op->buflen + len + 1); | ||
| 2796 | + memcpy(op->buf + op->buflen, tmpbuf, len); | ||
| 2797 | + op->buflen += len; | ||
| 2798 | + i++; | ||
| 2799 | + } | ||
| 2800 | + | ||
| 2801 | + if(ret < 0) { | ||
| 2802 | + printf("read() returned %d: %s\n", ret, strerror(errno)); | ||
| 2803 | + return ret; | ||
| 2804 | + } | ||
| 2805 | + | ||
| 2806 | + if(!op->buf || !op->buflen) return 0; | ||
| 2807 | + | ||
| 2808 | + /* some plugins may want to keep output unbroken */ | ||
| 2809 | + if(flags & RUNCMD_NO_ARRAYS) | ||
| 2810 | + return op->buflen; | ||
| 2811 | + | ||
| 2812 | + /* and some may want both (*sigh*) */ | ||
| 2813 | + if(flags & RUNCMD_NO_ASSOC) { | ||
| 2814 | + buf = malloc(op->buflen); | ||
| 2815 | + memcpy(buf, op->buf, op->buflen); | ||
| 2816 | + } | ||
| 2817 | + else buf = op->buf; | ||
| 2818 | + | ||
| 2819 | + op->line = NULL; | ||
| 2820 | + op->lens = NULL; | ||
| 2821 | + len = i = 0; | ||
| 2822 | + while(i < op->buflen) { | ||
| 2823 | + /* make sure we have enough memory */ | ||
| 2824 | + if(len >= ary_size) { | ||
| 2825 | + ary_size = op->buflen >> --rsf; | ||
| 2826 | + op->line = realloc(op->line, ary_size * sizeof(char *)); | ||
| 2827 | + op->lens = realloc(op->lens, ary_size * sizeof(size_t)); | ||
| 2828 | + } | ||
| 2829 | + | ||
| 2830 | + /* set the pointer to the string */ | ||
| 2831 | + op->line[len] = &buf[i]; | ||
| 2832 | + | ||
| 2833 | + /* hop to next newline or end of buffer */ | ||
| 2834 | + while(buf[i] != '\n' && i < op->buflen) i++; | ||
| 2835 | + buf[i] = '\0'; | ||
| 2836 | + | ||
| 2837 | + /* calculate the string length using pointer difference */ | ||
| 2838 | + op->lens[len] = (size_t)&buf[i] - (size_t)op->line[len]; | ||
| 2839 | + | ||
| 2840 | + len++; | ||
| 2841 | + i++; | ||
| 2842 | + } | ||
| 2843 | + | ||
| 2844 | + return len; | ||
| 2845 | +} | ||
| 2846 | + | ||
| 2847 | + | ||
| 2848 | +int | ||
| 2849 | +np_runcmd(const char *cmd, output *out, output *err, int flags) | ||
| 2850 | +{ | ||
| 2851 | + int fd, pfd_out[2], pfd_err[2]; | ||
| 2852 | + | ||
| 2853 | + /* initialize the structs */ | ||
| 2854 | + if(out) memset(out, 0, sizeof(output)); | ||
| 2855 | + if(err) memset(err, 0, sizeof(output)); | ||
| 2856 | + | ||
| 2857 | + if((fd = np_runcmd_open(cmd, pfd_out, pfd_err)) == -1) | ||
| 2858 | + die (STATE_UNKNOWN, _("Could not open pipe: %s\n"), cmd); | ||
| 2859 | + | ||
| 2860 | + if(out) out->lines = np_fetch_output(pfd_out[0], out, flags); | ||
| 2861 | + if(err) err->lines = np_fetch_output(pfd_err[0], err, flags); | ||
| 2862 | + | ||
| 2863 | + return np_runcmd_close(fd); | ||
| 2864 | +} | ||
| 2865 | diff -urN ../nplg/plugins/runcmd.h ./plugins/runcmd.h | ||
| 2866 | --- ../nplg/plugins/runcmd.h 1970-01-01 01:00:00.000000000 +0100 | ||
| 2867 | +++ ./plugins/runcmd.h 2005-06-10 15:01:26.000000000 +0200 | ||
| 2868 | @@ -0,0 +1,39 @@ | ||
| 2869 | +/* | ||
| 2870 | + * $Id: runcmd.h,v 1.1 2005/06/05 21:55:26 exon Exp $ | ||
| 2871 | + * | ||
| 2872 | + * Author: Andreas Ericsson <ae@op5.se> | ||
| 2873 | + * | ||
| 2874 | + * Copyright: GNU GPL v2 or any later version. | ||
| 2875 | + * | ||
| 2876 | + */ | ||
| 2877 | + | ||
| 2878 | +#ifndef NAGIOSPLUG_RUNCMD_H | ||
| 2879 | +#define NAGIOSPLUG_RUNCMD_H | ||
| 2880 | + | ||
| 2881 | +#include "common.h" | ||
| 2882 | + | ||
| 2883 | +/** types **/ | ||
| 2884 | +struct output { | ||
| 2885 | + char *buf; /* output buffer */ | ||
| 2886 | + size_t buflen; /* output buffer content length */ | ||
| 2887 | + char **line; /* array of lines (points to buf) */ | ||
| 2888 | + size_t *lens; /* string lengths */ | ||
| 2889 | + size_t lines; /* lines of output */ | ||
| 2890 | +}; | ||
| 2891 | + | ||
| 2892 | +typedef struct output output; | ||
| 2893 | + | ||
| 2894 | +/** prototypes **/ | ||
| 2895 | +int np_runcmd(const char *, output *, output *, int); | ||
| 2896 | +void popen_timeout_alarm_handler(int) | ||
| 2897 | + __attribute__((__noreturn__)); | ||
| 2898 | + | ||
| 2899 | +/* only multi-threaded plugins need to bother with this */ | ||
| 2900 | +void np_runcmd_init(void); | ||
| 2901 | +#define NP_RUNCMD_INIT np_runcmd_init() | ||
| 2902 | + | ||
| 2903 | +/* possible flags for np_runcmd()'s fourth argument */ | ||
| 2904 | +#define RUNCMD_NO_ARRAYS 0x01 /* don't populate arrays at all */ | ||
| 2905 | +#define RUNCMD_NO_ASSOC 0x02 /* output.line won't point to buf */ | ||
| 2906 | + | ||
| 2907 | +#endif /* NAGIOSPLUG_RUNCMD_H */ | ||
| 2908 | diff -urN ../nplg/plugins/urlize.c ./plugins/urlize.c | ||
| 2909 | --- ../nplg/plugins/urlize.c 2005-01-05 21:53:23.000000000 +0100 | ||
| 2910 | +++ ./plugins/urlize.c 2005-06-10 15:01:26.000000000 +0200 | ||
| 2911 | @@ -14,18 +14,18 @@ | ||
| 2912 | along with this program; if not, write to the Free Software | ||
| 2913 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 2914 | |||
| 2915 | - $Id: urlize.c,v 1.17 2004/12/25 23:17:44 opensides Exp $ | ||
| 2916 | + $Id: urlize.c,v 1.2 2005/06/05 21:55:26 exon Exp $ | ||
| 2917 | |||
| 2918 | ******************************************************************************/ | ||
| 2919 | |||
| 2920 | const char *progname = "urlize"; | ||
| 2921 | -const char *revision = "$Revision: 1.17 $"; | ||
| 2922 | +const char *revision = "$Revision: 1.2 $"; | ||
| 2923 | const char *copyright = "2000-2004"; | ||
| 2924 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 2925 | |||
| 2926 | #include "common.h" | ||
| 2927 | #include "utils.h" | ||
| 2928 | -#include "popen.h" | ||
| 2929 | +#include "runcmd.h" | ||
| 2930 | |||
| 2931 | void print_help (void); | ||
| 2932 | void print_usage (void); | ||
| 2933 | @@ -33,10 +33,11 @@ | ||
| 2934 | int | ||
| 2935 | main (int argc, char **argv) | ||
| 2936 | { | ||
| 2937 | - int found = 0, result = STATE_UNKNOWN; | ||
| 2938 | + int result = STATE_UNKNOWN; | ||
| 2939 | char *url = NULL; | ||
| 2940 | char *cmd; | ||
| 2941 | - char *buf; | ||
| 2942 | + output chld_out, chld_err; | ||
| 2943 | + size_t i; | ||
| 2944 | |||
| 2945 | int c; | ||
| 2946 | int option = 0; | ||
| 2947 | @@ -67,55 +68,37 @@ | ||
| 2948 | exit (EXIT_SUCCESS); | ||
| 2949 | break; | ||
| 2950 | case 'u': | ||
| 2951 | - url = strdup (argv[optind]); | ||
| 2952 | + url = optarg; | ||
| 2953 | break; | ||
| 2954 | case '?': | ||
| 2955 | default: | ||
| 2956 | - usage2 (_("Unknown argument"), optarg); | ||
| 2957 | + usage3 (_("Unknown argument"), c); | ||
| 2958 | } | ||
| 2959 | } | ||
| 2960 | |||
| 2961 | - if (url == NULL) | ||
| 2962 | - url = strdup (argv[optind++]); | ||
| 2963 | + if (url == NULL && optind < argc - 1) | ||
| 2964 | + url = argv[optind++]; | ||
| 2965 | |||
| 2966 | cmd = strdup (argv[optind++]); | ||
| 2967 | for (c = optind; c < argc; c++) { | ||
| 2968 | asprintf (&cmd, "%s %s", cmd, argv[c]); | ||
| 2969 | } | ||
| 2970 | |||
| 2971 | - child_process = spopen (cmd); | ||
| 2972 | - if (child_process == NULL) { | ||
| 2973 | - printf (_("Could not open pipe: %s\n"), cmd); | ||
| 2974 | - exit (STATE_UNKNOWN); | ||
| 2975 | - } | ||
| 2976 | - | ||
| 2977 | - child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 2978 | - if (child_stderr == NULL) { | ||
| 2979 | - printf (_("Could not open stderr for %s\n"), cmd); | ||
| 2980 | - } | ||
| 2981 | + result = np_runcmd(cmd, &chld_out, &chld_err, 0); | ||
| 2982 | + printf ("<A href=\"%s\">", url); | ||
| 2983 | |||
| 2984 | - buf = malloc(MAX_INPUT_BUFFER); | ||
| 2985 | - printf ("<A href=\"%s\">", argv[1]); | ||
| 2986 | - while (fgets (buf, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 2987 | - found++; | ||
| 2988 | - printf ("%s", buf); | ||
| 2989 | - } | ||
| 2990 | - | ||
| 2991 | - if (!found) | ||
| 2992 | + if (!chld_out.lines) | ||
| 2993 | die (STATE_UNKNOWN, | ||
| 2994 | _("%s UNKNOWN - No data received from host\nCMD: %s</A>\n"), | ||
| 2995 | argv[0], cmd); | ||
| 2996 | |||
| 2997 | - /* close the pipe */ | ||
| 2998 | - result = spclose (child_process); | ||
| 2999 | + for(i = 0; i < chld_out.lines; i++) | ||
| 3000 | + printf("%s", chld_out.line[i]); | ||
| 3001 | |||
| 3002 | /* WARNING if output found on stderr */ | ||
| 3003 | - if (fgets (buf, MAX_INPUT_BUFFER - 1, child_stderr)) | ||
| 3004 | + if (chld_err.buflen) | ||
| 3005 | result = max_state (result, STATE_WARNING); | ||
| 3006 | |||
| 3007 | - /* close stderr */ | ||
| 3008 | - (void) fclose (child_stderr); | ||
| 3009 | - | ||
| 3010 | printf ("</A>\n"); | ||
| 3011 | return result; | ||
| 3012 | } | ||
diff --git a/web/attachments/137903-nagiosplug-check_dhcp-unicast.diff b/web/attachments/137903-nagiosplug-check_dhcp-unicast.diff new file mode 100644 index 0000000..693de0f --- /dev/null +++ b/web/attachments/137903-nagiosplug-check_dhcp-unicast.diff | |||
| @@ -0,0 +1,1894 @@ | |||
| 1 | --- ../nplg/plugins/check_dhcp.c 2005-01-28 15:00:58.000000000 +0100 | ||
| 2 | +++ ./plugins/check_dhcp.c 2005-06-08 15:28:58.000000000 +0200 | ||
| 3 | @@ -22,12 +22,18 @@ | ||
| 4 | * along with this program; if not, write to the Free Software | ||
| 5 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 6 | * | ||
| 7 | -* $Id: check_dhcp.c,v 1.7 2005/01/25 18:11:21 harpermann Exp $ | ||
| 8 | +*-------------------------------------------------------------------------- | ||
| 9 | +* Unicast mode was originally implemented by Heiti of Boras Kommun with | ||
| 10 | +* general improvements as well as usability fixes and "forward"-porting by | ||
| 11 | +* Andreas Ericsson of OP5 AB. | ||
| 12 | +*-------------------------------------------------------------------------- | ||
| 13 | +* | ||
| 14 | +* $Id: check_dhcp.c,v 1.9 2005/06/07 15:57:53 exon Exp $ | ||
| 15 | * | ||
| 16 | *****************************************************************************/ | ||
| 17 | |||
| 18 | const char *progname = "check_dhcp"; | ||
| 19 | -const char *revision = "$Revision: 1.7 $"; | ||
| 20 | +const char *revision = "$Revision: 1.9 $"; | ||
| 21 | const char *copyright = "2001-2004"; | ||
| 22 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 23 | |||
| 24 | @@ -64,8 +70,8 @@ | ||
| 25 | |||
| 26 | #elif defined(__sun__) || defined(__solaris__) || defined(__hpux__) | ||
| 27 | |||
| 28 | -#define INSAP 22 | ||
| 29 | -#define OUTSAP 24 | ||
| 30 | +#define INSAP 22 | ||
| 31 | +#define OUTSAP 24 | ||
| 32 | |||
| 33 | #include <signal.h> | ||
| 34 | #include <ctype.h> | ||
| 35 | @@ -73,19 +79,17 @@ | ||
| 36 | #include <sys/poll.h> | ||
| 37 | #include <sys/dlpi.h> | ||
| 38 | |||
| 39 | -#define bcopy(source, destination, length) memcpy(destination, source, length) | ||
| 40 | - | ||
| 41 | -#define AREA_SZ 5000 /* buffer length in bytes */ | ||
| 42 | +#define AREA_SZ 5000 /* buffer length in bytes */ | ||
| 43 | static u_long ctl_area[AREA_SZ]; | ||
| 44 | static u_long dat_area[AREA_SZ]; | ||
| 45 | -static struct strbuf ctl = {AREA_SZ, 0, (char *)ctl_area}; | ||
| 46 | -static struct strbuf dat = {AREA_SZ, 0, (char *)dat_area}; | ||
| 47 | +static struct strbuf ctl = { AREA_SZ, 0, (char *)ctl_area }; | ||
| 48 | +static struct strbuf dat = { AREA_SZ, 0, (char *)dat_area }; | ||
| 49 | |||
| 50 | -#define GOT_CTRL 1 | ||
| 51 | -#define GOT_DATA 2 | ||
| 52 | -#define GOT_BOTH 3 | ||
| 53 | -#define GOT_INTR 4 | ||
| 54 | -#define GOT_ERR 128 | ||
| 55 | +#define GOT_CTRL 1 | ||
| 56 | +#define GOT_DATA 2 | ||
| 57 | +#define GOT_BOTH 3 | ||
| 58 | +#define GOT_INTR 4 | ||
| 59 | +#define GOT_ERR 128 | ||
| 60 | |||
| 61 | #define u_int8_t uint8_t | ||
| 62 | #define u_int16_t uint16_t | ||
| 63 | @@ -97,26 +101,11 @@ | ||
| 64 | static int put_both(int, int, int, int); | ||
| 65 | static int dl_open(const char *, int, int *); | ||
| 66 | static int dl_bind(int, int, u_char *); | ||
| 67 | -long mac_addr_dlpi( const char *, int, u_char *); | ||
| 68 | +static long mac_addr_dlpi(const char *, int, u_char *); | ||
| 69 | |||
| 70 | #endif | ||
| 71 | |||
| 72 | -#define HAVE_GETOPT_H | ||
| 73 | - | ||
| 74 | - | ||
| 75 | -/**** Common definitions ****/ | ||
| 76 | - | ||
| 77 | -#define STATE_OK 0 | ||
| 78 | -#define STATE_WARNING 1 | ||
| 79 | -#define STATE_CRITICAL 2 | ||
| 80 | -#define STATE_UNKNOWN -1 | ||
| 81 | - | ||
| 82 | -#define OK 0 | ||
| 83 | -#define ERROR -1 | ||
| 84 | - | ||
| 85 | -#define FALSE 0 | ||
| 86 | -#define TRUE 1 | ||
| 87 | - | ||
| 88 | +static int add_requested_server(struct in_addr server_address); | ||
| 89 | |||
| 90 | /**** DHCP definitions ****/ | ||
| 91 | |||
| 92 | @@ -126,39 +115,39 @@ | ||
| 93 | #define MAX_DHCP_OPTIONS_LENGTH 312 | ||
| 94 | |||
| 95 | |||
| 96 | -typedef struct dhcp_packet_struct{ | ||
| 97 | - u_int8_t op; /* packet type */ | ||
| 98 | - u_int8_t htype; /* type of hardware address for this machine (Ethernet, etc) */ | ||
| 99 | - u_int8_t hlen; /* length of hardware address (of this machine) */ | ||
| 100 | - u_int8_t hops; /* hops */ | ||
| 101 | - u_int32_t xid; /* random transaction id number - chosen by this machine */ | ||
| 102 | - u_int16_t secs; /* seconds used in timing */ | ||
| 103 | - u_int16_t flags; /* flags */ | ||
| 104 | - struct in_addr ciaddr; /* IP address of this machine (if we already have one) */ | ||
| 105 | - struct in_addr yiaddr; /* IP address of this machine (offered by the DHCP server) */ | ||
| 106 | - struct in_addr siaddr; /* IP address of DHCP server */ | ||
| 107 | - struct in_addr giaddr; /* IP address of DHCP relay */ | ||
| 108 | - unsigned char chaddr [MAX_DHCP_CHADDR_LENGTH]; /* hardware address of this machine */ | ||
| 109 | - char sname [MAX_DHCP_SNAME_LENGTH]; /* name of DHCP server */ | ||
| 110 | - char file [MAX_DHCP_FILE_LENGTH]; /* boot file name (used for diskless booting?) */ | ||
| 111 | - char options[MAX_DHCP_OPTIONS_LENGTH]; /* options */ | ||
| 112 | - }dhcp_packet; | ||
| 113 | - | ||
| 114 | - | ||
| 115 | -typedef struct dhcp_offer_struct{ | ||
| 116 | - struct in_addr server_address; /* address of DHCP server that sent this offer */ | ||
| 117 | - struct in_addr offered_address; /* the IP address that was offered to us */ | ||
| 118 | - u_int32_t lease_time; /* lease time in seconds */ | ||
| 119 | - u_int32_t renewal_time; /* renewal time in seconds */ | ||
| 120 | - u_int32_t rebinding_time; /* rebinding time in seconds */ | ||
| 121 | +typedef struct dhcp_packet_struct { | ||
| 122 | + u_int8_t op; /* packet type */ | ||
| 123 | + u_int8_t htype; /* type of hardware address for this machine (Ethernet, etc) */ | ||
| 124 | + u_int8_t hlen; /* length of hardware address (of this machine) */ | ||
| 125 | + u_int8_t hops; /* hops */ | ||
| 126 | + u_int32_t xid; /* random transaction id number - chosen by this machine */ | ||
| 127 | + u_int16_t secs; /* seconds used in timing */ | ||
| 128 | + u_int16_t flags; /* flags */ | ||
| 129 | + struct in_addr ciaddr; /* IP address of this machine (if we already have one) */ | ||
| 130 | + struct in_addr yiaddr; /* IP address of this machine (offered by the DHCP server) */ | ||
| 131 | + struct in_addr siaddr; /* IP address of DHCP server */ | ||
| 132 | + struct in_addr giaddr; /* IP address of DHCP relay */ | ||
| 133 | + unsigned char chaddr[MAX_DHCP_CHADDR_LENGTH]; /* hardware address of this machine */ | ||
| 134 | + char sname[MAX_DHCP_SNAME_LENGTH]; /* name of DHCP server */ | ||
| 135 | + char file[MAX_DHCP_FILE_LENGTH]; /* boot file name (used for diskless booting?) */ | ||
| 136 | + char options[MAX_DHCP_OPTIONS_LENGTH]; /* options */ | ||
| 137 | +} dhcp_packet; | ||
| 138 | + | ||
| 139 | + | ||
| 140 | +typedef struct dhcp_offer_struct { | ||
| 141 | + struct in_addr server_address; /* address of DHCP server that sent this offer */ | ||
| 142 | + struct in_addr offered_address; /* the IP address that was offered to us */ | ||
| 143 | + u_int32_t lease_time; /* lease time in seconds */ | ||
| 144 | + u_int32_t renewal_time; /* renewal time in seconds */ | ||
| 145 | + u_int32_t rebinding_time; /* rebinding time in seconds */ | ||
| 146 | struct dhcp_offer_struct *next; | ||
| 147 | - }dhcp_offer; | ||
| 148 | +} dhcp_offer; | ||
| 149 | |||
| 150 | |||
| 151 | -typedef struct requested_server_struct{ | ||
| 152 | +typedef struct requested_server_struct { | ||
| 153 | struct in_addr server_address; | ||
| 154 | struct requested_server_struct *next; | ||
| 155 | - }requested_server; | ||
| 156 | +} requested_server; | ||
| 157 | |||
| 158 | |||
| 159 | #define BOOTREQUEST 1 | ||
| 160 | @@ -183,35 +172,40 @@ | ||
| 161 | #define DHCP_INFINITE_TIME 0xFFFFFFFF | ||
| 162 | |||
| 163 | #define DHCP_BROADCAST_FLAG 32768 | ||
| 164 | +#define DHCP_UNICAST_FLAG 0 | ||
| 165 | |||
| 166 | #define DHCP_SERVER_PORT 67 | ||
| 167 | #define DHCP_CLIENT_PORT 68 | ||
| 168 | |||
| 169 | -#define ETHERNET_HARDWARE_ADDRESS 1 /* used in htype field of dhcp packet */ | ||
| 170 | -#define ETHERNET_HARDWARE_ADDRESS_LENGTH 6 /* length of Ethernet hardware addresses */ | ||
| 171 | +#define ETH_HW_ADDR 1 /* used in htype field of dhcp packet */ | ||
| 172 | +#define ETH_HW_ADDR_LEN 6 /* length of Ethernet hardware addresses */ | ||
| 173 | |||
| 174 | -unsigned char client_hardware_address[MAX_DHCP_CHADDR_LENGTH]=""; | ||
| 175 | +u_int8_t unicast_hops = 0; /* number of hops for unicast dhcp */ | ||
| 176 | +struct in_addr my_ip; /* our address (required for relay) */ | ||
| 177 | +struct in_addr dhcp_ip; /* server to query (if in unicast mode) */ | ||
| 178 | +struct sockaddr_in *my_addr; /* used to obtain our address */ | ||
| 179 | +unsigned char client_hardware_address[MAX_DHCP_CHADDR_LENGTH] = ""; | ||
| 180 | |||
| 181 | -char network_interface_name[8]="eth0"; | ||
| 182 | +char network_interface_name[8] = "eth0"; | ||
| 183 | |||
| 184 | -u_int32_t packet_xid=0; | ||
| 185 | +u_int32_t packet_xid = 0; | ||
| 186 | |||
| 187 | -u_int32_t dhcp_lease_time=0; | ||
| 188 | -u_int32_t dhcp_renewal_time=0; | ||
| 189 | -u_int32_t dhcp_rebinding_time=0; | ||
| 190 | +u_int32_t dhcp_lease_time = 0; | ||
| 191 | +u_int32_t dhcp_renewal_time = 0; | ||
| 192 | +u_int32_t dhcp_rebinding_time = 0; | ||
| 193 | |||
| 194 | -int dhcpoffer_timeout=2; | ||
| 195 | +int dhcpoffer_timeout = 2; | ||
| 196 | |||
| 197 | -dhcp_offer *dhcp_offer_list=NULL; | ||
| 198 | -requested_server *requested_server_list=NULL; | ||
| 199 | +dhcp_offer *dhcp_offer_list = NULL; | ||
| 200 | +requested_server *requested_server_list = NULL; | ||
| 201 | |||
| 202 | -int valid_responses=0; /* number of valid DHCPOFFERs we received */ | ||
| 203 | -int requested_servers=0; | ||
| 204 | -int requested_responses=0; | ||
| 205 | +int valid_responses = 0; /* number of valid DHCPOFFERs we received */ | ||
| 206 | +int requested_servers = 0; | ||
| 207 | +int requested_responses = 0; | ||
| 208 | |||
| 209 | -int request_specific_address=FALSE; | ||
| 210 | -int received_requested_address=FALSE; | ||
| 211 | -int verbose=0; | ||
| 212 | +int request_specific_address = FALSE; | ||
| 213 | +int received_requested_address = FALSE; | ||
| 214 | +int verbose = 0; | ||
| 215 | struct in_addr requested_address; | ||
| 216 | |||
| 217 | |||
| 218 | @@ -221,41 +215,42 @@ | ||
| 219 | void print_usage(void); | ||
| 220 | void print_help(void); | ||
| 221 | |||
| 222 | -int get_hardware_address(int,char *); | ||
| 223 | +int get_hardware_address(int, char *); | ||
| 224 | |||
| 225 | int send_dhcp_discover(int); | ||
| 226 | int get_dhcp_offer(int); | ||
| 227 | |||
| 228 | int get_results(void); | ||
| 229 | |||
| 230 | -int add_dhcp_offer(struct in_addr,dhcp_packet *); | ||
| 231 | +int add_dhcp_offer(struct in_addr, dhcp_packet *); | ||
| 232 | int free_dhcp_offer_list(void); | ||
| 233 | int free_requested_server_list(void); | ||
| 234 | |||
| 235 | int create_dhcp_socket(void); | ||
| 236 | -int close_dhcp_socket(int); | ||
| 237 | -int send_dhcp_packet(void *,int,int,struct sockaddr_in *); | ||
| 238 | -int receive_dhcp_packet(void *,int,int,int,struct sockaddr_in *); | ||
| 239 | +int send_dhcp_packet(void *, int, int, struct sockaddr_in *); | ||
| 240 | +int receive_dhcp_packet(void *, int, int, int, struct sockaddr_in *); | ||
| 241 | |||
| 242 | |||
| 243 | |||
| 244 | -int main(int argc, char **argv){ | ||
| 245 | +int | ||
| 246 | +main(int argc, char **argv) | ||
| 247 | +{ | ||
| 248 | int dhcp_socket; | ||
| 249 | int result; | ||
| 250 | |||
| 251 | - setlocale (LC_ALL, ""); | ||
| 252 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 253 | - textdomain (PACKAGE); | ||
| 254 | - | ||
| 255 | - if(process_arguments(argc,argv)!=OK){ | ||
| 256 | - usage4 (_("Could not parse arguments")); | ||
| 257 | - } | ||
| 258 | + setlocale(LC_ALL, ""); | ||
| 259 | + bindtextdomain(PACKAGE, LOCALEDIR); | ||
| 260 | + textdomain(PACKAGE); | ||
| 261 | + | ||
| 262 | + if(process_arguments(argc, argv) != OK) { | ||
| 263 | + usage4(_("Could not parse arguments")); | ||
| 264 | + } | ||
| 265 | |||
| 266 | /* create socket for DHCP communications */ | ||
| 267 | - dhcp_socket=create_dhcp_socket(); | ||
| 268 | + dhcp_socket = create_dhcp_socket(); | ||
| 269 | |||
| 270 | /* get hardware address of client machine */ | ||
| 271 | - get_hardware_address(dhcp_socket,network_interface_name); | ||
| 272 | + get_hardware_address(dhcp_socket, network_interface_name); | ||
| 273 | |||
| 274 | /* send DHCPDISCOVER packet */ | ||
| 275 | send_dhcp_discover(dhcp_socket); | ||
| 276 | @@ -264,930 +259,967 @@ | ||
| 277 | get_dhcp_offer(dhcp_socket); | ||
| 278 | |||
| 279 | /* close socket we created */ | ||
| 280 | - close_dhcp_socket(dhcp_socket); | ||
| 281 | + close(dhcp_socket); | ||
| 282 | |||
| 283 | /* determine state/plugin output to return */ | ||
| 284 | - result=get_results(); | ||
| 285 | + result = get_results(); | ||
| 286 | |||
| 287 | /* free allocated memory */ | ||
| 288 | free_dhcp_offer_list(); | ||
| 289 | free_requested_server_list(); | ||
| 290 | |||
| 291 | return result; | ||
| 292 | - } | ||
| 293 | - | ||
| 294 | +} | ||
| 295 | |||
| 296 | |||
| 297 | /* determines hardware address on client machine */ | ||
| 298 | -int get_hardware_address(int sock,char *interface_name){ | ||
| 299 | - | ||
| 300 | +int | ||
| 301 | +get_hardware_address(int sock, char *interface_name) | ||
| 302 | +{ | ||
| 303 | int i; | ||
| 304 | |||
| 305 | #if defined(__linux__) | ||
| 306 | struct ifreq ifr; | ||
| 307 | |||
| 308 | - strncpy((char *)&ifr.ifr_name,interface_name,sizeof(ifr.ifr_name)); | ||
| 309 | - | ||
| 310 | + strncpy((char *)&ifr.ifr_name, interface_name, sizeof(ifr.ifr_name)); | ||
| 311 | + | ||
| 312 | /* try and grab hardware address of requested interface */ | ||
| 313 | - if(ioctl(sock,SIOCGIFHWADDR,&ifr)<0){ | ||
| 314 | - printf(_("Error: Could not get hardware address of interface '%s'\n"),interface_name); | ||
| 315 | + if(ioctl(sock, SIOCGIFHWADDR, &ifr) < 0) { | ||
| 316 | + printf(_("Error: Could not get hardware address of interface '%s'\n"), | ||
| 317 | + interface_name); | ||
| 318 | exit(STATE_UNKNOWN); | ||
| 319 | - } | ||
| 320 | + } | ||
| 321 | + memcpy(&client_hardware_address[0], &ifr.ifr_hwaddr.sa_data, 6); | ||
| 322 | + | ||
| 323 | + /* get the IP of the interface we're using if this is a unicast request */ | ||
| 324 | + if(unicast_hops) { | ||
| 325 | + if(ioctl(sock, SIOCGIFADDR, &ifr) < 0) { | ||
| 326 | + printf(_("Error: Could not determine IP-address of interface '%s'\n"), | ||
| 327 | + interface_name); | ||
| 328 | + exit(STATE_UNKNOWN); | ||
| 329 | + } | ||
| 330 | |||
| 331 | - memcpy(&client_hardware_address[0],&ifr.ifr_hwaddr.sa_data,6); | ||
| 332 | + /* cast it to avoid black pointer magic */ | ||
| 333 | + my_addr = (struct sockaddr_in *)&ifr.ifr_addr; | ||
| 334 | + my_ip.s_addr = my_addr->sin_addr.s_addr; | ||
| 335 | + if(verbose) | ||
| 336 | + printf("Pretending to be relay client %s\n", inet_ntoa(my_ip)); | ||
| 337 | + } | ||
| 338 | |||
| 339 | #elif defined(__bsd__) | ||
| 340 | - /* King 2004 see ACKNOWLEDGEMENTS */ | ||
| 341 | + /* King 2004 see ACKNOWLEDGEMENTS */ | ||
| 342 | |||
| 343 | - int mib[6], len; | ||
| 344 | - char *buf; | ||
| 345 | - unsigned char *ptr; | ||
| 346 | - struct if_msghdr *ifm; | ||
| 347 | - struct sockaddr_dl *sdl; | ||
| 348 | - | ||
| 349 | - mib[0] = CTL_NET; | ||
| 350 | - mib[1] = AF_ROUTE; | ||
| 351 | - mib[2] = 0; | ||
| 352 | - mib[3] = AF_LINK; | ||
| 353 | - mib[4] = NET_RT_IFLIST; | ||
| 354 | - | ||
| 355 | - if ((mib[5] = if_nametoindex(interface_name)) == 0) { | ||
| 356 | - printf(_("Error: if_nametoindex error - %s.\n"), strerror(errno)); | ||
| 357 | - exit(STATE_UNKNOWN); | ||
| 358 | - } | ||
| 359 | - | ||
| 360 | - if (sysctl(mib, 6, NULL, &len, NULL, 0) < 0) { | ||
| 361 | - printf(_("Error: Couldn't get hardware address from %s. sysctl 1 error - %s.\n"), interface_name, strerror(errno)); | ||
| 362 | - exit(STATE_UNKNOWN); | ||
| 363 | - } | ||
| 364 | - | ||
| 365 | - if ((buf = malloc(len)) == NULL) { | ||
| 366 | - printf(_("Error: Couldn't get hardware address from interface %s. malloc error - %s.\n"), interface_name, strerror(errno)); | ||
| 367 | - exit(4); | ||
| 368 | - } | ||
| 369 | - | ||
| 370 | - if (sysctl(mib, 6, buf, &len, NULL, 0) < 0) { | ||
| 371 | - printf(_("Error: Couldn't get hardware address from %s. sysctl 2 error - %s.\n"), interface_name, strerror(errno)); | ||
| 372 | - exit(STATE_UNKNOWN); | ||
| 373 | - } | ||
| 374 | - | ||
| 375 | - ifm = (struct if_msghdr *)buf; | ||
| 376 | - sdl = (struct sockaddr_dl *)(ifm + 1); | ||
| 377 | - ptr = (unsigned char *)LLADDR(sdl); | ||
| 378 | - memcpy(&client_hardware_address[0], ptr, 6) ; | ||
| 379 | - /* King 2004 */ | ||
| 380 | + int mib[6], len; | ||
| 381 | + char *buf; | ||
| 382 | + unsigned char *ptr; | ||
| 383 | + struct if_msghdr *ifm; | ||
| 384 | + struct sockaddr_dl *sdl; | ||
| 385 | + | ||
| 386 | + mib[0] = CTL_NET; | ||
| 387 | + mib[1] = AF_ROUTE; | ||
| 388 | + mib[2] = 0; | ||
| 389 | + mib[3] = AF_LINK; | ||
| 390 | + mib[4] = NET_RT_IFLIST; | ||
| 391 | + | ||
| 392 | + if((mib[5] = if_nametoindex(interface_name)) == 0) { | ||
| 393 | + printf(_("Error: if_nametoindex error - %s.\n"), strerror(errno)); | ||
| 394 | + exit(STATE_UNKNOWN); | ||
| 395 | + } | ||
| 396 | + | ||
| 397 | + if(sysctl(mib, 6, NULL, &len, NULL, 0) < 0) { | ||
| 398 | + printf(_("Error: Couldn't get hardware address from %s. sysctl 1 error - %s.\n"), | ||
| 399 | + interface_name, strerror(errno)); | ||
| 400 | + exit(STATE_UNKNOWN); | ||
| 401 | + } | ||
| 402 | + | ||
| 403 | + if((buf = malloc(len)) == NULL) { | ||
| 404 | + printf(_("Error: Couldn't get hardware address from interface %s. malloc error - %s.\n"), | ||
| 405 | + interface_name, strerror(errno)); | ||
| 406 | + exit(4); | ||
| 407 | + } | ||
| 408 | + | ||
| 409 | + if(sysctl(mib, 6, buf, &len, NULL, 0) < 0) { | ||
| 410 | + printf(_("Error: Couldn't get hardware address from %s. sysctl 2 error - %s.\n"), | ||
| 411 | + interface_name, strerror(errno)); | ||
| 412 | + exit(STATE_UNKNOWN); | ||
| 413 | + } | ||
| 414 | + | ||
| 415 | + ifm = (struct if_msghdr *)buf; | ||
| 416 | + sdl = (struct sockaddr_dl *)(ifm + 1); | ||
| 417 | + ptr = (unsigned char *)LLADDR(sdl); | ||
| 418 | + memcpy(&client_hardware_address[0], ptr, 6); | ||
| 419 | + /* King 2004 */ | ||
| 420 | |||
| 421 | #elif defined(__sun__) || defined(__solaris__) | ||
| 422 | |||
| 423 | - /* Kompf 2000-2003 see ACKNOWLEDGEMENTS */ | ||
| 424 | + /* Kompf 2000-2003 see ACKNOWLEDGEMENTS */ | ||
| 425 | long stat; | ||
| 426 | char dev[20] = "/dev/"; | ||
| 427 | char *p; | ||
| 428 | int unit; | ||
| 429 | |||
| 430 | - for (p = interface_name; *p && isalpha(*p); p++) | ||
| 431 | - /* no-op */ ; | ||
| 432 | - if ( p != '\0' ) { | ||
| 433 | - unit = atoi(p) ; | ||
| 434 | - *p = '\0' ; | ||
| 435 | - strncat(dev, interface_name, 6) ; | ||
| 436 | - } else { | ||
| 437 | - printf(_("Error: can't find unit number in interface_name (%s) - expecting TypeNumber eg lnc0.\n"), interface_name); | ||
| 438 | + for(p = interface_name; *p && isalpha(*p); p++) /* no-op */ ; | ||
| 439 | + | ||
| 440 | + if(p != '\0') { | ||
| 441 | + unit = atoi(p); | ||
| 442 | + *p = '\0'; | ||
| 443 | + strncat(dev, interface_name, 6); | ||
| 444 | + } | ||
| 445 | + else { | ||
| 446 | + printf(_("Error: can't find unit number in interface_name (%s) - expecting TypeNumber eg lnc0.\n"), | ||
| 447 | + interface_name); | ||
| 448 | exit(STATE_UNKNOWN); | ||
| 449 | } | ||
| 450 | stat = mac_addr_dlpi(dev, unit, client_hardware_address); | ||
| 451 | - if (stat != 0) { | ||
| 452 | - printf(_("Error: can't read MAC address from DLPI streams interface for device %s unit %d.\n"), dev, unit); | ||
| 453 | + if(stat != 0) { | ||
| 454 | + printf(_("Error: can't read MAC address from DLPI streams interface for device %s unit %d.\n"), | ||
| 455 | + dev, unit); | ||
| 456 | exit(STATE_UNKNOWN); | ||
| 457 | } | ||
| 458 | |||
| 459 | #elif defined(__hpux__) | ||
| 460 | |||
| 461 | long stat; | ||
| 462 | - char dev[20] = "/dev/dlpi" ; | ||
| 463 | + char dev[20] = "/dev/dlpi"; | ||
| 464 | int unit = 0; | ||
| 465 | |||
| 466 | stat = mac_addr_dlpi(dev, unit, client_hardware_address); | ||
| 467 | - if (stat != 0) { | ||
| 468 | - printf(_("Error: can't read MAC address from DLPI streams interface for device %s unit %d.\n"), dev, unit); | ||
| 469 | + if(stat != 0) { | ||
| 470 | + printf(_("Error: can't read MAC address from DLPI streams interface for device %s unit %d.\n"), | ||
| 471 | + dev, unit); | ||
| 472 | exit(STATE_UNKNOWN); | ||
| 473 | } | ||
| 474 | - /* Kompf 2000-2003 */ | ||
| 475 | + /* Kompf 2000-2003 */ | ||
| 476 | |||
| 477 | #else | ||
| 478 | printf(_("Error: can't get MAC address for this architecture.\n")); | ||
| 479 | exit(STATE_UNKNOWN); | ||
| 480 | #endif | ||
| 481 | |||
| 482 | - if (verbose) { | ||
| 483 | + if(verbose) { | ||
| 484 | printf(_("Hardware address: ")); | ||
| 485 | - for (i=0; i<6; ++i) | ||
| 486 | + for(i = 0; i < 6; ++i) | ||
| 487 | printf("%2.2x", client_hardware_address[i]); | ||
| 488 | - printf( "\n"); | ||
| 489 | + printf("\n"); | ||
| 490 | } | ||
| 491 | |||
| 492 | return OK; | ||
| 493 | - } | ||
| 494 | +} | ||
| 495 | |||
| 496 | |||
| 497 | /* sends a DHCPDISCOVER broadcast message in an attempt to find DHCP servers */ | ||
| 498 | -int send_dhcp_discover(int sock){ | ||
| 499 | +int | ||
| 500 | +send_dhcp_discover(int sock) | ||
| 501 | +{ | ||
| 502 | dhcp_packet discover_packet; | ||
| 503 | struct sockaddr_in sockaddr_broadcast; | ||
| 504 | |||
| 505 | |||
| 506 | /* clear the packet data structure */ | ||
| 507 | - bzero(&discover_packet,sizeof(discover_packet)); | ||
| 508 | - | ||
| 509 | + memset(&discover_packet, 0, sizeof(discover_packet)); | ||
| 510 | |||
| 511 | /* boot request flag (backward compatible with BOOTP servers) */ | ||
| 512 | - discover_packet.op=BOOTREQUEST; | ||
| 513 | + discover_packet.op = BOOTREQUEST; | ||
| 514 | |||
| 515 | /* hardware address type */ | ||
| 516 | - discover_packet.htype=ETHERNET_HARDWARE_ADDRESS; | ||
| 517 | + discover_packet.htype = ETH_HW_ADDR; | ||
| 518 | |||
| 519 | /* length of our hardware address */ | ||
| 520 | - discover_packet.hlen=ETHERNET_HARDWARE_ADDRESS_LENGTH; | ||
| 521 | - | ||
| 522 | - discover_packet.hops=0; | ||
| 523 | + discover_packet.hlen = ETH_HW_ADDR_LEN; | ||
| 524 | |||
| 525 | - /* transaction id is supposed to be random */ | ||
| 526 | + /* transaction id is supposed to be random. We won't use the address so | ||
| 527 | + * we don't care about high entropy here. time() is good enough */ | ||
| 528 | srand(time(NULL)); | ||
| 529 | - packet_xid=random(); | ||
| 530 | - discover_packet.xid=htonl(packet_xid); | ||
| 531 | + packet_xid = random(); | ||
| 532 | + discover_packet.xid = htonl(packet_xid); | ||
| 533 | |||
| 534 | /**** WHAT THE HECK IS UP WITH THIS?!? IF I DON'T MAKE THIS CALL, ONLY ONE SERVER RESPONSE IS PROCESSED!!!! ****/ | ||
| 535 | /* downright bizzarre... */ | ||
| 536 | ntohl(discover_packet.xid); | ||
| 537 | |||
| 538 | - /*discover_packet.secs=htons(65535);*/ | ||
| 539 | - discover_packet.secs=0xFF; | ||
| 540 | + /*discover_packet.secs=htons(65535); */ | ||
| 541 | + discover_packet.secs = 0xFF; | ||
| 542 | |||
| 543 | - /* tell server it should broadcast its response */ | ||
| 544 | - discover_packet.flags=htons(DHCP_BROADCAST_FLAG); | ||
| 545 | + /* server needs to know if it should broadcast or unicast its response. | ||
| 546 | + * 0x8000L == 32768 == 1 << 15 == broadcast, 0 == unicast */ | ||
| 547 | + discover_packet.flags = unicast_hops == 0 ? htons(DHCP_BROADCAST_FLAG) : 0; | ||
| 548 | |||
| 549 | /* our hardware address */ | ||
| 550 | - memcpy(discover_packet.chaddr,client_hardware_address,ETHERNET_HARDWARE_ADDRESS_LENGTH); | ||
| 551 | + memcpy(discover_packet.chaddr, client_hardware_address, ETH_HW_ADDR_LEN); | ||
| 552 | |||
| 553 | /* first four bytes of options field is magic cookie (as per RFC 2132) */ | ||
| 554 | - discover_packet.options[0]='\x63'; | ||
| 555 | - discover_packet.options[1]='\x82'; | ||
| 556 | - discover_packet.options[2]='\x53'; | ||
| 557 | - discover_packet.options[3]='\x63'; | ||
| 558 | + discover_packet.options[0] = '\x63'; | ||
| 559 | + discover_packet.options[1] = '\x82'; | ||
| 560 | + discover_packet.options[2] = '\x53'; | ||
| 561 | + discover_packet.options[3] = '\x63'; | ||
| 562 | |||
| 563 | /* DHCP message type is embedded in options field */ | ||
| 564 | - discover_packet.options[4]=DHCP_OPTION_MESSAGE_TYPE; /* DHCP message type option identifier */ | ||
| 565 | - discover_packet.options[5]='\x01'; /* DHCP message option length in bytes */ | ||
| 566 | - discover_packet.options[6]=DHCPDISCOVER; | ||
| 567 | + discover_packet.options[4] = DHCP_OPTION_MESSAGE_TYPE; /* DHCP message type option identifier */ | ||
| 568 | + discover_packet.options[5] = '\x01'; /* DHCP message option length in bytes */ | ||
| 569 | + discover_packet.options[6] = DHCPDISCOVER; | ||
| 570 | |||
| 571 | /* the IP address we're requesting */ | ||
| 572 | - if(request_specific_address==TRUE){ | ||
| 573 | - discover_packet.options[7]=DHCP_OPTION_REQUESTED_ADDRESS; | ||
| 574 | - discover_packet.options[8]='\x04'; | ||
| 575 | - memcpy(&discover_packet.options[9],&requested_address,sizeof(requested_address)); | ||
| 576 | - } | ||
| 577 | - | ||
| 578 | - /* send the DHCPDISCOVER packet to broadcast address */ | ||
| 579 | - sockaddr_broadcast.sin_family=AF_INET; | ||
| 580 | - sockaddr_broadcast.sin_port=htons(DHCP_SERVER_PORT); | ||
| 581 | - sockaddr_broadcast.sin_addr.s_addr=INADDR_BROADCAST; | ||
| 582 | - bzero(&sockaddr_broadcast.sin_zero,sizeof(sockaddr_broadcast.sin_zero)); | ||
| 583 | + if(request_specific_address == TRUE) { | ||
| 584 | + discover_packet.options[7] = DHCP_OPTION_REQUESTED_ADDRESS; | ||
| 585 | + discover_packet.options[8] = '\x04'; | ||
| 586 | + memcpy(&discover_packet.options[9], &requested_address, | ||
| 587 | + sizeof(requested_address)); | ||
| 588 | + } | ||
| 589 | + | ||
| 590 | + /* unicast mods goes here */ | ||
| 591 | + if(unicast_hops) | ||
| 592 | + discover_packet.giaddr.s_addr = my_ip.s_addr; | ||
| 593 | |||
| 594 | + discover_packet.hops = unicast_hops; | ||
| 595 | |||
| 596 | - if (verbose) { | ||
| 597 | - printf(_("DHCPDISCOVER to %s port %d\n"),inet_ntoa(sockaddr_broadcast.sin_addr),ntohs(sockaddr_broadcast.sin_port)); | ||
| 598 | - printf("DHCPDISCOVER XID: %lu (0x%X)\n",ntohl(discover_packet.xid),ntohl(discover_packet.xid)); | ||
| 599 | - printf("DHCDISCOVER ciaddr: %s\n",inet_ntoa(discover_packet.ciaddr)); | ||
| 600 | - printf("DHCDISCOVER yiaddr: %s\n",inet_ntoa(discover_packet.yiaddr)); | ||
| 601 | - printf("DHCDISCOVER siaddr: %s\n",inet_ntoa(discover_packet.siaddr)); | ||
| 602 | - printf("DHCDISCOVER giaddr: %s\n",inet_ntoa(discover_packet.giaddr)); | ||
| 603 | + /* send the DHCPDISCOVER packet to broadcast address */ | ||
| 604 | + sockaddr_broadcast.sin_family = AF_INET; | ||
| 605 | + sockaddr_broadcast.sin_port = htons(DHCP_SERVER_PORT); | ||
| 606 | + sockaddr_broadcast.sin_addr.s_addr = unicast_hops == 0 ? INADDR_BROADCAST : dhcp_ip.s_addr; | ||
| 607 | + memset(&sockaddr_broadcast.sin_zero, 0, sizeof(sockaddr_broadcast.sin_zero)); | ||
| 608 | + | ||
| 609 | + | ||
| 610 | + if(verbose) { | ||
| 611 | + printf(_("DHCPDISCOVER to %s port %d\n"), | ||
| 612 | + inet_ntoa(sockaddr_broadcast.sin_addr), | ||
| 613 | + ntohs(sockaddr_broadcast.sin_port)); | ||
| 614 | + printf("DHCPDISCOVER XID: %u (0x%X)\n", ntohl(discover_packet.xid), | ||
| 615 | + ntohl(discover_packet.xid)); | ||
| 616 | + printf("DHCDISCOVER ciaddr: %s\n", inet_ntoa(discover_packet.ciaddr)); | ||
| 617 | + printf("DHCDISCOVER yiaddr: %s\n", inet_ntoa(discover_packet.yiaddr)); | ||
| 618 | + printf("DHCDISCOVER siaddr: %s\n", inet_ntoa(discover_packet.siaddr)); | ||
| 619 | + printf("DHCDISCOVER giaddr: %s\n", inet_ntoa(discover_packet.giaddr)); | ||
| 620 | } | ||
| 621 | |||
| 622 | /* send the DHCPDISCOVER packet out */ | ||
| 623 | - send_dhcp_packet(&discover_packet,sizeof(discover_packet),sock,&sockaddr_broadcast); | ||
| 624 | + send_dhcp_packet(&discover_packet, sizeof(discover_packet), sock, | ||
| 625 | + &sockaddr_broadcast); | ||
| 626 | |||
| 627 | - if (verbose) | ||
| 628 | - printf("\n\n"); | ||
| 629 | + if(verbose) printf("\n\n"); | ||
| 630 | |||
| 631 | return OK; | ||
| 632 | - } | ||
| 633 | - | ||
| 634 | - | ||
| 635 | +} | ||
| 636 | |||
| 637 | |||
| 638 | /* waits for a DHCPOFFER message from one or more DHCP servers */ | ||
| 639 | -int get_dhcp_offer(int sock){ | ||
| 640 | +int | ||
| 641 | +get_dhcp_offer(int sock) | ||
| 642 | +{ | ||
| 643 | dhcp_packet offer_packet; | ||
| 644 | struct sockaddr_in source; | ||
| 645 | - int result=OK; | ||
| 646 | - int timeout=1; | ||
| 647 | - int responses=0; | ||
| 648 | + int result = OK; | ||
| 649 | + int responses = 0; | ||
| 650 | int x; | ||
| 651 | - time_t start_time; | ||
| 652 | + time_t dhcp_start_time; | ||
| 653 | time_t current_time; | ||
| 654 | |||
| 655 | - time(&start_time); | ||
| 656 | + time(&dhcp_start_time); | ||
| 657 | |||
| 658 | /* receive as many responses as we can */ | ||
| 659 | - for(responses=0,valid_responses=0;;){ | ||
| 660 | + for(responses = 0, valid_responses = 0;;) { | ||
| 661 | |||
| 662 | time(¤t_time); | ||
| 663 | - if((current_time-start_time)>=dhcpoffer_timeout) | ||
| 664 | + if((current_time - dhcp_start_time) >= dhcpoffer_timeout) | ||
| 665 | break; | ||
| 666 | |||
| 667 | - if (verbose) | ||
| 668 | - printf("\n\n"); | ||
| 669 | + if(verbose) printf("\n\n"); | ||
| 670 | |||
| 671 | - bzero(&source,sizeof(source)); | ||
| 672 | - bzero(&offer_packet,sizeof(offer_packet)); | ||
| 673 | + memset(&source, 0, sizeof(source)); | ||
| 674 | + memset(&offer_packet, 0, sizeof(offer_packet)); | ||
| 675 | |||
| 676 | - result=OK; | ||
| 677 | - result=receive_dhcp_packet(&offer_packet,sizeof(offer_packet),sock,dhcpoffer_timeout,&source); | ||
| 678 | - | ||
| 679 | - if(result!=OK){ | ||
| 680 | - if (verbose) | ||
| 681 | - printf(_("Result=ERROR\n")); | ||
| 682 | + result = OK; | ||
| 683 | + result = receive_dhcp_packet(&offer_packet, sizeof(offer_packet), sock, | ||
| 684 | + dhcpoffer_timeout, &source); | ||
| 685 | |||
| 686 | + if(result != OK) { | ||
| 687 | + if(verbose) printf(_("Result=ERROR\n")); | ||
| 688 | continue; | ||
| 689 | - } | ||
| 690 | - else{ | ||
| 691 | - if (verbose) | ||
| 692 | - printf(_("Result=OK\n")); | ||
| 693 | - | ||
| 694 | + } | ||
| 695 | + else { | ||
| 696 | + if(verbose) printf(_("Result=OK\n")); | ||
| 697 | responses++; | ||
| 698 | - } | ||
| 699 | + } | ||
| 700 | |||
| 701 | - if (verbose) { | ||
| 702 | - printf(_("DHCPOFFER from IP address %s\n"),inet_ntoa(source.sin_addr)); | ||
| 703 | - printf("DHCPOFFER XID: %lu (0x%X)\n",ntohl(offer_packet.xid),ntohl(offer_packet.xid)); | ||
| 704 | + if(verbose) { | ||
| 705 | + printf(_("DHCPOFFER from IP address %s\n"), inet_ntoa(source.sin_addr)); | ||
| 706 | + printf("DHCPOFFER XID: %u (0x%X)\n", ntohl(offer_packet.xid), | ||
| 707 | + ntohl(offer_packet.xid)); | ||
| 708 | } | ||
| 709 | |||
| 710 | /* check packet xid to see if its the same as the one we used in the discover packet */ | ||
| 711 | - if(ntohl(offer_packet.xid)!=packet_xid){ | ||
| 712 | - if (verbose) | ||
| 713 | - printf(_("DHCPOFFER XID (%lu) did not match DHCPDISCOVER XID (%lu) - ignoring packet\n"),ntohl(offer_packet.xid),packet_xid); | ||
| 714 | - | ||
| 715 | + if(ntohl(offer_packet.xid) != packet_xid) { | ||
| 716 | + if(verbose) | ||
| 717 | + printf(_("DHCPOFFER XID (%u) did not match DHCPDISCOVER XID (%u) - ignoring packet\n"), | ||
| 718 | + ntohl(offer_packet.xid), packet_xid); | ||
| 719 | continue; | ||
| 720 | - } | ||
| 721 | + } | ||
| 722 | |||
| 723 | /* check hardware address */ | ||
| 724 | - result=OK; | ||
| 725 | - if (verbose) | ||
| 726 | - printf("DHCPOFFER chaddr: "); | ||
| 727 | - | ||
| 728 | - for(x=0;x<ETHERNET_HARDWARE_ADDRESS_LENGTH;x++){ | ||
| 729 | - if (verbose) | ||
| 730 | - printf("%02X",(unsigned char)offer_packet.chaddr[x]); | ||
| 731 | + result = OK; | ||
| 732 | + if(verbose) printf("DHCPOFFER chaddr: "); | ||
| 733 | |||
| 734 | - if(offer_packet.chaddr[x]!=client_hardware_address[x]) | ||
| 735 | - result=ERROR; | ||
| 736 | + for(x = 0; x < ETH_HW_ADDR_LEN; x++) { | ||
| 737 | + if(verbose) printf("%02X", (unsigned char)offer_packet.chaddr[x]); | ||
| 738 | + if(offer_packet.chaddr[x] != client_hardware_address[x]) | ||
| 739 | + result = ERROR; | ||
| 740 | } | ||
| 741 | - if (verbose) | ||
| 742 | - printf("\n"); | ||
| 743 | + if(verbose) printf("\n"); | ||
| 744 | |||
| 745 | - if(result==ERROR){ | ||
| 746 | - if (verbose) | ||
| 747 | + if(result == ERROR) { | ||
| 748 | + if(verbose) | ||
| 749 | printf(_("DHCPOFFER hardware address did not match our own - ignoring packet\n")); | ||
| 750 | - | ||
| 751 | continue; | ||
| 752 | - } | ||
| 753 | + } | ||
| 754 | |||
| 755 | - if (verbose) { | ||
| 756 | - printf("DHCPOFFER ciaddr: %s\n",inet_ntoa(offer_packet.ciaddr)); | ||
| 757 | - printf("DHCPOFFER yiaddr: %s\n",inet_ntoa(offer_packet.yiaddr)); | ||
| 758 | - printf("DHCPOFFER siaddr: %s\n",inet_ntoa(offer_packet.siaddr)); | ||
| 759 | - printf("DHCPOFFER giaddr: %s\n",inet_ntoa(offer_packet.giaddr)); | ||
| 760 | + if(verbose) { | ||
| 761 | + printf("DHCPOFFER ciaddr: %s\n", inet_ntoa(offer_packet.ciaddr)); | ||
| 762 | + printf("DHCPOFFER yiaddr: %s\n", inet_ntoa(offer_packet.yiaddr)); | ||
| 763 | + printf("DHCPOFFER siaddr: %s\n", inet_ntoa(offer_packet.siaddr)); | ||
| 764 | + printf("DHCPOFFER giaddr: %s\n", inet_ntoa(offer_packet.giaddr)); | ||
| 765 | } | ||
| 766 | |||
| 767 | - add_dhcp_offer(source.sin_addr,&offer_packet); | ||
| 768 | + add_dhcp_offer(source.sin_addr, &offer_packet); | ||
| 769 | |||
| 770 | valid_responses++; | ||
| 771 | - } | ||
| 772 | + } | ||
| 773 | |||
| 774 | - if (verbose) { | ||
| 775 | - printf(_("Total responses seen on the wire: %d\n"),responses); | ||
| 776 | - printf(_("Valid responses for this machine: %d\n"),valid_responses); | ||
| 777 | + if(verbose) { | ||
| 778 | + printf(_("Total responses seen on the wire: %d\n"), responses); | ||
| 779 | + printf(_("Valid responses for this machine: %d\n"), valid_responses); | ||
| 780 | } | ||
| 781 | |||
| 782 | return OK; | ||
| 783 | - } | ||
| 784 | - | ||
| 785 | +} | ||
| 786 | |||
| 787 | |||
| 788 | /* sends a DHCP packet */ | ||
| 789 | -int send_dhcp_packet(void *buffer, int buffer_size, int sock, struct sockaddr_in *dest){ | ||
| 790 | - struct sockaddr_in myname; | ||
| 791 | +int | ||
| 792 | +send_dhcp_packet(void *buffer, int buffer_size, int sock, struct sockaddr_in *dest) | ||
| 793 | +{ | ||
| 794 | int result; | ||
| 795 | |||
| 796 | - result=sendto(sock,(char *)buffer,buffer_size,0,(struct sockaddr *)dest,sizeof(*dest)); | ||
| 797 | + result = sendto(sock, (char *)buffer, buffer_size, 0, (struct sockaddr *)dest, | ||
| 798 | + sizeof(*dest)); | ||
| 799 | |||
| 800 | - if (verbose) | ||
| 801 | - printf(_("send_dhcp_packet result: %d\n"),result); | ||
| 802 | + if(verbose) printf(_("send_dhcp_packet result: %d\n"), result); | ||
| 803 | |||
| 804 | - if(result<0) | ||
| 805 | - return ERROR; | ||
| 806 | + if(result < 0) return ERROR; | ||
| 807 | |||
| 808 | return OK; | ||
| 809 | - } | ||
| 810 | - | ||
| 811 | +} | ||
| 812 | |||
| 813 | |||
| 814 | /* receives a DHCP packet */ | ||
| 815 | -int receive_dhcp_packet(void *buffer, int buffer_size, int sock, int timeout, struct sockaddr_in *address){ | ||
| 816 | - struct timeval tv; | ||
| 817 | - fd_set readfds; | ||
| 818 | +int | ||
| 819 | +receive_dhcp_packet(void *buffer, int buffer_size, int sock, int timeout, | ||
| 820 | + struct sockaddr_in *address) | ||
| 821 | +{ | ||
| 822 | + struct timeval tv; | ||
| 823 | + fd_set readfds; | ||
| 824 | + fd_set oobfds; | ||
| 825 | int recv_result; | ||
| 826 | socklen_t address_size; | ||
| 827 | struct sockaddr_in source_address; | ||
| 828 | + int nfound; | ||
| 829 | |||
| 830 | + /* wait for data to arrive (up time timeout) */ | ||
| 831 | + tv.tv_sec = timeout; | ||
| 832 | + tv.tv_usec = 0; | ||
| 833 | + FD_ZERO(&readfds); | ||
| 834 | + FD_ZERO(&oobfds); | ||
| 835 | + FD_SET(sock, &readfds); | ||
| 836 | + FD_SET(sock, &oobfds); | ||
| 837 | + nfound = select(sock + 1, &readfds, NULL, &oobfds, &tv); | ||
| 838 | + | ||
| 839 | + /* make sure some data has arrived */ | ||
| 840 | + if(!FD_ISSET(sock, &readfds)) { | ||
| 841 | + if(verbose) | ||
| 842 | + printf(_("nfound: %d, No (more) data received\n"), nfound); | ||
| 843 | + return ERROR; | ||
| 844 | + } | ||
| 845 | |||
| 846 | - /* wait for data to arrive (up time timeout) */ | ||
| 847 | - tv.tv_sec=timeout; | ||
| 848 | - tv.tv_usec=0; | ||
| 849 | - FD_ZERO(&readfds); | ||
| 850 | - FD_SET(sock,&readfds); | ||
| 851 | - select(sock+1,&readfds,NULL,NULL,&tv); | ||
| 852 | - | ||
| 853 | - /* make sure some data has arrived */ | ||
| 854 | - if(!FD_ISSET(sock,&readfds)){ | ||
| 855 | - if (verbose) | ||
| 856 | - printf(_("No (more) data received\n")); | ||
| 857 | - return ERROR; | ||
| 858 | - } | ||
| 859 | - | ||
| 860 | - else{ | ||
| 861 | - | ||
| 862 | - /* why do we need to peek first? i don't know, its a hack. without it, the source address of the first packet received was | ||
| 863 | - not being interpreted correctly. sigh... */ | ||
| 864 | - bzero(&source_address,sizeof(source_address)); | ||
| 865 | - address_size=sizeof(source_address); | ||
| 866 | - recv_result=recvfrom(sock,(char *)buffer,buffer_size,MSG_PEEK,(struct sockaddr *)&source_address,&address_size); | ||
| 867 | - if (verbose) | ||
| 868 | - printf("recv_result_1: %d\n",recv_result); | ||
| 869 | - recv_result=recvfrom(sock,(char *)buffer,buffer_size,0,(struct sockaddr *)&source_address,&address_size); | ||
| 870 | - if (verbose) | ||
| 871 | - printf("recv_result_2: %d\n",recv_result); | ||
| 872 | - | ||
| 873 | - if(recv_result==-1){ | ||
| 874 | - if (verbose) { | ||
| 875 | - printf(_("recvfrom() failed, ")); | ||
| 876 | - printf("errno: (%d) -> %s\n",errno,strerror(errno)); | ||
| 877 | - } | ||
| 878 | - return ERROR; | ||
| 879 | - } | ||
| 880 | - else{ | ||
| 881 | - if (verbose) { | ||
| 882 | - printf(_("receive_dhcp_packet() result: %d\n"),recv_result); | ||
| 883 | - printf(_("receive_dhcp_packet() source: %s\n"),inet_ntoa(source_address.sin_addr)); | ||
| 884 | - } | ||
| 885 | + /* why do we need to peek first? i don't know, its a hack. without it, | ||
| 886 | + * the source address of the first packet received was not being | ||
| 887 | + * interpreted correctly. sigh... */ | ||
| 888 | + memset(&source_address, 0, sizeof(source_address)); | ||
| 889 | + address_size = sizeof(source_address); | ||
| 890 | + recv_result = recvfrom(sock, (char *)buffer, buffer_size, MSG_PEEK, | ||
| 891 | + (struct sockaddr *)&source_address, &address_size); | ||
| 892 | + | ||
| 893 | + if(verbose) printf("recv_result_1: %d\n", recv_result); | ||
| 894 | + recv_result = recvfrom(sock, (char *)buffer, buffer_size, 0, | ||
| 895 | + (struct sockaddr *)&source_address, &address_size); | ||
| 896 | + | ||
| 897 | + if(verbose) printf("recv_result_2: %d\n", recv_result); | ||
| 898 | + | ||
| 899 | + if(recv_result == -1) { | ||
| 900 | + if(verbose) printf("errno: (%d) -> %s\n", errno, strerror(errno)); | ||
| 901 | + return ERROR; | ||
| 902 | + } | ||
| 903 | + | ||
| 904 | + if(verbose) { | ||
| 905 | + printf(_("receive_dhcp_packet() result: %d\n"), recv_result); | ||
| 906 | + printf(_("receive_dhcp_packet() source: %s\n"), | ||
| 907 | + inet_ntoa(source_address.sin_addr)); | ||
| 908 | + } | ||
| 909 | |||
| 910 | - memcpy(address,&source_address,sizeof(source_address)); | ||
| 911 | - return OK; | ||
| 912 | - } | ||
| 913 | - } | ||
| 914 | + memcpy(address, &source_address, sizeof(source_address)); | ||
| 915 | |||
| 916 | return OK; | ||
| 917 | - } | ||
| 918 | +} | ||
| 919 | |||
| 920 | |||
| 921 | /* creates a socket for DHCP communication */ | ||
| 922 | -int create_dhcp_socket(void){ | ||
| 923 | - struct sockaddr_in myname; | ||
| 924 | +int | ||
| 925 | +create_dhcp_socket(void) | ||
| 926 | +{ | ||
| 927 | + struct sockaddr_in myname; | ||
| 928 | struct ifreq interface; | ||
| 929 | - int sock; | ||
| 930 | - int flag=1; | ||
| 931 | + int sock; | ||
| 932 | + int flag = 1; | ||
| 933 | |||
| 934 | - /* Set up the address we're going to bind to. */ | ||
| 935 | - bzero(&myname,sizeof(myname)); | ||
| 936 | - myname.sin_family=AF_INET; | ||
| 937 | - myname.sin_port=htons(DHCP_CLIENT_PORT); | ||
| 938 | - myname.sin_addr.s_addr=INADDR_ANY; /* listen on any address */ | ||
| 939 | - bzero(&myname.sin_zero,sizeof(myname.sin_zero)); | ||
| 940 | - | ||
| 941 | - /* create a socket for DHCP communications */ | ||
| 942 | - sock=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP); | ||
| 943 | - if(sock<0){ | ||
| 944 | + /* Set up the address we're going to bind to. */ | ||
| 945 | + memset(&myname, 0, sizeof(myname)); | ||
| 946 | + memset(&myname.sin_zero, 0, sizeof(myname.sin_zero)); | ||
| 947 | + myname.sin_family = AF_INET; | ||
| 948 | + /* listen to dhcp server port if we're in unicast mode */ | ||
| 949 | + myname.sin_port = htons(unicast_hops == 0 ? DHCP_CLIENT_PORT : DHCP_SERVER_PORT); | ||
| 950 | + myname.sin_addr.s_addr = unicast_hops == 0 ? INADDR_ANY : my_ip.s_addr; | ||
| 951 | + | ||
| 952 | + /* create a socket for DHCP communications */ | ||
| 953 | + sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); | ||
| 954 | + if(sock < 0) { | ||
| 955 | printf(_("Error: Could not create socket!\n")); | ||
| 956 | exit(STATE_UNKNOWN); | ||
| 957 | - } | ||
| 958 | - | ||
| 959 | - if (verbose) | ||
| 960 | - printf("DHCP socket: %d\n",sock); | ||
| 961 | + } | ||
| 962 | |||
| 963 | - /* set the reuse address flag so we don't get errors when restarting */ | ||
| 964 | - flag=1; | ||
| 965 | - if(setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,(char *)&flag,sizeof(flag))<0){ | ||
| 966 | + /* set the reuse address flag so we don't get errors when restarting */ | ||
| 967 | + flag = 1; | ||
| 968 | + if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&flag, sizeof(flag)) < 0) { | ||
| 969 | printf(_("Error: Could not set reuse address option on DHCP socket!\n")); | ||
| 970 | exit(STATE_UNKNOWN); | ||
| 971 | - } | ||
| 972 | + } | ||
| 973 | |||
| 974 | - /* set the broadcast option - we need this to listen to DHCP broadcast messages */ | ||
| 975 | - if(setsockopt(sock,SOL_SOCKET,SO_BROADCAST,(char *)&flag,sizeof flag)<0){ | ||
| 976 | + /* set the broadcast option - we need this to listen to DHCP broadcast messages */ | ||
| 977 | + if(setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char *)&flag, sizeof flag) < 0) { | ||
| 978 | printf(_("Error: Could not set broadcast option on DHCP socket!\n")); | ||
| 979 | exit(STATE_UNKNOWN); | ||
| 980 | - } | ||
| 981 | + } | ||
| 982 | |||
| 983 | /* bind socket to interface */ | ||
| 984 | #if defined(__linux__) | ||
| 985 | - strncpy(interface.ifr_ifrn.ifrn_name,network_interface_name,IFNAMSIZ); | ||
| 986 | - if(setsockopt(sock,SOL_SOCKET,SO_BINDTODEVICE,(char *)&interface,sizeof(interface))<0){ | ||
| 987 | - printf(_("Error: Could not bind socket to interface %s. Check your privileges...\n"),network_interface_name); | ||
| 988 | + strncpy(interface.ifr_ifrn.ifrn_name, network_interface_name, IFNAMSIZ); | ||
| 989 | + if(setsockopt | ||
| 990 | + (sock, SOL_SOCKET, SO_BINDTODEVICE, (char *)&interface, | ||
| 991 | + sizeof(interface)) < 0) { | ||
| 992 | + printf(_("Error: Could not bind socket to interface %s. Check your privileges...\n"), | ||
| 993 | + network_interface_name); | ||
| 994 | exit(STATE_UNKNOWN); | ||
| 995 | - } | ||
| 996 | + } | ||
| 997 | |||
| 998 | #else | ||
| 999 | - strncpy(interface.ifr_name,network_interface_name,IFNAMSIZ); | ||
| 1000 | + strncpy(interface.ifr_name, network_interface_name, IFNAMSIZ); | ||
| 1001 | #endif | ||
| 1002 | |||
| 1003 | - /* bind the socket */ | ||
| 1004 | - if(bind(sock,(struct sockaddr *)&myname,sizeof(myname))<0){ | ||
| 1005 | - printf(_("Error: Could not bind to DHCP socket (port %d)! Check your privileges...\n"),DHCP_CLIENT_PORT); | ||
| 1006 | + /* bind the socket */ | ||
| 1007 | + if(bind(sock, (struct sockaddr *)&myname, sizeof(myname)) < 0) { | ||
| 1008 | + printf(_("Error: Could not bind to DHCP socket (port %d)! Check your privileges...\n"), | ||
| 1009 | + DHCP_CLIENT_PORT); | ||
| 1010 | exit(STATE_UNKNOWN); | ||
| 1011 | - } | ||
| 1012 | - | ||
| 1013 | - return sock; | ||
| 1014 | - } | ||
| 1015 | - | ||
| 1016 | - | ||
| 1017 | -/* closes DHCP socket */ | ||
| 1018 | -int close_dhcp_socket(int sock){ | ||
| 1019 | - | ||
| 1020 | - close(sock); | ||
| 1021 | + } | ||
| 1022 | |||
| 1023 | - return OK; | ||
| 1024 | - } | ||
| 1025 | + return sock; | ||
| 1026 | +} | ||
| 1027 | |||
| 1028 | |||
| 1029 | /* adds a requested server address to list in memory */ | ||
| 1030 | -int add_requested_server(struct in_addr server_address){ | ||
| 1031 | +static int | ||
| 1032 | +add_requested_server(struct in_addr server_address) | ||
| 1033 | +{ | ||
| 1034 | requested_server *new_server; | ||
| 1035 | |||
| 1036 | - new_server=(requested_server *)malloc(sizeof(requested_server)); | ||
| 1037 | - if(new_server==NULL) | ||
| 1038 | + new_server = (requested_server *) malloc(sizeof(requested_server)); | ||
| 1039 | + if(new_server == NULL) | ||
| 1040 | return ERROR; | ||
| 1041 | |||
| 1042 | - new_server->server_address=server_address; | ||
| 1043 | + new_server->server_address = server_address; | ||
| 1044 | |||
| 1045 | - new_server->next=requested_server_list; | ||
| 1046 | - requested_server_list=new_server; | ||
| 1047 | + new_server->next = requested_server_list; | ||
| 1048 | + requested_server_list = new_server; | ||
| 1049 | |||
| 1050 | requested_servers++; | ||
| 1051 | |||
| 1052 | - if (verbose) | ||
| 1053 | - printf(_("Requested server address: %s\n"),inet_ntoa(new_server->server_address)); | ||
| 1054 | + if(verbose) | ||
| 1055 | + printf(_("Requested server address: %s\n"), | ||
| 1056 | + inet_ntoa(new_server->server_address)); | ||
| 1057 | |||
| 1058 | return OK; | ||
| 1059 | - } | ||
| 1060 | +} | ||
| 1061 | |||
| 1062 | |||
| 1063 | |||
| 1064 | |||
| 1065 | /* adds a DHCP OFFER to list in memory */ | ||
| 1066 | -int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){ | ||
| 1067 | +int | ||
| 1068 | +add_dhcp_offer(struct in_addr source, dhcp_packet * offer_packet) | ||
| 1069 | +{ | ||
| 1070 | dhcp_offer *new_offer; | ||
| 1071 | int x; | ||
| 1072 | int y; | ||
| 1073 | unsigned option_type; | ||
| 1074 | unsigned option_length; | ||
| 1075 | |||
| 1076 | - if(offer_packet==NULL) | ||
| 1077 | - return ERROR; | ||
| 1078 | + if(offer_packet == NULL) return ERROR; | ||
| 1079 | |||
| 1080 | /* process all DHCP options present in the packet */ | ||
| 1081 | - for(x=4;x<MAX_DHCP_OPTIONS_LENGTH;){ | ||
| 1082 | + for(x = 4; x < MAX_DHCP_OPTIONS_LENGTH;) { | ||
| 1083 | |||
| 1084 | /* end of options (0 is really just a pad, but bail out anyway) */ | ||
| 1085 | - if((int)offer_packet->options[x]==-1 || (int)offer_packet->options[x]==0) | ||
| 1086 | + if((int)offer_packet->options[x] == -1 || (int)offer_packet->options[x] == 0) | ||
| 1087 | break; | ||
| 1088 | |||
| 1089 | /* get option type */ | ||
| 1090 | - option_type=offer_packet->options[x++]; | ||
| 1091 | + option_type = offer_packet->options[x++]; | ||
| 1092 | |||
| 1093 | /* get option length */ | ||
| 1094 | - option_length=offer_packet->options[x++]; | ||
| 1095 | + option_length = offer_packet->options[x++]; | ||
| 1096 | |||
| 1097 | - if (verbose) | ||
| 1098 | - printf("Option: %d (0x%02X)\n",option_type,option_length); | ||
| 1099 | + if(verbose) | ||
| 1100 | + printf("Option: %d (0x%02X)\n", option_type, option_length); | ||
| 1101 | |||
| 1102 | /* get option data */ | ||
| 1103 | - if(option_type==DHCP_OPTION_LEASE_TIME) { | ||
| 1104 | - memcpy(&dhcp_lease_time, &offer_packet->options[x], | ||
| 1105 | - sizeof(dhcp_lease_time)); | ||
| 1106 | - dhcp_lease_time = ntohl(dhcp_lease_time); | ||
| 1107 | - } | ||
| 1108 | - if(option_type==DHCP_OPTION_RENEWAL_TIME) { | ||
| 1109 | - memcpy(&dhcp_renewal_time, &offer_packet->options[x], | ||
| 1110 | - sizeof(dhcp_renewal_time)); | ||
| 1111 | - dhcp_renewal_time = ntohl(dhcp_renewal_time); | ||
| 1112 | - } | ||
| 1113 | - if(option_type==DHCP_OPTION_REBINDING_TIME) { | ||
| 1114 | - memcpy(&dhcp_rebinding_time, &offer_packet->options[x], | ||
| 1115 | - sizeof(dhcp_rebinding_time)); | ||
| 1116 | - dhcp_rebinding_time = ntohl(dhcp_rebinding_time); | ||
| 1117 | - } | ||
| 1118 | + if(option_type == DHCP_OPTION_LEASE_TIME) { | ||
| 1119 | + memcpy(&dhcp_lease_time, &offer_packet->options[x], | ||
| 1120 | + sizeof(dhcp_lease_time)); | ||
| 1121 | + dhcp_lease_time = ntohl(dhcp_lease_time); | ||
| 1122 | + } | ||
| 1123 | + if(option_type == DHCP_OPTION_RENEWAL_TIME) { | ||
| 1124 | + memcpy(&dhcp_renewal_time, &offer_packet->options[x], | ||
| 1125 | + sizeof(dhcp_renewal_time)); | ||
| 1126 | + dhcp_renewal_time = ntohl(dhcp_renewal_time); | ||
| 1127 | + } | ||
| 1128 | + if(option_type == DHCP_OPTION_REBINDING_TIME) { | ||
| 1129 | + memcpy(&dhcp_rebinding_time, &offer_packet->options[x], | ||
| 1130 | + sizeof(dhcp_rebinding_time)); | ||
| 1131 | + dhcp_rebinding_time = ntohl(dhcp_rebinding_time); | ||
| 1132 | + } | ||
| 1133 | |||
| 1134 | /* skip option data we're ignoring */ | ||
| 1135 | - else | ||
| 1136 | - for(y=0;y<option_length;y++,x++); | ||
| 1137 | - } | ||
| 1138 | + else for(y = 0; y < option_length; y++, x++) ; | ||
| 1139 | + } | ||
| 1140 | |||
| 1141 | - if (verbose) { | ||
| 1142 | - if(dhcp_lease_time==DHCP_INFINITE_TIME) | ||
| 1143 | + if(verbose) { | ||
| 1144 | + if(dhcp_lease_time == DHCP_INFINITE_TIME) | ||
| 1145 | printf(_("Lease Time: Infinite\n")); | ||
| 1146 | else | ||
| 1147 | - printf(_("Lease Time: %lu seconds\n"),(unsigned long)dhcp_lease_time); | ||
| 1148 | - if(dhcp_renewal_time==DHCP_INFINITE_TIME) | ||
| 1149 | + printf(_("Lease Time: %lu seconds\n"), (unsigned long)dhcp_lease_time); | ||
| 1150 | + if(dhcp_renewal_time == DHCP_INFINITE_TIME) | ||
| 1151 | printf(_("Renewal Time: Infinite\n")); | ||
| 1152 | else | ||
| 1153 | - printf(_("Renewal Time: %lu seconds\n"),(unsigned long)dhcp_renewal_time); | ||
| 1154 | - if(dhcp_rebinding_time==DHCP_INFINITE_TIME) | ||
| 1155 | + printf(_("Renewal Time: %lu seconds\n"), | ||
| 1156 | + (unsigned long)dhcp_renewal_time); | ||
| 1157 | + if(dhcp_rebinding_time == DHCP_INFINITE_TIME) | ||
| 1158 | printf(_("Rebinding Time: Infinite\n")); | ||
| 1159 | - printf(_("Rebinding Time: %lu seconds\n"),(unsigned long)dhcp_rebinding_time); | ||
| 1160 | + printf(_("Rebinding Time: %lu seconds\n"), | ||
| 1161 | + (unsigned long)dhcp_rebinding_time); | ||
| 1162 | } | ||
| 1163 | |||
| 1164 | - new_offer=(dhcp_offer *)malloc(sizeof(dhcp_offer)); | ||
| 1165 | + new_offer = (dhcp_offer *) malloc(sizeof(dhcp_offer)); | ||
| 1166 | |||
| 1167 | - if(new_offer==NULL) | ||
| 1168 | - return ERROR; | ||
| 1169 | + if(new_offer == NULL) return ERROR; | ||
| 1170 | |||
| 1171 | - new_offer->server_address=source; | ||
| 1172 | - new_offer->offered_address=offer_packet->yiaddr; | ||
| 1173 | - new_offer->lease_time=dhcp_lease_time; | ||
| 1174 | - new_offer->renewal_time=dhcp_renewal_time; | ||
| 1175 | - new_offer->rebinding_time=dhcp_rebinding_time; | ||
| 1176 | + new_offer->server_address = source; | ||
| 1177 | + new_offer->offered_address = offer_packet->yiaddr; | ||
| 1178 | + new_offer->lease_time = dhcp_lease_time; | ||
| 1179 | + new_offer->renewal_time = dhcp_renewal_time; | ||
| 1180 | + new_offer->rebinding_time = dhcp_rebinding_time; | ||
| 1181 | |||
| 1182 | |||
| 1183 | - if (verbose) { | ||
| 1184 | - printf(_("Added offer from server @ %s"),inet_ntoa(new_offer->server_address)); | ||
| 1185 | - printf(_(" of IP address %s\n"),inet_ntoa(new_offer->offered_address)); | ||
| 1186 | + if(verbose) { | ||
| 1187 | + printf(_("Added offer from server @ %s"), | ||
| 1188 | + inet_ntoa(new_offer->server_address)); | ||
| 1189 | + printf(_(" of IP address %s\n"), inet_ntoa(new_offer->offered_address)); | ||
| 1190 | } | ||
| 1191 | |||
| 1192 | /* add new offer to head of list */ | ||
| 1193 | - new_offer->next=dhcp_offer_list; | ||
| 1194 | - dhcp_offer_list=new_offer; | ||
| 1195 | + new_offer->next = dhcp_offer_list; | ||
| 1196 | + dhcp_offer_list = new_offer; | ||
| 1197 | |||
| 1198 | return OK; | ||
| 1199 | - } | ||
| 1200 | +} | ||
| 1201 | |||
| 1202 | |||
| 1203 | /* frees memory allocated to DHCP OFFER list */ | ||
| 1204 | -int free_dhcp_offer_list(void){ | ||
| 1205 | +int | ||
| 1206 | +free_dhcp_offer_list(void) | ||
| 1207 | +{ | ||
| 1208 | dhcp_offer *this_offer; | ||
| 1209 | dhcp_offer *next_offer; | ||
| 1210 | |||
| 1211 | - for(this_offer=dhcp_offer_list;this_offer!=NULL;this_offer=next_offer){ | ||
| 1212 | - next_offer=this_offer->next; | ||
| 1213 | + for(this_offer = dhcp_offer_list; this_offer != NULL; this_offer = next_offer) { | ||
| 1214 | + next_offer = this_offer->next; | ||
| 1215 | free(this_offer); | ||
| 1216 | - } | ||
| 1217 | + } | ||
| 1218 | |||
| 1219 | return OK; | ||
| 1220 | - } | ||
| 1221 | +} | ||
| 1222 | |||
| 1223 | |||
| 1224 | /* frees memory allocated to requested server list */ | ||
| 1225 | -int free_requested_server_list(void){ | ||
| 1226 | +int | ||
| 1227 | +free_requested_server_list(void) | ||
| 1228 | +{ | ||
| 1229 | requested_server *this_server; | ||
| 1230 | requested_server *next_server; | ||
| 1231 | |||
| 1232 | - for(this_server=requested_server_list;this_server!=NULL;this_server=next_server){ | ||
| 1233 | - next_server=this_server->next; | ||
| 1234 | + for(this_server = requested_server_list; this_server != NULL; | ||
| 1235 | + this_server = next_server) { | ||
| 1236 | + next_server = this_server->next; | ||
| 1237 | free(this_server); | ||
| 1238 | - } | ||
| 1239 | - | ||
| 1240 | + } | ||
| 1241 | + | ||
| 1242 | return OK; | ||
| 1243 | - } | ||
| 1244 | +} | ||
| 1245 | |||
| 1246 | |||
| 1247 | /* gets state and plugin output to return */ | ||
| 1248 | -int get_results(void){ | ||
| 1249 | +int | ||
| 1250 | +get_results(void) | ||
| 1251 | +{ | ||
| 1252 | dhcp_offer *temp_offer; | ||
| 1253 | requested_server *temp_server; | ||
| 1254 | int result; | ||
| 1255 | - u_int32_t max_lease_time=0; | ||
| 1256 | + u_int32_t max_lease_time = 0; | ||
| 1257 | |||
| 1258 | - received_requested_address=FALSE; | ||
| 1259 | + received_requested_address = FALSE; | ||
| 1260 | |||
| 1261 | /* checks responses from requested servers */ | ||
| 1262 | - requested_responses=0; | ||
| 1263 | - if(requested_servers>0){ | ||
| 1264 | + requested_responses = 0; | ||
| 1265 | + if(requested_servers > 0) { | ||
| 1266 | |||
| 1267 | - for(temp_server=requested_server_list;temp_server!=NULL;temp_server=temp_server->next){ | ||
| 1268 | + for(temp_server = requested_server_list; temp_server != NULL; | ||
| 1269 | + temp_server = temp_server->next) { | ||
| 1270 | |||
| 1271 | - for(temp_offer=dhcp_offer_list;temp_offer!=NULL;temp_offer=temp_offer->next){ | ||
| 1272 | + for(temp_offer = dhcp_offer_list; temp_offer != NULL; | ||
| 1273 | + temp_offer = temp_offer->next) { | ||
| 1274 | |||
| 1275 | /* get max lease time we were offered */ | ||
| 1276 | - if(temp_offer->lease_time>max_lease_time || temp_offer->lease_time==DHCP_INFINITE_TIME) | ||
| 1277 | - max_lease_time=temp_offer->lease_time; | ||
| 1278 | - | ||
| 1279 | + if(temp_offer->lease_time > max_lease_time | ||
| 1280 | + || temp_offer->lease_time == DHCP_INFINITE_TIME) | ||
| 1281 | + max_lease_time = temp_offer->lease_time; | ||
| 1282 | + | ||
| 1283 | /* see if we got the address we requested */ | ||
| 1284 | - if(!memcmp(&requested_address,&temp_offer->offered_address,sizeof(requested_address))) | ||
| 1285 | - received_requested_address=TRUE; | ||
| 1286 | + if(!memcmp(&requested_address, &temp_offer->offered_address, | ||
| 1287 | + sizeof(requested_address))) | ||
| 1288 | + received_requested_address = TRUE; | ||
| 1289 | |||
| 1290 | /* see if the servers we wanted a response from talked to us or not */ | ||
| 1291 | - if(!memcmp(&temp_offer->server_address,&temp_server->server_address,sizeof(temp_server->server_address))){ | ||
| 1292 | - if (verbose) { | ||
| 1293 | - printf(_("DHCP Server Match: Offerer=%s"),inet_ntoa(temp_offer->server_address)); | ||
| 1294 | - printf(_(" Requested=%s\n"),inet_ntoa(temp_server->server_address)); | ||
| 1295 | - } | ||
| 1296 | + if(!memcmp(&temp_offer->server_address, &temp_server->server_address, | ||
| 1297 | + sizeof(temp_server->server_address))) | ||
| 1298 | + { | ||
| 1299 | + if(verbose) { | ||
| 1300 | + printf(_("DHCP Server Match: Offerer=%s"), | ||
| 1301 | + inet_ntoa(temp_offer->server_address)); | ||
| 1302 | + printf(_(" Requested=%s\n"), | ||
| 1303 | + inet_ntoa(temp_server->server_address)); | ||
| 1304 | + } | ||
| 1305 | requested_responses++; | ||
| 1306 | - } | ||
| 1307 | - } | ||
| 1308 | - } | ||
| 1309 | - | ||
| 1310 | - } | ||
| 1311 | + } | ||
| 1312 | + } | ||
| 1313 | + } | ||
| 1314 | + } | ||
| 1315 | |||
| 1316 | /* else check and see if we got our requested address from any server */ | ||
| 1317 | - else{ | ||
| 1318 | - | ||
| 1319 | - for(temp_offer=dhcp_offer_list;temp_offer!=NULL;temp_offer=temp_offer->next){ | ||
| 1320 | - | ||
| 1321 | + else { | ||
| 1322 | + for(temp_offer = dhcp_offer_list; temp_offer != NULL; | ||
| 1323 | + temp_offer = temp_offer->next) | ||
| 1324 | + { | ||
| 1325 | /* get max lease time we were offered */ | ||
| 1326 | - if(temp_offer->lease_time>max_lease_time || temp_offer->lease_time==DHCP_INFINITE_TIME) | ||
| 1327 | - max_lease_time=temp_offer->lease_time; | ||
| 1328 | - | ||
| 1329 | + if(temp_offer->lease_time > max_lease_time | ||
| 1330 | + || temp_offer->lease_time == DHCP_INFINITE_TIME) | ||
| 1331 | + max_lease_time = temp_offer->lease_time; | ||
| 1332 | + | ||
| 1333 | /* see if we got the address we requested */ | ||
| 1334 | - if(!memcmp(&requested_address,&temp_offer->offered_address,sizeof(requested_address))) | ||
| 1335 | - received_requested_address=TRUE; | ||
| 1336 | - } | ||
| 1337 | - } | ||
| 1338 | - | ||
| 1339 | - result=STATE_OK; | ||
| 1340 | - if(valid_responses==0) | ||
| 1341 | - result=STATE_CRITICAL; | ||
| 1342 | - else if(requested_servers>0 && requested_responses==0) | ||
| 1343 | - result=STATE_CRITICAL; | ||
| 1344 | - else if(requested_responses<requested_servers) | ||
| 1345 | - result=STATE_WARNING; | ||
| 1346 | - else if(request_specific_address==TRUE && received_requested_address==FALSE) | ||
| 1347 | - result=STATE_WARNING; | ||
| 1348 | + if(!memcmp(&requested_address, &temp_offer->offered_address, | ||
| 1349 | + sizeof(requested_address))) | ||
| 1350 | + received_requested_address = TRUE; | ||
| 1351 | + } | ||
| 1352 | + } | ||
| 1353 | |||
| 1354 | + result = STATE_OK; | ||
| 1355 | + if(valid_responses == 0) | ||
| 1356 | + result = STATE_CRITICAL; | ||
| 1357 | + else if(requested_servers > 0 && requested_responses == 0) | ||
| 1358 | + result = STATE_CRITICAL; | ||
| 1359 | + else if(requested_responses < requested_servers) | ||
| 1360 | + result = STATE_WARNING; | ||
| 1361 | + else if(request_specific_address == TRUE && received_requested_address == FALSE) | ||
| 1362 | + result = STATE_WARNING; | ||
| 1363 | |||
| 1364 | - printf("DHCP %s: ",(result==STATE_OK)?"ok":"problem"); | ||
| 1365 | + printf("DHCP %s: ", (result == STATE_OK) ? "ok" : "problem"); | ||
| 1366 | |||
| 1367 | /* we didn't receive any DHCPOFFERs */ | ||
| 1368 | - if(dhcp_offer_list==NULL){ | ||
| 1369 | + if(dhcp_offer_list == NULL) { | ||
| 1370 | printf(_("No DHCPOFFERs were received.\n")); | ||
| 1371 | return result; | ||
| 1372 | - } | ||
| 1373 | - | ||
| 1374 | - printf(_("Received %d DHCPOFFER(s)"),valid_responses); | ||
| 1375 | + } | ||
| 1376 | |||
| 1377 | - if(requested_servers>0) | ||
| 1378 | - printf(_(", %s%d of %d requested servers responded"),((requested_responses<requested_servers) && requested_responses>0)?"only ":"",requested_responses,requested_servers); | ||
| 1379 | + printf(_("Received %d DHCPOFFER(s)"), valid_responses); | ||
| 1380 | |||
| 1381 | - if(request_specific_address==TRUE) | ||
| 1382 | - printf(_(", requested address (%s) was %soffered"),inet_ntoa(requested_address),(received_requested_address==TRUE)?"":_("not ")); | ||
| 1383 | + if(requested_servers > 0) | ||
| 1384 | + printf(_(", %s%d of %d requested servers responded"), | ||
| 1385 | + ((requested_responses < requested_servers) | ||
| 1386 | + && requested_responses > 0) ? "only " : "", | ||
| 1387 | + requested_responses, | ||
| 1388 | + requested_servers); | ||
| 1389 | + | ||
| 1390 | + if(request_specific_address == TRUE) | ||
| 1391 | + printf(_(", requested address (%s) was %soffered"), | ||
| 1392 | + inet_ntoa(requested_address), | ||
| 1393 | + (received_requested_address == TRUE) ? "" : _("not ")); | ||
| 1394 | |||
| 1395 | printf(_(", max lease time = ")); | ||
| 1396 | - if(max_lease_time==DHCP_INFINITE_TIME) | ||
| 1397 | + if(max_lease_time == DHCP_INFINITE_TIME) | ||
| 1398 | printf(_("Infinity")); | ||
| 1399 | else | ||
| 1400 | - printf("%lu sec",(unsigned long)max_lease_time); | ||
| 1401 | + printf("%lu sec", (unsigned long)max_lease_time); | ||
| 1402 | |||
| 1403 | - printf(".\n"); | ||
| 1404 | + puts("."); | ||
| 1405 | |||
| 1406 | return result; | ||
| 1407 | - } | ||
| 1408 | +} | ||
| 1409 | |||
| 1410 | |||
| 1411 | /* process command-line arguments */ | ||
| 1412 | -int process_arguments(int argc, char **argv){ | ||
| 1413 | - int c; | ||
| 1414 | - | ||
| 1415 | - if(argc<1) | ||
| 1416 | - return ERROR; | ||
| 1417 | - | ||
| 1418 | - c=0; | ||
| 1419 | - while((c+=(call_getopt(argc-c,&argv[c])))<argc){ | ||
| 1420 | - | ||
| 1421 | - /* | ||
| 1422 | - if(is_option(argv[c])) | ||
| 1423 | - continue; | ||
| 1424 | - */ | ||
| 1425 | - } | ||
| 1426 | - | ||
| 1427 | - return validate_arguments(); | ||
| 1428 | - } | ||
| 1429 | - | ||
| 1430 | - | ||
| 1431 | - | ||
| 1432 | -int call_getopt(int argc, char **argv){ | ||
| 1433 | - int c=0; | ||
| 1434 | - int i=0; | ||
| 1435 | +int | ||
| 1436 | +process_arguments(int argc, char **argv) | ||
| 1437 | +{ | ||
| 1438 | + int c = 0; | ||
| 1439 | struct in_addr ipaddress; | ||
| 1440 | - | ||
| 1441 | -#ifdef HAVE_GETOPT_H | ||
| 1442 | int option_index = 0; | ||
| 1443 | - static struct option long_options[] = | ||
| 1444 | - { | ||
| 1445 | - {"serverip", required_argument,0,'s'}, | ||
| 1446 | - {"requestedip", required_argument,0,'r'}, | ||
| 1447 | - {"timeout", required_argument,0,'t'}, | ||
| 1448 | - {"interface", required_argument,0,'i'}, | ||
| 1449 | - {"verbose", no_argument, 0,'v'}, | ||
| 1450 | - {"version", no_argument, 0,'V'}, | ||
| 1451 | - {"help", no_argument, 0,'h'}, | ||
| 1452 | - {0,0,0,0} | ||
| 1453 | - }; | ||
| 1454 | -#endif | ||
| 1455 | |||
| 1456 | - while(1){ | ||
| 1457 | -#ifdef HAVE_GETOPT_H | ||
| 1458 | - c=getopt_long(argc,argv,"+hVvt:s:r:t:i:",long_options,&option_index); | ||
| 1459 | -#else | ||
| 1460 | - c=getopt(argc,argv,"+?hVvt:s:r:t:i:"); | ||
| 1461 | -#endif | ||
| 1462 | + static struct option long_options[] = { | ||
| 1463 | + {"host", required_argument, 0, 'H'}, | ||
| 1464 | + {"serverip", required_argument, 0, 's'}, | ||
| 1465 | + {"requestedip", required_argument, 0, 'r'}, | ||
| 1466 | + {"timeout", required_argument, 0, 't'}, | ||
| 1467 | + {"interface", required_argument, 0, 'i'}, | ||
| 1468 | + {"unicast", required_argument, 0, 'u'}, | ||
| 1469 | + {"verbose", no_argument, 0, 'v'}, | ||
| 1470 | + {"version", no_argument, 0, 'V'}, | ||
| 1471 | + {"help", no_argument, 0, 'h'}, | ||
| 1472 | + {0, 0, 0, 0} | ||
| 1473 | + }; | ||
| 1474 | |||
| 1475 | - i++; | ||
| 1476 | + while(1) { | ||
| 1477 | + c = getopt_long(argc, argv, "+hVvt:s:r:t:i:u:", long_options, &option_index); | ||
| 1478 | |||
| 1479 | - if(c==-1||c==EOF||c==1) | ||
| 1480 | + if(c == -1 || c == EOF || c == 1) | ||
| 1481 | break; | ||
| 1482 | |||
| 1483 | - switch(c){ | ||
| 1484 | - case 'w': | ||
| 1485 | - case 'r': | ||
| 1486 | - case 't': | ||
| 1487 | - case 'i': | ||
| 1488 | - i++; | ||
| 1489 | + switch (c) { | ||
| 1490 | + case 'u': | ||
| 1491 | + unicast_hops = (u_int8_t)strtoul(optarg, NULL, 0); | ||
| 1492 | break; | ||
| 1493 | - default: | ||
| 1494 | - break; | ||
| 1495 | - } | ||
| 1496 | - | ||
| 1497 | - switch(c){ | ||
| 1498 | - | ||
| 1499 | - case 's': /* DHCP server address */ | ||
| 1500 | - if(inet_aton(optarg,&ipaddress)) | ||
| 1501 | + case 's': case 'H': /* DHCP server address */ | ||
| 1502 | + if(inet_aton(optarg, &ipaddress)) | ||
| 1503 | add_requested_server(ipaddress); | ||
| 1504 | /* | ||
| 1505 | - else | ||
| 1506 | - usage("Invalid server IP address\n"); | ||
| 1507 | - */ | ||
| 1508 | + else | ||
| 1509 | + usage("Invalid server IP address\n"); | ||
| 1510 | + */ | ||
| 1511 | + inet_aton(optarg, &dhcp_ip); | ||
| 1512 | + if(verbose) | ||
| 1513 | + printf("querying %s\n", inet_ntoa(dhcp_ip)); | ||
| 1514 | break; | ||
| 1515 | |||
| 1516 | - case 'r': /* address we are requested from DHCP servers */ | ||
| 1517 | - if(inet_aton(optarg,&ipaddress)){ | ||
| 1518 | - requested_address=ipaddress; | ||
| 1519 | - request_specific_address=TRUE; | ||
| 1520 | - } | ||
| 1521 | + case 'r': /* address we are requested from DHCP servers */ | ||
| 1522 | + if(inet_aton(optarg, &ipaddress)) { | ||
| 1523 | + requested_address = ipaddress; | ||
| 1524 | + request_specific_address = TRUE; | ||
| 1525 | + } | ||
| 1526 | /* | ||
| 1527 | - else | ||
| 1528 | - usage("Invalid requested IP address\n"); | ||
| 1529 | - */ | ||
| 1530 | + else | ||
| 1531 | + usage("Invalid requested IP address\n"); | ||
| 1532 | + */ | ||
| 1533 | break; | ||
| 1534 | |||
| 1535 | - case 't': /* timeout */ | ||
| 1536 | - | ||
| 1537 | + case 't': /* timeout */ | ||
| 1538 | /* | ||
| 1539 | - if(is_intnonneg(optarg)) | ||
| 1540 | - */ | ||
| 1541 | - if(atoi(optarg)>0) | ||
| 1542 | - dhcpoffer_timeout=atoi(optarg); | ||
| 1543 | + if(is_intnonneg(optarg)) | ||
| 1544 | + */ | ||
| 1545 | + if(atoi(optarg) > 0) | ||
| 1546 | + dhcpoffer_timeout = atoi(optarg); | ||
| 1547 | /* | ||
| 1548 | - else | ||
| 1549 | - usage("Time interval must be a nonnegative integer\n"); | ||
| 1550 | - */ | ||
| 1551 | + else | ||
| 1552 | + usage("Time interval must be a nonnegative integer\n"); | ||
| 1553 | + */ | ||
| 1554 | break; | ||
| 1555 | |||
| 1556 | - case 'i': /* interface name */ | ||
| 1557 | - | ||
| 1558 | - strncpy(network_interface_name,optarg,sizeof(network_interface_name)-1); | ||
| 1559 | - network_interface_name[sizeof(network_interface_name)-1]='\x0'; | ||
| 1560 | - | ||
| 1561 | + case 'i': /* interface name */ | ||
| 1562 | + strncpy(network_interface_name, optarg, | ||
| 1563 | + sizeof(network_interface_name) - 1); | ||
| 1564 | + network_interface_name[sizeof(network_interface_name) - 1] = '\x0'; | ||
| 1565 | break; | ||
| 1566 | |||
| 1567 | - case 'V': /* version */ | ||
| 1568 | - print_revision(progname,revision); | ||
| 1569 | + case 'V': /* version */ | ||
| 1570 | + print_revision(progname, revision); | ||
| 1571 | exit(STATE_OK); | ||
| 1572 | |||
| 1573 | - case 'h': /* help */ | ||
| 1574 | + case 'h': /* help */ | ||
| 1575 | print_help(); | ||
| 1576 | exit(STATE_OK); | ||
| 1577 | |||
| 1578 | - case 'v': /* verbose */ | ||
| 1579 | - verbose=1; | ||
| 1580 | + case 'v': /* verbose */ | ||
| 1581 | + verbose++; | ||
| 1582 | break; | ||
| 1583 | |||
| 1584 | - case '?': /* help */ | ||
| 1585 | - usage2 (_("Unknown argument"), optarg); | ||
| 1586 | + case '?': /* help */ | ||
| 1587 | + usage2(_("Unknown argument"), optarg); | ||
| 1588 | break; | ||
| 1589 | |||
| 1590 | default: | ||
| 1591 | break; | ||
| 1592 | - } | ||
| 1593 | - } | ||
| 1594 | - | ||
| 1595 | - return i; | ||
| 1596 | - } | ||
| 1597 | + } | ||
| 1598 | + } | ||
| 1599 | + | ||
| 1600 | + return validate_arguments(); | ||
| 1601 | +} | ||
| 1602 | |||
| 1603 | |||
| 1604 | -int validate_arguments(void){ | ||
| 1605 | +int | ||
| 1606 | +validate_arguments(void) | ||
| 1607 | +{ | ||
| 1608 | |||
| 1609 | return OK; | ||
| 1610 | - } | ||
| 1611 | +} | ||
| 1612 | |||
| 1613 | #if defined(__sun__) || defined(__solaris__) || defined(__hpux__) | ||
| 1614 | |||
| 1615 | - /* Kompf 2000-2003 see ACKNOWLEDGEMENTS */ | ||
| 1616 | + /* Kompf 2000-2003 see ACKNOWLEDGEMENTS */ | ||
| 1617 | |||
| 1618 | /* get a message from a stream; return type of message */ | ||
| 1619 | -static int get_msg(int fd) | ||
| 1620 | +static int | ||
| 1621 | +get_msg(int fd) | ||
| 1622 | { | ||
| 1623 | - int flags = 0; | ||
| 1624 | - int res, ret; | ||
| 1625 | - ctl_area[0] = 0; | ||
| 1626 | - dat_area[0] = 0; | ||
| 1627 | - ret = 0; | ||
| 1628 | - res = getmsg(fd, &ctl, &dat, &flags); | ||
| 1629 | - | ||
| 1630 | - if(res < 0) { | ||
| 1631 | - if(errno == EINTR) { | ||
| 1632 | - return(GOT_INTR); | ||
| 1633 | - } else { | ||
| 1634 | - printf("%s\n", "get_msg FAILED."); | ||
| 1635 | - return(GOT_ERR); | ||
| 1636 | - } | ||
| 1637 | - } | ||
| 1638 | - if(ctl.len > 0) { | ||
| 1639 | - ret |= GOT_CTRL; | ||
| 1640 | - } | ||
| 1641 | - if(dat.len > 0) { | ||
| 1642 | - ret |= GOT_DATA; | ||
| 1643 | - } | ||
| 1644 | - return(ret); | ||
| 1645 | + int flags = 0; | ||
| 1646 | + int res, ret; | ||
| 1647 | + | ||
| 1648 | + ctl_area[0] = 0; | ||
| 1649 | + dat_area[0] = 0; | ||
| 1650 | + ret = 0; | ||
| 1651 | + res = getmsg(fd, &ctl, &dat, &flags); | ||
| 1652 | + | ||
| 1653 | + if(res < 0) { | ||
| 1654 | + if(errno == EINTR) { | ||
| 1655 | + return (GOT_INTR); | ||
| 1656 | + } | ||
| 1657 | + else { | ||
| 1658 | + printf("%s\n", "get_msg FAILED."); | ||
| 1659 | + return (GOT_ERR); | ||
| 1660 | + } | ||
| 1661 | + } | ||
| 1662 | + if(ctl.len > 0) { | ||
| 1663 | + ret |= GOT_CTRL; | ||
| 1664 | + } | ||
| 1665 | + if(dat.len > 0) { | ||
| 1666 | + ret |= GOT_DATA; | ||
| 1667 | + } | ||
| 1668 | + return (ret); | ||
| 1669 | } | ||
| 1670 | |||
| 1671 | /* verify that dl_primitive in ctl_area = prim */ | ||
| 1672 | -static int check_ctrl(int prim) | ||
| 1673 | +static int | ||
| 1674 | +check_ctrl(int prim) | ||
| 1675 | { | ||
| 1676 | - dl_error_ack_t *err_ack = (dl_error_ack_t *)ctl_area; | ||
| 1677 | - if(err_ack->dl_primitive != prim) { | ||
| 1678 | - printf(_("Error: DLPI stream API failed to get MAC in check_ctrl: %s.\n"), strerror(errno)); | ||
| 1679 | - exit(STATE_UNKNOWN); | ||
| 1680 | - } | ||
| 1681 | - return 0; | ||
| 1682 | + dl_error_ack_t *err_ack = (dl_error_ack_t *) ctl_area; | ||
| 1683 | + | ||
| 1684 | + if(err_ack->dl_primitive != prim) { | ||
| 1685 | + printf(_("Error: DLPI stream API failed to get MAC in check_ctrl: %s.\n"), | ||
| 1686 | + strerror(errno)); | ||
| 1687 | + exit(STATE_UNKNOWN); | ||
| 1688 | + } | ||
| 1689 | + return 0; | ||
| 1690 | } | ||
| 1691 | |||
| 1692 | /* put a control message on a stream */ | ||
| 1693 | -static int put_ctrl(int fd, int len, int pri) | ||
| 1694 | +static int | ||
| 1695 | +put_ctrl(int fd, int len, int pri) | ||
| 1696 | { | ||
| 1697 | - ctl.len = len; | ||
| 1698 | - if(putmsg(fd, &ctl, 0, pri) < 0) { | ||
| 1699 | - printf(_("Error: DLPI stream API failed to get MAC in put_ctrl/putmsg(): %s.\n"), strerror(errno)); | ||
| 1700 | - exit(STATE_UNKNOWN); | ||
| 1701 | - } | ||
| 1702 | - return 0; | ||
| 1703 | + ctl.len = len; | ||
| 1704 | + if(putmsg(fd, &ctl, 0, pri) < 0) { | ||
| 1705 | + printf(_("Error: DLPI stream API failed to get MAC in put_ctrl/putmsg(): %s.\n"), | ||
| 1706 | + strerror(errno)); | ||
| 1707 | + exit(STATE_UNKNOWN); | ||
| 1708 | + } | ||
| 1709 | + | ||
| 1710 | + return 0; | ||
| 1711 | } | ||
| 1712 | |||
| 1713 | + | ||
| 1714 | /* put a control + data message on a stream */ | ||
| 1715 | -static int put_both(int fd, int clen, int dlen, int pri) | ||
| 1716 | +static int | ||
| 1717 | +put_both(int fd, int clen, int dlen, int pri) | ||
| 1718 | { | ||
| 1719 | - ctl.len = clen; | ||
| 1720 | - dat.len = dlen; | ||
| 1721 | - if(putmsg(fd, &ctl, &dat, pri) < 0) { | ||
| 1722 | - printf(_("Error: DLPI stream API failed to get MAC in put_both/putmsg().\n"), strerror(errno)); | ||
| 1723 | - exit(STATE_UNKNOWN); | ||
| 1724 | - } | ||
| 1725 | - return 0; | ||
| 1726 | + ctl.len = clen; | ||
| 1727 | + dat.len = dlen; | ||
| 1728 | + if(putmsg(fd, &ctl, &dat, pri) < 0) { | ||
| 1729 | + printf(_("Error: DLPI stream API failed to get MAC in put_both/putmsg().\n"), | ||
| 1730 | + strerror(errno)); | ||
| 1731 | + exit(STATE_UNKNOWN); | ||
| 1732 | + } | ||
| 1733 | + | ||
| 1734 | + return 0; | ||
| 1735 | } | ||
| 1736 | |||
| 1737 | + | ||
| 1738 | /* open file descriptor and attach */ | ||
| 1739 | -static int dl_open(const char *dev, int unit, int *fd) | ||
| 1740 | +static int | ||
| 1741 | +dl_open(const char *dev, int unit, int *fd) | ||
| 1742 | { | ||
| 1743 | - dl_attach_req_t *attach_req = (dl_attach_req_t *)ctl_area; | ||
| 1744 | - if((*fd = open(dev, O_RDWR)) == -1) { | ||
| 1745 | - printf(_("Error: DLPI stream API failed to get MAC in dl_attach_req/open(%s..): %s.\n"), dev, strerror(errno)); | ||
| 1746 | - exit(STATE_UNKNOWN); | ||
| 1747 | - } | ||
| 1748 | - attach_req->dl_primitive = DL_ATTACH_REQ; | ||
| 1749 | - attach_req->dl_ppa = unit; | ||
| 1750 | - put_ctrl(*fd, sizeof(dl_attach_req_t), 0); | ||
| 1751 | - get_msg(*fd); | ||
| 1752 | - return check_ctrl(DL_OK_ACK); | ||
| 1753 | + dl_attach_req_t *attach_req = (dl_attach_req_t *) ctl_area; | ||
| 1754 | + | ||
| 1755 | + if((*fd = open(dev, O_RDWR)) == -1) { | ||
| 1756 | + printf(_ | ||
| 1757 | + ("Error: DLPI stream API failed to get MAC in dl_attach_req/open(%s..): %s.\n"), | ||
| 1758 | + dev, strerror(errno)); | ||
| 1759 | + exit(STATE_UNKNOWN); | ||
| 1760 | + } | ||
| 1761 | + attach_req->dl_primitive = DL_ATTACH_REQ; | ||
| 1762 | + attach_req->dl_ppa = unit; | ||
| 1763 | + put_ctrl(*fd, sizeof(dl_attach_req_t), 0); | ||
| 1764 | + get_msg(*fd); | ||
| 1765 | + return check_ctrl(DL_OK_ACK); | ||
| 1766 | } | ||
| 1767 | |||
| 1768 | + | ||
| 1769 | /* send DL_BIND_REQ */ | ||
| 1770 | -static int dl_bind(int fd, int sap, u_char *addr) | ||
| 1771 | +static int | ||
| 1772 | +dl_bind(int fd, int sap, u_char * addr) | ||
| 1773 | { | ||
| 1774 | - dl_bind_req_t *bind_req = (dl_bind_req_t *)ctl_area; | ||
| 1775 | - dl_bind_ack_t *bind_ack = (dl_bind_ack_t *)ctl_area; | ||
| 1776 | - bind_req->dl_primitive = DL_BIND_REQ; | ||
| 1777 | - bind_req->dl_sap = sap; | ||
| 1778 | - bind_req->dl_max_conind = 1; | ||
| 1779 | - bind_req->dl_service_mode = DL_CLDLS; | ||
| 1780 | - bind_req->dl_conn_mgmt = 0; | ||
| 1781 | - bind_req->dl_xidtest_flg = 0; | ||
| 1782 | - put_ctrl(fd, sizeof(dl_bind_req_t), 0); | ||
| 1783 | - get_msg(fd); | ||
| 1784 | - if (GOT_ERR == check_ctrl(DL_BIND_ACK)) { | ||
| 1785 | - printf(_("Error: DLPI stream API failed to get MAC in dl_bind/check_ctrl(): %s.\n"), strerror(errno)); | ||
| 1786 | - exit(STATE_UNKNOWN); | ||
| 1787 | - } | ||
| 1788 | - bcopy((u_char *)bind_ack + bind_ack->dl_addr_offset, addr, | ||
| 1789 | - bind_ack->dl_addr_length); | ||
| 1790 | - return 0; | ||
| 1791 | + dl_bind_req_t *bind_req = (dl_bind_req_t *) ctl_area; | ||
| 1792 | + dl_bind_ack_t *bind_ack = (dl_bind_ack_t *) ctl_area; | ||
| 1793 | + | ||
| 1794 | + bind_req->dl_primitive = DL_BIND_REQ; | ||
| 1795 | + bind_req->dl_sap = sap; | ||
| 1796 | + bind_req->dl_max_conind = 1; | ||
| 1797 | + bind_req->dl_service_mode = DL_CLDLS; | ||
| 1798 | + bind_req->dl_conn_mgmt = 0; | ||
| 1799 | + bind_req->dl_xidtest_flg = 0; | ||
| 1800 | + put_ctrl(fd, sizeof(dl_bind_req_t), 0); | ||
| 1801 | + get_msg(fd); | ||
| 1802 | + if(GOT_ERR == check_ctrl(DL_BIND_ACK)) { | ||
| 1803 | + printf(_ | ||
| 1804 | + ("Error: DLPI stream API failed to get MAC in dl_bind/check_ctrl(): %s.\n"), | ||
| 1805 | + strerror(errno)); | ||
| 1806 | + exit(STATE_UNKNOWN); | ||
| 1807 | + } | ||
| 1808 | + memcpy(addr, (u_char *) bind_ack + bind_ack->dl_addr_offset, | ||
| 1809 | + bind_ack->dl_addr_length); | ||
| 1810 | + return 0; | ||
| 1811 | } | ||
| 1812 | |||
| 1813 | + | ||
| 1814 | /*********************************************************************** | ||
| 1815 | * interface: | ||
| 1816 | * function mac_addr_dlpi - get the mac address of the interface with | ||
| 1817 | @@ -1197,37 +1229,39 @@ | ||
| 1818 | * | ||
| 1819 | * return: 0 if OK, -1 if the address could not be determined | ||
| 1820 | * | ||
| 1821 | - * | ||
| 1822 | ***********************************************************************/ | ||
| 1823 | |||
| 1824 | -long mac_addr_dlpi( const char *dev, int unit, u_char *addr) { | ||
| 1825 | +long | ||
| 1826 | +mac_addr_dlpi(const char *dev, int unit, u_char * addr) | ||
| 1827 | +{ | ||
| 1828 | |||
| 1829 | int fd; | ||
| 1830 | u_char mac_addr[25]; | ||
| 1831 | |||
| 1832 | - if (GOT_ERR != dl_open(dev, unit, &fd)) { | ||
| 1833 | - if (GOT_ERR != dl_bind(fd, INSAP, mac_addr)) { | ||
| 1834 | - bcopy( mac_addr, addr, 6); | ||
| 1835 | - return 0; | ||
| 1836 | - } | ||
| 1837 | + if(GOT_ERR != dl_open(dev, unit, &fd)) { | ||
| 1838 | + if(GOT_ERR != dl_bind(fd, INSAP, mac_addr)) { | ||
| 1839 | + memcpy(addr, mac_addr, 6); | ||
| 1840 | + return 0; | ||
| 1841 | + } | ||
| 1842 | } | ||
| 1843 | - close(fd); | ||
| 1844 | + close(fd); | ||
| 1845 | return -1; | ||
| 1846 | } | ||
| 1847 | |||
| 1848 | /* Kompf 2000-2003 */ | ||
| 1849 | - | ||
| 1850 | #endif | ||
| 1851 | |||
| 1852 | |||
| 1853 | /* print usage help */ | ||
| 1854 | -void print_help(void){ | ||
| 1855 | +void | ||
| 1856 | +print_help(void) | ||
| 1857 | +{ | ||
| 1858 | |||
| 1859 | - print_revision(progname,revision); | ||
| 1860 | + print_revision(progname, revision); | ||
| 1861 | |||
| 1862 | printf("Copyright (c) 2001-2004 Ethan Galstad (nagios@nagios.org)\n\n"); | ||
| 1863 | - printf (COPYRIGHT, copyright, email); | ||
| 1864 | - | ||
| 1865 | + printf(COPYRIGHT, copyright, email); | ||
| 1866 | + | ||
| 1867 | printf(_("This plugin tests the availability of DHCP servers on a network.\n\n")); | ||
| 1868 | |||
| 1869 | print_usage(); | ||
| 1870 | @@ -1241,6 +1275,8 @@ | ||
| 1871 | Seconds to wait for DHCPOFFER before timeout occurs\n\ | ||
| 1872 | -i, --interface=STRING\n\ | ||
| 1873 | Interface to to use for listening (i.e. eth0)\n\ | ||
| 1874 | + -u, --unicast=INTEGER\n\ | ||
| 1875 | + Unicast testing. Requires -s. Useful for testing servers on remote networks. | ||
| 1876 | -v, --verbose\n\ | ||
| 1877 | Print extra information (command-line use only)\n\ | ||
| 1878 | -h, --help\n\ | ||
| 1879 | @@ -1250,12 +1286,10 @@ | ||
| 1880 | } | ||
| 1881 | |||
| 1882 | |||
| 1883 | -void print_usage(void) | ||
| 1884 | +void | ||
| 1885 | +print_usage(void) | ||
| 1886 | { | ||
| 1887 | printf("\ | ||
| 1888 | Usage: %s [-s serverip] [-r requestedip] [-t timeout] [-i interface]\n\ | ||
| 1889 | - [-v]",progname); | ||
| 1890 | + [-v]", progname); | ||
| 1891 | } | ||
| 1892 | - | ||
| 1893 | - | ||
| 1894 | - | ||
diff --git a/web/attachments/140951-radiusclient.h b/web/attachments/140951-radiusclient.h new file mode 100644 index 0000000..9ce2a39 --- /dev/null +++ b/web/attachments/140951-radiusclient.h | |||
| @@ -0,0 +1,496 @@ | |||
| 1 | /* | ||
| 2 | * $Id: radiusclient.h,v 1.9 2002/11/13 18:19:26 fcusack Exp $ | ||
| 3 | * | ||
| 4 | * Copyright (C) 1995,1996,1997,1998 Lars Fenneberg | ||
| 5 | * | ||
| 6 | * Copyright 1992 Livingston Enterprises, Inc. | ||
| 7 | * | ||
| 8 | * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan | ||
| 9 | * and Merit Network, Inc. All Rights Reserved | ||
| 10 | * | ||
| 11 | * See the file COPYRIGHT for the respective terms and conditions. | ||
| 12 | * If the file is missing contact me at lf@elemental.net | ||
| 13 | * and I'll send you a copy. | ||
| 14 | * | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef RADIUSCLIENT_H | ||
| 18 | #define RADIUSCLIENT_H | ||
| 19 | |||
| 20 | #include <sys/types.h> | ||
| 21 | #include <stdio.h> | ||
| 22 | #include <time.h> | ||
| 23 | |||
| 24 | #undef __BEGIN_DECLS | ||
| 25 | #undef __END_DECLS | ||
| 26 | #ifdef __cplusplus | ||
| 27 | # define __BEGIN_DECLS extern "C" { | ||
| 28 | # define __END_DECLS } | ||
| 29 | #else | ||
| 30 | # define __BEGIN_DECLS /* empty */ | ||
| 31 | # define __END_DECLS /* empty */ | ||
| 32 | #endif | ||
| 33 | |||
| 34 | #undef __P | ||
| 35 | #if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32) || defined(__cplusplus) | ||
| 36 | # define __P(protos) protos | ||
| 37 | #else | ||
| 38 | # define __P(protos) () | ||
| 39 | #endif | ||
| 40 | |||
| 41 | #ifndef _UINT4_T | ||
| 42 | #ifdef _LP64 | ||
| 43 | typedef unsigned int UINT4; | ||
| 44 | typedef int INT4; | ||
| 45 | #else | ||
| 46 | typedef unsigned long UINT4; | ||
| 47 | typedef long INT4; | ||
| 48 | #endif | ||
| 49 | #endif | ||
| 50 | |||
| 51 | #define AUTH_VECTOR_LEN 16 | ||
| 52 | #define AUTH_PASS_LEN (3 * 16) /* multiple of 16 */ | ||
| 53 | #define AUTH_ID_LEN 64 | ||
| 54 | #define AUTH_STRING_LEN 128 /* maximum of 253 */ | ||
| 55 | |||
| 56 | #define BUFFER_LEN 8192 | ||
| 57 | |||
| 58 | #define NAME_LENGTH 32 | ||
| 59 | #define GETSTR_LENGTH 128 /* must be bigger than AUTH_PASS_LEN */ | ||
| 60 | |||
| 61 | /* codes for radius_buildreq, radius_getport, etc. */ | ||
| 62 | #define AUTH 0 | ||
| 63 | #define ACCT 1 | ||
| 64 | |||
| 65 | /* defines for config.c */ | ||
| 66 | |||
| 67 | #define SERVER_MAX 8 | ||
| 68 | |||
| 69 | #define AUTH_LOCAL_FST (1<<0) | ||
| 70 | #define AUTH_RADIUS_FST (1<<1) | ||
| 71 | #define AUTH_LOCAL_SND (1<<2) | ||
| 72 | #define AUTH_RADIUS_SND (1<<3) | ||
| 73 | |||
| 74 | typedef struct server { | ||
| 75 | int max; | ||
| 76 | char *name[SERVER_MAX]; | ||
| 77 | unsigned short port[SERVER_MAX]; | ||
| 78 | } SERVER; | ||
| 79 | |||
| 80 | typedef struct pw_auth_hdr | ||
| 81 | { | ||
| 82 | u_char code; | ||
| 83 | u_char id; | ||
| 84 | u_short length; | ||
| 85 | u_char vector[AUTH_VECTOR_LEN]; | ||
| 86 | u_char data[2]; | ||
| 87 | } AUTH_HDR; | ||
| 88 | |||
| 89 | #define AUTH_HDR_LEN 20 | ||
| 90 | #define MAX_SECRET_LENGTH (3 * 16) /* MUST be multiple of 16 */ | ||
| 91 | #define CHAP_VALUE_LENGTH 16 | ||
| 92 | |||
| 93 | #define PW_AUTH_UDP_PORT 1812 | ||
| 94 | #define PW_ACCT_UDP_PORT 1813 | ||
| 95 | |||
| 96 | #define PW_TYPE_STRING 0 | ||
| 97 | #define PW_TYPE_INTEGER 1 | ||
| 98 | #define PW_TYPE_IPADDR 2 | ||
| 99 | #define PW_TYPE_DATE 3 | ||
| 100 | |||
| 101 | /* standard RADIUS codes */ | ||
| 102 | |||
| 103 | #define PW_ACCESS_REQUEST 1 | ||
| 104 | #define PW_ACCESS_ACCEPT 2 | ||
| 105 | #define PW_ACCESS_REJECT 3 | ||
| 106 | #define PW_ACCOUNTING_REQUEST 4 | ||
| 107 | #define PW_ACCOUNTING_RESPONSE 5 | ||
| 108 | #define PW_ACCOUNTING_STATUS 6 | ||
| 109 | #define PW_PASSWORD_REQUEST 7 | ||
| 110 | #define PW_PASSWORD_ACK 8 | ||
| 111 | #define PW_PASSWORD_REJECT 9 | ||
| 112 | #define PW_ACCOUNTING_MESSAGE 10 | ||
| 113 | #define PW_ACCESS_CHALLENGE 11 | ||
| 114 | #define PW_STATUS_SERVER 12 | ||
| 115 | #define PW_STATUS_CLIENT 13 | ||
| 116 | |||
| 117 | |||
| 118 | /* standard RADIUS attribute-value pairs */ | ||
| 119 | |||
| 120 | #define PW_USER_NAME 1 /* string */ | ||
| 121 | #define PW_USER_PASSWORD 2 /* string */ | ||
| 122 | #define PW_CHAP_PASSWORD 3 /* string */ | ||
| 123 | #define PW_NAS_IP_ADDRESS 4 /* ipaddr */ | ||
| 124 | #define PW_NAS_PORT 5 /* integer */ | ||
| 125 | #define PW_SERVICE_TYPE 6 /* integer */ | ||
| 126 | #define PW_FRAMED_PROTOCOL 7 /* integer */ | ||
| 127 | #define PW_FRAMED_IP_ADDRESS 8 /* ipaddr */ | ||
| 128 | #define PW_FRAMED_IP_NETMASK 9 /* ipaddr */ | ||
| 129 | #define PW_FRAMED_ROUTING 10 /* integer */ | ||
| 130 | #define PW_FILTER_ID 11 /* string */ | ||
| 131 | #define PW_FRAMED_MTU 12 /* integer */ | ||
| 132 | #define PW_FRAMED_COMPRESSION 13 /* integer */ | ||
| 133 | #define PW_LOGIN_IP_HOST 14 /* ipaddr */ | ||
| 134 | #define PW_LOGIN_SERVICE 15 /* integer */ | ||
| 135 | #define PW_LOGIN_PORT 16 /* integer */ | ||
| 136 | #define PW_OLD_PASSWORD 17 /* string */ /* deprecated */ | ||
| 137 | #define PW_REPLY_MESSAGE 18 /* string */ | ||
| 138 | #define PW_LOGIN_CALLBACK_NUMBER 19 /* string */ | ||
| 139 | #define PW_FRAMED_CALLBACK_ID 20 /* string */ | ||
| 140 | #define PW_EXPIRATION 21 /* date */ /* deprecated */ | ||
| 141 | #define PW_FRAMED_ROUTE 22 /* string */ | ||
| 142 | #define PW_FRAMED_IPX_NETWORK 23 /* integer */ | ||
| 143 | #define PW_STATE 24 /* string */ | ||
| 144 | #define PW_CLASS 25 /* string */ | ||
| 145 | #define PW_VENDOR_SPECIFIC 26 /* string */ | ||
| 146 | #define PW_SESSION_TIMEOUT 27 /* integer */ | ||
| 147 | #define PW_IDLE_TIMEOUT 28 /* integer */ | ||
| 148 | #define PW_TERMINATION_ACTION 29 /* integer */ | ||
| 149 | #define PW_CALLED_STATION_ID 30 /* string */ | ||
| 150 | #define PW_CALLING_STATION_ID 31 /* string */ | ||
| 151 | #define PW_NAS_IDENTIFIER 32 /* string */ | ||
| 152 | #define PW_PROXY_STATE 33 /* string */ | ||
| 153 | #define PW_LOGIN_LAT_SERVICE 34 /* string */ | ||
| 154 | #define PW_LOGIN_LAT_NODE 35 /* string */ | ||
| 155 | #define PW_LOGIN_LAT_GROUP 36 /* string */ | ||
| 156 | #define PW_FRAMED_APPLETALK_LINK 37 /* integer */ | ||
| 157 | #define PW_FRAMED_APPLETALK_NETWORK 38 /* integer */ | ||
| 158 | #define PW_FRAMED_APPLETALK_ZONE 39 /* string */ | ||
| 159 | #define PW_CHAP_CHALLENGE 60 /* string */ | ||
| 160 | #define PW_NAS_PORT_TYPE 61 /* integer */ | ||
| 161 | #define PW_PORT_LIMIT 62 /* integer */ | ||
| 162 | #define PW_LOGIN_LAT_PORT 63 /* string */ | ||
| 163 | |||
| 164 | /* Vendor RADIUS attribute-value pairs */ | ||
| 165 | #define PW_MS_CHAP_CHALLENGE 11 /* string */ | ||
| 166 | #define PW_MS_CHAP_RESPONSE 1 /* string */ | ||
| 167 | #define PW_MS_CHAP2_RESPONSE 25 /* string */ | ||
| 168 | #define PW_MS_CHAP2_SUCCESS 26 /* string */ | ||
| 169 | #define PW_MS_MPPE_ENCRYPTION_POLICY 7 /* string */ | ||
| 170 | #define PW_MS_MPPE_ENCRYPTION_TYPE 8 /* string */ | ||
| 171 | #define PW_MS_MPPE_ENCRYPTION_TYPES PW_MS_MPPE_ENCRYPTION_TYPE | ||
| 172 | #define PW_MS_CHAP_MPPE_KEYS 12 /* string */ | ||
| 173 | #define PW_MS_MPPE_SEND_KEY 16 /* string */ | ||
| 174 | #define PW_MS_MPPE_RECV_KEY 17 /* string */ | ||
| 175 | |||
| 176 | /* Accounting */ | ||
| 177 | |||
| 178 | #define PW_ACCT_STATUS_TYPE 40 /* integer */ | ||
| 179 | #define PW_ACCT_DELAY_TIME 41 /* integer */ | ||
| 180 | #define PW_ACCT_INPUT_OCTETS 42 /* integer */ | ||
| 181 | #define PW_ACCT_OUTPUT_OCTETS 43 /* integer */ | ||
| 182 | #define PW_ACCT_SESSION_ID 44 /* string */ | ||
| 183 | #define PW_ACCT_AUTHENTIC 45 /* integer */ | ||
| 184 | #define PW_ACCT_SESSION_TIME 46 /* integer */ | ||
| 185 | #define PW_ACCT_INPUT_PACKETS 47 /* integer */ | ||
| 186 | #define PW_ACCT_OUTPUT_PACKETS 48 /* integer */ | ||
| 187 | #define PW_ACCT_TERMINATE_CAUSE 49 /* integer */ | ||
| 188 | #define PW_ACCT_MULTI_SESSION_ID 50 /* string */ | ||
| 189 | #define PW_ACCT_LINK_COUNT 51 /* integer */ | ||
| 190 | |||
| 191 | /* From RFC 2869 */ | ||
| 192 | #define PW_ACCT_INTERIM_INTERVAL 85 /* integer */ | ||
| 193 | |||
| 194 | /* Merit Experimental Extensions */ | ||
| 195 | |||
| 196 | #define PW_USER_ID 222 /* string */ | ||
| 197 | #define PW_USER_REALM 223 /* string */ | ||
| 198 | |||
| 199 | |||
| 200 | /* Session limits */ | ||
| 201 | #define PW_SESSION_OCTETS_LIMIT 227 /* integer */ | ||
| 202 | #define PW_OCTETS_DIRECTION 228 /* integer */ | ||
| 203 | |||
| 204 | /* Integer Translations */ | ||
| 205 | |||
| 206 | /* SERVICE TYPES */ | ||
| 207 | |||
| 208 | #define PW_LOGIN 1 | ||
| 209 | #define PW_FRAMED 2 | ||
| 210 | #define PW_CALLBACK_LOGIN 3 | ||
| 211 | #define PW_CALLBACK_FRAMED 4 | ||
| 212 | #define PW_OUTBOUND 5 | ||
| 213 | #define PW_ADMINISTRATIVE 6 | ||
| 214 | #define PW_NAS_PROMPT 7 | ||
| 215 | #define PW_AUTHENTICATE_ONLY 8 | ||
| 216 | #define PW_CALLBACK_NAS_PROMPT 9 | ||
| 217 | |||
| 218 | /* FRAMED PROTOCOLS */ | ||
| 219 | |||
| 220 | #define PW_PPP 1 | ||
| 221 | #define PW_SLIP 2 | ||
| 222 | #define PW_ARA 3 | ||
| 223 | #define PW_GANDALF 4 | ||
| 224 | #define PW_XYLOGICS 5 | ||
| 225 | |||
| 226 | /* FRAMED ROUTING VALUES */ | ||
| 227 | |||
| 228 | #define PW_NONE 0 | ||
| 229 | #define PW_BROADCAST 1 | ||
| 230 | #define PW_LISTEN 2 | ||
| 231 | #define PW_BROADCAST_LISTEN 3 | ||
| 232 | |||
| 233 | /* FRAMED COMPRESSION TYPES */ | ||
| 234 | |||
| 235 | #define PW_VAN_JACOBSON_TCP_IP 1 | ||
| 236 | #define PW_IPX_HEADER_COMPRESSION 2 | ||
| 237 | |||
| 238 | /* LOGIN SERVICES */ | ||
| 239 | |||
| 240 | #define PW_TELNET 0 | ||
| 241 | #define PW_RLOGIN 1 | ||
| 242 | #define PW_TCP_CLEAR 2 | ||
| 243 | #define PW_PORTMASTER 3 | ||
| 244 | #define PW_LAT 4 | ||
| 245 | #define PW_X25_PAD 5 | ||
| 246 | #define PW_X25_T3POS 6 | ||
| 247 | |||
| 248 | /* TERMINATION ACTIONS */ | ||
| 249 | |||
| 250 | #define PW_DEFAULT 0 | ||
| 251 | #define PW_RADIUS_REQUEST 1 | ||
| 252 | |||
| 253 | /* PROHIBIT PROTOCOL */ | ||
| 254 | |||
| 255 | #define PW_DUMB 0 /* 1 and 2 are defined in FRAMED PROTOCOLS */ | ||
| 256 | #define PW_AUTH_ONLY 3 | ||
| 257 | #define PW_ALL 255 | ||
| 258 | |||
| 259 | /* ACCOUNTING STATUS TYPES */ | ||
| 260 | |||
| 261 | #define PW_STATUS_START 1 | ||
| 262 | #define PW_STATUS_STOP 2 | ||
| 263 | #define PW_STATUS_ALIVE 3 | ||
| 264 | #define PW_STATUS_MODEM_START 4 | ||
| 265 | #define PW_STATUS_MODEM_STOP 5 | ||
| 266 | #define PW_STATUS_CANCEL 6 | ||
| 267 | #define PW_ACCOUNTING_ON 7 | ||
| 268 | #define PW_ACCOUNTING_OFF 8 | ||
| 269 | |||
| 270 | /* ACCOUNTING TERMINATION CAUSES */ | ||
| 271 | |||
| 272 | #define PW_USER_REQUEST 1 | ||
| 273 | #define PW_LOST_CARRIER 2 | ||
| 274 | #define PW_LOST_SERVICE 3 | ||
| 275 | #define PW_ACCT_IDLE_TIMEOUT 4 | ||
| 276 | #define PW_ACCT_SESSION_TIMEOUT 5 | ||
| 277 | #define PW_ADMIN_RESET 6 | ||
| 278 | #define PW_ADMIN_REBOOT 7 | ||
| 279 | #define PW_PORT_ERROR 8 | ||
| 280 | #define PW_NAS_ERROR 9 | ||
| 281 | #define PW_NAS_REQUEST 10 | ||
| 282 | #define PW_NAS_REBOOT 11 | ||
| 283 | #define PW_PORT_UNNEEDED 12 | ||
| 284 | #define PW_PORT_PREEMPTED 13 | ||
| 285 | #define PW_PORT_SUSPENDED 14 | ||
| 286 | #define PW_SERVICE_UNAVAILABLE 15 | ||
| 287 | #define PW_CALLBACK 16 | ||
| 288 | #define PW_USER_ERROR 17 | ||
| 289 | #define PW_HOST_REQUEST 18 | ||
| 290 | |||
| 291 | /* NAS PORT TYPES */ | ||
| 292 | |||
| 293 | #define PW_ASYNC 0 | ||
| 294 | #define PW_SYNC 1 | ||
| 295 | #define PW_ISDN_SYNC 2 | ||
| 296 | #define PW_ISDN_SYNC_V120 3 | ||
| 297 | #define PW_ISDN_SYNC_V110 4 | ||
| 298 | #define PW_VIRTUAL 5 | ||
| 299 | |||
| 300 | /* AUTHENTIC TYPES */ | ||
| 301 | #define PW_RADIUS 1 | ||
| 302 | #define PW_LOCAL 2 | ||
| 303 | #define PW_REMOTE 3 | ||
| 304 | |||
| 305 | /* Session-Octets-Limit */ | ||
| 306 | #define PW_OCTETS_DIRECTION_SUM 0 | ||
| 307 | #define PW_OCTETS_DIRECTION_IN 1 | ||
| 308 | #define PW_OCTETS_DIRECTION_OUT 2 | ||
| 309 | #define PW_OCTETS_DIRECTION_MAX 3 | ||
| 310 | |||
| 311 | |||
| 312 | /* Vendor codes */ | ||
| 313 | #define VENDOR_NONE (-1) | ||
| 314 | #define VENDOR_MICROSOFT 311 | ||
| 315 | |||
| 316 | /* Server data structures */ | ||
| 317 | |||
| 318 | typedef struct dict_attr | ||
| 319 | { | ||
| 320 | char name[NAME_LENGTH + 1]; /* attribute name */ | ||
| 321 | int value; /* attribute index */ | ||
| 322 | int type; /* string, int, etc. */ | ||
| 323 | int vendorcode; /* vendor code */ | ||
| 324 | struct dict_attr *next; | ||
| 325 | } DICT_ATTR; | ||
| 326 | |||
| 327 | typedef struct dict_value | ||
| 328 | { | ||
| 329 | char attrname[NAME_LENGTH +1]; | ||
| 330 | char name[NAME_LENGTH + 1]; | ||
| 331 | int value; | ||
| 332 | struct dict_value *next; | ||
| 333 | } DICT_VALUE; | ||
| 334 | |||
| 335 | typedef struct vendor_dict | ||
| 336 | { | ||
| 337 | char vendorname[NAME_LENGTH + 1]; | ||
| 338 | int vendorcode; | ||
| 339 | DICT_ATTR *attributes; | ||
| 340 | struct vendor_dict *next; | ||
| 341 | } VENDOR_DICT; | ||
| 342 | |||
| 343 | typedef struct value_pair | ||
| 344 | { | ||
| 345 | char name[NAME_LENGTH + 1]; | ||
| 346 | int attribute; | ||
| 347 | int vendorcode; | ||
| 348 | int type; | ||
| 349 | UINT4 lvalue; | ||
| 350 | u_char strvalue[AUTH_STRING_LEN + 1]; | ||
| 351 | struct value_pair *next; | ||
| 352 | } VALUE_PAIR; | ||
| 353 | |||
| 354 | /* don't change this, as it has to be the same as in the Merit radiusd code */ | ||
| 355 | #define MGMT_POLL_SECRET "Hardlyasecret" | ||
| 356 | |||
| 357 | /* Define return codes from "SendServer" utility */ | ||
| 358 | |||
| 359 | #define BADRESP_RC -2 | ||
| 360 | #define ERROR_RC -1 | ||
| 361 | #define OK_RC 0 | ||
| 362 | #define TIMEOUT_RC 1 | ||
| 363 | |||
| 364 | typedef struct send_data /* Used to pass information to sendserver() function */ | ||
| 365 | { | ||
| 366 | u_char code; /* RADIUS packet code */ | ||
| 367 | u_char seq_nbr; /* Packet sequence number */ | ||
| 368 | char *server; /* Name/addrress of RADIUS server */ | ||
| 369 | int svc_port; /* RADIUS protocol destination port */ | ||
| 370 | int timeout; /* Session timeout in seconds */ | ||
| 371 | int retries; | ||
| 372 | VALUE_PAIR *send_pairs; /* More a/v pairs to send */ | ||
| 373 | VALUE_PAIR *receive_pairs; /* Where to place received a/v pairs */ | ||
| 374 | } SEND_DATA; | ||
| 375 | |||
| 376 | typedef struct request_info | ||
| 377 | { | ||
| 378 | char secret[MAX_SECRET_LENGTH + 1]; | ||
| 379 | u_char request_vector[AUTH_VECTOR_LEN]; | ||
| 380 | } REQUEST_INFO; | ||
| 381 | |||
| 382 | #ifndef MIN | ||
| 383 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) | ||
| 384 | #endif | ||
| 385 | #ifndef MAX | ||
| 386 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) | ||
| 387 | #endif | ||
| 388 | |||
| 389 | #ifndef PATH_MAX | ||
| 390 | #define PATH_MAX 1024 | ||
| 391 | #endif | ||
| 392 | |||
| 393 | typedef struct env | ||
| 394 | { | ||
| 395 | int maxsize, size; | ||
| 396 | char **env; | ||
| 397 | } ENV; | ||
| 398 | |||
| 399 | #define ENV_SIZE 128 | ||
| 400 | |||
| 401 | __BEGIN_DECLS | ||
| 402 | |||
| 403 | /* Function prototypes */ | ||
| 404 | |||
| 405 | /* avpair.c */ | ||
| 406 | |||
| 407 | VALUE_PAIR *rc_avpair_add __P((VALUE_PAIR **, int, void *, int, int)); | ||
| 408 | int rc_avpair_assign __P((VALUE_PAIR *, void *, int)); | ||
| 409 | VALUE_PAIR *rc_avpair_new __P((int, void *, int, int)); | ||
| 410 | VALUE_PAIR *rc_avpair_gen __P((AUTH_HDR *)); | ||
| 411 | VALUE_PAIR *rc_avpair_get __P((VALUE_PAIR *, UINT4)); | ||
| 412 | VALUE_PAIR *rc_avpair_copy __P((VALUE_PAIR *)); | ||
| 413 | void rc_avpair_insert __P((VALUE_PAIR **, VALUE_PAIR *, VALUE_PAIR *)); | ||
| 414 | void rc_avpair_free __P((VALUE_PAIR *)); | ||
| 415 | int rc_avpair_parse __P((char *, VALUE_PAIR **)); | ||
| 416 | int rc_avpair_tostr __P((VALUE_PAIR *, char *, int, char *, int)); | ||
| 417 | VALUE_PAIR *rc_avpair_readin __P((FILE *)); | ||
| 418 | |||
| 419 | /* buildreq.c */ | ||
| 420 | |||
| 421 | void rc_buildreq __P((SEND_DATA *, int, char *, unsigned short, int, int)); | ||
| 422 | unsigned char rc_get_seqnbr __P((void)); | ||
| 423 | int rc_auth __P((UINT4, VALUE_PAIR *, VALUE_PAIR **, char *, REQUEST_INFO *)); | ||
| 424 | int rc_auth_using_server __P((SERVER *, UINT4, VALUE_PAIR *, VALUE_PAIR **, | ||
| 425 | char *, REQUEST_INFO *)); | ||
| 426 | int rc_auth_proxy __P((VALUE_PAIR *, VALUE_PAIR **, char *)); | ||
| 427 | int rc_acct __P((UINT4, VALUE_PAIR *)); | ||
| 428 | int rc_acct_using_server __P((SERVER *, UINT4, VALUE_PAIR *)); | ||
| 429 | int rc_acct_proxy __P((VALUE_PAIR *)); | ||
| 430 | int rc_check __P((char *, unsigned short, char *)); | ||
| 431 | |||
| 432 | /* clientid.c */ | ||
| 433 | |||
| 434 | int rc_read_mapfile __P((char *)); | ||
| 435 | UINT4 rc_map2id __P((char *)); | ||
| 436 | |||
| 437 | /* config.c */ | ||
| 438 | |||
| 439 | int rc_read_config __P((char *)); | ||
| 440 | char *rc_conf_str __P((char *)); | ||
| 441 | int rc_conf_int __P((char *)); | ||
| 442 | SERVER *rc_conf_srv __P((char *)); | ||
| 443 | int rc_find_server __P((char *, UINT4 *, char *)); | ||
| 444 | |||
| 445 | /* dict.c */ | ||
| 446 | |||
| 447 | int rc_read_dictionary __P((char *)); | ||
| 448 | DICT_ATTR *rc_dict_getattr __P((int, int)); | ||
| 449 | DICT_ATTR *rc_dict_findattr __P((char *)); | ||
| 450 | DICT_VALUE *rc_dict_findval __P((char *)); | ||
| 451 | DICT_VALUE * rc_dict_getval __P((UINT4, char *)); | ||
| 452 | VENDOR_DICT * rc_dict_findvendor __P((char *)); | ||
| 453 | VENDOR_DICT * rc_dict_getvendor __P((int)); | ||
| 454 | |||
| 455 | /* ip_util.c */ | ||
| 456 | |||
| 457 | UINT4 rc_get_ipaddr __P((char *)); | ||
| 458 | int rc_good_ipaddr __P((char *)); | ||
| 459 | const char *rc_ip_hostname __P((UINT4)); | ||
| 460 | unsigned short rc_getport __P((int)); | ||
| 461 | int rc_own_hostname __P((char *, int)); | ||
| 462 | UINT4 rc_own_ipaddress __P((void)); | ||
| 463 | |||
| 464 | |||
| 465 | /* log.c */ | ||
| 466 | |||
| 467 | void rc_openlog __P((char *)); | ||
| 468 | void rc_log __P((int, const char *, ...)); | ||
| 469 | |||
| 470 | /* sendserver.c */ | ||
| 471 | |||
| 472 | int rc_send_server __P((SEND_DATA *, char *, REQUEST_INFO *)); | ||
| 473 | |||
| 474 | /* util.c */ | ||
| 475 | |||
| 476 | void rc_str2tm __P((char *, struct tm *)); | ||
| 477 | char *rc_mksid __P((void)); | ||
| 478 | char *rc_getifname __P((char *)); | ||
| 479 | char *rc_getstr __P((char *, int)); | ||
| 480 | void rc_mdelay __P((int)); | ||
| 481 | char *rc_mksid __P((void)); | ||
| 482 | |||
| 483 | /* env.c */ | ||
| 484 | |||
| 485 | struct env *rc_new_env __P((int)); | ||
| 486 | void rc_free_env __P((struct env *)); | ||
| 487 | int rc_add_env __P((struct env *, char *, char *)); | ||
| 488 | int rc_import_env __P((struct env *, char **)); | ||
| 489 | |||
| 490 | /* md5.c */ | ||
| 491 | |||
| 492 | void rc_md5_calc __P((unsigned char *, unsigned char *, unsigned int)); | ||
| 493 | |||
| 494 | __END_DECLS | ||
| 495 | |||
| 496 | #endif /* RADIUSCLIENT_H */ | ||
diff --git a/web/attachments/141582-diff b/web/attachments/141582-diff new file mode 100644 index 0000000..f956a50 --- /dev/null +++ b/web/attachments/141582-diff | |||
| @@ -0,0 +1,106 @@ | |||
| 1 | --- check_nwstat.c 2005-07-11 08:08:39.000000000 +0000 | ||
| 2 | +++ check_nwstat_patched.c 2005-07-11 08:07:02.000000000 +0000 | ||
| 3 | @@ -169,6 +169,10 @@ | ||
| 4 | if (result!=STATE_OK) | ||
| 5 | return result; | ||
| 6 | utilization=strtoul(recv_buffer,NULL,10); | ||
| 7 | + | ||
| 8 | + close(sd); | ||
| 9 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 10 | + | ||
| 11 | send_buffer = strdup ("UPTIME\r\n"); | ||
| 12 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 13 | if (result!=STATE_OK) | ||
| 14 | @@ -325,20 +329,24 @@ | ||
| 15 | |||
| 16 | free_disk_space=strtoul(recv_buffer,NULL,10); | ||
| 17 | |||
| 18 | + close(sd); | ||
| 19 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 20 | + | ||
| 21 | asprintf (&send_buffer,"VKS%s\r\n",volume_name); | ||
| 22 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 23 | if (result!=STATE_OK) | ||
| 24 | return result; | ||
| 25 | total_disk_space=strtoul(recv_buffer,NULL,10); | ||
| 26 | |||
| 27 | - percent_free_space=(int)(((double)free_disk_space/(double)total_disk_space)*100.0); | ||
| 28 | + percent_free_space=(unsigned long)(((double)free_disk_space/(double)total_disk_space)*100.0); | ||
| 29 | |||
| 30 | if (check_critical_value==TRUE && percent_free_space <= critical_value) | ||
| 31 | result=STATE_CRITICAL; | ||
| 32 | else if (check_warning_value==TRUE && percent_free_space <= warning_value) | ||
| 33 | result=STATE_WARNING; | ||
| 34 | free_disk_space/=1024; | ||
| 35 | - asprintf (&output_message,_("%lu MB (%lu%%) free on volume %s"),free_disk_space,percent_free_space,volume_name); | ||
| 36 | + total_disk_space/=1024; | ||
| 37 | + asprintf (&output_message,_("%lu MB (%lu%%) free on volume %s - total %lu MB"),free_disk_space,percent_free_space,volume_name,total_disk_space); | ||
| 38 | } | ||
| 39 | |||
| 40 | /* check to see if DS Database is open or closed */ | ||
| 41 | @@ -353,6 +361,9 @@ | ||
| 42 | else | ||
| 43 | result=STATE_WARNING; | ||
| 44 | |||
| 45 | + close(sd); | ||
| 46 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 47 | + | ||
| 48 | send_buffer = strdup ("S13\r\n"); | ||
| 49 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 50 | temp_buffer=strtok(recv_buffer,"\r\n"); | ||
| 51 | @@ -472,7 +483,7 @@ | ||
| 52 | return result; | ||
| 53 | total_disk_space=strtoul(recv_buffer,NULL,10); | ||
| 54 | |||
| 55 | - percent_purgeable_space=(int)(((double)purgeable_disk_space/(double)total_disk_space)*100.0); | ||
| 56 | + percent_purgeable_space=(unsigned long)(((double)purgeable_disk_space/(double)total_disk_space)*100.0); | ||
| 57 | |||
| 58 | if (check_critical_value==TRUE && percent_purgeable_space >= critical_value) | ||
| 59 | result=STATE_CRITICAL; | ||
| 60 | @@ -525,7 +536,7 @@ | ||
| 61 | return result; | ||
| 62 | total_disk_space=strtoul(recv_buffer,NULL,10); | ||
| 63 | |||
| 64 | - percent_non_purgeable_space=(int)(((double)non_purgeable_disk_space/(double)total_disk_space)*100.0); | ||
| 65 | + percent_non_purgeable_space=(unsigned long)(((double)non_purgeable_disk_space/(double)total_disk_space)*100.0); | ||
| 66 | |||
| 67 | if (check_critical_value==TRUE && percent_non_purgeable_space >= critical_value) | ||
| 68 | result=STATE_CRITICAL; | ||
| 69 | @@ -579,6 +590,9 @@ | ||
| 70 | |||
| 71 | max_service_processes=atoi(recv_buffer); | ||
| 72 | |||
| 73 | + close(sd); | ||
| 74 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 75 | + | ||
| 76 | asprintf (&send_buffer,"S21\r\n"); | ||
| 77 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 78 | if (result!=STATE_OK) | ||
| 79 | @@ -671,12 +685,15 @@ | ||
| 80 | asprintf (&output_message,_("NDS Version %s"),recv_buffer); | ||
| 81 | |||
| 82 | } else if (vars_to_check==UPTIME) { | ||
| 83 | + asprintf (&send_buffer,"UPTIME\r\n"); | ||
| 84 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 85 | if (result!=STATE_OK) | ||
| 86 | return result; | ||
| 87 | |||
| 88 | - recv_buffer[strlen(recv_buffer)-1]=0; | ||
| 89 | |||
| 90 | + recv_buffer[sizeof(recv_buffer)-1]=0; | ||
| 91 | + recv_buffer[strlen(recv_buffer)-1]=0; | ||
| 92 | + | ||
| 93 | asprintf (&output_message,_("Up %s"),recv_buffer); | ||
| 94 | |||
| 95 | } else if (vars_to_check==NLM) { | ||
| 96 | @@ -865,8 +882,9 @@ | ||
| 97 | vars_to_check=TSYNC; | ||
| 98 | else if (!strcmp(optarg,"DSVER")) | ||
| 99 | vars_to_check=DSVER; | ||
| 100 | - else if (!strcmp(optarg,"UPTIME")) | ||
| 101 | + else if (!strcmp(optarg,"UPTIME")) { | ||
| 102 | vars_to_check=UPTIME; | ||
| 103 | + } | ||
| 104 | else if (strncmp(optarg,"NLM:",4)==0) { | ||
| 105 | vars_to_check=NLM; | ||
| 106 | nlm_name=strdup (optarg+4); | ||
diff --git a/web/attachments/144080-check_disk_smb.smbclient-args-patch b/web/attachments/144080-check_disk_smb.smbclient-args-patch new file mode 100644 index 0000000..8886e03 --- /dev/null +++ b/web/attachments/144080-check_disk_smb.smbclient-args-patch | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | *** check_disk_smb 2005-06-08 11:09:01.720711352 -0500 | ||
| 2 | --- check_disk_smb.ultra 2005-06-08 11:05:52.927412296 -0500 | ||
| 3 | *************** | ||
| 4 | *** 15,22 **** | ||
| 5 | # allow setting of limits in MBytes or GBytes. Percentage settings for large | ||
| 6 | # drives is a pain in the butt | ||
| 7 | # 2-May-2002 - SGhosh fix for embedded perl | ||
| 8 | # | ||
| 9 | ! # $Id: check_disk_smb.pl,v 1.8.2.1 2003/07/02 15:52:23 tonvoon Exp $ | ||
| 10 | # | ||
| 11 | |||
| 12 | require 5.004; | ||
| 13 | --- 15,24 ---- | ||
| 14 | # allow setting of limits in MBytes or GBytes. Percentage settings for large | ||
| 15 | # drives is a pain in the butt | ||
| 16 | # 2-May-2002 - SGhosh fix for embedded perl | ||
| 17 | + # 8-Jun-2005 - Andrey Warkentin | ||
| 18 | + # Fixed the way smbclient gets called. The share path was malformed. | ||
| 19 | # | ||
| 20 | ! # $Id: check_disk_smb.pl,v 1.8.2.1 2005/06/08 10:44:21 root Exp $ | ||
| 21 | # | ||
| 22 | |||
| 23 | require 5.004; | ||
| 24 | *************** | ||
| 25 | *** 60,67 **** | ||
| 26 | my $smbclient= "$utils::PATH_TO_SMBCLIENT " ; | ||
| 27 | my $smbclientoptions=""; | ||
| 28 | |||
| 29 | ! # Options checking | ||
| 30 | ! | ||
| 31 | ($opt_H) || ($opt_H = shift) || usage("Host name not specified\n"); | ||
| 32 | my $host = $1 if ($opt_H =~ /^([-_.A-Za-z0-9]+\$?)$/); | ||
| 33 | ($host) || usage("Invalid host: $opt_H\n"); | ||
| 34 | --- 62,68 ---- | ||
| 35 | my $smbclient= "$utils::PATH_TO_SMBCLIENT " ; | ||
| 36 | my $smbclientoptions=""; | ||
| 37 | |||
| 38 | ! # Options checking. | ||
| 39 | ($opt_H) || ($opt_H = shift) || usage("Host name not specified\n"); | ||
| 40 | my $host = $1 if ($opt_H =~ /^([-_.A-Za-z0-9]+\$?)$/); | ||
| 41 | ($host) || usage("Invalid host: $opt_H\n"); | ||
| 42 | *************** | ||
| 43 | *** 105,111 **** | ||
| 44 | |||
| 45 | # end of options checking | ||
| 46 | |||
| 47 | - | ||
| 48 | my $state = "OK"; | ||
| 49 | my $answer = undef; | ||
| 50 | my $res = undef; | ||
| 51 | --- 106,111 ---- | ||
| 52 | *************** | ||
| 53 | *** 118,130 **** | ||
| 54 | }; | ||
| 55 | alarm($TIMEOUT); | ||
| 56 | |||
| 57 | # Execute an "ls" on the share using smbclient program | ||
| 58 | # get the results into $res | ||
| 59 | if (defined($workgroup)) { | ||
| 60 | ! $res = qx/$smbclient \/\/$host\/$share $pass -W $workgroup -U $user $smbclientoptions -c ls/; | ||
| 61 | } else { | ||
| 62 | ! print "$smbclient " . "\/\/$host\/$share" ." $pass -U $user $smbclientoptions -c ls\n" if ($verbose); | ||
| 63 | ! $res = qx/$smbclient \/\/$host\/$share $pass -U $user $smbclientoptions -c ls/; | ||
| 64 | } | ||
| 65 | #Turn off alarm | ||
| 66 | alarm(0); | ||
| 67 | --- 118,149 ---- | ||
| 68 | }; | ||
| 69 | alarm($TIMEOUT); | ||
| 70 | |||
| 71 | + # Check Samba version. Version 3 changed the way we pass the server path. | ||
| 72 | + my $samba_ver = qx/$smbclient --version 2>&1/; | ||
| 73 | + if($samba_ver =~ /Version (\d)/) | ||
| 74 | + { | ||
| 75 | + $samba_ver = $1; | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + # Version 3 broke it all. | ||
| 79 | + my $smbclient_part_cmd; | ||
| 80 | + if($samba_ver == 3) | ||
| 81 | + { | ||
| 82 | + $smbclient_part_cmd = "$smbclient \\\\\\\\$host\\\\$share"; | ||
| 83 | + } | ||
| 84 | + else | ||
| 85 | + { | ||
| 86 | + $smbclient_part_cmd = "$smbclient \/\/$host\/$share"; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | # Execute an "ls" on the share using smbclient program | ||
| 90 | # get the results into $res | ||
| 91 | if (defined($workgroup)) { | ||
| 92 | ! print $smbclient_part_cmd . " $pass -W $workgroup -U $user $smbclientoptions -c ls\n" if ($verbose); | ||
| 93 | ! $res = qx/$smbclient_part_cmd $pass -W $workgroup -U $user $smbclientoptions -c ls/; | ||
| 94 | } else { | ||
| 95 | ! print $smbclient_part_cmd . " $pass -U $user $smbclientoptions -c ls\n" if ($verbose); | ||
| 96 | ! $res = qx/$smbclient_part_cmd $pass -U $user $smbclientoptions -c ls/; | ||
| 97 | } | ||
| 98 | #Turn off alarm | ||
| 99 | alarm(0); | ||
diff --git a/web/attachments/144118-nagios-plugins-1.4.1-waitpid.patch b/web/attachments/144118-nagios-plugins-1.4.1-waitpid.patch new file mode 100644 index 0000000..331da4b --- /dev/null +++ b/web/attachments/144118-nagios-plugins-1.4.1-waitpid.patch | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | --- nagios-plugins-1.4.1/plugins/popen.c.orig 2005-08-02 13:44:47.631761141 +0200 | ||
| 2 | +++ nagios-plugins-1.4.1/plugins/popen.c 2005-08-02 13:52:24.589616713 +0200 | ||
| 3 | @@ -221,8 +221,13 @@ | ||
| 4 | return (1); | ||
| 5 | |||
| 6 | while (waitpid (pid, &status, 0) < 0) | ||
| 7 | + { | ||
| 8 | + if (errno == ECHILD) | ||
| 9 | + return (0); /* Child has already exited */ | ||
| 10 | + | ||
| 11 | if (errno != EINTR) | ||
| 12 | return (1); /* error other than EINTR from waitpid() */ | ||
| 13 | + } | ||
| 14 | |||
| 15 | if (WIFEXITED (status)) | ||
| 16 | return (WEXITSTATUS (status)); /* return child's termination status */ | ||
diff --git a/web/attachments/144263-patch-plugins-scripts_subst_in b/web/attachments/144263-patch-plugins-scripts_subst_in new file mode 100644 index 0000000..20f6300 --- /dev/null +++ b/web/attachments/144263-patch-plugins-scripts_subst_in | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | $OpenBSD: patch-plugins-scripts_subst_in,v 1.1.1.1 2005/07/25 16:32:07 sturm Exp $ | ||
| 2 | --- plugins-scripts/subst.in.orig Mon Jul 18 22:56:08 2005 | ||
| 3 | +++ plugins-scripts/subst.in Mon Jul 18 22:56:30 2005 | ||
| 4 | @@ -44,10 +44,6 @@ BEGIN { | ||
| 5 | /^#! ?\/.*\/[a-z]{0,2}awk/ {sub(/^#! ?\/.*\/[a-z]{0,2}awk/,"#! @AWK@");} | ||
| 6 | /^#! ?\/.*\/sh/ {sub(/^#! ?\/.*\/sh/,"#! @SHELL@");} | ||
| 7 | |||
| 8 | -# add to libexecdir to INC for perl utils.pm | ||
| 9 | -/^use/ { if (/lib/) { if (/utils.pm|"."/ ) {sub(/utils.pm|"."/,led() )} } } | ||
| 10 | - | ||
| 11 | - | ||
| 12 | # Trusted path mechanism (deprecated) | ||
| 13 | |||
| 14 | /^[ \t]*\$ENV[ \t]*\{[ \t'"]*PATH[ \t"']*\}[ \t]*=/ { | ||
| 15 | @@ -67,6 +63,9 @@ BEGIN { | ||
| 16 | c=substr($0,RSTART,RLENGTH); | ||
| 17 | sub(c,which(c,path)); | ||
| 18 | } | ||
| 19 | + | ||
| 20 | +# add to libexecdir to INC for perl utils.pm | ||
| 21 | +/^use/ { if (/lib/) { if (/utils.pm|"."/ ) {sub(/utils.pm|"."/,led() )} } } | ||
| 22 | |||
| 23 | { | ||
| 24 | print; | ||
diff --git a/web/attachments/144266-patch-configure b/web/attachments/144266-patch-configure new file mode 100644 index 0000000..9e7a2a4 --- /dev/null +++ b/web/attachments/144266-patch-configure | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | $OpenBSD: patch-configure,v 1.1.1.1 2005/07/25 16:32:07 sturm Exp $ | ||
| 2 | --- configure.orig Mon Aug 1 23:34:46 2005 | ||
| 3 | +++ configure Wed Aug 3 13:59:35 2005 | ||
| 4 | @@ -8339,13 +8339,13 @@ if test "${with_pgsql+set}" = set; then | ||
| 5 | PGSQL=$withval | ||
| 6 | fi; | ||
| 7 | |||
| 8 | -echo "$as_me:$LINENO: checking for main in -lcrypt" >&5 | ||
| 9 | -echo $ECHO_N "checking for main in -lcrypt... $ECHO_C" >&6 | ||
| 10 | +echo "$as_me:$LINENO: checking for main in -lcrypto" >&5 | ||
| 11 | +echo $ECHO_N "checking for main in -lcrypto... $ECHO_C" >&6 | ||
| 12 | if test "${ac_cv_lib_crypt_main+set}" = set; then | ||
| 13 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
| 14 | else | ||
| 15 | ac_check_lib_save_LIBS=$LIBS | ||
| 16 | -LIBS="-lcrypt $LIBS" | ||
| 17 | +LIBS="-lcrypto $LIBS" | ||
| 18 | cat >conftest.$ac_ext <<_ACEOF | ||
| 19 | /* confdefs.h. */ | ||
| 20 | _ACEOF | ||
| 21 | @@ -8402,7 +8402,7 @@ if test $ac_cv_lib_crypt_main = yes; the | ||
| 22 | #define HAVE_LIBCRYPT 1 | ||
| 23 | _ACEOF | ||
| 24 | |||
| 25 | - LIBS="-lcrypt $LIBS" | ||
| 26 | + LIBS="-lcrypto $LIBS" | ||
| 27 | |||
| 28 | fi | ||
| 29 | |||
| 30 | @@ -8418,7 +8418,7 @@ if test "${ac_cv_lib_pq_PQsetdbLogin+set | ||
| 31 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
| 32 | else | ||
| 33 | ac_check_lib_save_LIBS=$LIBS | ||
| 34 | -LIBS="-lpq -lcrypt $LIBS" | ||
| 35 | +LIBS="-lpq -lcrypto $LIBS" | ||
| 36 | cat >conftest.$ac_ext <<_ACEOF | ||
| 37 | /* confdefs.h. */ | ||
| 38 | _ACEOF | ||
| 39 | @@ -8937,16 +8937,16 @@ fi | ||
| 40 | done | ||
| 41 | |||
| 42 | if [ -n "$PGSQL" -a "$ac_cv_header_libpq_fe_h" = "yes" ]; then | ||
| 43 | - PGLIBS="-L$PGSQL/lib -lpq -lcrypt" | ||
| 44 | + PGLIBS="-L$PGSQL/lib -lpq -lcrypto" | ||
| 45 | PGINCLUDE="-I$PGSQL/include" | ||
| 46 | elif test "$ac_cv_header_pgsql_libpq_fe_h" = "yes"; then | ||
| 47 | - PGLIBS="-lpq -lcrypt" | ||
| 48 | - PGINCLUDE="-I/usr/include/pgsql" | ||
| 49 | + PGLIBS="-L$PGSQL/lib -lpq -lcrypto" | ||
| 50 | + PGINCLUDE="-I$PGSQL/include/pgsql" | ||
| 51 | elif test "$ac_cv_header_postgresql_libpq_fe_h" = "yes"; then | ||
| 52 | - PGLIBS="-L$PGSQL/lib -lpq -lcrypt" | ||
| 53 | - PGINCLUDE="-I/usr/include/postgresql" | ||
| 54 | + PGLIBS="-L$PGSQL/lib -lpq -lcrypto" | ||
| 55 | + PGINCLUDE="-I$PGSQL/include/postgresql" | ||
| 56 | elif test "$ac_cv_header_libpq_fe_h" = "yes"; then | ||
| 57 | - PGLIBS="-L$PGSQL/lib -lpq -lcrypt" | ||
| 58 | + PGLIBS="-L$PGSQL/lib -lpq -lcrypto" | ||
| 59 | PGINCLUDE="-I$PGSQL/include" | ||
| 60 | fi | ||
| 61 | if test -z "$PGINCLUDE"; then | ||
diff --git a/web/attachments/144285-nagios-plugins-1.4.1-check_ntp.patch b/web/attachments/144285-nagios-plugins-1.4.1-check_ntp.patch new file mode 100644 index 0000000..c50eb65 --- /dev/null +++ b/web/attachments/144285-nagios-plugins-1.4.1-check_ntp.patch | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | --- nagios-plugins-1.4.1/plugins-scripts/check_ntp.pl.orig 2005-08-03 13:37:36.876820293 +0200 | ||
| 2 | +++ nagios-plugins-1.4.1/plugins-scripts/check_ntp.pl 2005-08-03 13:38:26.845893474 +0200 | ||
| 3 | @@ -309,7 +309,7 @@ | ||
| 4 | } | ||
| 5 | } else { | ||
| 6 | print "No match!\n" if $verbose; | ||
| 7 | - $jitter = '(not parsed)'; | ||
| 8 | + $jitter = -1; | ||
| 9 | } | ||
| 10 | |||
| 11 | } | ||
| 12 | @@ -421,7 +421,7 @@ | ||
| 13 | foreach my $key (keys %ERRORS) { | ||
| 14 | if ($state==$ERRORS{$key}) { | ||
| 15 | # print ("NTP $key: $answer"); | ||
| 16 | - print ("NTP $key: $answer|offset=$offset, jitter=" . $jitter/1000 . ",peer_stratum=$stratum\n"); | ||
| 17 | + print ("NTP $key: $answer|offset=$offset, jitter=" . (($jitter) ? $jitter/1000 : '-') . ",peer_stratum=$stratum\n"); | ||
| 18 | last; | ||
| 19 | } | ||
| 20 | } | ||
diff --git a/web/attachments/144381-nagios-plugins-1.4.1-check_tcp.patch b/web/attachments/144381-nagios-plugins-1.4.1-check_tcp.patch new file mode 100644 index 0000000..55a1541 --- /dev/null +++ b/web/attachments/144381-nagios-plugins-1.4.1-check_tcp.patch | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | --- nagios-plugins-1.4.1/plugins/check_tcp.c.orig 2005-08-04 09:47:34.493447229 +0200 | ||
| 2 | +++ nagios-plugins-1.4.1/plugins/check_tcp.c 2005-08-04 09:48:24.684428631 +0200 | ||
| 3 | @@ -175,12 +175,12 @@ | ||
| 4 | flags |= FLAG_SSL; | ||
| 5 | PORT = 465; | ||
| 6 | } | ||
| 7 | - else if (!strncmp(SERVICE, "JABBER", 6)) { | ||
| 8 | + else if (!strncmp(SERVICE, "JABBERS", 7)) { | ||
| 9 | SEND = "<stream:stream to=\'host\' xmlns=\'jabber:client\' xmlns:stream=\'http://etherx.jabber.org/streams\'>\n"; | ||
| 10 | EXPECT = "<?xml version=\'1.0\'?><stream:stream xmlns:stream=\'http://etherx.jabber.org/streams\'"; | ||
| 11 | QUIT = "</stream:stream>\n"; | ||
| 12 | flags |= FLAG_SSL | FLAG_HIDE_OUTPUT; | ||
| 13 | - PORT = 5222; | ||
| 14 | + PORT = 5223; | ||
| 15 | } | ||
| 16 | else if (!strncmp (SERVICE, "NNTPS", 5)) { | ||
| 17 | server_expect_count = 2; | ||
| 18 | @@ -191,6 +191,13 @@ | ||
| 19 | PORT = 563; | ||
| 20 | } | ||
| 21 | #endif | ||
| 22 | + else if (!strncmp(SERVICE, "JABBER", 6)) { | ||
| 23 | + SEND = "<stream:stream to=\'host\' xmlns=\'jabber:client\' xmlns:stream=\'http://etherx.jabber.org/streams\'>\n"; | ||
| 24 | + EXPECT = "<?xml version=\'1.0\'?><stream:stream xmlns:stream=\'http://etherx.jabber.org/streams\'"; | ||
| 25 | + QUIT = "</stream:stream>\n"; | ||
| 26 | + flags |= FLAG_HIDE_OUTPUT; | ||
| 27 | + PORT = 5222; | ||
| 28 | + } | ||
| 29 | else if (!strncmp (SERVICE, "NNTP", 4)) { | ||
| 30 | server_expect_count = 2; | ||
| 31 | server_expect = malloc(sizeof(char *) * server_expect_count); | ||
| 32 | --- nagios-plugins-1.4.1/configure.in.orig 2005-08-04 10:31:50.608790288 +0200 | ||
| 33 | +++ nagios-plugins-1.4.1/configure.in 2005-08-04 10:32:00.309256197 +0200 | ||
| 34 | @@ -479,7 +479,7 @@ | ||
| 35 | fi | ||
| 36 | |||
| 37 | if test "$FOUNDSSL" = "yes"; then | ||
| 38 | - check_tcp_ssl="check_simap check_spop check_jabber check_nntps check_ssmtp" | ||
| 39 | + check_tcp_ssl="check_simap check_spop check_jabbers check_nntps check_ssmtp" | ||
| 40 | AC_SUBST(check_tcp_ssl) | ||
| 41 | AC_SUBST(SSLLIBS) | ||
| 42 | AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found]) | ||
| 43 | --- nagios-plugins-1.4.1/plugins/Makefile.am.orig 2005-08-04 10:32:17.072877007 +0200 | ||
| 44 | +++ nagios-plugins-1.4.1/plugins/Makefile.am 2005-08-04 10:32:30.926258102 +0200 | ||
| 45 | @@ -17,7 +17,7 @@ | ||
| 46 | check_udp check_ups check_users negate urlize check_icmp\ | ||
| 47 | @EXTRAS@ | ||
| 48 | |||
| 49 | -check_tcp_programs = check_ftp check_imap check_nntp check_pop check_udp2 \ | ||
| 50 | +check_tcp_programs = check_ftp check_imap check_jabber check_nntp check_pop check_udp2 \ | ||
| 51 | @check_tcp_ssl@ | ||
| 52 | |||
| 53 | EXTRA_PROGRAMS = check_mysql check_radius check_pgsql check_snmp check_hpjd \ | ||
diff --git a/web/attachments/144382-nagios-plugins-1.4.1-check_ntp.patch b/web/attachments/144382-nagios-plugins-1.4.1-check_ntp.patch new file mode 100644 index 0000000..c50eb65 --- /dev/null +++ b/web/attachments/144382-nagios-plugins-1.4.1-check_ntp.patch | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | --- nagios-plugins-1.4.1/plugins-scripts/check_ntp.pl.orig 2005-08-03 13:37:36.876820293 +0200 | ||
| 2 | +++ nagios-plugins-1.4.1/plugins-scripts/check_ntp.pl 2005-08-03 13:38:26.845893474 +0200 | ||
| 3 | @@ -309,7 +309,7 @@ | ||
| 4 | } | ||
| 5 | } else { | ||
| 6 | print "No match!\n" if $verbose; | ||
| 7 | - $jitter = '(not parsed)'; | ||
| 8 | + $jitter = -1; | ||
| 9 | } | ||
| 10 | |||
| 11 | } | ||
| 12 | @@ -421,7 +421,7 @@ | ||
| 13 | foreach my $key (keys %ERRORS) { | ||
| 14 | if ($state==$ERRORS{$key}) { | ||
| 15 | # print ("NTP $key: $answer"); | ||
| 16 | - print ("NTP $key: $answer|offset=$offset, jitter=" . $jitter/1000 . ",peer_stratum=$stratum\n"); | ||
| 17 | + print ("NTP $key: $answer|offset=$offset, jitter=" . (($jitter) ? $jitter/1000 : '-') . ",peer_stratum=$stratum\n"); | ||
| 18 | last; | ||
| 19 | } | ||
| 20 | } | ||
diff --git a/web/attachments/146297-check_http--more_perf_data.diff b/web/attachments/146297-check_http--more_perf_data.diff new file mode 100644 index 0000000..ffc3dba --- /dev/null +++ b/web/attachments/146297-check_http--more_perf_data.diff | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | --- check_http.c.orig 2005-08-19 10:38:29.000000000 -0500 | ||
| 2 | +++ check_http.c 2005-08-19 11:38:29.000000000 -0500 | ||
| 3 | @@ -20,8 +20,8 @@ | ||
| 4 | /* splint -I. -I../../plugins -I../../lib/ -I/usr/kerberos/include/ ../../plugins/check_http.c */ | ||
| 5 | |||
| 6 | const char *progname = "check_http"; | ||
| 7 | -const char *revision = "$Revision: 1.81 $"; | ||
| 8 | -const char *copyright = "1999-2004"; | ||
| 9 | +const char *revision = "$Revision: 1.9 $"; | ||
| 10 | +const char *copyright = "1999-2005"; | ||
| 11 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 12 | |||
| 13 | #include "common.h" | ||
| 14 | @@ -1356,20 +1356,20 @@ | ||
| 15 | stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min); | ||
| 16 | |||
| 17 | if (days_left > 0 && days_left <= days_till_exp) { | ||
| 18 | - printf (_("WARNING - Certificate expires in %d day(s) (%s).\n"), days_left, timestamp); | ||
| 19 | + printf (_("WARNING - Certificate expires in %d day(s) (%s). | cert_valid=1;1;2\n"), days_left, timestamp); | ||
| 20 | return STATE_WARNING; | ||
| 21 | } | ||
| 22 | if (days_left < 0) { | ||
| 23 | - printf (_("CRITICAL - Certificate expired on %s.\n"), timestamp); | ||
| 24 | + printf (_("CRITICAL - Certificate expired on %s. | cert_valid=2;1;2\n"), timestamp); | ||
| 25 | return STATE_CRITICAL; | ||
| 26 | } | ||
| 27 | |||
| 28 | if (days_left == 0) { | ||
| 29 | - printf (_("WARNING - Certificate expires today (%s).\n"), timestamp); | ||
| 30 | + printf (_("WARNING - Certificate expires today (%s). | cert_valid=1;1;2\n"), timestamp); | ||
| 31 | return STATE_WARNING; | ||
| 32 | } | ||
| 33 | |||
| 34 | - printf (_("OK - Certificate will expire on %s.\n"), timestamp); | ||
| 35 | + printf (_("OK - Certificate will expire on %s. | cert_valid=0;1;2\n"), timestamp); | ||
| 36 | |||
| 37 | return STATE_OK; | ||
| 38 | } | ||
diff --git a/web/attachments/146541-perl-path.patch b/web/attachments/146541-perl-path.patch new file mode 100644 index 0000000..35e1718 --- /dev/null +++ b/web/attachments/146541-perl-path.patch | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | --- plugins-scripts/subst.in.orig 2005-08-12 15:53:26.000000000 -0700 | ||
| 2 | +++ plugins-scripts/subst.in 2005-08-12 15:53:51.000000000 -0700 | ||
| 3 | @@ -1,24 +1,5 @@ | ||
| 4 | #!/usr/bin/awk | ||
| 5 | |||
| 6 | -function which(c,path) { | ||
| 7 | - cmd = "test -x " c; | ||
| 8 | - | ||
| 9 | - if (system(cmd)==0) { | ||
| 10 | - return c; | ||
| 11 | - } | ||
| 12 | - | ||
| 13 | - sub(/\/.*\//,"",c); | ||
| 14 | - for (dir in path) { | ||
| 15 | - cmd = "test -x " path[dir] "/" c; | ||
| 16 | - if (system(cmd)==0) { | ||
| 17 | - return path[dir] "/" c; | ||
| 18 | - } | ||
| 19 | - } | ||
| 20 | - | ||
| 21 | - | ||
| 22 | - return c; | ||
| 23 | -} | ||
| 24 | - | ||
| 25 | # used to replace "use lib utils.pm" with "use lib @libexecdir" | ||
| 26 | # | ||
| 27 | function led() { | ||
| 28 | @@ -58,15 +39,6 @@ | ||
| 29 | sub(/\=.*$/,"='@trusted_path@' # autoconf-derived"); | ||
| 30 | } | ||
| 31 | |||
| 32 | -# Specific programs | ||
| 33 | - | ||
| 34 | -# | ||
| 35 | -/^[^#]/ && /(\/.*)?\/(bin|sbin|lib|libexec)\// { | ||
| 36 | - match($0,/(\/.*)?\/(bin|sbin|lib|libexec)\/[-_a-zA-Z0-9]+/); | ||
| 37 | - start=RSTART+RLENGTH; | ||
| 38 | - c=substr($0,RSTART,RLENGTH); | ||
| 39 | - sub(c,which(c,path)); | ||
| 40 | -} | ||
| 41 | |||
| 42 | { | ||
| 43 | print; | ||
diff --git a/web/attachments/146722-check_ifoperstatus_cache.diff b/web/attachments/146722-check_ifoperstatus_cache.diff new file mode 100644 index 0000000..b0e2ae9 --- /dev/null +++ b/web/attachments/146722-check_ifoperstatus_cache.diff | |||
| @@ -0,0 +1,245 @@ | |||
| 1 | *** check_ifoperstatus.orig 2005-08-19 17:45:13.000000000 -0400 | ||
| 2 | --- check_ifoperstatus 2005-08-23 16:32:12.000000000 -0400 | ||
| 3 | *************** my $community = "public"; | ||
| 4 | *** 64,78 **** | ||
| 5 | my $maxmsgsize = 1472 ; # Net::SNMP default is 1472 | ||
| 6 | my ($seclevel, $authproto, $secname, $authpass, $privpass, $auth, $priv, $context); | ||
| 7 | my $port = 161; | ||
| 8 | - my @snmpoids; | ||
| 9 | my $sysUptime = '1.3.6.1.2.1.1.3.0'; | ||
| 10 | my $snmpIfDescr = '1.3.6.1.2.1.2.2.1.2'; | ||
| 11 | my $snmpIfAdminStatus = '1.3.6.1.2.1.2.2.1.7'; | ||
| 12 | my $snmpIfOperStatus = '1.3.6.1.2.1.2.2.1.8'; | ||
| 13 | my $snmpIfName = '1.3.6.1.2.1.31.1.1.1.1'; | ||
| 14 | my $snmpIfLastChange = '1.3.6.1.2.1.2.2.1.9'; | ||
| 15 | my $snmpIfAlias = '1.3.6.1.2.1.31.1.1.1.18'; | ||
| 16 | my $snmpLocIfDescr = '1.3.6.1.4.1.9.2.2.1.1.28'; | ||
| 17 | my $hostname; | ||
| 18 | my $ifName; | ||
| 19 | my $session; | ||
| 20 | --- 64,84 ---- | ||
| 21 | my $maxmsgsize = 1472 ; # Net::SNMP default is 1472 | ||
| 22 | my ($seclevel, $authproto, $secname, $authpass, $privpass, $auth, $priv, $context); | ||
| 23 | my $port = 161; | ||
| 24 | my $sysUptime = '1.3.6.1.2.1.1.3.0'; | ||
| 25 | my $snmpIfDescr = '1.3.6.1.2.1.2.2.1.2'; | ||
| 26 | + my $snmpIfDescrOid = $snmpIfDescr; | ||
| 27 | my $snmpIfAdminStatus = '1.3.6.1.2.1.2.2.1.7'; | ||
| 28 | + my $snmpIfAdminStatusOid = $snmpIfAdminStatus; | ||
| 29 | my $snmpIfOperStatus = '1.3.6.1.2.1.2.2.1.8'; | ||
| 30 | + my $snmpIfOperStatusOid = $snmpIfOperStatus; | ||
| 31 | my $snmpIfName = '1.3.6.1.2.1.31.1.1.1.1'; | ||
| 32 | + my $snmpIfNameOid = $snmpIfName; | ||
| 33 | my $snmpIfLastChange = '1.3.6.1.2.1.2.2.1.9'; | ||
| 34 | + my $snmpIfLastChangeOid = $snmpIfLastChange; | ||
| 35 | my $snmpIfAlias = '1.3.6.1.2.1.31.1.1.1.18'; | ||
| 36 | + my $snmpIfAliasOid = $snmpIfAlias; | ||
| 37 | my $snmpLocIfDescr = '1.3.6.1.4.1.9.2.2.1.1.28'; | ||
| 38 | + my $snmpLocIfDescrOid = $snmpLocIfDescr; | ||
| 39 | my $hostname; | ||
| 40 | my $ifName; | ||
| 41 | my $session; | ||
| 42 | *************** my $lastc; | ||
| 43 | *** 88,93 **** | ||
| 44 | --- 94,101 ---- | ||
| 45 | my $dormantWarn; | ||
| 46 | my $adminWarn; | ||
| 47 | my $name; | ||
| 48 | + my $cacheFileChecked = 0; | ||
| 49 | + my $cacheFileName = '/tmp/interface_cache.db'; | ||
| 50 | |||
| 51 | ### Validate Arguments | ||
| 52 | |||
| 53 | *************** alarm($timeout); | ||
| 54 | *** 106,114 **** | ||
| 55 | ## map ifdescr to ifindex - should look at being able to cache this value | ||
| 56 | |||
| 57 | if (defined $ifdescr) { | ||
| 58 | - # escape "/" in ifdescr - very common in the Cisco world | ||
| 59 | - $ifdescr =~ s/\//\\\//g; | ||
| 60 | - | ||
| 61 | $status=fetch_ifdescr(); # if using on device with large number of interfaces | ||
| 62 | # recommend use of SNMP v2 (get-bulk) | ||
| 63 | if ($status==0) { | ||
| 64 | --- 114,119 ---- | ||
| 65 | *************** if (defined $ifdescr) { | ||
| 66 | *** 122,155 **** | ||
| 67 | |||
| 68 | ## Main function | ||
| 69 | |||
| 70 | ! $snmpIfAdminStatus = $snmpIfAdminStatus . "." . $snmpkey; | ||
| 71 | ! $snmpIfOperStatus = $snmpIfOperStatus . "." . $snmpkey; | ||
| 72 | ! $snmpIfDescr = $snmpIfDescr . "." . $snmpkey; | ||
| 73 | ! $snmpIfName = $snmpIfName . "." . $snmpkey ; | ||
| 74 | ! $snmpIfAlias = $snmpIfAlias . "." . $snmpkey ; | ||
| 75 | ! | ||
| 76 | ! push(@snmpoids,$snmpIfAdminStatus); | ||
| 77 | ! push(@snmpoids,$snmpIfOperStatus); | ||
| 78 | ! push(@snmpoids,$snmpIfDescr); | ||
| 79 | ! push(@snmpoids,$snmpIfName) if (defined $ifXTable) ; | ||
| 80 | ! push(@snmpoids,$snmpIfAlias) if (defined $ifXTable) ; | ||
| 81 | |||
| 82 | ! if (!defined($response = $session->get_request(@snmpoids))) { | ||
| 83 | ! $answer=$session->error; | ||
| 84 | ! $session->close; | ||
| 85 | ! $state = 'WARNING'; | ||
| 86 | ! print ("$state: SNMP error: $answer\n"); | ||
| 87 | ! exit $ERRORS{$state}; | ||
| 88 | } | ||
| 89 | |||
| 90 | - $answer = sprintf("host '%s', %s(%s) is %s\n", | ||
| 91 | - $hostname, | ||
| 92 | - $response->{$snmpIfDescr}, | ||
| 93 | - $snmpkey, | ||
| 94 | - $ifOperStatus{$response->{$snmpIfOperStatus}} | ||
| 95 | - ); | ||
| 96 | - | ||
| 97 | - | ||
| 98 | ## Check to see if ifName match is requested and it matches - exit if no match | ||
| 99 | ## not the interface we want to monitor | ||
| 100 | if ( defined $name && not ($response->{$snmpIfName} eq $name) ) { | ||
| 101 | --- 127,145 ---- | ||
| 102 | |||
| 103 | ## Main function | ||
| 104 | |||
| 105 | ! # moved fetching of information to function to allow it to be recalled if | ||
| 106 | ! # bad snmpkey in cache file | ||
| 107 | |||
| 108 | ! fetch_data(); | ||
| 109 | ! # If using ifDescr check to make sure database didn't return | ||
| 110 | ! # stale snmpkey | ||
| 111 | ! if (defined $ifdescr) { | ||
| 112 | ! if ($response->{$snmpIfDescr} ne $ifdescr) { | ||
| 113 | ! fetch_ifdescr(); | ||
| 114 | ! fetch_data(); | ||
| 115 | ! } | ||
| 116 | } | ||
| 117 | |||
| 118 | ## Check to see if ifName match is requested and it matches - exit if no match | ||
| 119 | ## not the interface we want to monitor | ||
| 120 | if ( defined $name && not ($response->{$snmpIfName} eq $name) ) { | ||
| 121 | *************** exit $ERRORS{$state}; | ||
| 122 | *** 225,232 **** | ||
| 123 | |||
| 124 | ### subroutines | ||
| 125 | |||
| 126 | sub fetch_ifdescr { | ||
| 127 | ! if (!defined ($response = $session->get_table($snmpIfDescr))) { | ||
| 128 | $answer=$session->error; | ||
| 129 | $session->close; | ||
| 130 | $state = 'CRITICAL'; | ||
| 131 | --- 215,270 ---- | ||
| 132 | |||
| 133 | ### subroutines | ||
| 134 | |||
| 135 | + sub fetch_data { | ||
| 136 | + my @snmpoids; | ||
| 137 | + | ||
| 138 | + $snmpIfAdminStatus = $snmpIfAdminStatusOid . "." . $snmpkey; | ||
| 139 | + $snmpIfOperStatus = $snmpIfOperStatusOid . "." . $snmpkey; | ||
| 140 | + $snmpIfDescr = $snmpIfDescrOid . "." . $snmpkey; | ||
| 141 | + $snmpIfName = $snmpIfNameOid . "." . $snmpkey ; | ||
| 142 | + $snmpIfAlias = $snmpIfAliasOid . "." . $snmpkey ; | ||
| 143 | + | ||
| 144 | + push(@snmpoids,$snmpIfAdminStatus); | ||
| 145 | + push(@snmpoids,$snmpIfOperStatus); | ||
| 146 | + push(@snmpoids,$snmpIfDescr); | ||
| 147 | + push(@snmpoids,$snmpIfName) if (defined $ifXTable) ; | ||
| 148 | + push(@snmpoids,$snmpIfAlias) if (defined $ifXTable) ; | ||
| 149 | + | ||
| 150 | + if (!defined($response = $session->get_request(@snmpoids))) { | ||
| 151 | + $answer=$session->error; | ||
| 152 | + $session->close; | ||
| 153 | + $state = 'WARNING'; | ||
| 154 | + print ("$state: SNMP error: $answer\n"); | ||
| 155 | + exit $ERRORS{$state}; | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + $answer = sprintf("host '%s', %s(%s) is %s\n", | ||
| 159 | + $hostname, | ||
| 160 | + $response->{$snmpIfDescr}, | ||
| 161 | + $snmpkey, | ||
| 162 | + $ifOperStatus{$response->{$snmpIfOperStatus}} | ||
| 163 | + ); | ||
| 164 | + } | ||
| 165 | + | ||
| 166 | sub fetch_ifdescr { | ||
| 167 | ! my %intcache; | ||
| 168 | ! dbmopen %intcache, $cacheFileName, 0600 or exit $ERRORS{'CRITICAL'}; | ||
| 169 | ! | ||
| 170 | ! # check if we already checked cache file | ||
| 171 | ! if (!$cacheFileChecked) { | ||
| 172 | ! # check cache file for interface information, if exists use | ||
| 173 | ! # if not then update cache file for the entire host looking | ||
| 174 | ! # for this interface | ||
| 175 | ! | ||
| 176 | ! $cacheFileChecked = 1; | ||
| 177 | ! if (exists $intcache{$hostname.$ifdescr}) { | ||
| 178 | ! $snmpkey = $intcache{$hostname.$ifdescr}; | ||
| 179 | ! dbmclose %intcache; | ||
| 180 | ! return $snmpkey; | ||
| 181 | ! } | ||
| 182 | ! } | ||
| 183 | ! | ||
| 184 | ! if (!defined ($response = $session->get_table($snmpIfDescrOid))) { | ||
| 185 | $answer=$session->error; | ||
| 186 | $session->close; | ||
| 187 | $state = 'CRITICAL'; | ||
| 188 | *************** sub fetch_ifdescr { | ||
| 189 | *** 235,246 **** | ||
| 190 | exit $ERRORS{$state}; | ||
| 191 | } | ||
| 192 | |||
| 193 | foreach $key ( keys %{$response}) { | ||
| 194 | if ($response->{$key} =~ /^$ifdescr$/) { | ||
| 195 | ! $key =~ /.*\.(\d+)$/; | ||
| 196 | ! $snmpkey = $1; | ||
| 197 | #print "$ifdescr = $key / $snmpkey \n"; #debug | ||
| 198 | } | ||
| 199 | } | ||
| 200 | unless (defined $snmpkey) { | ||
| 201 | $session->close; | ||
| 202 | --- 273,297 ---- | ||
| 203 | exit $ERRORS{$state}; | ||
| 204 | } | ||
| 205 | |||
| 206 | + # snmpwalk succesful, empty cache file for this host | ||
| 207 | + # TODO: empty cache file for host | ||
| 208 | + | ||
| 209 | + # escape "/" in ifdescr - very common in the Cisco world | ||
| 210 | + $ifdescr =~ s/\//\\\//g; | ||
| 211 | + | ||
| 212 | foreach $key ( keys %{$response}) { | ||
| 213 | + $key =~ /.*\.(\d+)$/; | ||
| 214 | + my $cursnmpkey = $1; | ||
| 215 | + | ||
| 216 | if ($response->{$key} =~ /^$ifdescr$/) { | ||
| 217 | ! #$key =~ /.*\.(\d+)$/; | ||
| 218 | ! #$snmpkey = $1; | ||
| 219 | ! $snmpkey = $cursnmpkey; | ||
| 220 | #print "$ifdescr = $key / $snmpkey \n"; #debug | ||
| 221 | } | ||
| 222 | + | ||
| 223 | + # for each interface update cache file | ||
| 224 | + $intcache{$hostname.$response->{$key}} = $cursnmpkey; | ||
| 225 | } | ||
| 226 | unless (defined $snmpkey) { | ||
| 227 | $session->close; | ||
| 228 | *************** sub fetch_ifdescr { | ||
| 229 | *** 248,254 **** | ||
| 230 | printf "$state: Could not match $ifdescr on $hostname\n"; | ||
| 231 | exit $ERRORS{$state}; | ||
| 232 | } | ||
| 233 | ! | ||
| 234 | return $snmpkey; | ||
| 235 | } | ||
| 236 | |||
| 237 | --- 299,306 ---- | ||
| 238 | printf "$state: Could not match $ifdescr on $hostname\n"; | ||
| 239 | exit $ERRORS{$state}; | ||
| 240 | } | ||
| 241 | ! | ||
| 242 | ! dbmclose %intcache; | ||
| 243 | return $snmpkey; | ||
| 244 | } | ||
| 245 | |||
diff --git a/web/attachments/146863-check_http.c.patch b/web/attachments/146863-check_http.c.patch new file mode 100644 index 0000000..7f340bd --- /dev/null +++ b/web/attachments/146863-check_http.c.patch | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | --- check_http.c 2005-08-24 16:08:32.000000000 -0700 | ||
| 2 | +++ check_http.c.patched 2005-08-24 16:08:42.000000000 -0700 | ||
| 3 | @@ -173,6 +173,9 @@ | ||
| 4 | if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) { | ||
| 5 | result = check_certificate (&server_cert); | ||
| 6 | X509_free (server_cert); | ||
| 7 | + if (result == STATE_OK) { | ||
| 8 | + result = check_http (); | ||
| 9 | + } | ||
| 10 | } | ||
| 11 | else { | ||
| 12 | printf (_("CRITICAL - Cannot retrieve server certificate.\n")); | ||
| 13 | @@ -1369,8 +1372,6 @@ | ||
| 14 | return STATE_WARNING; | ||
| 15 | } | ||
| 16 | |||
| 17 | - printf (_("OK - Certificate will expire on %s.\n"), timestamp); | ||
| 18 | - | ||
| 19 | return STATE_OK; | ||
| 20 | } | ||
| 21 | #endif | ||
| 22 | @@ -1472,8 +1473,7 @@ | ||
| 23 | -S, --ssl\n\ | ||
| 24 | Connect via SSL\n\ | ||
| 25 | -C, --certificate=INTEGER\n\ | ||
| 26 | - Minimum number of days a certificate has to be valid.\n\ | ||
| 27 | - (when this option is used the url is not checked.)\n")); | ||
| 28 | + Minimum number of days a certificate has to be valid.\n")); | ||
| 29 | #endif | ||
| 30 | |||
| 31 | printf (_("\ \ No newline at end of file | ||
diff --git a/web/attachments/147630-check_mysqlhealth.pl b/web/attachments/147630-check_mysqlhealth.pl new file mode 100644 index 0000000..f0391d5 --- /dev/null +++ b/web/attachments/147630-check_mysqlhealth.pl | |||
| @@ -0,0 +1,159 @@ | |||
| 1 | #!/usr/bin/perl | ||
| 2 | # -- | ||
| 3 | # Check the health of a mysql server. | ||
| 4 | # | ||
| 5 | # @author Peter Romianowski / optivo GmbH | ||
| 6 | # @version 1.0 2005-08-31 | ||
| 7 | # -- | ||
| 8 | use Getopt::Long; | ||
| 9 | use DBI; | ||
| 10 | |||
| 11 | # -- | ||
| 12 | # Print out the usage message | ||
| 13 | # -- | ||
| 14 | sub usage { | ||
| 15 | print "usage: check_mysqlhealth.pl -H <host> -u <user> -p <password> \n"; | ||
| 16 | print " Optional parameters:\n"; | ||
| 17 | print " --port <port> \n"; | ||
| 18 | print " --Cc <critical number of connections> \n"; | ||
| 19 | print " --Wc <warning number of connections> \n"; | ||
| 20 | print " --Ca <critical number of ACTIVE connections> \n"; | ||
| 21 | print " --Wa <warning number of ACTIVE connections> \n"; | ||
| 22 | print " --sql <an sql statement that will be executed and that must return at least one row>\n"; | ||
| 23 | } | ||
| 24 | |||
| 25 | $|=1; | ||
| 26 | |||
| 27 | # -- | ||
| 28 | # Parse arguments and read Configuration | ||
| 29 | # -- | ||
| 30 | my ($host, $user, $password, $port, $criticalConnections, $warningConnections, $criticalActive, $warningActive, $sql); | ||
| 31 | GetOptions ( | ||
| 32 | 'host=s' => \$host, | ||
| 33 | 'H=s' => \$host, | ||
| 34 | 'user=s' => \$user, | ||
| 35 | 'u=s' => \$user, | ||
| 36 | 'password=s' => \$password, | ||
| 37 | 'p:s' => \$password, | ||
| 38 | 'port=i' => \$port, | ||
| 39 | 'Cc=i' => \$criticalConnections, | ||
| 40 | 'Wc=i' => \$warningConnections, | ||
| 41 | 'Ca=i' => \$criticalActive, | ||
| 42 | 'Wa=i' => \$warningActive, | ||
| 43 | 'sql=s'=> \$sql | ||
| 44 | ); | ||
| 45 | |||
| 46 | if (!$host || !$user) { | ||
| 47 | usage(); | ||
| 48 | exit(1); | ||
| 49 | } | ||
| 50 | |||
| 51 | if (!$port) { | ||
| 52 | $port = 3306; | ||
| 53 | } | ||
| 54 | |||
| 55 | my $totalTime = time(); | ||
| 56 | |||
| 57 | # -- | ||
| 58 | # Establish connection | ||
| 59 | # -- | ||
| 60 | my $state = "OK"; | ||
| 61 | my $dbh; | ||
| 62 | eval { | ||
| 63 | $dbh = DBI->connect("DBI:mysql:host=$host;port=$port", $user, $password, {'RaiseError' => 1}); | ||
| 64 | }; | ||
| 65 | |||
| 66 | if ($@) { | ||
| 67 | my $status = $@; | ||
| 68 | print 'CRITICAL: Connect failed with reason ' . $status . "\n"; | ||
| 69 | exit 2; | ||
| 70 | } | ||
| 71 | |||
| 72 | # -- | ||
| 73 | # Count active statements | ||
| 74 | # -- | ||
| 75 | my $connections = 0; | ||
| 76 | my $active = 0; | ||
| 77 | |||
| 78 | eval { | ||
| 79 | my $sth = $dbh->prepare("SHOW PROCESSLIST"); | ||
| 80 | $sth->execute(); | ||
| 81 | my $row; | ||
| 82 | do { | ||
| 83 | $row = $sth->fetchrow_hashref(); | ||
| 84 | if ($row) { | ||
| 85 | if (!($row->{'Command'} =~ /Sleep/)) { | ||
| 86 | $active++; | ||
| 87 | } | ||
| 88 | $connections++; | ||
| 89 | } | ||
| 90 | |||
| 91 | } while ($row); | ||
| 92 | }; | ||
| 93 | |||
| 94 | if ($@) { | ||
| 95 | my $status = $@; | ||
| 96 | print 'CRITICAL: Error executing SHOW PROCESSLIST, reason ' . $status . "\n"; | ||
| 97 | exit 2; | ||
| 98 | } | ||
| 99 | |||
| 100 | # -- | ||
| 101 | # Execute optional sql statement if given | ||
| 102 | # -- | ||
| 103 | $sqlResult; | ||
| 104 | if ($sql) { | ||
| 105 | eval { | ||
| 106 | my $sth = $dbh->prepare($sql); | ||
| 107 | $sth->execute(); | ||
| 108 | my @row = $sth->fetchrow(); | ||
| 109 | if (@row) { | ||
| 110 | $sqlResult = join('|', @row); | ||
| 111 | } | ||
| 112 | }; | ||
| 113 | |||
| 114 | if ($@) { | ||
| 115 | my $status = $@; | ||
| 116 | print 'CRITICAL: Error executing statement "' . $sql . '", reason ' . $status . "\n"; | ||
| 117 | exit 2; | ||
| 118 | } | ||
| 119 | |||
| 120 | } | ||
| 121 | |||
| 122 | # -- | ||
| 123 | # Cleanup resources | ||
| 124 | # -- | ||
| 125 | $dbh->disconnect(); | ||
| 126 | |||
| 127 | # -- | ||
| 128 | # Check | ||
| 129 | # -- | ||
| 130 | my $statusString = "$connections connections, $active active connections"; | ||
| 131 | if ($criticalConnections && $criticalConnections < $connections) { | ||
| 132 | print "CRITICAL: Number of connections higher than $criticalConnections ($statusString)\n"; | ||
| 133 | exit 2; | ||
| 134 | } | ||
| 135 | if ($criticalActive && $criticalActive < $active) { | ||
| 136 | print "CRITICAL: Number of ACTIVE connections higher than $criticalActive ($statusString)\n"; | ||
| 137 | exit 2; | ||
| 138 | } | ||
| 139 | if ($warningConnections && $warningConnections < $connections) { | ||
| 140 | print "WARNING: Number of connections higher than $warningConnections ($statusString)\n"; | ||
| 141 | exit 1; | ||
| 142 | } | ||
| 143 | if ($warningActive && $warningActive < $active) { | ||
| 144 | print "WARNING: Number of ACTIVE connections higher than $warningActive ($statusString)\n"; | ||
| 145 | exit 1; | ||
| 146 | } | ||
| 147 | if ($sql) { | ||
| 148 | if ($sqlResult) { | ||
| 149 | $statusString = "Statement '$sql' returned: '$sqlResult', $statusString"; | ||
| 150 | } else { | ||
| 151 | print "CRITICAL: Execution of statement '$sql' did not produce any result ($statusString)\n"; | ||
| 152 | exit 2; | ||
| 153 | } | ||
| 154 | } | ||
| 155 | |||
| 156 | print "OK: $statusString\n"; | ||
| 157 | exit 0; | ||
| 158 | |||
| 159 | |||
diff --git a/web/attachments/148122-waitpid.patch b/web/attachments/148122-waitpid.patch new file mode 100644 index 0000000..dc6c06a --- /dev/null +++ b/web/attachments/148122-waitpid.patch | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | --- nagios-plugins-1.4.1/plugins/popen.c.orig 2005-09-05 14:02:00.314775817 +0200 | ||
| 2 | +++ nagios-plugins-1.4.1/plugins/popen.c 2005-09-05 14:16:21.427287267 +0200 | ||
| 3 | @@ -30,6 +30,7 @@ | ||
| 4 | |||
| 5 | FILE *spopen (const char *); | ||
| 6 | int spclose (FILE *); | ||
| 7 | +static RETSIGTYPE popen_sigchld_handler (int); | ||
| 8 | RETSIGTYPE popen_timeout_alarm_handler (int); | ||
| 9 | |||
| 10 | #include <stdarg.h> /* ANSI C header file */ | ||
| 11 | @@ -66,6 +67,7 @@ | ||
| 12 | /*int *childerr = NULL;*//* ptr to array allocated at run-time */ | ||
| 13 | /*extern pid_t *childpid = NULL; *//* ptr to array allocated at run-time */ | ||
| 14 | static int maxfd; /* from our open_max(), {Prog openmax} */ | ||
| 15 | +static volatile int childtermd = 0; /* set by SIGCHLD handler */ | ||
| 16 | |||
| 17 | FILE * | ||
| 18 | spopen (const char *cmdstring) | ||
| 19 | @@ -171,6 +173,10 @@ | ||
| 20 | if (pipe (pfderr) < 0) | ||
| 21 | return (NULL); /* errno set by pipe() */ | ||
| 22 | |||
| 23 | + if (signal (SIGCHLD, popen_sigchld_handler) == SIG_ERR) { | ||
| 24 | + usage4 (_("Cannot catch SIGCHLD")); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | if ((pid = fork ()) < 0) | ||
| 28 | return (NULL); /* errno set by fork() */ | ||
| 29 | else if (pid == 0) { /* child */ | ||
| 30 | @@ -220,6 +226,8 @@ | ||
| 31 | if (fclose (fp) == EOF) | ||
| 32 | return (1); | ||
| 33 | |||
| 34 | + while (!childtermd); /* wait until SIGCHLD */ | ||
| 35 | + | ||
| 36 | while (waitpid (pid, &status, 0) < 0) | ||
| 37 | if (errno != EINTR) | ||
| 38 | return (1); /* error other than EINTR from waitpid() */ | ||
| 39 | @@ -239,8 +247,14 @@ | ||
| 40 | #define OPEN_MAX_GUESS 256 /* if OPEN_MAX is indeterminate */ | ||
| 41 | /* no guarantee this is adequate */ | ||
| 42 | |||
| 43 | +static RETSIGTYPE | ||
| 44 | +popen_sigchld_handler (int signo) | ||
| 45 | +{ | ||
| 46 | + if (signo == SIGCHLD) | ||
| 47 | + childtermd = 1; | ||
| 48 | +} | ||
| 49 | |||
| 50 | -void | ||
| 51 | +RETSIGTYPE | ||
| 52 | popen_timeout_alarm_handler (int signo) | ||
| 53 | { | ||
| 54 | int fh; | ||
diff --git a/web/attachments/148408-check_dhcp.c.diff b/web/attachments/148408-check_dhcp.c.diff new file mode 100644 index 0000000..bd24891 --- /dev/null +++ b/web/attachments/148408-check_dhcp.c.diff | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | --- check_dhcp.c.orig 2005-09-07 12:33:44.000000000 -0700 | ||
| 2 | +++ check_dhcp.c 2005-09-07 15:35:26.000000000 -0700 | ||
| 3 | @@ -157,6 +157,7 @@ | ||
| 4 | |||
| 5 | typedef struct requested_server_struct{ | ||
| 6 | struct in_addr server_address; | ||
| 7 | + int answered; | ||
| 8 | struct requested_server_struct *next; | ||
| 9 | }requested_server; | ||
| 10 | |||
| 11 | @@ -479,6 +480,7 @@ | ||
| 12 | int get_dhcp_offer(int sock){ | ||
| 13 | dhcp_packet offer_packet; | ||
| 14 | struct sockaddr_in source; | ||
| 15 | + struct sockaddr_in via; | ||
| 16 | int result=OK; | ||
| 17 | int timeout=1; | ||
| 18 | int responses=0; | ||
| 19 | @@ -499,6 +501,7 @@ | ||
| 20 | printf("\n\n"); | ||
| 21 | |||
| 22 | bzero(&source,sizeof(source)); | ||
| 23 | + bzero(&via,sizeof(via)); | ||
| 24 | bzero(&offer_packet,sizeof(offer_packet)); | ||
| 25 | |||
| 26 | result=OK; | ||
| 27 | @@ -516,9 +519,18 @@ | ||
| 28 | |||
| 29 | responses++; | ||
| 30 | } | ||
| 31 | + /* The "source" is either a server or a relay. */ | ||
| 32 | + /* Save a copy of "source" into "via" even if it's via itself */ | ||
| 33 | + memcpy(&via,&source,sizeof(source)) ; | ||
| 34 | + | ||
| 35 | + /* If siaddr is non-zero, set "source" to siaddr */ | ||
| 36 | + if (offer_packet.siaddr.s_addr != 0L) { | ||
| 37 | + source.sin_addr.s_addr = offer_packet.siaddr.s_addr ; | ||
| 38 | + } | ||
| 39 | |||
| 40 | if (verbose) { | ||
| 41 | - printf(_("DHCPOFFER from IP address %s\n"),inet_ntoa(source.sin_addr)); | ||
| 42 | + printf(_("DHCPOFFER from IP address %s"),inet_ntoa(source.sin_addr)); | ||
| 43 | + printf(_(" via %s\n"),inet_ntoa(via.sin_addr)); | ||
| 44 | printf("DHCPOFFER XID: %lu (0x%X)\n",ntohl(offer_packet.xid),ntohl(offer_packet.xid)); | ||
| 45 | } | ||
| 46 | |||
| 47 | @@ -727,6 +739,7 @@ | ||
| 48 | return ERROR; | ||
| 49 | |||
| 50 | new_server->server_address=server_address; | ||
| 51 | + new_server->answered=FALSE; | ||
| 52 | |||
| 53 | new_server->next=requested_server_list; | ||
| 54 | requested_server_list=new_server; | ||
| 55 | @@ -887,9 +900,17 @@ | ||
| 56 | if(!memcmp(&temp_offer->server_address,&temp_server->server_address,sizeof(temp_server->server_address))){ | ||
| 57 | if (verbose) { | ||
| 58 | printf(_("DHCP Server Match: Offerer=%s"),inet_ntoa(temp_offer->server_address)); | ||
| 59 | - printf(_(" Requested=%s\n"),inet_ntoa(temp_server->server_address)); | ||
| 60 | + printf(_(" Requested=%s"),inet_ntoa(temp_server->server_address)); | ||
| 61 | + if (temp_server->answered) | ||
| 62 | + printf(_(" (duplicate)")); | ||
| 63 | + | ||
| 64 | + printf(_("\n")); | ||
| 65 | } | ||
| 66 | - requested_responses++; | ||
| 67 | + if (temp_server->answered == FALSE){ | ||
| 68 | + requested_responses++; | ||
| 69 | + temp_server->answered=TRUE; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | } | ||
| 73 | } | ||
| 74 | } | ||
diff --git a/web/attachments/148493-check_dhcp--standardize.diff b/web/attachments/148493-check_dhcp--standardize.diff new file mode 100644 index 0000000..4e79f46 --- /dev/null +++ b/web/attachments/148493-check_dhcp--standardize.diff | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | --- check_dhcp.c.orig 2005-09-08 11:27:25.000000000 -0500 | ||
| 2 | +++ check_dhcp.c 2005-09-08 12:55:15.000000000 -0500 | ||
| 3 | @@ -27,7 +27,7 @@ | ||
| 4 | *****************************************************************************/ | ||
| 5 | |||
| 6 | const char *progname = "check_dhcp"; | ||
| 7 | -const char *revision = "$Revision: 1.7 $"; | ||
| 8 | +const char *revision = "$Revision: 1.8 $"; | ||
| 9 | const char *copyright = "2001-2004"; | ||
| 10 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 11 | |||
| 12 | @@ -106,11 +106,6 @@ | ||
| 13 | |||
| 14 | /**** Common definitions ****/ | ||
| 15 | |||
| 16 | -#define STATE_OK 0 | ||
| 17 | -#define STATE_WARNING 1 | ||
| 18 | -#define STATE_CRITICAL 2 | ||
| 19 | -#define STATE_UNKNOWN -1 | ||
| 20 | - | ||
| 21 | #define OK 0 | ||
| 22 | #define ERROR -1 | ||
| 23 | |||
| 24 | @@ -241,7 +236,7 @@ | ||
| 25 | |||
| 26 | int main(int argc, char **argv){ | ||
| 27 | int dhcp_socket; | ||
| 28 | - int result; | ||
| 29 | + int result = STATE_UNKNOWN; | ||
| 30 | |||
| 31 | setlocale (LC_ALL, ""); | ||
| 32 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 33 | @@ -921,8 +916,14 @@ | ||
| 34 | else if(request_specific_address==TRUE && received_requested_address==FALSE) | ||
| 35 | result=STATE_WARNING; | ||
| 36 | |||
| 37 | - | ||
| 38 | - printf("DHCP %s: ",(result==STATE_OK)?"ok":"problem"); | ||
| 39 | + if(result==0) /* garrett honeycutt 2005 */ | ||
| 40 | + printf("OK: "); | ||
| 41 | + else if(result==1) | ||
| 42 | + printf("WARNING: "); | ||
| 43 | + else if(result==2) | ||
| 44 | + printf("CRITICAL: "); | ||
| 45 | + else if(result==3) | ||
| 46 | + printf("UNKNOWN: "); | ||
| 47 | |||
| 48 | /* we didn't receive any DHCPOFFERs */ | ||
| 49 | if(dhcp_offer_list==NULL){ | ||
diff --git a/web/attachments/148805-check_dhcp--standardize.diff b/web/attachments/148805-check_dhcp--standardize.diff new file mode 100644 index 0000000..3a8a6a2 --- /dev/null +++ b/web/attachments/148805-check_dhcp--standardize.diff | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-5 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378821534" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378821534" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378821534" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378821534" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378821534'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1288725&group_id=29880&atid=397599&file_id=148805" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/149090-pst3.c b/web/attachments/149090-pst3.c new file mode 100644 index 0000000..3817819 --- /dev/null +++ b/web/attachments/149090-pst3.c | |||
| @@ -0,0 +1,252 @@ | |||
| 1 | /* pst3.c | ||
| 2 | * | ||
| 3 | * Third version to get process arg info; this time by using | ||
| 4 | * a combination of reading the /proc/<pid>/psinfo structures | ||
| 5 | * and reading the complete arg vector from kernel memory structures. | ||
| 6 | * | ||
| 7 | * Developed and tested under Solaris 5.8 (both 32 and 64 bit modes). | ||
| 8 | * | ||
| 9 | * NOTE: This program must be setuid-root (or run by root) to work! | ||
| 10 | * | ||
| 11 | * Written: 2005-04-28 R.W.Ingraham | ||
| 12 | */ | ||
| 13 | |||
| 14 | |||
| 15 | #define _KMEMUSER 1 | ||
| 16 | |||
| 17 | #include <kvm.h> | ||
| 18 | #include <sys/param.h> | ||
| 19 | #include <sys/user.h> | ||
| 20 | #include <sys/time.h> | ||
| 21 | #include <sys/proc.h> | ||
| 22 | #include <sys/types.h> | ||
| 23 | #include <sys/stat.h> | ||
| 24 | #include <stdio.h> | ||
| 25 | #include <stdlib.h> | ||
| 26 | #include <unistd.h> | ||
| 27 | #include <string.h> | ||
| 28 | #include <procfs.h> | ||
| 29 | #include <fcntl.h> | ||
| 30 | #include <dirent.h> | ||
| 31 | #include <errno.h> | ||
| 32 | |||
| 33 | |||
| 34 | /* | ||
| 35 | * Constants | ||
| 36 | */ | ||
| 37 | |||
| 38 | #define PROC_DIR "/proc" | ||
| 39 | #define MAX_PATH 1024 | ||
| 40 | |||
| 41 | |||
| 42 | /* | ||
| 43 | * Structures | ||
| 44 | */ | ||
| 45 | |||
| 46 | |||
| 47 | /* | ||
| 48 | * Globals | ||
| 49 | */ | ||
| 50 | |||
| 51 | static char * szProg; | ||
| 52 | static kvm_t * kd; | ||
| 53 | static struct proc * pProc; | ||
| 54 | static struct user * pUser; | ||
| 55 | static char ** myArgv; | ||
| 56 | |||
| 57 | |||
| 58 | /* | ||
| 59 | * Prototypes | ||
| 60 | */ | ||
| 61 | |||
| 62 | static int HandleFile (struct dirent *pDent); | ||
| 63 | static int HandlePsInfo (char *szPath, psinfo_t *pPsInfo); | ||
| 64 | static int GetArgVectors (pid_t pid); | ||
| 65 | static void ShowArgVectors (void); | ||
| 66 | static void ReleaseArgVectors(); | ||
| 67 | |||
| 68 | |||
| 69 | /*----------------------------------------------------------------------------*/ | ||
| 70 | |||
| 71 | int main (int argc, char **argv) | ||
| 72 | { | ||
| 73 | DIR *pDir; | ||
| 74 | struct dirent *pDent; | ||
| 75 | int retcode = 0; | ||
| 76 | |||
| 77 | |||
| 78 | /* Set our program name global */ | ||
| 79 | if ((szProg = strrchr(argv[0], '/')) != NULL) | ||
| 80 | szProg++; | ||
| 81 | else | ||
| 82 | szProg = argv[0]; | ||
| 83 | |||
| 84 | /* Make sure that our euid is root */ | ||
| 85 | if (geteuid() != 0) | ||
| 86 | { | ||
| 87 | fprintf(stderr, "%s: This program can only be run by the root user!\n", szProg); | ||
| 88 | exit(1); | ||
| 89 | } | ||
| 90 | |||
| 91 | /* Get a handle to the running kernel image */ | ||
| 92 | if ((kd = kvm_open(NULL, NULL, NULL, O_RDONLY, argv[0])) == NULL) | ||
| 93 | { | ||
| 94 | fprintf(stderr, "%s: Failed to open kernel memory: %s\n", szProg, strerror(errno)); | ||
| 95 | exit(2); | ||
| 96 | } | ||
| 97 | |||
| 98 | /* Open the /proc directory */ | ||
| 99 | if ((pDir = opendir(PROC_DIR)) != NULL) | ||
| 100 | { | ||
| 101 | /* Display column headings */ | ||
| 102 | printf("S UID PPID VSZ RSS %%CPU COMMAND ARGS\n"); | ||
| 103 | |||
| 104 | /* Zip through all of the process entries */ | ||
| 105 | while ((pDent = readdir(pDir)) != NULL) | ||
| 106 | { | ||
| 107 | /* Handle each pid sub-directory */ | ||
| 108 | HandleFile(pDent); | ||
| 109 | } | ||
| 110 | |||
| 111 | /* Close the directory */ | ||
| 112 | closedir(pDir); | ||
| 113 | } | ||
| 114 | else /* ERROR: Failure to open PROC_DIR */ | ||
| 115 | { | ||
| 116 | fprintf(stderr, "%s: Failed to open \"%s\": %s\n", szProg, PROC_DIR, strerror(errno)); | ||
| 117 | retcode = 3; | ||
| 118 | } | ||
| 119 | |||
| 120 | /* Close the handle to the running kernel image */ | ||
| 121 | kvm_close(kd); | ||
| 122 | |||
| 123 | return retcode; | ||
| 124 | } | ||
| 125 | |||
| 126 | /*----------------------------------------------------------------------------*/ | ||
| 127 | |||
| 128 | static int HandleFile (struct dirent *pDent) | ||
| 129 | { | ||
| 130 | char szPath[MAX_PATH]; | ||
| 131 | psinfo_t sPsInfo; | ||
| 132 | int fd, len; | ||
| 133 | int rc = 0; | ||
| 134 | |||
| 135 | /* Skip files beginning with a "." */ | ||
| 136 | if (pDent->d_name[0] == '.') | ||
| 137 | return 0; | ||
| 138 | |||
| 139 | /* Cosntruct the path to the psinfo file */ | ||
| 140 | len = sprintf(szPath, "%s/%s/psinfo", PROC_DIR, pDent->d_name); | ||
| 141 | |||
| 142 | /* Open the psinfo file for this pid and print out its arg vectors */ | ||
| 143 | if ((fd = open(szPath, O_RDONLY)) >= 0) | ||
| 144 | { | ||
| 145 | /* Read the psinfo struct */ | ||
| 146 | if ((len = read(fd, &sPsInfo, sizeof(sPsInfo))) != sizeof(sPsInfo)) | ||
| 147 | { | ||
| 148 | rc = errno; | ||
| 149 | fprintf(stderr, "%s: Read error of psinfo structure (%d)\n", szPath, len); | ||
| 150 | return rc; | ||
| 151 | } | ||
| 152 | |||
| 153 | /* Close the psinfo file */ | ||
| 154 | close(fd); | ||
| 155 | |||
| 156 | /* Pass psinfo struct to reporting function */ | ||
| 157 | HandlePsInfo(szPath, &sPsInfo); | ||
| 158 | } | ||
| 159 | else if (errno != ENOENT) | ||
| 160 | { | ||
| 161 | rc = errno; | ||
| 162 | fprintf(stderr, "%s: %s\n", szPath, strerror(errno)); | ||
| 163 | } | ||
| 164 | |||
| 165 | return 0; | ||
| 166 | } | ||
| 167 | |||
| 168 | /*----------------------------------------------------------------------------*/ | ||
| 169 | |||
| 170 | static int HandlePsInfo (char *szPath, psinfo_t *pPsInfo) | ||
| 171 | { | ||
| 172 | int retcode; | ||
| 173 | char *thisProg; | ||
| 174 | |||
| 175 | /* Make sure that the process is still there */ | ||
| 176 | if ((retcode = GetArgVectors(pPsInfo->pr_pid)) == 0) | ||
| 177 | { | ||
| 178 | /* We use the program name from the kvm argv[0] instead | ||
| 179 | * of pr_fname from the psinfo struct because pr_fname | ||
| 180 | * may be truncated. | ||
| 181 | * | ||
| 182 | * Also, strip-off leading path information. | ||
| 183 | */ | ||
| 184 | if ((thisProg = strrchr(myArgv[0], '/')) != NULL) | ||
| 185 | thisProg++; | ||
| 186 | else | ||
| 187 | thisProg = myArgv[0]; | ||
| 188 | |||
| 189 | /* Display the ps columns (except for argv) */ | ||
| 190 | printf("%c %5d %5d %6lu %6lu %4.1f %s ", | ||
| 191 | pPsInfo->pr_lwp.pr_sname, | ||
| 192 | (int)(pPsInfo->pr_euid), | ||
| 193 | (int)(pPsInfo->pr_ppid), | ||
| 194 | (unsigned long)(pPsInfo->pr_size), | ||
| 195 | (unsigned long)(pPsInfo->pr_rssize), | ||
| 196 | ((float)(pPsInfo->pr_pctcpu) / 0x8000 * 100.0), | ||
| 197 | thisProg); | ||
| 198 | |||
| 199 | /* Display the arg vectors associated with this pid */ | ||
| 200 | ShowArgVectors(); | ||
| 201 | |||
| 202 | /* Release the arg vector buffer memory */ | ||
| 203 | ReleaseArgVectors(); | ||
| 204 | } | ||
| 205 | |||
| 206 | return retcode; | ||
| 207 | } | ||
| 208 | |||
| 209 | /*----------------------------------------------------------------------------*/ | ||
| 210 | |||
| 211 | static int GetArgVectors (pid_t pid) | ||
| 212 | { | ||
| 213 | int retcode = 1; | ||
| 214 | |||
| 215 | /* Get the proc structure for the specified PID */ | ||
| 216 | if ((pProc = kvm_getproc(kd, pid)) != NULL) | ||
| 217 | { | ||
| 218 | /* Save a copy of the process' u-area */ | ||
| 219 | if ((pUser = kvm_getu(kd, pProc)) != NULL) | ||
| 220 | { | ||
| 221 | /* Reconstruct the process' argv vector array */ | ||
| 222 | if (kvm_getcmd(kd, pProc, pUser, &myArgv, NULL) == 0) | ||
| 223 | { | ||
| 224 | retcode = 0; | ||
| 225 | } | ||
| 226 | } | ||
| 227 | } | ||
| 228 | |||
| 229 | return retcode; | ||
| 230 | } | ||
| 231 | |||
| 232 | /*----------------------------------------------------------------------------*/ | ||
| 233 | |||
| 234 | static void ShowArgVectors (void) | ||
| 235 | { | ||
| 236 | int i; | ||
| 237 | |||
| 238 | for (i=0; myArgv[i]; i++) | ||
| 239 | { | ||
| 240 | printf(" %s", myArgv[i]); | ||
| 241 | } | ||
| 242 | printf("\n"); | ||
| 243 | } | ||
| 244 | |||
| 245 | /*----------------------------------------------------------------------------*/ | ||
| 246 | |||
| 247 | static void ReleaseArgVectors() | ||
| 248 | { | ||
| 249 | /* NOOP */ | ||
| 250 | } | ||
| 251 | |||
| 252 | /*----------------------------------------------------------------------------*/ | ||
diff --git a/web/attachments/149231-check_tcp.diff b/web/attachments/149231-check_tcp.diff new file mode 100644 index 0000000..e964ddf --- /dev/null +++ b/web/attachments/149231-check_tcp.diff | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | --- nagios-plugins-1.4.1-org/plugins/check_tcp.c 2005-06-05 19:43:58.000000000 +0200 | ||
| 2 | +++ nagios-plugins-1.4.1/plugins/check_tcp.c 2005-09-16 00:07:16.000000000 +0200 | ||
| 3 | @@ -108,6 +108,7 @@ | ||
| 4 | { | ||
| 5 | int result = STATE_UNKNOWN; | ||
| 6 | int i; | ||
| 7 | + int j; | ||
| 8 | char *status = NULL; | ||
| 9 | struct timeval tv; | ||
| 10 | size_t len, match = -1; | ||
| 11 | @@ -221,6 +222,30 @@ | ||
| 12 | if(EXPECT && !server_expect_count) | ||
| 13 | server_expect_count++; | ||
| 14 | |||
| 15 | + j=0; | ||
| 16 | + for(i=0; server_send[i]; i++) { | ||
| 17 | + if (server_send[i] == '\\') { | ||
| 18 | + switch(server_send[i+1]) { | ||
| 19 | + case 'n': | ||
| 20 | + server_send[j++] = '\n'; | ||
| 21 | + i++; | ||
| 22 | + break; | ||
| 23 | + case 'r': | ||
| 24 | + server_send[j++] = '\r'; | ||
| 25 | + i++; | ||
| 26 | + break; | ||
| 27 | + case 't': | ||
| 28 | + server_send[j++] = '\t'; | ||
| 29 | + i++; | ||
| 30 | + break; | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + else { | ||
| 34 | + server_send[j++] = server_send[i]; | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + server_send[j] = 0; | ||
| 38 | + | ||
| 39 | /* set up the timer */ | ||
| 40 | signal (SIGALRM, socket_timeout_alarm_handler); | ||
| 41 | alarm (socket_timeout); | ||
diff --git a/web/attachments/149734-check_nwstat.cap b/web/attachments/149734-check_nwstat.cap new file mode 100644 index 0000000..10745ce --- /dev/null +++ b/web/attachments/149734-check_nwstat.cap | |||
| Binary files differ | |||
diff --git a/web/attachments/149864-check_nwstat.c.diff b/web/attachments/149864-check_nwstat.c.diff new file mode 100644 index 0000000..cd26b2d --- /dev/null +++ b/web/attachments/149864-check_nwstat.c.diff | |||
| @@ -0,0 +1,306 @@ | |||
| 1 | --- check_nwstat.c 2005-07-11 23:15:58.000000000 +0100 | ||
| 2 | +++ /home/sully/check_nwstat.c 2005-09-21 11:55:09.000000000 +0100 | ||
| 3 | @@ -163,6 +163,9 @@ | ||
| 4 | temp_buffer = strdup ("15"); | ||
| 5 | break; | ||
| 6 | } | ||
| 7 | + | ||
| 8 | + close(sd); | ||
| 9 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 10 | |||
| 11 | asprintf (&send_buffer,"UTIL%s\r\n",temp_buffer); | ||
| 12 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 13 | @@ -195,6 +198,9 @@ | ||
| 14 | /* check number of user connections */ | ||
| 15 | } else if (vars_to_check==CONNS) { | ||
| 16 | |||
| 17 | + close(sd); | ||
| 18 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 19 | + | ||
| 20 | send_buffer = strdup ("CONNECT\r\n"); | ||
| 21 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 22 | if (result!=STATE_OK) | ||
| 23 | @@ -214,6 +220,9 @@ | ||
| 24 | /* check % long term cache hits */ | ||
| 25 | } else if (vars_to_check==LTCH) { | ||
| 26 | |||
| 27 | + close(sd); | ||
| 28 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 29 | + | ||
| 30 | send_buffer = strdup ("S1\r\n"); | ||
| 31 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 32 | if (result!=STATE_OK) | ||
| 33 | @@ -233,6 +242,9 @@ | ||
| 34 | /* check cache buffers */ | ||
| 35 | } else if (vars_to_check==CBUFF) { | ||
| 36 | |||
| 37 | + close(sd); | ||
| 38 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 39 | + | ||
| 40 | send_buffer = strdup ("S2\r\n"); | ||
| 41 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 42 | if (result!=STATE_OK) | ||
| 43 | @@ -252,6 +264,9 @@ | ||
| 44 | /* check dirty cache buffers */ | ||
| 45 | } else if (vars_to_check==CDBUFF) { | ||
| 46 | |||
| 47 | + close(sd); | ||
| 48 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 49 | + | ||
| 50 | send_buffer = strdup ("S3\r\n"); | ||
| 51 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 52 | if (result!=STATE_OK) | ||
| 53 | @@ -271,6 +286,9 @@ | ||
| 54 | /* check LRU sitting time in minutes */ | ||
| 55 | } else if (vars_to_check==LRUM) { | ||
| 56 | |||
| 57 | + close(sd); | ||
| 58 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 59 | + | ||
| 60 | send_buffer = strdup ("S5\r\n"); | ||
| 61 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 62 | if (result!=STATE_OK) | ||
| 63 | @@ -291,6 +309,9 @@ | ||
| 64 | /* check KB free space on volume */ | ||
| 65 | } else if (vars_to_check==VKF) { | ||
| 66 | |||
| 67 | + close(sd); | ||
| 68 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 69 | + | ||
| 70 | asprintf (&send_buffer,"VKF%s\r\n",volume_name); | ||
| 71 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 72 | if (result!=STATE_OK) | ||
| 73 | @@ -315,6 +336,9 @@ | ||
| 74 | /* check % free space on volume */ | ||
| 75 | } else if (vars_to_check==VPF) { | ||
| 76 | |||
| 77 | + close(sd); | ||
| 78 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 79 | + | ||
| 80 | asprintf (&send_buffer,"VKF%s\r\n",volume_name); | ||
| 81 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 82 | if (result!=STATE_OK) | ||
| 83 | @@ -331,7 +355,7 @@ | ||
| 84 | |||
| 85 | close(sd); | ||
| 86 | my_tcp_connect (server_address, server_port, &sd); | ||
| 87 | - | ||
| 88 | + | ||
| 89 | asprintf (&send_buffer,"VKS%s\r\n",volume_name); | ||
| 90 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 91 | if (result!=STATE_OK) | ||
| 92 | @@ -352,6 +376,9 @@ | ||
| 93 | /* check to see if DS Database is open or closed */ | ||
| 94 | } else if (vars_to_check==DSDB) { | ||
| 95 | |||
| 96 | + close(sd); | ||
| 97 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 98 | + | ||
| 99 | send_buffer = strdup ("S11\r\n"); | ||
| 100 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 101 | if (result!=STATE_OK) | ||
| 102 | @@ -373,6 +400,9 @@ | ||
| 103 | /* check to see if logins are enabled */ | ||
| 104 | } else if (vars_to_check==LOGINS) { | ||
| 105 | |||
| 106 | + close(sd); | ||
| 107 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 108 | + | ||
| 109 | send_buffer = strdup ("S12\r\n"); | ||
| 110 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 111 | if (result!=STATE_OK) | ||
| 112 | @@ -386,7 +416,10 @@ | ||
| 113 | |||
| 114 | /* check packet receive buffers */ | ||
| 115 | } else if (vars_to_check==UPRB || vars_to_check==PUPRB) { | ||
| 116 | - | ||
| 117 | + | ||
| 118 | + close(sd); | ||
| 119 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 120 | + | ||
| 121 | asprintf (&send_buffer,"S15\r\n"); | ||
| 122 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 123 | if (result!=STATE_OK) | ||
| 124 | @@ -394,6 +427,9 @@ | ||
| 125 | |||
| 126 | used_packet_receive_buffers=atoi(recv_buffer); | ||
| 127 | |||
| 128 | + close(sd); | ||
| 129 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 130 | + | ||
| 131 | asprintf (&send_buffer,"S16\r\n"); | ||
| 132 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 133 | if (result!=STATE_OK) | ||
| 134 | @@ -420,6 +456,9 @@ | ||
| 135 | /* check SAP table entries */ | ||
| 136 | } else if (vars_to_check==SAPENTRIES) { | ||
| 137 | |||
| 138 | + close(sd); | ||
| 139 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 140 | + | ||
| 141 | if (sap_number==-1) | ||
| 142 | asprintf (&send_buffer,"S9\r\n"); | ||
| 143 | else | ||
| 144 | @@ -443,6 +482,9 @@ | ||
| 145 | /* check KB purgeable space on volume */ | ||
| 146 | } else if (vars_to_check==VKP) { | ||
| 147 | |||
| 148 | + close(sd); | ||
| 149 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 150 | + | ||
| 151 | asprintf (&send_buffer,"VKP%s\r\n",volume_name); | ||
| 152 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 153 | if (result!=STATE_OK) | ||
| 154 | @@ -463,6 +505,9 @@ | ||
| 155 | /* check % purgeable space on volume */ | ||
| 156 | } else if (vars_to_check==VPP) { | ||
| 157 | |||
| 158 | + close(sd); | ||
| 159 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 160 | + | ||
| 161 | asprintf (&send_buffer,"VKP%s\r\n",volume_name); | ||
| 162 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 163 | if (result!=STATE_OK) | ||
| 164 | @@ -477,6 +522,9 @@ | ||
| 165 | |||
| 166 | purgeable_disk_space=strtoul(recv_buffer,NULL,10); | ||
| 167 | |||
| 168 | + close(sd); | ||
| 169 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 170 | + | ||
| 171 | asprintf (&send_buffer,"VKS%s\r\n",volume_name); | ||
| 172 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 173 | if (result!=STATE_OK) | ||
| 174 | @@ -496,6 +544,9 @@ | ||
| 175 | /* check KB not yet purgeable space on volume */ | ||
| 176 | } else if (vars_to_check==VKNP) { | ||
| 177 | |||
| 178 | + close(sd); | ||
| 179 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 180 | + | ||
| 181 | asprintf (&send_buffer,"VKNP%s\r\n",volume_name); | ||
| 182 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 183 | if (result!=STATE_OK) | ||
| 184 | @@ -516,6 +567,9 @@ | ||
| 185 | /* check % not yet purgeable space on volume */ | ||
| 186 | } else if (vars_to_check==VPNP) { | ||
| 187 | |||
| 188 | + close(sd); | ||
| 189 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 190 | + | ||
| 191 | asprintf (&send_buffer,"VKNP%s\r\n",volume_name); | ||
| 192 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 193 | if (result!=STATE_OK) | ||
| 194 | @@ -530,6 +584,9 @@ | ||
| 195 | |||
| 196 | non_purgeable_disk_space=strtoul(recv_buffer,NULL,10); | ||
| 197 | |||
| 198 | + close(sd); | ||
| 199 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 200 | + | ||
| 201 | asprintf (&send_buffer,"VKS%s\r\n",volume_name); | ||
| 202 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 203 | if (result!=STATE_OK) | ||
| 204 | @@ -549,6 +606,9 @@ | ||
| 205 | /* check # of open files */ | ||
| 206 | } else if (vars_to_check==OFILES) { | ||
| 207 | |||
| 208 | + close(sd); | ||
| 209 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 210 | + | ||
| 211 | asprintf (&send_buffer,"S18\r\n"); | ||
| 212 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 213 | if (result!=STATE_OK) | ||
| 214 | @@ -566,6 +626,9 @@ | ||
| 215 | /* check # of abended threads (Netware 5.x only) */ | ||
| 216 | } else if (vars_to_check==ABENDS) { | ||
| 217 | |||
| 218 | + close(sd); | ||
| 219 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 220 | + | ||
| 221 | asprintf (&send_buffer,"S17\r\n"); | ||
| 222 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 223 | if (result!=STATE_OK) | ||
| 224 | @@ -583,6 +646,9 @@ | ||
| 225 | /* check # of current service processes (Netware 5.x only) */ | ||
| 226 | } else if (vars_to_check==CSPROCS) { | ||
| 227 | |||
| 228 | + close(sd); | ||
| 229 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 230 | + | ||
| 231 | asprintf (&send_buffer,"S20\r\n"); | ||
| 232 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 233 | if (result!=STATE_OK) | ||
| 234 | @@ -613,6 +679,9 @@ | ||
| 235 | /* check # Timesync Status */ | ||
| 236 | } else if (vars_to_check==TSYNC) { | ||
| 237 | |||
| 238 | + close(sd); | ||
| 239 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 240 | + | ||
| 241 | asprintf (&send_buffer,"S22\r\n"); | ||
| 242 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 243 | if (result!=STATE_OK) | ||
| 244 | @@ -631,6 +700,9 @@ | ||
| 245 | /* check LRU sitting time in secondss */ | ||
| 246 | } else if (vars_to_check==LRUS) { | ||
| 247 | |||
| 248 | + close(sd); | ||
| 249 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 250 | + | ||
| 251 | send_buffer = strdup ("S4\r\n"); | ||
| 252 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 253 | if (result!=STATE_OK) | ||
| 254 | @@ -647,6 +719,9 @@ | ||
| 255 | /* check % dirty cacheobuffers as a percentage of the total*/ | ||
| 256 | } else if (vars_to_check==DCB) { | ||
| 257 | |||
| 258 | + close(sd); | ||
| 259 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 260 | + | ||
| 261 | send_buffer = strdup ("S6\r\n"); | ||
| 262 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 263 | if (result!=STATE_OK) | ||
| 264 | @@ -662,6 +737,9 @@ | ||
| 265 | /* check % total cache buffers as a percentage of the original*/ | ||
| 266 | } else if (vars_to_check==TCB) { | ||
| 267 | |||
| 268 | + close(sd); | ||
| 269 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 270 | + | ||
| 271 | send_buffer = strdup ("S7\r\n"); | ||
| 272 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 273 | if (result!=STATE_OK) | ||
| 274 | @@ -675,6 +753,10 @@ | ||
| 275 | asprintf (&output_message,_("Total cache buffers = %lu%% of the original"),total_cache_buffers); | ||
| 276 | |||
| 277 | } else if (vars_to_check==DSVER) { | ||
| 278 | + | ||
| 279 | + close(sd); | ||
| 280 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 281 | + | ||
| 282 | asprintf (&send_buffer,"S13\r\n"); | ||
| 283 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 284 | if (result!=STATE_OK) | ||
| 285 | @@ -685,6 +767,10 @@ | ||
| 286 | asprintf (&output_message,_("NDS Version %s"),recv_buffer); | ||
| 287 | |||
| 288 | } else if (vars_to_check==UPTIME) { | ||
| 289 | + | ||
| 290 | + close(sd); | ||
| 291 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 292 | + | ||
| 293 | asprintf (&send_buffer,"UPTIME\r\n"); | ||
| 294 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 295 | if (result!=STATE_OK) | ||
| 296 | @@ -697,6 +783,10 @@ | ||
| 297 | asprintf (&output_message,_("Up %s"),recv_buffer); | ||
| 298 | |||
| 299 | } else if (vars_to_check==NLM) { | ||
| 300 | + | ||
| 301 | + close(sd); | ||
| 302 | + my_tcp_connect (server_address, server_port, &sd); | ||
| 303 | + | ||
| 304 | asprintf (&send_buffer,"S24:%s\r\n",nlm_name); | ||
| 305 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 306 | if (result!=STATE_OK) | ||
diff --git a/web/attachments/149868-nagiosplug-check_snmp_mgeups.patch b/web/attachments/149868-nagiosplug-check_snmp_mgeups.patch new file mode 100644 index 0000000..c06bce7 --- /dev/null +++ b/web/attachments/149868-nagiosplug-check_snmp_mgeups.patch | |||
| @@ -0,0 +1,301 @@ | |||
| 1 | diff -Nru nagiosplug/plugins-scripts/check_snmp_mgeups.pl nagiosplug-check_snmp_mgeups/plugins-scripts/check_snmp_mgeups.pl | ||
| 2 | --- nagiosplug/plugins-scripts/check_snmp_mgeups.pl 1970-01-01 01:00:00.000000000 +0100 | ||
| 3 | +++ nagiosplug-check_snmp_mgeups/plugins-scripts/check_snmp_mgeups.pl 2005-09-21 13:51:12.000000000 +0200 | ||
| 4 | @@ -0,0 +1,271 @@ | ||
| 5 | +#!/usr/bin/perl | ||
| 6 | + | ||
| 7 | +#----------------------------------------------------------------- | ||
| 8 | +#Copyright 2005 Ignacio Barrientos <chipi@criptonita.com> | ||
| 9 | +# | ||
| 10 | +#This perl script query an UM_LINK unit via SNMP and grab some | ||
| 11 | +#useful information applied to determine the status of the UPS | ||
| 12 | +#to send it to Nagios. | ||
| 13 | +# | ||
| 14 | +#Thanks to Jos Beites, who gave me access to a MGE COMET S31 UPS | ||
| 15 | +#and UM-LINK unit. | ||
| 16 | +# | ||
| 17 | +#Thanks to check_snmp_apcups.pl | ||
| 18 | +# | ||
| 19 | +#This program is free software; you can redistribute it or modify | ||
| 20 | +#it under the terms of the GNU General Public License | ||
| 21 | +#----------------------------------------------------------------- | ||
| 22 | + | ||
| 23 | +# READ CAREFULLY BEFORE USE THIS SCRIPT: | ||
| 24 | +# | ||
| 25 | +# Please execute the script before use it with Nagios to test | ||
| 26 | +# if the oid's are OK, a message will be printed if there are | ||
| 27 | +# some problems with the oid's configuration. | ||
| 28 | +# | ||
| 29 | +# Thank you. | ||
| 30 | + | ||
| 31 | + | ||
| 32 | +use Net::SNMP; | ||
| 33 | +use Getopt::Std; | ||
| 34 | + | ||
| 35 | +$script_name = "check_snmp_mgeups"; | ||
| 36 | +$script_version = "0.1"; | ||
| 37 | + | ||
| 38 | +## CONNECTION STUFF ## | ||
| 39 | +$ipaddress = ""; # there is not default ip address, sorry | ||
| 40 | +$version = 1; # SNMP version, old UM_LINK hw works with version 1!!. | ||
| 41 | +$timeout = 2; # SNMP query timeout | ||
| 42 | +$defaultcommunity = "public"; # Default community string | ||
| 43 | + | ||
| 44 | +$warn_batt_level = 20; # battery level (%) that set a WARNING status. | ||
| 45 | +$crit_batt_level = 10; # battery level (%) that set a CRITICAL status. | ||
| 46 | +$warn_temp = 30; # temperature (degrees) that set a WARNING status. | ||
| 47 | +$warn_overload = 70; # output overload (%) that set WARNING status. | ||
| 48 | + | ||
| 49 | +################################################## | ||
| 50 | +## ## | ||
| 51 | +## DONT CHANGE NOTHING UNDER THIS LINE ## | ||
| 52 | +## ## | ||
| 53 | +################################################## | ||
| 54 | + | ||
| 55 | +## INTERESTING DEFINES ## | ||
| 56 | +my $OK = 0; | ||
| 57 | +my $WARNING = 1; | ||
| 58 | +my $CRITICAL = 2; | ||
| 59 | + | ||
| 60 | +## RETURN INFO VARIABLES ## | ||
| 61 | +$status = $OK; | ||
| 62 | +$returnstring = ""; | ||
| 63 | + | ||
| 64 | +## OID LIST ## | ||
| 65 | +$oid_ups_model = ".1.3.6.1.4.1.705.1.1.1.0"; | ||
| 66 | + | ||
| 67 | +$oid_internal_temp = ".1.3.6.1.4.1.705.1.5.7.0"; # degrees | ||
| 68 | + | ||
| 69 | +$oid_battery_porcentage = ".1.3.6.1.4.1.705.1.5.2.0"; | ||
| 70 | +$oid_battery_fault = ".1.3.6.1.4.1.705.1.5.9.0"; # 1 yes, 2 no | ||
| 71 | + | ||
| 72 | +$oid_input_outage = ".1.3.6.1.4.1.705.1.6.4.0"; # 1: ok, 2: voltage out tolerance, 3: freq out tolerance, 4: no voltage. | ||
| 73 | + | ||
| 74 | +$oid_output_overload = ".1.3.6.1.4.1.705.1.7.2.1.4.1"; # % | ||
| 75 | +$oid_output_on_bypass = ".1.3.6.1.4.1.705.1.7.3.0"; # 1: yes, 2: no | ||
| 76 | + | ||
| 77 | +## NOT USED ## | ||
| 78 | +# $oid_battery_voltage = ".1.3.6.1.4.1.705.1.5.5.0"; # dV | ||
| 79 | +# $oid_input_voltage = ".1.3.6.1.4.1.705.1.6.2.1.2.1"; # dV | ||
| 80 | +# $oid_output_voltage = ".1.3.6.1.4.1.705.1.7.2.1.2.1"; # dV | ||
| 81 | + | ||
| 82 | +$oid_generic = $oid_ups_model; | ||
| 83 | + | ||
| 84 | +## PERSONALIZED DATA VARIABLES ## | ||
| 85 | +$temp = 0; | ||
| 86 | + | ||
| 87 | +$batt_level = 0; | ||
| 88 | +$batt_fault = 0; | ||
| 89 | + | ||
| 90 | +$in_outage = 0; | ||
| 91 | + | ||
| 92 | +$out_overload = 0; | ||
| 93 | +$out_bypass = 0; | ||
| 94 | + | ||
| 95 | +## FETCHING ARGS STUFF ## | ||
| 96 | +if (@ARGV < 1) { | ||
| 97 | + print "\nERROR: Too few arguments\n"; | ||
| 98 | + usage(); | ||
| 99 | +} | ||
| 100 | + | ||
| 101 | +getopts("h:H:C:w:c:"); | ||
| 102 | + | ||
| 103 | +if ($opt_h) | ||
| 104 | +{ | ||
| 105 | + usage(); | ||
| 106 | + exit(0); | ||
| 107 | +} | ||
| 108 | + | ||
| 109 | +$ipaddress = $opt_H; | ||
| 110 | + | ||
| 111 | +if ($opt_C) | ||
| 112 | +{ | ||
| 113 | + $defaultcommunity = $opt_C; | ||
| 114 | +} | ||
| 115 | + | ||
| 116 | +## MAKING SNMP CONNECTION ## | ||
| 117 | +my ($s, $e) = Net::SNMP->session( | ||
| 118 | + -community => $defaultcommunity, | ||
| 119 | + -hostname => $ipaddress, | ||
| 120 | + -version => $version, | ||
| 121 | + -timeout => $timeout, | ||
| 122 | +); | ||
| 123 | + | ||
| 124 | +## TESTING SNMP CONNECTION WITH A GENERIC QUERY ## | ||
| 125 | +if (!defined($s->get_request($oid_generic))) | ||
| 126 | +{ | ||
| 127 | + $returnstring = "SNMP server not responding, host down?"; | ||
| 128 | + $status = $CRITICAL; | ||
| 129 | +} | ||
| 130 | +else | ||
| 131 | +{ | ||
| 132 | + ## DOING ALL WORK ## | ||
| 133 | + main(); | ||
| 134 | +} | ||
| 135 | + | ||
| 136 | +## CONNECTION TO /DEV/NULL ## | ||
| 137 | +$s->close(); | ||
| 138 | + | ||
| 139 | +## STUDYING THE OUTPUT ## | ||
| 140 | +if ($status == $OK) | ||
| 141 | +{ | ||
| 142 | + $returnstring = "- No problems."; | ||
| 143 | + print "Status is OK $returnstring\n"; | ||
| 144 | +} | ||
| 145 | +elsif ($status == $WARNING) | ||
| 146 | +{ | ||
| 147 | + print "Status is a WARNING level $returnstring\n"; | ||
| 148 | +} | ||
| 149 | +elsif ($status == $CRITICAL) | ||
| 150 | +{ | ||
| 151 | + print "Status is CRITICAL $returnstring\n"; | ||
| 152 | +} | ||
| 153 | + | ||
| 154 | +## GOOD BYE ## | ||
| 155 | +exit $status; | ||
| 156 | + | ||
| 157 | +## | ||
| 158 | +## getinfo: make a snmp query with OID (arg0) and put it in arg1. | ||
| 159 | + | ||
| 160 | +sub getinfo | ||
| 161 | +{ | ||
| 162 | + if(!defined($s->get_request(@_[0]))) | ||
| 163 | + { | ||
| 164 | + print "OID "; | ||
| 165 | + print @_[0]; | ||
| 166 | + print " not exists, and can't be checked, skipping\n"; | ||
| 167 | + $_[1] = undef; | ||
| 168 | + return; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + foreach ($s->var_bind_names()) { | ||
| 172 | + $_[1] = $s->var_bind_list()->{$_}; | ||
| 173 | + } | ||
| 174 | +} | ||
| 175 | + | ||
| 176 | +## | ||
| 177 | +## main: all queries and sets | ||
| 178 | + | ||
| 179 | +sub main | ||
| 180 | +{ | ||
| 181 | + | ||
| 182 | + ## GETTING DATA ## | ||
| 183 | + | ||
| 184 | + getinfo($oid_internal_temp,$temp); | ||
| 185 | + getinfo($oid_battery_porcentage,$batt_level); | ||
| 186 | + getinfo($oid_battery_fault,$batt_fault); | ||
| 187 | + getinfo($oid_input_outage,$in_outage); | ||
| 188 | + getinfo($oid_output_overload,$out_overload); | ||
| 189 | + getinfo($oid_output_on_bypass,$out_bypass); | ||
| 190 | + | ||
| 191 | + ## STUDYING STATUS LEVEL LOOKING SOME ISSUES ## | ||
| 192 | + | ||
| 193 | + ## THINGS CAN CHANGE STATUS TO: WARNING ## | ||
| 194 | + | ||
| 195 | + if( defined($batt_level) && ($batt_level < $warn_batt_level) ) | ||
| 196 | + { | ||
| 197 | + $status = $WARNING; | ||
| 198 | + $returnstring = " - Battery level is under "; | ||
| 199 | + $returnstring = "$returnstring$warn_batt_level"; | ||
| 200 | + $returnstring = "$returnstring%."; | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + if( defined($temp) && ($temp > $warn_temp) ) | ||
| 204 | + { | ||
| 205 | + $status = $WARNING; | ||
| 206 | + $returnstring = "$returnstring - Max temperature exceeded"; | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + if( defined($out_overload) && ($out_overload > $warn_overload) ) | ||
| 210 | + { | ||
| 211 | + $status = $WARNING; | ||
| 212 | + $returnstring = "$returnstring - Output overloaded"; | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + ## THINGS CAN CHANGE STATUS TO: CRITICAL ## | ||
| 216 | + | ||
| 217 | + if( defined($batt_level) && ($batt_level < $crit_batt_level) ) | ||
| 218 | + { | ||
| 219 | + $status = $CRITICAL; | ||
| 220 | + $returnstring = " - Battery level is under "; | ||
| 221 | + $returnstring = "$returnstring$crit_batt_level"; | ||
| 222 | + $returnstring = "$returnstring%."; | ||
| 223 | + } | ||
| 224 | + | ||
| 225 | + if( defined($batt_fault) && ($batt_fault eq 1) ) | ||
| 226 | + { | ||
| 227 | + $status = $CRITICAL; | ||
| 228 | + $returnstring = "$returnstring - Battery fail"; | ||
| 229 | + } | ||
| 230 | + | ||
| 231 | + if( defined($in_outage) && (! $in_outage eq 1) ) | ||
| 232 | + { | ||
| 233 | + $status = $CRITICAL; | ||
| 234 | + $returnstring = "$returnstring - AC input fail"; | ||
| 235 | + } | ||
| 236 | + | ||
| 237 | + if( defined($out_bypass) && ($out_bypass eq 1) ) | ||
| 238 | + { | ||
| 239 | + $status = $CRITICAL; | ||
| 240 | + $returnstring = "$returnstring - System in BY PASS mode"; | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | +} | ||
| 244 | + | ||
| 245 | +## | ||
| 246 | +## usage: self explaining | ||
| 247 | + | ||
| 248 | +sub usage { | ||
| 249 | + print << "USAGE"; | ||
| 250 | + | ||
| 251 | +----------------------------------------------------------------- | ||
| 252 | +$script_name v$script_version | ||
| 253 | + | ||
| 254 | +Monitors MGE UPS via SNMP v1. | ||
| 255 | + | ||
| 256 | +Usage: $script_name -H <hostname> [-C <community>] | ||
| 257 | + | ||
| 258 | +Options: -H Hostname or IP address | ||
| 259 | + -C Community (default is public) | ||
| 260 | + | ||
| 261 | +----------------------------------------------------------------- | ||
| 262 | +Copyright 2005 Ignacio Barrientos <chipi\@criptonita.com> | ||
| 263 | + | ||
| 264 | +Thanks to Jos Beites, who gave me access to a MGE COMET S31 UPS | ||
| 265 | +and UM-LINK unit. | ||
| 266 | + | ||
| 267 | +Thanks to check_snmp_apcups.pl | ||
| 268 | + | ||
| 269 | +This program is free software; you can redistribute it or modify | ||
| 270 | +it under the terms of the GNU General Public License | ||
| 271 | +----------------------------------------------------------------- | ||
| 272 | + | ||
| 273 | +USAGE | ||
| 274 | + exit 1; | ||
| 275 | +} | ||
| 276 | diff -Nru nagiosplug/plugins-scripts/Makefile.am nagiosplug-check_snmp_mgeups/plugins-scripts/Makefile.am | ||
| 277 | --- nagiosplug/plugins-scripts/Makefile.am 2003-07-02 17:01:22.000000000 +0200 | ||
| 278 | +++ nagiosplug-check_snmp_mgeups/plugins-scripts/Makefile.am 2005-09-21 13:56:57.000000000 +0200 | ||
| 279 | @@ -7,12 +7,12 @@ | ||
| 280 | libexec_SCRIPTS = check_breeze check_disk_smb check_flexlm check_ircd \ | ||
| 281 | check_log check_ntp check_oracle check_rpc check_sensors check_wave \ | ||
| 282 | check_ifstatus check_ifoperstatus check_mailq check_file_age \ | ||
| 283 | - utils.sh utils.pm | ||
| 284 | + check_snmp_mgeups utils.sh utils.pm | ||
| 285 | |||
| 286 | EXTRA_DIST=check_breeze.pl check_disk_smb.pl check_flexlm.pl check_ircd.pl \ | ||
| 287 | check_log.sh check_ntp.pl check_oracle.sh check_rpc.pl check_sensors.sh \ | ||
| 288 | check_ifstatus.pl check_ifoperstatus.pl check_wave.pl check_mailq.pl check_file_age.pl \ | ||
| 289 | - utils.sh.in utils.pm.in t | ||
| 290 | + check_snmp_mgeups.pl utils.sh.in utils.pm.in t | ||
| 291 | |||
| 292 | TESTS_ENVIRONMENT=perl -I $(top_builddir) -I $(top_srcdir) | ||
| 293 | |||
| 294 | diff -Nru nagiosplug/THANKS.in nagiosplug-check_snmp_mgeups/THANKS.in | ||
| 295 | --- nagiosplug/THANKS.in 2005-09-19 12:58:24.000000000 +0200 | ||
| 296 | +++ nagiosplug-check_snmp_mgeups/THANKS.in 2005-09-21 13:55:43.000000000 +0200 | ||
| 297 | @@ -166,3 +166,4 @@ | ||
| 298 | Sascha Runschke | ||
| 299 | Ronald Tin | ||
| 300 | Chester Hosey | ||
| 301 | +Ignacio Barrientos | ||
diff --git a/web/attachments/151032-nagios-plugins-1.4.1-check_snmp_c_fix.patch b/web/attachments/151032-nagios-plugins-1.4.1-check_snmp_c_fix.patch new file mode 100644 index 0000000..babe7fc --- /dev/null +++ b/web/attachments/151032-nagios-plugins-1.4.1-check_snmp_c_fix.patch | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | --- plugins/check_snmp.c.orig Sat Oct 1 13:45:45 2005 | ||
| 2 | +++ plugins/check_snmp.c Sat Oct 1 13:46:15 2005 | ||
| 3 | @@ -206,6 +206,7 @@ | ||
| 4 | strcat(perfstr, "| "); | ||
| 5 | while (ptr) { | ||
| 6 | char *foo; | ||
| 7 | + char *str[MAX_INPUT_BUFFER]; | ||
| 8 | |||
| 9 | foo = strstr (ptr, delimiter); | ||
| 10 | strncat(perfstr, ptr, foo-ptr); | ||
| 11 | @@ -338,7 +339,6 @@ | ||
| 12 | |||
| 13 | i++; | ||
| 14 | |||
| 15 | - char *str[MAX_INPUT_BUFFER]; | ||
| 16 | asprintf(str, "=%s%s;;;; ", show, type ? type : ""); | ||
| 17 | strcat(perfstr, *str); | ||
| 18 | |||
diff --git a/web/attachments/152023-check_http.patch b/web/attachments/152023-check_http.patch new file mode 100644 index 0000000..fa0b5c6 --- /dev/null +++ b/web/attachments/152023-check_http.patch | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | *** check_http.c.orig Mon Oct 10 21:00:43 2005 | ||
| 2 | --- check_http.c Mon Oct 10 21:09:02 2005 | ||
| 3 | *************** | ||
| 4 | *** 107,112 **** | ||
| 5 | --- 107,113 ---- | ||
| 6 | double critical_time = 0; | ||
| 7 | int check_critical_time = FALSE; | ||
| 8 | char user_auth[MAX_INPUT_BUFFER] = ""; | ||
| 9 | + char proxy_auth[MAX_INPUT_BUFFER] = ""; | ||
| 10 | int display_html = FALSE; | ||
| 11 | char *http_opt_headers; | ||
| 12 | int onredirect = STATE_OK; | ||
| 13 | *************** | ||
| 14 | *** 220,225 **** | ||
| 15 | --- 221,228 ---- | ||
| 16 | {"certificate", required_argument, 0, 'C'}, | ||
| 17 | {"useragent", required_argument, 0, 'A'}, | ||
| 18 | {"header", required_argument, 0, 'k'}, | ||
| 19 | + {"authorization", required_argument, 0, 'a'}, | ||
| 20 | + {"proxy-authorization", required_argument, 0, 'b'}, | ||
| 21 | {"no-body", no_argument, 0, 'N'}, | ||
| 22 | {"max-age", required_argument, 0, 'M'}, | ||
| 23 | {"content-type", required_argument, 0, 'T'}, | ||
| 24 | *************** | ||
| 25 | *** 246,252 **** | ||
| 26 | } | ||
| 27 | |||
| 28 | while (1) { | ||
| 29 | ! c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:T:I:a:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 30 | if (c == -1 || c == EOF) | ||
| 31 | break; | ||
| 32 | |||
| 33 | --- 249,255 ---- | ||
| 34 | } | ||
| 35 | |||
| 36 | while (1) { | ||
| 37 | ! c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:T:I:a:b:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 38 | if (c == -1 || c == EOF) | ||
| 39 | break; | ||
| 40 | |||
| 41 | *************** | ||
| 42 | *** 355,360 **** | ||
| 43 | --- 358,367 ---- | ||
| 44 | strncpy (user_auth, optarg, MAX_INPUT_BUFFER - 1); | ||
| 45 | user_auth[MAX_INPUT_BUFFER - 1] = 0; | ||
| 46 | break; | ||
| 47 | + case 'b': /* proxy-authorization info */ | ||
| 48 | + strncpy (proxy_auth, optarg, MAX_INPUT_BUFFER - 1); | ||
| 49 | + proxy_auth[MAX_INPUT_BUFFER - 1] = 0; | ||
| 50 | + break; | ||
| 51 | case 'P': /* HTTP POST data in URL encoded format */ | ||
| 52 | if (http_method || http_post_data) break; | ||
| 53 | http_method = strdup("POST"); | ||
| 54 | *************** | ||
| 55 | *** 835,840 **** | ||
| 56 | --- 842,854 ---- | ||
| 57 | asprintf (&buf, "%sAuthorization: Basic %s\r\n", buf, auth); | ||
| 58 | } | ||
| 59 | |||
| 60 | + /* optionally send the proxy authentication info */ | ||
| 61 | + if (strlen(proxy_auth)) { | ||
| 62 | + auth = base64 (proxy_auth, strlen (proxy_auth)); | ||
| 63 | + asprintf (&buf, "%sProxy-Authorization: Basic %s\r\n", buf, auth); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + | ||
| 67 | /* either send http POST data */ | ||
| 68 | if (http_post_data) { | ||
| 69 | if (http_content_type) { | ||
| 70 | *************** | ||
| 71 | *** 1508,1513 **** | ||
| 72 | --- 1522,1529 ---- | ||
| 73 | printf (_("\ | ||
| 74 | -a, --authorization=AUTH_PAIR\n\ | ||
| 75 | Username:password on sites with basic authentication\n\ | ||
| 76 | + -b, --proxy-authorization=AUTH_PAIR\n\ | ||
| 77 | + Username:password on proxy-servers with basic authentication\n\ | ||
| 78 | -A, --useragent=STRING\n\ | ||
| 79 | String to be sent in http header as \"User Agent\"\n\ | ||
| 80 | -k, --header=STRING\n\ | ||
| 81 | *************** | ||
| 82 | *** 1565,1572 **** | ||
| 83 | printf ("\ | ||
| 84 | Usage: %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n\ | ||
| 85 | [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\ | ||
| 86 | ! [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\ | ||
| 87 | ! [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\ | ||
| 88 | ! [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] \n\ | ||
| 89 | [-M <age>] [-A string] [-k string]\n", progname); | ||
| 90 | } | ||
| 91 | --- 1581,1589 ---- | ||
| 92 | printf ("\ | ||
| 93 | Usage: %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n\ | ||
| 94 | [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\ | ||
| 95 | ! [-a auth] [-b auth] [-f <ok | warn | critcal | follow>] \n\ | ||
| 96 | ! [-e <expect>] [-s string] [-l] \n\ | ||
| 97 | ! [-r <regex> | -R <case-insensitive regex>] [-P string]\n\ | ||
| 98 | ! [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] \n\ | ||
| 99 | [-M <age>] [-A string] [-k string]\n", progname); | ||
| 100 | } | ||
diff --git a/web/attachments/152738-snmpwalk.tgz b/web/attachments/152738-snmpwalk.tgz new file mode 100644 index 0000000..75057e8 --- /dev/null +++ b/web/attachments/152738-snmpwalk.tgz | |||
| Binary files differ | |||
diff --git a/web/attachments/153117-check_pop3_message.pl b/web/attachments/153117-check_pop3_message.pl new file mode 100644 index 0000000..ee93123 --- /dev/null +++ b/web/attachments/153117-check_pop3_message.pl | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-2 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378822229" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378822229" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378822229" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378822229" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378822229'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1331909&group_id=29880&atid=397599&file_id=153117" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/153312-nagios-plugins-1.4-check_log.patch b/web/attachments/153312-nagios-plugins-1.4-check_log.patch new file mode 100644 index 0000000..7c8f439 --- /dev/null +++ b/web/attachments/153312-nagios-plugins-1.4-check_log.patch | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | *** nagios-plugins-1.4/plugins-scripts/check_log.sh.orig Thu Feb 3 23:51:35 2005 | ||
| 2 | --- nagios-plugins-1.4/plugins-scripts/check_log.sh Fri Oct 21 10:34:23 2005 | ||
| 3 | *************** | ||
| 4 | *** 61,71 **** | ||
| 5 | PATH="" | ||
| 6 | |||
| 7 | ECHO="/bin/echo" | ||
| 8 | ! GREP="/bin/grep" | ||
| 9 | DIFF="/bin/diff" | ||
| 10 | TAIL="/bin/tail" | ||
| 11 | CAT="/bin/cat" | ||
| 12 | RM="/bin/rm" | ||
| 13 | |||
| 14 | PROGNAME=`/bin/basename $0` | ||
| 15 | PROGPATH=`echo $0 | /bin/sed -e 's,[\\/][^\\/][^\\/]*$,,'` | ||
| 16 | --- 61,73 ---- | ||
| 17 | PATH="" | ||
| 18 | |||
| 19 | ECHO="/bin/echo" | ||
| 20 | ! GREP="/bin/egrep" | ||
| 21 | DIFF="/bin/diff" | ||
| 22 | TAIL="/bin/tail" | ||
| 23 | CAT="/bin/cat" | ||
| 24 | RM="/bin/rm" | ||
| 25 | + CHMOD="/bin/chmod" | ||
| 26 | + TOUCH="/bin/touch" | ||
| 27 | |||
| 28 | PROGNAME=`/bin/basename $0` | ||
| 29 | PROGPATH=`echo $0 | /bin/sed -e 's,[\\/][^\\/][^\\/]*$,,'` | ||
| 30 | *************** | ||
| 31 | *** 191,198 **** | ||
| 32 | else | ||
| 33 | tempdiff=`/bin/date '+%H%M%S'` | ||
| 34 | tempdiff="/tmp/check_log.${tempdiff}" | ||
| 35 | ! /bin/touch $tempdiff | ||
| 36 | ! chmod 600 $tempdiff | ||
| 37 | fi | ||
| 38 | |||
| 39 | $DIFF $logfile $oldlog > $tempdiff | ||
| 40 | --- 193,200 ---- | ||
| 41 | else | ||
| 42 | tempdiff=`/bin/date '+%H%M%S'` | ||
| 43 | tempdiff="/tmp/check_log.${tempdiff}" | ||
| 44 | ! $TOUCH $tempdiff | ||
| 45 | ! $CHMOD 600 $tempdiff | ||
| 46 | fi | ||
| 47 | |||
| 48 | $DIFF $logfile $oldlog > $tempdiff | ||
| 49 | *************** | ||
| 50 | *** 201,207 **** | ||
| 51 | count=`$GREP -c "$query" $tempdiff` | ||
| 52 | |||
| 53 | # Get the last matching entry in the diff file | ||
| 54 | ! lastentry=`$GREP "$query" $tempdiff | $TAIL --lines=1` | ||
| 55 | |||
| 56 | $RM -f $tempdiff | ||
| 57 | $CAT $logfile > $oldlog | ||
| 58 | --- 203,209 ---- | ||
| 59 | count=`$GREP -c "$query" $tempdiff` | ||
| 60 | |||
| 61 | # Get the last matching entry in the diff file | ||
| 62 | ! lastentry=`$GREP "$query" $tempdiff | $TAIL -1` | ||
| 63 | |||
| 64 | $RM -f $tempdiff | ||
| 65 | $CAT $logfile > $oldlog | ||
diff --git a/web/attachments/153825-check_linux_raid.diff b/web/attachments/153825-check_linux_raid.diff new file mode 100644 index 0000000..35c3162 --- /dev/null +++ b/web/attachments/153825-check_linux_raid.diff | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-5 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378824737" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378824737" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378824737" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378824737" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378824737'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1338298&group_id=29880&atid=397599&file_id=153825" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/154188-patch-plugins_Makefile_in b/web/attachments/154188-patch-plugins_Makefile_in new file mode 100644 index 0000000..92b9b71 --- /dev/null +++ b/web/attachments/154188-patch-plugins_Makefile_in | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | $OpenBSD: patch-plugins_Makefile_in,v 1.1 2005/10/28 17:44:12 sturm Exp $ | ||
| 2 | --- plugins/Makefile.in.orig Fri Oct 28 18:58:58 2005 | ||
| 3 | +++ plugins/Makefile.in Fri Oct 28 18:59:09 2005 | ||
| 4 | @@ -977,7 +977,7 @@ $(check_tcp_programs): check_tcp | ||
| 5 | install-exec-hook: | ||
| 6 | cd $(DESTDIR)$(libexecdir) && \ | ||
| 7 | for i in $(check_tcp_programs) ; do rm -f $$i; ln -s check_tcp $$i ; done ;\ | ||
| 8 | - if [ -x check_ldaps ] ; then rm -f check_ldaps ; ln -s check_ldap check_ldaps ; fi | ||
| 9 | + if [ -x check_ldap ] ; then rm -f check_ldaps ; ln -s check_ldap check_ldaps ; fi | ||
| 10 | |||
| 11 | clean-local: | ||
| 12 | rm -f $(check_tcp_programs) | ||
diff --git a/web/attachments/154470-nagios_plugins-check_ssh.c.patch b/web/attachments/154470-nagios_plugins-check_ssh.c.patch new file mode 100644 index 0000000..44c5fea --- /dev/null +++ b/web/attachments/154470-nagios_plugins-check_ssh.c.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-3 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378821080" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378821080" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378821080" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378821080" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378821080'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1343151&group_id=29880&atid=397599&file_id=154470" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/154471-nagios_plugins-check_dns.c.patch b/web/attachments/154471-nagios_plugins-check_dns.c.patch new file mode 100644 index 0000000..f024078 --- /dev/null +++ b/web/attachments/154471-nagios_plugins-check_dns.c.patch | |||
| @@ -0,0 +1,113 @@ | |||
| 1 | --- ../../original_sources/nagios-plugins-1.4.2/plugins/check_dns.c 2004-12-29 19:41:39.000000000 -0500 | ||
| 2 | +++ nagios-plugins-1.4.2/plugins/check_dns.c 2005-10-19 22:54:35.000000000 -0400 | ||
| 3 | @@ -45,6 +45,8 @@ | ||
| 4 | char expected_address[ADDRESS_LENGTH] = ""; | ||
| 5 | int match_expected_address = FALSE; | ||
| 6 | int expect_authority = FALSE; | ||
| 7 | +double elapsed_warn_time = 0.0; | ||
| 8 | +double elapsed_crit_time = 0.0; | ||
| 9 | |||
| 10 | int | ||
| 11 | main (int argc, char **argv) | ||
| 12 | @@ -193,6 +195,21 @@ | ||
| 13 | microsec = deltime (tv); | ||
| 14 | elapsed_time = (double)microsec / 1.0e6; | ||
| 15 | |||
| 16 | + | ||
| 17 | + /* check elapsed time */ | ||
| 18 | + if ((result == STATE_OK) && | ||
| 19 | + ((elapsed_warn_time != 0.0) && (elapsed_warn_time <= elapsed_time)) && | ||
| 20 | + ((elapsed_crit_time == 0.0) || elapsed_crit_time > elapsed_time) ) { | ||
| 21 | + result = STATE_WARNING; | ||
| 22 | + asprintf(&output, _("server %s responded too slowly. %.5f seconds response time."), dns_server, elapsed_time); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + if ((result == STATE_OK) && (elapsed_crit_time != 0) && | ||
| 26 | + (elapsed_crit_time <= elapsed_time) ) { | ||
| 27 | + result = STATE_CRITICAL; | ||
| 28 | + asprintf(&output, _("server %s responded too slowly. %.5f seconds response time."), dns_server, elapsed_time); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | if (result == STATE_OK) { | ||
| 32 | if (strchr (address, ',') == NULL) | ||
| 33 | multi_address = FALSE; | ||
| 34 | @@ -200,7 +217,7 @@ | ||
| 35 | multi_address = TRUE; | ||
| 36 | |||
| 37 | printf ("DNS %s: ", _("OK")); | ||
| 38 | - printf (ngettext("%.3f second response time ", "%.3f seconds response time ", elapsed_time), elapsed_time); | ||
| 39 | + printf (ngettext("%.5f second response time ", "%.5f seconds response time ", elapsed_time), elapsed_time); | ||
| 40 | printf (_("%s returns %s"), query_address, address); | ||
| 41 | printf ("|%s\n", fperfdata ("time", elapsed_time, "s", FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); | ||
| 42 | } | ||
| 43 | @@ -294,6 +311,8 @@ | ||
| 44 | {"reverse-server", required_argument, 0, 'r'}, | ||
| 45 | {"expected-address", required_argument, 0, 'a'}, | ||
| 46 | {"expect-authority", no_argument, 0, 'A'}, | ||
| 47 | + {"warning", required_argument, 0, 'w'}, | ||
| 48 | + {"critical", required_argument, 0, 'c'}, | ||
| 49 | {0, 0, 0, 0} | ||
| 50 | }; | ||
| 51 | |||
| 52 | @@ -305,7 +324,7 @@ | ||
| 53 | strcpy (argv[c], "-t"); | ||
| 54 | |||
| 55 | while (1) { | ||
| 56 | - c = getopt_long (argc, argv, "hVvAt:H:s:r:a:", long_opts, &opt_index); | ||
| 57 | + c = getopt_long (argc, argv, "hVvAt:H:s:r:a:w:c:", long_opts, &opt_index); | ||
| 58 | |||
| 59 | if (c == -1 || c == EOF) | ||
| 60 | break; | ||
| 61 | @@ -358,6 +377,12 @@ | ||
| 62 | case 'A': /* expect authority */ | ||
| 63 | expect_authority = TRUE; | ||
| 64 | break; | ||
| 65 | + case 'w': /* elapsed time > warning */ | ||
| 66 | + elapsed_warn_time = atof (optarg); | ||
| 67 | + break; | ||
| 68 | + case 'c': /* elapsed time > critical */ | ||
| 69 | + elapsed_crit_time = atof (optarg); | ||
| 70 | + break; | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 74 | @@ -387,11 +412,13 @@ | ||
| 75 | validate_arguments () | ||
| 76 | { | ||
| 77 | if (query_address[0] == 0) | ||
| 78 | - return ERROR; | ||
| 79 | - else | ||
| 80 | - return OK; | ||
| 81 | -} | ||
| 82 | + usage4 (_("Can't determine/parse address to query.")); | ||
| 83 | + | ||
| 84 | + if ( elapsed_crit_time != 0.0 && elapsed_warn_time > elapsed_crit_time ) | ||
| 85 | + usage4 (_("Warning time must be less than critical time.")); | ||
| 86 | |||
| 87 | + return OK; | ||
| 88 | +} | ||
| 89 | |||
| 90 | void | ||
| 91 | print_help (void) | ||
| 92 | @@ -419,7 +446,13 @@ | ||
| 93 | -a, --expected-address=IP-ADDRESS\n\ | ||
| 94 | Optional IP address you expect the DNS server to return\n\ | ||
| 95 | -A, --expect-authority\n\ | ||
| 96 | - Optionally expect the DNS server to be authoritative for the lookup\n")); | ||
| 97 | + Optionally expect the DNS server to be authoritative for the lookup\n\ | ||
| 98 | +-w, --warning=seconds\n\ | ||
| 99 | + Return warning if elapsed time exceeds value. Default is 0.0 seconds (off).\n\ | ||
| 100 | +-c, --critical=seconds\n\ | ||
| 101 | + Return critical if elapsed time exceeds value. Default is 0.0 seconds (off).\n\ | ||
| 102 | +\n\ | ||
| 103 | +seconds are floating point values. Set to 0 turn off check.\n")); | ||
| 104 | |||
| 105 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
| 106 | |||
| 107 | @@ -431,5 +464,5 @@ | ||
| 108 | print_usage (void) | ||
| 109 | { | ||
| 110 | printf ("\ | ||
| 111 | -Usage: %s -H host [-s server] [-a expected-address] [-A] [-t timeout]\n", progname); | ||
| 112 | +Usage: %s -H host [-s server] [-a expected-address] [-A] [-t timeout] [-w warn] [-c crit]\n", progname); | ||
| 113 | } | ||
diff --git a/web/attachments/154472-nagios_plugins-check_test.patch b/web/attachments/154472-nagios_plugins-check_test.patch new file mode 100644 index 0000000..832c6a0 --- /dev/null +++ b/web/attachments/154472-nagios_plugins-check_test.patch | |||
| @@ -0,0 +1,172 @@ | |||
| 1 | --- ../../original_sources/nagios-plugins-1.4.2/contrib/check_test 2005-10-11 20:24:13.349222200 -0400 | ||
| 2 | +++ nagios-plugins-1.4.2/contrib/check_test 2005-10-11 20:22:49.205014064 -0400 | ||
| 3 | @@ -0,0 +1,169 @@ | ||
| 4 | +#! /bin/bash | ||
| 5 | + | ||
| 6 | +# Author: John P. Rouillard - rouilj@cs.umb.edu, | ||
| 7 | +# rouilj-check_test@renesys.com | ||
| 8 | +# A quick and dirty test program similar to check_dummy, but exit | ||
| 9 | +# status is contollable from an external file. It can be used for | ||
| 10 | +# testing nagios service dependency and host dependency notification | ||
| 11 | +# suppression. | ||
| 12 | +# | ||
| 13 | +# Entries in the external file are composed of a label and an exit | ||
| 14 | +# code, or code list seperated by an = sign. | ||
| 15 | +# | ||
| 16 | +# The exit code list is any 1, 2 or 3 digit number which will exit | ||
| 17 | +# with that status (0, 1, 2 and 3 are valid for nagios). The code 'S' | ||
| 18 | +# or 's' will cause the process to sleep for 1 hour in the expectation | ||
| 19 | +# that it will recieve a kill signal from nagios. | ||
| 20 | +# | ||
| 21 | +# The label has one of the following forms: | ||
| 22 | +# | ||
| 23 | +# hostname-service_name (if -H specified) | ||
| 24 | +# service_name (if -E is not specified) | ||
| 25 | +# hostname (if -H specified) | ||
| 26 | +# default | ||
| 27 | +# | ||
| 28 | +# The labels are searched for in order. If no matching label is found, | ||
| 29 | +# one is appended to the command file, with exit status 0. If duplicate | ||
| 30 | +# labels are in the file, the last label takes precidence. So you can | ||
| 31 | +# append a label/exit code line to the file and get a change in the | ||
| 32 | +# exit code. | ||
| 33 | + | ||
| 34 | +# Exit code lists look like: | ||
| 35 | +# | ||
| 36 | +# label=value1,value2,value3,value4,...,valueN | ||
| 37 | +# | ||
| 38 | +# where value1 is used for this invocation, and a new label entry is | ||
| 39 | +# added with value1 put after valueN so that value2 wil be used as | ||
| 40 | +# exit code on the next run. This allows deterministic runs of the | ||
| 41 | +# program for testing availability metrics and various senarios for | ||
| 42 | +# reporting and other related activities. | ||
| 43 | +# | ||
| 44 | +# Note that regular poll and error poll times along with the number of | ||
| 45 | +# retries to go from soft to hard have to be considered when designing | ||
| 46 | +# a test. | ||
| 47 | +# | ||
| 48 | +# Options: | ||
| 49 | +help="Usage: $0 -E -s <svc> -H <host> -e <exitcode> -f <file> -ht -m <msg> | ||
| 50 | + -E - exact entry including hostname is needed. Prevents matching | ||
| 51 | + only on service_ name. | ||
| 52 | + -H <hostname> - the hostname this test is running on. No default. | ||
| 53 | + -e <exit code> - used like check dummy, always exits with this | ||
| 54 | + status code. Ignores the external file. | ||
| 55 | + -f <filename> - the external file name used for determining exit | ||
| 56 | + code. Default: /tmp/check_test. | ||
| 57 | + -h - This help text. | ||
| 58 | + -s <service_name> - the service description for this test. Default | ||
| 59 | + the basename of the progam name. | ||
| 60 | + -t - enable tracing info for debugging. Note this will cause | ||
| 61 | + problems is run from nagios. | ||
| 62 | + -m - message to be put out when running. | ||
| 63 | +" | ||
| 64 | + | ||
| 65 | +## standard debugging preamble | ||
| 66 | +trace=true | ||
| 67 | +if ! [ -z "$SHELL_DEBUG" ]; then | ||
| 68 | + if echo "$SHELL_DEBUG" | grep -i xv > /dev/null 2>&1; then | ||
| 69 | + set -xv | ||
| 70 | + fi | ||
| 71 | + if echo "$SHELL_DEBUG" | grep -i trace > /dev/null 2>&1; then | ||
| 72 | + trace=echo | ||
| 73 | + fi | ||
| 74 | +fi | ||
| 75 | + | ||
| 76 | +## set variables | ||
| 77 | +exact="" | ||
| 78 | +exitcode=-1 | ||
| 79 | +filename=/tmp/check_test | ||
| 80 | +hostname="" | ||
| 81 | +message="" | ||
| 82 | +service_name=`basename $0` | ||
| 83 | + | ||
| 84 | + | ||
| 85 | +## parse arguments | ||
| 86 | +while getopts -- EH:e:f:hs:t arg | ||
| 87 | +do | ||
| 88 | + case "$arg" in | ||
| 89 | + E) exact="yes";; | ||
| 90 | + H) hostname="$OPTARG";; | ||
| 91 | + e) exitcode="$OPTARG";; | ||
| 92 | + f) filename="$OPTARG";; | ||
| 93 | + h) echo "$help"; exit;; | ||
| 94 | + m) message="$OPTARG";; | ||
| 95 | + s) service_name="$OPTARG";; | ||
| 96 | + t) trace=echo;; | ||
| 97 | + *) echo "Usage: $0 -E -s <svc> -H <host> -e <exitcode> -f <file>" | ||
| 98 | + exit 4;; | ||
| 99 | + esac | ||
| 100 | +done | ||
| 101 | + | ||
| 102 | +$trace "parsed arguments: $hostname, $service_name, $exitcode, $filename" | ||
| 103 | + | ||
| 104 | +## create command file if needed | ||
| 105 | +if ! [ -r $filename ]; then | ||
| 106 | + $trace Did not find readable file. Creating config file $filename | ||
| 107 | + # hmm how to capture. Wrapping with `` and assigning to variable | ||
| 108 | + # produces syntax error missing close ` in cygwin bash, but it works | ||
| 109 | + # interactively. | ||
| 110 | + touch $filename 2>&1 || \ | ||
| 111 | + eval "echo \"$0: Unable to create $filename, $error\" && exit 2" | ||
| 112 | +fi | ||
| 113 | + | ||
| 114 | +## find the exit code entry for this invocation | ||
| 115 | +if [ $exitcode = "-1" ]; then | ||
| 116 | + rule=`grep "^$hostname-$service_name=" $filename | tail -1` | ||
| 117 | + if [ -z "$rule" ]; then | ||
| 118 | + if [ -z "$exact" ]; then | ||
| 119 | + rule=`grep "^$service_name=" $filename | tail -1` | ||
| 120 | + fi | ||
| 121 | + if [ -z "$rule" ]; then | ||
| 122 | + if [ -n "$hostname" ]; then | ||
| 123 | + rule=`grep "^$hostname=" $filename | tail -1` | ||
| 124 | + fi | ||
| 125 | + if [ -z "$rule" ]; then | ||
| 126 | + rule=`grep "^default=" $filename | tail -1` | ||
| 127 | + if [ -z "$rule" ]; then | ||
| 128 | + $trace no matching rule found, creating new rule | ||
| 129 | + rule="${hostname}${hostname:+-}${service_name}=0" | ||
| 130 | + echo $rule >> $filename | ||
| 131 | + fi | ||
| 132 | + fi | ||
| 133 | + fi | ||
| 134 | + fi | ||
| 135 | + $trace rule is $rule | ||
| 136 | + | ||
| 137 | + ## split the rule to isolate the exit code(s). | ||
| 138 | + IFS="=" | ||
| 139 | + set -- $rule | ||
| 140 | + IFS="" | ||
| 141 | + | ||
| 142 | + if [ $# -gt 2 ]; then | ||
| 143 | + echo "$0: Malformed rule $rule:" | ||
| 144 | + exit 2 | ||
| 145 | + fi | ||
| 146 | + | ||
| 147 | + exitcode="$2" | ||
| 148 | + label=$1 | ||
| 149 | +fi | ||
| 150 | + | ||
| 151 | +## exit with message and proper code and rotate exit code list if present | ||
| 152 | +while true; do | ||
| 153 | + case $exitcode in | ||
| 154 | + 0) echo $0: $message exiting 0; exit 0;; | ||
| 155 | + 1) echo $0: $message exiting 1; exit 1;; | ||
| 156 | + 2) echo $0: $message exiting 2; exit 2;; | ||
| 157 | + [0-9]|[0-9][0-9]|[0-9][0-9][0-9]) | ||
| 158 | + # exit with odd exit codes | ||
| 159 | + echo $0: $message exiting $exitcode; exit $exitcode;; | ||
| 160 | + s|S) sleep 3600 ;; # stall forcing parent nagios to kill us | ||
| 161 | + *,*) IFS="," | ||
| 162 | + set -- $exitcode | ||
| 163 | + exitcode=$1 | ||
| 164 | + shift | ||
| 165 | + exitcodes="$*,$exitcode" | ||
| 166 | + echo "$label=$exitcodes" >> $filename | ||
| 167 | + # not checking for bad/missing exit code here. main | ||
| 168 | + # loop will do that. | ||
| 169 | + ;; | ||
| 170 | + *) echo "$0: Unrecognised status code $rule"; exit 2;; | ||
| 171 | + esac | ||
| 172 | +done | ||
diff --git a/web/attachments/154473-nagios_plugins-nagios_shell.patch b/web/attachments/154473-nagios_plugins-nagios_shell.patch new file mode 100644 index 0000000..64e7d5f --- /dev/null +++ b/web/attachments/154473-nagios_plugins-nagios_shell.patch | |||
| @@ -0,0 +1,168 @@ | |||
| 1 | --- ../../original_sources/nagios-plugins-1.4.2/contrib/nagios_shell 2005-10-11 20:27:28.411568216 -0400 | ||
| 2 | +++ nagios-plugins-1.4.2/contrib/nagios_shell 2005-10-11 20:28:54.933414896 -0400 | ||
| 3 | @@ -0,0 +1,165 @@ | ||
| 4 | +#! /usr/bin/perl -T | ||
| 5 | + | ||
| 6 | +# changable variables | ||
| 7 | +# set $NAGIOS_PLUGIN_DIR to the directory that contains the nagios plugins. | ||
| 8 | +# Don't include a trailing '/'. | ||
| 9 | +my($NAGIOS_PLUGIN_DIR)="PLUGIN_DIR_HERE"; | ||
| 10 | + | ||
| 11 | +# Other commands that can be run via this shell. It is strongly | ||
| 12 | +# recommended that all of these are specified with a full path name. | ||
| 13 | +my(@other_commands) = ( | ||
| 14 | +); | ||
| 15 | + | ||
| 16 | +# set the PATH needed for the commands run under this shell. | ||
| 17 | +$ENV{'PATH'} = "/bin:/usr/bin:/usr/sbin"; | ||
| 18 | + | ||
| 19 | +#Name: nagiosshell | ||
| 20 | +#Use: used as forced command under ssh as receiver for check_by_ssh plugin | ||
| 21 | +#Function: Check provided command and runs it from predefined directory | ||
| 22 | +# or fully specified path. | ||
| 23 | +# Example: in ~nagios/.ssh/authorized_keys on system to be monitoed using | ||
| 24 | +# check_by_ssh: | ||
| 25 | +# | ||
| 26 | +# command="/path/to/nagiosshell" from="nagios.example.org" ssh-rsa AAAAB3N... | ||
| 27 | +# | ||
| 28 | +# This has not been tested with the multiple passive mode of check_by_ssh. | ||
| 29 | + | ||
| 30 | +use warnings; | ||
| 31 | +use strict; | ||
| 32 | + | ||
| 33 | +my($command, $exec_command, @args, @exec_args, $i); | ||
| 34 | + | ||
| 35 | +die("$0: Not running as forced command, \$SSH_ORIGINAL_COMMAND not found.\n") | ||
| 36 | + if (not exists($ENV{"SSH_ORIGINAL_COMMAND"})); | ||
| 37 | + | ||
| 38 | +($command, @args) = split(' ', $ENV{"SSH_ORIGINAL_COMMAND"}); | ||
| 39 | +if ($command !~ m#/#) { | ||
| 40 | + # then its a command name and not a full path | ||
| 41 | + if (! -x "$NAGIOS_PLUGIN_DIR/$command") { | ||
| 42 | + print "$0: Unable to find command $NAGIOS_PLUGIN_DIR/$command.\n"; | ||
| 43 | + exit 3; | ||
| 44 | + } else { | ||
| 45 | + # create the fully qualified name | ||
| 46 | + ($exec_command) = ($command =~ m/^([A-z0-9_.-]+)$/); | ||
| 47 | + $exec_command = "$NAGIOS_PLUGIN_DIR/$exec_command"; | ||
| 48 | + } | ||
| 49 | +} else { | ||
| 50 | + # we have a qualified command path, verify it | ||
| 51 | + foreach $i (@other_commands) { | ||
| 52 | + $exec_command = $i if ($i eq $command); | ||
| 53 | + } | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +if (! $exec_command) { | ||
| 57 | + print "$0: Unable to validate $command\n"; | ||
| 58 | + exit 3; | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +# set up a clean environment | ||
| 62 | +# PATH is explicitly set at top of script in modifyable variables. | ||
| 63 | +delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV', 'PERLLIB'}; | ||
| 64 | + | ||
| 65 | +# clean the args | ||
| 66 | +foreach (@args) { | ||
| 67 | + if ( m/^([^`;()]*)$/ ) { | ||
| 68 | + push(@exec_args, $1); | ||
| 69 | + } else { | ||
| 70 | + die ("$0: Unsafe argument $_ found. Exiting.\n"); | ||
| 71 | + } | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +# run the requested command without executing a shell. | ||
| 75 | +if (@exec_args) { | ||
| 76 | + eval {no warnings 'all'; exec $exec_command $exec_command, @exec_args}; | ||
| 77 | +} else { | ||
| 78 | + eval {no warnings 'all'; exec $exec_command $exec_command}; | ||
| 79 | +} | ||
| 80 | + | ||
| 81 | +use warnings; | ||
| 82 | + | ||
| 83 | +die("$0: Unable to exec ($!) $exec_command with args: \"" . join('", "', @exec_args) . "\".\n"); | ||
| 84 | + | ||
| 85 | +#TESTPREP: | ||
| 86 | +# mkdir $NAGIOS_PLUGIN_DIR | ||
| 87 | +# echo '#! /usr/bin/foo' > $NAGIOS_PLUGIN_BIN/check_foo | ||
| 88 | +# echo '#! /bin/sh' > $NAGIOS_PLUGIN_BIN/check_bar | ||
| 89 | +# echo 'ls "$@"' >> $NAGIOS_PLUGIN_BIN/check_bar | ||
| 90 | +# chmod +x $NAGIOS_PLUGIN_BIN/check_bar $NAGIOS_PLUGIN_BIN/check_foo | ||
| 91 | + | ||
| 92 | +#TEST: | ||
| 93 | +#- plugin unable to exec good args | ||
| 94 | +# SSH_ORIGINAL_COMMAND='check_foo -w 3:5 -c 2,4,3 -d 12-34' ./nagios_shell | ||
| 95 | +##Unable to exec (No such file or directory) /tmp/nagiosplug/check_foo | ||
| 96 | +## with args: "-w", "3:5", "-c", "2,4,3", "-d", "12-34". | ||
| 97 | + | ||
| 98 | +#- plugin unable to exec bad args | ||
| 99 | +# SSH_ORIGINAL_COMMAND='check_foo -w 3`5 -c 2,4,3 -d 12-34' ./nagios_shell | ||
| 100 | +##./nagios_shell: Unsafe argument 3`5 found. Exiting. | ||
| 101 | + | ||
| 102 | +#- plugin unable to exec no args | ||
| 103 | +# SSH_ORIGINAL_COMMAND='check_foo' ./nagios_shell | ||
| 104 | +##./nagios_shell: Unable to exec (No such file or directory) | ||
| 105 | +## /tmp/nagiosplug/check_foo with args: "". | ||
| 106 | + | ||
| 107 | +#- plugin able to exec good args | ||
| 108 | +# SSH_ORIGINAL_COMMAND='check_bar -w 3:5 -c 2,4,3 -d 12-34' ./nagios_shell | ||
| 109 | +##ls: 2,4,3: No such file or directory | ||
| 110 | +##ls: 12-34: No such file or directory | ||
| 111 | + | ||
| 112 | +#- plugin able to exec bad args | ||
| 113 | +# SSH_ORIGINAL_COMMAND='check_bar -w 35 -c 2,4,3 -d (12-34)' ./nagios_shell | ||
| 114 | +##./nagios_shell: Unsafe argument (12-34) found. Exiting. | ||
| 115 | + | ||
| 116 | +#- plugin able to exec no args | ||
| 117 | +# SSH_ORIGINAL_COMMAND='check_bar' ./nagios_shell | ||
| 118 | +## list of files in directory | ||
| 119 | + | ||
| 120 | +#- non existant plugin no args | ||
| 121 | +# SSH_ORIGINAL_COMMAND='check_zap' ./nagios_shell | ||
| 122 | +##./nagios_shell: Unable to find command /tmp/nagiosplug/check_zap. | ||
| 123 | + | ||
| 124 | +#- non existant plugin bad args | ||
| 125 | +# SSH_ORIGINAL_COMMAND='check_zap (foo' ./nagios_shell | ||
| 126 | +##./nagios_shell: Unable to find command /tmp/nagiosplug/check_zap. | ||
| 127 | + | ||
| 128 | +#- non existant plugin good args | ||
| 129 | +# SSH_ORIGINAL_COMMAND='check_zap foo' ./nagios_shell | ||
| 130 | +##./nagios_shell: Unable to find command /tmp/nagiosplug/check_zap. | ||
| 131 | + | ||
| 132 | +#- explicit command unable to exec (non-existent) good args | ||
| 133 | +# SSH_ORIGINAL_COMMAND='/usr/bin/nc1 -l /tmp' ./nagios_shell | ||
| 134 | +##Unable to exec (No such file or directory) /usr/bin/nc1 with args: | ||
| 135 | +## "-l", "/tmp". | ||
| 136 | + | ||
| 137 | +#- explicit command unable to exec (non-existent) bad args | ||
| 138 | +# SSH_ORIGINAL_COMMAND='/usr/bin/nc1 -l (/tmp)' ./nagios_shell | ||
| 139 | +##Unsafe argument (/tmp) found. Exiting. | ||
| 140 | + | ||
| 141 | +#- explicit command unable to exec (non-existent) no args | ||
| 142 | +# SSH_ORIGINAL_COMMAND='/usr/bin/nc1' ./nagios_shell | ||
| 143 | +##./nagios_shell: Unable to exec (No such file or directory) | ||
| 144 | +## /usr/bin/nc1 with args: "". | ||
| 145 | + | ||
| 146 | +#- explicit command able to exec good args | ||
| 147 | +# SSH_ORIGINAL_COMMAND='/usr/bin/ls -l /dev/null' ./nagios_shell | ||
| 148 | +##crw-rw-rw- 1 rouilj None 1, 3 Sep 24 23:19 /dev/null | ||
| 149 | + | ||
| 150 | +#- explicit command able to exec bad args | ||
| 151 | +# SSH_ORIGINAL_COMMAND='/usr/bin/ls -l `/dev/null`' ./nagios_shell | ||
| 152 | +##./nagios_shell: Unsafe argument `/dev/null` found. Exiting. | ||
| 153 | + | ||
| 154 | +#- explicit command able to exec no args | ||
| 155 | +# SSH_ORIGINAL_COMMAND='/usr/bin/ls ' ./nagios_shell | ||
| 156 | +##list of files in directory | ||
| 157 | + | ||
| 158 | +#- explicit command not found in list | ||
| 159 | +# SSH_ORIGINAL_COMMAND='/usr/bin/nc3' ./nagios_shell | ||
| 160 | +##./nagios_shell: Unable to validate /usr/bin/nc3 | ||
| 161 | + | ||
| 162 | +#- explicit command not found in list bad args | ||
| 163 | +# SSH_ORIGINAL_COMMAND='/usr/bin/nc3 (foo' ./nagios_shell | ||
| 164 | +##./nagios_shell: Unable to validate /usr/bin/nc3 | ||
| 165 | + | ||
| 166 | +#- explicit command not found in list good args | ||
| 167 | +# SSH_ORIGINAL_COMMAND='/usr/bin/nc3 foo' ./nagios_shell | ||
| 168 | +##./nagios_shell: Unable to validate /usr/bin/nc3 | ||
diff --git a/web/attachments/154512-check_linux_raid.pl b/web/attachments/154512-check_linux_raid.pl new file mode 100644 index 0000000..a7a948a --- /dev/null +++ b/web/attachments/154512-check_linux_raid.pl | |||
| @@ -0,0 +1,111 @@ | |||
| 1 | #!/usr/bin/perl -w | ||
| 2 | |||
| 3 | # Copyright (c) 2002 ISOMEDIA, Inc. | ||
| 4 | # Written by Steve Milton | ||
| 5 | # Released under the GNU Public License | ||
| 6 | # | ||
| 7 | # This program is free software; you can redistribute it and/or modify | ||
| 8 | # it under the terms of the GNU General Public License as published by | ||
| 9 | # the Free Software Foundation; either version 2 of the License, or | ||
| 10 | # (at your option) any later version. | ||
| 11 | # | ||
| 12 | # This program is distributed in the hope that it will be useful, | ||
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | # GNU General Public License for more details. | ||
| 16 | # | ||
| 17 | # You should have received a copy of the GNU General Public License | ||
| 18 | # along with this program; if not, write to the Free Software | ||
| 19 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 20 | # | ||
| 21 | # Usage: check_raid <raid-name> | ||
| 22 | # Example: check_raid md0 | ||
| 23 | # WARNING md0 status=[UUU_U], recovery=46.4%, finish=123.0min | ||
| 24 | |||
| 25 | use strict; | ||
| 26 | use Getopt::Long qw(:config no_ignore_case); | ||
| 27 | |||
| 28 | my %ERRORS=('DEPENDENT'=>4,'UNKNOWN'=>3,'OK'=>0,'WARNING'=>1,'CRITICAL'=>2); | ||
| 29 | |||
| 30 | my $mdstat = "/proc/mdstat"; | ||
| 31 | my $verbose = 0; | ||
| 32 | |||
| 33 | GetOptions('mdstat=s' => \$mdstat, | ||
| 34 | 'v|verbose+' => \$verbose, | ||
| 35 | 'h|help' => sub { usage(); exit $ERRORS{'UNKNOWN'}; }, | ||
| 36 | 'V|version' => sub { version(); exit $ERRORS{'UNKNOWN'}; }); | ||
| 37 | |||
| 38 | # die with an error if we're not on Linux | ||
| 39 | if ($^O ne 'linux') { | ||
| 40 | print "This plugin only applicable on Linux.\n"; | ||
| 41 | exit $ERRORS{'UNKNOWN'}; | ||
| 42 | } | ||
| 43 | |||
| 44 | my $mddev = shift; | ||
| 45 | |||
| 46 | open (MDSTAT, "<$mdstat") or die "Failed to open $mdstat"; | ||
| 47 | my $found = 0; | ||
| 48 | my $status = ""; | ||
| 49 | my $recovery = ""; | ||
| 50 | my $finish = ""; | ||
| 51 | my $speed = ""; | ||
| 52 | my $active = ""; | ||
| 53 | while(<MDSTAT>) { | ||
| 54 | chomp; | ||
| 55 | if ($found) { | ||
| 56 | if (/(\[[_U]+\])/) { | ||
| 57 | $status = $1; | ||
| 58 | } elsif (/recovery *= *([^ ]+)/) { | ||
| 59 | $recovery = $1; | ||
| 60 | ($finish) = /finish= *([^ ]+)/; | ||
| 61 | ($speed) = /speed= *([^ ]+)/; | ||
| 62 | } elsif (/^[^ \t]/) { | ||
| 63 | last; | ||
| 64 | } | ||
| 65 | } else { | ||
| 66 | if (/^$mddev\s*:/) { | ||
| 67 | $found = 1; | ||
| 68 | if (/active/) { | ||
| 69 | $active = 1; | ||
| 70 | } | ||
| 71 | } | ||
| 72 | } | ||
| 73 | } | ||
| 74 | |||
| 75 | my $msg = "FAILURE"; | ||
| 76 | my $code = "UNKNOWN"; | ||
| 77 | if ($status =~ /_/) { | ||
| 78 | if ($recovery) { | ||
| 79 | $msg = "$mddev status=$status, recovery=$recovery, finish=$finish, speed=$speed", | ||
| 80 | $code = "WARNING"; | ||
| 81 | } else { | ||
| 82 | $msg = "$mddev status=$status"; | ||
| 83 | $code = "CRITICAL"; | ||
| 84 | } | ||
| 85 | } elsif ($status =~ /U+/) { | ||
| 86 | $msg = "$mddev status=$status"; | ||
| 87 | $code = "OK"; | ||
| 88 | } else { | ||
| 89 | if ($active) { | ||
| 90 | $msg = "$mddev active with no status information"; | ||
| 91 | $code = "OK"; | ||
| 92 | } else { | ||
| 93 | $msg = "$mddev does not exist"; | ||
| 94 | $code = "CRITICAL"; | ||
| 95 | } | ||
| 96 | } | ||
| 97 | |||
| 98 | print "RAID $code: $msg\n"; | ||
| 99 | exit ($ERRORS{$code}); | ||
| 100 | |||
| 101 | sub usage { | ||
| 102 | print qq{usage: | ||
| 103 | check_linux_raid.pl [--mdstat=</proc/mdstat>] <md-device> | ||
| 104 | e.g. | ||
| 105 | check_linux_raid.pl md0 | ||
| 106 | }; | ||
| 107 | } | ||
| 108 | |||
| 109 | sub version { | ||
| 110 | print "check_linux_raid.pl 1.1\n"; | ||
| 111 | } | ||
diff --git a/web/attachments/154515-nagios_plugins-check_ssh.c.patch b/web/attachments/154515-nagios_plugins-check_ssh.c.patch new file mode 100644 index 0000000..da31ea2 --- /dev/null +++ b/web/attachments/154515-nagios_plugins-check_ssh.c.patch | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | --- ../../original_sources/nagios-plugins-1.4.2/plugins/check_ssh.c 2005-04-11 14:02:40.000000000 -0400 | ||
| 2 | +++ nagios-plugins-1.4.2/plugins/check_ssh.c 2005-10-31 09:04:34.000000000 -0500 | ||
| 3 | @@ -36,7 +36,8 @@ | ||
| 4 | |||
| 5 | int port = -1; | ||
| 6 | char *server_name = NULL; | ||
| 7 | -char *remote_version = NULL; | ||
| 8 | +int remote_versions = 0; | ||
| 9 | +char **remote_version; | ||
| 10 | int verbose = FALSE; | ||
| 11 | |||
| 12 | int process_arguments (int, char **); | ||
| 13 | @@ -44,7 +45,7 @@ | ||
| 14 | void print_help (void); | ||
| 15 | void print_usage (void); | ||
| 16 | |||
| 17 | -int ssh_connect (char *haddr, int hport, char *remote_version); | ||
| 18 | +int ssh_connect (char *haddr, int hport, char **remote_version); | ||
| 19 | |||
| 20 | |||
| 21 | |||
| 22 | @@ -136,9 +137,13 @@ | ||
| 23 | usage4 (_("IPv6 support not available")); | ||
| 24 | #endif | ||
| 25 | break; | ||
| 26 | - case 'r': /* remote version */ | ||
| 27 | - remote_version = optarg; | ||
| 28 | - break; | ||
| 29 | + case 'r': /* remote version multiple occurances allowed */ | ||
| 30 | + if (verbose) printf("pre-parsing %s-%d\n",optarg, remote_versions); | ||
| 31 | + remote_version = realloc(remote_version, (++remote_versions) * sizeof(char *)); | ||
| 32 | + if (verbose) printf("post-parsing %s\n",optarg); | ||
| 33 | + | ||
| 34 | + remote_version[remote_versions - 1] = optarg; | ||
| 35 | + break; | ||
| 36 | case 'H': /* host */ | ||
| 37 | if (is_host (optarg) == FALSE) | ||
| 38 | usage2 (_("Invalid hostname/address"), optarg); | ||
| 39 | @@ -193,7 +198,7 @@ | ||
| 40 | |||
| 41 | |||
| 42 | int | ||
| 43 | -ssh_connect (char *haddr, int hport, char *remote_version) | ||
| 44 | +ssh_connect (char *haddr, int hport, char **remote_version) | ||
| 45 | { | ||
| 46 | int sd; | ||
| 47 | int result; | ||
| 48 | @@ -202,6 +207,7 @@ | ||
| 49 | char *ssh_proto = NULL; | ||
| 50 | char *ssh_server = NULL; | ||
| 51 | char rev_no[20]; | ||
| 52 | + int remote_versions_i; | ||
| 53 | |||
| 54 | sscanf ("$Revision: 1.27 $", "$Revision: %[0123456789.]", rev_no); | ||
| 55 | |||
| 56 | @@ -230,11 +236,26 @@ | ||
| 57 | if (verbose) | ||
| 58 | printf ("%s\n", buffer); | ||
| 59 | |||
| 60 | - if (remote_version && strcmp(remote_version, ssh_server)) { | ||
| 61 | - printf | ||
| 62 | - (_("SSH WARNING - %s (protocol %s) version mismatch, expected '%s'\n"), | ||
| 63 | - ssh_server, ssh_proto, remote_version); | ||
| 64 | - exit (STATE_WARNING); | ||
| 65 | + if ( remote_versions ) { | ||
| 66 | + remote_versions_i = remote_versions; | ||
| 67 | + while ( remote_versions_i > 0) { | ||
| 68 | + if (verbose) printf("Comparing server '%s' to -r opt '%s'\n", ssh_server, remote_version[remote_versions_i -1]); | ||
| 69 | + if ( ! strcmp(remote_version[remote_versions_i - 1], ssh_server)) { | ||
| 70 | + break; | ||
| 71 | + } else { | ||
| 72 | + remote_versions_i--; | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + if (remote_versions_i == 0) { | ||
| 76 | + printf | ||
| 77 | + (_("SSH WARNING - '%s' (protocol %s) version mismatch, expected "), | ||
| 78 | + ssh_server, ssh_proto); | ||
| 79 | + while (remote_versions > 0) { | ||
| 80 | + printf("'%s'%s", remote_version[remote_versions -1], remote_versions == 1?".\n":", "); | ||
| 81 | + remote_versions --; | ||
| 82 | + } | ||
| 83 | + exit (STATE_WARNING); | ||
| 84 | + } | ||
| 85 | } | ||
| 86 | |||
| 87 | printf | ||
| 88 | @@ -272,7 +293,9 @@ | ||
| 89 | |||
| 90 | printf (_("\ | ||
| 91 | -r, --remote-version=STRING\n\ | ||
| 92 | - Warn if string doesn't match expected server version (ex: OpenSSH_3.9p1)\n")); | ||
| 93 | + Warn if string doesn't match expected server version (ex: OpenSSH_3.9p1).\n")); | ||
| 94 | + printf (_("\ | ||
| 95 | + Can use multiple times to accept multiple version strings.\n")); | ||
| 96 | |||
| 97 | printf (_(UT_VERBOSE)); | ||
| 98 | |||
diff --git a/web/attachments/154773-nagios_plugins-check_tcp.c.patch b/web/attachments/154773-nagios_plugins-check_tcp.c.patch new file mode 100644 index 0000000..3d547df --- /dev/null +++ b/web/attachments/154773-nagios_plugins-check_tcp.c.patch | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | --- ../../original_sources/nagios-plugins-1.4.2/plugins/check_tcp.c 2005-06-05 13:43:58.000000000 -0400 | ||
| 2 | +++ nagios-plugins-1.4.2/plugins/check_tcp.c 2005-11-02 10:21:56.000000000 -0500 | ||
| 3 | @@ -78,6 +78,8 @@ | ||
| 4 | static char *server_address = NULL; | ||
| 5 | static char *server_send = NULL; | ||
| 6 | static char *server_quit = NULL; | ||
| 7 | +static char *lineend = ""; | ||
| 8 | +static char *lineendquit = "\r\n"; | ||
| 9 | static char **server_expect; | ||
| 10 | static size_t server_expect_count = 0; | ||
| 11 | static size_t maxbytes = 0; | ||
| 12 | @@ -404,6 +406,7 @@ | ||
| 13 | {"timeout", required_argument, 0, 't'}, | ||
| 14 | {"protocol", required_argument, 0, 'P'}, | ||
| 15 | {"port", required_argument, 0, 'p'}, | ||
| 16 | + {"lineend", required_argument, 0, 'l'}, | ||
| 17 | {"send", required_argument, 0, 's'}, | ||
| 18 | {"expect", required_argument, 0, 'e'}, | ||
| 19 | {"maxbytes", required_argument, 0, 'm'}, | ||
| 20 | @@ -445,7 +448,7 @@ | ||
| 21 | } | ||
| 22 | |||
| 23 | while (1) { | ||
| 24 | - c = getopt_long (argc, argv, "+hVv46H:s:e:q:m:c:w:t:p:C:W:d:Sr:jD:M:", | ||
| 25 | + c = getopt_long (argc, argv, "+hVv46H:l:s:e:q:m:c:w:t:p:C:W:d:Sr:jD:M:", | ||
| 26 | longopts, &option); | ||
| 27 | |||
| 28 | if (c == -1 || c == EOF || c == 1) | ||
| 29 | @@ -515,8 +518,30 @@ | ||
| 30 | else | ||
| 31 | server_port = atoi (optarg); | ||
| 32 | break; | ||
| 33 | + case 'l': | ||
| 34 | + switch (*optarg) { | ||
| 35 | + case 'n': | ||
| 36 | + lineend = "\n"; | ||
| 37 | + lineendquit = lineend; | ||
| 38 | + break; | ||
| 39 | + case 'r': | ||
| 40 | + lineend = "\r"; | ||
| 41 | + lineendquit = lineend; | ||
| 42 | + break; | ||
| 43 | + case 'b': | ||
| 44 | + lineend = "\r\n"; | ||
| 45 | + lineendquit = lineend; | ||
| 46 | + break; | ||
| 47 | + case 'e': | ||
| 48 | + lineend = ""; | ||
| 49 | + | ||
| 50 | + break; | ||
| 51 | + default: | ||
| 52 | + usage4 (_("Unrecognized option to -l not r, n, b or e.")); | ||
| 53 | + } | ||
| 54 | + break; | ||
| 55 | case 's': | ||
| 56 | - server_send = optarg; | ||
| 57 | + asprintf(&server_send, "%s%s", optarg, lineend); | ||
| 58 | break; | ||
| 59 | case 'e': /* expect string (may be repeated) */ | ||
| 60 | EXPECT = NULL; | ||
| 61 | @@ -533,7 +558,7 @@ | ||
| 62 | else | ||
| 63 | maxbytes = strtol (optarg, NULL, 0); | ||
| 64 | case 'q': | ||
| 65 | - asprintf(&server_quit, "%s\r\n", optarg); | ||
| 66 | + asprintf(&server_quit, "%s%s", optarg, lineendquit); | ||
| 67 | break; | ||
| 68 | case 'r': | ||
| 69 | if (!strncmp(optarg,"ok",2)) | ||
| 70 | @@ -738,6 +763,10 @@ | ||
| 71 | printf (_(UT_IPv46)); | ||
| 72 | |||
| 73 | printf (_("\ | ||
| 74 | + -l, --lineend=b|e|n|r\n\ | ||
| 75 | + Ending on -s nd -q strings. b - both: <cr><lf> style, e - empty no\n\ | ||
| 76 | + end, n - newline: newline end, r - return: carriage return end\n\ | ||
| 77 | + Default is \"-l e -s <send> -l b -q <quit>\".\n\ | ||
| 78 | -s, --send=STRING\n\ | ||
| 79 | String to send to the server\n\ | ||
| 80 | -e, --expect=STRING\n\ | ||
| 81 | @@ -783,6 +812,6 @@ | ||
| 82 | [-s <send string>] [-e <expect string>] [-q <quit string>]\n\ | ||
| 83 | [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\ | ||
| 84 | [-r <refuse state>] [-M <mismatch state>] [-v] [-4|-6] [-j]\n\ | ||
| 85 | - [-D <days to cert expiry>] [-S <use SSL>]\n", progname); | ||
| 86 | + [-D <days to cert expiry>] [-S <use SSL>] [-l <n|r|b|e>]\n", progname); | ||
| 87 | } | ||
| 88 | |||
diff --git a/web/attachments/156009-check_email_loop.diff b/web/attachments/156009-check_email_loop.diff new file mode 100644 index 0000000..01901f4 --- /dev/null +++ b/web/attachments/156009-check_email_loop.diff | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | Index: check_email_loop.pl | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/contrib/check_email_loop.pl,v | ||
| 4 | retrieving revision 1.3 | ||
| 5 | diff -r1.3 check_email_loop.pl | ||
| 6 | 1c1 | ||
| 7 | < #!/usr/bin/perl | ||
| 8 | --- | ||
| 9 | > #!/usr/bin/perl -w | ||
| 10 | 51a52,53 | ||
| 11 | > $debug = 0; | ||
| 12 | > | ||
| 13 | 115c117 | ||
| 14 | < %other_smtp_opts={}; | ||
| 15 | --- | ||
| 16 | > %other_smtp_opts=(); | ||
diff --git a/web/attachments/156702-nagios.configure.patch b/web/attachments/156702-nagios.configure.patch new file mode 100644 index 0000000..554cd7a --- /dev/null +++ b/web/attachments/156702-nagios.configure.patch | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | --- nagios-plugins-1.4.2/configure.in 2005-09-19 23:51:19.000000000 +1000 | ||
| 2 | +++ nagios-plugins-1.4.2.new/configure.in 2005-11-17 15:36:08.000000000 +1100 | ||
| 3 | @@ -227,45 +227,27 @@ | ||
| 4 | dnl Check for mysql libraries | ||
| 5 | _SAVEDLIBS="$LIBS" | ||
| 6 | _SAVEDCPPFLAGS="$CPPFLAGS" | ||
| 7 | -AC_ARG_WITH(mysql, | ||
| 8 | - ACX_HELP_STRING([--with-mysql=DIR], | ||
| 9 | - [sets path to mysql installation (assumes lib/mysql and include subdirs]), | ||
| 10 | - MYSQL=$withval,) | ||
| 11 | -if test -n "$MYSQL"; then | ||
| 12 | - MYSQLLIBDIR=$MYSQL/lib/mysql | ||
| 13 | - CPPFLAGS="-I$MYSQL/include" | ||
| 14 | - AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L$MYSQLLIBDIR ",,-L$MYSQLLIBDIR -lz) | ||
| 15 | - AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient") | ||
| 16 | -elif test -f /usr/lib/libmysqlclient.so; then | ||
| 17 | - AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz) | ||
| 18 | - AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient") | ||
| 19 | -elif test -f /usr/lib/libmysqlclient.a; then | ||
| 20 | - AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz) | ||
| 21 | - AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient") | ||
| 22 | -elif test -f /usr/lib/mysql/libmysqlclient.so; then | ||
| 23 | - AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz) | ||
| 24 | - AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql) | ||
| 25 | -elif test -f /usr/lib/mysql/libmysqlclient.a; then | ||
| 26 | - AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz) | ||
| 27 | - AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql) | ||
| 28 | -fi | ||
| 29 | -if test "$ac_cv_lib_mysqlclient_mysql_init" = "yes" -o "$ac_cv_lib_mysqlclient_mysql_close" = "yes"; then | ||
| 30 | - AC_CHECK_HEADERS(mysql/mysql.h mysql/errmsg.h, MYSQLINCLUDE="-I$MYSQL/include" ) | ||
| 31 | - if test "$ac_cv_header_mysql_mysql_h" = "yes" -a "$ac_cv_header_mysql_errmsg_h" = "yes"; then | ||
| 32 | - EXTRAS="$EXTRAS check_mysql" | ||
| 33 | - AC_SUBST(MYSQLINCLUDE) | ||
| 34 | - AC_SUBST(MYSQLLIBS) | ||
| 35 | - AC_SUBST(check_mysql_LDFLAGS) | ||
| 36 | - else | ||
| 37 | + | ||
| 38 | +AC_PATH_PROG(MYSQLCONFIG,mysql_config) | ||
| 39 | + | ||
| 40 | +if test -z "$MYSQLCONFIG"; then | ||
| 41 | AC_MSG_WARN([Skipping mysql plugin]) | ||
| 42 | AC_MSG_WARN([install mysql client headers to compile this plugin (see REQUIREMENTS).]) | ||
| 43 | - fi | ||
| 44 | -else | ||
| 45 | - AC_MSG_WARN([Skipping mysql plugin]) | ||
| 46 | - AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).]) | ||
| 47 | +else | ||
| 48 | + MYSQLINCLUDE=`$MYSQLCONFIG --include` | ||
| 49 | + MYSQLCFLAGS=`$MYSQLCONFIG --cflags` | ||
| 50 | + MYSQLLIBS=`$MYSQLCONFIG --libs` | ||
| 51 | + check_mysql_LDFLAGS="$MYSQLLIBS" | ||
| 52 | + EXTRAS="$EXTRAS check_mysql" | ||
| 53 | + | ||
| 54 | + AC_SUBST(MYSQLINCLUDE) | ||
| 55 | + AC_SUBST(MYSQLLIBS) | ||
| 56 | + AC_SUBST(MYSQLCFLAGS) | ||
| 57 | + AC_SUBST(check_mysql_LDFLAGS) | ||
| 58 | fi | ||
| 59 | -CPPFLAGS="$_SAVEDCPPFLAGS $MYSQLINCLUDE" | ||
| 60 | -LIBS="$_SAVEDLIBS" | ||
| 61 | + | ||
| 62 | +CPPFLAGS="$_SAVEDCPPFLAGS $MYSQLCFLAGS" | ||
| 63 | +LIBS="$_SAVEDLIBS" | ||
| 64 | |||
| 65 | AC_CHECK_HEADERS(unistd.h) | ||
| 66 | |||
diff --git a/web/attachments/156798-check_dhcp--standardize.diff b/web/attachments/156798-check_dhcp--standardize.diff new file mode 100644 index 0000000..00cfc4c --- /dev/null +++ b/web/attachments/156798-check_dhcp--standardize.diff | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | --- check_dhcp.c.orig 2005-11-18 13:47:21.000000000 -0500 | ||
| 2 | +++ check_dhcp.c 2005-11-18 13:55:21.000000000 -0500 | ||
| 3 | @@ -27,8 +27,8 @@ | ||
| 4 | *****************************************************************************/ | ||
| 5 | |||
| 6 | const char *progname = "check_dhcp"; | ||
| 7 | -const char *revision = "$Revision: 1.7 $"; | ||
| 8 | -const char *copyright = "2001-2004"; | ||
| 9 | +const char *revision = "$Revision: 1.8 $"; | ||
| 10 | +const char *copyright = "2001-2005"; | ||
| 11 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 12 | |||
| 13 | #include "common.h" | ||
| 14 | @@ -106,11 +106,6 @@ | ||
| 15 | |||
| 16 | /**** Common definitions ****/ | ||
| 17 | |||
| 18 | -#define STATE_OK 0 | ||
| 19 | -#define STATE_WARNING 1 | ||
| 20 | -#define STATE_CRITICAL 2 | ||
| 21 | -#define STATE_UNKNOWN -1 | ||
| 22 | - | ||
| 23 | #define OK 0 | ||
| 24 | #define ERROR -1 | ||
| 25 | |||
| 26 | @@ -241,7 +236,7 @@ | ||
| 27 | |||
| 28 | int main(int argc, char **argv){ | ||
| 29 | int dhcp_socket; | ||
| 30 | - int result; | ||
| 31 | + int result = STATE_UNKNOWN; | ||
| 32 | |||
| 33 | setlocale (LC_ALL, ""); | ||
| 34 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 35 | @@ -921,8 +916,14 @@ | ||
| 36 | else if(request_specific_address==TRUE && received_requested_address==FALSE) | ||
| 37 | result=STATE_WARNING; | ||
| 38 | |||
| 39 | - | ||
| 40 | - printf("DHCP %s: ",(result==STATE_OK)?"ok":"problem"); | ||
| 41 | + if(result==0) /* garrett honeycutt 2005 */ | ||
| 42 | + printf("OK: "); | ||
| 43 | + else if(result==1) | ||
| 44 | + printf("WARNING: "); | ||
| 45 | + else if(result==2) | ||
| 46 | + printf("CRITICAL: "); | ||
| 47 | + else if(result==3) | ||
| 48 | + printf("UNKNOWN: "); | ||
| 49 | |||
| 50 | /* we didn't receive any DHCPOFFERs */ | ||
| 51 | if(dhcp_offer_list==NULL){ | ||
diff --git a/web/attachments/158101-check_disk_smb.pl.PATCH b/web/attachments/158101-check_disk_smb.pl.PATCH new file mode 100644 index 0000000..193932e --- /dev/null +++ b/web/attachments/158101-check_disk_smb.pl.PATCH | |||
| @@ -0,0 +1,148 @@ | |||
| 1 | --- check_disk_smb.pl.ORIG Sun Apr 17 22:22:41 2005 | ||
| 2 | +++ check_disk_smb.pl Mon Nov 28 20:11:19 2005 | ||
| 3 | @@ -1,7 +1,7 @@ | ||
| 4 | #!/usr/bin/perl -w | ||
| 5 | # | ||
| 6 | # | ||
| 7 | -# check_disk.pl <host> <share> <user> <pass> [warn] [critical] [port] | ||
| 8 | +# check_disk.pl <ip> <host> <share> <user> <pass> [warn] [critical] [port] | ||
| 9 | # | ||
| 10 | # Nagios host script to get the disk usage from a SMB share | ||
| 11 | # | ||
| 12 | @@ -15,6 +15,10 @@ | ||
| 13 | # allow setting of limits in MBytes or GBytes. Percentage settings for large | ||
| 14 | # drives is a pain in the butt | ||
| 15 | # 2-May-2002 - SGhosh fix for embedded perl | ||
| 16 | +# 11-Nov-2005 - John Relph | ||
| 17 | +# allow specifying IP address for NetBIOS names that don't resolve | ||
| 18 | +# correctly using DNS; specifically for *nix samba servers using | ||
| 19 | +# virtual names | ||
| 20 | # | ||
| 21 | # $Id: check_disk_smb.pl,v 1.12 2005/04/17 22:22:41 seanius Exp $ | ||
| 22 | # | ||
| 23 | @@ -23,7 +27,7 @@ | ||
| 24 | use POSIX; | ||
| 25 | use strict; | ||
| 26 | use Getopt::Long; | ||
| 27 | -use vars qw($opt_P $opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $verbose); | ||
| 28 | +use vars qw($opt_P $opt_V $opt_h $opt_H $opt_I $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $verbose); | ||
| 29 | use vars qw($PROGNAME); | ||
| 30 | use lib utils.pm ; | ||
| 31 | use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); | ||
| 32 | @@ -49,7 +53,9 @@ | ||
| 33 | "u=s" => \$opt_u, "username=s" => \$opt_u, | ||
| 34 | "s=s" => \$opt_s, "share=s" => \$opt_s, | ||
| 35 | "W=s" => \$opt_W, "workgroup=s" => \$opt_W, | ||
| 36 | - "H=s" => \$opt_H, "hostname=s" => \$opt_H); | ||
| 37 | + "H=s" => \$opt_H, "hostname=s" => \$opt_H, | ||
| 38 | + "I=s" => \$opt_I, "ipaddr=s" => \$opt_I | ||
| 39 | + ); | ||
| 40 | |||
| 41 | if ($opt_V) { | ||
| 42 | print_revision($PROGNAME,'$Revision: 1.12 $'); #' | ||
| 43 | @@ -68,8 +74,14 @@ | ||
| 44 | my $host = $1 if ($opt_H =~ /^([-_.A-Za-z0-9]+\$?)$/); | ||
| 45 | ($host) || usage("Invalid host: $opt_H\n"); | ||
| 46 | |||
| 47 | +($opt_I) || ($opt_I = shift) || ($opt_I = ''); | ||
| 48 | +my $ipaddr = ($opt_I =~ /^([-_.A-Za-z0-9]+\$?)$/ ? $1 : ''); | ||
| 49 | +if ($opt_I) { ($ipaddr) || usage("Invalid IP address: $opt_I\n"); } | ||
| 50 | + | ||
| 51 | +$smbclientoptions .= "-I $ipaddr " if $ipaddr; | ||
| 52 | + | ||
| 53 | ($opt_s) || ($opt_s = shift) || usage("Share volume not specified\n"); | ||
| 54 | -my $share = $1 if ($opt_s =~ /^([-_.A-Za-z0-9]+\$?)$/); | ||
| 55 | +my $share = $1 if ($opt_s =~ /^([-_.A-Za-z0-9 ]+\$?)$/); | ||
| 56 | ($share) || usage("Invalid share: $opt_s\n"); | ||
| 57 | |||
| 58 | ($opt_u) || ($opt_u = shift) || ($opt_u = "guest"); | ||
| 59 | @@ -120,27 +132,23 @@ | ||
| 60 | }; | ||
| 61 | alarm($TIMEOUT); | ||
| 62 | |||
| 63 | -# Execute an "ls" on the share using smbclient program | ||
| 64 | +# Execute a "du" on the share using smbclient program | ||
| 65 | # get the results into $res | ||
| 66 | if (defined($workgroup)) { | ||
| 67 | - $res = qx/$smbclient \/\/$host\/$share -W $workgroup -U $user%$pass $smbclientoptions -c ls/; | ||
| 68 | + print "$smbclient " . "\/\/$host\/$share" ." $pass -W $workgroup -U $user $smbclientoptions -c du\n" if ($verbose); | ||
| 69 | + $res = qx/$smbclient "\/\/$host\/$share" -W $workgroup -U $user%$pass $smbclientoptions -c du/; | ||
| 70 | } else { | ||
| 71 | - print "$smbclient " . "\/\/$host\/$share" ." $pass -U $user $smbclientoptions -c ls\n" if ($verbose); | ||
| 72 | - $res = qx/$smbclient \/\/$host\/$share -U $user%$pass $smbclientoptions -c ls/; | ||
| 73 | + print "$smbclient " . "\/\/$host\/$share" ." $pass -U $user $smbclientoptions -c du\n" if ($verbose); | ||
| 74 | + $res = qx/$smbclient "\/\/$host\/$share" -U $user%$pass $smbclientoptions -c du/; | ||
| 75 | } | ||
| 76 | #Turn off alarm | ||
| 77 | alarm(0); | ||
| 78 | |||
| 79 | -#Split $res into an array of lines | ||
| 80 | -@lines = split /\n/, $res; | ||
| 81 | - | ||
| 82 | -#Get the last line into $_ | ||
| 83 | -$_ = $lines[$#lines]; | ||
| 84 | -#print "$_\n"; | ||
| 85 | +print "result: $res" if ($verbose); | ||
| 86 | |||
| 87 | -#Process the last line to get free space. | ||
| 88 | +#Process the output to get free space. | ||
| 89 | #If line does not match required regexp, return an UNKNOWN error | ||
| 90 | -if (/\s*(\d*) blocks of size (\d*)\. (\d*) blocks available/) { | ||
| 91 | +if ($res =~ m/\s*(\d*) blocks of size (\d*)\. (\d*) blocks available/s) { | ||
| 92 | |||
| 93 | my ($avail) = ($3*$2)/1024; | ||
| 94 | my ($avail_bytes) = $avail; | ||
| 95 | @@ -189,9 +197,9 @@ | ||
| 96 | $avail = $avail ."K"; | ||
| 97 | } | ||
| 98 | |||
| 99 | -#print ":$warn:$warn_type:\n"; | ||
| 100 | -#print ":$crit:$crit_type:\n"; | ||
| 101 | -#print ":$avail:$avail_bytes:$capper:$mountpt:\n"; | ||
| 102 | +print ":$warn:$warn_type:\n" if ($verbose); | ||
| 103 | +print ":$crit:$crit_type:\n" if ($verbose); | ||
| 104 | +print ":$avail:$avail_bytes:$capper:$mountpt:\n" if ($verbose); | ||
| 105 | |||
| 106 | if ((($warn_type eq "P") && (100 - $capper) < $warn) || (($warn_type eq "K") && ($avail_bytes > $warn))) { | ||
| 107 | $answer = "Disk ok - $avail ($capper%) free on $mountpt\n"; | ||
| 108 | @@ -205,18 +213,18 @@ | ||
| 109 | } else { | ||
| 110 | $answer = "Result from smbclient not suitable\n"; | ||
| 111 | $state = "UNKNOWN"; | ||
| 112 | - foreach (@lines) { | ||
| 113 | - if (/(Access denied|NT_STATUS_LOGON_FAILURE)/) { | ||
| 114 | + foreach ($res) { | ||
| 115 | + if (/(Access denied|NT_STATUS_LOGON_FAILURE)/s) { | ||
| 116 | $answer = "Access Denied\n"; | ||
| 117 | $state = "CRITICAL"; | ||
| 118 | last; | ||
| 119 | } | ||
| 120 | - if (/(Unknown host \w*|Connection.*failed)/) { | ||
| 121 | + if (/(Unknown host \w*|Connection.*failed)/s) { | ||
| 122 | $answer = "$1\n"; | ||
| 123 | $state = "CRITICAL"; | ||
| 124 | last; | ||
| 125 | } | ||
| 126 | - if (/(You specified an invalid share name|NT_STATUS_BAD_NETWORK_NAME)/) { | ||
| 127 | + if (/(You specified an invalid share name|NT_STATUS_BAD_NETWORK_NAME)/s) { | ||
| 128 | $answer = "Invalid share name \\\\$host\\$share\n"; | ||
| 129 | $state = "CRITICAL"; | ||
| 130 | last; | ||
| 131 | @@ -230,7 +238,7 @@ | ||
| 132 | exit $ERRORS{$state}; | ||
| 133 | |||
| 134 | sub print_usage () { | ||
| 135 | - print "Usage: $PROGNAME -H <host> -s <share> -u <user> -p <password> | ||
| 136 | + print "Usage: $PROGNAME -H <host> -I <ipaddr> -s <share> -u <user> -p <password> | ||
| 137 | -w <warn> -c <crit> [-W <workgroup>] [-P <port>]\n"; | ||
| 138 | } | ||
| 139 | |||
| 140 | @@ -245,6 +253,8 @@ | ||
| 141 | print " | ||
| 142 | -H, --hostname=HOST | ||
| 143 | NetBIOS name of the server | ||
| 144 | +-I, --ipaddr=IPADDR | ||
| 145 | + IP address of the server | ||
| 146 | -s, --share=STRING | ||
| 147 | Share name to be tested | ||
| 148 | -W, --workgroup=STRING | ||
diff --git a/web/attachments/158749-patch-check_ping-timeout b/web/attachments/158749-patch-check_ping-timeout new file mode 100644 index 0000000..35d3dfb --- /dev/null +++ b/web/attachments/158749-patch-check_ping-timeout | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | --- check_ping.c.org 2005-06-14 12:40:11.000000000 -0400 | ||
| 2 | +++ check_ping.c 2005-06-14 12:40:22.000000000 -0400 | ||
| 3 | @@ -87,7 +87,7 @@ | ||
| 4 | } | ||
| 5 | |||
| 6 | /* handle timeouts gracefully */ | ||
| 7 | - alarm (timeout_interval); | ||
| 8 | + alarm (timeout_interval+4); | ||
| 9 | |||
| 10 | for (i = 0 ; i < n_addresses ; i++) { | ||
| 11 | |||
diff --git a/web/attachments/158752-patch-check_disk_snmp.pl-snmpv1-2-win b/web/attachments/158752-patch-check_disk_snmp.pl-snmpv1-2-win new file mode 100644 index 0000000..7db3a88 --- /dev/null +++ b/web/attachments/158752-patch-check_disk_snmp.pl-snmpv1-2-win | |||
| @@ -0,0 +1,299 @@ | |||
| 1 | --- check_disk_snmp.pl.org 2005-12-05 15:06:35.815047753 -0500 | ||
| 2 | +++ check_disk_snmp.pl 2005-12-05 15:17:23.142768392 -0500 | ||
| 3 | @@ -1,74 +1,257 @@ | ||
| 4 | #!/usr/bin/perl | ||
| 5 | -# cm@financial.com 07/2002 | ||
| 6 | +# ---------------------------------------------------------------------------- | ||
| 7 | +# Name: check_disk_snmp.pl | ||
| 8 | +# Version: 1.1 | ||
| 9 | +# Description: This script will check the disk space usage using SNMP for | ||
| 10 | +# both Unix and Windows hosts. The warning and critical values | ||
| 11 | +# can be specified using ratios (default) or free bytes. | ||
| 12 | +# ---------------------------------------------------------------------------- | ||
| 13 | +# ChangeLog: | ||
| 14 | +# | ||
| 15 | +# July, 2002: cm@financial.com | ||
| 16 | +# -Original release | ||
| 17 | +# | ||
| 18 | +# Oct 14, 2005: Alex Burger <alex_b@users.sourceforge.net> | ||
| 19 | +# - Added support for SNMP version 1 and 2 | ||
| 20 | +# - Added support for checking free bytes instead of only usage ratio | ||
| 21 | +# - Added support for selecting a device by specifying a substring of the | ||
| 22 | +# device description such as c:, d: etc. | ||
| 23 | +# - Added support for hostname:port | ||
| 24 | +# ---------------------------------------------------------------------------- | ||
| 25 | +# This program is free software; you can redistribute it and/or modify | ||
| 26 | +# it under the terms of the GNU General Public License as published by | ||
| 27 | +# the Free Software Foundation; either version 2 of the License, or | ||
| 28 | +# (at your option) any later version. | ||
| 29 | +# | ||
| 30 | +# This program is distributed in the hope that it will be useful, | ||
| 31 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 32 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 33 | +# GNU General Public License for more details. | ||
| 34 | +# | ||
| 35 | +# You should have received a copy of the GNU General Public License | ||
| 36 | +# along with this program; if not, write to the Free Software | ||
| 37 | +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 38 | +# ---------------------------------------------------------------------------- | ||
| 39 | use strict; | ||
| 40 | use Net::SNMP; | ||
| 41 | use Getopt::Std; | ||
| 42 | +my ($warn_bytes, $critical_bytes); | ||
| 43 | |||
| 44 | my %opts =( | ||
| 45 | - u => 'nobody', # snmp user | ||
| 46 | - l => 'authNoPriv', # snmp security level | ||
| 47 | - a => 'MD5', # snmp authentication protocol | ||
| 48 | - A => 'nopass', # authentication protocol pass phrase. | ||
| 49 | - x => 'DES', # privacy protocol | ||
| 50 | + u => 'nobody', # snmp user (v3) or snmp community string (v1/2c) | ||
| 51 | + l => 'authNoPriv', # snmp security level (v3) | ||
| 52 | + a => 'MD5', # snmp authentication protocol (v3) | ||
| 53 | + A => 'nopass', # authentication protocol pass phrase. (v3) | ||
| 54 | + x => 'DES', # privacy protocol (v3) | ||
| 55 | m => 'localhost', # host | ||
| 56 | - d => 1, # devicenumber | ||
| 57 | - w => 70, # warnratio | ||
| 58 | - c => 85, # critical ratio | ||
| 59 | + d => 1, # devicenumber | ||
| 60 | + w => 70, # usage warnratio or bytes free | ||
| 61 | + c => 85, # usage critical ratio or bytes free | ||
| 62 | + v => 3, | ||
| 63 | + t => 'ratio', # ratio or bytes | ||
| 64 | h => 0, | ||
| 65 | - ); | ||
| 66 | + ); | ||
| 67 | |||
| 68 | -getopts('m:u:l:a:A:x:d:w:c:h',\%opts); | ||
| 69 | +getopts('m:u:l:a:A:x:d:w:c:v:t:h',\%opts); | ||
| 70 | |||
| 71 | if ( $opts{'h'} ) { | ||
| 72 | - print "Usage: $0 [ -u <username> ] [ -l <snmp security level>] [ -a <snmp authentication protocol> ] [ -A <authentication protocol pass phrase> ] [ -x <snmp privacy protocol> ] [ -m <hostname>] [ -d <devicenumber> ] [ -w <warning ratio> ] [ -c <critical ratio ]\n"; | ||
| 73 | + print "Usage: $0 [ -v <snmp version (3)> ]\n"; | ||
| 74 | + print " [ -u <username or community name> ] [ -l <snmp security level>]\n"; | ||
| 75 | + print " [ -a <snmp authentication protocol> ]\n"; | ||
| 76 | + print " [ -A <authentication protocol pass phrase> ]\n"; | ||
| 77 | + print " [ -x <snmp privacy protocol> ] [ -m <hostname>]\n"; | ||
| 78 | + print " [ -d <devicenumber or description> ] [ -w <warning ratio or bytes free> ]\n"; | ||
| 79 | + print " [ -c <critical ratio or bytes free> ] [ -t <(ratio)|bytes> ]\n\n"; | ||
| 80 | + print "SNMP V3 example using ratio for device number 2:\n"; | ||
| 81 | + print "$0 -u nobody -l authPriv -a MD5 -A nopass -x DES \\\n"; | ||
| 82 | + print " -m server1 -d 2 -w 70 -c 85\n\n"; | ||
| 83 | + print "SNMP V1 example using ratio for device number 2:\n"; | ||
| 84 | + print "$0 -v 1 -u public -m server1 -d 2 -w 70 -c 85\n\n"; | ||
| 85 | + print "SNMP V1 example using bytes for device number 2\n"; | ||
| 86 | + print "$0 -v 1 -u public -m server1 -d 2 -w 10Gb -c 900Mb \\\n"; | ||
| 87 | + print " -t bytes\n\n"; | ||
| 88 | + print "SNMP V1 example using bytes free for device description that contains 'c:'\n"; | ||
| 89 | + print "$0 -v 1 -u public -m server1 -d 'c:' -w 10Gb -c 900Mb \\\n"; | ||
| 90 | + print " -t bytes\n\n"; | ||
| 91 | + print "Note: The device list can be retreived using Net-SNMP's snmpwalk:\n"; | ||
| 92 | + print " snmpwalk -v 1 -c public server01 .1.3.6.1.2.1.25.2.3.1\n\n"; | ||
| 93 | exit 1; | ||
| 94 | } | ||
| 95 | |||
| 96 | -if ($opts{'w'} >= $opts{'c'}) { | ||
| 97 | - print "Errorratio must be higher then Warnratio!\n"; | ||
| 98 | - exit 1; | ||
| 99 | +if ($opts{'t'} eq "ratio") { | ||
| 100 | + if ($opts{'w'} >= $opts{'c'}) { | ||
| 101 | + print "Errorratio must be higher then Warnratio!\n"; | ||
| 102 | + exit 3; | ||
| 103 | + } | ||
| 104 | +} | ||
| 105 | +else { | ||
| 106 | + # For 'bytes' mode, allow user to specify size using k, M, G or T | ||
| 107 | + ($warn_bytes, $critical_bytes) = ($opts{'w'}, $opts{'c'}); | ||
| 108 | + | ||
| 109 | + if ($warn_bytes =~ /(.*)T/i) { | ||
| 110 | + $warn_bytes = $1 * 1099511627776; # 1024 * 1024 * 1024 * 1024 | ||
| 111 | + } | ||
| 112 | + elsif ($warn_bytes =~ /(.*)G.*/i) { | ||
| 113 | + $warn_bytes = $1 * 1073741824; # 1024 * 1024 * 1024 | ||
| 114 | + } | ||
| 115 | + elsif ($warn_bytes =~ /(.*)M.*/i) { | ||
| 116 | + $warn_bytes = $1 * 1048576; # 1024 * 1024 | ||
| 117 | + } | ||
| 118 | + elsif ($warn_bytes =~ /(.*)k.*/i) { | ||
| 119 | + $warn_bytes = $1 * 1024; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + if ($critical_bytes =~ /(.*)T/i) { | ||
| 123 | + $critical_bytes = $1 * 1099511627776; # 1024 * 1024 * 1024 * 1024 | ||
| 124 | + } | ||
| 125 | + elsif ($critical_bytes =~ /(.*)G.*/i) { | ||
| 126 | + $critical_bytes = $1 * 1073741824; # 1024 * 1024 * 1024 | ||
| 127 | + } | ||
| 128 | + elsif ($critical_bytes =~ /(.*)M.*/i) { | ||
| 129 | + $critical_bytes = $1 * 1048576; # 1024 * 1024 | ||
| 130 | + } | ||
| 131 | + elsif ($critical_bytes =~ /(.*)k.*/i) { | ||
| 132 | + $critical_bytes = $1 * 1024; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + if ($warn_bytes <= $critical_bytes) { | ||
| 136 | + print "Critical bytes free must be lower then Warning bytes free!\n"; | ||
| 137 | + exit 3; | ||
| 138 | + } | ||
| 139 | } | ||
| 140 | |||
| 141 | -my ($session, $error) = Net::SNMP->session( | ||
| 142 | - -hostname => $opts{'m'}, | ||
| 143 | - -nonblocking => 0x0, | ||
| 144 | - -username => $opts{'u'}, | ||
| 145 | - -authpassword => $opts{'A'}, | ||
| 146 | - -authprotocol => $opts{'a'}, | ||
| 147 | - -version => '3', | ||
| 148 | - ); | ||
| 149 | +# Allow hostname:port for -m | ||
| 150 | +my $hostname = $opts{'m'}; | ||
| 151 | +my $port = 161; # Default to port 161 | ||
| 152 | +if ($hostname =~ /(.*):(.*)/) { | ||
| 153 | + $hostname = $1; | ||
| 154 | + $port = $2; | ||
| 155 | +} | ||
| 156 | + | ||
| 157 | +my $session; | ||
| 158 | +my $error; | ||
| 159 | +if ($opts{'v'} == 3) { | ||
| 160 | + ($session, $error) = Net::SNMP->session( | ||
| 161 | + -hostname => $hostname, | ||
| 162 | + -port => $port, | ||
| 163 | + -nonblocking => 0x0, | ||
| 164 | + -username => $opts{'u'}, | ||
| 165 | + -authpassword => $opts{'A'}, | ||
| 166 | + -authprotocol => $opts{'a'}, | ||
| 167 | + -version => '3', | ||
| 168 | + ); | ||
| 169 | +} | ||
| 170 | +else { | ||
| 171 | + ($session, $error) = Net::SNMP->session( | ||
| 172 | + -hostname => $hostname, | ||
| 173 | + -port => $port, | ||
| 174 | + -nonblocking => 0x0, | ||
| 175 | + -community => $opts{'u'}, | ||
| 176 | + -version => $opts{'v'}, | ||
| 177 | + ); | ||
| 178 | +} | ||
| 179 | |||
| 180 | if ($@) { | ||
| 181 | print "SNMP-Error occured"; | ||
| 182 | - exit 1; | ||
| 183 | + exit 3; | ||
| 184 | } | ||
| 185 | my $result=undef; | ||
| 186 | |||
| 187 | +my $device_id = $opts{'d'}; | ||
| 188 | + | ||
| 189 | +if ($device_id =~ /^(\D+)$/) { | ||
| 190 | + # Non numeric device. Search for matching description in all drives. | ||
| 191 | + # If we don't find it, set device number to 999. | ||
| 192 | + #print "non numeric device: $1\n\n"; | ||
| 193 | + | ||
| 194 | + my $i=1; | ||
| 195 | + $device_id = 999; | ||
| 196 | + while (1) { | ||
| 197 | + my $deviceName=".1.3.6.1.2.1.25.2.3.1.3.$i"; # HOST-RESOURCES-MIB::hrStorageDescr | ||
| 198 | + | ||
| 199 | + my $result = $session->get_request( | ||
| 200 | + -varbindlist => [$deviceName] | ||
| 201 | + ); | ||
| 202 | + | ||
| 203 | + if (!defined($result)) { | ||
| 204 | + $session->close; | ||
| 205 | + last; | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + if ($result->{$deviceName} =~ /$opts{'d'}/i) { | ||
| 209 | + #print "Found matching device: $result->{$deviceName}\n"; | ||
| 210 | + $device_id = $i; | ||
| 211 | + last; | ||
| 212 | + } | ||
| 213 | + $i++; | ||
| 214 | + } | ||
| 215 | +} | ||
| 216 | |||
| 217 | -my $deviceSize=".1.3.6.1.2.1.25.2.3.1.5.$opts{'d'}"; | ||
| 218 | -my $deviceUsed=".1.3.6.1.2.1.25.2.3.1.6.$opts{'d'}"; | ||
| 219 | -my $deviceName=".1.3.6.1.2.1.25.2.3.1.3.$opts{'d'}"; | ||
| 220 | -my @OID=($deviceSize, $deviceUsed, $deviceName); | ||
| 221 | -$result = $session->get_request( | ||
| 222 | +my $deviceUnits=".1.3.6.1.2.1.25.2.3.1.4.$device_id"; # HOST-RESOURCES-MIB::hrStorageAllocationUnits | ||
| 223 | +my $deviceSize=".1.3.6.1.2.1.25.2.3.1.5.$device_id"; # HOST-RESOURCES-MIB::hrStorageSize | ||
| 224 | +my $deviceUsed=".1.3.6.1.2.1.25.2.3.1.6.$device_id"; # HOST-RESOURCES-MIB::hrStorageUsed | ||
| 225 | +my $deviceName=".1.3.6.1.2.1.25.2.3.1.3.$device_id"; # HOST-RESOURCES-MIB::hrStorageDescr | ||
| 226 | +my @OID=($deviceUnits, $deviceSize, $deviceUsed, $deviceName); | ||
| 227 | +my $result = $session->get_request( | ||
| 228 | -varbindlist => \@OID, | ||
| 229 | ); | ||
| 230 | |||
| 231 | if (!defined($result)) { | ||
| 232 | printf("ERROR: %s.\n", $session->error); | ||
| 233 | $session->close; | ||
| 234 | - exit 1; | ||
| 235 | + exit 3; | ||
| 236 | } | ||
| 237 | |||
| 238 | -my $ratio=$result->{$deviceUsed}*100/$result->{$deviceSize}; | ||
| 239 | +if ($opts{'t'} eq "ratio") { | ||
| 240 | + my $ratio=$result->{$deviceUsed}*100/$result->{$deviceSize}; | ||
| 241 | |||
| 242 | -if ($ratio > $opts{'c'}){ | ||
| 243 | - printf("CRITICAL: %s usage %.2f%%\n", $result->{$deviceName}, $ratio); | ||
| 244 | - exit 2; | ||
| 245 | + if ($ratio > $opts{'c'}){ | ||
| 246 | + printf("CRITICAL: %s usage %.2f%%\n", $result->{$deviceName}, $ratio); | ||
| 247 | + exit 2; | ||
| 248 | + } | ||
| 249 | + if ($ratio > $opts{'w'}){ | ||
| 250 | + printf("WARNING: %s usage %.2f%%\n", $result->{$deviceName}, $ratio); | ||
| 251 | + exit 1; | ||
| 252 | + } | ||
| 253 | + | ||
| 254 | + printf("OK: %s usage %.2f%%\n", $result->{$deviceName}, $ratio); | ||
| 255 | + exit 0; | ||
| 256 | } | ||
| 257 | -if ($ratio > $opts{'w'}){ | ||
| 258 | - printf("WARNING: %s usage %.2f%%\n", $result->{$deviceName}, $ratio); | ||
| 259 | - exit 1; | ||
| 260 | +else { | ||
| 261 | + #print "Bytes...\n"; | ||
| 262 | + # Calculate actual size in bytes | ||
| 263 | + my $b_deviceSize = $result->{$deviceSize} * $result->{$deviceUnits}; | ||
| 264 | + my $b_deviceUsed = $result->{$deviceUsed} * $result->{$deviceUnits}; | ||
| 265 | + my $b_free = $b_deviceSize - $b_deviceUsed; | ||
| 266 | + my $b_free_units; | ||
| 267 | + | ||
| 268 | + if ($b_free > 1099511627776) { | ||
| 269 | + $b_free_units = (int ($b_free / 1099511627776 * 100) / 100); | ||
| 270 | + $b_free_units .= "Tb"; | ||
| 271 | + } | ||
| 272 | + elsif ($b_free > 1073741824) { | ||
| 273 | + $b_free_units = (int ($b_free / 1073741824 * 100) / 100); | ||
| 274 | + $b_free_units .= "Gb"; | ||
| 275 | + } | ||
| 276 | + elsif ($b_free > 1048576) { | ||
| 277 | + $b_free_units = (int ($b_free / 1048576 * 100) / 100); | ||
| 278 | + $b_free_units .= "Mb"; | ||
| 279 | + } | ||
| 280 | + elsif ($b_free > 1024) { | ||
| 281 | + $b_free_units = (int ($b_free / 1024 * 100) / 100); | ||
| 282 | + $b_free_units .= "kb"; | ||
| 283 | + } | ||
| 284 | + | ||
| 285 | + if ($b_free < $critical_bytes){ | ||
| 286 | + printf("CRITICAL: %s free: %s\n", $result->{$deviceName}, $b_free_units); | ||
| 287 | + exit 2; | ||
| 288 | + } | ||
| 289 | + if ($b_free < $warn_bytes){ | ||
| 290 | + printf("WARNING: %s free: %s\n", $result->{$deviceName}, $b_free_units); | ||
| 291 | + exit 1; | ||
| 292 | + } | ||
| 293 | + | ||
| 294 | + printf("OK: %s free: %s\n", $result->{$deviceName}, $b_free_units); | ||
| 295 | + exit 0; | ||
| 296 | } | ||
| 297 | |||
| 298 | -printf("OK: %s usage %.2f%%\n", $result->{$deviceName}, $ratio); | ||
| 299 | -exit 0; | ||
diff --git a/web/attachments/159986-check_ntp.zip b/web/attachments/159986-check_ntp.zip new file mode 100644 index 0000000..fcd96b5 --- /dev/null +++ b/web/attachments/159986-check_ntp.zip | |||
| Binary files differ | |||
diff --git a/web/attachments/160015-check_ups--1.28.diff b/web/attachments/160015-check_ups--1.28.diff new file mode 100644 index 0000000..b86f9bb --- /dev/null +++ b/web/attachments/160015-check_ups--1.28.diff | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | --- check_ups.c.orig 2005-12-15 17:17:54.000000000 -0500 | ||
| 2 | +++ check_ups.c 2005-12-15 17:22:44.000000000 -0500 | ||
| 3 | @@ -7,6 +7,7 @@ | ||
| 4 | Copyright (c) 2000 Tom Shields | ||
| 5 | 2004 Alain Richard <alain.richard@equation.fr> | ||
| 6 | 2004 Arnaud Quette <arnaud.quette@mgeups.com> | ||
| 7 | + 2005 Garrett Honeycutt <gh@3gupload.com> | ||
| 8 | |||
| 9 | |||
| 10 | This program is free software; you can redistribute it and/or modify | ||
| 11 | @@ -23,13 +24,11 @@ | ||
| 12 | along with this program; if not, write to the Free Software | ||
| 13 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 14 | |||
| 15 | - $Id: check_ups.c,v 1.27 2005/03/04 21:58:40 tonvoon Exp $ | ||
| 16 | - | ||
| 17 | ******************************************************************************/ | ||
| 18 | |||
| 19 | const char *progname = "check_ups"; | ||
| 20 | -const char *revision = "$Revision: 1.27 $"; | ||
| 21 | -const char *copyright = "2000-2004"; | ||
| 22 | +const char *revision = "$Revision: 1.28 $"; | ||
| 23 | +const char *copyright = "2000-2005"; | ||
| 24 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 25 | |||
| 26 | #include "common.h" | ||
| 27 | @@ -302,9 +301,17 @@ | ||
| 28 | check_crit, (long)(1000*critical_value), | ||
| 29 | TRUE, 0, FALSE, 0)); | ||
| 30 | } else { | ||
| 31 | - asprintf (&data, "%s %s", data, | ||
| 32 | - perfdata ("temp", (long)ups_temperature, "degF", | ||
| 33 | - FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); | ||
| 34 | + /* 2005 garrett honeycutt - small bugfix to print the correct abbreviation */ | ||
| 35 | + if (temp_output_c) { | ||
| 36 | + asprintf (&data, "%s %s", data, | ||
| 37 | + perfdata ("temp", (long)ups_temperature, "degC", | ||
| 38 | + FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); | ||
| 39 | + } | ||
| 40 | + else { | ||
| 41 | + asprintf (&data, "%s %s", data, | ||
| 42 | + perfdata ("temp", (long)ups_temperature, "degF", | ||
| 43 | + FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); | ||
| 44 | + } | ||
| 45 | } | ||
| 46 | } | ||
| 47 | |||
| 48 | @@ -588,6 +595,7 @@ | ||
| 49 | printf ("Copyright (c) 2000 Tom Shields"); | ||
| 50 | printf ("Copyright (c) 2004 Alain Richard <alain.richard@equation.fr>\n"); | ||
| 51 | printf ("Copyright (c) 2004 Arnaud Quette <arnaud.quette@mgeups.com>\n"); | ||
| 52 | + printf ("Copyright (c) 2005 Garrett Honeycutt <gh@3gupload.com>\n"); | ||
| 53 | printf (COPYRIGHT, copyright, email); | ||
| 54 | |||
| 55 | printf (_("This plugin tests the UPS service on the specified host.\n\ | ||
diff --git a/web/attachments/160368-check_ntp-131.out b/web/attachments/160368-check_ntp-131.out new file mode 100644 index 0000000..86796aa --- /dev/null +++ b/web/attachments/160368-check_ntp-131.out | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | ntperr = 0 | ||
| 2 | ntperr = 0 | ||
| 3 | Argument "(not parsed)" isn't numeric in abs at ./check_ntp line 408. | ||
| 4 | remote refid st t when poll reach delay offset jitter | ||
| 5 | No match! | ||
| 6 | ============================================================================== | ||
| 7 | No match! | ||
| 8 | 127.127.1.0 LOCAL(0) 10 l 19 64 377 0.000 0.000 0.001 | ||
| 9 | No match! | ||
| 10 | +10.17.33.12 .GPS. 1 u 440 1024 377 5.121 -0.443 2.513 | ||
| 11 | Candidate count= 1 | ||
| 12 | No match! | ||
| 13 | -10.64.49.11 .GPS. 1 u 138 1024 377 14.865 1.412 12.189 | ||
| 14 | No match! | ||
| 15 | *10.80.49.11 .GPS. 1 u 728 1024 377 11.730 -0.399 1.081 | ||
| 16 | Candidate count= 2 | ||
| 17 | match *10.80.49.11 .GPS. 1 u 728 1024 377 11.730 -0.399 1.081 | ||
| 18 | |||
| 19 | +10.96.113.11 .GPS. 1 u 265 1024 377 13.316 -0.622 0.617 | ||
| 20 | Candidate count= 3 | ||
| 21 | No match! | ||
| 22 | -10.112.49.11 .GPS. 1 u 395 1024 377 13.645 1.960 0.637 | ||
| 23 | No match! | ||
| 24 | +10.128.49.11 .GPS. 1 u 383 1024 377 13.932 -0.405 8.635 | ||
| 25 | Candidate count= 4 | ||
| 26 | No match! | ||
| 27 | -192.168.219.11 10.80.49.11 2 u 362 1024 377 0.001 18.433 18.817 | ||
| 28 | No match! | ||
| 29 | x192.168.219.12 10.17.33.12 2 u 442 1024 377 0.001 39.417 16.607 | ||
| 30 | No match! | ||
| 31 | NTP OK: Offset 0.009224 secs, jitter (not parsed) msec, peer is stratum 1|offset=0.009224, jitter=0,peer_stratum=1 | ||
diff --git a/web/attachments/160369-check_ntp-fqdn.patch b/web/attachments/160369-check_ntp-fqdn.patch new file mode 100644 index 0000000..b20a702 --- /dev/null +++ b/web/attachments/160369-check_ntp-fqdn.patch | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | --- check_ntp.pl.orig 2005-12-19 13:34:41.000000000 +0100 | ||
| 2 | +++ check_ntp.pl 2005-12-19 13:43:49.000000000 +0100 | ||
| 3 | @@ -112,7 +112,7 @@ | ||
| 4 | } | ||
| 5 | |||
| 6 | $opt_H = shift unless ($opt_H); | ||
| 7 | -my $host = $1 if ($opt_H && $opt_H =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]+(\.[a-zA-Z][-a-zA-Z0-9]+)*)$/); | ||
| 8 | +my $host = $1 if ($opt_H && $opt_H =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]+([a-zA-Z][-a-zA-Z0-9\.]+)*)$/); | ||
| 9 | unless ($host) { | ||
| 10 | print "No target host specified\n"; | ||
| 11 | print_usage(); | ||
diff --git a/web/attachments/160531-check_mrtg.c b/web/attachments/160531-check_mrtg.c new file mode 100644 index 0000000..4c592dd --- /dev/null +++ b/web/attachments/160531-check_mrtg.c | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-4 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378821200" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378821200" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378821200" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378821200" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378821200'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1386201&group_id=29880&atid=397597&file_id=160531" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/160532-check_mrtg.c b/web/attachments/160532-check_mrtg.c new file mode 100644 index 0000000..9d652ad --- /dev/null +++ b/web/attachments/160532-check_mrtg.c | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-4 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378821205" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378821205" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378821205" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378821205" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378821205'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1386205&group_id=29880&atid=397599&file_id=160532" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/162122-check_procs.patch b/web/attachments/162122-check_procs.patch new file mode 100644 index 0000000..55889fb --- /dev/null +++ b/web/attachments/162122-check_procs.patch | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | --- nagios-plugins-1.4.2/plugins/check_procs.c 2005-09-15 08:27:58.000000000 +0000 | ||
| 2 | +++ check_procs.c 2006-01-04 15:22:53.684763668 +0000 | ||
| 3 | @@ -84,6 +84,7 @@ | ||
| 4 | char *input_buffer; | ||
| 5 | char *input_line; | ||
| 6 | char *procprog; | ||
| 7 | + char *tmp_out; | ||
| 8 | |||
| 9 | pid_t mypid = 0; | ||
| 10 | int procuid = 0; | ||
| 11 | @@ -300,7 +301,18 @@ | ||
| 12 | if ( verbose >= 1 && strcmp(fails,"") ) | ||
| 13 | printf (" [%s]", fails); | ||
| 14 | |||
| 15 | - printf ("\n"); | ||
| 16 | + /* add performance data */ | ||
| 17 | + if ( metric == METRIC_PROCS ) { | ||
| 18 | + printf ("|%s\n", perfdata (metric_name,procs,"",(wmax!=-1),wmax,(cmax!=-1),cmax,TRUE,0,FALSE,0)); | ||
| 19 | + } else { | ||
| 20 | + asprintf (&tmp_out, _("%s Processes OK"),metric_name); | ||
| 21 | + printf ("|%s", perfdata (tmp_out,procs,"",FALSE,0,FALSE,0,TRUE,0,FALSE,0)); | ||
| 22 | + asprintf (&tmp_out, _("%s Processes WARNING"),metric_name); | ||
| 23 | + printf (" %s", perfdata (tmp_out,warn,"",FALSE,0,FALSE,0,TRUE,0,FALSE,0)); | ||
| 24 | + asprintf (&tmp_out, _("%s Processes CRITICAL"),metric_name); | ||
| 25 | + printf (" %s\n", perfdata (tmp_out,crit,"",FALSE,0,FALSE,0,TRUE,0,FALSE,0)); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | return result; | ||
| 29 | } | ||
| 30 | |||
diff --git a/web/attachments/163283-nagios-plugins-1.4.1-check_snmp_c_fix_alt.patch b/web/attachments/163283-nagios-plugins-1.4.1-check_snmp_c_fix_alt.patch new file mode 100644 index 0000000..47d51fc --- /dev/null +++ b/web/attachments/163283-nagios-plugins-1.4.1-check_snmp_c_fix_alt.patch | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | --- nagios-plugins-1.4.2/plugins/check_snmp.c.orig Wed Jun | ||
| 2 | 1 15:41: | ||
| 3 | 01 2005 | ||
| 4 | +++ nagios-plugins-1.4.2/plugins/check_snmp.c Thu Jan 12 | ||
| 5 | 18:22: | ||
| 6 | 47 2006 | ||
| 7 | @@ -337,10 +337,17 @@ | ||
| 8 | asprintf (&outbuff, "%s %s", outbuff, unitv[i]); | ||
| 9 | |||
| 10 | i++; | ||
| 11 | - | ||
| 12 | +#if 0 | ||
| 13 | char *str[MAX_INPUT_BUFFER]; | ||
| 14 | asprintf(str, "=%s%s;;;; ", show, type ? type : ""); | ||
| 15 | strcat(perfstr, *str); | ||
| 16 | +#else | ||
| 17 | + strcat(perfstr, "="); | ||
| 18 | + strcat(perfstr, show); | ||
| 19 | + if (type) | ||
| 20 | + strcat(perfstr, type); | ||
| 21 | + strcat(perfstr, ";;;; "); | ||
| 22 | +#endif | ||
| 23 | |||
| 24 | } /* end while (ptr) */ | ||
| 25 | |||
diff --git a/web/attachments/163415-diff-check_dns b/web/attachments/163415-diff-check_dns new file mode 100644 index 0000000..1c1beb2 --- /dev/null +++ b/web/attachments/163415-diff-check_dns | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | *** check_dns.c.orig Sun Jan 15 10:30:55 2006 | ||
| 2 | --- check_dns.c Sun Jan 15 10:55:07 2006 | ||
| 3 | *************** | ||
| 4 | *** 173,178 **** | ||
| 5 | --- 173,179 ---- | ||
| 6 | |||
| 7 | /* If we got here, we should have an address string, | ||
| 8 | and we can segfault if we do not */ | ||
| 9 | + strip(address); | ||
| 10 | if (address==NULL || strlen(address)==0) | ||
| 11 | die (STATE_CRITICAL, | ||
| 12 | _("DNS CRITICAL - '%s' output parsing exited with no address\n"), | ||
| 13 | |||
diff --git a/web/attachments/163636-check_ntp.pl.patch b/web/attachments/163636-check_ntp.pl.patch new file mode 100644 index 0000000..3ce6b2a --- /dev/null +++ b/web/attachments/163636-check_ntp.pl.patch | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | --- check_ntp.pl.dist 2006-01-16 17:56:25.835790000 +0100 | ||
| 2 | +++ check_ntp.pl 2006-01-16 20:17:39.345787000 +0100 | ||
| 3 | @@ -56,6 +56,12 @@ | ||
| 4 | # changed ntpdc to ntpq - jitter/dispersion is in milliseconds | ||
| 5 | # | ||
| 6 | # Patch for for regex for stratum1 refid. | ||
| 7 | +# | ||
| 8 | +# Modified by Joachim Schrod <jschrod@acm.org>, 16 Jan 06: | ||
| 9 | +# Support multiple peers, don't overwrite jitter value if one was found. | ||
| 10 | +# ntpdate and ntpq may exit with non-zero status, then close() returns false. | ||
| 11 | +# Support FQDN hostnames with one-letter components. | ||
| 12 | +# Support unknown hosts. | ||
| 13 | |||
| 14 | require 5.004; | ||
| 15 | use POSIX; | ||
| 16 | @@ -112,7 +118,7 @@ | ||
| 17 | } | ||
| 18 | |||
| 19 | $opt_H = shift unless ($opt_H); | ||
| 20 | -my $host = $1 if ($opt_H && $opt_H =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]+(\.[a-zA-Z][-a-zA-Z0-9]+)*)$/); | ||
| 21 | +my $host = $1 if ($opt_H && $opt_H =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]*(\.[a-zA-Z][-a-zA-Z0-9]*)*)$/); | ||
| 22 | unless ($host) { | ||
| 23 | print "No target host specified\n"; | ||
| 24 | print_usage(); | ||
| 25 | @@ -242,11 +248,15 @@ | ||
| 26 | } | ||
| 27 | } | ||
| 28 | |||
| 29 | + if (/can\'t find host/) { | ||
| 30 | + $ntpdate_error = $ERRORS{"CRITICAL"}; | ||
| 31 | + $msg = "Host not found - "; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | } | ||
| 35 | $out =~ s/\n//g; | ||
| 36 | -close (NTPDATE) || | ||
| 37 | - die $! ? "$out - Error closing $ntpdate pipe: $!" | ||
| 38 | - : "$out - Exit status: $? from $ntpdate\n"; | ||
| 39 | +close (NTPDATE) or | ||
| 40 | + $! and die "$out - Error closing $ntpdate pipe: $!\n"; | ||
| 41 | |||
| 42 | # declare an error if we also get a non-zero return code from ntpdate | ||
| 43 | # unless already set to critical | ||
| 44 | @@ -314,13 +324,11 @@ | ||
| 45 | } | ||
| 46 | } else { | ||
| 47 | print "No match!\n" if $verbose; | ||
| 48 | - $jitter = '(not parsed)'; | ||
| 49 | } | ||
| 50 | |||
| 51 | } | ||
| 52 | - close NTPQ || | ||
| 53 | - die $! ? "Error closing $ntpq pipe: $!" | ||
| 54 | - : "Exit status: $? from $ntpq\n"; | ||
| 55 | + close NTPQ or | ||
| 56 | + $! and die "Error closing $ntpq pipe: $!\n"; | ||
| 57 | |||
| 58 | # if we did not match sys.peer or pps.peer but matched # candidates only | ||
| 59 | # generate a warning | ||
| 60 | @@ -428,7 +436,14 @@ | ||
| 61 | foreach my $key (keys %ERRORS) { | ||
| 62 | if ($state==$ERRORS{$key}) { | ||
| 63 | # print ("NTP $key: $answer"); | ||
| 64 | - print ("NTP $key: $answer|offset=$offset, jitter=" . $jitter/1000 . ",peer_stratum=$stratum\n"); | ||
| 65 | + defined($offset) or $offset = '-'; | ||
| 66 | + defined($stratum) or $stratum = '-'; | ||
| 67 | + if (defined($jitter)) { | ||
| 68 | + $jitter /= 1000; | ||
| 69 | + } else { | ||
| 70 | + $jitter = '-'; | ||
| 71 | + } | ||
| 72 | + print ("NTP $key: $answer|offset=$offset, jitter=$jitter, peer_stratum=$stratum\n"); | ||
| 73 | last; | ||
| 74 | } | ||
| 75 | } | ||
diff --git a/web/attachments/165690-check_swap.c.diff b/web/attachments/165690-check_swap.c.diff new file mode 100644 index 0000000..38c4396 --- /dev/null +++ b/web/attachments/165690-check_swap.c.diff | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | --- check_swap.c.1.54 2006-01-31 12:14:01.000000000 -0500 | ||
| 2 | +++ check_swap.c 2006-01-31 12:14:46.000000000 -0500 | ||
| 3 | @@ -292,4 +292,4 @@ | ||
| 4 | for(i=0;i<nswaps;i++){ | ||
| 5 | - dsktotal_mb = (float) ent->se_nblks / conv_factor; | ||
| 6 | - dskused_mb = (float) ent->se_inuse / conv_factor; | ||
| 7 | + dsktotal_mb = (float) ent[i].se_nblks / conv_factor; | ||
| 8 | + dskused_mb = (float) ent[i].se_inuse / conv_factor; | ||
| 9 | dskfree_mb = ( dsktotal_mb - dskused_mb ); | ||
diff --git a/web/attachments/169141-check_file_age.pl.patch b/web/attachments/169141-check_file_age.pl.patch new file mode 100644 index 0000000..857e11c --- /dev/null +++ b/web/attachments/169141-check_file_age.pl.patch | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | diff -r -U1 nagios-plugins-HEAD-200602280052-orig/plugins-scripts/check_file_age.pl nagios-plugins-HEAD-200602280052/plugins-scripts/check_file_age.pl | ||
| 2 | --- nagios-plugins-HEAD-200602280052-orig/plugins-scripts/check_file_age.pl 2005-12-15 16:17:49.000000000 +0100 | ||
| 3 | +++ nagios-plugins-HEAD-200602280052/plugins-scripts/check_file_age.pl 2006-02-28 12:10:21.000000000 +0100 | ||
| 4 | @@ -35,4 +35,4 @@ | ||
| 5 | |||
| 6 | -my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V); | ||
| 7 | -my ($result, $message, $age, $size, $st); | ||
| 8 | +my ($opt_c, $opt_f, $opt_d, $opt_n, $opt_w, $opt_r, $opt_C, $opt_W, $opt_h, $opt_V); | ||
| 9 | +my ($result, $message, $age, $size, $st, @files, @failed, $file); | ||
| 10 | |||
| 11 | @@ -45,2 +45,5 @@ | ||
| 12 | $opt_f = ""; | ||
| 13 | +$opt_n = 1; | ||
| 14 | +$opt_d = ""; | ||
| 15 | +$opt_r = ""; | ||
| 16 | |||
| 17 | @@ -50,3 +53,6 @@ | ||
| 18 | "h" => \$opt_h, "help" => \$opt_h, | ||
| 19 | + "d" => \$opt_d, "dir-content" => \$opt_d, | ||
| 20 | "f=s" => \$opt_f, "file" => \$opt_f, | ||
| 21 | + "n=i" => \$opt_n, "num-files=i" => \$opt_n, | ||
| 22 | + "r=s" => \$opt_r, "regexp=s" => \$opt_r, | ||
| 23 | "w=f" => \$opt_w, "warning-age=f" => \$opt_w, | ||
| 24 | @@ -79,17 +85,54 @@ | ||
| 25 | |||
| 26 | -$st = File::stat::stat($opt_f); | ||
| 27 | -$age = time - $st->mtime; | ||
| 28 | -$size = $st->size; | ||
| 29 | - | ||
| 30 | +if ($opt_d) { | ||
| 31 | + if (!opendir(DIR, $opt_f)) { | ||
| 32 | + print "FILE_AGE CRITICAL: $opt_f: $!"; | ||
| 33 | + exit $ERRORS{'CRITICAL'}; | ||
| 34 | + } | ||
| 35 | + # remove . and .. and filter regular expression | ||
| 36 | + @files = grep { !/^\.{1,2}$/ } grep { /$opt_r/ } readdir(DIR); | ||
| 37 | + # print "@files"; | ||
| 38 | + closedir(DIR); | ||
| 39 | +} else { | ||
| 40 | + @files = ($opt_f); | ||
| 41 | +} | ||
| 42 | + | ||
| 43 | +my $crit = 0; | ||
| 44 | +my $warn = 0; | ||
| 45 | +foreach $file (@files) { | ||
| 46 | + if ($opt_d) { | ||
| 47 | + $file = "$opt_f/$file"; | ||
| 48 | + } | ||
| 49 | + $st = File::stat::stat("$file"); | ||
| 50 | + $age = time - $st->mtime; | ||
| 51 | + $size = $st->size; | ||
| 52 | + | ||
| 53 | + if (($opt_c and $age > $opt_c) or ($opt_C and $size < $opt_C)) { | ||
| 54 | + push (@failed,$file); | ||
| 55 | + $crit++; | ||
| 56 | + } | ||
| 57 | + elsif (($opt_w and $age > $opt_w) or ($opt_W and $size < $opt_W)) { | ||
| 58 | + push (@failed,$file); | ||
| 59 | + $warn++; | ||
| 60 | + } | ||
| 61 | +} | ||
| 62 | + | ||
| 63 | +# return maximum RC if the sum of nOK files exceeds $opt_n | ||
| 64 | +if ($warn + $crit >= $opt_n) { | ||
| 65 | + if ($crit > 0 ) { | ||
| 66 | + $result = 'CRITICAL'; | ||
| 67 | + } else { | ||
| 68 | + $result = 'WARNING'; | ||
| 69 | + } | ||
| 70 | +} else { | ||
| 71 | + $result = 'OK'; | ||
| 72 | +} | ||
| 73 | |||
| 74 | -$result = 'OK'; | ||
| 75 | |||
| 76 | -if (($opt_c and $age > $opt_c) or ($opt_C and $size < $opt_C)) { | ||
| 77 | - $result = 'CRITICAL'; | ||
| 78 | +if ( ! $opt_d ) { | ||
| 79 | + print "FILE_AGE $result: $opt_f is $age seconds old and $size bytes\n"; | ||
| 80 | +} else { | ||
| 81 | + my $failed = @failed; | ||
| 82 | + print "FILE_AGE $result: @failed " . $failed ." files older/smaller than threshold thres: $opt_n\n"; | ||
| 83 | } | ||
| 84 | -elsif (($opt_w and $age > $opt_w) or ($opt_W and $size < $opt_W)) { | ||
| 85 | - $result = 'WARNING'; | ||
| 86 | -} | ||
| 87 | - | ||
| 88 | -print "FILE_AGE $result: $opt_f is $age seconds old and $size bytes\n"; | ||
| 89 | + | ||
| 90 | exit $ERRORS{$result}; | ||
| 91 | @@ -98,3 +141,3 @@ | ||
| 92 | print "Usage:\n"; | ||
| 93 | - print " $PROGNAME [-w <secs>] [-c <secs>] [-W <size>] [-C <size>] -f <file>\n"; | ||
| 94 | + print " $PROGNAME [-w <secs>] [-c <secs>] [-W <size>] [-C <size>] [-d [-r <regexp>] [-n <num>] -f <file>\n"; | ||
| 95 | print " $PROGNAME [-h | --help]\n"; | ||
| 96 | @@ -110,2 +153,5 @@ | ||
| 97 | print " <size> File must be at least this many bytes long (default: crit 0 bytes)\n"; | ||
| 98 | + print " -d check all files in <file> (if <file> is a directory)\n"; | ||
| 99 | + print " -r only check files maching regular expression in directory (only if -d is given)\n"; | ||
| 100 | + print " -n minimum number of files that have to be crit/warn to reach non OK state\n"; | ||
| 101 | print "\n"; | ||
diff --git a/web/attachments/170107-check_pgsql.patch b/web/attachments/170107-check_pgsql.patch new file mode 100644 index 0000000..b880f8c --- /dev/null +++ b/web/attachments/170107-check_pgsql.patch | |||
| @@ -0,0 +1,138 @@ | |||
| 1 | --- check_pgsql.original 2006-03-07 12:40:11.000000000 -0700 | ||
| 2 | +++ check_pgsql.c 2006-03-07 12:47:48.000000000 -0700 | ||
| 3 | @@ -21,5 +21,5 @@ | ||
| 4 | const char *progname = "check_pgsql"; | ||
| 5 | const char *revision = "$Revision: 1.31 $"; | ||
| 6 | -const char *copyright = "1999-2004"; | ||
| 7 | +const char *copyright = "1999-2006"; | ||
| 8 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 9 | |||
| 10 | @@ -36,5 +36,7 @@ | ||
| 11 | DEFAULT_PORT = 5432, | ||
| 12 | DEFAULT_WARN = 2, | ||
| 13 | - DEFAULT_CRIT = 8 | ||
| 14 | + DEFAULT_CRIT = 8, | ||
| 15 | + DEFAULT_WARNING_XID_AGE = 500000000, /* 500M */ | ||
| 16 | + DEFAULT_CRITICAL_XID_AGE = 1000000000 /* 1B */ | ||
| 17 | }; | ||
| 18 | |||
| 19 | @@ -58,4 +60,6 @@ | ||
| 20 | double twarn = (double)DEFAULT_WARN; | ||
| 21 | double tcrit = (double)DEFAULT_CRIT; | ||
| 22 | +int warning_xid_age = DEFAULT_WARNING_XID_AGE; | ||
| 23 | +int critical_xid_age = DEFAULT_CRITICAL_XID_AGE; | ||
| 24 | |||
| 25 | PGconn *conn; | ||
| 26 | @@ -124,4 +128,9 @@ | ||
| 27 | int elapsed_time; | ||
| 28 | int status = STATE_UNKNOWN; | ||
| 29 | + int i,j; | ||
| 30 | + int nFields; | ||
| 31 | + const char *paramValues[1]; | ||
| 32 | + char param[100]; | ||
| 33 | + PGresult *res; | ||
| 34 | |||
| 35 | /* begin, by setting the parameters for a backend connection if the | ||
| 36 | @@ -167,8 +176,43 @@ | ||
| 37 | } | ||
| 38 | else { | ||
| 39 | + snprintf(param, 100, "%d", warning_xid_age); | ||
| 40 | + paramValues[0] = param; | ||
| 41 | + res = PQexecParams(conn, | ||
| 42 | + "SELECT datname,age(datvacuumxid) FROM pg_database WHERE age(datvacuumxid) > $1 ORDER BY age(datvacuumxid) DESC", | ||
| 43 | + 1, NULL, paramValues, NULL, NULL, 0); | ||
| 44 | + if (PQresultStatus(res) != PGRES_TUPLES_OK) | ||
| 45 | + { | ||
| 46 | + printf (_("CRITICAL - error '%s' running query on '%s' (%s).\n"), | ||
| 47 | + PQerrorMessage(conn), dbName, PQerrorMessage (conn)); | ||
| 48 | + PQclear (res); | ||
| 49 | + PQfinish (conn); | ||
| 50 | + return STATE_CRITICAL; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + if (PQntuples(res) > 0) | ||
| 54 | + { | ||
| 55 | + j = atoi(PQgetvalue(res, 0, 1)); | ||
| 56 | + | ||
| 57 | + printf (_("%s: Databases in danger of XID wraparound: "), | ||
| 58 | + ((j > critical_xid_age) ? "CRITICAL" : "WARNING")); | ||
| 59 | + | ||
| 60 | + for (i = 0; i < PQntuples(res); i++) | ||
| 61 | + { | ||
| 62 | + printf (_("%s age %s"), PQgetvalue(res, i, 0), PQgetvalue(res, i, 1)); | ||
| 63 | + if (i < PQntuples(res) - 1) | ||
| 64 | + printf (_(",")); | ||
| 65 | + else | ||
| 66 | + printf (_("\n\n")); | ||
| 67 | + } | ||
| 68 | + PQclear (res); | ||
| 69 | + PQfinish (conn); | ||
| 70 | + return (j > critical_xid_age) ? STATE_CRITICAL : STATE_WARNING; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + PQclear(res); | ||
| 74 | status = STATE_OK; | ||
| 75 | } | ||
| 76 | PQfinish (conn); | ||
| 77 | - printf (_(" %s - database %s (%d sec.)|%s\n"), | ||
| 78 | + printf (_(" %s - database %s (%ds, XIDs OK)|%s\n"), | ||
| 79 | state_text(status), dbName, elapsed_time, | ||
| 80 | fperfdata("time", elapsed_time, "s", | ||
| 81 | @@ -198,9 +242,11 @@ | ||
| 82 | {"port", required_argument, 0, 'P'}, | ||
| 83 | {"database", required_argument, 0, 'd'}, | ||
| 84 | + {"warnxid", required_argument, 0, 'x'}, | ||
| 85 | + {"critxid", required_argument, 0, 'y'}, | ||
| 86 | {0, 0, 0, 0} | ||
| 87 | }; | ||
| 88 | |||
| 89 | while (1) { | ||
| 90 | - c = getopt_long (argc, argv, "hVt:c:w:H:P:d:l:p:a:", | ||
| 91 | + c = getopt_long (argc, argv, "hVt:c:w:H:P:d:l:p:a:x:y:", | ||
| 92 | longopts, &option); | ||
| 93 | |||
| 94 | @@ -259,4 +305,16 @@ | ||
| 95 | pguser = optarg; | ||
| 96 | break; | ||
| 97 | + case 'x': | ||
| 98 | + if (!is_intpos(optarg)) | ||
| 99 | + usage2 (_("Warning XID age must be a positive integer"), optarg); | ||
| 100 | + else | ||
| 101 | + warning_xid_age = atoi(optarg); | ||
| 102 | + break; | ||
| 103 | + case 'y': | ||
| 104 | + if (!is_intpos(optarg)) | ||
| 105 | + usage2 (_("Critical XID age must be a positive integer"), optarg); | ||
| 106 | + else | ||
| 107 | + critical_xid_age = atoi(optarg); | ||
| 108 | + break; | ||
| 109 | case 'p': /* authentication password */ | ||
| 110 | case 'a': | ||
| 111 | @@ -403,11 +461,17 @@ | ||
| 112 | |||
| 113 | printf (_("\ | ||
| 114 | - -d, --database=STRING\n\ | ||
| 115 | + -d, --database=STRING\n\ | ||
| 116 | Database to check (default: %s)\n\ | ||
| 117 | - -l, --logname = STRING\n\ | ||
| 118 | + -l, --logname = STRING\n\ | ||
| 119 | Login name of user\n\ | ||
| 120 | - -p, --password = STRING\n\ | ||
| 121 | + -p, --password = STRING\n\ | ||
| 122 | Password (BIG SECURITY ISSUE)\n"), DEFAULT_DB); | ||
| 123 | |||
| 124 | + printf (_("\ | ||
| 125 | + -x, --warnxid=INTEGER\n\ | ||
| 126 | + Minimum XID age to generate a warning (default: %d)\n\ | ||
| 127 | + -y, --critxid=INTEGER\n\ | ||
| 128 | + Minimum XID age to generate a critical (default: %d)\n"), DEFAULT_WARNING_XID_AGE, DEFAULT_CRITICAL_XID_AGE); | ||
| 129 | + | ||
| 130 | printf (_(UT_WARN_CRIT)); | ||
| 131 | |||
| 132 | @@ -442,4 +506,5 @@ | ||
| 133 | printf ("\ | ||
| 134 | Usage: %s [-H <host>] [-P <port>] [-c <critical time>] [-w <warning time>]\n\ | ||
| 135 | - [-t <timeout>] [-d <database>] [-l <logname>] [-p <password>]\n", progname); | ||
| 136 | + [-t <timeout>] [-d <database>] [-l <logname>] [-p <password>]\n\ | ||
| 137 | + [-x <warning_xid_age>] [-y <critical_xid_age>]\n", progname); | ||
| 138 | } | ||
diff --git a/web/attachments/170760-core.9342.tar.gz b/web/attachments/170760-core.9342.tar.gz new file mode 100644 index 0000000..502117b --- /dev/null +++ b/web/attachments/170760-core.9342.tar.gz | |||
| Binary files differ | |||
diff --git a/web/attachments/171745-nagios-plugins-1.4.2-check_procs_zombies.patch b/web/attachments/171745-nagios-plugins-1.4.2-check_procs_zombies.patch new file mode 100644 index 0000000..3ba88bf --- /dev/null +++ b/web/attachments/171745-nagios-plugins-1.4.2-check_procs_zombies.patch | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | diff -Naur nagios-plugins-1.4.2/plugins/check_procs.c nagios-plugins-1.4.2-check_proc_zombies/plugins/check_procs.c | ||
| 2 | --- nagios-plugins-1.4.2/plugins/check_procs.c 2005-09-15 10:27:58.000000000 +0200 | ||
| 3 | +++ nagios-plugins-1.4.2-check_proc_zombies/plugins/check_procs.c 2006-03-21 20:22:50.883708900 +0100 | ||
| 4 | @@ -166,6 +166,7 @@ | ||
| 5 | strcpy (procprog, ""); | ||
| 6 | asprintf (&procargs, "%s", ""); | ||
| 7 | |||
| 8 | + pos = 0; | ||
| 9 | cols = sscanf (input_line, PS_FORMAT, PS_VARLIST); | ||
| 10 | |||
| 11 | /* Zombie processes do not give a procprog command */ | ||
| 12 | @@ -174,8 +175,12 @@ | ||
| 13 | } | ||
| 14 | if ( cols >= expected_cols ) { | ||
| 15 | resultsum = 0; | ||
| 16 | - asprintf (&procargs, "%s", input_line + pos); | ||
| 17 | - strip (procargs); | ||
| 18 | + if (strstr(procstat, zombie)) { | ||
| 19 | + procargs = ""; | ||
| 20 | + } else { | ||
| 21 | + asprintf (&procargs, "%s", input_line + pos); | ||
| 22 | + strip (procargs); | ||
| 23 | + } | ||
| 24 | |||
| 25 | /* Some ps return full pathname for command. This removes path */ | ||
| 26 | #ifdef HAVE_BASENAME | ||
diff --git a/web/attachments/172575-nagios-plugins-1.4.check_http.patch b/web/attachments/172575-nagios-plugins-1.4.check_http.patch new file mode 100644 index 0000000..f3c3b4d --- /dev/null +++ b/web/attachments/172575-nagios-plugins-1.4.check_http.patch | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | --- nagios-plugins-1.4.orig/plugins/check_http.c 2006-03-28 16:19:02.000000000 -0500 | ||
| 2 | +++ nagios-plugins-1.4/plugins/check_http.c 2006-03-28 17:08:22.000000000 -0500 | ||
| 3 | @@ -989,14 +989,12 @@ | ||
| 4 | die (STATE_WARNING, _("HTTP WARNING: %s\n"), status_line); | ||
| 5 | |||
| 6 | /* check redirected page if specified */ | ||
| 7 | - else if (http_status >= 300) { | ||
| 8 | + else if (http_status >= 300 && onredirect != STATE_OK) { | ||
| 9 | |||
| 10 | if (onredirect == STATE_DEPENDENT) | ||
| 11 | redir (header, status_line); | ||
| 12 | else if (onredirect == STATE_UNKNOWN) | ||
| 13 | printf (_("UNKNOWN")); | ||
| 14 | - else if (onredirect == STATE_OK) | ||
| 15 | - printf (_("OK")); | ||
| 16 | else if (onredirect == STATE_WARNING) | ||
| 17 | printf (_("WARNING")); | ||
| 18 | else if (onredirect == STATE_CRITICAL) | ||
diff --git a/web/attachments/174385-patch-plugins_popen_c b/web/attachments/174385-patch-plugins_popen_c new file mode 100644 index 0000000..b424896 --- /dev/null +++ b/web/attachments/174385-patch-plugins_popen_c | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | $OpenBSD$ | ||
| 2 | --- plugins/popen.c.orig Wed Apr 12 20:42:46 2006 | ||
| 3 | +++ plugins/popen.c Wed Apr 12 20:42:48 2006 | ||
| 4 | @@ -268,9 +268,10 @@ popen_sigchld_handler (int signo) | ||
| 5 | RETSIGTYPE | ||
| 6 | popen_timeout_alarm_handler (int signo) | ||
| 7 | { | ||
| 8 | - int fh; | ||
| 9 | + int fh = -1; | ||
| 10 | if (signo == SIGALRM) { | ||
| 11 | - fh=fileno (child_process); | ||
| 12 | + if (child_process) | ||
| 13 | + fh=fileno (child_process); | ||
| 14 | if(fh >= 0){ | ||
| 15 | kill (childpid[fh], SIGKILL); | ||
| 16 | } | ||
diff --git a/web/attachments/176602-nagios-plugins-1.4.3-Makefile.in-mathlib.diff b/web/attachments/176602-nagios-plugins-1.4.3-Makefile.in-mathlib.diff new file mode 100644 index 0000000..bd97a71 --- /dev/null +++ b/web/attachments/176602-nagios-plugins-1.4.3-Makefile.in-mathlib.diff | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | *** nagios-plugins-1.4.3/plugins/Makefile.in.orig Tue May 2 18:20:40 2006 | ||
| 2 | --- nagios-plugins-1.4.3/plugins/Makefile.in Tue May 2 18:41:19 2006 | ||
| 3 | *************** | ||
| 4 | *** 411,417 **** | ||
| 5 | ############################################################################## | ||
| 6 | # the actual targets | ||
| 7 | check_dig_LDADD = $(NETLIBS) runcmd.o | ||
| 8 | ! check_disk_LDADD = $(BASEOBJS) popen.o | ||
| 9 | check_dns_LDADD = $(NETLIBS) runcmd.o | ||
| 10 | check_dummy_LDADD = $(BASEOBJS) | ||
| 11 | check_fping_LDADD = $(NETLIBS) popen.o | ||
| 12 | --- 411,417 ---- | ||
| 13 | ############################################################################## | ||
| 14 | # the actual targets | ||
| 15 | check_dig_LDADD = $(NETLIBS) runcmd.o | ||
| 16 | ! check_disk_LDADD = $(MATHLIBS) $(BASEOBJS) popen.o | ||
| 17 | check_dns_LDADD = $(NETLIBS) runcmd.o | ||
| 18 | check_dummy_LDADD = $(BASEOBJS) | ||
| 19 | check_fping_LDADD = $(NETLIBS) popen.o | ||
diff --git a/web/attachments/176994-check-smtp-ehlo.diff b/web/attachments/176994-check-smtp-ehlo.diff new file mode 100644 index 0000000..d40329a --- /dev/null +++ b/web/attachments/176994-check-smtp-ehlo.diff | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | Index: check_smtp.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_smtp.c,v | ||
| 4 | retrieving revision 1.50 | ||
| 5 | diff -u -r1.50 check_smtp.c | ||
| 6 | --- check_smtp.c 2 Nov 2005 08:47:26 -0000 1.50 | ||
| 7 | +++ check_smtp.c 6 May 2006 01:41:30 -0000 | ||
| 8 | @@ -270,6 +270,35 @@ | ||
| 9 | } else { | ||
| 10 | ssl_established = 1; | ||
| 11 | } | ||
| 12 | + | ||
| 13 | + /* | ||
| 14 | + * Resend the EHLO command. | ||
| 15 | + * | ||
| 16 | + * RFC 3207 (4.2) says: ``The client MUST discard any knowledge | ||
| 17 | + * obtained from the server, such as the list of SMTP service | ||
| 18 | + * extensions, which was not obtained from the TLS negotiation | ||
| 19 | + * itself. The client SHOULD send an EHLO command as the first | ||
| 20 | + * command after a successful TLS negotiation.'' For this | ||
| 21 | + * reason, some MTAs will not allow an AUTH LOGIN command before | ||
| 22 | + * we resent EHLO via TLS. | ||
| 23 | + */ | ||
| 24 | + if (my_send(helocmd, strlen(helocmd)) <= 0) { | ||
| 25 | + printf(_("SMTP UNKNOWN - Cannot send EHLO command via TLS.\n")); | ||
| 26 | + my_close(); | ||
| 27 | + return STATE_UNKNOWN; | ||
| 28 | + } | ||
| 29 | + if (verbose) | ||
| 30 | + printf(_("sent %s"), helocmd); | ||
| 31 | + if ((n = my_recv(buffer, MAX_INPUT_BUFFER - 1)) <= 0) { | ||
| 32 | + printf(_("SMTP UNKNOWN - Cannot read EHLO response via TLS.\n")); | ||
| 33 | + my_close(); | ||
| 34 | + return STATE_UNKNOWN; | ||
| 35 | + } | ||
| 36 | + if (verbose) { | ||
| 37 | + buffer[n] = '\0'; | ||
| 38 | + printf("%s", buffer); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | # ifdef USE_OPENSSL | ||
| 42 | if ( check_cert ) { | ||
| 43 | result = np_net_ssl_check_cert(days_till_exp); | ||
diff --git a/web/attachments/177459-check_ntp.diff b/web/attachments/177459-check_ntp.diff new file mode 100644 index 0000000..da11eb4 --- /dev/null +++ b/web/attachments/177459-check_ntp.diff | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | --- check_ntp 2006-04-28 07:19:01.546010471 +0200 | ||
| 2 | +++ check_ntp.modified 2006-04-28 07:02:45.236824995 +0200 | ||
| 3 | @@ -56,6 +56,10 @@ | ||
| 4 | # changed ntpdc to ntpq - jitter/dispersion is in milliseconds | ||
| 5 | # | ||
| 6 | # Patch for for regex for stratum1 refid. | ||
| 7 | +# | ||
| 8 | +# Script modified 2006 April 28 by Johan Nilsson (johan.nilsson@axis.com) | ||
| 9 | +# o Modified script to handle case when ntpdate reports time, but ntpq times out | ||
| 10 | +# | ||
| 11 | |||
| 12 | require 5.004; | ||
| 13 | use POSIX; | ||
| 14 | @@ -427,8 +431,11 @@ | ||
| 15 | |||
| 16 | foreach my $key (keys %ERRORS) { | ||
| 17 | if ($state==$ERRORS{$key}) { | ||
| 18 | -# print ("NTP $key: $answer"); | ||
| 19 | - print ("NTP $key: $answer|offset=$offset, jitter=" . $jitter/1000 . ",peer_stratum=$stratum\n"); | ||
| 20 | + if ( defined($jitter) ) { | ||
| 21 | + print ("NTP $key: $answer|offset=$offset, jitter=" . $jitter/1000 . ",peer_stratum=$stratum\n"); | ||
| 22 | + } else { | ||
| 23 | + print ("NTP $key: $answer"); | ||
| 24 | + }; | ||
| 25 | last; | ||
| 26 | } | ||
| 27 | } | ||
diff --git a/web/attachments/178166-check_log_patch.txt b/web/attachments/178166-check_log_patch.txt new file mode 100644 index 0000000..7debed7 --- /dev/null +++ b/web/attachments/178166-check_log_patch.txt | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | *************** | ||
| 2 | *** 198,207 **** | ||
| 3 | $DIFF $logfile $oldlog > $tempdiff | ||
| 4 | |||
| 5 | # Count the number of matching log entries we have | ||
| 6 | ! count=`$GREP -c "$query" $tempdiff` | ||
| 7 | |||
| 8 | # Get the last matching entry in the diff file | ||
| 9 | ! lastentry=`$GREP "$query" $tempdiff | $TAIL --lines=1` | ||
| 10 | |||
| 11 | $RM -f $tempdiff | ||
| 12 | $CAT $logfile > $oldlog | ||
| 13 | --- 198,207 ---- | ||
| 14 | $DIFF $logfile $oldlog > $tempdiff | ||
| 15 | |||
| 16 | # Count the number of matching log entries we have | ||
| 17 | ! count=`$GREP -c "^<.*$query" $tempdiff` | ||
| 18 | |||
| 19 | # Get the last matching entry in the diff file | ||
| 20 | ! lastentry=`$GREP "^<.*$query" $tempdiff | $TAIL --lines=1` | ||
| 21 | |||
| 22 | $RM -f $tempdiff | ||
| 23 | $CAT $logfile > $oldlog | ||
diff --git a/web/attachments/178421-check_disk.c b/web/attachments/178421-check_disk.c new file mode 100644 index 0000000..a46ceb6 --- /dev/null +++ b/web/attachments/178421-check_disk.c | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-5 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378822012" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378822012" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378822012" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378822012" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378822012'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1485816&group_id=29880&atid=397597&file_id=178421" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/178627-nagios-plugins-HEAD-200605181152-bugreport.tar.gz b/web/attachments/178627-nagios-plugins-HEAD-200605181152-bugreport.tar.gz new file mode 100644 index 0000000..976d2c4 --- /dev/null +++ b/web/attachments/178627-nagios-plugins-HEAD-200605181152-bugreport.tar.gz | |||
| Binary files differ | |||
diff --git a/web/attachments/178637-check_disk.c b/web/attachments/178637-check_disk.c new file mode 100644 index 0000000..b4c2b1d --- /dev/null +++ b/web/attachments/178637-check_disk.c | |||
| @@ -0,0 +1,874 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | |||
| 3 | This program is free software; you can redistribute it and/or modify | ||
| 4 | it under the terms of the GNU General Public License as published by | ||
| 5 | the Free Software Foundation; either version 2 of the License, or | ||
| 6 | (at your option) any later version. | ||
| 7 | |||
| 8 | This program is distributed in the hope that it will be useful, | ||
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | GNU General Public License for more details. | ||
| 12 | |||
| 13 | You should have received a copy of the GNU General Public License | ||
| 14 | along with this program; if not, write to the Free Software | ||
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 16 | |||
| 17 | $Id: check_disk.c,v 1.65m 2006/03/27 08:19:01 maemigh Exp $ | ||
| 18 | |||
| 19 | *****************************************************************************/ | ||
| 20 | |||
| 21 | const char *progname = "check_disk"; | ||
| 22 | const char *program_name = "check_disk"; /* Required for coreutils libs */ | ||
| 23 | const char *revision = "$Revision: 1.65.1 maemigh $"; | ||
| 24 | const char *copyright = "1999-2005"; | ||
| 25 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 26 | |||
| 27 | /* | ||
| 28 | * Additional inode code by Jorgen Lundman <lundman@lundman.net> | ||
| 29 | */ | ||
| 30 | |||
| 31 | |||
| 32 | #include "common.h" | ||
| 33 | #if HAVE_INTTYPES_H | ||
| 34 | # include <inttypes.h> | ||
| 35 | #endif | ||
| 36 | #include <assert.h> | ||
| 37 | #include "popen.h" | ||
| 38 | #include "utils.h" | ||
| 39 | #include <stdarg.h> | ||
| 40 | #include "../lib/fsusage.h" | ||
| 41 | #include "../lib/mountlist.h" | ||
| 42 | #if HAVE_LIMITS_H | ||
| 43 | # include <limits.h> | ||
| 44 | #endif | ||
| 45 | |||
| 46 | /* If nonzero, show even filesystems with zero size or | ||
| 47 | uninteresting types. */ | ||
| 48 | static int show_all_fs = 1; | ||
| 49 | |||
| 50 | /* If nonzero, show only local filesystems. */ | ||
| 51 | static int show_local_fs = 0; | ||
| 52 | |||
| 53 | /* If nonzero, show output in HTML format. */ | ||
| 54 | static int show_html = 0; | ||
| 55 | |||
| 56 | /* If nonzero, output percent of space and inodes USED rather than percent free */ | ||
| 57 | static int show_used = 0; | ||
| 58 | |||
| 59 | /* If positive, the units to use when printing sizes; | ||
| 60 | if negative, the human-readable base. */ | ||
| 61 | /* static int output_block_size; */ | ||
| 62 | |||
| 63 | /* If nonzero, invoke the `sync' system call before getting any usage data. | ||
| 64 | Using this option can make df very slow, especially with many or very | ||
| 65 | busy disks. Note that this may make a difference on some systems -- | ||
| 66 | SunOs4.1.3, for one. It is *not* necessary on Linux. */ | ||
| 67 | /* static int require_sync = 0; */ | ||
| 68 | |||
| 69 | /* A filesystem type to display. */ | ||
| 70 | |||
| 71 | struct name_list | ||
| 72 | { | ||
| 73 | char *name; | ||
| 74 | int exclude; | ||
| 75 | int found; | ||
| 76 | int foundexact; | ||
| 77 | int found_len; | ||
| 78 | uintmax_t w_df; | ||
| 79 | uintmax_t c_df; | ||
| 80 | double w_dfp; | ||
| 81 | double c_dfp; | ||
| 82 | double w_idfp; | ||
| 83 | double c_idfp; | ||
| 84 | struct name_list *name_next; | ||
| 85 | }; | ||
| 86 | |||
| 87 | /* Linked list of filesystem types to display. | ||
| 88 | If `fs_select_list' is NULL, list all types. | ||
| 89 | This table is generated dynamically from command-line options, | ||
| 90 | rather than hardcoding into the program what it thinks are the | ||
| 91 | valid filesystem types; let the user specify any filesystem type | ||
| 92 | they want to, and if there are any filesystems of that type, they | ||
| 93 | will be shown. | ||
| 94 | |||
| 95 | Some filesystem types: | ||
| 96 | 4.2 4.3 ufs nfs swap ignore io vm efs dbg */ | ||
| 97 | |||
| 98 | /* static struct name_list *fs_select_list; */ | ||
| 99 | |||
| 100 | /* Linked list of filesystem types to omit. | ||
| 101 | If the list is empty, don't exclude any types. */ | ||
| 102 | |||
| 103 | static struct name_list *fs_exclude_list; | ||
| 104 | |||
| 105 | static struct name_list *dp_exclude_list; | ||
| 106 | |||
| 107 | static struct name_list *path_select_list; | ||
| 108 | |||
| 109 | static struct name_list *dev_select_list; | ||
| 110 | |||
| 111 | /* Linked list of mounted filesystems. */ | ||
| 112 | static struct mount_entry *mount_list; | ||
| 113 | |||
| 114 | /* For long options that have no equivalent short option, use a | ||
| 115 | non-character as a pseudo short option, starting with CHAR_MAX + 1. */ | ||
| 116 | enum | ||
| 117 | { | ||
| 118 | SYNC_OPTION = CHAR_MAX + 1, | ||
| 119 | NO_SYNC_OPTION, | ||
| 120 | BLOCK_SIZE_OPTION | ||
| 121 | }; | ||
| 122 | |||
| 123 | #ifdef _AIX | ||
| 124 | #pragma alloca | ||
| 125 | #endif | ||
| 126 | |||
| 127 | int process_arguments (int, char **); | ||
| 128 | void print_path (const char *mypath); | ||
| 129 | int validate_arguments (uintmax_t, uintmax_t, double, double, double, double, char *); | ||
| 130 | int check_disk (double usp, uintmax_t free_disk, double uisp); | ||
| 131 | int walk_name_list (struct name_list *list, const char *name); | ||
| 132 | void print_help (void); | ||
| 133 | void print_usage (void); | ||
| 134 | |||
| 135 | uintmax_t w_df = 0; | ||
| 136 | uintmax_t c_df = 0; | ||
| 137 | double w_dfp = -1.0; | ||
| 138 | double c_dfp = -1.0; | ||
| 139 | double w_idfp = -1.0; | ||
| 140 | double c_idfp = -1.0; | ||
| 141 | char *path; | ||
| 142 | char *exclude_device; | ||
| 143 | char *units; | ||
| 144 | uintmax_t mult = 1024 * 1024; | ||
| 145 | int verbose = 0; | ||
| 146 | int erronly = FALSE; | ||
| 147 | int display_mntp = FALSE; | ||
| 148 | int longest_length = 0; | ||
| 149 | /* Linked list of mounted filesystems. */ | ||
| 150 | static struct mount_entry *mount_list; | ||
| 151 | |||
| 152 | |||
| 153 | |||
| 154 | int | ||
| 155 | main (int argc, char **argv) | ||
| 156 | { | ||
| 157 | double usp = -1.0, uisp = -1.0; | ||
| 158 | int result = STATE_UNKNOWN; | ||
| 159 | int disk_result = STATE_UNKNOWN; | ||
| 160 | char file_system[MAX_INPUT_BUFFER]; | ||
| 161 | char *output; | ||
| 162 | char *details; | ||
| 163 | char *perf; | ||
| 164 | uintmax_t psize; | ||
| 165 | float free_space, free_space_pct, total_space, inode_space_pct; | ||
| 166 | |||
| 167 | struct mount_entry *me; | ||
| 168 | struct fs_usage fsp; | ||
| 169 | struct name_list *temp_list; | ||
| 170 | |||
| 171 | output = strdup (" - free space:"); | ||
| 172 | details = strdup (""); | ||
| 173 | perf = strdup (""); | ||
| 174 | |||
| 175 | setlocale (LC_ALL, ""); | ||
| 176 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 177 | textdomain (PACKAGE); | ||
| 178 | |||
| 179 | mount_list = read_filesystem_list (0); | ||
| 180 | |||
| 181 | if (process_arguments (argc, argv) == ERROR) | ||
| 182 | usage4 (_("Could not parse arguments")); | ||
| 183 | |||
| 184 | /* if a list of paths has been selected, preseed the list with | ||
| 185 | * the longest matching filesystem name by iterating across | ||
| 186 | * the mountlist once ahead of time. this will allow a query on | ||
| 187 | * "/var/log" to return information about "/var" if no "/var/log" | ||
| 188 | * filesystem exists, etc. this is the default behavior already | ||
| 189 | * with df-based checks, but for systems with their own space | ||
| 190 | * checking routines, this should make them more consistent. | ||
| 191 | * | ||
| 192 | * Also keep track of the longest path that will be displayed | ||
| 193 | * in order to format in HTML. | ||
| 194 | */ | ||
| 195 | |||
| 196 | /* The walk_name_list function will keep track of longest_length */ | ||
| 197 | if(path_select_list){ | ||
| 198 | for (me = mount_list; me; me = me->me_next) { | ||
| 199 | walk_name_list(path_select_list, me->me_devname); | ||
| 200 | walk_name_list(path_select_list, me->me_mountdir); | ||
| 201 | } | ||
| 202 | } | ||
| 203 | /* Longest length is only kept track of when the list passed is NOT | ||
| 204 | * and exclude list. Thus we must verify the longest path that | ||
| 205 | * will be displayed in the output. | ||
| 206 | */ | ||
| 207 | else { | ||
| 208 | for (me = mount_list; me; me = me->me_next) { | ||
| 209 | if(!walk_name_list(fs_exclude_list, me->me_type) && | ||
| 210 | !walk_name_list(dp_exclude_list, me->me_devname) && | ||
| 211 | !walk_name_list(dp_exclude_list, me->me_mountdir)) { | ||
| 212 | get_fs_usage (me->me_mountdir, me->me_devname, &fsp); | ||
| 213 | if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) { | ||
| 214 | if (!strcmp(file_system, "none") || display_mntp) { | ||
| 215 | if(strlen(me->me_devname) > longest_length) longest_length = strlen(me->me_devname); | ||
| 216 | } else { | ||
| 217 | if(strlen(me->me_mountdir) > longest_length) longest_length = strlen(me->me_mountdir); | ||
| 218 | } | ||
| 219 | } | ||
| 220 | } | ||
| 221 | } | ||
| 222 | } | ||
| 223 | /* now pretend we never saw anything, but keep found_len. | ||
| 224 | * thus future searches will only match the best match */ | ||
| 225 | for (temp_list = path_select_list; temp_list; temp_list=temp_list->name_next){ | ||
| 226 | temp_list->found=0; | ||
| 227 | } | ||
| 228 | |||
| 229 | /* for every mount entry */ | ||
| 230 | for (me = mount_list; me; me = me->me_next) { | ||
| 231 | /* if there's a list of paths to select, the current mount | ||
| 232 | * entry matches in path or device name, get fs usage */ | ||
| 233 | if (path_select_list && | ||
| 234 | (walk_name_list(path_select_list, me->me_devname) || | ||
| 235 | walk_name_list(path_select_list, me->me_mountdir))) { | ||
| 236 | get_fs_usage (me->me_mountdir, me->me_devname, &fsp); | ||
| 237 | /* else if there's a list of paths/devices to select (but | ||
| 238 | * we didn't match above) skip to the next mount entry */ | ||
| 239 | } else if (dev_select_list || path_select_list) { | ||
| 240 | continue; | ||
| 241 | /* skip remote filesystems if we're not interested in them */ | ||
| 242 | } else if (me->me_remote && show_local_fs) { | ||
| 243 | continue; | ||
| 244 | /* skip pseudo fs's if we haven't asked for all fs's */ | ||
| 245 | } else if (me->me_dummy && !show_all_fs) { | ||
| 246 | continue; | ||
| 247 | /* skip excluded fstypes */ | ||
| 248 | } else if (fs_exclude_list && walk_name_list (fs_exclude_list, me->me_type)) { | ||
| 249 | continue; | ||
| 250 | /* skip excluded fs's */ | ||
| 251 | } else if (dp_exclude_list && | ||
| 252 | (walk_name_list (dp_exclude_list, me->me_devname) || | ||
| 253 | walk_name_list (dp_exclude_list, me->me_mountdir))) { | ||
| 254 | continue; | ||
| 255 | /* otherwise, get fs usage */ | ||
| 256 | } else { | ||
| 257 | get_fs_usage (me->me_mountdir, me->me_devname, &fsp); | ||
| 258 | } | ||
| 259 | if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) { | ||
| 260 | usp = (double)(fsp.fsu_blocks - fsp.fsu_bavail) * 100 / fsp.fsu_blocks; | ||
| 261 | uisp = (double)(fsp.fsu_files - fsp.fsu_ffree) * 100 / fsp.fsu_files; | ||
| 262 | disk_result = check_disk (usp, fsp.fsu_bavail, uisp); | ||
| 263 | |||
| 264 | |||
| 265 | result = max_state (disk_result, result); | ||
| 266 | psize = fsp.fsu_blocks*fsp.fsu_blocksize/mult; | ||
| 267 | |||
| 268 | |||
| 269 | /* Moved this computation up here so we can add it | ||
| 270 | * to perf */ | ||
| 271 | inode_space_pct = (float)fsp.fsu_ffree*100/fsp.fsu_files; | ||
| 272 | |||
| 273 | asprintf (&perf, "%s %s", perf, | ||
| 274 | perfdata ((!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
| 275 | psize-(fsp.fsu_bavail*fsp.fsu_blocksize/mult), units, | ||
| 276 | TRUE, min ((uintmax_t)psize-(uintmax_t)w_df, (uintmax_t)((1.0-w_dfp/100.0)*psize)), | ||
| 277 | TRUE, min ((uintmax_t)psize-(uintmax_t)c_df, (uintmax_t)((1.0-c_dfp/100.0)*psize)), | ||
| 278 | TRUE, inode_space_pct, | ||
| 279 | |||
| 280 | TRUE, psize)); | ||
| 281 | if (disk_result==STATE_OK && erronly && !verbose) | ||
| 282 | continue; | ||
| 283 | |||
| 284 | free_space = (float)fsp.fsu_bavail*fsp.fsu_blocksize/mult; | ||
| 285 | free_space_pct = (float)fsp.fsu_bavail*100/fsp.fsu_blocks; | ||
| 286 | total_space = (float)fsp.fsu_blocks*fsp.fsu_blocksize/mult; | ||
| 287 | if (disk_result!=STATE_OK || verbose>=0) { | ||
| 288 | if (show_html == 1) { | ||
| 289 | int x = 0; | ||
| 290 | int delta_len = (longest_length - strlen((!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir)); | ||
| 291 | for(x=delta_len; x >= 0; x--) { | ||
| 292 | if((!strcmp(file_system, "none") || display_mntp)) strcat(me->me_devname, " "); | ||
| 293 | else strcat(me->me_mountdir, " "); | ||
| 294 | } | ||
| 295 | asprintf (&output, ("%s <br/>%s %6.0f %s (%3.0f%% inode=%3.0f%%);"), | ||
| 296 | output, | ||
| 297 | (!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
| 298 | free_space, | ||
| 299 | units, | ||
| 300 | (show_used == 1) ? 100-free_space_pct : free_space_pct, | ||
| 301 | (show_used == 1) ? 100-inode_space_pct : inode_space_pct); | ||
| 302 | } else { | ||
| 303 | asprintf (&output, ("%s %s %.0f %s (%.0f%% inode=%.0f%%);"), | ||
| 304 | output, | ||
| 305 | (!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
| 306 | free_space, | ||
| 307 | units, | ||
| 308 | (show_used == 1) ? 100-free_space_pct : free_space_pct, | ||
| 309 | (show_used == 1) ? 100-inode_space_pct : inode_space_pct); | ||
| 310 | } | ||
| 311 | } | ||
| 312 | asprintf (&details, _("%s\n\ | ||
| 313 | %.0f of %.0f %s (%.0f%% inode=%.0f%%) free on %s (type %s mounted on %s) warn:%lu crit:%lu warn%%:%.0f%% crit%%:%.0f%%"), | ||
| 314 | details, free_space, total_space, units, free_space_pct, inode_space_pct, | ||
| 315 | me->me_devname, me->me_type, me->me_mountdir, | ||
| 316 | (unsigned long)w_df, (unsigned long)c_df, w_dfp, c_dfp); | ||
| 317 | |||
| 318 | } | ||
| 319 | |||
| 320 | } | ||
| 321 | |||
| 322 | if (verbose > 2) | ||
| 323 | asprintf (&output, "%s%s", output, details); | ||
| 324 | |||
| 325 | /* Override result if paths specified and not found */ | ||
| 326 | temp_list = path_select_list; | ||
| 327 | while (temp_list) { | ||
| 328 | if (!temp_list->found) { | ||
| 329 | asprintf (&output, _("%s [%s not found]"), output, temp_list->name); | ||
| 330 | result = STATE_CRITICAL; | ||
| 331 | } | ||
| 332 | temp_list = temp_list->name_next; | ||
| 333 | } | ||
| 334 | if (show_html == 1) | ||
| 335 | printf ("<pre>DISK %s%s|%s\n", state_text (result), output, perf); | ||
| 336 | else | ||
| 337 | printf ("DISK %s%s|%s\n", state_text (result), output, perf); | ||
| 338 | return result; | ||
| 339 | } | ||
| 340 | |||
| 341 | |||
| 342 | |||
| 343 | /* process command-line arguments */ | ||
| 344 | int | ||
| 345 | process_arguments (int argc, char **argv) | ||
| 346 | { | ||
| 347 | int c; | ||
| 348 | struct name_list *se; | ||
| 349 | struct name_list **pathtail = &path_select_list; | ||
| 350 | struct name_list **fstail = &fs_exclude_list; | ||
| 351 | struct name_list **dptail = &dp_exclude_list; | ||
| 352 | struct name_list *temp_list; | ||
| 353 | int result = OK; | ||
| 354 | struct stat *stat_buf; | ||
| 355 | |||
| 356 | unsigned long l; | ||
| 357 | |||
| 358 | int option = 0; | ||
| 359 | static struct option longopts[] = { | ||
| 360 | {"timeout", required_argument, 0, 't'}, | ||
| 361 | {"warning", required_argument, 0, 'w'}, | ||
| 362 | {"critical", required_argument, 0, 'c'}, | ||
| 363 | {"iwarning", required_argument, 0, 'W'}, | ||
| 364 | /* Dang, -C is taken. We might want to reshuffle this. */ | ||
| 365 | {"icritical", required_argument, 0, 'K'}, | ||
| 366 | {"local", required_argument, 0, 'l'}, | ||
| 367 | {"kilobytes", required_argument, 0, 'k'}, | ||
| 368 | {"megabytes", required_argument, 0, 'm'}, | ||
| 369 | {"units", required_argument, 0, 'u'}, | ||
| 370 | {"path", required_argument, 0, 'p'}, | ||
| 371 | {"partition", required_argument, 0, 'p'}, | ||
| 372 | {"exclude_device", required_argument, 0, 'x'}, | ||
| 373 | {"exclude_path", required_argument, 0, 's'}, | ||
| 374 | {"exclude-type", required_argument, 0, 'X'}, | ||
| 375 | {"mountpoint", no_argument, 0, 'M'}, | ||
| 376 | {"errors-only", no_argument, 0, 'e'}, | ||
| 377 | {"verbose", no_argument, 0, 'v'}, | ||
| 378 | {"quiet", no_argument, 0, 'q'}, | ||
| 379 | {"clear", no_argument, 0, 'C'}, | ||
| 380 | {"version", no_argument, 0, 'V'}, | ||
| 381 | {"help", no_argument, 0, 'h'}, | ||
| 382 | {"html", no_argument, 0, 'H'}, | ||
| 383 | {"used", no_argument, 0, 'U'}, | ||
| 384 | {0, 0, 0, 0} | ||
| 385 | }; | ||
| 386 | |||
| 387 | if (argc < 2) | ||
| 388 | return ERROR; | ||
| 389 | |||
| 390 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 391 | se->name = strdup ("iso9660"); | ||
| 392 | se->name_next = NULL; | ||
| 393 | se->found = 0; | ||
| 394 | se->foundexact = 0; | ||
| 395 | se->exclude = 0; | ||
| 396 | se->found_len = 0; | ||
| 397 | *fstail = se; | ||
| 398 | fstail = &se->name_next; | ||
| 399 | for (c = 1; c < argc; c++) | ||
| 400 | if (strcmp ("-to", argv[c]) == 0) | ||
| 401 | strcpy (argv[c], "-t"); | ||
| 402 | |||
| 403 | while (1) { | ||
| 404 | c = getopt_long (argc, argv, "+?VqhHiUveCt:c:w:K:W:u:p:x:s:X:mklM", longopts, &option); | ||
| 405 | |||
| 406 | if (c == -1 || c == EOF) | ||
| 407 | break; | ||
| 408 | |||
| 409 | switch (c) { | ||
| 410 | case 't': /* timeout period */ | ||
| 411 | if (is_integer (optarg)) { | ||
| 412 | timeout_interval = atoi (optarg); | ||
| 413 | break; | ||
| 414 | } | ||
| 415 | else { | ||
| 416 | usage2 (_("Timeout interval must be a positive integer"), optarg); | ||
| 417 | } | ||
| 418 | case 'w': /* warning threshold */ | ||
| 419 | if (is_intnonneg (optarg)) { | ||
| 420 | w_df = atoi (optarg); | ||
| 421 | break; | ||
| 422 | } | ||
| 423 | else if (strpbrk (optarg, ",:") && | ||
| 424 | strstr (optarg, "%") && | ||
| 425 | sscanf (optarg, "%lu%*[:,]%lf%%", &l, &w_dfp) == 2) { | ||
| 426 | w_df = (uintmax_t)l; | ||
| 427 | break; | ||
| 428 | } | ||
| 429 | else if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &w_dfp) == 1) { | ||
| 430 | break; | ||
| 431 | } | ||
| 432 | else { | ||
| 433 | usage4 (_("Warning threshold must be integer or percentage!")); | ||
| 434 | } | ||
| 435 | case 'c': /* critical threshold */ | ||
| 436 | if (is_intnonneg (optarg)) { | ||
| 437 | c_df = atoi (optarg); | ||
| 438 | break; | ||
| 439 | } | ||
| 440 | else if (strpbrk (optarg, ",:") && | ||
| 441 | strstr (optarg, "%") && | ||
| 442 | sscanf (optarg, "%lu%*[,:]%lf%%", &l, &c_dfp) == 2) { | ||
| 443 | c_df = (uintmax_t)l; | ||
| 444 | break; | ||
| 445 | } | ||
| 446 | else if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &c_dfp) == 1) { | ||
| 447 | break; | ||
| 448 | } | ||
| 449 | else { | ||
| 450 | usage4 (_("Critical threshold must be integer or percentage!")); | ||
| 451 | } | ||
| 452 | |||
| 453 | |||
| 454 | case 'W': /* warning inode threshold */ | ||
| 455 | if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &w_idfp) == 1) { | ||
| 456 | break; | ||
| 457 | } | ||
| 458 | else { | ||
| 459 | usage (_("Warning inode threshold must be percentage!\n")); | ||
| 460 | } | ||
| 461 | case 'K': /* kritical inode threshold */ | ||
| 462 | if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &c_idfp) == 1) { | ||
| 463 | break; | ||
| 464 | } | ||
| 465 | else { | ||
| 466 | usage (_("Critical inode threshold must be percentage!\n")); | ||
| 467 | } | ||
| 468 | case 'u': | ||
| 469 | if (units) | ||
| 470 | free(units); | ||
| 471 | if (! strcmp (optarg, "bytes")) { | ||
| 472 | mult = (uintmax_t)1; | ||
| 473 | units = strdup ("B"); | ||
| 474 | } else if (! strcmp (optarg, "kB")) { | ||
| 475 | mult = (uintmax_t)1024; | ||
| 476 | units = strdup ("kB"); | ||
| 477 | } else if (! strcmp (optarg, "MB")) { | ||
| 478 | mult = (uintmax_t)1024 * 1024; | ||
| 479 | units = strdup ("MB"); | ||
| 480 | } else if (! strcmp (optarg, "GB")) { | ||
| 481 | mult = (uintmax_t)1024 * 1024 * 1024; | ||
| 482 | units = strdup ("GB"); | ||
| 483 | } else if (! strcmp (optarg, "TB")) { | ||
| 484 | mult = (uintmax_t)1024 * 1024 * 1024 * 1024; | ||
| 485 | units = strdup ("TB"); | ||
| 486 | } else { | ||
| 487 | die (STATE_UNKNOWN, _("unit type %s not known\n"), optarg); | ||
| 488 | } | ||
| 489 | if (units == NULL) | ||
| 490 | die (STATE_UNKNOWN, _("failed allocating storage for '%s'\n"), "units"); | ||
| 491 | break; | ||
| 492 | case 'k': /* display mountpoint */ | ||
| 493 | mult = 1024; | ||
| 494 | if (units) | ||
| 495 | free(units); | ||
| 496 | units = strdup ("kB"); | ||
| 497 | break; | ||
| 498 | case 'm': /* display mountpoint */ | ||
| 499 | mult = 1024 * 1024; | ||
| 500 | if (units) | ||
| 501 | free(units); | ||
| 502 | units = strdup ("MB"); | ||
| 503 | break; | ||
| 504 | case 'l': | ||
| 505 | show_local_fs = 1; | ||
| 506 | break; | ||
| 507 | case 'p': /* select path */ | ||
| 508 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 509 | se->name = optarg; | ||
| 510 | se->name_next = NULL; | ||
| 511 | se->w_df = w_df; | ||
| 512 | se->c_df = c_df; | ||
| 513 | se->w_dfp = w_dfp; | ||
| 514 | se->c_dfp = c_dfp; | ||
| 515 | se->w_idfp = w_idfp; | ||
| 516 | se->c_idfp = c_idfp; | ||
| 517 | se->found = 0; | ||
| 518 | se->foundexact = 0; | ||
| 519 | se->found_len = 0; | ||
| 520 | se->exclude = 0; | ||
| 521 | *pathtail = se; | ||
| 522 | pathtail = &se->name_next; | ||
| 523 | break; | ||
| 524 | case 'x': /* exclude path or partition */ | ||
| 525 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 526 | se->name = optarg; | ||
| 527 | se->name_next = NULL; | ||
| 528 | |||
| 529 | /* If you don't clear the w_fd etc values here, they | ||
| 530 | * get processed when you walk the list and assigned | ||
| 531 | * to the global w_df! | ||
| 532 | */ | ||
| 533 | se->w_df = 0; | ||
| 534 | se->c_df = 0; | ||
| 535 | se->w_dfp = 0; | ||
| 536 | se->c_dfp = 0; | ||
| 537 | se->w_idfp = 0; | ||
| 538 | se->c_idfp = 0; | ||
| 539 | se->found = 0; | ||
| 540 | se->foundexact = 0; | ||
| 541 | se->found_len = 0; | ||
| 542 | se->exclude = 1; | ||
| 543 | *dptail = se; | ||
| 544 | dptail = &se->name_next; | ||
| 545 | break; | ||
| 546 | case 's': /* exclude path or partition */ | ||
| 547 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 548 | se->name = optarg; | ||
| 549 | se->name_next = NULL; | ||
| 550 | |||
| 551 | /* If you don't clear the w_fd etc values here, they | ||
| 552 | * get processed when you walk the list and assigned | ||
| 553 | * to the global w_df! | ||
| 554 | */ | ||
| 555 | se->w_df = 0; | ||
| 556 | se->c_df = 0; | ||
| 557 | se->w_dfp = 0; | ||
| 558 | se->c_dfp = 0; | ||
| 559 | se->w_idfp = 0; | ||
| 560 | se->c_idfp = 0; | ||
| 561 | se->found = 0; | ||
| 562 | se->foundexact = 0; | ||
| 563 | se->found_len = 0; | ||
| 564 | se->exclude = 2; | ||
| 565 | *dptail = se; | ||
| 566 | dptail = &se->name_next; | ||
| 567 | break; | ||
| 568 | case 'X': /* exclude file system type */ | ||
| 569 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 570 | se->name = optarg; | ||
| 571 | se->name_next = NULL; | ||
| 572 | /* If you don't clear the w_fd etc values here, they | ||
| 573 | * get processed when you walk the list and assigned | ||
| 574 | * to the global w_df! | ||
| 575 | */ | ||
| 576 | se->w_df = 0; | ||
| 577 | se->c_df = 0; | ||
| 578 | se->w_dfp = 0; | ||
| 579 | se->c_dfp = 0; | ||
| 580 | se->w_idfp = 0; | ||
| 581 | se->c_idfp = 0; | ||
| 582 | se->found = 0; | ||
| 583 | se->foundexact = 0; | ||
| 584 | se->found_len = 0; | ||
| 585 | *fstail = se; | ||
| 586 | fstail = &se->name_next; | ||
| 587 | break; | ||
| 588 | case 'v': /* verbose */ | ||
| 589 | verbose++; | ||
| 590 | break; | ||
| 591 | case 'q': /* verbose */ | ||
| 592 | verbose--; | ||
| 593 | break; | ||
| 594 | case 'e': | ||
| 595 | erronly = TRUE; | ||
| 596 | break; | ||
| 597 | case 'M': /* display mountpoint */ | ||
| 598 | display_mntp = TRUE; | ||
| 599 | break; | ||
| 600 | case 'C': | ||
| 601 | w_df = 0; | ||
| 602 | c_df = 0; | ||
| 603 | w_dfp = -1.0; | ||
| 604 | c_dfp = -1.0; | ||
| 605 | w_idfp = -1.0; | ||
| 606 | c_idfp = -1.0; | ||
| 607 | break; | ||
| 608 | case 'H': /* HTML formatted output */ | ||
| 609 | show_html = 1; | ||
| 610 | break; | ||
| 611 | case 'U': | ||
| 612 | show_used = 1; | ||
| 613 | break; | ||
| 614 | case 'V': /* version */ | ||
| 615 | print_revision (progname, revision); | ||
| 616 | exit (STATE_OK); | ||
| 617 | case 'h': /* help */ | ||
| 618 | print_help (); | ||
| 619 | exit (STATE_OK); | ||
| 620 | case '?': /* help */ | ||
| 621 | usage (_("Unknown argument")); | ||
| 622 | } | ||
| 623 | } | ||
| 624 | |||
| 625 | /* Support for "check_disk warn crit [fs]" with thresholds at used level */ | ||
| 626 | c = optind; | ||
| 627 | if (w_dfp < 0 && argc > c && is_intnonneg (argv[c])) | ||
| 628 | w_dfp = (100.0 - atof (argv[c++])); | ||
| 629 | |||
| 630 | if (c_dfp < 0 && argc > c && is_intnonneg (argv[c])) | ||
| 631 | c_dfp = (100.0 - atof (argv[c++])); | ||
| 632 | |||
| 633 | if (argc > c && path == NULL) { | ||
| 634 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 635 | se->name = strdup (argv[c++]); | ||
| 636 | se->name_next = NULL; | ||
| 637 | se->w_df = w_df; | ||
| 638 | se->c_df = c_df; | ||
| 639 | se->w_dfp = w_dfp; | ||
| 640 | se->c_dfp = c_dfp; | ||
| 641 | se->w_idfp = w_idfp; | ||
| 642 | se->c_idfp = c_idfp; | ||
| 643 | se->found =0; | ||
| 644 | se->foundexact = 0; | ||
| 645 | se->found_len = 0; | ||
| 646 | se->exclude = 0; | ||
| 647 | *pathtail = se; | ||
| 648 | } | ||
| 649 | |||
| 650 | if (path_select_list) { | ||
| 651 | temp_list = path_select_list; | ||
| 652 | stat_buf = malloc(sizeof *stat_buf); | ||
| 653 | while (temp_list) { | ||
| 654 | /* Stat each entry to check that dir exists */ | ||
| 655 | if (stat (temp_list->name, &stat_buf[0])) { | ||
| 656 | printf("DISK %s - ", _("CRITICAL")); | ||
| 657 | die (STATE_CRITICAL, _("%s does not exist\n"), temp_list->name); | ||
| 658 | } | ||
| 659 | if (validate_arguments (temp_list->w_df, | ||
| 660 | temp_list->c_df, | ||
| 661 | temp_list->w_dfp, | ||
| 662 | temp_list->c_dfp, | ||
| 663 | temp_list->w_idfp, | ||
| 664 | temp_list->c_idfp, | ||
| 665 | temp_list->name) == ERROR) | ||
| 666 | result = ERROR; | ||
| 667 | temp_list = temp_list->name_next; | ||
| 668 | } | ||
| 669 | free(stat_buf); | ||
| 670 | return result; | ||
| 671 | } else { | ||
| 672 | return validate_arguments (w_df, c_df, w_dfp, c_dfp, w_idfp, c_idfp, NULL); | ||
| 673 | } | ||
| 674 | } | ||
| 675 | |||
| 676 | |||
| 677 | |||
| 678 | void | ||
| 679 | print_path (const char *mypath) | ||
| 680 | { | ||
| 681 | if (mypath == NULL) | ||
| 682 | printf ("\n"); | ||
| 683 | else | ||
| 684 | printf (_(" for %s\n"), mypath); | ||
| 685 | |||
| 686 | return; | ||
| 687 | } | ||
| 688 | |||
| 689 | |||
| 690 | |||
| 691 | int | ||
| 692 | validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, double iwp, double icp, char *mypath) | ||
| 693 | { | ||
| 694 | if (w < 0 && c < 0 && wp < 0.0 && cp < 0.0) { | ||
| 695 | printf (_("INPUT ERROR: No thresholds specified")); | ||
| 696 | print_path (mypath); | ||
| 697 | return ERROR; | ||
| 698 | } | ||
| 699 | else if ((wp >= 0.0 || cp >= 0.0) && | ||
| 700 | (wp < 0.0 || cp < 0.0 || wp > 100.0 || cp > 100.0 || cp > wp)) { | ||
| 701 | printf (_("\ | ||
| 702 | INPUT ERROR: C_DFP (%f) should be less than W_DFP (%.1f) and both should be between zero and 100 percent, inclusive"), | ||
| 703 | cp, wp); | ||
| 704 | print_path (mypath); | ||
| 705 | return ERROR; | ||
| 706 | } | ||
| 707 | else if ((iwp >= 0.0 || icp >= 0.0) && | ||
| 708 | (iwp < 0.0 || icp < 0.0 || iwp > 100.0 || icp > 100.0 || icp > iwp)) { | ||
| 709 | printf (_("\ | ||
| 710 | INPUT ERROR: C_IDFP (%f) should be less than W_IDFP (%.1f) and both should be between zero and 100 percent, inclusive"), | ||
| 711 | icp, iwp); | ||
| 712 | print_path (mypath); | ||
| 713 | return ERROR; | ||
| 714 | } | ||
| 715 | else if ((w > 0 || c > 0) && (w == 0 || c == 0 || c > w)) { | ||
| 716 | printf (_("\ | ||
| 717 | INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greater than zero"), | ||
| 718 | (unsigned long)c, (unsigned long)w); | ||
| 719 | print_path (mypath); | ||
| 720 | return ERROR; | ||
| 721 | } | ||
| 722 | |||
| 723 | if (units == NULL) { | ||
| 724 | units = strdup ("MB"); | ||
| 725 | mult = (uintmax_t)1024 * 1024; | ||
| 726 | } | ||
| 727 | return OK; | ||
| 728 | } | ||
| 729 | |||
| 730 | |||
| 731 | |||
| 732 | int | ||
| 733 | |||
| 734 | check_disk (double usp, uintmax_t free_disk, double uisp) | ||
| 735 | { | ||
| 736 | int result = STATE_UNKNOWN; | ||
| 737 | /* check the percent used space against thresholds */ | ||
| 738 | if (usp >= 0.0 && c_dfp >=0.0 && usp >= (100.0 - c_dfp)) | ||
| 739 | result = STATE_CRITICAL; | ||
| 740 | else if (uisp >= 0.0 && c_idfp >=0.0 && uisp >= (100.0 - c_idfp)) | ||
| 741 | result = STATE_CRITICAL; | ||
| 742 | else if (c_df > 0 && free_disk <= c_df) | ||
| 743 | result = STATE_CRITICAL; | ||
| 744 | else if (usp >= 0.0 && w_dfp >=0.0 && usp >= (100.0 - w_dfp)) | ||
| 745 | result = STATE_WARNING; | ||
| 746 | else if (uisp >= 0.0 && w_idfp >=0.0 && uisp >= (100.0 - w_idfp)) | ||
| 747 | result = STATE_WARNING; | ||
| 748 | else if (w_df > 0 && free_disk <= w_df) | ||
| 749 | result = STATE_WARNING; | ||
| 750 | else if (usp >= 0.0) | ||
| 751 | result = STATE_OK; | ||
| 752 | return result; | ||
| 753 | } | ||
| 754 | |||
| 755 | |||
| 756 | |||
| 757 | int | ||
| 758 | walk_name_list (struct name_list *list, const char *name) | ||
| 759 | { | ||
| 760 | int foundexact = FALSE, foundmatch = FALSE; | ||
| 761 | int name_len; | ||
| 762 | name_len = strlen(name); | ||
| 763 | while (list) { | ||
| 764 | int list_name_len; | ||
| 765 | list_name_len = strlen(list->name); | ||
| 766 | if ((list->exclude == 1 && name_len == list_name_len && strncmp(list->name, name, list_name_len-1) == 0) || | ||
| 767 | (list->foundexact == 0 && list->exclude == 0 && name_len < list_name_len && strncmp(list->name, name, name_len-1) == 0) || | ||
| 768 | (list->exclude == 0 && name_len == list_name_len && strncmp(list->name, name, name_len-1) == 0) || | ||
| 769 | (list->exclude == 2 && name_len >= list_name_len && strncmp(list->name, name, list_name_len-1) == 0)) { | ||
| 770 | /* Set to -1 for now to note it was a potential match. If an EXACT match is found later, | ||
| 771 | then reset this found to 0. If not, set it to 1. */ | ||
| 772 | list->found = -1; | ||
| 773 | list->found_len = name_len; | ||
| 774 | /* Grab the longest string length that is not being excluded in order to format HTML properly */ | ||
| 775 | if (name_len > longest_length && list->exclude == 0) {longest_length = name_len;} | ||
| 776 | /* if required for name_lists that have not saved w_df, etc (eg exclude lists) */ | ||
| 777 | if (list->w_df) w_df = list->w_df; | ||
| 778 | if (list->c_df) c_df = list->c_df; | ||
| 779 | if (list->w_dfp>=0.0) w_dfp = list->w_dfp; | ||
| 780 | if (list->c_dfp>=0.0) c_dfp = list->c_dfp; | ||
| 781 | if (name_len == list_name_len) { | ||
| 782 | foundexact=TRUE; | ||
| 783 | list->foundexact = TRUE; | ||
| 784 | list->found = 1; | ||
| 785 | } | ||
| 786 | foundmatch = TRUE; | ||
| 787 | } | ||
| 788 | list = list->name_next; | ||
| 789 | } | ||
| 790 | /* Traverse the list again to reset the found variable properly */ | ||
| 791 | while (list) { | ||
| 792 | if (list->found == -1 && foundexact == TRUE) list->found = 0; | ||
| 793 | if (list->found == -1 && foundexact == FALSE) list->found =1; | ||
| 794 | list = list->name_next; | ||
| 795 | printf("tried "); | ||
| 796 | } | ||
| 797 | return foundmatch; | ||
| 798 | } | ||
| 799 | |||
| 800 | |||
| 801 | |||
| 802 | void | ||
| 803 | print_help (void) | ||
| 804 | { | ||
| 805 | print_revision (progname, revision); | ||
| 806 | |||
| 807 | printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n"); | ||
| 808 | printf (COPYRIGHT, copyright, email); | ||
| 809 | |||
| 810 | printf (_("This plugin checks the amount of used disk space on a mounted file system")); | ||
| 811 | printf (_("and generates an alert if free space is less than one of the threshold values")); | ||
| 812 | |||
| 813 | printf ("\n\n"); | ||
| 814 | |||
| 815 | print_usage (); | ||
| 816 | |||
| 817 | printf (_(UT_HELP_VRSN)); | ||
| 818 | |||
| 819 | printf (" %s\n", "-w, --warning=INTEGER"); | ||
| 820 | printf (" %s\n", _("Exit with WARNING status if less than INTEGER units of disk are free")); | ||
| 821 | printf (" %s\n", "-w, --warning=PERCENT%"); | ||
| 822 | printf (" %s\n", _("Exit with WARNING status if less than PERCENT of disk space is free")); | ||
| 823 | printf (" %s\n", "-W, --iwarning=PERCENT%"); | ||
| 824 | printf (" %s\n", _("Exit with WARNING status if less than PERCENT of inode space is free")); | ||
| 825 | printf (" %s\n", "-K, --icritical=PERCENT%"); | ||
| 826 | printf (" %s\n", _("Exit with CRITICAL status if less than PERCENT of inode space is free")); | ||
| 827 | printf (" %s\n", "-c, --critical=INTEGER"); | ||
| 828 | printf (" %s\n", _("Exit with CRITICAL status if less than INTEGER units of disk are free")); | ||
| 829 | printf (" %s\n", "-c, --critical=PERCENT%"); | ||
| 830 | printf (" %s\n", _("Exit with CRITCAL status if less than PERCENT of disk space is free")); | ||
| 831 | printf (" %s\n", "-C, --clear"); | ||
| 832 | printf (" %s\n", _("Clear thresholds")); | ||
| 833 | printf (" %s\n", "-u, --units=STRING"); | ||
| 834 | printf (" %s\n", _("Choose bytes, kB, MB, GB, TB (default: MB)")); | ||
| 835 | printf (" %s\n", "-k, --kilobytes"); | ||
| 836 | printf (" %s\n", _("Same as '--units kB'")); | ||
| 837 | printf (" %s\n", "-m, --megabytes"); | ||
| 838 | printf (" %s\n", _("Same as '--units MB'")); | ||
| 839 | printf (" %s\n", "-l, --local"); | ||
| 840 | printf (" %s\n", _("Only check local filesystems")); | ||
| 841 | printf (" %s\n", "-p, --path=PATH, --partition=PARTITION"); | ||
| 842 | printf (" %s\n", _("Path or partition (may be repeated)")); | ||
| 843 | printf (" %s\n", "-x, --exclude_device=PATH <STRING>"); | ||
| 844 | printf (" %s\n", _("Ignore device (only works if -p unspecified)")); | ||
| 845 | printf (" %s\n", "-s, --exclude_path=PATH <STRING>"); | ||
| 846 | printf (" %s\n", _("Ignore device (only works if -p unspecified)")); | ||
| 847 | printf (" %s\n", _("-X, --exclude-type=TYPE <STRING>")); | ||
| 848 | printf (" %s\n", _("Ignore all filesystems of indicated type (may be repeated)")); | ||
| 849 | printf (" %s\n", "-m, --mountpoint"); | ||
| 850 | printf (" %s\n", _("Display the mountpoint instead of the partition")); | ||
| 851 | printf (" %s\n", "-e, --errors-only"); | ||
| 852 | printf (" %s\n", _("Display only devices/mountpoints with errors")); | ||
| 853 | printf (" %s\n", "-H, --html"); | ||
| 854 | printf (" %s\n", _("Output in HTML format")); | ||
| 855 | printf (" %s\n", "-U, --used"); | ||
| 856 | printf (" %s\n", _("Output percentage of space/inodes used rather than free")); | ||
| 857 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
| 858 | printf (_(UT_VERBOSE)); | ||
| 859 | printf ("\n"); | ||
| 860 | printf ("%s\n", _("Examples:")); | ||
| 861 | printf (" %s\n", "check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /"); | ||
| 862 | printf (" %s\n", _("Checks /tmp and /var at 10% and 5%, and / at 100MB and 50MB")); | ||
| 863 | printf (_(UT_SUPPORT)); | ||
| 864 | } | ||
| 865 | |||
| 866 | |||
| 867 | |||
| 868 | void | ||
| 869 | print_usage (void) | ||
| 870 | { | ||
| 871 | printf (_("Usage:")); | ||
| 872 | printf (" %s -w limit -c limit [-p path | -x device | -s path] [-t timeout]", progname); | ||
| 873 | printf ("[-m] [-e] [-W limit] [-K limit] [-H] [-U] [-v] [-q]\n"); | ||
| 874 | } | ||
diff --git a/web/attachments/178709-check_disk.c b/web/attachments/178709-check_disk.c new file mode 100644 index 0000000..0e97150 --- /dev/null +++ b/web/attachments/178709-check_disk.c | |||
| @@ -0,0 +1,914 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | |||
| 3 | This program is free software; you can redistribute it and/or modify | ||
| 4 | it under the terms of the GNU General Public License as published by | ||
| 5 | the Free Software Foundation; either version 2 of the License, or | ||
| 6 | (at your option) any later version. | ||
| 7 | |||
| 8 | This program is distributed in the hope that it will be useful, | ||
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | GNU General Public License for more details. | ||
| 12 | |||
| 13 | You should have received a copy of the GNU General Public License | ||
| 14 | along with this program; if not, write to the Free Software | ||
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 16 | |||
| 17 | $Id: check_disk.c,v 1.65.3m 2006/05/20 21:34:01 maemigh Exp $ | ||
| 18 | |||
| 19 | *****************************************************************************/ | ||
| 20 | |||
| 21 | const char *progname = "check_disk"; | ||
| 22 | const char *program_name = "check_disk"; /* Required for coreutils libs */ | ||
| 23 | const char *revision = "$Revision: 1.65.3 maemigh $"; | ||
| 24 | const char *copyright = "1999-2005"; | ||
| 25 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 26 | |||
| 27 | /* | ||
| 28 | * Additional inode code by Jorgen Lundman <lundman@lundman.net> | ||
| 29 | */ | ||
| 30 | |||
| 31 | |||
| 32 | #include "common.h" | ||
| 33 | #if HAVE_INTTYPES_H | ||
| 34 | # include <inttypes.h> | ||
| 35 | #endif | ||
| 36 | #include <assert.h> | ||
| 37 | #include "popen.h" | ||
| 38 | #include "utils.h" | ||
| 39 | #include <stdarg.h> | ||
| 40 | #include "../lib/fsusage.h" | ||
| 41 | #include "../lib/mountlist.h" | ||
| 42 | #if HAVE_LIMITS_H | ||
| 43 | # include <limits.h> | ||
| 44 | #endif | ||
| 45 | |||
| 46 | /* If nonzero, show even filesystems with zero size or | ||
| 47 | uninteresting types. */ | ||
| 48 | static int show_all_fs = 1; | ||
| 49 | |||
| 50 | /* If nonzero, show only local filesystems. */ | ||
| 51 | static int show_local_fs = 0; | ||
| 52 | |||
| 53 | /* If nonzero, show output in HTML format. */ | ||
| 54 | static int show_html = 0; | ||
| 55 | |||
| 56 | /* If nonzero, output percent of space and inodes USED rather than percent free */ | ||
| 57 | static int show_used = 0; | ||
| 58 | |||
| 59 | /* If zero, display all mounts even with -p specified */ | ||
| 60 | static int path_select_exclude_others = 1; | ||
| 61 | |||
| 62 | /* If positive, the units to use when printing sizes; | ||
| 63 | if negative, the human-readable base. */ | ||
| 64 | /* static int output_block_size; */ | ||
| 65 | |||
| 66 | /* If nonzero, invoke the `sync' system call before getting any usage data. | ||
| 67 | Using this option can make df very slow, especially with many or very | ||
| 68 | busy disks. Note that this may make a difference on some systems -- | ||
| 69 | SunOs4.1.3, for one. It is *not* necessary on Linux. */ | ||
| 70 | /* static int require_sync = 0; */ | ||
| 71 | |||
| 72 | /* A filesystem type to display. */ | ||
| 73 | |||
| 74 | struct name_list | ||
| 75 | { | ||
| 76 | char *name; | ||
| 77 | int exclude; | ||
| 78 | int found; | ||
| 79 | int foundexact; | ||
| 80 | int found_len; | ||
| 81 | uintmax_t w_df; | ||
| 82 | uintmax_t c_df; | ||
| 83 | double w_dfp; | ||
| 84 | double c_dfp; | ||
| 85 | double w_idfp; | ||
| 86 | double c_idfp; | ||
| 87 | struct name_list *name_next; | ||
| 88 | }; | ||
| 89 | |||
| 90 | /* Linked list of filesystem types to display. | ||
| 91 | If `fs_select_list' is NULL, list all types. | ||
| 92 | This table is generated dynamically from command-line options, | ||
| 93 | rather than hardcoding into the program what it thinks are the | ||
| 94 | valid filesystem types; let the user specify any filesystem type | ||
| 95 | they want to, and if there are any filesystems of that type, they | ||
| 96 | will be shown. | ||
| 97 | |||
| 98 | Some filesystem types: | ||
| 99 | 4.2 4.3 ufs nfs swap ignore io vm efs dbg */ | ||
| 100 | |||
| 101 | /* static struct name_list *fs_select_list; */ | ||
| 102 | |||
| 103 | /* Linked list of filesystem types to omit. | ||
| 104 | If the list is empty, don't exclude any types. */ | ||
| 105 | |||
| 106 | static struct name_list *fs_exclude_list; | ||
| 107 | |||
| 108 | static struct name_list *dp_exclude_list; | ||
| 109 | |||
| 110 | static struct name_list *path_select_list; | ||
| 111 | |||
| 112 | static struct name_list *dev_select_list; | ||
| 113 | |||
| 114 | /* Linked list of mounted filesystems. */ | ||
| 115 | static struct mount_entry *mount_list; | ||
| 116 | |||
| 117 | /* For long options that have no equivalent short option, use a | ||
| 118 | non-character as a pseudo short option, starting with CHAR_MAX + 1. */ | ||
| 119 | enum | ||
| 120 | { | ||
| 121 | SYNC_OPTION = CHAR_MAX + 1, | ||
| 122 | NO_SYNC_OPTION, | ||
| 123 | BLOCK_SIZE_OPTION | ||
| 124 | }; | ||
| 125 | |||
| 126 | #ifdef _AIX | ||
| 127 | #pragma alloca | ||
| 128 | #endif | ||
| 129 | |||
| 130 | int process_arguments (int, char **); | ||
| 131 | void print_path (const char *mypath); | ||
| 132 | int validate_arguments (uintmax_t, uintmax_t, double, double, double, double, char *); | ||
| 133 | int check_disk (double usp, uintmax_t free_disk, double uisp); | ||
| 134 | int walk_name_list (struct name_list *list, const char *name); | ||
| 135 | void print_help (void); | ||
| 136 | void print_usage (void); | ||
| 137 | |||
| 138 | uintmax_t w_df = 0; | ||
| 139 | uintmax_t c_df = 0; | ||
| 140 | double w_dfp = -1.0; | ||
| 141 | double c_dfp = -1.0; | ||
| 142 | double w_idfp = -1.0; | ||
| 143 | double c_idfp = -1.0; | ||
| 144 | uintmax_t dw_df = 0; | ||
| 145 | uintmax_t dc_df = 0; | ||
| 146 | double dw_dfp = -1.0; | ||
| 147 | double dc_dfp = -1.0; | ||
| 148 | double dw_idfp = -1.0; | ||
| 149 | double dc_idfp = -1.0; | ||
| 150 | |||
| 151 | char *path; | ||
| 152 | char *exclude_device; | ||
| 153 | char *units; | ||
| 154 | uintmax_t mult = 1024 * 1024; | ||
| 155 | int verbose = 0; | ||
| 156 | int erronly = FALSE; | ||
| 157 | int display_mntp = FALSE; | ||
| 158 | int longest_length = 0; | ||
| 159 | /* Linked list of mounted filesystems. */ | ||
| 160 | static struct mount_entry *mount_list; | ||
| 161 | |||
| 162 | |||
| 163 | |||
| 164 | int | ||
| 165 | main (int argc, char **argv) | ||
| 166 | { | ||
| 167 | double usp = -1.0, uisp = -1.0; | ||
| 168 | int result = STATE_UNKNOWN; | ||
| 169 | int disk_result = STATE_UNKNOWN; | ||
| 170 | char file_system[MAX_INPUT_BUFFER]; | ||
| 171 | char *output; | ||
| 172 | char *details; | ||
| 173 | char *perf; | ||
| 174 | uintmax_t psize; | ||
| 175 | float free_space, free_space_pct, total_space, inode_space_pct; | ||
| 176 | |||
| 177 | struct mount_entry *me; | ||
| 178 | struct fs_usage fsp; | ||
| 179 | struct name_list *temp_list; | ||
| 180 | |||
| 181 | output = strdup (" - free space:"); | ||
| 182 | details = strdup (""); | ||
| 183 | perf = strdup (""); | ||
| 184 | |||
| 185 | setlocale (LC_ALL, ""); | ||
| 186 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 187 | textdomain (PACKAGE); | ||
| 188 | |||
| 189 | mount_list = read_filesystem_list (0); | ||
| 190 | |||
| 191 | if (process_arguments (argc, argv) == ERROR) | ||
| 192 | usage4 (_("Could not parse arguments")); | ||
| 193 | |||
| 194 | /* if a list of paths has been selected, preseed the list with | ||
| 195 | * the longest matching filesystem name by iterating across | ||
| 196 | * the mountlist once ahead of time. this will allow a query on | ||
| 197 | * "/var/log" to return information about "/var" if no "/var/log" | ||
| 198 | * filesystem exists, etc. this is the default behavior already | ||
| 199 | * with df-based checks, but for systems with their own space | ||
| 200 | * checking routines, this should make them more consistent. | ||
| 201 | * | ||
| 202 | * Also keep track of the longest path that will be displayed | ||
| 203 | * in order to format in HTML. | ||
| 204 | */ | ||
| 205 | |||
| 206 | /* The walk_name_list function will keep track of longest_length */ | ||
| 207 | if(path_select_list){ | ||
| 208 | for (me = mount_list; me; me = me->me_next) { | ||
| 209 | walk_name_list(path_select_list, me->me_devname); | ||
| 210 | walk_name_list(path_select_list, me->me_mountdir); | ||
| 211 | } | ||
| 212 | } | ||
| 213 | /* Longest length is only kept track of when the list passed is NOT | ||
| 214 | * and exclude list. Thus we must verify the longest path that | ||
| 215 | * will be displayed in the output. | ||
| 216 | */ | ||
| 217 | else { | ||
| 218 | for (me = mount_list; me; me = me->me_next) { | ||
| 219 | if(!walk_name_list(fs_exclude_list, me->me_type) && | ||
| 220 | !walk_name_list(dp_exclude_list, me->me_devname) && | ||
| 221 | !walk_name_list(dp_exclude_list, me->me_mountdir)) { | ||
| 222 | get_fs_usage (me->me_mountdir, me->me_devname, &fsp); | ||
| 223 | if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) { | ||
| 224 | if (!strcmp(file_system, "none") || display_mntp) { | ||
| 225 | if(strlen(me->me_devname) > longest_length) longest_length = strlen(me->me_devname); | ||
| 226 | } else { | ||
| 227 | if(strlen(me->me_mountdir) > longest_length) longest_length = strlen(me->me_mountdir); | ||
| 228 | } | ||
| 229 | } | ||
| 230 | } | ||
| 231 | } | ||
| 232 | } | ||
| 233 | /* now pretend we never saw anything, but keep found_len. | ||
| 234 | * thus future searches will only match the best match */ | ||
| 235 | for (temp_list = path_select_list; temp_list; temp_list=temp_list->name_next){ | ||
| 236 | temp_list->found=0; | ||
| 237 | } | ||
| 238 | |||
| 239 | /* for every mount entry */ | ||
| 240 | for (me = mount_list; me; me = me->me_next) { | ||
| 241 | /* if there's a list of paths to select, the current mount | ||
| 242 | * entry matches in path or device name, get fs usage */ | ||
| 243 | if (path_select_list && | ||
| 244 | (walk_name_list(path_select_list, me->me_devname) || | ||
| 245 | walk_name_list(path_select_list, me->me_mountdir))) { | ||
| 246 | get_fs_usage (me->me_mountdir, me->me_devname, &fsp); | ||
| 247 | /* else if there's a list of paths/devices to select (but | ||
| 248 | * we didn't match above) skip to the next mount entry */ | ||
| 249 | } else if (dev_select_list || (path_select_list && path_select_exclude_others)) { | ||
| 250 | continue; | ||
| 251 | /* skip remote filesystems if we're not interested in them */ | ||
| 252 | } else if (me->me_remote && show_local_fs) { | ||
| 253 | continue; | ||
| 254 | /* skip pseudo fs's if we haven't asked for all fs's */ | ||
| 255 | } else if (me->me_dummy && !show_all_fs) { | ||
| 256 | continue; | ||
| 257 | /* skip excluded fstypes */ | ||
| 258 | } else if (fs_exclude_list && walk_name_list (fs_exclude_list, me->me_type)) { | ||
| 259 | continue; | ||
| 260 | /* skip excluded fs's */ | ||
| 261 | } else if (dp_exclude_list && | ||
| 262 | (walk_name_list (dp_exclude_list, me->me_devname) || | ||
| 263 | walk_name_list (dp_exclude_list, me->me_mountdir))) { | ||
| 264 | continue; | ||
| 265 | /* otherwise, get fs usage */ | ||
| 266 | } else { | ||
| 267 | /* Reset thresholds to defaults */ | ||
| 268 | w_df = dw_df; | ||
| 269 | c_df = dc_df; | ||
| 270 | w_dfp = dw_dfp; | ||
| 271 | c_dfp = dc_dfp; | ||
| 272 | w_idfp = dw_idfp; | ||
| 273 | c_idfp = dc_idfp; | ||
| 274 | get_fs_usage (me->me_mountdir, me->me_devname, &fsp); | ||
| 275 | } | ||
| 276 | if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) { | ||
| 277 | usp = (double)(fsp.fsu_blocks - fsp.fsu_bavail) * 100 / fsp.fsu_blocks; | ||
| 278 | uisp = (double)(fsp.fsu_files - fsp.fsu_ffree) * 100 / fsp.fsu_files; | ||
| 279 | disk_result = check_disk (usp, fsp.fsu_bavail, uisp); | ||
| 280 | |||
| 281 | |||
| 282 | result = max_state (disk_result, result); | ||
| 283 | psize = fsp.fsu_blocks*fsp.fsu_blocksize/mult; | ||
| 284 | |||
| 285 | |||
| 286 | /* Moved this computation up here so we can add it | ||
| 287 | * to perf */ | ||
| 288 | inode_space_pct = (float)fsp.fsu_ffree*100/fsp.fsu_files; | ||
| 289 | |||
| 290 | asprintf (&perf, "%s %s", perf, | ||
| 291 | perfdata ((!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
| 292 | psize-(fsp.fsu_bavail*fsp.fsu_blocksize/mult), units, | ||
| 293 | TRUE, min ((uintmax_t)psize-(uintmax_t)w_df, (uintmax_t)((1.0-w_dfp/100.0)*psize)), | ||
| 294 | TRUE, min ((uintmax_t)psize-(uintmax_t)c_df, (uintmax_t)((1.0-c_dfp/100.0)*psize)), | ||
| 295 | TRUE, inode_space_pct, | ||
| 296 | |||
| 297 | TRUE, psize)); | ||
| 298 | if (disk_result==STATE_OK && erronly && !verbose) | ||
| 299 | continue; | ||
| 300 | |||
| 301 | free_space = (float)fsp.fsu_bavail*fsp.fsu_blocksize/mult; | ||
| 302 | free_space_pct = (float)fsp.fsu_bavail*100/fsp.fsu_blocks; | ||
| 303 | total_space = (float)fsp.fsu_blocks*fsp.fsu_blocksize/mult; | ||
| 304 | if (disk_result!=STATE_OK || verbose>=0) { | ||
| 305 | if (show_html == 1) { | ||
| 306 | int x = 0; | ||
| 307 | int delta_len = (longest_length - strlen((!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir)); | ||
| 308 | for(x=delta_len; x >= 0; x--) { | ||
| 309 | if((!strcmp(file_system, "none") || display_mntp)) strcat(me->me_devname, " "); | ||
| 310 | else strcat(me->me_mountdir, " "); | ||
| 311 | } | ||
| 312 | asprintf (&output, ("%s <br/>%s%s %6.0f %s (%3.0f%% inode=%3.0f%%);%s"), | ||
| 313 | output, | ||
| 314 | (disk_result!=STATE_OK) ? "*" : " ", | ||
| 315 | (!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
| 316 | free_space, | ||
| 317 | units, | ||
| 318 | (show_used == 1) ? 100-free_space_pct : free_space_pct, | ||
| 319 | (show_used == 1) ? 100-inode_space_pct : inode_space_pct, | ||
| 320 | (disk_result!=STATE_OK) ? "*" : " "); | ||
| 321 | } else { | ||
| 322 | asprintf (&output, ("%s %s %.0f %s (%.0f%% inode=%.0f%%);"), | ||
| 323 | output, | ||
| 324 | (!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
| 325 | free_space, | ||
| 326 | units, | ||
| 327 | (show_used == 1) ? 100-free_space_pct : free_space_pct, | ||
| 328 | (show_used == 1) ? 100-inode_space_pct : inode_space_pct); | ||
| 329 | } | ||
| 330 | } | ||
| 331 | asprintf (&details, _("%s\n\ | ||
| 332 | %.0f of %.0f %s (%.0f%% inode=%.0f%%) free on %s (type %s mounted on %s) warn:%lu crit:%lu warn%%:%.0f%% crit%%:%.0f%%"), | ||
| 333 | details, free_space, total_space, units, free_space_pct, inode_space_pct, | ||
| 334 | me->me_devname, me->me_type, me->me_mountdir, | ||
| 335 | (unsigned long)w_df, (unsigned long)c_df, w_dfp, c_dfp); | ||
| 336 | |||
| 337 | } | ||
| 338 | |||
| 339 | } | ||
| 340 | |||
| 341 | if (verbose > 2) | ||
| 342 | asprintf (&output, "%s%s", output, details); | ||
| 343 | |||
| 344 | /* Override result if paths specified and not found */ | ||
| 345 | temp_list = path_select_list; | ||
| 346 | while (temp_list) { | ||
| 347 | if (!temp_list->found) { | ||
| 348 | asprintf (&output, _("%s [%s not found]"), output, temp_list->name); | ||
| 349 | result = STATE_CRITICAL; | ||
| 350 | } | ||
| 351 | temp_list = temp_list->name_next; | ||
| 352 | } | ||
| 353 | if (show_html == 1) | ||
| 354 | printf ("<pre>DISK %s%s|%s\n", state_text (result), output, perf); | ||
| 355 | else | ||
| 356 | printf ("DISK %s%s|%s\n", state_text (result), output, perf); | ||
| 357 | return result; | ||
| 358 | } | ||
| 359 | |||
| 360 | |||
| 361 | |||
| 362 | /* process command-line arguments */ | ||
| 363 | int | ||
| 364 | process_arguments (int argc, char **argv) | ||
| 365 | { | ||
| 366 | int c; | ||
| 367 | struct name_list *se; | ||
| 368 | struct name_list **pathtail = &path_select_list; | ||
| 369 | struct name_list **fstail = &fs_exclude_list; | ||
| 370 | struct name_list **dptail = &dp_exclude_list; | ||
| 371 | struct name_list *temp_list; | ||
| 372 | int result = OK; | ||
| 373 | struct stat *stat_buf; | ||
| 374 | |||
| 375 | unsigned long l; | ||
| 376 | |||
| 377 | int option = 0; | ||
| 378 | static struct option longopts[] = { | ||
| 379 | {"timeout", required_argument, 0, 't'}, | ||
| 380 | {"warning", required_argument, 0, 'w'}, | ||
| 381 | {"critical", required_argument, 0, 'c'}, | ||
| 382 | {"iwarning", required_argument, 0, 'W'}, | ||
| 383 | /* Dang, -C is taken. We might want to reshuffle this. */ | ||
| 384 | {"icritical", required_argument, 0, 'K'}, | ||
| 385 | {"local", required_argument, 0, 'l'}, | ||
| 386 | {"kilobytes", required_argument, 0, 'k'}, | ||
| 387 | {"megabytes", required_argument, 0, 'm'}, | ||
| 388 | {"units", required_argument, 0, 'u'}, | ||
| 389 | {"all", no_argument, 0, 'a'}, | ||
| 390 | {"path", required_argument, 0, 'p'}, | ||
| 391 | {"partition", required_argument, 0, 'p'}, | ||
| 392 | {"exclude_device", required_argument, 0, 'x'}, | ||
| 393 | {"exclude_path", required_argument, 0, 's'}, | ||
| 394 | {"exclude-type", required_argument, 0, 'X'}, | ||
| 395 | {"mountpoint", no_argument, 0, 'M'}, | ||
| 396 | {"errors-only", no_argument, 0, 'e'}, | ||
| 397 | {"verbose", no_argument, 0, 'v'}, | ||
| 398 | {"quiet", no_argument, 0, 'q'}, | ||
| 399 | {"clear", no_argument, 0, 'C'}, | ||
| 400 | {"version", no_argument, 0, 'V'}, | ||
| 401 | {"help", no_argument, 0, 'h'}, | ||
| 402 | {"html", no_argument, 0, 'H'}, | ||
| 403 | {"used", no_argument, 0, 'U'}, | ||
| 404 | {0, 0, 0, 0} | ||
| 405 | }; | ||
| 406 | |||
| 407 | if (argc < 2) | ||
| 408 | return ERROR; | ||
| 409 | |||
| 410 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 411 | se->name = strdup ("iso9660"); | ||
| 412 | se->name_next = NULL; | ||
| 413 | se->found = 0; | ||
| 414 | se->foundexact = 0; | ||
| 415 | se->exclude = 0; | ||
| 416 | se->found_len = 0; | ||
| 417 | *fstail = se; | ||
| 418 | fstail = &se->name_next; | ||
| 419 | for (c = 1; c < argc; c++) | ||
| 420 | if (strcmp ("-to", argv[c]) == 0) | ||
| 421 | strcpy (argv[c], "-t"); | ||
| 422 | |||
| 423 | while (1) { | ||
| 424 | c = getopt_long (argc, argv, "+?VqhHiUveCat:c:w:K:W:u:p:x:s:X:mklM", longopts, &option); | ||
| 425 | |||
| 426 | if (c == -1 || c == EOF) | ||
| 427 | break; | ||
| 428 | |||
| 429 | switch (c) { | ||
| 430 | case 't': /* timeout period */ | ||
| 431 | if (is_integer (optarg)) { | ||
| 432 | timeout_interval = atoi (optarg); | ||
| 433 | break; | ||
| 434 | } | ||
| 435 | else { | ||
| 436 | usage2 (_("Timeout interval must be a positive integer"), optarg); | ||
| 437 | } | ||
| 438 | case 'w': /* warning threshold */ | ||
| 439 | if (is_intnonneg (optarg)) { | ||
| 440 | w_df = atoi (optarg); | ||
| 441 | break; | ||
| 442 | } | ||
| 443 | else if (strpbrk (optarg, ",:") && | ||
| 444 | strstr (optarg, "%") && | ||
| 445 | sscanf (optarg, "%lu%*[:,]%lf%%", &l, &w_dfp) == 2) { | ||
| 446 | w_df = (uintmax_t)l; | ||
| 447 | break; | ||
| 448 | } | ||
| 449 | else if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &w_dfp) == 1) { | ||
| 450 | break; | ||
| 451 | } | ||
| 452 | else { | ||
| 453 | usage4 (_("Warning threshold must be integer or percentage!")); | ||
| 454 | } | ||
| 455 | case 'c': /* critical threshold */ | ||
| 456 | if (is_intnonneg (optarg)) { | ||
| 457 | c_df = atoi (optarg); | ||
| 458 | break; | ||
| 459 | } | ||
| 460 | else if (strpbrk (optarg, ",:") && | ||
| 461 | strstr (optarg, "%") && | ||
| 462 | sscanf (optarg, "%lu%*[,:]%lf%%", &l, &c_dfp) == 2) { | ||
| 463 | c_df = (uintmax_t)l; | ||
| 464 | break; | ||
| 465 | } | ||
| 466 | else if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &c_dfp) == 1) { | ||
| 467 | break; | ||
| 468 | } | ||
| 469 | else { | ||
| 470 | usage4 (_("Critical threshold must be integer or percentage!")); | ||
| 471 | } | ||
| 472 | |||
| 473 | |||
| 474 | case 'W': /* warning inode threshold */ | ||
| 475 | if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &w_idfp) == 1) { | ||
| 476 | break; | ||
| 477 | } | ||
| 478 | else { | ||
| 479 | usage (_("Warning inode threshold must be percentage!\n")); | ||
| 480 | } | ||
| 481 | case 'K': /* kritical inode threshold */ | ||
| 482 | if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &c_idfp) == 1) { | ||
| 483 | break; | ||
| 484 | } | ||
| 485 | else { | ||
| 486 | usage (_("Critical inode threshold must be percentage!\n")); | ||
| 487 | } | ||
| 488 | case 'u': | ||
| 489 | if (units) | ||
| 490 | free(units); | ||
| 491 | if (! strcmp (optarg, "bytes")) { | ||
| 492 | mult = (uintmax_t)1; | ||
| 493 | units = strdup ("B"); | ||
| 494 | } else if (! strcmp (optarg, "kB")) { | ||
| 495 | mult = (uintmax_t)1024; | ||
| 496 | units = strdup ("kB"); | ||
| 497 | } else if (! strcmp (optarg, "MB")) { | ||
| 498 | mult = (uintmax_t)1024 * 1024; | ||
| 499 | units = strdup ("MB"); | ||
| 500 | } else if (! strcmp (optarg, "GB")) { | ||
| 501 | mult = (uintmax_t)1024 * 1024 * 1024; | ||
| 502 | units = strdup ("GB"); | ||
| 503 | } else if (! strcmp (optarg, "TB")) { | ||
| 504 | mult = (uintmax_t)1024 * 1024 * 1024 * 1024; | ||
| 505 | units = strdup ("TB"); | ||
| 506 | } else { | ||
| 507 | die (STATE_UNKNOWN, _("unit type %s not known\n"), optarg); | ||
| 508 | } | ||
| 509 | if (units == NULL) | ||
| 510 | die (STATE_UNKNOWN, _("failed allocating storage for '%s'\n"), "units"); | ||
| 511 | break; | ||
| 512 | case 'k': /* display mountpoint */ | ||
| 513 | mult = 1024; | ||
| 514 | if (units) | ||
| 515 | free(units); | ||
| 516 | units = strdup ("kB"); | ||
| 517 | break; | ||
| 518 | case 'm': /* display mountpoint */ | ||
| 519 | mult = 1024 * 1024; | ||
| 520 | if (units) | ||
| 521 | free(units); | ||
| 522 | units = strdup ("MB"); | ||
| 523 | break; | ||
| 524 | case 'l': | ||
| 525 | show_local_fs = 1; | ||
| 526 | break; | ||
| 527 | case 'a': /* Choose all paths */ | ||
| 528 | /* Remember the values passed in for all paths */ | ||
| 529 | path_select_exclude_others=0; | ||
| 530 | dw_df = w_df; | ||
| 531 | dc_df = c_df; | ||
| 532 | dw_dfp = w_dfp; | ||
| 533 | dc_dfp = c_dfp; | ||
| 534 | dw_idfp = w_idfp; | ||
| 535 | dc_idfp = c_idfp; | ||
| 536 | break; | ||
| 537 | case 'p': /* select path */ | ||
| 538 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 539 | se->name = optarg; | ||
| 540 | se->name_next = NULL; | ||
| 541 | se->w_df = w_df; | ||
| 542 | se->c_df = c_df; | ||
| 543 | se->w_dfp = w_dfp; | ||
| 544 | se->c_dfp = c_dfp; | ||
| 545 | se->w_idfp = w_idfp; | ||
| 546 | se->c_idfp = c_idfp; | ||
| 547 | se->found = 0; | ||
| 548 | se->foundexact = 0; | ||
| 549 | se->found_len = 0; | ||
| 550 | se->exclude = 0; | ||
| 551 | *pathtail = se; | ||
| 552 | pathtail = &se->name_next; | ||
| 553 | break; | ||
| 554 | case 'x': /* exclude path or partition */ | ||
| 555 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 556 | se->name = optarg; | ||
| 557 | se->name_next = NULL; | ||
| 558 | |||
| 559 | /* If you don't clear the w_fd etc values here, they | ||
| 560 | * get processed when you walk the list and assigned | ||
| 561 | * to the global w_df! | ||
| 562 | */ | ||
| 563 | se->w_df = 0; | ||
| 564 | se->c_df = 0; | ||
| 565 | se->w_dfp = 0; | ||
| 566 | se->c_dfp = 0; | ||
| 567 | se->w_idfp = 0; | ||
| 568 | se->c_idfp = 0; | ||
| 569 | se->found = 0; | ||
| 570 | se->foundexact = 0; | ||
| 571 | se->found_len = 0; | ||
| 572 | se->exclude = 1; | ||
| 573 | *dptail = se; | ||
| 574 | dptail = &se->name_next; | ||
| 575 | break; | ||
| 576 | case 's': /* exclude path or partition */ | ||
| 577 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 578 | se->name = optarg; | ||
| 579 | se->name_next = NULL; | ||
| 580 | |||
| 581 | /* If you don't clear the w_fd etc values here, they | ||
| 582 | * get processed when you walk the list and assigned | ||
| 583 | * to the global w_df! | ||
| 584 | */ | ||
| 585 | se->w_df = 0; | ||
| 586 | se->c_df = 0; | ||
| 587 | se->w_dfp = 0; | ||
| 588 | se->c_dfp = 0; | ||
| 589 | se->w_idfp = 0; | ||
| 590 | se->c_idfp = 0; | ||
| 591 | se->found = 0; | ||
| 592 | se->foundexact = 0; | ||
| 593 | se->found_len = 0; | ||
| 594 | se->exclude = 2; | ||
| 595 | *dptail = se; | ||
| 596 | dptail = &se->name_next; | ||
| 597 | break; | ||
| 598 | case 'X': /* exclude file system type */ | ||
| 599 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 600 | se->name = optarg; | ||
| 601 | se->name_next = NULL; | ||
| 602 | /* If you don't clear the w_fd etc values here, they | ||
| 603 | * get processed when you walk the list and assigned | ||
| 604 | * to the global w_df! | ||
| 605 | */ | ||
| 606 | se->w_df = 0; | ||
| 607 | se->c_df = 0; | ||
| 608 | se->w_dfp = 0; | ||
| 609 | se->c_dfp = 0; | ||
| 610 | se->w_idfp = 0; | ||
| 611 | se->c_idfp = 0; | ||
| 612 | se->found = 0; | ||
| 613 | se->foundexact = 0; | ||
| 614 | se->found_len = 0; | ||
| 615 | *fstail = se; | ||
| 616 | fstail = &se->name_next; | ||
| 617 | break; | ||
| 618 | case 'v': /* verbose */ | ||
| 619 | verbose++; | ||
| 620 | break; | ||
| 621 | case 'q': /* verbose */ | ||
| 622 | verbose--; | ||
| 623 | break; | ||
| 624 | case 'e': | ||
| 625 | erronly = TRUE; | ||
| 626 | break; | ||
| 627 | case 'M': /* display mountpoint */ | ||
| 628 | display_mntp = TRUE; | ||
| 629 | break; | ||
| 630 | case 'C': | ||
| 631 | w_df = 0; | ||
| 632 | c_df = 0; | ||
| 633 | w_dfp = -1.0; | ||
| 634 | c_dfp = -1.0; | ||
| 635 | w_idfp = -1.0; | ||
| 636 | c_idfp = -1.0; | ||
| 637 | break; | ||
| 638 | case 'H': /* HTML formatted output */ | ||
| 639 | show_html = 1; | ||
| 640 | break; | ||
| 641 | case 'U': | ||
| 642 | show_used = 1; | ||
| 643 | break; | ||
| 644 | case 'V': /* version */ | ||
| 645 | print_revision (progname, revision); | ||
| 646 | exit (STATE_OK); | ||
| 647 | case 'h': /* help */ | ||
| 648 | print_help (); | ||
| 649 | exit (STATE_OK); | ||
| 650 | case '?': /* help */ | ||
| 651 | usage (_("Unknown argument")); | ||
| 652 | } | ||
| 653 | } | ||
| 654 | |||
| 655 | /* Support for "check_disk warn crit [fs]" with thresholds at used level */ | ||
| 656 | c = optind; | ||
| 657 | if (w_dfp < 0 && argc > c && is_intnonneg (argv[c])) | ||
| 658 | w_dfp = (100.0 - atof (argv[c++])); | ||
| 659 | |||
| 660 | if (c_dfp < 0 && argc > c && is_intnonneg (argv[c])) | ||
| 661 | c_dfp = (100.0 - atof (argv[c++])); | ||
| 662 | |||
| 663 | if (argc > c && path == NULL) { | ||
| 664 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 665 | se->name = strdup (argv[c++]); | ||
| 666 | se->name_next = NULL; | ||
| 667 | se->w_df = w_df; | ||
| 668 | se->c_df = c_df; | ||
| 669 | se->w_dfp = w_dfp; | ||
| 670 | se->c_dfp = c_dfp; | ||
| 671 | se->w_idfp = w_idfp; | ||
| 672 | se->c_idfp = c_idfp; | ||
| 673 | se->found =0; | ||
| 674 | se->foundexact = 0; | ||
| 675 | se->found_len = 0; | ||
| 676 | se->exclude = 0; | ||
| 677 | *pathtail = se; | ||
| 678 | } | ||
| 679 | |||
| 680 | /* Remember the default values */ | ||
| 681 | w_df = 0; | ||
| 682 | c_df = 0; | ||
| 683 | w_dfp = -1.0; | ||
| 684 | c_dfp = -1.0; | ||
| 685 | w_idfp = -1.0; | ||
| 686 | c_idfp = -1.0; | ||
| 687 | |||
| 688 | if (path_select_list) { | ||
| 689 | temp_list = path_select_list; | ||
| 690 | stat_buf = malloc(sizeof *stat_buf); | ||
| 691 | while (temp_list) { | ||
| 692 | /* Stat each entry to check that dir exists */ | ||
| 693 | if (stat (temp_list->name, &stat_buf[0])) { | ||
| 694 | printf("DISK %s - ", _("CRITICAL")); | ||
| 695 | die (STATE_CRITICAL, _("%s does not exist\n"), temp_list->name); | ||
| 696 | } | ||
| 697 | if (validate_arguments (temp_list->w_df, | ||
| 698 | temp_list->c_df, | ||
| 699 | temp_list->w_dfp, | ||
| 700 | temp_list->c_dfp, | ||
| 701 | temp_list->w_idfp, | ||
| 702 | temp_list->c_idfp, | ||
| 703 | temp_list->name) == ERROR) | ||
| 704 | result = ERROR; | ||
| 705 | temp_list = temp_list->name_next; | ||
| 706 | } | ||
| 707 | free(stat_buf); | ||
| 708 | return result; | ||
| 709 | } else { | ||
| 710 | return validate_arguments (w_df, c_df, w_dfp, c_dfp, w_idfp, c_idfp, NULL); | ||
| 711 | } | ||
| 712 | } | ||
| 713 | |||
| 714 | |||
| 715 | |||
| 716 | void | ||
| 717 | print_path (const char *mypath) | ||
| 718 | { | ||
| 719 | if (mypath == NULL) | ||
| 720 | printf ("\n"); | ||
| 721 | else | ||
| 722 | printf (_(" for %s\n"), mypath); | ||
| 723 | |||
| 724 | return; | ||
| 725 | } | ||
| 726 | |||
| 727 | |||
| 728 | |||
| 729 | int | ||
| 730 | validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, double iwp, double icp, char *mypath) | ||
| 731 | { | ||
| 732 | if (w < 0 && c < 0 && wp < 0.0 && cp < 0.0) { | ||
| 733 | printf (_("INPUT ERROR: No thresholds specified")); | ||
| 734 | print_path (mypath); | ||
| 735 | return ERROR; | ||
| 736 | } | ||
| 737 | else if ((wp >= 0.0 || cp >= 0.0) && | ||
| 738 | (wp < 0.0 || cp < 0.0 || wp > 100.0 || cp > 100.0 || cp > wp)) { | ||
| 739 | printf (_("\ | ||
| 740 | INPUT ERROR: C_DFP (%f) should be less than W_DFP (%.1f) and both should be between zero and 100 percent, inclusive"), | ||
| 741 | cp, wp); | ||
| 742 | print_path (mypath); | ||
| 743 | return ERROR; | ||
| 744 | } | ||
| 745 | else if ((iwp >= 0.0 || icp >= 0.0) && | ||
| 746 | (iwp < 0.0 || icp < 0.0 || iwp > 100.0 || icp > 100.0 || icp > iwp)) { | ||
| 747 | printf (_("\ | ||
| 748 | INPUT ERROR: C_IDFP (%f) should be less than W_IDFP (%.1f) and both should be between zero and 100 percent, inclusive"), | ||
| 749 | icp, iwp); | ||
| 750 | print_path (mypath); | ||
| 751 | return ERROR; | ||
| 752 | } | ||
| 753 | else if ((w > 0 || c > 0) && (w == 0 || c == 0 || c > w)) { | ||
| 754 | printf (_("\ | ||
| 755 | INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greater than zero"), | ||
| 756 | (unsigned long)c, (unsigned long)w); | ||
| 757 | print_path (mypath); | ||
| 758 | return ERROR; | ||
| 759 | } | ||
| 760 | |||
| 761 | if (units == NULL) { | ||
| 762 | units = strdup ("MB"); | ||
| 763 | mult = (uintmax_t)1024 * 1024; | ||
| 764 | } | ||
| 765 | return OK; | ||
| 766 | } | ||
| 767 | |||
| 768 | |||
| 769 | |||
| 770 | int | ||
| 771 | |||
| 772 | check_disk (double usp, uintmax_t free_disk, double uisp) | ||
| 773 | { | ||
| 774 | int result = STATE_UNKNOWN; | ||
| 775 | /* check the percent used space against thresholds */ | ||
| 776 | if (usp >= 0.0 && c_dfp >=0.0 && usp >= (100.0 - c_dfp)) | ||
| 777 | result = STATE_CRITICAL; | ||
| 778 | else if (uisp >= 0.0 && c_idfp >=0.0 && uisp >= (100.0 - c_idfp)) | ||
| 779 | result = STATE_CRITICAL; | ||
| 780 | else if (c_df > 0 && free_disk <= c_df) | ||
| 781 | result = STATE_CRITICAL; | ||
| 782 | else if (usp >= 0.0 && w_dfp >=0.0 && usp >= (100.0 - w_dfp)) | ||
| 783 | result = STATE_WARNING; | ||
| 784 | else if (uisp >= 0.0 && w_idfp >=0.0 && uisp >= (100.0 - w_idfp)) | ||
| 785 | result = STATE_WARNING; | ||
| 786 | else if (w_df > 0 && free_disk <= w_df) | ||
| 787 | result = STATE_WARNING; | ||
| 788 | else if (usp >= 0.0) | ||
| 789 | result = STATE_OK; | ||
| 790 | return result; | ||
| 791 | } | ||
| 792 | |||
| 793 | |||
| 794 | |||
| 795 | int | ||
| 796 | walk_name_list (struct name_list *list, const char *name) | ||
| 797 | { | ||
| 798 | int foundexact = FALSE, foundmatch = FALSE; | ||
| 799 | int name_len; | ||
| 800 | name_len = strlen(name); | ||
| 801 | while (list) { | ||
| 802 | int list_name_len; | ||
| 803 | list_name_len = strlen(list->name); | ||
| 804 | if ((list->exclude == 1 && name_len == list_name_len && strncmp(list->name, name, list_name_len-1) == 0) || | ||
| 805 | (list->foundexact == 0 && list->exclude == 0 && name_len < list_name_len && strncmp(list->name, name, name_len-1) == 0) || | ||
| 806 | (list->exclude == 0 && name_len == list_name_len && strncmp(list->name, name, name_len-1) == 0) || | ||
| 807 | (list->exclude == 2 && name_len >= list_name_len && strncmp(list->name, name, list_name_len-1) == 0)) { | ||
| 808 | /* Set to -1 for now to note it was a potential match. If an EXACT match is found later, | ||
| 809 | then reset this found to 0. If not, set it to 1. */ | ||
| 810 | list->found = -1; | ||
| 811 | list->found_len = name_len; | ||
| 812 | /* Grab the longest string length that is not being excluded in order to format HTML properly */ | ||
| 813 | if (name_len > longest_length && list->exclude == 0) {longest_length = name_len;} | ||
| 814 | /* if required for name_lists that have not saved w_df, etc (eg exclude lists) */ | ||
| 815 | if (list->w_df) w_df = list->w_df; | ||
| 816 | if (list->c_df) c_df = list->c_df; | ||
| 817 | if (list->w_dfp>=0.0) w_dfp = list->w_dfp; | ||
| 818 | if (list->c_dfp>=0.0) c_dfp = list->c_dfp; | ||
| 819 | if (name_len == list_name_len) { | ||
| 820 | foundexact=TRUE; | ||
| 821 | list->foundexact = TRUE; | ||
| 822 | list->found = 1; | ||
| 823 | } | ||
| 824 | foundmatch = TRUE; | ||
| 825 | } | ||
| 826 | list = list->name_next; | ||
| 827 | } | ||
| 828 | /* Traverse the list again to reset the found variable properly */ | ||
| 829 | while (list) { | ||
| 830 | if (list->found == -1 && foundexact == TRUE) list->found = 0; | ||
| 831 | if (list->found == -1 && foundexact == FALSE) list->found =1; | ||
| 832 | list = list->name_next; | ||
| 833 | printf("tried "); | ||
| 834 | } | ||
| 835 | return foundmatch; | ||
| 836 | } | ||
| 837 | |||
| 838 | |||
| 839 | |||
| 840 | void | ||
| 841 | print_help (void) | ||
| 842 | { | ||
| 843 | print_revision (progname, revision); | ||
| 844 | |||
| 845 | printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n"); | ||
| 846 | printf (COPYRIGHT, copyright, email); | ||
| 847 | |||
| 848 | printf (_("This plugin checks the amount of used disk space on a mounted file system")); | ||
| 849 | printf (_("and generates an alert if free space is less than one of the threshold values")); | ||
| 850 | |||
| 851 | printf ("\n\n"); | ||
| 852 | |||
| 853 | print_usage (); | ||
| 854 | |||
| 855 | printf (_(UT_HELP_VRSN)); | ||
| 856 | |||
| 857 | printf (" %s\n", "-w, --warning=INTEGER"); | ||
| 858 | printf (" %s\n", _("Exit with WARNING status if less than INTEGER units of disk are free")); | ||
| 859 | printf (" %s\n", "-w, --warning=PERCENT%"); | ||
| 860 | printf (" %s\n", _("Exit with WARNING status if less than PERCENT of disk space is free")); | ||
| 861 | printf (" %s\n", "-W, --iwarning=PERCENT%"); | ||
| 862 | printf (" %s\n", _("Exit with WARNING status if less than PERCENT of inode space is free")); | ||
| 863 | printf (" %s\n", "-K, --icritical=PERCENT%"); | ||
| 864 | printf (" %s\n", _("Exit with CRITICAL status if less than PERCENT of inode space is free")); | ||
| 865 | printf (" %s\n", "-c, --critical=INTEGER"); | ||
| 866 | printf (" %s\n", _("Exit with CRITICAL status if less than INTEGER units of disk are free")); | ||
| 867 | printf (" %s\n", "-c, --critical=PERCENT%"); | ||
| 868 | printf (" %s\n", _("Exit with CRITCAL status if less than PERCENT of disk space is free")); | ||
| 869 | printf (" %s\n", "-C, --clear"); | ||
| 870 | printf (" %s\n", _("Clear thresholds")); | ||
| 871 | printf (" %s\n", "-u, --units=STRING"); | ||
| 872 | printf (" %s\n", _("Choose bytes, kB, MB, GB, TB (default: MB)")); | ||
| 873 | printf (" %s\n", "-k, --kilobytes"); | ||
| 874 | printf (" %s\n", _("Same as '--units kB'")); | ||
| 875 | printf (" %s\n", "-m, --megabytes"); | ||
| 876 | printf (" %s\n", _("Same as '--units MB'")); | ||
| 877 | printf (" %s\n", "-l, --local"); | ||
| 878 | printf (" %s\n", _("Only check local filesystems")); | ||
| 879 | printf (" %s\n", "-p, --path=PATH, --partition=PARTITION"); | ||
| 880 | printf (" %s\n", _("Path or partition (may be repeated)")); | ||
| 881 | printf (" %s\n", "-x, --exclude_device=PATH <STRING>"); | ||
| 882 | printf (" %s\n", _("Ignore device (only works if -p unspecified)")); | ||
| 883 | printf (" %s\n", "-s, --exclude_path=PATH <STRING>"); | ||
| 884 | printf (" %s\n", _("Ignore device (only works if -p unspecified)")); | ||
| 885 | printf (" %s\n", _("-X, --exclude-type=TYPE <STRING>")); | ||
| 886 | printf (" %s\n", _("Ignore all filesystems of indicated type (may be repeated)")); | ||
| 887 | printf (" %s\n", "-m, --mountpoint"); | ||
| 888 | printf (" %s\n", _("Display the mountpoint instead of the partition")); | ||
| 889 | printf (" %s\n", "-e, --errors-only"); | ||
| 890 | printf (" %s\n", _("Display only devices/mountpoints with errors")); | ||
| 891 | printf (" %s\n", "-H, --html"); | ||
| 892 | printf (" %s\n", _("Output in HTML format")); | ||
| 893 | printf (" %s\n", "-U, --used"); | ||
| 894 | printf (" %s\n", _("Output percentage of space/inodes used rather than free")); | ||
| 895 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
| 896 | printf (_(UT_VERBOSE)); | ||
| 897 | printf ("\n"); | ||
| 898 | printf ("%s\n", _("Examples:")); | ||
| 899 | printf (" %s\n", "check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /"); | ||
| 900 | printf (" %s\n", _("Checks /tmp and /var at 10% and 5%, and / at 100MB and 50MB")); | ||
| 901 | printf (" %s\n", "check_disk -w 10% -c 5% -a -C -w 5% -c 3% -p /"); | ||
| 902 | printf (" %s\n", _("Checks / at 5% and 3% and every other mount at 10% and 5%")); | ||
| 903 | printf (_(UT_SUPPORT)); | ||
| 904 | } | ||
| 905 | |||
| 906 | |||
| 907 | |||
| 908 | void | ||
| 909 | print_usage (void) | ||
| 910 | { | ||
| 911 | printf (_("Usage:")); | ||
| 912 | printf (" %s -w limit -c limit [-a | -p path | -x device | -s path] [-t timeout]", progname); | ||
| 913 | printf ("[-m] [-e] [-W limit] [-K limit] [-H] [-U] [-v] [-q]\n"); | ||
| 914 | } | ||
diff --git a/web/attachments/178761-nagiosplug-check_dhcp-ifnamsiz.patch b/web/attachments/178761-nagiosplug-check_dhcp-ifnamsiz.patch new file mode 100644 index 0000000..ccfb9b5 --- /dev/null +++ b/web/attachments/178761-nagiosplug-check_dhcp-ifnamsiz.patch | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | diff -ru nagios-plugins-1.4.3.orig/plugins-root/check_dhcp.c nagios-plugins-1.4.3/plugins-root/check_dhcp.c | ||
| 2 | --- nagios-plugins-1.4.3.orig/plugins-root/check_dhcp.c 2005-09-21 12:06:37.000000000 +0200 | ||
| 3 | +++ nagios-plugins-1.4.3/plugins-root/check_dhcp.c 2006-05-21 15:40:27.000000000 +0200 | ||
| 4 | @@ -192,7 +192,11 @@ | ||
| 5 | |||
| 6 | unsigned char client_hardware_address[MAX_DHCP_CHADDR_LENGTH]=""; | ||
| 7 | |||
| 8 | +#if IFNAMSIZ > 8 | ||
| 9 | +char network_interface_name[IFNAMSIZ]="eth0"; | ||
| 10 | +#else | ||
| 11 | char network_interface_name[8]="eth0"; | ||
| 12 | +#endif | ||
| 13 | |||
| 14 | u_int32_t packet_xid=0; | ||
| 15 | |||
diff --git a/web/attachments/178818-check_disk.c b/web/attachments/178818-check_disk.c new file mode 100644 index 0000000..bad05fb --- /dev/null +++ b/web/attachments/178818-check_disk.c | |||
| @@ -0,0 +1,916 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | |||
| 3 | This program is free software; you can redistribute it and/or modify | ||
| 4 | it under the terms of the GNU General Public License as published by | ||
| 5 | the Free Software Foundation; either version 2 of the License, or | ||
| 6 | (at your option) any later version. | ||
| 7 | |||
| 8 | This program is distributed in the hope that it will be useful, | ||
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | GNU General Public License for more details. | ||
| 12 | |||
| 13 | You should have received a copy of the GNU General Public License | ||
| 14 | along with this program; if not, write to the Free Software | ||
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 16 | |||
| 17 | $Id: check_disk.c,v 1.65.4m 2006/05/20 21:34:01 maemigh Exp $ | ||
| 18 | |||
| 19 | *****************************************************************************/ | ||
| 20 | |||
| 21 | const char *progname = "check_disk"; | ||
| 22 | const char *program_name = "check_disk"; /* Required for coreutils libs */ | ||
| 23 | const char *revision = "$Revision: 1.65.4 maemigh $"; | ||
| 24 | const char *copyright = "1999-2005"; | ||
| 25 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 26 | |||
| 27 | /* | ||
| 28 | * Additional inode code by Jorgen Lundman <lundman@lundman.net> | ||
| 29 | */ | ||
| 30 | |||
| 31 | |||
| 32 | #include "common.h" | ||
| 33 | #if HAVE_INTTYPES_H | ||
| 34 | # include <inttypes.h> | ||
| 35 | #endif | ||
| 36 | #include <assert.h> | ||
| 37 | #include "popen.h" | ||
| 38 | #include "utils.h" | ||
| 39 | #include <stdarg.h> | ||
| 40 | #include "../lib/fsusage.h" | ||
| 41 | #include "../lib/mountlist.h" | ||
| 42 | #if HAVE_LIMITS_H | ||
| 43 | # include <limits.h> | ||
| 44 | #endif | ||
| 45 | |||
| 46 | /* If nonzero, show even filesystems with zero size or | ||
| 47 | uninteresting types. */ | ||
| 48 | static int show_all_fs = 1; | ||
| 49 | |||
| 50 | /* If nonzero, show only local filesystems. */ | ||
| 51 | static int show_local_fs = 0; | ||
| 52 | |||
| 53 | /* If nonzero, show output in HTML format. */ | ||
| 54 | static int show_html = 0; | ||
| 55 | |||
| 56 | /* If nonzero, output percent of space and inodes USED rather than percent free */ | ||
| 57 | static int show_used = 0; | ||
| 58 | |||
| 59 | /* If zero, display all mounts even with -p specified */ | ||
| 60 | static int path_select_exclude_others = 1; | ||
| 61 | |||
| 62 | /* If positive, the units to use when printing sizes; | ||
| 63 | if negative, the human-readable base. */ | ||
| 64 | /* static int output_block_size; */ | ||
| 65 | |||
| 66 | /* If nonzero, invoke the `sync' system call before getting any usage data. | ||
| 67 | Using this option can make df very slow, especially with many or very | ||
| 68 | busy disks. Note that this may make a difference on some systems -- | ||
| 69 | SunOs4.1.3, for one. It is *not* necessary on Linux. */ | ||
| 70 | /* static int require_sync = 0; */ | ||
| 71 | |||
| 72 | /* A filesystem type to display. */ | ||
| 73 | |||
| 74 | struct name_list | ||
| 75 | { | ||
| 76 | char *name; | ||
| 77 | int exclude; | ||
| 78 | int found; | ||
| 79 | int foundexact; | ||
| 80 | int found_len; | ||
| 81 | uintmax_t w_df; | ||
| 82 | uintmax_t c_df; | ||
| 83 | double w_dfp; | ||
| 84 | double c_dfp; | ||
| 85 | double w_idfp; | ||
| 86 | double c_idfp; | ||
| 87 | struct name_list *name_next; | ||
| 88 | }; | ||
| 89 | |||
| 90 | /* Linked list of filesystem types to display. | ||
| 91 | If `fs_select_list' is NULL, list all types. | ||
| 92 | This table is generated dynamically from command-line options, | ||
| 93 | rather than hardcoding into the program what it thinks are the | ||
| 94 | valid filesystem types; let the user specify any filesystem type | ||
| 95 | they want to, and if there are any filesystems of that type, they | ||
| 96 | will be shown. | ||
| 97 | |||
| 98 | Some filesystem types: | ||
| 99 | 4.2 4.3 ufs nfs swap ignore io vm efs dbg */ | ||
| 100 | |||
| 101 | /* static struct name_list *fs_select_list; */ | ||
| 102 | |||
| 103 | /* Linked list of filesystem types to omit. | ||
| 104 | If the list is empty, don't exclude any types. */ | ||
| 105 | |||
| 106 | static struct name_list *fs_exclude_list; | ||
| 107 | |||
| 108 | static struct name_list *dp_exclude_list; | ||
| 109 | |||
| 110 | static struct name_list *path_select_list; | ||
| 111 | |||
| 112 | static struct name_list *dev_select_list; | ||
| 113 | |||
| 114 | /* Linked list of mounted filesystems. */ | ||
| 115 | static struct mount_entry *mount_list; | ||
| 116 | |||
| 117 | /* For long options that have no equivalent short option, use a | ||
| 118 | non-character as a pseudo short option, starting with CHAR_MAX + 1. */ | ||
| 119 | enum | ||
| 120 | { | ||
| 121 | SYNC_OPTION = CHAR_MAX + 1, | ||
| 122 | NO_SYNC_OPTION, | ||
| 123 | BLOCK_SIZE_OPTION | ||
| 124 | }; | ||
| 125 | |||
| 126 | #ifdef _AIX | ||
| 127 | #pragma alloca | ||
| 128 | #endif | ||
| 129 | |||
| 130 | int process_arguments (int, char **); | ||
| 131 | void print_path (const char *mypath); | ||
| 132 | int validate_arguments (uintmax_t, uintmax_t, double, double, double, double, char *); | ||
| 133 | int check_disk (double usp, uintmax_t free_disk, double uisp); | ||
| 134 | int walk_name_list (struct name_list *list, const char *name); | ||
| 135 | void print_help (void); | ||
| 136 | void print_usage (void); | ||
| 137 | |||
| 138 | uintmax_t w_df = 0; | ||
| 139 | uintmax_t c_df = 0; | ||
| 140 | double w_dfp = -1.0; | ||
| 141 | double c_dfp = -1.0; | ||
| 142 | double w_idfp = -1.0; | ||
| 143 | double c_idfp = -1.0; | ||
| 144 | uintmax_t dw_df = 0; | ||
| 145 | uintmax_t dc_df = 0; | ||
| 146 | double dw_dfp = -1.0; | ||
| 147 | double dc_dfp = -1.0; | ||
| 148 | double dw_idfp = -1.0; | ||
| 149 | double dc_idfp = -1.0; | ||
| 150 | |||
| 151 | char *path; | ||
| 152 | char *exclude_device; | ||
| 153 | char *units; | ||
| 154 | uintmax_t mult = 1024 * 1024; | ||
| 155 | int verbose = 0; | ||
| 156 | int erronly = FALSE; | ||
| 157 | int display_mntp = FALSE; | ||
| 158 | int longest_length = 0; | ||
| 159 | /* Linked list of mounted filesystems. */ | ||
| 160 | static struct mount_entry *mount_list; | ||
| 161 | |||
| 162 | |||
| 163 | |||
| 164 | int | ||
| 165 | main (int argc, char **argv) | ||
| 166 | { | ||
| 167 | double usp = -1.0, uisp = -1.0; | ||
| 168 | int result = STATE_UNKNOWN; | ||
| 169 | int disk_result = STATE_UNKNOWN; | ||
| 170 | char file_system[MAX_INPUT_BUFFER]; | ||
| 171 | char *output; | ||
| 172 | char *details; | ||
| 173 | char *perf; | ||
| 174 | uintmax_t psize; | ||
| 175 | float free_space, free_space_pct, total_space, inode_space_pct; | ||
| 176 | |||
| 177 | struct mount_entry *me; | ||
| 178 | struct fs_usage fsp; | ||
| 179 | struct name_list *temp_list; | ||
| 180 | |||
| 181 | output = strdup (" - free space:"); | ||
| 182 | details = strdup (""); | ||
| 183 | perf = strdup (""); | ||
| 184 | |||
| 185 | setlocale (LC_ALL, ""); | ||
| 186 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 187 | textdomain (PACKAGE); | ||
| 188 | |||
| 189 | mount_list = read_filesystem_list (0); | ||
| 190 | |||
| 191 | if (process_arguments (argc, argv) == ERROR) | ||
| 192 | usage4 (_("Could not parse arguments")); | ||
| 193 | |||
| 194 | /* if a list of paths has been selected, preseed the list with | ||
| 195 | * the longest matching filesystem name by iterating across | ||
| 196 | * the mountlist once ahead of time. this will allow a query on | ||
| 197 | * "/var/log" to return information about "/var" if no "/var/log" | ||
| 198 | * filesystem exists, etc. this is the default behavior already | ||
| 199 | * with df-based checks, but for systems with their own space | ||
| 200 | * checking routines, this should make them more consistent. | ||
| 201 | * | ||
| 202 | * Also keep track of the longest path that will be displayed | ||
| 203 | * in order to format in HTML. | ||
| 204 | */ | ||
| 205 | |||
| 206 | /* The walk_name_list function will keep track of longest_length */ | ||
| 207 | if(path_select_list){ | ||
| 208 | for (me = mount_list; me; me = me->me_next) { | ||
| 209 | walk_name_list(path_select_list, me->me_devname); | ||
| 210 | walk_name_list(path_select_list, me->me_mountdir); | ||
| 211 | } | ||
| 212 | } | ||
| 213 | /* Longest length is only kept track of when the list passed is NOT | ||
| 214 | * and exclude list. Thus we must verify the longest path that | ||
| 215 | * will be displayed in the output. | ||
| 216 | */ | ||
| 217 | else { | ||
| 218 | for (me = mount_list; me; me = me->me_next) { | ||
| 219 | if(!walk_name_list(fs_exclude_list, me->me_type) && | ||
| 220 | !walk_name_list(dp_exclude_list, me->me_devname) && | ||
| 221 | !walk_name_list(dp_exclude_list, me->me_mountdir)) { | ||
| 222 | get_fs_usage (me->me_mountdir, me->me_devname, &fsp); | ||
| 223 | if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) { | ||
| 224 | if (!strcmp(file_system, "none") || display_mntp) { | ||
| 225 | if(strlen(me->me_devname) > longest_length) longest_length = strlen(me->me_devname); | ||
| 226 | } else { | ||
| 227 | if(strlen(me->me_mountdir) > longest_length) longest_length = strlen(me->me_mountdir); | ||
| 228 | } | ||
| 229 | } | ||
| 230 | } | ||
| 231 | } | ||
| 232 | } | ||
| 233 | /* now pretend we never saw anything, but keep found_len. | ||
| 234 | * thus future searches will only match the best match */ | ||
| 235 | for (temp_list = path_select_list; temp_list; temp_list=temp_list->name_next){ | ||
| 236 | temp_list->found=0; | ||
| 237 | } | ||
| 238 | |||
| 239 | /* for every mount entry */ | ||
| 240 | for (me = mount_list; me; me = me->me_next) { | ||
| 241 | /* if there's a list of paths to select, the current mount | ||
| 242 | * entry matches in path or device name, get fs usage */ | ||
| 243 | if (path_select_list && | ||
| 244 | (walk_name_list(path_select_list, me->me_devname) || | ||
| 245 | walk_name_list(path_select_list, me->me_mountdir))) { | ||
| 246 | get_fs_usage (me->me_mountdir, me->me_devname, &fsp); | ||
| 247 | /* else if there's a list of paths/devices to select (but | ||
| 248 | * we didn't match above) skip to the next mount entry */ | ||
| 249 | } else if (dev_select_list || (path_select_list && path_select_exclude_others == 1)) { | ||
| 250 | continue; | ||
| 251 | /* skip remote filesystems if we're not interested in them */ | ||
| 252 | } else if (me->me_remote && show_local_fs) { | ||
| 253 | continue; | ||
| 254 | /* skip pseudo fs's if we haven't asked for all fs's */ | ||
| 255 | } else if (me->me_dummy && !show_all_fs) { | ||
| 256 | continue; | ||
| 257 | /* skip excluded fstypes */ | ||
| 258 | } else if (fs_exclude_list && walk_name_list (fs_exclude_list, me->me_type)) { | ||
| 259 | continue; | ||
| 260 | /* skip excluded fs's */ | ||
| 261 | } else if (dp_exclude_list && | ||
| 262 | (walk_name_list (dp_exclude_list, me->me_devname) || | ||
| 263 | walk_name_list (dp_exclude_list, me->me_mountdir))) { | ||
| 264 | continue; | ||
| 265 | /* otherwise, get fs usage */ | ||
| 266 | } else { | ||
| 267 | /* Reset thresholds to defaults */ | ||
| 268 | w_df = dw_df; | ||
| 269 | c_df = dc_df; | ||
| 270 | w_dfp = dw_dfp; | ||
| 271 | c_dfp = dc_dfp; | ||
| 272 | w_idfp = dw_idfp; | ||
| 273 | c_idfp = dc_idfp; | ||
| 274 | get_fs_usage (me->me_mountdir, me->me_devname, &fsp); | ||
| 275 | } | ||
| 276 | if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) { | ||
| 277 | usp = (double)(fsp.fsu_blocks - fsp.fsu_bavail) * 100 / fsp.fsu_blocks; | ||
| 278 | uisp = (double)(fsp.fsu_files - fsp.fsu_ffree) * 100 / fsp.fsu_files; | ||
| 279 | disk_result = check_disk (usp, fsp.fsu_bavail, uisp); | ||
| 280 | |||
| 281 | |||
| 282 | result = max_state (disk_result, result); | ||
| 283 | psize = fsp.fsu_blocks*fsp.fsu_blocksize/mult; | ||
| 284 | |||
| 285 | |||
| 286 | /* Moved this computation up here so we can add it | ||
| 287 | * to perf */ | ||
| 288 | inode_space_pct = (float)fsp.fsu_ffree*100/fsp.fsu_files; | ||
| 289 | |||
| 290 | asprintf (&perf, "%s %s", perf, | ||
| 291 | perfdata ((!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
| 292 | psize-(fsp.fsu_bavail*fsp.fsu_blocksize/mult), units, | ||
| 293 | TRUE, min ((uintmax_t)psize-(uintmax_t)w_df, (uintmax_t)((1.0-w_dfp/100.0)*psize)), | ||
| 294 | TRUE, min ((uintmax_t)psize-(uintmax_t)c_df, (uintmax_t)((1.0-c_dfp/100.0)*psize)), | ||
| 295 | TRUE, inode_space_pct, | ||
| 296 | |||
| 297 | TRUE, psize)); | ||
| 298 | if (disk_result==STATE_OK && erronly && !verbose) | ||
| 299 | continue; | ||
| 300 | |||
| 301 | free_space = (float)fsp.fsu_bavail*fsp.fsu_blocksize/mult; | ||
| 302 | free_space_pct = (float)fsp.fsu_bavail*100/fsp.fsu_blocks; | ||
| 303 | total_space = (float)fsp.fsu_blocks*fsp.fsu_blocksize/mult; | ||
| 304 | if (disk_result!=STATE_OK || verbose>=0) { | ||
| 305 | if (show_html == 1) { | ||
| 306 | int x = 0; | ||
| 307 | int delta_len = (longest_length - strlen((!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir)); | ||
| 308 | for(x=delta_len; x >= 0; x--) { | ||
| 309 | if((!strcmp(file_system, "none") || display_mntp)) strcat(me->me_devname, " "); | ||
| 310 | else strcat(me->me_mountdir, " "); | ||
| 311 | } | ||
| 312 | asprintf (&output, ("%s <br/>%s%s %6.0f %s (%3.0f%% inode=%3.0f%%);%s"), | ||
| 313 | output, | ||
| 314 | (disk_result!=STATE_OK) ? "*" : " ", | ||
| 315 | (!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
| 316 | free_space, | ||
| 317 | units, | ||
| 318 | (show_used == 1) ? 100-free_space_pct : free_space_pct, | ||
| 319 | (show_used == 1) ? 100-inode_space_pct : inode_space_pct, | ||
| 320 | (disk_result!=STATE_OK) ? "*" : " "); | ||
| 321 | } else { | ||
| 322 | asprintf (&output, ("%s %s %.0f %s (%.0f%% inode=%.0f%%);"), | ||
| 323 | output, | ||
| 324 | (!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
| 325 | free_space, | ||
| 326 | units, | ||
| 327 | (show_used == 1) ? 100-free_space_pct : free_space_pct, | ||
| 328 | (show_used == 1) ? 100-inode_space_pct : inode_space_pct); | ||
| 329 | } | ||
| 330 | } | ||
| 331 | asprintf (&details, _("%s\n\ | ||
| 332 | %.0f of %.0f %s (%.0f%% inode=%.0f%%) free on %s (type %s mounted on %s) warn:%lu crit:%lu warn%%:%.0f%% crit%%:%.0f%%"), | ||
| 333 | details, free_space, total_space, units, free_space_pct, inode_space_pct, | ||
| 334 | me->me_devname, me->me_type, me->me_mountdir, | ||
| 335 | (unsigned long)w_df, (unsigned long)c_df, w_dfp, c_dfp); | ||
| 336 | |||
| 337 | } | ||
| 338 | |||
| 339 | } | ||
| 340 | |||
| 341 | if (verbose > 2) | ||
| 342 | asprintf (&output, "%s%s", output, details); | ||
| 343 | |||
| 344 | /* Override result if paths specified and not found */ | ||
| 345 | temp_list = path_select_list; | ||
| 346 | while (temp_list) { | ||
| 347 | if (!temp_list->found) { | ||
| 348 | asprintf (&output, _("%s [%s not found]"), output, temp_list->name); | ||
| 349 | result = STATE_CRITICAL; | ||
| 350 | } | ||
| 351 | temp_list = temp_list->name_next; | ||
| 352 | } | ||
| 353 | if (show_html == 1) | ||
| 354 | printf ("<pre>DISK %s%s|%s\n", state_text (result), output, perf); | ||
| 355 | else | ||
| 356 | printf ("DISK %s%s|%s\n", state_text (result), output, perf); | ||
| 357 | return result; | ||
| 358 | } | ||
| 359 | |||
| 360 | |||
| 361 | |||
| 362 | /* process command-line arguments */ | ||
| 363 | int | ||
| 364 | process_arguments (int argc, char **argv) | ||
| 365 | { | ||
| 366 | int c; | ||
| 367 | struct name_list *se; | ||
| 368 | struct name_list **pathtail = &path_select_list; | ||
| 369 | struct name_list **fstail = &fs_exclude_list; | ||
| 370 | struct name_list **dptail = &dp_exclude_list; | ||
| 371 | struct name_list *temp_list; | ||
| 372 | int result = OK; | ||
| 373 | struct stat *stat_buf; | ||
| 374 | |||
| 375 | unsigned long l; | ||
| 376 | |||
| 377 | int option = 0; | ||
| 378 | static struct option longopts[] = { | ||
| 379 | {"timeout", required_argument, 0, 't'}, | ||
| 380 | {"warning", required_argument, 0, 'w'}, | ||
| 381 | {"critical", required_argument, 0, 'c'}, | ||
| 382 | {"iwarning", required_argument, 0, 'W'}, | ||
| 383 | /* Dang, -C is taken. We might want to reshuffle this. */ | ||
| 384 | {"icritical", required_argument, 0, 'K'}, | ||
| 385 | {"local", required_argument, 0, 'l'}, | ||
| 386 | {"kilobytes", required_argument, 0, 'k'}, | ||
| 387 | {"megabytes", required_argument, 0, 'm'}, | ||
| 388 | {"units", required_argument, 0, 'u'}, | ||
| 389 | {"all", no_argument, 0, 'a'}, | ||
| 390 | {"path", required_argument, 0, 'p'}, | ||
| 391 | {"partition", required_argument, 0, 'p'}, | ||
| 392 | {"exclude_device", required_argument, 0, 'x'}, | ||
| 393 | {"exclude_path", required_argument, 0, 's'}, | ||
| 394 | {"exclude-type", required_argument, 0, 'X'}, | ||
| 395 | {"mountpoint", no_argument, 0, 'M'}, | ||
| 396 | {"errors-only", no_argument, 0, 'e'}, | ||
| 397 | {"verbose", no_argument, 0, 'v'}, | ||
| 398 | {"quiet", no_argument, 0, 'q'}, | ||
| 399 | {"clear", no_argument, 0, 'C'}, | ||
| 400 | {"version", no_argument, 0, 'V'}, | ||
| 401 | {"help", no_argument, 0, 'h'}, | ||
| 402 | {"html", no_argument, 0, 'H'}, | ||
| 403 | {"used", no_argument, 0, 'U'}, | ||
| 404 | {0, 0, 0, 0} | ||
| 405 | }; | ||
| 406 | |||
| 407 | if (argc < 2) | ||
| 408 | return ERROR; | ||
| 409 | |||
| 410 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 411 | se->name = strdup ("iso9660"); | ||
| 412 | se->name_next = NULL; | ||
| 413 | se->found = 0; | ||
| 414 | se->foundexact = 0; | ||
| 415 | se->exclude = 0; | ||
| 416 | se->found_len = 0; | ||
| 417 | *fstail = se; | ||
| 418 | fstail = &se->name_next; | ||
| 419 | for (c = 1; c < argc; c++) | ||
| 420 | if (strcmp ("-to", argv[c]) == 0) | ||
| 421 | strcpy (argv[c], "-t"); | ||
| 422 | |||
| 423 | while (1) { | ||
| 424 | c = getopt_long (argc, argv, "+?VqhHiUveCat:c:w:K:W:u:p:x:s:X:mklM", longopts, &option); | ||
| 425 | |||
| 426 | if (c == -1 || c == EOF) | ||
| 427 | break; | ||
| 428 | |||
| 429 | switch (c) { | ||
| 430 | case 't': /* timeout period */ | ||
| 431 | if (is_integer (optarg)) { | ||
| 432 | timeout_interval = atoi (optarg); | ||
| 433 | break; | ||
| 434 | } | ||
| 435 | else { | ||
| 436 | usage2 (_("Timeout interval must be a positive integer"), optarg); | ||
| 437 | } | ||
| 438 | case 'w': /* warning threshold */ | ||
| 439 | if (is_intnonneg (optarg)) { | ||
| 440 | w_df = atoi (optarg); | ||
| 441 | break; | ||
| 442 | } | ||
| 443 | else if (strpbrk (optarg, ",:") && | ||
| 444 | strstr (optarg, "%") && | ||
| 445 | sscanf (optarg, "%lu%*[:,]%lf%%", &l, &w_dfp) == 2) { | ||
| 446 | w_df = (uintmax_t)l; | ||
| 447 | break; | ||
| 448 | } | ||
| 449 | else if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &w_dfp) == 1) { | ||
| 450 | break; | ||
| 451 | } | ||
| 452 | else { | ||
| 453 | usage4 (_("Warning threshold must be integer or percentage!")); | ||
| 454 | } | ||
| 455 | case 'c': /* critical threshold */ | ||
| 456 | if (is_intnonneg (optarg)) { | ||
| 457 | c_df = atoi (optarg); | ||
| 458 | break; | ||
| 459 | } | ||
| 460 | else if (strpbrk (optarg, ",:") && | ||
| 461 | strstr (optarg, "%") && | ||
| 462 | sscanf (optarg, "%lu%*[,:]%lf%%", &l, &c_dfp) == 2) { | ||
| 463 | c_df = (uintmax_t)l; | ||
| 464 | break; | ||
| 465 | } | ||
| 466 | else if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &c_dfp) == 1) { | ||
| 467 | break; | ||
| 468 | } | ||
| 469 | else { | ||
| 470 | usage4 (_("Critical threshold must be integer or percentage!")); | ||
| 471 | } | ||
| 472 | |||
| 473 | |||
| 474 | case 'W': /* warning inode threshold */ | ||
| 475 | if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &w_idfp) == 1) { | ||
| 476 | break; | ||
| 477 | } | ||
| 478 | else { | ||
| 479 | usage (_("Warning inode threshold must be percentage!\n")); | ||
| 480 | } | ||
| 481 | case 'K': /* kritical inode threshold */ | ||
| 482 | if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &c_idfp) == 1) { | ||
| 483 | break; | ||
| 484 | } | ||
| 485 | else { | ||
| 486 | usage (_("Critical inode threshold must be percentage!\n")); | ||
| 487 | } | ||
| 488 | case 'u': | ||
| 489 | if (units) | ||
| 490 | free(units); | ||
| 491 | if (! strcmp (optarg, "bytes")) { | ||
| 492 | mult = (uintmax_t)1; | ||
| 493 | units = strdup ("B"); | ||
| 494 | } else if (! strcmp (optarg, "kB")) { | ||
| 495 | mult = (uintmax_t)1024; | ||
| 496 | units = strdup ("kB"); | ||
| 497 | } else if (! strcmp (optarg, "MB")) { | ||
| 498 | mult = (uintmax_t)1024 * 1024; | ||
| 499 | units = strdup ("MB"); | ||
| 500 | } else if (! strcmp (optarg, "GB")) { | ||
| 501 | mult = (uintmax_t)1024 * 1024 * 1024; | ||
| 502 | units = strdup ("GB"); | ||
| 503 | } else if (! strcmp (optarg, "TB")) { | ||
| 504 | mult = (uintmax_t)1024 * 1024 * 1024 * 1024; | ||
| 505 | units = strdup ("TB"); | ||
| 506 | } else { | ||
| 507 | die (STATE_UNKNOWN, _("unit type %s not known\n"), optarg); | ||
| 508 | } | ||
| 509 | if (units == NULL) | ||
| 510 | die (STATE_UNKNOWN, _("failed allocating storage for '%s'\n"), "units"); | ||
| 511 | break; | ||
| 512 | case 'k': /* display mountpoint */ | ||
| 513 | mult = 1024; | ||
| 514 | if (units) | ||
| 515 | free(units); | ||
| 516 | units = strdup ("kB"); | ||
| 517 | break; | ||
| 518 | case 'm': /* display mountpoint */ | ||
| 519 | mult = 1024 * 1024; | ||
| 520 | if (units) | ||
| 521 | free(units); | ||
| 522 | units = strdup ("MB"); | ||
| 523 | break; | ||
| 524 | case 'l': | ||
| 525 | show_local_fs = 1; | ||
| 526 | break; | ||
| 527 | case 'a': /* Choose all paths */ | ||
| 528 | /* Remember the values passed in for all paths */ | ||
| 529 | path_select_exclude_others=0; | ||
| 530 | dw_df = w_df; | ||
| 531 | dc_df = c_df; | ||
| 532 | dw_dfp = w_dfp; | ||
| 533 | dc_dfp = c_dfp; | ||
| 534 | dw_idfp = w_idfp; | ||
| 535 | dc_idfp = c_idfp; | ||
| 536 | break; | ||
| 537 | case 'p': /* select path */ | ||
| 538 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 539 | se->name = optarg; | ||
| 540 | se->name_next = NULL; | ||
| 541 | se->w_df = w_df; | ||
| 542 | se->c_df = c_df; | ||
| 543 | se->w_dfp = w_dfp; | ||
| 544 | se->c_dfp = c_dfp; | ||
| 545 | se->w_idfp = w_idfp; | ||
| 546 | se->c_idfp = c_idfp; | ||
| 547 | se->found = 0; | ||
| 548 | se->foundexact = 0; | ||
| 549 | se->found_len = 0; | ||
| 550 | se->exclude = 0; | ||
| 551 | *pathtail = se; | ||
| 552 | pathtail = &se->name_next; | ||
| 553 | break; | ||
| 554 | case 'x': /* exclude path or partition */ | ||
| 555 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 556 | se->name = optarg; | ||
| 557 | se->name_next = NULL; | ||
| 558 | |||
| 559 | /* If you don't clear the w_fd etc values here, they | ||
| 560 | * get processed when you walk the list and assigned | ||
| 561 | * to the global w_df! | ||
| 562 | */ | ||
| 563 | se->w_df = 0; | ||
| 564 | se->c_df = 0; | ||
| 565 | se->w_dfp = 0; | ||
| 566 | se->c_dfp = 0; | ||
| 567 | se->w_idfp = 0; | ||
| 568 | se->c_idfp = 0; | ||
| 569 | se->found = 0; | ||
| 570 | se->foundexact = 0; | ||
| 571 | se->found_len = 0; | ||
| 572 | se->exclude = 1; | ||
| 573 | *dptail = se; | ||
| 574 | dptail = &se->name_next; | ||
| 575 | break; | ||
| 576 | case 's': /* exclude path or partition */ | ||
| 577 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 578 | se->name = optarg; | ||
| 579 | se->name_next = NULL; | ||
| 580 | |||
| 581 | /* If you don't clear the w_fd etc values here, they | ||
| 582 | * get processed when you walk the list and assigned | ||
| 583 | * to the global w_df! | ||
| 584 | */ | ||
| 585 | se->w_df = 0; | ||
| 586 | se->c_df = 0; | ||
| 587 | se->w_dfp = 0; | ||
| 588 | se->c_dfp = 0; | ||
| 589 | se->w_idfp = 0; | ||
| 590 | se->c_idfp = 0; | ||
| 591 | se->found = 0; | ||
| 592 | se->foundexact = 0; | ||
| 593 | se->found_len = 0; | ||
| 594 | se->exclude = 2; | ||
| 595 | *dptail = se; | ||
| 596 | dptail = &se->name_next; | ||
| 597 | break; | ||
| 598 | case 'X': /* exclude file system type */ | ||
| 599 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 600 | se->name = optarg; | ||
| 601 | se->name_next = NULL; | ||
| 602 | /* If you don't clear the w_fd etc values here, they | ||
| 603 | * get processed when you walk the list and assigned | ||
| 604 | * to the global w_df! | ||
| 605 | */ | ||
| 606 | se->w_df = 0; | ||
| 607 | se->c_df = 0; | ||
| 608 | se->w_dfp = 0; | ||
| 609 | se->c_dfp = 0; | ||
| 610 | se->w_idfp = 0; | ||
| 611 | se->c_idfp = 0; | ||
| 612 | se->found = 0; | ||
| 613 | se->foundexact = 0; | ||
| 614 | se->found_len = 0; | ||
| 615 | *fstail = se; | ||
| 616 | fstail = &se->name_next; | ||
| 617 | break; | ||
| 618 | case 'v': /* verbose */ | ||
| 619 | verbose++; | ||
| 620 | break; | ||
| 621 | case 'q': /* verbose */ | ||
| 622 | verbose--; | ||
| 623 | break; | ||
| 624 | case 'e': | ||
| 625 | erronly = TRUE; | ||
| 626 | break; | ||
| 627 | case 'M': /* display mountpoint */ | ||
| 628 | display_mntp = TRUE; | ||
| 629 | break; | ||
| 630 | case 'C': | ||
| 631 | w_df = 0; | ||
| 632 | c_df = 0; | ||
| 633 | w_dfp = -1.0; | ||
| 634 | c_dfp = -1.0; | ||
| 635 | w_idfp = -1.0; | ||
| 636 | c_idfp = -1.0; | ||
| 637 | break; | ||
| 638 | case 'H': /* HTML formatted output */ | ||
| 639 | show_html = 1; | ||
| 640 | break; | ||
| 641 | case 'U': | ||
| 642 | show_used = 1; | ||
| 643 | break; | ||
| 644 | case 'V': /* version */ | ||
| 645 | print_revision (progname, revision); | ||
| 646 | exit (STATE_OK); | ||
| 647 | case 'h': /* help */ | ||
| 648 | print_help (); | ||
| 649 | exit (STATE_OK); | ||
| 650 | case '?': /* help */ | ||
| 651 | usage (_("Unknown argument")); | ||
| 652 | } | ||
| 653 | } | ||
| 654 | |||
| 655 | /* Support for "check_disk warn crit [fs]" with thresholds at used level */ | ||
| 656 | c = optind; | ||
| 657 | if (w_dfp < 0 && argc > c && is_intnonneg (argv[c])) | ||
| 658 | w_dfp = (100.0 - atof (argv[c++])); | ||
| 659 | |||
| 660 | if (c_dfp < 0 && argc > c && is_intnonneg (argv[c])) | ||
| 661 | c_dfp = (100.0 - atof (argv[c++])); | ||
| 662 | |||
| 663 | if (argc > c && path == NULL) { | ||
| 664 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 665 | se->name = strdup (argv[c++]); | ||
| 666 | se->name_next = NULL; | ||
| 667 | se->w_df = w_df; | ||
| 668 | se->c_df = c_df; | ||
| 669 | se->w_dfp = w_dfp; | ||
| 670 | se->c_dfp = c_dfp; | ||
| 671 | se->w_idfp = w_idfp; | ||
| 672 | se->c_idfp = c_idfp; | ||
| 673 | se->found =0; | ||
| 674 | se->foundexact = 0; | ||
| 675 | se->found_len = 0; | ||
| 676 | se->exclude = 0; | ||
| 677 | *pathtail = se; | ||
| 678 | } | ||
| 679 | |||
| 680 | /* Remember the default values */ | ||
| 681 | if(path_select_exclude_others == 1) { | ||
| 682 | dw_df = w_df; | ||
| 683 | dc_df = c_df; | ||
| 684 | dw_dfp = w_dfp; | ||
| 685 | dc_dfp = c_dfp; | ||
| 686 | dw_idfp = w_idfp; | ||
| 687 | dc_idfp = c_idfp; | ||
| 688 | } | ||
| 689 | |||
| 690 | if (path_select_list) { | ||
| 691 | temp_list = path_select_list; | ||
| 692 | stat_buf = malloc(sizeof *stat_buf); | ||
| 693 | while (temp_list) { | ||
| 694 | /* Stat each entry to check that dir exists */ | ||
| 695 | if (stat (temp_list->name, &stat_buf[0])) { | ||
| 696 | printf("DISK %s - ", _("CRITICAL")); | ||
| 697 | die (STATE_CRITICAL, _("%s does not exist\n"), temp_list->name); | ||
| 698 | } | ||
| 699 | if (validate_arguments (temp_list->w_df, | ||
| 700 | temp_list->c_df, | ||
| 701 | temp_list->w_dfp, | ||
| 702 | temp_list->c_dfp, | ||
| 703 | temp_list->w_idfp, | ||
| 704 | temp_list->c_idfp, | ||
| 705 | temp_list->name) == ERROR) | ||
| 706 | result = ERROR; | ||
| 707 | temp_list = temp_list->name_next; | ||
| 708 | } | ||
| 709 | free(stat_buf); | ||
| 710 | return result; | ||
| 711 | } else { | ||
| 712 | return validate_arguments (w_df, c_df, w_dfp, c_dfp, w_idfp, c_idfp, NULL); | ||
| 713 | } | ||
| 714 | } | ||
| 715 | |||
| 716 | |||
| 717 | |||
| 718 | void | ||
| 719 | print_path (const char *mypath) | ||
| 720 | { | ||
| 721 | if (mypath == NULL) | ||
| 722 | printf ("\n"); | ||
| 723 | else | ||
| 724 | printf (_(" for %s\n"), mypath); | ||
| 725 | |||
| 726 | return; | ||
| 727 | } | ||
| 728 | |||
| 729 | |||
| 730 | |||
| 731 | int | ||
| 732 | validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, double iwp, double icp, char *mypath) | ||
| 733 | { | ||
| 734 | if (w < 0 && c < 0 && wp < 0.0 && cp < 0.0) { | ||
| 735 | printf (_("INPUT ERROR: No thresholds specified")); | ||
| 736 | print_path (mypath); | ||
| 737 | return ERROR; | ||
| 738 | } | ||
| 739 | else if ((wp >= 0.0 || cp >= 0.0) && | ||
| 740 | (wp < 0.0 || cp < 0.0 || wp > 100.0 || cp > 100.0 || cp > wp)) { | ||
| 741 | printf (_("\ | ||
| 742 | INPUT ERROR: C_DFP (%f) should be less than W_DFP (%.1f) and both should be between zero and 100 percent, inclusive"), | ||
| 743 | cp, wp); | ||
| 744 | print_path (mypath); | ||
| 745 | return ERROR; | ||
| 746 | } | ||
| 747 | else if ((iwp >= 0.0 || icp >= 0.0) && | ||
| 748 | (iwp < 0.0 || icp < 0.0 || iwp > 100.0 || icp > 100.0 || icp > iwp)) { | ||
| 749 | printf (_("\ | ||
| 750 | INPUT ERROR: C_IDFP (%f) should be less than W_IDFP (%.1f) and both should be between zero and 100 percent, inclusive"), | ||
| 751 | icp, iwp); | ||
| 752 | print_path (mypath); | ||
| 753 | return ERROR; | ||
| 754 | } | ||
| 755 | else if ((w > 0 || c > 0) && (w == 0 || c == 0 || c > w)) { | ||
| 756 | printf (_("\ | ||
| 757 | INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greater than zero"), | ||
| 758 | (unsigned long)c, (unsigned long)w); | ||
| 759 | print_path (mypath); | ||
| 760 | return ERROR; | ||
| 761 | } | ||
| 762 | |||
| 763 | if (units == NULL) { | ||
| 764 | units = strdup ("MB"); | ||
| 765 | mult = (uintmax_t)1024 * 1024; | ||
| 766 | } | ||
| 767 | return OK; | ||
| 768 | } | ||
| 769 | |||
| 770 | |||
| 771 | |||
| 772 | int | ||
| 773 | |||
| 774 | check_disk (double usp, uintmax_t free_disk, double uisp) | ||
| 775 | { | ||
| 776 | int result = STATE_UNKNOWN; | ||
| 777 | /* check the percent used space against thresholds */ | ||
| 778 | if (usp >= 0.0 && c_dfp >=0.0 && usp >= (100.0 - c_dfp)) | ||
| 779 | result = STATE_CRITICAL; | ||
| 780 | else if (uisp >= 0.0 && c_idfp >=0.0 && uisp >= (100.0 - c_idfp)) | ||
| 781 | result = STATE_CRITICAL; | ||
| 782 | else if (c_df > 0 && free_disk <= c_df) | ||
| 783 | result = STATE_CRITICAL; | ||
| 784 | else if (usp >= 0.0 && w_dfp >=0.0 && usp >= (100.0 - w_dfp)) | ||
| 785 | result = STATE_WARNING; | ||
| 786 | else if (uisp >= 0.0 && w_idfp >=0.0 && uisp >= (100.0 - w_idfp)) | ||
| 787 | result = STATE_WARNING; | ||
| 788 | else if (w_df > 0 && free_disk <= w_df) | ||
| 789 | result = STATE_WARNING; | ||
| 790 | else if (usp >= 0.0) | ||
| 791 | result = STATE_OK; | ||
| 792 | return result; | ||
| 793 | } | ||
| 794 | |||
| 795 | |||
| 796 | |||
| 797 | int | ||
| 798 | walk_name_list (struct name_list *list, const char *name) | ||
| 799 | { | ||
| 800 | int foundexact = FALSE, foundmatch = FALSE; | ||
| 801 | int name_len; | ||
| 802 | name_len = strlen(name); | ||
| 803 | while (list) { | ||
| 804 | int list_name_len; | ||
| 805 | list_name_len = strlen(list->name); | ||
| 806 | if ((list->exclude == 1 && name_len == list_name_len && strncmp(list->name, name, list_name_len-1) == 0) || | ||
| 807 | (list->foundexact == 0 && list->exclude == 0 && name_len < list_name_len && strncmp(list->name, name, name_len-1) == 0) || | ||
| 808 | (list->exclude == 0 && name_len == list_name_len && strncmp(list->name, name, name_len-1) == 0) || | ||
| 809 | (list->exclude == 2 && name_len >= list_name_len && strncmp(list->name, name, list_name_len-1) == 0)) { | ||
| 810 | /* Set to -1 for now to note it was a potential match. If an EXACT match is found later, | ||
| 811 | then reset this found to 0. If not, set it to 1. */ | ||
| 812 | list->found = -1; | ||
| 813 | list->found_len = name_len; | ||
| 814 | /* Grab the longest string length that is not being excluded in order to format HTML properly */ | ||
| 815 | if (name_len > longest_length && list->exclude == 0) {longest_length = name_len;} | ||
| 816 | /* if required for name_lists that have not saved w_df, etc (eg exclude lists) */ | ||
| 817 | if (list->w_df) w_df = list->w_df; | ||
| 818 | if (list->c_df) c_df = list->c_df; | ||
| 819 | if (list->w_dfp>=0.0) w_dfp = list->w_dfp; | ||
| 820 | if (list->c_dfp>=0.0) c_dfp = list->c_dfp; | ||
| 821 | if (name_len == list_name_len) { | ||
| 822 | foundexact=TRUE; | ||
| 823 | list->foundexact = TRUE; | ||
| 824 | list->found = 1; | ||
| 825 | } | ||
| 826 | foundmatch = TRUE; | ||
| 827 | } | ||
| 828 | list = list->name_next; | ||
| 829 | } | ||
| 830 | /* Traverse the list again to reset the found variable properly */ | ||
| 831 | while (list) { | ||
| 832 | if (list->found == -1 && foundexact == TRUE) list->found = 0; | ||
| 833 | if (list->found == -1 && foundexact == FALSE) list->found =1; | ||
| 834 | list = list->name_next; | ||
| 835 | printf("tried "); | ||
| 836 | } | ||
| 837 | return foundmatch; | ||
| 838 | } | ||
| 839 | |||
| 840 | |||
| 841 | |||
| 842 | void | ||
| 843 | print_help (void) | ||
| 844 | { | ||
| 845 | print_revision (progname, revision); | ||
| 846 | |||
| 847 | printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n"); | ||
| 848 | printf (COPYRIGHT, copyright, email); | ||
| 849 | |||
| 850 | printf (_("This plugin checks the amount of used disk space on a mounted file system")); | ||
| 851 | printf (_("and generates an alert if free space is less than one of the threshold values")); | ||
| 852 | |||
| 853 | printf ("\n\n"); | ||
| 854 | |||
| 855 | print_usage (); | ||
| 856 | |||
| 857 | printf (_(UT_HELP_VRSN)); | ||
| 858 | |||
| 859 | printf (" %s\n", "-w, --warning=INTEGER"); | ||
| 860 | printf (" %s\n", _("Exit with WARNING status if less than INTEGER units of disk are free")); | ||
| 861 | printf (" %s\n", "-w, --warning=PERCENT%"); | ||
| 862 | printf (" %s\n", _("Exit with WARNING status if less than PERCENT of disk space is free")); | ||
| 863 | printf (" %s\n", "-W, --iwarning=PERCENT%"); | ||
| 864 | printf (" %s\n", _("Exit with WARNING status if less than PERCENT of inode space is free")); | ||
| 865 | printf (" %s\n", "-K, --icritical=PERCENT%"); | ||
| 866 | printf (" %s\n", _("Exit with CRITICAL status if less than PERCENT of inode space is free")); | ||
| 867 | printf (" %s\n", "-c, --critical=INTEGER"); | ||
| 868 | printf (" %s\n", _("Exit with CRITICAL status if less than INTEGER units of disk are free")); | ||
| 869 | printf (" %s\n", "-c, --critical=PERCENT%"); | ||
| 870 | printf (" %s\n", _("Exit with CRITCAL status if less than PERCENT of disk space is free")); | ||
| 871 | printf (" %s\n", "-C, --clear"); | ||
| 872 | printf (" %s\n", _("Clear thresholds")); | ||
| 873 | printf (" %s\n", "-u, --units=STRING"); | ||
| 874 | printf (" %s\n", _("Choose bytes, kB, MB, GB, TB (default: MB)")); | ||
| 875 | printf (" %s\n", "-k, --kilobytes"); | ||
| 876 | printf (" %s\n", _("Same as '--units kB'")); | ||
| 877 | printf (" %s\n", "-m, --megabytes"); | ||
| 878 | printf (" %s\n", _("Same as '--units MB'")); | ||
| 879 | printf (" %s\n", "-l, --local"); | ||
| 880 | printf (" %s\n", _("Only check local filesystems")); | ||
| 881 | printf (" %s\n", "-p, --path=PATH, --partition=PARTITION"); | ||
| 882 | printf (" %s\n", _("Path or partition (may be repeated)")); | ||
| 883 | printf (" %s\n", "-x, --exclude_device=PATH <STRING>"); | ||
| 884 | printf (" %s\n", _("Ignore device (only works if -p unspecified)")); | ||
| 885 | printf (" %s\n", "-s, --exclude_path=PATH <STRING>"); | ||
| 886 | printf (" %s\n", _("Ignore device (only works if -p unspecified)")); | ||
| 887 | printf (" %s\n", _("-X, --exclude-type=TYPE <STRING>")); | ||
| 888 | printf (" %s\n", _("Ignore all filesystems of indicated type (may be repeated)")); | ||
| 889 | printf (" %s\n", "-m, --mountpoint"); | ||
| 890 | printf (" %s\n", _("Display the mountpoint instead of the partition")); | ||
| 891 | printf (" %s\n", "-e, --errors-only"); | ||
| 892 | printf (" %s\n", _("Display only devices/mountpoints with errors")); | ||
| 893 | printf (" %s\n", "-H, --html"); | ||
| 894 | printf (" %s\n", _("Output in HTML format")); | ||
| 895 | printf (" %s\n", "-U, --used"); | ||
| 896 | printf (" %s\n", _("Output percentage of space/inodes used rather than free")); | ||
| 897 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
| 898 | printf (_(UT_VERBOSE)); | ||
| 899 | printf ("\n"); | ||
| 900 | printf ("%s\n", _("Examples:")); | ||
| 901 | printf (" %s\n", "check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /"); | ||
| 902 | printf (" %s\n", _("Checks /tmp and /var at 10% and 5%, and / at 100MB and 50MB")); | ||
| 903 | printf (" %s\n", "check_disk -w 10% -c 5% -a -C -w 5% -c 3% -p /"); | ||
| 904 | printf (" %s\n", _("Checks / at 5% and 3% and every other mount at 10% and 5%")); | ||
| 905 | printf (_(UT_SUPPORT)); | ||
| 906 | } | ||
| 907 | |||
| 908 | |||
| 909 | |||
| 910 | void | ||
| 911 | print_usage (void) | ||
| 912 | { | ||
| 913 | printf (_("Usage:")); | ||
| 914 | printf (" %s -w limit -c limit [-a | -p path | -x device | -s path] [-t timeout]", progname); | ||
| 915 | printf ("[-m] [-e] [-W limit] [-K limit] [-H] [-U] [-v] [-q]\n"); | ||
| 916 | } | ||
diff --git a/web/attachments/180341-nagios-plugins-1.4.3.ping_source_address.patch b/web/attachments/180341-nagios-plugins-1.4.3.ping_source_address.patch new file mode 100644 index 0000000..1560a41 --- /dev/null +++ b/web/attachments/180341-nagios-plugins-1.4.3.ping_source_address.patch | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | diff -uNr nagios-plugins-1.4.3.old/plugins/check_ping.c nagios-plugins-1.4.3/plugins/check_ping.c | ||
| 2 | --- nagios-plugins-1.4.3.old/plugins/check_ping.c 2006-03-13 06:08:28.000000000 -0500 | ||
| 3 | +++ nagios-plugins-1.4.3/plugins/check_ping.c 2006-05-19 11:33:42.000000000 -0400 | ||
| 4 | @@ -50,6 +50,7 @@ | ||
| 5 | float wrta = UNKNOWN_TRIP_TIME; | ||
| 6 | float crta = UNKNOWN_TRIP_TIME; | ||
| 7 | char **addresses = NULL; | ||
| 8 | +char *source_address; | ||
| 9 | int n_addresses = 0; | ||
| 10 | int max_addr = 1; | ||
| 11 | int max_packets = -1; | ||
| 12 | @@ -67,6 +68,7 @@ | ||
| 13 | { | ||
| 14 | char *cmd = NULL; | ||
| 15 | char *rawcmd = NULL; | ||
| 16 | + char *ping_args = NULL; | ||
| 17 | int result = STATE_UNKNOWN; | ||
| 18 | int this_result = STATE_UNKNOWN; | ||
| 19 | int i; | ||
| 20 | @@ -101,15 +103,28 @@ | ||
| 21 | rawcmd = strdup(PING_COMMAND); | ||
| 22 | #endif | ||
| 23 | |||
| 24 | + ping_args = strdup(""); | ||
| 25 | + | ||
| 26 | + /* Need to check ping -I in configure and enclose this in ifdef */ | ||
| 27 | + if (source_address != NULL) { | ||
| 28 | + ping_args = realloc (ping_args, 20 * sizeof(char)); | ||
| 29 | + ping_args = strcat(ping_args, "-I "); | ||
| 30 | + ping_args = strncat(ping_args, source_address, 15 * sizeof(char)); | ||
| 31 | + ping_args = strcat(ping_args, " "); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + ping_args = realloc (ping_args, strlen(ping_args) + strlen(addresses[i]) + 1); | ||
| 35 | + ping_args = strcat(ping_args, addresses[i]); | ||
| 36 | + | ||
| 37 | /* does the host address of number of packets argument come first? */ | ||
| 38 | #ifdef PING_PACKETS_FIRST | ||
| 39 | # ifdef PING_HAS_TIMEOUT | ||
| 40 | - asprintf (&cmd, rawcmd, timeout_interval, max_packets, addresses[i]); | ||
| 41 | + asprintf (&cmd, rawcmd, timeout_interval, max_packets, ping_args); | ||
| 42 | # else | ||
| 43 | - asprintf (&cmd, rawcmd, max_packets, addresses[i]); | ||
| 44 | + asprintf (&cmd, rawcmd, max_packets, ping_args); | ||
| 45 | # endif | ||
| 46 | #else | ||
| 47 | - asprintf (&cmd, rawcmd, addresses[i], max_packets); | ||
| 48 | + asprintf (&cmd, rawcmd, ping_args, max_packets); | ||
| 49 | #endif | ||
| 50 | |||
| 51 | if (verbose >= 2) | ||
| 52 | @@ -150,6 +165,7 @@ | ||
| 53 | printf ("%f:%d%% %f:%d%%\n", wrta, wpl, crta, cpl); | ||
| 54 | |||
| 55 | result = max_state (result, this_result); | ||
| 56 | + free (ping_args); | ||
| 57 | free (rawcmd); | ||
| 58 | free (cmd); | ||
| 59 | } | ||
| 60 | @@ -170,6 +186,7 @@ | ||
| 61 | static struct option longopts[] = { | ||
| 62 | STD_LONG_OPTS, | ||
| 63 | {"packets", required_argument, 0, 'p'}, | ||
| 64 | + {"source", required_argument, 0, 's'}, | ||
| 65 | {"nohtml", no_argument, 0, 'n'}, | ||
| 66 | {"link", no_argument, 0, 'L'}, | ||
| 67 | {"use-ipv4", no_argument, 0, '4'}, | ||
| 68 | @@ -188,7 +205,7 @@ | ||
| 69 | } | ||
| 70 | |||
| 71 | while (1) { | ||
| 72 | - c = getopt_long (argc, argv, "VvhnL46t:c:w:H:p:", longopts, &option); | ||
| 73 | + c = getopt_long (argc, argv, "VvhnL46t:c:w:H:p:s:", longopts, &option); | ||
| 74 | |||
| 75 | if (c == -1 || c == EOF) | ||
| 76 | break; | ||
| 77 | @@ -245,6 +262,9 @@ | ||
| 78 | else | ||
| 79 | usage2 (_("<max_packets> (%s) must be a non-negative number\n"), optarg); | ||
| 80 | break; | ||
| 81 | + case 's': /* number of packets to send */ | ||
| 82 | + source_address = strdup (optarg); | ||
| 83 | + break; | ||
| 84 | case 'n': /* no HTML */ | ||
| 85 | display_html = FALSE; | ||
| 86 | break; | ||
| 87 | @@ -396,6 +416,11 @@ | ||
| 88 | usage (_("You must specify a server address or host name")); | ||
| 89 | } | ||
| 90 | |||
| 91 | + if (source_address != NULL) { | ||
| 92 | + if (is_addr(source_address) == FALSE) | ||
| 93 | + usage2 (_("Invalid source address"), source_address); | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | return OK; | ||
| 97 | } | ||
| 98 | |||
| 99 | @@ -535,6 +560,8 @@ | ||
| 100 | critical threshold pair\n\ | ||
| 101 | -p, --packets=INTEGER\n\ | ||
| 102 | number of ICMP ECHO packets to send (Default: %d)\n\ | ||
| 103 | +-s, --source=IP\n\ | ||
| 104 | + source address\n\ | ||
| 105 | -L, --link\n\ | ||
| 106 | show HTML in the plugin output (obsoleted by urlize)\n"), | ||
| 107 | DEFAULT_MAX_PACKETS); | ||
| 108 | @@ -559,5 +586,5 @@ | ||
| 109 | print_usage (void) | ||
| 110 | { | ||
| 111 | printf ("Usage: %s -H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n\ | ||
| 112 | - [-p packets] [-t timeout] [-L] [-4|-6]\n", progname); | ||
| 113 | + [-p packets] [-s source_address] [-t timeout] [-L] [-4|-6]\n", progname); | ||
| 114 | } | ||
diff --git a/web/attachments/180350-check_rsync b/web/attachments/180350-check_rsync new file mode 100644 index 0000000..b65a2fd --- /dev/null +++ b/web/attachments/180350-check_rsync | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-2 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378821899" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378821899" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378821899" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378821899" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378821899'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1499684&group_id=29880&atid=397599&file_id=180350" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/181129-check_rsync b/web/attachments/181129-check_rsync new file mode 100644 index 0000000..e7537ee --- /dev/null +++ b/web/attachments/181129-check_rsync | |||
| @@ -0,0 +1,146 @@ | |||
| 1 | #! /usr/bin/perl -w | ||
| 2 | # | ||
| 3 | # check_rsync - Check Rsync and modules availability | ||
| 4 | # | ||
| 5 | # Copyright (C) 2006 Thomas Guyot-Sionnest <tguyot@gmail.com> | ||
| 6 | # | ||
| 7 | # This program is free software; you can redistribute it and/or | ||
| 8 | # modify it under the terms of the GNU General Public License | ||
| 9 | # as published by the Free Software Foundation; either version 2 | ||
| 10 | # of the License, or (at your option) any later version. | ||
| 11 | # | ||
| 12 | # This program is distributed in the hope that it will be useful, | ||
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | # GNU General Public License for more details. | ||
| 16 | # | ||
| 17 | # You should have received a copy of the GNU General Public License | ||
| 18 | # along with this program; if not, write to the Free Software | ||
| 19 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 20 | # | ||
| 21 | |||
| 22 | use POSIX; | ||
| 23 | use strict; | ||
| 24 | use Getopt::Long; | ||
| 25 | |||
| 26 | # Make sure this module is installed or IPC::Cmd::run won't work as expected. | ||
| 27 | require IPC::Run; | ||
| 28 | |||
| 29 | use IPC::Cmd qw[run]; | ||
| 30 | use vars qw($opt_H $opt_p $opt_m); | ||
| 31 | use vars qw($PROGNAME); | ||
| 32 | use lib "/usr/local/nagios/libexec"; | ||
| 33 | use utils qw($TIMEOUT %ERRORS); | ||
| 34 | |||
| 35 | $PROGNAME = "check_rsync"; | ||
| 36 | $ENV{'PATH'}=''; | ||
| 37 | $ENV{'BASH_ENV'}=''; | ||
| 38 | $ENV{'ENV'}=''; | ||
| 39 | |||
| 40 | Getopt::Long::Configure('bundling'); | ||
| 41 | GetOptions ( | ||
| 42 | "H=s" => \$opt_H, "hostname=s" => \$opt_H, | ||
| 43 | "p=s" => \$opt_p, "port=s" => \$opt_p, | ||
| 44 | "m=s@" => \$opt_m, "module=s@" => \$opt_m ); | ||
| 45 | |||
| 46 | unless (defined($opt_H)){ | ||
| 47 | print "Usage: $PROGNAME -H <host> [-p <port>] [-m <module>[,<user>,<password>] [-m <module>[,<user>,<password>]...]]\n"; | ||
| 48 | exit $ERRORS{'UNKNOWN'}; | ||
| 49 | } | ||
| 50 | |||
| 51 | my $host = $opt_H; | ||
| 52 | my $port = defined($opt_p) ? $opt_p : 873; | ||
| 53 | |||
| 54 | # Create an array for each -m arguments and store them in @modules | ||
| 55 | my @modules; | ||
| 56 | if (defined($opt_m)) { | ||
| 57 | for(@$opt_m) { | ||
| 58 | push @modules, [ split(/,/) ]; | ||
| 59 | } | ||
| 60 | } | ||
| 61 | |||
| 62 | # Just in case of problems, let's not hang Nagios | ||
| 63 | $SIG{'ALRM'} = sub { | ||
| 64 | print "CRITICAL: Rsync timed out\n"; | ||
| 65 | exit $ERRORS{"CRITICAL"}; | ||
| 66 | }; | ||
| 67 | |||
| 68 | # Rsync arguments | ||
| 69 | my $source = "rsync://$host"; | ||
| 70 | |||
| 71 | alarm($TIMEOUT); | ||
| 72 | |||
| 73 | # Get a list of modules to see if rsync is up | ||
| 74 | my $command = "/usr/bin/rsync --port=$port $source"; | ||
| 75 | my (undef, $error_code, undef, $stdout_buf, $stderr_buf ) = | ||
| 76 | run( command => $command, verbose => 0 ); | ||
| 77 | |||
| 78 | #Turn off alarm | ||
| 79 | alarm(0); | ||
| 80 | |||
| 81 | my $realerr = $error_code >> 8; | ||
| 82 | report_error("Rsync command $command failed with error " . $realerr) if ($realerr != 0); | ||
| 83 | |||
| 84 | # If one or more -m, check if these modules exists first... | ||
| 85 | if (@modules) { | ||
| 86 | |||
| 87 | # IPC::Run have the bad habbit of randomly concatenating multiple lines | ||
| 88 | # in the same array element. | ||
| 89 | my @result; | ||
| 90 | for (@$stdout_buf) { | ||
| 91 | push(@result, split(/\n/)); | ||
| 92 | } | ||
| 93 | |||
| 94 | foreach my $mod (@modules) { | ||
| 95 | my $match = 0; | ||
| 96 | for (@result) { | ||
| 97 | $match = 1 if (/^$$mod[0]\s/); | ||
| 98 | } | ||
| 99 | report_error("Module $$mod[0] not found") if ($match == 0); | ||
| 100 | } | ||
| 101 | } else { # else just return OK | ||
| 102 | print "OK: Rsync is up\n"; | ||
| 103 | exit $ERRORS{'OK'}; | ||
| 104 | } | ||
| 105 | |||
| 106 | # Check each -m aruments... | ||
| 107 | for my $arg (@modules) { | ||
| 108 | if (defined($$arg[1]) and defined($$arg[2])) { | ||
| 109 | $source = "rsync://$$arg[1]" . '@' . "$host/$$arg[0]"; | ||
| 110 | $ENV{'RSYNC_PASSWORD'} = $$arg[2]; | ||
| 111 | } else { | ||
| 112 | $source = "rsync://$host/$$arg[0]"; | ||
| 113 | } | ||
| 114 | |||
| 115 | alarm($TIMEOUT); | ||
| 116 | |||
| 117 | # Get a file listing of the root of the module | ||
| 118 | undef $error_code; # Better safe than sorry... | ||
| 119 | $command = "/usr/bin/rsync --port=$port $source"; | ||
| 120 | (undef, $error_code, undef, $stdout_buf, $stderr_buf ) = | ||
| 121 | run( command => $command, verbose => 0 ); | ||
| 122 | |||
| 123 | #Turn off alarm | ||
| 124 | alarm(0); | ||
| 125 | |||
| 126 | $realerr = $error_code >> 8; | ||
| 127 | report_error("Rsync command failed on module $$arg[0] with error " . $realerr) if ($realerr != 0); | ||
| 128 | } | ||
| 129 | |||
| 130 | if (@modules > 0) { | ||
| 131 | print "OK: Rsync is up with ", scalar(@modules), " module tested\n" if (@modules == 1); | ||
| 132 | print "OK: Rsync is up with ", scalar(@modules), " modules tested\n" if (@modules > 1); | ||
| 133 | exit $ERRORS{'OK'}; | ||
| 134 | } else { # We hould never end up here :) | ||
| 135 | print "UNKNOWN: The unexpected occured (bug?)\n"; | ||
| 136 | exit $ERRORS{'UNKNOWN'}; | ||
| 137 | } | ||
| 138 | |||
| 139 | # Report error passed as one string, print rsync messages to STDERR | ||
| 140 | sub report_error { | ||
| 141 | my $report = shift; | ||
| 142 | print "CRITICAL: $report\n"; | ||
| 143 | print STDERR @$stderr_buf; | ||
| 144 | exit $ERRORS{'CRITICAL'}; | ||
| 145 | } | ||
| 146 | |||
diff --git a/web/attachments/182402-check_mysql.c b/web/attachments/182402-check_mysql.c new file mode 100644 index 0000000..5ef37d1 --- /dev/null +++ b/web/attachments/182402-check_mysql.c | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | /***************************************************************** | ||
| 2 | * | ||
| 3 | * Program: check_mysql.c | ||
| 4 | * License: GPL | ||
| 5 | * | ||
| 6 | * Written by Tim Weippert | ||
| 7 | * (based on plugins by Ethan Galstad and MySQL example code) | ||
| 8 | * | ||
| 9 | * Adapted by J. Javier Sianes - skyo@rotxa.org | ||
| 10 | * | ||
| 11 | * | ||
| 12 | * Command line: check_mysql <host> [user] [passwd] [db] [port] | ||
| 13 | * <host> can be the FQDN or the IP-Adress | ||
| 14 | * [user], [passwd], [db] and [port] are optional | ||
| 15 | * | ||
| 16 | * Description: | ||
| 17 | * | ||
| 18 | * This plugin attempts to connect to an MySQL Server | ||
| 19 | * with the optional specified parameters user, passwd and db. | ||
| 20 | * Normaly the host and a user HAVE to assigned. | ||
| 21 | * | ||
| 22 | * The plugin returns | ||
| 23 | * STATE_OK and the Version Number of the Server when all is fine | ||
| 24 | * STATE_CRITICAL if the Connection can't be esablished | ||
| 25 | * STATE_WARNING if the connection was established but the | ||
| 26 | * program can't get the Versoin Number | ||
| 27 | * STATE_UNKNOWN if to many parameters are given | ||
| 28 | * | ||
| 29 | * Copyright (c) 1999 by Tim Weippert | ||
| 30 | * | ||
| 31 | * Changes: | ||
| 32 | * 16.12.1999: Changed the return codes from numbers to statements | ||
| 33 | * 20.06.2006: Included new db and port parameters | ||
| 34 | * 20.06.2006: Adapted for using new MySQL5 API | ||
| 35 | * | ||
| 36 | *******************************************************************/ | ||
| 37 | |||
| 38 | /***************************************************************** | ||
| 39 | * | ||
| 40 | * Note that all includes are related to Nagios and MySQL default installation. | ||
| 41 | * If you have installed them on a different location, you may change | ||
| 42 | * the following include lines in order to make it works. | ||
| 43 | * | ||
| 44 | * To compile the agent, in a shell use the following command, for example: | ||
| 45 | * | ||
| 46 | * gcc -lmysqlclient -o check_mysql check_mysql.c | ||
| 47 | * | ||
| 48 | *******************************************************************/ | ||
| 49 | |||
| 50 | #include <stdio.h> | ||
| 51 | #include <stdlib.h> | ||
| 52 | #include "/usr/include/nagios/config.h" | ||
| 53 | #include "/usr/include/nagios/common.h" | ||
| 54 | #include "/usr/include/nagios/nagios.h" | ||
| 55 | #include "/usr/include/mysql/mysql.h" | ||
| 56 | |||
| 57 | MYSQL mysql; | ||
| 58 | |||
| 59 | int main(int argc, char **argv) | ||
| 60 | { | ||
| 61 | uint i = 0; | ||
| 62 | int mport; | ||
| 63 | char *host; | ||
| 64 | char *user; | ||
| 65 | char *passwd; | ||
| 66 | char *db; | ||
| 67 | |||
| 68 | char *status; | ||
| 69 | char *version; | ||
| 70 | |||
| 71 | if ( ( argc > 6 ) || ( argc < 2 ) ) { | ||
| 72 | printf("Incorrect number of arguments supplied - %i .\n", argc); | ||
| 73 | printf("Usage: %s <host> [user] [passwd] [db] [port]\n", argv[0]); | ||
| 74 | return STATE_UNKNOWN; | ||
| 75 | } | ||
| 76 | |||
| 77 | (host = argv[1]) || (host = NULL); | ||
| 78 | (user = argv[2]) || (user = NULL); | ||
| 79 | (passwd = argv[3]) || (passwd = NULL); | ||
| 80 | (db = argv[4]) || (db = "mysql"); | ||
| 81 | if (argc==6) { mport = atoi(argv[5]); } else { mport = 3306; } | ||
| 82 | |||
| 83 | mysql_init(&mysql); | ||
| 84 | mysql_options(&mysql,MYSQL_READ_DEFAULT_GROUP,"check_mysql"); | ||
| 85 | |||
| 86 | if (!mysql_real_connect(&mysql,host,user,passwd,db,(unsigned int)mport,NULL,0)) { | ||
| 87 | printf("Connect ERROR, Failed to connect to database '%s': %s\n",db,mysql_error(&mysql)); | ||
| 88 | return STATE_CRITICAL; | ||
| 89 | } | ||
| 90 | |||
| 91 | if ( !(version = mysql_get_server_info(&mysql)) ) { | ||
| 92 | printf("Connect OK, but can't get Serverinfo ... something wrong !\n"); | ||
| 93 | return STATE_WARNING; | ||
| 94 | } | ||
| 95 | |||
| 96 | printf("MYSQL OK - Running Version: %s\n", version); | ||
| 97 | |||
| 98 | mysql_close(&mysql); | ||
| 99 | return STATE_OK; | ||
| 100 | } | ||
diff --git a/web/attachments/182602-check_mailq-nullmailer.diff b/web/attachments/182602-check_mailq-nullmailer.diff new file mode 100644 index 0000000..f61486f --- /dev/null +++ b/web/attachments/182602-check_mailq-nullmailer.diff | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | --- check_mailq 2005-05-08 17:15:26.000000000 +0200 | ||
| 2 | +++ check_mailq 2006-06-22 16:29:57.000000000 +0200 | ||
| 3 | @@ -378,7 +378,7 @@ | ||
| 4 | # } | ||
| 5 | #} | ||
| 6 | } | ||
| 7 | -} # end of ($mailq eq "postfixl") | ||
| 8 | +} # end of ($mailq eq "postfix") | ||
| 9 | elsif ( $mailq eq "qmail" ) { | ||
| 10 | |||
| 11 | # open qmail-qstat | ||
| 12 | @@ -502,6 +502,43 @@ | ||
| 13 | } | ||
| 14 | } # end of ($mailq eq "exim") | ||
| 15 | |||
| 16 | +elsif ( $mailq eq "nullmailer" ) { | ||
| 17 | + ## open mailq | ||
| 18 | + if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { | ||
| 19 | + if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { | ||
| 20 | + print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; | ||
| 21 | + exit $ERRORS{'UNKNOWN'}; | ||
| 22 | + } | ||
| 23 | + }elsif( defined $utils::PATH_TO_MAILQ){ | ||
| 24 | + unless (-x $utils::PATH_TO_MAILQ) { | ||
| 25 | + print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($)))\n"; | ||
| 26 | + exit $ERRORS{'UNKNOWN'}; | ||
| 27 | + } | ||
| 28 | + } else { | ||
| 29 | + print "ERROR: \$utils::PATH_TO_MAILQ is not defined\n"; | ||
| 30 | + exit $ERRORS{'UNKNOWN'}; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + while (<MAILQ>) { | ||
| 34 | + #2006-06-22 16:00:00 282 bytes | ||
| 35 | + | ||
| 36 | + if (/^[1-9][0-9]*-[01][0-9]-[0-3][0-9]\s[0-2][0-9]\:[0-2][0-9]\:[0-2][0-9]\s{2}[0-9]+\sbytes$/) { | ||
| 37 | + $msg_q++ ; | ||
| 38 | + } | ||
| 39 | + } | ||
| 40 | + close(MAILQ) ; | ||
| 41 | + if ($msg_q < $opt_w) { | ||
| 42 | + $msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)"; | ||
| 43 | + $state = $ERRORS{'OK'}; | ||
| 44 | + }elsif ($msg_q >= $opt_w && $msg_q < $opt_c) { | ||
| 45 | + $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)"; | ||
| 46 | + $state = $ERRORS{'WARNING'}; | ||
| 47 | + }else { | ||
| 48 | + $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)"; | ||
| 49 | + $state = $ERRORS{'CRITICAL'}; | ||
| 50 | + } | ||
| 51 | +} # end of ($mailq eq "nullmailer") | ||
| 52 | + | ||
| 53 | # Perfdata support | ||
| 54 | print "$msg|unsent=$msg_q;$opt_w;$opt_c;0\n"; | ||
| 55 | exit $state; | ||
| 56 | @@ -561,7 +598,7 @@ | ||
| 57 | } | ||
| 58 | |||
| 59 | if (defined $opt_M) { | ||
| 60 | - if ($opt_M =~ /^(sendmail|qmail|postfix|exim)$/) { | ||
| 61 | + if ($opt_M =~ /^(sendmail|qmail|postfix|exim|nullmailer)$/) { | ||
| 62 | $mailq = $opt_M ; | ||
| 63 | }elsif( $opt_M eq ''){ | ||
| 64 | $mailq = 'sendmail'; | ||
| 65 | @@ -593,7 +630,7 @@ | ||
| 66 | print "-W (--Warning) = Min. number of messages for same domain in queue to generate warning\n"; | ||
| 67 | print "-C (--Critical) = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n"; | ||
| 68 | print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n"; | ||
| 69 | - print "-M (--mailserver) = [ sendmail | qmail | postfix | exim ] (default = sendmail)\n"; | ||
| 70 | + print "-M (--mailserver) = [ sendmail | qmail | postfix | exim | nullmailer ] (default = sendmail)\n"; | ||
| 71 | print "-h (--help)\n"; | ||
| 72 | print "-V (--version)\n"; | ||
| 73 | print "-v (--verbose) = debugging output\n"; | ||
diff --git a/web/attachments/183551-partfix.tar b/web/attachments/183551-partfix.tar new file mode 100644 index 0000000..3e7d632 --- /dev/null +++ b/web/attachments/183551-partfix.tar | |||
| Binary files differ | |||
diff --git a/web/attachments/183681-check_pgsql.c b/web/attachments/183681-check_pgsql.c new file mode 100644 index 0000000..eeee495 --- /dev/null +++ b/web/attachments/183681-check_pgsql.c | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-7 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378821686" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378821686" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378821686" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378821686" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378821686'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1516150&group_id=29880&atid=397600&file_id=183681" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/183682-pgslq.png b/web/attachments/183682-pgslq.png new file mode 100644 index 0000000..81995b1 --- /dev/null +++ b/web/attachments/183682-pgslq.png | |||
| Binary files differ | |||
diff --git a/web/attachments/183683-check_pgsql.c b/web/attachments/183683-check_pgsql.c new file mode 100644 index 0000000..0879cf6 --- /dev/null +++ b/web/attachments/183683-check_pgsql.c | |||
| @@ -0,0 +1,164 @@ | |||
| 1 | /***************************************************************** | ||
| 2 | * | ||
| 3 | * Program: check_pgsql.c | ||
| 4 | * License: GPL | ||
| 5 | * | ||
| 6 | * Written by J. Javier Sianes - skyo@rotxa.org | ||
| 7 | * Based on MySQL check program written by Tim Weippert | ||
| 8 | * | ||
| 9 | * Command line: check_pgsql <host> user passwd [db] [port] | ||
| 10 | * <host> can be the FQDN or the IP-Adress | ||
| 11 | * [db] and [port] are optional | ||
| 12 | * | ||
| 13 | * Description: | ||
| 14 | * | ||
| 15 | * This plugin attempts to connect to an PostgreSQL Server | ||
| 16 | * with the optional specified parameters db and port. | ||
| 17 | * | ||
| 18 | * The plugin returns | ||
| 19 | * STATE_OK and the Version Number of the Server when all is fine | ||
| 20 | * STATE_CRITICAL if the Connection can't be esablished | ||
| 21 | * STATE_WARNING if the connection was established but the | ||
| 22 | * program can't get the Versoin Number | ||
| 23 | * STATE_UNKNOWN if to many parameters are given | ||
| 24 | * | ||
| 25 | * Copyright (c) 2006 by J. Javier Sianes | ||
| 26 | * | ||
| 27 | *******************************************************************/ | ||
| 28 | |||
| 29 | /***************************************************************** | ||
| 30 | * | ||
| 31 | * Note that all includes are related to Nagios and PostgreSQL default installation. | ||
| 32 | * If you have installed them on a different location, you may change | ||
| 33 | * the following include lines in order to make it works. | ||
| 34 | * | ||
| 35 | * To compile the agent, in a shell use the following command, for example: | ||
| 36 | * | ||
| 37 | * gcc -lpq -o check_pgsql check_pgsql.c | ||
| 38 | * | ||
| 39 | *******************************************************************/ | ||
| 40 | |||
| 41 | #include <stdio.h> | ||
| 42 | #include <stdlib.h> | ||
| 43 | #include "/usr/include/nagios/config.h" | ||
| 44 | #include "/usr/include/nagios/common.h" | ||
| 45 | #include "/usr/include/nagios/nagios.h" | ||
| 46 | #include "/usr/include/libpq-fe.h" | ||
| 47 | #define TAM_BLK 1024 | ||
| 48 | |||
| 49 | PGconn *ConexionPG=NULL; | ||
| 50 | |||
| 51 | char *PGVersion(int version) { | ||
| 52 | int i=0,j=0,k=0,len,par=1,cont=0; | ||
| 53 | char *cad=NULL,*res=NULL,num[3]; | ||
| 54 | |||
| 55 | cad=(char *)malloc(TAM_BLK*sizeof(char)); | ||
| 56 | res=(char *)malloc(TAM_BLK*sizeof(char)); | ||
| 57 | if ((cad==NULL)||(res==NULL)){ | ||
| 58 | free(cad); | ||
| 59 | free(res); | ||
| 60 | return NULL; | ||
| 61 | } | ||
| 62 | |||
| 63 | for (k=0;k<TAM_BLK;k++) { cad[k]='\0'; res[k]='\0'; } | ||
| 64 | for (k=0;k<3;k++) { num[k]='\0'; } | ||
| 65 | |||
| 66 | sprintf(cad,"%d",version); | ||
| 67 | len=strlen(cad); | ||
| 68 | if (len%2!=0) { par=0; } | ||
| 69 | |||
| 70 | for (i=0;i<len;i++) { | ||
| 71 | if (cont==2) { | ||
| 72 | cont=0; | ||
| 73 | if (num[1]=='0') { | ||
| 74 | res[j++]=num[0]; | ||
| 75 | res[j++]='.'; | ||
| 76 | } else { | ||
| 77 | res[j++]=num[0]; | ||
| 78 | res[j++]=num[1]; | ||
| 79 | res[j++]='.'; | ||
| 80 | } | ||
| 81 | for (k=0;k<3;k++) { num[k]='\0'; } | ||
| 82 | } | ||
| 83 | |||
| 84 | num[cont]=cad[i]; | ||
| 85 | |||
| 86 | if (i==(len-1)) { | ||
| 87 | if (par) { | ||
| 88 | res[j++]=num[0]; | ||
| 89 | res[j++]=num[1]; | ||
| 90 | } else { | ||
| 91 | res[j++]=num[0]; | ||
| 92 | } | ||
| 93 | } | ||
| 94 | |||
| 95 | cont++; | ||
| 96 | } | ||
| 97 | |||
| 98 | free(cad); | ||
| 99 | return res; | ||
| 100 | } | ||
| 101 | |||
| 102 | int main(int argc, char **argv) | ||
| 103 | { | ||
| 104 | uint i = 0; | ||
| 105 | int version,mport; | ||
| 106 | char *host; | ||
| 107 | char *user; | ||
| 108 | char *passwd; | ||
| 109 | char *db; | ||
| 110 | char *PgConnectChain=NULL; | ||
| 111 | char *cversion=NULL; | ||
| 112 | |||
| 113 | PgConnectChain=(char *)malloc(TAM_BLK*sizeof(char)); | ||
| 114 | |||
| 115 | if (PgConnectChain==NULL) { | ||
| 116 | printf("PGSQL UNKNOWN - Not enough memory to allocate data !"); | ||
| 117 | return STATE_UNKNOWN; | ||
| 118 | } | ||
| 119 | |||
| 120 | if ( ( argc > 6 ) || ( argc < 4 ) ) { | ||
| 121 | printf("Incorrect number of arguments supplied - %i .\n", argc); | ||
| 122 | printf("Usage: %s <host> user passwd [db] [port]\n", argv[0]); | ||
| 123 | free(PgConnectChain); | ||
| 124 | return STATE_UNKNOWN; | ||
| 125 | } | ||
| 126 | |||
| 127 | host = argv[1]; | ||
| 128 | user = argv[2]; | ||
| 129 | passwd = argv[3]; | ||
| 130 | (db = argv[4]) || (db = "postgres"); | ||
| 131 | if (argc==6) { mport = atoi(argv[5]); } else { mport = 5432; } | ||
| 132 | |||
| 133 | sprintf(PgConnectChain, "host=%s port=%d dbname=%s user=%s password=%s",host,mport,db,user,passwd); | ||
| 134 | ConexionPG=PQconnectdb(PgConnectChain); | ||
| 135 | |||
| 136 | if (PQstatus(ConexionPG) != CONNECTION_OK) | ||
| 137 | { | ||
| 138 | printf("PGSQL ERROR - Connection to database '%s' failed: %s",db,PQerrorMessage(ConexionPG)); | ||
| 139 | free(PgConnectChain); | ||
| 140 | PQfinish(ConexionPG); | ||
| 141 | return STATE_CRITICAL; | ||
| 142 | } | ||
| 143 | |||
| 144 | version=PQserverVersion(ConexionPG); | ||
| 145 | if (version > 0 ) { | ||
| 146 | cversion=PGVersion(version); | ||
| 147 | if (cversion==NULL) { | ||
| 148 | printf("PGSQL UNKNOWN - Not enough memory to allocate data !"); | ||
| 149 | free(PgConnectChain); | ||
| 150 | PQfinish(ConexionPG); | ||
| 151 | return STATE_UNKNOWN; | ||
| 152 | } | ||
| 153 | printf("PGSQL OK - Running Version: postmaster (PostgreSQL) %s\n",cversion); | ||
| 154 | } else { | ||
| 155 | printf("Connect OK, but can't get Serverinfo ... something wrong !\n"); | ||
| 156 | free(PgConnectChain); | ||
| 157 | PQfinish(ConexionPG); | ||
| 158 | return STATE_WARNING; | ||
| 159 | } | ||
| 160 | |||
| 161 | free(PgConnectChain); | ||
| 162 | PQfinish(ConexionPG); | ||
| 163 | return STATE_OK; | ||
| 164 | } | ||
diff --git a/web/attachments/184991-autoconf-fix.patch b/web/attachments/184991-autoconf-fix.patch new file mode 100644 index 0000000..34f65c7 --- /dev/null +++ b/web/attachments/184991-autoconf-fix.patch | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | --- configure.in.old 2006-07-15 00:01:50.000000000 -0500 | ||
| 2 | +++ configure.in 2006-07-15 00:02:18.000000000 -0500 | ||
| 3 | @@ -1639,7 +1639,9 @@ | ||
| 4 | #endif], | ||
| 5 | [va_list args;], | ||
| 6 | [AC_MSG_RESULT(yes)], | ||
| 7 | - [NEED_VA_LIST=-DNEED_VA_LIST AC_SUBST(NEED_VA_LIST) AC_MSG_RESULT(no)]) | ||
| 8 | + [NEED_VA_LIST=-DNEED_VA_LIST | ||
| 9 | + AC_SUBST(NEED_VA_LIST) | ||
| 10 | + AC_MSG_RESULT(no)]) | ||
| 11 | |||
| 12 | case $host in | ||
| 13 | *bsd*) | ||
diff --git a/web/attachments/186091-check_mem.pl.patch b/web/attachments/186091-check_mem.pl.patch new file mode 100644 index 0000000..9eaec75 --- /dev/null +++ b/web/attachments/186091-check_mem.pl.patch | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | *** check_mem.pl 2006-05-24 15:47:09.000000000 -0700 | ||
| 2 | --- modified_check_mem.pl 2006-07-24 13:58:06.000000000 -0700 | ||
| 3 | *************** | ||
| 4 | *** 46,51 **** | ||
| 5 | |||
| 6 | # Define the calculating scalars | ||
| 7 | ! $used_memory = $memlist[0]; | ||
| 8 | ! $free_memory = $memlist[1]; | ||
| 9 | $total_memory = $used_memory + $free_memory; | ||
| 10 | |||
| 11 | --- 46,51 ---- | ||
| 12 | |||
| 13 | # Define the calculating scalars | ||
| 14 | ! $used_memory = $memlist[1]; | ||
| 15 | ! $free_memory = $memlist[0]; | ||
| 16 | $total_memory = $used_memory + $free_memory; | ||
| 17 | |||
diff --git a/web/attachments/187009-check_disk.diff b/web/attachments/187009-check_disk.diff new file mode 100644 index 0000000..bc98702 --- /dev/null +++ b/web/attachments/187009-check_disk.diff | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | 60a61,63 | ||
| 2 | > /* If nonzero, display percents as % of space used rather than free */ | ||
| 3 | > static int show_used_pct = 0; | ||
| 4 | > | ||
| 5 | 160c163 | ||
| 6 | < double dused_inodes_percent; | ||
| 7 | --- | ||
| 8 | > double dused_inodes_percent, dfree_inodes_percent; | ||
| 9 | 249a253 | ||
| 10 | > dfree_inodes_percent = 100 - dused_inodes_percent; | ||
| 11 | 278,286d281 | ||
| 12 | < | ||
| 13 | < | ||
| 14 | < | ||
| 15 | < | ||
| 16 | < /* Moved this computation up here so we can add it | ||
| 17 | < * to perf */ | ||
| 18 | < inode_space_pct = (1 - dused_inodes_percent) * 100; | ||
| 19 | < | ||
| 20 | < | ||
| 21 | 304c299 | ||
| 22 | < dfree_pct); | ||
| 23 | --- | ||
| 24 | > (show_used_pct ? dused_pct : dfree_pct)); | ||
| 25 | 308c303 | ||
| 26 | < asprintf(&output, "%s inode=%.0f%%);", output, (1 - dused_inodes_percent) * 100); | ||
| 27 | --- | ||
| 28 | > asprintf(&output, "%s inode=%.0f%%);", output, (show_used_pct ? dused_inodes_percent : dfree_inodes_percent) ); | ||
| 29 | 385a381 | ||
| 30 | > {"used", no_argument, 0, 'f'}, | ||
| 31 | 404c400 | ||
| 32 | < c = getopt_long (argc, argv, "+?VqhveCt:c:w:K:W:u:p:x:X:mklME", longopts, &option); | ||
| 33 | --- | ||
| 34 | > c = getopt_long (argc, argv, "+?VqhveCt:c:w:K:W:u:p:x:X:mklMEU", longopts, &option); | ||
| 35 | 548a545,547 | ||
| 36 | > case 'U': /* Display output percentage as % free */ | ||
| 37 | > show_used_pct = 1; | ||
| 38 | > break; | ||
| 39 | 720a720,721 | ||
| 40 | > printf (" %s\n", "-U --used"); | ||
| 41 | > printf (" %s\n", _("Display output percentage as % free")); | ||
| 42 | 737c738 | ||
| 43 | < printf ("[-m] [-e] [-W limit] [-K limit] [-v] [-q] [-E]\n"); | ||
| 44 | --- | ||
| 45 | > printf ("[-m] [-e] [-W limit] [-K limit] [-v] [-q] [-E] [-U]\n"); | ||
diff --git a/web/attachments/190509-check_disk.patch b/web/attachments/190509-check_disk.patch new file mode 100644 index 0000000..ba4a9ed --- /dev/null +++ b/web/attachments/190509-check_disk.patch | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | --- check_disk.c.old 2006-08-24 14:23:56.131294343 -0400 | ||
| 2 | +++ check_disk.c 2006-08-24 14:25:19.000294237 -0400 | ||
| 3 | @@ -339,6 +339,7 @@ process_arguments (int argc, char **argv | ||
| 4 | return ERROR; | ||
| 5 | |||
| 6 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 7 | + memset(se,0,sizeof(struct name_list)); | ||
| 8 | se->name = strdup ("iso9660"); | ||
| 9 | se->name_next = NULL; | ||
| 10 | se->found = 0; | ||
| 11 | @@ -456,6 +457,7 @@ process_arguments (int argc, char **argv | ||
| 12 | break; | ||
| 13 | case 'p': /* select path */ | ||
| 14 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 15 | + memset(se,0,sizeof(struct name_list)); | ||
| 16 | se->name = optarg; | ||
| 17 | se->name_next = NULL; | ||
| 18 | se->w_df = w_df; | ||
| 19 | @@ -469,6 +471,7 @@ process_arguments (int argc, char **argv | ||
| 20 | break; | ||
| 21 | case 'x': /* exclude path or partition */ | ||
| 22 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 23 | + memset(se,0,sizeof(struct name_list)); | ||
| 24 | se->name = optarg; | ||
| 25 | se->name_next = NULL; | ||
| 26 | |||
| 27 | @@ -487,6 +490,7 @@ process_arguments (int argc, char **argv | ||
| 28 | break; | ||
| 29 | case 'X': /* exclude file system type */ | ||
| 30 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 31 | + memset(se,0,sizeof(struct name_list)); | ||
| 32 | se->name = optarg; | ||
| 33 | se->name_next = NULL; | ||
| 34 | /* If you don't clear the w_fd etc values here, they | ||
| 35 | @@ -541,6 +545,7 @@ process_arguments (int argc, char **argv | ||
| 36 | |||
| 37 | if (argc > c && path == NULL) { | ||
| 38 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 39 | + memset(se,0,sizeof(struct name_list)); | ||
| 40 | se->name = strdup (argv[c++]); | ||
| 41 | se->name_next = NULL; | ||
| 42 | se->w_df = w_df; | ||
diff --git a/web/attachments/194456-check_http_patch.txt b/web/attachments/194456-check_http_patch.txt new file mode 100644 index 0000000..45c84cf --- /dev/null +++ b/web/attachments/194456-check_http_patch.txt | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | diff -uNr nagios-plugins-1.4.3/plugins/check_http.c nagios-plugins-1.4.3_new/plugins/check_http.c | ||
| 2 | --- nagios-plugins-1.4.3/plugins/check_http.c 2006-04-05 00:58:27.000000000 -0700 | ||
| 3 | +++ nagios-plugins-1.4.3_new/plugins/check_http.c 2006-08-30 02:34:35.000000000 -0700 | ||
| 4 | @@ -1073,9 +1073,8 @@ | ||
| 5 | die (STATE_UNKNOWN, _("Could not allocate url\n")); | ||
| 6 | |||
| 7 | while (pos) { | ||
| 8 | - | ||
| 9 | - if (sscanf (pos, "%[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]:%n", xx, &i) < 1) { | ||
| 10 | - | ||
| 11 | + sscanf (pos, "%[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]:%n", xx, &i); | ||
| 12 | + if (i == 0) { | ||
| 13 | pos += (size_t) strcspn (pos, "\r\n"); | ||
| 14 | pos += (size_t) strspn (pos, "\r\n"); | ||
| 15 | if (strlen(pos) == 0) | ||
diff --git a/web/attachments/195732-utils.pm-1.4.3.patch b/web/attachments/195732-utils.pm-1.4.3.patch new file mode 100644 index 0000000..987e4b8 --- /dev/null +++ b/web/attachments/195732-utils.pm-1.4.3.patch | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | --- utils.pm.orig Thu Sep 28 14:05:56 2006 | ||
| 2 | +++ utils.pm Thu Sep 28 14:06:01 2006 | ||
| 3 | @@ -73,7 +73,7 @@ | ||
| 4 | |||
| 5 | sub is_hostname { | ||
| 6 | my $host1 = shift; | ||
| 7 | - if ($host1 && $host1 =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z0-9][-a-zA-Z0-9]+(\.[a-zA-Z][-a-zA-Z0-9]+)*)$/) { | ||
| 8 | + if ($host1 && $host1 =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z0-9][-a-zA-Z0-9]+(\.[a-zA-Z0-9][-a-zA-Z0-9]+)*\.[a-zA-Z][-a-zA-Z0-9]+)$/) { | ||
| 9 | return 1; | ||
| 10 | }else{ | ||
| 11 | return 0; | ||
diff --git a/web/attachments/197609-check_real_options.patch b/web/attachments/197609-check_real_options.patch new file mode 100644 index 0000000..a2f069e --- /dev/null +++ b/web/attachments/197609-check_real_options.patch | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | Index: plugins/check_real.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_real.c,v | ||
| 4 | retrieving revision 1.26 | ||
| 5 | diff -u -r1.26 check_real.c | ||
| 6 | --- plugins/check_real.c 20 Jun 2006 11:17:02 -0000 1.26 | ||
| 7 | +++ plugins/check_real.c 10 Oct 2006 22:24:03 -0000 | ||
| 8 | @@ -299,7 +299,7 @@ | ||
| 9 | } | ||
| 10 | |||
| 11 | while (1) { | ||
| 12 | - c = getopt_long (argc, argv, "+hVI:H:e:u:p:w:c:t:", longopts, | ||
| 13 | + c = getopt_long (argc, argv, "+hVvI:H:e:u:p:w:c:t:", longopts, | ||
| 14 | &option); | ||
| 15 | |||
| 16 | if (c == -1 || c == EOF) | ||
diff --git a/web/attachments/199141-is_hostname.diff b/web/attachments/199141-is_hostname.diff new file mode 100644 index 0000000..8d6e498 --- /dev/null +++ b/web/attachments/199141-is_hostname.diff | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | Index: plugins-scripts/utils.pm.in | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins-scripts/utils.pm.in,v | ||
| 4 | retrieving revision 1.9 | ||
| 5 | diff -u -r1.9 utils.pm.in | ||
| 6 | --- plugins-scripts/utils.pm.in 19 Oct 2006 18:44:53 -0000 1.9 | ||
| 7 | +++ plugins-scripts/utils.pm.in 20 Oct 2006 15:57:37 -0000 | ||
| 8 | @@ -76,7 +76,7 @@ | ||
| 9 | |||
| 10 | sub is_hostname { | ||
| 11 | my $host1 = shift; | ||
| 12 | - if ($host1 && $host1 =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z0-9]+(\.[a-zA-Z0-9]+)*)$/) { | ||
| 13 | + if ($host1 && $host1 =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z0-9][-a-zA-Z0-9]+(\.[a-zA-Z0-9][-a-zA-Z0-9]+)*)$/) { | ||
| 14 | return 1; | ||
| 15 | }else{ | ||
| 16 | return 0; | ||
diff --git a/web/attachments/200576-ssh_connect_parse.patch b/web/attachments/200576-ssh_connect_parse.patch new file mode 100644 index 0000000..7f7e707 --- /dev/null +++ b/web/attachments/200576-ssh_connect_parse.patch | |||
| @@ -0,0 +1,95 @@ | |||
| 1 | diff -ruN nagios-plugins-1.4.4.orig/plugins/check_ssh.c nagios-plugins-1.4.4/plugins/check_ssh.c | ||
| 2 | --- nagios-plugins-1.4.4.orig/plugins/check_ssh.c 2006-06-21 07:05:00.000000000 -0400 | ||
| 3 | +++ nagios-plugins-1.4.4/plugins/check_ssh.c 2006-10-29 20:20:11.000000000 -0500 | ||
| 4 | @@ -50,6 +50,7 @@ | ||
| 5 | int port = -1; | ||
| 6 | char *server_name = NULL; | ||
| 7 | char *remote_version = NULL; | ||
| 8 | +char *parse_remote_version = NULL; | ||
| 9 | int verbose = FALSE; | ||
| 10 | |||
| 11 | int process_arguments (int, char **); | ||
| 12 | @@ -57,7 +58,7 @@ | ||
| 13 | void print_help (void); | ||
| 14 | void print_usage (void); | ||
| 15 | |||
| 16 | -int ssh_connect (char *haddr, int hport, char *remote_version); | ||
| 17 | +int ssh_connect (char *haddr, int hport, char *remote_version, char *parse_remote_version); | ||
| 18 | |||
| 19 | |||
| 20 | |||
| 21 | @@ -79,7 +80,7 @@ | ||
| 22 | alarm (socket_timeout); | ||
| 23 | |||
| 24 | /* ssh_connect exits if error is found */ | ||
| 25 | - result = ssh_connect (server_name, port, remote_version); | ||
| 26 | + result = ssh_connect (server_name, port, remote_version, parse_remote_version); | ||
| 27 | |||
| 28 | alarm (0); | ||
| 29 | |||
| 30 | @@ -105,6 +106,7 @@ | ||
| 31 | {"timeout", required_argument, 0, 't'}, | ||
| 32 | {"verbose", no_argument, 0, 'v'}, | ||
| 33 | {"remote-version", required_argument, 0, 'r'}, | ||
| 34 | + {"parse-remote-version", required_argument, 0, 's'}, | ||
| 35 | {0, 0, 0, 0} | ||
| 36 | }; | ||
| 37 | |||
| 38 | @@ -116,7 +118,7 @@ | ||
| 39 | strcpy (argv[c], "-t"); | ||
| 40 | |||
| 41 | while (1) { | ||
| 42 | - c = getopt_long (argc, argv, "+Vhv46t:r:H:p:", longopts, &option); | ||
| 43 | + c = getopt_long (argc, argv, "+Vhv46t:r:s:H:p:", longopts, &option); | ||
| 44 | |||
| 45 | if (c == -1 || c == EOF) | ||
| 46 | break; | ||
| 47 | @@ -152,6 +154,9 @@ | ||
| 48 | case 'r': /* remote version */ | ||
| 49 | remote_version = optarg; | ||
| 50 | break; | ||
| 51 | + case 's': /* remote version */ | ||
| 52 | + parse_remote_version = optarg; | ||
| 53 | + break; | ||
| 54 | case 'H': /* host */ | ||
| 55 | if (is_host (optarg) == FALSE) | ||
| 56 | usage2 (_("Invalid hostname/address"), optarg); | ||
| 57 | @@ -206,7 +211,7 @@ | ||
| 58 | |||
| 59 | |||
| 60 | int | ||
| 61 | -ssh_connect (char *haddr, int hport, char *remote_version) | ||
| 62 | +ssh_connect (char *haddr, int hport, char *remote_version, char *parse_remote_version) | ||
| 63 | { | ||
| 64 | int sd; | ||
| 65 | int result; | ||
| 66 | @@ -248,6 +253,11 @@ | ||
| 67 | (_("SSH WARNING - %s (protocol %s) version mismatch, expected '%s'\n"), | ||
| 68 | ssh_server, ssh_proto, remote_version); | ||
| 69 | exit (STATE_WARNING); | ||
| 70 | + } else if (parse_remote_version && !strstr(parse_remote_version, ssh_server)) { | ||
| 71 | + printf | ||
| 72 | + (_("SSH WARNING - %s (protocol %s) version mismatch, expected '%s'\n"), | ||
| 73 | + ssh_server, ssh_proto, parse_remote_version); | ||
| 74 | + exit (STATE_WARNING); | ||
| 75 | } | ||
| 76 | |||
| 77 | printf | ||
| 78 | @@ -285,6 +295,9 @@ | ||
| 79 | |||
| 80 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
| 81 | |||
| 82 | + printf (" %s\n", "-s, --parse-remote-version=STRING"); | ||
| 83 | + printf (" %s\n", _("Warn if STRING isnt in server version(ex: SSH)")); | ||
| 84 | + | ||
| 85 | printf (" %s\n", "-r, --remote-version=STRING"); | ||
| 86 | printf (" %s\n", _("Warn if string doesn't match expected server version (ex: OpenSSH_3.9p1)")); | ||
| 87 | |||
| 88 | @@ -299,6 +312,6 @@ | ||
| 89 | print_usage (void) | ||
| 90 | { | ||
| 91 | printf (_("Usage:")); | ||
| 92 | - printf ("%s [-46] [-t <timeout>] [-r <remote version>] [-p <port>] <host>\n", progname); | ||
| 93 | + printf ("%s [-46] [-t <timeout>] [-r <remote version> | -s <remote string>] [-p <port>] <host>\n", progname); | ||
| 94 | } | ||
| 95 | |||
diff --git a/web/attachments/200842-check_swap.c.patch b/web/attachments/200842-check_swap.c.patch new file mode 100644 index 0000000..c75a369 --- /dev/null +++ b/web/attachments/200842-check_swap.c.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-3 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378822046" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378822046" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378822046" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378822046" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378822046'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1588031&group_id=29880&atid=397599&file_id=200842" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/200960-check_swap.c.patch b/web/attachments/200960-check_swap.c.patch new file mode 100644 index 0000000..d4f8176 --- /dev/null +++ b/web/attachments/200960-check_swap.c.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-1 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378822045" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378822045" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378822045" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378822045" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378822045'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1588031&group_id=29880&atid=397599&file_id=200960" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/202053-check_swap.c.patch b/web/attachments/202053-check_swap.c.patch new file mode 100644 index 0000000..34e6a5d --- /dev/null +++ b/web/attachments/202053-check_swap.c.patch | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | *** check_swap.c.orig Fri Oct 20 00:53:28 2006 | ||
| 2 | --- check_swap.c Tue Nov 7 14:54:35 2006 | ||
| 3 | *************** | ||
| 4 | *** 37,42 **** | ||
| 5 | --- 37,48 ---- | ||
| 6 | const char *copyright = "2000-2006"; | ||
| 7 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 8 | |||
| 9 | + /* required to work correctly on solaris (else gets 'Bad Address' errors) */ | ||
| 10 | + /* #ifdef HAVE_SYS_STAT_H - using this one doesnt work on solaris */ | ||
| 11 | + #ifdef __sun__ | ||
| 12 | + #include <sys/stat.h> | ||
| 13 | + #endif | ||
| 14 | + | ||
| 15 | #include "common.h" | ||
| 16 | #include "popen.h" | ||
| 17 | #include "utils.h" | ||
| 18 | *************** | ||
| 19 | *** 236,257 **** | ||
| 20 | # ifdef CHECK_SWAP_SWAPCTL_SVR4 | ||
| 21 | |||
| 22 | /* get the number of active swap devices */ | ||
| 23 | ! nswaps=swapctl(SC_GETNSWP, NULL); | ||
| 24 | |||
| 25 | /* initialize swap table + entries */ | ||
| 26 | tbl=(swaptbl_t*)malloc(sizeof(swaptbl_t)+(sizeof(swapent_t)*nswaps)); | ||
| 27 | memset(tbl, 0, sizeof(swaptbl_t)+(sizeof(swapent_t)*nswaps)); | ||
| 28 | tbl->swt_n=nswaps; | ||
| 29 | for(i=0;i<nswaps;i++){ | ||
| 30 | ! ent=&tbl->swt_ent[i]; | ||
| 31 | ! ent->ste_path=(char*)malloc(sizeof(char)*MAXPATHLEN); | ||
| 32 | } | ||
| 33 | |||
| 34 | /* and now, tally 'em up */ | ||
| 35 | swapctl_res=swapctl(SC_LIST, tbl); | ||
| 36 | if(swapctl_res < 0){ | ||
| 37 | ! perror(_("swapctl failed: ")); | ||
| 38 | ! result = STATE_WARNING; | ||
| 39 | } | ||
| 40 | |||
| 41 | for(i=0;i<nswaps;i++){ | ||
| 42 | --- 242,273 ---- | ||
| 43 | # ifdef CHECK_SWAP_SWAPCTL_SVR4 | ||
| 44 | |||
| 45 | /* get the number of active swap devices */ | ||
| 46 | ! if((nswaps=swapctl(SC_GETNSWP, NULL))== -1) | ||
| 47 | ! perror(_(argv[0])), exit(STATE_UNKNOWN); | ||
| 48 | |||
| 49 | + if(nswaps == 0) | ||
| 50 | + (void)printf("No swap devices defined\n"), exit(STATE_OK); | ||
| 51 | + | ||
| 52 | + if(verbose > 0) | ||
| 53 | + (void)printf("Found %d swap device(s)\n",nswaps); | ||
| 54 | + | ||
| 55 | /* initialize swap table + entries */ | ||
| 56 | tbl=(swaptbl_t*)malloc(sizeof(swaptbl_t)+(sizeof(swapent_t)*nswaps)); | ||
| 57 | + | ||
| 58 | + if(tbl==NULL) | ||
| 59 | + perror(_(argv[0])), exit(STATE_UNKNOWN); | ||
| 60 | + | ||
| 61 | memset(tbl, 0, sizeof(swaptbl_t)+(sizeof(swapent_t)*nswaps)); | ||
| 62 | tbl->swt_n=nswaps; | ||
| 63 | for(i=0;i<nswaps;i++){ | ||
| 64 | ! if((tbl->swt_ent[i].ste_path=(char*)malloc(sizeof(char)*MAXPATHLEN)) == NULL) | ||
| 65 | ! perror(_(argv[0])), exit(STATE_UNKNOWN); | ||
| 66 | } | ||
| 67 | |||
| 68 | /* and now, tally 'em up */ | ||
| 69 | swapctl_res=swapctl(SC_LIST, tbl); | ||
| 70 | if(swapctl_res < 0){ | ||
| 71 | ! perror(_("swapctl failed")), exit(STATE_UNKNOWN); | ||
| 72 | } | ||
| 73 | |||
| 74 | for(i=0;i<nswaps;i++){ | ||
| 75 | *************** | ||
| 76 | *** 292,299 **** | ||
| 77 | /* and now, tally 'em up */ | ||
| 78 | swapctl_res=swapctl(SWAP_STATS, ent, nswaps); | ||
| 79 | if(swapctl_res < 0){ | ||
| 80 | ! perror(_("swapctl failed: ")); | ||
| 81 | ! result = STATE_WARNING; | ||
| 82 | } | ||
| 83 | |||
| 84 | for(i=0;i<nswaps;i++){ | ||
| 85 | --- 308,314 ---- | ||
| 86 | /* and now, tally 'em up */ | ||
| 87 | swapctl_res=swapctl(SWAP_STATS, ent, nswaps); | ||
| 88 | if(swapctl_res < 0){ | ||
| 89 | ! perror(_("swapctl failed")), exit(STATE_UNKNOWN); | ||
| 90 | } | ||
| 91 | |||
| 92 | for(i=0;i<nswaps;i++){ | ||
diff --git a/web/attachments/206987-check_procs.p1 b/web/attachments/206987-check_procs.p1 new file mode 100644 index 0000000..51070bc --- /dev/null +++ b/web/attachments/206987-check_procs.p1 | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | Index: check_procs.c | ||
| 2 | =================================================================== | ||
| 3 | --- check_procs.c (revision 1) | ||
| 4 | +++ check_procs.c (working copy) | ||
| 5 | @@ -303,7 +303,8 @@ | ||
| 6 | printf (_("%d crit, %d warn out of "), crit, warn); | ||
| 7 | } | ||
| 8 | } | ||
| 9 | - printf (ngettext ("%d process", "%d processes", (unsigned long) procs), procs); | ||
| 10 | + | ||
| 11 | + printf (ngettext ("%d process|processes=%d;;;0", "%d processes|processes=%d;;;0", (unsigned long) procs), procs, procs, procs); | ||
| 12 | |||
| 13 | if (strcmp(fmt,"") != 0) { | ||
| 14 | printf (_(" with %s"), fmt); | ||
| 15 | @@ -437,8 +438,8 @@ | ||
| 16 | break; | ||
| 17 | else | ||
| 18 | prog = optarg; | ||
| 19 | - asprintf (&fmt, _("%s%scommand name '%s'"), (fmt ? fmt : ""), (options ? ", " : ""), | ||
| 20 | - prog); | ||
| 21 | + asprintf (&fmt, _("%s%s"), (fmt ? fmt : ""), (options ? ", " : ""), | ||
| 22 | + prog); | ||
| 23 | options |= PROG; | ||
| 24 | break; | ||
| 25 | case 'a': /* args (full path name with args) */ | ||
| 26 | @@ -447,7 +448,6 @@ | ||
| 27 | break; | ||
| 28 | else | ||
| 29 | args = optarg; | ||
| 30 | - asprintf (&fmt, "%s%sargs '%s'", (fmt ? fmt : ""), (options ? ", " : ""), args); | ||
| 31 | options |= ARGS; | ||
| 32 | break; | ||
| 33 | case 'r': /* RSS */ | ||
| 34 | Index: check_procs.c | ||
| 35 | =================================================================== | ||
| 36 | --- check_procs.c (revision 2) | ||
| 37 | +++ check_procs.c (working copy) | ||
| 38 | @@ -304,7 +304,7 @@ | ||
| 39 | } | ||
| 40 | } | ||
| 41 | |||
| 42 | - printf (ngettext ("%d process|processes=%d;;;0", "%d processes|processes=%d;;;0", (unsigned long) procs), procs, procs, procs); | ||
| 43 | + printf (ngettext ("%d process|processes=%d;;;0", "%d processes|processes=%d;%d;%d;0", (unsigned long) procs), procs, warn, crit, procs, procs); | ||
| 44 | |||
| 45 | if (strcmp(fmt,"") != 0) { | ||
| 46 | printf (_(" with %s"), fmt); | ||
diff --git a/web/attachments/206988-check_apt.p1 b/web/attachments/206988-check_apt.p1 new file mode 100644 index 0000000..0d8c584 --- /dev/null +++ b/web/attachments/206988-check_apt.p1 | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | Index: check_apt.c | ||
| 2 | =================================================================== | ||
| 3 | --- check_apt.c (revision 2) | ||
| 4 | +++ check_apt.c (working copy) | ||
| 5 | @@ -115,7 +115,7 @@ | ||
| 6 | result = max_state(result, STATE_OK); | ||
| 7 | } | ||
| 8 | |||
| 9 | - printf(_("APT %s: %d packages available for %s (%d critical updates). %s%s%s%s\n"), | ||
| 10 | + printf(_("APT %s: %d packages available for %s (%d critical updates). %s%s%s%s|available_upgrades=%d;;;0 critical_updates=%d;;;0\n"), | ||
| 11 | state_text(result), | ||
| 12 | packages_available, | ||
| 13 | (upgrade==DIST_UPGRADE)?"dist-upgrade":"upgrade", | ||
| 14 | @@ -123,7 +123,9 @@ | ||
| 15 | (stderr_warning)?" warnings detected":"", | ||
| 16 | (stderr_warning && exec_warning)?",":"", | ||
| 17 | (exec_warning)?" errors detected":"", | ||
| 18 | - (stderr_warning||exec_warning)?". run with -v for information.":"" | ||
| 19 | + (stderr_warning||exec_warning)?". run with -v for information.":"", | ||
| 20 | + packages_available, | ||
| 21 | + sec_count | ||
| 22 | ); | ||
| 23 | |||
| 24 | return result; | ||
diff --git a/web/attachments/206989-check_swap.p1 b/web/attachments/206989-check_swap.p1 new file mode 100644 index 0000000..2bafa2c --- /dev/null +++ b/web/attachments/206989-check_swap.p1 | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | Index: pkg/solaris/pkginfo | ||
| 2 | =================================================================== | ||
| 3 | --- pkg/solaris/pkginfo (revision 1) | ||
| 4 | +++ pkg/solaris/pkginfo (working copy) | ||
| 5 | @@ -1,12 +1,12 @@ | ||
| 6 | PKG="NAGplugin" | ||
| 7 | NAME="nagios-plugins" | ||
| 8 | DESC="Nagios network monitoring plugins" | ||
| 9 | -ARCH="powerpc" | ||
| 10 | -VERSION="1.4.5,REV=2006.11.01.21.25" | ||
| 11 | +ARCH="" | ||
| 12 | +VERSION="1.4.5,REV=2006.12.12.09.37" | ||
| 13 | CATEGORY="application" | ||
| 14 | VENDOR="Nagios Plugin Development Team" | ||
| 15 | EMAIL="nagiosplug-devel@lists.sourceforge.net" | ||
| 16 | -PSTAMP="nag20061101212546" | ||
| 17 | +PSTAMP="nag20061212093733" | ||
| 18 | BASEDIR="/" | ||
| 19 | CLASSES="none" | ||
| 20 | |||
| 21 | Index: plugins/check_swap.c | ||
| 22 | =================================================================== | ||
| 23 | --- plugins/check_swap.c (revision 2) | ||
| 24 | +++ plugins/check_swap.c (working copy) | ||
| 25 | @@ -334,10 +334,10 @@ | ||
| 26 | state_text (result), | ||
| 27 | (100 - percent_used), (int) free_swap_mb, (int) total_swap_mb, status); | ||
| 28 | |||
| 29 | - puts (perfdata ("swap", (long) free_swap_mb, "MB", | ||
| 30 | - TRUE, (long) max (warn_size_bytes/(1024 * 1024), warn_percent/100.0*total_swap_mb), | ||
| 31 | - TRUE, (long) max (crit_size_bytes/(1024 * 1024), crit_percent/100.0*total_swap_mb), | ||
| 32 | - TRUE, 0, | ||
| 33 | + puts (perfdata ("swap", (long) total_swap_mb-free_swap_mb, "MB", | ||
| 34 | + TRUE, total_swap_mb-((long) max (warn_size_bytes/(1024 * 1024),(warn_percent/100.0*total_swap_mb))), | ||
| 35 | + TRUE, total_swap_mb-((long) max (crit_size_bytes/(1024 * 1024),(crit_percent/100.0*total_swap_mb))), | ||
| 36 | + TRUE, 0, | ||
| 37 | TRUE, (long) total_swap_mb)); | ||
| 38 | |||
| 39 | return result; | ||
diff --git a/web/attachments/207725-check_by_ssh.patch b/web/attachments/207725-check_by_ssh.patch new file mode 100644 index 0000000..be15032 --- /dev/null +++ b/web/attachments/207725-check_by_ssh.patch | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | --- check_by_ssh.c 2006-10-18 20:25:16.000000000 -0400 | ||
| 2 | +++ check_by_ssh_new.c 2006-12-18 10:51:04.000000000 -0500 | ||
| 3 | @@ -166,6 +166,7 @@ | ||
| 4 | {"proto2", no_argument, 0, '2'}, | ||
| 5 | {"use-ipv4", no_argument, 0, '4'}, | ||
| 6 | {"use-ipv6", no_argument, 0, '6'}, | ||
| 7 | + {"quiet", no_argument, 0, 'q'}, | ||
| 8 | {0, 0, 0, 0} | ||
| 9 | }; | ||
| 10 | |||
| 11 | @@ -177,7 +178,7 @@ | ||
| 12 | strcpy (argv[c], "-t"); | ||
| 13 | |||
| 14 | while (1) { | ||
| 15 | - c = getopt_long (argc, argv, "Vvh1246ft:H:O:p:i:u:l:C:S:n:s:", longopts, | ||
| 16 | + c = getopt_long (argc, argv, "Vvh1246fqt:H:O:p:i:u:l:C:S:n:s:", longopts, | ||
| 17 | &option); | ||
| 18 | |||
| 19 | if (c == -1 || c == EOF) | ||
| 20 | @@ -238,6 +239,7 @@ | ||
| 21 | case '2': /* 1 to force version 1, 2 to force version 2 */ | ||
| 22 | case '4': /* -4 for IPv4 */ | ||
| 23 | case '6': /* -6 for IPv6 */ | ||
| 24 | + case 'q': /* Quiet ssh output to suppress motd */ | ||
| 25 | case 'f': /* fork to background */ | ||
| 26 | asprintf (&comm, "%s -%c", comm, c); | ||
| 27 | break; | ||
| 28 | @@ -328,6 +330,8 @@ | ||
| 29 | printf (" %s\n", _("tell ssh to use Protocol 1")); | ||
| 30 | printf (" %s\n", "-2, --proto2"); | ||
| 31 | printf (" %s\n", _("tell ssh to use Protocol 2")); | ||
| 32 | + printf (" %s\n", "-q, --quiet"); | ||
| 33 | + printf (" %s\n", _("tell ssh to use quiet mode")); | ||
| 34 | printf (" %s\n", "-S, --skiplines=n"); | ||
| 35 | printf (" %s\n", _("Ignore first n lines on STDERR (to suppress a logon banner)")); | ||
| 36 | printf (" %s\n", "-f"); | ||
diff --git a/web/attachments/209675-check_procs.c-1.4.5-zombies-patch b/web/attachments/209675-check_procs.c-1.4.5-zombies-patch new file mode 100644 index 0000000..6923bf5 --- /dev/null +++ b/web/attachments/209675-check_procs.c-1.4.5-zombies-patch | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | diff -Naur nagios-plugins-1.4.5/plugins/check_procs.c nagios-plugins-1.4.5-patched/plugins/check_procs.c | ||
| 2 | --- nagios-plugins-1.4.5/plugins/check_procs.c 2006-10-23 00:03:31.000000000 +0200 | ||
| 3 | +++ nagios-plugins-1.4.5-patched/plugins/check_procs.c 2007-01-04 12:00:46.512560576 +0100 | ||
| 4 | @@ -181,6 +181,7 @@ | ||
| 5 | strcpy (procprog, ""); | ||
| 6 | asprintf (&procargs, "%s", ""); | ||
| 7 | |||
| 8 | + pos = 0; | ||
| 9 | cols = sscanf (input_line, PS_FORMAT, PS_VARLIST); | ||
| 10 | |||
| 11 | /* Zombie processes do not give a procprog command */ | ||
| 12 | @@ -189,8 +190,12 @@ | ||
| 13 | } | ||
| 14 | if ( cols >= expected_cols ) { | ||
| 15 | resultsum = 0; | ||
| 16 | - asprintf (&procargs, "%s", input_line + pos); | ||
| 17 | - strip (procargs); | ||
| 18 | + if (strstr(procstat, zombie)) { | ||
| 19 | + procargs = ""; | ||
| 20 | + } else { | ||
| 21 | + asprintf (&procargs, "%s", input_line + pos); | ||
| 22 | + strip (procargs); | ||
| 23 | + } | ||
| 24 | |||
| 25 | /* Some ps return full pathname for command. This removes path */ | ||
| 26 | procprog = base_name(procprog); | ||
diff --git a/web/attachments/209934-check_ping-1.4.5-filtered-packets.diff b/web/attachments/209934-check_ping-1.4.5-filtered-packets.diff new file mode 100644 index 0000000..e738d27 --- /dev/null +++ b/web/attachments/209934-check_ping-1.4.5-filtered-packets.diff | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | diff -r -u nagios-plugins-1.4.5.old/plugins/check_ping.c nagios-plugins-1.4.5/plugins/check_ping.c | ||
| 2 | --- nagios-plugins-1.4.5.old/plugins/check_ping.c 2006-10-19 01:25:16.000000000 +0100 | ||
| 3 | +++ nagios-plugins-1.4.5/plugins/check_ping.c 2007-01-05 18:17:12.000000000 +0000 | ||
| 4 | @@ -503,6 +503,27 @@ | ||
| 5 | int | ||
| 6 | error_scan (char buf[MAX_INPUT_BUFFER], const char *addr) | ||
| 7 | { | ||
| 8 | + /* | ||
| 9 | + * This constant shouldn't be here. It is bad practice, and just | ||
| 10 | + * generally offensive to the sensibilities. Unfortunately, the | ||
| 11 | + * relevant constant, MAX_HOST_ADDRESS_LENGTH, is an enum, which means | ||
| 12 | + * I can't compile-time cat it into a scanf format string. | ||
| 13 | + * | ||
| 14 | + * I could change the common header to work around this, but that's | ||
| 15 | + * invasive. I could sprintf a scanf string, but then I need about 5 | ||
| 16 | + * times the memory (for a sprintf buffer of unknown length). Since I | ||
| 17 | + * intend to report my problem as a bug to the Nagios maintainers I'll | ||
| 18 | + * just leave it for them to fix as they feel best fits the | ||
| 19 | + * application -- they're the experts, after all, I'm just a device | ||
| 20 | + * for ensuring RFC1925 Section 2(1) compliancy, and this does it. I | ||
| 21 | + * would never put this in my own code, got it? I'm just not sure | ||
| 22 | + * what the house style dictates in this case. | ||
| 23 | + * | ||
| 24 | + * Maybe this variable shouldn't even be here -- it looks awfully | ||
| 25 | + * lonely, doesn't it? Dunno. It works for me, though. | ||
| 26 | + */ | ||
| 27 | + char filter_host[256+1]; | ||
| 28 | + | ||
| 29 | if (strstr (buf, "Network is unreachable")) | ||
| 30 | die (STATE_CRITICAL, _("CRITICAL - Network unreachable (%s)"), addr); | ||
| 31 | else if (strstr (buf, "Destination Host Unreachable")) | ||
| 32 | @@ -511,6 +532,8 @@ | ||
| 33 | die (STATE_CRITICAL, _("CRITICAL - Host not found (%s)"), addr); | ||
| 34 | else if (strstr (buf, "Time to live exceeded")) | ||
| 35 | die (STATE_CRITICAL, _("CRITICAL - Time to live exceeded (%s)"), addr); | ||
| 36 | + else if (sscanf (buf, "From %256s %*s Packet filtered", filter_host) == 1) | ||
| 37 | + die (STATE_CRITICAL, _("CRITICAL - Packet filtered by %s (%s)"), filter_host, addr); | ||
| 38 | |||
| 39 | if (strstr (buf, "(DUP!)") || strstr (buf, "DUPLICATES FOUND")) { | ||
| 40 | if (warn_text == NULL) | ||
diff --git a/web/attachments/209994-check_ping.response_handling.patch b/web/attachments/209994-check_ping.response_handling.patch new file mode 100644 index 0000000..f86141c --- /dev/null +++ b/web/attachments/209994-check_ping.response_handling.patch | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | Index: plugins/check_ping.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ping.c,v | ||
| 4 | retrieving revision 1.55 | ||
| 5 | diff -u -r1.55 check_ping.c | ||
| 6 | --- plugins/check_ping.c 6 Jan 2007 04:52:58 -0000 1.55 | ||
| 7 | +++ plugins/check_ping.c 6 Jan 2007 06:08:11 -0000 | ||
| 8 | @@ -503,10 +503,22 @@ | ||
| 9 | int | ||
| 10 | error_scan (char buf[MAX_INPUT_BUFFER], const char *addr) | ||
| 11 | { | ||
| 12 | - if (strstr (buf, "Network is unreachable")) | ||
| 13 | - die (STATE_CRITICAL, _("CRITICAL - Network unreachable (%s)"), addr); | ||
| 14 | + if (strstr (buf, "Network is unreachable") || | ||
| 15 | + strstr (buf, "Destination Net Unreachable") | ||
| 16 | + ) | ||
| 17 | + die (STATE_CRITICAL, _("CRITICAL - Network Unreachable (%s)"), addr); | ||
| 18 | else if (strstr (buf, "Destination Host Unreachable")) | ||
| 19 | die (STATE_CRITICAL, _("CRITICAL - Host Unreachable (%s)"), addr); | ||
| 20 | + else if (strstr (buf, "Destination Port Unreachable")) | ||
| 21 | + die (STATE_CRITICAL, _("CRITICAL - Bogus ICMP: Port Unreachable (%s)"), addr); | ||
| 22 | + else if (strstr (buf, "Destination Protocol Unreachable")) | ||
| 23 | + die (STATE_CRITICAL, _("CRITICAL - Bogus ICMP: Protocol Unreachable (%s)"), addr); | ||
| 24 | + else if (strstr (buf, "Destination Net Prohibited")) | ||
| 25 | + die (STATE_CRITICAL, _("CRITICAL - Network Prohibited (%s)"), addr); | ||
| 26 | + else if (strstr (buf, "Destination Host Prohibited")) | ||
| 27 | + die (STATE_CRITICAL, _("CRITICAL - Host Prohibited (%s)"), addr); | ||
| 28 | + else if (strstr (buf, "Packet filtered")) | ||
| 29 | + die (STATE_CRITICAL, _("CRITICAL - Packet Filtered (%s)"), addr); | ||
| 30 | else if (strstr (buf, "unknown host" )) | ||
| 31 | die (STATE_CRITICAL, _("CRITICAL - Host not found (%s)"), addr); | ||
| 32 | else if (strstr (buf, "Time to live exceeded")) | ||
diff --git a/web/attachments/210121-check_disk.multiple_perfdata.patch b/web/attachments/210121-check_disk.multiple_perfdata.patch new file mode 100644 index 0000000..bf2d265 --- /dev/null +++ b/web/attachments/210121-check_disk.multiple_perfdata.patch | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | Index: plugins/check_disk.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_disk.c,v | ||
| 4 | retrieving revision 1.81 | ||
| 5 | diff -u -r1.81 check_disk.c | ||
| 6 | --- plugins/check_disk.c 20 Dec 2006 19:25:59 -0000 1.81 | ||
| 7 | +++ plugins/check_disk.c 7 Jan 2007 07:01:22 -0000 | ||
| 8 | @@ -164,8 +164,8 @@ | ||
| 9 | double dfree_pct = -1, dused_pct = -1; | ||
| 10 | double dused_units, dfree_units, dtotal_units; | ||
| 11 | double dused_inodes_percent, dfree_inodes_percent; | ||
| 12 | - double warning_high_tide = UINT_MAX; | ||
| 13 | - double critical_high_tide = UINT_MAX; | ||
| 14 | + double warning_high_tide; | ||
| 15 | + double critical_high_tide; | ||
| 16 | int temp_result; | ||
| 17 | |||
| 18 | struct mount_entry *me; | ||
| 19 | @@ -300,6 +300,11 @@ | ||
| 20 | Hack here. Trying to get warn/crit levels from freespace_(units|percent) for perf | ||
| 21 | data. Assumption that start=0. Roll on new syntax... | ||
| 22 | */ | ||
| 23 | + | ||
| 24 | + /* *_high_tide must be reinitialized at each run */ | ||
| 25 | + warning_high_tide = UINT_MAX; | ||
| 26 | + critical_high_tide = UINT_MAX; | ||
| 27 | + | ||
| 28 | if (path->freespace_units->warning != NULL) { | ||
| 29 | warning_high_tide = dtotal_units - path->freespace_units->warning->end; | ||
| 30 | } | ||
diff --git a/web/attachments/210386-nagios-plugins-check_procs-procprog-fix.diff b/web/attachments/210386-nagios-plugins-check_procs-procprog-fix.diff new file mode 100644 index 0000000..6eb498e --- /dev/null +++ b/web/attachments/210386-nagios-plugins-check_procs-procprog-fix.diff | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | *** nagios-plugins-1.4.5/plugins/check_procs.c Sun Oct 22 17:03:31 2006 | ||
| 2 | --- nagios-plugins-1.4.5/plugins/check_procs.c.new Mon Jan 8 14:28:10 2007 | ||
| 3 | *************** | ||
| 4 | *** 193,199 **** | ||
| 5 | strip (procargs); | ||
| 6 | |||
| 7 | /* Some ps return full pathname for command. This removes path */ | ||
| 8 | ! procprog = base_name(procprog); | ||
| 9 | |||
| 10 | /* we need to convert the elapsed time to seconds */ | ||
| 11 | procseconds = convert_to_seconds(procetime); | ||
| 12 | --- 193,199 ---- | ||
| 13 | strip (procargs); | ||
| 14 | |||
| 15 | /* Some ps return full pathname for command. This removes path */ | ||
| 16 | ! strcpy(procprog, base_name(procprog)); | ||
| 17 | |||
| 18 | /* we need to convert the elapsed time to seconds */ | ||
| 19 | procseconds = convert_to_seconds(procetime); | ||
diff --git a/web/attachments/210598-printf_fmt.patch b/web/attachments/210598-printf_fmt.patch new file mode 100644 index 0000000..c6e0f6a --- /dev/null +++ b/web/attachments/210598-printf_fmt.patch | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | Index: plugins/check_ldap.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ldap.c,v | ||
| 4 | retrieving revision 1.33 | ||
| 5 | diff -r1.33 check_ldap.c | ||
| 6 | 381c381 | ||
| 7 | < printf (" %s\n," "-D [--bind]"); | ||
| 8 | --- | ||
| 9 | > printf (" %s\n", "-D [--bind]"); | ||
| 10 | 383c383 | ||
| 11 | < printf (" %s\n," "-P [--pass]"); | ||
| 12 | --- | ||
| 13 | > printf (" %s\n", "-P [--pass]"); | ||
| 14 | 413c413 | ||
| 15 | < printf ("[-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n", | ||
| 16 | --- | ||
| 17 | > printf ("[-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]%s\n", | ||
| 18 | Index: plugins/check_http.c | ||
| 19 | =================================================================== | ||
| 20 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_http.c,v | ||
| 21 | retrieving revision 1.97 | ||
| 22 | diff -r1.97 check_http.c | ||
| 23 | 1272c1272 | ||
| 24 | < printf (" %s\n," "-P, --post=STRING"); | ||
| 25 | --- | ||
| 26 | > printf (" %s\n", "-P, --post=STRING"); | ||
diff --git a/web/attachments/212731-check_radius.c.diff b/web/attachments/212731-check_radius.c.diff new file mode 100644 index 0000000..b9f70f3 --- /dev/null +++ b/web/attachments/212731-check_radius.c.diff | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | --- nagios-plugins-HEAD-200610282352/plugins/check_radius.c.orig 2006-10-20 08:53:28.000000000 +0900 | ||
| 2 | +++ nagios-plugins-HEAD-200610282352/plugins/check_radius.c 2006-10-29 17:30:31.000000000 +0900 | ||
| 3 | @@ -139,6 +139,7 @@ | ||
| 4 | |||
| 5 | service = PW_AUTHENTICATE_ONLY; | ||
| 6 | |||
| 7 | + memset (&data, 0, sizeof data); | ||
| 8 | if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) && | ||
| 9 | rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) && | ||
| 10 | rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) && | ||
diff --git a/web/attachments/212735-check_tcp.c.diff b/web/attachments/212735-check_tcp.c.diff new file mode 100644 index 0000000..ed32a84 --- /dev/null +++ b/web/attachments/212735-check_tcp.c.diff | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | --- nagios-plugins-1.4.5/plugins/check_tcp.c.old 2007-01-24 01:17:45.000000000 +0900 | ||
| 2 | +++ nagios-plugins-1.4.5/plugins/check_tcp.c 2007-01-24 01:17:50.000000000 +0900 | ||
| 3 | @@ -520,6 +520,7 @@ | ||
| 4 | usage4 (_("Maxbytes must be a positive integer")); | ||
| 5 | else | ||
| 6 | maxbytes = strtol (optarg, NULL, 0); | ||
| 7 | + break; | ||
| 8 | case 'q': | ||
| 9 | if (escape) | ||
| 10 | server_quit = np_escaped_string(optarg); | ||
diff --git a/web/attachments/212748-check_ssh_hostname_opt_fix.diff b/web/attachments/212748-check_ssh_hostname_opt_fix.diff new file mode 100644 index 0000000..0411a2e --- /dev/null +++ b/web/attachments/212748-check_ssh_hostname_opt_fix.diff | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | --- nagios-plugins-HEAD-200701231300/plugins/check_ssh.c.orig 2007-01-23 19:43:04.000000000 +0200 | ||
| 2 | +++ nagios-plugins-HEAD-200701231300/plugins/check_ssh.c 2007-01-23 19:43:16.000000000 +0200 | ||
| 3 | @@ -103,6 +103,7 @@ | ||
| 4 | {"help", no_argument, 0, 'h'}, | ||
| 5 | {"version", no_argument, 0, 'V'}, | ||
| 6 | {"host", required_argument, 0, 'H'}, | ||
| 7 | + {"hostname", required_argument, 0, 'H'}, | ||
| 8 | {"port", required_argument, 0, 'p'}, | ||
| 9 | {"use-ipv4", no_argument, 0, '4'}, | ||
| 10 | {"use-ipv6", no_argument, 0, '6'}, | ||
diff --git a/web/attachments/213131-check_log b/web/attachments/213131-check_log new file mode 100644 index 0000000..a9aebbe --- /dev/null +++ b/web/attachments/213131-check_log | |||
| @@ -0,0 +1,217 @@ | |||
| 1 | #! /bin/sh | ||
| 2 | # | ||
| 3 | # Log file pattern detector plugin for Nagios | ||
| 4 | # Written by Ethan Galstad (nagios@nagios.org) | ||
| 5 | # Last Modified: 07-31-1999 | ||
| 6 | # | ||
| 7 | # Usage: ./check_log <log_file> <old_log_file> <pattern> | ||
| 8 | # | ||
| 9 | # Description: | ||
| 10 | # | ||
| 11 | # This plugin will scan a log file (specified by the <log_file> option) | ||
| 12 | # for a specific pattern (specified by the <pattern> option). Successive | ||
| 13 | # calls to the plugin script will only report *new* pattern matches in the | ||
| 14 | # log file, since an copy of the log file from the previous run is saved | ||
| 15 | # to <old_log_file>. | ||
| 16 | # | ||
| 17 | # Output: | ||
| 18 | # | ||
| 19 | # On the first run of the plugin, it will return an OK state with a message | ||
| 20 | # of "Log check data initialized". On successive runs, it will return an OK | ||
| 21 | # state if *no* pattern matches have been found in the *difference* between the | ||
| 22 | # log file and the older copy of the log file. If the plugin detects any | ||
| 23 | # pattern matches in the log diff, it will return a CRITICAL state and print | ||
| 24 | # out a message is the following format: "(x) last_match", where "x" is the | ||
| 25 | # total number of pattern matches found in the file and "last_match" is the | ||
| 26 | # last entry in the log file which matches the pattern. | ||
| 27 | # | ||
| 28 | # Notes: | ||
| 29 | # | ||
| 30 | # If you use this plugin make sure to keep the following in mind: | ||
| 31 | # | ||
| 32 | # 1. The "max_attempts" value for the service should be 1, as this | ||
| 33 | # will prevent Nagios from retrying the service check (the | ||
| 34 | # next time the check is run it will not produce the same results). | ||
| 35 | # | ||
| 36 | # 2. The "notify_recovery" value for the service should be 0, so that | ||
| 37 | # Nagios does not notify you of "recoveries" for the check. Since | ||
| 38 | # pattern matches in the log file will only be reported once and not | ||
| 39 | # the next time, there will always be "recoveries" for the service, even | ||
| 40 | # though recoveries really don't apply to this type of check. | ||
| 41 | # | ||
| 42 | # 3. You *must* supply a different <old_file_log> for each service that | ||
| 43 | # you define to use this plugin script - even if the different services | ||
| 44 | # check the same <log_file> for pattern matches. This is necessary | ||
| 45 | # because of the way the script operates. | ||
| 46 | # | ||
| 47 | # Examples: | ||
| 48 | # | ||
| 49 | # Check for login failures in the syslog... | ||
| 50 | # | ||
| 51 | # check_log /var/log/messages ./check_log.badlogins.old "LOGIN FAILURE" | ||
| 52 | # | ||
| 53 | # Check for port scan alerts generated by Psionic's PortSentry software... | ||
| 54 | # | ||
| 55 | # check_log /var/log/message ./check_log.portscan.old "attackalert" | ||
| 56 | # | ||
| 57 | |||
| 58 | # Paths to commands used in this script. These | ||
| 59 | # may have to be modified to match your system setup. | ||
| 60 | |||
| 61 | PATH="" | ||
| 62 | |||
| 63 | ECHO="/bin/echo" | ||
| 64 | GREP="/bin/grep" | ||
| 65 | DIFF="/usr/bin/diff" | ||
| 66 | TAIL="/usr/bin/tail" | ||
| 67 | CAT="/bin/cat" | ||
| 68 | RM="/bin/rm" | ||
| 69 | |||
| 70 | PROGNAME=`/bin/basename $0` | ||
| 71 | PROGPATH=`echo $0 | /bin/sed -e 's,[\\/][^\\/][^\\/]*$,,'` | ||
| 72 | REVISION=`echo '$Revision: 1.4 $' | /bin/sed -e 's/[^0-9.]//g'` | ||
| 73 | |||
| 74 | . $PROGPATH/utils.sh | ||
| 75 | |||
| 76 | print_usage() { | ||
| 77 | echo "Usage: $PROGNAME -F logfile -O oldlog -q query" | ||
| 78 | echo "Usage: $PROGNAME --help" | ||
| 79 | echo "Usage: $PROGNAME --version" | ||
| 80 | } | ||
| 81 | |||
| 82 | print_help() { | ||
| 83 | print_revision $PROGNAME $REVISION | ||
| 84 | echo "" | ||
| 85 | print_usage | ||
| 86 | echo "" | ||
| 87 | echo "Log file pattern detector plugin for Nagios" | ||
| 88 | echo "" | ||
| 89 | support | ||
| 90 | } | ||
| 91 | |||
| 92 | # Make sure the correct number of command line | ||
| 93 | # arguments have been supplied | ||
| 94 | |||
| 95 | if [ $# -lt 1 ]; then | ||
| 96 | print_usage | ||
| 97 | exit $STATE_UNKNOWN | ||
| 98 | fi | ||
| 99 | |||
| 100 | # Grab the command line arguments | ||
| 101 | |||
| 102 | #logfile=$1 | ||
| 103 | #oldlog=$2 | ||
| 104 | #query=$3 | ||
| 105 | exitstatus=$STATE_WARNING #default | ||
| 106 | while test -n "$1"; do | ||
| 107 | case "$1" in | ||
| 108 | --help) | ||
| 109 | print_help | ||
| 110 | exit $STATE_OK | ||
| 111 | ;; | ||
| 112 | -h) | ||
| 113 | print_help | ||
| 114 | exit $STATE_OK | ||
| 115 | ;; | ||
| 116 | --version) | ||
| 117 | print_revision $PROGNAME $VERSION | ||
| 118 | exit $STATE_OK | ||
| 119 | ;; | ||
| 120 | -V) | ||
| 121 | print_revision $PROGNAME $VERSION | ||
| 122 | exit $STATE_OK | ||
| 123 | ;; | ||
| 124 | --filename) | ||
| 125 | logfile=$2 | ||
| 126 | shift | ||
| 127 | ;; | ||
| 128 | -F) | ||
| 129 | logfile=$2 | ||
| 130 | shift | ||
| 131 | ;; | ||
| 132 | --oldlog) | ||
| 133 | oldlog=$2 | ||
| 134 | shift | ||
| 135 | ;; | ||
| 136 | -O) | ||
| 137 | oldlog=$2 | ||
| 138 | shift | ||
| 139 | ;; | ||
| 140 | --query) | ||
| 141 | query=$2 | ||
| 142 | shift | ||
| 143 | ;; | ||
| 144 | -q) | ||
| 145 | query=$2 | ||
| 146 | shift | ||
| 147 | ;; | ||
| 148 | -x) | ||
| 149 | exitstatus=$2 | ||
| 150 | shift | ||
| 151 | ;; | ||
| 152 | --exitstatus) | ||
| 153 | exitstatus=$2 | ||
| 154 | shift | ||
| 155 | ;; | ||
| 156 | *) | ||
| 157 | echo "Unknown argument: $1" | ||
| 158 | print_usage | ||
| 159 | exit $STATE_UNKNOWN | ||
| 160 | ;; | ||
| 161 | esac | ||
| 162 | shift | ||
| 163 | done | ||
| 164 | |||
| 165 | # If the source log file doesn't exist, exit | ||
| 166 | |||
| 167 | if [ ! -e $logfile ]; then | ||
| 168 | $ECHO "Log check error: Log file $logfile does not exist!\n" | ||
| 169 | exit $STATE_UNKNOWN | ||
| 170 | elif [ ! -r $logfile ] ; then | ||
| 171 | $ECHO "Log check error: Log file $logfile is not readable!\n" | ||
| 172 | exit $STATE_UNKNOWN | ||
| 173 | fi | ||
| 174 | |||
| 175 | # If the old log file doesn't exist, this must be the first time | ||
| 176 | # we're running this test, so copy the original log file over to | ||
| 177 | # the old diff file and exit | ||
| 178 | |||
| 179 | if [ ! -e $oldlog ]; then | ||
| 180 | $CAT $logfile > $oldlog | ||
| 181 | $ECHO "Log check data initialized...\n" | ||
| 182 | exit $STATE_OK | ||
| 183 | fi | ||
| 184 | |||
| 185 | # The old log file exists, so compare it to the original log now | ||
| 186 | |||
| 187 | # The temporary file that the script should use while | ||
| 188 | # processing the log file. | ||
| 189 | if [ -x /bin/mktemp ]; then | ||
| 190 | tempdiff=`/bin/mktemp /tmp/check_log.XXXXXXXXXX` | ||
| 191 | else | ||
| 192 | tempdiff=`/bin/date '+%H%M%S'` | ||
| 193 | tempdiff="/tmp/check_log.${tempdiff}" | ||
| 194 | /bin/touch $tempdiff | ||
| 195 | chmod 600 $tempdiff | ||
| 196 | fi | ||
| 197 | |||
| 198 | $DIFF $logfile $oldlog | $GREP -v "^>" > $tempdiff | ||
| 199 | |||
| 200 | # Count the number of matching log entries we have | ||
| 201 | count=`$GREP -c "$query" $tempdiff` | ||
| 202 | |||
| 203 | # Get the last matching entry in the diff file | ||
| 204 | lastentry=`$GREP "$query" $tempdiff | $TAIL --lines=1` | ||
| 205 | |||
| 206 | $RM -f $tempdiff | ||
| 207 | $CAT $logfile > $oldlog | ||
| 208 | |||
| 209 | if [ "$count" = "0" ]; then # no matches, exit with no error | ||
| 210 | $ECHO "Log check ok - 0 pattern matches found\n" | ||
| 211 | exitstatus=$STATE_OK | ||
| 212 | else # Print total matche count and the last entry we found | ||
| 213 | $ECHO "($count) $lastentry" | ||
| 214 | exitstatus=$STATE_CRITICAL | ||
| 215 | fi | ||
| 216 | |||
| 217 | exit $exitstatus | ||
diff --git a/web/attachments/213396-check_disk.reverse_perfdata.patch b/web/attachments/213396-check_disk.reverse_perfdata.patch new file mode 100644 index 0000000..7f2a94d --- /dev/null +++ b/web/attachments/213396-check_disk.reverse_perfdata.patch | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | Index: plugins/check_disk.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_disk.c,v | ||
| 4 | retrieving revision 1.82 | ||
| 5 | diff -u -r1.82 check_disk.c | ||
| 6 | --- plugins/check_disk.c 7 Jan 2007 07:14:04 -0000 1.82 | ||
| 7 | +++ plugins/check_disk.c 27 Jan 2007 18:01:18 -0000 | ||
| 8 | @@ -306,16 +306,16 @@ | ||
| 9 | critical_high_tide = UINT_MAX; | ||
| 10 | |||
| 11 | if (path->freespace_units->warning != NULL) { | ||
| 12 | - warning_high_tide = dtotal_units - path->freespace_units->warning->end; | ||
| 13 | + warning_high_tide = path->freespace_units->warning->end; | ||
| 14 | } | ||
| 15 | if (path->freespace_percent->warning != NULL) { | ||
| 16 | - warning_high_tide = abs( min( (double) warning_high_tide, (double) (1.0 - path->freespace_percent->warning->end/100)*dtotal_units )); | ||
| 17 | + warning_high_tide = abs( min( (double) warning_high_tide, (double) path->freespace_percent->warning->end/100*dtotal_units )); | ||
| 18 | } | ||
| 19 | if (path->freespace_units->critical != NULL) { | ||
| 20 | - critical_high_tide = dtotal_units - path->freespace_units->critical->end; | ||
| 21 | + critical_high_tide = path->freespace_units->critical->end; | ||
| 22 | } | ||
| 23 | if (path->freespace_percent->critical != NULL) { | ||
| 24 | - critical_high_tide = abs( min( (double) critical_high_tide, (double) (1.0 - path->freespace_percent->critical->end/100)*dtotal_units )); | ||
| 25 | + critical_high_tide = abs( min( (double) critical_high_tide, (double) path->freespace_percent->critical->end/100*dtotal_units )); | ||
| 26 | } | ||
| 27 | |||
| 28 | asprintf (&perf, "%s %s", perf, | ||
| 29 | Index: plugins/t/check_disk.t | ||
| 30 | =================================================================== | ||
| 31 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/t/check_disk.t,v | ||
| 32 | retrieving revision 1.16 | ||
| 33 | diff -u -r1.16 check_disk.t | ||
| 34 | --- plugins/t/check_disk.t 8 Jan 2007 11:05:55 -0000 1.16 | ||
| 35 | +++ plugins/t/check_disk.t 27 Jan 2007 18:01:18 -0000 | ||
| 36 | @@ -24,7 +24,7 @@ | ||
| 37 | if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") { | ||
| 38 | plan skip_all => "Need 2 mountpoints to test"; | ||
| 39 | } else { | ||
| 40 | - plan tests => 57; | ||
| 41 | + plan tests => 61; | ||
| 42 | } | ||
| 43 | |||
| 44 | $result = NPTest->testCmd( | ||
| 45 | @@ -76,6 +76,24 @@ | ||
| 46 | die "Two mountpoints with same inodes free - cannot do rest of test"; | ||
| 47 | } | ||
| 48 | |||
| 49 | +# Verify performance data | ||
| 50 | +# First check absolute thresholds... | ||
| 51 | +$result = NPTest->testCmd( | ||
| 52 | + "./check_disk -w 20 -c 10 -p $mountpoint_valid" | ||
| 53 | + ); | ||
| 54 | +$_ = $result->perf_output; | ||
| 55 | +my ($warn_absth_data, $crit_absth_data) = (m/=.[^;]*;(\d+);(\d+);\d+;\d+/); | ||
| 56 | +is ($warn_absth_data, 20, "Wrong warning in perf data using absolute thresholds"); | ||
| 57 | +is ($crit_absth_data, 10, "Wrong critical in perf data using absolute thresholds"); | ||
| 58 | + | ||
| 59 | +# Then check percent thresholds. | ||
| 60 | +$result = NPTest->testCmd( | ||
| 61 | + "./check_disk -w 20% -c 10% -p $mountpoint_valid" | ||
| 62 | + ); | ||
| 63 | +$_ = $result->perf_output; | ||
| 64 | +my ($warn_percth_data, $crit_percth_data, $total_percth_data) = (m/=.[^;]*;(\d+);(\d+);\d+;(\d+)/); | ||
| 65 | +is ($warn_percth_data, int($total_percth_data/100*20), "Wrong warning in perf data using percent thresholds"); | ||
| 66 | +is ($crit_percth_data, int($total_percth_data/100*10), "Wrong critical in perf data using percent thresholds"); | ||
| 67 | |||
| 68 | |||
| 69 | # Check when order of mount points are reversed, that perf data remains same | ||
diff --git a/web/attachments/214858-patch-plugins_check_swap_c b/web/attachments/214858-patch-plugins_check_swap_c new file mode 100644 index 0000000..42efa9f --- /dev/null +++ b/web/attachments/214858-patch-plugins_check_swap_c | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | $OpenBSD$ | ||
| 2 | --- plugins/check_swap.c.orig Wed Feb 7 10:05:35 2007 | ||
| 3 | +++ plugins/check_swap.c Wed Feb 7 10:06:28 2007 | ||
| 4 | @@ -42,14 +42,14 @@ const char *email = "nagiosplug-devel@li | ||
| 5 | #include "utils.h" | ||
| 6 | |||
| 7 | #ifdef HAVE_DECL_SWAPCTL | ||
| 8 | +# ifdef HAVE_SYS_PARAM_H | ||
| 9 | +# include <sys/param.h> | ||
| 10 | +# endif | ||
| 11 | # ifdef HAVE_SYS_SWAP_H | ||
| 12 | # include <sys/swap.h> | ||
| 13 | # endif | ||
| 14 | # ifdef HAVE_SYS_STAT_H | ||
| 15 | # include <sys/stat.h> | ||
| 16 | -# endif | ||
| 17 | -# ifdef HAVE_SYS_PARAM_H | ||
| 18 | -# include <sys/param.h> | ||
| 19 | # endif | ||
| 20 | #endif | ||
| 21 | |||
diff --git a/web/attachments/215428-check_http.c.diff b/web/attachments/215428-check_http.c.diff new file mode 100644 index 0000000..30fbfba --- /dev/null +++ b/web/attachments/215428-check_http.c.diff | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-3 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378822323" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378822323" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378822323" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378822323" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378822323'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1657280&group_id=29880&atid=397599&file_id=215428" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/215430-check_http.c.diff b/web/attachments/215430-check_http.c.diff new file mode 100644 index 0000000..488f549 --- /dev/null +++ b/web/attachments/215430-check_http.c.diff | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | --- nagios-plugins-1.4.6.orig/plugins/check_http.c 2007-01-29 06:46:40.000000000 +0900 | ||
| 2 | +++ nagios-plugins-1.4.6/plugins/check_http.c 2007-02-11 21:03:21.000000000 +0900 | ||
| 3 | @@ -175,15 +175,16 @@ | ||
| 4 | int option = 0; | ||
| 5 | static struct option longopts[] = { | ||
| 6 | STD_LONG_OPTS, | ||
| 7 | - {"file",required_argument,0,'F'}, | ||
| 8 | {"link", no_argument, 0, 'L'}, | ||
| 9 | {"nohtml", no_argument, 0, 'n'}, | ||
| 10 | {"ssl", no_argument, 0, 'S'}, | ||
| 11 | - {"verbose", no_argument, 0, 'v'}, | ||
| 12 | {"post", required_argument, 0, 'P'}, | ||
| 13 | {"IP-address", required_argument, 0, 'I'}, | ||
| 14 | {"url", required_argument, 0, 'u'}, | ||
| 15 | + {"port", required_argument, 0, 'p'}, | ||
| 16 | + {"authorization", required_argument, 0, 'a'}, | ||
| 17 | {"string", required_argument, 0, 's'}, | ||
| 18 | + {"expect", required_argument, 0, 'e'}, | ||
| 19 | {"regex", required_argument, 0, 'r'}, | ||
| 20 | {"ereg", required_argument, 0, 'r'}, | ||
| 21 | {"eregi", required_argument, 0, 'R'}, | ||
| 22 | @@ -1295,7 +1296,7 @@ | ||
| 23 | printf (" %s\n", _("String to be sent in http header as \"User Agent\"")); | ||
| 24 | printf (" %s\n", "-k, --header=STRING"); | ||
| 25 | printf (" %s\n", _(" Any other tags to be sent in http header. Use multiple times for additional headers")); | ||
| 26 | - printf (" %s\n", "-L, --link=URL"); | ||
| 27 | + printf (" %s\n", "-L, --link"); | ||
| 28 | printf (" %s\n", _("Wrap output in HTML link (obsoleted by urlize)")); | ||
| 29 | printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow>"); | ||
| 30 | printf (" %s\n", _("How to handle redirected pages")); | ||
diff --git a/web/attachments/216171-check_hpjd_jetreadysupport.patch b/web/attachments/216171-check_hpjd_jetreadysupport.patch new file mode 100644 index 0000000..f33c934 --- /dev/null +++ b/web/attachments/216171-check_hpjd_jetreadysupport.patch | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | diff -Naur nagios-plugins-1.4.5-orig/plugins/check_hpjd.c nagios-plugins-1.4.5/plugins/check_hpjd.c | ||
| 2 | --- nagios-plugins-1.4.5-orig/plugins/check_hpjd.c 2006-10-18 20:25:16.000000000 -0400 | ||
| 3 | +++ nagios-plugins-1.4.5/plugins/check_hpjd.c 2007-02-15 12:31:34.000000000 -0500 | ||
| 4 | @@ -64,6 +64,11 @@ | ||
| 5 | |||
| 6 | #define ONLINE 0 | ||
| 7 | #define OFFLINE 1 | ||
| 8 | +#define JAONLINE 1 | ||
| 9 | +#define JAOFFLINE 0 | ||
| 10 | + | ||
| 11 | +#define JETDIRECT 0 | ||
| 12 | +#define JETREADY 1 | ||
| 13 | |||
| 14 | int process_arguments (int, char **); | ||
| 15 | int validate_arguments (void); | ||
| 16 | @@ -71,6 +76,7 @@ | ||
| 17 | void print_usage (void); | ||
| 18 | |||
| 19 | char *community = NULL; | ||
| 20 | +char *jd_type = JETDIRECT; // default to JetDirect type | ||
| 21 | char *address = NULL; | ||
| 22 | |||
| 23 | int | ||
| 24 | @@ -245,8 +251,8 @@ | ||
| 25 | result = STATE_WARNING; | ||
| 26 | strcpy (errmsg, _("Out of Paper")); | ||
| 27 | } | ||
| 28 | - else if (line_status == OFFLINE) { | ||
| 29 | - if (strcmp (errmsg, "POWERSAVE ON") != 0) { | ||
| 30 | + else if ((line_status == OFFLINE && jd_type == JETDIRECT) || (line_status == JAOFFLINE && jd_type == JETREADY)) { | ||
| 31 | + if ((strcmp (errmsg, "POWERSAVE ON") != 0) || (strcmp (errmsg, "Sleep mode on") != 0)) { | ||
| 32 | result = STATE_WARNING; | ||
| 33 | strcpy (errmsg, _("Printer Offline")); | ||
| 34 | } | ||
| 35 | @@ -317,6 +323,7 @@ | ||
| 36 | /* {"critical", required_argument,0,'c'}, */ | ||
| 37 | /* {"warning", required_argument,0,'w'}, */ | ||
| 38 | /* {"port", required_argument,0,'P'}, */ | ||
| 39 | + {"jetready", no_argument, 0, 'A'}, | ||
| 40 | {"version", no_argument, 0, 'V'}, | ||
| 41 | {"help", no_argument, 0, 'h'}, | ||
| 42 | {0, 0, 0, 0} | ||
| 43 | @@ -327,7 +334,7 @@ | ||
| 44 | |||
| 45 | |||
| 46 | while (1) { | ||
| 47 | - c = getopt_long (argc, argv, "+hVH:C:", longopts, &option); | ||
| 48 | + c = getopt_long (argc, argv, "+hVAH:C:", longopts, &option); | ||
| 49 | |||
| 50 | if (c == -1 || c == EOF || c == 1) | ||
| 51 | break; | ||
| 52 | @@ -344,6 +351,9 @@ | ||
| 53 | case 'C': /* community */ | ||
| 54 | community = strscpy (community, optarg); | ||
| 55 | break; | ||
| 56 | + case 'A': /* change jd type */ | ||
| 57 | + jd_type = JETREADY; | ||
| 58 | + break; | ||
| 59 | case 'V': /* version */ | ||
| 60 | print_revision (progname, revision); | ||
| 61 | exit (STATE_OK); | ||
| 62 | @@ -400,6 +410,8 @@ | ||
| 63 | |||
| 64 | printf (_(UT_HELP_VRSN)); | ||
| 65 | |||
| 66 | + printf (" %s\n", "-A, --jetready"); | ||
| 67 | + printf (" %s", _("Change logic from assuming JetDirect to JetReady support")); | ||
| 68 | printf (" %s\n", "-C, --community=STRING"); | ||
| 69 | printf (" %s", _("The SNMP community name ")); | ||
| 70 | printf (_("(default=%s)"), DEFAULT_COMMUNITY); | ||
| 71 | @@ -413,5 +425,5 @@ | ||
| 72 | print_usage (void) | ||
| 73 | { | ||
| 74 | printf (_("Usage:")); | ||
| 75 | - printf ("%s -H host [-C community]\n", progname); | ||
| 76 | + printf ("%s -H host [-a] [-C community]\n", progname); | ||
| 77 | } | ||
diff --git a/web/attachments/216487-check_ntp.patch b/web/attachments/216487-check_ntp.patch new file mode 100644 index 0000000..6fbea15 --- /dev/null +++ b/web/attachments/216487-check_ntp.patch | |||
| @@ -0,0 +1,150 @@ | |||
| 1 | *** nagios-plugins-1.4.6-orig/plugins/check_ntp.c 2007-01-28 16:46:40.000000000 -0500 | ||
| 2 | --- nagios-plugins-1.4.6/plugins/check_ntp.c 2007-02-17 17:17:20.000000000 -0500 | ||
| 3 | *************** static double ocrit=120; | ||
| 4 | *** 53,58 **** | ||
| 5 | --- 53,62 ---- | ||
| 6 | static short do_jitter=0; | ||
| 7 | static double jwarn=5000; | ||
| 8 | static double jcrit=10000; | ||
| 9 | + static short do_stratum=0; | ||
| 10 | + static int swarn=4; | ||
| 11 | + static int scrit=15; | ||
| 12 | + static int max_stratum=0; | ||
| 13 | |||
| 14 | int process_arguments (int, char **); | ||
| 15 | void print_help (void); | ||
| 16 | *************** double offset_request(const char *host, | ||
| 17 | *** 447,452 **** | ||
| 18 | --- 451,459 ---- | ||
| 19 | if(verbose) { | ||
| 20 | printf("offset %.10g\n", servers[i].offset[respnum]); | ||
| 21 | } | ||
| 22 | + if (req[i].stratum > max_stratum) { | ||
| 23 | + max_stratum = req[i].stratum; | ||
| 24 | + } | ||
| 25 | servers[i].stratum=req[i].stratum; | ||
| 26 | servers[i].rtdisp=NTP32asDOUBLE(req[i].rtdisp); | ||
| 27 | servers[i].rtdelay=NTP32asDOUBLE(req[i].rtdelay); | ||
| 28 | *************** int process_arguments(int argc, char **a | ||
| 29 | *** 631,636 **** | ||
| 30 | --- 638,645 ---- | ||
| 31 | {"zero-offset", no_argument, 0, 'O'}, | ||
| 32 | {"jwarn", required_argument, 0, 'j'}, | ||
| 33 | {"jcrit", required_argument, 0, 'k'}, | ||
| 34 | + {"swarn", required_argument, 0, 's'}, | ||
| 35 | + {"scrit", required_argument, 0, 'S'}, | ||
| 36 | {"timeout", required_argument, 0, 't'}, | ||
| 37 | {"hostname", required_argument, 0, 'H'}, | ||
| 38 | {0, 0, 0, 0} | ||
| 39 | *************** int process_arguments(int argc, char **a | ||
| 40 | *** 641,647 **** | ||
| 41 | usage ("\n"); | ||
| 42 | |||
| 43 | while (1) { | ||
| 44 | ! c = getopt_long (argc, argv, "Vhv46w:c:Oj:k:t:H:", longopts, &option); | ||
| 45 | if (c == -1 || c == EOF || c == 1) | ||
| 46 | break; | ||
| 47 | |||
| 48 | --- 650,656 ---- | ||
| 49 | usage ("\n"); | ||
| 50 | |||
| 51 | while (1) { | ||
| 52 | ! c = getopt_long (argc, argv, "Vhv46w:c:Oj:k:t:H:s:S:", longopts, &option); | ||
| 53 | if (c == -1 || c == EOF || c == 1) | ||
| 54 | break; | ||
| 55 | |||
| 56 | *************** int process_arguments(int argc, char **a | ||
| 57 | *** 671,676 **** | ||
| 58 | --- 680,693 ---- | ||
| 59 | do_jitter=1; | ||
| 60 | jcrit = atof(optarg); | ||
| 61 | break; | ||
| 62 | + case 's': | ||
| 63 | + do_stratum=1; | ||
| 64 | + swarn = atoi(optarg); | ||
| 65 | + break; | ||
| 66 | + case 'S': | ||
| 67 | + do_stratum=1; | ||
| 68 | + scrit = atoi(optarg); | ||
| 69 | + break; | ||
| 70 | case 'H': | ||
| 71 | if(is_host(optarg) == FALSE) | ||
| 72 | usage2(_("Invalid hostname/address"), optarg); | ||
| 73 | *************** int process_arguments(int argc, char **a | ||
| 74 | *** 703,712 **** | ||
| 75 | usage4(_("Critical offset should be larger than warning offset")); | ||
| 76 | } | ||
| 77 | |||
| 78 | ! if (ocrit < owarn){ | ||
| 79 | usage4(_("Critical jitter should be larger than warning jitter")); | ||
| 80 | } | ||
| 81 | |||
| 82 | if(server_address == NULL){ | ||
| 83 | usage4(_("Hostname was not supplied")); | ||
| 84 | } | ||
| 85 | --- 720,733 ---- | ||
| 86 | usage4(_("Critical offset should be larger than warning offset")); | ||
| 87 | } | ||
| 88 | |||
| 89 | ! if (jcrit < jwarn){ | ||
| 90 | usage4(_("Critical jitter should be larger than warning jitter")); | ||
| 91 | } | ||
| 92 | |||
| 93 | + if (scrit < swarn){ | ||
| 94 | + usage4(_("Critical stratum should be larger than warning stratum")); | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | if(server_address == NULL){ | ||
| 98 | usage4(_("Hostname was not supplied")); | ||
| 99 | } | ||
| 100 | *************** int main(int argc, char *argv[]){ | ||
| 101 | *** 758,763 **** | ||
| 102 | --- 779,792 ---- | ||
| 103 | } | ||
| 104 | result=max_state(result, jitter_result); | ||
| 105 | |||
| 106 | + if(do_stratum){ | ||
| 107 | + if (max_stratum >= scrit){ | ||
| 108 | + result - max_state(result, STATE_CRITICAL); | ||
| 109 | + } else if(max_stratum >= swarn) { | ||
| 110 | + result = max_state(result, STATE_WARNING); | ||
| 111 | + } | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | switch (result) { | ||
| 115 | case STATE_CRITICAL : | ||
| 116 | printf("NTP CRITICAL: "); | ||
| 117 | *************** int main(int argc, char *argv[]){ | ||
| 118 | *** 778,784 **** | ||
| 119 | if(offset_result==STATE_WARNING){ | ||
| 120 | printf("Unable to fully sample sync server. "); | ||
| 121 | } | ||
| 122 | ! printf("Offset %.10g secs|offset=%.10g", offset, offset); | ||
| 123 | } | ||
| 124 | if (do_jitter) printf(" jitter=%f", jitter); | ||
| 125 | printf("\n"); | ||
| 126 | --- 807,817 ---- | ||
| 127 | if(offset_result==STATE_WARNING){ | ||
| 128 | printf("Unable to fully sample sync server. "); | ||
| 129 | } | ||
| 130 | ! printf("Offset %.10g secs", offset); | ||
| 131 | ! if (do_stratum) { | ||
| 132 | ! printf(", max Stratum %d", max_stratum); | ||
| 133 | ! } | ||
| 134 | ! printf("|offset=%.10g", offset); | ||
| 135 | } | ||
| 136 | if (do_jitter) printf(" jitter=%f", jitter); | ||
| 137 | printf("\n"); | ||
| 138 | *************** void print_help(void){ | ||
| 139 | *** 804,809 **** | ||
| 140 | --- 837,846 ---- | ||
| 141 | printf (_(UT_HOST_PORT), 'p', "123"); | ||
| 142 | printf (_(UT_WARN_CRIT)); | ||
| 143 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
| 144 | + printf (" -j, --jwarn=DOUBLE\n Jitter level to result in warning status\n"); | ||
| 145 | + printf (" -k, --jcrit=DOUBLE\n Jitter level to result in critical status\n"); | ||
| 146 | + printf (" -s, --swarn=INTEGER\n Stratum clock level to result in warning status\n"); | ||
| 147 | + printf (" -S, --scrit=INTEGER\n Stratum clock level to result in critical status\n"); | ||
| 148 | printf (_(UT_VERBOSE)); | ||
| 149 | printf (_(UT_SUPPORT)); | ||
| 150 | } | ||
diff --git a/web/attachments/216525-check_dhcp-osx.patch b/web/attachments/216525-check_dhcp-osx.patch new file mode 100644 index 0000000..16c5319 --- /dev/null +++ b/web/attachments/216525-check_dhcp-osx.patch | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | --- plugins-root/check_dhcp.c 28 Jan 2007 21:46:41 -0000 1.8 | ||
| 2 | +++ plugins-root/check_dhcp.c 18 Feb 2007 08:05:59 -0000 | ||
| 3 | @@ -65,7 +65,7 @@ | ||
| 4 | #include <linux/if_ether.h> | ||
| 5 | #include <features.h> | ||
| 6 | |||
| 7 | -#elif defined (__bsd__) | ||
| 8 | +#elif defined (__bsd__) || defined (__APPLE__) | ||
| 9 | |||
| 10 | #include <netinet/if_ether.h> | ||
| 11 | #include <sys/param.h> | ||
| 12 | @@ -301,7 +301,7 @@ | ||
| 13 | |||
| 14 | memcpy(&client_hardware_address[0],&ifr.ifr_hwaddr.sa_data,6); | ||
| 15 | |||
| 16 | -#elif defined(__bsd__) | ||
| 17 | +#elif defined(__bsd__) || defined(__APPLE__) | ||
| 18 | /* King 2004 see ACKNOWLEDGEMENTS */ | ||
| 19 | |||
| 20 | int mib[6], len; | ||
diff --git a/web/attachments/217297-check_procs b/web/attachments/217297-check_procs new file mode 100644 index 0000000..4c67842 --- /dev/null +++ b/web/attachments/217297-check_procs | |||
| Binary files differ | |||
diff --git a/web/attachments/217472-check_dhcp.c.patch b/web/attachments/217472-check_dhcp.c.patch new file mode 100644 index 0000000..d9b69e0 --- /dev/null +++ b/web/attachments/217472-check_dhcp.c.patch | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | --- nagios-plugins-HEAD-200702121300/plugins-root/check_dhcp.c 2007-01-28 22:46:41.000000000 +0100 | ||
| 2 | +++ nagios-plugins-HEAD-200702121300/plugins-root/check_dhcp.c 2007-02-23 22:36:30.200102288 +0100 | ||
| 3 | @@ -182,6 +182,7 @@ typedef struct requested_server_struct{ | ||
| 4 | #define DHCP_OPTION_BROADCAST_ADDRESS 28 | ||
| 5 | #define DHCP_OPTION_REQUESTED_ADDRESS 50 | ||
| 6 | #define DHCP_OPTION_LEASE_TIME 51 | ||
| 7 | +#define DHCP_OPTION_SERVER_IDENTIFIER 54 | ||
| 8 | #define DHCP_OPTION_RENEWAL_TIME 58 | ||
| 9 | #define DHCP_OPTION_REBINDING_TIME 59 | ||
| 10 | |||
| 11 | @@ -768,6 +769,7 @@ int add_dhcp_offer(struct in_addr source | ||
| 12 | int y; | ||
| 13 | unsigned option_type; | ||
| 14 | unsigned option_length; | ||
| 15 | + struct in_addr serv_ident = {0}; | ||
| 16 | |||
| 17 | if(offer_packet==NULL) | ||
| 18 | return ERROR; | ||
| 19 | @@ -789,23 +791,27 @@ int add_dhcp_offer(struct in_addr source | ||
| 20 | printf("Option: %d (0x%02X)\n",option_type,option_length); | ||
| 21 | |||
| 22 | /* get option data */ | ||
| 23 | - if(option_type==DHCP_OPTION_LEASE_TIME){ | ||
| 24 | - memcpy(&dhcp_lease_time, &offer_packet->options[x],sizeof(dhcp_lease_time)); | ||
| 25 | + switch(option_type) { | ||
| 26 | + case DHCP_OPTION_LEASE_TIME: | ||
| 27 | + memcpy(&dhcp_lease_time,offer_packet->options+x,sizeof dhcp_lease_time); | ||
| 28 | dhcp_lease_time = ntohl(dhcp_lease_time); | ||
| 29 | - } | ||
| 30 | - if(option_type==DHCP_OPTION_RENEWAL_TIME){ | ||
| 31 | - memcpy(&dhcp_renewal_time, &offer_packet->options[x],sizeof(dhcp_renewal_time)); | ||
| 32 | + break; | ||
| 33 | + case DHCP_OPTION_RENEWAL_TIME: | ||
| 34 | + memcpy(&dhcp_renewal_time,offer_packet->options+x,sizeof dhcp_renewal_time); | ||
| 35 | dhcp_renewal_time = ntohl(dhcp_renewal_time); | ||
| 36 | - } | ||
| 37 | - if(option_type==DHCP_OPTION_REBINDING_TIME){ | ||
| 38 | - memcpy(&dhcp_rebinding_time, &offer_packet->options[x],sizeof(dhcp_rebinding_time)); | ||
| 39 | + break; | ||
| 40 | + case DHCP_OPTION_REBINDING_TIME: | ||
| 41 | + memcpy(&dhcp_rebinding_time,offer_packet->options+x,sizeof dhcp_rebinding_time); | ||
| 42 | dhcp_rebinding_time = ntohl(dhcp_rebinding_time); | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | + break; | ||
| 46 | + case DHCP_OPTION_SERVER_IDENTIFIER: | ||
| 47 | + memcpy(&serv_ident.s_addr,offer_packet->options+x,sizeof serv_ident.s_addr); | ||
| 48 | + break; | ||
| 49 | + } | ||
| 50 | /* skip option data we're ignoring */ | ||
| 51 | - else | ||
| 52 | - for(y=0;y<option_length;y++,x++); | ||
| 53 | - } | ||
| 54 | + if(option_type!=DHCP_OPTION_REBINDING_TIME) | ||
| 55 | + x+=option_length; | ||
| 56 | + } | ||
| 57 | |||
| 58 | if(verbose){ | ||
| 59 | if(dhcp_lease_time==DHCP_INFINITE_TIME) | ||
| 60 | @@ -819,14 +825,14 @@ int add_dhcp_offer(struct in_addr source | ||
| 61 | if(dhcp_rebinding_time==DHCP_INFINITE_TIME) | ||
| 62 | printf(_("Rebinding Time: Infinite\n")); | ||
| 63 | printf(_("Rebinding Time: %lu seconds\n"),(unsigned long)dhcp_rebinding_time); | ||
| 64 | - } | ||
| 65 | + } | ||
| 66 | |||
| 67 | new_offer=(dhcp_offer *)malloc(sizeof(dhcp_offer)); | ||
| 68 | |||
| 69 | if(new_offer==NULL) | ||
| 70 | return ERROR; | ||
| 71 | |||
| 72 | - new_offer->server_address=source; | ||
| 73 | + new_offer->server_address=serv_ident.s_addr?serv_ident:source; | ||
| 74 | new_offer->offered_address=offer_packet->yiaddr; | ||
| 75 | new_offer->lease_time=dhcp_lease_time; | ||
| 76 | new_offer->renewal_time=dhcp_renewal_time; | ||
| 77 | @@ -836,14 +842,14 @@ int add_dhcp_offer(struct in_addr source | ||
| 78 | if(verbose){ | ||
| 79 | printf(_("Added offer from server @ %s"),inet_ntoa(new_offer->server_address)); | ||
| 80 | printf(_(" of IP address %s\n"),inet_ntoa(new_offer->offered_address)); | ||
| 81 | - } | ||
| 82 | + } | ||
| 83 | |||
| 84 | /* add new offer to head of list */ | ||
| 85 | new_offer->next=dhcp_offer_list; | ||
| 86 | dhcp_offer_list=new_offer; | ||
| 87 | |||
| 88 | return OK; | ||
| 89 | - } | ||
| 90 | +} | ||
| 91 | |||
| 92 | |||
| 93 | /* frees memory allocated to DHCP OFFER list */ | ||
diff --git a/web/attachments/221749-check_snmp_sourceip.patch b/web/attachments/221749-check_snmp_sourceip.patch new file mode 100644 index 0000000..2bba2f4 --- /dev/null +++ b/web/attachments/221749-check_snmp_sourceip.patch | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | --- check_snmp.c.orig 2007-03-22 15:24:22.000000000 +0100 | ||
| 2 | +++ check_snmp.c 2007-03-22 15:23:00.000000000 +0100 | ||
| 3 | @@ -103,6 +103,7 @@ | ||
| 4 | int errcode, excode; | ||
| 5 | |||
| 6 | char *server_address = NULL; | ||
| 7 | +char *client_address = NULL; | ||
| 8 | char *community = NULL; | ||
| 9 | char *authpriv = NULL; | ||
| 10 | char *proto = NULL; | ||
| 11 | @@ -183,11 +184,22 @@ | ||
| 12 | |||
| 13 | /* create the command line to execute */ | ||
| 14 | if(usesnmpgetnext == TRUE) { | ||
| 15 | + if (client_address != NULL) | ||
| 16 | + asprintf(&command_line, "%s --clientaddr=%s -t %d -r %d -m %s -v %s %s %s:%s %s", | ||
| 17 | + PATH_TO_SNMPGETNEXT, client_address, timeout_interval, retries, miblist, proto, | ||
| 18 | + authpriv, server_address, port, oid); | ||
| 19 | + if (client_address == NULL) | ||
| 20 | asprintf(&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s", | ||
| 21 | PATH_TO_SNMPGETNEXT, timeout_interval, retries, miblist, proto, | ||
| 22 | authpriv, server_address, port, oid); | ||
| 23 | }else{ | ||
| 24 | |||
| 25 | + if (client_address != NULL) | ||
| 26 | + asprintf (&command_line, "%s --clientaddr=%s -t %d -r %d -m %s -v %s %s %s:%s %s", | ||
| 27 | + PATH_TO_SNMPGET, client_address, timeout_interval, retries, miblist, proto, | ||
| 28 | + authpriv, server_address, port, oid); | ||
| 29 | + | ||
| 30 | + if (client_address == NULL) | ||
| 31 | asprintf (&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s", | ||
| 32 | PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto, | ||
| 33 | authpriv, server_address, port, oid); | ||
| 34 | @@ -398,6 +410,7 @@ | ||
| 35 | static struct option longopts[] = { | ||
| 36 | STD_LONG_OPTS, | ||
| 37 | {"community", required_argument, 0, 'C'}, | ||
| 38 | + {"source", required_argument, 0, 'S'}, | ||
| 39 | {"oid", required_argument, 0, 'o'}, | ||
| 40 | {"object", required_argument, 0, 'o'}, | ||
| 41 | {"delimiter", required_argument, 0, 'd'}, | ||
| 42 | @@ -436,7 +449,7 @@ | ||
| 43 | } | ||
| 44 | |||
| 45 | while (1) { | ||
| 46 | - c = getopt_long (argc, argv, "nhvVt:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:L:U:a:A:X:", | ||
| 47 | + c = getopt_long (argc, argv, "nhvVt:c:w:H:S:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:L:U:a:A:X:", | ||
| 48 | longopts, &option); | ||
| 49 | |||
| 50 | if (c == -1 || c == EOF) | ||
| 51 | @@ -462,6 +475,9 @@ | ||
| 52 | case 'H': /* Host or server */ | ||
| 53 | server_address = optarg; | ||
| 54 | break; | ||
| 55 | + case 'S': /* Client source address */ | ||
| 56 | + client_address = optarg; | ||
| 57 | + break; | ||
| 58 | case 'p': /* TCP port number */ | ||
| 59 | port = optarg; | ||
| 60 | break; | ||
| 61 | @@ -919,6 +935,8 @@ | ||
| 62 | /* SNMP and Authentication Protocol */ | ||
| 63 | printf (" %s\n", "-n, --next"); | ||
| 64 | printf (" %s\n", _("Use SNMP GETNEXT instead of SNMP GET")); | ||
| 65 | + printf (" %s\n", "-S, --source=ADDRESS"); | ||
| 66 | + printf (" %s\n", _("Specify SNMP client source address")); | ||
| 67 | printf (" %s\n", "-P, --protocol=[1|2c|3]"); | ||
| 68 | printf (" %s\n", _("SNMP protocol version")); | ||
| 69 | printf (" %s\n", "-L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]"); | ||
| 70 | @@ -1005,7 +1023,7 @@ | ||
| 71 | print_usage (void) | ||
| 72 | { | ||
| 73 | printf (_("Usage:")); | ||
| 74 | - printf ("%s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range]\n",progname); | ||
| 75 | + printf ("%s -H <ip_address> -o <OID> [-S source_ip_address] [-w warn_range] [-c crit_range]\n",progname); | ||
| 76 | printf ("[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]\n"); | ||
| 77 | printf ("[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]\n"); | ||
| 78 | printf ("[-m miblist] [-P snmp version] [-L seclevel] [-U secname] [-a authproto]\n"); | ||
diff --git a/web/attachments/222424-check_icmp.32bit-pid_t.patch b/web/attachments/222424-check_icmp.32bit-pid_t.patch new file mode 100644 index 0000000..a3154ed --- /dev/null +++ b/web/attachments/222424-check_icmp.32bit-pid_t.patch | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | Index: plugins-root/check_icmp.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins-root/check_icmp.c,v | ||
| 4 | retrieving revision 1.11 | ||
| 5 | diff -u -r1.11 check_icmp.c | ||
| 6 | --- plugins-root/check_icmp.c 8 Mar 2007 09:09:38 -0000 1.11 | ||
| 7 | +++ plugins-root/check_icmp.c 27 Mar 2007 06:29:32 -0000 | ||
| 8 | @@ -395,7 +395,8 @@ | ||
| 9 | environ = NULL; | ||
| 10 | |||
| 11 | /* use the pid to mark packets as ours */ | ||
| 12 | - pid = getpid(); | ||
| 13 | + /* Some systems have 32-bit pid_t so mask off only 16 bits */ | ||
| 14 | + pid = getpid() & 0xffff; | ||
| 15 | /* printf("pid = %u\n", pid); */ | ||
| 16 | |||
| 17 | /* get calling name the old-fashioned way for portability instead | ||
diff --git a/web/attachments/222519-check_smtp.c.patch b/web/attachments/222519-check_smtp.c.patch new file mode 100644 index 0000000..96e6f9d --- /dev/null +++ b/web/attachments/222519-check_smtp.c.patch | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | --- check_smtp.c.orig 2007-03-27 10:20:06.000000000 -0400 | ||
| 2 | +++ check_smtp.c 2007-03-27 10:20:58.000000000 -0400 | ||
| 3 | @@ -190,9 +190,9 @@ | ||
| 4 | printf(_("gethostname() failed!\n")); | ||
| 5 | return STATE_CRITICAL; | ||
| 6 | } | ||
| 7 | - } else { | ||
| 8 | - helocmd = localhostname; | ||
| 9 | } | ||
| 10 | + helocmd = localhostname; | ||
| 11 | + | ||
| 12 | if(use_ehlo) | ||
| 13 | asprintf (&helocmd, "%s%s%s", SMTP_EHLO, helocmd, "\r\n"); | ||
| 14 | else | ||
diff --git a/web/attachments/222809-check_ntp.startofvalue.patch b/web/attachments/222809-check_ntp.startofvalue.patch new file mode 100644 index 0000000..998102b --- /dev/null +++ b/web/attachments/222809-check_ntp.startofvalue.patch | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | Index: plugins/check_ntp.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ntp.c,v | ||
| 4 | retrieving revision 1.13 | ||
| 5 | diff -u -r1.13 check_ntp.c | ||
| 6 | --- plugins/check_ntp.c 28 Jan 2007 21:46:40 -0000 1.13 | ||
| 7 | +++ plugins/check_ntp.c 29 Mar 2007 11:33:26 -0000 | ||
| 8 | @@ -590,7 +590,8 @@ | ||
| 9 | if(verbose) { | ||
| 10 | printf("parsing jitter from peer %.2x: ", peers[i].assoc); | ||
| 11 | } | ||
| 12 | - startofvalue = strchr(req.data, '=') + 1; | ||
| 13 | + startofvalue = strchr(req.data, '='); | ||
| 14 | + if(startofvalue != NULL) startofvalue++; | ||
| 15 | if(startofvalue != NULL) { | ||
| 16 | jitter = strtod(startofvalue, &nptr); | ||
| 17 | } | ||
diff --git a/web/attachments/226292-check_by_ssh.c b/web/attachments/226292-check_by_ssh.c new file mode 100644 index 0000000..237d5b6 --- /dev/null +++ b/web/attachments/226292-check_by_ssh.c | |||
| @@ -0,0 +1,388 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | * | ||
| 3 | * Nagios check_by_ssh plugin | ||
| 4 | * | ||
| 5 | * License: GPL | ||
| 6 | * Copyright (c) 1999-2006 nagios-plugins team | ||
| 7 | * | ||
| 8 | * Last Modified: $Date: 2007/01/28 21:46:40 $ | ||
| 9 | * | ||
| 10 | * Description: | ||
| 11 | * | ||
| 12 | * This file contains the check_by_ssh plugin | ||
| 13 | * | ||
| 14 | * License Information: | ||
| 15 | * | ||
| 16 | * This program is free software; you can redistribute it and/or modify | ||
| 17 | * it under the terms of the GNU General Public License as published by | ||
| 18 | * the Free Software Foundation; either version 2 of the License, or | ||
| 19 | * (at your option) any later version. | ||
| 20 | * | ||
| 21 | * This program is distributed in the hope that it will be useful, | ||
| 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 24 | * GNU General Public License for more details. | ||
| 25 | * | ||
| 26 | * You should have received a copy of the GNU General Public License | ||
| 27 | * along with this program; if not, write to the Free Software | ||
| 28 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 29 | * | ||
| 30 | * $Id: check_by_ssh.c,v 1.41 2007/01/28 21:46:40 hweiss Exp $ | ||
| 31 | * | ||
| 32 | ******************************************************************************/ | ||
| 33 | |||
| 34 | const char *progname = "check_by_ssh"; | ||
| 35 | const char *revision = "$Revision: 1.41 $"; | ||
| 36 | const char *copyright = "2000-2006"; | ||
| 37 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 38 | |||
| 39 | #include "common.h" | ||
| 40 | #include "netutils.h" | ||
| 41 | #include "utils.h" | ||
| 42 | #include "runcmd.h" | ||
| 43 | |||
| 44 | int process_arguments (int, char **); | ||
| 45 | int validate_arguments (void); | ||
| 46 | void print_help (void); | ||
| 47 | void print_usage (void); | ||
| 48 | |||
| 49 | int commands = 0; | ||
| 50 | int services = 0; | ||
| 51 | int skip = 0; | ||
| 52 | char *remotecmd = NULL; | ||
| 53 | char *comm = NULL; | ||
| 54 | char *hostname = NULL; | ||
| 55 | char *outputfile = NULL; | ||
| 56 | char *host_shortname = NULL; | ||
| 57 | char **service; | ||
| 58 | int passive = FALSE; | ||
| 59 | int verbose = FALSE; | ||
| 60 | |||
| 61 | int | ||
| 62 | main (int argc, char **argv) | ||
| 63 | { | ||
| 64 | |||
| 65 | char *status_text; | ||
| 66 | int cresult; | ||
| 67 | int result = STATE_UNKNOWN; | ||
| 68 | int i; | ||
| 69 | time_t local_time; | ||
| 70 | FILE *fp = NULL; | ||
| 71 | struct output chld_out, chld_err; | ||
| 72 | |||
| 73 | remotecmd = ""; | ||
| 74 | comm = strdup (SSH_COMMAND); | ||
| 75 | |||
| 76 | setlocale (LC_ALL, ""); | ||
| 77 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 78 | textdomain (PACKAGE); | ||
| 79 | |||
| 80 | /* process arguments */ | ||
| 81 | if (process_arguments (argc, argv) == ERROR) | ||
| 82 | usage_va(_("Could not parse arguments")); | ||
| 83 | |||
| 84 | /* Set signal handling and alarm timeout */ | ||
| 85 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { | ||
| 86 | usage_va(_("Cannot catch SIGALRM")); | ||
| 87 | } | ||
| 88 | alarm (timeout_interval); | ||
| 89 | |||
| 90 | /* run the command */ | ||
| 91 | if (verbose) | ||
| 92 | printf ("%s\n", comm); | ||
| 93 | |||
| 94 | result = np_runcmd(comm, &chld_out, &chld_err, 0); | ||
| 95 | /* UNKNOWN if output found on stderr */ | ||
| 96 | if(chld_err.buflen && !skip) { | ||
| 97 | printf(_("Remote command execution failed: %s\n"), | ||
| 98 | chld_err.buflen ? chld_err.buf : _("Unknown error")); | ||
| 99 | return STATE_UNKNOWN; | ||
| 100 | } | ||
| 101 | |||
| 102 | /* this is simple if we're not supposed to be passive. | ||
| 103 | * Wrap up quickly and keep the tricks below */ | ||
| 104 | if(!passive) { | ||
| 105 | printf ("%s\n", skip < chld_out.lines ? chld_out.line[skip] : chld_out.buf); | ||
| 106 | return result; /* return error status from remote command */ | ||
| 107 | } | ||
| 108 | |||
| 109 | |||
| 110 | /* | ||
| 111 | * Passive mode | ||
| 112 | */ | ||
| 113 | |||
| 114 | /* process output */ | ||
| 115 | if (!(fp = fopen (outputfile, "a"))) { | ||
| 116 | printf (_("SSH WARNING: could not open %s\n"), outputfile); | ||
| 117 | exit (STATE_UNKNOWN); | ||
| 118 | } | ||
| 119 | |||
| 120 | local_time = time (NULL); | ||
| 121 | commands = 0; | ||
| 122 | for(i = skip; chld_out.line[i]; i++) { | ||
| 123 | status_text = strstr (chld_out.line[i], "STATUS CODE: "); | ||
| 124 | if (status_text == NULL) { | ||
| 125 | printf ("%s", chld_out.line[i]); | ||
| 126 | return result; | ||
| 127 | } | ||
| 128 | if (service[commands] && status_text | ||
| 129 | && sscanf (status_text, "STATUS CODE: %d", &cresult) == 1) | ||
| 130 | { | ||
| 131 | fprintf (fp, "[%d] PROCESS_SERVICE_CHECK_RESULT;%s;%s;%d;%s\n", | ||
| 132 | (int) local_time, host_shortname, service[commands++], | ||
| 133 | cresult, chld_out.line[i]); | ||
| 134 | } | ||
| 135 | } | ||
| 136 | |||
| 137 | /* force an OK state */ | ||
| 138 | return result; | ||
| 139 | } | ||
| 140 | |||
| 141 | /* process command-line arguments */ | ||
| 142 | int | ||
| 143 | process_arguments (int argc, char **argv) | ||
| 144 | { | ||
| 145 | int c; | ||
| 146 | char *p1, *p2; | ||
| 147 | |||
| 148 | int option = 0; | ||
| 149 | static struct option longopts[] = { | ||
| 150 | {"version", no_argument, 0, 'V'}, | ||
| 151 | {"help", no_argument, 0, 'h'}, | ||
| 152 | {"verbose", no_argument, 0, 'v'}, | ||
| 153 | {"fork", no_argument, 0, 'f'}, | ||
| 154 | {"timeout", required_argument, 0, 't'}, | ||
| 155 | {"host", required_argument, 0, 'H'}, | ||
| 156 | {"port", required_argument,0,'p'}, | ||
| 157 | {"output", required_argument, 0, 'O'}, | ||
| 158 | {"name", required_argument, 0, 'n'}, | ||
| 159 | {"services", required_argument, 0, 's'}, | ||
| 160 | {"identity", required_argument, 0, 'i'}, | ||
| 161 | {"user", required_argument, 0, 'u'}, | ||
| 162 | {"logname", required_argument, 0, 'l'}, | ||
| 163 | {"command", required_argument, 0, 'C'}, | ||
| 164 | {"skip", required_argument, 0, 'S'}, | ||
| 165 | {"proto1", no_argument, 0, '1'}, | ||
| 166 | {"proto2", no_argument, 0, '2'}, | ||
| 167 | {"use-ipv4", no_argument, 0, '4'}, | ||
| 168 | {"use-ipv6", no_argument, 0, '6'}, | ||
| 169 | {"ssh-option", required_argument, 0, 'o'}, | ||
| 170 | {"quiet", no_argument, 0, 'q'}, | ||
| 171 | {0, 0, 0, 0} | ||
| 172 | }; | ||
| 173 | |||
| 174 | if (argc < 2) | ||
| 175 | return ERROR; | ||
| 176 | |||
| 177 | for (c = 1; c < argc; c++) | ||
| 178 | if (strcmp ("-to", argv[c]) == 0) | ||
| 179 | strcpy (argv[c], "-t"); | ||
| 180 | |||
| 181 | while (1) { | ||
| 182 | c = getopt_long (argc, argv, "Vvh1246fqt:H:O:p:i:u:l:C:S:n:s:o:", longopts, | ||
| 183 | &option); | ||
| 184 | |||
| 185 | if (c == -1 || c == EOF) | ||
| 186 | break; | ||
| 187 | |||
| 188 | switch (c) { | ||
| 189 | case 'V': /* version */ | ||
| 190 | print_revision (progname, revision); | ||
| 191 | exit (STATE_OK); | ||
| 192 | case 'h': /* help */ | ||
| 193 | print_help (); | ||
| 194 | exit (STATE_OK); | ||
| 195 | case 'v': /* help */ | ||
| 196 | verbose = TRUE; | ||
| 197 | break; | ||
| 198 | case 't': /* timeout period */ | ||
| 199 | if (!is_integer (optarg)) | ||
| 200 | usage_va(_("Timeout interval must be a positive integer")); | ||
| 201 | else | ||
| 202 | timeout_interval = atoi (optarg); | ||
| 203 | break; | ||
| 204 | case 'H': /* host */ | ||
| 205 | host_or_die(optarg); | ||
| 206 | hostname = optarg; | ||
| 207 | break; | ||
| 208 | case 'p': /* port number */ | ||
| 209 | if (!is_integer (optarg)) | ||
| 210 | usage_va(_("Port must be a positive integer")); | ||
| 211 | asprintf (&comm,"%s -p %s", comm, optarg); | ||
| 212 | break; | ||
| 213 | case 'O': /* output file */ | ||
| 214 | outputfile = optarg; | ||
| 215 | passive = TRUE; | ||
| 216 | break; | ||
| 217 | case 's': /* description of service to check */ | ||
| 218 | p1 = optarg; | ||
| 219 | service = realloc (service, (++services) * sizeof(char *)); | ||
| 220 | while ((p2 = index (p1, ':'))) { | ||
| 221 | *p2 = '\0'; | ||
| 222 | service[services - 1] = p1; | ||
| 223 | service = realloc (service, (++services) * sizeof(char *)); | ||
| 224 | p1 = p2 + 1; | ||
| 225 | } | ||
| 226 | service[services - 1] = p1; | ||
| 227 | break; | ||
| 228 | case 'n': /* short name of host in nagios configuration */ | ||
| 229 | host_shortname = optarg; | ||
| 230 | break; | ||
| 231 | |||
| 232 | case 'u': | ||
| 233 | c = 'l'; | ||
| 234 | case 'l': /* login name */ | ||
| 235 | case 'i': /* identity */ | ||
| 236 | asprintf (&comm, "%s -%c %s", comm, c, optarg); | ||
| 237 | break; | ||
| 238 | |||
| 239 | case '1': /* Pass these switches directly to ssh */ | ||
| 240 | case '2': /* 1 to force version 1, 2 to force version 2 */ | ||
| 241 | case '4': /* -4 for IPv4 */ | ||
| 242 | case '6': /* -6 for IPv6 */ | ||
| 243 | case 'f': /* fork to background */ | ||
| 244 | asprintf (&comm, "%s -%c", comm, c); | ||
| 245 | break; | ||
| 246 | case 'C': /* Command for remote machine */ | ||
| 247 | commands++; | ||
| 248 | if (commands > 1) | ||
| 249 | asprintf (&remotecmd, "%s;echo STATUS CODE: $?;", remotecmd); | ||
| 250 | asprintf (&remotecmd, "%s%s", remotecmd, optarg); | ||
| 251 | break; | ||
| 252 | case 'S': /* Skip n lines in the output to ignore system banner */ | ||
| 253 | if (!is_integer (optarg)) | ||
| 254 | usage_va(_("skip lines must be an integer")); | ||
| 255 | else | ||
| 256 | skip = atoi (optarg); | ||
| 257 | break; | ||
| 258 | case 'o': /* Extra options for the ssh command */ | ||
| 259 | asprintf (&comm, "%s -%c '%s'", comm, c, optarg); | ||
| 260 | break; | ||
| 261 | case 'q': /* Tell the ssh command to be quiet */ | ||
| 262 | asprintf (&comm, "%s -%c", comm, c); | ||
| 263 | break; | ||
| 264 | default: /* help */ | ||
| 265 | usage5(); | ||
| 266 | } | ||
| 267 | } | ||
| 268 | |||
| 269 | c = optind; | ||
| 270 | if (hostname == NULL) { | ||
| 271 | if (c <= argc) { | ||
| 272 | die (STATE_UNKNOWN, _("%s: You must provide a host name\n"), progname); | ||
| 273 | } | ||
| 274 | host_or_die(argv[c]); | ||
| 275 | hostname = argv[c++]; | ||
| 276 | } | ||
| 277 | |||
| 278 | if (strlen(remotecmd) == 0) { | ||
| 279 | for (; c < argc; c++) | ||
| 280 | if (strlen(remotecmd) > 0) | ||
| 281 | asprintf (&remotecmd, "%s %s", remotecmd, argv[c]); | ||
| 282 | else | ||
| 283 | asprintf (&remotecmd, "%s", argv[c]); | ||
| 284 | } | ||
| 285 | |||
| 286 | if (commands > 1) | ||
| 287 | asprintf (&remotecmd, "%s;echo STATUS CODE: $?;", remotecmd); | ||
| 288 | |||
| 289 | if (remotecmd == NULL || strlen (remotecmd) <= 1) | ||
| 290 | usage_va(_("No remotecmd")); | ||
| 291 | |||
| 292 | asprintf (&comm, "%s %s '%s'", comm, hostname, remotecmd); | ||
| 293 | |||
| 294 | return validate_arguments (); | ||
| 295 | } | ||
| 296 | |||
| 297 | |||
| 298 | |||
| 299 | int | ||
| 300 | validate_arguments (void) | ||
| 301 | { | ||
| 302 | if (remotecmd == NULL || hostname == NULL) | ||
| 303 | return ERROR; | ||
| 304 | |||
| 305 | if (passive && commands != services) | ||
| 306 | die (STATE_UNKNOWN, _("%s: In passive mode, you must provide a service name for each command.\n"), progname); | ||
| 307 | |||
| 308 | if (passive && host_shortname == NULL) | ||
| 309 | die (STATE_UNKNOWN, _("%s: In passive mode, you must provide the host short name from the nagios configs.\n"), progname); | ||
| 310 | |||
| 311 | return OK; | ||
| 312 | } | ||
| 313 | |||
| 314 | |||
| 315 | void | ||
| 316 | print_help (void) | ||
| 317 | { | ||
| 318 | print_revision (progname, revision); | ||
| 319 | |||
| 320 | printf ("Copyright (c) 1999 Karl DeBisschop <kdebisschop@users.sourceforge.net>\n"); | ||
| 321 | printf (COPYRIGHT, copyright, email); | ||
| 322 | |||
| 323 | printf (_("This plugin uses SSH to execute commands on a remote host")); | ||
| 324 | |||
| 325 | printf ("\n\n"); | ||
| 326 | |||
| 327 | print_usage (); | ||
| 328 | |||
| 329 | printf (_(UT_HELP_VRSN)); | ||
| 330 | |||
| 331 | printf (_(UT_HOST_PORT), 'p', "none"); | ||
| 332 | |||
| 333 | printf (_(UT_IPv46)); | ||
| 334 | |||
| 335 | printf (" %s\n", "-1, --proto1"); | ||
| 336 | printf (" %s\n", _("tell ssh to use Protocol 1")); | ||
| 337 | printf (" %s\n", "-2, --proto2"); | ||
| 338 | printf (" %s\n", _("tell ssh to use Protocol 2")); | ||
| 339 | printf (" %s\n", "-S, --skip=n"); | ||
| 340 | printf (" %s\n", _("Ignore first n lines on STDERR (to suppress a logon banner)")); | ||
| 341 | printf (" %s\n", "-f"); | ||
| 342 | printf (" %s\n", _("tells ssh to fork rather than create a tty")); | ||
| 343 | printf (" %s\n","-C, --command='COMMAND STRING'"); | ||
| 344 | printf (" %s\n", _("command to execute on the remote machine")); | ||
| 345 | printf (" %s\n","-l, --logname=USERNAME"); | ||
| 346 | printf (" %s\n", _("SSH user name on remote host [optional]")); | ||
| 347 | printf (" %s\n","-i, --identity=KEYFILE"); | ||
| 348 | printf (" %s\n", _("identity of an authorized key [optional]")); | ||
| 349 | printf (" %s\n","-O, --output=FILE"); | ||
| 350 | printf (" %s\n", _("external command file for nagios [optional]")); | ||
| 351 | printf (" %s\n","-s, --services=LIST"); | ||
| 352 | printf (" %s\n", _("list of nagios service names, separated by ':' [optional]")); | ||
| 353 | printf (" %s\n","-n, --name=NAME"); | ||
| 354 | printf (" %s\n", _("short name of host in nagios configuration [optional]")); | ||
| 355 | printf (" %s\n","-o, --ssh-option=OPTION"); | ||
| 356 | printf (" %s\n", _("Call ssh with '-o OPTION' (may be used multiple times) [optional]")); | ||
| 357 | printf (" %s\n","-q, --quiet"); | ||
| 358 | printf (" %s\n", _("Tell ssh to suppress warning and diagnostic messages [optional]")); | ||
| 359 | printf (_(UT_WARN_CRIT)); | ||
| 360 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
| 361 | printf (" %s\n", _("The most common mode of use is to refer to a local identity file with")); | ||
| 362 | printf (" %s\n", _("the '-i' option. In this mode, the identity pair should have a null")); | ||
| 363 | printf (" %s\n", _("passphrase and the public key should be listed in the authorized_keys")); | ||
| 364 | printf (" %s\n", _("file of the remote host. Usually the key will be restricted to running")); | ||
| 365 | printf (" %s\n", _("only one command on the remote server. If the remote SSH server tracks")); | ||
| 366 | printf (" %s\n", _("invocation arguments, the one remote program may be an agent that can")); | ||
| 367 | printf (" %s\n", _("execute additional commands as proxy")); | ||
| 368 | printf (" %s\n", _("To use passive mode, provide multiple '-C' options, and provide")); | ||
| 369 | printf (" %s\n", _("all of -O, -s, and -n options (servicelist order must match '-C'options)")); | ||
| 370 | printf ("\n"); | ||
| 371 | printf ("%s\n", _("Examples:")); | ||
| 372 | printf (" %s\n", "$ check_by_ssh -H localhost -n lh -s c1:c2:c3 -C uptime -C uptime -C uptime -O /tmp/foo"); | ||
| 373 | printf (" %s\n", "$ cat /tmp/foo"); | ||
| 374 | printf (" %s\n", "[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c1;0; up 2 days"); | ||
| 375 | printf (" %s\n", "[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c2;0; up 2 days"); | ||
| 376 | printf (" %s\n", "[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c3;0; up 2 days"); | ||
| 377 | printf (_(UT_SUPPORT)); | ||
| 378 | } | ||
| 379 | |||
| 380 | |||
| 381 | |||
| 382 | void | ||
| 383 | print_usage (void) | ||
| 384 | { | ||
| 385 | printf (_("Usage:")); | ||
| 386 | printf(" %s [-fq46] [-t timeout] [-i identity] [-l user] -H <host> -C <command>",progname); | ||
| 387 | printf(" [-n name] [-s servicelist] [-O outputfile] [-p port] [-o ssh-option]\n"); | ||
| 388 | } | ||
diff --git a/web/attachments/227858-check_httppatch.txt b/web/attachments/227858-check_httppatch.txt new file mode 100644 index 0000000..08bf2ff --- /dev/null +++ b/web/attachments/227858-check_httppatch.txt | |||
| @@ -0,0 +1,103 @@ | |||
| 1 | --- check_http.c 2007-03-06 14:45:57.000000000 -0800 | ||
| 2 | +++ - 2007-05-04 11:00:35.226089000 -0700 | ||
| 3 | @@ -110,7 +110,7 @@ | ||
| 4 | int http_opt_headers_count = 0; | ||
| 5 | int onredirect = STATE_OK; | ||
| 6 | int use_ssl = FALSE; | ||
| 7 | -int verbose = FALSE; | ||
| 8 | +int verbose = TRUE; | ||
| 9 | int sd; | ||
| 10 | int min_page_len = 0; | ||
| 11 | int max_page_len = 0; | ||
| 12 | @@ -751,6 +751,17 @@ | ||
| 13 | char *header; | ||
| 14 | char *page; | ||
| 15 | char *auth; | ||
| 16 | +/* Patched by T.P -- binary data */ | ||
| 17 | + char bindata[MAX_INPUT_BUFFER]; | ||
| 18 | + int bindatalen = 0; | ||
| 19 | + int bindatafound = 0; | ||
| 20 | + int bufpos=0; | ||
| 21 | + int mybuflen=0; | ||
| 22 | + char *pointer = http_post_data; | ||
| 23 | + unsigned long ascii = 0; | ||
| 24 | + char code[3] = {0}; | ||
| 25 | + char *end = NULL; | ||
| 26 | +/* End patch */ | ||
| 27 | int http_status; | ||
| 28 | int i = 0; | ||
| 29 | size_t pagesize = 0; | ||
| 30 | @@ -800,14 +811,42 @@ | ||
| 31 | |||
| 32 | /* either send http POST data */ | ||
| 33 | if (http_post_data) { | ||
| 34 | +/* Patched by T.P -- binary data */ | ||
| 35 | + while (*pointer) { | ||
| 36 | + if (*pointer == '%') { | ||
| 37 | + /* Interpret the next two hex chars -- no error checking */ | ||
| 38 | + memcpy(code,++pointer,2); | ||
| 39 | + ascii = strtoul(code,&end,16); | ||
| 40 | + bindata[bindatalen] = (char)ascii; | ||
| 41 | + pointer += 2; | ||
| 42 | + } else if (*pointer == '\\') { | ||
| 43 | + /* Skip the escape char -- no error checking */ | ||
| 44 | + pointer++; | ||
| 45 | + bindata[bindatalen++] = *pointer++; | ||
| 46 | + } else { | ||
| 47 | + /* Just copy the char */ | ||
| 48 | + bindata[bindatalen] = *pointer++; | ||
| 49 | + } | ||
| 50 | + bindatalen++; | ||
| 51 | + } | ||
| 52 | + /* Truncate the original string at the shorter length for future use */ | ||
| 53 | + http_post_data[bindatalen] = (char)0; | ||
| 54 | +/* End patch */ | ||
| 55 | if (http_content_type) { | ||
| 56 | asprintf (&buf, "%sContent-Type: %s\r\n", buf, http_content_type); | ||
| 57 | } else { | ||
| 58 | asprintf (&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf); | ||
| 59 | } | ||
| 60 | |||
| 61 | +/* Patched by T.P -- binary data */ | ||
| 62 | + /* original line | ||
| 63 | asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, (int)strlen (http_post_data)); | ||
| 64 | + */ | ||
| 65 | + asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, bindatalen); | ||
| 66 | + /* Print the original (ascii, truncated) string to fill space */ | ||
| 67 | asprintf (&buf, "%s%s%s", buf, http_post_data, CRLF); | ||
| 68 | + bufpos = strlen(buf) - bindatalen - 2; | ||
| 69 | +/* End patch */ | ||
| 70 | } | ||
| 71 | else { | ||
| 72 | /* or just a newline so the server knows we're done with the request */ | ||
| 73 | @@ -815,13 +854,29 @@ | ||
| 74 | } | ||
| 75 | |||
| 76 | if (verbose) printf ("%s\n", buf); | ||
| 77 | - my_send (buf, strlen (buf)); | ||
| 78 | +/* Patched by T.P -- binary data */ | ||
| 79 | + if (bindatalen) { | ||
| 80 | + mybuflen = strlen(buf); | ||
| 81 | + /* Overwrite it with the (possibly) binary data */ | ||
| 82 | + for (i=0;i<bindatalen;i++) { | ||
| 83 | + buf[i+bufpos] = bindata[i]; | ||
| 84 | + } | ||
| 85 | + my_send (buf, mybuflen); | ||
| 86 | + } else { | ||
| 87 | + /* original line */ | ||
| 88 | + my_send (buf, strlen (buf)); | ||
| 89 | + } | ||
| 90 | |||
| 91 | /* fetch the page */ | ||
| 92 | full_page = strdup(""); | ||
| 93 | + pointer=full_page; | ||
| 94 | while ((i = my_recv (buffer, MAX_INPUT_BUFFER-1)) > 0) { | ||
| 95 | + /* Original lines | ||
| 96 | buffer[i] = '\0'; | ||
| 97 | asprintf (&full_page, "%s%s", full_page, buffer); | ||
| 98 | + */ | ||
| 99 | + memcpy(pointer+pagesize,buffer,i); | ||
| 100 | +/* End patch */ | ||
| 101 | pagesize += i; | ||
| 102 | |||
| 103 | if (no_body && document_headers_done (full_page)) { \ No newline at end of file | ||
diff --git a/web/attachments/228497-check_disk_smb.pl-diff b/web/attachments/228497-check_disk_smb.pl-diff new file mode 100644 index 0000000..496d1a4 --- /dev/null +++ b/web/attachments/228497-check_disk_smb.pl-diff | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | Index: check_disk_smb.pl | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /usr/local/share/cvs/MyNagiosTools/check_disk_smb.pl,v | ||
| 4 | retrieving revision 1.1 | ||
| 5 | retrieving revision 1.2 | ||
| 6 | diff -r1.1 -r1.2 | ||
| 7 | 26c26 | ||
| 8 | < use vars qw($opt_P $opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $verbose); | ||
| 9 | --- | ||
| 10 | > use vars qw($opt_P $opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $opt_I $verbose); | ||
| 11 | 51a52 | ||
| 12 | > "I=s" => \$opt_I, "ipaddess=s" => \$opt_I, | ||
| 13 | 63a65,68 | ||
| 14 | > # | ||
| 15 | > # by Rene Fertig | ||
| 16 | > # | ||
| 17 | > $smbclientoptions.= $opt_I ? "-I $opt_I " : ""; | ||
diff --git a/web/attachments/229809-c b/web/attachments/229809-c new file mode 100644 index 0000000..5f311fc --- /dev/null +++ b/web/attachments/229809-c | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | *** check_by_ssh.c 18 Apr 2007 21:31:29 +0200 1.43 | ||
| 2 | --- check_by_ssh.c 19 May 2007 17:15:55 +0200 | ||
| 3 | *************** | ||
| 4 | *** 393,398 **** | ||
| 5 | --- 393,406 ---- | ||
| 6 | printf (" %s\n", _("To use passive mode, provide multiple '-C' options, and provide")); | ||
| 7 | printf (" %s\n", _("all of -O, -s, and -n options (servicelist order must match '-C'options)")); | ||
| 8 | printf ("\n"); | ||
| 9 | + printf (" %s\n", _("The -C command is not evaluated by a shell, it is parsed by a custom algorithm.")); | ||
| 10 | + printf (" %s\n", _("Double quotes are forbiden. ")); | ||
| 11 | + printf (" %s\n", _("Single quotes are allowed if not surrounded by spaces but")); | ||
| 12 | + printf (" %s\n", _("will not have the expected result because they are parsed")); | ||
| 13 | + printf (" %s\n", _("in a way that was not designed specificaly for ssh invocation.")); | ||
| 14 | + printf (" %s\n", _("Backslash can be used as in the following example:")); | ||
| 15 | + printf (" %s\n", _("... -C 'check_mysql_query -q select\ count\(serial\)\ from\ counter -u nagios -d pokernetwork -H localhost -c 0' ... ")); | ||
| 16 | + printf ("\n"); | ||
| 17 | printf ("%s\n", _("Examples:")); | ||
| 18 | printf (" %s\n", "$ check_by_ssh -H localhost -n lh -s c1:c2:c3 -C uptime -C uptime -C uptime -O /tmp/foo"); | ||
| 19 | printf (" %s\n", "$ cat /tmp/foo"); | ||
diff --git a/web/attachments/230229-nagios-checkdns.patch b/web/attachments/230229-nagios-checkdns.patch new file mode 100644 index 0000000..591cbf8 --- /dev/null +++ b/web/attachments/230229-nagios-checkdns.patch | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | diff -ru nagios-plugins-HEAD-200705220000/plugins/check_dns.c nagios-plugins/plugins/check_dns.c | ||
| 2 | --- nagios-plugins-HEAD-200705220000/plugins/check_dns.c 2007-01-28 22:46:40.000000000 +0100 | ||
| 3 | +++ nagios-plugins/plugins/check_dns.c 2007-05-23 12:06:06.000000000 +0200 | ||
| 4 | @@ -62,12 +62,24 @@ | ||
| 5 | int expect_authority = FALSE; | ||
| 6 | thresholds *time_thresholds = NULL; | ||
| 7 | |||
| 8 | +static int | ||
| 9 | +qstrcmp(const void *p1, const void *p2) | ||
| 10 | +{ | ||
| 11 | + /* The actual arguments to this function are "pointers to | ||
| 12 | + pointers to char", but strcmp() arguments are "pointers | ||
| 13 | + to char", hence the following cast plus dereference */ | ||
| 14 | + return strcmp(* (char * const *) p1, * (char * const *) p2); | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | + | ||
| 18 | int | ||
| 19 | main (int argc, char **argv) | ||
| 20 | { | ||
| 21 | char *command_line = NULL; | ||
| 22 | char input_buffer[MAX_INPUT_BUFFER]; | ||
| 23 | char *address = NULL; | ||
| 24 | + char **addresses = NULL; | ||
| 25 | + int n_addresses = 0; | ||
| 26 | char *msg = NULL; | ||
| 27 | char *temp_buffer = NULL; | ||
| 28 | int non_authoritative = FALSE; | ||
| 29 | @@ -141,16 +153,17 @@ | ||
| 30 | NSLOOKUP_COMMAND); | ||
| 31 | } | ||
| 32 | |||
| 33 | - if (address == NULL) | ||
| 34 | - address = strdup (temp_buffer); | ||
| 35 | - else | ||
| 36 | - asprintf(&address, "%s,%s", address, temp_buffer); | ||
| 37 | + if (addresses == NULL) | ||
| 38 | + addresses = malloc(sizeof(*addresses)*10); | ||
| 39 | + else if (!(n_addresses % 10)) | ||
| 40 | + addresses = realloc(addresses,sizeof(*addresses) * (n_addresses + 10)); | ||
| 41 | + addresses[n_addresses++] = strdup(temp_buffer); | ||
| 42 | } | ||
| 43 | - | ||
| 44 | else if (strstr (chld_out.line[i], _("Non-authoritative answer:"))) { | ||
| 45 | non_authoritative = TRUE; | ||
| 46 | } | ||
| 47 | |||
| 48 | + | ||
| 49 | result = error_scan (chld_out.line[i]); | ||
| 50 | if (result != STATE_OK) { | ||
| 51 | msg = strchr (chld_out.line[i], ':'); | ||
| 52 | @@ -171,9 +184,21 @@ | ||
| 53 | } | ||
| 54 | } | ||
| 55 | |||
| 56 | - /* If we got here, we should have an address string, | ||
| 57 | - * and we can segfault if we do not */ | ||
| 58 | - if (address==NULL || strlen(address)==0) | ||
| 59 | + if (addresses) { | ||
| 60 | + int i,slen; | ||
| 61 | + char *adrp; | ||
| 62 | + qsort(addresses, n_addresses, sizeof(*addresses), qstrcmp); | ||
| 63 | + for(i=0, slen=1; i < n_addresses; i++) { | ||
| 64 | + slen += strlen(addresses[i])+1; | ||
| 65 | + } | ||
| 66 | + adrp = address = malloc(slen); | ||
| 67 | + for(i=0; i < n_addresses; i++) { | ||
| 68 | + if (i) *adrp++ = ','; | ||
| 69 | + strcpy(adrp, addresses[i]); | ||
| 70 | + adrp += strlen(addresses[i]); | ||
| 71 | + } | ||
| 72 | + *adrp = 0; | ||
| 73 | + } else | ||
| 74 | die (STATE_CRITICAL, | ||
| 75 | _("DNS CRITICAL - '%s' msg parsing exited with no address\n"), | ||
| 76 | NSLOOKUP_COMMAND); | ||
| 77 | @@ -428,7 +453,8 @@ | ||
| 78 | printf (" -s, --server=HOST\n"); | ||
| 79 | printf (" %s\n", _("Optional DNS server you want to use for the lookup")); | ||
| 80 | printf (" -a, --expected-address=IP-ADDRESS|HOST\n"); | ||
| 81 | - printf (" %s\n", _("Optional IP-ADDRESS you expect the DNS server to return. HOST must end with .")); | ||
| 82 | + printf (" %s\n", _("Optional IP-ADDRESS you expect the DNS server to return. HOST must end with .\n\ | ||
| 83 | +Multiple addresses can be separated with commas, and need to be sorted.")); | ||
| 84 | printf (" -A, --expect-authority\n"); | ||
| 85 | printf (" %s\n", _("Optionally expect the DNS server to be authoritative for the lookup")); | ||
| 86 | printf (" -w, --warning=seconds\n"); | ||
diff --git a/web/attachments/230926-check_ntp.c.patch b/web/attachments/230926-check_ntp.c.patch new file mode 100644 index 0000000..7b59002 --- /dev/null +++ b/web/attachments/230926-check_ntp.c.patch | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | --- check_ntp.c.orig 2007-04-10 08:17:18.000000000 +0100 | ||
| 2 | +++ check_ntp.c 2007-05-29 12:41:58.000000000 +0100 | ||
| 3 | @@ -47,6 +47,7 @@ | ||
| 4 | |||
| 5 | static char *server_address=NULL; | ||
| 6 | static int verbose=0; | ||
| 7 | +static int max_hosts=0; | ||
| 8 | static double owarn=60; | ||
| 9 | static double ocrit=120; | ||
| 10 | static short do_jitter=0; | ||
| 11 | @@ -372,7 +373,15 @@ | ||
| 12 | } | ||
| 13 | |||
| 14 | /* count the number of returned hosts, and allocate stuff accordingly */ | ||
| 15 | - for(ai_tmp=ai; ai_tmp!=NULL; ai_tmp=ai_tmp->ai_next){ num_hosts++; } | ||
| 16 | + for(ai_tmp=ai; ai_tmp!=NULL; ai_tmp=ai_tmp->ai_next){ | ||
| 17 | + num_hosts++; | ||
| 18 | + /* Reached max # hosts to compare ? */ | ||
| 19 | + if(max_hosts && num_hosts >= max_hosts && ai_tmp->ai_next) { | ||
| 20 | +printf("chopping at %d\n", num_hosts); | ||
| 21 | + freeaddrinfo(ai_tmp->ai_next); | ||
| 22 | + ai_tmp->ai_next = NULL; | ||
| 23 | + } | ||
| 24 | + } | ||
| 25 | req=(ntp_message*)malloc(sizeof(ntp_message)*num_hosts); | ||
| 26 | if(req==NULL) die(STATE_UNKNOWN, "can not allocate ntp message array"); | ||
| 27 | socklist=(int*)malloc(sizeof(int)*num_hosts); | ||
| 28 | @@ -651,6 +660,7 @@ | ||
| 29 | {"critical", required_argument, 0, 'c'}, | ||
| 30 | {"jwarn", required_argument, 0, 'j'}, | ||
| 31 | {"jcrit", required_argument, 0, 'k'}, | ||
| 32 | + {"maxhosts", required_argument, 0, 'm'}, | ||
| 33 | {"timeout", required_argument, 0, 't'}, | ||
| 34 | {"hostname", required_argument, 0, 'H'}, | ||
| 35 | {0, 0, 0, 0} | ||
| 36 | @@ -661,7 +671,7 @@ | ||
| 37 | usage ("\n"); | ||
| 38 | |||
| 39 | while (1) { | ||
| 40 | - c = getopt_long (argc, argv, "Vhv46w:c:j:k:t:H:", longopts, &option); | ||
| 41 | + c = getopt_long (argc, argv, "Vhv46w:c:j:k:t:H:m:", longopts, &option); | ||
| 42 | if (c == -1 || c == EOF || c == 1) | ||
| 43 | break; | ||
| 44 | |||
| 45 | @@ -677,6 +687,9 @@ | ||
| 46 | case 'v': | ||
| 47 | verbose++; | ||
| 48 | break; | ||
| 49 | + case 'm': | ||
| 50 | + max_hosts = atoi(optarg); | ||
| 51 | + break; | ||
| 52 | case 'w': | ||
| 53 | owarn = atof(optarg); | ||
| 54 | break; | ||
| 55 | @@ -848,6 +861,8 @@ | ||
| 56 | printf (" %s\n", _("Warning value for jitter")); | ||
| 57 | printf (" %s\n", "-k, --critical=DOUBLE"); | ||
| 58 | printf (" %s\n", _("Critical value for jitter")); | ||
| 59 | + printf (" %s\n", "-m, --maxhosts=INTEGER"); | ||
| 60 | + printf (" %s\n", _("Max hosts to check - for where host expands to multiple addresses")); | ||
| 61 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
| 62 | printf (_(UT_VERBOSE)); | ||
| 63 | printf (_(UT_SUPPORT)); | ||
| 64 | @@ -857,5 +872,5 @@ | ||
| 65 | print_usage(void) | ||
| 66 | { | ||
| 67 | printf (_("Usage:")); | ||
| 68 | - printf("%s -H <host> [-w <warn>] [-c <crit>] [-j <warn>] [-k <crit>] [-v verbose]\n", progname); | ||
| 69 | + printf("%s -H <host> [-w <warn>] [-c <crit>] [-j <warn>] [-k <crit>] [-v verbose] [-m <max hosts to check>]\n", progname); | ||
| 70 | } | ||
diff --git a/web/attachments/231381-check_ntp-jitterfix.diff b/web/attachments/231381-check_ntp-jitterfix.diff new file mode 100644 index 0000000..d6d6d78 --- /dev/null +++ b/web/attachments/231381-check_ntp-jitterfix.diff | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | --- nagios-plugins-HEAD-200706011200/plugins-scripts/check_ntp.pl 2005-11-29 16:49:47.000000000 -0800 | ||
| 2 | +++ nagios-plugins/plugins-scripts/check_ntp.pl 2007-06-01 09:40:41.000000000 -0700 | ||
| 3 | @@ -312,6 +312,8 @@ | ||
| 4 | } else { | ||
| 5 | $jitter_error = $ERRORS{'OK'}; | ||
| 6 | } | ||
| 7 | + # We found the associated host, no need to process any more | ||
| 8 | + last; | ||
| 9 | } else { | ||
| 10 | print "No match!\n" if $verbose; | ||
| 11 | $jitter = '(not parsed)'; | ||
diff --git a/web/attachments/234288-check_smtp.c.patch b/web/attachments/234288-check_smtp.c.patch new file mode 100644 index 0000000..9a69cce --- /dev/null +++ b/web/attachments/234288-check_smtp.c.patch | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | *** check_smtp.c.orig Wed Jun 13 12:19:37 2007 | ||
| 2 | --- check_smtp.c Wed Jun 13 12:22:30 2007 | ||
| 3 | *************** process_arguments (int argc, char **argv | ||
| 4 | *** 582,603 **** | ||
| 5 | break; | ||
| 6 | case 'C': /* commands */ | ||
| 7 | if (ncommands >= command_size) { | ||
| 8 | ! commands = realloc (commands, command_size+8); | ||
| 9 | if (commands == NULL) | ||
| 10 | die (STATE_UNKNOWN, | ||
| 11 | _("Could not realloc() units [%d]\n"), ncommands); | ||
| 12 | } | ||
| 13 | ! commands[ncommands] = optarg; | ||
| 14 | ncommands++; | ||
| 15 | break; | ||
| 16 | case 'R': /* server responses */ | ||
| 17 | if (nresponses >= response_size) { | ||
| 18 | ! responses = realloc (responses, response_size+8); | ||
| 19 | if (responses == NULL) | ||
| 20 | die (STATE_UNKNOWN, | ||
| 21 | _("Could not realloc() units [%d]\n"), nresponses); | ||
| 22 | } | ||
| 23 | ! responses[nresponses] = optarg; | ||
| 24 | nresponses++; | ||
| 25 | break; | ||
| 26 | case 'c': /* critical time threshold */ | ||
| 27 | --- 582,607 ---- | ||
| 28 | break; | ||
| 29 | case 'C': /* commands */ | ||
| 30 | if (ncommands >= command_size) { | ||
| 31 | ! command_size+=8; | ||
| 32 | ! commands = realloc (commands, sizeof(char **)*command_size); | ||
| 33 | if (commands == NULL) | ||
| 34 | die (STATE_UNKNOWN, | ||
| 35 | _("Could not realloc() units [%d]\n"), ncommands); | ||
| 36 | } | ||
| 37 | ! commands[ncommands] = (char *)malloc (sizeof(char)*255); | ||
| 38 | ! strncpy (commands[ncommands], optarg, 250); | ||
| 39 | ncommands++; | ||
| 40 | break; | ||
| 41 | case 'R': /* server responses */ | ||
| 42 | if (nresponses >= response_size) { | ||
| 43 | ! response_size += 8; | ||
| 44 | ! responses = realloc (responses, sizeof(char **)*response_size); | ||
| 45 | if (responses == NULL) | ||
| 46 | die (STATE_UNKNOWN, | ||
| 47 | _("Could not realloc() units [%d]\n"), nresponses); | ||
| 48 | } | ||
| 49 | ! responses[nresponses] = (char *)malloc (sizeof(char)*255); | ||
| 50 | ! strncpy (responses[nresponses], optarg, 250); | ||
| 51 | nresponses++; | ||
| 52 | break; | ||
| 53 | case 'c': /* critical time threshold */ | ||
diff --git a/web/attachments/239325-check_file_age.patch b/web/attachments/239325-check_file_age.patch new file mode 100644 index 0000000..9381765 --- /dev/null +++ b/web/attachments/239325-check_file_age.patch | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | --- check_file_age.bak 2007-07-27 14:24:15.000000000 +0100 | ||
| 2 | +++ check_file_age 2007-07-27 14:31:20.000000000 +0100 | ||
| 3 | @@ -33,22 +33,23 @@ | ||
| 4 | sub print_help (); | ||
| 5 | sub print_usage (); | ||
| 6 | |||
| 7 | -my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V); | ||
| 8 | -my ($result, $message, $age, $size, $st); | ||
| 9 | - | ||
| 10 | $PROGNAME="check_file_age"; | ||
| 11 | |||
| 12 | -$opt_w = 240; | ||
| 13 | -$opt_c = 600; | ||
| 14 | -$opt_W = 0; | ||
| 15 | -$opt_C = 0; | ||
| 16 | -$opt_f = ""; | ||
| 17 | +my $opt_V = undef; | ||
| 18 | +my $opt_w = 240; | ||
| 19 | +my $opt_c = 600; | ||
| 20 | +my $opt_W = 0; | ||
| 21 | +my $opt_C = 0; | ||
| 22 | +my $opt_f = ""; | ||
| 23 | +my $opt_d = ""; | ||
| 24 | +my $opt_h = ""; | ||
| 25 | |||
| 26 | Getopt::Long::Configure('bundling'); | ||
| 27 | GetOptions( | ||
| 28 | "V" => \$opt_V, "version" => \$opt_V, | ||
| 29 | "h" => \$opt_h, "help" => \$opt_h, | ||
| 30 | "f=s" => \$opt_f, "file" => \$opt_f, | ||
| 31 | + "d=s" => \$opt_d, "dir" => \$opt_d, | ||
| 32 | "w=f" => \$opt_w, "warning-age=f" => \$opt_w, | ||
| 33 | "W=f" => \$opt_W, "warning-size=f" => \$opt_W, | ||
| 34 | "c=f" => \$opt_c, "critical-age=f" => \$opt_c, | ||
| 35 | @@ -64,25 +65,32 @@ | ||
| 36 | exit $ERRORS{'OK'}; | ||
| 37 | } | ||
| 38 | |||
| 39 | -$opt_f = shift unless ($opt_f); | ||
| 40 | +$opt_f = shift unless ($opt_f or $opt_d); | ||
| 41 | |||
| 42 | -if (! $opt_f) { | ||
| 43 | - print "No file specified\n"; | ||
| 44 | +if (not $opt_f and not $opt_d) { | ||
| 45 | + print "No file or directory specified\n"; | ||
| 46 | exit $ERRORS{'UNKNOWN'}; | ||
| 47 | } | ||
| 48 | |||
| 49 | # Examine the file. | ||
| 50 | -unless (-f $opt_f) { | ||
| 51 | +if ($opt_f and not -f $opt_f) | ||
| 52 | +{ | ||
| 53 | print "$opt_f: File not found\n"; | ||
| 54 | exit $ERRORS{'UNKNOWN'}; | ||
| 55 | } | ||
| 56 | +elsif ($opt_d and not -d $opt_d) | ||
| 57 | +{ | ||
| 58 | + print "$opt_d: Directory not found\n"; | ||
| 59 | + exit $ERRORS{'UNKNOWN'}; | ||
| 60 | +} | ||
| 61 | |||
| 62 | -$st = File::stat::stat($opt_f); | ||
| 63 | -$age = time - $st->mtime; | ||
| 64 | -$size = $st->size; | ||
| 65 | +my $file = $opt_f || $opt_d; | ||
| 66 | |||
| 67 | +my $st = File::stat::stat($file); | ||
| 68 | +my $age = time - $st->mtime; | ||
| 69 | +my $size = $st->size; | ||
| 70 | |||
| 71 | -$result = 'OK'; | ||
| 72 | +my $result = 'OK'; | ||
| 73 | |||
| 74 | if (($opt_c and $age > $opt_c) or ($opt_C and $size < $opt_C)) { | ||
| 75 | $result = 'CRITICAL'; | ||
| 76 | @@ -91,7 +99,7 @@ | ||
| 77 | $result = 'WARNING'; | ||
| 78 | } | ||
| 79 | |||
| 80 | -print "$result - $opt_f is $age seconds old and $size bytes\n"; | ||
| 81 | +print "$result - $file is $age seconds old and $size bytes\n"; | ||
| 82 | exit $ERRORS{$result}; | ||
| 83 | |||
| 84 | sub print_usage () { | ||
diff --git a/web/attachments/239424-check_email_loop.diff b/web/attachments/239424-check_email_loop.diff new file mode 100644 index 0000000..e06de63 --- /dev/null +++ b/web/attachments/239424-check_email_loop.diff | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | Index: etch/contrib/check_email_loop.pl | ||
| 2 | =================================================================== | ||
| 3 | --- etch/contrib/check_email_loop.pl (revision 172) | ||
| 4 | +++ etch/contrib/check_email_loop.pl (working copy) | ||
| 5 | @@ -112,6 +112,7 @@ | ||
| 6 | # creating new serial id | ||
| 7 | my $serial = time(); | ||
| 8 | $serial = "ID#" . $serial . "#$$"; | ||
| 9 | +push @messageids, $serial; | ||
| 10 | |||
| 11 | |||
| 12 | # sending new ping email | ||
| 13 | @@ -136,6 +137,7 @@ | ||
| 14 | # no the interessting part: let's if they are receiving ;-) | ||
| 15 | |||
| 16 | $pop = Net::POP3->new( $pophost, | ||
| 17 | + Debug=>$debug, | ||
| 18 | Timeout=>$poptimeout) | ||
| 19 | || nsexit("POP3 connect timeout (>$poptimeout s, host: $pophost)",'CRITICAL'); | ||
| 20 | |||
| 21 | @@ -154,6 +156,7 @@ | ||
| 22 | @msglines = @{$pop->top($msgcount,1)}; | ||
| 23 | for (my $i=0; $i < scalar @messageids; $i++) { | ||
| 24 | if (messagematchsid(\@msglines,$messageids[$i])) { | ||
| 25 | + warn "Found message $messageids[$i]\n" if $debug; | ||
| 26 | $matchcount++; | ||
| 27 | # newest received mail than the others, ok remeber id. | ||
| 28 | if (!defined $newestid) { | ||
| 29 | @@ -177,6 +180,7 @@ | ||
| 30 | chomp @msgsubject; | ||
| 31 | # Scan Subject if email is an Email-Ping. In fact we match and delete also successfully retrieved messages here again. | ||
| 32 | if (!defined $keeporphaned && $msgsubject[0] =~ /E-Mail Ping \[/) { | ||
| 33 | + warn "Deleting orphan: $msgsubject[0]\n"; | ||
| 34 | $pop->delete($msgcount); # remove E-Mail from POP3 server | ||
| 35 | } | ||
| 36 | |||
| 37 | @@ -200,10 +204,7 @@ | ||
| 38 | } | ||
| 39 | |||
| 40 | # Write list to id-Database | ||
| 41 | -foreach my $id (@messageids) { | ||
| 42 | - print STATF "$id\n"; | ||
| 43 | -} | ||
| 44 | -print STATF "$serial\n"; # remember send mail of this session | ||
| 45 | +print STATF map { "$_\n" } @messageids; | ||
| 46 | close STATF; | ||
| 47 | |||
| 48 | # ok - count lost and pending mails; | ||
diff --git a/web/attachments/239804-check_ifstatus.pl.patch b/web/attachments/239804-check_ifstatus.pl.patch new file mode 100644 index 0000000..6dd90a0 --- /dev/null +++ b/web/attachments/239804-check_ifstatus.pl.patch | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | 209c209 | ||
| 2 | < my $perfdata = sprintf("up=%d,down=%d,dormant=%d,excluded=%d,unused=%d",$ifup,$ifdown,$ifdormant,$ifexclude,$ifunused); | ||
| 3 | --- | ||
| 4 | > my $perfdata = sprintf("up=%d down=%d dormant=%d excluded=%d unused=%d",$ifup,$ifdown,$ifdormant,$ifexclude,$ifunused); | ||
diff --git a/web/attachments/240316-check_by_ssh.c.patch b/web/attachments/240316-check_by_ssh.c.patch new file mode 100644 index 0000000..4f4982e --- /dev/null +++ b/web/attachments/240316-check_by_ssh.c.patch | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | --- nagios-plugins-trunk-200708071200/plugins/check_by_ssh.c 2007-06-13 01:18:13.000000000 +0200 | ||
| 2 | +++ nagios-plugins-trunk-200708071200-check_by_ssh_patch/plugins/check_by_ssh.c 2007-08-07 20:31:57.000000000 +0200 | ||
| 3 | @@ -110,7 +110,8 @@ | ||
| 4 | * Wrap up quickly and keep the tricks below */ | ||
| 5 | if(!passive) { | ||
| 6 | if (chld_out.lines > skip_stdout) | ||
| 7 | - puts (chld_out.line[skip_stdout]); | ||
| 8 | + for (i = skip_stdout; i < chld_out.lines; i++) | ||
| 9 | + puts (chld_out.line[i]); | ||
| 10 | else | ||
| 11 | printf (_("%s - check_by_ssh: Remote command '%s' returned status %d\n"), | ||
| 12 | state_text(result), remotecmd, result); | ||
diff --git a/web/attachments/240318-configure.patch b/web/attachments/240318-configure.patch new file mode 100644 index 0000000..c9dc127 --- /dev/null +++ b/web/attachments/240318-configure.patch | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | --- configure.in 2007-08-07 23:21:00.000000000 +0200 | ||
| 2 | +++ configure_radiusclientng.in 2007-08-07 23:20:54.000000000 +0200 | ||
| 3 | @@ -218,8 +218,15 @@ | ||
| 4 | RADIUSLIBS="-lradiusclient" | ||
| 5 | AC_SUBST(RADIUSLIBS) | ||
| 6 | else | ||
| 7 | - AC_MSG_WARN([Skipping radius plugin]) | ||
| 8 | - AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).]) | ||
| 9 | + AC_CHECK_LIB(radiusclient-ng,rc_read_config) | ||
| 10 | + if test "$ac_cv_lib_radiusclient_ng_rc_read_config" = "yes"; then | ||
| 11 | + EXTRAS="$EXTRAS check_radius" | ||
| 12 | + RADIUSLIBS="-lradiusclient-ng" | ||
| 13 | + AC_SUBST(RADIUSLIBS) | ||
| 14 | + else | ||
| 15 | + AC_MSG_WARN([Skipping radius plugin]) | ||
| 16 | + AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).]) | ||
| 17 | + fi | ||
| 18 | fi | ||
| 19 | LIBS="$_SAVEDLIBS" | ||
| 20 | |||
diff --git a/web/attachments/240319-wrapper.patch b/web/attachments/240319-wrapper.patch new file mode 100644 index 0000000..0d852ef --- /dev/null +++ b/web/attachments/240319-wrapper.patch | |||
| @@ -0,0 +1,146 @@ | |||
| 1 | --- check_radius_orig.c 2007-08-07 22:34:39.000000000 +0200 | ||
| 2 | +++ check_radius.c 2007-08-07 23:07:46.000000000 +0200 | ||
| 3 | @@ -43,12 +43,28 @@ | ||
| 4 | #include "utils.h" | ||
| 5 | #include "netutils.h" | ||
| 6 | |||
| 7 | +#ifdef HAVE_LIBRADIUSCLIENT_NG | ||
| 8 | +#include <radiusclient-ng.h> | ||
| 9 | +rc_handle *rch = NULL; | ||
| 10 | +#else | ||
| 11 | #include <radiusclient.h> | ||
| 12 | +#endif | ||
| 13 | |||
| 14 | int process_arguments (int, char **); | ||
| 15 | void print_help (void); | ||
| 16 | void print_usage (void); | ||
| 17 | |||
| 18 | +/* libradiusclient(-ng) wrapper functions */ | ||
| 19 | +int my_rc_read_dictionary(const char *); | ||
| 20 | +VALUE_PAIR *my_rc_avpair_add(VALUE_PAIR **, int, void *, int); | ||
| 21 | +UINT4 my_rc_own_ipaddress(); | ||
| 22 | +void my_rc_buildreq(SEND_DATA *, int, char *, unsigned short, int, int); | ||
| 23 | +int my_rc_send_server(SEND_DATA *, char *); | ||
| 24 | +char *my_rc_conf_str(char *); | ||
| 25 | +int my_rc_read_config(char *); | ||
| 26 | + | ||
| 27 | + | ||
| 28 | + | ||
| 29 | char *server = NULL; | ||
| 30 | char *username = NULL; | ||
| 31 | char *password = NULL; | ||
| 32 | @@ -133,33 +149,33 @@ | ||
| 33 | usage4 (_("Could not parse arguments")); | ||
| 34 | |||
| 35 | str = strdup ("dictionary"); | ||
| 36 | - if ((config_file && rc_read_config (config_file)) || | ||
| 37 | - rc_read_dictionary (rc_conf_str (str))) | ||
| 38 | + if ((config_file && my_rc_read_config (config_file)) || | ||
| 39 | + my_rc_read_dictionary (my_rc_conf_str (str))) | ||
| 40 | die (STATE_UNKNOWN, _("Config file error")); | ||
| 41 | |||
| 42 | service = PW_AUTHENTICATE_ONLY; | ||
| 43 | |||
| 44 | memset (&data, 0, sizeof(data)); | ||
| 45 | - if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) && | ||
| 46 | - rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) && | ||
| 47 | - rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) && | ||
| 48 | - (nasid==NULL || rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0)))) | ||
| 49 | + if (!(my_rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) && | ||
| 50 | + my_rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) && | ||
| 51 | + my_rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) && | ||
| 52 | + (nasid==NULL || my_rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0)))) | ||
| 53 | die (STATE_UNKNOWN, _("Out of Memory?")); | ||
| 54 | |||
| 55 | /* | ||
| 56 | * Fill in NAS-IP-Address | ||
| 57 | */ | ||
| 58 | |||
| 59 | - if ((client_id = rc_own_ipaddress ()) == 0) | ||
| 60 | + if ((client_id = my_rc_own_ipaddress ()) == 0) | ||
| 61 | return (ERROR_RC); | ||
| 62 | |||
| 63 | - if (rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == | ||
| 64 | + if (my_rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == | ||
| 65 | NULL) return (ERROR_RC); | ||
| 66 | |||
| 67 | - rc_buildreq (&data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval, | ||
| 68 | + my_rc_buildreq (&data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval, | ||
| 69 | retries); | ||
| 70 | |||
| 71 | - result = rc_send_server (&data, msg); | ||
| 72 | + result = my_rc_send_server (&data, msg); | ||
| 73 | rc_avpair_free (data.send_pairs); | ||
| 74 | if (data.receive_pairs) | ||
| 75 | rc_avpair_free (data.receive_pairs); | ||
| 76 | @@ -350,3 +366,70 @@ | ||
| 77 | printf ("%s -H host -F config_file -u username -p password [-n nas-id] [-P port]\n\ | ||
| 78 | [-t timeout] [-r retries] [-e expect]\n", progname); | ||
| 79 | } | ||
| 80 | + | ||
| 81 | + | ||
| 82 | + | ||
| 83 | + | ||
| 84 | +int my_rc_read_dictionary(const char * a) | ||
| 85 | +{ | ||
| 86 | +#ifdef HAVE_LIBRADIUSCLIENT_NG | ||
| 87 | + return rc_read_dictionary(rch, a); | ||
| 88 | +#else | ||
| 89 | + return rc_read_dictionary(a); | ||
| 90 | +#endif | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | +VALUE_PAIR *my_rc_avpair_add(VALUE_PAIR ** a, int b, void * c, int d) | ||
| 94 | +{ | ||
| 95 | +#ifdef HAVE_LIBRADIUSCLIENT_NG | ||
| 96 | + return rc_avpair_add(rch, a, b, c, -1, d); | ||
| 97 | +#else | ||
| 98 | + return rc_avpair_add(a, b, c, d); | ||
| 99 | +#endif | ||
| 100 | +} | ||
| 101 | + | ||
| 102 | +UINT4 my_rc_own_ipaddress() | ||
| 103 | +{ | ||
| 104 | +#ifdef HAVE_LIBRADIUSCLIENT_NG | ||
| 105 | + return rc_own_ipaddress(rch); | ||
| 106 | +#else | ||
| 107 | + return rc_own_ipaddress(); | ||
| 108 | +#endif | ||
| 109 | +} | ||
| 110 | + | ||
| 111 | +void my_rc_buildreq(SEND_DATA * a, int b, char * c, unsigned short d, int e, int f) | ||
| 112 | +{ | ||
| 113 | +#ifdef HAVE_LIBRADIUSCLIENT_NG | ||
| 114 | + return rc_buildreq(rch, a, b, c, d, e, f); | ||
| 115 | +#else | ||
| 116 | + return rc_buildreq(a, b, c, d, e, f); | ||
| 117 | +#endif | ||
| 118 | +} | ||
| 119 | + | ||
| 120 | +int my_rc_send_server(SEND_DATA * a, char * b) | ||
| 121 | +{ | ||
| 122 | +#ifdef HAVE_LIBRADIUSCLIENT_NG | ||
| 123 | + return rc_send_server(rch, a, b); | ||
| 124 | +#else | ||
| 125 | + return rc_send_server(a, b); | ||
| 126 | +#endif | ||
| 127 | +} | ||
| 128 | + | ||
| 129 | +int my_rc_read_config(char * a) | ||
| 130 | +{ | ||
| 131 | +#ifdef HAVE_LIBRADIUSCLIENT_NG | ||
| 132 | + rch = rc_read_config(a); | ||
| 133 | + return (rch == NULL) ? 1 : 0; | ||
| 134 | +#else | ||
| 135 | + return rc_read_config(a); | ||
| 136 | +#endif | ||
| 137 | +} | ||
| 138 | + | ||
| 139 | +char *my_rc_conf_str(char * a) | ||
| 140 | +{ | ||
| 141 | +#ifdef HAVE_LIBRADIUSCLIENT_NG | ||
| 142 | + return rc_conf_str(rch, a); | ||
| 143 | +#else | ||
| 144 | + return rc_conf_str(a); | ||
| 145 | +#endif | ||
| 146 | +} | ||
diff --git a/web/attachments/240320-ifdef.patch b/web/attachments/240320-ifdef.patch new file mode 100644 index 0000000..983a1ce --- /dev/null +++ b/web/attachments/240320-ifdef.patch | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | --- check_radius_orig.c 2007-08-07 22:34:39.000000000 +0200 | ||
| 2 | +++ check_radius_ifdef.c 2007-08-07 22:34:01.000000000 +0200 | ||
| 3 | @@ -42,8 +42,12 @@ | ||
| 4 | #include "common.h" | ||
| 5 | #include "utils.h" | ||
| 6 | #include "netutils.h" | ||
| 7 | - | ||
| 8 | +#ifdef HAVE_LIBRADIUSCLIENT_NG | ||
| 9 | +#include <radiusclient-ng.h> | ||
| 10 | +rc_handle *rch = NULL; | ||
| 11 | +#else | ||
| 12 | #include <radiusclient.h> | ||
| 13 | +#endif | ||
| 14 | |||
| 15 | int process_arguments (int, char **); | ||
| 16 | void print_help (void); | ||
| 17 | @@ -133,26 +137,49 @@ | ||
| 18 | usage4 (_("Could not parse arguments")); | ||
| 19 | |||
| 20 | str = strdup ("dictionary"); | ||
| 21 | +#ifdef HAVE_LIBRADIUSCLIENT_NG | ||
| 22 | + if ((config_file && ! (rch = rc_read_config (config_file))) || | ||
| 23 | + rc_read_dictionary (rch, rc_conf_str (rch, str))) | ||
| 24 | +#else | ||
| 25 | if ((config_file && rc_read_config (config_file)) || | ||
| 26 | rc_read_dictionary (rc_conf_str (str))) | ||
| 27 | +#endif | ||
| 28 | die (STATE_UNKNOWN, _("Config file error")); | ||
| 29 | |||
| 30 | service = PW_AUTHENTICATE_ONLY; | ||
| 31 | |||
| 32 | memset (&data, 0, sizeof(data)); | ||
| 33 | +#ifdef HAVE_LIBRADIUSCLIENT_NG | ||
| 34 | + if (!(rc_avpair_add (rch, &data.send_pairs, PW_SERVICE_TYPE, &service, -1, 0) && | ||
| 35 | + rc_avpair_add (rch, &data.send_pairs, PW_USER_NAME, username, -1, 0) && | ||
| 36 | + rc_avpair_add (rch, &data.send_pairs, PW_USER_PASSWORD, password, -1, 0) && | ||
| 37 | + (nasid==NULL || rc_avpair_add (rch, &data.send_pairs, PW_NAS_IDENTIFIER, nasid, -1, 0)))) | ||
| 38 | +#else | ||
| 39 | if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) && | ||
| 40 | rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) && | ||
| 41 | rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) && | ||
| 42 | (nasid==NULL || rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0)))) | ||
| 43 | +#endif | ||
| 44 | die (STATE_UNKNOWN, _("Out of Memory?")); | ||
| 45 | |||
| 46 | /* | ||
| 47 | * Fill in NAS-IP-Address | ||
| 48 | */ | ||
| 49 | |||
| 50 | +#ifdef HAVE_LIBRADIUSCLIENT_NG | ||
| 51 | + if ((client_id = rc_own_ipaddress (rch)) == 0) | ||
| 52 | +#else | ||
| 53 | if ((client_id = rc_own_ipaddress ()) == 0) | ||
| 54 | +#endif | ||
| 55 | return (ERROR_RC); | ||
| 56 | |||
| 57 | +#ifdef HAVE_LIBRADIUSCLIENT_NG | ||
| 58 | + if (rc_avpair_add (rch, &(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id,-1, 0) == | ||
| 59 | + NULL) return (ERROR_RC); | ||
| 60 | + rc_buildreq (rch, &data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval, | ||
| 61 | + retries); | ||
| 62 | + result = rc_send_server (rch, &data, msg); | ||
| 63 | +#else | ||
| 64 | if (rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == | ||
| 65 | NULL) return (ERROR_RC); | ||
| 66 | |||
| 67 | @@ -160,6 +187,8 @@ | ||
| 68 | retries); | ||
| 69 | |||
| 70 | result = rc_send_server (&data, msg); | ||
| 71 | +#endif | ||
| 72 | + | ||
| 73 | rc_avpair_free (data.send_pairs); | ||
| 74 | if (data.receive_pairs) | ||
| 75 | rc_avpair_free (data.receive_pairs); | ||
diff --git a/web/attachments/241185-check_mailq.pl.patch b/web/attachments/241185-check_mailq.pl.patch new file mode 100644 index 0000000..906234b --- /dev/null +++ b/web/attachments/241185-check_mailq.pl.patch | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | --- check_mailq.pl.orig 2006-07-05 15:45:57.000000000 +0200 | ||
| 2 | +++ check_mailq.pl 2007-08-14 13:32:15.463385010 +0200 | ||
| 3 | @@ -29,7 +29,7 @@ | ||
| 4 | use POSIX; | ||
| 5 | use strict; | ||
| 6 | use Getopt::Long; | ||
| 7 | -use vars qw($opt_V $opt_h $opt_v $verbose $PROGNAME $opt_w $opt_c $opt_t | ||
| 8 | +use vars qw($opt_d $opt_V $opt_h $opt_v $verbose $PROGNAME $opt_w $opt_c $opt_t | ||
| 9 | $opt_M $mailq $status $state $msg $msg_q $msg_p $opt_W $opt_C $mailq @lines | ||
| 10 | %srcdomains %dstdomains); | ||
| 11 | use lib utils.pm; | ||
| 12 | @@ -515,12 +515,17 @@ | ||
| 13 | ("V" => \$opt_V, "version" => \$opt_V, | ||
| 14 | "v" => \$opt_v, "verbose" => \$opt_v, | ||
| 15 | "h" => \$opt_h, "help" => \$opt_h, | ||
| 16 | + "d:s" => \$opt_d, "configdir:s" => \$opt_d, | ||
| 17 | "M:s" => \$opt_M, "mailserver:s" => \$opt_M, # mailserver (default sendmail) | ||
| 18 | "w=i" => \$opt_w, "warning=i" => \$opt_w, # warning if above this number | ||
| 19 | "c=i" => \$opt_c, "critical=i" => \$opt_c, # critical if above this number | ||
| 20 | "t=i" => \$opt_t, "timeout=i" => \$opt_t | ||
| 21 | ); | ||
| 22 | |||
| 23 | + if ($opt_d) { | ||
| 24 | + $ENV{'MAIL_CONFIG'}=$opt_d; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | if ($opt_V) { | ||
| 28 | print_revision($PROGNAME,'$Revision: 1.7 $ '); | ||
| 29 | exit $ERRORS{'OK'}; | ||
| 30 | @@ -576,7 +581,7 @@ | ||
| 31 | } | ||
| 32 | |||
| 33 | sub print_usage () { | ||
| 34 | - print "Usage: $PROGNAME -w <warn> -c <crit> [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-v verbose]\n"; | ||
| 35 | + print "Usage: $PROGNAME -d <configdir> -w <warn> -c <crit> [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-v verbose]\n"; | ||
| 36 | } | ||
| 37 | |||
| 38 | sub print_help () { | ||
| 39 | @@ -587,6 +592,7 @@ | ||
| 40 | print "\n"; | ||
| 41 | print " Checks the number of messages in the mail queue (supports multiple sendmail queues, qmail)\n"; | ||
| 42 | print " Feedback/patches to support non-sendmail mailqueue welcome\n\n"; | ||
| 43 | + print "-d (--configdir) = Use configdir for postfix command (MAIL_CONFIG)\n"; | ||
| 44 | print "-w (--warning) = Min. number of messages in queue to generate warning\n"; | ||
| 45 | print "-c (--critical) = Min. number of messages in queu to generate critical alert ( w < c )\n"; | ||
| 46 | print "-W (--Warning) = Min. number of messages for same domain in queue to generate warning\n"; | ||
diff --git a/web/attachments/241808-configure.in_check_dig.c.diff b/web/attachments/241808-configure.in_check_dig.c.diff new file mode 100644 index 0000000..3ba9b50 --- /dev/null +++ b/web/attachments/241808-configure.in_check_dig.c.diff | |||
| @@ -0,0 +1,126 @@ | |||
| 1 | diff -Nru configure.in.orig configure.in | ||
| 2 | --- configure.in.orig 2007-07-28 17:40:54.000000000 +0000 | ||
| 3 | +++ configure.in 2007-07-28 13:38:11.000000000 +0000 | ||
| 4 | @@ -93,6 +93,7 @@ | ||
| 5 | PKG_ARCH=`uname -p` | ||
| 6 | REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'` | ||
| 7 | REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'` | ||
| 8 | +first_ip=`/sbin/ifconfig | egrep "inet addr:" | sed -n '1p' | sed 's/ Bcast.*$//' | sed 's/^\s*inet addr://'` | ||
| 9 | |||
| 10 | AC_SUBST(PKG_ARCH) | ||
| 11 | AC_SUBST(REV_DATESTAMP) | ||
| 12 | @@ -771,14 +772,14 @@ | ||
| 13 | fi | ||
| 14 | |||
| 15 | elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \ | ||
| 16 | - $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \ | ||
| 17 | + $PATH_TO_PING -n -s $first_ip 56 1 2>/dev/null | \ | ||
| 18 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 19 | then | ||
| 20 | with_ping_command="$PATH_TO_PING -n -U -c %d %s" | ||
| 21 | ac_cv_ping_packets_first=yes | ||
| 22 | AC_MSG_RESULT([$with_ping_command]) | ||
| 23 | |||
| 24 | -elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \ | ||
| 25 | +elif $PATH_TO_PING -n -U -w 10 -c 1 $first_ip 2>/dev/null | \ | ||
| 26 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 27 | then | ||
| 28 | with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s" | ||
| 29 | @@ -786,52 +787,52 @@ | ||
| 30 | ac_cv_ping_has_timeout=yes | ||
| 31 | AC_MSG_RESULT([$with_ping_command]) | ||
| 32 | |||
| 33 | -elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \ | ||
| 34 | +elif $PATH_TO_PING -n -U -c 1 $first_ip 2>/dev/null | \ | ||
| 35 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 36 | then | ||
| 37 | with_ping_command="$PATH_TO_PING -n -U -c %d %s" | ||
| 38 | ac_cv_ping_packets_first=yes | ||
| 39 | AC_MSG_RESULT([$with_ping_command]) | ||
| 40 | |||
| 41 | -elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \ | ||
| 42 | +elif $PATH_TO_PING -n -c 1 $first_ip 2>/dev/null | \ | ||
| 43 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 44 | then | ||
| 45 | with_ping_command="$PATH_TO_PING -n -c %d %s" | ||
| 46 | ac_cv_ping_packets_first=yes | ||
| 47 | AC_MSG_RESULT([$with_ping_command]) | ||
| 48 | |||
| 49 | -elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \ | ||
| 50 | +elif $PATH_TO_PING -n $first_ip -c 1 2>/dev/null | \ | ||
| 51 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 52 | then | ||
| 53 | with_ping_command="$PATH_TO_PING -n %s -c %d" | ||
| 54 | AC_MSG_RESULT([$with_ping_command]) | ||
| 55 | |||
| 56 | -elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \ | ||
| 57 | +elif $PATH_TO_PING $first_ip -n 1 2>/dev/null | \ | ||
| 58 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 59 | then | ||
| 60 | with_ping_command="$PATH_TO_PING %s -n %d" | ||
| 61 | AC_MSG_RESULT([$with_ping_command]) | ||
| 62 | |||
| 63 | -elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \ | ||
| 64 | +elif $PATH_TO_PING -n -s $first_ip 56 1 2>/dev/null | \ | ||
| 65 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 66 | then | ||
| 67 | with_ping_command="$PATH_TO_PING -n -s %s 56 %d" | ||
| 68 | AC_MSG_RESULT([$with_ping_command]) | ||
| 69 | |||
| 70 | -elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \ | ||
| 71 | +elif $PATH_TO_PING -n -h $first_ip -s 56 -c 1 2>/dev/null | \ | ||
| 72 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 73 | then | ||
| 74 | with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d" | ||
| 75 | AC_MSG_RESULT([$with_ping_command]) | ||
| 76 | |||
| 77 | -elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \ | ||
| 78 | +elif $PATH_TO_PING -n -s 56 -c 1 $first_ip 2>/dev/null | \ | ||
| 79 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 80 | then | ||
| 81 | with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s" | ||
| 82 | ac_cv_ping_packets_first=yes | ||
| 83 | AC_MSG_RESULT([$with_ping_command]) | ||
| 84 | |||
| 85 | -elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \ | ||
| 86 | +elif $PATH_TO_PING -n -c 1 $first_ip 2>/dev/null | \ | ||
| 87 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 88 | then | ||
| 89 | with_ping_command="$PATH_TO_PING -n -c %d %s" | ||
| 90 | @@ -1034,7 +1035,7 @@ | ||
| 91 | if test -n "$PATH_TO_NSLOOKUP" | ||
| 92 | then | ||
| 93 | AC_MSG_CHECKING(for nslookup syntax) | ||
| 94 | - if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null | ||
| 95 | + if $PATH_TO_NSLOOKUP -sil $first_ip 2>&1 | grep ["Invalid option: sil"] >/dev/null | ||
| 96 | then | ||
| 97 | ac_cv_nslookup_command="$PATH_TO_NSLOOKUP" | ||
| 98 | AC_MSG_RESULT([$ac_cv_nslookup_command]) | ||
| 99 | diff -Nru plugins/check_dig.c.orig plugins/check_dig.c | ||
| 100 | --- plugins/check_dig.c.orig 2007-07-29 20:59:04.000000000 +0200 | ||
| 101 | +++ plugins/check_dig.c 2007-07-29 20:53:15.000000000 +0200 | ||
| 102 | @@ -59,6 +59,7 @@ | ||
| 103 | char *record_type = "A"; | ||
| 104 | char *expected_address = NULL; | ||
| 105 | char *dns_server = NULL; | ||
| 106 | +char server_name[256]; | ||
| 107 | int verbose = FALSE; | ||
| 108 | int server_port = DEFAULT_PORT; | ||
| 109 | double warning_interval = UNDEFINED; | ||
| 110 | @@ -277,8 +278,13 @@ | ||
| 111 | dns_server = argv[c]; | ||
| 112 | } | ||
| 113 | else { | ||
| 114 | - dns_server = strdup ("127.0.0.1"); | ||
| 115 | - } | ||
| 116 | + if(gethostname(server_name, 255) != 0) { | ||
| 117 | + host_or_die("Can't get local hostname"); | ||
| 118 | + } | ||
| 119 | + else { | ||
| 120 | + dns_server = strdup (server_name); | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | } | ||
| 124 | |||
| 125 | return validate_arguments (); | ||
| 126 | |||
diff --git a/web/attachments/242023-check_ifstatus.patch b/web/attachments/242023-check_ifstatus.patch new file mode 100644 index 0000000..76f490d --- /dev/null +++ b/web/attachments/242023-check_ifstatus.patch | |||
| @@ -0,0 +1,241 @@ | |||
| 1 | 1a2,12 | ||
| 2 | > # vim:foldmethod=syntax:tabstop=4:shiftwidth=4 | ||
| 3 | > # | ||
| 4 | > # matthew.martin, Tuesday August 14, 2007 | ||
| 5 | > # Problems with check_ifstatus.pl | ||
| 6 | > # 1) "No response from remote host" should be unknown, not critical, right? | ||
| 7 | > # 2) Serial link "dormant" should be critical, not okay | ||
| 8 | > # 3) dormant, excluded and unused interfaces are not correctly counted | ||
| 9 | > # 4) default exclusions were broken, fix that and add a couple default exclusions | ||
| 10 | > # 5) made the formatting in this file more consistent | ||
| 11 | > # | ||
| 12 | > # check_ifstatus.pl - nagios plugin | ||
| 13 | 3,4d13 | ||
| 14 | < # check_ifstatus.pl - nagios plugin | ||
| 15 | < # | ||
| 16 | 29c38 | ||
| 17 | < # | ||
| 18 | --- | ||
| 19 | > # | ||
| 20 | 36c45 | ||
| 21 | < use lib "/opt/csw/libexec/nagios-plugins" ; | ||
| 22 | --- | ||
| 23 | > use lib "/opt/csw/libexec/nagios-plugins"; | ||
| 24 | 49d57 | ||
| 25 | < | ||
| 26 | 94c102 | ||
| 27 | < my %excluded ; | ||
| 28 | --- | ||
| 29 | > my %excluded; | ||
| 30 | 97,100d104 | ||
| 31 | < | ||
| 32 | < | ||
| 33 | < | ||
| 34 | < | ||
| 35 | 103,104c107,108 | ||
| 36 | < print ("ERROR: No snmp response from $hostname (alarm timeout)\n"); | ||
| 37 | < exit $ERRORS{"UNKNOWN"}; | ||
| 38 | --- | ||
| 39 | > print ("ERROR: No snmp response from $hostname (alarm timeout)\n"); | ||
| 40 | > exit $ERRORS{"UNKNOWN"}; | ||
| 41 | 107,108c111 | ||
| 42 | < | ||
| 43 | < #Option checking | ||
| 44 | --- | ||
| 45 | > # Option checking | ||
| 46 | 111,112c114 | ||
| 47 | < if ($status != 0) | ||
| 48 | < { | ||
| 49 | --- | ||
| 50 | > if ($status != 0) { | ||
| 51 | 117d118 | ||
| 52 | < | ||
| 53 | 127,129d127 | ||
| 54 | < | ||
| 55 | < | ||
| 56 | < | ||
| 57 | 131,135c129,135 | ||
| 58 | < | ||
| 59 | < if (!defined($response = $session->get_table($snmpoid))) { | ||
| 60 | < $answer=$session->error; | ||
| 61 | < $session->close; | ||
| 62 | < $state = 'CRITICAL'; | ||
| 63 | --- | ||
| 64 | > if (!defined($response = $session->get_table($snmpoid))) { | ||
| 65 | > $answer=$session->error; | ||
| 66 | > $session->close; | ||
| 67 | > # matthew.martin. Tuesday August 14, 2007 | ||
| 68 | > # I think a SNMP error should give UNKNOWN, not CRITICAL | ||
| 69 | > #$state = 'CRITICAL'; | ||
| 70 | > $state = 'UNKNOWN'; | ||
| 71 | 138c138 | ||
| 72 | < }else{ | ||
| 73 | --- | ||
| 74 | > } else { | ||
| 75 | 141,142c141,142 | ||
| 76 | < exit $ERRORS{$state}; | ||
| 77 | < } | ||
| 78 | --- | ||
| 79 | > exit $ERRORS{$state}; | ||
| 80 | > } | ||
| 81 | 144,148c144,148 | ||
| 82 | < foreach $snmpkey (keys %{$response}) { | ||
| 83 | < $snmpkey =~ /.*\.(\d+)$/; | ||
| 84 | < $key = $1; | ||
| 85 | < $ifStatus{$key}{$snmpoid} = $response->{$snmpkey}; | ||
| 86 | < } | ||
| 87 | --- | ||
| 88 | > foreach $snmpkey (keys %{$response}) { | ||
| 89 | > $snmpkey =~ /.*\.(\d+)$/; | ||
| 90 | > $key = $1; | ||
| 91 | > $ifStatus{$key}{$snmpoid} = $response->{$snmpkey}; | ||
| 92 | > } | ||
| 93 | 151d150 | ||
| 94 | < | ||
| 95 | 155a155,156 | ||
| 96 | > # matthew.martin. This script cannot tell that specific logical interfaces are | ||
| 97 | > # associated with their phys IF so it checks them all. | ||
| 98 | 158c159,160 | ||
| 99 | < # skip unused interfaces | ||
| 100 | --- | ||
| 101 | > # Skip interfaces flagged with -u (--unused_ports) | ||
| 102 | > # "A comma separated list of ifIndex values that should be excluded" | ||
| 103 | 160,163c162,166 | ||
| 104 | < # check only if interface is administratively up | ||
| 105 | < if ($ifStatus{$key}{$snmpIfAdminStatus} == 1 ) { | ||
| 106 | < | ||
| 107 | < # check only if interface type is not listed in %excluded | ||
| 108 | --- | ||
| 109 | > | ||
| 110 | > # Further checking only if interface is administratively up | ||
| 111 | > if ($ifStatus{$key}{$snmpIfAdminStatus} == 1 ) { | ||
| 112 | > | ||
| 113 | > # Check only if interface type is not listed in %excluded | ||
| 114 | 170,172c173,175 | ||
| 115 | < $ifStatus{$key}{$snmpIfName}, | ||
| 116 | < $ifStatus{$key}{$snmpIfAlias}); | ||
| 117 | < }else{ | ||
| 118 | --- | ||
| 119 | > $ifStatus{$key}{$snmpIfName}, | ||
| 120 | > $ifStatus{$key}{$snmpIfAlias}); | ||
| 121 | > } else { | ||
| 122 | 174c177 | ||
| 123 | < $ifStatus{$key}{$snmpIfDescr}); | ||
| 124 | --- | ||
| 125 | > $ifStatus{$key}{$snmpIfDescr}); | ||
| 126 | 178c181,182 | ||
| 127 | < }else{ | ||
| 128 | --- | ||
| 129 | > # matthew.martin Interface is listed in %excluded | ||
| 130 | > } else { | ||
| 131 | 181c185,187 | ||
| 132 | < | ||
| 133 | --- | ||
| 134 | > # matthew.martin If not administratively up, mark as unused. | ||
| 135 | > } elsif ($ifStatus{$key}{$snmpIfAdminStatus} == 2 ) { | ||
| 136 | > $ifunused++; | ||
| 137 | 183,184c189,195 | ||
| 138 | < }else{ | ||
| 139 | < $ifunused++; | ||
| 140 | --- | ||
| 141 | > } else { | ||
| 142 | > # matthew.martin. Original line: | ||
| 143 | > # $ifunused++; | ||
| 144 | > # actually matches the flag | ||
| 145 | > # -u (--unused_ports) A comma separated list of ifIndex values that should be excluded | ||
| 146 | > # They should be marked as excluded, not unused. | ||
| 147 | > $ifexclude++; | ||
| 148 | 188,208c199,224 | ||
| 149 | < if ($ifdown > 0) { | ||
| 150 | < $state = 'CRITICAL'; | ||
| 151 | < $answer = sprintf("host '%s', interfaces up: %d, down: %d, dormant: %d, excluded: %d, unused: %d<BR>", | ||
| 152 | < $hostname, | ||
| 153 | < $ifup, | ||
| 154 | < $ifdown, | ||
| 155 | < $ifdormant, | ||
| 156 | < $ifexclude, | ||
| 157 | < $ifunused); | ||
| 158 | < $answer = $answer . $ifmessage . "\n"; | ||
| 159 | < } | ||
| 160 | < else { | ||
| 161 | < $state = 'OK'; | ||
| 162 | < $answer = sprintf("host '%s', interfaces up: %d, down: %d, dormant: %d, excluded: %d, unused: %d", | ||
| 163 | < $hostname, | ||
| 164 | < $ifup, | ||
| 165 | < $ifdown, | ||
| 166 | < $ifdormant, | ||
| 167 | < $ifexclude, | ||
| 168 | < $ifunused); | ||
| 169 | < } | ||
| 170 | --- | ||
| 171 | > # matthew.martin | ||
| 172 | > # The original has dormant serial interfaces return status of "OK". | ||
| 173 | > # A dormant serial connection should be CRITICAL, right? | ||
| 174 | > # I changed the following line to address this: | ||
| 175 | > #if ($ifdown > 0) { | ||
| 176 | > if (($ifdown > 0) || ($ifdormant > 0)) { | ||
| 177 | > $state = 'CRITICAL'; | ||
| 178 | > $answer = sprintf("host '%s', interfaces up: %d, down: %d, dormant: %d, excluded: %d, unused: %d<BR>", | ||
| 179 | > $hostname, | ||
| 180 | > $ifup, | ||
| 181 | > $ifdown, | ||
| 182 | > $ifdormant, | ||
| 183 | > $ifexclude, | ||
| 184 | > $ifunused); | ||
| 185 | > $answer = $answer . $ifmessage . "\n"; | ||
| 186 | > } else { | ||
| 187 | > $state = 'OK'; | ||
| 188 | > $answer = sprintf("host '%s', interfaces up: %d, down: %d, dormant: %d, excluded: %d, unused: %d", | ||
| 189 | > $hostname, | ||
| 190 | > $ifup, | ||
| 191 | > $ifdown, | ||
| 192 | > $ifdormant, | ||
| 193 | > $ifexclude, | ||
| 194 | > $ifunused); | ||
| 195 | > } | ||
| 196 | > | ||
| 197 | 248c264 | ||
| 198 | < printf " in hex with 0x prefix generated by using \"snmpkey\" utility\n"; | ||
| 199 | --- | ||
| 200 | > printf " in hex with 0x prefix generated by using \"snmpkey\" utility\n"; | ||
| 201 | 252c268 | ||
| 202 | < printf " in hex with 0x prefix generated by using \"snmpkey\" utility\n"; | ||
| 203 | --- | ||
| 204 | > printf " in hex with 0x prefix generated by using \"snmpkey\" utility\n"; | ||
| 205 | 323c339 | ||
| 206 | < }else{ | ||
| 207 | --- | ||
| 208 | > } else { | ||
| 209 | 326c342 | ||
| 210 | < }else{ | ||
| 211 | --- | ||
| 212 | > } else { | ||
| 213 | 338c354 | ||
| 214 | < }else{ | ||
| 215 | --- | ||
| 216 | > } else { | ||
| 217 | 341c357 | ||
| 218 | < }else{ | ||
| 219 | --- | ||
| 220 | > } else { | ||
| 221 | 370,371d385 | ||
| 222 | < }else{ | ||
| 223 | < $excluded{23} = 1; # default PPP(23) if empty list - note (AIX seems to think PPP is 22 according to a post) | ||
| 224 | 372a387,391 | ||
| 225 | > # matthew.martin, Tuesday August 14, 2007. In the original this else was nested wrong and never matched | ||
| 226 | > } else { | ||
| 227 | > $excluded{23} = 1; # default PPP(23) if empty list - note (AIX seems to think PPP is 22 according to a post) | ||
| 228 | > $excluded{24} = 1; # matthew.martin, Tuesday August 14, 2007, Nokia, ifDescr.6 = loop0c0 Software Loopback Layer -- ifType.6 = softwareLoopback(24) (taken from a Nokia IP330) | ||
| 229 | > $excluded{25} = 1; # matthew.martin, Tuesday August 14, 2007, Nokia, ifDescr.1 = pppoe0 Ethernet Layer -- ifType.1 = eon(25) (from a Nokia IP350) | ||
| 230 | 378c397 | ||
| 231 | < foreach $key (@unused_ports) { | ||
| 232 | --- | ||
| 233 | > foreach $key (@unused_ports) { | ||
| 234 | 392c411 | ||
| 235 | < }else{ | ||
| 236 | --- | ||
| 237 | > } else { | ||
| 238 | 450c469 | ||
| 239 | < }else{ | ||
| 240 | --- | ||
| 241 | > } else { | ||
diff --git a/web/attachments/24487-check_rbl.c b/web/attachments/24487-check_rbl.c new file mode 100644 index 0000000..e9a7725 --- /dev/null +++ b/web/attachments/24487-check_rbl.c | |||
| @@ -0,0 +1,329 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | * | ||
| 3 | * check_rbl.c | ||
| 4 | * | ||
| 5 | * Modified by Tim Bell <bhat@trinity.unimelb.edu.au> 2002-06-05 | ||
| 6 | * based on: | ||
| 7 | * | ||
| 8 | * * check_dig.c | ||
| 9 | * * | ||
| 10 | * * Program: dig plugin for NetSaint | ||
| 11 | * * License: GPL | ||
| 12 | * * Copyright (c) 2000 | ||
| 13 | * * | ||
| 14 | * * $Id: check_dig.c,v 1.4.2.1 2001/04/13 20:19:47 karldebisschop Exp $ | ||
| 15 | * | ||
| 16 | *****************************************************************************/ | ||
| 17 | |||
| 18 | #include "config.h" | ||
| 19 | #include "common.h" | ||
| 20 | #include "utils.h" | ||
| 21 | #include "popen.h" | ||
| 22 | #include "string.h" | ||
| 23 | |||
| 24 | #define PROGNAME "check_rbl" | ||
| 25 | |||
| 26 | int process_arguments(int, char **); | ||
| 27 | int call_getopt(int, char **); | ||
| 28 | int validate_arguments(void); | ||
| 29 | int check_disk(int usp,int free_disk); | ||
| 30 | void print_help(void); | ||
| 31 | void print_usage(void); | ||
| 32 | char *reverse_ipaddr(char *ipaddr); | ||
| 33 | |||
| 34 | char *query_address=NULL; | ||
| 35 | char *query_address_rev=NULL; | ||
| 36 | char *dns_server=NULL; | ||
| 37 | char *rbl_name=NULL; | ||
| 38 | int verbose=FALSE; | ||
| 39 | |||
| 40 | int main(int argc, char **argv){ | ||
| 41 | char input_buffer[MAX_INPUT_BUFFER]; | ||
| 42 | char *command_line=NULL; | ||
| 43 | char *output=NULL; | ||
| 44 | int result=STATE_OK; | ||
| 45 | |||
| 46 | /* Set signal handling and alarm */ | ||
| 47 | if (signal(SIGALRM,popen_timeout_alarm_handler)==SIG_ERR) | ||
| 48 | usage("Cannot catch SIGALRM\n"); | ||
| 49 | |||
| 50 | if (process_arguments(argc,argv)!=OK) | ||
| 51 | usage("Could not parse arguments\n"); | ||
| 52 | |||
| 53 | /* reverse the octets in the IP address */ | ||
| 54 | query_address_rev = reverse_ipaddr(query_address); | ||
| 55 | |||
| 56 | /* build the command to run */ | ||
| 57 | if (dns_server) { | ||
| 58 | command_line=ssprintf(command_line,"%s @%s %s.%s", | ||
| 59 | PATH_TO_DIG,dns_server, | ||
| 60 | query_address_rev, rbl_name); | ||
| 61 | } else { | ||
| 62 | command_line=ssprintf(command_line,"%s %s.%s", | ||
| 63 | PATH_TO_DIG, | ||
| 64 | query_address_rev, rbl_name); | ||
| 65 | } | ||
| 66 | alarm(timeout_interval); | ||
| 67 | time(&start_time); | ||
| 68 | |||
| 69 | if (verbose) | ||
| 70 | printf("%s\n",command_line); | ||
| 71 | /* run the command */ | ||
| 72 | child_process=spopen(command_line); | ||
| 73 | if (child_process==NULL) { | ||
| 74 | printf("Could not open pipe: %s\n",command_line); | ||
| 75 | return STATE_UNKNOWN; | ||
| 76 | } | ||
| 77 | |||
| 78 | child_stderr=fdopen(child_stderr_array[fileno(child_process)],"r"); | ||
| 79 | if(child_stderr==NULL) | ||
| 80 | printf("Could not open stderr for %s\n",command_line); | ||
| 81 | |||
| 82 | output=strscpy(output,""); | ||
| 83 | |||
| 84 | while (fgets(input_buffer,MAX_INPUT_BUFFER-1,child_process)) { | ||
| 85 | |||
| 86 | /* the server is responding, we just got the host name... */ | ||
| 87 | if (strstr(input_buffer,";; ANSWER SECTION:")) { | ||
| 88 | |||
| 89 | /* get the host address */ | ||
| 90 | if (!fgets(input_buffer,MAX_INPUT_BUFFER-1,child_process)) | ||
| 91 | break; | ||
| 92 | |||
| 93 | if (strpbrk(input_buffer,"\r\n")) | ||
| 94 | input_buffer[strcspn(input_buffer,"\r\n")] = '\0'; | ||
| 95 | |||
| 96 | if (strstr(input_buffer,query_address_rev)==input_buffer) { | ||
| 97 | output=strscpy(output,input_buffer); | ||
| 98 | /* we found it, which means it's listed! */ | ||
| 99 | result=STATE_CRITICAL; | ||
| 100 | } else { | ||
| 101 | strcpy(output,"Server not RBL listed."); | ||
| 102 | result=STATE_OK; | ||
| 103 | } | ||
| 104 | |||
| 105 | continue; | ||
| 106 | } | ||
| 107 | |||
| 108 | } | ||
| 109 | |||
| 110 | /* | ||
| 111 | if (result!=STATE_OK) { | ||
| 112 | strcpy(output,"No ANSWER SECTION found"); | ||
| 113 | } | ||
| 114 | */ | ||
| 115 | |||
| 116 | while (fgets(input_buffer,MAX_INPUT_BUFFER-1,child_stderr)) { | ||
| 117 | /* If we get anything on STDERR, at least set warning */ | ||
| 118 | result=error_set(result,STATE_WARNING); | ||
| 119 | printf("%s",input_buffer); | ||
| 120 | if (!strcmp(output,"")) | ||
| 121 | strcpy(output,1+index(input_buffer,':')); | ||
| 122 | } | ||
| 123 | |||
| 124 | (void)fclose(child_stderr); | ||
| 125 | |||
| 126 | /* close the pipe */ | ||
| 127 | if (spclose(child_process)) { | ||
| 128 | result=error_set(result,STATE_WARNING); | ||
| 129 | if (!strcmp(output,"")) | ||
| 130 | strcpy(output,"nslookup returned error status"); | ||
| 131 | } | ||
| 132 | |||
| 133 | (void)time(&end_time); | ||
| 134 | |||
| 135 | if (result==STATE_OK) | ||
| 136 | printf("RBL check okay - not listed.\n"); | ||
| 137 | else if (result==STATE_WARNING) | ||
| 138 | printf("RBL WARNING - %s\n",!strcmp(output,"")?" Probably a non-existent host/domain":output); | ||
| 139 | else if (result==STATE_CRITICAL) | ||
| 140 | printf("RBL CRITICAL - %s is listed on %s\n",query_address, rbl_name); | ||
| 141 | else | ||
| 142 | printf("DNS problem - %s\n",!strcmp(output,"")?" Probably a non-existent host/domain":output); | ||
| 143 | |||
| 144 | return result; | ||
| 145 | } | ||
| 146 | |||
| 147 | /* reverse the ipaddr */ | ||
| 148 | char *reverse_ipaddr(char *ipaddr) | ||
| 149 | { | ||
| 150 | static char revip[MAX_HOST_ADDRESS_LENGTH]; | ||
| 151 | int a, b, c, d; | ||
| 152 | |||
| 153 | if (strlen(ipaddr) >= MAX_HOST_ADDRESS_LENGTH || | ||
| 154 | sscanf(ipaddr, "%d.%d.%d.%d", &a, &b, &c, &d) != 4) { | ||
| 155 | usage("IP address invalid or too long"); | ||
| 156 | } | ||
| 157 | sprintf(revip, "%d.%d.%d.%d", d, c, b, a); | ||
| 158 | |||
| 159 | return revip; | ||
| 160 | } | ||
| 161 | |||
| 162 | |||
| 163 | /* process command-line arguments */ | ||
| 164 | int process_arguments(int argc, char **argv) | ||
| 165 | { | ||
| 166 | int c; | ||
| 167 | |||
| 168 | if(argc<2) | ||
| 169 | return ERROR; | ||
| 170 | |||
| 171 | |||
| 172 | c=0; | ||
| 173 | while((c+=(call_getopt(argc-c,&argv[c])))<argc){ | ||
| 174 | |||
| 175 | if (is_option(argv[c])) | ||
| 176 | continue; | ||
| 177 | |||
| 178 | if (query_address==NULL) { | ||
| 179 | if (is_host(argv[c])) { | ||
| 180 | query_address=argv[c]; | ||
| 181 | } else { | ||
| 182 | usage("Invalid host name"); | ||
| 183 | } | ||
| 184 | } | ||
| 185 | } | ||
| 186 | |||
| 187 | return validate_arguments(); | ||
| 188 | } | ||
| 189 | |||
| 190 | |||
| 191 | |||
| 192 | |||
| 193 | |||
| 194 | |||
| 195 | int call_getopt(int argc, char **argv) | ||
| 196 | { | ||
| 197 | int c,i=0; | ||
| 198 | |||
| 199 | #ifdef HAVE_GETOPT_H | ||
| 200 | int option_index = 0; | ||
| 201 | static struct option long_options[] = | ||
| 202 | { | ||
| 203 | {"hostname", required_argument,0,'H'}, | ||
| 204 | {"server", required_argument,0,'s'}, | ||
| 205 | {"rblname", required_argument,0,'r'}, | ||
| 206 | {"verbose", no_argument, 0,'v'}, | ||
| 207 | {"version", no_argument, 0,'V'}, | ||
| 208 | {"help", no_argument, 0,'h'}, | ||
| 209 | {0,0,0,0} | ||
| 210 | }; | ||
| 211 | #endif | ||
| 212 | |||
| 213 | while (1){ | ||
| 214 | #ifdef HAVE_GETOPT_H | ||
| 215 | c = getopt_long(argc,argv,"+hVvt:s:H:r:",long_options,&option_index); | ||
| 216 | #else | ||
| 217 | c = getopt(argc,argv,"+?hVvt:s:H:r:"); | ||
| 218 | #endif | ||
| 219 | |||
| 220 | i++; | ||
| 221 | |||
| 222 | if(c==-1||c==EOF||c==1) | ||
| 223 | break; | ||
| 224 | |||
| 225 | switch (c) | ||
| 226 | { | ||
| 227 | case 't': | ||
| 228 | case 'l': | ||
| 229 | case 'H': | ||
| 230 | i++; | ||
| 231 | } | ||
| 232 | |||
| 233 | switch (c) | ||
| 234 | { | ||
| 235 | case 'H': /* hostname */ | ||
| 236 | if (is_host(optarg)) { | ||
| 237 | query_address=optarg; | ||
| 238 | } else { | ||
| 239 | usage("Invalid host name (-H)\n"); | ||
| 240 | } | ||
| 241 | break; | ||
| 242 | case 's': /* server */ | ||
| 243 | if (is_host(optarg)) { | ||
| 244 | dns_server=optarg; | ||
| 245 | } else { | ||
| 246 | usage("Invalid host name (-s)\n"); | ||
| 247 | } | ||
| 248 | break; | ||
| 249 | case 'r': /* rblname */ | ||
| 250 | rbl_name=optarg; | ||
| 251 | break; | ||
| 252 | case 'v': /* verbose */ | ||
| 253 | verbose=TRUE; | ||
| 254 | break; | ||
| 255 | case 't': /* timeout */ | ||
| 256 | if (is_intnonneg(optarg)) { | ||
| 257 | timeout_interval=atoi(optarg); | ||
| 258 | } else { | ||
| 259 | usage("Time interval must be a nonnegative integer\n"); | ||
| 260 | } | ||
| 261 | break; | ||
| 262 | case 'V': /* version */ | ||
| 263 | print_revision(PROGNAME,"$Revision: 1.4.2.1 $"); | ||
| 264 | exit(STATE_OK); | ||
| 265 | case 'h': /* help */ | ||
| 266 | print_help(); | ||
| 267 | exit(STATE_OK); | ||
| 268 | case '?': /* help */ | ||
| 269 | usage("Invalid argument\n"); | ||
| 270 | } | ||
| 271 | } | ||
| 272 | return i; | ||
| 273 | } | ||
| 274 | |||
| 275 | |||
| 276 | |||
| 277 | |||
| 278 | |||
| 279 | int validate_arguments(void) | ||
| 280 | { | ||
| 281 | if (query_address == NULL || rbl_name == NULL) | ||
| 282 | return ERROR; | ||
| 283 | else | ||
| 284 | return OK; | ||
| 285 | } | ||
| 286 | |||
| 287 | |||
| 288 | |||
| 289 | |||
| 290 | |||
| 291 | void print_help(void) | ||
| 292 | { | ||
| 293 | print_revision(PROGNAME,"$Revision: 1.4.2.1 $"); | ||
| 294 | printf | ||
| 295 | ("Copyright (c) 2000 Karl DeBisschop\n\n" | ||
| 296 | "This plugin uses dig to test whether the specified host is on any RBL lists.\n\n"); | ||
| 297 | print_usage(); | ||
| 298 | printf | ||
| 299 | ("\nOptions:\n" | ||
| 300 | " -H, --hostname=IPADDRESS\n" | ||
| 301 | " Check status of indicated host\n" | ||
| 302 | " -s, --server=STRING or IPADDRESS\n" | ||
| 303 | " DNS server to use\n" | ||
| 304 | " -r, --rblname=STRING\n" | ||
| 305 | " RBL domain name to use (e.g. relays.ordb.org)\n" | ||
| 306 | " -t, --timeout=INTEGER\n" | ||
| 307 | " Seconds before connection attempt times out (default: %d)\n" | ||
| 308 | " -v, --verbose\n" | ||
| 309 | " Print extra information (command-line use only)\n" | ||
| 310 | " -h, --help\n" | ||
| 311 | " Print detailed help screen\n" | ||
| 312 | " -V, --version\n" | ||
| 313 | " Print version information\n\n", | ||
| 314 | DEFAULT_SOCKET_TIMEOUT); | ||
| 315 | support(); | ||
| 316 | } | ||
| 317 | |||
| 318 | |||
| 319 | |||
| 320 | |||
| 321 | |||
| 322 | void print_usage(void) | ||
| 323 | { | ||
| 324 | printf | ||
| 325 | ("Usage: %s -H hostip -r rblname [-s server] [-t timeout] [-v]\n" | ||
| 326 | " %s --help\n" | ||
| 327 | " %s --version\n", | ||
| 328 | PROGNAME,PROGNAME,PROGNAME); | ||
| 329 | } | ||
diff --git a/web/attachments/246468-check_ntp_flags.patch b/web/attachments/246468-check_ntp_flags.patch new file mode 100644 index 0000000..e659ec5 --- /dev/null +++ b/web/attachments/246468-check_ntp_flags.patch | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | *** nagios-plugins-1.4.9/plugins/check_ntp.c 2007-04-10 09:17:18.000000000 +0200 | ||
| 2 | --- nagios-plugins-1.4.9_flags/plugins/check_ntp.c 2007-09-20 15:14:54.000000000 +0200 | ||
| 3 | *************** | ||
| 4 | *** 86,91 **** | ||
| 5 | --- 86,92 ---- | ||
| 6 | double rtdelay; /* converted from the ntp_message */ | ||
| 7 | double rtdisp; /* converted from the ntp_message */ | ||
| 8 | double offset[AVG_NUM]; /* offsets from each response */ | ||
| 9 | + uint8_t flags; /* byte with leapindicator,vers,mode. see macros */ | ||
| 10 | } ntp_server_results; | ||
| 11 | |||
| 12 | /* this structure holds everything in an ntp control message as per rfc1305 */ | ||
| 13 | *************** | ||
| 14 | *** 302,307 **** | ||
| 15 | --- 303,314 ---- | ||
| 16 | |||
| 17 | /* for each server */ | ||
| 18 | for(cserver=0; cserver<nservers; cserver++){ | ||
| 19 | + /* sort out servers with error flags */ | ||
| 20 | + if ( LI(slist[cserver].flags) != LI_NOWARNING ){ | ||
| 21 | + if (verbose) printf("discarding peer id %d: flags=%d\n", cserver, LI(slist[cserver].flags)); | ||
| 22 | + break; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | /* compare it to each of the servers already in the candidate list */ | ||
| 26 | for(i=0; i<csize; i++){ | ||
| 27 | /* does it have an equal or better stratum? */ | ||
| 28 | *************** | ||
| 29 | *** 450,455 **** | ||
| 30 | --- 457,463 ---- | ||
| 31 | servers[i].rtdisp=NTP32asDOUBLE(req[i].rtdisp); | ||
| 32 | servers[i].rtdelay=NTP32asDOUBLE(req[i].rtdelay); | ||
| 33 | servers[i].waiting=0; | ||
| 34 | + servers[i].flags=req[i].flags; | ||
| 35 | servers_readable--; | ||
| 36 | one_read = 1; | ||
| 37 | if(servers[i].num_responses==AVG_NUM) servers_completed++; | ||
| 38 | *************** | ||
| 39 | *** 808,813 **** | ||
| 40 | --- 816,822 ---- | ||
| 41 | } | ||
| 42 | if(offset_result==STATE_CRITICAL){ | ||
| 43 | asprintf(&result_line, "%s %s", result_line, _("Offset unknown")); | ||
| 44 | + asprintf(&perfdata_line, "%s", "no perfdata"); | ||
| 45 | } else { | ||
| 46 | if(offset_result==STATE_WARNING){ | ||
| 47 | asprintf(&result_line, "%s %s", result_line, _("Unable to fully sample sync server")); | ||
diff --git a/web/attachments/249657-nagiosplugins-checkhttp-crash.patch b/web/attachments/249657-nagiosplugins-checkhttp-crash.patch new file mode 100644 index 0000000..d128581 --- /dev/null +++ b/web/attachments/249657-nagiosplugins-checkhttp-crash.patch | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | --- plugins/check_http.c.old 2007-07-21 18:29:01.000000000 +0200 | ||
| 2 | +++ plugins/check_http.c 2007-10-14 22:05:26.000000000 +0200 | ||
| 3 | @@ -1092,7 +1092,7 @@ redir (char *pos, char *status_line) | ||
| 4 | die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate url\n")); | ||
| 5 | |||
| 6 | while (pos) { | ||
| 7 | - sscanf (pos, "%[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]:%n", xx, &i); | ||
| 8 | + sscanf (pos, "%1[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]:%n", xx, &i); | ||
| 9 | if (i == 0) { | ||
| 10 | pos += (size_t) strcspn (pos, "\r\n"); | ||
| 11 | pos += (size_t) strspn (pos, "\r\n"); | ||
diff --git a/web/attachments/24999-check_snmp.patch.txt b/web/attachments/24999-check_snmp.patch.txt new file mode 100644 index 0000000..f56dd49 --- /dev/null +++ b/web/attachments/24999-check_snmp.patch.txt | |||
| @@ -0,0 +1,124 @@ | |||
| 1 | *** check_snmp.c.orig Wed Jun 12 20:13:42 2002 | ||
| 2 | --- check_snmp.c Wed Jun 12 20:15:07 2002 | ||
| 3 | *************** int errcode, excode; | ||
| 4 | *** 94,99 **** | ||
| 5 | --- 94,100 ---- | ||
| 6 | |||
| 7 | char *server_address = NULL; | ||
| 8 | char *community = NULL; | ||
| 9 | + char *mibslist = NULL; | ||
| 10 | char oid[MAX_INPUT_BUFFER] = ""; | ||
| 11 | char *label = NULL; | ||
| 12 | char *units = NULL; | ||
| 13 | *************** main (int argc, char **argv) | ||
| 14 | *** 143,152 **** | ||
| 15 | usage ("Incorrect arguments supplied\n"); | ||
| 16 | |||
| 17 | /* create the command line to execute */ | ||
| 18 | ! command_line = ssprintf | ||
| 19 | ! (command_line, | ||
| 20 | ! "%s -m ALL -v 1 %s %s %s", | ||
| 21 | ! PATH_TO_SNMPGET, server_address, community, oid); | ||
| 22 | |||
| 23 | /* run the command */ | ||
| 24 | child_process = spopen (command_line); | ||
| 25 | --- 144,159 ---- | ||
| 26 | usage ("Incorrect arguments supplied\n"); | ||
| 27 | |||
| 28 | /* create the command line to execute */ | ||
| 29 | ! if (mibslist == NULL) | ||
| 30 | ! command_line = ssprintf | ||
| 31 | ! (command_line, | ||
| 32 | ! "%s -v 1 %s %s %s", | ||
| 33 | ! PATH_TO_SNMPGET, server_address, community, oid); | ||
| 34 | ! else | ||
| 35 | ! command_line = ssprintf | ||
| 36 | ! (command_line, | ||
| 37 | ! "%s -m %s -v 1 %s %s %s", | ||
| 38 | ! PATH_TO_SNMPGET, mibslist, server_address, community, oid); | ||
| 39 | |||
| 40 | /* run the command */ | ||
| 41 | child_process = spopen (command_line); | ||
| 42 | *************** call_getopt (int argc, char **argv) | ||
| 43 | *** 368,373 **** | ||
| 44 | --- 375,381 ---- | ||
| 45 | {"warning", required_argument, 0, 'w'}, | ||
| 46 | {"hostname", required_argument, 0, 'H'}, | ||
| 47 | {"community", required_argument, 0, 'C'}, | ||
| 48 | + {"mibslist", required_argument, 0, 'm'}, | ||
| 49 | {"oid", required_argument, 0, 'o'}, | ||
| 50 | {"object", required_argument, 0, 'o'}, | ||
| 51 | {"delimiter", required_argument, 0, 'd'}, | ||
| 52 | *************** call_getopt (int argc, char **argv) | ||
| 53 | *** 385,394 **** | ||
| 54 | while (1) { | ||
| 55 | #ifdef HAVE_GETOPT_H | ||
| 56 | c = | ||
| 57 | ! getopt_long (argc, argv, "+?hVt:c:w:H:C:o:d:D:s:R:r:l:u:", | ||
| 58 | long_options, &option_index); | ||
| 59 | #else | ||
| 60 | ! c = getopt (argc, argv, "+?hVt:c:w:H:C:o:d:D:s:R:r:l:u:"); | ||
| 61 | #endif | ||
| 62 | |||
| 63 | if (c == -1 || c == EOF) | ||
| 64 | --- 393,402 ---- | ||
| 65 | while (1) { | ||
| 66 | #ifdef HAVE_GETOPT_H | ||
| 67 | c = | ||
| 68 | ! getopt_long (argc, argv, "+?hVt:c:w:H:C:m:o:d:D:s:R:r:l:u:", | ||
| 69 | long_options, &option_index); | ||
| 70 | #else | ||
| 71 | ! c = getopt (argc, argv, "+?hVt:c:w:H:C:m:o:d:D:s:R:r:l:u:"); | ||
| 72 | #endif | ||
| 73 | |||
| 74 | if (c == -1 || c == EOF) | ||
| 75 | *************** call_getopt (int argc, char **argv) | ||
| 76 | *** 401,406 **** | ||
| 77 | --- 409,415 ---- | ||
| 78 | case 'w': | ||
| 79 | case 'H': | ||
| 80 | case 'C': | ||
| 81 | + case 'm': | ||
| 82 | case 'o': | ||
| 83 | case 'd': | ||
| 84 | case 'D': | ||
| 85 | *************** call_getopt (int argc, char **argv) | ||
| 86 | *** 466,471 **** | ||
| 87 | --- 475,483 ---- | ||
| 88 | case 'C': /* group or community */ | ||
| 89 | community = strscpy (community, optarg); | ||
| 90 | break; | ||
| 91 | + case 'm': /* mibs list */ | ||
| 92 | + mibslist = strscpy (mibslist, optarg); | ||
| 93 | + break; | ||
| 94 | case 'o': /* object identifier */ | ||
| 95 | for (ptr = optarg; (ptr = index (ptr, ',')); ptr++) | ||
| 96 | ptr[0] = ' '; | ||
| 97 | *************** void | ||
| 98 | *** 577,583 **** | ||
| 99 | print_usage (void) | ||
| 100 | { | ||
| 101 | printf | ||
| 102 | ! ("Usage: check_snmp -H <ip_address> -o <OID> [-w warn_range] [-c crit_range] \n" | ||
| 103 | " [-C community] [-s string] [-r regex] [-R regexi] [-t timeout]\n" | ||
| 104 | " [-l label] [-u units] [-d delimiter] [-D output-delimiter]\n" | ||
| 105 | " check_snmp --help\n" " check_snmp --version\n"); | ||
| 106 | --- 589,595 ---- | ||
| 107 | print_usage (void) | ||
| 108 | { | ||
| 109 | printf | ||
| 110 | ! ("Usage: check_snmp -m <mibs_list> -H <ip_address> -o <OID> [-w warn_range] [-c crit_range] \n" | ||
| 111 | " [-C community] [-s string] [-r regex] [-R regexi] [-t timeout]\n" | ||
| 112 | " [-l label] [-u units] [-d delimiter] [-D output-delimiter]\n" | ||
| 113 | " check_snmp --help\n" " check_snmp --version\n"); | ||
| 114 | *************** print_help (char *cmd) | ||
| 115 | *** 595,600 **** | ||
| 116 | --- 607,614 ---- | ||
| 117 | " Print detailed help screen\n" | ||
| 118 | " -V, --version\n" | ||
| 119 | " Print version information\n" | ||
| 120 | + " -m, --mibslist=STRING\n" | ||
| 121 | + " Specify which mibs to use (defaults to default mib list)\n" | ||
| 122 | " -H, --hostname=HOST\n" | ||
| 123 | " Name or IP address of the device you wish to query\n" | ||
| 124 | " -o, --oid=OID(s)\n" | ||
diff --git a/web/attachments/250217-nagiosplugins-checksnmp-crash.patch b/web/attachments/250217-nagiosplugins-checksnmp-crash.patch new file mode 100644 index 0000000..6fc9540 --- /dev/null +++ b/web/attachments/250217-nagiosplugins-checksnmp-crash.patch | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | --- plugins/check_snmp.c.old 2007-05-29 07:22:32.000000000 +0200 | ||
| 2 | +++ plugins/check_snmp.c 2007-10-17 22:08:49.000000000 +0200 | ||
| 3 | @@ -219,12 +219,16 @@ main (int argc, char **argv) | ||
| 4 | |||
| 5 | ptr = output; | ||
| 6 | |||
| 7 | - strcat(perfstr, "| "); | ||
| 8 | + strncat(perfstr, "| ", sizeof(perfstr)-strlen(perfstr)-1); | ||
| 9 | while (ptr) { | ||
| 10 | char *foo; | ||
| 11 | + unsigned int copylen; | ||
| 12 | |||
| 13 | foo = strstr (ptr, delimiter); | ||
| 14 | - strncat(perfstr, ptr, foo-ptr); | ||
| 15 | + copylen = foo-ptr; | ||
| 16 | + if (copylen > sizeof(perfstr)-strlen(perfstr)-1) | ||
| 17 | + copylen = sizeof(perfstr)-strlen(perfstr)-1; | ||
| 18 | + strncat(perfstr, ptr, copylen); | ||
| 19 | ptr = foo; | ||
| 20 | |||
| 21 | if (ptr == NULL) | ||
| 22 | @@ -357,11 +361,11 @@ main (int argc, char **argv) | ||
| 23 | |||
| 24 | i++; | ||
| 25 | |||
| 26 | - strcat(perfstr, "="); | ||
| 27 | - strcat(perfstr, show); | ||
| 28 | + strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1); | ||
| 29 | + strncat(perfstr, show, sizeof(perfstr)-strlen(perfstr)-1); | ||
| 30 | if (type) | ||
| 31 | - strcat(perfstr, type); | ||
| 32 | - strcat(perfstr, " "); | ||
| 33 | + strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1); | ||
| 34 | + strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1); | ||
| 35 | |||
| 36 | } /* end while (ptr) */ | ||
| 37 | |||
diff --git a/web/attachments/250664-check_http.c.diff b/web/attachments/250664-check_http.c.diff new file mode 100644 index 0000000..add888d --- /dev/null +++ b/web/attachments/250664-check_http.c.diff | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | Index: nagios-plugins-trunk/plugins/check_http.c | ||
| 2 | =================================================================== | ||
| 3 | --- nagios-plugins-trunk/plugins/check_http.c (revision 1808) | ||
| 4 | +++ nagios-plugins-trunk/plugins/check_http.c (working copy) | ||
| 5 | @@ -247,7 +247,7 @@ | ||
| 6 | break; | ||
| 7 | case 'c': /* critical time threshold */ | ||
| 8 | if (!is_nonnegative (optarg)) | ||
| 9 | - usage2 (_("Critical threshold must be integer"), optarg); | ||
| 10 | + usage2 (_("Critical threshold must be non-negative number"), optarg); | ||
| 11 | else { | ||
| 12 | critical_time = strtod (optarg, NULL); | ||
| 13 | check_critical_time = TRUE; | ||
| 14 | @@ -255,7 +255,7 @@ | ||
| 15 | break; | ||
| 16 | case 'w': /* warning time threshold */ | ||
| 17 | if (!is_nonnegative (optarg)) | ||
| 18 | - usage2 (_("Warning threshold must be integer"), optarg); | ||
| 19 | + usage2 (_("Warning threshold must be non-negative number"), optarg); | ||
| 20 | else { | ||
| 21 | warning_time = strtod (optarg, NULL); | ||
| 22 | check_warning_time = TRUE; | ||
| 23 | @@ -982,14 +982,14 @@ | ||
| 24 | microsec = deltime (tv); | ||
| 25 | elapsed_time = (double)microsec / 1.0e6; | ||
| 26 | asprintf (&msg, | ||
| 27 | - _("HTTP WARNING: %s - %.3f second response time %s|%s %s\n"), | ||
| 28 | + _("%s - %.3f second response time %s|%s %s\n"), | ||
| 29 | status_line, elapsed_time, | ||
| 30 | (display_html ? "</A>" : ""), | ||
| 31 | perfd_time (elapsed_time), perfd_size (pagesize)); | ||
| 32 | if (check_critical_time == TRUE && elapsed_time > critical_time) | ||
| 33 | - die (STATE_CRITICAL, "%s", msg); | ||
| 34 | + die (STATE_CRITICAL, "HTTP CRITICAL: %s", msg); | ||
| 35 | if (check_warning_time == TRUE && elapsed_time > warning_time) | ||
| 36 | - die (STATE_WARNING, "%s", msg); | ||
| 37 | + die (STATE_WARNING, "HTTP WARNING: %s", msg); | ||
| 38 | |||
| 39 | /* Page and Header content checks go here */ | ||
| 40 | /* these checks should be last */ | ||
diff --git a/web/attachments/254104-check_http.c-head-patch b/web/attachments/254104-check_http.c-head-patch new file mode 100644 index 0000000..490a6a4 --- /dev/null +++ b/web/attachments/254104-check_http.c-head-patch | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | 75d74 | ||
| 2 | < int use_head = FALSE; | ||
| 3 | 176,177c175 | ||
| 4 | < INVERT_REGEX = CHAR_MAX + 1, | ||
| 5 | < USE_HEAD = CHAR_MAX + 2 | ||
| 6 | --- | ||
| 7 | > INVERT_REGEX = CHAR_MAX + 1 | ||
| 8 | 208d205 | ||
| 9 | < {"head", no_argument, NULL, USE_HEAD}, | ||
| 10 | 376,378d372 | ||
| 11 | < case USE_HEAD: | ||
| 12 | < use_head = 1; | ||
| 13 | < break; | ||
| 14 | 459,466d452 | ||
| 15 | < if ( use_head == 1 ) { | ||
| 16 | < if ( strcmp(http_method, "POST") == 0 ) | ||
| 17 | < usage4 (_("Using POST data and HEAD requests is not supported")); | ||
| 18 | < else | ||
| 19 | < no_body = TRUE; | ||
| 20 | < http_method = strdup("HEAD"); | ||
| 21 | < } | ||
| 22 | < | ||
| 23 | 1320,1322d1305 | ||
| 24 | < printf (" %s\n", "--head"); | ||
| 25 | < printf (" %s\n", _("make a HEAD request instead of GET")); | ||
| 26 | < printf (" %s\n", _("this implies -N\n")); | ||
| 27 | 1398c1381 | ||
| 28 | < printf (" [-k string] [-S] [-C <age>] [-T <content-type>] [--head]\n"); | ||
| 29 | --- | ||
| 30 | > printf (" [-k string] [-S] [-C <age>] [-T <content-type>]\n"); | ||
diff --git a/web/attachments/256811-check_disk.extra-debug.patch b/web/attachments/256811-check_disk.extra-debug.patch new file mode 100644 index 0000000..c083be7 --- /dev/null +++ b/web/attachments/256811-check_disk.extra-debug.patch | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | Index: plugins/check_disk.c | ||
| 2 | =================================================================== | ||
| 3 | --- plugins/check_disk.c (revision 1828) | ||
| 4 | +++ plugins/check_disk.c (working copy) | ||
| 5 | @@ -311,6 +311,10 @@ | ||
| 6 | available_to_root = fsp.fsu_bfree; | ||
| 7 | used = total - available_to_root; | ||
| 8 | |||
| 9 | + if (verbose >= 3) | ||
| 10 | + printf ("For %s, total=%llu, available=%llu, available_to_root=%llu, used=%llu, fsp.fsu_files=%llu, fsp.fsu_ffree=%llu\n", | ||
| 11 | + me->me_mountdir, total, available, available_to_root, used, fsp.fsu_files, fsp.fsu_ffree); | ||
| 12 | + | ||
| 13 | dused_pct = calculate_percent( used, used + available ); /* used + available can never be > uintmax */ | ||
| 14 | |||
| 15 | dfree_pct = 100 - dused_pct; | ||
diff --git a/web/attachments/257980-check_ram.patch b/web/attachments/257980-check_ram.patch new file mode 100644 index 0000000..09e7a0a --- /dev/null +++ b/web/attachments/257980-check_ram.patch | |||
| @@ -0,0 +1,376 @@ | |||
| 1 | --- nagios-plugins-1.4.5.orig/configure.in | ||
| 2 | +++ nagios-plugins-1.4.5/configure.in | ||
| 3 | @@ -1585,7 +1585,7 @@ fi | ||
| 4 | if test -n "$ac_cv_proc_meminfo"; then | ||
| 5 | AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo]) | ||
| 6 | AC_DEFINE_UNQUOTED(PROC_MEMINFO,"$ac_cv_proc_meminfo",[path to /proc/meminfo if name changes]) | ||
| 7 | - EXTRAS="$EXTRAS check_swap" | ||
| 8 | + EXTRAS="$EXTRAS check_swap check_ram" | ||
| 9 | fi | ||
| 10 | |||
| 11 | AC_PATH_PROG(PATH_TO_DIG,dig) | ||
| 12 | --- nagios-plugins-1.4.5.orig/plugins/Makefile.am | ||
| 13 | +++ nagios-plugins-1.4.5/plugins/Makefile.am | ||
| 14 | @@ -23,7 +23,7 @@ check_tcp_programs = check_ftp check_ima | ||
| 15 | check_udp check_clamd @check_tcp_ssl@ | ||
| 16 | |||
| 17 | EXTRA_PROGRAMS = check_mysql check_radius check_pgsql check_snmp check_hpjd \ | ||
| 18 | - check_swap check_fping check_ldap check_game check_dig \ | ||
| 19 | + check_swap check_fping check_ldap check_game check_dig check_ram \ | ||
| 20 | check_nagios check_by_ssh check_dns check_nt check_ide_smart \ | ||
| 21 | check_procs check_mysql_query check_apt | ||
| 22 | |||
| 23 | @@ -76,6 +76,7 @@ check_pgsql_LDADD = $(NETLIBS) $(PGLIBS) | ||
| 24 | check_ping_LDADD = $(NETLIBS) popen.o | ||
| 25 | check_procs_LDADD = $(BASEOBJS) popen.o | ||
| 26 | check_radius_LDADD = $(NETLIBS) $(RADIUSLIBS) | ||
| 27 | +check_ram_LDADD = $(MATHLIBS) $(BASEOBJS) popen.o | ||
| 28 | check_real_LDADD = $(NETLIBS) | ||
| 29 | check_snmp_LDADD = $(BASEOBJS) popen.o | ||
| 30 | check_smtp_LDADD = $(SSLOBJS) $(NETLIBS) | ||
| 31 | @@ -115,6 +116,7 @@ check_pgsql_DEPENDENCIES = check_pgsql.c | ||
| 32 | check_ping_DEPENDENCIES = check_ping.c $(NETOBJS) popen.o $(DEPLIBS) | ||
| 33 | check_procs_DEPENDENCIES = check_procs.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 34 | check_radius_DEPENDENCIES = check_radius.c $(NETOBJS) $(DEPLIBS) | ||
| 35 | +check_ram_DEPENDENCIES = check_ram.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 36 | check_real_DEPENDENCIES = check_real.c $(NETOBJS) $(DEPLIBS) | ||
| 37 | check_snmp_DEPENDENCIES = check_snmp.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 38 | check_smtp_DEPENDENCIES = check_smtp.c $(SSLOBJS) $(NETOBJS) $(DEPLIBS) | ||
| 39 | --- /dev/null | ||
| 40 | +++ nagios-plugins-1.4.5/plugins/check_ram.c | ||
| 41 | @@ -0,0 +1,300 @@ | ||
| 42 | +/****************************************************************************** | ||
| 43 | +* | ||
| 44 | +* Nagios check_ram plugin | ||
| 45 | +* | ||
| 46 | +* License: GPL | ||
| 47 | +* Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net) | ||
| 48 | +* Copyright (c) 2000-2006 nagios-plugins team | ||
| 49 | +* Copyright (c) 2007 Christian Heim (christian.heim@uni-greifswald.de) | ||
| 50 | +* | ||
| 51 | +* Last Modified: $Date: $ | ||
| 52 | +* | ||
| 53 | +* Description: | ||
| 54 | +* | ||
| 55 | +* This file contains the check_ram plugin | ||
| 56 | +* | ||
| 57 | +* License Information: | ||
| 58 | +* | ||
| 59 | +* This program is free software; you can redistribute it and/or modify | ||
| 60 | +* it under the terms of the GNU General Public License as published by | ||
| 61 | +* the Free Software Foundation; either version 2 of the License, or | ||
| 62 | +* (at your option) any later version. | ||
| 63 | +* | ||
| 64 | +* This program is distributed in the hope that it will be useful, | ||
| 65 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 66 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 67 | +* GNU General Public License for more details. | ||
| 68 | +* | ||
| 69 | +* You should have received a copy of the GNU General Public License | ||
| 70 | +* along with this program; if not, write to the Free Software | ||
| 71 | +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 72 | +* | ||
| 73 | +* $Id: check_ram.c $ | ||
| 74 | +* | ||
| 75 | +*****************************************************************************/ | ||
| 76 | + | ||
| 77 | +const char *progname = "check_ram"; | ||
| 78 | +const char *revision = "$Revision: $"; | ||
| 79 | +const char *copyright = "2000-2007"; | ||
| 80 | +const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 81 | + | ||
| 82 | +#include "common.h" | ||
| 83 | +#include "popen.h" | ||
| 84 | +#include "utils.h" | ||
| 85 | + | ||
| 86 | +int check_ram (int usp, float free_ram_mb); | ||
| 87 | +int process_arguments (int argc, char **argv); | ||
| 88 | +int validate_arguments (void); | ||
| 89 | +void print_usage (void); | ||
| 90 | +void print_help (void); | ||
| 91 | + | ||
| 92 | +int warn_percent = 0; | ||
| 93 | +int crit_percent = 0; | ||
| 94 | +float warn_size_bytes = 0; | ||
| 95 | +float crit_size_bytes= 0; | ||
| 96 | +int verbose; | ||
| 97 | + | ||
| 98 | +int main (int argc, char **argv) | ||
| 99 | +{ | ||
| 100 | + int percent_used, percent; | ||
| 101 | + float total_ram_mb = 0, used_ram_mb = 0, free_ram_mb = 0; | ||
| 102 | + float dsktotal_mb = 0, dskused_mb = 0, dskfree_mb = 0, tmp_mb = 0; | ||
| 103 | + int result = STATE_UNKNOWN; | ||
| 104 | + char input_buffer[MAX_INPUT_BUFFER]; | ||
| 105 | +#ifdef HAVE_PROC_MEMINFO | ||
| 106 | + FILE *fp; | ||
| 107 | +#endif | ||
| 108 | + char str[32]; | ||
| 109 | + char *status; | ||
| 110 | + | ||
| 111 | + setlocale (LC_ALL, ""); | ||
| 112 | + bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 113 | + textdomain (PACKAGE); | ||
| 114 | + | ||
| 115 | + status = strdup (""); | ||
| 116 | + | ||
| 117 | + if (process_arguments (argc, argv) == ERROR) | ||
| 118 | + usage4 (_("Could not parse arguments")); | ||
| 119 | + | ||
| 120 | +#ifdef HAVE_PROC_MEMINFO | ||
| 121 | + if (verbose >= 3) { | ||
| 122 | + printf("Reading PROC_MEMINFO at %s\n", PROC_MEMINFO); | ||
| 123 | + } | ||
| 124 | + fp = fopen (PROC_MEMINFO, "r"); | ||
| 125 | + while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, fp)) { | ||
| 126 | + if (sscanf (input_buffer, "%*[M]%*[e]%*[m]%*[:] %f %f %f", &dsktotal_mb, &dskused_mb, &dskfree_mb) == 3) { | ||
| 127 | + dsktotal_mb = dsktotal_mb / 1048576; /* Apply conversion */ | ||
| 128 | + dskused_mb = dskused_mb / 1048576; | ||
| 129 | + dskfree_mb = dskfree_mb / 1048576; | ||
| 130 | + total_ram_mb += dsktotal_mb; | ||
| 131 | + used_ram_mb += dskused_mb; | ||
| 132 | + free_ram_mb += dskfree_mb; | ||
| 133 | + | ||
| 134 | + percent = 100 * (((double) dskused_mb) / ((double) dsktotal_mb)); | ||
| 135 | + result = max_state (result, check_ram (percent, dskfree_mb)); | ||
| 136 | + | ||
| 137 | + if (verbose) | ||
| 138 | + asprintf (&status, "%s [%.0f (%d%%)]", status, dskfree_mb, 100 - percent); | ||
| 139 | + } | ||
| 140 | + else if (sscanf (input_buffer, "%*[M]%*[e]%*[m]%[TotalFre]%*[:] %f %*[k]%*[B]", str, &tmp_mb)) { | ||
| 141 | + if (verbose >= 3) { | ||
| 142 | + printf("Got %s with %f\n", str, tmp_mb); | ||
| 143 | + } | ||
| 144 | + /* I think this part is always in Kb, so convert to mb */ | ||
| 145 | + if (strcmp ("Total", str) == 0) { | ||
| 146 | + dsktotal_mb = tmp_mb / 1024; | ||
| 147 | + } | ||
| 148 | + else if (strcmp ("Free", str) == 0) { | ||
| 149 | + dskfree_mb = tmp_mb / 1024; | ||
| 150 | + } | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + fclose(fp); | ||
| 154 | + dskused_mb = dsktotal_mb - dskfree_mb; | ||
| 155 | + total_ram_mb = dsktotal_mb; | ||
| 156 | + used_ram_mb = dskused_mb; | ||
| 157 | + free_ram_mb = dskfree_mb; | ||
| 158 | +#endif /* HAVE_PROC_MEMINFO */ | ||
| 159 | + | ||
| 160 | + /* if total_ram_mb == 0, let's not divide by 0 */ | ||
| 161 | + if(total_ram_mb) { | ||
| 162 | + percent_used = 100 * ((double) used_ram_mb) / ((double) total_ram_mb); | ||
| 163 | + } else { | ||
| 164 | + percent_used = 0; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + result = max_state (result, check_ram (percent_used, free_ram_mb)); | ||
| 168 | + printf (_("RAM %s - %d%% free (%d MB out of %d MB) %s|"), | ||
| 169 | + state_text (result), | ||
| 170 | + (100 - percent_used), (int) free_ram_mb, (int) total_ram_mb, status); | ||
| 171 | + | ||
| 172 | + puts (perfdata ("ram", (long) free_ram_mb, "MB", | ||
| 173 | + TRUE, (long) max (warn_size_bytes/(1024 * 1024), warn_percent/100.0*total_ram_mb), | ||
| 174 | + TRUE, (long) max (crit_size_bytes/(1024 * 1024), crit_percent/100.0*total_ram_mb), | ||
| 175 | + TRUE, 0, | ||
| 176 | + TRUE, (long) total_ram_mb)); | ||
| 177 | + | ||
| 178 | + return result; | ||
| 179 | +} | ||
| 180 | + | ||
| 181 | +int check_ram (int usp, float free_ram_mb) | ||
| 182 | +{ | ||
| 183 | + int result = STATE_UNKNOWN; | ||
| 184 | + float free_ram = free_ram_mb * (1024 * 1024); /* Convert back to bytes as warn and crit specified in bytes */ | ||
| 185 | + if (usp >= 0 && crit_percent != 0 && usp >= (100.0 - crit_percent)) | ||
| 186 | + result = STATE_CRITICAL; | ||
| 187 | + else if (crit_size_bytes > 0 && free_ram <= crit_size_bytes) | ||
| 188 | + result = STATE_CRITICAL; | ||
| 189 | + else if (usp >= 0 && warn_percent != 0 && usp >= (100.0 - warn_percent)) | ||
| 190 | + result = STATE_WARNING; | ||
| 191 | + else if (warn_size_bytes > 0 && free_ram <= warn_size_bytes) | ||
| 192 | + result = STATE_WARNING; | ||
| 193 | + else if (usp >= 0.0) | ||
| 194 | + result = STATE_OK; | ||
| 195 | + return result; | ||
| 196 | +} | ||
| 197 | + | ||
| 198 | +/* process command-line arguments */ | ||
| 199 | +int process_arguments (int argc, char **argv) | ||
| 200 | +{ | ||
| 201 | + int c = 0; /* option character */ | ||
| 202 | + | ||
| 203 | + int option = 0; | ||
| 204 | + static struct option longopts[] = { | ||
| 205 | + {"warning", required_argument, 0, 'w'}, | ||
| 206 | + {"critical", required_argument, 0, 'c'}, | ||
| 207 | + {"verbose", no_argument, 0, 'v'}, | ||
| 208 | + {"version", no_argument, 0, 'V'}, | ||
| 209 | + {"help", no_argument, 0, 'h'}, | ||
| 210 | + {0, 0, 0, 0} | ||
| 211 | + }; | ||
| 212 | + | ||
| 213 | + if (argc < 2) | ||
| 214 | + return ERROR; | ||
| 215 | + | ||
| 216 | + while (1) { | ||
| 217 | + c = getopt_long (argc, argv, "+?Vvhc:w:", longopts, &option); | ||
| 218 | + | ||
| 219 | + if (c == -1 || c == EOF) | ||
| 220 | + break; | ||
| 221 | + | ||
| 222 | + switch (c) { | ||
| 223 | + case 'w': /* warning size threshold */ | ||
| 224 | + if (is_intnonneg (optarg)) { | ||
| 225 | + warn_size_bytes = (float) atoi (optarg); | ||
| 226 | + break; | ||
| 227 | + } | ||
| 228 | + else if (strstr (optarg, ",") && | ||
| 229 | + strstr (optarg, "%") && | ||
| 230 | + sscanf (optarg, "%f,%d%%", &warn_size_bytes, &warn_percent) == 2) { | ||
| 231 | + warn_size_bytes = floorf(warn_size_bytes); | ||
| 232 | + break; | ||
| 233 | + } | ||
| 234 | + else if (strstr (optarg, "%") && | ||
| 235 | + sscanf (optarg, "%d%%", &warn_percent) == 1) { | ||
| 236 | + break; | ||
| 237 | + } | ||
| 238 | + else { | ||
| 239 | + usage4 (_("Warning threshold must be integer or percentage!")); | ||
| 240 | + } | ||
| 241 | + case 'c': /* critical size threshold */ | ||
| 242 | + if (is_intnonneg (optarg)) { | ||
| 243 | + crit_size_bytes = (float) atoi (optarg); | ||
| 244 | + break; | ||
| 245 | + } | ||
| 246 | + else if (strstr (optarg, ",") && | ||
| 247 | + strstr (optarg, "%") && | ||
| 248 | + sscanf (optarg, "%f,%d%%", &crit_size_bytes, &crit_percent) == 2) { | ||
| 249 | + crit_size_bytes = floorf(crit_size_bytes); | ||
| 250 | + break; | ||
| 251 | + } | ||
| 252 | + else if (strstr (optarg, "%") && | ||
| 253 | + sscanf (optarg, "%d%%", &crit_percent) == 1) { | ||
| 254 | + break; | ||
| 255 | + } | ||
| 256 | + else { | ||
| 257 | + usage4 (_("Critical threshold must be integer or percentage!")); | ||
| 258 | + } | ||
| 259 | + case 'v': /* verbose */ | ||
| 260 | + verbose++; | ||
| 261 | + break; | ||
| 262 | + case 'V': /* version */ | ||
| 263 | + print_revision (progname, revision); | ||
| 264 | + exit (STATE_OK); | ||
| 265 | + case 'h': /* help */ | ||
| 266 | + print_help (); | ||
| 267 | + exit (STATE_OK); | ||
| 268 | + case '?': /* error */ | ||
| 269 | + usage2 (_("Unknown argument"), optarg); | ||
| 270 | + } | ||
| 271 | + } | ||
| 272 | + | ||
| 273 | + c = optind; | ||
| 274 | + if (c == argc) | ||
| 275 | + return validate_arguments (); | ||
| 276 | + if (warn_percent == 0 && is_intnonneg (argv[c])) | ||
| 277 | + warn_percent = atoi (argv[c++]); | ||
| 278 | + | ||
| 279 | + if (c == argc) | ||
| 280 | + return validate_arguments (); | ||
| 281 | + if (crit_percent == 0 && is_intnonneg (argv[c])) | ||
| 282 | + crit_percent = atoi (argv[c++]); | ||
| 283 | + | ||
| 284 | + if (c == argc) | ||
| 285 | + return validate_arguments (); | ||
| 286 | + if (warn_size_bytes == 0 && is_intnonneg (argv[c])) | ||
| 287 | + warn_size_bytes = (float) atoi (argv[c++]); | ||
| 288 | + | ||
| 289 | + if (c == argc) | ||
| 290 | + return validate_arguments (); | ||
| 291 | + if (crit_size_bytes == 0 && is_intnonneg (argv[c])) | ||
| 292 | + crit_size_bytes = (float) atoi (argv[c++]); | ||
| 293 | + | ||
| 294 | + return validate_arguments (); | ||
| 295 | +} | ||
| 296 | + | ||
| 297 | +int validate_arguments (void) | ||
| 298 | +{ | ||
| 299 | + if (warn_percent == 0 && crit_percent == 0 && warn_size_bytes == 0 | ||
| 300 | + && crit_size_bytes == 0) { | ||
| 301 | + return ERROR; | ||
| 302 | + } | ||
| 303 | + else if (warn_percent < crit_percent) { | ||
| 304 | + usage4 | ||
| 305 | + (_("Warning percentage should be more than critical percentage")); | ||
| 306 | + } | ||
| 307 | + else if (warn_size_bytes < crit_size_bytes) { | ||
| 308 | + usage4 | ||
| 309 | + (_("Warning free space should be more than critical free space")); | ||
| 310 | + } | ||
| 311 | + return OK; | ||
| 312 | +} | ||
| 313 | + | ||
| 314 | +void print_help (void) | ||
| 315 | +{ | ||
| 316 | + print_revision (progname, revision); | ||
| 317 | + printf (_(COPYRIGHT), copyright, email); | ||
| 318 | + printf ("%s\n", _("Check RAM on local machine.")); | ||
| 319 | + printf ("\n\n"); | ||
| 320 | + print_usage (); | ||
| 321 | + printf (_(UT_HELP_VRSN)); | ||
| 322 | + printf (" %s\n", "-w, --warning=INTEGER"); | ||
| 323 | + printf (" %s\n", _("Exit with WARNING status if less than INTEGER bytes of RAM are free")); | ||
| 324 | + printf (" %s\n", "-w, --warning=PERCENT%%"); | ||
| 325 | + printf (" %s\n", _("Exit with WARNING status if less than PERCENT of RAM are free")); | ||
| 326 | + printf (" %s\n", "-c, --critical=INTEGER"); | ||
| 327 | + printf (" %s\n", _("Exit with CRITICAL status if less than INTEGER bytes of RAM are free")); | ||
| 328 | + printf (" %s\n", "-c, --critical=PERCENT%%"); | ||
| 329 | + printf (" %s\n", _("Exit with CRITCAL status if less than PERCENT of RAM are free")); | ||
| 330 | + printf (" %s\n", "-v, --verbose"); | ||
| 331 | + printf (" %s\n", _("Verbose output. Up to 3 levels")); | ||
| 332 | + printf ("\n"); | ||
| 333 | + printf (_(UT_SUPPORT)); | ||
| 334 | +} | ||
| 335 | + | ||
| 336 | +void print_usage (void) | ||
| 337 | +{ | ||
| 338 | + printf (_("Usage:")); | ||
| 339 | + printf ("%s [-v] -w <percent_free>%% -c <percent_free>%%\n",progname); | ||
| 340 | + printf ("%s [-v] -w <bytes_free> -c <bytes_free>\n", progname); | ||
| 341 | +} | ||
| 342 | --- /dev/null | ||
| 343 | +++ nagios-plugins-1.4.5/plugins/t/check_ram.t | ||
| 344 | @@ -0,0 +1,32 @@ | ||
| 345 | +#! /usr/bin/perl -w -I .. | ||
| 346 | +# | ||
| 347 | +# Ram Space Tests via check_ram | ||
| 348 | +# | ||
| 349 | +# $Id: check_raam.t $ | ||
| 350 | +# | ||
| 351 | + | ||
| 352 | +use strict; | ||
| 353 | +use Test::More tests => 8; | ||
| 354 | +use NPTest; | ||
| 355 | + | ||
| 356 | +my $successOutput = '/^RAM OK - [0-9]+\% free \([0-9]+ MB out of [0-9]+ MB\)/'; | ||
| 357 | +my $failureOutput = '/^RAM CRITICAL - [0-9]+\% free \([0-9]+ MB out of [0-9]+ MB\)/'; | ||
| 358 | +my $warnOutput = '/^RAM WARNING - [0-9]+\% free \([0-9]+ MB out of [0-9]+ MB\)/'; | ||
| 359 | + | ||
| 360 | +my $result; | ||
| 361 | + | ||
| 362 | +$result = NPTest->testCmd( "./check_ram -w 1048576 -c 1048576" ); # 1 MB free | ||
| 363 | +cmp_ok( $result->return_code, "==", 0, "At least 1MB free" ); | ||
| 364 | +like( $result->output, $successOutput, "Right output" ); | ||
| 365 | + | ||
| 366 | +$result = NPTest->testCmd( "./check_ram -w 1% -c 1%" ); # 1% free | ||
| 367 | +cmp_ok( $result->return_code, "==", 0, 'At least 1% free' ); | ||
| 368 | +like( $result->output, $successOutput, "Right output" ); | ||
| 369 | + | ||
| 370 | +$result = NPTest->testCmd( "./check_ram -w 100% -c 100%" ); # 100% (always critical) | ||
| 371 | +cmp_ok( $result->return_code, "==", 2, 'Get critical because not 100% free' ); | ||
| 372 | +like( $result->output, $failureOutput, "Right output" ); | ||
| 373 | + | ||
| 374 | +$result = NPTest->testCmd( "./check_ram -w 100% -c 1%" ); # 100% (always warn) | ||
| 375 | +cmp_ok( $result->return_code, "==", 1, 'Get warning because not 100% free' ); | ||
| 376 | +like( $result->output, $warnOutput, "Right output" ); | ||
diff --git a/web/attachments/258626-check_mysql_query.c.diff b/web/attachments/258626-check_mysql_query.c.diff new file mode 100644 index 0000000..c06efe0 --- /dev/null +++ b/web/attachments/258626-check_mysql_query.c.diff | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | --- check_mysql_query.c 2007-12-14 11:41:41.000000000 -0800 | ||
| 2 | +++ check_mysql_query.c 2007-12-14 12:17:56.000000000 -0800 | ||
| 3 | @@ -59,6 +59,8 @@ | ||
| 4 | void print_usage (void); | ||
| 5 | |||
| 6 | char *sql_query = NULL; | ||
| 7 | +unsigned int sql_column = 0; | ||
| 8 | + | ||
| 9 | int verbose = 0; | ||
| 10 | thresholds *my_thresholds = NULL; | ||
| 11 | |||
| 12 | @@ -74,6 +76,7 @@ | ||
| 13 | double value; | ||
| 14 | char *error = NULL; | ||
| 15 | int status; | ||
| 16 | + unsigned int numcols; | ||
| 17 | |||
| 18 | setlocale (LC_ALL, ""); | ||
| 19 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 20 | @@ -121,6 +124,12 @@ | ||
| 21 | mysql_close(&mysql); | ||
| 22 | die (STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), _("No rows returned")); | ||
| 23 | } | ||
| 24 | + | ||
| 25 | + /* Check number of columns in result */ | ||
| 26 | + numcols = mysql_num_fields(res); | ||
| 27 | + if(sql_column >= numcols) { | ||
| 28 | + die (STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), _("Result has too few columns to satisfy --column")); | ||
| 29 | + } | ||
| 30 | |||
| 31 | /* fetch the first row */ | ||
| 32 | if ( (row = mysql_fetch_row (res)) == NULL) { | ||
| 33 | @@ -136,11 +145,11 @@ | ||
| 34 | /* close the connection */ | ||
| 35 | mysql_close (&mysql); | ||
| 36 | |||
| 37 | - if (! is_numeric(row[0])) { | ||
| 38 | + if (! is_numeric(row[sql_column])) { | ||
| 39 | die (STATE_CRITICAL, "QUERY %s: %s - '%s'\n", _("CRITICAL"), _("Is not a numeric"), row[0]); | ||
| 40 | } | ||
| 41 | |||
| 42 | - value = strtod(row[0], NULL); | ||
| 43 | + value = strtod(row[sql_column], NULL); | ||
| 44 | |||
| 45 | if (verbose >= 3) | ||
| 46 | printf("mysql result: %f\n", value); | ||
| 47 | @@ -182,6 +191,7 @@ | ||
| 48 | {"query", required_argument, 0, 'q'}, | ||
| 49 | {"warning", required_argument, 0, 'w'}, | ||
| 50 | {"critical", required_argument, 0, 'c'}, | ||
| 51 | + {"column", required_argument, 0, 'C'}, | ||
| 52 | {0, 0, 0, 0} | ||
| 53 | }; | ||
| 54 | |||
| 55 | @@ -189,7 +199,7 @@ | ||
| 56 | return ERROR; | ||
| 57 | |||
| 58 | while (1) { | ||
| 59 | - c = getopt_long (argc, argv, "hvVSP:p:u:d:H:q:w:c:", longopts, &option); | ||
| 60 | + c = getopt_long (argc, argv, "hvVSP:p:u:d:H:q:w:c:C:", longopts, &option); | ||
| 61 | |||
| 62 | if (c == -1 || c == EOF) | ||
| 63 | break; | ||
| 64 | @@ -233,6 +243,9 @@ | ||
| 65 | case 'q': | ||
| 66 | asprintf(&sql_query, "%s", optarg); | ||
| 67 | break; | ||
| 68 | + case 'C': /* column */ | ||
| 69 | + sql_column = atoi(optarg); | ||
| 70 | + break; | ||
| 71 | case 'w': | ||
| 72 | warning = optarg; | ||
| 73 | break; | ||
| 74 | @@ -292,7 +305,9 @@ | ||
| 75 | |||
| 76 | printf (_(UT_HELP_VRSN)); | ||
| 77 | printf (" -q, --query=STRING\n"); | ||
| 78 | - printf (" %s\n", _("SQL query to run. Only first column in first row will be read")); | ||
| 79 | + printf (" %s\n", _("SQL query to run. Only first column (unless -c says otherwise) in first row will be read")); | ||
| 80 | + printf (" -C, --column=INTEGER\n"); | ||
| 81 | + printf (" %s\n", _("Column number in result row to use for comparison (Default: 0)")); | ||
| 82 | printf (_(UT_WARN_CRIT_RANGE)); | ||
| 83 | printf (_(UT_HOST_PORT), 'P', myport); | ||
| 84 | printf (" -d, --database=STRING\n"); | ||
| 85 | @@ -317,6 +332,6 @@ | ||
| 86 | { | ||
| 87 | printf (_("Usage:")); | ||
| 88 | printf ("%s -q SQL_query [-w warn] [-c crit]\n",progname); | ||
| 89 | - printf ("[-d database] [-H host] [-P port] [-u user] [-p password]\n"); | ||
| 90 | + printf ("[ -C column ] [-d database] [-H host] [-P port] [-u user] [-p password]\n"); | ||
| 91 | } | ||
| 92 | |||
diff --git a/web/attachments/258859-check_dns.c.patch b/web/attachments/258859-check_dns.c.patch new file mode 100644 index 0000000..256624f --- /dev/null +++ b/web/attachments/258859-check_dns.c.patch | |||
| @@ -0,0 +1,97 @@ | |||
| 1 | --- check_dns.c 2007-01-29 08:46:41.000000000 +1100 | ||
| 2 | +++ check_dns-patched.c 2007-11-26 21:31:23.000000000 +1100 | ||
| 3 | @@ -62,6 +62,9 @@ | ||
| 4 | int expect_authority = FALSE; | ||
| 5 | thresholds *time_thresholds = NULL; | ||
| 6 | |||
| 7 | +#define IPV4_SIZE 16*sizeof(char) | ||
| 8 | +int order_results = FALSE; | ||
| 9 | + | ||
| 10 | int | ||
| 11 | main (int argc, char **argv) | ||
| 12 | { | ||
| 13 | @@ -178,6 +181,56 @@ | ||
| 14 | _("DNS CRITICAL - '%s' msg parsing exited with no address\n"), | ||
| 15 | NSLOOKUP_COMMAND); | ||
| 16 | |||
| 17 | + /* Order the results from DNS server */ | ||
| 18 | + if (order_results) { | ||
| 19 | + int num_result = 1; /* No commas? only one address */ | ||
| 20 | + int i = 0; | ||
| 21 | + char *ipv4_sort = NULL; | ||
| 22 | + char *pstrtmp; | ||
| 23 | + char *pstrtok; | ||
| 24 | + | ||
| 25 | + pstrtmp = strchr(address, ','); | ||
| 26 | + while (pstrtmp) { | ||
| 27 | + num_result++; | ||
| 28 | + pstrtmp += sizeof(char); | ||
| 29 | + pstrtmp = strchr(pstrtmp, ','); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + if (num_result > 1) { | ||
| 33 | + ipv4_sort = malloc(IPV4_SIZE*num_result); | ||
| 34 | + if (NULL == ipv4_sort) | ||
| 35 | + die (STATE_UNKNOWN, | ||
| 36 | + _("DNS UNKNOWN - Failed allocating %d bytes for ordering results\n"), | ||
| 37 | + IPV4_SIZE*num_result); | ||
| 38 | + | ||
| 39 | + memset(ipv4_sort, 0, IPV4_SIZE*num_result); | ||
| 40 | + pstrtmp = strdup(address); | ||
| 41 | + pstrtok = strtok(pstrtmp, ","); | ||
| 42 | + i = 0; | ||
| 43 | + while (pstrtok) { | ||
| 44 | + strncpy(ipv4_sort+(i*IPV4_SIZE), pstrtok, IPV4_SIZE); | ||
| 45 | + pstrtok = strtok(NULL, ","); | ||
| 46 | + i++; | ||
| 47 | + } | ||
| 48 | + free(pstrtmp); | ||
| 49 | + | ||
| 50 | + qsort(ipv4_sort, num_result, IPV4_SIZE, strcmp); | ||
| 51 | + | ||
| 52 | + pstrtmp = address; | ||
| 53 | + for (i = 0; i < num_result; i++) { | ||
| 54 | + strcpy(pstrtmp, ipv4_sort+(i*IPV4_SIZE)); | ||
| 55 | + pstrtmp += (strlen(pstrtmp)); | ||
| 56 | + if (i+1 < num_result) { | ||
| 57 | + *pstrtmp = ','; | ||
| 58 | + pstrtmp += sizeof(char); | ||
| 59 | + } | ||
| 60 | + *pstrtmp = '\0'; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + free(ipv4_sort); | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | /* compare to expected address */ | ||
| 68 | if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) { | ||
| 69 | result = STATE_CRITICAL; | ||
| 70 | @@ -316,7 +369,7 @@ | ||
| 71 | strcpy (argv[c], "-t"); | ||
| 72 | |||
| 73 | while (1) { | ||
| 74 | - c = getopt_long (argc, argv, "hVvAt:H:s:r:a:w:c:", long_opts, &opt_index); | ||
| 75 | + c = getopt_long (argc, argv, "hVvAot:H:s:r:a:w:c:", long_opts, &opt_index); | ||
| 76 | |||
| 77 | if (c == -1 || c == EOF) | ||
| 78 | break; | ||
| 79 | @@ -331,6 +384,9 @@ | ||
| 80 | case 'v': /* version */ | ||
| 81 | verbose = TRUE; | ||
| 82 | break; | ||
| 83 | + case 'o': | ||
| 84 | + order_results = TRUE; | ||
| 85 | + break; | ||
| 86 | case 't': /* timeout period */ | ||
| 87 | timeout_interval = atoi (optarg); | ||
| 88 | break; | ||
| 89 | @@ -431,6 +487,8 @@ | ||
| 90 | printf (" %s\n", _("Optional IP-ADDRESS you expect the DNS server to return. HOST must end with .")); | ||
| 91 | printf (" -A, --expect-authority\n"); | ||
| 92 | printf (" %s\n", _("Optionally expect the DNS server to be authoritative for the lookup")); | ||
| 93 | + printf (" -o\n"); | ||
| 94 | + printf (" %s\n", _("Order the results from DNS server. Useful for round-robind setups.")); | ||
| 95 | printf (" -w, --warning=seconds\n"); | ||
| 96 | printf (" %s\n", _("Return warning if elapsed time exceeds value. Default off")); | ||
| 97 | printf (" -c, --critical=seconds\n"); | ||
diff --git a/web/attachments/259195-check_dhcp-roguedhcpservercheck.txt b/web/attachments/259195-check_dhcp-roguedhcpservercheck.txt new file mode 100644 index 0000000..4489fec --- /dev/null +++ b/web/attachments/259195-check_dhcp-roguedhcpservercheck.txt | |||
| @@ -0,0 +1,123 @@ | |||
| 1 | --- check_dhcp.c.orig 2007-12-14 21:04:26.000000000 +0100 | ||
| 2 | +++ check_dhcp.c 2007-12-15 16:04:12.000000000 +0100 | ||
| 3 | @@ -165,6 +165,7 @@ | ||
| 4 | u_int32_t lease_time; /* lease time in seconds */ | ||
| 5 | u_int32_t renewal_time; /* renewal time in seconds */ | ||
| 6 | u_int32_t rebinding_time; /* rebinding time in seconds */ | ||
| 7 | + u_int8_t desired; /* is this offer desired (necessary in exclusive mode) */ | ||
| 8 | struct dhcp_offer_struct *next; | ||
| 9 | }dhcp_offer; | ||
| 10 | |||
| 11 | @@ -209,6 +210,7 @@ | ||
| 12 | #define ETHERNET_HARDWARE_ADDRESS_LENGTH 6 /* length of Ethernet hardware addresses */ | ||
| 13 | |||
| 14 | u_int8_t unicast = 0; /* unicast mode: mimic a DHCP relay */ | ||
| 15 | +u_int8_t exclusive = 0; /* exclusive mode aka "rogue DHCP server detection" */ | ||
| 16 | struct in_addr my_ip; /* our address (required for relay) */ | ||
| 17 | struct in_addr dhcp_ip; /* server to query (if in unicast mode) */ | ||
| 18 | unsigned char client_hardware_address[MAX_DHCP_CHADDR_LENGTH]=""; | ||
| 19 | @@ -919,6 +921,7 @@ | ||
| 20 | new_offer->lease_time=dhcp_lease_time; | ||
| 21 | new_offer->renewal_time=dhcp_renewal_time; | ||
| 22 | new_offer->rebinding_time=dhcp_rebinding_time; | ||
| 23 | + new_offer->desired=FALSE; /* exclusive mode: we'll check that in get_results */ | ||
| 24 | |||
| 25 | |||
| 26 | if(verbose){ | ||
| 27 | @@ -964,7 +967,7 @@ | ||
| 28 | |||
| 29 | /* gets state and plugin output to return */ | ||
| 30 | int get_results(void){ | ||
| 31 | - dhcp_offer *temp_offer; | ||
| 32 | + dhcp_offer *temp_offer, *undesired_offer=NULL; | ||
| 33 | requested_server *temp_server; | ||
| 34 | int result; | ||
| 35 | u_int32_t max_lease_time=0; | ||
| 36 | @@ -999,11 +1002,18 @@ | ||
| 37 | if(temp_server->answered == FALSE){ | ||
| 38 | requested_responses++; | ||
| 39 | temp_server->answered=TRUE; | ||
| 40 | + temp_offer->desired=TRUE; | ||
| 41 | } | ||
| 42 | } | ||
| 43 | } | ||
| 44 | } | ||
| 45 | |||
| 46 | + /* exclusive mode: check for undesired offers */ | ||
| 47 | + for(temp_offer=dhcp_offer_list;temp_offer!=NULL;temp_offer=temp_offer->next) | ||
| 48 | + if (temp_offer->desired == FALSE) { | ||
| 49 | + undesired_offer=temp_offer; /* Checks only for the first undesired offer */ | ||
| 50 | + break; /* no further checks needed */ | ||
| 51 | + } | ||
| 52 | } | ||
| 53 | |||
| 54 | /* else check and see if we got our requested address from any server */ | ||
| 55 | @@ -1030,6 +1040,9 @@ | ||
| 56 | result=STATE_WARNING; | ||
| 57 | else if(request_specific_address==TRUE && received_requested_address==FALSE) | ||
| 58 | result=STATE_WARNING; | ||
| 59 | + | ||
| 60 | + if(exclusive && undesired_offer) | ||
| 61 | + result=STATE_CRITICAL; | ||
| 62 | |||
| 63 | if(result==0) /* garrett honeycutt 2005 */ | ||
| 64 | printf("OK: "); | ||
| 65 | @@ -1046,6 +1059,12 @@ | ||
| 66 | return result; | ||
| 67 | } | ||
| 68 | |||
| 69 | + if(exclusive && undesired_offer){ | ||
| 70 | + printf(_("Rogue DHCP Server detected! Server %s"),inet_ntoa(undesired_offer->server_address)); | ||
| 71 | + printf(_(" offered %s \n"),inet_ntoa(undesired_offer->offered_address)); | ||
| 72 | + return result; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | printf(_("Received %d DHCPOFFER(s)"),valid_responses); | ||
| 76 | |||
| 77 | if(requested_servers>0) | ||
| 78 | @@ -1100,6 +1119,7 @@ | ||
| 79 | {"interface", required_argument,0,'i'}, | ||
| 80 | {"mac", required_argument,0,'m'}, | ||
| 81 | {"unicast", no_argument, 0,'u'}, | ||
| 82 | + {"exclusive", no_argument, 0,'x'}, | ||
| 83 | {"verbose", no_argument, 0,'v'}, | ||
| 84 | {"version", no_argument, 0,'V'}, | ||
| 85 | {"help", no_argument, 0,'h'}, | ||
| 86 | @@ -1107,7 +1127,7 @@ | ||
| 87 | }; | ||
| 88 | |||
| 89 | while(1){ | ||
| 90 | - c=getopt_long(argc,argv,"+hVvt:s:r:t:i:m:u",long_options,&option_index); | ||
| 91 | + c=getopt_long(argc,argv,"+hVvxt:s:r:t:i:m:u",long_options,&option_index); | ||
| 92 | |||
| 93 | i++; | ||
| 94 | |||
| 95 | @@ -1170,6 +1190,10 @@ | ||
| 96 | unicast=1; | ||
| 97 | break; | ||
| 98 | |||
| 99 | + case 'x': /* exclusive testing aka "rogue DHCP server detection" */ | ||
| 100 | + exclusive=1; | ||
| 101 | + break; | ||
| 102 | + | ||
| 103 | case 'V': /* version */ | ||
| 104 | print_revision(progname,revision); | ||
| 105 | exit(STATE_OK); | ||
| 106 | @@ -1415,6 +1439,8 @@ | ||
| 107 | printf (" %s\n", _("MAC address to use in the DHCP request")); | ||
| 108 | printf (" %s\n", "-u, --unicast"); | ||
| 109 | printf (" %s\n", _("Unicast testing: mimic a DHCP relay, requires -s")); | ||
| 110 | + printf (" %s\n", "-x, --exclusive"); | ||
| 111 | + printf (" %s\n", _("Only requested DHCP server may response (rogue DHCP server detection), requires -s")); | ||
| 112 | |||
| 113 | return; | ||
| 114 | } | ||
| 115 | @@ -1424,7 +1450,7 @@ | ||
| 116 | print_usage(void){ | ||
| 117 | |||
| 118 | printf (_("Usage:")); | ||
| 119 | - printf (" %s [-v] [-u] [-s serverip] [-r requestedip] [-t timeout]\n",progname); | ||
| 120 | + printf (" %s [-v] [-u] [-x] [-s serverip] [-r requestedip] [-t timeout]\n",progname); | ||
| 121 | printf (" [-i interface] [-m mac]\n"); | ||
| 122 | |||
| 123 | return; | ||
diff --git a/web/attachments/260740-check_ntp_time.mega_debug.patch b/web/attachments/260740-check_ntp_time.mega_debug.patch new file mode 100644 index 0000000..b08b980 --- /dev/null +++ b/web/attachments/260740-check_ntp_time.mega_debug.patch | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | Index: plugins/check_ntp_time.c | ||
| 2 | =================================================================== | ||
| 3 | --- plugins/check_ntp_time.c (revision 1884) | ||
| 4 | +++ plugins/check_ntp_time.c (working copy) | ||
| 5 | @@ -249,8 +249,12 @@ | ||
| 6 | int best_offset_server(const ntp_server_results *slist, int nservers){ | ||
| 7 | int i=0, j=0, cserver=0, candidates[5], csize=0; | ||
| 8 | |||
| 9 | + if (verbose>2) | ||
| 10 | + printf("best_offset_server() line %d: nservers=%d\n", __LINE__, nservers); | ||
| 11 | /* for each server */ | ||
| 12 | for(cserver=0; cserver<nservers; cserver++){ | ||
| 13 | + if (verbose>2) | ||
| 14 | + printf("best_offset_server() line %d: cserver=%d\n", __LINE__, cserver); | ||
| 15 | /* sort out servers with error flags */ | ||
| 16 | if ( LI(slist[cserver].flags) != LI_NOWARNING ){ | ||
| 17 | if (verbose) printf("discarding peer id %d: flags=%d\n", cserver, LI(slist[cserver].flags)); | ||
| 18 | @@ -261,25 +265,37 @@ | ||
| 19 | for(i=0; i<csize; i++){ | ||
| 20 | /* does it have an equal or better stratum? */ | ||
| 21 | if(slist[cserver].stratum <= slist[i].stratum){ | ||
| 22 | + if (verbose>2) | ||
| 23 | + printf("best_offset_server() line %d: slist[%d].stratum <= slist[%d].stratum\n", __LINE__, cserver, i); | ||
| 24 | /* does it have an equal or better dispersion? */ | ||
| 25 | if(slist[cserver].rtdisp <= slist[i].rtdisp){ | ||
| 26 | + if (verbose>2) | ||
| 27 | + printf("best_offset_server() line %d: slist[%d].rtdisp <= slist[%d].rtdisp\n", __LINE__, cserver, i); | ||
| 28 | /* does it have a better rtdelay? */ | ||
| 29 | if(slist[cserver].rtdelay < slist[i].rtdelay){ | ||
| 30 | + if (verbose>2) | ||
| 31 | + printf("best_offset_server() line %d: slist[%d].rtdelay < slist[%d].rtdelay\n", __LINE__, cserver, i); | ||
| 32 | break; | ||
| 33 | } | ||
| 34 | } | ||
| 35 | } | ||
| 36 | + if (verbose>2) | ||
| 37 | + printf("best_offset_server() line %d: i=%d, csize=%d\n", __LINE__, i, csize); | ||
| 38 | } | ||
| 39 | |||
| 40 | /* if we haven't reached the current list's end, move everyone | ||
| 41 | * over one to the right, and insert the new candidate */ | ||
| 42 | if(i<csize){ | ||
| 43 | for(j=5; j>i; j--){ | ||
| 44 | + if (verbose>2) | ||
| 45 | + printf("best_offset_server() line %d: candidates[%d]=candidates[%d-1] (i=%d, csize=%d)\n", __LINE__, j, j, i, csize); | ||
| 46 | candidates[j]=candidates[j-1]; | ||
| 47 | } | ||
| 48 | } | ||
| 49 | /* regardless, if they should be on the list... */ | ||
| 50 | if(i<5) { | ||
| 51 | + if (verbose>2) | ||
| 52 | + printf("best_offset_server() line %d: candidates[%d]=%d (csize=%d)\n", __LINE__, i, cserver, csize); | ||
| 53 | candidates[i]=cserver; | ||
| 54 | if(csize<5) csize++; | ||
| 55 | /* otherwise discard the server */ | ||
| 56 | @@ -337,6 +353,7 @@ | ||
| 57 | servers=(ntp_server_results*)malloc(sizeof(ntp_server_results)*num_hosts); | ||
| 58 | if(servers==NULL) die(STATE_UNKNOWN, "can not allocate server array"); | ||
| 59 | memset(servers, 0, sizeof(ntp_server_results)*num_hosts); | ||
| 60 | + DBG(printf("Found %d peers to check\n", num_hosts)); | ||
| 61 | |||
| 62 | /* setup each socket for writing, and the corresponding struct pollfd */ | ||
| 63 | ai_tmp=ai; | ||
diff --git a/web/attachments/260847-check_ntp_time.best_offset_server_fix.patch b/web/attachments/260847-check_ntp_time.best_offset_server_fix.patch new file mode 100644 index 0000000..c542da0 --- /dev/null +++ b/web/attachments/260847-check_ntp_time.best_offset_server_fix.patch | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | Index: plugins/check_ntp_time.c | ||
| 2 | =================================================================== | ||
| 3 | --- plugins/check_ntp_time.c (revision 1885) | ||
| 4 | +++ plugins/check_ntp_time.c (working copy) | ||
| 5 | @@ -274,7 +274,7 @@ | ||
| 6 | /* if we haven't reached the current list's end, move everyone | ||
| 7 | * over one to the right, and insert the new candidate */ | ||
| 8 | if(i<csize){ | ||
| 9 | - for(j=5; j>i; j--){ | ||
| 10 | + for(j=4; j>i; j--){ | ||
| 11 | candidates[j]=candidates[j-1]; | ||
| 12 | } | ||
| 13 | } | ||
| 14 | @@ -337,6 +337,7 @@ | ||
| 15 | servers=(ntp_server_results*)malloc(sizeof(ntp_server_results)*num_hosts); | ||
| 16 | if(servers==NULL) die(STATE_UNKNOWN, "can not allocate server array"); | ||
| 17 | memset(servers, 0, sizeof(ntp_server_results)*num_hosts); | ||
| 18 | + DBG(printf("Found %d peers to check\n", num_hosts)); | ||
| 19 | |||
| 20 | /* setup each socket for writing, and the corresponding struct pollfd */ | ||
| 21 | ai_tmp=ai; | ||
diff --git a/web/attachments/260911-nagios-plugins-1.4.11-check_swap-hpux-floor-patch b/web/attachments/260911-nagios-plugins-1.4.11-check_swap-hpux-floor-patch new file mode 100644 index 0000000..0ecd862 --- /dev/null +++ b/web/attachments/260911-nagios-plugins-1.4.11-check_swap-hpux-floor-patch | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | diff -Naur nagios-plugins-1.4.11/plugins/check_swap.c nagios-plugins-1.4.11-hpux-floor/plugins/check_swap.c | ||
| 2 | --- nagios-plugins-1.4.11/plugins/check_swap.c 2007-12-10 08:52:00.000000000 +0100 | ||
| 3 | +++ nagios-plugins-1.4.11-hpux-floor/plugins/check_swap.c 2008-01-05 17:11:46.696863797 +0100 | ||
| 4 | @@ -427,7 +427,7 @@ | ||
| 5 | else if (strstr (optarg, ",") && | ||
| 6 | strstr (optarg, "%") && | ||
| 7 | sscanf (optarg, "%f,%d%%", &warn_size_bytes, &warn_percent) == 2) { | ||
| 8 | - warn_size_bytes = floorf(warn_size_bytes); | ||
| 9 | + warn_size_bytes = (float) floor(warn_size_bytes); | ||
| 10 | break; | ||
| 11 | } | ||
| 12 | else if (strstr (optarg, "%") && | ||
| 13 | @@ -445,7 +445,7 @@ | ||
| 14 | else if (strstr (optarg, ",") && | ||
| 15 | strstr (optarg, "%") && | ||
| 16 | sscanf (optarg, "%f,%d%%", &crit_size_bytes, &crit_percent) == 2) { | ||
| 17 | - crit_size_bytes = floorf(crit_size_bytes); | ||
| 18 | + crit_size_bytes = (float) floor(crit_size_bytes); | ||
| 19 | break; | ||
| 20 | } | ||
| 21 | else if (strstr (optarg, "%") && | ||
diff --git a/web/attachments/261480-nagios-plugins-1.4.11-check_http-sizecheck.patch b/web/attachments/261480-nagios-plugins-1.4.11-check_http-sizecheck.patch new file mode 100644 index 0000000..e6831d9 --- /dev/null +++ b/web/attachments/261480-nagios-plugins-1.4.11-check_http-sizecheck.patch | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | --- check_http.c (revision 1904) | ||
| 2 | +++ check_http.c (working copy) | ||
| 3 | @@ -961,14 +961,7 @@ | ||
| 4 | /* these checks should be last */ | ||
| 5 | |||
| 6 | if (strlen (string_expect)) { | ||
| 7 | - if (strstr (page, string_expect)) { | ||
| 8 | - printf (_("HTTP OK %s - %.3f second response time %s|%s %s\n"), | ||
| 9 | - status_line, elapsed_time, | ||
| 10 | - (display_html ? "</A>" : ""), | ||
| 11 | - perfd_time (elapsed_time), perfd_size (pagesize)); | ||
| 12 | - exit (STATE_OK); | ||
| 13 | - } | ||
| 14 | - else { | ||
| 15 | + if (!strstr (page, string_expect)) { | ||
| 16 | printf (_("HTTP CRITICAL - string not found%s|%s %s\n"), | ||
| 17 | (display_html ? "</A>" : ""), | ||
| 18 | perfd_time (elapsed_time), perfd_size (pagesize)); | ||
| 19 | @@ -979,11 +972,10 @@ | ||
| 20 | if (strlen (regexp)) { | ||
| 21 | errcode = regexec (&preg, page, REGS, pmatch, 0); | ||
| 22 | if ((errcode == 0 && invert_regex == 0) || (errcode == REG_NOMATCH && invert_regex == 1)) { | ||
| 23 | - printf (_("HTTP OK %s - %.3f second response time %s|%s %s\n"), | ||
| 24 | - status_line, elapsed_time, | ||
| 25 | - (display_html ? "</A>" : ""), | ||
| 26 | - perfd_time (elapsed_time), perfd_size (pagesize)); | ||
| 27 | - exit (STATE_OK); | ||
| 28 | + /* | ||
| 29 | + Success, i.e. don't do anything here -- let the final success | ||
| 30 | + handler take care of it. | ||
| 31 | + */ | ||
| 32 | } | ||
| 33 | else if ((errcode == REG_NOMATCH && invert_regex == 0) || (errcode == 0 && invert_regex == 1)) { | ||
| 34 | if (invert_regex == 0) | ||
diff --git a/web/attachments/26227-check_procs-pch.txt b/web/attachments/26227-check_procs-pch.txt new file mode 100644 index 0000000..e3f8bd1 --- /dev/null +++ b/web/attachments/26227-check_procs-pch.txt | |||
| @@ -0,0 +1,135 @@ | |||
| 1 | --- plugins/check_procs.c.orig Tue Jun 11 09:08:00 2002 | ||
| 2 | +++ plugins/check_procs.c Tue Jun 11 13:47:52 2002 | ||
| 3 | @@ -68,6 +68,14 @@ | ||
| 4 | char *format = NULL; | ||
| 5 | char tmp[MAX_INPUT_BUFFER]; | ||
| 6 | |||
| 7 | +#ifdef HAVE_REGEX_H | ||
| 8 | +#include <regex.h> | ||
| 9 | +regex_t argsre, progre; | ||
| 10 | +int cflags = 0; | ||
| 11 | +char errbuf[MAX_INPUT_BUFFER]; | ||
| 12 | +int excode; | ||
| 13 | +#endif | ||
| 14 | + | ||
| 15 | int | ||
| 16 | main (int argc, char **argv) | ||
| 17 | { | ||
| 18 | @@ -91,6 +99,21 @@ | ||
| 19 | if (process_arguments (argc, argv) == ERROR) | ||
| 20 | usage ("Unable to parse command line\n"); | ||
| 21 | |||
| 22 | +#if HAVE_REGEX_H | ||
| 23 | + if ((options & ARGS) && cflags) { | ||
| 24 | + if ((excode = regcomp (&argsre, args, cflags)) != 0) { | ||
| 25 | + printf ("Could Not Compile Regular Expression\n"); | ||
| 26 | + return STATE_UNKNOWN; | ||
| 27 | + } | ||
| 28 | + } | ||
| 29 | + if ((options & PROG) && cflags) { | ||
| 30 | + if ((excode = regcomp (&progre, prog, cflags)) != 0) { | ||
| 31 | + printf ("Could Not Compile Regular Expression\n"); | ||
| 32 | + return STATE_UNKNOWN; | ||
| 33 | + } | ||
| 34 | + } | ||
| 35 | +#endif | ||
| 36 | + | ||
| 37 | /* run the command */ | ||
| 38 | if (verbose) | ||
| 39 | printf ("%s\n", PS_COMMAND); | ||
| 40 | @@ -121,10 +144,34 @@ | ||
| 41 | strip (procargs); | ||
| 42 | if ((options & STAT) && (strstr (statopts, procstat))) | ||
| 43 | resultsum |= STAT; | ||
| 44 | - if ((options & ARGS) && (strstr (procargs, args) == procargs)) | ||
| 45 | + if ((options & ARGS) && !cflags && (strstr (procargs, args) == procargs)) | ||
| 46 | resultsum |= ARGS; | ||
| 47 | - if ((options & PROG) && (strcmp (prog, procprog) == 0)) | ||
| 48 | + if ((options & PROG) && !cflags && (strcmp (prog, procprog) == 0)) | ||
| 49 | resultsum |= PROG; | ||
| 50 | +#if HAVE_REGEX_H | ||
| 51 | + if ((options & ARGS) && cflags) { | ||
| 52 | + excode = regexec (&argsre, procargs, (size_t) 0, NULL, 0); | ||
| 53 | + if (excode == 0) { | ||
| 54 | + resultsum |= ARGS; | ||
| 55 | + } | ||
| 56 | + else if (excode != REG_NOMATCH) { | ||
| 57 | + regerror (excode, &argsre, errbuf, MAX_INPUT_BUFFER); | ||
| 58 | + printf ("Execute Error: %s\n", errbuf); | ||
| 59 | + exit (STATE_CRITICAL); | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + if ((options & PROG) && cflags) { | ||
| 63 | + excode = regexec (&progre, procprog, (size_t) 0, NULL, 0); | ||
| 64 | + if (excode == 0) { | ||
| 65 | + resultsum |= PROG; | ||
| 66 | + } | ||
| 67 | + else if (excode != REG_NOMATCH) { | ||
| 68 | + regerror (excode, &argsre, errbuf, MAX_INPUT_BUFFER); | ||
| 69 | + printf ("Execute Error: %s\n", errbuf); | ||
| 70 | + exit (STATE_CRITICAL); | ||
| 71 | + } | ||
| 72 | + } | ||
| 73 | +#endif | ||
| 74 | if ((options & PPID) && (procppid == ppid)) | ||
| 75 | resultsum |= PPID; | ||
| 76 | if ((options & USER) && (procuid == uid)) | ||
| 77 | @@ -263,6 +310,9 @@ | ||
| 78 | {"help", no_argument, 0, 'h'}, | ||
| 79 | {"version", no_argument, 0, 'V'}, | ||
| 80 | {"verbose", no_argument, 0, 'v'}, | ||
| 81 | + {"regex", no_argument, 0, 'r'}, | ||
| 82 | + {"ereg", no_argument, 0, 'r'}, | ||
| 83 | + {"eregi", no_argument, 0, 'R'}, | ||
| 84 | {0, 0, 0, 0} | ||
| 85 | }; | ||
| 86 | #endif | ||
| 87 | @@ -270,10 +320,10 @@ | ||
| 88 | while (1) { | ||
| 89 | #ifdef HAVE_GETOPT_H | ||
| 90 | c = | ||
| 91 | - getopt_long (argc, argv, "+Vvht:c:w:p:s:u:C:a:", long_options, | ||
| 92 | + getopt_long (argc, argv, "+VvhRrt:c:w:p:s:u:C:a:", long_options, | ||
| 93 | &option_index); | ||
| 94 | #else | ||
| 95 | - c = getopt (argc, argv, "+Vvht:c:w:p:s:u:C:a:"); | ||
| 96 | + c = getopt (argc, argv, "+VvhRrt:c:w:p:s:u:C:a:"); | ||
| 97 | #endif | ||
| 98 | |||
| 99 | if (c == EOF) | ||
| 100 | @@ -419,6 +469,22 @@ | ||
| 101 | case 'v': /* command */ | ||
| 102 | verbose = TRUE; | ||
| 103 | break; | ||
| 104 | + case 'R': /* regex */ | ||
| 105 | +#ifdef HAVE_REGEX_H | ||
| 106 | + cflags = REG_ICASE | REG_EXTENDED | REG_NOSUB | REG_NEWLINE; | ||
| 107 | +#else | ||
| 108 | + printf ("PROCS UNKNOWN: call for regex which was not a compiled option"); | ||
| 109 | + exit (STATE_UNKNOWN); | ||
| 110 | +#endif | ||
| 111 | + break; | ||
| 112 | + case 'r': /* regex */ | ||
| 113 | +#ifdef HAVE_REGEX_H | ||
| 114 | + cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; | ||
| 115 | +#else | ||
| 116 | + printf ("PROCS UNKNOWN: call for regex which was not a compiled option"); | ||
| 117 | + exit (STATE_UNKNOWN); | ||
| 118 | +#endif | ||
| 119 | + break; | ||
| 120 | } | ||
| 121 | } | ||
| 122 | return i; | ||
| 123 | @@ -492,7 +558,11 @@ | ||
| 124 | " -a, --argument-array=STRING\n" | ||
| 125 | " Only scan for ARGS that match up to the length of the given STRING\n" | ||
| 126 | " -C, --command=COMMAND\n" | ||
| 127 | - " Only scan for exact matches to the named COMMAND.\n\n" | ||
| 128 | + " Only scan for exact matches to the named COMMAND.\n" | ||
| 129 | + " -r, --ereg\n" | ||
| 130 | + " Treat the -a or -C argument as an extended regular expression\n" | ||
| 131 | + " -R, --eregi\n" | ||
| 132 | + " Treat the -a or -C argument as a case-insensitive extended regular expression\n\n" | ||
| 133 | "RANGEs are specified 'min:max' or 'min:' or ':max' (or 'max'). If\n" | ||
| 134 | "specified 'max:min', a warning status will be generated if the\n" | ||
| 135 | |||
diff --git a/web/attachments/262608-check_oracle.sh-1.4.11.patch b/web/attachments/262608-check_oracle.sh-1.4.11.patch new file mode 100644 index 0000000..720445c --- /dev/null +++ b/web/attachments/262608-check_oracle.sh-1.4.11.patch | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | diff -u -r nagios-plugins-1.4.11\plugins-scripts\check_oracle.sh nagios-plugins-1.4.11-patch\plugins-scripts\check_oracle.sh | ||
| 2 | --- nagios-plugins-1.4.11\plugins-scripts\check_oracle.sh Sat Jul 07 13:40:30 2007 | ||
| 3 | +++ nagios-plugins-1.4.11-patch\plugins-scripts\check_oracle.sh Thu Jan 17 13:47:50 2008 | ||
| 4 | @@ -247,13 +247,10 @@ | ||
| 5 | set pagesize 0 | ||
| 6 | set numf '9999999.99' | ||
| 7 | select NVL(b.free,0.0),a.total,100 - trunc(NVL(b.free,0.0)/a.total * 1000) / 10 prc | ||
| 8 | -from ( | ||
| 9 | -select tablespace_name,sum(bytes)/1024/1024 total | ||
| 10 | -from dba_data_files group by tablespace_name) A | ||
| 11 | -LEFT OUTER JOIN | ||
| 12 | -( select tablespace_name,sum(bytes)/1024/1024 free | ||
| 13 | -from dba_free_space group by tablespace_name) B | ||
| 14 | -ON a.tablespace_name=b.tablespace_name WHERE a.tablespace_name='${5}'; | ||
| 15 | +from | ||
| 16 | + ( select tablespace_name,sum(bytes)/1024/1024 total from dba_data_files group by tablespace_name) A | ||
| 17 | +, ( select tablespace_name,sum(bytes)/1024/1024 free from dba_free_space group by tablespace_name) B | ||
| 18 | +WHERE a.tablespace_name(+)=b.tablespace_name AND a.tablespace_name='${5}'; | ||
| 19 | EOF` | ||
| 20 | |||
| 21 | if [ -n "`echo $result | grep ORA-`" ] ; then | ||
diff --git a/web/attachments/26290-autoconf.dif b/web/attachments/26290-autoconf.dif new file mode 100644 index 0000000..082234f --- /dev/null +++ b/web/attachments/26290-autoconf.dif | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | --- configure.in | ||
| 2 | +++ configure.in 2002/07/01 13:58:19 | ||
| 3 | @@ -160,7 +160,7 @@ | ||
| 4 | _SAVEDCPPFLAGS="$CPPFLAGS" | ||
| 5 | CPPFLAGS="-I/usr/include" | ||
| 6 | AC_ARG_WITH(mysqllibdir,--with-mysqllibdir=<dir> sets path to mysql libraries,[MYSQLLIBDIR=$withval]) | ||
| 7 | -if test -n "$MYSQLLIBS"; then | ||
| 8 | +if test -n "$MYSQLLIBDIR"; then | ||
| 9 | AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L$MYSQLLIBDIR",,-L$MYSQLLIBDIR -lz) | ||
| 10 | elif test -f /usr/lib/libmysqlclient.so; then | ||
| 11 | AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz) | ||
diff --git a/web/attachments/263186-check_linux_raid.pl.diff b/web/attachments/263186-check_linux_raid.pl.diff new file mode 100644 index 0000000..0e7861c --- /dev/null +++ b/web/attachments/263186-check_linux_raid.pl.diff | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | --- contrib/check_linux_raid.pl 2007-08-28 04:19:45.000000000 +0100 | ||
| 2 | +++ contrib/check_linux_raid.pl.new 2008-01-21 17:28:18.000000000 +0000 | ||
| 3 | @@ -3,6 +3,7 @@ | ||
| 4 | # Copyright (c) 2002 ISOMEDIA, Inc. | ||
| 5 | # originally written by Steve Milton | ||
| 6 | # later updates by sean finney <seanius@seanius.net> | ||
| 7 | +# bux fixing & usage message by Alain Williams <addw@phcomp.co.uk> | ||
| 8 | # | ||
| 9 | # This program is free software; you can redistribute it and/or modify | ||
| 10 | # it under the terms of the GNU General Public License as published by | ||
| 11 | @@ -26,6 +27,8 @@ | ||
| 12 | use lib "/usr/local/nagios/libexec"; | ||
| 13 | use utils qw(%ERRORS); | ||
| 14 | |||
| 15 | +my ($progname) = $0 =~ m|([^/]+)$|; | ||
| 16 | + | ||
| 17 | # die with an error if we're not on Linux | ||
| 18 | if ($^O ne 'linux') { | ||
| 19 | print "This plugin only applicable on Linux.\n"; | ||
| 20 | @@ -42,9 +45,22 @@ | ||
| 21 | return "UNKNOWN"; | ||
| 22 | } | ||
| 23 | |||
| 24 | +sub usage { | ||
| 25 | + print "Inspect Linux software raid devices and return a status for nagios\n"; | ||
| 26 | + print "Usage:\n"; | ||
| 27 | + print "$progname [--help | -h] [md-device ...]\n"; | ||
| 28 | + print "A md-device might be: md0\n"; | ||
| 29 | + print "If md-device is not given, all mds will be inspected\n"; | ||
| 30 | + exit 0; | ||
| 31 | +} | ||
| 32 | + | ||
| 33 | my $nextdev; | ||
| 34 | -if(defined $ARGV[0]) { $nextdev = shift; } | ||
| 35 | -else { $nextdev = "md[0-9]"; } | ||
| 36 | +if(defined $ARGV[0]) { | ||
| 37 | + $nextdev = shift; | ||
| 38 | + usage() if($nextdev eq '--help' or $nextdev eq '-h'); | ||
| 39 | +} else { | ||
| 40 | + $nextdev = "md[0-9]+"; # All MD devices | ||
| 41 | +} | ||
| 42 | |||
| 43 | my $code = "UNKNOWN"; | ||
| 44 | my $msg = ""; | ||
| 45 | @@ -53,6 +69,7 @@ | ||
| 46 | my %finish; | ||
| 47 | my %active; | ||
| 48 | my %devices; | ||
| 49 | +my $debug; | ||
| 50 | |||
| 51 | while(defined $nextdev){ | ||
| 52 | open (MDSTAT, "< /proc/mdstat") or die "Failed to open /proc/mdstat"; | ||
| 53 | @@ -60,14 +77,22 @@ | ||
| 54 | while(<MDSTAT>) { | ||
| 55 | if (defined $device) { | ||
| 56 | if (/(\[[_U]+\])/) { | ||
| 57 | + print "status='$1' device '$device'\n" if($debug); | ||
| 58 | $status{$device} = $1; | ||
| 59 | } elsif (/recovery = (.*?)\s/) { | ||
| 60 | $recovery{$device} = $1; | ||
| 61 | ($finish{$device}) = /finish=(.*?min)/; | ||
| 62 | - } elsif (/^\s*$/) { | ||
| 63 | + } elsif (/^\s*$/) { # Start of another device - blank line. NB: may not be present | ||
| 64 | + print "undef '$device' _='$_'\n" if($debug); | ||
| 65 | $device=undef; | ||
| 66 | + } elsif(/^md[0-9]+\s*:/) { # Start of another device - another way | ||
| 67 | + print "undef '$device' _='$_'\n" if($debug); | ||
| 68 | + undef $device; | ||
| 69 | } | ||
| 70 | - } elsif (/^($nextdev)\s*:/) { | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + # No current device and this line matches the device pattern ? | ||
| 74 | + if ( ! defined($device) and /^($nextdev)\s*:/) { | ||
| 75 | $device=$1; | ||
| 76 | $devices{$device}=$device; | ||
| 77 | if (/active/) { | ||
diff --git a/web/attachments/263302-command.cfg.in-check_ldap.patch b/web/attachments/263302-command.cfg.in-check_ldap.patch new file mode 100644 index 0000000..ada86c2 --- /dev/null +++ b/web/attachments/263302-command.cfg.in-check_ldap.patch | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | --- nagios-plugins-1.4.11/command.cfg.in.org 2004-12-02 05:48:37.000000000 +0100 | ||
| 2 | +++ nagios-plugins-1.4.11/command.cfg.in 2008-01-22 16:17:07.000000000 +0100 | ||
| 3 | @@ -268,8 +268,11 @@ | ||
| 4 | # Netware 5 number of current service procs | ||
| 5 | command[check_nwstat_csprocs]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v CSPROCS -w $ARG1$ -c $ARG2$ | ||
| 6 | |||
| 7 | +# Check LDAP and LDAP over SSL | ||
| 8 | +command[check_ldap]=@libexecdir@/check_ldap -H $HOSTADDRESS$ -b "dc=Some,dc=Company,dc=com" | ||
| 9 | +command[check_ldaps]=@libexecdir@/check_ldaps -H $HOSTADDRESS$ -b "dc=Some,dc=Company,dc=com" | ||
| 10 | + | ||
| 11 | |||
| 12 | # Still have to write sample entries for the following: | ||
| 13 | # | ||
| 14 | -# check_ldap | ||
| 15 | # check_overcr | ||
diff --git a/web/attachments/263441-check_mailq-add-sudo.patch b/web/attachments/263441-check_mailq-add-sudo.patch new file mode 100644 index 0000000..dff08c3 --- /dev/null +++ b/web/attachments/263441-check_mailq-add-sudo.patch | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | diff -Naur /home/qqnagio/software/nagios/nagios-plugins-1.4.11/plugins-scripts/check_mailq.pl /home/qqnagio/software/nagios/nagios-plugins-1.4.11.sudomailq/plugins-scripts/check_mailq.pl | ||
| 2 | --- /home/qqnagio/software/nagios/nagios-plugins-1.4.11/plugins-scripts/check_mailq.pl 2006-07-05 15:45:57.000000000 +0200 | ||
| 3 | +++ /home/qqnagio/software/nagios/nagios-plugins-1.4.11.sudomailq/plugins-scripts/check_mailq.pl 2008-01-23 14:52:01.556368612 +0100 | ||
| 4 | @@ -62,12 +62,29 @@ | ||
| 5 | }; | ||
| 6 | alarm($opt_t); | ||
| 7 | |||
| 8 | +# if there is an entry in the sudoers file which allows the caller of this | ||
| 9 | +# plugin to execute the $utils::PATH_TO_MAILQ command with superuser privileges | ||
| 10 | +# then prepend $utils::PATH_TO_MAILQ with "sudo " | ||
| 11 | + | ||
| 12 | +sub sudoize { | ||
| 13 | + my $ppath_to_mailq = shift; | ||
| 14 | + if (grep(/$$ppath_to_mailq/, | ||
| 15 | + map { s/^\s+//g; s/\s+$//g; $_; } | ||
| 16 | + map { split /, / } | ||
| 17 | + map { s/^.*?://g; $_; } | ||
| 18 | + do { local (@ARGV) = "/usr/bin/sudo -l |"; <> })) { | ||
| 19 | + $$ppath_to_mailq = "/usr/bin/sudo ".$$ppath_to_mailq; | ||
| 20 | + } | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | + | ||
| 24 | # switch based on MTA | ||
| 25 | |||
| 26 | if ($mailq eq "sendmail") { | ||
| 27 | |||
| 28 | ## open mailq | ||
| 29 | if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { | ||
| 30 | + sudoize(\$utils::PATH_TO_MAILQ); | ||
| 31 | if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { | ||
| 32 | print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; | ||
| 33 | exit $ERRORS{'UNKNOWN'}; | ||
| 34 | @@ -297,6 +314,7 @@ | ||
| 35 | |||
| 36 | ## open mailq | ||
| 37 | if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { | ||
| 38 | + sudoize(\$utils::PATH_TO_MAILQ); | ||
| 39 | if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { | ||
| 40 | print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; | ||
| 41 | exit $ERRORS{'UNKNOWN'}; | ||
| 42 | @@ -379,6 +397,7 @@ | ||
| 43 | |||
| 44 | # open qmail-qstat | ||
| 45 | if ( defined $utils::PATH_TO_QMAIL_QSTAT && -x $utils::PATH_TO_QMAIL_QSTAT ) { | ||
| 46 | + sudoize(\$utils::PATH_TO_MAILQ); | ||
| 47 | if (! open (MAILQ, "$utils::PATH_TO_QMAIL_QSTAT | " ) ) { | ||
| 48 | print "ERROR: could not open $utils::PATH_TO_QMAIL_QSTAT \n"; | ||
| 49 | exit $ERRORS{'UNKNOWN'}; | ||
| 50 | @@ -461,6 +480,7 @@ | ||
| 51 | elsif ( $mailq eq "exim" ) { | ||
| 52 | ## open mailq | ||
| 53 | if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { | ||
| 54 | + sudoize(\$utils::PATH_TO_MAILQ); | ||
| 55 | if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { | ||
| 56 | print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; | ||
| 57 | exit $ERRORS{'UNKNOWN'}; | ||
diff --git a/web/attachments/263604-50_misc_typos.dpatch b/web/attachments/263604-50_misc_typos.dpatch new file mode 100644 index 0000000..2f49980 --- /dev/null +++ b/web/attachments/263604-50_misc_typos.dpatch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-3 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378823768" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378823768" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378823768" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378823768" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378823768'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1878971&group_id=29880&atid=397597&file_id=263604" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/263605-28_check_pgsql_include_for_8.3.dpatch b/web/attachments/263605-28_check_pgsql_include_for_8.3.dpatch new file mode 100644 index 0000000..88fd591 --- /dev/null +++ b/web/attachments/263605-28_check_pgsql_include_for_8.3.dpatch | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | ## 28_check_pgsql_include_for_8.3.dpatch by Jan Wagner <waja@cyconet.org> | ||
| 2 | ## | ||
| 3 | ## All lines beginning with `## DP:' are a description of the patch. | ||
| 4 | ## DP: include pg_config_manual.h since NAMEDATALEN definition moved there with psql 8.3 | ||
| 5 | |||
| 6 | diff -Nur nagios-plugins-1.4.11.orig/plugins/check_pgsql.c nagios-plugins-1.4.11/plugins/check_pgsql.c | ||
| 7 | --- nagios-plugins-1.4.11.orig/plugins/check_pgsql.c 2007-01-28 22:46:41.000000000 +0100 | ||
| 8 | +++ nagios-plugins-1.4.11/plugins/check_pgsql.c 2008-01-24 15:54:56.533368467 +0100 | ||
| 9 | @@ -43,6 +43,7 @@ | ||
| 10 | #include "utils.h" | ||
| 11 | |||
| 12 | #include "netutils.h" | ||
| 13 | +#include "pg_config_manual.h" | ||
| 14 | #include <libpq-fe.h> | ||
| 15 | |||
| 16 | #define DEFAULT_DB "template1" | ||
diff --git a/web/attachments/26370-check_http_strace.txt b/web/attachments/26370-check_http_strace.txt new file mode 100644 index 0000000..0b8197b --- /dev/null +++ b/web/attachments/26370-check_http_strace.txt | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | connect(3, {sin_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("216.239. | ||
| 2 | 39.100")}}, 16) = 0 | ||
| 3 | send(3, "GET / HTTP/1.0\r\n", 16, 0) = 16 | ||
| 4 | send(3, "Host: www.google.com\r\n", 22, 0) = 22 | ||
| 5 | send(3, "User-Agent: check_http/1.1.1.1 ("..., 62, 0) = 62 | ||
| 6 | send(3, "\r\n\r\n", 4, 0) = 4 | ||
| 7 | recv(3, "HTTP/1.0 200 OK\r\nContent-Length:"..., 1023, 0) = 381 | ||
| 8 | recv(3, "<html><head><META HTTP-EQUIV=\"co"..., 1023, 0) = 1023 | ||
| 9 | brk(0x8051000) = 0x8051000 | ||
| 10 | recv(3, "color=#3366cc align=center width"..., 1023, 0) = 80 | ||
| 11 | recv(3, "b></font></td><td width=15> "..., 1023, 0) = 1023 | ||
| 12 | recv(3, "<td valign=top nowrap><font size"..., 1023, 0) = 455 | ||
| 13 | recv(3, "ont size=-1><br><font color=red>"..., 1023, 0) = 579 | ||
| 14 | brk(0x8053000) = 0x8053000 | ||
| 15 | recv(3, 0x804e100, 1023, 0) = ? ERESTARTSYS (To be restarted) | ||
| 16 | --- SIGALRM (Alarm clock) --- | ||
| 17 | fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0 | ||
| 18 | old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0 | ||
| 19 | x40014000 | ||
| 20 | write(1, "Socket timeout after 10 seconds\n", 32) = 32 \ No newline at end of file | ||
diff --git a/web/attachments/263786-30_fix_check_ntp_options.dpatch b/web/attachments/263786-30_fix_check_ntp_options.dpatch new file mode 100644 index 0000000..2a1c2d6 --- /dev/null +++ b/web/attachments/263786-30_fix_check_ntp_options.dpatch | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | ## 30_fix_check_ntp_options.dpatch by Jan Wagner <waja@cyconet.org> | ||
| 2 | ## | ||
| 3 | ## All lines beginning with `## DP:' are a description of the patch. | ||
| 4 | ## DP: Fix options for check_ntp_time and check_ntp_peer | ||
| 5 | |||
| 6 | --- nagios-plugins-1.4.11/plugins/check_ntp_time.c.orig 2008-01-26 00:03:57.486086968 +0100 | ||
| 7 | +++ nagios-plugins-1.4.11/plugins/check_ntp_time.c 2008-01-26 00:04:26.652580066 +0100 | ||
| 8 | @@ -631,7 +631,6 @@ | ||
| 9 | print_usage(void) | ||
| 10 | { | ||
| 11 | printf (_("Usage:")); | ||
| 12 | - printf(" %s -H <host> [-w <warn>] [-c <crit>] [-W <warn>] [-C <crit>]\n", progname); | ||
| 13 | - printf(" [-j <warn>] [-k <crit>] [-v verbose]\n"); | ||
| 14 | + printf(" %s -H <host> [-w <warn>] [-c <crit>] [-v verbose]\n", progname); | ||
| 15 | } | ||
| 16 | |||
| 17 | --- nagios-plugins-1.4.11/plugins/check_ntp_peer.c.orig 2008-01-26 00:08:50.393996604 +0100 | ||
| 18 | +++ nagios-plugins-1.4.11/plugins/check_ntp_peer.c 2008-01-26 00:09:36.762190836 +0100 | ||
| 19 | @@ -642,7 +642,7 @@ | ||
| 20 | printf (" %s\n", _("Offset to result in critical status (seconds)")); | ||
| 21 | printf (" %s\n", "-W, --warning=THRESHOLD"); | ||
| 22 | printf (" %s\n", _("Warning threshold for stratum")); | ||
| 23 | - printf (" %s\n", "-W, --critical=THRESHOLD"); | ||
| 24 | + printf (" %s\n", "-C, --critical=THRESHOLD"); | ||
| 25 | printf (" %s\n", _("Critical threshold for stratum")); | ||
| 26 | printf (" %s\n", "-j, --warning=THRESHOLD"); | ||
| 27 | printf (" %s\n", _("Warning threshold for jitter")); | ||
diff --git a/web/attachments/264034-nagios-plugins_bind.patch b/web/attachments/264034-nagios-plugins_bind.patch new file mode 100644 index 0000000..208ae96 --- /dev/null +++ b/web/attachments/264034-nagios-plugins_bind.patch | |||
| @@ -0,0 +1,137 @@ | |||
| 1 | diff -ur nagiosplug-trunk/plugins/check_http.c nagiosplug/plugins/check_http.c | ||
| 2 | --- nagiosplug-trunk/plugins/check_http.c 2008-01-28 16:20:49.000000000 +0100 | ||
| 3 | +++ nagiosplug/plugins/check_http.c 2008-01-28 17:03:51.000000000 +0100 | ||
| 4 | @@ -97,6 +97,7 @@ | ||
| 5 | char server_port_text[6] = ""; | ||
| 6 | char server_type[6] = "http"; | ||
| 7 | char *server_address; | ||
| 8 | +char *client_address = NULL; | ||
| 9 | char *host_name; | ||
| 10 | char *server_url; | ||
| 11 | char *user_agent; | ||
| 12 | @@ -188,6 +189,7 @@ | ||
| 13 | {"ssl", no_argument, 0, 'S'}, | ||
| 14 | {"post", required_argument, 0, 'P'}, | ||
| 15 | {"IP-address", required_argument, 0, 'I'}, | ||
| 16 | + {"bind-address", required_argument, 0, 'B'}, | ||
| 17 | {"url", required_argument, 0, 'u'}, | ||
| 18 | {"port", required_argument, 0, 'p'}, | ||
| 19 | {"authorization", required_argument, 0, 'a'}, | ||
| 20 | @@ -228,7 +230,7 @@ | ||
| 21 | } | ||
| 22 | |||
| 23 | while (1) { | ||
| 24 | - c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:T:I:a:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 25 | + c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:T:I:B:a:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 26 | if (c == -1 || c == EOF) | ||
| 27 | break; | ||
| 28 | |||
| 29 | @@ -328,6 +330,9 @@ | ||
| 30 | case 'I': /* Server IP-address */ | ||
| 31 | server_address = strdup (optarg); | ||
| 32 | break; | ||
| 33 | + case 'B': /* Bind address */ | ||
| 34 | + client_address = strdup (optarg); | ||
| 35 | + break; | ||
| 36 | case 'u': /* URL path */ | ||
| 37 | server_url = strdup (optarg); | ||
| 38 | server_url_length = strlen (server_url); | ||
| 39 | @@ -732,7 +737,7 @@ | ||
| 40 | int result = STATE_UNKNOWN; | ||
| 41 | |||
| 42 | /* try to connect to the host at the given port number */ | ||
| 43 | - if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) | ||
| 44 | + if (my_tcp_bind_connect (server_address, server_port, &sd, client_address) != STATE_OK) | ||
| 45 | die (STATE_CRITICAL, _("HTTP CRITICAL - Unable to open TCP socket\n")); | ||
| 46 | #ifdef HAVE_SSL | ||
| 47 | if (use_ssl == TRUE) { | ||
| 48 | @@ -1241,6 +1246,9 @@ | ||
| 49 | printf (" %s\n", _("Append a port to include it in the header (eg: example.com:5000)")); | ||
| 50 | printf (" %s\n", "-I, --IP-address=ADDRESS"); | ||
| 51 | printf (" %s\n", _("IP address or name (use numeric address if possible to bypass DNS lookup).")); | ||
| 52 | + printf (" %s\n", "-B, --bind-address=ADDRESS"); | ||
| 53 | + printf (" %s\n", _("IP address or name on the local machine to be used as the source address")); | ||
| 54 | + printf (" %s\n", _("of the connection.")); | ||
| 55 | printf (" %s\n", "-p, --port=INTEGER"); | ||
| 56 | printf (" %s", _("Port number (default: ")); | ||
| 57 | printf ("%d)\n", HTTP_PORT); | ||
| 58 | diff -ur nagiosplug-trunk/plugins/netutils.c nagiosplug/plugins/netutils.c | ||
| 59 | --- nagiosplug-trunk/plugins/netutils.c 2008-01-28 16:20:49.000000000 +0100 | ||
| 60 | +++ nagiosplug/plugins/netutils.c 2008-01-28 17:33:48.000000000 +0100 | ||
| 61 | @@ -163,12 +163,14 @@ | ||
| 62 | |||
| 63 | /* opens a tcp or udp connection to a remote host or local socket */ | ||
| 64 | int | ||
| 65 | -np_net_connect (const char *host_name, int port, int *sd, int proto) | ||
| 66 | +np_net_connect (const char *host_name, int port, int *sd, int proto, ...) | ||
| 67 | { | ||
| 68 | + va_list ap; | ||
| 69 | struct addrinfo hints; | ||
| 70 | - struct addrinfo *r, *res; | ||
| 71 | + struct addrinfo *r, *res, *rb; | ||
| 72 | struct sockaddr_un su; | ||
| 73 | char port_str[6], host[MAX_HOST_ADDRESS_LENGTH]; | ||
| 74 | + char *bindaddress; | ||
| 75 | size_t len; | ||
| 76 | int socktype, result; | ||
| 77 | |||
| 78 | @@ -200,6 +202,28 @@ | ||
| 79 | } | ||
| 80 | |||
| 81 | r = res; | ||
| 82 | + | ||
| 83 | + va_start(ap, proto); | ||
| 84 | + bindaddress = va_arg(ap, char *); | ||
| 85 | + va_end(ap); | ||
| 86 | + if (bindaddress) { | ||
| 87 | + memset (&hints, 0, sizeof (hints)); | ||
| 88 | + hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ | ||
| 89 | + hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */ | ||
| 90 | + hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */ | ||
| 91 | + hints.ai_protocol = 0; /* Any protocol */ | ||
| 92 | + hints.ai_canonname = NULL; | ||
| 93 | + hints.ai_addr = NULL; | ||
| 94 | + hints.ai_next = NULL; | ||
| 95 | + | ||
| 96 | + result = getaddrinfo (bindaddress, NULL, &hints, &res); | ||
| 97 | + if (result != 0) { | ||
| 98 | + printf ("%s\n", gai_strerror (result)); | ||
| 99 | + return STATE_UNKNOWN; | ||
| 100 | + } | ||
| 101 | + rb = res; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | while (r) { | ||
| 105 | /* attempt to create a socket */ | ||
| 106 | *sd = socket (r->ai_family, socktype, r->ai_protocol); | ||
| 107 | @@ -210,6 +234,15 @@ | ||
| 108 | return STATE_UNKNOWN; | ||
| 109 | } | ||
| 110 | |||
| 111 | + /* attempt to bind to source IP */ | ||
| 112 | + if (bindaddress) { | ||
| 113 | + result = bind(*sd, rb->ai_addr, rb->ai_addrlen); | ||
| 114 | + if (result != 0) { | ||
| 115 | + printf ("%s\n", _("Unable to bind to source address")); | ||
| 116 | + return STATE_UNKNOWN; | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | /* attempt to open a connection */ | ||
| 121 | result = connect (*sd, r->ai_addr, r->ai_addrlen); | ||
| 122 | |||
| 123 | diff -ur nagiosplug-trunk/plugins/netutils.h nagiosplug/plugins/netutils.h | ||
| 124 | --- nagiosplug-trunk/plugins/netutils.h 2008-01-28 16:20:49.000000000 +0100 | ||
| 125 | +++ nagiosplug/plugins/netutils.h 2008-01-28 17:27:30.000000000 +0100 | ||
| 126 | @@ -64,7 +64,10 @@ | ||
| 127 | /* my_connect and wrapper macros */ | ||
| 128 | #define my_tcp_connect(addr, port, s) np_net_connect(addr, port, s, IPPROTO_TCP) | ||
| 129 | #define my_udp_connect(addr, port, s) np_net_connect(addr, port, s, IPPROTO_UDP) | ||
| 130 | -int np_net_connect(const char *address, int port, int *sd, int proto); | ||
| 131 | +#define my_tcp_bind_connect(addr, port, s, bind_addr) np_net_connect(addr, port, s, IPPROTO_TCP, bind_addr) | ||
| 132 | +#define my_ucp_bind_connect(addr, port, s, bind_addr) np_net_connect(addr, port, s, IPPROTO_TCP, bind_addr) | ||
| 133 | + | ||
| 134 | +int np_net_connect(const char *address, int port, int *sd, int proto, ...); | ||
| 135 | |||
| 136 | /* send_request and wrapper macros */ | ||
| 137 | #define send_tcp_request(s, sbuf, rbuf, rsize) \ | ||
diff --git a/web/attachments/264171-check_http-HostHeader.patch b/web/attachments/264171-check_http-HostHeader.patch new file mode 100644 index 0000000..556e57a --- /dev/null +++ b/web/attachments/264171-check_http-HostHeader.patch | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | --- check_http.c.orig 2008-01-29 10:58:01.000000000 -0500 | ||
| 2 | +++ check_http.c 2008-01-29 11:01:47.000000000 -0500 | ||
| 3 | @@ -753,7 +787,7 @@ | ||
| 4 | |||
| 5 | /* optionally send the host header info */ | ||
| 6 | if (host_name) | ||
| 7 | - asprintf (&buf, "%sHost: %s\r\n", buf, host_name); | ||
| 8 | + asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port); | ||
| 9 | |||
| 10 | /* optionally send any other header tag */ | ||
| 11 | if (http_opt_headers_count) { | ||
diff --git a/web/attachments/264173-check_http-PostFromFile.patch b/web/attachments/264173-check_http-PostFromFile.patch new file mode 100644 index 0000000..2fe2102 --- /dev/null +++ b/web/attachments/264173-check_http-PostFromFile.patch | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | --- check_http.c.orig 2008-01-29 10:58:01.000000000 -0500 | ||
| 2 | +++ check_http.c 2008-01-29 11:01:47.000000000 -0500 | ||
| 3 | @@ -122,6 +122,7 @@ | ||
| 4 | int max_depth = 15; | ||
| 5 | char *http_method; | ||
| 6 | char *http_post_data; | ||
| 7 | +char *http_post_datafile; | ||
| 8 | char *http_content_type; | ||
| 9 | char buffer[MAX_INPUT_BUFFER]; | ||
| 10 | |||
| 11 | @@ -175,6 +176,9 @@ | ||
| 12 | { | ||
| 13 | int c = 1; | ||
| 14 | char *p; | ||
| 15 | + FILE *fp; | ||
| 16 | + char input_buffer[MAX_INPUT_BUFFER]; | ||
| 17 | + int first; | ||
| 18 | |||
| 19 | enum { | ||
| 20 | INVERT_REGEX = CHAR_MAX + 1 | ||
| 21 | @@ -187,6 +191,7 @@ | ||
| 22 | {"nohtml", no_argument, 0, 'n'}, | ||
| 23 | {"ssl", no_argument, 0, 'S'}, | ||
| 24 | {"post", required_argument, 0, 'P'}, | ||
| 25 | + {"postfile", required_argument, 0, 'F'}, | ||
| 26 | {"IP-address", required_argument, 0, 'I'}, | ||
| 27 | {"url", required_argument, 0, 'u'}, | ||
| 28 | {"port", required_argument, 0, 'p'}, | ||
| 29 | @@ -228,7 +233,7 @@ | ||
| 30 | } | ||
| 31 | |||
| 32 | while (1) { | ||
| 33 | - c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:T:I:a:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 34 | + c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:F:T:I:a:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 35 | if (c == -1 || c == EOF) | ||
| 36 | break; | ||
| 37 | |||
| 38 | @@ -349,6 +354,11 @@ | ||
| 39 | http_method = strdup("POST"); | ||
| 40 | http_post_data = strdup (optarg); | ||
| 41 | break; | ||
| 42 | + case 'F': /* HTTP POST data from file in URL encoded format */ | ||
| 43 | + if (http_method || http_post_datafile) break; | ||
| 44 | + http_method = strdup("POST"); | ||
| 45 | + http_post_datafile = strdup (optarg); | ||
| 46 | + break; | ||
| 47 | case 's': /* string or substring */ | ||
| 48 | strncpy (string_expect, optarg, MAX_INPUT_BUFFER - 1); | ||
| 49 | string_expect[MAX_INPUT_BUFFER - 1] = 0; | ||
| 50 | @@ -439,6 +449,30 @@ | ||
| 51 | } | ||
| 52 | |||
| 53 | c = optind; | ||
| 54 | + | ||
| 55 | + /* If user asked to read POST data from file, check for file existence then read content */ | ||
| 56 | + | ||
| 57 | + if (http_post_datafile != NULL) { | ||
| 58 | + fp = fopen(http_post_datafile,"r"); | ||
| 59 | + if (fp == NULL) | ||
| 60 | + usage4 (_("Unable to open POST data file\n")); | ||
| 61 | + | ||
| 62 | + first=1; | ||
| 63 | + while (fgets(input_buffer,MAX_INPUT_BUFFER,fp)) { | ||
| 64 | + input_buffer[strlen(input_buffer)-1] = '\0'; /* strip newline */ | ||
| 65 | + if (first == 1) { | ||
| 66 | + first=0; | ||
| 67 | + asprintf (&http_post_data, "%s\r\n", input_buffer); | ||
| 68 | + } else { | ||
| 69 | + asprintf (&http_post_data, "%s%s\r\n", http_post_data, input_buffer); | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + fclose(fp); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + /* End of POST data file addition */ | ||
| 77 | + | ||
| 78 | |||
| 79 | if (server_address == NULL && c < argc) | ||
| 80 | server_address = strdup (argv[c++]); | ||
| 81 | @@ -1265,6 +1299,8 @@ | ||
| 82 | printf (" %s\n", _("URL to GET or POST (default: /)")); | ||
| 83 | printf (" %s\n", "-P, --post=STRING"); | ||
| 84 | printf (" %s\n", _("URL encoded http POST data")); | ||
| 85 | + printf (" %s\n", "-F, --postfile=PATH"); | ||
| 86 | + printf (" %s\n", _("file with URL-encoded http POST data")); | ||
| 87 | printf (" %s\n", "-N, --no-body"); | ||
| 88 | printf (" %s\n", _("Don't wait for document body: stop reading after headers.")); | ||
| 89 | printf (" %s\n", _("(Note that this still does an HTTP GET or POST, not a HEAD.)")); | ||
| 90 | @@ -1341,7 +1377,7 @@ | ||
| 91 | printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname); | ||
| 92 | printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n"); | ||
| 93 | printf (" [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n"); | ||
| 94 | - printf (" [-s string] [-l] [-r <regex> | -R <case-insensitive regex>] [-P string]\n"); | ||
| 95 | + printf (" [-s string] [-l] [-r <regex> | -R <case-insensitive regex>] [-P string | -F file]\n"); | ||
| 96 | printf (" [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>] [-A string]\n"); | ||
| 97 | printf (" [-k string] [-S] [-C <age>] [-T <content-type>]\n"); | ||
| 98 | } | ||
diff --git a/web/attachments/265188-31_check_disk_local_option.dpatch b/web/attachments/265188-31_check_disk_local_option.dpatch new file mode 100644 index 0000000..08bbabc --- /dev/null +++ b/web/attachments/265188-31_check_disk_local_option.dpatch | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | ## 31_check_disk_local_option.dpatch by Jan Wagner <waja@cyconet.org> | ||
| 2 | ## | ||
| 3 | ## All lines beginning with `## DP:' are a description of the patch. | ||
| 4 | ## DP: Fix local option for check_disk | ||
| 5 | |||
| 6 | diff -Nur nagios-plugins-1.4.11/plugins/check_disk.c.orig nagios-plugins-1.4.11/plugins/check_disk.c | ||
| 7 | --- nagios-plugins-1.4.11/plugins/check_disk.c.orig 2007-12-08 17:34:05.000000000 +0100 | ||
| 8 | +++ nagios-plugins-1.4.11/plugins/check_disk.c 2008-02-05 22:13:43.397159697 +0100 | ||
| 9 | @@ -475,7 +475,7 @@ | ||
| 10 | {"iwarning", required_argument, 0, 'W'}, | ||
| 11 | /* Dang, -C is taken. We might want to reshuffle this. */ | ||
| 12 | {"icritical", required_argument, 0, 'K'}, | ||
| 13 | - {"local", required_argument, 0, 'l'}, | ||
| 14 | + {"local", no_argument, 0, 'l'}, | ||
| 15 | {"stat-remote-fs", required_argument, 0, 'L'}, | ||
| 16 | {"kilobytes", required_argument, 0, 'k'}, | ||
| 17 | {"megabytes", required_argument, 0, 'm'}, | ||
diff --git a/web/attachments/265606-nagios-plugins-1.4.11-check_dig_fix-1.patch b/web/attachments/265606-nagios-plugins-1.4.11-check_dig_fix-1.patch new file mode 100644 index 0000000..d1a3516 --- /dev/null +++ b/web/attachments/265606-nagios-plugins-1.4.11-check_dig_fix-1.patch | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | Date: 07 Feburary 2008 | ||
| 2 | Author: Jethro Carr <jethro.carr@jethrocarr.com> working for Prophecy Networks NZ. | ||
| 3 | Details: Fixed check_dig plugin to make the dig command in the backend run for the specified time period. | ||
| 4 | |||
| 5 | --- nagios-plugins-1.4.1/plugins/check_dig.c 2005-01-27 10:21:01.000000000 +1300 | ||
| 6 | --- nagios-plugins-1.4.11.orig/plugins/check_dig.c 2007-01-29 10:46:41.000000000 +1300 | ||
| 7 | +++ nagios-plugins-1.4.11/plugins/check_dig.c 2008-02-07 10:59:46.000000000 +1300 | ||
| 8 | @@ -54,6 +54,8 @@ | ||
| 9 | |||
| 10 | #define UNDEFINED 0 | ||
| 11 | #define DEFAULT_PORT 53 | ||
| 12 | +#define DEFAULT_TRIES 3 | ||
| 13 | +#define DEFAULT_TIMEOUT 10 | ||
| 14 | |||
| 15 | char *query_address = NULL; | ||
| 16 | char *record_type = "A"; | ||
| 17 | @@ -61,6 +63,7 @@ | ||
| 18 | char *dns_server = NULL; | ||
| 19 | int verbose = FALSE; | ||
| 20 | int server_port = DEFAULT_PORT; | ||
| 21 | +int number_tries = DEFAULT_TRIES; | ||
| 22 | double warning_interval = UNDEFINED; | ||
| 23 | double critical_interval = UNDEFINED; | ||
| 24 | struct timeval tv; | ||
| 25 | @@ -76,6 +79,7 @@ | ||
| 26 | long microsec; | ||
| 27 | double elapsed_time; | ||
| 28 | int result = STATE_UNKNOWN; | ||
| 29 | + timeout_interval = DEFAULT_TIMEOUT; | ||
| 30 | |||
| 31 | setlocale (LC_ALL, ""); | ||
| 32 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 33 | @@ -88,9 +92,13 @@ | ||
| 34 | if (process_arguments (argc, argv) == ERROR) | ||
| 35 | usage_va(_("Could not parse arguments")); | ||
| 36 | |||
| 37 | + /* dig applies the timeout to each try, so we need to work around this */ | ||
| 38 | + int timeout_interval_dig = ceil((double) timeout_interval / (double) number_tries); | ||
| 39 | + | ||
| 40 | /* get the command to run */ | ||
| 41 | - asprintf (&command_line, "%s @%s -p %d %s -t %s", | ||
| 42 | - PATH_TO_DIG, dns_server, server_port, query_address, record_type); | ||
| 43 | + asprintf (&command_line, "%s @%s -p %d %s -t %s +tries=%d +time=%d", | ||
| 44 | + PATH_TO_DIG, dns_server, server_port, query_address, record_type, number_tries, timeout_interval_dig); | ||
| 45 | + | ||
| 46 | |||
| 47 | alarm (timeout_interval); | ||
| 48 | gettimeofday (&tv, NULL); | ||
diff --git a/web/attachments/265656-nagios-plugins-1.4.11.patch b/web/attachments/265656-nagios-plugins-1.4.11.patch new file mode 100644 index 0000000..e61c513 --- /dev/null +++ b/web/attachments/265656-nagios-plugins-1.4.11.patch | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | diff -ru ../../../src/nagios-plugins-1.4.11/plugins-root/check_dhcp.c ./plugins-root/check_dhcp.c | ||
| 2 | --- ../../../src/nagios-plugins-1.4.11/plugins-root/check_dhcp.c 2007-10-25 15:43:04.000000000 -0500 | ||
| 3 | +++ ./plugins-root/check_dhcp.c 2008-02-09 13:04:02.803830506 -0600 | ||
| 4 | @@ -82,7 +82,7 @@ | ||
| 5 | #include <sys/sysctl.h> | ||
| 6 | #include <net/if_dl.h> | ||
| 7 | |||
| 8 | -#elif defined(__sun__) || defined(__solaris__) || defined(__hpux__) | ||
| 9 | +#elif defined(__sun) || defined(__sun__) || defined(__solaris__) || defined(__hpux__) | ||
| 10 | |||
| 11 | #define INSAP 22 | ||
| 12 | #define OUTSAP 24 | ||
diff --git a/web/attachments/265873-child_test.strace b/web/attachments/265873-child_test.strace new file mode 100644 index 0000000..d3c2834 --- /dev/null +++ b/web/attachments/265873-child_test.strace | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | execve("./child_test", ["./child_test"], [/* 23 vars */]) = 0 | ||
| 2 | uname({sys="Linux", node="esvnagios.esv.chipkarte.at", ...}) = 0 | ||
| 3 | brk(0) = 0x8163000 | ||
| 4 | access("/etc/ld.so.preload", R_OK) = 0 | ||
| 5 | open("/etc/ld.so.preload", O_RDONLY) = 3 | ||
| 6 | fstat64(3, {st_mode=S_IFREG|0444, st_size=17, ...}) = 0 | ||
| 7 | old_mmap(NULL, 17, PROT_READ|PROT_WRITE, MAP_PRIVATE, 3, 0) = 0xb7fe7000 | ||
| 8 | close(3) = 0 | ||
| 9 | open("/lib/libcwait.so", O_RDONLY) = 3 | ||
| 10 | read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@\4\0\000"..., 512) = 512 | ||
| 11 | fstat64(3, {st_mode=S_IFREG|0755, st_size=2784, ...}) = 0 | ||
| 12 | old_mmap(NULL, 5764, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x815000 | ||
| 13 | old_mmap(0x816000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0x816000 | ||
| 14 | close(3) = 0 | ||
| 15 | munmap(0xb7fe7000, 17) = 0 | ||
| 16 | open("/etc/ld.so.cache", O_RDONLY) = 3 | ||
| 17 | fstat64(3, {st_mode=S_IFREG|0644, st_size=76531, ...}) = 0 | ||
| 18 | old_mmap(NULL, 76531, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7fd5000 | ||
| 19 | close(3) = 0 | ||
| 20 | open("/usr/lib/libstdc++.so.6", O_RDONLY) = 3 | ||
| 21 | read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\260\265"..., 512) = 512 | ||
| 22 | fstat64(3, {st_mode=S_IFREG|0755, st_size=796392, ...}) = 0 | ||
| 23 | old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fd4000 | ||
| 24 | old_mmap(NULL, 818420, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x6ae000 | ||
| 25 | old_mmap(0x76c000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xbe000) = 0x76c000 | ||
| 26 | old_mmap(0x771000, 19700, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x771000 | ||
| 27 | close(3) = 0 | ||
| 28 | open("/lib/tls/libm.so.6", O_RDONLY) = 3 | ||
| 29 | read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0003\0"..., 512) = 512 | ||
| 30 | fstat64(3, {st_mode=S_IFREG|0755, st_size=176195, ...}) = 0 | ||
| 31 | old_mmap(NULL, 139424, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xcd6000 | ||
| 32 | old_mmap(0xcf7000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x20000) = 0xcf7000 | ||
| 33 | close(3) = 0 | ||
| 34 | open("/lib/libgcc_s.so.1", O_RDONLY) = 3 | ||
| 35 | read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\f\25\0"..., 512) = 512 | ||
| 36 | fstat64(3, {st_mode=S_IFREG|0755, st_size=29700, ...}) = 0 | ||
| 37 | old_mmap(NULL, 32512, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x605000 | ||
| 38 | old_mmap(0x60c000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x60c000 | ||
| 39 | close(3) = 0 | ||
| 40 | open("/lib/tls/libc.so.6", O_RDONLY) = 3 | ||
| 41 | read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20O\1\000"..., 512) = 512 | ||
| 42 | fstat64(3, {st_mode=S_IFREG|0755, st_size=1451450, ...}) = 0 | ||
| 43 | old_mmap(NULL, 1219772, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x34e000 | ||
| 44 | old_mmap(0x472000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x124000) = 0x472000 | ||
| 45 | old_mmap(0x476000, 7356, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x476000 | ||
| 46 | close(3) = 0 | ||
| 47 | old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fd3000 | ||
| 48 | mprotect(0x472000, 4096, PROT_READ) = 0 | ||
| 49 | mprotect(0x33d000, 4096, PROT_READ) = 0 | ||
| 50 | set_thread_area({entry_number:-1 -> 6, base_addr:0xb7fd38e0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0 | ||
| 51 | munmap(0xb7fd5000, 76531) = 0 | ||
| 52 | rt_sigaction(SIGCHLD, {0x80487c6, [CHLD], SA_RESTORER|SA_RESTART, 0x3758e8}, {SIG_DFL}, 8) = 0 | ||
| 53 | pipe([3, 4]) = 0 | ||
| 54 | clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7fd3928) = 7085 | ||
| 55 | close(0) = 0 | ||
| 56 | dup(3) = 0 | ||
| 57 | close(4) = 0 | ||
| 58 | fstat64(0, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0 | ||
| 59 | mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fe7000 | ||
| 60 | read(0, ";; connection timed out; no serv"..., 4096) = 54 | ||
| 61 | wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 7085 | ||
| 62 | --- SIGCHLD (Child exited) @ 0 (0) --- | ||
| 63 | sigreturn() = ? (mask now []) | ||
| 64 | exit_group(0) = ? | ||
diff --git a/web/attachments/266199-check_ping-ignore-duplicates.patch b/web/attachments/266199-check_ping-ignore-duplicates.patch new file mode 100644 index 0000000..01cf036 --- /dev/null +++ b/web/attachments/266199-check_ping-ignore-duplicates.patch | |||
| @@ -0,0 +1,111 @@ | |||
| 1 | Index: Projects/Nagiosplug/trunk/plugins/check_ping.c | ||
| 2 | =================================================================== | ||
| 3 | --- Projects/Nagiosplug/trunk/plugins/check_ping.c (revision 1932) | ||
| 4 | +++ Projects/Nagiosplug/trunk/plugins/check_ping.c (working copy) | ||
| 5 | @@ -67,6 +67,7 @@ | ||
| 6 | int max_addr = 1; | ||
| 7 | int max_packets = -1; | ||
| 8 | int verbose = 0; | ||
| 9 | +int warn_on_duplicate = 1; | ||
| 10 | |||
| 11 | float rta = UNKNOWN_TRIP_TIME; | ||
| 12 | int pl = UNKNOWN_PACKET_LOSS; | ||
| 13 | @@ -192,6 +193,7 @@ | ||
| 14 | {"link", no_argument, 0, 'L'}, | ||
| 15 | {"use-ipv4", no_argument, 0, '4'}, | ||
| 16 | {"use-ipv6", no_argument, 0, '6'}, | ||
| 17 | + {"ignore-duplicates", no_argument, 0, "d"}, | ||
| 18 | {0, 0, 0, 0} | ||
| 19 | }; | ||
| 20 | |||
| 21 | @@ -206,7 +208,7 @@ | ||
| 22 | } | ||
| 23 | |||
| 24 | while (1) { | ||
| 25 | - c = getopt_long (argc, argv, "VvhnL46t:c:w:H:p:", longopts, &option); | ||
| 26 | + c = getopt_long (argc, argv, "VvhnL46t:c:d:w:H:p:", longopts, &option); | ||
| 27 | |||
| 28 | if (c == -1 || c == EOF) | ||
| 29 | break; | ||
| 30 | @@ -275,6 +277,9 @@ | ||
| 31 | case 'w': | ||
| 32 | get_threshold (optarg, &wrta, &wpl); | ||
| 33 | break; | ||
| 34 | + case 'd': | ||
| 35 | + warn_on_duplicate = 0; | ||
| 36 | + break; | ||
| 37 | } | ||
| 38 | } | ||
| 39 | |||
| 40 | @@ -527,12 +532,14 @@ | ||
| 41 | die (STATE_CRITICAL, _("CRITICAL - Time to live exceeded (%s)"), addr); | ||
| 42 | |||
| 43 | if (strstr (buf, "(DUP!)") || strstr (buf, "DUPLICATES FOUND")) { | ||
| 44 | - if (warn_text == NULL) | ||
| 45 | - warn_text = strdup (_(WARN_DUPLICATES)); | ||
| 46 | - else if (! strstr (warn_text, _(WARN_DUPLICATES)) && | ||
| 47 | - asprintf (&warn_text, "%s %s", warn_text, _(WARN_DUPLICATES)) == -1) | ||
| 48 | - die (STATE_UNKNOWN, _("Unable to realloc warn_text")); | ||
| 49 | - return (STATE_WARNING); | ||
| 50 | + if (warn_on_duplicate) { | ||
| 51 | + if (warn_text == NULL) | ||
| 52 | + warn_text = strdup (_(WARN_DUPLICATES)); | ||
| 53 | + else if (! strstr (warn_text, _(WARN_DUPLICATES)) && | ||
| 54 | + asprintf (&warn_text, "%s %s", warn_text, _(WARN_DUPLICATES)) == -1) | ||
| 55 | + die (STATE_UNKNOWN, _("Unable to realloc warn_text")); | ||
| 56 | + return (STATE_WARNING); | ||
| 57 | + } | ||
| 58 | } | ||
| 59 | |||
| 60 | return (STATE_OK); | ||
| 61 | @@ -559,31 +566,33 @@ | ||
| 62 | printf (_(UT_IPv46)); | ||
| 63 | |||
| 64 | printf (" %s\n", "-H, --hostname=HOST"); | ||
| 65 | - printf (" %s\n", _("host to ping")); | ||
| 66 | - printf (" %s\n", "-w, --warning=THRESHOLD"); | ||
| 67 | - printf (" %s\n", _("warning threshold pair")); | ||
| 68 | - printf (" %s\n", "-c, --critical=THRESHOLD"); | ||
| 69 | - printf (" %s\n", _("critical threshold pair")); | ||
| 70 | - printf (" %s\n", "-p, --packets=INTEGER"); | ||
| 71 | - printf (" %s ", _("number of ICMP ECHO packets to send")); | ||
| 72 | - printf (_("(Default: %d)\n"), DEFAULT_MAX_PACKETS); | ||
| 73 | - printf (" %s\n", "-L, --link"); | ||
| 74 | - printf (" %s\n", _("show HTML in the plugin output (obsoleted by urlize)")); | ||
| 75 | + printf (" %s\n", _("host to ping")); | ||
| 76 | + printf (" %s\n", "-w, --warning=THRESHOLD"); | ||
| 77 | + printf (" %s\n", _("warning threshold pair")); | ||
| 78 | + printf (" %s\n", "-c, --critical=THRESHOLD"); | ||
| 79 | + printf (" %s\n", _("critical threshold pair")); | ||
| 80 | + printf (" %s\n", "-p, --packets=INTEGER"); | ||
| 81 | + printf (" %s ", _("number of ICMP ECHO packets to send")); | ||
| 82 | + printf (_("(Default: %d)\n"), DEFAULT_MAX_PACKETS); | ||
| 83 | + printf (" %s\n", "-L, --link"); | ||
| 84 | + printf (" %s\n", _("show HTML in the plugin output (obsoleted by urlize)")); | ||
| 85 | + printf (" %s\n", "-d, --ignore-duplicates"); | ||
| 86 | + printf (" %s\n", _("don't warn on duplicate responses")); | ||
| 87 | |||
| 88 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
| 89 | |||
| 90 | printf ("%s\n", _("THRESHOLD is <rta>,<pl>% where <rta> is the round trip average travel")); | ||
| 91 | - printf ("%s\n", _("time (ms) which triggers a WARNING or CRITICAL state, and <pl> is the")); | ||
| 92 | - printf ("%s\n", _("percentage of packet loss to trigger an alarm state.")); | ||
| 93 | + printf ("%s\n", _("time (ms) which triggers a WARNING or CRITICAL state, and <pl> is the")); | ||
| 94 | + printf ("%s\n", _("percentage of packet loss to trigger an alarm state.")); | ||
| 95 | |||
| 96 | - printf ("\n\n"); | ||
| 97 | + printf ("\n\n"); | ||
| 98 | |||
| 99 | printf ("%s\n", _("This plugin uses the ping command to probe the specified host for packet loss")); | ||
| 100 | - printf ("%s\n", _("(percentage) and round trip average (milliseconds). It can produce HTML output")); | ||
| 101 | - printf ("%s\n", _("linking to a traceroute CGI contributed by Ian Cass. The CGI can be found in")); | ||
| 102 | - printf ("%s\n", _("the contrib area of the downloads section at http://www.nagios.org/")); | ||
| 103 | + printf ("%s\n", _("(percentage) and round trip average (milliseconds). It can produce HTML output")); | ||
| 104 | + printf ("%s\n", _("linking to a traceroute CGI contributed by Ian Cass. The CGI can be found in")); | ||
| 105 | + printf ("%s\n", _("the contrib area of the downloads section at http://www.nagios.org/")); | ||
| 106 | |||
| 107 | - printf ("\n\n"); | ||
| 108 | + printf ("\n\n"); | ||
| 109 | |||
| 110 | printf (_(UT_SUPPORT)); | ||
| 111 | } | ||
diff --git a/web/attachments/266362-check_ssh-clean-shutdown.patch b/web/attachments/266362-check_ssh-clean-shutdown.patch new file mode 100644 index 0000000..c035101 --- /dev/null +++ b/web/attachments/266362-check_ssh-clean-shutdown.patch | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | *** check_ssh.c 2008-02-14 12:19:32.000000000 -0800 | ||
| 2 | --- check_cch.c 2007-11-09 05:08:43.000000000 -0800 | ||
| 3 | *************** | ||
| 4 | *** 260,266 **** | ||
| 5 | printf | ||
| 6 | (_("SSH OK - %s (protocol %s)\n"), | ||
| 7 | ssh_server, ssh_proto); | ||
| 8 | - shutdown(sd, SHUT_RDWR); | ||
| 9 | close(sd); | ||
| 10 | exit (STATE_OK); | ||
| 11 | } | ||
| 12 | --- 260,265 ---- | ||
diff --git a/web/attachments/266460-check_http.head.patch b/web/attachments/266460-check_http.head.patch new file mode 100644 index 0000000..0b6539c --- /dev/null +++ b/web/attachments/266460-check_http.head.patch | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | 95a96 | ||
| 2 | > int use_head = FALSE; | ||
| 3 | 179c208,209 | ||
| 4 | < INVERT_REGEX = CHAR_MAX + 1 | ||
| 5 | --- | ||
| 6 | > INVERT_REGEX = CHAR_MAX + 1, | ||
| 7 | > USE_HEAD = CHAR_MAX + 2 | ||
| 8 | 209a240 | ||
| 9 | > {"head", no_argument, 0, USE_HEAD}, | ||
| 10 | 341a373,375 | ||
| 11 | > case USE_HEAD: | ||
| 12 | > use_head = 1; | ||
| 13 | > break; | ||
| 14 | 455a490,497 | ||
| 15 | > | ||
| 16 | > if (use_head == 1 ) | ||
| 17 | > if ( strcmp(http_method, "POST") == 0) { | ||
| 18 | > usage4 (_("Using POST data and HEAD requests is not supported")); | ||
| 19 | > } else { | ||
| 20 | > no_body = TRUE; | ||
| 21 | > http_method = strdup("HEAD"); | ||
| 22 | > } | ||
| 23 | 1292a1335,1337 | ||
| 24 | > printf (" %s\n", "--head"); | ||
| 25 | > printf (" %s\n", _("make a HEAD request instead of GET")); | ||
| 26 | > printf (" %s\n", _("this implies -N\n")); | ||
| 27 | 1341c1386 | ||
| 28 | < printf (" [-k string] [-S] [-C <age>] [-T <content-type>]\n"); | ||
| 29 | --- | ||
| 30 | > printf (" [-k string] [-S] [-C <age>] [-T <content-type>] [--head]\n"); | ||
diff --git a/web/attachments/266466-check_http.extented_status_codes.patch b/web/attachments/266466-check_http.extented_status_codes.patch new file mode 100644 index 0000000..47ff717 --- /dev/null +++ b/web/attachments/266466-check_http.extented_status_codes.patch | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | 169c170,198 | ||
| 2 | < | ||
| 3 | --- | ||
| 4 | > | ||
| 5 | > /* checks if status code statcode is in server reply reply */ | ||
| 6 | > int | ||
| 7 | > check_statuscode (char * reply, char * statcode) | ||
| 8 | > { | ||
| 9 | > int status = 0; | ||
| 10 | > char scode[4] = "201"; | ||
| 11 | > int ipos = 0; | ||
| 12 | > char *kpos = strchr(statcode, ','); | ||
| 13 | > | ||
| 14 | > while (kpos) | ||
| 15 | > { | ||
| 16 | > memcpy(scode, &statcode[ipos], 3); | ||
| 17 | > ipos += 4; | ||
| 18 | > kpos = strchr(&statcode[ipos], ','); | ||
| 19 | > | ||
| 20 | > if (strstr(reply, scode)) | ||
| 21 | > { | ||
| 22 | > status = 1; | ||
| 23 | > } | ||
| 24 | > } | ||
| 25 | > | ||
| 26 | > memcpy(scode, &statcode[ipos], 3); | ||
| 27 | > if (strstr(reply, scode)) | ||
| 28 | > { | ||
| 29 | > status = 1; | ||
| 30 | > } | ||
| 31 | > return status; | ||
| 32 | > } | ||
| 33 | 871c913 | ||
| 34 | < if (!strstr (status_line, server_expect)) { | ||
| 35 | --- | ||
| 36 | > if (!check_statuscode(status_line, server_expect)) { | ||
| 37 | 874c916 | ||
| 38 | < _("Invalid HTTP response received from host\n")); | ||
| 39 | --- | ||
| 40 | > _("Invalid HTTP response received from host \"%s\"\n"), status_line); | ||
| 41 | 877,878c919,920 | ||
| 42 | < _("Invalid HTTP response received from host on port %d\n"), | ||
| 43 | < server_port); | ||
| 44 | --- | ||
| 45 | > _("Invalid HTTP response received from host on port %d \"%s\"\n"), | ||
| 46 | > server_port, status_line); | ||
diff --git a/web/attachments/26654-snmpv3.dif b/web/attachments/26654-snmpv3.dif new file mode 100644 index 0000000..d4d9ecb --- /dev/null +++ b/web/attachments/26654-snmpv3.dif | |||
| @@ -0,0 +1,167 @@ | |||
| 1 | --- plugins/check_snmp.c.orig Thu Feb 28 07:42:59 2002 | ||
| 2 | +++ plugins/check_snmp.c Tue Jul 9 11:48:10 2002 | ||
| 3 | @@ -97,6 +97,12 @@ | ||
| 4 | char oid[MAX_INPUT_BUFFER] = ""; | ||
| 5 | char *label = NULL; | ||
| 6 | char *units = NULL; | ||
| 7 | +char *secname = NULL; | ||
| 8 | +char *seclevel = NULL; | ||
| 9 | +char *authproto = NULL; | ||
| 10 | +char *authpasswd = NULL; | ||
| 11 | +char *privpasswd = NULL; | ||
| 12 | +int proto = 1; | ||
| 13 | char string_value[MAX_INPUT_BUFFER] = ""; | ||
| 14 | char **labels = NULL; | ||
| 15 | char **unitv = NULL; | ||
| 16 | @@ -143,10 +149,35 @@ | ||
| 17 | usage ("Incorrect arguments supplied\n"); | ||
| 18 | |||
| 19 | /* create the command line to execute */ | ||
| 20 | - command_line = ssprintf | ||
| 21 | + if (proto == 3) { | ||
| 22 | + if ( strcmp(seclevel, "noAuthNoPriv") == 0 ) { | ||
| 23 | + command_line = ssprintf | ||
| 24 | + (command_line, | ||
| 25 | + "%s -m ALL -v 3 -l noAuthNoPriv %s %s", | ||
| 26 | + PATH_TO_SNMPGET, server_address, oid); | ||
| 27 | + } | ||
| 28 | + if ( strcmp(seclevel, "authNoPriv") == 0 ) { | ||
| 29 | + command_line = ssprintf | ||
| 30 | + (command_line, | ||
| 31 | + "%s -m ALL -v 3 -l authNoPriv -a %s -u %s -A %s %s %s", | ||
| 32 | + PATH_TO_SNMPGET, authproto, secname, authpasswd, | ||
| 33 | + server_address, oid); | ||
| 34 | + } | ||
| 35 | + if ( strcmp(seclevel, "authPriv") == 0 ) { | ||
| 36 | + command_line = ssprintf | ||
| 37 | + (command_line, | ||
| 38 | + "%s -m ALL -v 3 -l authPriv -a %s -u %s -A %s -X %s %s %s", | ||
| 39 | + PATH_TO_SNMPGET, authproto, secname, authpasswd, | ||
| 40 | + privpasswd, server_address, oid); | ||
| 41 | + } | ||
| 42 | + } else { | ||
| 43 | + command_line = ssprintf | ||
| 44 | (command_line, | ||
| 45 | "%s -m ALL -v 1 %s %s %s", | ||
| 46 | PATH_TO_SNMPGET, server_address, community, oid); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + | ||
| 50 | |||
| 51 | /* run the command */ | ||
| 52 | child_process = spopen (command_line); | ||
| 53 | @@ -285,7 +316,7 @@ | ||
| 54 | if (found == 0) | ||
| 55 | terminate | ||
| 56 | (STATE_UNKNOWN, | ||
| 57 | - "%s problem - No data recieved from host\nCMD: %s\n", | ||
| 58 | + "%s problem - No data received from host\nCMD: %s\n", | ||
| 59 | label, command_line); | ||
| 60 | |||
| 61 | /* WARNING if output found on stderr */ | ||
| 62 | @@ -348,6 +379,13 @@ | ||
| 63 | if (units == NULL) | ||
| 64 | units = strscpy (NULL, ""); | ||
| 65 | |||
| 66 | + if (seclevel == NULL || ( strcmp(seclevel, "authNoPriv") && | ||
| 67 | + strcmp(seclevel, "authPriv") ) ) | ||
| 68 | + seclevel = strscpy (NULL, "noAuthNoPriv"); | ||
| 69 | + | ||
| 70 | + if (authproto == NULL) | ||
| 71 | + authproto = strscpy (NULL, "MD5"); | ||
| 72 | + | ||
| 73 | return c; | ||
| 74 | } | ||
| 75 | |||
| 76 | @@ -378,6 +416,12 @@ | ||
| 77 | {"eregi", required_argument, 0, 'R'}, | ||
| 78 | {"label", required_argument, 0, 'l'}, | ||
| 79 | {"units", required_argument, 0, 'u'}, | ||
| 80 | + {"protocol", required_argument,0, 'p'}, | ||
| 81 | + {"seclevel", required_argument,0, 'L'}, | ||
| 82 | + {"authproto", required_argument,0, 'a'}, | ||
| 83 | + {"authpasswd", required_argument,0, 'A'}, | ||
| 84 | + {"privpasswd", required_argument,0, 'X'}, | ||
| 85 | + {"secname", required_argument, 0, 'U'}, | ||
| 86 | {0, 0, 0, 0} | ||
| 87 | }; | ||
| 88 | #endif | ||
| 89 | @@ -385,10 +429,10 @@ | ||
| 90 | while (1) { | ||
| 91 | #ifdef HAVE_GETOPT_H | ||
| 92 | c = | ||
| 93 | - getopt_long (argc, argv, "+?hVt:c:w:H:C:o:d:D:s:R:r:l:u:", | ||
| 94 | + getopt_long (argc, argv, "+?hVt:c:w:H:C:o:d:D:s:R:r:l:u:p:L:a:A:X:U:", | ||
| 95 | long_options, &option_index); | ||
| 96 | #else | ||
| 97 | - c = getopt (argc, argv, "+?hVt:c:w:H:C:o:d:D:s:R:r:l:u:"); | ||
| 98 | + c = getopt (argc, argv, "+?hVt:c:w:H:C:o:d:D:s:R:r:l:u:p:L:a:A:X:U:"); | ||
| 99 | #endif | ||
| 100 | |||
| 101 | if (c == -1 || c == EOF) | ||
| 102 | @@ -409,6 +453,12 @@ | ||
| 103 | case 'r': | ||
| 104 | case 'l': | ||
| 105 | case 'u': | ||
| 106 | + case 'p': | ||
| 107 | + case 'L': | ||
| 108 | + case 'a': | ||
| 109 | + case 'A': | ||
| 110 | + case 'X': | ||
| 111 | + case 'U': | ||
| 112 | i++; | ||
| 113 | } | ||
| 114 | |||
| 115 | @@ -568,6 +618,24 @@ | ||
| 116 | unitv[nunits - 1] = ptr; | ||
| 117 | } | ||
| 118 | break; | ||
| 119 | + case 'p': | ||
| 120 | + proto = atoi(optarg); | ||
| 121 | + break; | ||
| 122 | + case 'L': | ||
| 123 | + seclevel = strscpy (seclevel, optarg); | ||
| 124 | + break; | ||
| 125 | + case 'a': | ||
| 126 | + authproto = strscpy (authproto, optarg); | ||
| 127 | + break; | ||
| 128 | + case 'A': | ||
| 129 | + authpasswd = strscpy (authpasswd, optarg); | ||
| 130 | + break; | ||
| 131 | + case 'X': | ||
| 132 | + privpasswd = strscpy (privpasswd, optarg); | ||
| 133 | + break; | ||
| 134 | + case 'U': | ||
| 135 | + secname = strscpy (secname, optarg); | ||
| 136 | + break; | ||
| 137 | } | ||
| 138 | } | ||
| 139 | return i; | ||
| 140 | @@ -580,6 +648,8 @@ | ||
| 141 | ("Usage: check_snmp -H <ip_address> -o <OID> [-w warn_range] [-c crit_range] \n" | ||
| 142 | " [-C community] [-s string] [-r regex] [-R regexi] [-t timeout]\n" | ||
| 143 | " [-l label] [-u units] [-d delimiter] [-D output-delimiter]\n" | ||
| 144 | + " [-p protocol] [-L seclevel] [-a authproto] [-A authpasswd]\n" | ||
| 145 | + " [-X privpasswd] [-U secname]\n" | ||
| 146 | " check_snmp --help\n" " check_snmp --version\n"); | ||
| 147 | } | ||
| 148 | |||
| 149 | @@ -597,6 +667,18 @@ | ||
| 150 | " Print version information\n" | ||
| 151 | " -H, --hostname=HOST\n" | ||
| 152 | " Name or IP address of the device you wish to query\n" | ||
| 153 | + " -p, --protocol=[1|3]\n" | ||
| 154 | + " SNMP protocol version\n" | ||
| 155 | + " -L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]\n" | ||
| 156 | + " SNMPv3 securityLevel\n" | ||
| 157 | + " -U, --secname=USERNAME\n" | ||
| 158 | + " SNMPv3 username\n" | ||
| 159 | + " -a, --authproto=[MD5|SHA]\n" | ||
| 160 | + " SNMPv3 authproto\n" | ||
| 161 | + " -A, --authpasswd=PASSWORD\n" | ||
| 162 | + " SNMPv3 authentication password\n" | ||
| 163 | + " -X, --privpasswd=PASSWORD\n" | ||
| 164 | + " SNMPv3 crypt password (DES)\n" | ||
| 165 | " -o, --oid=OID(s)\n" | ||
| 166 | " Object identifier(s) whose value you wish to query\n" | ||
| 167 | " -w, --warning=INTEGER_RANGE(s)\n" | ||
diff --git a/web/attachments/266554-ping-sscanf.diff b/web/attachments/266554-ping-sscanf.diff new file mode 100644 index 0000000..dd16d4b --- /dev/null +++ b/web/attachments/266554-ping-sscanf.diff | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | --- plugins/check_ping.c~ | ||
| 2 | +++ plugins/check_ping.c | ||
| 3 | @@ -424,6 +424,7 @@ | ||
| 4 | { | ||
| 5 | char buf[MAX_INPUT_BUFFER]; | ||
| 6 | int result = STATE_UNKNOWN; | ||
| 7 | + int match; | ||
| 8 | |||
| 9 | if ((child_process = spopen (cmd)) == NULL) | ||
| 10 | die (STATE_UNKNOWN, _("Could not open pipe: %s\n"), cmd); | ||
| 11 | @@ -440,28 +441,29 @@ | ||
| 12 | result = max_state (result, error_scan (buf, addr)); | ||
| 13 | |||
| 14 | /* get the percent loss statistics */ | ||
| 15 | - if(sscanf(buf,"%*d packets transmitted, %*d packets received, +%*d errors, %d%% packet loss",&pl)==1 || | ||
| 16 | - sscanf(buf,"%*d packets transmitted, %*d packets received, +%*d duplicates, %d%% packet loss", &pl) == 1 || | ||
| 17 | - sscanf(buf,"%*d packets transmitted, %*d received, +%*d duplicates, %d%% packet loss", &pl) == 1 || | ||
| 18 | - sscanf(buf,"%*d packets transmitted, %*d packets received, %d%% packet loss",&pl)==1 || | ||
| 19 | - sscanf(buf,"%*d packets transmitted, %*d packets received, %d%% loss, time",&pl)==1 || | ||
| 20 | - sscanf(buf,"%*d packets transmitted, %*d received, %d%% loss, time", &pl)==1 || | ||
| 21 | - sscanf(buf,"%*d packets transmitted, %*d received, %d%% packet loss, time", &pl)==1 || | ||
| 22 | - sscanf(buf,"%*d packets transmitted, %*d received, +%*d errors, %d%% packet loss", &pl) == 1 || | ||
| 23 | - sscanf(buf,"%*d packets transmitted %*d received, +%*d errors, %d%% packet loss", &pl) == 1 | ||
| 24 | + match = 0; | ||
| 25 | + if((sscanf(buf,"%*d packets transmitted, %*d packets received, +%*d errors, %d%% packet loss%n",&pl,&match) && match) || | ||
| 26 | + (sscanf(buf,"%*d packets transmitted, %*d packets received, +%*d duplicates, %d%% packet loss%n",&pl,&match) && match) || | ||
| 27 | + (sscanf(buf,"%*d packets transmitted, %*d received, +%*d duplicates, %d%% packet loss%n",&pl,&match) && match) || | ||
| 28 | + (sscanf(buf,"%*d packets transmitted, %*d packets received, %d%% packet loss%n",&pl,&match) && match) || | ||
| 29 | + (sscanf(buf,"%*d packets transmitted, %*d packets received, %d%% loss, time%n",&pl,&match) && match) || | ||
| 30 | + (sscanf(buf,"%*d packets transmitted, %*d received, %d%% loss, time%n",&pl,&match) && match) || | ||
| 31 | + (sscanf(buf,"%*d packets transmitted, %*d received, %d%% packet loss, time%n",&pl,&match) && match) || | ||
| 32 | + (sscanf(buf,"%*d packets transmitted, %*d received, +%*d errors, %d%% packet loss%n",&pl,&match) && match) || | ||
| 33 | + (sscanf(buf,"%*d packets transmitted %*d received, +%*d errors, %d%% packet loss%n",&pl,&match) && match) | ||
| 34 | ) | ||
| 35 | continue; | ||
| 36 | |||
| 37 | /* get the round trip average */ | ||
| 38 | else | ||
| 39 | - if(sscanf(buf,"round-trip min/avg/max = %*f/%f/%*f",&rta)==1 || | ||
| 40 | - sscanf(buf,"round-trip min/avg/max/mdev = %*f/%f/%*f/%*f",&rta)==1 || | ||
| 41 | - sscanf(buf,"round-trip min/avg/max/sdev = %*f/%f/%*f/%*f",&rta)==1 || | ||
| 42 | - sscanf(buf,"round-trip min/avg/max/stddev = %*f/%f/%*f/%*f",&rta)==1 || | ||
| 43 | - sscanf(buf,"round-trip min/avg/max/std-dev = %*f/%f/%*f/%*f",&rta)==1 || | ||
| 44 | - sscanf(buf,"round-trip (ms) min/avg/max = %*f/%f/%*f",&rta)==1 || | ||
| 45 | - sscanf(buf,"round-trip (ms) min/avg/max/stddev = %*f/%f/%*f/%*f",&rta)==1 || | ||
| 46 | - sscanf(buf,"rtt min/avg/max/mdev = %*f/%f/%*f/%*f ms",&rta)==1) | ||
| 47 | + if((sscanf(buf,"round-trip min/avg/max = %*f/%f/%*f%n",&rta,&match) && match) || | ||
| 48 | + (sscanf(buf,"round-trip min/avg/max/mdev = %*f/%f/%*f/%*f%n",&rta,&match) && match) || | ||
| 49 | + (sscanf(buf,"round-trip min/avg/max/sdev = %*f/%f/%*f/%*f%n",&rta,&match) && match) || | ||
| 50 | + (sscanf(buf,"round-trip min/avg/max/stddev = %*f/%f/%*f/%*f%n",&rta,&match) && match) || | ||
| 51 | + (sscanf(buf,"round-trip min/avg/max/std-dev = %*f/%f/%*f/%*f%n",&rta,&match) && match) || | ||
| 52 | + (sscanf(buf,"round-trip (ms) min/avg/max = %*f/%f/%*f%n",&rta,&match) && match) || | ||
| 53 | + (sscanf(buf,"round-trip (ms) min/avg/max/stddev = %*f/%f/%*f/%*f%n",&rta,&match) && match) || | ||
| 54 | + (sscanf(buf,"rtt min/avg/max/mdev = %*f/%f/%*f/%*f ms%n",&rta,&match) && match)) | ||
| 55 | continue; | ||
| 56 | } | ||
| 57 | |||
diff --git a/web/attachments/267584-nagios-plugins-1.4.8-checksshproto.patch b/web/attachments/267584-nagios-plugins-1.4.8-checksshproto.patch new file mode 100644 index 0000000..6ae62c5 --- /dev/null +++ b/web/attachments/267584-nagios-plugins-1.4.8-checksshproto.patch | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | --- nagios-plugins-1.4.8/plugins/check_ssh.c.orig 2008-01-07 16:18:34.000000000 -0800 | ||
| 2 | +++ nagios-plugins-1.4.8/plugins/check_ssh.c 2008-02-22 10:23:37.000000000 -0800 | ||
| 3 | @@ -54,6 +54,7 @@ | ||
| 4 | int port = -1; | ||
| 5 | char *server_name = NULL; | ||
| 6 | char *remote_version = NULL; | ||
| 7 | +char *remote_protocol = NULL; | ||
| 8 | int verbose = FALSE; | ||
| 9 | |||
| 10 | int process_arguments (int, char **); | ||
| 11 | @@ -61,7 +62,7 @@ | ||
| 12 | void print_help (void); | ||
| 13 | void print_usage (void); | ||
| 14 | |||
| 15 | -int ssh_connect (char *haddr, int hport, char *remote_version); | ||
| 16 | +int ssh_connect (char *haddr, int hport, char *remote_version, char *remote_protocol); | ||
| 17 | |||
| 18 | |||
| 19 | |||
| 20 | @@ -83,7 +84,7 @@ | ||
| 21 | alarm (socket_timeout); | ||
| 22 | |||
| 23 | /* ssh_connect exits if error is found */ | ||
| 24 | - result = ssh_connect (server_name, port, remote_version); | ||
| 25 | + result = ssh_connect (server_name, port, remote_version, remote_protocol); | ||
| 26 | |||
| 27 | alarm (0); | ||
| 28 | |||
| 29 | @@ -110,6 +111,7 @@ | ||
| 30 | {"timeout", required_argument, 0, 't'}, | ||
| 31 | {"verbose", no_argument, 0, 'v'}, | ||
| 32 | {"remote-version", required_argument, 0, 'r'}, | ||
| 33 | + {"remote-protcol", required_argument, 0, 'P'}, | ||
| 34 | {0, 0, 0, 0} | ||
| 35 | }; | ||
| 36 | |||
| 37 | @@ -121,7 +123,7 @@ | ||
| 38 | strcpy (argv[c], "-t"); | ||
| 39 | |||
| 40 | while (1) { | ||
| 41 | - c = getopt_long (argc, argv, "+Vhv46t:r:H:p:", longopts, &option); | ||
| 42 | + c = getopt_long (argc, argv, "+Vhv46t:r:H:p:P:", longopts, &option); | ||
| 43 | |||
| 44 | if (c == -1 || c == EOF) | ||
| 45 | break; | ||
| 46 | @@ -157,6 +159,9 @@ | ||
| 47 | case 'r': /* remote version */ | ||
| 48 | remote_version = optarg; | ||
| 49 | break; | ||
| 50 | + case 'P': /* remote version */ | ||
| 51 | + remote_protocol = optarg; | ||
| 52 | + break; | ||
| 53 | case 'H': /* host */ | ||
| 54 | if (is_host (optarg) == FALSE) | ||
| 55 | usage2 (_("Invalid hostname/address"), optarg); | ||
| 56 | @@ -211,7 +216,7 @@ | ||
| 57 | |||
| 58 | |||
| 59 | int | ||
| 60 | -ssh_connect (char *haddr, int hport, char *remote_version) | ||
| 61 | +ssh_connect (char *haddr, int hport, char *remote_version, char *remote_protocol) | ||
| 62 | { | ||
| 63 | int sd; | ||
| 64 | int result; | ||
| 65 | @@ -254,6 +259,13 @@ | ||
| 66 | ssh_server, ssh_proto, remote_version); | ||
| 67 | exit (STATE_WARNING); | ||
| 68 | } | ||
| 69 | + | ||
| 70 | + if (remote_protocol && strcmp(remote_protocol, ssh_proto)) { | ||
| 71 | + printf | ||
| 72 | + (_("SSH WARNING - %s (protocol %s) protocol version mismatch, expected '%s'\n"), | ||
| 73 | + ssh_server, ssh_proto, remote_protocol); | ||
| 74 | + exit (STATE_WARNING); | ||
| 75 | + } | ||
| 76 | |||
| 77 | printf | ||
| 78 | (_("SSH OK - %s (protocol %s)\n"), | ||
| 79 | @@ -293,6 +305,9 @@ | ||
| 80 | printf (" %s\n", "-r, --remote-version=STRING"); | ||
| 81 | printf (" %s\n", _("Warn if string doesn't match expected server version (ex: OpenSSH_3.9p1)")); | ||
| 82 | |||
| 83 | + printf (" %s\n", "-P, --remote-protocol=STRING"); | ||
| 84 | + printf (" %s\n", _("Warn if protocol doesn't match expected protocol version (ex: 2.0)")); | ||
| 85 | + | ||
| 86 | printf (_(UT_VERBOSE)); | ||
| 87 | |||
| 88 | printf (_(UT_SUPPORT)); | ||
diff --git a/web/attachments/267864-patch.check_mysql.c b/web/attachments/267864-patch.check_mysql.c new file mode 100644 index 0000000..59ef214 --- /dev/null +++ b/web/attachments/267864-patch.check_mysql.c | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | 54a55 | ||
| 2 | > char *defaults_file = NULL; | ||
| 3 | 89a91,94 | ||
| 4 | > if (defaults_file != NULL) { | ||
| 5 | > mysql_options(&mysql,MYSQL_READ_DEFAULT_FILE,defaults_file); | ||
| 6 | > } | ||
| 7 | > | ||
| 8 | 249a255 | ||
| 9 | > {"defaults-file", required_argument, 0, 'f'}, | ||
| 10 | 263c269 | ||
| 11 | < c = getopt_long (argc, argv, "hvVSP:p:u:d:H:c:w:", longopts, &option); | ||
| 12 | --- | ||
| 13 | > c = getopt_long (argc, argv, "hvVSP:p:u:d:f:H:c:w:", longopts, &option); | ||
| 14 | 288a295,297 | ||
| 15 | > case 'f': | ||
| 16 | > defaults_file = optarg; | ||
| 17 | > break; | ||
| 18 | 332a342,343 | ||
| 19 | > else if (defaults_file == NULL) | ||
| 20 | > defaults_file = argv[c++]; | ||
| 21 | 355a367 | ||
| 22 | > | ||
| 23 | 387a400,401 | ||
| 24 | > printf (" %s\n", "-f, --defaults-file=FILE"); | ||
| 25 | > printf (" %s\n", _("Read mysql options from FILE")); | ||
| 26 | 405c419 | ||
| 27 | < printf ("%s [-d database] [-H host] [-P port] [-u user] [-p password] [-S]\n",progname); | ||
| 28 | --- | ||
| 29 | > printf ("%s [-d database] [-H host] [-P port] [-u user] [-p password] [-f defaultsfile] [-S]\n",progname); | ||
diff --git a/web/attachments/268243-patch.check_ping.c b/web/attachments/268243-patch.check_ping.c new file mode 100644 index 0000000..a9dff19 --- /dev/null +++ b/web/attachments/268243-patch.check_ping.c | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | 88a89,90 | ||
| 2 | > char *perf; | ||
| 3 | > char *perf1; | ||
| 4 | 161,162c163,171 | ||
| 5 | < printf (_("PING %s - %sPacket loss = %d%%"), state_text (this_result), warn_text, | ||
| 6 | < pl); | ||
| 7 | --- | ||
| 8 | > { | ||
| 9 | > asprintf(&perf, "%s", perfdata("packet_loss", pl, "%", | ||
| 10 | > TRUE, wpl, | ||
| 11 | > TRUE, cpl, | ||
| 12 | > TRUE, 0, | ||
| 13 | > FALSE, 0)); | ||
| 14 | > printf (_("PING %s - %sPacket loss = %d%% |%s\n"), state_text (this_result), warn_text, | ||
| 15 | > pl, perf); | ||
| 16 | > } | ||
| 17 | 164,165c173,186 | ||
| 18 | < printf (_("PING %s - %sPacket loss = %d%%, RTA = %2.2f ms"), | ||
| 19 | < state_text (this_result), warn_text, pl, rta); | ||
| 20 | --- | ||
| 21 | > { | ||
| 22 | > asprintf(&perf, "%s", perfdata("packet_loss", pl, "%", | ||
| 23 | > TRUE, wpl, | ||
| 24 | > TRUE, cpl, | ||
| 25 | > TRUE, 0, | ||
| 26 | > FALSE, 0)); | ||
| 27 | > asprintf(&perf1, "%s", perfdata("RTA", rta, "ms", | ||
| 28 | > TRUE, wrta, | ||
| 29 | > TRUE, crta, | ||
| 30 | > TRUE, 0, | ||
| 31 | > FALSE, 0)); | ||
| 32 | > printf (_("PING %s - %sPacket loss = %d%%, RTA = %2.2f ms | %s %s\n"), | ||
| 33 | > state_text (this_result), warn_text, pl, rta, perf1, perf); | ||
| 34 | > } | ||
| 35 | |||
diff --git a/web/attachments/268504-patch.diff b/web/attachments/268504-patch.diff new file mode 100644 index 0000000..83cc70a --- /dev/null +++ b/web/attachments/268504-patch.diff | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | 555c555 | ||
| 2 | < asprintf (&send_buffer,"NRMH:Server_Health_Status\r\n"); | ||
| 3 | --- | ||
| 4 | > asprintf (&send_buffer,"NRMH\r\n"); | ||
| 5 | 563c563 | ||
| 6 | < result=STATE_CRITICAL; | ||
| 7 | --- | ||
| 8 | > result=STATE_OK; | ||
| 9 | 566c566,567 | ||
| 10 | < else if (nrm_health_status==1) { | ||
| 11 | --- | ||
| 12 | > else { | ||
| 13 | > if (nrm_health_status==1) { | ||
| 14 | 569,571c570,571 | ||
| 15 | < } | ||
| 16 | < else { | ||
| 17 | < result=STATE_OK; | ||
| 18 | --- | ||
| 19 | > } | ||
| 20 | > | ||
| 21 | 573c573 | ||
| 22 | < } | ||
| 23 | --- | ||
| 24 | > } | ||
| 25 | 1679c1679 | ||
| 26 | < printf (" %s\n", _(" TCB, LRUS and LRUM.\n")); | ||
| 27 | --- | ||
| 28 | > printf (" %S\n", _(" TCB, LRUS and LRUM.\n")); | ||
diff --git a/web/attachments/268575-patch.check_mysql.c b/web/attachments/268575-patch.check_mysql.c new file mode 100644 index 0000000..cbcc110 --- /dev/null +++ b/web/attachments/268575-patch.check_mysql.c | |||
| @@ -0,0 +1,289 @@ | |||
| 1 | 68,87d67 | ||
| 2 | < int strIndexOf(char *string1, char *string2); | ||
| 3 | < char *strSubstring(char *string1, char *string2, int StartingPos, int EndPos); | ||
| 4 | < char *GetThreadsPerfdata(char *stringtoparse); | ||
| 5 | < char *GetQuestionsPerfdata(char *stringtoparse); | ||
| 6 | < char *GetSQPerfdata(char *stringtoparse); | ||
| 7 | < char *GetOpensPerfdata(char *stringtoparse); | ||
| 8 | < char *GetFTPerfdata(char *stringtoparse); | ||
| 9 | < char *GetOTPerfdata(char *stringtoparse); | ||
| 10 | < char *GetQPSAPerfdata(char *stringtoparse); | ||
| 11 | < | ||
| 12 | < struct mysql_statistics | ||
| 13 | < { | ||
| 14 | < char *ThreadsPerfdata; | ||
| 15 | < char *QuestionsPerfdata; | ||
| 16 | < char *SQPerfdata; | ||
| 17 | < char *OpensPerfdata; | ||
| 18 | < char *FTPerfdata; | ||
| 19 | < char *OTPerfdata; | ||
| 20 | < char *QPSAPerfdata; | ||
| 21 | < }; | ||
| 22 | 102,105d81 | ||
| 23 | < | ||
| 24 | < /* variables needed to parse */ | ||
| 25 | < char *StringToParse; | ||
| 26 | < struct mysql_statistics Stats; | ||
| 27 | 138,154d113 | ||
| 28 | < /* parse the server stats */ | ||
| 29 | < strcpy(StringToParse, result); | ||
| 30 | < | ||
| 31 | < Stats.ThreadsPerfdata = GetThreadsPerfdata(StringToParse); | ||
| 32 | < strcpy(StringToParse, result); | ||
| 33 | < Stats.QuestionsPerfdata = GetQuestionsPerfdata(StringToParse); | ||
| 34 | < strcpy(StringToParse, result); | ||
| 35 | < Stats.SQPerfdata = GetSQPerfdata(StringToParse); | ||
| 36 | < strcpy(StringToParse, result); | ||
| 37 | < Stats.OpensPerfdata = GetOpensPerfdata(StringToParse); | ||
| 38 | < strcpy(StringToParse, result); | ||
| 39 | < Stats.FTPerfdata = GetFTPerfdata(StringToParse); | ||
| 40 | < strcpy(StringToParse, result); | ||
| 41 | < Stats.OTPerfdata = GetOTPerfdata(StringToParse); | ||
| 42 | < strcpy(StringToParse, result); | ||
| 43 | < Stats.QPSAPerfdata = GetQPSAPerfdata(StringToParse); | ||
| 44 | < | ||
| 45 | 270c229 | ||
| 46 | < printf ("%s %s | %s %s %s %s %s %s %s\n", result, slaveresult, Stats.ThreadsPerfdata, Stats.SQPerfdata, Stats.OpensPerfdata, Stats.FTPerfdata, Stats.OTPerfdata, Stats.QPSAPerfdata); | ||
| 47 | --- | ||
| 48 | > printf ("%s %s\n", result, slaveresult); | ||
| 49 | 272c231 | ||
| 50 | < printf ("%s | %s %s %s %s %s %s %s\n", result, Stats.ThreadsPerfdata, Stats.QuestionsPerfdata, Stats.SQPerfdata, Stats.OpensPerfdata, Stats.FTPerfdata, Stats.OTPerfdata, Stats.QPSAPerfdata); | ||
| 51 | --- | ||
| 52 | > printf ("%s\n", result); | ||
| 53 | 278,512d236 | ||
| 54 | < char | ||
| 55 | < *GetQPSAPerfdata(char *stringtoparse) | ||
| 56 | < { | ||
| 57 | < int Start = 0; | ||
| 58 | < int End = 0; | ||
| 59 | < char *qpsa; | ||
| 60 | < char *output; | ||
| 61 | < Start = strIndexOf("Queries per second avg\0", stringtoparse); | ||
| 62 | < End = strlen(stringtoparse); | ||
| 63 | < | ||
| 64 | < qpsa = strSubstring(qpsa, stringtoparse, Start, End); | ||
| 65 | < qpsa = strSubstring(qpsa, qpsa, strIndexOf(" \0", qpsa) + 1, strlen(qpsa)); | ||
| 66 | < qpsa = strSubstring(qpsa, qpsa, strIndexOf(" \0", qpsa) + 1, strlen(qpsa)); | ||
| 67 | < qpsa = strSubstring(qpsa, qpsa, strIndexOf(" \0", qpsa) + 1, strlen(qpsa)); | ||
| 68 | < qpsa = strSubstring(qpsa, qpsa, strIndexOf(" \0", qpsa) + 1, strlen(qpsa)); | ||
| 69 | < printf("%s", qpsa); | ||
| 70 | < asprintf(&output, "%s", fperfdata("queries_per_second_avg", atof(qpsa), "", | ||
| 71 | < FALSE, 0, | ||
| 72 | < FALSE, 0, | ||
| 73 | < TRUE, 0, | ||
| 74 | < FALSE, 0)); | ||
| 75 | < | ||
| 76 | < return output; | ||
| 77 | < } | ||
| 78 | < | ||
| 79 | < char | ||
| 80 | < *GetOTPerfdata(char *stringtoparse) | ||
| 81 | < { | ||
| 82 | < int Start = 0; | ||
| 83 | < int End = 0; | ||
| 84 | < char *ot; | ||
| 85 | < char *output; | ||
| 86 | < Start = strIndexOf("Open tables\0", stringtoparse); | ||
| 87 | < End = strIndexOf("Queries per second avg\0", stringtoparse); | ||
| 88 | < | ||
| 89 | < ot = strSubstring(ot, stringtoparse, Start, End - 2); | ||
| 90 | < ot = strSubstring(ot, ot, strIndexOf(" \0", ot) + 1, strlen(ot)); | ||
| 91 | < ot = strSubstring(ot, ot, strIndexOf(" \0", ot) + 1, strlen(ot)); | ||
| 92 | < asprintf(&output, "%s", perfdata("open_tables", atoi(ot), "", | ||
| 93 | < FALSE, 0, | ||
| 94 | < FALSE, 0, | ||
| 95 | < TRUE, 0, | ||
| 96 | < FALSE, 0)); | ||
| 97 | < | ||
| 98 | < return output; | ||
| 99 | < } | ||
| 100 | < | ||
| 101 | < char | ||
| 102 | < *GetFTPerfdata(char *stringtoparse) | ||
| 103 | < { | ||
| 104 | < int Start = 0; | ||
| 105 | < int End = 0; | ||
| 106 | < char *ft; | ||
| 107 | < char *output; | ||
| 108 | < Start = strIndexOf("Flush tables\0", stringtoparse); | ||
| 109 | < End = strIndexOf("Open tables\0", stringtoparse); | ||
| 110 | < | ||
| 111 | < ft = strSubstring(ft, stringtoparse, Start, End - 2); | ||
| 112 | < ft = strSubstring(ft, ft, strIndexOf(" \0", ft) + 1, strlen(ft)); | ||
| 113 | < ft = strSubstring(ft, ft, strIndexOf(" \0", ft) + 1, strlen(ft)); | ||
| 114 | < asprintf(&output, "%s", perfdata("flush_tables", atoi(ft), "", | ||
| 115 | < FALSE, 0, | ||
| 116 | < FALSE, 0, | ||
| 117 | < TRUE, 0, | ||
| 118 | < FALSE, 0)); | ||
| 119 | < | ||
| 120 | < return output; | ||
| 121 | < } | ||
| 122 | < | ||
| 123 | < char | ||
| 124 | < *GetOpensPerfdata(char *stringtoparse) | ||
| 125 | < { | ||
| 126 | < int Start = 0; | ||
| 127 | < int End = 0; | ||
| 128 | < char *opens; | ||
| 129 | < char *output; | ||
| 130 | < Start = strIndexOf("Opens\0", stringtoparse); | ||
| 131 | < End = strIndexOf("Flush tables\0", stringtoparse); | ||
| 132 | < | ||
| 133 | < opens = strSubstring(opens, stringtoparse, Start, End - 2); | ||
| 134 | < opens = strSubstring(opens, opens, strIndexOf(" \0", opens) + 1, strlen(opens)); | ||
| 135 | < asprintf(&output, "%s", perfdata("opens", atoi(opens), "", | ||
| 136 | < FALSE, 0, | ||
| 137 | < FALSE, 0, | ||
| 138 | < TRUE, 0, | ||
| 139 | < FALSE, 0)); | ||
| 140 | < | ||
| 141 | < return output; | ||
| 142 | < } | ||
| 143 | < | ||
| 144 | < char | ||
| 145 | < *GetSQPerfdata(char *stringtoparse) | ||
| 146 | < { | ||
| 147 | < int Start = 0; | ||
| 148 | < int End = 0; | ||
| 149 | < char *slowqueries; | ||
| 150 | < char *output; | ||
| 151 | < Start = strIndexOf("Slow queries\0", stringtoparse); | ||
| 152 | < End = strIndexOf("Opens\0", stringtoparse); | ||
| 153 | < | ||
| 154 | < slowqueries = strSubstring(slowqueries, stringtoparse, Start, End - 2); | ||
| 155 | < slowqueries = strSubstring(slowqueries, slowqueries, strIndexOf(" \0", slowqueries) + 1, strlen(slowqueries)); | ||
| 156 | < slowqueries = strSubstring(slowqueries, slowqueries, strIndexOf(" \0", slowqueries) + 1, strlen(slowqueries)); | ||
| 157 | < asprintf(&output, "%s", perfdata("slow_queries", atoi(slowqueries), "", | ||
| 158 | < FALSE, 0, | ||
| 159 | < FALSE, 0, | ||
| 160 | < TRUE, 0, | ||
| 161 | < FALSE, 0)); | ||
| 162 | < | ||
| 163 | < return output; | ||
| 164 | < } | ||
| 165 | < | ||
| 166 | < char | ||
| 167 | < *GetQuestionsPerfdata(char *stringtoparse) | ||
| 168 | < { | ||
| 169 | < int Start = 0; | ||
| 170 | < int End = 0; | ||
| 171 | < char *questions; | ||
| 172 | < char *output; | ||
| 173 | < Start = strIndexOf("Questions\0", stringtoparse); | ||
| 174 | < End = strIndexOf("Slow queries\0", stringtoparse); | ||
| 175 | < | ||
| 176 | < questions = strSubstring(questions, stringtoparse, Start, End - 2); | ||
| 177 | < questions = strSubstring(questions, questions, strIndexOf(" \0", questions) + 1, strlen(questions)); | ||
| 178 | < asprintf(&output, "%s", perfdata("questions", atoi(questions), "", | ||
| 179 | < FALSE, 0, | ||
| 180 | < FALSE, 0, | ||
| 181 | < TRUE, 0, | ||
| 182 | < FALSE, 0)); | ||
| 183 | < | ||
| 184 | < return output; | ||
| 185 | < } | ||
| 186 | < | ||
| 187 | < char | ||
| 188 | < *GetThreadsPerfdata(char *stringtoparse) | ||
| 189 | < { | ||
| 190 | < int Start = 0; | ||
| 191 | < int End = 0; | ||
| 192 | < char *threads; | ||
| 193 | < char *output; | ||
| 194 | < | ||
| 195 | < Start = strIndexOf("Threads\0", stringtoparse); | ||
| 196 | < End = strIndexOf("Questions\0", stringtoparse); | ||
| 197 | < | ||
| 198 | < threads = strSubstring(threads, stringtoparse, Start, End - 2); | ||
| 199 | < threads = strSubstring(threads, threads, strIndexOf(" \0", threads) + 1, strlen(threads)); | ||
| 200 | < asprintf(&output, "%s", perfdata("threads", atoi(threads), "", | ||
| 201 | < FALSE, 0, | ||
| 202 | < FALSE, 0, | ||
| 203 | < TRUE, 0, | ||
| 204 | < FALSE, 0)); | ||
| 205 | < | ||
| 206 | < return output; | ||
| 207 | < } | ||
| 208 | < | ||
| 209 | < /* takes the substring from string1 between startingpos and the startingpos plus the length, | ||
| 210 | < all is returned */ | ||
| 211 | < char | ||
| 212 | < *strSubstring(char *string1, char *string2, int StartingPos, int EndPos) | ||
| 213 | < { | ||
| 214 | < /* current position in string2 */ | ||
| 215 | < int CurPos = 0; | ||
| 216 | < /* current position in string1 */ | ||
| 217 | < int String1Pos = 0; | ||
| 218 | < char *NULLChar = "\0"; | ||
| 219 | < | ||
| 220 | < for (CurPos = StartingPos; CurPos < EndPos; CurPos++) | ||
| 221 | < { | ||
| 222 | < string1[String1Pos] = string2[CurPos]; | ||
| 223 | < String1Pos++; | ||
| 224 | < } | ||
| 225 | < | ||
| 226 | < string1[String1Pos] = *NULLChar; | ||
| 227 | < | ||
| 228 | < return string1; | ||
| 229 | < } | ||
| 230 | < | ||
| 231 | < /* gets the starting position of string1 in string2, | ||
| 232 | < if string1 is not contained in string2 then the function returns -1 */ | ||
| 233 | < int | ||
| 234 | < strIndexOf (char *string1, char *string2) | ||
| 235 | < { | ||
| 236 | < /* current position in string2 */ | ||
| 237 | < int CurPos = 0; | ||
| 238 | < /* the amount of matches found after the startingposition was found */ | ||
| 239 | < int CharsFound = 0; | ||
| 240 | < /* the starting position of string1 in string2 */ | ||
| 241 | < int StartingPos = -1; | ||
| 242 | < /* length of string1 */ | ||
| 243 | < int Length1 = strlen(string1); | ||
| 244 | < /* Length of string2 */ | ||
| 245 | < int Length2 = strlen(string2); | ||
| 246 | < /* the maximum length of the search */ | ||
| 247 | < int MaxLength = 0; | ||
| 248 | < | ||
| 249 | < /* check if string2 is longer the string1, if not tell the program that something went wrong */ | ||
| 250 | < if (Length2 < Length1) | ||
| 251 | < { | ||
| 252 | < return -2; | ||
| 253 | < } | ||
| 254 | < | ||
| 255 | < /* calculate the max length of the search */ | ||
| 256 | < MaxLength = Length2; | ||
| 257 | < | ||
| 258 | < for (CurPos = 0; CurPos != MaxLength; CurPos++) | ||
| 259 | < { | ||
| 260 | < if (CharsFound == Length1) | ||
| 261 | < { | ||
| 262 | < return StartingPos; | ||
| 263 | < } | ||
| 264 | < | ||
| 265 | < if (StartingPos == -1) | ||
| 266 | < { | ||
| 267 | < if (string2[CurPos] == string1[CharsFound]) | ||
| 268 | < { | ||
| 269 | < StartingPos = CurPos; | ||
| 270 | < CharsFound++; | ||
| 271 | < } | ||
| 272 | < } | ||
| 273 | < else | ||
| 274 | < { | ||
| 275 | < if (string2[CurPos] == string1[CharsFound]) | ||
| 276 | < { | ||
| 277 | < CharsFound++; | ||
| 278 | < } | ||
| 279 | < else | ||
| 280 | < { | ||
| 281 | < CharsFound = 0; | ||
| 282 | < StartingPos = -1; | ||
| 283 | < } | ||
| 284 | < } | ||
| 285 | < } | ||
| 286 | < | ||
| 287 | < return -1; | ||
| 288 | < } | ||
| 289 | |||
diff --git a/web/attachments/268583-check_apache.pl.diff b/web/attachments/268583-check_apache.pl.diff new file mode 100644 index 0000000..f90513b --- /dev/null +++ b/web/attachments/268583-check_apache.pl.diff | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | 156,157c156,157 | ||
| 2 | < if (/^BusyServers:\s+([0-9.]+)\s+/) { $busy = $1; next; } | ||
| 3 | < if (/^IdleServers:\s+([0-9.]+)\s+/) { $idle = $1; next; } | ||
| 4 | --- | ||
| 5 | > if (/^BusyWorkers:\s+([0-9.]+)\s+/) { $busy = $1; next; } | ||
| 6 | > if (/^IdleWorkers:\s+([0-9.]+)\s+/) { $idle = $1; next; } | ||
| 7 | 219c219 | ||
| 8 | < if($average>0) { | ||
| 9 | --- | ||
| 10 | > if($average>=0) { | ||
diff --git a/web/attachments/268643-check_apt.c.patch b/web/attachments/268643-check_apt.c.patch new file mode 100644 index 0000000..e5893dc --- /dev/null +++ b/web/attachments/268643-check_apt.c.patch | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | --- plugins/check_apt.c 2008-02-29 13:00:36.000000000 -0800 | ||
| 2 | +++ plugins/check_apt.new.c 2008-02-29 13:00:07.000000000 -0800 | ||
| 3 | @@ -57,7 +57,7 @@ | ||
| 4 | # define PATH_TO_APTGET "/usr/bin/apt-get" | ||
| 5 | #endif /* PATH_TO_APTGET */ | ||
| 6 | /* the RE that catches security updates */ | ||
| 7 | -#define SECURITY_RE "^[^\\(]*\\(.*[ ,](Debian-Security:|Ubuntu:[^/]*/[^-]*-security)" | ||
| 8 | +#define SECURITY_RE "^[^\\(]*\\([^ ]* (Debian-Security:|Ubuntu:[^/]*/[^-]*-security)" | ||
| 9 | |||
| 10 | /* some standard functions */ | ||
| 11 | int process_arguments(int, char **); | ||
| 12 | @@ -354,13 +354,13 @@ | ||
| 13 | if(expr==NULL){ | ||
| 14 | re=malloc(sizeof(char)*(strlen("^Inst () ")+strlen(next)+1)); | ||
| 15 | if(!re) die(STATE_UNKNOWN, "malloc failed!\n"); | ||
| 16 | - sprintf(re, "^Inst (%s) ", next); | ||
| 17 | + sprintf(re, "^Inst (%s)", next); | ||
| 18 | } else { | ||
| 19 | /* resize it, adding an extra char for the new '|' separator */ | ||
| 20 | re=realloc(expr, sizeof(char)*strlen(expr)+1+strlen(next)+1); | ||
| 21 | if(!re) die(STATE_UNKNOWN, "realloc failed!\n"); | ||
| 22 | /* append it starting at ')' in the old re */ | ||
| 23 | - sprintf((char*)(re+strlen(re)-2), "|%s) ", next); | ||
| 24 | + sprintf((char*)(re+strlen(re)-2), "|%s)", next); | ||
| 25 | } | ||
| 26 | |||
| 27 | return re; | ||
diff --git a/web/attachments/26866-check_disk.noerr-exclude.patch b/web/attachments/26866-check_disk.noerr-exclude.patch new file mode 100644 index 0000000..4f12559 --- /dev/null +++ b/web/attachments/26866-check_disk.noerr-exclude.patch | |||
| @@ -0,0 +1,130 @@ | |||
| 1 | 10c10 | ||
| 2 | < * $Id: check_disk.c,v 1.3 2002/06/19 03:09:10 sghosh Exp $ | ||
| 3 | --- | ||
| 4 | > * $Id: check_disk.c,v 1.2 2002/06/06 04:15:49 sghosh Exp $ | ||
| 5 | 53d52 | ||
| 6 | < char *exclude_device = NULL; | ||
| 7 | 56d54 | ||
| 8 | < int display_errors_only = FALSE; | ||
| 9 | 67d64 | ||
| 10 | < int temp_result = STATE_UNKNOWN; | ||
| 11 | 105,156c102,106 | ||
| 12 | < /* cannot use max now that STATE_UNKNOWN is greater than STATE_CRITICAL | ||
| 13 | < result = max (result, check_disk (usp, free_disk)); */ | ||
| 14 | < temp_result = check_disk (usp, free_disk) ; | ||
| 15 | < | ||
| 16 | < if (exclude_device && !strcmp(exclude_device,file_system)) { | ||
| 17 | < if (verbose) | ||
| 18 | < printf ("ignoring %s.", file_system); | ||
| 19 | < temp_result = STATE_OK; | ||
| 20 | < } | ||
| 21 | < | ||
| 22 | < if ( temp_result == STATE_CRITICAL ) { | ||
| 23 | < result = STATE_CRITICAL; | ||
| 24 | < } | ||
| 25 | < else if (temp_result == STATE_WARNING) { | ||
| 26 | < if ( !( result == STATE_CRITICAL) ) { | ||
| 27 | < result = STATE_WARNING; | ||
| 28 | < } | ||
| 29 | < } | ||
| 30 | < else if (temp_result == STATE_OK) { | ||
| 31 | < if ( ! ( result == STATE_CRITICAL || result == STATE_WARNING) ){ | ||
| 32 | < result = STATE_OK; | ||
| 33 | < } | ||
| 34 | < } | ||
| 35 | < else if (temp_result == STATE_UNKNOWN) { | ||
| 36 | < if ( ! ( result == STATE_CRITICAL || result == STATE_WARNING || result == STATE_OK) ){ | ||
| 37 | < result = STATE_UNKNOWN; | ||
| 38 | < } | ||
| 39 | < } | ||
| 40 | < else { | ||
| 41 | < /* don't have a match with the return value from check_disk() */ | ||
| 42 | < result = STATE_UNKNOWN; | ||
| 43 | < } | ||
| 44 | < | ||
| 45 | < | ||
| 46 | < if (display_errors_only) { | ||
| 47 | < if (temp_result != STATE_OK) { | ||
| 48 | < len = | ||
| 49 | < snprintf (outbuf, MAX_INPUT_BUFFER - 1, | ||
| 50 | < " [%d kB (%d%%) free on %s]", free_disk, 100 - usp, | ||
| 51 | < display_mntp ? mntp : file_system); | ||
| 52 | < } | ||
| 53 | < else { | ||
| 54 | < len = 0; | ||
| 55 | < } | ||
| 56 | < } | ||
| 57 | < else { | ||
| 58 | < len = | ||
| 59 | < snprintf (outbuf, MAX_INPUT_BUFFER - 1, | ||
| 60 | < " [%d kB (%d%%) free on %s]", free_disk, 100 - usp, | ||
| 61 | < display_mntp ? mntp : file_system); | ||
| 62 | < } | ||
| 63 | < | ||
| 64 | --- | ||
| 65 | > result = max (result, check_disk (usp, free_disk)); | ||
| 66 | > len = | ||
| 67 | > snprintf (outbuf, MAX_INPUT_BUFFER - 1, | ||
| 68 | > " [%d kB (%d%%) free on %s]", free_disk, 100 - usp, | ||
| 69 | > display_mntp ? mntp : file_system); | ||
| 70 | 161,162c111,112 | ||
| 71 | < printf ("Unable to read output:\n%s\n%s\n", command_line, input_buffer); | ||
| 72 | < return result; | ||
| 73 | --- | ||
| 74 | > printf ("Unable to read output:\n%s\n%s\n", command_line, input_buffer); | ||
| 75 | > return result; | ||
| 76 | 168,171c118 | ||
| 77 | < /*result = max (result, STATE_WARNING); */ | ||
| 78 | < if( !( result == STATE_CRITICAL) ) { | ||
| 79 | < result = STATE_WARNING; | ||
| 80 | < } | ||
| 81 | --- | ||
| 82 | > result = max (result, STATE_WARNING); | ||
| 83 | 178,181c125,126 | ||
| 84 | < /*result = max (result, STATE_WARNING); */ | ||
| 85 | < if( !( result == STATE_CRITICAL) ) { | ||
| 86 | < result = STATE_WARNING; | ||
| 87 | < } | ||
| 88 | --- | ||
| 89 | > result = max (result, STATE_WARNING); | ||
| 90 | > | ||
| 91 | 241d185 | ||
| 92 | < {"exclude_device", required_argument, 0, 'x'}, | ||
| 93 | 246d189 | ||
| 94 | < {"errors-only", no_argument, 0, 'e'}, | ||
| 95 | 254c197 | ||
| 96 | < getopt_long (argc, argv, "+?Vehvt:c:w:p:x:m", long_options, &option_index); | ||
| 97 | --- | ||
| 98 | > getopt_long (argc, argv, "+?Vhvt:c:w:p:m", long_options, &option_index); | ||
| 99 | 256c199 | ||
| 100 | < c = getopt (argc, argv, "+?Vehvt:c:w:p:x:m"); | ||
| 101 | --- | ||
| 102 | > c = getopt (argc, argv, "+?Vhvt:c:w:p:m"); | ||
| 103 | 269d211 | ||
| 104 | < case 'x': | ||
| 105 | 317,319d258 | ||
| 106 | < case 'x': /* exclude path or partition */ | ||
| 107 | < exclude_device = optarg; | ||
| 108 | < break; | ||
| 109 | 326,328d264 | ||
| 110 | < case 'e': /* only display paths with error conditions */ | ||
| 111 | < display_errors_only = TRUE; | ||
| 112 | < break; | ||
| 113 | 330c266 | ||
| 114 | < print_revision (my_basename (argv[0]), "$Revision: 1.3 $"); | ||
| 115 | --- | ||
| 116 | > print_revision (my_basename (argv[0]), "$Revision: 1.2 $"); | ||
| 117 | 390c326 | ||
| 118 | < print_revision (PROGNAME, "$Revision: 1.3 $"); | ||
| 119 | --- | ||
| 120 | > print_revision (PROGNAME, "$Revision: 1.2 $"); | ||
| 121 | 409,410d344 | ||
| 122 | < " -x, --exclude_device=PATH\n" | ||
| 123 | < " Ignore device (only works if -p unspecified)\n" | ||
| 124 | 413,414d346 | ||
| 125 | < " -e, --errors-only\n" | ||
| 126 | < " Display only devices/mountpoints with errors\n" | ||
| 127 | 427c359 | ||
| 128 | < ("Usage: %s -w limit -c limit [-p path | -x device] [-t timeout] [-m] [-e] [--verbose]\n" | ||
| 129 | --- | ||
| 130 | > ("Usage: %s -w limit -c limit [-p path] [-t timeout] [-m] [--verbose]\n" | ||
diff --git a/web/attachments/271136-check_dig-help-info-fix.diff b/web/attachments/271136-check_dig-help-info-fix.diff new file mode 100644 index 0000000..b646d76 --- /dev/null +++ b/web/attachments/271136-check_dig-help-info-fix.diff | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | --- nagios-plugins-trunk-200803200100/plugins/check_dig.c.orig 2008-03-20 07:34:20.000000000 +0200 | ||
| 2 | +++ nagios-plugins-trunk-200803200100/plugins/check_dig.c 2008-03-20 07:35:23.000000000 +0200 | ||
| 3 | @@ -319,7 +319,7 @@ | ||
| 4 | |||
| 5 | printf (_(UT_HOST_PORT), 'p', myport); | ||
| 6 | |||
| 7 | - printf (" %s\n","-l, --lookup=STRING"); | ||
| 8 | + printf (" %s\n","-l, --query_address=STRING"); | ||
| 9 | printf (" %s\n",_("machine name to lookup")); | ||
| 10 | printf (" %s\n","-T, --record_type=STRING"); | ||
| 11 | printf (" %s\n",_("record type to lookup (default: A)")); | ||
diff --git a/web/attachments/272335-patch-plugins__check_procs.c b/web/attachments/272335-patch-plugins__check_procs.c new file mode 100644 index 0000000..1d187ca --- /dev/null +++ b/web/attachments/272335-patch-plugins__check_procs.c | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | --- plugins/check_procs.c.orig 2007-07-15 11:21:51.000000000 -0400 | ||
| 2 | +++ plugins/check_procs.c 2008-03-28 21:56:51.000000000 -0400 | ||
| 3 | @@ -208,6 +208,10 @@ | ||
| 4 | /* Ignore self */ | ||
| 5 | if (mypid == procpid) continue; | ||
| 6 | |||
| 7 | + if (metric == METRIC_CPU) | ||
| 8 | + if (procppid == 0 && procpid != 1) | ||
| 9 | + continue; | ||
| 10 | + | ||
| 11 | if ((options & STAT) && (strstr (statopts, procstat))) | ||
| 12 | resultsum |= STAT; | ||
| 13 | if ((options & ARGS) && procargs && (strstr (procargs, args) != NULL)) | ||
diff --git a/web/attachments/27256-cpu_mem.tgz b/web/attachments/27256-cpu_mem.tgz new file mode 100644 index 0000000..2fc1856 --- /dev/null +++ b/web/attachments/27256-cpu_mem.tgz | |||
| Binary files differ | |||
diff --git a/web/attachments/273929-nagiosplug-sni-trunk.patch b/web/attachments/273929-nagiosplug-sni-trunk.patch new file mode 100644 index 0000000..c6d2c3e --- /dev/null +++ b/web/attachments/273929-nagiosplug-sni-trunk.patch | |||
| @@ -0,0 +1,85 @@ | |||
| 1 | Index: plugins/netutils.h | ||
| 2 | =================================================================== | ||
| 3 | --- plugins/netutils.h (revision 1977) | ||
| 4 | +++ plugins/netutils.h (working copy) | ||
| 5 | @@ -99,6 +99,7 @@ | ||
| 6 | int np_net_ssl_write(const void *buf, int num); | ||
| 7 | int np_net_ssl_read(void *buf, int num); | ||
| 8 | int np_net_ssl_check_cert(int days_till_exp); | ||
| 9 | +void np_net_ssl_set_host_name(const char *buf); | ||
| 10 | #endif /* HAVE_SSL */ | ||
| 11 | |||
| 12 | #endif /* _NETUTILS_H_ */ | ||
| 13 | Index: plugins/sslutils.c | ||
| 14 | =================================================================== | ||
| 15 | --- plugins/sslutils.c (revision 1977) | ||
| 16 | +++ plugins/sslutils.c (working copy) | ||
| 17 | @@ -37,6 +37,7 @@ | ||
| 18 | static SSL_CTX *c=NULL; | ||
| 19 | static SSL *s=NULL; | ||
| 20 | static int initialized=0; | ||
| 21 | +const char *host_name=NULL; | ||
| 22 | |||
| 23 | int np_net_ssl_init (int sd){ | ||
| 24 | if (!initialized) { | ||
| 25 | @@ -51,6 +52,10 @@ | ||
| 26 | return STATE_CRITICAL; | ||
| 27 | } | ||
| 28 | if ((s = SSL_new (c)) != NULL){ | ||
| 29 | +#ifdef SSL_set_tlsext_host_name | ||
| 30 | + if (host_name != NULL) | ||
| 31 | + SSL_set_tlsext_host_name(s, host_name); | ||
| 32 | +#endif | ||
| 33 | SSL_set_fd (s, sd); | ||
| 34 | if (SSL_connect(s) == 1){ | ||
| 35 | return OK; | ||
| 36 | @@ -68,6 +73,9 @@ | ||
| 37 | |||
| 38 | void np_net_ssl_cleanup (){ | ||
| 39 | if(s){ | ||
| 40 | +#ifdef SSL_set_tlsext_host_name | ||
| 41 | + SSL_set_tlsext_host_name(s, NULL); | ||
| 42 | +#endif | ||
| 43 | SSL_shutdown (s); | ||
| 44 | SSL_free (s); | ||
| 45 | if(c) { | ||
| 46 | @@ -93,7 +101,7 @@ | ||
| 47 | int offset; | ||
| 48 | struct tm stamp; | ||
| 49 | int days_left; | ||
| 50 | - char timestamp[17] = ""; | ||
| 51 | + char timestamp[21] = ""; | ||
| 52 | |||
| 53 | certificate=SSL_get_peer_certificate(s); | ||
| 54 | if(! certificate){ | ||
| 55 | @@ -138,16 +146,17 @@ | ||
| 56 | stamp.tm_sec = 0; | ||
| 57 | stamp.tm_isdst = -1; | ||
| 58 | |||
| 59 | - days_left = (mktime (&stamp) - time (NULL)) / 86400; | ||
| 60 | + float time_left = difftime(timegm(&stamp), time(NULL)); | ||
| 61 | + days_left = time_left / 86400; | ||
| 62 | snprintf | ||
| 63 | - (timestamp, 17, "%02d/%02d/%04d %02d:%02d", | ||
| 64 | + (timestamp, 21, "%02d/%02d/%04d %02d:%02d %s", | ||
| 65 | stamp.tm_mon + 1, | ||
| 66 | - stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min); | ||
| 67 | + stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min, stamp.tm_zone); | ||
| 68 | |||
| 69 | if (days_left > 0 && days_left <= days_till_exp) { | ||
| 70 | printf (_("WARNING - Certificate expires in %d day(s) (%s).\n"), days_left, timestamp); | ||
| 71 | return STATE_WARNING; | ||
| 72 | - } else if (days_left < 0) { | ||
| 73 | + } else if (time_left < 0) { | ||
| 74 | printf (_("CRITICAL - Certificate expired on %s.\n"), timestamp); | ||
| 75 | return STATE_CRITICAL; | ||
| 76 | } else if (days_left == 0) { | ||
| 77 | @@ -164,4 +173,8 @@ | ||
| 78 | # endif /* USE_OPENSSL */ | ||
| 79 | } | ||
| 80 | |||
| 81 | +void np_net_ssl_set_host_name (const char *buf){ | ||
| 82 | + host_name = buf; | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | #endif /* HAVE_SSL */ | ||
diff --git a/web/attachments/27403-cpu_mem-0.4.tgz b/web/attachments/27403-cpu_mem-0.4.tgz new file mode 100644 index 0000000..aff9e05 --- /dev/null +++ b/web/attachments/27403-cpu_mem-0.4.tgz | |||
| Binary files differ | |||
diff --git a/web/attachments/274034-check_tcp-openfire-jabber.patch b/web/attachments/274034-check_tcp-openfire-jabber.patch new file mode 100644 index 0000000..87f8098 --- /dev/null +++ b/web/attachments/274034-check_tcp-openfire-jabber.patch | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | --- check_tcp.c.orig 2008-04-10 13:02:42.000000000 -0400 | ||
| 2 | +++ check_tcp.c 2008-04-10 13:14:50.000000000 -0400 | ||
| 3 | @@ -167,9 +167,14 @@ | ||
| 4 | } | ||
| 5 | else if (!strncmp(SERVICE, "JABBER", 6)) { | ||
| 6 | SEND = "<stream:stream to=\'host\' xmlns=\'jabber:client\' xmlns:stream=\'http://etherx.jabber.org/streams\'>\n"; | ||
| 7 | - EXPECT = "<?xml version=\'1.0\'?><stream:stream xmlns=\'jabber:client\' xmlns:stream=\'http://etherx.jabber.org/streams\'"; | ||
| 8 | + server_expect_count = 3; | ||
| 9 | + server_expect = malloc(sizeof(char *) * server_expect_count); | ||
| 10 | + server_expect[0] = "<?xml version='1.0' encoding='UTF-8'?><stream:stream"; | ||
| 11 | + server_expect[1] = "xmlns=\"jabber:client\""; | ||
| 12 | + server_expect[2] = "xmlns:stream=\"http://etherx.jabber.org/streams\""; | ||
| 13 | QUIT = "</stream:stream>\n"; | ||
| 14 | - flags |= FLAG_HIDE_OUTPUT; | ||
| 15 | + flags |= (FLAG_MATCH_ALL | FLAG_HIDE_OUTPUT); | ||
| 16 | + flags &= ~FLAG_EXACT_MATCH; | ||
| 17 | PORT = 5222; | ||
| 18 | } | ||
| 19 | else if (!strncmp (SERVICE, "NNTPS", 5)) { | ||
diff --git a/web/attachments/27405-cpu0.3_mem0.5.tgz b/web/attachments/27405-cpu0.3_mem0.5.tgz new file mode 100644 index 0000000..345745e --- /dev/null +++ b/web/attachments/27405-cpu0.3_mem0.5.tgz | |||
| Binary files differ | |||
diff --git a/web/attachments/27407-nagios-plugins-check_smtp.patch b/web/attachments/27407-nagios-plugins-check_smtp.patch new file mode 100644 index 0000000..be08038 --- /dev/null +++ b/web/attachments/27407-nagios-plugins-check_smtp.patch | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | --- nagios-plugins/plugins/check_smtp.c Thu Jun 13 13:49:38 2002 | ||
| 2 | +++ nagios-plugins.patched/plugins/check_smtp.c Fri Jul 19 14:03:19 2002 | ||
| 3 | @@ -50,8 +50,13 @@ | ||
| 4 | */ | ||
| 5 | #define SMTP_DUMMYCMD "MAIL\r\n" | ||
| 6 | #define SMTP_USE_DUMMYCMD 1 | ||
| 7 | +#define SMTP_USE_HELOCMD 1 | ||
| 8 | #define SMTP_QUIT "QUIT\r\n" | ||
| 9 | |||
| 10 | +#ifdef SMTP_USE_HELOCMD | ||
| 11 | +#undef SMTP_USE_DUMMYCMD | ||
| 12 | +#endif /* SMTP_USE_HELOCMD */ | ||
| 13 | + | ||
| 14 | int process_arguments (int, char **); | ||
| 15 | int call_getopt (int, char **); | ||
| 16 | int validate_arguments (void); | ||
| 17 | @@ -74,6 +79,10 @@ | ||
| 18 | int sd; | ||
| 19 | int result; | ||
| 20 | char buffer[MAX_INPUT_BUFFER] = ""; | ||
| 21 | +#ifdef SMTP_USE_HELOCMD | ||
| 22 | + char helocmd[255] = "HELO "; | ||
| 23 | + char myhostname[248]; | ||
| 24 | +#endif /* SMTP_USE_HELOCMD */ | ||
| 25 | |||
| 26 | if (process_arguments (argc, argv) != OK) | ||
| 27 | usage ("Invalid command arguments supplied\n"); | ||
| 28 | @@ -137,13 +146,22 @@ | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | - /* close the connection */ | ||
| 33 | +#ifdef SMTP_USE_HELOCMD | ||
| 34 | + gethostname(myhostname, sizeof(myhostname)); | ||
| 35 | + strcat(helocmd,myhostname); | ||
| 36 | + strcat(helocmd,"\r\n"); | ||
| 37 | + send(sd,helocmd,strlen(helocmd),0); | ||
| 38 | + /* allow for response to helo command to reach us */ | ||
| 39 | + recv(sd,buffer,MAX_INPUT_BUFFER-1,0); | ||
| 40 | +#endif /* SMTP_USE_HELOCMD */ | ||
| 41 | + | ||
| 42 | #ifdef SMTP_USE_DUMMYCMD | ||
| 43 | send(sd,SMTP_DUMMYCMD,strlen(SMTP_DUMMYCMD),0); | ||
| 44 | /* allow for response to DUMMYCMD to reach us */ | ||
| 45 | recv(sd,buffer,MAX_INPUT_BUFFER-1,0); | ||
| 46 | #endif /* SMTP_USE_DUMMYCMD */ | ||
| 47 | |||
| 48 | + /* close the connection */ | ||
| 49 | send (sd, SMTP_QUIT, strlen (SMTP_QUIT), 0); | ||
| 50 | close (sd); | ||
| 51 | } | ||
| 52 | |||
diff --git a/web/attachments/274975-check_oracle.patch b/web/attachments/274975-check_oracle.patch new file mode 100644 index 0000000..98eeced --- /dev/null +++ b/web/attachments/274975-check_oracle.patch | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | --- plugins-scripts/check_oracle.sh.old 2008-04-17 15:59:40.807652000 -0400 | ||
| 2 | +++ plugins-scripts/check_oracle.sh 2008-04-17 16:15:15.641727000 -0400 | ||
| 3 | @@ -37,7 +37,7 @@ | ||
| 4 | echo "--db SID" | ||
| 5 | echo " Check local database (search /bin/ps for PMON process) and check" | ||
| 6 | echo " filesystem for sgadefORACLE_SID.dbf" | ||
| 7 | - echo "--login SID" | ||
| 8 | + echo "--login SID|<IP or hostname> SID" | ||
| 9 | echo " Attempt a dummy login and alert if not ORA-01017: invalid username/password" | ||
| 10 | echo "--cache" | ||
| 11 | echo " Check local database for library and buffer cache hit ratios" | ||
| 12 | @@ -176,7 +176,11 @@ | ||
| 13 | fi | ||
| 14 | ;; | ||
| 15 | --login) | ||
| 16 | - loginchk=`sqlplus dummy/user@$2 < /dev/null` | ||
| 17 | + if [ -n "$3" ]; then | ||
| 18 | + loginchk=`sqlplus dummy/user@$2/$3 < /dev/null` | ||
| 19 | + else | ||
| 20 | + loginchk=`sqlplus dummy/user@$2 < /dev/null` | ||
| 21 | + fi | ||
| 22 | loginchk2=` echo $loginchk | grep -c ORA-01017` | ||
| 23 | if [ ${loginchk2} -eq 1 ] ; then | ||
| 24 | echo "OK - dummy login connected" | ||
diff --git a/web/attachments/27581-z b/web/attachments/27581-z new file mode 100644 index 0000000..fb3e37c --- /dev/null +++ b/web/attachments/27581-z | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | --- check_snmp.c.cln Tue Jul 23 09:42:21 2002 | ||
| 2 | +++ check_snmp.c Tue Jul 23 09:42:50 2002 | ||
| 3 | @@ -145,8 +145,8 @@ | ||
| 4 | /* create the command line to execute */ | ||
| 5 | command_line = ssprintf | ||
| 6 | (command_line, | ||
| 7 | - "%s -m ALL -v 1 %s %s %s", | ||
| 8 | - PATH_TO_SNMPGET, server_address, community, oid); | ||
| 9 | + "%s -m ALL -v 1 -c %s %s %s", | ||
| 10 | + PATH_TO_SNMPGET, community, server_address, oid); | ||
| 11 | |||
| 12 | /* run the command */ | ||
| 13 | child_process = spopen (command_line); | ||
| 14 | --- check_hpjd.c.cln Tue Jul 23 09:45:16 2002 | ||
| 15 | +++ check_hpjd.c Tue Jul 23 09:46:00 2002 | ||
| 16 | @@ -135,8 +135,8 @@ | ||
| 17 | HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY); | ||
| 18 | |||
| 19 | /* get the command to run */ | ||
| 20 | - sprintf (command_line, "%s -m : -v 1 %s %s %s", PATH_TO_SNMPGET, address, | ||
| 21 | - community, query_string); | ||
| 22 | + sprintf (command_line, "%s -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET, | ||
| 23 | + community, address, query_string); | ||
| 24 | |||
| 25 | /* run the command */ | ||
| 26 | child_process = spopen (command_line); | ||
diff --git a/web/attachments/27710-snmptest.sh b/web/attachments/27710-snmptest.sh new file mode 100644 index 0000000..71dc310 --- /dev/null +++ b/web/attachments/27710-snmptest.sh | |||
| Binary files differ | |||
diff --git a/web/attachments/279258-check_radius.c.diff b/web/attachments/279258-check_radius.c.diff new file mode 100644 index 0000000..051dc4d --- /dev/null +++ b/web/attachments/279258-check_radius.c.diff | |||
| @@ -0,0 +1,94 @@ | |||
| 1 | --- check_radius.c.orig 2008-05-28 00:31:54.000000000 +0200 | ||
| 2 | +++ check_radius.c 2008-05-28 00:29:27.000000000 +0200 | ||
| 3 | @@ -53,6 +53,7 @@ | ||
| 4 | char *username = NULL; | ||
| 5 | char *password = NULL; | ||
| 6 | char *nasid = NULL; | ||
| 7 | +char *nasipaddress = NULL; | ||
| 8 | char *expect = NULL; | ||
| 9 | char *config_file = NULL; | ||
| 10 | unsigned short port = PW_AUTH_UDP_PORT; | ||
| 11 | @@ -149,19 +150,26 @@ | ||
| 12 | |||
| 13 | if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) && | ||
| 14 | rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) && | ||
| 15 | - rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) && | ||
| 16 | - (nasid==NULL || rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0)))) | ||
| 17 | + rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) | ||
| 18 | + )) | ||
| 19 | die (STATE_UNKNOWN, _("Out of Memory?")); | ||
| 20 | |||
| 21 | - /* | ||
| 22 | - * Fill in NAS-IP-Address | ||
| 23 | - */ | ||
| 24 | - | ||
| 25 | - if ((client_id = rc_own_ipaddress ()) == 0) | ||
| 26 | - return (ERROR_RC); | ||
| 27 | - | ||
| 28 | - if (rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == | ||
| 29 | - NULL) return (ERROR_RC); | ||
| 30 | + if (nasid != NULL) { | ||
| 31 | + if (!(rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0))) | ||
| 32 | + die (STATE_UNKNOWN, _("Invalid NAS-Identifier")); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + if (nasipaddress != NULL) { | ||
| 36 | + if (rc_good_ipaddr (nasipaddress)) | ||
| 37 | + die (STATE_UNKNOWN, _("Invalid NAS-IP-Address")); | ||
| 38 | + if ((client_id = rc_get_ipaddr(nasipaddress)) == 0) | ||
| 39 | + die (STATE_UNKNOWN, _("Invalid NAS-IP-Address")); | ||
| 40 | + } else { | ||
| 41 | + if ((client_id = rc_own_ipaddress ()) == 0) | ||
| 42 | + die (STATE_UNKNOWN, _("Can't find local IP for NAS-IP-Address")); | ||
| 43 | + } | ||
| 44 | + if (rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == NULL) | ||
| 45 | + die (STATE_UNKNOWN, _("Invalid NAS-IP-Address")); | ||
| 46 | |||
| 47 | rc_buildreq (&data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval, | ||
| 48 | retries); | ||
| 49 | @@ -199,6 +207,7 @@ | ||
| 50 | {"username", required_argument, 0, 'u'}, | ||
| 51 | {"password", required_argument, 0, 'p'}, | ||
| 52 | {"nas-id", required_argument, 0, 'n'}, | ||
| 53 | + {"nas-ip-address", required_argument, 0, 'N'}, | ||
| 54 | {"filename", required_argument, 0, 'F'}, | ||
| 55 | {"expect", required_argument, 0, 'e'}, | ||
| 56 | {"retries", required_argument, 0, 'r'}, | ||
| 57 | @@ -234,7 +243,7 @@ | ||
| 58 | } | ||
| 59 | |||
| 60 | while (1) { | ||
| 61 | - c = getopt_long (argc, argv, "+hVvH:P:F:u:p:n:t:r:e:", longopts, | ||
| 62 | + c = getopt_long (argc, argv, "+hVvH:P:F:u:p:n:N:t:r:e:", longopts, | ||
| 63 | &option); | ||
| 64 | |||
| 65 | if (c == -1 || c == EOF || c == 1) | ||
| 66 | @@ -273,6 +282,9 @@ | ||
| 67 | case 'n': /* nas id */ | ||
| 68 | nasid = optarg; | ||
| 69 | break; | ||
| 70 | + case 'N': /* nas ip address */ | ||
| 71 | + nasipaddress = optarg; | ||
| 72 | + break; | ||
| 73 | case 'F': /* configuration file */ | ||
| 74 | config_file = optarg; | ||
| 75 | break; | ||
| 76 | @@ -325,6 +337,8 @@ | ||
| 77 | printf (" %s\n", _("Password for autentication (SECURITY RISK)")); | ||
| 78 | printf (" %s\n", "-n, --nas-id=STRING"); | ||
| 79 | printf (" %s\n", _("NAS identifier")); | ||
| 80 | + printf (" %s\n", "-N, --nas-ip-address=STRING"); | ||
| 81 | + printf (" %s\n", _("NAS IP Address")); | ||
| 82 | printf (" %s\n", "-F, --filename=STRING"); | ||
| 83 | printf (" %s\n", _("Configuration file")); | ||
| 84 | printf (" %s\n", "-e, --expect=STRING"); | ||
| 85 | @@ -354,6 +368,7 @@ | ||
| 86 | print_usage (void) | ||
| 87 | { | ||
| 88 | printf (_("Usage:")); | ||
| 89 | - printf ("%s -H host -F config_file -u username -p password [-n nas-id] [-P port]\n\ | ||
| 90 | - [-t timeout] [-r retries] [-e expect]\n", progname); | ||
| 91 | + printf ("%s -H host -F config_file -u username -p password\n\ | ||
| 92 | + [-P port] [-t timeout] [-r retries] [-e expect]\n\ | ||
| 93 | + [-n nas-id] [-N nas-ip-addr]\n", progname); | ||
| 94 | } | ||
diff --git a/web/attachments/279991-50_misc_typos.dpatch b/web/attachments/279991-50_misc_typos.dpatch new file mode 100644 index 0000000..a40d67b --- /dev/null +++ b/web/attachments/279991-50_misc_typos.dpatch | |||
| @@ -0,0 +1,322 @@ | |||
| 1 | #! /bin/sh /usr/share/dpatch/dpatch-run | ||
| 2 | ## 50_misc_typos.dpatch by <andy@andrewprice.me.uk> modified for 1.4.10 by | ||
| 3 | ## Jan Wagner <waja@cyconet.org> | ||
| 4 | ## | ||
| 5 | ## DP: This patch fixes various typos and grammatical errors in plugins/*.c. | ||
| 6 | ## DP: It is based on Malcolm Parsons' patch posted at https://launchpad.net/bugs/64595 | ||
| 7 | |||
| 8 | @DPATCH@ | ||
| 9 | diff -urNad nagios-plugins-1.4.12~/plugins/check_dns.c nagios-plugins-1.4.12/plugins/check_dns.c | ||
| 10 | --- nagios-plugins-1.4.12~/plugins/check_dns.c 2008-05-13 11:14:45.000000000 +0200 | ||
| 11 | +++ nagios-plugins-1.4.12/plugins/check_dns.c 2008-06-03 11:08:17.000000000 +0200 | ||
| 12 | @@ -255,7 +255,7 @@ | ||
| 13 | printf (_("DNS CRITICAL - %s\n"), | ||
| 14 | !strcmp (msg, "") ? _(" Probably a non-existent host/domain") : msg); | ||
| 15 | else | ||
| 16 | - printf (_("DNS UNKNOW - %s\n"), | ||
| 17 | + printf (_("DNS UNKNOWN - %s\n"), | ||
| 18 | !strcmp (msg, "") ? _(" Probably a non-existent host/domain") : msg); | ||
| 19 | |||
| 20 | return result; | ||
| 21 | diff -urNad nagios-plugins-1.4.12~/plugins/check_http.c nagios-plugins-1.4.12/plugins/check_http.c | ||
| 22 | --- nagios-plugins-1.4.12~/plugins/check_http.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 23 | +++ nagios-plugins-1.4.12/plugins/check_http.c 2008-06-03 11:08:17.000000000 +0200 | ||
| 24 | @@ -1054,7 +1054,7 @@ | ||
| 25 | |||
| 26 | url = malloc (strcspn (pos, "\r\n")); | ||
| 27 | if (url == NULL) | ||
| 28 | - die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate url\n")); | ||
| 29 | + die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate URL\n")); | ||
| 30 | |||
| 31 | while (pos) { | ||
| 32 | sscanf (pos, "%1[Ll]%*1[Oo]%*1[Cc]%*1[Aa]%*1[Tt]%*1[Ii]%*1[Oo]%*1[Nn]:%n", xx, &i); | ||
| 33 | @@ -1085,7 +1085,7 @@ | ||
| 34 | |||
| 35 | url = realloc (url, strcspn (pos, "\r\n") + 1); | ||
| 36 | if (url == NULL) | ||
| 37 | - die (STATE_UNKNOWN, _("HTTP UNKNOWN - could not allocate url\n")); | ||
| 38 | + die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate URL\n")); | ||
| 39 | |||
| 40 | /* URI_HTTP, URI_HOST, URI_PORT, URI_PATH */ | ||
| 41 | if (sscanf (pos, HD1, type, addr, &i, url) == 4) | ||
| 42 | @@ -1253,7 +1253,7 @@ | ||
| 43 | printf (" %s\n", _("Connect via SSL. Port defaults to 443")); | ||
| 44 | printf (" %s\n", "-C, --certificate=INTEGER"); | ||
| 45 | printf (" %s\n", _("Minimum number of days a certificate has to be valid. Port defaults to 443")); | ||
| 46 | - printf (" %s\n", _("(when this option is used the url is not checked.)\n")); | ||
| 47 | + printf (" %s\n", _("(when this option is used the URL is not checked.)\n")); | ||
| 48 | #endif | ||
| 49 | |||
| 50 | printf (" %s\n", "-e, --expect=STRING"); | ||
| 51 | diff -urNad nagios-plugins-1.4.12~/plugins/check_ldap.c nagios-plugins-1.4.12/plugins/check_ldap.c | ||
| 52 | --- nagios-plugins-1.4.12~/plugins/check_ldap.c 2008-06-03 11:08:16.000000000 +0200 | ||
| 53 | +++ nagios-plugins-1.4.12/plugins/check_ldap.c 2008-06-03 11:08:17.000000000 +0200 | ||
| 54 | @@ -196,7 +196,7 @@ | ||
| 55 | LDAP_SUCCESS) { | ||
| 56 | if (verbose) | ||
| 57 | ldap_perror(ld, "ldap_bind"); | ||
| 58 | - printf (_("Could not bind to the ldap-server\n")); | ||
| 59 | + printf (_("Could not bind to the LDAP server\n")); | ||
| 60 | return STATE_CRITICAL; | ||
| 61 | } | ||
| 62 | |||
| 63 | diff -urNad nagios-plugins-1.4.12~/plugins/check_mysql.c nagios-plugins-1.4.12/plugins/check_mysql.c | ||
| 64 | --- nagios-plugins-1.4.12~/plugins/check_mysql.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 65 | +++ nagios-plugins-1.4.12/plugins/check_mysql.c 2008-06-03 11:08:17.000000000 +0200 | ||
| 66 | @@ -381,7 +381,7 @@ | ||
| 67 | |||
| 68 | printf (_(COPYRIGHT), copyright, email); | ||
| 69 | |||
| 70 | - printf ("%s\n", _("This program tests connections to a mysql server")); | ||
| 71 | + printf ("%s\n", _("This program tests connections to a MySQL server")); | ||
| 72 | |||
| 73 | printf ("\n\n"); | ||
| 74 | |||
| 75 | diff -urNad nagios-plugins-1.4.12~/plugins/check_procs.c nagios-plugins-1.4.12/plugins/check_procs.c | ||
| 76 | --- nagios-plugins-1.4.12~/plugins/check_procs.c 2008-06-03 11:08:16.000000000 +0200 | ||
| 77 | +++ nagios-plugins-1.4.12/plugins/check_procs.c 2008-06-03 11:14:09.000000000 +0200 | ||
| 78 | @@ -730,7 +730,7 @@ | ||
| 79 | printf (" %s\n", _("PROCS - number of processes (default)")); | ||
| 80 | printf (" %s\n", _("VSZ - virtual memory size")); | ||
| 81 | printf (" %s\n", _("RSS - resident set memory size")); | ||
| 82 | - printf (" %s\n", _("CPU - percentage cpu")); | ||
| 83 | + printf (" %s\n", _("CPU - percentage CPU")); | ||
| 84 | /* only linux etime is support currently */ | ||
| 85 | #if defined( __linux__ ) | ||
| 86 | printf (" %s\n", _("ELAPSED - time elapsed in seconds")); | ||
| 87 | @@ -749,11 +749,11 @@ | ||
| 88 | printf (" %s\n", "-p, --ppid=PPID"); | ||
| 89 | printf (" %s\n", _("Only scan for children of the parent process ID indicated.")); | ||
| 90 | printf (" %s\n", "-z, --vsz=VSZ"); | ||
| 91 | - printf (" %s\n", _("Only scan for processes with vsz higher than indicated.")); | ||
| 92 | + printf (" %s\n", _("Only scan for processes with VSZ higher than indicated.")); | ||
| 93 | printf (" %s\n", "-r, --rss=RSS"); | ||
| 94 | - printf (" %s\n", _("Only scan for processes with rss higher than indicated.")); | ||
| 95 | + printf (" %s\n", _("Only scan for processes with RSS higher than indicated.")); | ||
| 96 | printf (" %s\n", "-P, --pcpu=PCPU"); | ||
| 97 | - printf (" %s\n", _("Only scan for processes with pcpu higher than indicated.")); | ||
| 98 | + printf (" %s\n", _("Only scan for processes with PCPU higher than indicated.")); | ||
| 99 | printf (" %s\n", "-u, --user=USER"); | ||
| 100 | printf (" %s\n", _("Only scan for processes with user name or ID indicated.")); | ||
| 101 | printf (" %s\n", "-a, --argument-array=STRING"); | ||
| 102 | @@ -789,9 +789,9 @@ | ||
| 103 | printf (" %s\n", _("Warning alert if > 10 processes with command arguments containing")); | ||
| 104 | printf (" %s\n\n", _("'/usr/local/bin/perl' and owned by root")); | ||
| 105 | printf (" %s\n", "check_procs -w 50000 -c 100000 --metric=VSZ"); | ||
| 106 | - printf (" %s\n\n", _("Alert if vsz of any processes over 50K or 100K")); | ||
| 107 | + printf (" %s\n\n", _("Alert if VSZ of any processes over 50K or 100K")); | ||
| 108 | printf (" %s\n", "check_procs -w 10 -c 20 --metric=CPU"); | ||
| 109 | - printf (" %s\n", _("Alert if cpu of any processes over 10%% or 20%%")); | ||
| 110 | + printf (" %s\n", _("Alert if CPU of any processes over 10%% or 20%%")); | ||
| 111 | |||
| 112 | printf (_(UT_SUPPORT)); | ||
| 113 | } | ||
| 114 | diff -urNad nagios-plugins-1.4.12~/plugins/check_procs.c.rej nagios-plugins-1.4.12/plugins/check_procs.c.rej | ||
| 115 | --- nagios-plugins-1.4.12~/plugins/check_procs.c.rej 1970-01-01 01:00:00.000000000 +0100 | ||
| 116 | +++ nagios-plugins-1.4.12/plugins/check_procs.c.rej 2008-06-03 11:08:17.000000000 +0200 | ||
| 117 | @@ -0,0 +1,21 @@ | ||
| 118 | +*************** | ||
| 119 | +*** 781,789 **** | ||
| 120 | + printf (" %s\n", _("Warning alert if > 10 processes with command arguments containing")); | ||
| 121 | + printf (" %s\n\n", _("'/usr/local/bin/perl' and owned by root")); | ||
| 122 | + printf (" %s\n", "check_procs -w 50000 -c 100000 --metric=VSZ"); | ||
| 123 | +- printf (" %s\n\n", _("Alert if vsz of any processes over 50K or 100K")); | ||
| 124 | + printf (" %s\n", "check_procs -w 10 -c 20 --metric=CPU"); | ||
| 125 | +- printf (" %s\n\n", _("Alert if cpu of any processes over 10%% or 20%%")); | ||
| 126 | + | ||
| 127 | + printf (_(UT_SUPPORT)); | ||
| 128 | + } | ||
| 129 | +--- 781,789 ---- | ||
| 130 | + printf (" %s\n", _("Warning alert if > 10 processes with command arguments containing")); | ||
| 131 | + printf (" %s\n\n", _("'/usr/local/bin/perl' and owned by root")); | ||
| 132 | + printf (" %s\n", "check_procs -w 50000 -c 100000 --metric=VSZ"); | ||
| 133 | ++ printf (" %s\n\n", _("Alert if VSZ of any processes over 50K or 100K")); | ||
| 134 | + printf (" %s\n", "check_procs -w 10 -c 20 --metric=CPU"); | ||
| 135 | ++ printf (" %s\n\n", _("Alert if CPU of any processes over 10%% or 20%%")); | ||
| 136 | + | ||
| 137 | + printf (_(UT_SUPPORT)); | ||
| 138 | + } | ||
| 139 | diff -urNad nagios-plugins-1.4.12~/plugins/check_radius.c nagios-plugins-1.4.12/plugins/check_radius.c | ||
| 140 | --- nagios-plugins-1.4.12~/plugins/check_radius.c 2008-06-03 11:08:16.000000000 +0200 | ||
| 141 | +++ nagios-plugins-1.4.12/plugins/check_radius.c 2008-06-03 11:16:39.000000000 +0200 | ||
| 142 | @@ -325,7 +325,7 @@ | ||
| 143 | printf ("Copyright (c) 1999 Robert August Vincent II\n"); | ||
| 144 | printf (COPYRIGHT, copyright, email); | ||
| 145 | |||
| 146 | - printf("%s\n", _("Tests to see if a radius server is accepting connections.")); | ||
| 147 | + printf("%s\n", _("Tests to see if a RADIUS server is accepting connections.")); | ||
| 148 | |||
| 149 | printf ("\n\n"); | ||
| 150 | |||
| 151 | @@ -352,7 +352,7 @@ | ||
| 152 | printf (_(UT_TIMEOUT), timeout_interval); | ||
| 153 | |||
| 154 | printf ("\n"); | ||
| 155 | - printf ("%s\n", _("This plugin tests a radius server to see if it is accepting connections.")); | ||
| 156 | + printf ("%s\n", _("This plugin tests a RADIUS server to see if it is accepting connections.")); | ||
| 157 | printf ("%s\n", _("The server to test must be specified in the invocation, as well as a user")); | ||
| 158 | printf ("%s\n", _("name and password. A configuration file may also be present. The format of")); | ||
| 159 | printf ("%s\n", _("the configuration file is described in the radiusclient library sources.")); | ||
| 160 | diff -urNad nagios-plugins-1.4.12~/plugins/check_radius.c.rej nagios-plugins-1.4.12/plugins/check_radius.c.rej | ||
| 161 | --- nagios-plugins-1.4.12~/plugins/check_radius.c.rej 1970-01-01 01:00:00.000000000 +0100 | ||
| 162 | +++ nagios-plugins-1.4.12/plugins/check_radius.c.rej 2008-06-03 11:08:17.000000000 +0200 | ||
| 163 | @@ -0,0 +1,35 @@ | ||
| 164 | +*************** | ||
| 165 | +*** 350,365 **** | ||
| 166 | + | ||
| 167 | + printf (_(UT_TIMEOUT), timeout_interval); | ||
| 168 | + | ||
| 169 | +- printf ("%s\n", _("This plugin tests a radius server to see if it is accepting connections.")); | ||
| 170 | + printf ("%s\n", _("The server to test must be specified in the invocation, as well as a user")); | ||
| 171 | + printf ("%s\n", _("name and password. A configuration file may also be present. The format of")); | ||
| 172 | + printf ("%s\n", _("the configuration file is described in the radiusclient library sources.")); | ||
| 173 | + printf ("%s\n", _("The password option presents a substantial security issue because the")); | ||
| 174 | + printf ("%s\n", _("password can be determined by careful watching of the command line in")); | ||
| 175 | + printf ("%s\n", _("a process listing. This risk is exacerbated because nagios will")); | ||
| 176 | +- printf ("%s\n", _("run the plugin at regular prdictable intervals. Please be sure that")); | ||
| 177 | + printf ("%s\n", _("the password used does not allow access to sensitive system resources,")); | ||
| 178 | +- printf ("%s\n", _("otherwise compormise could occur.")); | ||
| 179 | + | ||
| 180 | + printf (_(UT_SUPPORT)); | ||
| 181 | + } | ||
| 182 | +--- 350,365 ---- | ||
| 183 | + | ||
| 184 | + printf (_(UT_TIMEOUT), timeout_interval); | ||
| 185 | + | ||
| 186 | ++ printf ("%s\n", _("This plugin tests a RADIUS server to see if it is accepting connections.")); | ||
| 187 | + printf ("%s\n", _("The server to test must be specified in the invocation, as well as a user")); | ||
| 188 | + printf ("%s\n", _("name and password. A configuration file may also be present. The format of")); | ||
| 189 | + printf ("%s\n", _("the configuration file is described in the radiusclient library sources.")); | ||
| 190 | + printf ("%s\n", _("The password option presents a substantial security issue because the")); | ||
| 191 | + printf ("%s\n", _("password can be determined by careful watching of the command line in")); | ||
| 192 | + printf ("%s\n", _("a process listing. This risk is exacerbated because nagios will")); | ||
| 193 | ++ printf ("%s\n", _("run the plugin at regular predictable intervals. Please be sure that")); | ||
| 194 | + printf ("%s\n", _("the password used does not allow access to sensitive system resources,")); | ||
| 195 | ++ printf ("%s\n", _("otherwise compromise could occur.")); | ||
| 196 | + | ||
| 197 | + printf (_(UT_SUPPORT)); | ||
| 198 | + } | ||
| 199 | diff -urNad nagios-plugins-1.4.12~/plugins/check_snmp.c nagios-plugins-1.4.12/plugins/check_snmp.c | ||
| 200 | --- nagios-plugins-1.4.12~/plugins/check_snmp.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 201 | +++ nagios-plugins-1.4.12/plugins/check_snmp.c 2008-06-03 11:08:17.000000000 +0200 | ||
| 202 | @@ -928,7 +928,7 @@ | ||
| 203 | |||
| 204 | printf (COPYRIGHT, copyright, email); | ||
| 205 | |||
| 206 | - printf ("%s\n", _("Check status of remote machines and obtain sustem information via SNMP")); | ||
| 207 | + printf ("%s\n", _("Check status of remote machines and obtain system information via SNMP")); | ||
| 208 | |||
| 209 | printf ("\n\n"); | ||
| 210 | |||
| 211 | @@ -964,8 +964,8 @@ | ||
| 212 | printf (" %s\n", "-o, --oid=OID(s)"); | ||
| 213 | printf (" %s\n", _("Object identifier(s) or SNMP variables whose value you wish to query")); | ||
| 214 | printf (" %s\n", "-m, --miblist=STRING"); | ||
| 215 | - printf (" %s\n", _("List of MIBS to be loaded (default = none if using numeric oids or 'ALL'")); | ||
| 216 | - printf (" %s\n", _("for symbolic oids.)")); | ||
| 217 | + printf (" %s\n", _("List of MIBS to be loaded (default = none if using numeric OIDs or 'ALL'")); | ||
| 218 | + printf (" %s\n", _("for symbolic OIDs.)")); | ||
| 219 | printf (" %s\n", "-d, --delimiter=STRING"); | ||
| 220 | printf (_(" Delimiter to use when parsing returned data. Default is \"%s\""), DEFAULT_DELIMITER); | ||
| 221 | printf (" %s\n", _("Any data on the right hand side of the delimiter is considered")); | ||
| 222 | diff -urNad nagios-plugins-1.4.12~/plugins/check_tcp.c nagios-plugins-1.4.12/plugins/check_tcp.c | ||
| 223 | --- nagios-plugins-1.4.12~/plugins/check_tcp.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 224 | +++ nagios-plugins-1.4.12/plugins/check_tcp.c 2008-06-03 11:08:17.000000000 +0200 | ||
| 225 | @@ -623,7 +623,7 @@ | ||
| 226 | printf (" %s\n", "-q, --quit=STRING"); | ||
| 227 | printf (" %s\n", _("String to send server to initiate a clean close of the connection")); | ||
| 228 | printf (" %s\n", "-r, --refuse=ok|warn|crit"); | ||
| 229 | - printf (" %s\n", _("Accept tcp refusals with states ok, warn, crit (default: crit)")); | ||
| 230 | + printf (" %s\n", _("Accept TCP refusals with states ok, warn, crit (default: crit)")); | ||
| 231 | printf (" %s\n", "-M, --mismatch=ok|warn|crit"); | ||
| 232 | printf (" %s\n", _("Accept expected string mismatches with states ok, warn, crit (default: warn)")); | ||
| 233 | printf (" %s\n", "-j, --jail"); | ||
| 234 | diff -urNad nagios-plugins-1.4.12~/plugins/check_ups.c nagios-plugins-1.4.12/plugins/check_ups.c | ||
| 235 | --- nagios-plugins-1.4.12~/plugins/check_ups.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 236 | +++ nagios-plugins-1.4.12/plugins/check_ups.c 2008-06-03 11:19:51.000000000 +0200 | ||
| 237 | @@ -417,7 +417,7 @@ | ||
| 238 | len = strlen(ptr); | ||
| 239 | if (len > 0 && ptr[len-1] == '\n') ptr[len-1]=0; | ||
| 240 | if (strcmp (ptr, "ERR UNKNOWN-UPS") == 0) { | ||
| 241 | - printf (_("CRITICAL - no such ups '%s' on that host\n"), ups_name); | ||
| 242 | + printf (_("CRITICAL - no such UPS '%s' on that host\n"), ups_name); | ||
| 243 | return ERROR; | ||
| 244 | } | ||
| 245 | |||
| 246 | @@ -584,7 +584,7 @@ | ||
| 247 | validate_arguments (void) | ||
| 248 | { | ||
| 249 | if (! ups_name) { | ||
| 250 | - printf ("%s\n", _("Error : no ups indicated")); | ||
| 251 | + printf ("%s\n", _("Error : no UPS indicated")); | ||
| 252 | return ERROR; | ||
| 253 | } | ||
| 254 | return OK; | ||
| 255 | @@ -635,7 +635,7 @@ | ||
| 256 | printf ("%s\n", _("This plugin attempts to determine the status of a UPS (Uninterruptible Power")); | ||
| 257 | printf ("%s\n", _("Supply) on a local or remote host. If the UPS is online or calibrating, the")); | ||
| 258 | printf ("%s\n", _("plugin will return an OK state. If the battery is on it will return a WARNING")); | ||
| 259 | - printf ("%s\n", _("state.If the UPS is off or has a low battery the plugin will return a CRITICAL")); | ||
| 260 | + printf ("%s\n", _("state. If the UPS is off or has a low battery the plugin will return a CRITICAL")); | ||
| 261 | printf ("%s\n", _("state.")); | ||
| 262 | |||
| 263 | printf ("\n"); | ||
| 264 | @@ -645,7 +645,7 @@ | ||
| 265 | printf (" %s\n", _("of that variable. If the remote host has multiple UPS that are being monitored")); | ||
| 266 | printf (" %s\n", _("you will have to use the --ups option to specify which UPS to check.")); | ||
| 267 | printf ("\n"); | ||
| 268 | - printf (" %s\n", _("This plugin requires that the UPSD daemon distributed with Russel Kroll's")); | ||
| 269 | + printf (" %s\n", _("This plugin requires that the UPSD daemon distributed with Russell Kroll's")); | ||
| 270 | printf (" %s\n", _("Smart UPS Tools be installed on the remote host. If you do not have the")); | ||
| 271 | printf (" %s\n", _("package installed on your system, you can download it from")); | ||
| 272 | printf (" %s\n", _("http://www.networkupstools.org")); | ||
| 273 | diff -urNad nagios-plugins-1.4.12~/plugins/check_ups.c.rej nagios-plugins-1.4.12/plugins/check_ups.c.rej | ||
| 274 | --- nagios-plugins-1.4.12~/plugins/check_ups.c.rej 1970-01-01 01:00:00.000000000 +0100 | ||
| 275 | +++ nagios-plugins-1.4.12/plugins/check_ups.c.rej 2008-06-03 11:08:17.000000000 +0200 | ||
| 276 | @@ -0,0 +1,34 @@ | ||
| 277 | +*************** | ||
| 278 | +*** 636,642 **** | ||
| 279 | + printf ("%s\n", _("This plugin attempts to determine the status of a UPS (Uninterruptible Power")); | ||
| 280 | + printf ("%s\n", _("Supply) on a local or remote host. If the UPS is online or calibrating, the")); | ||
| 281 | + printf ("%s\n", _("plugin will return an OK state. If the battery is on it will return a WARNING")); | ||
| 282 | +- printf ("%s\n", _("state.If the UPS is off or has a low battery the plugin will return a CRITICAL")); | ||
| 283 | + printf ("%s\n\n", _("state.")); | ||
| 284 | + | ||
| 285 | + printf ("%s\n", _("You may also specify a variable to check [such as temperature, utility voltage,")); | ||
| 286 | +--- 636,642 ---- | ||
| 287 | + printf ("%s\n", _("This plugin attempts to determine the status of a UPS (Uninterruptible Power")); | ||
| 288 | + printf ("%s\n", _("Supply) on a local or remote host. If the UPS is online or calibrating, the")); | ||
| 289 | + printf ("%s\n", _("plugin will return an OK state. If the battery is on it will return a WARNING")); | ||
| 290 | ++ printf ("%s\n", _("state. If the UPS is off or has a low battery the plugin will return a CRITICAL")); | ||
| 291 | + printf ("%s\n\n", _("state.")); | ||
| 292 | + | ||
| 293 | + printf ("%s\n", _("You may also specify a variable to check [such as temperature, utility voltage,")); | ||
| 294 | +*************** | ||
| 295 | +*** 644,650 **** | ||
| 296 | + printf ("%s\n", _("that variable. If the remote host has multiple UPS that are being monitored you")); | ||
| 297 | + printf ("%s\n", _("will have to use the [ups] option to specify which UPS to check.")); | ||
| 298 | + | ||
| 299 | +- printf ("%s\n", _("This plugin requires that the UPSD daemon distributed with Russel Kroll's")); | ||
| 300 | + printf ("%s\n", _("Smart UPS Tools be installed on the remote host. If you do not have the")); | ||
| 301 | + printf ("%s\n", _("package installed on your system, you can download it from http://www.networkupstools.org")); | ||
| 302 | + | ||
| 303 | +--- 644,650 ---- | ||
| 304 | + printf ("%s\n", _("that variable. If the remote host has multiple UPS that are being monitored you")); | ||
| 305 | + printf ("%s\n", _("will have to use the [ups] option to specify which UPS to check.")); | ||
| 306 | + | ||
| 307 | ++ printf ("%s\n", _("This plugin requires that the UPSD daemon distributed with Russell Kroll's")); | ||
| 308 | + printf ("%s\n", _("Smart UPS Tools be installed on the remote host. If you do not have the")); | ||
| 309 | + printf ("%s\n", _("package installed on your system, you can download it from http://www.networkupstools.org")); | ||
| 310 | + | ||
| 311 | diff -urNad nagios-plugins-1.4.12~/plugins-scripts/check_mailq.pl nagios-plugins-1.4.12/plugins-scripts/check_mailq.pl | ||
| 312 | --- nagios-plugins-1.4.12~/plugins-scripts/check_mailq.pl 2006-07-05 15:45:57.000000000 +0200 | ||
| 313 | +++ nagios-plugins-1.4.12/plugins-scripts/check_mailq.pl 2008-06-03 11:08:17.000000000 +0200 | ||
| 314 | @@ -588,7 +588,7 @@ | ||
| 315 | print " Checks the number of messages in the mail queue (supports multiple sendmail queues, qmail)\n"; | ||
| 316 | print " Feedback/patches to support non-sendmail mailqueue welcome\n\n"; | ||
| 317 | print "-w (--warning) = Min. number of messages in queue to generate warning\n"; | ||
| 318 | - print "-c (--critical) = Min. number of messages in queu to generate critical alert ( w < c )\n"; | ||
| 319 | + print "-c (--critical) = Min. number of messages in queue to generate critical alert ( w < c )\n"; | ||
| 320 | print "-W (--Warning) = Min. number of messages for same domain in queue to generate warning\n"; | ||
| 321 | print "-C (--Critical) = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n"; | ||
| 322 | print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n"; | ||
diff --git a/web/attachments/280102-config.log.gz b/web/attachments/280102-config.log.gz new file mode 100644 index 0000000..4682716 --- /dev/null +++ b/web/attachments/280102-config.log.gz | |||
| Binary files differ | |||
diff --git a/web/attachments/280264-check_ups.diff b/web/attachments/280264-check_ups.diff new file mode 100644 index 0000000..595353e --- /dev/null +++ b/web/attachments/280264-check_ups.diff | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | === plugins/check_ups.c | ||
| 2 | ================================================================== | ||
| 3 | --- plugins/check_ups.c (revision 2) | ||
| 4 | +++ plugins/check_ups.c (revision 4) | ||
| 5 | @@ -393,13 +393,13 @@ | ||
| 6 | /* char command[MAX_INPUT_BUFFER]; */ | ||
| 7 | char temp_buffer[MAX_INPUT_BUFFER]; | ||
| 8 | char send_buffer[MAX_INPUT_BUFFER]; | ||
| 9 | - char *ptr; | ||
| 10 | + char *ptr, *end = NULL; | ||
| 11 | int len; | ||
| 12 | |||
| 13 | *buf=0; | ||
| 14 | |||
| 15 | /* create the command string to send to the UPS daemon */ | ||
| 16 | - sprintf (send_buffer, "GET VAR %s %s\n", ups_name, varname); | ||
| 17 | + sprintf (send_buffer, "GET VAR %s %s\nLOGOUT\n", ups_name, varname); | ||
| 18 | |||
| 19 | /* send the command to the daemon and get a response back */ | ||
| 20 | if (process_tcp_request | ||
| 21 | @@ -433,6 +433,9 @@ | ||
| 22 | } | ||
| 23 | |||
| 24 | ptr = temp_buffer + strlen (varname) + strlen (ups_name) + 6; | ||
| 25 | + end = strchr(ptr, '\n'); | ||
| 26 | + if (end) | ||
| 27 | + *end = 0; | ||
| 28 | len = strlen(ptr); | ||
| 29 | if (len < 2 || ptr[0] != '"' || ptr[len-1] != '"') { | ||
| 30 | printf ("%s\n", _("Error: unable to parse variable")); | ||
diff --git a/web/attachments/280286-fix_emb_check_disk_smb.diff b/web/attachments/280286-fix_emb_check_disk_smb.diff new file mode 100644 index 0000000..4079be3 --- /dev/null +++ b/web/attachments/280286-fix_emb_check_disk_smb.diff | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-5 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378824428" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378824428" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378824428" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378824428" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378824428'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1985338&group_id=29880&atid=397597&file_id=280286" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/280402-33_fix_emb_check_disk_smb.dpatch b/web/attachments/280402-33_fix_emb_check_disk_smb.dpatch new file mode 100644 index 0000000..2713e64 --- /dev/null +++ b/web/attachments/280402-33_fix_emb_check_disk_smb.dpatch | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | #! /bin/sh /usr/share/dpatch/dpatch-run | ||
| 2 | ## 32_check_ldap_pointer.dpatch by Jan Wagner <waja@cyconet.org> | ||
| 3 | ## patch provided by Stephane Chazelas <stephane@artesyncp.com> | ||
| 4 | ## | ||
| 5 | ## DP: fix processing vi embedded perl interpreter | ||
| 6 | |||
| 7 | @DPATCH@ | ||
| 8 | diff -urNad nagios-plugins-1.4.12~/plugins-scripts/check_disk_smb.pl nagios-plugins-1.4.12/plugins-scripts/check_disk_smb.pl | ||
| 9 | --- nagios-plugins-1.4.12~/plugins-scripts/check_disk_smb.pl 2008-06-06 11:57:33.000000000 +0200 | ||
| 10 | +++ nagios-plugins-1.4.12/plugins-scripts/check_disk_smb.pl 2008-06-06 11:58:03.000000000 +0200 | ||
| 11 | @@ -65,27 +65,27 @@ | ||
| 12 | |||
| 13 | # Options checking | ||
| 14 | |||
| 15 | -($opt_H) || ($opt_H = shift) || usage("Host name not specified\n"); | ||
| 16 | +($opt_H) || ($opt_H = shift @ARGV) || usage("Host name not specified\n"); | ||
| 17 | my $host = $1 if ($opt_H =~ /^([-_.A-Za-z0-9 ]+\$?)$/); | ||
| 18 | ($host) || usage("Invalid host: $opt_H\n"); | ||
| 19 | |||
| 20 | -($opt_s) || ($opt_s = shift) || usage("Share volume not specified\n"); | ||
| 21 | +($opt_s) || ($opt_s = shift @ARGV) || usage("Share volume not specified\n"); | ||
| 22 | my $share = $1 if ($opt_s =~ /^([-_.A-Za-z0-9]+\$?)$/); | ||
| 23 | ($share) || usage("Invalid share: $opt_s\n"); | ||
| 24 | |||
| 25 | -($opt_u) || ($opt_u = shift) || ($opt_u = "guest"); | ||
| 26 | +($opt_u) || ($opt_u = shift @ARGV) || ($opt_u = "guest"); | ||
| 27 | my $user = $1 if ($opt_u =~ /^([-_.A-Za-z0-9\\]+)$/); | ||
| 28 | ($user) || usage("Invalid user: $opt_u\n"); | ||
| 29 | |||
| 30 | -($opt_p) || ($opt_p = shift) || ($opt_p = ""); | ||
| 31 | +($opt_p) || ($opt_p = shift @ARGV) || ($opt_p = ""); | ||
| 32 | my $pass = $1 if ($opt_p =~ /(.*)/); | ||
| 33 | $pass = "-N" if ($opt_p eq ""); | ||
| 34 | |||
| 35 | -($opt_w) || ($opt_w = shift) || ($opt_w = 85); | ||
| 36 | +($opt_w) || ($opt_w = shift @ARGV) || ($opt_w = 85); | ||
| 37 | my $warn = $1 if ($opt_w =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/); | ||
| 38 | ($warn) || usage("Invalid warning threshold: $opt_w\n"); | ||
| 39 | |||
| 40 | -($opt_c) || ($opt_c = shift) || ($opt_c = 95); | ||
| 41 | +($opt_c) || ($opt_c = shift @ARGV) || ($opt_c = 95); | ||
| 42 | my $crit = $1 if ($opt_c =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/); | ||
| 43 | ($crit) || usage("Invalid critical threshold: $opt_c\n"); | ||
| 44 | |||
diff --git a/web/attachments/280406-34_fix_smbclient_check_disk_smb.dpatch b/web/attachments/280406-34_fix_smbclient_check_disk_smb.dpatch new file mode 100644 index 0000000..a6867a1 --- /dev/null +++ b/web/attachments/280406-34_fix_smbclient_check_disk_smb.dpatch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-2 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378824398" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378824398" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378824398" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378824398" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378824398'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=1986260&group_id=29880&atid=397597&file_id=280406" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/280540-check_radius.c.diff b/web/attachments/280540-check_radius.c.diff new file mode 100644 index 0000000..94052ab --- /dev/null +++ b/web/attachments/280540-check_radius.c.diff | |||
| @@ -0,0 +1,95 @@ | |||
| 1 | --- nagios-plugins-1.4.12.orig/plugins/check_radius.c 2008-06-06 13:54:31.000000000 +0200 | ||
| 2 | +++ nagios-plugins-1.4.12/plugins/check_radius.c 2008-06-06 14:08:00.000000000 +0200 | ||
| 3 | @@ -73,6 +73,7 @@ | ||
| 4 | char *username = NULL; | ||
| 5 | char *password = NULL; | ||
| 6 | char *nasid = NULL; | ||
| 7 | +char *nasipaddress = NULL; | ||
| 8 | char *expect = NULL; | ||
| 9 | char *config_file = NULL; | ||
| 10 | unsigned short port = PW_AUTH_UDP_PORT; | ||
| 11 | @@ -173,19 +174,26 @@ | ||
| 12 | memset (&data, 0, sizeof(data)); | ||
| 13 | if (!(my_rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) && | ||
| 14 | my_rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) && | ||
| 15 | - my_rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) && | ||
| 16 | - (nasid==NULL || my_rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0)))) | ||
| 17 | + my_rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) | ||
| 18 | + )) | ||
| 19 | die (STATE_UNKNOWN, _("Out of Memory?")); | ||
| 20 | |||
| 21 | - /* | ||
| 22 | - * Fill in NAS-IP-Address | ||
| 23 | - */ | ||
| 24 | - | ||
| 25 | - if ((client_id = my_rc_own_ipaddress ()) == 0) | ||
| 26 | - return (ERROR_RC); | ||
| 27 | + if (nasid != NULL) { | ||
| 28 | + if (!(my_rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0))) | ||
| 29 | + die (STATE_UNKNOWN, _("Invalid NAS-Identifier")); | ||
| 30 | + } | ||
| 31 | |||
| 32 | - if (my_rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == | ||
| 33 | - NULL) return (ERROR_RC); | ||
| 34 | + if (nasipaddress != NULL) { | ||
| 35 | + if (rc_good_ipaddr (nasipaddress)) | ||
| 36 | + die (STATE_UNKNOWN, _("Invalid NAS-IP-Address")); | ||
| 37 | + if ((client_id = rc_get_ipaddr(nasipaddress)) == 0) | ||
| 38 | + die (STATE_UNKNOWN, _("Invalid NAS-IP-Address")); | ||
| 39 | + } else { | ||
| 40 | + if ((client_id = my_rc_own_ipaddress ()) == 0) | ||
| 41 | + die (STATE_UNKNOWN, _("Can't find local IP for NAS-IP-Address")); | ||
| 42 | + } | ||
| 43 | + if (my_rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == NULL) | ||
| 44 | + die (STATE_UNKNOWN, _("Invalid NAS-IP-Address")); | ||
| 45 | |||
| 46 | my_rc_buildreq (&data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval, | ||
| 47 | retries); | ||
| 48 | @@ -223,6 +231,7 @@ | ||
| 49 | {"username", required_argument, 0, 'u'}, | ||
| 50 | {"password", required_argument, 0, 'p'}, | ||
| 51 | {"nas-id", required_argument, 0, 'n'}, | ||
| 52 | + {"nas-ip-address", required_argument, 0, 'N'}, | ||
| 53 | {"filename", required_argument, 0, 'F'}, | ||
| 54 | {"expect", required_argument, 0, 'e'}, | ||
| 55 | {"retries", required_argument, 0, 'r'}, | ||
| 56 | @@ -234,7 +243,7 @@ | ||
| 57 | }; | ||
| 58 | |||
| 59 | while (1) { | ||
| 60 | - c = getopt_long (argc, argv, "+hVvH:P:F:u:p:n:t:r:e:", longopts, | ||
| 61 | + c = getopt_long (argc, argv, "+hVvH:P:F:u:p:n:N:t:r:e:", longopts, | ||
| 62 | &option); | ||
| 63 | |||
| 64 | if (c == -1 || c == EOF || c == 1) | ||
| 65 | @@ -279,6 +288,9 @@ | ||
| 66 | case 'n': /* nas id */ | ||
| 67 | nasid = optarg; | ||
| 68 | break; | ||
| 69 | + case 'N': /* nas ip address */ | ||
| 70 | + nasipaddress = optarg; | ||
| 71 | + break; | ||
| 72 | case 'F': /* configuration file */ | ||
| 73 | config_file = optarg; | ||
| 74 | break; | ||
| 75 | @@ -342,6 +354,8 @@ | ||
| 76 | printf (" %s\n", _("Password for autentication (SECURITY RISK)")); | ||
| 77 | printf (" %s\n", "-n, --nas-id=STRING"); | ||
| 78 | printf (" %s\n", _("NAS identifier")); | ||
| 79 | + printf (" %s\n", "-N, --nas-ip-address=STRING"); | ||
| 80 | + printf (" %s\n", _("NAS IP Address")); | ||
| 81 | printf (" %s\n", "-F, --filename=STRING"); | ||
| 82 | printf (" %s\n", _("Configuration file")); | ||
| 83 | printf (" %s\n", "-e, --expect=STRING"); | ||
| 84 | @@ -377,8 +391,9 @@ | ||
| 85 | print_usage (void) | ||
| 86 | { | ||
| 87 | printf (_("Usage:")); | ||
| 88 | - printf ("%s -H host -F config_file -u username -p password [-n nas-id] [-P port]\n\ | ||
| 89 | - [-t timeout] [-r retries] [-e expect]\n", progname); | ||
| 90 | + printf ("%s -H host -F config_file -u username -p password\n\ | ||
| 91 | + [-P port] [-t timeout] [-r retries] [-e expect]\n\ | ||
| 92 | + [-n nas-id] [-N nas-ip-addr]\n", progname); | ||
| 93 | } | ||
| 94 | |||
| 95 | |||
diff --git a/web/attachments/281050-check_ping_countermeasures.patch b/web/attachments/281050-check_ping_countermeasures.patch new file mode 100644 index 0000000..ce62a42 --- /dev/null +++ b/web/attachments/281050-check_ping_countermeasures.patch | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | --- nagios-plugins-1.4.6-modified/plugins/check_ping.c 2008-06-11 10:08:35.000000000 -0400 | ||
| 2 | +++ nagios-plugins-1.4.6/plugins/check_ping.c 2008-06-11 10:07:08.000000000 -0400 | ||
| 3 | @@ -470,11 +470,7 @@ run_ping (const char *cmd, const char *a | ||
| 4 | /* check stderr, setting at least WARNING if there is output here */ | ||
| 5 | /* Add warning into warn_text */ | ||
| 6 | while (fgets (buf, MAX_INPUT_BUFFER - 1, child_stderr)) { | ||
| 7 | - if ( | ||
| 8 | - ! strstr(buf,"WARNING - no SO_TIMESTAMP support, falling back to SIOCGSTAMP") | ||
| 9 | - && ! strstr(buf,"Warning: time of day goes back") | ||
| 10 | - | ||
| 11 | - ) { | ||
| 12 | + if (! strstr(buf,"WARNING - no SO_TIMESTAMP support, falling back to SIOCGSTAMP")) { | ||
| 13 | if (verbose >= 3) { | ||
| 14 | printf("Got stderr: %s", buf); | ||
| 15 | } | ||
diff --git a/web/attachments/281911-check_http.c.diff b/web/attachments/281911-check_http.c.diff new file mode 100644 index 0000000..a29dd37 --- /dev/null +++ b/web/attachments/281911-check_http.c.diff | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | --- check_http.c~ 2008-06-19 11:42:25.000000000 +0200 | ||
| 2 | +++ check_http.c 2008-06-19 11:42:25.000000000 +0200 | ||
| 3 | @@ -912,11 +912,12 @@ | ||
| 4 | if (!strstr (status_line, server_expect)) { | ||
| 5 | if (server_port == HTTP_PORT) | ||
| 6 | asprintf (&msg, | ||
| 7 | - _("Invalid HTTP response received from host\n")); | ||
| 8 | + _("Invalid HTTP response received from host: %s\n"), | ||
| 9 | + status_line); | ||
| 10 | else | ||
| 11 | asprintf (&msg, | ||
| 12 | - _("Invalid HTTP response received from host on port %d\n"), | ||
| 13 | - server_port); | ||
| 14 | + _("Invalid HTTP response received from host on port %d: %s\n"), | ||
| 15 | + server_port, status_line); | ||
| 16 | die (STATE_CRITICAL, "%s", msg); | ||
| 17 | } | ||
| 18 | |||
diff --git a/web/attachments/282489-check_icmp.c b/web/attachments/282489-check_icmp.c new file mode 100644 index 0000000..2c8f121 --- /dev/null +++ b/web/attachments/282489-check_icmp.c | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-7 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378823484" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378823484" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378823484" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378823484" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378823484'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=2001832&group_id=29880&atid=397599&file_id=282489" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/282511-check_icmp.c b/web/attachments/282511-check_icmp.c new file mode 100644 index 0000000..fc59f2a --- /dev/null +++ b/web/attachments/282511-check_icmp.c | |||
| @@ -0,0 +1,1301 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | * | ||
| 3 | * Nagios check_icmp plugin | ||
| 4 | * | ||
| 5 | * License: GPL | ||
| 6 | * Copyright (c) 2005-2007 nagios-plugins team | ||
| 7 | * | ||
| 8 | * Original Author : Andreas Ericsson <ae@op5.se> | ||
| 9 | * | ||
| 10 | * set TOS-bist (-T): Georg von Zengen <gvz@ciphron.de> | ||
| 11 | * | ||
| 12 | * Last Modified: $Date: 2008-06-24 17:06:35 +0000 (Tue, 24 JUN 2008) $ | ||
| 13 | * | ||
| 14 | * Description: | ||
| 15 | * | ||
| 16 | * This file contains the check_icmp plugin | ||
| 17 | * | ||
| 18 | * Relevant RFC's: 792 (ICMP), 791 (IP) | ||
| 19 | * | ||
| 20 | * This program was modeled somewhat after the check_icmp program, | ||
| 21 | * which was in turn a hack of fping (www.fping.org) but has been | ||
| 22 | * completely rewritten since to generate higher precision rta values, | ||
| 23 | * and support several different modes as well as setting ttl to control. | ||
| 24 | * redundant routes. The only remainders of fping is currently a few | ||
| 25 | * function names. | ||
| 26 | * | ||
| 27 | * License Information: | ||
| 28 | * | ||
| 29 | * This program is free software; you can redistribute it and/or modify | ||
| 30 | * it under the terms of the GNU General Public License as published by | ||
| 31 | * the Free Software Foundation; either version 2 of the License, or | ||
| 32 | * (at your option) any later version. | ||
| 33 | * | ||
| 34 | * This program is distributed in the hope that it will be useful, | ||
| 35 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 36 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 37 | * GNU General Public License for more details. | ||
| 38 | * | ||
| 39 | * You should have received a copy of the GNU General Public License | ||
| 40 | * along with this program; if not, write to the Free Software | ||
| 41 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 42 | * | ||
| 43 | * $Id: check_icmp.c 1861 2007-12-11 05:57:35Z dermoth $ | ||
| 44 | * | ||
| 45 | *****************************************************************************/ | ||
| 46 | |||
| 47 | /* progname may change */ | ||
| 48 | /* char *progname = "check_icmp"; */ | ||
| 49 | char *progname; | ||
| 50 | const char *revision = "$Revision: 1861 $"; | ||
| 51 | const char *copyright = "2005-2007"; | ||
| 52 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 53 | |||
| 54 | /** nagios plugins basic includes */ | ||
| 55 | #include "common.h" | ||
| 56 | #include "netutils.h" | ||
| 57 | #include "utils.h" | ||
| 58 | |||
| 59 | #include <sys/time.h> | ||
| 60 | #include <sys/types.h> | ||
| 61 | #include <stdio.h> | ||
| 62 | #include <stdlib.h> | ||
| 63 | #include <stdarg.h> | ||
| 64 | #include <unistd.h> | ||
| 65 | #include <stddef.h> | ||
| 66 | #include <errno.h> | ||
| 67 | #include <string.h> | ||
| 68 | #include <ctype.h> | ||
| 69 | #include <netdb.h> | ||
| 70 | #include <sys/socket.h> | ||
| 71 | #include <netinet/in_systm.h> | ||
| 72 | #include <netinet/in.h> | ||
| 73 | #include <netinet/ip.h> | ||
| 74 | #include <netinet/ip_icmp.h> | ||
| 75 | #include <arpa/inet.h> | ||
| 76 | #include <signal.h> | ||
| 77 | |||
| 78 | |||
| 79 | /** sometimes undefined system macros (quite a few, actually) **/ | ||
| 80 | #ifndef MAXTTL | ||
| 81 | # define MAXTTL 255 | ||
| 82 | #endif | ||
| 83 | #ifndef INADDR_NONE | ||
| 84 | # define INADDR_NONE 0xffffffU | ||
| 85 | #endif | ||
| 86 | |||
| 87 | #ifndef SOL_IP | ||
| 88 | #define SOL_IP 0 | ||
| 89 | #endif | ||
| 90 | |||
| 91 | /* we bundle these in one #ifndef, since they're all from BSD | ||
| 92 | * Put individual #ifndef's around those that bother you */ | ||
| 93 | #ifndef ICMP_UNREACH_NET_UNKNOWN | ||
| 94 | # define ICMP_UNREACH_NET_UNKNOWN 6 | ||
| 95 | # define ICMP_UNREACH_HOST_UNKNOWN 7 | ||
| 96 | # define ICMP_UNREACH_ISOLATED 8 | ||
| 97 | # define ICMP_UNREACH_NET_PROHIB 9 | ||
| 98 | # define ICMP_UNREACH_HOST_PROHIB 10 | ||
| 99 | # define ICMP_UNREACH_TOSNET 11 | ||
| 100 | # define ICMP_UNREACH_TOSHOST 12 | ||
| 101 | #endif | ||
| 102 | /* tru64 has the ones above, but not these */ | ||
| 103 | #ifndef ICMP_UNREACH_FILTER_PROHIB | ||
| 104 | # define ICMP_UNREACH_FILTER_PROHIB 13 | ||
| 105 | # define ICMP_UNREACH_HOST_PRECEDENCE 14 | ||
| 106 | # define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 | ||
| 107 | #endif | ||
| 108 | |||
| 109 | |||
| 110 | typedef unsigned short range_t; /* type for get_range() -- unimplemented */ | ||
| 111 | |||
| 112 | typedef struct rta_host { | ||
| 113 | unsigned short id; /* id in **table, and icmp pkts */ | ||
| 114 | char *name; /* arg used for adding this host */ | ||
| 115 | char *msg; /* icmp error message, if any */ | ||
| 116 | struct sockaddr_in saddr_in; /* the address of this host */ | ||
| 117 | struct in_addr error_addr; /* stores address of error replies */ | ||
| 118 | unsigned long long time_waited; /* total time waited, in usecs */ | ||
| 119 | unsigned int icmp_sent, icmp_recv, icmp_lost; /* counters */ | ||
| 120 | unsigned char icmp_type, icmp_code; /* type and code from errors */ | ||
| 121 | unsigned short flags; /* control/status flags */ | ||
| 122 | double rta; /* measured RTA */ | ||
| 123 | unsigned char pl; /* measured packet loss */ | ||
| 124 | struct rta_host *next; /* linked list */ | ||
| 125 | } rta_host; | ||
| 126 | |||
| 127 | #define FLAG_LOST_CAUSE 0x01 /* decidedly dead target. */ | ||
| 128 | |||
| 129 | /* threshold structure. all values are maximum allowed, exclusive */ | ||
| 130 | typedef struct threshold { | ||
| 131 | unsigned char pl; /* max allowed packet loss in percent */ | ||
| 132 | unsigned int rta; /* roundtrip time average, microseconds */ | ||
| 133 | } threshold; | ||
| 134 | |||
| 135 | /* the data structure */ | ||
| 136 | typedef struct icmp_ping_data { | ||
| 137 | struct timeval stime; /* timestamp (saved in protocol struct as well) */ | ||
| 138 | unsigned short ping_id; | ||
| 139 | } icmp_ping_data; | ||
| 140 | |||
| 141 | /* the different modes of this program are as follows: | ||
| 142 | * MODE_RTA: send all packets no matter what (mimic check_icmp and check_ping) | ||
| 143 | * MODE_HOSTCHECK: Return immediately upon any sign of life | ||
| 144 | * In addition, sends packets to ALL addresses assigned | ||
| 145 | * to this host (as returned by gethostbyname() or | ||
| 146 | * gethostbyaddr() and expects one host only to be checked at | ||
| 147 | * a time. Therefore, any packet response what so ever will | ||
| 148 | * count as a sign of life, even when received outside | ||
| 149 | * crit.rta limit. Do not misspell any additional IP's. | ||
| 150 | * MODE_ALL: Requires packets from ALL requested IP to return OK (default). | ||
| 151 | * MODE_ICMP: implement something similar to check_icmp (MODE_RTA without | ||
| 152 | * tcp and udp args does this) | ||
| 153 | */ | ||
| 154 | #define MODE_RTA 0 | ||
| 155 | #define MODE_HOSTCHECK 1 | ||
| 156 | #define MODE_ALL 2 | ||
| 157 | #define MODE_ICMP 3 | ||
| 158 | |||
| 159 | /* the different ping types we can do | ||
| 160 | * TODO: investigate ARP ping as well */ | ||
| 161 | #define HAVE_ICMP 1 | ||
| 162 | #define HAVE_UDP 2 | ||
| 163 | #define HAVE_TCP 4 | ||
| 164 | #define HAVE_ARP 8 | ||
| 165 | |||
| 166 | #define MIN_PING_DATA_SIZE sizeof(struct icmp_ping_data) | ||
| 167 | #define MAX_IP_PKT_SIZE 65536 /* (theoretical) max IP packet size */ | ||
| 168 | #define IP_HDR_SIZE 20 | ||
| 169 | #define MAX_PING_DATA (MAX_IP_PKT_SIZE - IP_HDR_SIZE - ICMP_MINLEN) | ||
| 170 | #define DEFAULT_PING_DATA_SIZE (MIN_PING_DATA_SIZE + 44) | ||
| 171 | |||
| 172 | /* various target states */ | ||
| 173 | #define TSTATE_INACTIVE 0x01 /* don't ping this host anymore */ | ||
| 174 | #define TSTATE_WAITING 0x02 /* unanswered packets on the wire */ | ||
| 175 | #define TSTATE_ALIVE 0x04 /* target is alive (has answered something) */ | ||
| 176 | #define TSTATE_UNREACH 0x08 | ||
| 177 | |||
| 178 | /** prototypes **/ | ||
| 179 | void print_help (void); | ||
| 180 | void print_usage (void); | ||
| 181 | static u_int get_timevar(const char *); | ||
| 182 | static u_int get_timevaldiff(struct timeval *, struct timeval *); | ||
| 183 | static int wait_for_reply(int, u_int); | ||
| 184 | static int recvfrom_wto(int, char *, unsigned int, struct sockaddr *, u_int *); | ||
| 185 | static int send_icmp_ping(int, struct rta_host *); | ||
| 186 | static int get_threshold(char *str, threshold *th); | ||
| 187 | static void run_checks(void); | ||
| 188 | static int add_target(char *); | ||
| 189 | static int add_target_ip(char *, struct in_addr *); | ||
| 190 | static int handle_random_icmp(struct icmp *, struct sockaddr_in *); | ||
| 191 | static unsigned short icmp_checksum(unsigned short *, int); | ||
| 192 | static void finish(int); | ||
| 193 | static void crash(const char *, ...); | ||
| 194 | |||
| 195 | /** external **/ | ||
| 196 | extern int optind, opterr, optopt; | ||
| 197 | extern char *optarg; | ||
| 198 | extern char **environ; | ||
| 199 | |||
| 200 | /** global variables **/ | ||
| 201 | static struct rta_host **table, *cursor, *list; | ||
| 202 | static threshold crit = {80, 500000}, warn = {40, 200000}; | ||
| 203 | static int mode, protocols, sockets, debug = 0, timeout = 10; | ||
| 204 | static unsigned short icmp_pkt_size, icmp_data_size = DEFAULT_PING_DATA_SIZE; | ||
| 205 | static unsigned int icmp_sent = 0, icmp_recv = 0, icmp_lost = 0; | ||
| 206 | #define icmp_pkts_en_route (icmp_sent - (icmp_recv + icmp_lost)) | ||
| 207 | static unsigned short targets_down = 0, targets = 0, packets = 0; | ||
| 208 | #define targets_alive (targets - targets_down) | ||
| 209 | static unsigned int retry_interval, pkt_interval, target_interval; | ||
| 210 | static int icmp_sock, tcp_sock, udp_sock, status = STATE_OK; | ||
| 211 | static pid_t pid; | ||
| 212 | static struct timezone tz; | ||
| 213 | static struct timeval prog_start; | ||
| 214 | static unsigned long long max_completion_time = 0; | ||
| 215 | static unsigned char ttl = 0; /* outgoing ttl */ | ||
| 216 | static unsigned int warn_down = 1, crit_down = 1; /* host down threshold values */ | ||
| 217 | static int min_hosts_alive = -1; | ||
| 218 | float pkt_backoff_factor = 1.5; | ||
| 219 | float target_backoff_factor = 1.5; | ||
| 220 | int tos=0; | ||
| 221 | /** code start **/ | ||
| 222 | static void | ||
| 223 | crash(const char *fmt, ...) | ||
| 224 | { | ||
| 225 | va_list ap; | ||
| 226 | |||
| 227 | printf("%s: ", progname); | ||
| 228 | |||
| 229 | va_start(ap, fmt); | ||
| 230 | vprintf(fmt, ap); | ||
| 231 | va_end(ap); | ||
| 232 | |||
| 233 | if(errno) printf(": %s", strerror(errno)); | ||
| 234 | puts(""); | ||
| 235 | |||
| 236 | exit(3); | ||
| 237 | } | ||
| 238 | |||
| 239 | |||
| 240 | static char * | ||
| 241 | get_icmp_error_msg(unsigned char icmp_type, unsigned char icmp_code) | ||
| 242 | { | ||
| 243 | char *msg = "unreachable"; | ||
| 244 | |||
| 245 | if(debug > 1) printf("get_icmp_error_msg(%u, %u)\n", icmp_type, icmp_code); | ||
| 246 | switch(icmp_type) { | ||
| 247 | case ICMP_UNREACH: | ||
| 248 | switch(icmp_code) { | ||
| 249 | case ICMP_UNREACH_NET: msg = "Net unreachable"; break; | ||
| 250 | case ICMP_UNREACH_HOST: msg = "Host unreachable"; break; | ||
| 251 | case ICMP_UNREACH_PROTOCOL: msg = "Protocol unreachable (firewall?)"; break; | ||
| 252 | case ICMP_UNREACH_PORT: msg = "Port unreachable (firewall?)"; break; | ||
| 253 | case ICMP_UNREACH_NEEDFRAG: msg = "Fragmentation needed"; break; | ||
| 254 | case ICMP_UNREACH_SRCFAIL: msg = "Source route failed"; break; | ||
| 255 | case ICMP_UNREACH_ISOLATED: msg = "Source host isolated"; break; | ||
| 256 | case ICMP_UNREACH_NET_UNKNOWN: msg = "Unknown network"; break; | ||
| 257 | case ICMP_UNREACH_HOST_UNKNOWN: msg = "Unknown host"; break; | ||
| 258 | case ICMP_UNREACH_NET_PROHIB: msg = "Network denied (firewall?)"; break; | ||
| 259 | case ICMP_UNREACH_HOST_PROHIB: msg = "Host denied (firewall?)"; break; | ||
| 260 | case ICMP_UNREACH_TOSNET: msg = "Bad TOS for network (firewall?)"; break; | ||
| 261 | case ICMP_UNREACH_TOSHOST: msg = "Bad TOS for host (firewall?)"; break; | ||
| 262 | case ICMP_UNREACH_FILTER_PROHIB: msg = "Prohibited by filter (firewall)"; break; | ||
| 263 | case ICMP_UNREACH_HOST_PRECEDENCE: msg = "Host precedence violation"; break; | ||
| 264 | case ICMP_UNREACH_PRECEDENCE_CUTOFF: msg = "Precedence cutoff"; break; | ||
| 265 | default: msg = "Invalid code"; break; | ||
| 266 | } | ||
| 267 | break; | ||
| 268 | |||
| 269 | case ICMP_TIMXCEED: | ||
| 270 | /* really 'out of reach', or non-existant host behind a router serving | ||
| 271 | * two different subnets */ | ||
| 272 | switch(icmp_code) { | ||
| 273 | case ICMP_TIMXCEED_INTRANS: msg = "Time to live exceeded in transit"; break; | ||
| 274 | case ICMP_TIMXCEED_REASS: msg = "Fragment reassembly time exceeded"; break; | ||
| 275 | default: msg = "Invalid code"; break; | ||
| 276 | } | ||
| 277 | break; | ||
| 278 | |||
| 279 | case ICMP_SOURCEQUENCH: msg = "Transmitting too fast"; break; | ||
| 280 | case ICMP_REDIRECT: msg = "Redirect (change route)"; break; | ||
| 281 | case ICMP_PARAMPROB: msg = "Bad IP header (required option absent)"; break; | ||
| 282 | |||
| 283 | /* the following aren't error messages, so ignore */ | ||
| 284 | case ICMP_TSTAMP: | ||
| 285 | case ICMP_TSTAMPREPLY: | ||
| 286 | case ICMP_IREQ: | ||
| 287 | case ICMP_IREQREPLY: | ||
| 288 | case ICMP_MASKREQ: | ||
| 289 | case ICMP_MASKREPLY: | ||
| 290 | default: msg = ""; break; | ||
| 291 | } | ||
| 292 | |||
| 293 | return msg; | ||
| 294 | } | ||
| 295 | |||
| 296 | static int | ||
| 297 | handle_random_icmp(struct icmp *p, struct sockaddr_in *addr) | ||
| 298 | { | ||
| 299 | struct icmp sent_icmp; | ||
| 300 | struct rta_host *host = NULL; | ||
| 301 | unsigned char *ptr; | ||
| 302 | |||
| 303 | if(p->icmp_type == ICMP_ECHO && p->icmp_id == pid) { | ||
| 304 | /* echo request from us to us (pinging localhost) */ | ||
| 305 | return 0; | ||
| 306 | } | ||
| 307 | |||
| 308 | ptr = (unsigned char *)p; | ||
| 309 | if(debug) printf("handle_random_icmp(%p, %p)\n", (void *)p, (void *)addr); | ||
| 310 | |||
| 311 | /* only handle a few types, since others can't possibly be replies to | ||
| 312 | * us in a sane network (if it is anyway, it will be counted as lost | ||
| 313 | * at summary time, but not as quickly as a proper response */ | ||
| 314 | /* TIMXCEED can be an unreach from a router with multiple IP's which | ||
| 315 | * serves two different subnets on the same interface and a dead host | ||
| 316 | * on one net is pinged from the other. The router will respond to | ||
| 317 | * itself and thus set TTL=0 so as to not loop forever. Even when | ||
| 318 | * TIMXCEED actually sends a proper icmp response we will have passed | ||
| 319 | * too many hops to have a hope of reaching it later, in which case it | ||
| 320 | * indicates overconfidence in the network, poor routing or both. */ | ||
| 321 | if(p->icmp_type != ICMP_UNREACH && p->icmp_type != ICMP_TIMXCEED && | ||
| 322 | p->icmp_type != ICMP_SOURCEQUENCH && p->icmp_type != ICMP_PARAMPROB) | ||
| 323 | { | ||
| 324 | return 0; | ||
| 325 | } | ||
| 326 | |||
| 327 | /* might be for us. At least it holds the original package (according | ||
| 328 | * to RFC 792). If it isn't, just ignore it */ | ||
| 329 | memcpy(&sent_icmp, ptr + 28, sizeof(sent_icmp)); | ||
| 330 | if(sent_icmp.icmp_type != ICMP_ECHO || sent_icmp.icmp_id != pid || | ||
| 331 | sent_icmp.icmp_seq >= targets) | ||
| 332 | { | ||
| 333 | if(debug) printf("Packet is no response to a packet we sent\n"); | ||
| 334 | return 0; | ||
| 335 | } | ||
| 336 | |||
| 337 | /* it is indeed a response for us */ | ||
| 338 | host = table[sent_icmp.icmp_seq]; | ||
| 339 | if(debug) { | ||
| 340 | printf("Received \"%s\" from %s for ICMP ECHO sent to %s.\n", | ||
| 341 | get_icmp_error_msg(p->icmp_type, p->icmp_code), | ||
| 342 | inet_ntoa(addr->sin_addr), host->name); | ||
| 343 | } | ||
| 344 | |||
| 345 | icmp_lost++; | ||
| 346 | host->icmp_lost++; | ||
| 347 | /* don't spend time on lost hosts any more */ | ||
| 348 | if(host->flags & FLAG_LOST_CAUSE) return 0; | ||
| 349 | |||
| 350 | /* source quench means we're sending too fast, so increase the | ||
| 351 | * interval and mark this packet lost */ | ||
| 352 | if(p->icmp_type == ICMP_SOURCEQUENCH) { | ||
| 353 | pkt_interval *= pkt_backoff_factor; | ||
| 354 | target_interval *= target_backoff_factor; | ||
| 355 | } | ||
| 356 | else { | ||
| 357 | targets_down++; | ||
| 358 | host->flags |= FLAG_LOST_CAUSE; | ||
| 359 | } | ||
| 360 | host->icmp_type = p->icmp_type; | ||
| 361 | host->icmp_code = p->icmp_code; | ||
| 362 | host->error_addr.s_addr = addr->sin_addr.s_addr; | ||
| 363 | |||
| 364 | return 0; | ||
| 365 | } | ||
| 366 | |||
| 367 | int | ||
| 368 | main(int argc, char **argv) | ||
| 369 | { | ||
| 370 | int i; | ||
| 371 | char *ptr; | ||
| 372 | long int arg; | ||
| 373 | int icmp_sockerrno, udp_sockerrno, tcp_sockerrno; | ||
| 374 | int result; | ||
| 375 | struct rta_host *host; | ||
| 376 | |||
| 377 | setlocale (LC_ALL, ""); | ||
| 378 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 379 | textdomain (PACKAGE); | ||
| 380 | |||
| 381 | /* print a helpful error message if geteuid != 0 */ | ||
| 382 | np_warn_if_not_root(); | ||
| 383 | |||
| 384 | /* we only need to be setsuid when we get the sockets, so do | ||
| 385 | * that before pointer magic (esp. on network data) */ | ||
| 386 | icmp_sockerrno = udp_sockerrno = tcp_sockerrno = sockets = 0; | ||
| 387 | |||
| 388 | if((icmp_sock = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP)) != -1) | ||
| 389 | sockets |= HAVE_ICMP; | ||
| 390 | else icmp_sockerrno = errno; | ||
| 391 | |||
| 392 | /* if((udp_sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) != -1) */ | ||
| 393 | /* sockets |= HAVE_UDP; */ | ||
| 394 | /* else udp_sockerrno = errno; */ | ||
| 395 | |||
| 396 | /* if((tcp_sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) != -1) */ | ||
| 397 | /* sockets |= HAVE_TCP; */ | ||
| 398 | /* else tcp_sockerrno = errno; */ | ||
| 399 | |||
| 400 | /* now drop privileges (no effect if not setsuid or geteuid() == 0) */ | ||
| 401 | setuid(getuid()); | ||
| 402 | |||
| 403 | /* POSIXLY_CORRECT might break things, so unset it (the portable way) */ | ||
| 404 | environ = NULL; | ||
| 405 | |||
| 406 | /* use the pid to mark packets as ours */ | ||
| 407 | /* Some systems have 32-bit pid_t so mask off only 16 bits */ | ||
| 408 | pid = getpid() & 0xffff; | ||
| 409 | /* printf("pid = %u\n", pid); */ | ||
| 410 | |||
| 411 | /* get calling name the old-fashioned way for portability instead | ||
| 412 | * of relying on the glibc-ism __progname */ | ||
| 413 | ptr = strrchr(argv[0], '/'); | ||
| 414 | if(ptr) progname = &ptr[1]; | ||
| 415 | else progname = argv[0]; | ||
| 416 | |||
| 417 | /* now set defaults. Use progname to set them initially (allows for | ||
| 418 | * superfast check_host program when target host is up */ | ||
| 419 | cursor = list = NULL; | ||
| 420 | table = NULL; | ||
| 421 | |||
| 422 | mode = MODE_RTA; | ||
| 423 | crit.rta = 500000; | ||
| 424 | crit.pl = 80; | ||
| 425 | warn.rta = 200000; | ||
| 426 | warn.pl = 40; | ||
| 427 | protocols = HAVE_ICMP | HAVE_UDP | HAVE_TCP; | ||
| 428 | pkt_interval = 80000; /* 80 msec packet interval by default */ | ||
| 429 | packets = 5; | ||
| 430 | |||
| 431 | if(!strcmp(progname, "check_icmp") || !strcmp(progname, "check_ping")) { | ||
| 432 | mode = MODE_ICMP; | ||
| 433 | protocols = HAVE_ICMP; | ||
| 434 | } | ||
| 435 | else if(!strcmp(progname, "check_host")) { | ||
| 436 | mode = MODE_HOSTCHECK; | ||
| 437 | pkt_interval = 1000000; | ||
| 438 | packets = 5; | ||
| 439 | crit.rta = warn.rta = 1000000; | ||
| 440 | crit.pl = warn.pl = 100; | ||
| 441 | } | ||
| 442 | else if(!strcmp(progname, "check_rta_multi")) { | ||
| 443 | mode = MODE_ALL; | ||
| 444 | target_interval = 0; | ||
| 445 | pkt_interval = 50000; | ||
| 446 | packets = 5; | ||
| 447 | } | ||
| 448 | |||
| 449 | /* parse the arguments */ | ||
| 450 | for(i = 1; i < argc; i++) { | ||
| 451 | while((arg = getopt(argc, argv, "vhVw:c:n:p:t:H:i:b:I:l:m:T:")) != EOF) { | ||
| 452 | switch(arg) { | ||
| 453 | case 'T': | ||
| 454 | //tos = strtoul(optarg, NULL, 0); | ||
| 455 | sscanf(optarg,"%x",&tos); | ||
| 456 | if (tos > 0xff){ | ||
| 457 | crash("value of -T must not be greater than 0xFF\n"); | ||
| 458 | } | ||
| 459 | if(tos < 0){ | ||
| 460 | crash("value of -T must be greater than 0x00\n"); | ||
| 461 | } | ||
| 462 | //tos = xtoi(tos, NULL, 0); | ||
| 463 | // printf("\n%d\n",tos); | ||
| 464 | break; | ||
| 465 | case 'v': | ||
| 466 | debug++; | ||
| 467 | break; | ||
| 468 | case 'b': | ||
| 469 | /* silently ignored for now */ | ||
| 470 | break; | ||
| 471 | case 'i': | ||
| 472 | pkt_interval = get_timevar(optarg); | ||
| 473 | break; | ||
| 474 | case 'I': | ||
| 475 | target_interval = get_timevar(optarg); | ||
| 476 | break; | ||
| 477 | case 'w': | ||
| 478 | get_threshold(optarg, &warn); | ||
| 479 | break; | ||
| 480 | case 'c': | ||
| 481 | get_threshold(optarg, &crit); | ||
| 482 | break; | ||
| 483 | case 'n': | ||
| 484 | case 'p': | ||
| 485 | packets = strtoul(optarg, NULL, 0); | ||
| 486 | break; | ||
| 487 | case 't': | ||
| 488 | timeout = strtoul(optarg, NULL, 0); | ||
| 489 | if(!timeout) timeout = 10; | ||
| 490 | break; | ||
| 491 | case 'H': | ||
| 492 | add_target(optarg); | ||
| 493 | break; | ||
| 494 | case 'l': | ||
| 495 | ttl = (unsigned char)strtoul(optarg, NULL, 0); | ||
| 496 | break; | ||
| 497 | case 'm': | ||
| 498 | min_hosts_alive = (int)strtoul(optarg, NULL, 0); | ||
| 499 | break; | ||
| 500 | case 'd': /* implement later, for cluster checks */ | ||
| 501 | warn_down = (unsigned char)strtoul(optarg, &ptr, 0); | ||
| 502 | if(ptr) { | ||
| 503 | crit_down = (unsigned char)strtoul(ptr + 1, NULL, 0); | ||
| 504 | } | ||
| 505 | break; | ||
| 506 | case 'V': /* version */ | ||
| 507 | /*print_revision (progname, revision);*/ /* FIXME: Why? */ | ||
| 508 | exit (STATE_OK); | ||
| 509 | case 'h': /* help */ | ||
| 510 | print_help (); | ||
| 511 | exit (STATE_OK); | ||
| 512 | } | ||
| 513 | } | ||
| 514 | } | ||
| 515 | |||
| 516 | argv = &argv[optind]; | ||
| 517 | while(*argv) { | ||
| 518 | add_target(*argv); | ||
| 519 | argv++; | ||
| 520 | } | ||
| 521 | if(!targets) { | ||
| 522 | errno = 0; | ||
| 523 | crash("No hosts to check"); | ||
| 524 | exit(3); | ||
| 525 | } | ||
| 526 | |||
| 527 | if(!sockets) { | ||
| 528 | if(icmp_sock == -1) { | ||
| 529 | errno = icmp_sockerrno; | ||
| 530 | crash("Failed to obtain ICMP socket"); | ||
| 531 | return -1; | ||
| 532 | } | ||
| 533 | /* if(udp_sock == -1) { */ | ||
| 534 | /* errno = icmp_sockerrno; */ | ||
| 535 | /* crash("Failed to obtain UDP socket"); */ | ||
| 536 | /* return -1; */ | ||
| 537 | /* } */ | ||
| 538 | /* if(tcp_sock == -1) { */ | ||
| 539 | /* errno = icmp_sockerrno; */ | ||
| 540 | /* crash("Failed to obtain TCP socker"); */ | ||
| 541 | /* return -1; */ | ||
| 542 | /* } */ | ||
| 543 | } | ||
| 544 | if(!ttl) ttl = 64; | ||
| 545 | |||
| 546 | if(icmp_sock) { | ||
| 547 | result = setsockopt(icmp_sock, SOL_IP, IP_TTL, &ttl, sizeof(ttl)); | ||
| 548 | if(debug) { | ||
| 549 | if(result == -1) printf("setsockopt failed\n"); | ||
| 550 | else printf("ttl set to %u\n", ttl); | ||
| 551 | } | ||
| 552 | } | ||
| 553 | if(tos > 0) { | ||
| 554 | result = setsockopt(icmp_sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); | ||
| 555 | } | ||
| 556 | /* stupid users should be able to give whatever thresholds they want | ||
| 557 | * (nothing will break if they do), but some anal plugin maintainer | ||
| 558 | * will probably add some printf() thing here later, so it might be | ||
| 559 | * best to at least show them where to do it. ;) */ | ||
| 560 | if(warn.pl > crit.pl) warn.pl = crit.pl; | ||
| 561 | if(warn.rta > crit.rta) warn.rta = crit.rta; | ||
| 562 | if(warn_down > crit_down) crit_down = warn_down; | ||
| 563 | |||
| 564 | signal(SIGINT, finish); | ||
| 565 | signal(SIGHUP, finish); | ||
| 566 | signal(SIGTERM, finish); | ||
| 567 | signal(SIGALRM, finish); | ||
| 568 | if(debug) printf("Setting alarm timeout to %u seconds\n", timeout); | ||
| 569 | alarm(timeout); | ||
| 570 | |||
| 571 | /* make sure we don't wait any longer than necessary */ | ||
| 572 | gettimeofday(&prog_start, &tz); | ||
| 573 | max_completion_time = | ||
| 574 | ((targets * packets * pkt_interval) + (targets * target_interval)) + | ||
| 575 | (targets * packets * crit.rta) + crit.rta; | ||
| 576 | |||
| 577 | if(debug) { | ||
| 578 | printf("packets: %u, targets: %u\n" | ||
| 579 | "target_interval: %0.3f, pkt_interval %0.3f\n" | ||
| 580 | "crit.rta: %0.3f\n" | ||
| 581 | "max_completion_time: %0.3f\n", | ||
| 582 | packets, targets, | ||
| 583 | (float)target_interval / 1000, (float)pkt_interval / 1000, | ||
| 584 | (float)crit.rta / 1000, | ||
| 585 | (float)max_completion_time / 1000); | ||
| 586 | } | ||
| 587 | |||
| 588 | if(debug) { | ||
| 589 | if(max_completion_time > (u_int)timeout * 1000000) { | ||
| 590 | printf("max_completion_time: %llu timeout: %u\n", | ||
| 591 | max_completion_time, timeout); | ||
| 592 | printf("Timout must be at lest %llu\n", | ||
| 593 | max_completion_time / 1000000 + 1); | ||
| 594 | } | ||
| 595 | } | ||
| 596 | |||
| 597 | icmp_pkt_size = icmp_data_size + ICMP_MINLEN; | ||
| 598 | if(debug > 2) printf("icmp_pkt_size = %u\n", icmp_pkt_size); | ||
| 599 | if(icmp_pkt_size < sizeof(struct icmp) + sizeof(struct icmp_ping_data)) { | ||
| 600 | icmp_pkt_size = sizeof(struct icmp) + sizeof(struct icmp_ping_data); | ||
| 601 | } | ||
| 602 | if(debug > 2) printf("icmp_pkt_size = %u\n", icmp_pkt_size); | ||
| 603 | |||
| 604 | if(debug) { | ||
| 605 | printf("crit = {%u, %u%%}, warn = {%u, %u%%}\n", | ||
| 606 | crit.rta, crit.pl, warn.rta, warn.pl); | ||
| 607 | printf("pkt_interval: %u target_interval: %u retry_interval: %u\n", | ||
| 608 | pkt_interval, target_interval, retry_interval); | ||
| 609 | printf("icmp_pkt_size: %u timeout: %u\n", | ||
| 610 | icmp_pkt_size, timeout); | ||
| 611 | } | ||
| 612 | |||
| 613 | if(packets > 20) { | ||
| 614 | errno = 0; | ||
| 615 | crash("packets is > 20 (%d)", packets); | ||
| 616 | } | ||
| 617 | |||
| 618 | if(min_hosts_alive < -1) { | ||
| 619 | errno = 0; | ||
| 620 | crash("minimum alive hosts is negative (%i)", min_hosts_alive); | ||
| 621 | } | ||
| 622 | |||
| 623 | host = list; | ||
| 624 | table = malloc(sizeof(struct rta_host **) * (argc - 1)); | ||
| 625 | i = 0; | ||
| 626 | while(host) { | ||
| 627 | host->id = i; | ||
| 628 | table[i] = host; | ||
| 629 | host = host->next; | ||
| 630 | i++; | ||
| 631 | } | ||
| 632 | |||
| 633 | run_checks(); | ||
| 634 | |||
| 635 | errno = 0; | ||
| 636 | finish(0); | ||
| 637 | |||
| 638 | return(0); | ||
| 639 | } | ||
| 640 | |||
| 641 | static void | ||
| 642 | run_checks() | ||
| 643 | { | ||
| 644 | u_int i, t, result; | ||
| 645 | u_int final_wait, time_passed; | ||
| 646 | |||
| 647 | /* this loop might actually violate the pkt_interval or target_interval | ||
| 648 | * settings, but only if there aren't any packets on the wire which | ||
| 649 | * indicates that the target can handle an increased packet rate */ | ||
| 650 | for(i = 0; i < packets; i++) { | ||
| 651 | for(t = 0; t < targets; t++) { | ||
| 652 | /* don't send useless packets */ | ||
| 653 | if(!targets_alive) finish(0); | ||
| 654 | if(table[t]->flags & FLAG_LOST_CAUSE) { | ||
| 655 | if(debug) printf("%s is a lost cause. not sending any more\n", | ||
| 656 | table[t]->name); | ||
| 657 | continue; | ||
| 658 | } | ||
| 659 | |||
| 660 | /* we're still in the game, so send next packet */ | ||
| 661 | (void)send_icmp_ping(icmp_sock, table[t]); | ||
| 662 | result = wait_for_reply(icmp_sock, target_interval); | ||
| 663 | } | ||
| 664 | result = wait_for_reply(icmp_sock, pkt_interval * targets); | ||
| 665 | } | ||
| 666 | |||
| 667 | if(icmp_pkts_en_route && targets_alive) { | ||
| 668 | time_passed = get_timevaldiff(NULL, NULL); | ||
| 669 | final_wait = max_completion_time - time_passed; | ||
| 670 | |||
| 671 | if(debug) { | ||
| 672 | printf("time_passed: %u final_wait: %u max_completion_time: %llu\n", | ||
| 673 | time_passed, final_wait, max_completion_time); | ||
| 674 | } | ||
| 675 | if(time_passed > max_completion_time) { | ||
| 676 | if(debug) printf("Time passed. Finishing up\n"); | ||
| 677 | finish(0); | ||
| 678 | } | ||
| 679 | |||
| 680 | /* catch the packets that might come in within the timeframe, but | ||
| 681 | * haven't yet */ | ||
| 682 | if(debug) printf("Waiting for %u micro-seconds (%0.3f msecs)\n", | ||
| 683 | final_wait, (float)final_wait / 1000); | ||
| 684 | result = wait_for_reply(icmp_sock, final_wait); | ||
| 685 | } | ||
| 686 | } | ||
| 687 | |||
| 688 | /* response structure: | ||
| 689 | * ip header : 20 bytes | ||
| 690 | * icmp header : 28 bytes | ||
| 691 | * icmp echo reply : the rest | ||
| 692 | */ | ||
| 693 | static int | ||
| 694 | wait_for_reply(int sock, u_int t) | ||
| 695 | { | ||
| 696 | int n, hlen; | ||
| 697 | static char buf[4096]; | ||
| 698 | struct sockaddr_in resp_addr; | ||
| 699 | struct ip *ip; | ||
| 700 | struct icmp icp; | ||
| 701 | struct rta_host *host; | ||
| 702 | struct icmp_ping_data data; | ||
| 703 | struct timeval wait_start, now; | ||
| 704 | u_int tdiff, i, per_pkt_wait; | ||
| 705 | |||
| 706 | /* if we can't listen or don't have anything to listen to, just return */ | ||
| 707 | if(!t || !icmp_pkts_en_route) return 0; | ||
| 708 | |||
| 709 | gettimeofday(&wait_start, &tz); | ||
| 710 | |||
| 711 | i = t; | ||
| 712 | per_pkt_wait = t / icmp_pkts_en_route; | ||
| 713 | while(icmp_pkts_en_route && get_timevaldiff(&wait_start, NULL) < i) { | ||
| 714 | t = per_pkt_wait; | ||
| 715 | |||
| 716 | /* wrap up if all targets are declared dead */ | ||
| 717 | if(!targets_alive || | ||
| 718 | get_timevaldiff(&prog_start, NULL) >= max_completion_time || | ||
| 719 | (mode == MODE_HOSTCHECK && targets_down)) | ||
| 720 | { | ||
| 721 | finish(0); | ||
| 722 | } | ||
| 723 | |||
| 724 | /* reap responses until we hit a timeout */ | ||
| 725 | n = recvfrom_wto(sock, buf, sizeof(buf), | ||
| 726 | (struct sockaddr *)&resp_addr, &t); | ||
| 727 | if(!n) { | ||
| 728 | if(debug > 1) { | ||
| 729 | printf("recvfrom_wto() timed out during a %u usecs wait\n", | ||
| 730 | per_pkt_wait); | ||
| 731 | } | ||
| 732 | continue; /* timeout for this one, so keep trying */ | ||
| 733 | } | ||
| 734 | if(n < 0) { | ||
| 735 | if(debug) printf("recvfrom_wto() returned errors\n"); | ||
| 736 | return n; | ||
| 737 | } | ||
| 738 | |||
| 739 | ip = (struct ip *)buf; | ||
| 740 | if(debug > 1) printf("received %u bytes from %s\n", | ||
| 741 | ntohs(ip->ip_len), inet_ntoa(resp_addr.sin_addr)); | ||
| 742 | |||
| 743 | /* obsolete. alpha on tru64 provides the necessary defines, but isn't broken */ | ||
| 744 | /* #if defined( __alpha__ ) && __STDC__ && !defined( __GLIBC__ ) */ | ||
| 745 | /* alpha headers are decidedly broken. Using an ansi compiler, | ||
| 746 | * they provide ip_vhl instead of ip_hl and ip_v, so we mask | ||
| 747 | * off the bottom 4 bits */ | ||
| 748 | /* hlen = (ip->ip_vhl & 0x0f) << 2; */ | ||
| 749 | /* #else */ | ||
| 750 | hlen = ip->ip_hl << 2; | ||
| 751 | /* #endif */ | ||
| 752 | |||
| 753 | if(n < (hlen + ICMP_MINLEN)) { | ||
| 754 | crash("received packet too short for ICMP (%d bytes, expected %d) from %s\n", | ||
| 755 | n, hlen + icmp_pkt_size, inet_ntoa(resp_addr.sin_addr)); | ||
| 756 | } | ||
| 757 | /* else if(debug) { */ | ||
| 758 | /* printf("ip header size: %u, packet size: %u (expected %u, %u)\n", */ | ||
| 759 | /* hlen, ntohs(ip->ip_len) - hlen, */ | ||
| 760 | /* sizeof(struct ip), icmp_pkt_size); */ | ||
| 761 | /* } */ | ||
| 762 | |||
| 763 | /* check the response */ | ||
| 764 | memcpy(&icp, buf + hlen, sizeof(icp)); | ||
| 765 | |||
| 766 | if(icp.icmp_id != pid) { | ||
| 767 | handle_random_icmp(&icp, &resp_addr); | ||
| 768 | continue; | ||
| 769 | } | ||
| 770 | |||
| 771 | if(icp.icmp_type != ICMP_ECHOREPLY || icp.icmp_seq >= targets) { | ||
| 772 | if(debug > 2) printf("not a proper ICMP_ECHOREPLY\n"); | ||
| 773 | handle_random_icmp(&icp, &resp_addr); | ||
| 774 | continue; | ||
| 775 | } | ||
| 776 | |||
| 777 | /* this is indeed a valid response */ | ||
| 778 | memcpy(&data, icp.icmp_data, sizeof(data)); | ||
| 779 | |||
| 780 | host = table[icp.icmp_seq]; | ||
| 781 | gettimeofday(&now, &tz); | ||
| 782 | tdiff = get_timevaldiff(&data.stime, &now); | ||
| 783 | |||
| 784 | host->time_waited += tdiff; | ||
| 785 | host->icmp_recv++; | ||
| 786 | icmp_recv++; | ||
| 787 | |||
| 788 | if(debug) { | ||
| 789 | printf("%0.3f ms rtt from %s, outgoing ttl: %u, incoming ttl: %u\n", | ||
| 790 | (float)tdiff / 1000, inet_ntoa(resp_addr.sin_addr), | ||
| 791 | ttl, ip->ip_ttl); | ||
| 792 | } | ||
| 793 | |||
| 794 | /* if we're in hostcheck mode, exit with limited printouts */ | ||
| 795 | if(mode == MODE_HOSTCHECK) { | ||
| 796 | printf("OK - %s responds to ICMP. Packet %u, rta %0.3fms|" | ||
| 797 | "pkt=%u;;0;%u rta=%0.3f;%0.3f;%0.3f;;\n", | ||
| 798 | host->name, icmp_recv, (float)tdiff / 1000, | ||
| 799 | icmp_recv, packets, (float)tdiff / 1000, | ||
| 800 | (float)warn.rta / 1000, (float)crit.rta / 1000); | ||
| 801 | exit(STATE_OK); | ||
| 802 | } | ||
| 803 | } | ||
| 804 | |||
| 805 | return 0; | ||
| 806 | } | ||
| 807 | |||
| 808 | /* the ping functions */ | ||
| 809 | static int | ||
| 810 | send_icmp_ping(int sock, struct rta_host *host) | ||
| 811 | { | ||
| 812 | static union { | ||
| 813 | char *buf; /* re-use so we prevent leaks */ | ||
| 814 | struct icmp *icp; | ||
| 815 | u_short *cksum_in; | ||
| 816 | } packet = { NULL }; | ||
| 817 | long int len; | ||
| 818 | struct icmp_ping_data data; | ||
| 819 | struct timeval tv; | ||
| 820 | struct sockaddr *addr; | ||
| 821 | |||
| 822 | if(sock == -1) { | ||
| 823 | errno = 0; | ||
| 824 | crash("Attempt to send on bogus socket"); | ||
| 825 | return -1; | ||
| 826 | } | ||
| 827 | addr = (struct sockaddr *)&host->saddr_in; | ||
| 828 | |||
| 829 | if(!packet.buf) { | ||
| 830 | if (!(packet.buf = malloc(icmp_pkt_size))) { | ||
| 831 | crash("send_icmp_ping(): failed to malloc %d bytes for send buffer", | ||
| 832 | icmp_pkt_size); | ||
| 833 | return -1; /* might be reached if we're in debug mode */ | ||
| 834 | } | ||
| 835 | } | ||
| 836 | memset(packet.buf, 0, icmp_pkt_size); | ||
| 837 | |||
| 838 | if((gettimeofday(&tv, &tz)) == -1) return -1; | ||
| 839 | |||
| 840 | data.ping_id = 10; /* host->icmp.icmp_sent; */ | ||
| 841 | memcpy(&data.stime, &tv, sizeof(tv)); | ||
| 842 | memcpy(&packet.icp->icmp_data, &data, sizeof(data)); | ||
| 843 | packet.icp->icmp_type = ICMP_ECHO; | ||
| 844 | packet.icp->icmp_code = 0; | ||
| 845 | packet.icp->icmp_cksum = 0; | ||
| 846 | packet.icp->icmp_id = pid; | ||
| 847 | packet.icp->icmp_seq = host->id; | ||
| 848 | packet.icp->icmp_cksum = icmp_checksum(packet.cksum_in, icmp_pkt_size); | ||
| 849 | |||
| 850 | len = sendto(sock, packet.buf, icmp_pkt_size, 0, (struct sockaddr *)addr, | ||
| 851 | sizeof(struct sockaddr)); | ||
| 852 | |||
| 853 | if(len < 0 || (unsigned int)len != icmp_pkt_size) { | ||
| 854 | if(debug) printf("Failed to send ping to %s\n", | ||
| 855 | inet_ntoa(host->saddr_in.sin_addr)); | ||
| 856 | return -1; | ||
| 857 | } | ||
| 858 | |||
| 859 | icmp_sent++; | ||
| 860 | host->icmp_sent++; | ||
| 861 | |||
| 862 | return 0; | ||
| 863 | } | ||
| 864 | |||
| 865 | static int | ||
| 866 | recvfrom_wto(int sock, char *buf, unsigned int len, struct sockaddr *saddr, | ||
| 867 | u_int *timo) | ||
| 868 | { | ||
| 869 | u_int slen; | ||
| 870 | int n; | ||
| 871 | struct timeval to, then, now; | ||
| 872 | fd_set rd, wr; | ||
| 873 | |||
| 874 | if(!*timo) { | ||
| 875 | if(debug) printf("*timo is not\n"); | ||
| 876 | return 0; | ||
| 877 | } | ||
| 878 | |||
| 879 | to.tv_sec = *timo / 1000000; | ||
| 880 | to.tv_usec = (*timo - (to.tv_sec * 1000000)); | ||
| 881 | |||
| 882 | FD_ZERO(&rd); | ||
| 883 | FD_ZERO(&wr); | ||
| 884 | FD_SET(sock, &rd); | ||
| 885 | errno = 0; | ||
| 886 | gettimeofday(&then, &tz); | ||
| 887 | n = select(sock + 1, &rd, &wr, NULL, &to); | ||
| 888 | if(n < 0) crash("select() in recvfrom_wto"); | ||
| 889 | gettimeofday(&now, &tz); | ||
| 890 | *timo = get_timevaldiff(&then, &now); | ||
| 891 | |||
| 892 | if(!n) return 0; /* timeout */ | ||
| 893 | |||
| 894 | slen = sizeof(struct sockaddr); | ||
| 895 | |||
| 896 | return recvfrom(sock, buf, len, 0, saddr, &slen); | ||
| 897 | } | ||
| 898 | |||
| 899 | static void | ||
| 900 | finish(int sig) | ||
| 901 | { | ||
| 902 | u_int i = 0; | ||
| 903 | unsigned char pl; | ||
| 904 | double rta; | ||
| 905 | struct rta_host *host; | ||
| 906 | char *status_string[] = | ||
| 907 | {"OK", "WARNING", "CRITICAL", "UNKNOWN", "DEPENDENT"}; | ||
| 908 | int hosts_ok = 0; | ||
| 909 | int hosts_warn = 0; | ||
| 910 | |||
| 911 | alarm(0); | ||
| 912 | if(debug > 1) printf("finish(%d) called\n", sig); | ||
| 913 | |||
| 914 | if(icmp_sock != -1) close(icmp_sock); | ||
| 915 | if(udp_sock != -1) close(udp_sock); | ||
| 916 | if(tcp_sock != -1) close(tcp_sock); | ||
| 917 | |||
| 918 | if(debug) { | ||
| 919 | printf("icmp_sent: %u icmp_recv: %u icmp_lost: %u\n", | ||
| 920 | icmp_sent, icmp_recv, icmp_lost); | ||
| 921 | printf("targets: %u targets_alive: %u\n", targets, targets_alive); | ||
| 922 | } | ||
| 923 | |||
| 924 | /* iterate thrice to calculate values, give output, and print perfparse */ | ||
| 925 | host = list; | ||
| 926 | while(host) { | ||
| 927 | if(!host->icmp_recv) { | ||
| 928 | /* rta 0 is ofcourse not entirely correct, but will still show up | ||
| 929 | * conspicuosly as missing entries in perfparse and cacti */ | ||
| 930 | pl = 100; | ||
| 931 | rta = 0; | ||
| 932 | status = STATE_CRITICAL; | ||
| 933 | /* up the down counter if not already counted */ | ||
| 934 | if(!(host->flags & FLAG_LOST_CAUSE) && targets_alive) targets_down++; | ||
| 935 | } | ||
| 936 | else { | ||
| 937 | pl = ((host->icmp_sent - host->icmp_recv) * 100) / host->icmp_sent; | ||
| 938 | rta = (double)host->time_waited / host->icmp_recv; | ||
| 939 | } | ||
| 940 | host->pl = pl; | ||
| 941 | host->rta = rta; | ||
| 942 | if(pl >= crit.pl || rta >= crit.rta) { | ||
| 943 | status = STATE_CRITICAL; | ||
| 944 | } | ||
| 945 | else if(!status && (pl >= warn.pl || rta >= warn.rta)) { | ||
| 946 | status = STATE_WARNING; | ||
| 947 | hosts_warn++; | ||
| 948 | } | ||
| 949 | else { | ||
| 950 | hosts_ok++; | ||
| 951 | } | ||
| 952 | |||
| 953 | host = host->next; | ||
| 954 | } | ||
| 955 | /* this is inevitable */ | ||
| 956 | if(!targets_alive) status = STATE_CRITICAL; | ||
| 957 | if(min_hosts_alive > -1) { | ||
| 958 | if(hosts_ok >= min_hosts_alive) status = STATE_OK; | ||
| 959 | else if((hosts_ok + hosts_warn) >= min_hosts_alive) status = STATE_WARNING; | ||
| 960 | } | ||
| 961 | printf("%s - ", status_string[status]); | ||
| 962 | |||
| 963 | host = list; | ||
| 964 | while(host) { | ||
| 965 | if(debug) puts(""); | ||
| 966 | if(i) { | ||
| 967 | if(i < targets) printf(" :: "); | ||
| 968 | else printf("\n"); | ||
| 969 | } | ||
| 970 | i++; | ||
| 971 | if(!host->icmp_recv) { | ||
| 972 | status = STATE_CRITICAL; | ||
| 973 | if(host->flags & FLAG_LOST_CAUSE) { | ||
| 974 | printf("%s: %s @ %s. rta nan, lost %d%%", | ||
| 975 | host->name, | ||
| 976 | get_icmp_error_msg(host->icmp_type, host->icmp_code), | ||
| 977 | inet_ntoa(host->error_addr), | ||
| 978 | 100); | ||
| 979 | } | ||
| 980 | else { /* not marked as lost cause, so we have no flags for it */ | ||
| 981 | printf("%s: rta nan, lost 100%%", host->name); | ||
| 982 | } | ||
| 983 | } | ||
| 984 | else { /* !icmp_recv */ | ||
| 985 | printf("%s: rta %0.3fms, lost %u%%", | ||
| 986 | host->name, host->rta / 1000, host->pl); | ||
| 987 | } | ||
| 988 | |||
| 989 | host = host->next; | ||
| 990 | } | ||
| 991 | |||
| 992 | /* iterate once more for pretty perfparse output */ | ||
| 993 | printf("|"); | ||
| 994 | i = 0; | ||
| 995 | host = list; | ||
| 996 | while(host) { | ||
| 997 | if(debug) puts(""); | ||
| 998 | printf("%srta=%0.3fms;%0.3f;%0.3f;0; %spl=%u%%;%u;%u;; ", | ||
| 999 | (targets > 1) ? host->name : "", | ||
| 1000 | host->rta / 1000, (float)warn.rta / 1000, (float)crit.rta / 1000, | ||
| 1001 | (targets > 1) ? host->name : "", | ||
| 1002 | host->pl, warn.pl, crit.pl); | ||
| 1003 | |||
| 1004 | host = host->next; | ||
| 1005 | } | ||
| 1006 | |||
| 1007 | if(min_hosts_alive > -1) { | ||
| 1008 | if(hosts_ok >= min_hosts_alive) status = STATE_OK; | ||
| 1009 | else if((hosts_ok + hosts_warn) >= min_hosts_alive) status = STATE_WARNING; | ||
| 1010 | } | ||
| 1011 | |||
| 1012 | /* finish with an empty line */ | ||
| 1013 | puts(""); | ||
| 1014 | if(debug) printf("targets: %u, targets_alive: %u, hosts_ok: %u, hosts_warn: %u, min_hosts_alive: %i\n", | ||
| 1015 | targets, targets_alive, hosts_ok, hosts_warn, min_hosts_alive); | ||
| 1016 | |||
| 1017 | exit(status); | ||
| 1018 | } | ||
| 1019 | |||
| 1020 | static u_int | ||
| 1021 | get_timevaldiff(struct timeval *early, struct timeval *later) | ||
| 1022 | { | ||
| 1023 | u_int ret; | ||
| 1024 | struct timeval now; | ||
| 1025 | |||
| 1026 | if(!later) { | ||
| 1027 | gettimeofday(&now, &tz); | ||
| 1028 | later = &now; | ||
| 1029 | } | ||
| 1030 | if(!early) early = &prog_start; | ||
| 1031 | |||
| 1032 | /* if early > later we return 0 so as to indicate a timeout */ | ||
| 1033 | if(early->tv_sec > early->tv_sec || | ||
| 1034 | (early->tv_sec == later->tv_sec && early->tv_usec > later->tv_usec)) | ||
| 1035 | { | ||
| 1036 | return 0; | ||
| 1037 | } | ||
| 1038 | |||
| 1039 | ret = (later->tv_sec - early->tv_sec) * 1000000; | ||
| 1040 | ret += later->tv_usec - early->tv_usec; | ||
| 1041 | |||
| 1042 | return ret; | ||
| 1043 | } | ||
| 1044 | |||
| 1045 | static int | ||
| 1046 | add_target_ip(char *arg, struct in_addr *in) | ||
| 1047 | { | ||
| 1048 | struct rta_host *host; | ||
| 1049 | |||
| 1050 | /* disregard obviously stupid addresses */ | ||
| 1051 | if(in->s_addr == INADDR_NONE || in->s_addr == INADDR_ANY) | ||
| 1052 | return -1; | ||
| 1053 | |||
| 1054 | /* no point in adding two identical IP's, so don't. ;) */ | ||
| 1055 | host = list; | ||
| 1056 | while(host) { | ||
| 1057 | if(host->saddr_in.sin_addr.s_addr == in->s_addr) { | ||
| 1058 | if(debug) printf("Identical IP already exists. Not adding %s\n", arg); | ||
| 1059 | return -1; | ||
| 1060 | } | ||
| 1061 | host = host->next; | ||
| 1062 | } | ||
| 1063 | |||
| 1064 | /* add the fresh ip */ | ||
| 1065 | host = malloc(sizeof(struct rta_host)); | ||
| 1066 | if(!host) { | ||
| 1067 | crash("add_target_ip(%s, %s): malloc(%d) failed", | ||
| 1068 | arg, inet_ntoa(*in), sizeof(struct rta_host)); | ||
| 1069 | } | ||
| 1070 | memset(host, 0, sizeof(struct rta_host)); | ||
| 1071 | |||
| 1072 | /* set the values. use calling name for output */ | ||
| 1073 | host->name = strdup(arg); | ||
| 1074 | |||
| 1075 | /* fill out the sockaddr_in struct */ | ||
| 1076 | host->saddr_in.sin_family = AF_INET; | ||
| 1077 | host->saddr_in.sin_addr.s_addr = in->s_addr; | ||
| 1078 | |||
| 1079 | if(!list) list = cursor = host; | ||
| 1080 | else cursor->next = host; | ||
| 1081 | |||
| 1082 | cursor = host; | ||
| 1083 | targets++; | ||
| 1084 | |||
| 1085 | return 0; | ||
| 1086 | } | ||
| 1087 | |||
| 1088 | /* wrapper for add_target_ip */ | ||
| 1089 | static int | ||
| 1090 | add_target(char *arg) | ||
| 1091 | { | ||
| 1092 | int i; | ||
| 1093 | struct hostent *he; | ||
| 1094 | struct in_addr *in, ip; | ||
| 1095 | |||
| 1096 | /* don't resolve if we don't have to */ | ||
| 1097 | if((ip.s_addr = inet_addr(arg)) != INADDR_NONE) { | ||
| 1098 | /* don't add all ip's if we were given a specific one */ | ||
| 1099 | return add_target_ip(arg, &ip); | ||
| 1100 | /* he = gethostbyaddr((char *)in, sizeof(struct in_addr), AF_INET); */ | ||
| 1101 | /* if(!he) return add_target_ip(arg, in); */ | ||
| 1102 | } | ||
| 1103 | else { | ||
| 1104 | errno = 0; | ||
| 1105 | he = gethostbyname(arg); | ||
| 1106 | if(!he) { | ||
| 1107 | errno = 0; | ||
| 1108 | crash("Failed to resolve %s", arg); | ||
| 1109 | return -1; | ||
| 1110 | } | ||
| 1111 | } | ||
| 1112 | |||
| 1113 | /* possibly add all the IP's as targets */ | ||
| 1114 | for(i = 0; he->h_addr_list[i]; i++) { | ||
| 1115 | in = (struct in_addr *)he->h_addr_list[i]; | ||
| 1116 | add_target_ip(arg, in); | ||
| 1117 | |||
| 1118 | /* this is silly, but it works */ | ||
| 1119 | if(mode == MODE_HOSTCHECK || mode == MODE_ALL) { | ||
| 1120 | printf("mode: %d\n", mode); | ||
| 1121 | continue; | ||
| 1122 | } | ||
| 1123 | break; | ||
| 1124 | } | ||
| 1125 | |||
| 1126 | return 0; | ||
| 1127 | } | ||
| 1128 | /* | ||
| 1129 | * u = micro | ||
| 1130 | * m = milli | ||
| 1131 | * s = seconds | ||
| 1132 | * return value is in microseconds | ||
| 1133 | */ | ||
| 1134 | static u_int | ||
| 1135 | get_timevar(const char *str) | ||
| 1136 | { | ||
| 1137 | char p, u, *ptr; | ||
| 1138 | unsigned int len; | ||
| 1139 | u_int i, d; /* integer and decimal, respectively */ | ||
| 1140 | u_int factor = 1000; /* default to milliseconds */ | ||
| 1141 | |||
| 1142 | if(!str) return 0; | ||
| 1143 | len = strlen(str); | ||
| 1144 | if(!len) return 0; | ||
| 1145 | |||
| 1146 | /* unit might be given as ms|m (millisec), | ||
| 1147 | * us|u (microsec) or just plain s, for seconds */ | ||
| 1148 | u = p = '\0'; | ||
| 1149 | u = str[len - 1]; | ||
| 1150 | if(len >= 2 && !isdigit((int)str[len - 2])) p = str[len - 2]; | ||
| 1151 | if(p && u == 's') u = p; | ||
| 1152 | else if(!p) p = u; | ||
| 1153 | if(debug > 2) printf("evaluating %s, u: %c, p: %c\n", str, u, p); | ||
| 1154 | |||
| 1155 | if(u == 'u') factor = 1; /* microseconds */ | ||
| 1156 | else if(u == 'm') factor = 1000; /* milliseconds */ | ||
| 1157 | else if(u == 's') factor = 1000000; /* seconds */ | ||
| 1158 | if(debug > 2) printf("factor is %u\n", factor); | ||
| 1159 | |||
| 1160 | i = strtoul(str, &ptr, 0); | ||
| 1161 | if(!ptr || *ptr != '.' || strlen(ptr) < 2 || factor == 1) | ||
| 1162 | return i * factor; | ||
| 1163 | |||
| 1164 | /* time specified in usecs can't have decimal points, so ignore them */ | ||
| 1165 | if(factor == 1) return i; | ||
| 1166 | |||
| 1167 | d = strtoul(ptr + 1, NULL, 0); | ||
| 1168 | |||
| 1169 | /* d is decimal, so get rid of excess digits */ | ||
| 1170 | while(d >= factor) d /= 10; | ||
| 1171 | |||
| 1172 | /* the last parenthesis avoids floating point exceptions. */ | ||
| 1173 | return ((i * factor) + (d * (factor / 10))); | ||
| 1174 | } | ||
| 1175 | |||
| 1176 | /* not too good at checking errors, but it'll do (main() should barfe on -1) */ | ||
| 1177 | static int | ||
| 1178 | get_threshold(char *str, threshold *th) | ||
| 1179 | { | ||
| 1180 | char *p = NULL, i = 0; | ||
| 1181 | |||
| 1182 | if(!str || !strlen(str) || !th) return -1; | ||
| 1183 | |||
| 1184 | /* pointer magic slims code by 10 lines. i is bof-stop on stupid libc's */ | ||
| 1185 | p = &str[strlen(str) - 1]; | ||
| 1186 | while(p != &str[1]) { | ||
| 1187 | if(*p == '%') *p = '\0'; | ||
| 1188 | else if(*p == ',' && i) { | ||
| 1189 | *p = '\0'; /* reset it so get_timevar(str) works nicely later */ | ||
| 1190 | th->pl = (unsigned char)strtoul(p+1, NULL, 0); | ||
| 1191 | break; | ||
| 1192 | } | ||
| 1193 | i = 1; | ||
| 1194 | p--; | ||
| 1195 | } | ||
| 1196 | th->rta = get_timevar(str); | ||
| 1197 | |||
| 1198 | if(!th->rta) return -1; | ||
| 1199 | |||
| 1200 | if(th->rta > MAXTTL * 1000000) th->rta = MAXTTL * 1000000; | ||
| 1201 | if(th->pl > 100) th->pl = 100; | ||
| 1202 | |||
| 1203 | return 0; | ||
| 1204 | } | ||
| 1205 | |||
| 1206 | unsigned short | ||
| 1207 | icmp_checksum(unsigned short *p, int n) | ||
| 1208 | { | ||
| 1209 | register unsigned short cksum; | ||
| 1210 | register long sum = 0; | ||
| 1211 | |||
| 1212 | while(n > 1) { | ||
| 1213 | sum += *p++; | ||
| 1214 | n -= 2; | ||
| 1215 | } | ||
| 1216 | |||
| 1217 | /* mop up the occasional odd byte */ | ||
| 1218 | if(n == 1) sum += (unsigned char)*p; | ||
| 1219 | |||
| 1220 | sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */ | ||
| 1221 | sum += (sum >> 16); /* add carry */ | ||
| 1222 | cksum = ~sum; /* ones-complement, trunc to 16 bits */ | ||
| 1223 | |||
| 1224 | return cksum; | ||
| 1225 | } | ||
| 1226 | |||
| 1227 | void | ||
| 1228 | print_help(void) | ||
| 1229 | { | ||
| 1230 | |||
| 1231 | /*print_revision (progname, revision);*/ /* FIXME: Why? */ | ||
| 1232 | |||
| 1233 | printf ("Copyright (c) 2005 Andreas Ericsson <ae@op5.se>\n"); | ||
| 1234 | printf (COPYRIGHT, copyright, email); | ||
| 1235 | |||
| 1236 | printf ("\n\n"); | ||
| 1237 | |||
| 1238 | print_usage (); | ||
| 1239 | |||
| 1240 | printf (_(UT_HELP_VRSN)); | ||
| 1241 | |||
| 1242 | printf (" %s\n", "-H"); | ||
| 1243 | printf (" %s\n", _("specify a target")); | ||
| 1244 | printf (" %s\n", "-w"); | ||
| 1245 | printf (" %s", _("warning threshold (currently ")); | ||
| 1246 | printf ("%0.3fms,%u%%)\n", (float)warn.rta / 1000 , warn.pl / 1000); | ||
| 1247 | printf (" %s\n", "-c"); | ||
| 1248 | printf (" %s", _("critical threshold (currently ")); | ||
| 1249 | printf ("%0.3fms,%u%%)\n", (float)crit.rta, crit.pl); | ||
| 1250 | printf (" %s\n", "-n"); | ||
| 1251 | printf (" %s", _("number of packets to send (currently ")); | ||
| 1252 | printf ("%u)\n",packets); | ||
| 1253 | printf (" %s\n", "-i"); | ||
| 1254 | printf (" %s", _("max packet interval (currently ")); | ||
| 1255 | printf ("%0.3fms)\n",(float)pkt_interval / 1000); | ||
| 1256 | printf (" %s\n", "-I"); | ||
| 1257 | printf (" %s", _("max target interval (currently ")); | ||
| 1258 | printf ("%0.3fms)\n", (float)target_interval / 1000); | ||
| 1259 | printf (" %s\n", "-m"); | ||
| 1260 | printf (" %s",_("number of alive hosts required for success")); | ||
| 1261 | printf ("\n"); | ||
| 1262 | printf (" %s\n", "-l"); | ||
| 1263 | printf (" %s", _("TTL on outgoing packets (currently ")); | ||
| 1264 | printf ("%u)", ttl); | ||
| 1265 | printf (" %s\n", "-t"); | ||
| 1266 | printf (" %s",_("timeout value (seconds, currently ")); | ||
| 1267 | printf ("%u)\n", timeout); | ||
| 1268 | printf (" %s\n", "-b"); | ||
| 1269 | printf (" %s\n", _("icmp packet size (currenly ignored)")); | ||
| 1270 | printf (" -T\n set TOS in Hex\n"); | ||
| 1271 | printf (" %s\n", "-v"); | ||
| 1272 | printf (" %s\n", _("verbose")); | ||
| 1273 | |||
| 1274 | printf ("\n"); | ||
| 1275 | printf ("%s\n\n", _("The -H switch is optional. Naming a host (or several) to check is not.")); | ||
| 1276 | printf ("%s\n", _("Threshold format for -w and -c is 200.25,60% for 200.25 msec RTA and 60%")); | ||
| 1277 | printf ("%s\n", _("packet loss. The default values should work well for most users.")); | ||
| 1278 | printf ("%s\n", _("You can specify different RTA factors using the standardized abbreviations")); | ||
| 1279 | printf ("%s\n\n", _("us (microseconds), ms (milliseconds, default) or just plain s for seconds.")); | ||
| 1280 | /* -d not yet implemented */ | ||
| 1281 | /* printf ("%s\n", _("Threshold format for -d is warn,crit. 12,14 means WARNING if >= 12 hops")); | ||
| 1282 | printf ("%s\n", _("are spent and CRITICAL if >= 14 hops are spent.")); | ||
| 1283 | printf ("%s\n\n", _("NOTE: Some systems decrease TTL when forming ICMP_ECHOREPLY, others do not."));*/ | ||
| 1284 | printf ("%s\n\n", _("The -v switch can be specified several times for increased verbosity.")); | ||
| 1285 | |||
| 1286 | /* printf ("%s\n", _("Long options are currently unsupported.")); | ||
| 1287 | printf ("%s\n", _("Options marked with * require an argument")); | ||
| 1288 | */ | ||
| 1289 | printf (_(UT_SUPPORT)); | ||
| 1290 | |||
| 1291 | printf (_(UT_NOWARRANTY)); | ||
| 1292 | } | ||
| 1293 | |||
| 1294 | |||
| 1295 | |||
| 1296 | void | ||
| 1297 | print_usage (void) | ||
| 1298 | { | ||
| 1299 | printf (_("Usage:")); | ||
| 1300 | printf(" %s [options] [-H] host1 host2 hostn\n", progname); | ||
| 1301 | } | ||
diff --git a/web/attachments/284178-34_fix_smbclient_check_disk_smb.dpatch b/web/attachments/284178-34_fix_smbclient_check_disk_smb.dpatch new file mode 100644 index 0000000..0e53eb1 --- /dev/null +++ b/web/attachments/284178-34_fix_smbclient_check_disk_smb.dpatch | |||
| @@ -0,0 +1,138 @@ | |||
| 1 | #! /bin/sh /usr/share/dpatch/dpatch-run | ||
| 2 | ## 34_fix_smbclient_check_disk_smb.dpatch by Jan Wagner <waja@cyconet.org> | ||
| 3 | ## patch provided by Stephane Chazelas <stephane@artesyncp.com> | ||
| 4 | ## | ||
| 5 | ## DP: Fixes use of smbclient | ||
| 6 | |||
| 7 | @DPATCH@ | ||
| 8 | diff -urNad nagios-plugins-1.4.12~/plugins-scripts/check_disk_smb.pl nagios-plugins-1.4.12/plugins-scripts/check_disk_smb.pl | ||
| 9 | --- nagios-plugins-1.4.12~/plugins-scripts/check_disk_smb.pl 2008-07-02 23:08:03.000000000 +0200 | ||
| 10 | +++ nagios-plugins-1.4.12/plugins-scripts/check_disk_smb.pl 2008-07-02 23:10:42.000000000 +0200 | ||
| 11 | @@ -26,17 +26,13 @@ | ||
| 12 | use vars qw($opt_P $opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $opt_a $verbose); | ||
| 13 | use vars qw($PROGNAME); | ||
| 14 | use lib utils.pm ; | ||
| 15 | -use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); | ||
| 16 | +use utils qw($TIMEOUT %ERRORS &print_revision &support &usage &output_and_error_of); | ||
| 17 | |||
| 18 | sub print_help (); | ||
| 19 | sub print_usage (); | ||
| 20 | |||
| 21 | $PROGNAME = "check_disk_smb"; | ||
| 22 | |||
| 23 | -$ENV{'PATH'}=''; | ||
| 24 | -$ENV{'BASH_ENV'}=''; | ||
| 25 | -$ENV{'ENV'}=''; | ||
| 26 | - | ||
| 27 | Getopt::Long::Configure('bundling'); | ||
| 28 | GetOptions | ||
| 29 | ("v" => \$verbose, "verbose" => \$verbose, | ||
| 30 | @@ -59,9 +55,7 @@ | ||
| 31 | |||
| 32 | if ($opt_h) {print_help(); exit $ERRORS{'OK'};} | ||
| 33 | |||
| 34 | -my $smbclient= "$utils::PATH_TO_SMBCLIENT " ; | ||
| 35 | -my $smbclientoptions= $opt_P ? "-p $opt_P " : ""; | ||
| 36 | - | ||
| 37 | +my $smbclient = $utils::PATH_TO_SMBCLIENT; | ||
| 38 | |||
| 39 | # Options checking | ||
| 40 | |||
| 41 | @@ -73,13 +67,12 @@ | ||
| 42 | my $share = $1 if ($opt_s =~ /^([-_.A-Za-z0-9]+\$?)$/); | ||
| 43 | ($share) || usage("Invalid share: $opt_s\n"); | ||
| 44 | |||
| 45 | -($opt_u) || ($opt_u = shift @ARGV) || ($opt_u = "guest"); | ||
| 46 | -my $user = $1 if ($opt_u =~ /^([-_.A-Za-z0-9\\]+)$/); | ||
| 47 | -($user) || usage("Invalid user: $opt_u\n"); | ||
| 48 | +defined($opt_u) || ($opt_u = shift @ARGV) || ($opt_u = "guest"); | ||
| 49 | +my $user = $1 if ($opt_u =~ /^([-_.A-Za-z0-9\\]*)$/); | ||
| 50 | +defined($user) || usage("Invalid user: $opt_u\n"); | ||
| 51 | |||
| 52 | -($opt_p) || ($opt_p = shift @ARGV) || ($opt_p = ""); | ||
| 53 | +defined($opt_p) || ($opt_p = shift @ARGV) || ($opt_p = ""); | ||
| 54 | my $pass = $1 if ($opt_p =~ /(.*)/); | ||
| 55 | -$pass = "-N" if ($opt_p eq ""); | ||
| 56 | |||
| 57 | ($opt_w) || ($opt_w = shift @ARGV) || ($opt_w = 85); | ||
| 58 | my $warn = $1 if ($opt_w =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/); | ||
| 59 | @@ -163,23 +156,19 @@ | ||
| 60 | |||
| 61 | # Execute an "ls" on the share using smbclient program | ||
| 62 | # get the results into $res | ||
| 63 | -if (defined($workgroup)) { | ||
| 64 | - if (defined($address)) { | ||
| 65 | - print "$smbclient " . "\/\/$host\/$share" ." $pass -W $workgroup -U $user $smbclientoptions -I $address -c ls\n" if ($verbose); | ||
| 66 | - $res = qx/$smbclient "\/\/$host\/$share" $pass -W $workgroup -U $user $smbclientoptions -I $address -c ls/; | ||
| 67 | - } else { | ||
| 68 | - print "$smbclient " . "\/\/$host\/$share" ." $pass -W $workgroup -U $user $smbclientoptions -c ls\n" if ($verbose); | ||
| 69 | - $res = qx/$smbclient "\/\/$host\/$share" $pass -W $workgroup -U $user $smbclientoptions -c ls/; | ||
| 70 | - } | ||
| 71 | -} else { | ||
| 72 | - if (defined($address)) { | ||
| 73 | - print "$smbclient " . "\/\/$host\/$share" ." $pass -U $user $smbclientoptions -I $address -c ls\n" if ($verbose); | ||
| 74 | - $res = qx/$smbclient "\/\/$host\/$share" $pass -U $user $smbclientoptions -I $address -c ls/; | ||
| 75 | - } else { | ||
| 76 | - print "$smbclient " . "\/\/$host\/$share" ." $pass -U $user $smbclientoptions -c ls\n" if ($verbose); | ||
| 77 | - $res = qx/$smbclient "\/\/$host\/$share" $pass -U $user $smbclientoptions -c ls/; | ||
| 78 | - } | ||
| 79 | -} | ||
| 80 | +my @cmd = ( | ||
| 81 | + $smbclient, | ||
| 82 | + "//$host/$share", | ||
| 83 | + "-U", "$user%$pass", | ||
| 84 | + defined($workgroup) ? ("-W", $workgroup) : (), | ||
| 85 | + defined($address) ? ("-I", $address) : (), | ||
| 86 | + defined($opt_P) ? ("-p", $opt_P) : (), | ||
| 87 | + "-c", "ls" | ||
| 88 | +); | ||
| 89 | + | ||
| 90 | +print join(" ", @cmd) . "\n" if ($verbose); | ||
| 91 | +$res = output_and_error_of(@cmd) or exit $ERRORS{"UNKNOWN"}; | ||
| 92 | + | ||
| 93 | #Turn off alarm | ||
| 94 | alarm(0); | ||
| 95 | |||
| 96 | diff -urNad nagios-plugins-1.4.12~/plugins-scripts/utils.pm.in nagios-plugins-1.4.12/plugins-scripts/utils.pm.in | ||
| 97 | --- nagios-plugins-1.4.12~/plugins-scripts/utils.pm.in 2007-07-07 13:55:48.000000000 +0200 | ||
| 98 | +++ nagios-plugins-1.4.12/plugins-scripts/utils.pm.in 2008-07-02 23:08:04.000000000 +0200 | ||
| 99 | @@ -8,7 +8,8 @@ | ||
| 100 | |||
| 101 | require Exporter; | ||
| 102 | @ISA = qw(Exporter); | ||
| 103 | -@EXPORT_OK = qw($TIMEOUT %ERRORS &print_revision &support &usage); | ||
| 104 | +@EXPORT_OK = qw($TIMEOUT %ERRORS &print_revision &support &usage | ||
| 105 | + &output_of &output_and_error_of); | ||
| 106 | |||
| 107 | #use strict; | ||
| 108 | #use vars($TIMEOUT %ERRORS); | ||
| 109 | @@ -67,4 +68,29 @@ | ||
| 110 | } | ||
| 111 | } | ||
| 112 | |||
| 113 | +sub output_of { | ||
| 114 | + local *CMD; | ||
| 115 | + local $/ = undef; | ||
| 116 | + if (open CMD, "-|", @_) { | ||
| 117 | + return <CMD>; | ||
| 118 | + close CMD; | ||
| 119 | + } | ||
| 120 | + return undef; | ||
| 121 | +} | ||
| 122 | + | ||
| 123 | +sub output_and_error_of { | ||
| 124 | + local *CMD; | ||
| 125 | + local $/ = undef; | ||
| 126 | + my $pid = open CMD, "-|"; | ||
| 127 | + if (defined($pid)) { | ||
| 128 | + if ($pid) { | ||
| 129 | + return <CMD>; | ||
| 130 | + } else { | ||
| 131 | + open STDERR, ">&STDOUT" and exec @_; | ||
| 132 | + exit(1); | ||
| 133 | + } | ||
| 134 | + } | ||
| 135 | + return undef; | ||
| 136 | +} | ||
| 137 | + | ||
| 138 | 1; | ||
diff --git a/web/attachments/289932-check_http.extented_status_codes.diff.2 b/web/attachments/289932-check_http.extented_status_codes.diff.2 new file mode 100644 index 0000000..a703883 --- /dev/null +++ b/web/attachments/289932-check_http.extented_status_codes.diff.2 | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | Index: THANKS.in | ||
| 2 | =================================================================== | ||
| 3 | --- THANKS.in (revision 2045) | ||
| 4 | +++ THANKS.in (working copy) | ||
| 5 | @@ -237,3 +237,4 @@ | ||
| 6 | Rob Windsor | ||
| 7 | Hilko Bengen | ||
| 8 | Michael Harris | ||
| 9 | +Sven Nierlein | ||
| 10 | Index: NEWS | ||
| 11 | =================================================================== | ||
| 12 | --- NEWS (revision 2045) | ||
| 13 | +++ NEWS (working copy) | ||
| 14 | @@ -10,6 +10,7 @@ | ||
| 15 | check_snmp now only prints perfdata for non numeric values (#1867716) | ||
| 16 | check_icmp now supports packet size modification | ||
| 17 | check_http now sends the Host header first to fix 301s on servers with vitrual hosts (Michael Harris). | ||
| 18 | + check_http -e now accepts a comma-delimited list of expected status codes | ||
| 19 | libtap now included with this distribution for easier testing. Run ./configure with --enable-libtap | ||
| 20 | |||
| 21 | 1.4.12 27th May 2008 | ||
| 22 | Index: plugins/check_http.c | ||
| 23 | =================================================================== | ||
| 24 | --- plugins/check_http.c (revision 2045) | ||
| 25 | +++ plugins/check_http.c (working copy) | ||
| 26 | @@ -573,8 +573,22 @@ | ||
| 27 | } | ||
| 28 | } | ||
| 29 | |||
| 30 | +/* Checks if the server 'reply' is one of the expected 'statuscodes' */ | ||
| 31 | +static int | ||
| 32 | +expected_statuscode (const char *reply, const char *statuscodes) | ||
| 33 | +{ | ||
| 34 | + char *expected, *code; | ||
| 35 | |||
| 36 | + if ((expected = strdup (statuscodes)) == NULL) | ||
| 37 | + die (STATE_UNKNOWN, _("HTTP UNKNOWN - Memory allocation error\n")); | ||
| 38 | |||
| 39 | + for (code = strtok (expected, ","); code != NULL; code = strtok (NULL, ",")) | ||
| 40 | + if (strstr (reply, code) != NULL) | ||
| 41 | + return 1; | ||
| 42 | + | ||
| 43 | + return 0; | ||
| 44 | +} | ||
| 45 | + | ||
| 46 | static void | ||
| 47 | check_document_dates (const char *headers) | ||
| 48 | { | ||
| 49 | @@ -878,14 +892,15 @@ | ||
| 50 | (no_body ? " [[ skipped ]]" : page)); | ||
| 51 | |||
| 52 | /* make sure the status line matches the response we are looking for */ | ||
| 53 | - if (!strstr (status_line, server_expect)) { | ||
| 54 | + if (!expected_statuscode (status_line, server_expect)) { | ||
| 55 | if (server_port == HTTP_PORT) | ||
| 56 | asprintf (&msg, | ||
| 57 | - _("Invalid HTTP response received from host\n")); | ||
| 58 | + _("Invalid HTTP response received from host: %s\n"), | ||
| 59 | + status_line); | ||
| 60 | else | ||
| 61 | asprintf (&msg, | ||
| 62 | - _("Invalid HTTP response received from host on port %d\n"), | ||
| 63 | - server_port); | ||
| 64 | + _("Invalid HTTP response received from host on port %d: %s\n"), | ||
| 65 | + server_port, status_line); | ||
| 66 | die (STATE_CRITICAL, "HTTP CRITICAL - %s", msg); | ||
| 67 | } | ||
| 68 | |||
| 69 | @@ -1262,7 +1277,8 @@ | ||
| 70 | #endif | ||
| 71 | |||
| 72 | printf (" %s\n", "-e, --expect=STRING"); | ||
| 73 | - printf (" %s\n", _("String to expect in first (status) line of server response (default: ")); | ||
| 74 | + printf (" %s\n", _("Comma-delimited list of strings, at least one of them is expected in")); | ||
| 75 | + printf (" %s\n", _("the first (status) line of the server response (default: ")); | ||
| 76 | printf ("%s)\n", HTTP_EXPECT); | ||
| 77 | printf (" %s\n", _("If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)")); | ||
| 78 | printf (" %s\n", "-s, --string=STRING"); | ||
diff --git a/web/attachments/289944-check_http.extented_status_codes.diff.3 b/web/attachments/289944-check_http.extented_status_codes.diff.3 new file mode 100644 index 0000000..141e707 --- /dev/null +++ b/web/attachments/289944-check_http.extented_status_codes.diff.3 | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | Index: THANKS.in | ||
| 2 | =================================================================== | ||
| 3 | --- THANKS.in (revision 2045) | ||
| 4 | +++ THANKS.in (working copy) | ||
| 5 | @@ -237,3 +237,4 @@ | ||
| 6 | Rob Windsor | ||
| 7 | Hilko Bengen | ||
| 8 | Michael Harris | ||
| 9 | +Sven Nierlein | ||
| 10 | Index: NEWS | ||
| 11 | =================================================================== | ||
| 12 | --- NEWS (revision 2045) | ||
| 13 | +++ NEWS (working copy) | ||
| 14 | @@ -10,6 +10,7 @@ | ||
| 15 | check_snmp now only prints perfdata for non numeric values (#1867716) | ||
| 16 | check_icmp now supports packet size modification | ||
| 17 | check_http now sends the Host header first to fix 301s on servers with vitrual hosts (Michael Harris). | ||
| 18 | + check_http -e now accepts a comma-delimited list of expected status codes | ||
| 19 | libtap now included with this distribution for easier testing. Run ./configure with --enable-libtap | ||
| 20 | |||
| 21 | 1.4.12 27th May 2008 | ||
| 22 | Index: plugins/check_http.c | ||
| 23 | =================================================================== | ||
| 24 | --- plugins/check_http.c (revision 2045) | ||
| 25 | +++ plugins/check_http.c (working copy) | ||
| 26 | @@ -573,8 +573,26 @@ | ||
| 27 | } | ||
| 28 | } | ||
| 29 | |||
| 30 | +/* Checks if the server 'reply' is one of the expected 'statuscodes' */ | ||
| 31 | +static int | ||
| 32 | +expected_statuscode (const char *reply, const char *statuscodes) | ||
| 33 | +{ | ||
| 34 | + char *expected, *code; | ||
| 35 | + int result = 0; | ||
| 36 | |||
| 37 | + if ((expected = strdup (statuscodes)) == NULL) | ||
| 38 | + die (STATE_UNKNOWN, _("HTTP UNKNOWN - Memory allocation error\n")); | ||
| 39 | |||
| 40 | + for (code = strtok (expected, ","); code != NULL; code = strtok (NULL, ",")) | ||
| 41 | + if (strstr (reply, code) != NULL) { | ||
| 42 | + result = 1; | ||
| 43 | + break; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + free (expected); | ||
| 47 | + return result; | ||
| 48 | +} | ||
| 49 | + | ||
| 50 | static void | ||
| 51 | check_document_dates (const char *headers) | ||
| 52 | { | ||
| 53 | @@ -878,14 +896,15 @@ | ||
| 54 | (no_body ? " [[ skipped ]]" : page)); | ||
| 55 | |||
| 56 | /* make sure the status line matches the response we are looking for */ | ||
| 57 | - if (!strstr (status_line, server_expect)) { | ||
| 58 | + if (!expected_statuscode (status_line, server_expect)) { | ||
| 59 | if (server_port == HTTP_PORT) | ||
| 60 | asprintf (&msg, | ||
| 61 | - _("Invalid HTTP response received from host\n")); | ||
| 62 | + _("Invalid HTTP response received from host: %s\n"), | ||
| 63 | + status_line); | ||
| 64 | else | ||
| 65 | asprintf (&msg, | ||
| 66 | - _("Invalid HTTP response received from host on port %d\n"), | ||
| 67 | - server_port); | ||
| 68 | + _("Invalid HTTP response received from host on port %d: %s\n"), | ||
| 69 | + server_port, status_line); | ||
| 70 | die (STATE_CRITICAL, "HTTP CRITICAL - %s", msg); | ||
| 71 | } | ||
| 72 | |||
| 73 | @@ -1262,7 +1281,8 @@ | ||
| 74 | #endif | ||
| 75 | |||
| 76 | printf (" %s\n", "-e, --expect=STRING"); | ||
| 77 | - printf (" %s\n", _("String to expect in first (status) line of server response (default: ")); | ||
| 78 | + printf (" %s\n", _("Comma-delimited list of strings, at least one of them is expected in")); | ||
| 79 | + printf (" %s\n", _("the first (status) line of the server response (default: ")); | ||
| 80 | printf ("%s)\n", HTTP_EXPECT); | ||
| 81 | printf (" %s\n", _("If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)")); | ||
| 82 | printf (" %s\n", "-s, --string=STRING"); | ||
diff --git a/web/attachments/291715-nagios-plugins-1.4.12-ommit-default-port.patch b/web/attachments/291715-nagios-plugins-1.4.12-ommit-default-port.patch new file mode 100644 index 0000000..c43e6ed --- /dev/null +++ b/web/attachments/291715-nagios-plugins-1.4.12-ommit-default-port.patch | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | --- nagios-plugins-1.4.12-orig/plugins/check_http.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 2 | +++ nagios-plugins-1.4.12-ommit-default-port/plugins/check_http.c 2008-09-02 10:32:30.000000000 +0200 | ||
| 3 | @@ -753,7 +753,17 @@ | ||
| 4 | |||
| 5 | /* optionally send the host header info */ | ||
| 6 | if (host_name) | ||
| 7 | - asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port); | ||
| 8 | + { | ||
| 9 | + /* Ommit the server port if it's the standard port (80 for http and 443 for https). */ | ||
| 10 | + /* Some applications like wordpress do a redirect to a portless host if you named */ | ||
| 11 | + /* a portnumber like www.wordpress-thingy.invalid:80. It will redirect to */ | ||
| 12 | + /* www.wordpress-thingy.invalid and check_http adds the port number in the next */ | ||
| 13 | + /* http call again resulting in a "redirection creates an infinite loop" */ | ||
| 14 | + if ((use_ssl == false && server_port == HTTP_PORT) || (use_ssl == true && server_port == HTTPS_PORT)) | ||
| 15 | + asprintf (&buf, "%sHost: %s\r\n", buf, host_name); | ||
| 16 | + else | ||
| 17 | + asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port); | ||
| 18 | + } | ||
| 19 | |||
| 20 | /* optionally send any other header tag */ | ||
| 21 | if (http_opt_headers_count) { | ||
diff --git a/web/attachments/292902-patch.patch b/web/attachments/292902-patch.patch new file mode 100644 index 0000000..32ea878 --- /dev/null +++ b/web/attachments/292902-patch.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-5 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378823565" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378823565" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378823565" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378823565" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378823565'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=2104167&group_id=29880&atid=397597&file_id=292902" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/292903-check_mssql.sh-errorfile_deletion-patch.txt b/web/attachments/292903-check_mssql.sh-errorfile_deletion-patch.txt new file mode 100644 index 0000000..56eaedd --- /dev/null +++ b/web/attachments/292903-check_mssql.sh-errorfile_deletion-patch.txt | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-6 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378823564" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378823564" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378823564" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378823564" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378823564'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=2104167&group_id=29880&atid=397597&file_id=292903" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/292904-check_mssql.sh-errorfile_deletion.patch b/web/attachments/292904-check_mssql.sh-errorfile_deletion.patch new file mode 100644 index 0000000..1a882f9 --- /dev/null +++ b/web/attachments/292904-check_mssql.sh-errorfile_deletion.patch | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | --- check_mssql.sh.orig 2008-09-10 11:20:25.000000000 -0700 | ||
| 2 | +++ check_mssql.sh 2008-09-10 11:20:48.000000000 -0700 | ||
| 3 | @@ -92,7 +92,7 @@ | ||
| 4 | else | ||
| 5 | nmbr=`$catcmd $resultfile | $grepcmd -v locale | $grepcmd -v charset| | ||
| 6 | $grepcmd -v 1\> | $sedcmd '/^$/d' | $sedcmd 's/ //g' | $wccmd -l | sed 's/ | ||
| 7 | //g'` | ||
| 8 | users=`$catcmd $resultfile | $grepcmd -v locale | $grepcmd -v charset| | ||
| 9 | $grepcmd -v 1\> | $sedcmd '/^$/d' | $sedcmd 's/ //g' | $uniqcmd -c | $trcmd | ||
| 10 | \\\n , | $sedcmd 's/,$/./g' | $sedcmd 's/,/, /g' | $sedcmd 's/ //g' | $trcmd | ||
| 11 | \\\t " " | $sedcmd 's/ \./\./g' | $sedcmd 's/ ,/,/g'` | ||
| 12 | - $rmcmd -f $tmpfile $resultfile; | ||
| 13 | + $rmcmd -f $tmpfile $resultfile $errorfile; | ||
| 14 | echo "OK - MS SQL Server $srv has $nmbr user(s) connected: $users" | | ||
| 15 | sed 's/: $/./g'; | ||
| 16 | exit 0; | ||
| 17 | fi | ||
diff --git a/web/attachments/293580-check_ircd.pl.patch b/web/attachments/293580-check_ircd.pl.patch new file mode 100644 index 0000000..511b719 --- /dev/null +++ b/web/attachments/293580-check_ircd.pl.patch | |||
| @@ -0,0 +1,121 @@ | |||
| 1 | --- check_ircd.pl.orig 2008-09-16 12:41:20.000000000 +0200 | ||
| 2 | +++ check_ircd.pl 2008-09-16 12:43:23.000000000 +0200 | ||
| 3 | @@ -1,4 +1,4 @@ | ||
| 4 | -#!/usr/bin/perl -wT | ||
| 5 | +#! /usr/bin/perl -wT | ||
| 6 | |||
| 7 | # ----------------------------------------------------------------------------- | ||
| 8 | # File Name: check_ircd.pl | ||
| 9 | @@ -50,7 +50,7 @@ | ||
| 10 | use Socket; | ||
| 11 | use strict; | ||
| 12 | use Getopt::Long; | ||
| 13 | -use vars qw($opt_V $opt_h $opt_t $opt_p $opt_H $opt_w $opt_c $verbose); | ||
| 14 | +use vars qw($opt_V $opt_h $opt_t $opt_p $opt_H $opt_w $opt_c $verbose $opt_6); | ||
| 15 | use vars qw($PROGNAME); | ||
| 16 | use lib utils.pm; | ||
| 17 | use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); | ||
| 18 | @@ -60,7 +60,7 @@ | ||
| 19 | sub print_help (); | ||
| 20 | sub print_usage (); | ||
| 21 | sub connection ($$$$); | ||
| 22 | -sub bindRemote ($$$); | ||
| 23 | +sub connectRemote ($$); | ||
| 24 | |||
| 25 | # -------------------------------------------------------------[ Enviroment ]-- | ||
| 26 | |||
| 27 | @@ -140,30 +140,36 @@ | ||
| 28 | "; | ||
| 29 | } | ||
| 30 | |||
| 31 | -# -------------------------------------------------------------[ bindRemote ]-- | ||
| 32 | +# ----------------------------------------------------------[ connectRemote ]-- | ||
| 33 | |||
| 34 | -sub bindRemote ($$$) | ||
| 35 | +sub connectRemote ($$) | ||
| 36 | { | ||
| 37 | - my ($in_remotehost, $in_remoteport, $in_hostname) = @_; | ||
| 38 | + my ($in_remotehost, $in_remoteport) = @_; | ||
| 39 | my $proto = getprotobyname('tcp'); | ||
| 40 | my $sockaddr; | ||
| 41 | - my $this; | ||
| 42 | - my $thisaddr = gethostbyname($in_hostname); | ||
| 43 | my $that; | ||
| 44 | - my ($name, $aliases,$type,$len,$thataddr) = gethostbyname($in_remotehost); | ||
| 45 | -# ($name,$aliases,$type,$len,$thisaddr) = gethostbyname($in_hostname); | ||
| 46 | + my $pf; | ||
| 47 | + if ($opt_6) { | ||
| 48 | + require Socket6; | ||
| 49 | + $pf = PF_INET6; | ||
| 50 | + unless ($that = (Socket6::getaddrinfo($in_remotehost, $in_remoteport, AF_INET6, SOCK_STREAM, $proto))[3]) { | ||
| 51 | + print "IRCD UNKNOWN: Could not resolve $in_remotehost\n"; | ||
| 52 | + exit $ERRORS{"UNKNOWN"}; | ||
| 53 | + } | ||
| 54 | + } else { | ||
| 55 | + $pf = PF_INET; | ||
| 56 | + unless ($that = gethostbyname($in_remotehost)) { | ||
| 57 | + print "IRCD UNKNOWN: Could not resolve $in_remotehost\n"; | ||
| 58 | + exit $ERRORS{"UNKNOWN"}; | ||
| 59 | + } | ||
| 60 | + $sockaddr = 'S n a4 x8'; | ||
| 61 | + $that = pack($sockaddr, AF_INET, $in_remoteport, $that); | ||
| 62 | + } | ||
| 63 | |||
| 64 | - if (!socket(ClientSocket,AF_INET, SOCK_STREAM, $proto)) { | ||
| 65 | + if (!socket(ClientSocket, $pf, SOCK_STREAM, $proto)) { | ||
| 66 | print "IRCD UNKNOWN: Could not start socket ($!)\n"; | ||
| 67 | exit $ERRORS{"UNKNOWN"}; | ||
| 68 | } | ||
| 69 | - $sockaddr = 'S n a4 x8'; | ||
| 70 | - $this = pack($sockaddr, AF_INET, 0, $thisaddr); | ||
| 71 | - $that = pack($sockaddr, AF_INET, $in_remoteport, $thataddr); | ||
| 72 | - if (!bind(ClientSocket, $this)) { | ||
| 73 | - print "IRCD UNKNOWN: Could not bind socket ($!)\n"; | ||
| 74 | - exit $ERRORS{"UNKNOWN"}; | ||
| 75 | - } | ||
| 76 | if (!connect(ClientSocket, $that)) { | ||
| 77 | print "IRCD UNKNOWN: Could not connect socket ($!)\n"; | ||
| 78 | exit $ERRORS{"UNKNOWN"}; | ||
| 79 | @@ -183,6 +189,7 @@ | ||
| 80 | ("V" => \$opt_V, "version" => \$opt_V, | ||
| 81 | "h" => \$opt_h, "help" => \$opt_h, | ||
| 82 | "v" => \$verbose,"verbose" => \$verbose, | ||
| 83 | + "6" => \$opt_6, | ||
| 84 | "t=i" => \$opt_t, "timeout=i" => \$opt_t, | ||
| 85 | "w=i" => \$opt_w, "warning=i" => \$opt_w, | ||
| 86 | "c=i" => \$opt_c, "critical=i" => \$opt_c, | ||
| 87 | @@ -190,15 +197,16 @@ | ||
| 88 | "H=s" => \$opt_H, "hostname=s" => \$opt_H); | ||
| 89 | |||
| 90 | if ($opt_V) { | ||
| 91 | - print_revision($PROGNAME,'$Revision$ '); | ||
| 92 | + print_revision($PROGNAME,'$Revision: 1.3 $ '); | ||
| 93 | exit $ERRORS{'OK'}; | ||
| 94 | } | ||
| 95 | |||
| 96 | if ($opt_h) {print_help(); exit $ERRORS{'OK'};} | ||
| 97 | |||
| 98 | ($opt_H) || ($opt_H = shift) || usage("Host name/address not specified\n"); | ||
| 99 | - my $remotehost = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/); | ||
| 100 | + my $remotehost = $1 if ($opt_H =~ /^([-.:A-Za-z0-9]+)$/); | ||
| 101 | ($remotehost) || usage("Invalid host: $opt_H\n"); | ||
| 102 | + $opt_6 ++ if $remotehost =~ /:/; | ||
| 103 | |||
| 104 | ($opt_w) || ($opt_w = shift) || ($opt_w = 50); | ||
| 105 | my $warn = $1 if ($opt_w =~ /^([0-9]+)$/); | ||
| 106 | @@ -222,13 +230,8 @@ | ||
| 107 | |||
| 108 | alarm($TIMEOUT); | ||
| 109 | |||
| 110 | - chomp($hostname = `/bin/hostname`); | ||
| 111 | - $hostname = $1 if ($hostname =~ /([-.a-zA-Z0-9]+)/); | ||
| 112 | - my ($name, $alias, $proto) = getprotobyname('tcp'); | ||
| 113 | - print "MAIN(debug): hostname = $hostname\n" if $verbose; | ||
| 114 | - | ||
| 115 | - print "MAIN(debug): binding to remote host: $remotehost -> $remoteport -> $hostname\n" if $verbose; | ||
| 116 | - my $ClientSocket = &bindRemote($remotehost,$remoteport,$hostname); | ||
| 117 | + print "MAIN(debug): connecting to $remotehost:$remoteport\n" if $verbose; | ||
| 118 | + my $ClientSocket = &connectRemote($remotehost,$remoteport); | ||
| 119 | |||
| 120 | print ClientSocket "NICK $NICK\nUSER $USER_INFO\n"; | ||
| 121 | |||
diff --git a/web/attachments/295310-config.zip b/web/attachments/295310-config.zip new file mode 100644 index 0000000..b0dcdcc --- /dev/null +++ b/web/attachments/295310-config.zip | |||
| Binary files differ | |||
diff --git a/web/attachments/295596-check_ircd.pl.diff b/web/attachments/295596-check_ircd.pl.diff new file mode 100644 index 0000000..b3792c4 --- /dev/null +++ b/web/attachments/295596-check_ircd.pl.diff | |||
| @@ -0,0 +1,119 @@ | |||
| 1 | --- check_ircd.pl.orig 2002-05-06 22:35:49.000000000 -0700 | ||
| 2 | +++ check_ircd.pl 2008-10-01 01:22:43.496305819 -0700 | ||
| 3 | @@ -43,15 +43,17 @@ | ||
| 4 | |||
| 5 | # ----------------------------------------------------------------[ Require ]-- | ||
| 6 | |||
| 7 | -require 5.004; | ||
| 8 | +require 5.6.0; | ||
| 9 | |||
| 10 | # -------------------------------------------------------------------[ Uses ]-- | ||
| 11 | |||
| 12 | -use Socket; | ||
| 13 | use strict; | ||
| 14 | +use IO::Socket; | ||
| 15 | +use Sys::Hostname; | ||
| 16 | use Getopt::Long; | ||
| 17 | use vars qw($opt_V $opt_h $opt_t $opt_p $opt_H $opt_w $opt_c $verbose); | ||
| 18 | use vars qw($PROGNAME); | ||
| 19 | +use vars qw($ClientSocket); | ||
| 20 | use lib utils.pm; | ||
| 21 | use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); | ||
| 22 | |||
| 23 | @@ -60,7 +62,6 @@ | ||
| 24 | sub print_help (); | ||
| 25 | sub print_usage (); | ||
| 26 | sub connection ($$$$); | ||
| 27 | -sub bindRemote ($$$); | ||
| 28 | |||
| 29 | # -------------------------------------------------------------[ Enviroment ]-- | ||
| 30 | |||
| 31 | @@ -104,7 +105,7 @@ | ||
| 32 | $answer = "Server $in_remotehost has less than 0 users! Something is Really WRONG!\n"; | ||
| 33 | } | ||
| 34 | |||
| 35 | - print ClientSocket "quit\n"; | ||
| 36 | + print $ClientSocket "quit\n"; | ||
| 37 | print $answer; | ||
| 38 | exit $ERRORS{$state}; | ||
| 39 | } | ||
| 40 | @@ -140,38 +141,6 @@ | ||
| 41 | "; | ||
| 42 | } | ||
| 43 | |||
| 44 | -# -------------------------------------------------------------[ bindRemote ]-- | ||
| 45 | - | ||
| 46 | -sub bindRemote ($$$) | ||
| 47 | -{ | ||
| 48 | - my ($in_remotehost, $in_remoteport, $in_hostname) = @_; | ||
| 49 | - my $proto = getprotobyname('tcp'); | ||
| 50 | - my $sockaddr; | ||
| 51 | - my $this; | ||
| 52 | - my $thisaddr = gethostbyname($in_hostname); | ||
| 53 | - my $that; | ||
| 54 | - my ($name, $aliases,$type,$len,$thataddr) = gethostbyname($in_remotehost); | ||
| 55 | -# ($name,$aliases,$type,$len,$thisaddr) = gethostbyname($in_hostname); | ||
| 56 | - | ||
| 57 | - if (!socket(ClientSocket,AF_INET, SOCK_STREAM, $proto)) { | ||
| 58 | - print "IRCD UNKNOWN: Could not start socket ($!)\n"; | ||
| 59 | - exit $ERRORS{"UNKNOWN"}; | ||
| 60 | - } | ||
| 61 | - $sockaddr = 'S n a4 x8'; | ||
| 62 | - $this = pack($sockaddr, AF_INET, 0, $thisaddr); | ||
| 63 | - $that = pack($sockaddr, AF_INET, $in_remoteport, $thataddr); | ||
| 64 | - if (!bind(ClientSocket, $this)) { | ||
| 65 | - print "IRCD UNKNOWN: Could not bind socket ($!)\n"; | ||
| 66 | - exit $ERRORS{"UNKNOWN"}; | ||
| 67 | - } | ||
| 68 | - if (!connect(ClientSocket, $that)) { | ||
| 69 | - print "IRCD UNKNOWN: Could not connect socket ($!)\n"; | ||
| 70 | - exit $ERRORS{"UNKNOWN"}; | ||
| 71 | - } | ||
| 72 | - select(ClientSocket); $| = 1; select(STDOUT); | ||
| 73 | - return \*ClientSocket; | ||
| 74 | -} | ||
| 75 | - | ||
| 76 | # ===================================================================[ MAIN ]== | ||
| 77 | |||
| 78 | MAIN: | ||
| 79 | @@ -222,24 +191,34 @@ | ||
| 80 | |||
| 81 | alarm($TIMEOUT); | ||
| 82 | |||
| 83 | - chomp($hostname = `/bin/hostname`); | ||
| 84 | + $hostname = hostname; | ||
| 85 | $hostname = $1 if ($hostname =~ /([-.a-zA-Z0-9]+)/); | ||
| 86 | - my ($name, $alias, $proto) = getprotobyname('tcp'); | ||
| 87 | print "MAIN(debug): hostname = $hostname\n" if $verbose; | ||
| 88 | |||
| 89 | print "MAIN(debug): binding to remote host: $remotehost -> $remoteport -> $hostname\n" if $verbose; | ||
| 90 | - my $ClientSocket = &bindRemote($remotehost,$remoteport,$hostname); | ||
| 91 | + | ||
| 92 | + $ClientSocket = IO::Socket::INET->new( | ||
| 93 | + PeerAddr => $remotehost, | ||
| 94 | + PeerPort => $remoteport, | ||
| 95 | + LocalAddr => $hostname, | ||
| 96 | + Proto => "tcp" | ||
| 97 | + ); | ||
| 98 | + | ||
| 99 | + if (! $ClientSocket) { | ||
| 100 | + print "IRCD UNKNOWN: Could not connect socket ($!)\n"; | ||
| 101 | + exit $ERRORS{"UNKNOWN"}; | ||
| 102 | + } | ||
| 103 | |||
| 104 | - print ClientSocket "NICK $NICK\nUSER $USER_INFO\n"; | ||
| 105 | + print $ClientSocket "NICK $NICK\nUSER $USER_INFO\n"; | ||
| 106 | |||
| 107 | - while (<ClientSocket>) { | ||
| 108 | + while (<$ClientSocket>) { | ||
| 109 | print "MAIN(debug): default var = $_\n" if $verbose; | ||
| 110 | |||
| 111 | # DALnet,LagNet,UnderNet etc. Require this! | ||
| 112 | # Replies with a PONG when presented with a PING query. | ||
| 113 | # If a server doesn't require it, it will be ignored. | ||
| 114 | |||
| 115 | - if (m/^PING (.*)/) {print ClientSocket "PONG $1\n";} | ||
| 116 | + if (m/^PING (.*)/) {print $ClientSocket "PONG $1\n";} | ||
| 117 | |||
| 118 | alarm(0); | ||
| 119 | |||
diff --git a/web/attachments/296709-check_http.patch b/web/attachments/296709-check_http.patch new file mode 100644 index 0000000..04d83f1 --- /dev/null +++ b/web/attachments/296709-check_http.patch | |||
| @@ -0,0 +1,158 @@ | |||
| 1 | Index: check_http.c | ||
| 2 | =================================================================== | ||
| 3 | --- check_http.c (revision 2059) | ||
| 4 | +++ check_http.c (working copy) | ||
| 5 | @@ -187,6 +187,7 @@ | ||
| 6 | {"nohtml", no_argument, 0, 'n'}, | ||
| 7 | {"ssl", no_argument, 0, 'S'}, | ||
| 8 | {"post", required_argument, 0, 'P'}, | ||
| 9 | + {"method", required_argument, 0, 'j'}, | ||
| 10 | {"IP-address", required_argument, 0, 'I'}, | ||
| 11 | {"url", required_argument, 0, 'u'}, | ||
| 12 | {"port", required_argument, 0, 'p'}, | ||
| 13 | @@ -228,7 +229,7 @@ | ||
| 14 | } | ||
| 15 | |||
| 16 | while (1) { | ||
| 17 | - c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:T:I:a:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 18 | + c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 19 | if (c == -1 || c == EOF) | ||
| 20 | break; | ||
| 21 | |||
| 22 | @@ -344,11 +345,19 @@ | ||
| 23 | strncpy (user_auth, optarg, MAX_INPUT_BUFFER - 1); | ||
| 24 | user_auth[MAX_INPUT_BUFFER - 1] = 0; | ||
| 25 | break; | ||
| 26 | - case 'P': /* HTTP POST data in URL encoded format */ | ||
| 27 | - if (http_method || http_post_data) break; | ||
| 28 | + case 'P': /* HTTP POST data in URL encoded format; only sets data when method already set*/ | ||
| 29 | + if (http_post_data) break; | ||
| 30 | + if (http_method) | ||
| 31 | + { | ||
| 32 | + http_post_data = strdup (optarg); | ||
| 33 | + break; | ||
| 34 | + } | ||
| 35 | http_method = strdup("POST"); | ||
| 36 | http_post_data = strdup (optarg); | ||
| 37 | break; | ||
| 38 | + case 'j': /* SET HTTP METHOD */ | ||
| 39 | + http_method = strdup (optarg); | ||
| 40 | + break; | ||
| 41 | case 's': /* string or substring */ | ||
| 42 | strncpy (string_expect, optarg, MAX_INPUT_BUFFER - 1); | ||
| 43 | string_expect[MAX_INPUT_BUFFER - 1] = 0; | ||
| 44 | @@ -817,7 +826,7 @@ | ||
| 45 | asprintf (&buf, "%sAuthorization: Basic %s\r\n", buf, auth); | ||
| 46 | } | ||
| 47 | |||
| 48 | - /* either send http POST data */ | ||
| 49 | + /* either send http POST data (any data, not only POST)*/ | ||
| 50 | if (http_post_data) { | ||
| 51 | if (http_content_type) { | ||
| 52 | asprintf (&buf, "%sContent-Type: %s\r\n", buf, http_content_type); | ||
| 53 | @@ -1312,7 +1321,9 @@ | ||
| 54 | printf (" %s\n", "-u, --url=PATH"); | ||
| 55 | printf (" %s\n", _("URL to GET or POST (default: /)")); | ||
| 56 | printf (" %s\n", "-P, --post=STRING"); | ||
| 57 | - printf (" %s\n", _("URL encoded http POST data")); | ||
| 58 | + printf (" %s\n", _("URL encoded http POST data. When used with -j only sets data.")); | ||
| 59 | + printf (" %s\n", "-j, --method=STRING (ex. OPTIONS, TRACE, PUT, DELETE)"); | ||
| 60 | + printf (" %s\n", _("Set HTTP method.")); | ||
| 61 | printf (" %s\n", "-N, --no-body"); | ||
| 62 | printf (" %s\n", _("Don't wait for document body: stop reading after headers.")); | ||
| 63 | printf (" %s\n", _("(Note that this still does an HTTP GET or POST, not a HEAD.)")); | ||
| 64 | @@ -1396,5 +1407,5 @@ | ||
| 65 | printf (" [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n"); | ||
| 66 | printf (" [-s string] [-l] [-r <regex> | -R <case-insensitive regex>] [-P string]\n"); | ||
| 67 | printf (" [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>] [-A string]\n"); | ||
| 68 | - printf (" [-k string] [-S] [-C <age>] [-T <content-type>]\n"); | ||
| 69 | + printf (" [-k string] [-S] [-C <age>] [-T <content-type>] [-j string]\n"); | ||
| 70 | } | ||
| 71 | Index: tests/check_http.t | ||
| 72 | =================================================================== | ||
| 73 | --- tests/check_http.t (revision 2059) | ||
| 74 | +++ tests/check_http.t (working copy) | ||
| 75 | @@ -33,9 +33,7 @@ | ||
| 76 | print "Please contact me at: <URL:", $d->url, ">\n"; | ||
| 77 | while (my $c = $d->accept ) { | ||
| 78 | while (my $r = $c->get_request) { | ||
| 79 | - if ($r->method eq "GET" and $r->url->path eq "/xyzzy") { | ||
| 80 | - $c->send_file_response("/etc/passwd"); | ||
| 81 | - } elsif ($r->method eq "GET" and $r->url->path =~ m^/statuscode/(\d+)^) { | ||
| 82 | + if ($r->method eq "GET" and $r->url->path =~ m^/statuscode/(\d+)^) { | ||
| 83 | $c->send_basic_header($1); | ||
| 84 | $c->send_crlf; | ||
| 85 | } elsif ($r->method eq "GET" and $r->url->path =~ m^/file/(.*)^) { | ||
| 86 | @@ -46,8 +44,15 @@ | ||
| 87 | $c->send_basic_header; | ||
| 88 | $c->send_crlf; | ||
| 89 | sleep 1; | ||
| 90 | - $c->send_response("slow"); | ||
| 91 | + } elsif ($r->url->path eq "/method") { | ||
| 92 | + if ($r->method eq "DELETE") { | ||
| 93 | + $c->send_error(RC_METHOD_NOT_ALLOWED); | ||
| 94 | + } elsif ($r->method eq "foo") { | ||
| 95 | + $c->send_error(RC_NOT_IMPLEMENTED); | ||
| 96 | } else { | ||
| 97 | + $c->send_status_line(200, $r->method); | ||
| 98 | + } | ||
| 99 | + } else { | ||
| 100 | $c->send_error(RC_FORBIDDEN); | ||
| 101 | } | ||
| 102 | $c->close; | ||
| 103 | @@ -63,7 +68,7 @@ | ||
| 104 | } | ||
| 105 | |||
| 106 | if (-x "./check_http") { | ||
| 107 | - plan tests => 19; | ||
| 108 | + plan tests => 33; | ||
| 109 | } else { | ||
| 110 | plan skip_all => "No check_http compiled"; | ||
| 111 | } | ||
| 112 | @@ -84,7 +89,7 @@ | ||
| 113 | |||
| 114 | $result = NPTest->testCmd( "$command -u /slow" ); | ||
| 115 | is( $result->return_code, 0, "/file/root"); | ||
| 116 | -like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - 177 bytes in ([\d\.]+) seconds/', "Output correct" ); | ||
| 117 | +like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - 89 bytes in ([\d\.]+) seconds/', "Output correct" ); | ||
| 118 | $result->output =~ /in ([\d\.]+) seconds/; | ||
| 119 | cmp_ok( $1, ">", 1, "Time is > 1 second" ); | ||
| 120 | |||
| 121 | @@ -119,3 +124,37 @@ | ||
| 122 | is( $result->return_code, 2, $cmd); | ||
| 123 | like( $result->output, '/^HTTP CRITICAL - Invalid HTTP response received from host on port (\d+): HTTP/1.1 203 Non-Authoritative Information/', "Output correct: ".$result->output ); | ||
| 124 | |||
| 125 | +$cmd = "$command -j HEAD -u /method"; | ||
| 126 | +$result = NPTest->testCmd( $cmd ); | ||
| 127 | +is( $result->return_code, 0, $cmd); | ||
| 128 | +like( $result->output, '/^HTTP OK HTTP/1.1 200 HEAD - 19 bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output ); | ||
| 129 | + | ||
| 130 | +$cmd = "$command -j POST -u /method"; | ||
| 131 | +$result = NPTest->testCmd( $cmd ); | ||
| 132 | +is( $result->return_code, 0, $cmd); | ||
| 133 | +like( $result->output, '/^HTTP OK HTTP/1.1 200 POST - 19 bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output ); | ||
| 134 | + | ||
| 135 | +$cmd = "$command -j GET -u /method"; | ||
| 136 | +$result = NPTest->testCmd( $cmd ); | ||
| 137 | +is( $result->return_code, 0, $cmd); | ||
| 138 | +like( $result->output, '/^HTTP OK HTTP/1.1 200 GET - 18 bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output ); | ||
| 139 | + | ||
| 140 | +$cmd = "$command -u /method"; | ||
| 141 | +$result = NPTest->testCmd( $cmd ); | ||
| 142 | +is( $result->return_code, 0, $cmd); | ||
| 143 | +like( $result->output, '/^HTTP OK HTTP/1.1 200 GET - 18 bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output ); | ||
| 144 | + | ||
| 145 | +$cmd = "$command -P foo -u /method"; | ||
| 146 | +$result = NPTest->testCmd( $cmd ); | ||
| 147 | +is( $result->return_code, 0, $cmd); | ||
| 148 | +like( $result->output, '/^HTTP OK HTTP/1.1 200 POST - 19 bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output ); | ||
| 149 | + | ||
| 150 | +$cmd = "$command -j DELETE -u /method"; | ||
| 151 | +$result = NPTest->testCmd( $cmd ); | ||
| 152 | +is( $result->return_code, 1, $cmd); | ||
| 153 | +like( $result->output, '/^HTTP WARNING: HTTP/1.1 405 Method Not Allowed/', "Output correct: ".$result->output ); | ||
| 154 | + | ||
| 155 | +$cmd = "$command -j foo -u /method"; | ||
| 156 | +$result = NPTest->testCmd( $cmd ); | ||
| 157 | +is( $result->return_code, 2, $cmd); | ||
| 158 | +like( $result->output, '/^HTTP CRITICAL: HTTP/1.1 501 Not Implemented/', "Output correct: ".$result->output ); | ||
diff --git a/web/attachments/297946-patch-plugins__check_nt.c.txt b/web/attachments/297946-patch-plugins__check_nt.c.txt new file mode 100644 index 0000000..a004ad4 --- /dev/null +++ b/web/attachments/297946-patch-plugins__check_nt.c.txt | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | --- plugins/check_nt.c.orig 2008-10-19 14:39:43.000000000 +0200 | ||
| 2 | +++ plugins/check_nt.c 2008-10-19 14:47:19.000000000 +0200 | ||
| 3 | @@ -97,6 +97,8 @@ | ||
| 4 | char *temp_string_perf=NULL; | ||
| 5 | char *description=NULL,*counter_unit = NULL; | ||
| 6 | char *minval = NULL, *maxval = NULL, *errcvt = NULL; | ||
| 7 | + char *fds=NULL; | ||
| 8 | + char *tds=NULL; | ||
| 9 | |||
| 10 | double total_disk_space=0; | ||
| 11 | double free_disk_space=0; | ||
| 12 | @@ -218,33 +220,41 @@ | ||
| 13 | else { | ||
| 14 | asprintf(&send_buffer,"%s&4&%s", req_password, value_list); | ||
| 15 | fetch_data (server_address, server_port, send_buffer); | ||
| 16 | - free_disk_space=atof(strtok(recv_buffer,"&")); | ||
| 17 | - total_disk_space=atof(strtok(NULL,"&")); | ||
| 18 | - percent_used_space = ((total_disk_space - free_disk_space) / total_disk_space) * 100; | ||
| 19 | - warning_used_space = ((float)warning_value / 100) * total_disk_space; | ||
| 20 | - critical_used_space = ((float)critical_value / 100) * total_disk_space; | ||
| 21 | - | ||
| 22 | - if (free_disk_space>=0) { | ||
| 23 | - asprintf(&temp_string,_("%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)"), | ||
| 24 | - value_list, total_disk_space / 1073741824, (total_disk_space - free_disk_space) / 1073741824, | ||
| 25 | - percent_used_space, free_disk_space / 1073741824, (free_disk_space / total_disk_space)*100); | ||
| 26 | - asprintf(&temp_string_perf,_("'%s:\\ Used Space'=%.2fGb;%.2f;%.2f;0.00;%.2f"), value_list, | ||
| 27 | - (total_disk_space - free_disk_space) / 1073741824, warning_used_space / 1073741824, | ||
| 28 | - critical_used_space / 1073741824, total_disk_space / 1073741824); | ||
| 29 | + fds=strtok(recv_buffer,"&"); | ||
| 30 | + tds=strtok(NULL,"&"); | ||
| 31 | |||
| 32 | - if(check_critical_value==TRUE && percent_used_space >= critical_value) | ||
| 33 | - return_code=STATE_CRITICAL; | ||
| 34 | - else if (check_warning_value==TRUE && percent_used_space >= warning_value) | ||
| 35 | - return_code=STATE_WARNING; | ||
| 36 | - else | ||
| 37 | - return_code=STATE_OK; | ||
| 38 | - | ||
| 39 | - output_message = strdup (temp_string); | ||
| 40 | - perfdata = temp_string_perf; | ||
| 41 | + if (fds != NULL) | ||
| 42 | + free_disk_space=atof(fds); | ||
| 43 | + if (tds != NULL) | ||
| 44 | + total_disk_space=atof(tds); | ||
| 45 | + | ||
| 46 | + if (total_disk_space>0) { | ||
| 47 | + percent_used_space = ((total_disk_space - free_disk_space) / total_disk_space) * 100; | ||
| 48 | + warning_used_space = ((float)warning_value / 100) * total_disk_space; | ||
| 49 | + critical_used_space = ((float)critical_value / 100) * total_disk_space; | ||
| 50 | + | ||
| 51 | + if (free_disk_space>=0) { | ||
| 52 | + asprintf(&temp_string,_("%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)"), | ||
| 53 | + value_list, total_disk_space / 1073741824, (total_disk_space - free_disk_space) / 1073741824, | ||
| 54 | + percent_used_space, free_disk_space / 1073741824, (free_disk_space / total_disk_space)*100); | ||
| 55 | + asprintf(&temp_string_perf,_("'%s:\\ Used Space'=%.2fGb;%.2f;%.2f;0.00;%.2f"), value_list, | ||
| 56 | + (total_disk_space - free_disk_space) / 1073741824, warning_used_space / 1073741824, | ||
| 57 | + critical_used_space / 1073741824, total_disk_space / 1073741824); | ||
| 58 | + | ||
| 59 | + if(check_critical_value==TRUE && percent_used_space >= critical_value) | ||
| 60 | + return_code=STATE_CRITICAL; | ||
| 61 | + else if (check_warning_value==TRUE && percent_used_space >= warning_value) | ||
| 62 | + return_code=STATE_WARNING; | ||
| 63 | + else | ||
| 64 | + return_code=STATE_OK; | ||
| 65 | + | ||
| 66 | + output_message = strdup (temp_string); | ||
| 67 | + perfdata = temp_string_perf; | ||
| 68 | + } | ||
| 69 | } else { | ||
| 70 | - output_message = strdup (_("Free disk space : Invalid drive ")); | ||
| 71 | - return_code=STATE_UNKNOWN; | ||
| 72 | - } | ||
| 73 | + output_message = strdup (_("Free disk space : Invalid drive ")); | ||
| 74 | + return_code=STATE_UNKNOWN; | ||
| 75 | + } | ||
| 76 | } | ||
| 77 | break; | ||
diff --git a/web/attachments/299119-check_http.diff b/web/attachments/299119-check_http.diff new file mode 100644 index 0000000..e745e36 --- /dev/null +++ b/web/attachments/299119-check_http.diff | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | *** check_http.c_old 2008-10-27 08:52:54.000000000 +0000 | ||
| 2 | --- check_http.c 2008-10-27 08:54:15.000000000 +0000 | ||
| 3 | *************** | ||
| 4 | *** 968,974 **** | ||
| 5 | --- 968,978 ---- | ||
| 6 | else if (http_status >= 300) { | ||
| 7 | |||
| 8 | if (onredirect == STATE_DEPENDENT) | ||
| 9 | + { | ||
| 10 | + microsec = socket_timeout - deltime(tv)/1.0e6; | ||
| 11 | + alarm( microsec>1?microsec:1 ); | ||
| 12 | redir (header, status_line); | ||
| 13 | + } | ||
| 14 | else if (onredirect == STATE_UNKNOWN) | ||
| 15 | printf (_("HTTP UNKNOWN")); | ||
| 16 | else if (onredirect == STATE_OK) | ||
diff --git a/web/attachments/299693-patch-plugins__check_nt.c.txt b/web/attachments/299693-patch-plugins__check_nt.c.txt new file mode 100644 index 0000000..a004ad4 --- /dev/null +++ b/web/attachments/299693-patch-plugins__check_nt.c.txt | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | --- plugins/check_nt.c.orig 2008-10-19 14:39:43.000000000 +0200 | ||
| 2 | +++ plugins/check_nt.c 2008-10-19 14:47:19.000000000 +0200 | ||
| 3 | @@ -97,6 +97,8 @@ | ||
| 4 | char *temp_string_perf=NULL; | ||
| 5 | char *description=NULL,*counter_unit = NULL; | ||
| 6 | char *minval = NULL, *maxval = NULL, *errcvt = NULL; | ||
| 7 | + char *fds=NULL; | ||
| 8 | + char *tds=NULL; | ||
| 9 | |||
| 10 | double total_disk_space=0; | ||
| 11 | double free_disk_space=0; | ||
| 12 | @@ -218,33 +220,41 @@ | ||
| 13 | else { | ||
| 14 | asprintf(&send_buffer,"%s&4&%s", req_password, value_list); | ||
| 15 | fetch_data (server_address, server_port, send_buffer); | ||
| 16 | - free_disk_space=atof(strtok(recv_buffer,"&")); | ||
| 17 | - total_disk_space=atof(strtok(NULL,"&")); | ||
| 18 | - percent_used_space = ((total_disk_space - free_disk_space) / total_disk_space) * 100; | ||
| 19 | - warning_used_space = ((float)warning_value / 100) * total_disk_space; | ||
| 20 | - critical_used_space = ((float)critical_value / 100) * total_disk_space; | ||
| 21 | - | ||
| 22 | - if (free_disk_space>=0) { | ||
| 23 | - asprintf(&temp_string,_("%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)"), | ||
| 24 | - value_list, total_disk_space / 1073741824, (total_disk_space - free_disk_space) / 1073741824, | ||
| 25 | - percent_used_space, free_disk_space / 1073741824, (free_disk_space / total_disk_space)*100); | ||
| 26 | - asprintf(&temp_string_perf,_("'%s:\\ Used Space'=%.2fGb;%.2f;%.2f;0.00;%.2f"), value_list, | ||
| 27 | - (total_disk_space - free_disk_space) / 1073741824, warning_used_space / 1073741824, | ||
| 28 | - critical_used_space / 1073741824, total_disk_space / 1073741824); | ||
| 29 | + fds=strtok(recv_buffer,"&"); | ||
| 30 | + tds=strtok(NULL,"&"); | ||
| 31 | |||
| 32 | - if(check_critical_value==TRUE && percent_used_space >= critical_value) | ||
| 33 | - return_code=STATE_CRITICAL; | ||
| 34 | - else if (check_warning_value==TRUE && percent_used_space >= warning_value) | ||
| 35 | - return_code=STATE_WARNING; | ||
| 36 | - else | ||
| 37 | - return_code=STATE_OK; | ||
| 38 | - | ||
| 39 | - output_message = strdup (temp_string); | ||
| 40 | - perfdata = temp_string_perf; | ||
| 41 | + if (fds != NULL) | ||
| 42 | + free_disk_space=atof(fds); | ||
| 43 | + if (tds != NULL) | ||
| 44 | + total_disk_space=atof(tds); | ||
| 45 | + | ||
| 46 | + if (total_disk_space>0) { | ||
| 47 | + percent_used_space = ((total_disk_space - free_disk_space) / total_disk_space) * 100; | ||
| 48 | + warning_used_space = ((float)warning_value / 100) * total_disk_space; | ||
| 49 | + critical_used_space = ((float)critical_value / 100) * total_disk_space; | ||
| 50 | + | ||
| 51 | + if (free_disk_space>=0) { | ||
| 52 | + asprintf(&temp_string,_("%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)"), | ||
| 53 | + value_list, total_disk_space / 1073741824, (total_disk_space - free_disk_space) / 1073741824, | ||
| 54 | + percent_used_space, free_disk_space / 1073741824, (free_disk_space / total_disk_space)*100); | ||
| 55 | + asprintf(&temp_string_perf,_("'%s:\\ Used Space'=%.2fGb;%.2f;%.2f;0.00;%.2f"), value_list, | ||
| 56 | + (total_disk_space - free_disk_space) / 1073741824, warning_used_space / 1073741824, | ||
| 57 | + critical_used_space / 1073741824, total_disk_space / 1073741824); | ||
| 58 | + | ||
| 59 | + if(check_critical_value==TRUE && percent_used_space >= critical_value) | ||
| 60 | + return_code=STATE_CRITICAL; | ||
| 61 | + else if (check_warning_value==TRUE && percent_used_space >= warning_value) | ||
| 62 | + return_code=STATE_WARNING; | ||
| 63 | + else | ||
| 64 | + return_code=STATE_OK; | ||
| 65 | + | ||
| 66 | + output_message = strdup (temp_string); | ||
| 67 | + perfdata = temp_string_perf; | ||
| 68 | + } | ||
| 69 | } else { | ||
| 70 | - output_message = strdup (_("Free disk space : Invalid drive ")); | ||
| 71 | - return_code=STATE_UNKNOWN; | ||
| 72 | - } | ||
| 73 | + output_message = strdup (_("Free disk space : Invalid drive ")); | ||
| 74 | + return_code=STATE_UNKNOWN; | ||
| 75 | + } | ||
| 76 | } | ||
| 77 | break; | ||
diff --git a/web/attachments/301093-check_by_ssh_patch.diff b/web/attachments/301093-check_by_ssh_patch.diff new file mode 100644 index 0000000..ca57d51 --- /dev/null +++ b/web/attachments/301093-check_by_ssh_patch.diff | |||
| @@ -0,0 +1,310 @@ | |||
| 1 | --- plugins/check_by_ssh.c | ||
| 2 | +++ plugins/check_by_ssh.c | ||
| 3 | @@ -38,8 +38,11 @@ const char *email = "nagiosplug-devel@li | ||
| 4 | #include "netutils.h" | ||
| 5 | #include "utils.h" | ||
| 6 | #include "runcmd.h" | ||
| 7 | +#ifndef MAXARGS | ||
| 8 | +#define MAXARGS 255 | ||
| 9 | +#endif | ||
| 10 | |||
| 11 | -int process_arguments (int, char **); | ||
| 12 | +int process_arguments (int, char **, char **); | ||
| 13 | int validate_arguments (void); | ||
| 14 | void print_help (void); | ||
| 15 | void print_usage (void); | ||
| 16 | @@ -49,7 +52,6 @@ unsigned int services = 0; | ||
| 17 | int skip_stdout = 0; | ||
| 18 | int skip_stderr = 0; | ||
| 19 | char *remotecmd = NULL; | ||
| 20 | -char *comm = NULL; | ||
| 21 | char *hostname = NULL; | ||
| 22 | char *outputfile = NULL; | ||
| 23 | char *host_shortname = NULL; | ||
| 24 | @@ -68,9 +70,16 @@ main (int argc, char **argv) | ||
| 25 | time_t local_time; | ||
| 26 | FILE *fp = NULL; | ||
| 27 | struct output chld_out, chld_err; | ||
| 28 | + char **newargv; | ||
| 29 | + | ||
| 30 | + | ||
| 31 | + if ((newargv = calloc ((MAXARGS + 1), sizeof(char *))) == NULL) | ||
| 32 | + printf (_("malloc failed")); | ||
| 33 | + | ||
| 34 | + newargv[MAXARGS] = (char *)1; | ||
| 35 | |||
| 36 | remotecmd = ""; | ||
| 37 | - comm = strdup (SSH_COMMAND); | ||
| 38 | + newargv[0] = strdup (SSH_COMMAND); | ||
| 39 | |||
| 40 | setlocale (LC_ALL, ""); | ||
| 41 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 42 | @@ -80,7 +89,7 @@ main (int argc, char **argv) | ||
| 43 | argv=np_extra_opts (&argc, argv, progname); | ||
| 44 | |||
| 45 | /* process arguments */ | ||
| 46 | - if (process_arguments (argc, argv) == ERROR) | ||
| 47 | + if (process_arguments (argc, argv, newargv) == ERROR) | ||
| 48 | usage_va(_("Could not parse arguments")); | ||
| 49 | |||
| 50 | /* Set signal handling and alarm timeout */ | ||
| 51 | @@ -90,11 +99,28 @@ main (int argc, char **argv) | ||
| 52 | alarm (timeout_interval); | ||
| 53 | |||
| 54 | /* run the command */ | ||
| 55 | - if (verbose) | ||
| 56 | - printf ("%s\n", comm); | ||
| 57 | + if (verbose) { | ||
| 58 | + printf ("%s ", newargv[0]); | ||
| 59 | + for (i=1; i <= MAXARGS; i++) { | ||
| 60 | + if (newargv[i] > (char *)1 ) { | ||
| 61 | + printf ("'%s' ", newargv[i]); | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + printf ("\n"); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + result = np_runcmdv(newargv[0], newargv, &chld_out, &chld_err, 0); | ||
| 68 | |||
| 69 | - result = np_runcmd(comm, &chld_out, &chld_err, 0); | ||
| 70 | |||
| 71 | + // free memory to prevent valgrind errors | ||
| 72 | + for (i=0; i <= MAXARGS; i++) { | ||
| 73 | + if (newargv[i] > (char *)1 ) { | ||
| 74 | + free (newargv[i]); | ||
| 75 | + newargv[i]=0; | ||
| 76 | + } | ||
| 77 | + } | ||
| 78 | + free (newargv); | ||
| 79 | + | ||
| 80 | if (skip_stdout == -1) /* --skip-stdout specified without argument */ | ||
| 81 | skip_stdout = chld_out.lines; | ||
| 82 | if (skip_stderr == -1) /* --skip-stderr specified without argument */ | ||
| 83 | @@ -152,10 +178,11 @@ main (int argc, char **argv) | ||
| 84 | |||
| 85 | /* process command-line arguments */ | ||
| 86 | int | ||
| 87 | -process_arguments (int argc, char **argv) | ||
| 88 | +process_arguments (int argc, char **argv, char **newargv) | ||
| 89 | { | ||
| 90 | int c; | ||
| 91 | char *p1, *p2; | ||
| 92 | + char **opts = newargv + 2; | ||
| 93 | |||
| 94 | int option = 0; | ||
| 95 | static struct option longopts[] = { | ||
| 96 | @@ -222,7 +249,8 @@ process_arguments (int argc, char **argv | ||
| 97 | case 'p': /* port number */ | ||
| 98 | if (!is_integer (optarg)) | ||
| 99 | usage_va(_("Port must be a positive integer")); | ||
| 100 | - asprintf (&comm,"%s -p %s", comm, optarg); | ||
| 101 | + add_argument (&opts, "-p"); | ||
| 102 | + add_argument (&opts, optarg); | ||
| 103 | break; | ||
| 104 | case 'O': /* output file */ | ||
| 105 | outputfile = optarg; | ||
| 106 | @@ -246,16 +274,27 @@ process_arguments (int argc, char **argv | ||
| 107 | case 'u': | ||
| 108 | c = 'l'; | ||
| 109 | case 'l': /* login name */ | ||
| 110 | + add_argument (&opts, "-l"); | ||
| 111 | + add_argument (&opts, optarg); | ||
| 112 | + break; | ||
| 113 | case 'i': /* identity */ | ||
| 114 | - asprintf (&comm, "%s -%c %s", comm, c, optarg); | ||
| 115 | + add_argument (&opts, "-i"); | ||
| 116 | + add_argument (&opts, optarg); | ||
| 117 | break; | ||
| 118 | - | ||
| 119 | case '1': /* Pass these switches directly to ssh */ | ||
| 120 | + add_argument (&opts, "-1"); | ||
| 121 | + break; | ||
| 122 | case '2': /* 1 to force version 1, 2 to force version 2 */ | ||
| 123 | + add_argument (&opts, "-2"); | ||
| 124 | + break; | ||
| 125 | case '4': /* -4 for IPv4 */ | ||
| 126 | - case '6': /* -6 for IPv6 */ | ||
| 127 | + add_argument (&opts, "-4"); | ||
| 128 | + break; | ||
| 129 | + case '6': /* -6 for IPv6 */ | ||
| 130 | + add_argument (&opts, "-6"); | ||
| 131 | + break; | ||
| 132 | case 'f': /* fork to background */ | ||
| 133 | - asprintf (&comm, "%s -%c", comm, c); | ||
| 134 | + add_argument (&opts, "-f"); | ||
| 135 | break; | ||
| 136 | case 'C': /* Command for remote machine */ | ||
| 137 | commands++; | ||
| 138 | @@ -280,10 +319,11 @@ process_arguments (int argc, char **argv | ||
| 139 | skip_stderr = atoi (optarg); | ||
| 140 | break; | ||
| 141 | case 'o': /* Extra options for the ssh command */ | ||
| 142 | - asprintf (&comm, "%s -%c '%s'", comm, c, optarg); | ||
| 143 | + add_argument (&opts, "-o"); | ||
| 144 | + add_argument (&opts, optarg); | ||
| 145 | break; | ||
| 146 | case 'q': /* Tell the ssh command to be quiet */ | ||
| 147 | - asprintf (&comm, "%s -%c", comm, c); | ||
| 148 | + add_argument (&opts, "-q"); | ||
| 149 | break; | ||
| 150 | default: /* help */ | ||
| 151 | usage5(); | ||
| 152 | @@ -313,12 +353,25 @@ process_arguments (int argc, char **argv | ||
| 153 | if (remotecmd == NULL || strlen (remotecmd) <= 1) | ||
| 154 | usage_va(_("No remotecmd")); | ||
| 155 | |||
| 156 | - asprintf (&comm, "%s %s '%s'", comm, hostname, remotecmd); | ||
| 157 | + add_argument (&opts, remotecmd); | ||
| 158 | + opts = newargv+1; | ||
| 159 | + add_argument (&opts, hostname); | ||
| 160 | |||
| 161 | return validate_arguments (); | ||
| 162 | } | ||
| 163 | |||
| 164 | +int add_argument (char ***argv, const char *str) | ||
| 165 | +{ | ||
| 166 | + | ||
| 167 | + if (**argv == (char *)1) | ||
| 168 | + die (STATE_UNKNOWN, _("%s: Argument limit of %d exceeded\n"), progname, MAXARGS); | ||
| 169 | |||
| 170 | + **argv = (char *)malloc((strlen(str) * sizeof(char)) +1); | ||
| 171 | + | ||
| 172 | + strcpy(**argv, str); | ||
| 173 | + (*argv)++; | ||
| 174 | + return 0; | ||
| 175 | +} | ||
| 176 | |||
| 177 | int | ||
| 178 | validate_arguments (void) | ||
| 179 | --- plugins/runcmd.c | ||
| 180 | +++ plugins/runcmd.c | ||
| 181 | @@ -46,6 +46,7 @@ | ||
| 182 | #ifdef HAVE_SYS_WAIT_H | ||
| 183 | # include <sys/wait.h> | ||
| 184 | #endif | ||
| 185 | +#include <sys/ioctl.h> | ||
| 186 | |||
| 187 | /** macros **/ | ||
| 188 | #ifndef WEXITSTATUS | ||
| 189 | @@ -87,6 +88,8 @@ static long maxfd = 0; | ||
| 190 | static int np_runcmd_open(const char *, int *, int *) | ||
| 191 | __attribute__((__nonnull__(1, 2, 3))); | ||
| 192 | |||
| 193 | +static int np_runcmd_open_argv(const char *, char **, int *, int *); | ||
| 194 | + | ||
| 195 | static int np_fetch_output(int, output *, int) | ||
| 196 | __attribute__((__nonnull__(2))); | ||
| 197 | |||
| 198 | @@ -118,24 +121,14 @@ void np_runcmd_init(void) | ||
| 199 | static int | ||
| 200 | np_runcmd_open(const char *cmdstring, int *pfd, int *pfderr) | ||
| 201 | { | ||
| 202 | - char *env[2]; | ||
| 203 | char *cmd = NULL; | ||
| 204 | char **argv = NULL; | ||
| 205 | char *str; | ||
| 206 | int argc; | ||
| 207 | size_t cmdlen; | ||
| 208 | - pid_t pid; | ||
| 209 | -#ifdef RLIMIT_CORE | ||
| 210 | - struct rlimit limit; | ||
| 211 | -#endif | ||
| 212 | |||
| 213 | int i = 0; | ||
| 214 | |||
| 215 | - if(!np_pids) NP_RUNCMD_INIT; | ||
| 216 | - | ||
| 217 | - env[0] = strdup("LC_ALL=C"); | ||
| 218 | - env[1] = '\0'; | ||
| 219 | - | ||
| 220 | /* if no command was passed, return with no error */ | ||
| 221 | if (cmdstring == NULL) | ||
| 222 | return -1; | ||
| 223 | @@ -191,6 +184,35 @@ np_runcmd_open(const char *cmdstring, in | ||
| 224 | argv[i++] = str; | ||
| 225 | } | ||
| 226 | |||
| 227 | + | ||
| 228 | + return (np_runcmd_open_argv(argv[0], argv, pfd, pfderr)); | ||
| 229 | +} | ||
| 230 | + | ||
| 231 | +static int | ||
| 232 | +np_runcmd_open_argv(const char *cmdstring, char **argv, int *pfd, int *pfderr) | ||
| 233 | +{ | ||
| 234 | + char *env[2]; | ||
| 235 | + pid_t pid; | ||
| 236 | +#ifdef RLIMIT_CORE | ||
| 237 | + struct rlimit limit; | ||
| 238 | +#endif | ||
| 239 | + | ||
| 240 | + int i = 0; | ||
| 241 | + int master,slave; | ||
| 242 | + | ||
| 243 | + if(!np_pids) NP_RUNCMD_INIT; | ||
| 244 | + | ||
| 245 | + env[0] = strdup("LC_ALL=C"); | ||
| 246 | + env[1] = '\0'; | ||
| 247 | + | ||
| 248 | + /* if no command was passed, return with an error */ | ||
| 249 | + if (cmdstring == NULL) | ||
| 250 | + return -1; | ||
| 251 | + | ||
| 252 | + /* make sure that the command name is also argv[0] */ | ||
| 253 | + if (strcmp(cmdstring, argv[0]) != 0) | ||
| 254 | + return -1; | ||
| 255 | + | ||
| 256 | if (pipe(pfd) < 0 || pipe(pfderr) < 0 || (pid = fork()) < 0) | ||
| 257 | return -1; /* errno set by the failing function */ | ||
| 258 | |||
| 259 | @@ -202,6 +224,11 @@ np_runcmd_open(const char *cmdstring, in | ||
| 260 | limit.rlim_cur = 0; | ||
| 261 | setrlimit (RLIMIT_CORE, &limit); | ||
| 262 | #endif | ||
| 263 | +#ifdef TIOCNOTTY | ||
| 264 | + /* disassociate from tty to prevent e.g. ssh asking for passwords */ | ||
| 265 | + if(isatty(STDOUT_FILENO)) | ||
| 266 | + ioctl(STDOUT_FILENO, TIOCNOTTY); | ||
| 267 | +#endif | ||
| 268 | close (pfd[0]); | ||
| 269 | if (pfd[1] != STDOUT_FILENO) { | ||
| 270 | dup2 (pfd[1], STDOUT_FILENO); | ||
| 271 | @@ -235,7 +262,6 @@ np_runcmd_open(const char *cmdstring, in | ||
| 272 | return pfd[0]; | ||
| 273 | } | ||
| 274 | |||
| 275 | - | ||
| 276 | static int | ||
| 277 | np_runcmd_close(int fd) | ||
| 278 | { | ||
| 279 | @@ -360,3 +386,21 @@ np_runcmd(const char *cmd, output *out, | ||
| 280 | |||
| 281 | return np_runcmd_close(fd); | ||
| 282 | } | ||
| 283 | + | ||
| 284 | +int | ||
| 285 | +np_runcmdv(const char *cmd, char ** argv, output *out, output *err, int flags) | ||
| 286 | +{ | ||
| 287 | + int fd, pfd_out[2], pfd_err[2]; | ||
| 288 | + | ||
| 289 | + /* initialize the structs */ | ||
| 290 | + if(out) memset(out, 0, sizeof(output)); | ||
| 291 | + if(err) memset(err, 0, sizeof(output)); | ||
| 292 | + | ||
| 293 | + if((fd = np_runcmd_open_argv(cmd, argv, pfd_out, pfd_err)) == -1) | ||
| 294 | + die (STATE_UNKNOWN, _("Could not open pipe: %s\n"), cmd); | ||
| 295 | + | ||
| 296 | + if(out) out->lines = np_fetch_output(pfd_out[0], out, flags); | ||
| 297 | + if(err) err->lines = np_fetch_output(pfd_err[0], err, flags); | ||
| 298 | + | ||
| 299 | + return np_runcmd_close(fd); | ||
| 300 | +} | ||
| 301 | --- plugins/runcmd.h | ||
| 302 | +++ plugins/runcmd.h | ||
| 303 | @@ -40,6 +40,7 @@ typedef struct output output; | ||
| 304 | |||
| 305 | /** prototypes **/ | ||
| 306 | int np_runcmd(const char *, output *, output *, int); | ||
| 307 | +int np_runcmdv(const char *, char **, output *, output *, int); | ||
| 308 | void popen_timeout_alarm_handler(int) | ||
| 309 | __attribute__((__noreturn__)); | ||
| 310 | |||
diff --git a/web/attachments/302833-nagios-plugins-check_fping-timeout-1.4.13.patch b/web/attachments/302833-nagios-plugins-check_fping-timeout-1.4.13.patch new file mode 100644 index 0000000..965631e --- /dev/null +++ b/web/attachments/302833-nagios-plugins-check_fping-timeout-1.4.13.patch | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | diff -urN nagios-plugins-1.4.13.ORIG/plugins/check_fping.c nagios-plugins-1.4.13/plugins/check_fping.c | ||
| 2 | --- nagios-plugins-1.4.13.ORIG/plugins/check_fping.c 2008-11-15 08:39:42.000000000 +0000 | ||
| 3 | +++ nagios-plugins-1.4.13/plugins/check_fping.c 2008-11-15 10:03:56.000000000 +0000 | ||
| 4 | @@ -46,7 +46,8 @@ | ||
| 5 | PACKET_COUNT = 1, | ||
| 6 | PACKET_SIZE = 56, | ||
| 7 | PL = 0, | ||
| 8 | - RTA = 1 | ||
| 9 | + RTA = 1, | ||
| 10 | + TARGET_TIMEOUT = 500 | ||
| 11 | }; | ||
| 12 | |||
| 13 | int textscan (char *buf); | ||
| 14 | @@ -58,6 +59,7 @@ | ||
| 15 | char *server_name = NULL; | ||
| 16 | int packet_size = PACKET_SIZE; | ||
| 17 | int packet_count = PACKET_COUNT; | ||
| 18 | +int target_timeout = TARGET_TIMEOUT; | ||
| 19 | int verbose = FALSE; | ||
| 20 | int cpl; | ||
| 21 | int wpl; | ||
| 22 | @@ -92,8 +94,8 @@ | ||
| 23 | server = strscpy (server, server_name); | ||
| 24 | |||
| 25 | /* compose the command */ | ||
| 26 | - asprintf (&command_line, "%s -b %d -c %d %s", PATH_TO_FPING, | ||
| 27 | - packet_size, packet_count, server); | ||
| 28 | + asprintf (&command_line, "%s -t %d -b %d -c %d %s", PATH_TO_FPING, | ||
| 29 | + target_timeout, packet_size, packet_count, server); | ||
| 30 | |||
| 31 | if (verbose) | ||
| 32 | printf ("%s\n", command_line); | ||
| 33 | @@ -252,7 +254,7 @@ | ||
| 34 | } | ||
| 35 | |||
| 36 | while (1) { | ||
| 37 | - c = getopt_long (argc, argv, "+hVvH:c:w:b:n:", longopts, &option); | ||
| 38 | + c = getopt_long (argc, argv, "+hVvH:c:w:b:n:t:", longopts, &option); | ||
| 39 | |||
| 40 | if (c == -1 || c == EOF || c == 1) | ||
| 41 | break; | ||
| 42 | @@ -313,6 +315,12 @@ | ||
| 43 | else | ||
| 44 | usage (_("Packet count must be a positive integer")); | ||
| 45 | break; | ||
| 46 | + case 't': /* timeout in msec */ | ||
| 47 | + if (is_intpos (optarg)) | ||
| 48 | + target_timeout = atoi (optarg); | ||
| 49 | + else | ||
| 50 | + usage (_("Target timeout must be a positive integer")); | ||
| 51 | + break; | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | @@ -414,5 +422,5 @@ | ||
| 56 | print_usage (void) | ||
| 57 | { | ||
| 58 | printf (_("Usage:")); | ||
| 59 | - printf (" %s <host_address> -w limit -c limit [-b size] [-n number]\n", progname); | ||
| 60 | + printf (" %s <host_address> -w limit -c limit [-b size] [-n number] [-t number]\n", progname); | ||
| 61 | } | ||
| 62 | |||
diff --git a/web/attachments/302869-perl-snmpv3.patch.gz b/web/attachments/302869-perl-snmpv3.patch.gz new file mode 100644 index 0000000..fc80fbd --- /dev/null +++ b/web/attachments/302869-perl-snmpv3.patch.gz | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-5 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378824082" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378824082" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378824082" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378824082" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378824082'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=2343438&group_id=29880&atid=397597&file_id=302869" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/302871-perl-snmpv3.patch.gz b/web/attachments/302871-perl-snmpv3.patch.gz new file mode 100644 index 0000000..c9d745e --- /dev/null +++ b/web/attachments/302871-perl-snmpv3.patch.gz | |||
| Binary files differ | |||
diff --git a/web/attachments/302952-check_ifstatus b/web/attachments/302952-check_ifstatus new file mode 100644 index 0000000..2381fd2 --- /dev/null +++ b/web/attachments/302952-check_ifstatus | |||
| @@ -0,0 +1,483 @@ | |||
| 1 | #! /opt/coolstack/bin/perl -w | ||
| 2 | # vim:foldmethod=syntax:tabstop=4:shiftwidth=4 | ||
| 3 | # | ||
| 4 | # Matthew Martin, Tuesday August 14, 2007 | ||
| 5 | # Problems with check_ifstatus.pl | ||
| 6 | # 1) "No response from remote host" should be unknown, not critical, right? | ||
| 7 | # 2) Serial link "dormant" should be critical, not okay | ||
| 8 | # 3) dormant, excluded and unused interfaces are not correctly counted | ||
| 9 | # 4) add some default exclusions | ||
| 10 | # | ||
| 11 | # check_ifstatus.pl - nagios plugin | ||
| 12 | # | ||
| 13 | # | ||
| 14 | # Copyright (C) 2000 Christoph Kron | ||
| 15 | # Modified 5/2002 to conform to updated Nagios Plugin Guidelines (S. Ghosh) | ||
| 16 | # Added -x option (4/2003) | ||
| 17 | # Added -u option (4/2003) | ||
| 18 | # Added -M option (10/2003) | ||
| 19 | # Added SNMPv3 support (10/2003) | ||
| 20 | # | ||
| 21 | # This program is free software; you can redistribute it and/or | ||
| 22 | # modify it under the terms of the GNU General Public License | ||
| 23 | # as published by the Free Software Foundation; either version 2 | ||
| 24 | # of the License, or (at your option) any later version. | ||
| 25 | # | ||
| 26 | # This program is distributed in the hope that it will be useful, | ||
| 27 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 28 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 29 | # GNU General Public License for more details. | ||
| 30 | # | ||
| 31 | # You should have received a copy of the GNU General Public License | ||
| 32 | # along with this program; if not, write to the Free Software | ||
| 33 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 34 | # | ||
| 35 | # | ||
| 36 | # Report bugs to: ck@zet.net, nagiosplug-help@lists.sf.net | ||
| 37 | # | ||
| 38 | # 11.01.2000 Version 1.0 | ||
| 39 | # | ||
| 40 | # $Id: check_ifstatus.pl 884 2004-08-18 19:51:35Z tonvoon $ | ||
| 41 | |||
| 42 | use POSIX; | ||
| 43 | use strict; | ||
| 44 | use lib "/opt/nagios-3.0.5/libexec" ; | ||
| 45 | use utils qw($TIMEOUT %ERRORS &print_revision &support); | ||
| 46 | |||
| 47 | use Net::SNMP; | ||
| 48 | use Getopt::Long; | ||
| 49 | Getopt::Long::Configure('bundling'); | ||
| 50 | |||
| 51 | my $PROGNAME = "check_ifstatus"; | ||
| 52 | |||
| 53 | sub print_help (); | ||
| 54 | sub usage (); | ||
| 55 | sub process_arguments (); | ||
| 56 | |||
| 57 | |||
| 58 | my $status; | ||
| 59 | my %ifOperStatus = ('1','up', | ||
| 60 | '2','down', | ||
| 61 | '3','testing', | ||
| 62 | '4','unknown', | ||
| 63 | '5','dormant', | ||
| 64 | '6','notPresent', | ||
| 65 | '7','lowerLayerDown'); # down due to the state of lower layer interface(s)); | ||
| 66 | |||
| 67 | my $timeout ; | ||
| 68 | my $state = "UNKNOWN"; | ||
| 69 | my $answer = ""; | ||
| 70 | my $snmpkey=0; | ||
| 71 | my $snmpoid=0; | ||
| 72 | my $key=0; | ||
| 73 | my $community = "public"; | ||
| 74 | my $maxmsgsize = 1472 ; # Net::SNMP default is 1472 | ||
| 75 | my ($seclevel, $authproto, $secname, $authpass, $privpass, $auth, $priv, $context); | ||
| 76 | my $port = 161; | ||
| 77 | my @snmpoids; | ||
| 78 | my $snmpIfAdminStatus = '1.3.6.1.2.1.2.2.1.7'; | ||
| 79 | my $snmpIfDescr = '1.3.6.1.2.1.2.2.1.2'; | ||
| 80 | my $snmpIfOperStatus = '1.3.6.1.2.1.2.2.1.8'; | ||
| 81 | my $snmpIfName = '1.3.6.1.2.1.31.1.1.1.1'; | ||
| 82 | my $snmpIfAlias = '1.3.6.1.2.1.31.1.1.1.18'; | ||
| 83 | my $snmpLocIfDescr = '1.3.6.1.4.1.9.2.2.1.1.28'; | ||
| 84 | my $snmpIfType = '1.3.6.1.2.1.2.2.1.3'; | ||
| 85 | my $hostname; | ||
| 86 | my $session; | ||
| 87 | my $error; | ||
| 88 | my $response; | ||
| 89 | my %ifStatus; | ||
| 90 | my $ifup =0 ; | ||
| 91 | my $ifdown =0; | ||
| 92 | my $ifdormant = 0; | ||
| 93 | my $ifexclude = 0 ; | ||
| 94 | my $ifunused = 0; | ||
| 95 | my $ifmessage = ""; | ||
| 96 | my $snmp_version = 1; | ||
| 97 | my $ifXTable; | ||
| 98 | my $opt_h ; | ||
| 99 | my $opt_V ; | ||
| 100 | my $opt_u; | ||
| 101 | my $opt_x ; | ||
| 102 | my %excluded ; | ||
| 103 | my @unused_ports ; | ||
| 104 | |||
| 105 | # Just in case of problems, let's not hang Nagios | ||
| 106 | $SIG{'ALRM'} = sub { | ||
| 107 | print ("ERROR: No snmp response from $hostname (alarm timeout)\n"); | ||
| 108 | exit $ERRORS{"UNKNOWN"}; | ||
| 109 | }; | ||
| 110 | |||
| 111 | |||
| 112 | #Option checking | ||
| 113 | $status = process_arguments(); | ||
| 114 | |||
| 115 | if ($status != 0) | ||
| 116 | { | ||
| 117 | print_help() ; | ||
| 118 | exit $ERRORS{'OK'}; | ||
| 119 | } | ||
| 120 | |||
| 121 | |||
| 122 | alarm($timeout); | ||
| 123 | |||
| 124 | push(@snmpoids,$snmpIfOperStatus); | ||
| 125 | push(@snmpoids,$snmpIfAdminStatus); | ||
| 126 | push(@snmpoids,$snmpIfDescr); | ||
| 127 | push(@snmpoids,$snmpIfType); | ||
| 128 | push(@snmpoids,$snmpIfName) if ( defined $ifXTable); | ||
| 129 | push(@snmpoids,$snmpIfAlias) if ( defined $ifXTable); | ||
| 130 | |||
| 131 | |||
| 132 | |||
| 133 | |||
| 134 | foreach $snmpoid (@snmpoids) { | ||
| 135 | |||
| 136 | if (!defined($response = $session->get_table($snmpoid))) { | ||
| 137 | $answer=$session->error; | ||
| 138 | $session->close; | ||
| 139 | # mgmart6. Tuesday August 14, 2007 | ||
| 140 | # I think a SNMP error should give UNKNOWN, not CRITICAL | ||
| 141 | #$state = 'CRITICAL'; | ||
| 142 | $state = 'UNKNOWN'; | ||
| 143 | if ( ( $snmpoid =~ $snmpIfName ) && defined $ifXTable ) { | ||
| 144 | print ("$state: Device does not support ifTable - try without -I option\n"); | ||
| 145 | }else{ | ||
| 146 | print ("$state: $answer for $snmpoid with snmp version $snmp_version\n"); | ||
| 147 | } | ||
| 148 | exit $ERRORS{$state}; | ||
| 149 | } | ||
| 150 | |||
| 151 | foreach $snmpkey (keys %{$response}) { | ||
| 152 | $snmpkey =~ /.*\.(\d+)$/; | ||
| 153 | $key = $1; | ||
| 154 | $ifStatus{$key}{$snmpoid} = $response->{$snmpkey}; | ||
| 155 | } | ||
| 156 | } | ||
| 157 | |||
| 158 | |||
| 159 | $session->close; | ||
| 160 | |||
| 161 | alarm(0); | ||
| 162 | |||
| 163 | # mgmart6. This script cannot tell that specific logical interfaces are | ||
| 164 | # associated with their phys IF so it checks them all. | ||
| 165 | foreach $key (keys %ifStatus) { | ||
| 166 | |||
| 167 | # Skip interfaces flagged with -u (--unused_ports) | ||
| 168 | # "A comma separated list of ifIndex values that should be excluded" | ||
| 169 | if (!defined($ifStatus{$key}{'notInUse'})) { | ||
| 170 | # check only if interface is administratively up | ||
| 171 | if ($ifStatus{$key}{$snmpIfAdminStatus} == 1 ) { | ||
| 172 | |||
| 173 | # check only if interface type is not listed in %excluded | ||
| 174 | if (!defined $excluded{$ifStatus{$key}{$snmpIfType}} ) { | ||
| 175 | if ($ifStatus{$key}{$snmpIfOperStatus} == 1 ) { $ifup++ ;} | ||
| 176 | if ($ifStatus{$key}{$snmpIfOperStatus} == 2 ) { | ||
| 177 | $ifdown++ ; | ||
| 178 | if (defined $ifXTable) { | ||
| 179 | $ifmessage .= sprintf("%s: down -> %s<BR>", | ||
| 180 | $ifStatus{$key}{$snmpIfName}, | ||
| 181 | $ifStatus{$key}{$snmpIfAlias}); | ||
| 182 | }else{ | ||
| 183 | $ifmessage .= sprintf("%s: down <BR>", | ||
| 184 | $ifStatus{$key}{$snmpIfDescr}); | ||
| 185 | } | ||
| 186 | } | ||
| 187 | if ($ifStatus{$key}{$snmpIfOperStatus} == 5 ) { $ifdormant++ ;} | ||
| 188 | # Matthew Martin Interface is listed in %excluded | ||
| 189 | } else { | ||
| 190 | $ifexclude++; | ||
| 191 | } | ||
| 192 | # mgmart6 If not administratively up, mark as unused. | ||
| 193 | } elsif ($ifStatus{$key}{$snmpIfAdminStatus} == 2 ) { | ||
| 194 | $ifunused++; | ||
| 195 | } | ||
| 196 | }else{ | ||
| 197 | # mgmart6. Original line: $ifunused++; | ||
| 198 | # actually matches the flag | ||
| 199 | # -u (--unused_ports) A comma separated list of ifIndex values that should be excluded | ||
| 200 | # They should be marked as excluded, not unused. | ||
| 201 | $ifexclude++; | ||
| 202 | } | ||
| 203 | } | ||
| 204 | |||
| 205 | # mgmart6 | ||
| 206 | # The original has dormant serial interfaces return status of "OK". | ||
| 207 | # A dormant serial connection should be CRITICAL, right? | ||
| 208 | # I changed the following line to address this: | ||
| 209 | #if ($ifdown > 0) { | ||
| 210 | if (($ifdown > 0) || ($ifdormant > 0)) { | ||
| 211 | $state = 'CRITICAL'; | ||
| 212 | $answer = sprintf("host '%s', interfaces up: %d, down: %d, dormant: %d, excluded: %d, unused: %d<BR>", | ||
| 213 | $hostname, | ||
| 214 | $ifup, | ||
| 215 | $ifdown, | ||
| 216 | $ifdormant, | ||
| 217 | $ifexclude, | ||
| 218 | $ifunused); | ||
| 219 | $answer = $answer . $ifmessage . "\n"; | ||
| 220 | } else { | ||
| 221 | $state = 'OK'; | ||
| 222 | $answer = sprintf("host '%s', interfaces up: %d, down: %d, dormant: %d, excluded: %d, unused: %d", | ||
| 223 | $hostname, | ||
| 224 | $ifup, | ||
| 225 | $ifdown, | ||
| 226 | $ifdormant, | ||
| 227 | $ifexclude, | ||
| 228 | $ifunused); | ||
| 229 | } | ||
| 230 | my $perfdata = sprintf("up=%d,down=%d,dormant=%d,excluded=%d,unused=%d",$ifup,$ifdown,$ifdormant,$ifexclude,$ifunused); | ||
| 231 | print ("$state: $answer |$perfdata\n"); | ||
| 232 | exit $ERRORS{$state}; | ||
| 233 | |||
| 234 | |||
| 235 | sub usage (){ | ||
| 236 | printf "\nMissing arguments!\n"; | ||
| 237 | printf "\n"; | ||
| 238 | printf "check_ifstatus -C <READCOMMUNITY> -p <PORT> -H <HOSTNAME>\n"; | ||
| 239 | printf "Copyright (C) 2000 Christoph Kron\n"; | ||
| 240 | printf "Updates 5/2002 Subhendu Ghosh\n"; | ||
| 241 | printf "\n\n"; | ||
| 242 | support(); | ||
| 243 | exit $ERRORS{"UNKNOWN"}; | ||
| 244 | } | ||
| 245 | |||
| 246 | sub print_help (){ | ||
| 247 | printf "check_ifstatus plugin for Nagios monitors operational \n"; | ||
| 248 | printf "status of each network interface on the target host\n"; | ||
| 249 | printf "\nUsage:\n"; | ||
| 250 | printf " -H (--hostname) Hostname to query - (required)\n"; | ||
| 251 | printf " -C (--community) SNMP read community (defaults to public,\n"; | ||
| 252 | printf " used with SNMP v1 and v2c\n"; | ||
| 253 | printf " -v (--snmp_version) 1 for SNMP v1 (default)\n"; | ||
| 254 | printf " 2 for SNMP v2c\n"; | ||
| 255 | printf " SNMP v2c will use get_bulk for less overhead\n"; | ||
| 256 | printf " 3 for SNMPv3 (requires -U option)"; | ||
| 257 | printf " -p (--port) SNMP port (default 161)\n"; | ||
| 258 | printf " -I (--ifmib) Agent supports IFMIB ifXTable. For Cisco - this will provide\n"; | ||
| 259 | printf " the descriptive name. Do not use if you don't know what this is. \n"; | ||
| 260 | printf " -x (--exclude) A comma separated list of ifType values that should be excluded \n"; | ||
| 261 | printf " from the report (default for an empty list is PPP(23).\n"; | ||
| 262 | printf " -u (--unused_ports) A comma separated list of ifIndex values that should be excluded \n"; | ||
| 263 | printf " from the report (default is an empty exclusion list).\n"; | ||
| 264 | printf " See the IANAifType-MIB for a list of interface types.\n"; | ||
| 265 | printf " -L (--seclevel) choice of \"noAuthNoPriv\", \"authNoPriv\", or \"authPriv\"\n"; | ||
| 266 | printf " -U (--secname) username for SNMPv3 context\n"; | ||
| 267 | printf " -c (--context) SNMPv3 context name (default is empty string)"; | ||
| 268 | printf " -A (--authpass) authentication password (cleartext ascii or localized key\n"; | ||
| 269 | printf " in hex with 0x prefix generated by using \"snmpkey\" utility\n"; | ||
| 270 | printf " auth password and authEngineID\n"; | ||
| 271 | printf " -a (--authproto) Authentication protocol ( MD5 or SHA1)\n"; | ||
| 272 | printf " -X (--privpass) privacy password (cleartext ascii or localized key\n"; | ||
| 273 | printf " in hex with 0x prefix generated by using \"snmpkey\" utility\n"; | ||
| 274 | printf " privacy password and authEngineID\n"; | ||
| 275 | printf " -M (--maxmsgsize) Max message size - usefull only for v1 or v2c\n"; | ||
| 276 | printf " -t (--timeout) seconds before the plugin times out (default=$TIMEOUT)\n"; | ||
| 277 | printf " -V (--version) Plugin version\n"; | ||
| 278 | printf " -h (--help) usage help \n\n"; | ||
| 279 | print_revision($PROGNAME, '$Revision: 884 $'); | ||
| 280 | |||
| 281 | } | ||
| 282 | |||
| 283 | sub process_arguments() { | ||
| 284 | $status = GetOptions( | ||
| 285 | "V" => \$opt_V, "version" => \$opt_V, | ||
| 286 | "h" => \$opt_h, "help" => \$opt_h, | ||
| 287 | "v=i" => \$snmp_version, "snmp_version=i" => \$snmp_version, | ||
| 288 | "C=s" => \$community,"community=s" => \$community, | ||
| 289 | "L=s" => \$seclevel, "seclevel=s" => \$seclevel, | ||
| 290 | "a=s" => \$authproto, "authproto=s" => \$authproto, | ||
| 291 | "U=s" => \$secname, "secname=s" => \$secname, | ||
| 292 | "A=s" => \$authpass, "authpass=s" => \$authpass, | ||
| 293 | "X=s" => \$privpass, "privpass=s" => \$privpass, | ||
| 294 | "c=s" => \$context, "context=s" => \$context, | ||
| 295 | "p=i" =>\$port, "port=i" => \$port, | ||
| 296 | "H=s" => \$hostname, "hostname=s" => \$hostname, | ||
| 297 | "I" => \$ifXTable, "ifmib" => \$ifXTable, | ||
| 298 | "x:s" => \$opt_x, "exclude:s" => \$opt_x, | ||
| 299 | "u=s" => \$opt_u, "unused_ports=s" => \$opt_u, | ||
| 300 | "M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize, | ||
| 301 | "t=i" => \$timeout, "timeout=i" => \$timeout, | ||
| 302 | ); | ||
| 303 | |||
| 304 | if ($status == 0){ | ||
| 305 | print_help() ; | ||
| 306 | exit $ERRORS{'OK'}; | ||
| 307 | } | ||
| 308 | if ($opt_V) { | ||
| 309 | print_revision($PROGNAME,'$Revision: 884 $ '); | ||
| 310 | exit $ERRORS{'OK'}; | ||
| 311 | } | ||
| 312 | |||
| 313 | if ($opt_h) { | ||
| 314 | print_help(); | ||
| 315 | exit $ERRORS{'OK'}; | ||
| 316 | } | ||
| 317 | |||
| 318 | unless (defined $timeout) { | ||
| 319 | $timeout = $TIMEOUT; | ||
| 320 | } | ||
| 321 | |||
| 322 | if ($snmp_version =~ /3/ ) { | ||
| 323 | # Must define a security level even though default is noAuthNoPriv | ||
| 324 | # v3 requires a security username | ||
| 325 | if (defined $seclevel && defined $secname) { | ||
| 326 | |||
| 327 | # Must define a security level even though defualt is noAuthNoPriv | ||
| 328 | unless ($seclevel eq ('noAuthNoPriv' || 'authNoPriv' || 'authPriv' ) ) { | ||
| 329 | usage(); | ||
| 330 | exit $ERRORS{"UNKNOWN"}; | ||
| 331 | } | ||
| 332 | |||
| 333 | # Authentication wanted | ||
| 334 | if ($seclevel eq ('authNoPriv' || 'authPriv') ) { | ||
| 335 | |||
| 336 | unless ($authproto eq ('MD5' || 'SHA1') ) { | ||
| 337 | usage(); | ||
| 338 | exit $ERRORS{"UNKNOWN"}; | ||
| 339 | } | ||
| 340 | |||
| 341 | if ( !defined $authpass) { | ||
| 342 | usage(); | ||
| 343 | exit $ERRORS{"UNKNOWN"}; | ||
| 344 | }else{ | ||
| 345 | if ($authpass =~ /^0x/ ) { | ||
| 346 | $auth = "-authkey => $authpass" ; | ||
| 347 | }else{ | ||
| 348 | $auth = "-authpassword => $authpass"; | ||
| 349 | } | ||
| 350 | } | ||
| 351 | |||
| 352 | } | ||
| 353 | |||
| 354 | # Privacy (DES encryption) wanted | ||
| 355 | if ($seclevel eq 'authPriv' ) { | ||
| 356 | if (! defined $privpass) { | ||
| 357 | usage(); | ||
| 358 | exit $ERRORS{"UNKNOWN"}; | ||
| 359 | }else{ | ||
| 360 | if ($privpass =~ /^0x/){ | ||
| 361 | $priv = "-privkey => $privpass"; | ||
| 362 | }else{ | ||
| 363 | $priv = "-privpassword => $privpass"; | ||
| 364 | } | ||
| 365 | } | ||
| 366 | } | ||
| 367 | |||
| 368 | # Context name defined or default | ||
| 369 | |||
| 370 | unless ( defined $context) { | ||
| 371 | $context = ""; | ||
| 372 | } | ||
| 373 | |||
| 374 | |||
| 375 | |||
| 376 | }else { | ||
| 377 | usage(); | ||
| 378 | exit $ERRORS{'UNKNOWN'}; ; | ||
| 379 | } | ||
| 380 | } # end snmpv3 | ||
| 381 | |||
| 382 | # for snmp v1 & v2c we default to community = "public" | ||
| 383 | |||
| 384 | # Excluded interfaces types (ifType) (backup interfaces, dial-on demand interfaces, PPP interfaces | ||
| 385 | if (defined $opt_x) { | ||
| 386 | my @x = split(/,/, $opt_x); | ||
| 387 | if ( @x) { | ||
| 388 | foreach $key (@x){ | ||
| 389 | $excluded{$key} = 1; | ||
| 390 | } | ||
| 391 | } | ||
| 392 | # Matthew Martin In the original this else was nested wrong and never matched | ||
| 393 | } else { | ||
| 394 | $excluded{23} = 1; # default PPP(23) if empty list - note (AIX seems to think PPP is 22 according to a post) | ||
| 395 | $excluded{24} = 1; # mgmart6, Tuesday August 14, 2007, Nokia, ifDescr.6 = loop0c0 Software Loopback Layer -- ifType.6 = softwareLoopback(24) (taken from a Nokia IP330) | ||
| 396 | $excluded{25} = 1; # mgmart6, Tuesday August 14, 2007, Nokia, ifDescr.1 = pppoe0 Ethernet Layer -- ifType.1 = eon(25) (from a Nokia IP350) | ||
| 397 | } | ||
| 398 | |||
| 399 | # Excluded interface ports (ifIndex) - management reasons | ||
| 400 | if ($opt_u) { | ||
| 401 | @unused_ports = split(/,/,$opt_u); | ||
| 402 | foreach $key (@unused_ports) { | ||
| 403 | $ifStatus{$key}{'notInUse'}++ ; | ||
| 404 | } | ||
| 405 | } | ||
| 406 | |||
| 407 | if (! utils::is_hostname($hostname)){ | ||
| 408 | usage(); | ||
| 409 | exit $ERRORS{"UNKNOWN"}; | ||
| 410 | } | ||
| 411 | |||
| 412 | # create SNMP session handle based on options passed. | ||
| 413 | |||
| 414 | if ( ! $snmp_version ) { | ||
| 415 | $snmp_version =1 ; | ||
| 416 | }else{ | ||
| 417 | if ( $snmp_version =~ /[12]/ ) { | ||
| 418 | |||
| 419 | ($session, $error) = Net::SNMP->session( | ||
| 420 | -hostname => $hostname, | ||
| 421 | -community => $community, | ||
| 422 | -port => $port, | ||
| 423 | -version => $snmp_version, | ||
| 424 | -maxmsgsize => $maxmsgsize | ||
| 425 | ); | ||
| 426 | |||
| 427 | if (!defined($session)) { | ||
| 428 | $state='UNKNOWN'; | ||
| 429 | $answer=$error; | ||
| 430 | print ("$state: $answer"); | ||
| 431 | exit $ERRORS{$state}; | ||
| 432 | } | ||
| 433 | |||
| 434 | |||
| 435 | }elsif ( $snmp_version =~ /3/ ) { | ||
| 436 | |||
| 437 | if ($seclevel eq 'noAuthNoPriv') { | ||
| 438 | ($session, $error) = Net::SNMP->session( | ||
| 439 | -hostname => $hostname, | ||
| 440 | -port => $port, | ||
| 441 | -version => $snmp_version, | ||
| 442 | -username => $secname, | ||
| 443 | ); | ||
| 444 | |||
| 445 | }elsif ( $seclevel eq 'authNoPriv' ) { | ||
| 446 | ($session, $error) = Net::SNMP->session( | ||
| 447 | -hostname => $hostname, | ||
| 448 | -port => $port, | ||
| 449 | -version => $snmp_version, | ||
| 450 | -username => $secname, | ||
| 451 | -authprotocol => $authproto, | ||
| 452 | $auth | ||
| 453 | ); | ||
| 454 | }elsif ($seclevel eq 'authPriv' ) { | ||
| 455 | ($session, $error) = Net::SNMP->session( | ||
| 456 | -hostname => $hostname, | ||
| 457 | -port => $port, | ||
| 458 | -version => $snmp_version, | ||
| 459 | -username => $secname, | ||
| 460 | -authprotocol => $authproto, | ||
| 461 | $auth, | ||
| 462 | $priv | ||
| 463 | ); | ||
| 464 | } | ||
| 465 | |||
| 466 | |||
| 467 | if (!defined($session)) { | ||
| 468 | $state='UNKNOWN'; | ||
| 469 | $answer=$error; | ||
| 470 | print ("$state: $answer"); | ||
| 471 | exit $ERRORS{$state}; | ||
| 472 | } | ||
| 473 | |||
| 474 | }else{ | ||
| 475 | $state='UNKNOWN'; | ||
| 476 | print ("$state: No support for SNMP v$snmp_version yet\n"); | ||
| 477 | exit $ERRORS{$state}; | ||
| 478 | } | ||
| 479 | } | ||
| 480 | |||
| 481 | return $ERRORS{"OK"}; | ||
| 482 | |||
| 483 | } | ||
diff --git a/web/attachments/302976-nagios-plugins-check_fping-timeout-1.4.13.patch b/web/attachments/302976-nagios-plugins-check_fping-timeout-1.4.13.patch new file mode 100644 index 0000000..965631e --- /dev/null +++ b/web/attachments/302976-nagios-plugins-check_fping-timeout-1.4.13.patch | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | diff -urN nagios-plugins-1.4.13.ORIG/plugins/check_fping.c nagios-plugins-1.4.13/plugins/check_fping.c | ||
| 2 | --- nagios-plugins-1.4.13.ORIG/plugins/check_fping.c 2008-11-15 08:39:42.000000000 +0000 | ||
| 3 | +++ nagios-plugins-1.4.13/plugins/check_fping.c 2008-11-15 10:03:56.000000000 +0000 | ||
| 4 | @@ -46,7 +46,8 @@ | ||
| 5 | PACKET_COUNT = 1, | ||
| 6 | PACKET_SIZE = 56, | ||
| 7 | PL = 0, | ||
| 8 | - RTA = 1 | ||
| 9 | + RTA = 1, | ||
| 10 | + TARGET_TIMEOUT = 500 | ||
| 11 | }; | ||
| 12 | |||
| 13 | int textscan (char *buf); | ||
| 14 | @@ -58,6 +59,7 @@ | ||
| 15 | char *server_name = NULL; | ||
| 16 | int packet_size = PACKET_SIZE; | ||
| 17 | int packet_count = PACKET_COUNT; | ||
| 18 | +int target_timeout = TARGET_TIMEOUT; | ||
| 19 | int verbose = FALSE; | ||
| 20 | int cpl; | ||
| 21 | int wpl; | ||
| 22 | @@ -92,8 +94,8 @@ | ||
| 23 | server = strscpy (server, server_name); | ||
| 24 | |||
| 25 | /* compose the command */ | ||
| 26 | - asprintf (&command_line, "%s -b %d -c %d %s", PATH_TO_FPING, | ||
| 27 | - packet_size, packet_count, server); | ||
| 28 | + asprintf (&command_line, "%s -t %d -b %d -c %d %s", PATH_TO_FPING, | ||
| 29 | + target_timeout, packet_size, packet_count, server); | ||
| 30 | |||
| 31 | if (verbose) | ||
| 32 | printf ("%s\n", command_line); | ||
| 33 | @@ -252,7 +254,7 @@ | ||
| 34 | } | ||
| 35 | |||
| 36 | while (1) { | ||
| 37 | - c = getopt_long (argc, argv, "+hVvH:c:w:b:n:", longopts, &option); | ||
| 38 | + c = getopt_long (argc, argv, "+hVvH:c:w:b:n:t:", longopts, &option); | ||
| 39 | |||
| 40 | if (c == -1 || c == EOF || c == 1) | ||
| 41 | break; | ||
| 42 | @@ -313,6 +315,12 @@ | ||
| 43 | else | ||
| 44 | usage (_("Packet count must be a positive integer")); | ||
| 45 | break; | ||
| 46 | + case 't': /* timeout in msec */ | ||
| 47 | + if (is_intpos (optarg)) | ||
| 48 | + target_timeout = atoi (optarg); | ||
| 49 | + else | ||
| 50 | + usage (_("Target timeout must be a positive integer")); | ||
| 51 | + break; | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | @@ -414,5 +422,5 @@ | ||
| 56 | print_usage (void) | ||
| 57 | { | ||
| 58 | printf (_("Usage:")); | ||
| 59 | - printf (" %s <host_address> -w limit -c limit [-b size] [-n number]\n", progname); | ||
| 60 | + printf (" %s <host_address> -w limit -c limit [-b size] [-n number] [-t number]\n", progname); | ||
| 61 | } | ||
| 62 | |||
diff --git a/web/attachments/30350-check_smtp.c.diff b/web/attachments/30350-check_smtp.c.diff new file mode 100644 index 0000000..aa1c86c --- /dev/null +++ b/web/attachments/30350-check_smtp.c.diff | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | --- nagiosplug-1.3-beta1/plugins/check_smtp.c Mon Jun 10 05:24:06 2002 | ||
| 2 | +++ nagiosplug-1.3-beta1-BALU/plugins/check_smtp.c Tue Sep 3 15:01:09 2002 | ||
| 3 | @@ -49,7 +49,8 @@ | ||
| 4 | * You can disable sending DUMMYCMD by undefining SMTP_USE_DUMMYCMD. | ||
| 5 | */ | ||
| 6 | #define SMTP_DUMMYCMD "MAIL\n" | ||
| 7 | -#define SMTP_USE_DUMMYCMD 1 | ||
| 8 | +// BALU 20020903: added "--sendmail", so it is not needed anymore | ||
| 9 | +// #define SMTP_USE_DUMMYCMD 1 | ||
| 10 | #define SMTP_QUIT "QUIT\n" | ||
| 11 | |||
| 12 | int process_arguments (int, char **); | ||
| 13 | @@ -67,6 +68,7 @@ | ||
| 14 | int critical_time = 0; | ||
| 15 | int check_critical_time = FALSE; | ||
| 16 | int verbose = FALSE; | ||
| 17 | +int sendmail = FALSE; | ||
| 18 | |||
| 19 | int | ||
| 20 | main (int argc, char **argv) | ||
| 21 | @@ -138,11 +140,11 @@ | ||
| 22 | } | ||
| 23 | |||
| 24 | /* close the connection */ | ||
| 25 | -#ifdef SMTP_USE_DUMMYCMD | ||
| 26 | - send(sd,SMTP_DUMMYCMD,strlen(SMTP_DUMMYCMD),0); | ||
| 27 | - /* allow for response to DUMMYCMD to reach us */ | ||
| 28 | - recv(sd,buffer,MAX_INPUT_BUFFER-1,0); | ||
| 29 | -#endif /* SMTP_USE_DUMMYCMD */ | ||
| 30 | + if (sendmail == TRUE) { | ||
| 31 | + send(sd,SMTP_DUMMYCMD,strlen(SMTP_DUMMYCMD),0); | ||
| 32 | + /* allow for response to DUMMYCMD to reach us */ | ||
| 33 | + recv(sd,buffer,MAX_INPUT_BUFFER-1,0); | ||
| 34 | + } | ||
| 35 | |||
| 36 | send (sd, SMTP_QUIT, strlen (SMTP_QUIT), 0); | ||
| 37 | close (sd); | ||
| 38 | @@ -225,17 +227,17 @@ | ||
| 39 | {"verbose", no_argument, 0, 'v'}, | ||
| 40 | {"version", no_argument, 0, 'V'}, | ||
| 41 | {"help", no_argument, 0, 'h'}, | ||
| 42 | + {"sendmail", no_argument, 0, 's'}, | ||
| 43 | {0, 0, 0, 0} | ||
| 44 | }; | ||
| 45 | #endif | ||
| 46 | |||
| 47 | while (1) { | ||
| 48 | #ifdef HAVE_GETOPT_H | ||
| 49 | - c = | ||
| 50 | - getopt_long (argc, argv, "+hVvt:p:e:c:w:H:", long_options, | ||
| 51 | + c = getopt_long (argc, argv, "+?hVvst:p:e:c:w:H:", long_options, | ||
| 52 | &option_index); | ||
| 53 | #else | ||
| 54 | - c = getopt (argc, argv, "+?hVvt:p:e:c:w:H:"); | ||
| 55 | + c = getopt (argc, argv, "+?hVvst:p:e:c:w:H:"); | ||
| 56 | #endif | ||
| 57 | |||
| 58 | i++; | ||
| 59 | @@ -250,6 +252,7 @@ | ||
| 60 | case 'c': | ||
| 61 | case 'w': | ||
| 62 | case 'H': | ||
| 63 | + case 's': | ||
| 64 | i++; | ||
| 65 | } | ||
| 66 | |||
| 67 | @@ -302,6 +305,9 @@ | ||
| 68 | usage ("Time interval must be a nonnegative integer\n"); | ||
| 69 | } | ||
| 70 | break; | ||
| 71 | + case 's': /* sendmail-quirk? */ | ||
| 72 | + sendmail = TRUE; | ||
| 73 | + break; | ||
| 74 | case 'V': /* version */ | ||
| 75 | print_revision (PROGNAME, "$Revision: 1.2 $"); | ||
| 76 | exit (STATE_OK); | ||
| 77 | @@ -356,7 +362,9 @@ | ||
| 78 | " -h, --help\n" | ||
| 79 | " Print detailed help screen\n" | ||
| 80 | " -V, --version\n" | ||
| 81 | - " Print version information\n\n", | ||
| 82 | + " Print version information\n" | ||
| 83 | + " -s, --sendmail\n" | ||
| 84 | + " Enable dummy command to stop sendmail from logging NOQUEUE\n\n", | ||
| 85 | SMTP_PORT, SMTP_EXPECT, DEFAULT_SOCKET_TIMEOUT); | ||
| 86 | support (); | ||
| 87 | } | ||
| 88 | @@ -369,7 +377,7 @@ | ||
| 89 | print_usage (void) | ||
| 90 | { | ||
| 91 | printf | ||
| 92 | - ("Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit] [-t timeout] [-v]\n" | ||
| 93 | + ("Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit] [-t timeout] [-v] [-s]\n" | ||
| 94 | " %s --help\n" | ||
| 95 | " %s --version\n", PROGNAME, PROGNAME, PROGNAME); | ||
| 96 | } | ||
diff --git a/web/attachments/303749-check_mrtg.diff b/web/attachments/303749-check_mrtg.diff new file mode 100644 index 0000000..8b4dfd5 --- /dev/null +++ b/web/attachments/303749-check_mrtg.diff | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | diff -Naubr nagios-plugins-1.4.13.old/plugins/check_mrtg.c nagios-plugins-1.4.13.new/plugins/check_mrtg.c | ||
| 2 | --- nagios-plugins-1.4.13.old/plugins/check_mrtg.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 3 | +++ nagios-plugins-1.4.13.new/plugins/check_mrtg.c 2008-12-02 16:50:55.000000000 +0100 | ||
| 4 | @@ -57,7 +57,7 @@ | ||
| 5 | int | ||
| 6 | main (int argc, char **argv) | ||
| 7 | { | ||
| 8 | - int result = STATE_UNKNOWN; | ||
| 9 | + int result = STATE_OK; | ||
| 10 | FILE *fp; | ||
| 11 | int line; | ||
| 12 | char input_buffer[MAX_INPUT_BUFFER]; | ||
diff --git a/web/attachments/304167-check_ifoperstatus_perfdata.diff b/web/attachments/304167-check_ifoperstatus_perfdata.diff new file mode 100644 index 0000000..437f47f --- /dev/null +++ b/web/attachments/304167-check_ifoperstatus_perfdata.diff | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | --- check_ifoperstatus.pl 2007-03-16 13:11:46.000000000 +0100 | ||
| 2 | +++ check_ifoperstatus_perfdata 2008-12-05 12:53:33.000000000 +0100 | ||
| 3 | @@ -73,6 +73,8 @@ | ||
| 4 | my $snmpIfLastChange = '1.3.6.1.2.1.2.2.1.9'; | ||
| 5 | my $snmpIfAlias = '1.3.6.1.2.1.31.1.1.1.18'; | ||
| 6 | my $snmpLocIfDescr = '1.3.6.1.4.1.9.2.2.1.1.28'; | ||
| 7 | +my $snmpIfInOctets = '1.3.6.1.2.1.2.2.1.10'; | ||
| 8 | +my $snmpIfOutOctets = '1.3.6.1.2.1.2.2.1.16'; | ||
| 9 | my $hostname; | ||
| 10 | my $ifName; | ||
| 11 | my $session; | ||
| 12 | @@ -127,10 +129,14 @@ | ||
| 13 | $snmpIfDescr = $snmpIfDescr . "." . $snmpkey; | ||
| 14 | $snmpIfName = $snmpIfName . "." . $snmpkey ; | ||
| 15 | $snmpIfAlias = $snmpIfAlias . "." . $snmpkey ; | ||
| 16 | +$snmpIfInOctets = $snmpIfInOctets . "." . $snmpkey ; | ||
| 17 | +$snmpIfOutOctets = $snmpIfOutOctets . "." . $snmpkey ; | ||
| 18 | |||
| 19 | push(@snmpoids,$snmpIfAdminStatus); | ||
| 20 | push(@snmpoids,$snmpIfOperStatus); | ||
| 21 | push(@snmpoids,$snmpIfDescr); | ||
| 22 | +push(@snmpoids,$snmpIfInOctets); | ||
| 23 | +push(@snmpoids,$snmpIfOutOctets); | ||
| 24 | push(@snmpoids,$snmpIfName) if (defined $ifXTable) ; | ||
| 25 | push(@snmpoids,$snmpIfAlias) if (defined $ifXTable) ; | ||
| 26 | |||
| 27 | @@ -219,7 +225,7 @@ | ||
| 28 | |||
| 29 | |||
| 30 | |||
| 31 | -print ("$state: $answer"); | ||
| 32 | +print ("$state: $answer|in=" . $response->{$snmpIfInOctets} . " out=" . $response->{$snmpIfOutOctets}); | ||
| 33 | exit $ERRORS{$state}; | ||
| 34 | |||
| 35 | |||
diff --git a/web/attachments/30441-check_dns_random.diff b/web/attachments/30441-check_dns_random.diff new file mode 100644 index 0000000..785fbc5 --- /dev/null +++ b/web/attachments/30441-check_dns_random.diff | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | --- check_dns_random.pl Thu Sep 5 09:43:22 2002 | ||
| 2 | +++ check_dns_random.pl Thu Sep 5 09:58:32 2002 | ||
| 3 | @@ -55,9 +55,8 @@ | ||
| 4 | $x = rand $wc; | ||
| 5 | ($z,$y) = split(/\./,$x); | ||
| 6 | |||
| 7 | -print `$check $data[$z] $host`; | ||
| 8 | - | ||
| 9 | - | ||
| 10 | +system($check, $data[$z], $host); | ||
| 11 | +exit ($? / 256); | ||
| 12 | |||
| 13 | sub usage | ||
| 14 | { | ||
| 15 | |||
diff --git a/web/attachments/304650-check_ntp_peer.patch b/web/attachments/304650-check_ntp_peer.patch new file mode 100644 index 0000000..632a106 --- /dev/null +++ b/web/attachments/304650-check_ntp_peer.patch | |||
| @@ -0,0 +1,147 @@ | |||
| 1 | diff -Nur nagios-plugins-1.4.13.orig/plugins/check_ntp_peer.c nagios-plugins-1.4.13/plugins/check_ntp_peer.c | ||
| 2 | --- nagios-plugins-1.4.13.orig/plugins/check_ntp_peer.c 2008-09-02 14:28:04.000000000 +0200 | ||
| 3 | +++ nagios-plugins-1.4.13/plugins/check_ntp_peer.c 2008-12-09 14:12:32.000000000 +0100 | ||
| 4 | @@ -60,6 +60,9 @@ | ||
| 5 | static short do_jitter=0; | ||
| 6 | static char *jwarn="-1:5000"; | ||
| 7 | static char *jcrit="-1:10000"; | ||
| 8 | +static short do_peer=0; | ||
| 9 | +static char *pwarn="@1"; | ||
| 10 | +static char *pcrit="@1"; | ||
| 11 | static int syncsource_found=0; | ||
| 12 | static int li_alarm=0; | ||
| 13 | |||
| 14 | @@ -67,6 +70,7 @@ | ||
| 15 | thresholds *offset_thresholds = NULL; | ||
| 16 | thresholds *jitter_thresholds = NULL; | ||
| 17 | thresholds *stratum_thresholds = NULL; | ||
| 18 | +thresholds *peer_thresholds = NULL; | ||
| 19 | void print_help (void); | ||
| 20 | void print_usage (void); | ||
| 21 | |||
| 22 | @@ -252,7 +256,7 @@ | ||
| 23 | * status is pretty much useless as syncsource_found is a global variable | ||
| 24 | * used later in main to check is the server was synchronized. It works | ||
| 25 | * so I left it alone */ | ||
| 26 | -int ntp_request(const char *host, double *offset, int *offset_result, double *jitter, int *stratum){ | ||
| 27 | +int ntp_request(const char *host, double *offset, int *offset_result, double *jitter, int *stratum, int *peer){ | ||
| 28 | int conn=-1, i, npeers=0, num_candidates=0; | ||
| 29 | double tmp_offset = 0; | ||
| 30 | int min_peer_sel=PEER_INCLUDED; | ||
| 31 | @@ -266,7 +270,7 @@ | ||
| 32 | |||
| 33 | status = STATE_OK; | ||
| 34 | *offset_result = STATE_UNKNOWN; | ||
| 35 | - *jitter = *stratum = -1; | ||
| 36 | + *jitter = *stratum = *peer = -1; | ||
| 37 | |||
| 38 | /* Long-winded explanation: | ||
| 39 | * Getting the sync peer offset, jitter and stratum requires a number of | ||
| 40 | @@ -328,6 +332,7 @@ | ||
| 41 | } | ||
| 42 | } | ||
| 43 | if(verbose) printf("%d candiate peers available\n", num_candidates); | ||
| 44 | + *peer = num_candidates; | ||
| 45 | if(verbose && syncsource_found) printf("synchronization source found\n"); | ||
| 46 | if(! syncsource_found){ | ||
| 47 | status = STATE_WARNING; | ||
| 48 | @@ -471,6 +476,8 @@ | ||
| 49 | {"scrit", required_argument, 0, 'C'}, | ||
| 50 | {"jwarn", required_argument, 0, 'j'}, | ||
| 51 | {"jcrit", required_argument, 0, 'k'}, | ||
| 52 | + {"pwarn", required_argument, 0, 'o'}, | ||
| 53 | + {"pcrit", required_argument, 0, 'P'}, | ||
| 54 | {"timeout", required_argument, 0, 't'}, | ||
| 55 | {"hostname", required_argument, 0, 'H'}, | ||
| 56 | {"port", required_argument, 0, 'p'}, | ||
| 57 | @@ -482,7 +489,7 @@ | ||
| 58 | usage ("\n"); | ||
| 59 | |||
| 60 | while (1) { | ||
| 61 | - c = getopt_long (argc, argv, "Vhv46qw:c:W:C:j:k:t:H:p:", longopts, &option); | ||
| 62 | + c = getopt_long (argc, argv, "Vhv46qw:c:W:C:j:k:t:H:p:P:o:", longopts, &option); | ||
| 63 | if (c == -1 || c == EOF || c == 1) | ||
| 64 | break; | ||
| 65 | |||
| 66 | @@ -525,6 +532,14 @@ | ||
| 67 | do_jitter=1; | ||
| 68 | jcrit = optarg; | ||
| 69 | break; | ||
| 70 | + case 'o': | ||
| 71 | + do_peer=1; | ||
| 72 | + pwarn = optarg; | ||
| 73 | + break; | ||
| 74 | + case 'P': | ||
| 75 | + do_peer=1; | ||
| 76 | + pcrit = optarg; | ||
| 77 | + break; | ||
| 78 | case 'H': | ||
| 79 | if(is_host(optarg) == FALSE) | ||
| 80 | usage2(_("Invalid hostname/address"), optarg); | ||
| 81 | @@ -584,8 +599,16 @@ | ||
| 82 | TRUE, 0, TRUE, 16); | ||
| 83 | } | ||
| 84 | |||
| 85 | +char *perfd_peer (int num_peer) | ||
| 86 | +{ | ||
| 87 | + return perfdata ("num_peer", num_peer, "", | ||
| 88 | + do_peer, (int)peer_thresholds->warning->end, | ||
| 89 | + do_peer, (int)peer_thresholds->critical->end, | ||
| 90 | + TRUE, 0, TRUE, 16); | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | int main(int argc, char *argv[]){ | ||
| 94 | - int result, offset_result, stratum; | ||
| 95 | + int result, offset_result, stratum, peer; | ||
| 96 | double offset=0, jitter=0; | ||
| 97 | char *result_line, *perfdata_line; | ||
| 98 | |||
| 99 | @@ -602,6 +625,7 @@ | ||
| 100 | set_thresholds(&offset_thresholds, owarn, ocrit); | ||
| 101 | set_thresholds(&jitter_thresholds, jwarn, jcrit); | ||
| 102 | set_thresholds(&stratum_thresholds, swarn, scrit); | ||
| 103 | + set_thresholds(&peer_thresholds, pwarn, pcrit); | ||
| 104 | |||
| 105 | /* initialize alarm signal handling */ | ||
| 106 | signal (SIGALRM, socket_timeout_alarm_handler); | ||
| 107 | @@ -610,7 +634,7 @@ | ||
| 108 | alarm (socket_timeout); | ||
| 109 | |||
| 110 | /* This returns either OK or WARNING (See comment preceeding ntp_request) */ | ||
| 111 | - result = ntp_request(server_address, &offset, &offset_result, &jitter, &stratum); | ||
| 112 | + result = ntp_request(server_address, &offset, &offset_result, &jitter, &stratum, &peer); | ||
| 113 | |||
| 114 | if(offset_result == STATE_UNKNOWN) { | ||
| 115 | /* if there's no sync peer (this overrides ntp_request output): */ | ||
| 116 | @@ -628,6 +652,9 @@ | ||
| 117 | if(do_jitter) | ||
| 118 | result = max_state_alt(result, get_status(jitter, jitter_thresholds)); | ||
| 119 | |||
| 120 | + if(do_peer) | ||
| 121 | + result = max_state_alt(result, get_status(peer, peer_thresholds)); | ||
| 122 | + | ||
| 123 | switch (result) { | ||
| 124 | case STATE_CRITICAL : | ||
| 125 | asprintf(&result_line, _("NTP CRITICAL:")); | ||
| 126 | @@ -662,6 +689,10 @@ | ||
| 127 | asprintf(&result_line, "%s, stratum=%i", result_line, stratum); | ||
| 128 | asprintf(&perfdata_line, "%s %s", perfdata_line, perfd_stratum(stratum)); | ||
| 129 | } | ||
| 130 | + if (do_peer) { | ||
| 131 | + asprintf(&result_line, "%s, num_peer=%i", result_line, peer); | ||
| 132 | + asprintf(&perfdata_line, "%s %s", perfdata_line, perfd_peer(peer)); | ||
| 133 | + } | ||
| 134 | printf("%s|%s\n", result_line, perfdata_line); | ||
| 135 | |||
| 136 | if(server_address!=NULL) free(server_address); | ||
| 137 | @@ -698,6 +729,10 @@ | ||
| 138 | printf (" %s\n", _("Warning threshold for jitter")); | ||
| 139 | printf (" %s\n", "-k, --jcrit=THRESHOLD"); | ||
| 140 | printf (" %s\n", _("Critical threshold for jitter")); | ||
| 141 | + printf (" %s\n", "-o, --pwarn=THRESHOLD"); | ||
| 142 | + printf (" %s\n", _("Warning threshold for peer")); | ||
| 143 | + printf (" %s\n", "-P, --pcrit=THRESHOLD"); | ||
| 144 | + printf (" %s\n", _("Critical threshold for peer")); | ||
| 145 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
| 146 | printf (_(UT_VERBOSE)); | ||
| 147 | |||
diff --git a/web/attachments/305194-sslutils.c.correcteddayleft.patch b/web/attachments/305194-sslutils.c.correcteddayleft.patch new file mode 100644 index 0000000..3110327 --- /dev/null +++ b/web/attachments/305194-sslutils.c.correcteddayleft.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-5 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378823707" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378823707" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378823707" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378823707" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378823707'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=2424562&group_id=29880&atid=397599&file_id=305194" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/305196-sslutils.c.localtimeformat.patch b/web/attachments/305196-sslutils.c.localtimeformat.patch new file mode 100644 index 0000000..66435b8 --- /dev/null +++ b/web/attachments/305196-sslutils.c.localtimeformat.patch | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | --- nagios-plugins-1.4.13/plugins/sslutils.c.prelocaltimeformat 2008-12-13 22:26:49.000000000 +0000 | ||
| 2 | +++ nagios-plugins-1.4.13/plugins/sslutils.c 2008-12-13 22:34:15.000000000 +0000 | ||
| 3 | @@ -93,7 +93,8 @@ | ||
| 4 | int offset; | ||
| 5 | struct tm stamp; | ||
| 6 | int days_left; | ||
| 7 | - char timestamp[17] = ""; | ||
| 8 | + char timestamp[50] = ""; | ||
| 9 | + time_t tm_t; | ||
| 10 | |||
| 11 | certificate=SSL_get_peer_certificate(s); | ||
| 12 | if(! certificate){ | ||
| 13 | @@ -139,10 +140,8 @@ | ||
| 14 | stamp.tm_isdst = -1; | ||
| 15 | |||
| 16 | days_left = (mktime (&stamp) - time (NULL)) / 86400; | ||
| 17 | - snprintf | ||
| 18 | - (timestamp, 17, "%02d/%02d/%04d %02d:%02d", | ||
| 19 | - stamp.tm_mon + 1, | ||
| 20 | - stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min); | ||
| 21 | + tm_t = mktime (&stamp); | ||
| 22 | + strftime(timestamp, 50, "%c", localtime(&tm_t)); | ||
| 23 | |||
| 24 | if (days_left > 0 && days_left <= days_till_exp) { | ||
| 25 | printf (_("WARNING - Certificate expires in %d day(s) (%s).\n"), days_left, timestamp); | ||
diff --git a/web/attachments/305359-sslutils.c.expiry.patch b/web/attachments/305359-sslutils.c.expiry.patch new file mode 100644 index 0000000..151fc62 --- /dev/null +++ b/web/attachments/305359-sslutils.c.expiry.patch | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | --- nagios-plugins-1.4.13/plugins/sslutils.c.orig 2008-12-13 22:26:49.000000000 +0000 | ||
| 2 | +++ nagios-plugins-1.4.13/plugins/sslutils.c 2008-12-15 11:46:37.000000000 +0000 | ||
| 3 | @@ -92,7 +92,7 @@ | ||
| 4 | ASN1_STRING *tm; | ||
| 5 | int offset; | ||
| 6 | struct tm stamp; | ||
| 7 | - int days_left; | ||
| 8 | + double days_left, hours_left, minutes_left; | ||
| 9 | char timestamp[17] = ""; | ||
| 10 | |||
| 11 | certificate=SSL_get_peer_certificate(s); | ||
| 12 | @@ -138,20 +138,26 @@ | ||
| 13 | stamp.tm_sec = 0; | ||
| 14 | stamp.tm_isdst = -1; | ||
| 15 | |||
| 16 | - days_left = (mktime (&stamp) - time (NULL)) / 86400; | ||
| 17 | + minutes_left = (mktime (&stamp) - time (NULL)) / 60.0; | ||
| 18 | + hours_left = minutes_left / 60.0; | ||
| 19 | + days_left = hours_left / 24.0; | ||
| 20 | snprintf | ||
| 21 | (timestamp, 17, "%02d/%02d/%04d %02d:%02d", | ||
| 22 | stamp.tm_mon + 1, | ||
| 23 | stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min); | ||
| 24 | |||
| 25 | - if (days_left > 0 && days_left <= days_till_exp) { | ||
| 26 | - printf (_("WARNING - Certificate expires in %d day(s) (%s).\n"), days_left, timestamp); | ||
| 27 | - return STATE_WARNING; | ||
| 28 | - } else if (days_left < 0) { | ||
| 29 | + if (days_left < 0) { | ||
| 30 | printf (_("CRITICAL - Certificate expired on %s.\n"), timestamp); | ||
| 31 | return STATE_CRITICAL; | ||
| 32 | - } else if (days_left == 0) { | ||
| 33 | - printf (_("WARNING - Certificate expires today (%s).\n"), timestamp); | ||
| 34 | + } | ||
| 35 | + else if (days_left <= days_till_exp) { | ||
| 36 | + printf (_("WARNING - Certificate expires in %d day(s) (%s).\n"), days_left, timestamp); | ||
| 37 | + return STATE_WARNING; | ||
| 38 | + } else if (days_left < 1 && hours_left > 1 && days_left <= days_till_exp) { | ||
| 39 | + printf (_("WARNING - Certificate expires in %d hours (%s).\n"), hours_left, timestamp); | ||
| 40 | + return STATE_WARNING; | ||
| 41 | + } else if (days_left < 1 && hours_left < 1 && days_left <= days_till_exp) { | ||
| 42 | + printf (_("WARNING - Certificate expires in %d minutes (%s).\n"), minutes_left, timestamp); | ||
| 43 | return STATE_WARNING; | ||
| 44 | } | ||
| 45 | |||
diff --git a/web/attachments/305360-sslutils.c.expiry.patch b/web/attachments/305360-sslutils.c.expiry.patch new file mode 100644 index 0000000..151fc62 --- /dev/null +++ b/web/attachments/305360-sslutils.c.expiry.patch | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | --- nagios-plugins-1.4.13/plugins/sslutils.c.orig 2008-12-13 22:26:49.000000000 +0000 | ||
| 2 | +++ nagios-plugins-1.4.13/plugins/sslutils.c 2008-12-15 11:46:37.000000000 +0000 | ||
| 3 | @@ -92,7 +92,7 @@ | ||
| 4 | ASN1_STRING *tm; | ||
| 5 | int offset; | ||
| 6 | struct tm stamp; | ||
| 7 | - int days_left; | ||
| 8 | + double days_left, hours_left, minutes_left; | ||
| 9 | char timestamp[17] = ""; | ||
| 10 | |||
| 11 | certificate=SSL_get_peer_certificate(s); | ||
| 12 | @@ -138,20 +138,26 @@ | ||
| 13 | stamp.tm_sec = 0; | ||
| 14 | stamp.tm_isdst = -1; | ||
| 15 | |||
| 16 | - days_left = (mktime (&stamp) - time (NULL)) / 86400; | ||
| 17 | + minutes_left = (mktime (&stamp) - time (NULL)) / 60.0; | ||
| 18 | + hours_left = minutes_left / 60.0; | ||
| 19 | + days_left = hours_left / 24.0; | ||
| 20 | snprintf | ||
| 21 | (timestamp, 17, "%02d/%02d/%04d %02d:%02d", | ||
| 22 | stamp.tm_mon + 1, | ||
| 23 | stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min); | ||
| 24 | |||
| 25 | - if (days_left > 0 && days_left <= days_till_exp) { | ||
| 26 | - printf (_("WARNING - Certificate expires in %d day(s) (%s).\n"), days_left, timestamp); | ||
| 27 | - return STATE_WARNING; | ||
| 28 | - } else if (days_left < 0) { | ||
| 29 | + if (days_left < 0) { | ||
| 30 | printf (_("CRITICAL - Certificate expired on %s.\n"), timestamp); | ||
| 31 | return STATE_CRITICAL; | ||
| 32 | - } else if (days_left == 0) { | ||
| 33 | - printf (_("WARNING - Certificate expires today (%s).\n"), timestamp); | ||
| 34 | + } | ||
| 35 | + else if (days_left <= days_till_exp) { | ||
| 36 | + printf (_("WARNING - Certificate expires in %d day(s) (%s).\n"), days_left, timestamp); | ||
| 37 | + return STATE_WARNING; | ||
| 38 | + } else if (days_left < 1 && hours_left > 1 && days_left <= days_till_exp) { | ||
| 39 | + printf (_("WARNING - Certificate expires in %d hours (%s).\n"), hours_left, timestamp); | ||
| 40 | + return STATE_WARNING; | ||
| 41 | + } else if (days_left < 1 && hours_left < 1 && days_left <= days_till_exp) { | ||
| 42 | + printf (_("WARNING - Certificate expires in %d minutes (%s).\n"), minutes_left, timestamp); | ||
| 43 | return STATE_WARNING; | ||
| 44 | } | ||
| 45 | |||
diff --git a/web/attachments/305376-nagios-plugins-1.4.13-check_ldap_certificate.patch b/web/attachments/305376-nagios-plugins-1.4.13-check_ldap_certificate.patch new file mode 100644 index 0000000..c1a45f1 --- /dev/null +++ b/web/attachments/305376-nagios-plugins-1.4.13-check_ldap_certificate.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-2 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378825124" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378825124" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378825124" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378825124" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378825124'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=2430999&group_id=29880&atid=397599&file_id=305376" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/306172-nagios-plugins-1.4.13-check_ldap_certificate.patch b/web/attachments/306172-nagios-plugins-1.4.13-check_ldap_certificate.patch new file mode 100644 index 0000000..9f8fa2a --- /dev/null +++ b/web/attachments/306172-nagios-plugins-1.4.13-check_ldap_certificate.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-10 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378825124" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378825124" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378825124" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378825124" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378825124'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=2430999&group_id=29880&atid=397599&file_id=306172" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/306246-check_procs_perf b/web/attachments/306246-check_procs_perf new file mode 100644 index 0000000..acbd997 --- /dev/null +++ b/web/attachments/306246-check_procs_perf | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | RET=`/usr/lib/nagios/plugins/check_procs "$@"` | ||
| 4 | STATUS=$? | ||
| 5 | |||
| 6 | getopts c:w: name "$@" | ||
| 7 | eval $name=$OPTARG | ||
| 8 | getopts c:w: name "$@" | ||
| 9 | eval $name=$OPTARG | ||
| 10 | |||
| 11 | VAL=`echo $RET | sed 's/^.*: \([0-9]*\) process.*$/\1/'` | ||
| 12 | echo "$RET|procs=$VAL;$w;$c;0" | ||
| 13 | |||
| 14 | exit $STATUS | ||
diff --git a/web/attachments/309099-check_disk.txt b/web/attachments/309099-check_disk.txt new file mode 100644 index 0000000..500ab18 --- /dev/null +++ b/web/attachments/309099-check_disk.txt | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | *** plugins/check_disk.c.orig Thu Jul 10 11:03:55 2008 | ||
| 2 | --- plugins/check_disk.c Wed Jan 14 11:49:37 2009 | ||
| 3 | *************** | ||
| 4 | *** 155,160 **** | ||
| 5 | --- 155,161 ---- | ||
| 6 | int path_selected = FALSE; | ||
| 7 | char *group = NULL; | ||
| 8 | struct stat *stat_buf; | ||
| 9 | + int no_match_ok = 0; | ||
| 10 | |||
| 11 | |||
| 12 | int | ||
| 13 | *************** | ||
| 14 | *** 493,498 **** | ||
| 15 | --- 494,500 ---- | ||
| 16 | {"ignore-ereg-partition", required_argument, 0, 'i'}, | ||
| 17 | {"ignore-eregi-path", required_argument, 0, 'I'}, | ||
| 18 | {"ignore-eregi-partition", required_argument, 0, 'I'}, | ||
| 19 | + {"no-match-ok", no_argument, 0, 'n'}, | ||
| 20 | {"local", no_argument, 0, 'l'}, | ||
| 21 | {"stat-remote-fs", no_argument, 0, 'L'}, | ||
| 22 | {"mountpoint", no_argument, 0, 'M'}, | ||
| 23 | *************** | ||
| 24 | *** 517,523 **** | ||
| 25 | strcpy (argv[c], "-t"); | ||
| 26 | |||
| 27 | while (1) { | ||
| 28 | ! c = getopt_long (argc, argv, "+?VqhveCt:c:w:K:W:u:p:x:X:mklLg:R:r:i:I:MEA", longopts, &option); | ||
| 29 | |||
| 30 | if (c == -1 || c == EOF) | ||
| 31 | break; | ||
| 32 | --- 519,525 ---- | ||
| 33 | strcpy (argv[c], "-t"); | ||
| 34 | |||
| 35 | while (1) { | ||
| 36 | ! c = getopt_long (argc, argv, "+?VqhveCt:c:w:K:W:u:p:x:X:mklLg:R:r:i:I:MEAn", longopts, &option); | ||
| 37 | |||
| 38 | if (c == -1 || c == EOF) | ||
| 39 | break; | ||
| 40 | *************** | ||
| 41 | *** 669,674 **** | ||
| 42 | --- 671,679 ---- | ||
| 43 | die (STATE_UNKNOWN, "DISK %s: %s", _("UNKNOWN"), _("Must set group value before selecting pathes \n")); | ||
| 44 | group = optarg; | ||
| 45 | break; | ||
| 46 | + case 'n': /* Don't complain if a regular expression doesn't match anything */ | ||
| 47 | + no_match_ok = 1; | ||
| 48 | + break; | ||
| 49 | case 'I': | ||
| 50 | cflags |= REG_ICASE; | ||
| 51 | case 'i': | ||
| 52 | *************** | ||
| 53 | *** 741,747 **** | ||
| 54 | } | ||
| 55 | } | ||
| 56 | |||
| 57 | ! if (!fnd) | ||
| 58 | die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"), | ||
| 59 | _("Regular expression did not match any path or disk"), optarg); | ||
| 60 | |||
| 61 | --- 746,752 ---- | ||
| 62 | } | ||
| 63 | } | ||
| 64 | |||
| 65 | ! if (!fnd && !no_match_ok) | ||
| 66 | die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"), | ||
| 67 | _("Regular expression did not match any path or disk"), optarg); | ||
| 68 | |||
diff --git a/web/attachments/310361-nagios-1.4.13-no_pass.diff b/web/attachments/310361-nagios-1.4.13-no_pass.diff new file mode 100644 index 0000000..b621967 --- /dev/null +++ b/web/attachments/310361-nagios-1.4.13-no_pass.diff | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | --- nagios-plugins-1.4.13/plugins/check_mysql.c 2008-08-16 00:47:32.000000000 -0400 | ||
| 2 | +++ nagios-plugins-1.4.13-no_pass/plugins/check_mysql.c 2009-01-23 18:10:48.000000000 -0500 | ||
| 3 | @@ -265,7 +265,7 @@ | ||
| 4 | return ERROR; | ||
| 5 | |||
| 6 | while (1) { | ||
| 7 | - c = getopt_long (argc, argv, "hvVSP:p:u:d:H:s:c:w:", longopts, &option); | ||
| 8 | + c = getopt_long (argc, argv, "hvVSP:p::u:d:H:s:c:w:", longopts, &option); | ||
| 9 | |||
| 10 | if (c == -1 || c == EOF) | ||
| 11 | break; | ||
| 12 | @@ -289,12 +289,16 @@ | ||
| 13 | db_user = optarg; | ||
| 14 | break; | ||
| 15 | case 'p': /* authentication information: password */ | ||
| 16 | - db_pass = strdup(optarg); | ||
| 17 | - | ||
| 18 | - /* Delete the password from process list */ | ||
| 19 | - while (*optarg != '\0') { | ||
| 20 | - *optarg = 'X'; | ||
| 21 | - optarg++; | ||
| 22 | + if (optarg == NULL) | ||
| 23 | + db_pass = strdup(""); | ||
| 24 | + else | ||
| 25 | + { | ||
| 26 | + db_pass = strdup(optarg); | ||
| 27 | + /* Delete the password from process list */ | ||
| 28 | + while (*optarg != '\0') { | ||
| 29 | + *optarg = 'X'; | ||
| 30 | + optarg++; | ||
| 31 | + } | ||
| 32 | } | ||
| 33 | break; | ||
| 34 | case 'P': /* critical time threshold */ | ||
| 35 | @@ -361,9 +365,6 @@ | ||
| 36 | if (db_host == NULL) | ||
| 37 | db_host = strdup(""); | ||
| 38 | |||
| 39 | - if (db_pass == NULL) | ||
| 40 | - db_pass = strdup(""); | ||
| 41 | - | ||
| 42 | if (db == NULL) | ||
| 43 | db = strdup(""); | ||
| 44 | |||
diff --git a/web/attachments/310959-libexec.zip b/web/attachments/310959-libexec.zip new file mode 100644 index 0000000..2aa0318 --- /dev/null +++ b/web/attachments/310959-libexec.zip | |||
| Binary files differ | |||
diff --git a/web/attachments/31133-check_http.diff b/web/attachments/31133-check_http.diff new file mode 100644 index 0000000..1e80479 --- /dev/null +++ b/web/attachments/31133-check_http.diff | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | --- check_http.c Thu Feb 28 07:42:57 2002 | ||
| 2 | +++ /root/check_http.c Sat Sep 14 22:51:21 2002 | ||
| 3 | @@ -529,6 +529,9 @@ | ||
| 4 | size_t pagesize = 0; | ||
| 5 | char *full_page = NULL; | ||
| 6 | char *pos = NULL; | ||
| 7 | +#ifdef HAVE_SSL | ||
| 8 | + int sslerr; | ||
| 9 | +#endif | ||
| 10 | |||
| 11 | /* try to connect to the host at the given port number */ | ||
| 12 | #ifdef HAVE_SSL | ||
| 13 | @@ -660,8 +663,18 @@ | ||
| 14 | pagesize += i; | ||
| 15 | } | ||
| 16 | |||
| 17 | - if (i < 0) | ||
| 18 | + if (i < 0) { | ||
| 19 | +#ifdef HAVE_SSL | ||
| 20 | + sslerr=SSL_get_error(ssl, i); | ||
| 21 | + if ( sslerr == SSL_ERROR_SSL ) { | ||
| 22 | + terminate (STATE_WARNING, "Client Certificate Required\n"); | ||
| 23 | + } else { | ||
| 24 | + terminate (STATE_CRITICAL, "Error in recv()"); | ||
| 25 | + } | ||
| 26 | +#else | ||
| 27 | terminate (STATE_CRITICAL, "Error in recv()"); | ||
| 28 | +#endif | ||
| 29 | + } | ||
| 30 | |||
| 31 | /* return a CRITICAL status if we couldn't read any data */ | ||
| 32 | if (pagesize == (size_t) 0) | ||
diff --git a/web/attachments/311556-patch-nagios-plugins-1.4.12 b/web/attachments/311556-patch-nagios-plugins-1.4.12 new file mode 100644 index 0000000..49a3d6f --- /dev/null +++ b/web/attachments/311556-patch-nagios-plugins-1.4.12 | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | --- check_smtp.orig 2009-01-19 10:57:05.000000000 +0100 | ||
| 2 | +++ check_smtp.c 2009-01-19 11:34:04.000000000 +0100 | ||
| 3 | @@ -103,9 +103,9 @@ | ||
| 4 | char *authtype = NULL; | ||
| 5 | char *authuser = NULL; | ||
| 6 | char *authpass = NULL; | ||
| 7 | -int warning_time = 0; | ||
| 8 | +double warning_time = 0; | ||
| 9 | int check_warning_time = FALSE; | ||
| 10 | -int critical_time = 0; | ||
| 11 | +double critical_time = 0; | ||
| 12 | int check_critical_time = FALSE; | ||
| 13 | int verbose = 0; | ||
| 14 | int use_ssl = FALSE; | ||
| 15 | @@ -432,9 +432,9 @@ | ||
| 16 | elapsed_time = (double)microsec / 1.0e6; | ||
| 17 | |||
| 18 | if (result == STATE_OK) { | ||
| 19 | - if (check_critical_time && elapsed_time > (double) critical_time) | ||
| 20 | + if (check_critical_time && elapsed_time > critical_time) | ||
| 21 | result = STATE_CRITICAL; | ||
| 22 | - else if (check_warning_time && elapsed_time > (double) warning_time) | ||
| 23 | + else if (check_warning_time && elapsed_time > warning_time) | ||
| 24 | result = STATE_WARNING; | ||
| 25 | } | ||
| 26 | |||
| 27 | @@ -565,21 +565,19 @@ | ||
| 28 | nresponses++; | ||
| 29 | break; | ||
| 30 | case 'c': /* critical time threshold */ | ||
| 31 | - if (is_intnonneg (optarg)) { | ||
| 32 | - critical_time = atoi (optarg); | ||
| 33 | - check_critical_time = TRUE; | ||
| 34 | - } | ||
| 35 | + if (!is_nonnegative (optarg)) | ||
| 36 | + usage4 (_("Critical time must be a positive")); | ||
| 37 | else { | ||
| 38 | - usage4 (_("Critical time must be a positive integer")); | ||
| 39 | + critical_time = strtod (optarg, NULL); | ||
| 40 | + check_critical_time = TRUE; | ||
| 41 | } | ||
| 42 | break; | ||
| 43 | case 'w': /* warning time threshold */ | ||
| 44 | - if (is_intnonneg (optarg)) { | ||
| 45 | - warning_time = atoi (optarg); | ||
| 46 | - check_warning_time = TRUE; | ||
| 47 | - } | ||
| 48 | + if (!is_nonnegative (optarg)) | ||
| 49 | + usage4 (_("Warning time must be a positive")); | ||
| 50 | else { | ||
| 51 | - usage4 (_("Warning time must be a positive integer")); | ||
| 52 | + warning_time = strtod (optarg, NULL); | ||
| 53 | + check_warning_time = TRUE; | ||
| 54 | } | ||
| 55 | break; | ||
| 56 | case 'v': /* verbose */ | ||
diff --git a/web/attachments/313868-check_snmp.patch b/web/attachments/313868-check_snmp.patch new file mode 100644 index 0000000..439617f --- /dev/null +++ b/web/attachments/313868-check_snmp.patch | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | --- check_snmp-old.c 2008-12-23 06:53:16.000000000 -0500 | ||
| 2 | +++ check_snmp.c 2009-02-17 01:10:44.094965523 -0500 | ||
| 3 | @@ -968,6 +968,8 @@ | ||
| 4 | printf (" %s\n", _("SNMPv3 authentication password")); | ||
| 5 | printf (" %s\n", "-X, --privpasswd=PASSWORD"); | ||
| 6 | printf (" %s\n", _("SNMPv3 privacy password")); | ||
| 7 | + printf (" %s\n", "-e, --retries=INTEGER"); | ||
| 8 | + printf (" %s\n", _("Number of times to retry query")); | ||
| 9 | |||
| 10 | /* OID Stuff */ | ||
| 11 | printf (" %s\n", "-o, --oid=OID(s)"); | ||
diff --git a/web/attachments/314900-truss-check_procs b/web/attachments/314900-truss-check_procs new file mode 100644 index 0000000..87d91d0 --- /dev/null +++ b/web/attachments/314900-truss-check_procs | |||
| @@ -0,0 +1,128 @@ | |||
| 1 | execve("/usit/spider/local/store/localhost/.nagios-plugins/ver-1.4.13/opt/nagios/libexec/check_procs@sun4os58", 0xFFBEFC1C, 0xFFBEFC24) argc = 1 | ||
| 2 | resolvepath("/usr/lib/ld.so.1", "/usr/lib/ld.so.1", 1023) = 16 | ||
| 3 | open("/var/ld/ld.config", O_RDONLY) Err#2 ENOENT | ||
| 4 | stat("/local/lib/libm.so.1", 0xFFBEF33C) Err#2 ENOENT | ||
| 5 | stat("/usr/openwin/lib/libm.so.1", 0xFFBEF33C) Err#2 ENOENT | ||
| 6 | stat("/usr/lib/libm.so.1", 0xFFBEF33C) = 0 | ||
| 7 | open("/usr/lib/libm.so.1", O_RDONLY) = 3 | ||
| 8 | fstat(3, 0xFFBEF33C) = 0 | ||
| 9 | mmap(0x00000000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xFF3A0000 | ||
| 10 | mmap(0x00000000, 155648, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON, -1, 0) = 0xFF370000 | ||
| 11 | mmap(0xFF370000, 84962, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF370000 | ||
| 12 | mmap(0xFF394000, 4228, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 81920) = 0xFF394000 | ||
| 13 | munmap(0xFF386000, 57344) = 0 | ||
| 14 | mmap(0x00000000, 8192, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, -1, 0) = 0xFF360000 | ||
| 15 | memcntl(0xFF370000, 8144, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0 | ||
| 16 | close(3) = 0 | ||
| 17 | stat("/local/lib/libintl.so.8", 0xFFBEF33C) = 0 | ||
| 18 | open("/local/lib/libintl.so.8", O_RDONLY) = 3 | ||
| 19 | fstat(3, 0xFFBEF33C) = 0 | ||
| 20 | mmap(0xFF3A0000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF3A0000 | ||
| 21 | mmap(0x00000000, 122880, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON, -1, 0) = 0xFF330000 | ||
| 22 | mmap(0xFF330000, 49728, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF330000 | ||
| 23 | mmap(0xFF34C000, 2476, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 49152) = 0xFF34C000 | ||
| 24 | munmap(0xFF33E000, 57344) = 0 | ||
| 25 | memcntl(0xFF330000, 14872, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0 | ||
| 26 | close(3) = 0 | ||
| 27 | stat("/local/lib/libiconv.so.2", 0xFFBEF33C) = 0 | ||
| 28 | open("/local/lib/libiconv.so.2", O_RDONLY) = 3 | ||
| 29 | fstat(3, 0xFFBEF33C) = 0 | ||
| 30 | mmap(0xFF3A0000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF3A0000 | ||
| 31 | mmap(0x00000000, 1081344, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON, -1, 0) = 0xFF200000 | ||
| 32 | mmap(0xFF200000, 1003443, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF200000 | ||
| 33 | mmap(0xFF304000, 9144, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 999424) = 0xFF304000 | ||
| 34 | munmap(0xFF2F6000, 57344) = 0 | ||
| 35 | memcntl(0xFF200000, 68624, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0 | ||
| 36 | close(3) = 0 | ||
| 37 | stat("/local/lib/libc.so.1", 0xFFBEF33C) Err#2 ENOENT | ||
| 38 | stat("/usr/openwin/lib/libc.so.1", 0xFFBEF33C) Err#2 ENOENT | ||
| 39 | stat("/usr/lib/libc.so.1", 0xFFBEF33C) = 0 | ||
| 40 | open("/usr/lib/libc.so.1", O_RDONLY) = 3 | ||
| 41 | fstat(3, 0xFFBEF33C) = 0 | ||
| 42 | mmap(0xFF3A0000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF3A0000 | ||
| 43 | mmap(0x00000000, 802816, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON, -1, 0) = 0xFF100000 | ||
| 44 | mmap(0xFF100000, 702416, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF100000 | ||
| 45 | mmap(0xFF1BC000, 24772, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 704512) = 0xFF1BC000 | ||
| 46 | munmap(0xFF1AC000, 65536) = 0 | ||
| 47 | memcntl(0xFF100000, 113528, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0 | ||
| 48 | close(3) = 0 | ||
| 49 | stat("/local/lib/libnsl.so.1", 0xFFBEF33C) Err#2 ENOENT | ||
| 50 | stat("/usr/openwin/lib/libnsl.so.1", 0xFFBEF33C) Err#2 ENOENT | ||
| 51 | stat("/usr/lib/libnsl.so.1", 0xFFBEF33C) = 0 | ||
| 52 | open("/usr/lib/libnsl.so.1", O_RDONLY) = 3 | ||
| 53 | fstat(3, 0xFFBEF33C) = 0 | ||
| 54 | mmap(0xFF3A0000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF3A0000 | ||
| 55 | mmap(0x00000000, 712704, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON, -1, 0) = 0xFF000000 | ||
| 56 | mmap(0xFF000000, 579850, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF000000 | ||
| 57 | mmap(0xFF09E000, 33168, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 581632) = 0xFF09E000 | ||
| 58 | mmap(0xFF0A8000, 23224, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANON, -1, 0) = 0xFF0A8000 | ||
| 59 | munmap(0xFF08E000, 65536) = 0 | ||
| 60 | memcntl(0xFF000000, 83740, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0 | ||
| 61 | close(3) = 0 | ||
| 62 | stat("/local/lib/libsocket.so.1", 0xFFBEF33C) Err#2 ENOENT | ||
| 63 | stat("/usr/openwin/lib/libsocket.so.1", 0xFFBEF33C) Err#2 ENOENT | ||
| 64 | stat("/usr/lib/libsocket.so.1", 0xFFBEF33C) = 0 | ||
| 65 | open("/usr/lib/libsocket.so.1", O_RDONLY) = 3 | ||
| 66 | fstat(3, 0xFFBEF33C) = 0 | ||
| 67 | mmap(0xFF3A0000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF3A0000 | ||
| 68 | mmap(0x00000000, 114688, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON, -1, 0) = 0xFF1E0000 | ||
| 69 | mmap(0xFF1E0000, 40558, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF1E0000 | ||
| 70 | mmap(0xFF1FA000, 4365, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 40960) = 0xFF1FA000 | ||
| 71 | munmap(0xFF1EA000, 65536) = 0 | ||
| 72 | memcntl(0xFF1E0000, 14496, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0 | ||
| 73 | close(3) = 0 | ||
| 74 | stat("/local/lib/libdl.so.1", 0xFFBEF33C) Err#2 ENOENT | ||
| 75 | stat("/usr/openwin/lib/libdl.so.1", 0xFFBEF33C) Err#2 ENOENT | ||
| 76 | stat("/usr/lib/libdl.so.1", 0xFFBEF33C) = 0 | ||
| 77 | open("/usr/lib/libdl.so.1", O_RDONLY) = 3 | ||
| 78 | fstat(3, 0xFFBEF33C) = 0 | ||
| 79 | mmap(0xFF3A0000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF3A0000 | ||
| 80 | close(3) = 0 | ||
| 81 | stat("/usr/lib/libmp.so.2", 0xFFBEF33C) = 0 | ||
| 82 | open("/usr/lib/libmp.so.2", O_RDONLY) = 3 | ||
| 83 | fstat(3, 0xFFBEF33C) = 0 | ||
| 84 | mmap(0x00000000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xFF320000 | ||
| 85 | mmap(0x00000000, 90112, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON, -1, 0) = 0xFF0E0000 | ||
| 86 | mmap(0xFF0E0000, 11316, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF0E0000 | ||
| 87 | mmap(0xFF0F4000, 865, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 16384) = 0xFF0F4000 | ||
| 88 | munmap(0xFF0E4000, 65536) = 0 | ||
| 89 | memcntl(0xFF0E0000, 3124, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0 | ||
| 90 | close(3) = 0 | ||
| 91 | stat("/usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1", 0xFFBEF104) = 0 | ||
| 92 | open("/usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1", O_RDONLY) = 3 | ||
| 93 | fstat(3, 0xFFBEF104) = 0 | ||
| 94 | mmap(0xFF320000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF320000 | ||
| 95 | mmap(0x00000000, 16384, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON, -1, 0) = 0xFF310000 | ||
| 96 | mmap(0xFF310000, 13800, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF310000 | ||
| 97 | close(3) = 0 | ||
| 98 | mmap(0x00000000, 8192, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, -1, 0) = 0xFF1D0000 | ||
| 99 | munmap(0xFF320000, 8192) = 0 | ||
| 100 | brk(0x0004B630) = 0 | ||
| 101 | brk(0x0004D630) = 0 | ||
| 102 | brk(0x0004D630) = 0 | ||
| 103 | brk(0x0004F630) = 0 | ||
| 104 | brk(0x0004F630) = 0 | ||
| 105 | brk(0x00051630) = 0 | ||
| 106 | getpid() = 5322 [5321] | ||
| 107 | sigaction(SIGALRM, 0xFFBED9E8, 0xFFBEDA68) = 0 | ||
| 108 | alarm(10) = 0 | ||
| 109 | sysconfig(_CONFIG_OPEN_FILES) = 256 | ||
| 110 | brk(0x00051630) = 0 | ||
| 111 | brk(0x00053630) = 0 | ||
| 112 | pipe() = 3 [4] | ||
| 113 | pipe() = 5 [6] | ||
| 114 | fork() = 5323 | ||
| 115 | close(4) = 0 | ||
| 116 | close(6) = 0 | ||
| 117 | read(3, 0xFFBEC9D8, 4096) = 0 | ||
| 118 | read(5, 0xFFBEC9D8, 4096) = 0 | ||
| 119 | close(3) = 0 | ||
| 120 | waitid(P_PID, 5323, 0xFFBED8F0, WEXITED|WTRAPPED) = 0 | ||
| 121 | getuid() = 0 [0] | ||
| 122 | getuid() = 0 [0] | ||
| 123 | getgid() = 1 [1] | ||
| 124 | getgid() = 1 [1] | ||
| 125 | ioctl(1, TCGETA, 0xFFBECD14) = 0 | ||
| 126 | write(1, " U n a b l e t o r e".., 22) = 22 | ||
| 127 | llseek(0, 0, SEEK_CUR) = 3219 | ||
| 128 | _exit(3) | ||
diff --git a/web/attachments/316148-patch.diff b/web/attachments/316148-patch.diff new file mode 100644 index 0000000..65f71d5 --- /dev/null +++ b/web/attachments/316148-patch.diff | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | *** check_nrpe.c 2009-03-04 15:21:49.000000000 +0100 | ||
| 2 | --- check_nrpe_new.c 2009-03-04 15:21:36.000000000 +0100 | ||
| 3 | *************** | ||
| 4 | *** 389,394 **** | ||
| 5 | --- 389,395 ---- | ||
| 6 | return ERROR; | ||
| 7 | break; | ||
| 8 | } | ||
| 9 | + if (argindex > 0) break; | ||
| 10 | } | ||
| 11 | |||
| 12 | /* determine (base) command query */ | ||
diff --git a/web/attachments/317729-check_snmp.patch b/web/attachments/317729-check_snmp.patch new file mode 100644 index 0000000..63ae35f --- /dev/null +++ b/web/attachments/317729-check_snmp.patch | |||
| @@ -0,0 +1,406 @@ | |||
| 1 | Index: plugins/check_snmp.c | ||
| 2 | =================================================================== | ||
| 3 | --- plugins/check_snmp.c (revision 2160) | ||
| 4 | +++ plugins/check_snmp.c (working copy) | ||
| 5 | @@ -34,7 +34,7 @@ | ||
| 6 | |||
| 7 | #include "common.h" | ||
| 8 | #include "utils.h" | ||
| 9 | -#include "popen.h" | ||
| 10 | +#include "utils_cmd.h" | ||
| 11 | |||
| 12 | #define DEFAULT_COMMUNITY "public" | ||
| 13 | #define DEFAULT_PORT "161" | ||
| 14 | @@ -91,14 +91,14 @@ | ||
| 15 | regmatch_t pmatch[10]; | ||
| 16 | char timestamp[10] = ""; | ||
| 17 | char errbuf[MAX_INPUT_BUFFER] = ""; | ||
| 18 | -char perfstr[MAX_INPUT_BUFFER] = ""; | ||
| 19 | +char perfstr[MAX_INPUT_BUFFER] = "| "; | ||
| 20 | int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; | ||
| 21 | int eflags = 0; | ||
| 22 | int errcode, excode; | ||
| 23 | |||
| 24 | char *server_address = NULL; | ||
| 25 | char *community = NULL; | ||
| 26 | -char *authpriv = NULL; | ||
| 27 | +char **authpriv = NULL; | ||
| 28 | char *proto = NULL; | ||
| 29 | char *seclevel = NULL; | ||
| 30 | char *secname = NULL; | ||
| 31 | @@ -106,10 +106,11 @@ | ||
| 32 | char *privproto = NULL; | ||
| 33 | char *authpasswd = NULL; | ||
| 34 | char *privpasswd = NULL; | ||
| 35 | -char *oid; | ||
| 36 | +char **oids = NULL; | ||
| 37 | char *label; | ||
| 38 | char *units; | ||
| 39 | char *port; | ||
| 40 | +char *snmpcmd; | ||
| 41 | char string_value[MAX_INPUT_BUFFER] = ""; | ||
| 42 | char **labels = NULL; | ||
| 43 | char **unitv = NULL; | ||
| 44 | @@ -117,6 +118,8 @@ | ||
| 45 | size_t labels_size = 8; | ||
| 46 | size_t nunits = 0; | ||
| 47 | size_t unitv_size = 8; | ||
| 48 | +int numoids = 0; | ||
| 49 | +int numauthpriv = 0; | ||
| 50 | int verbose = FALSE; | ||
| 51 | int usesnmpgetnext = FALSE; | ||
| 52 | unsigned long long lower_warn_lim[MAX_OIDS]; | ||
| 53 | @@ -139,18 +142,16 @@ | ||
| 54 | { | ||
| 55 | int i = 0; | ||
| 56 | int iresult = STATE_UNKNOWN; | ||
| 57 | - int found = 0; | ||
| 58 | - int result = STATE_DEPENDENT; | ||
| 59 | - char input_buffer[MAX_INPUT_BUFFER]; | ||
| 60 | - char *command_line = NULL; | ||
| 61 | + int result = STATE_UNKNOWN; | ||
| 62 | + char **command_line = NULL; | ||
| 63 | char *cl_hidden_auth = NULL; | ||
| 64 | + char *oidname = NULL; | ||
| 65 | char *response = NULL; | ||
| 66 | char *outbuff; | ||
| 67 | - char *output; | ||
| 68 | char *ptr = NULL; | ||
| 69 | - char *p2 = NULL; | ||
| 70 | char *show = NULL; | ||
| 71 | char type[8] = ""; | ||
| 72 | + output chld_out, chld_err; | ||
| 73 | |||
| 74 | setlocale (LC_ALL, ""); | ||
| 75 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 76 | @@ -162,12 +163,10 @@ | ||
| 77 | eval_method[i] = CHECK_UNDEF; | ||
| 78 | i = 0; | ||
| 79 | |||
| 80 | - oid = strdup (""); | ||
| 81 | label = strdup ("SNMP"); | ||
| 82 | units = strdup (""); | ||
| 83 | port = strdup (DEFAULT_PORT); | ||
| 84 | outbuff = strdup (""); | ||
| 85 | - output = strdup (""); | ||
| 86 | delimiter = strdup (" = "); | ||
| 87 | output_delim = strdup (DEFAULT_OUTPUT_DELIMITER); | ||
| 88 | /* miblist = strdup (DEFAULT_MIBLIST); */ | ||
| 89 | @@ -180,92 +179,71 @@ | ||
| 90 | if (process_arguments (argc, argv) == ERROR) | ||
| 91 | usage4 (_("Could not parse arguments")); | ||
| 92 | |||
| 93 | - /* create the command line to execute */ | ||
| 94 | - if(usesnmpgetnext == TRUE) { | ||
| 95 | - asprintf(&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s", | ||
| 96 | - PATH_TO_SNMPGETNEXT, timeout_interval, retries, miblist, proto, | ||
| 97 | - authpriv, server_address, port, oid); | ||
| 98 | - asprintf(&cl_hidden_auth, "%s -t %d -r %d -m %s -v %s %s %s:%s %s", | ||
| 99 | - PATH_TO_SNMPGETNEXT, timeout_interval, retries, miblist, proto, | ||
| 100 | - "[authpriv]", server_address, port, oid); | ||
| 101 | + /* Create the command array to execute */ | ||
| 102 | + if(usesnmpgetnext == TRUE) { | ||
| 103 | + snmpcmd = strdup (PATH_TO_SNMPGETNEXT); | ||
| 104 | }else{ | ||
| 105 | + snmpcmd = strdup (PATH_TO_SNMPGET); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + /* 10 is the number of arguments to pass before authpriv options and OIDs. Add one for terminating NULL */ | ||
| 109 | + command_line = calloc (10 + numauthpriv + numoids + 1, sizeof (char *)); | ||
| 110 | + command_line[0] = snmpcmd; | ||
| 111 | + command_line[1] = strdup ("-t"); | ||
| 112 | + asprintf (&command_line[2], "%d", timeout_interval); | ||
| 113 | + command_line[3] = strdup ("-r"); | ||
| 114 | + asprintf (&command_line[4], "%d", retries); | ||
| 115 | + command_line[5] = strdup ("-m"); | ||
| 116 | + command_line[6] = strdup (miblist); | ||
| 117 | + command_line[7] = "-v"; | ||
| 118 | + command_line[8] = strdup (proto); | ||
| 119 | + asprintf (&command_line[9], "%s:%s", server_address, port); | ||
| 120 | |||
| 121 | - asprintf (&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s", | ||
| 122 | - PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto, | ||
| 123 | - authpriv, server_address, port, oid); | ||
| 124 | - asprintf(&cl_hidden_auth, "%s -t %d -r %d -m %s -v %s %s %s:%s %s", | ||
| 125 | - PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto, | ||
| 126 | - "[authpriv]", server_address, port, oid); | ||
| 127 | + for (i = 0; i < numauthpriv; i++) { | ||
| 128 | + command_line[10 + numoids + i] = authpriv[i]; | ||
| 129 | } | ||
| 130 | |||
| 131 | - if (verbose) | ||
| 132 | - printf ("%s\n", command_line); | ||
| 133 | + /* This is just for display purposes, so it can remain a string */ | ||
| 134 | + asprintf(&cl_hidden_auth, "%s -t %d -r %d -m %s -v %s %s:%s %s", | ||
| 135 | + snmpcmd, timeout_interval, retries, miblist, proto, | ||
| 136 | + server_address, port, "[authpriv]"); | ||
| 137 | |||
| 138 | - | ||
| 139 | - /* run the command */ | ||
| 140 | - child_process = spopen (command_line); | ||
| 141 | - if (child_process == NULL) { | ||
| 142 | - printf (_("Could not open pipe: %s\n"), cl_hidden_auth); | ||
| 143 | - exit (STATE_UNKNOWN); | ||
| 144 | + for (i = 0; i < numoids; i++) { | ||
| 145 | + command_line[10 + i] = oids[i]; | ||
| 146 | + asprintf(&cl_hidden_auth, "%s %s", cl_hidden_auth, oids[i]); | ||
| 147 | } | ||
| 148 | |||
| 149 | -#if 0 /* Removed May 29, 2007 */ | ||
| 150 | - child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 151 | - if (child_stderr == NULL) { | ||
| 152 | - printf (_("Could not open stderr for %s\n"), cl_hidden_auth); | ||
| 153 | - } | ||
| 154 | -#endif | ||
| 155 | - | ||
| 156 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) | ||
| 157 | - asprintf (&output, "%s%s", output, input_buffer); | ||
| 158 | - | ||
| 159 | if (verbose) | ||
| 160 | - printf ("%s\n", output); | ||
| 161 | + printf ("%s\n", cl_hidden_auth); | ||
| 162 | |||
| 163 | - ptr = output; | ||
| 164 | + /* Run the command */ | ||
| 165 | + result = cmd_run_array (command_line, &chld_out, &chld_err, 0); | ||
| 166 | |||
| 167 | - strncat(perfstr, "| ", sizeof(perfstr)-strlen(perfstr)-1); | ||
| 168 | - while (ptr) { | ||
| 169 | - char *foo, *ptr2; | ||
| 170 | - unsigned int copylen; | ||
| 171 | + if (chld_err.lines > 0) { | ||
| 172 | + printf ("%s problem - error output from command\nCMD: %s\n", label, cl_hidden_auth); | ||
| 173 | + for (i = 0; i < chld_err.lines; i++) { | ||
| 174 | + printf ("%s\n", chld_err.line[i]); | ||
| 175 | + } | ||
| 176 | + exit (STATE_WARNING); | ||
| 177 | + } | ||
| 178 | |||
| 179 | - foo = strstr (ptr, delimiter); | ||
| 180 | - copylen = foo-ptr; | ||
| 181 | - if (copylen > sizeof(perfstr)-strlen(perfstr)-1) | ||
| 182 | - copylen = sizeof(perfstr)-strlen(perfstr)-1; | ||
| 183 | - ptr2 = ptr; | ||
| 184 | - ptr = foo; | ||
| 185 | + /* Return UNKNOWN or worse if no output is returned */ | ||
| 186 | + if (chld_out.lines == 0) | ||
| 187 | + die (max_state_alt (result, STATE_UNKNOWN), _("%s problem - No data received from host\nCMD: %s\n"), | ||
| 188 | + label, | ||
| 189 | + cl_hidden_auth); | ||
| 190 | |||
| 191 | - if (ptr == NULL) | ||
| 192 | - break; | ||
| 193 | - | ||
| 194 | - ptr += strlen (delimiter); | ||
| 195 | - ptr += strspn (ptr, " "); | ||
| 196 | - | ||
| 197 | - found++; | ||
| 198 | - | ||
| 199 | - if (ptr[0] == '"') { | ||
| 200 | - ptr++; | ||
| 201 | - response = strpcpy (response, ptr, "\""); | ||
| 202 | - ptr = strpbrk (ptr, "\""); | ||
| 203 | - ptr += strspn (ptr, "\"\n"); | ||
| 204 | + if (verbose) { | ||
| 205 | + for (i = 0; i < chld_out.lines; i++) { | ||
| 206 | + printf ("%s\n", chld_out.line[i]); | ||
| 207 | } | ||
| 208 | - else { | ||
| 209 | - response = strpcpy (response, ptr, "\n"); | ||
| 210 | - ptr = strpbrk (ptr, "\n"); | ||
| 211 | - ptr += strspn (ptr, "\n"); | ||
| 212 | - while | ||
| 213 | - (strstr (ptr, delimiter) && | ||
| 214 | - strstr (ptr, "\n") && strstr (ptr, "\n") < strstr (ptr, delimiter)) { | ||
| 215 | - response = strpcat (response, ptr, "\n"); | ||
| 216 | - ptr = strpbrk (ptr, "\n"); | ||
| 217 | - } | ||
| 218 | - if (ptr && strstr (ptr, delimiter) == NULL) { | ||
| 219 | - asprintf (&response, "%s%s", response, ptr); | ||
| 220 | - ptr = NULL; | ||
| 221 | - } | ||
| 222 | - } | ||
| 223 | + } | ||
| 224 | |||
| 225 | + for (i = 0; i < chld_out.lines; i++) { | ||
| 226 | + ptr = chld_out.line[i]; | ||
| 227 | + oidname = strpcpy (oidname, ptr, delimiter); | ||
| 228 | + response = strstr (ptr, delimiter); | ||
| 229 | + | ||
| 230 | /* We strip out the datatype indicator for PHBs */ | ||
| 231 | |||
| 232 | /* Clean up type array - Sol10 does not necessarily zero it out */ | ||
| 233 | @@ -289,7 +267,6 @@ | ||
| 234 | show = strstr (response, "STRING: ") + 8; | ||
| 235 | else | ||
| 236 | show = response; | ||
| 237 | - p2 = show; | ||
| 238 | |||
| 239 | iresult = STATE_DEPENDENT; | ||
| 240 | |||
| 241 | @@ -306,10 +283,10 @@ | ||
| 242 | eval_method[i] & WARN_LE || | ||
| 243 | eval_method[i] & WARN_EQ || | ||
| 244 | eval_method[i] & WARN_NE) { | ||
| 245 | - p2 = strpbrk (p2, "0123456789"); | ||
| 246 | - if (p2 == NULL) | ||
| 247 | + ptr = strpbrk (show, "0123456789"); | ||
| 248 | + if (ptr == NULL) | ||
| 249 | die (STATE_UNKNOWN,_("No valid data returned")); | ||
| 250 | - response_value[i] = strtoul (p2, NULL, 10); | ||
| 251 | + response_value[i] = strtoul (ptr, NULL, 10); | ||
| 252 | iresult = check_num (i); | ||
| 253 | asprintf (&show, "%llu", response_value[i]); | ||
| 254 | } | ||
| 255 | @@ -364,10 +341,8 @@ | ||
| 256 | if (nunits > (size_t)0 && (size_t)i < nunits && unitv[i] != NULL) | ||
| 257 | asprintf (&outbuff, "%s %s", outbuff, unitv[i]); | ||
| 258 | |||
| 259 | - i++; | ||
| 260 | - | ||
| 261 | if (is_numeric(show)) { | ||
| 262 | - strncat(perfstr, ptr2, copylen); | ||
| 263 | + strncat(perfstr, oidname, sizeof(perfstr)-strlen(perfstr)-1); | ||
| 264 | strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1); | ||
| 265 | strncat(perfstr, show, sizeof(perfstr)-strlen(perfstr)-1); | ||
| 266 | |||
| 267 | @@ -375,29 +350,6 @@ | ||
| 268 | strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1); | ||
| 269 | strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1); | ||
| 270 | } | ||
| 271 | - | ||
| 272 | - } /* end while (ptr) */ | ||
| 273 | - | ||
| 274 | - if (found == 0) | ||
| 275 | - die (STATE_UNKNOWN, | ||
| 276 | - _("%s problem - No data received from host\nCMD: %s\n"), | ||
| 277 | - label, | ||
| 278 | - cl_hidden_auth); | ||
| 279 | - | ||
| 280 | -#if 0 /* Removed May 29, 2007 */ | ||
| 281 | - /* WARNING if output found on stderr */ | ||
| 282 | - if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) | ||
| 283 | - result = max_state (result, STATE_WARNING); | ||
| 284 | - | ||
| 285 | - /* close stderr */ | ||
| 286 | - (void) fclose (child_stderr); | ||
| 287 | -#endif | ||
| 288 | - | ||
| 289 | - /* close the pipe */ | ||
| 290 | - if (spclose (child_process)) { | ||
| 291 | - if (result == STATE_OK) | ||
| 292 | - result = STATE_UNKNOWN; | ||
| 293 | - asprintf (&outbuff, "%s (%s)", outbuff, _("snmpget returned an error status")); | ||
| 294 | } | ||
| 295 | |||
| 296 | /* if (nunits == 1 || i == 1) */ | ||
| 297 | @@ -563,12 +515,12 @@ | ||
| 298 | */ | ||
| 299 | needmibs = TRUE; | ||
| 300 | } | ||
| 301 | - | ||
| 302 | - for (ptr = optarg; (ptr = index (ptr, ',')); ptr++) | ||
| 303 | - ptr[0] = ' '; /* relpace comma with space */ | ||
| 304 | - for (ptr = optarg; (ptr = index (ptr, ' ')); ptr++) | ||
| 305 | - j++; /* count OIDs */ | ||
| 306 | - asprintf (&oid, "%s %s", (oid?oid:""), optarg); | ||
| 307 | + oids = calloc(MAX_OIDS, sizeof (char *)); | ||
| 308 | + for (ptr = strtok(optarg, ", "); ptr != NULL; ptr = strtok(NULL, ", ")) { | ||
| 309 | + oids[j] = strdup(ptr); | ||
| 310 | + j++; | ||
| 311 | + } | ||
| 312 | + numoids = j; | ||
| 313 | if (c == 'E' || c == 'e') { | ||
| 314 | jj++; | ||
| 315 | ii++; | ||
| 316 | @@ -728,16 +680,25 @@ | ||
| 317 | |||
| 318 | if (proto == NULL || (strcmp(proto,DEFAULT_PROTOCOL) == 0) ) { /* default protocol version */ | ||
| 319 | asprintf(&proto, DEFAULT_PROTOCOL); | ||
| 320 | - asprintf(&authpriv, "%s%s", "-c ", community); | ||
| 321 | + numauthpriv = 2; | ||
| 322 | + authpriv = calloc (numauthpriv, sizeof (char *)); | ||
| 323 | + authpriv[0] = strdup ("-c"); | ||
| 324 | + authpriv[1] = strdup (community); | ||
| 325 | } | ||
| 326 | else if ( strcmp (proto, "2c") == 0 ) { /* snmpv2c args */ | ||
| 327 | - asprintf(&authpriv, "%s%s", "-c ", community); | ||
| 328 | + numauthpriv = 2; | ||
| 329 | + authpriv = calloc (numauthpriv, sizeof (char *)); | ||
| 330 | + authpriv[0] = strdup ("-c"); | ||
| 331 | + authpriv[1] = strdup (community); | ||
| 332 | } | ||
| 333 | else if ( strcmp (proto, "3") == 0 ) { /* snmpv3 args */ | ||
| 334 | asprintf(&proto, "%s", "3"); | ||
| 335 | |||
| 336 | if ( (strcmp(seclevel, "noAuthNoPriv") == 0) || seclevel == NULL ) { | ||
| 337 | - asprintf(&authpriv, "%s", "-l noAuthNoPriv" ); | ||
| 338 | + numauthpriv = 2; | ||
| 339 | + authpriv = calloc (numauthpriv, sizeof (char *)); | ||
| 340 | + authpriv[0] = strdup ("-l"); | ||
| 341 | + authpriv[1] = strdup ("noAuthNoPriv"); | ||
| 342 | } | ||
| 343 | else if ( strcmp(seclevel, "authNoPriv") == 0 ) { | ||
| 344 | if ( secname == NULL || authpasswd == NULL) { | ||
| 345 | @@ -745,7 +706,16 @@ | ||
| 346 | print_usage (); | ||
| 347 | exit (STATE_UNKNOWN); | ||
| 348 | } | ||
| 349 | - asprintf(&authpriv, "-l authNoPriv -a %s -u %s -A %s ", authproto, secname, authpasswd); | ||
| 350 | + numauthpriv = 8; | ||
| 351 | + authpriv = calloc (numauthpriv, sizeof (char *)); | ||
| 352 | + authpriv[0] = strdup ("-l"); | ||
| 353 | + authpriv[1] = strdup ("authNoPriv"); | ||
| 354 | + authpriv[3] = strdup ("-a"); | ||
| 355 | + authpriv[4] = strdup (authproto); | ||
| 356 | + authpriv[5] = strdup ("-u"); | ||
| 357 | + authpriv[6] = strdup (secname); | ||
| 358 | + authpriv[7] = strdup ("-A"); | ||
| 359 | + authpriv[8] = strdup (authpasswd); | ||
| 360 | } | ||
| 361 | else if ( strcmp(seclevel, "authPriv") == 0 ) { | ||
| 362 | if ( secname == NULL || authpasswd == NULL || privpasswd == NULL ) { | ||
| 363 | @@ -753,7 +723,20 @@ | ||
| 364 | print_usage (); | ||
| 365 | exit (STATE_UNKNOWN); | ||
| 366 | } | ||
| 367 | - asprintf(&authpriv, "-l authPriv -a %s -u %s -A %s -x %s -X %s ", authproto, secname, authpasswd, privproto, privpasswd); | ||
| 368 | + numauthpriv = 12; | ||
| 369 | + authpriv = calloc (numauthpriv, sizeof (char *)); | ||
| 370 | + authpriv[0] = strdup ("-l"); | ||
| 371 | + authpriv[1] = strdup ("authPriv"); | ||
| 372 | + authpriv[3] = strdup ("-a"); | ||
| 373 | + authpriv[4] = strdup (authproto); | ||
| 374 | + authpriv[5] = strdup ("-u"); | ||
| 375 | + authpriv[6] = strdup (secname); | ||
| 376 | + authpriv[7] = strdup ("-A"); | ||
| 377 | + authpriv[8] = strdup (authpasswd); | ||
| 378 | + authpriv[9] = strdup ("-x"); | ||
| 379 | + authpriv[10] = strdup (privproto); | ||
| 380 | + authpriv[11] = strdup ("-X"); | ||
| 381 | + authpriv[12] = strdup (privpasswd); | ||
| 382 | } | ||
| 383 | |||
| 384 | } | ||
| 385 | Index: plugins/Makefile.am | ||
| 386 | =================================================================== | ||
| 387 | --- plugins/Makefile.am (revision 2160) | ||
| 388 | +++ plugins/Makefile.am (working copy) | ||
| 389 | @@ -93,7 +93,7 @@ | ||
| 390 | check_procs_LDADD = $(BASEOBJS) | ||
| 391 | check_radius_LDADD = $(NETLIBS) $(RADIUSLIBS) | ||
| 392 | check_real_LDADD = $(NETLIBS) | ||
| 393 | -check_snmp_LDADD = $(BASEOBJS) popen.o | ||
| 394 | +check_snmp_LDADD = $(BASEOBJS) | ||
| 395 | check_smtp_LDADD = $(SSLOBJS) $(NETLIBS) $(SSLLIBS) | ||
| 396 | check_ssh_LDADD = $(NETLIBS) | ||
| 397 | check_swap_LDADD = $(MATHLIBS) $(BASEOBJS) popen.o | ||
| 398 | @@ -135,7 +135,7 @@ | ||
| 399 | check_procs_DEPENDENCIES = check_procs.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 400 | check_radius_DEPENDENCIES = check_radius.c $(NETOBJS) $(DEPLIBS) | ||
| 401 | check_real_DEPENDENCIES = check_real.c $(NETOBJS) $(DEPLIBS) | ||
| 402 | -check_snmp_DEPENDENCIES = check_snmp.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 403 | +check_snmp_DEPENDENCIES = check_snmp.c $(BASEOBJS) $(DEPLIBS) | ||
| 404 | check_smtp_DEPENDENCIES = check_smtp.c $(SSLOBJS) $(NETOBJS) $(DEPLIBS) | ||
| 405 | check_ssh_DEPENDENCIES = check_ssh.c $(NETOBJS) $(DEPLIBS) | ||
| 406 | check_swap_DEPENDENCIES = check_swap.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
diff --git a/web/attachments/318264-check_snmp_max_oids.patch b/web/attachments/318264-check_snmp_max_oids.patch new file mode 100644 index 0000000..c2a3217 --- /dev/null +++ b/web/attachments/318264-check_snmp_max_oids.patch | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c | ||
| 2 | index 3dc52df..41a5ea1 100644 | ||
| 3 | --- a/plugins/check_snmp.c | ||
| 4 | +++ b/plugins/check_snmp.c | ||
| 5 | @@ -527,9 +527,8 @@ process_arguments (int argc, char **argv) | ||
| 6 | needmibs = TRUE; | ||
| 7 | } | ||
| 8 | oids = calloc(MAX_OIDS, sizeof (char *)); | ||
| 9 | - for (ptr = strtok(optarg, ", "); ptr != NULL; ptr = strtok(NULL, ", ")) { | ||
| 10 | + for (ptr = strtok(optarg, ", "); ptr != NULL && j < MAX_OIDS; ptr = strtok(NULL, ", "), j++) { | ||
| 11 | oids[j] = strdup(ptr); | ||
| 12 | - j++; | ||
| 13 | } | ||
| 14 | numoids = j; | ||
| 15 | if (c == 'E' || c == 'e') { | ||
diff --git a/web/attachments/318691-check_mysql.patch b/web/attachments/318691-check_mysql.patch new file mode 100644 index 0000000..1716c74 --- /dev/null +++ b/web/attachments/318691-check_mysql.patch | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | --- nagios-plugins-1.4.13/plugins/check_mysql.c 2008-08-16 06:47:32.000000000 +0200 | ||
| 2 | +++ nagios-plugins-1.4.13.oskar/plugins/check_mysql.c 2009-03-19 16:50:18.000000000 +0100 | ||
| 3 | @@ -181,13 +181,14 @@ | ||
| 4 | continue; | ||
| 5 | } | ||
| 6 | } | ||
| 7 | + | ||
| 8 | if ((slave_io_field < 0) || (slave_sql_field < 0) || (num_fields == 0)) { | ||
| 9 | mysql_free_result (res); | ||
| 10 | mysql_close (&mysql); | ||
| 11 | die (STATE_CRITICAL, "Slave status unavailable\n"); | ||
| 12 | } | ||
| 13 | |||
| 14 | - snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s Seconds Behind Master: %s", row[slave_io_field], row[slave_sql_field], row[seconds_behind_field]); | ||
| 15 | + snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s Seconds Behind Master: %s", row[slave_io_field], row[slave_sql_field], seconds_behind_field!=-1?row[seconds_behind_field]:"Unknown"); | ||
| 16 | if (strcmp (row[slave_io_field], "Yes") != 0 || strcmp (row[slave_sql_field], "Yes") != 0) { | ||
| 17 | mysql_free_result (res); | ||
| 18 | mysql_close (&mysql); | ||
| 19 | |||
diff --git a/web/attachments/318840-sslutils_sni.patch b/web/attachments/318840-sslutils_sni.patch new file mode 100644 index 0000000..4251244 --- /dev/null +++ b/web/attachments/318840-sslutils_sni.patch | |||
| @@ -0,0 +1,85 @@ | |||
| 1 | diff --git a/plugins/check_http.c b/plugins/check_http.c | ||
| 2 | index c8ae67f..33a9379 100644 | ||
| 3 | --- a/plugins/check_http.c | ||
| 4 | +++ b/plugins/check_http.c | ||
| 5 | @@ -790,6 +790,9 @@ check_http (void) | ||
| 6 | die (STATE_CRITICAL, _("HTTP CRITICAL - Unable to open TCP socket\n")); | ||
| 7 | #ifdef HAVE_SSL | ||
| 8 | if (use_ssl == TRUE) { | ||
| 9 | + /* Set host name for SSL/TLS hostname extension support (SNI) */ | ||
| 10 | + if (host_name) | ||
| 11 | + np_net_ssl_set_host_name(host_name); | ||
| 12 | np_net_ssl_init(sd); | ||
| 13 | if (check_cert == TRUE) { | ||
| 14 | result = np_net_ssl_check_cert(days_till_exp); | ||
| 15 | diff --git a/plugins/netutils.h b/plugins/netutils.h | ||
| 16 | index 6bc5386..c6f863d 100644 | ||
| 17 | --- a/plugins/netutils.h | ||
| 18 | +++ b/plugins/netutils.h | ||
| 19 | @@ -96,6 +96,7 @@ void np_net_ssl_cleanup(); | ||
| 20 | int np_net_ssl_write(const void *buf, int num); | ||
| 21 | int np_net_ssl_read(void *buf, int num); | ||
| 22 | int np_net_ssl_check_cert(int days_till_exp); | ||
| 23 | +void np_net_ssl_set_host_name(const char *buf); | ||
| 24 | #endif /* HAVE_SSL */ | ||
| 25 | |||
| 26 | #endif /* _NETUTILS_H_ */ | ||
| 27 | diff --git a/plugins/sslutils.c b/plugins/sslutils.c | ||
| 28 | index 1d4ef94..a8aee93 100644 | ||
| 29 | --- a/plugins/sslutils.c | ||
| 30 | +++ b/plugins/sslutils.c | ||
| 31 | @@ -34,6 +34,7 @@ | ||
| 32 | static SSL_CTX *c=NULL; | ||
| 33 | static SSL *s=NULL; | ||
| 34 | static int initialized=0; | ||
| 35 | +const char *host_name=NULL; | ||
| 36 | |||
| 37 | int np_net_ssl_init (int sd){ | ||
| 38 | if (!initialized) { | ||
| 39 | @@ -48,6 +49,10 @@ int np_net_ssl_init (int sd){ | ||
| 40 | return STATE_CRITICAL; | ||
| 41 | } | ||
| 42 | if ((s = SSL_new (c)) != NULL){ | ||
| 43 | +#ifdef SSL_set_tlsext_host_name | ||
| 44 | + if (host_name != NULL) | ||
| 45 | + SSL_set_tlsext_host_name(s, host_name); | ||
| 46 | +#endif | ||
| 47 | SSL_set_fd (s, sd); | ||
| 48 | if (SSL_connect(s) == 1){ | ||
| 49 | return OK; | ||
| 50 | @@ -65,6 +70,9 @@ int np_net_ssl_init (int sd){ | ||
| 51 | |||
| 52 | void np_net_ssl_cleanup (){ | ||
| 53 | if(s){ | ||
| 54 | +#ifdef SSL_set_tlsext_host_name | ||
| 55 | + SSL_set_tlsext_host_name(s, NULL); | ||
| 56 | +#endif | ||
| 57 | SSL_shutdown (s); | ||
| 58 | SSL_free (s); | ||
| 59 | if(c) { | ||
| 60 | @@ -73,6 +81,7 @@ void np_net_ssl_cleanup (){ | ||
| 61 | } | ||
| 62 | s=NULL; | ||
| 63 | } | ||
| 64 | + host_name = NULL; | ||
| 65 | } | ||
| 66 | |||
| 67 | int np_net_ssl_write(const void *buf, int num){ | ||
| 68 | @@ -86,7 +95,7 @@ int np_net_ssl_read(void *buf, int num){ | ||
| 69 | int np_net_ssl_check_cert(int days_till_exp){ | ||
| 70 | # ifdef USE_OPENSSL | ||
| 71 | X509 *certificate=NULL; | ||
| 72 | - ASN1_STRING *tm; | ||
| 73 | + ASN1_STRING *tm; | ||
| 74 | int offset; | ||
| 75 | struct tm stamp; | ||
| 76 | float time_left; | ||
| 77 | @@ -163,4 +172,8 @@ int np_net_ssl_check_cert(int days_till_exp){ | ||
| 78 | # endif /* USE_OPENSSL */ | ||
| 79 | } | ||
| 80 | |||
| 81 | +void np_net_ssl_set_host_name (const char *buf){ | ||
| 82 | + host_name = buf; | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | #endif /* HAVE_SSL */ | ||
diff --git a/web/attachments/319236-check_file_age--allow_missing_file.diff b/web/attachments/319236-check_file_age--allow_missing_file.diff new file mode 100644 index 0000000..6e51a5a --- /dev/null +++ b/web/attachments/319236-check_file_age--allow_missing_file.diff | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | --- a/check_file_age 2008-12-29 07:54:29.000000000 -0800 | ||
| 2 | +++ b/check_file_age 2009-03-23 22:35:54.000000000 -0700 | ||
| 3 | @@ -33,7 +33,7 @@ use utils qw (%ERRORS &print_revision &s | ||
| 4 | sub print_help (); | ||
| 5 | sub print_usage (); | ||
| 6 | |||
| 7 | -my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V); | ||
| 8 | +my ($opt_c, $opt_f, $opt_m, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V); | ||
| 9 | my ($result, $message, $age, $size, $st); | ||
| 10 | |||
| 11 | $PROGNAME="check_file_age"; | ||
| 12 | @@ -48,6 +48,7 @@ Getopt::Long::Configure('bundling'); | ||
| 13 | GetOptions( | ||
| 14 | "V" => \$opt_V, "version" => \$opt_V, | ||
| 15 | "h" => \$opt_h, "help" => \$opt_h, | ||
| 16 | + "m" => \$opt_m, "missing" => \$opt_m, | ||
| 17 | "f=s" => \$opt_f, "file" => \$opt_f, | ||
| 18 | "w=f" => \$opt_w, "warning-age=f" => \$opt_w, | ||
| 19 | "W=f" => \$opt_W, "warning-size=f" => \$opt_W, | ||
| 20 | @@ -73,8 +74,14 @@ if (! $opt_f) { | ||
| 21 | |||
| 22 | # Check that file exists (can be directory or link) | ||
| 23 | unless (-e $opt_f) { | ||
| 24 | - print "FILE_AGE CRITICAL: File not found - $opt_f\n"; | ||
| 25 | - exit $ERRORS{'CRITICAL'}; | ||
| 26 | + # If we allow missing files/directories, return OK | ||
| 27 | + if ($opt_m) { | ||
| 28 | + print "FILE_AGE OK: File not found - $opt_f\n"; | ||
| 29 | + exit $ERRORS{'OK'}; | ||
| 30 | + } else { | ||
| 31 | + print "FILE_AGE CRITICAL: File not found - $opt_f\n"; | ||
| 32 | + exit $ERRORS{'CRITICAL'}; | ||
| 33 | + } | ||
| 34 | } | ||
| 35 | |||
| 36 | $st = File::stat::stat($opt_f); | ||
| 37 | |||
diff --git a/web/attachments/320396-nagios-plugins-subst.txt b/web/attachments/320396-nagios-plugins-subst.txt new file mode 100644 index 0000000..b04dea5 --- /dev/null +++ b/web/attachments/320396-nagios-plugins-subst.txt | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | --- nagios-plugins-1.4.13/plugins-scripts/subst.in.orig 2009-03-31 13:59:58.000000000 +1100 | ||
| 2 | +++ nagios-plugins-1.4.13/plugins-scripts/subst.in 2009-03-31 14:01:30.000000000 +1100 | ||
| 3 | @@ -62,11 +62,14 @@ | ||
| 4 | # subst will replace the fully qualified command with whatever is | ||
| 5 | # returned from the which subroutine | ||
| 6 | # | ||
| 7 | -/^[^#]/ && /(\/.*)?\/(bin|sbin|lib|libexec)\// { | ||
| 8 | - match($0,/(\/.*)?\/(bin|sbin|lib|libexec)\/[-_a-zA-Z0-9]+/); | ||
| 9 | - c=substr($0,RSTART,RLENGTH); | ||
| 10 | - sub(c,which(c,path)); | ||
| 11 | -} | ||
| 12 | +# REMOVED: had collateral dammage of also replacing library paths: | ||
| 13 | +# use lib "/usr/lib/nagios/plugins" ==> use lib "nagios/plugins", | ||
| 14 | +# this is wrong, and provides no real benefit for executables | ||
| 15 | +#/^[^#]/ && /(\/.*)?\/(bin|sbin|lib|libexec)\// { | ||
| 16 | +# match($0,/(\/.*)?\/(bin|sbin|lib|libexec)\/[-_a-zA-Z0-9]+/); | ||
| 17 | +# c=substr($0,RSTART,RLENGTH); | ||
| 18 | +# sub(c,which(c,path)); | ||
| 19 | +#} | ||
| 20 | |||
| 21 | { | ||
| 22 | print; | ||
diff --git a/web/attachments/320775-debian-subst.txt b/web/attachments/320775-debian-subst.txt new file mode 100644 index 0000000..65e28ea --- /dev/null +++ b/web/attachments/320775-debian-subst.txt | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | diff -urNad sid2~/plugins-scripts/subst.in sid2/plugins-scripts/subst.in | ||
| 2 | --- sid2~/plugins-scripts/subst.in 2005-08-31 00:11:42.000000000 +0200 | ||
| 3 | +++ sid2/plugins-scripts/subst.in 2005-10-07 22:37:45.000000000 +0200 | ||
| 4 | @@ -1,35 +1,9 @@ | ||
| 5 | #!/usr/bin/awk | ||
| 6 | |||
| 7 | -function which(c,path) { | ||
| 8 | - cmd = "test -x " c; | ||
| 9 | - | ||
| 10 | - if (system(cmd)==0) { | ||
| 11 | - return c; | ||
| 12 | - } | ||
| 13 | - | ||
| 14 | - sub(/\/.*\//,"",c); | ||
| 15 | - for (dir in path) { | ||
| 16 | - cmd = "test -x " path[dir] "/" c; | ||
| 17 | - if (system(cmd)==0) { | ||
| 18 | - return path[dir] "/" c; | ||
| 19 | - } | ||
| 20 | - } | ||
| 21 | - | ||
| 22 | - | ||
| 23 | - return c; | ||
| 24 | -} | ||
| 25 | - | ||
| 26 | # used to replace "use lib utils.pm" with "use lib @libexecdir" | ||
| 27 | # | ||
| 28 | function led() { | ||
| 29 | - led1 = "@libexecdir@"; | ||
| 30 | - led2 = "@exec_prefix@"; | ||
| 31 | - led3 = "@prefix@"; | ||
| 32 | - if ( match(led1, /^\$\{exec_prefix\}/ ) != 0 ) { | ||
| 33 | - return "\"" led3 "/libexec\" " ; | ||
| 34 | - | ||
| 35 | - } | ||
| 36 | - return "\"" led1 "\"" ; | ||
| 37 | + return "\"/usr/lib/nagios/plugins\"" ; | ||
| 38 | } | ||
| 39 | |||
| 40 | BEGIN { | ||
| 41 | @@ -58,16 +32,6 @@ | ||
| 42 | sub(/\=.*$/,"='@with_trusted_path@' # autoconf-derived"); | ||
| 43 | } | ||
| 44 | |||
| 45 | -# If a script contains a reference to a fully qualified command, | ||
| 46 | -# subst will replace the fully qualified command with whatever is | ||
| 47 | -# returned from the which subroutine | ||
| 48 | -# | ||
| 49 | -/^[^#]/ && /(\/.*)?\/(bin|sbin|lib|libexec)\// { | ||
| 50 | - match($0,/(\/.*)?\/(bin|sbin|lib|libexec)\/[-_a-zA-Z0-9]+/); | ||
| 51 | - c=substr($0,RSTART,RLENGTH); | ||
| 52 | - sub(c,which(c,path)); | ||
| 53 | -} | ||
| 54 | - | ||
| 55 | { | ||
| 56 | print; | ||
| 57 | } \ No newline at end of file | ||
diff --git a/web/attachments/320776-nagios-plugins-subst.patch b/web/attachments/320776-nagios-plugins-subst.patch new file mode 100644 index 0000000..9402d30 --- /dev/null +++ b/web/attachments/320776-nagios-plugins-subst.patch | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | --- nagios-plugins-1.4.13/plugins-scripts/subst.in.orig 2009-04-02 11:42:29.000000000 +1100 | ||
| 2 | +++ nagios-plugins-1.4.13/plugins-scripts/subst.in 2009-04-02 11:43:39.000000000 +1100 | ||
| 3 | @@ -44,6 +44,16 @@ | ||
| 4 | /^#! ?\/.*\/[a-z]{0,2}awk/ {sub(/^#! ?\/.*\/[a-z]{0,2}awk/,"#! @AWK@");} | ||
| 5 | /^#! ?\/.*\/sh/ {sub(/^#! ?\/.*\/sh/,"#! @SHELL@");} | ||
| 6 | |||
| 7 | +# If a script contains a reference to a fully qualified command, | ||
| 8 | +# subst will replace the fully qualified command with whatever is | ||
| 9 | +# returned from the which subroutine. run before changes to INC to add libexecdir | ||
| 10 | +# | ||
| 11 | +/^[^#]/ && /(\/.*)?\/(bin|sbin|lib|libexec)\// { | ||
| 12 | + match($0,/(\/.*)?\/(bin|sbin|lib|libexec)\/[-_a-zA-Z0-9]+/); | ||
| 13 | + c=substr($0,RSTART,RLENGTH); | ||
| 14 | + sub(c,which(c,path)); | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | # add to libexecdir to INC for perl utils.pm | ||
| 18 | /^use/ { if (/lib/) { if (/utils.pm|"."/ ) {sub(/utils.pm|"."/,led() )} } } | ||
| 19 | |||
| 20 | @@ -58,16 +68,6 @@ | ||
| 21 | sub(/\=.*$/,"='@with_trusted_path@' # autoconf-derived"); | ||
| 22 | } | ||
| 23 | |||
| 24 | -# If a script contains a reference to a fully qualified command, | ||
| 25 | -# subst will replace the fully qualified command with whatever is | ||
| 26 | -# returned from the which subroutine | ||
| 27 | -# | ||
| 28 | -/^[^#]/ && /(\/.*)?\/(bin|sbin|lib|libexec)\// { | ||
| 29 | - match($0,/(\/.*)?\/(bin|sbin|lib|libexec)\/[-_a-zA-Z0-9]+/); | ||
| 30 | - c=substr($0,RSTART,RLENGTH); | ||
| 31 | - sub(c,which(c,path)); | ||
| 32 | -} | ||
| 33 | - | ||
| 34 | { | ||
| 35 | print; | ||
| 36 | } | ||
diff --git a/web/attachments/321258-patch-521097.diff b/web/attachments/321258-patch-521097.diff new file mode 100644 index 0000000..80d5386 --- /dev/null +++ b/web/attachments/321258-patch-521097.diff | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | diff -u nagios-plugins-1.4.12/debian/changelog nagios-plugins-1.4.12/debian/changelog | ||
| 2 | --- nagios-plugins-1.4.12.orig/plugins/check_nt.c | ||
| 3 | +++ nagios-plugins-1.4.12/plugins/check_nt.c | ||
| 4 | @@ -134,6 +134,11 @@ | ||
| 5 | /* set socket timeout */ | ||
| 6 | alarm(socket_timeout); | ||
| 7 | |||
| 8 | + if (NULL==server_address) { | ||
| 9 | + fputs("missing -H parameter\n", stderr); | ||
| 10 | + exit(return_code); | ||
| 11 | + } | ||
| 12 | + | ||
| 13 | switch (vars_to_check) { | ||
| 14 | |||
| 15 | case CHECK_CLIENTVERSION: | ||
| 16 | @@ -517,7 +522,6 @@ | ||
| 17 | print_revision(progname,revision); | ||
| 18 | exit(STATE_OK); | ||
| 19 | case 'H': /* hostname */ | ||
| 20 | - if (server_address) free(server_address); | ||
| 21 | server_address = optarg; | ||
| 22 | break; | ||
| 23 | case 's': /* password */ | ||
diff --git a/web/attachments/321721-check_dns.patch.txt b/web/attachments/321721-check_dns.patch.txt new file mode 100644 index 0000000..8dae235 --- /dev/null +++ b/web/attachments/321721-check_dns.patch.txt | |||
| @@ -0,0 +1,183 @@ | |||
| 1 | Index: check_dns.c | ||
| 2 | =================================================================== | ||
| 3 | --- check_dns.c (revision 2188) | ||
| 4 | +++ check_dns.c (working copy) | ||
| 5 | @@ -45,15 +45,17 @@ | ||
| 6 | void print_help (void); | ||
| 7 | void print_usage (void); | ||
| 8 | |||
| 9 | -#define ADDRESS_LENGTH 256 | ||
| 10 | +#define ADDRESS_LENGTH 384 | ||
| 11 | char query_address[ADDRESS_LENGTH] = ""; | ||
| 12 | char dns_server[ADDRESS_LENGTH] = ""; | ||
| 13 | char ptr_server[ADDRESS_LENGTH] = ""; | ||
| 14 | +char query_type[16] = ""; | ||
| 15 | int verbose = FALSE; | ||
| 16 | char **expected_address = NULL; | ||
| 17 | int expected_address_cnt = 0; | ||
| 18 | |||
| 19 | int expect_authority = FALSE; | ||
| 20 | +int accept_cname = FALSE; | ||
| 21 | thresholds *time_thresholds = NULL; | ||
| 22 | |||
| 23 | static int | ||
| 24 | @@ -65,7 +67,23 @@ | ||
| 25 | return strcmp(* (char * const *) p1, * (char * const *) p2); | ||
| 26 | } | ||
| 27 | |||
| 28 | +char * | ||
| 29 | +check_new_address(char *temp_buffer) | ||
| 30 | +{ | ||
| 31 | + temp_buffer++; | ||
| 32 | + /* Strip leading spaces */ | ||
| 33 | + for (; *temp_buffer != '\0' && *temp_buffer == ' '; temp_buffer++) | ||
| 34 | + /* NOOP */; | ||
| 35 | |||
| 36 | + strip(temp_buffer); | ||
| 37 | + if (temp_buffer==NULL || strlen(temp_buffer)==0) { | ||
| 38 | + die (STATE_CRITICAL, | ||
| 39 | + _("DNS CRITICAL - '%s' returned empty host name string\n"), | ||
| 40 | + NSLOOKUP_COMMAND); | ||
| 41 | + } | ||
| 42 | + return temp_buffer; | ||
| 43 | +} | ||
| 44 | + | ||
| 45 | int | ||
| 46 | main (int argc, char **argv) | ||
| 47 | { | ||
| 48 | @@ -103,7 +121,7 @@ | ||
| 49 | } | ||
| 50 | |||
| 51 | /* get the command to run */ | ||
| 52 | - asprintf (&command_line, "%s %s %s", NSLOOKUP_COMMAND, query_address, dns_server); | ||
| 53 | + asprintf (&command_line, "%s %s %s %s", NSLOOKUP_COMMAND, query_type, query_address, dns_server); | ||
| 54 | |||
| 55 | alarm (timeout_interval); | ||
| 56 | gettimeofday (&tv, NULL); | ||
| 57 | @@ -136,28 +154,26 @@ | ||
| 58 | } | ||
| 59 | } | ||
| 60 | |||
| 61 | + if (strstr (chld_out.line[i], "Authoritative answers can be found from:")) | ||
| 62 | + break; | ||
| 63 | /* the server is responding, we just got the host name... */ | ||
| 64 | if (strstr (chld_out.line[i], "Name:")) | ||
| 65 | parse_address = TRUE; | ||
| 66 | + else if (strstr (chld_out.line[i], "AAAA address")) { | ||
| 67 | + temp_buffer = rindex (chld_out.line[i], ' '); | ||
| 68 | + addresses[n_addresses++] = check_new_address(temp_buffer); | ||
| 69 | + } | ||
| 70 | + else if (strstr (chld_out.line[i], "text =") || strstr (chld_out.line[i], "exchanger =") \ | ||
| 71 | + || strstr (chld_out.line[i], "service =") || (accept_cname && strstr (chld_out.line[i], "name ="))) { | ||
| 72 | + temp_buffer = index (chld_out.line[i], '='); | ||
| 73 | + addresses[n_addresses++] = check_new_address(temp_buffer); | ||
| 74 | + } | ||
| 75 | else if (parse_address == TRUE && (strstr (chld_out.line[i], "Address:") || | ||
| 76 | strstr (chld_out.line[i], "Addresses:"))) { | ||
| 77 | temp_buffer = index (chld_out.line[i], ':'); | ||
| 78 | - temp_buffer++; | ||
| 79 | - | ||
| 80 | - /* Strip leading spaces */ | ||
| 81 | - for (; *temp_buffer != '\0' && *temp_buffer == ' '; temp_buffer++) | ||
| 82 | - /* NOOP */; | ||
| 83 | - | ||
| 84 | - strip(temp_buffer); | ||
| 85 | - if (temp_buffer==NULL || strlen(temp_buffer)==0) { | ||
| 86 | - die (STATE_CRITICAL, | ||
| 87 | - _("DNS CRITICAL - '%s' returned empty host name string\n"), | ||
| 88 | - NSLOOKUP_COMMAND); | ||
| 89 | - } | ||
| 90 | - | ||
| 91 | - addresses[n_addresses++] = strdup(temp_buffer); | ||
| 92 | - } | ||
| 93 | - else if (strstr (chld_out.line[i], _("Non-authoritative answer:"))) { | ||
| 94 | + addresses[n_addresses++] = check_new_address(temp_buffer); | ||
| 95 | + } | ||
| 96 | + if (strstr (chld_out.line[i], _("Non-authoritative answer:"))) { | ||
| 97 | non_authoritative = TRUE; | ||
| 98 | } | ||
| 99 | |||
| 100 | @@ -274,7 +290,7 @@ | ||
| 101 | die (STATE_CRITICAL, _("No response from DNS %s\n"), dns_server); | ||
| 102 | |||
| 103 | /* Host name is valid, but server doesn't have records... */ | ||
| 104 | - else if (strstr (input_buffer, "No records")) | ||
| 105 | + else if (strstr (input_buffer, "No records") || strstr (input_buffer, "No answer")) | ||
| 106 | die (STATE_CRITICAL, _("DNS %s has no records\n"), dns_server); | ||
| 107 | |||
| 108 | /* Connection was refused */ | ||
| 109 | @@ -316,7 +332,6 @@ | ||
| 110 | |||
| 111 | } | ||
| 112 | |||
| 113 | - | ||
| 114 | /* process command-line arguments */ | ||
| 115 | int | ||
| 116 | process_arguments (int argc, char **argv) | ||
| 117 | @@ -334,8 +349,10 @@ | ||
| 118 | {"hostname", required_argument, 0, 'H'}, | ||
| 119 | {"server", required_argument, 0, 's'}, | ||
| 120 | {"reverse-server", required_argument, 0, 'r'}, | ||
| 121 | + {"querytype", required_argument, 0, 'q'}, | ||
| 122 | {"expected-address", required_argument, 0, 'a'}, | ||
| 123 | {"expect-authority", no_argument, 0, 'A'}, | ||
| 124 | + {"accept-cname", no_argument, 0, 'n'}, | ||
| 125 | {"warning", required_argument, 0, 'w'}, | ||
| 126 | {"critical", required_argument, 0, 'c'}, | ||
| 127 | {0, 0, 0, 0} | ||
| 128 | @@ -349,7 +366,7 @@ | ||
| 129 | strcpy (argv[c], "-t"); | ||
| 130 | |||
| 131 | while (1) { | ||
| 132 | - c = getopt_long (argc, argv, "hVvAt:H:s:r:a:w:c:", long_opts, &opt_index); | ||
| 133 | + c = getopt_long (argc, argv, "hVvAnt:H:s:r:a:q:w:c:", long_opts, &opt_index); | ||
| 134 | |||
| 135 | if (c == -1 || c == EOF) | ||
| 136 | break; | ||
| 137 | @@ -394,9 +411,18 @@ | ||
| 138 | expected_address[expected_address_cnt] = strdup(optarg); | ||
| 139 | expected_address_cnt++; | ||
| 140 | break; | ||
| 141 | + case 'q': /* querytype -- A or AAAA or ANY or SRV or TXT, etc. */ | ||
| 142 | + if (strlen (optarg) < 1 || strlen (optarg) > 4) | ||
| 143 | + die (STATE_UNKNOWN, _("Missing valid querytype parameter. Try using 'A' or 'AAAA' or 'SRV'\n")); | ||
| 144 | + strcpy(query_type, "-querytype="); | ||
| 145 | + strcat(query_type, optarg); | ||
| 146 | + break; | ||
| 147 | case 'A': /* expect authority */ | ||
| 148 | expect_authority = TRUE; | ||
| 149 | break; | ||
| 150 | + case 'n': /* accept cname responses as a result */ | ||
| 151 | + accept_cname = TRUE; | ||
| 152 | + break; | ||
| 153 | case 'w': | ||
| 154 | warning = optarg; | ||
| 155 | break; | ||
| 156 | @@ -462,13 +488,20 @@ | ||
| 157 | printf (" %s\n", _("The name or address you want to query")); | ||
| 158 | printf (" -s, --server=HOST\n"); | ||
| 159 | printf (" %s\n", _("Optional DNS server you want to use for the lookup")); | ||
| 160 | + printf (" -q, --querytype=TYPE\n"); | ||
| 161 | + printf (" %s\n", _("Optional DNS record query type where TYPE =(A, AAAA, SRV, TXT, MX, ANY)")); | ||
| 162 | + printf (" %s\n", _("The default query type is 'A' (IPv4 host entry)")); | ||
| 163 | printf (" -a, --expected-address=IP-ADDRESS|HOST\n"); | ||
| 164 | printf (" %s\n", _("Optional IP-ADDRESS you expect the DNS server to return. HOST must end with")); | ||
| 165 | printf (" %s\n", _("a dot (.). This option can be repeated multiple times (Returns OK if any")); | ||
| 166 | printf (" %s\n", _("value match). If multiple addresses are returned at once, you have to match")); | ||
| 167 | printf (" %s\n", _("the whole string of addresses separated with commas (sorted alphabetically).")); | ||
| 168 | + printf (" %s\n", _("If you would like to test for the presence of a cname, combine with -n param.")); | ||
| 169 | printf (" -A, --expect-authority\n"); | ||
| 170 | printf (" %s\n", _("Optionally expect the DNS server to be authoritative for the lookup")); | ||
| 171 | + printf (" -n, --accept-cname\n"); | ||
| 172 | + printf (" %s\n", _("Optionally accept cname responses as a valid result to a query")); | ||
| 173 | + printf (" %s\n", _("The default is to ignore cname responses as part of the result")); | ||
| 174 | printf (" -w, --warning=seconds\n"); | ||
| 175 | printf (" %s\n", _("Return warning if elapsed time exceeds value. Default off")); | ||
| 176 | printf (" -c, --critical=seconds\n"); | ||
| 177 | @@ -490,5 +523,5 @@ | ||
| 178 | print_usage (void) | ||
| 179 | { | ||
| 180 | printf (_("Usage:")); | ||
| 181 | - printf ("%s -H host [-s server] [-a expected-address] [-A] [-t timeout] [-w warn] [-c crit]\n", progname); | ||
| 182 | + printf ("%s -H host [-s server] [-q type ] [-a expected-address] [-A] [-n] [-t timeout] [-w warn] [-c crit]\n", progname); | ||
| 183 | } | ||
diff --git a/web/attachments/321739-check_dns.patch.git.txt b/web/attachments/321739-check_dns.patch.git.txt new file mode 100644 index 0000000..2f386cd --- /dev/null +++ b/web/attachments/321739-check_dns.patch.git.txt | |||
| @@ -0,0 +1,182 @@ | |||
| 1 | diff --git a/plugins/check_dns.c b/plugins/check_dns.c | ||
| 2 | index 873dcae..4ca6b91 100644 | ||
| 3 | --- a/plugins/check_dns.c | ||
| 4 | +++ b/plugins/check_dns.c | ||
| 5 | @@ -45,15 +45,17 @@ int error_scan (char *); | ||
| 6 | void print_help (void); | ||
| 7 | void print_usage (void); | ||
| 8 | |||
| 9 | -#define ADDRESS_LENGTH 256 | ||
| 10 | +#define ADDRESS_LENGTH 384 | ||
| 11 | char query_address[ADDRESS_LENGTH] = ""; | ||
| 12 | char dns_server[ADDRESS_LENGTH] = ""; | ||
| 13 | char ptr_server[ADDRESS_LENGTH] = ""; | ||
| 14 | +char query_type[16] = ""; | ||
| 15 | int verbose = FALSE; | ||
| 16 | char **expected_address = NULL; | ||
| 17 | int expected_address_cnt = 0; | ||
| 18 | |||
| 19 | int expect_authority = FALSE; | ||
| 20 | +int accept_cname = FALSE; | ||
| 21 | thresholds *time_thresholds = NULL; | ||
| 22 | |||
| 23 | static int | ||
| 24 | @@ -65,6 +67,22 @@ qstrcmp(const void *p1, const void *p2) | ||
| 25 | return strcmp(* (char * const *) p1, * (char * const *) p2); | ||
| 26 | } | ||
| 27 | |||
| 28 | +char * | ||
| 29 | +check_new_address(char *temp_buffer) | ||
| 30 | +{ | ||
| 31 | + temp_buffer++; | ||
| 32 | + /* Strip leading spaces */ | ||
| 33 | + for (; *temp_buffer != '\0' && *temp_buffer == ' '; temp_buffer++) | ||
| 34 | + /* NOOP */; | ||
| 35 | + | ||
| 36 | + strip(temp_buffer); | ||
| 37 | + if (temp_buffer==NULL || strlen(temp_buffer)==0) { | ||
| 38 | + die (STATE_CRITICAL, | ||
| 39 | + _("DNS CRITICAL - '%s' returned empty host name string\n"), | ||
| 40 | + NSLOOKUP_COMMAND); | ||
| 41 | + } | ||
| 42 | + return temp_buffer; | ||
| 43 | +} | ||
| 44 | |||
| 45 | int | ||
| 46 | main (int argc, char **argv) | ||
| 47 | @@ -103,7 +121,7 @@ main (int argc, char **argv) | ||
| 48 | } | ||
| 49 | |||
| 50 | /* get the command to run */ | ||
| 51 | - asprintf (&command_line, "%s %s %s", NSLOOKUP_COMMAND, query_address, dns_server); | ||
| 52 | + asprintf (&command_line, "%s %s %s %s", NSLOOKUP_COMMAND, query_type, query_address, dns_server); | ||
| 53 | |||
| 54 | alarm (timeout_interval); | ||
| 55 | gettimeofday (&tv, NULL); | ||
| 56 | @@ -136,28 +154,26 @@ main (int argc, char **argv) | ||
| 57 | } | ||
| 58 | } | ||
| 59 | |||
| 60 | + if (strstr (chld_out.line[i], "Authoritative answers can be found from:")) | ||
| 61 | + break; | ||
| 62 | /* the server is responding, we just got the host name... */ | ||
| 63 | if (strstr (chld_out.line[i], "Name:")) | ||
| 64 | parse_address = TRUE; | ||
| 65 | + else if (strstr (chld_out.line[i], "AAAA address")) { | ||
| 66 | + temp_buffer = rindex (chld_out.line[i], ' '); | ||
| 67 | + addresses[n_addresses++] = check_new_address(temp_buffer); | ||
| 68 | + } | ||
| 69 | + else if (strstr (chld_out.line[i], "text =") || strstr (chld_out.line[i], "exchanger =") \ | ||
| 70 | + || strstr (chld_out.line[i], "service =") || (accept_cname && strstr (chld_out.line[i], "name ="))) { | ||
| 71 | + temp_buffer = index (chld_out.line[i], '='); | ||
| 72 | + addresses[n_addresses++] = check_new_address(temp_buffer); | ||
| 73 | + } | ||
| 74 | else if (parse_address == TRUE && (strstr (chld_out.line[i], "Address:") || | ||
| 75 | strstr (chld_out.line[i], "Addresses:"))) { | ||
| 76 | temp_buffer = index (chld_out.line[i], ':'); | ||
| 77 | - temp_buffer++; | ||
| 78 | - | ||
| 79 | - /* Strip leading spaces */ | ||
| 80 | - for (; *temp_buffer != '\0' && *temp_buffer == ' '; temp_buffer++) | ||
| 81 | - /* NOOP */; | ||
| 82 | - | ||
| 83 | - strip(temp_buffer); | ||
| 84 | - if (temp_buffer==NULL || strlen(temp_buffer)==0) { | ||
| 85 | - die (STATE_CRITICAL, | ||
| 86 | - _("DNS CRITICAL - '%s' returned empty host name string\n"), | ||
| 87 | - NSLOOKUP_COMMAND); | ||
| 88 | - } | ||
| 89 | - | ||
| 90 | - addresses[n_addresses++] = strdup(temp_buffer); | ||
| 91 | - } | ||
| 92 | - else if (strstr (chld_out.line[i], _("Non-authoritative answer:"))) { | ||
| 93 | + addresses[n_addresses++] = check_new_address(temp_buffer); | ||
| 94 | + } | ||
| 95 | + if (strstr (chld_out.line[i], _("Non-authoritative answer:"))) { | ||
| 96 | non_authoritative = TRUE; | ||
| 97 | } | ||
| 98 | |||
| 99 | @@ -274,7 +290,7 @@ error_scan (char *input_buffer) | ||
| 100 | die (STATE_CRITICAL, _("No response from DNS %s\n"), dns_server); | ||
| 101 | |||
| 102 | /* Host name is valid, but server doesn't have records... */ | ||
| 103 | - else if (strstr (input_buffer, "No records")) | ||
| 104 | + else if (strstr (input_buffer, "No records") || strstr (input_buffer, "No answer")) | ||
| 105 | die (STATE_CRITICAL, _("DNS %s has no records\n"), dns_server); | ||
| 106 | |||
| 107 | /* Connection was refused */ | ||
| 108 | @@ -316,7 +332,6 @@ error_scan (char *input_buffer) | ||
| 109 | |||
| 110 | } | ||
| 111 | |||
| 112 | - | ||
| 113 | /* process command-line arguments */ | ||
| 114 | int | ||
| 115 | process_arguments (int argc, char **argv) | ||
| 116 | @@ -334,8 +349,10 @@ process_arguments (int argc, char **argv) | ||
| 117 | {"hostname", required_argument, 0, 'H'}, | ||
| 118 | {"server", required_argument, 0, 's'}, | ||
| 119 | {"reverse-server", required_argument, 0, 'r'}, | ||
| 120 | + {"querytype", required_argument, 0, 'q'}, | ||
| 121 | {"expected-address", required_argument, 0, 'a'}, | ||
| 122 | {"expect-authority", no_argument, 0, 'A'}, | ||
| 123 | + {"accept-cname", no_argument, 0, 'n'}, | ||
| 124 | {"warning", required_argument, 0, 'w'}, | ||
| 125 | {"critical", required_argument, 0, 'c'}, | ||
| 126 | {0, 0, 0, 0} | ||
| 127 | @@ -349,7 +366,7 @@ process_arguments (int argc, char **argv) | ||
| 128 | strcpy (argv[c], "-t"); | ||
| 129 | |||
| 130 | while (1) { | ||
| 131 | - c = getopt_long (argc, argv, "hVvAt:H:s:r:a:w:c:", long_opts, &opt_index); | ||
| 132 | + c = getopt_long (argc, argv, "hVvAnt:H:s:r:a:q:w:c:", long_opts, &opt_index); | ||
| 133 | |||
| 134 | if (c == -1 || c == EOF) | ||
| 135 | break; | ||
| 136 | @@ -394,9 +411,18 @@ process_arguments (int argc, char **argv) | ||
| 137 | expected_address[expected_address_cnt] = strdup(optarg); | ||
| 138 | expected_address_cnt++; | ||
| 139 | break; | ||
| 140 | + case 'q': /* querytype -- A or AAAA or ANY or SRV or TXT, etc. */ | ||
| 141 | + if (strlen (optarg) < 1 || strlen (optarg) > 4) | ||
| 142 | + die (STATE_UNKNOWN, _("Missing valid querytype parameter. Try using 'A' or 'AAAA' or 'SRV'\n")); | ||
| 143 | + strcpy(query_type, "-querytype="); | ||
| 144 | + strcat(query_type, optarg); | ||
| 145 | + break; | ||
| 146 | case 'A': /* expect authority */ | ||
| 147 | expect_authority = TRUE; | ||
| 148 | break; | ||
| 149 | + case 'n': /* accept cname responses as a result */ | ||
| 150 | + accept_cname = TRUE; | ||
| 151 | + break; | ||
| 152 | case 'w': | ||
| 153 | warning = optarg; | ||
| 154 | break; | ||
| 155 | @@ -462,13 +488,20 @@ print_help (void) | ||
| 156 | printf (" %s\n", _("The name or address you want to query")); | ||
| 157 | printf (" -s, --server=HOST\n"); | ||
| 158 | printf (" %s\n", _("Optional DNS server you want to use for the lookup")); | ||
| 159 | + printf (" -q, --querytype=TYPE\n"); | ||
| 160 | + printf (" %s\n", _("Optional DNS record query type where TYPE =(A, AAAA, SRV, TXT, MX, ANY)")); | ||
| 161 | + printf (" %s\n", _("The default query type is 'A' (IPv4 host entry)")); | ||
| 162 | printf (" -a, --expected-address=IP-ADDRESS|HOST\n"); | ||
| 163 | printf (" %s\n", _("Optional IP-ADDRESS you expect the DNS server to return. HOST must end with")); | ||
| 164 | printf (" %s\n", _("a dot (.). This option can be repeated multiple times (Returns OK if any")); | ||
| 165 | printf (" %s\n", _("value match). If multiple addresses are returned at once, you have to match")); | ||
| 166 | printf (" %s\n", _("the whole string of addresses separated with commas (sorted alphabetically).")); | ||
| 167 | + printf (" %s\n", _("If you would like to test for the presence of a cname, combine with -n param.")); | ||
| 168 | printf (" -A, --expect-authority\n"); | ||
| 169 | printf (" %s\n", _("Optionally expect the DNS server to be authoritative for the lookup")); | ||
| 170 | + printf (" -n, --accept-cname\n"); | ||
| 171 | + printf (" %s\n", _("Optionally accept cname responses as a valid result to a query")); | ||
| 172 | + printf (" %s\n", _("The default is to ignore cname responses as part of the result")); | ||
| 173 | printf (" -w, --warning=seconds\n"); | ||
| 174 | printf (" %s\n", _("Return warning if elapsed time exceeds value. Default off")); | ||
| 175 | printf (" -c, --critical=seconds\n"); | ||
| 176 | @@ -490,5 +523,5 @@ void | ||
| 177 | print_usage (void) | ||
| 178 | { | ||
| 179 | printf (_("Usage:")); | ||
| 180 | - printf ("%s -H host [-s server] [-a expected-address] [-A] [-t timeout] [-w warn] [-c crit]\n", progname); | ||
| 181 | + printf ("%s -H host [-s server] [-q type ] [-a expected-address] [-A] [-n] [-t timeout] [-w warn] [-c crit]\n", progname); | ||
| 182 | } | ||
diff --git a/web/attachments/325264-nagios-plugins-1.4.13.check_disks.nfs.patch b/web/attachments/325264-nagios-plugins-1.4.13.check_disks.nfs.patch new file mode 100644 index 0000000..1e4e0fa --- /dev/null +++ b/web/attachments/325264-nagios-plugins-1.4.13.check_disks.nfs.patch | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | diff -Naur nagios-plugins-1.4.13/configure.in nagios-plugins-1.4.13.nfs/configure.in | ||
| 2 | --- nagios-plugins-1.4.13/configure.in 2008-09-25 10:15:58.000000000 +0200 | ||
| 3 | +++ nagios-plugins-1.4.13.nfs/configure.in 2009-05-01 11:33:59.000000000 +0200 | ||
| 4 | @@ -453,6 +453,18 @@ | ||
| 5 | with_gnutls="no" | ||
| 6 | fi | ||
| 7 | |||
| 8 | +dnl Check for POSIX thread libraries | ||
| 9 | +AC_CHECK_HEADERS(pthread.h) | ||
| 10 | +case $host in | ||
| 11 | + *sun* | *solaris*) | ||
| 12 | + AC_CHECK_LIB(pthread,pthread_create,THRLIBS="-lpthread -lrt") | ||
| 13 | + ;; | ||
| 14 | + *) | ||
| 15 | + AC_CHECK_LIB(pthread,pthread_create,THRLIBS="-lpthread") | ||
| 16 | + ;; | ||
| 17 | +esac | ||
| 18 | +AC_SUBST(THRLIBS) | ||
| 19 | + | ||
| 20 | dnl | ||
| 21 | dnl Checks for header files. | ||
| 22 | dnl | ||
| 23 | diff -Naur nagios-plugins-1.4.13/plugins/check_disk.c nagios-plugins-1.4.13.nfs/plugins/check_disk.c | ||
| 24 | --- nagios-plugins-1.4.13/plugins/check_disk.c 2008-07-10 12:03:55.000000000 +0200 | ||
| 25 | +++ nagios-plugins-1.4.13.nfs/plugins/check_disk.c 2009-05-01 11:34:18.000000000 +0200 | ||
| 26 | @@ -55,6 +55,9 @@ | ||
| 27 | # include <limits.h> | ||
| 28 | #endif | ||
| 29 | #include "regex.h" | ||
| 30 | +#if HAVE_PTHREAD_H | ||
| 31 | +# include <pthread.h> | ||
| 32 | +#endif | ||
| 33 | |||
| 34 | |||
| 35 | /* If nonzero, show inode information. */ | ||
| 36 | @@ -129,6 +132,7 @@ | ||
| 37 | void print_usage (void); | ||
| 38 | double calculate_percent(uintmax_t, uintmax_t); | ||
| 39 | void stat_path (struct parameter_list *p); | ||
| 40 | +void do_stat_path (struct parameter_list *p); | ||
| 41 | |||
| 42 | double w_dfp = -1.0; | ||
| 43 | double c_dfp = -1.0; | ||
| 44 | @@ -993,6 +997,42 @@ | ||
| 45 | void | ||
| 46 | stat_path (struct parameter_list *p) | ||
| 47 | { | ||
| 48 | +#ifdef HAVE_PTHREAD_H | ||
| 49 | + pthread_t stat_thread; | ||
| 50 | + int status; | ||
| 51 | + int statdone = 0; | ||
| 52 | + int timer = timeout_interval; | ||
| 53 | + struct timespec req, rem; | ||
| 54 | + req.tv_sec = 0; | ||
| 55 | + pthread_create(&stat_thread, NULL, do_stat_path, p); | ||
| 56 | + while (timer-- > 0) { | ||
| 57 | + req.tv_nsec = 10000000; | ||
| 58 | + nanosleep(&req, &rem); | ||
| 59 | + if (pthread_kill(stat_thread, 0)) { | ||
| 60 | + statdone = 1; | ||
| 61 | + break; | ||
| 62 | + } else { | ||
| 63 | + req.tv_nsec = 990000000; | ||
| 64 | + nanosleep(&req, &rem); | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + if (statdone == 1) { | ||
| 68 | + pthread_join(stat_thread, (void *)&status); | ||
| 69 | + } else { | ||
| 70 | + pthread_detach(stat_thread); | ||
| 71 | + if (verbose >= 3) | ||
| 72 | + printf("stat did not return within %ds on %s\n", timeout_interval, p->name); | ||
| 73 | + printf("DISK %s - ", _("CRITICAL")); | ||
| 74 | + die (STATE_CRITICAL, _("%s %s: %s\n"), p->name, _("hangs"), _("Timeout")); | ||
| 75 | + } | ||
| 76 | +#else | ||
| 77 | + do_stat_path(p); | ||
| 78 | +#endif | ||
| 79 | +} | ||
| 80 | + | ||
| 81 | +void | ||
| 82 | +do_stat_path (struct parameter_list *p) | ||
| 83 | +{ | ||
| 84 | /* Stat entry to check that dir exists and is accessible */ | ||
| 85 | if (verbose >= 3) | ||
| 86 | printf("calling stat on %s\n", p->name); | ||
| 87 | diff -Naur nagios-plugins-1.4.13/plugins/Makefile.am nagios-plugins-1.4.13.nfs/plugins/Makefile.am | ||
| 88 | --- nagios-plugins-1.4.13/plugins/Makefile.am 2008-07-08 11:31:04.000000000 +0200 | ||
| 89 | +++ nagios-plugins-1.4.13.nfs/plugins/Makefile.am 2009-05-01 11:34:26.000000000 +0200 | ||
| 90 | @@ -54,7 +54,7 @@ | ||
| 91 | check_apt_LDADD = $(BASEOBJS) runcmd.o | ||
| 92 | check_cluster_LDADD = $(BASEOBJS) | ||
| 93 | check_dig_LDADD = $(NETLIBS) runcmd.o | ||
| 94 | -check_disk_LDADD = $(BASEOBJS) popen.o | ||
| 95 | +check_disk_LDADD = $(BASEOBJS) popen.o $(THRLIBS) | ||
| 96 | check_dns_LDADD = $(NETLIBS) runcmd.o | ||
| 97 | check_dummy_LDADD = $(BASEOBJS) | ||
| 98 | check_fping_LDADD = $(NETLIBS) popen.o | ||
diff --git a/web/attachments/32558-check_dns.c.patch b/web/attachments/32558-check_dns.c.patch new file mode 100644 index 0000000..3a03290 --- /dev/null +++ b/web/attachments/32558-check_dns.c.patch | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | Index: plugins/check_dns.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_dns.c,v | ||
| 4 | retrieving revision 1.2 | ||
| 5 | diff -u -b -r1.2 check_dns.c | ||
| 6 | --- plugins/check_dns.c 19 Jun 2002 05:11:52 -0000 1.2 | ||
| 7 | +++ plugins/check_dns.c 7 Oct 2002 17:33:58 -0000 | ||
| 8 | @@ -10,8 +10,9 @@ | ||
| 9 | * | ||
| 10 | * Notes: | ||
| 11 | * - Safe popen added by Karl DeBisschop 9-11-99 | ||
| 12 | + * - expected-address parameter added by Alex Chaffee - 7 Oct 2002 | ||
| 13 | * | ||
| 14 | - * Command line: CHECK_DNS <query_address> [dns_server] | ||
| 15 | + * Command line: (see print_usage) | ||
| 16 | * | ||
| 17 | * Description: | ||
| 18 | * | ||
| 19 | @@ -59,6 +60,8 @@ | ||
| 20 | char dns_server[ADDRESS_LENGTH] = ""; | ||
| 21 | char ptr_server[ADDRESS_LENGTH] = ""; | ||
| 22 | int verbose = FALSE; | ||
| 23 | +char expected_address[ADDRESS_LENGTH] = ""; | ||
| 24 | +int match_expected_address = FALSE; | ||
| 25 | |||
| 26 | int | ||
| 27 | main (int argc, char **argv) | ||
| 28 | @@ -165,6 +168,12 @@ | ||
| 29 | output = strscpy (output, "nslookup returned error status"); | ||
| 30 | } | ||
| 31 | |||
| 32 | + /* compare to expected address */ | ||
| 33 | + if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) { | ||
| 34 | + result = STATE_CRITICAL; | ||
| 35 | + output = ssprintf(output, "expected %s but got %s", expected_address, address); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | (void) time (&end_time); | ||
| 39 | |||
| 40 | if (result == STATE_OK) | ||
| 41 | @@ -297,6 +306,7 @@ | ||
| 42 | {"hostname", required_argument, 0, 'H'}, | ||
| 43 | {"server", required_argument, 0, 's'}, | ||
| 44 | {"reverse-server", required_argument, 0, 'r'}, | ||
| 45 | + {"expected-address", required_argument, 0, 'a'}, | ||
| 46 | {0, 0, 0, 0} | ||
| 47 | }; | ||
| 48 | #endif | ||
| 49 | @@ -304,9 +314,9 @@ | ||
| 50 | |||
| 51 | while (1) { | ||
| 52 | #ifdef HAVE_GETOPT_H | ||
| 53 | - c = getopt_long (argc, argv, "+?hVvt:H:s:r:", long_opts, &opt_index); | ||
| 54 | + c = getopt_long (argc, argv, "+?hVvt:H:s:r:a:", long_opts, &opt_index); | ||
| 55 | #else | ||
| 56 | - c = getopt (argc, argv, "+?hVvt:H:s:r:"); | ||
| 57 | + c = getopt (argc, argv, "+?hVvt:H:s:r:a:"); | ||
| 58 | #endif | ||
| 59 | |||
| 60 | if (c == -1 || c == EOF) | ||
| 61 | @@ -318,6 +328,7 @@ | ||
| 62 | case 'H': | ||
| 63 | case 's': | ||
| 64 | case 'r': | ||
| 65 | + case 'a': | ||
| 66 | i++; | ||
| 67 | } | ||
| 68 | |||
| 69 | @@ -368,6 +379,17 @@ | ||
| 70 | terminate (STATE_UNKNOWN, "Input buffer overflow\n"); | ||
| 71 | strcpy (ptr_server, optarg); | ||
| 72 | break; | ||
| 73 | + case 'a': /* expected address */ | ||
| 74 | + if (is_host (optarg) == FALSE) { | ||
| 75 | + printf ("Invalid expected address\n\n"); | ||
| 76 | + print_usage (my_basename (argv[0])); | ||
| 77 | + exit (STATE_UNKNOWN); | ||
| 78 | + } | ||
| 79 | + if (strlen (optarg) >= ADDRESS_LENGTH) | ||
| 80 | + terminate (STATE_UNKNOWN, "Input buffer overflow\n"); | ||
| 81 | + strcpy (expected_address, optarg); | ||
| 82 | + match_expected_address = TRUE; | ||
| 83 | + break; | ||
| 84 | } | ||
| 85 | } | ||
| 86 | return i; | ||
| 87 | @@ -385,7 +407,7 @@ | ||
| 88 | void | ||
| 89 | print_usage (char *cmd) | ||
| 90 | { | ||
| 91 | - printf ("Usage: %s -H host [-s server] [-t timeout]\n" " %s --help\n" | ||
| 92 | + printf ("Usage: %s -H host [-s server] [-a expected-address] [-t timeout]\n" " %s --help\n" | ||
| 93 | " %s --version\n", cmd, cmd, cmd); | ||
| 94 | } | ||
| 95 | |||
| 96 | @@ -401,6 +423,8 @@ | ||
| 97 | " The name or address you want to query\n" | ||
| 98 | "-s, --server=HOST\n" | ||
| 99 | " Optional DNS server you want to use for the lookup\n" | ||
| 100 | + "-a, --expected-address=IP-ADDRESS\n" | ||
| 101 | + " Optional IP address you expect the DNS server to return\n" | ||
| 102 | "-t, --timeout=INTEGER\n" | ||
| 103 | " Seconds before connection times out (default: %d)\n" | ||
| 104 | "-h, --help\n" | ||
diff --git a/web/attachments/327688-check_procs.c.patch b/web/attachments/327688-check_procs.c.patch new file mode 100644 index 0000000..2c262f7 --- /dev/null +++ b/web/attachments/327688-check_procs.c.patch | |||
| @@ -0,0 +1,796 @@ | |||
| 1 | --- check_procs.c 2009-02-21 09:59:24.000000000 +0000 | ||
| 2 | +++ check_procs.c.new 2009-05-19 10:41:14.000000000 +0000 | ||
| 3 | @@ -27,7 +27,8 @@ | ||
| 4 | * | ||
| 5 | * You should have received a copy of the GNU General Public License | ||
| 6 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 7 | -* | ||
| 8 | +* | ||
| 9 | +* State file stuff originally by: Alain Williams <addw@phcomp.co.uk> | ||
| 10 | * | ||
| 11 | *****************************************************************************/ | ||
| 12 | |||
| 13 | @@ -42,13 +43,7 @@ | ||
| 14 | #include "regex.h" | ||
| 15 | |||
| 16 | #include <pwd.h> | ||
| 17 | - | ||
| 18 | -int process_arguments (int, char **); | ||
| 19 | -int validate_arguments (void); | ||
| 20 | -int check_thresholds (int); | ||
| 21 | -int convert_to_seconds (char *); | ||
| 22 | -void print_help (void); | ||
| 23 | -void print_usage (void); | ||
| 24 | +#include <time.h> | ||
| 25 | |||
| 26 | int wmax = -1; | ||
| 27 | int cmax = -1; | ||
| 28 | @@ -77,6 +72,7 @@ | ||
| 29 | METRIC_ELAPSED | ||
| 30 | }; | ||
| 31 | enum metric metric = METRIC_PROCS; | ||
| 32 | +char metric_state_name = 'P'; /* Metric name in the state file */ | ||
| 33 | |||
| 34 | int verbose = 0; | ||
| 35 | int uid; | ||
| 36 | @@ -92,9 +88,98 @@ | ||
| 37 | char *fmt; | ||
| 38 | char *fails; | ||
| 39 | char tmp[MAX_INPUT_BUFFER]; | ||
| 40 | +time_t now; | ||
| 41 | +time_t state_limit_start; | ||
| 42 | |||
| 43 | FILE *ps_input = NULL; | ||
| 44 | |||
| 45 | +/* Optionally trigger an alert if a process has been in a state for | ||
| 46 | + * some time. This time will be measured in minutes, ie much longer than | ||
| 47 | + * this program runs for - thus a state file is needed to store this | ||
| 48 | + * between runs of this program. | ||
| 49 | + * This happens if --state-file is specified. | ||
| 50 | + * | ||
| 51 | + * The state file records information about processes that exceed some criteria | ||
| 52 | + * for a warning or critical notice. | ||
| 53 | + * The file will contain one 'V' line. | ||
| 54 | + * If the metric is PROCS there will be one N line, else zero or more P lines. | ||
| 55 | + * Format of the state file: | ||
| 56 | + * Max line length of 500 | ||
| 57 | + * Empty lines and lines starting '#' are ignored | ||
| 58 | + * Lines consist of a type character, a space and optional extra information | ||
| 59 | + * V version_number | ||
| 60 | + * P pid ppid name MS secs | ||
| 61 | + * name is limited to a max 20 characters | ||
| 62 | + * M is the metric: | ||
| 63 | + * V virtual memory size | ||
| 64 | + * R resident set memory size | ||
| 65 | + * C percentage CPU | ||
| 66 | + * E time elapsed in seconds | ||
| 67 | + * S is the state: | ||
| 68 | + * W Warning | ||
| 69 | + * C Critical | ||
| 70 | + * N MS secs | ||
| 71 | + * M will be 'P' | ||
| 72 | + * S is the state as above | ||
| 73 | + * secs is the epoch time the metric was first exceeded - hex number | ||
| 74 | + * The 'MS secs' or 'S secs' may appear twice as it is possible for a process (or the | ||
| 75 | + * max # processes) to exceed both the warning and critical thresholds but for different times. | ||
| 76 | + * If something is C then it is implicitly W. | ||
| 77 | + * | ||
| 78 | + * There might be a trailing space on a N line. | ||
| 79 | + * | ||
| 80 | + * Eg: | ||
| 81 | + * P 1234 1200 cpu_hog CW 4a05a817 CC 4a05a91f | ||
| 82 | + * N PW 4a05a91f | ||
| 83 | + */ | ||
| 84 | +#define STATE_VERSION 1 /* Change me if the file format changes */ | ||
| 85 | +#define STATE_MAX_LINE 500 /* Longest line */ | ||
| 86 | +#define MAX_PROG_NAME 20 /* Longest name of program - search for this if you change it */ | ||
| 87 | +#define METRIC_CODES "PVRCE" /* For input validation */ | ||
| 88 | +#define STATE_CODES "WC" /* For input validation */ | ||
| 89 | +#define STATE2state(x) ((x) == STATE_WARNING ? 'W' : 'C') /* Convert STATE_WARNING or STATE_CRITICAL to 'W' or 'C' */ | ||
| 90 | + | ||
| 91 | +/* A process can exceed various limits. This describes on of them | ||
| 92 | + */ | ||
| 93 | +typedef struct plimit { | ||
| 94 | + struct plimit* pl_next; /* NULL terminated list */ | ||
| 95 | + time_t pl_when; /* When it first exceeded this limit */ | ||
| 96 | + int pl_state; /* STATE_WARNING or STATE_CRITICAL */ | ||
| 97 | + int pl_seen; /* Exceeded this run */ | ||
| 98 | + char pl_metric; /* What is exceeded - as in file */ | ||
| 99 | +} PLimit; | ||
| 100 | + | ||
| 101 | +/* Something to describe a process that is exceeding something | ||
| 102 | + */ | ||
| 103 | +typedef struct exproc { | ||
| 104 | + struct exproc* ep_next; /* NULL terminated list */ | ||
| 105 | + pid_t ep_pid; /* Process ID */ | ||
| 106 | + pid_t ep_ppid; /* Parent PID */ | ||
| 107 | + char* ep_prog; /* Program name */ | ||
| 108 | + PLimit* ep_limits; /* Limits exceeded list */ | ||
| 109 | + int ep_seen; /* Updated/noticed this run */ | ||
| 110 | +} ExProc; | ||
| 111 | + | ||
| 112 | +char* state_filename; /* File that we store this in */ | ||
| 113 | +int state_time = 5; /* Trigger time - minutes */ | ||
| 114 | +ExProc* state_list; /* Used for process specific metrics - ie metric is *not* PROCS */ | ||
| 115 | +PLimit* state_nprocs; /* Info on # procs exceeded - used if metric is PROCS */ | ||
| 116 | +int state_changed; /* Ie need to write back to file */ | ||
| 117 | +int must_rewrite; /* Set this if there is a syntax error in the file, or | ||
| 118 | + * some other reason which means we must rewrite it */ | ||
| 119 | + | ||
| 120 | +int process_arguments (int, char **); | ||
| 121 | +int validate_arguments (void); | ||
| 122 | +int check_thresholds (int); | ||
| 123 | +int convert_to_seconds (char *); | ||
| 124 | +void print_help (void); | ||
| 125 | +void print_usage (void); | ||
| 126 | +void read_state_file(void); | ||
| 127 | +void write_state_file(char** argv); | ||
| 128 | +void record_state(pid_t procpid, pid_t procppid, char* procprog, char prog_metric, int state, time_t start_time); | ||
| 129 | +void record_limit(PLimit** l_ref, int state, char proc_metric, time_t start_time); | ||
| 130 | +void read_limit_line(const char* in_line, PLimit** ppl, char* state_filename, int line_no); | ||
| 131 | +int check_limit(PLimit* pl); | ||
| 132 | |||
| 133 | int | ||
| 134 | main (int argc, char **argv) | ||
| 135 | @@ -129,13 +214,16 @@ | ||
| 136 | int result = STATE_UNKNOWN; | ||
| 137 | output chld_out, chld_err; | ||
| 138 | |||
| 139 | + now = time(NULL); | ||
| 140 | + | ||
| 141 | setlocale (LC_ALL, ""); | ||
| 142 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 143 | textdomain (PACKAGE); | ||
| 144 | setlocale(LC_NUMERIC, "POSIX"); | ||
| 145 | |||
| 146 | - input_buffer = malloc (MAX_INPUT_BUFFER); | ||
| 147 | - procprog = malloc (MAX_INPUT_BUFFER); | ||
| 148 | + if( ! (input_buffer = malloc (MAX_INPUT_BUFFER)) || | ||
| 149 | + ! (procprog = malloc (MAX_INPUT_BUFFER))) | ||
| 150 | + die(STATE_UNKNOWN, _("Out of memory in startup\n")); | ||
| 151 | |||
| 152 | asprintf (&metric_name, "PROCS"); | ||
| 153 | metric = METRIC_PROCS; | ||
| 154 | @@ -168,6 +256,9 @@ | ||
| 155 | result = cmd_file_read( input_filename, &chld_out, 0); | ||
| 156 | } | ||
| 157 | |||
| 158 | + /* What do we remember from last time ? */ | ||
| 159 | + read_state_file(); | ||
| 160 | + | ||
| 161 | /* flush first line: j starts at 1 */ | ||
| 162 | for (j = 1; j < chld_out.lines; j++) { | ||
| 163 | input_line = chld_out.line[j]; | ||
| 164 | @@ -237,6 +328,10 @@ | ||
| 165 | procetime, procprog, procargs); | ||
| 166 | } | ||
| 167 | |||
| 168 | + /* This is all made simpler because metric can only talk about | ||
| 169 | + * one metric, ie can't check more than one thing at a time. | ||
| 170 | + * This means that metric_state_name is the char equivalent of metric. | ||
| 171 | + */ | ||
| 172 | if (metric == METRIC_VSZ) | ||
| 173 | i = check_thresholds (procvsz); | ||
| 174 | else if (metric == METRIC_RSS) | ||
| 175 | @@ -248,15 +343,29 @@ | ||
| 176 | i = check_thresholds (procseconds); | ||
| 177 | |||
| 178 | if (metric != METRIC_PROCS) { | ||
| 179 | - if (i == STATE_WARNING) { | ||
| 180 | - warn++; | ||
| 181 | - asprintf (&fails, "%s%s%s", fails, (strcmp(fails,"") ? ", " : ""), procprog); | ||
| 182 | - result = max_state (result, i); | ||
| 183 | - } | ||
| 184 | - if (i == STATE_CRITICAL) { | ||
| 185 | - crit++; | ||
| 186 | - asprintf (&fails, "%s%s%s", fails, (strcmp(fails,"") ? ", " : ""), procprog); | ||
| 187 | - result = max_state (result, i); | ||
| 188 | + if(state_filename) { | ||
| 189 | + /* State is being stored - ie don't report immediately. | ||
| 190 | + * Note what we have found: | ||
| 191 | + */ | ||
| 192 | + if(i == STATE_WARNING || i == STATE_CRITICAL) | ||
| 193 | + record_state(procpid, procppid, procprog, metric_state_name, i, now); | ||
| 194 | + } else { | ||
| 195 | + if (i == STATE_WARNING) { | ||
| 196 | + char* str = fails; | ||
| 197 | + warn++; | ||
| 198 | + asprintf (&fails, "%s%s%s", fails, (strcmp(fails,"") ? ", " : ""), procprog); | ||
| 199 | + result = max_state (result, i); | ||
| 200 | + if(str) | ||
| 201 | + free(str); | ||
| 202 | + } | ||
| 203 | + if (i == STATE_CRITICAL) { | ||
| 204 | + char* str = fails; | ||
| 205 | + crit++; | ||
| 206 | + asprintf (&fails, "%s%s%s", fails, (strcmp(fails,"") ? ", " : ""), procprog); | ||
| 207 | + result = max_state (result, i); | ||
| 208 | + if(str) | ||
| 209 | + free(str); | ||
| 210 | + } | ||
| 211 | } | ||
| 212 | } | ||
| 213 | } | ||
| 214 | @@ -276,7 +385,59 @@ | ||
| 215 | |||
| 216 | /* Needed if procs found, but none match filter */ | ||
| 217 | if ( metric == METRIC_PROCS ) { | ||
| 218 | - result = max_state (result, check_thresholds (procs) ); | ||
| 219 | + int threshold = check_thresholds(procs); | ||
| 220 | + int putative_result = max_state(result, threshold); | ||
| 221 | + | ||
| 222 | + if(state_filename) { /* Do not report immediately - note what we found */ | ||
| 223 | + /* Only record something if we may need to report it */ | ||
| 224 | + if(putative_result == STATE_WARNING || putative_result == STATE_CRITICAL) | ||
| 225 | + record_limit(&state_nprocs, putative_result, 'P', now); | ||
| 226 | + } else | ||
| 227 | + result = putative_result; | ||
| 228 | + } | ||
| 229 | + | ||
| 230 | + /* If we have a state file, the above has just stored the results away, so have | ||
| 231 | + * a look and see if there is anything that we should note. | ||
| 232 | + * The slight subtlety is that we could have something recorded as both a warning | ||
| 233 | + * & a critical - in this case only report the critical. | ||
| 234 | + */ | ||
| 235 | + if(state_filename) { | ||
| 236 | + /* Compute the start time of any state that we must report. | ||
| 237 | + * Ie any state younger than this we keep quiet about. | ||
| 238 | + */ | ||
| 239 | + state_limit_start = (time_t)((unsigned long)now - state_time * 60); | ||
| 240 | + | ||
| 241 | + if(verbose >= 3) | ||
| 242 | + printf("Checking metric %c, limit_start %s", metric_state_name, ctime(&state_limit_start)); | ||
| 243 | + | ||
| 244 | + if(metric == METRIC_PROCS) { | ||
| 245 | + result = check_limit(state_nprocs); | ||
| 246 | + } else { | ||
| 247 | + ExProc* pp; | ||
| 248 | + | ||
| 249 | + for(pp = state_list; pp; pp = pp->ep_next) { | ||
| 250 | + char* str = fails; | ||
| 251 | + | ||
| 252 | + /* What is the state of this recorded process ? */ | ||
| 253 | + int res = check_limit(pp->ep_limits); | ||
| 254 | + | ||
| 255 | + switch(res) { | ||
| 256 | + case STATE_OK: | ||
| 257 | + continue; /* Don't do the stuff below */ | ||
| 258 | + case STATE_WARNING: | ||
| 259 | + warn++; | ||
| 260 | + break; | ||
| 261 | + case STATE_CRITICAL: | ||
| 262 | + crit++; | ||
| 263 | + break; | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + asprintf (&fails, "%s%s%s", fails, (strcmp(fails,"") ? ", " : ""), pp->ep_prog); | ||
| 267 | + result = max_state(result, res); | ||
| 268 | + if(str) | ||
| 269 | + free(str); | ||
| 270 | + } | ||
| 271 | + } | ||
| 272 | } | ||
| 273 | |||
| 274 | if ( result == STATE_OK ) { | ||
| 275 | @@ -302,6 +463,9 @@ | ||
| 276 | printf (" [%s]", fails); | ||
| 277 | |||
| 278 | printf ("\n"); | ||
| 279 | + | ||
| 280 | + write_state_file(argv); | ||
| 281 | + | ||
| 282 | return result; | ||
| 283 | } | ||
| 284 | |||
| 285 | @@ -336,6 +500,8 @@ | ||
| 286 | {"verbose", no_argument, 0, 'v'}, | ||
| 287 | {"ereg-argument-array", required_argument, 0, CHAR_MAX+1}, | ||
| 288 | {"input-file", required_argument, 0, CHAR_MAX+2}, | ||
| 289 | + {"state-file", required_argument, 0, 'S'}, | ||
| 290 | + {"state-time", required_argument, 0, 'T'}, | ||
| 291 | {0, 0, 0, 0} | ||
| 292 | }; | ||
| 293 | |||
| 294 | @@ -344,7 +510,7 @@ | ||
| 295 | strcpy (argv[c], "-t"); | ||
| 296 | |||
| 297 | while (1) { | ||
| 298 | - c = getopt_long (argc, argv, "Vvht:c:w:p:s:u:C:a:z:r:m:P:", | ||
| 299 | + c = getopt_long (argc, argv, "Vvht:c:w:p:s:u:C:a:z:r:m:P:S:T:", | ||
| 300 | longopts, &option); | ||
| 301 | |||
| 302 | if (c == -1 || c == EOF) | ||
| 303 | @@ -479,22 +645,27 @@ | ||
| 304 | asprintf (&metric_name, "%s", optarg); | ||
| 305 | if ( strcmp(optarg, "PROCS") == 0) { | ||
| 306 | metric = METRIC_PROCS; | ||
| 307 | + metric_state_name = 'P'; | ||
| 308 | break; | ||
| 309 | } | ||
| 310 | else if ( strcmp(optarg, "VSZ") == 0) { | ||
| 311 | metric = METRIC_VSZ; | ||
| 312 | + metric_state_name = 'V'; | ||
| 313 | break; | ||
| 314 | } | ||
| 315 | else if ( strcmp(optarg, "RSS") == 0 ) { | ||
| 316 | metric = METRIC_RSS; | ||
| 317 | + metric_state_name = 'R'; | ||
| 318 | break; | ||
| 319 | } | ||
| 320 | else if ( strcmp(optarg, "CPU") == 0 ) { | ||
| 321 | metric = METRIC_CPU; | ||
| 322 | + metric_state_name = 'C'; | ||
| 323 | break; | ||
| 324 | } | ||
| 325 | else if ( strcmp(optarg, "ELAPSED") == 0) { | ||
| 326 | metric = METRIC_ELAPSED; | ||
| 327 | + metric_state_name = 'E'; | ||
| 328 | break; | ||
| 329 | } | ||
| 330 | |||
| 331 | @@ -505,6 +676,16 @@ | ||
| 332 | case CHAR_MAX+2: | ||
| 333 | input_filename = optarg; | ||
| 334 | break; | ||
| 335 | + case 'S': /* state-file */ | ||
| 336 | + state_filename = optarg; | ||
| 337 | + break; | ||
| 338 | + case 'T': /* state-time */ | ||
| 339 | + if (!is_integer (optarg)) | ||
| 340 | + usage2 (_("state-time must be a positive integer"), optarg); | ||
| 341 | + else | ||
| 342 | + if((state_time = atoi (optarg)) < 0) /* Treat -ve time as zero */ | ||
| 343 | + state_time = 0; | ||
| 344 | + break; | ||
| 345 | } | ||
| 346 | } | ||
| 347 | |||
| 348 | @@ -727,6 +908,12 @@ | ||
| 349 | printf (" %s\n", "-C, --command=COMMAND"); | ||
| 350 | printf (" %s\n", _("Only scan for exact matches of COMMAND (without path).")); | ||
| 351 | |||
| 352 | + printf ("\n"); | ||
| 353 | + printf ( "%s\n", "State memory (complain if a process exceeds a limit for a long time):"); | ||
| 354 | + printf ( " %s\n", "-S, --state-file=StateFile"); | ||
| 355 | + printf ( " %s\n", _("Store process information in this file")); | ||
| 356 | + printf ( " %s\n", "-T, --state-time=minutes"); | ||
| 357 | + | ||
| 358 | printf(_("\n\ | ||
| 359 | RANGEs are specified 'min:max' or 'min:' or ':max' (or 'max'). If\n\ | ||
| 360 | specified 'max:min', a warning status will be generated if the\n\ | ||
| 361 | @@ -755,7 +942,9 @@ | ||
| 362 | printf (" %s\n", "check_procs -w 50000 -c 100000 --metric=VSZ"); | ||
| 363 | printf (" %s\n\n", _("Alert if VSZ of any processes over 50K or 100K")); | ||
| 364 | printf (" %s\n", "check_procs -w 10 -c 20 --metric=CPU"); | ||
| 365 | - printf (" %s\n", _("Alert if CPU of any processes over 10%% or 20%%")); | ||
| 366 | + printf (" %s\n\n", _("Alert if CPU of any processes over 10% or 20%")); | ||
| 367 | + printf (" %s\n", "check_procs -w 80 -c 90 --metric=CPU --state-time=10 --state-file=/tmp/CPU-state"); | ||
| 368 | + printf (" %s\n", _("Alert if CPU of any processes over 80% or 90% for at least 10 minutes, record state in /tmp/CPU-state")); | ||
| 369 | |||
| 370 | printf (_(UT_SUPPORT)); | ||
| 371 | } | ||
| 372 | @@ -766,5 +955,423 @@ | ||
| 373 | printf (_("Usage: ")); | ||
| 374 | printf ("%s -w <range> -c <range> [-m metric] [-s state] [-p ppid]\n", progname); | ||
| 375 | printf (" [-u user] [-r rss] [-z vsz] [-P %%cpu] [-a argument-array]\n"); | ||
| 376 | - printf (" [-C command] [-t timeout] [-v]\n"); | ||
| 377 | + printf (" [-C command] [-t timeout] [-v] [-S state_file] [-T state_time_minutes]\n"); | ||
| 378 | +} | ||
| 379 | + | ||
| 380 | +/* Read the state file - if there is one. | ||
| 381 | + * | ||
| 382 | + * This file is not locked. On a horribly over loaded system it might happen that reads & writes | ||
| 383 | + * could overlap in the wrong way. Locking could make things worse, you may end up with many | ||
| 384 | + * instances of this program waiting on the lock. | ||
| 385 | + */ | ||
| 386 | +void | ||
| 387 | +read_state_file(void) | ||
| 388 | +{ | ||
| 389 | + FILE* sf; | ||
| 390 | + char* errstr; | ||
| 391 | + char* str; | ||
| 392 | + char in_buf[STATE_MAX_LINE]; /* Input buffer */ | ||
| 393 | + int line_no = 0; | ||
| 394 | + char prog_name[MAX_PROG_NAME + 1]; | ||
| 395 | + int eaten; | ||
| 396 | + ExProc* pp; | ||
| 397 | + | ||
| 398 | + if( ! state_filename) /* No file specified */ | ||
| 399 | + return; | ||
| 400 | + | ||
| 401 | + if( ! (sf = fopen(state_filename, "r"))) { | ||
| 402 | + /* It is OK if it doesn't exist, we just haven't created it yet */ | ||
| 403 | + if(errno == ENOENT) { | ||
| 404 | + must_rewrite = 1; /* Force it to be created */ | ||
| 405 | + return; | ||
| 406 | + } | ||
| 407 | + | ||
| 408 | + /* Anything else - should not happen */ | ||
| 409 | + errstr = strerror(errno); | ||
| 410 | + die(STATE_UNKNOWN, _("Can't open %s for reading as: %s"), state_filename, errstr); | ||
| 411 | + } | ||
| 412 | + | ||
| 413 | + /* Read a line at a time */ | ||
| 414 | + while(fgets(in_buf, STATE_MAX_LINE, sf)) { | ||
| 415 | + line_no++; | ||
| 416 | + if( ! (str = strchr(in_buf, '\n'))) { | ||
| 417 | + printf(_("State file %s corrupt, line too long, at line %d\n"), state_filename, line_no); | ||
| 418 | + must_rewrite = 1; /* Force write */ | ||
| 419 | + goto read_off; /* Will be fixed when we rewrite it in a moment */ | ||
| 420 | + } | ||
| 421 | + *str = '\0'; | ||
| 422 | + | ||
| 423 | + /* Empty line or comment ? */ | ||
| 424 | + if(in_buf[0] == '\0' || in_buf[0] == '#') | ||
| 425 | + continue; | ||
| 426 | + | ||
| 427 | + if(in_buf[1] != ' ') { | ||
| 428 | + printf(_("State file %s corrupt, no space at position 1, at line %d\n"), state_filename, line_no); | ||
| 429 | + must_rewrite = 1; /* Force write */ | ||
| 430 | + goto read_off; | ||
| 431 | + } | ||
| 432 | + | ||
| 433 | + /* What line type ? */ | ||
| 434 | + switch(in_buf[0]) { | ||
| 435 | + case 'V': /* In case we are running 1st time after upgrade */ | ||
| 436 | + if(atoi(in_buf + 2) != STATE_VERSION) { | ||
| 437 | + printf(_("State file %s is wrong version, expecting %d. File ignored\n"), state_filename, STATE_VERSION); | ||
| 438 | + must_rewrite = 1; /* Force write */ | ||
| 439 | + goto read_off; | ||
| 440 | + } | ||
| 441 | + break; | ||
| 442 | + case 'P': /* Info about a process */ | ||
| 443 | + /* P 1234 1200 cpu_hog CW 4a05a817 CC 4a05a92f */ | ||
| 444 | + if( ! (pp = calloc(sizeof(ExProc), 1))) | ||
| 445 | + die(STATE_UNKNOWN, _("Out of memory reading %s line %d"), state_filename, line_no); | ||
| 446 | + | ||
| 447 | + pp->ep_next = state_list; | ||
| 448 | + state_list = pp; | ||
| 449 | + | ||
| 450 | + /* MAX_PROG_NAME on next line */ | ||
| 451 | + if(sscanf(in_buf, "P %d %d %20s%n", &pp->ep_pid, &pp->ep_ppid, prog_name, &eaten) != 3) { | ||
| 452 | + printf(_("State file corrupt, bad process line, file %s line %d\n"), state_filename, line_no); | ||
| 453 | + must_rewrite = 1; /* Force write */ | ||
| 454 | + goto read_off; | ||
| 455 | + } | ||
| 456 | + | ||
| 457 | + if( ! (pp->ep_prog = strdup(prog_name))) | ||
| 458 | + die(STATE_UNKNOWN, _("Out of memory reading %s line %d\n"), state_filename, line_no); | ||
| 459 | + | ||
| 460 | + if(verbose >= 3) | ||
| 461 | + printf("Read pid %d ppid %d proc %s\n", pp->ep_pid, pp->ep_ppid, pp->ep_prog); | ||
| 462 | + | ||
| 463 | + read_limit_line(in_buf + eaten, &pp->ep_limits, state_filename, line_no); | ||
| 464 | + break; | ||
| 465 | + case 'N': /* Number of procs exceeded */ | ||
| 466 | + if(verbose >= 3) | ||
| 467 | + printf("Read N:\n"); | ||
| 468 | + read_limit_line(in_buf + 1, &state_nprocs, state_filename, line_no); | ||
| 469 | + break; | ||
| 470 | + default: | ||
| 471 | + printf(_("State file %s corrupt, unknown line type, at line %d\n"), state_filename, line_no); | ||
| 472 | + must_rewrite = 1; /* Force write */ | ||
| 473 | + goto read_off; | ||
| 474 | + } | ||
| 475 | + } | ||
| 476 | + | ||
| 477 | + /* Ignore changes so far */ | ||
| 478 | +read_off: | ||
| 479 | + state_changed = 0; | ||
| 480 | + | ||
| 481 | + fclose(sf); | ||
| 482 | +} | ||
| 483 | + | ||
| 484 | +/* Read a line (or rest of) a process or global limit line. | ||
| 485 | + * Expect the first character of in_line to be NUL or a space. | ||
| 486 | + * Args: | ||
| 487 | + * in_line the line to read | ||
| 488 | + * ppl pointer to pointer to linked list where to store what is read | ||
| 489 | + * filename the name of the file being read | ||
| 490 | + * line_no that was read | ||
| 491 | + * | ||
| 492 | + * Read lines like: | ||
| 493 | + * PW 4a05a91f PC 4a05a817 | ||
| 494 | + */ | ||
| 495 | +void | ||
| 496 | +read_limit_line(const char* in_line, PLimit** ppl, char* state_filename, int line_no) | ||
| 497 | +{ | ||
| 498 | + PLimit* pl; | ||
| 499 | + unsigned long when; | ||
| 500 | + int eaten; | ||
| 501 | + | ||
| 502 | + while(*in_line) { | ||
| 503 | + if(*in_line == ' ') { /* Ignore spaces */ | ||
| 504 | + in_line++; | ||
| 505 | + continue; | ||
| 506 | + } | ||
| 507 | + | ||
| 508 | + /* We have found something, allocate somewhere to put it */ | ||
| 509 | + if( ! (pl = calloc(sizeof(PLimit), 1))) | ||
| 510 | + die(STATE_UNKNOWN, _("Out of memory reading %s line %d\n"), state_filename, line_no); | ||
| 511 | + | ||
| 512 | + /* Read a metric code */ | ||
| 513 | + if( ! strchr(METRIC_CODES, *in_line)) { | ||
| 514 | + printf(_("State file %s corrupt, unknown metric code, at line %d\n"), state_filename, line_no); | ||
| 515 | + must_rewrite = 1; | ||
| 516 | + free(pl); | ||
| 517 | + return; | ||
| 518 | + } | ||
| 519 | + pl->pl_metric = *in_line++; | ||
| 520 | + | ||
| 521 | + /* Read the state code */ | ||
| 522 | + if(*in_line == '\0' || ! strchr(STATE_CODES, *in_line)) { | ||
| 523 | + printf(_("State file %s corrupt, unknown state code, at line %d\n"), state_filename, line_no); | ||
| 524 | + must_rewrite = 1; | ||
| 525 | + free(pl); | ||
| 526 | + return; | ||
| 527 | + } | ||
| 528 | + pl->pl_state = *in_line++ == 'W' ? STATE_WARNING : STATE_CRITICAL; | ||
| 529 | + | ||
| 530 | + /* Read the time */ | ||
| 531 | + if(sscanf(in_line, " %lx%n", &when, &eaten) != 1) { | ||
| 532 | + printf(_("State file %s corrupt, bad time, at line %d\n"), state_filename, line_no); | ||
| 533 | + must_rewrite = 1; | ||
| 534 | + free(pl); | ||
| 535 | + return; | ||
| 536 | + } | ||
| 537 | + pl->pl_when = (time_t)when; | ||
| 538 | + in_line += eaten; | ||
| 539 | + | ||
| 540 | + if(verbose >= 3) | ||
| 541 | + printf(" metric=%c state=%c since %s", pl->pl_metric, STATE2state(pl->pl_state), ctime(&pl->pl_when)); | ||
| 542 | + | ||
| 543 | + /* Link it in */ | ||
| 544 | + pl->pl_next = *ppl; | ||
| 545 | + *ppl = pl; | ||
| 546 | + } | ||
| 547 | + | ||
| 548 | + if(verbose >= 3) | ||
| 549 | + printf("\n"); | ||
| 550 | +} | ||
| 551 | + | ||
| 552 | +/* Write back to the state file | ||
| 553 | + */ | ||
| 554 | +void | ||
| 555 | +write_state_file(char** argv) | ||
| 556 | +{ | ||
| 557 | + FILE* sf; | ||
| 558 | + char* errstr; | ||
| 559 | + ExProc* pp; | ||
| 560 | + PLimit* pl; | ||
| 561 | + | ||
| 562 | + if( ! state_filename) /* No file specified */ | ||
| 563 | + return; | ||
| 564 | + | ||
| 565 | + /* Work out if we are going to write back what we read in. | ||
| 566 | + * If there is something that has not been seen then it was read in | ||
| 567 | + * from the file - need to write back to loose the entry, scan for that. | ||
| 568 | + * Otherwise: state_changed will tell us what we want to know and was set | ||
| 569 | + * when a change was made. | ||
| 570 | + */ | ||
| 571 | + if(metric == METRIC_PROCS) { | ||
| 572 | + for(pl = state_nprocs; pl; pl = pl->pl_next) | ||
| 573 | + if( ! pl->pl_seen) | ||
| 574 | + state_changed = 1; | ||
| 575 | + } else { | ||
| 576 | + for(pp = state_list; pp; pp = pp->ep_next) { | ||
| 577 | + if( ! pp->ep_seen) | ||
| 578 | + state_changed = 1; | ||
| 579 | + | ||
| 580 | + for(pl = pp->ep_limits; pl; pl = pl->pl_next) | ||
| 581 | + if( ! pl->pl_seen) | ||
| 582 | + state_changed = 1; | ||
| 583 | + } | ||
| 584 | + } | ||
| 585 | + | ||
| 586 | + if(verbose >= 3) | ||
| 587 | + printf("Write state, changed=%d\n", state_changed); | ||
| 588 | + | ||
| 589 | + /* No change to the state file ? */ | ||
| 590 | + if( ! state_changed && ! must_rewrite) | ||
| 591 | + return; | ||
| 592 | + | ||
| 593 | + if( ! (sf = fopen(state_filename, "w"))) { | ||
| 594 | + errstr = strerror(errno); | ||
| 595 | + die(STATE_UNKNOWN, _("Can't open %s for writing as: %s"), state_filename, errstr); | ||
| 596 | + } | ||
| 597 | + | ||
| 598 | + fprintf(sf, "# Process state file written by %s - DO NOT HAND EDIT\n", progname); | ||
| 599 | + fprintf(sf, "# Args:"); | ||
| 600 | + for(; *argv; argv++) | ||
| 601 | + fprintf(sf, " %s", *argv); | ||
| 602 | + fprintf(sf, "\n"); | ||
| 603 | + fprintf(sf, "V %d\n", STATE_VERSION); | ||
| 604 | + | ||
| 605 | + if(metric != METRIC_PROCS) { | ||
| 606 | + /* Traverse the processes that we know about */ | ||
| 607 | + for(pp = state_list; pp; pp = pp->ep_next) { | ||
| 608 | + if( ! pp->ep_seen) | ||
| 609 | + continue; | ||
| 610 | + | ||
| 611 | + fprintf(sf, "P %d %d %.*s", pp->ep_pid, pp->ep_ppid, MAX_PROG_NAME, pp->ep_prog); | ||
| 612 | + for(pl = pp->ep_limits; pl; pl = pl->pl_next) | ||
| 613 | + if(pl->pl_seen) | ||
| 614 | + fprintf(sf, " %c%c %lx", pl->pl_metric, STATE2state(pl->pl_state), (unsigned long)pl->pl_when); | ||
| 615 | + | ||
| 616 | + fprintf(sf, "\n"); | ||
| 617 | + } | ||
| 618 | + } else { | ||
| 619 | + /* Print when the # processes is what is being checked */ | ||
| 620 | + fprintf(sf, "N"); | ||
| 621 | + for(pl = state_nprocs; pl; pl = pl->pl_next) | ||
| 622 | + if(pl->pl_seen) | ||
| 623 | + fprintf(sf, " %c%c %lx", pl->pl_metric, STATE2state(pl->pl_state), (unsigned long)pl->pl_when); | ||
| 624 | + | ||
| 625 | + /* Space before \n is important - else get error on read if no limits follow -- which | ||
| 626 | + * will happen if all is well. | ||
| 627 | + */ | ||
| 628 | + fprintf(sf, " \n"); | ||
| 629 | + } | ||
| 630 | + | ||
| 631 | + fclose(sf); | ||
| 632 | +} | ||
| 633 | + | ||
| 634 | +/* Record a state for a program. | ||
| 635 | + * Create a new entry if we need to, or update an existing one. | ||
| 636 | + * Program must match on the first 3 args to update. | ||
| 637 | + * Args: | ||
| 638 | + * procpid Process ID | ||
| 639 | + * procppid Parent process ID | ||
| 640 | + * progprog Program name | ||
| 641 | + * prog_metric What we are measuring (METRIC_something but represented as the character in the file) | ||
| 642 | + * state Error or warning (STATE_something) | ||
| 643 | + */ | ||
| 644 | +void | ||
| 645 | +record_state(pid_t procpid, pid_t procppid, char* procprog, char prog_metric, int state, time_t start_time) | ||
| 646 | +{ | ||
| 647 | + ExProc* pp; | ||
| 648 | + | ||
| 649 | + /* Look for the process */ | ||
| 650 | + for(pp = state_list; pp; pp = pp->ep_next) { | ||
| 651 | + if(pp->ep_pid != procpid) | ||
| 652 | + continue; | ||
| 653 | + | ||
| 654 | + /* Right process, but if it has mutated - throw it away and start again. | ||
| 655 | + * This doesn't detect processes that exec() a lot w/out fork(), but that is rare. | ||
| 656 | + */ | ||
| 657 | + if(pp->ep_ppid != procppid || strcmp(pp->ep_prog, procprog)) { | ||
| 658 | + PLimit* pl; | ||
| 659 | + while(pl = pp->ep_limits) { | ||
| 660 | + pp->ep_limits = pl->pl_next; | ||
| 661 | + free(pl); | ||
| 662 | + } | ||
| 663 | + pp->ep_ppid = procppid; | ||
| 664 | + if(strcmp(pp->ep_prog, procprog)) { | ||
| 665 | + free(pp->ep_prog); | ||
| 666 | + if( ! (pp->ep_prog = strdup(procprog))) | ||
| 667 | + die(STATE_UNKNOWN, _("Out of memory")); | ||
| 668 | + } | ||
| 669 | + | ||
| 670 | + state_changed = 1; | ||
| 671 | + } | ||
| 672 | + | ||
| 673 | + if(verbose >= 3) | ||
| 674 | + printf("Record found: pid %d %s\n", pp->ep_pid, pp->ep_prog); | ||
| 675 | + | ||
| 676 | + break; | ||
| 677 | + } | ||
| 678 | + | ||
| 679 | + /* Didn't find the process, allocate a new entry */ | ||
| 680 | + if( ! pp) { | ||
| 681 | + if( ! (pp = calloc(sizeof(ExProc), 1))) | ||
| 682 | + die(STATE_UNKNOWN, _("Out of memory")); | ||
| 683 | + pp->ep_pid = procpid; | ||
| 684 | + pp->ep_ppid = procppid; | ||
| 685 | + if( ! (pp->ep_prog = strdup(procprog))) | ||
| 686 | + die(STATE_UNKNOWN, _("Out of memory")); | ||
| 687 | + | ||
| 688 | + pp->ep_next = state_list; | ||
| 689 | + state_list = pp; | ||
| 690 | + state_changed = 1; | ||
| 691 | + | ||
| 692 | + if(verbose >= 3) | ||
| 693 | + printf("Record alloc: pid %d %s\n", pp->ep_pid, pp->ep_prog); | ||
| 694 | + } | ||
| 695 | + | ||
| 696 | + pp->ep_seen = 1; /* Ensure that this gets written out */ | ||
| 697 | + | ||
| 698 | + record_limit(&pp->ep_limits, state, prog_metric, start_time); | ||
| 699 | +} | ||
| 700 | + | ||
| 701 | +/* Store a limit | ||
| 702 | + * l_ref address of head of limits chain | ||
| 703 | + * prog_metric What we are measuring (METRIC_something but represented as the character in the file) | ||
| 704 | + * state Error or warning (STATE_something) | ||
| 705 | + * start_time The time to record when it started, if we already record this - don't change the time | ||
| 706 | + * unless this is older. | ||
| 707 | + * | ||
| 708 | + * If something is C then it is implicitly W. This is important: if something goes from | ||
| 709 | + * W to C, it might remain at C for less than the state time (which it might do W -> C | ||
| 710 | + * & back again several times) - but the time above the W level might be notifiable. | ||
| 711 | + */ | ||
| 712 | +void | ||
| 713 | +record_limit(PLimit** l_ref, int state, char proc_metric, time_t start_time) | ||
| 714 | +{ | ||
| 715 | + PLimit* pl; | ||
| 716 | + PLimit* pl_found = NULL; | ||
| 717 | + int seen_warning = 0; | ||
| 718 | + | ||
| 719 | + /* Find the individual process limit. | ||
| 720 | + * Scan the whole lot since we want to 'seen' a Warning if we have Critical. | ||
| 721 | + */ | ||
| 722 | + for(pl = *l_ref; pl; pl = pl->pl_next) | ||
| 723 | + if(pl->pl_metric == proc_metric) { | ||
| 724 | + if(state == STATE_CRITICAL && pl->pl_state == STATE_WARNING) { | ||
| 725 | + pl->pl_seen = 1; /* Ensure that it is output */ | ||
| 726 | + seen_warning = 1; | ||
| 727 | + } | ||
| 728 | + | ||
| 729 | + if(pl->pl_state == state) | ||
| 730 | + pl_found = pl; /* We found what we were looking for */ | ||
| 731 | + } | ||
| 732 | + | ||
| 733 | + pl = pl_found; | ||
| 734 | + | ||
| 735 | + /* Didn't find it, allocate a new one */ | ||
| 736 | + if( ! pl) { | ||
| 737 | + if( ! (pl = calloc(sizeof(PLimit), 1))) | ||
| 738 | + die(STATE_UNKNOWN, _("Out of memory")); | ||
| 739 | + pl->pl_next = *l_ref; | ||
| 740 | + *l_ref = pl; | ||
| 741 | + pl->pl_when = start_time; | ||
| 742 | + pl->pl_state = state; | ||
| 743 | + pl->pl_metric = proc_metric; | ||
| 744 | + | ||
| 745 | + state_changed = 1; | ||
| 746 | + } else /* It is possible that the time was set earlier when a 'C' generated | ||
| 747 | + * an implicit 'W'. Since the 'W' prob started earlier that the 'C' | ||
| 748 | + * we may have recorded the later 'C' time rather than the 'W' time. | ||
| 749 | + */ | ||
| 750 | + if(pl->pl_when > start_time) | ||
| 751 | + pl->pl_when = start_time; | ||
| 752 | + | ||
| 753 | + pl->pl_seen = 1; /* Ensure that it is output */ | ||
| 754 | + | ||
| 755 | + if(verbose >= 3) | ||
| 756 | + printf("Record limit: metric=%c state=%c since %s", pl->pl_metric, STATE2state(pl->pl_state), ctime(&pl->pl_when)); | ||
| 757 | + | ||
| 758 | + /* If this is a critical, but we didn't see the warning - generate the warning */ | ||
| 759 | + if(state == 'C' && ! seen_warning) | ||
| 760 | + record_limit(l_ref, 'W', proc_metric, start_time); | ||
| 761 | +} | ||
| 762 | + | ||
| 763 | +/* Check if limits have been exceeded for at least the state-time | ||
| 764 | + * Check only metric_state_name regardless of what is stored. | ||
| 765 | + * | ||
| 766 | + * Args: | ||
| 767 | + * pl List of limit values | ||
| 768 | + * | ||
| 769 | + * Return: STATE_OK, STATE_WARNING or STATE_CRITICAL | ||
| 770 | + */ | ||
| 771 | +int | ||
| 772 | +check_limit(PLimit* pl) | ||
| 773 | +{ | ||
| 774 | + int result = STATE_OK; | ||
| 775 | + | ||
| 776 | + for(; pl; pl = pl->pl_next) { | ||
| 777 | + if( ! pl->pl_seen) | ||
| 778 | + continue; /* Of no interest, not updated this run */ | ||
| 779 | + | ||
| 780 | + if(pl->pl_metric != metric_state_name) | ||
| 781 | + continue; /* Not what we are looking for */ | ||
| 782 | + | ||
| 783 | + /* Is this something that has been going on for long enough that we | ||
| 784 | + * are to report it ? | ||
| 785 | + */ | ||
| 786 | + if(pl->pl_when <= state_limit_start) { | ||
| 787 | + if(result == STATE_OK) | ||
| 788 | + result = pl->pl_state; | ||
| 789 | + | ||
| 790 | + if(result == STATE_WARNING && pl->pl_state == STATE_CRITICAL) | ||
| 791 | + result = STATE_CRITICAL; | ||
| 792 | + } | ||
| 793 | + } | ||
| 794 | + | ||
| 795 | + return(result); | ||
| 796 | } | ||
diff --git a/web/attachments/32813-check_oracle.patch b/web/attachments/32813-check_oracle.patch new file mode 100644 index 0000000..a2bd429 --- /dev/null +++ b/web/attachments/32813-check_oracle.patch | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | 38a39,40 | ||
| 2 | > echo " $PROGNAME --cache <USER> <PASS> <INST> <CRITICAL> <WARNING>" | ||
| 3 | > echo " $PROGNAME --tablespace <USER> <PASS> <INST> <TABLESPACE> <CRITICAL> <WARNING>" | ||
| 4 | 55a58,65 | ||
| 5 | > echo "--cache" | ||
| 6 | > echo " Check local database for library and buffer cache hit ratios" | ||
| 7 | > echo " ---> Requires Oracle user/password and SID specified." | ||
| 8 | > echo " ---> Requires select on v_$sysstat and v_$librarycache" | ||
| 9 | > echo "--tablespace" | ||
| 10 | > echo " Check local database for tablespace capacity in ORACLE_SID" | ||
| 11 | > echo " ---> Requires Oracle user/password specified." | ||
| 12 | > echo " ---> Requires select on dba_data_fiels and dba_free_Space" | ||
| 13 | 157a168,233 | ||
| 14 | > ;; | ||
| 15 | > --cache) | ||
| 16 | > if [ ${5} -gt ${6} ] ; then | ||
| 17 | > echo "UNKNOWN - Warning level is less then Crit" | ||
| 18 | > exit $STATE_UNKNOWN | ||
| 19 | > fi | ||
| 20 | > result=`sqlplus -s ${2}/${3}@${4} << EOF | ||
| 21 | > set pagesize 0 | ||
| 22 | > | ||
| 23 | > select (1-(pr.value/(dbg.value+cg.value)))*100 \ | ||
| 24 | > from v\\$sysstat pr, v\\$sysstat dbg, v\\$sysstat cg \ | ||
| 25 | > where pr.name = 'physical reads' \ | ||
| 26 | > and dbg.name='db block gets' \ | ||
| 27 | > and cg.name='consistent gets'; ` | ||
| 28 | > | ||
| 29 | > | ||
| 30 | > buf_hr=`echo $result | awk '{print int($1)}'` | ||
| 31 | > result=`sqlplus -s ${2}/${3}@${4} << EOF | ||
| 32 | > set pagesize 0 | ||
| 33 | > | ||
| 34 | > select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 \ | ||
| 35 | > from v\\$librarycache lc ; ` | ||
| 36 | > | ||
| 37 | > lib_hr=`echo $result | awk '{print int($1)}'` | ||
| 38 | > | ||
| 39 | > if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then | ||
| 40 | > echo "${3} : ${4} CRITICAL - Cache Hit Rates: $lib_hr % Lib -- $buf_hr % Buff" | ||
| 41 | > exit $STATE_CRITICAL | ||
| 42 | > fi | ||
| 43 | > if [ $buf_hr -le ${6} -o $lib_hr -le ${6} ] ; then | ||
| 44 | > echo "${3} : ${4} WARNING - Cache Hit Rates: $lib_hr % Lib -- $buf_hr % Buff" | ||
| 45 | > exit $STATE_WARNING | ||
| 46 | > fi | ||
| 47 | > echo "${3} : ${4} OK - Cache Hit Rates: $lib_hr % Lib -- $buf_hr % Buff" | ||
| 48 | > | ||
| 49 | > exit $STATE_OK | ||
| 50 | > ;; | ||
| 51 | > --tablespace) | ||
| 52 | > if [ ${6} -lt ${7} ] ; then | ||
| 53 | > echo "UNKNOWN - Warning level is more then Crit" | ||
| 54 | > exit $STATE_UNKNOWN | ||
| 55 | > fi | ||
| 56 | > result=`sqlplus -s ${2}/${3}@${4} << EOF | ||
| 57 | > set pagesize 0 | ||
| 58 | > | ||
| 59 | > select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc \ | ||
| 60 | > from ( \ | ||
| 61 | > select tablespace_name,sum(bytes)/1024/1024 total \ | ||
| 62 | > from dba_data_files group by tablespace_name) A, \ | ||
| 63 | > ( select tablespace_name,sum(bytes)/1024/1024 free \ | ||
| 64 | > from dba_Free_space group by tablespace_name) B \ | ||
| 65 | > where a.tablespace_name=b.tablespace_name and a.tablespace_name='${5}'; ` | ||
| 66 | > | ||
| 67 | > ts_free=`echo $result | awk '{print int($1)}'` | ||
| 68 | > ts_total=`echo $result | awk '{print int($2)}'` | ||
| 69 | > ts_pct=`echo $result | awk '{print int($3)}'` | ||
| 70 | > if [ $ts_pct -ge ${6} ] ; then | ||
| 71 | > echo "${4} : ${5} CRITICAL - $ts_pct% used [ $ts_free / $ts_total MB available ]" | ||
| 72 | > exit $STATE_CRITICAL | ||
| 73 | > fi | ||
| 74 | > if [ $ts_pct -ge ${7} ] ; then | ||
| 75 | > echo "${4} : ${5} WARNING - $ts_pct% used [ $ts_free / $ts_total MB available ]" | ||
| 76 | > exit $STATE_WARNING | ||
| 77 | > fi | ||
| 78 | > echo "${4} : ${5} OK - $ts_pct% used [ $ts_free / $ts_total MB available ]" | ||
| 79 | > exit $STATE_OK | ||
diff --git a/web/attachments/328741-utils_base.c.patch b/web/attachments/328741-utils_base.c.patch new file mode 100644 index 0000000..d5207e2 --- /dev/null +++ b/web/attachments/328741-utils_base.c.patch | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | --- utils_base.c.old 2009-05-27 15:55:13.000000000 +0400 | ||
| 2 | +++ utils_base.c 2009-05-28 11:51:11.000000000 +0400 | ||
| 3 | @@ -23,7 +23,6 @@ | ||
| 4 | * You should have received a copy of the GNU General Public License | ||
| 5 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 6 | * | ||
| 7 | -* $Id: utils_base.c 1938 2008-03-11 00:10:23Z tonvoon $ | ||
| 8 | * | ||
| 9 | *****************************************************************************/ | ||
| 10 | |||
| 11 | @@ -104,7 +103,7 @@ | ||
| 12 | { | ||
| 13 | thresholds *temp_thresholds = NULL; | ||
| 14 | |||
| 15 | - temp_thresholds = malloc(sizeof(temp_thresholds)); | ||
| 16 | + temp_thresholds = malloc(sizeof(thresholds)); | ||
| 17 | |||
| 18 | temp_thresholds->warning = NULL; | ||
| 19 | temp_thresholds->critical = NULL; | ||
diff --git a/web/attachments/328860-check_http.patch b/web/attachments/328860-check_http.patch new file mode 100644 index 0000000..f1e32b6 --- /dev/null +++ b/web/attachments/328860-check_http.patch | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | Index: check_http.c | ||
| 2 | =================================================================== | ||
| 3 | --- check_http.c (Revision 449) | ||
| 4 | +++ check_http.c (Arbeitskopie) | ||
| 5 | @@ -1017,7 +1017,8 @@ | ||
| 6 | exit (STATE_OK); | ||
| 7 | } | ||
| 8 | else { | ||
| 9 | - printf (_("HTTP CRITICAL - string not found%s|%s %s\n"), | ||
| 10 | + printf (_("HTTP CRITICAL - string '%s' not found%s|%s %s\n"), | ||
| 11 | + string_expect, | ||
| 12 | (display_html ? "</A>" : ""), | ||
| 13 | perfd_time (elapsed_time), perfd_size (pagesize)); | ||
| 14 | exit (STATE_CRITICAL); | ||
diff --git a/web/attachments/329105-check_pgsql.c.diff b/web/attachments/329105-check_pgsql.c.diff new file mode 100644 index 0000000..f6e6eef --- /dev/null +++ b/web/attachments/329105-check_pgsql.c.diff | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | Index: check_pgsql.c | ||
| 2 | =================================================================== | ||
| 3 | --- check_pgsql.c (revision 2203) | ||
| 4 | +++ check_pgsql.c (working copy) | ||
| 5 | @@ -429,8 +429,6 @@ | ||
| 6 | |||
| 7 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
| 8 | |||
| 9 | - printf (_(UT_VERBOSE)); | ||
| 10 | - | ||
| 11 | printf ("\n"); | ||
| 12 | printf (" %s\n", _("All parameters are optional.")); | ||
| 13 | printf (" %s\n", _("This plugin tests a PostgreSQL DBMS to determine whether it is active and")); | ||
diff --git a/web/attachments/329918-checkntp.zip b/web/attachments/329918-checkntp.zip new file mode 100644 index 0000000..1262d80 --- /dev/null +++ b/web/attachments/329918-checkntp.zip | |||
| Binary files differ | |||
diff --git a/web/attachments/329923-snmp_procmon.diff b/web/attachments/329923-snmp_procmon.diff new file mode 100644 index 0000000..dd02316 --- /dev/null +++ b/web/attachments/329923-snmp_procmon.diff | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | --- nagios-plugins-1.4.13/contrib/check_snmp_process_monitor.pl 2002-08-22 15:08:46.000000000 -0700 | ||
| 2 | +++ nagios-plugins-1.4.13_mod/contrib/check_snmp_process_monitor.pl 2009-06-01 05:57:37.000000000 -0700 | ||
| 3 | @@ -293,12 +293,12 @@ | ||
| 4 | # warning, critical | ||
| 5 | if ( ($opt_warning->[0] > 0 && $opt_warning->[0] > $count) | ||
| 6 | || ($opt_warning->[1] > 0 && $opt_warning->[1] <= $count) ) { | ||
| 7 | - $message = "WARNING - no processes found resembling '". ($opt_command || $opt_regex); | ||
| 8 | + $message = "WARNING - $count processes found resembling '". ($opt_command || $opt_regex); | ||
| 9 | $exit = $ERRORS{WARNING}; | ||
| 10 | } | ||
| 11 | if ( ($opt_critical->[0] > 0 && $opt_critical->[0] > $count) | ||
| 12 | || ($opt_critical->[1] > 0 && $opt_critical->[1] <= $count) ) { | ||
| 13 | - $message = "CRITICAL - no processes found resembling '". ($opt_command || $opt_regex); | ||
| 14 | + $message = "CRITICAL - $count processes found resembling '". ($opt_command || $opt_regex); | ||
| 15 | $exit = $ERRORS{CRITICAL}; | ||
| 16 | } | ||
| 17 | |||
diff --git a/web/attachments/329924-snmp_dskmon.diff b/web/attachments/329924-snmp_dskmon.diff new file mode 100644 index 0000000..f454346 --- /dev/null +++ b/web/attachments/329924-snmp_dskmon.diff | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | --- nagios-plugins-1.4.13/contrib/check_snmp_disk_monitor.pl 2002-08-22 07:42:43.000000000 -0700 | ||
| 2 | +++ nagios-plugins-1.4.13_mod/contrib/check_snmp_disk_monitor.pl 2009-06-03 06:27:33.000000000 -0700 | ||
| 3 | @@ -27,7 +27,6 @@ | ||
| 4 | %mounts = (); | ||
| 5 | |||
| 6 | sub process_options { | ||
| 7 | - my( $opt_crit, $opt_warn ) = (); | ||
| 8 | Getopt::Long::Configure( 'bundling' ); | ||
| 9 | GetOptions( | ||
| 10 | 'V' => \$opt_version, 'version' => \$opt_version, | ||
| 11 | @@ -37,8 +36,8 @@ | ||
| 12 | 'H:s' => \$opt_host, 'hostname:s' => \$opt_host, | ||
| 13 | 'p:i' => \$opt_port, 'port:i' => \$opt_port, | ||
| 14 | 'C:s' => \$opt_community, 'community:s' => \$opt_community, | ||
| 15 | - 'c:i' => \$opt_crit, 'critical:i' => \$opt_crit, | ||
| 16 | - 'w:i' => \$opt_warn, 'warning:i' => \$opt_warn, | ||
| 17 | + 'c:i' => \$opt_critical, 'critical:i' => \$opt_critical, | ||
| 18 | + 'w:i' => \$opt_warning, 'warning:i' => \$opt_warning, | ||
| 19 | 't:i' => \$TIMEOUT, 'timeout:i' => \$TIMEOUT, | ||
| 20 | 'm:s' => \$opt_mountpoint, 'mountpoint:s'=> \$opt_mountpoint | ||
| 21 | ); | ||
| 22 | @@ -56,7 +55,7 @@ | ||
| 23 | } | ||
| 24 | |||
| 25 | sub print_usage { | ||
| 26 | - print "Usage: $PROGNAME -H <host> -C <snmp_community> [-s] [-w <low>,<high>] [-c <low>,<high>] [-t <timeout>] -m <mountpoint>\n"; | ||
| 27 | + print "Usage: $PROGNAME -H <host> -C <snmp_community> [-s] [-w <limit>] [-c <limit>] [-t <timeout>] -m <mountpoint>\n"; | ||
| 28 | } | ||
| 29 | |||
| 30 | sub print_help { | ||
diff --git a/web/attachments/330164-nagios-plugins-1.4.13-no-buggy-locales.diff b/web/attachments/330164-nagios-plugins-1.4.13-no-buggy-locales.diff new file mode 100644 index 0000000..280708f --- /dev/null +++ b/web/attachments/330164-nagios-plugins-1.4.13-no-buggy-locales.diff | |||
| @@ -0,0 +1,577 @@ | |||
| 1 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_by_ssh.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_by_ssh.c | ||
| 2 | --- nagios-plugins-1.4.13/plugins/check_by_ssh.c 2008-05-27 23:31:13.000000000 +0200 | ||
| 3 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_by_ssh.c 2008-12-15 22:10:55.000000000 +0100 | ||
| 4 | @@ -72,10 +72,6 @@ | ||
| 5 | remotecmd = ""; | ||
| 6 | comm = strdup (SSH_COMMAND); | ||
| 7 | |||
| 8 | - setlocale (LC_ALL, ""); | ||
| 9 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 10 | - textdomain (PACKAGE); | ||
| 11 | - | ||
| 12 | /* Parse extra opts if any */ | ||
| 13 | argv=np_extra_opts (&argc, argv, progname); | ||
| 14 | |||
| 15 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_cluster.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_cluster.c | ||
| 16 | --- nagios-plugins-1.4.13/plugins/check_cluster.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 17 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_cluster.c 2008-12-15 22:10:55.000000000 +0100 | ||
| 18 | @@ -70,10 +70,6 @@ | ||
| 19 | int return_code=STATE_OK; | ||
| 20 | thresholds *thresholds = NULL; | ||
| 21 | |||
| 22 | - setlocale (LC_ALL, ""); | ||
| 23 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 24 | - textdomain (PACKAGE); | ||
| 25 | - | ||
| 26 | /* Parse extra opts if any */ | ||
| 27 | argv=np_extra_opts(&argc, argv, progname); | ||
| 28 | |||
| 29 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_dig.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_dig.c | ||
| 30 | --- nagios-plugins-1.4.13/plugins/check_dig.c 2008-06-09 21:47:36.000000000 +0200 | ||
| 31 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_dig.c 2008-12-15 22:10:55.000000000 +0100 | ||
| 32 | @@ -76,10 +76,6 @@ | ||
| 33 | double elapsed_time; | ||
| 34 | int result = STATE_UNKNOWN; | ||
| 35 | |||
| 36 | - setlocale (LC_ALL, ""); | ||
| 37 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 38 | - textdomain (PACKAGE); | ||
| 39 | - | ||
| 40 | /* Set signal handling and alarm */ | ||
| 41 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) | ||
| 42 | usage_va(_("Cannot catch SIGALRM")); | ||
| 43 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_disk.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_disk.c | ||
| 44 | --- nagios-plugins-1.4.13/plugins/check_disk.c 2008-07-10 12:03:55.000000000 +0200 | ||
| 45 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_disk.c 2008-12-15 22:10:56.000000000 +0100 | ||
| 46 | @@ -186,10 +186,6 @@ | ||
| 47 | perf = strdup (""); | ||
| 48 | stat_buf = malloc(sizeof *stat_buf); | ||
| 49 | |||
| 50 | - setlocale (LC_ALL, ""); | ||
| 51 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 52 | - textdomain (PACKAGE); | ||
| 53 | - | ||
| 54 | mount_list = read_file_system_list (0); | ||
| 55 | |||
| 56 | /* Parse extra opts if any */ | ||
| 57 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_dns.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_dns.c | ||
| 58 | --- nagios-plugins-1.4.13/plugins/check_dns.c 2008-05-13 11:14:45.000000000 +0200 | ||
| 59 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_dns.c 2008-12-15 22:10:56.000000000 +0100 | ||
| 60 | @@ -90,10 +90,6 @@ | ||
| 61 | output chld_out, chld_err; | ||
| 62 | size_t i; | ||
| 63 | |||
| 64 | - setlocale (LC_ALL, ""); | ||
| 65 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 66 | - textdomain (PACKAGE); | ||
| 67 | - | ||
| 68 | /* Set signal handling and alarm */ | ||
| 69 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { | ||
| 70 | usage_va(_("Cannot catch SIGALRM")); | ||
| 71 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_dummy.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_dummy.c | ||
| 72 | --- nagios-plugins-1.4.13/plugins/check_dummy.c 2008-04-27 16:35:26.000000000 +0200 | ||
| 73 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_dummy.c 2008-12-15 22:10:56.000000000 +0100 | ||
| 74 | @@ -48,10 +48,6 @@ | ||
| 75 | { | ||
| 76 | int result = STATE_UNKNOWN; | ||
| 77 | |||
| 78 | - setlocale (LC_ALL, ""); | ||
| 79 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 80 | - textdomain (PACKAGE); | ||
| 81 | - | ||
| 82 | if (argc < 2) | ||
| 83 | usage4 (_("Could not parse arguments")); | ||
| 84 | else if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "--version") == 0) { | ||
| 85 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_fping.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_fping.c | ||
| 86 | --- nagios-plugins-1.4.13/plugins/check_fping.c 2008-08-16 06:47:22.000000000 +0200 | ||
| 87 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_fping.c 2008-12-15 22:10:56.000000000 +0100 | ||
| 88 | @@ -79,10 +79,6 @@ | ||
| 89 | char *input_buffer = NULL; | ||
| 90 | input_buffer = malloc (MAX_INPUT_BUFFER); | ||
| 91 | |||
| 92 | - setlocale (LC_ALL, ""); | ||
| 93 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 94 | - textdomain (PACKAGE); | ||
| 95 | - | ||
| 96 | /* Parse extra opts if any */ | ||
| 97 | argv=np_extra_opts (&argc, argv, progname); | ||
| 98 | |||
| 99 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_game.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_game.c | ||
| 100 | --- nagios-plugins-1.4.13/plugins/check_game.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 101 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_game.c 2008-12-15 22:10:57.000000000 +0100 | ||
| 102 | @@ -75,10 +75,6 @@ | ||
| 103 | size_t i = 0; | ||
| 104 | output chld_out; | ||
| 105 | |||
| 106 | - setlocale (LC_ALL, ""); | ||
| 107 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 108 | - textdomain (PACKAGE); | ||
| 109 | - | ||
| 110 | /* Parse extra opts if any */ | ||
| 111 | argv=np_extra_opts (&argc, argv, progname); | ||
| 112 | |||
| 113 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_hpjd.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_hpjd.c | ||
| 114 | --- nagios-plugins-1.4.13/plugins/check_hpjd.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 115 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_hpjd.c 2008-12-15 22:10:57.000000000 +0100 | ||
| 116 | @@ -96,10 +96,6 @@ | ||
| 117 | |||
| 118 | errmsg = malloc(MAX_INPUT_BUFFER); | ||
| 119 | |||
| 120 | - setlocale (LC_ALL, ""); | ||
| 121 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 122 | - textdomain (PACKAGE); | ||
| 123 | - | ||
| 124 | /* Parse extra opts if any */ | ||
| 125 | argv=np_extra_opts (&argc, argv, progname); | ||
| 126 | |||
| 127 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_http.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_http.c | ||
| 128 | --- nagios-plugins-1.4.13/plugins/check_http.c 2008-09-02 13:26:31.000000000 +0200 | ||
| 129 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_http.c 2008-12-15 22:10:57.000000000 +0100 | ||
| 130 | @@ -137,10 +137,6 @@ | ||
| 131 | { | ||
| 132 | int result = STATE_UNKNOWN; | ||
| 133 | |||
| 134 | - setlocale (LC_ALL, ""); | ||
| 135 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 136 | - textdomain (PACKAGE); | ||
| 137 | - | ||
| 138 | /* Set default URL. Must be malloced for subsequent realloc if --onredirect=follow */ | ||
| 139 | server_url = strdup(HTTP_URL); | ||
| 140 | server_url_length = strlen(server_url); | ||
| 141 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_ide_smart.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_ide_smart.c | ||
| 142 | --- nagios-plugins-1.4.13/plugins/check_ide_smart.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 143 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_ide_smart.c 2008-12-15 22:10:57.000000000 +0100 | ||
| 144 | @@ -176,10 +176,6 @@ | ||
| 145 | {"version", no_argument, 0, 'V'}, {0, 0, 0, 0} | ||
| 146 | }; | ||
| 147 | |||
| 148 | - setlocale (LC_ALL, ""); | ||
| 149 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 150 | - textdomain (PACKAGE); | ||
| 151 | - | ||
| 152 | while (1) { | ||
| 153 | |||
| 154 | o = getopt_long (argc, argv, "+d:iq10nhV", longopts, &longindex); | ||
| 155 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_ldap.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_ldap.c | ||
| 156 | --- nagios-plugins-1.4.13/plugins/check_ldap.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 157 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_ldap.c 2008-12-15 22:10:57.000000000 +0100 | ||
| 158 | @@ -97,10 +97,6 @@ | ||
| 159 | int tls; | ||
| 160 | int version=3; | ||
| 161 | |||
| 162 | - setlocale (LC_ALL, ""); | ||
| 163 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 164 | - textdomain (PACKAGE); | ||
| 165 | - | ||
| 166 | if (strstr(argv[0],"check_ldaps")) { | ||
| 167 | asprintf (&progname, "check_ldaps"); | ||
| 168 | } | ||
| 169 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_load.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_load.c | ||
| 170 | --- nagios-plugins-1.4.13/plugins/check_load.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 171 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_load.c 2008-12-15 22:10:58.000000000 +0100 | ||
| 172 | @@ -114,11 +114,6 @@ | ||
| 173 | # endif | ||
| 174 | #endif | ||
| 175 | |||
| 176 | - setlocale (LC_ALL, ""); | ||
| 177 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 178 | - textdomain (PACKAGE); | ||
| 179 | - setlocale(LC_NUMERIC, "POSIX"); | ||
| 180 | - | ||
| 181 | /* Parse extra opts if any */ | ||
| 182 | argv = np_extra_opts (&argc, argv, progname); | ||
| 183 | |||
| 184 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_mrtg.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_mrtg.c | ||
| 185 | --- nagios-plugins-1.4.13/plugins/check_mrtg.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 186 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_mrtg.c 2008-12-15 22:10:58.000000000 +0100 | ||
| 187 | @@ -68,10 +68,6 @@ | ||
| 188 | unsigned long maximum_value_rate = 0L; | ||
| 189 | unsigned long rate = 0L; | ||
| 190 | |||
| 191 | - setlocale (LC_ALL, ""); | ||
| 192 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 193 | - textdomain (PACKAGE); | ||
| 194 | - | ||
| 195 | /* Parse extra opts if any */ | ||
| 196 | argv=np_extra_opts (&argc, argv, progname); | ||
| 197 | |||
| 198 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_mrtgtraf.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_mrtgtraf.c | ||
| 199 | --- nagios-plugins-1.4.13/plugins/check_mrtgtraf.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 200 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_mrtgtraf.c 2008-12-15 22:10:58.000000000 +0100 | ||
| 201 | @@ -76,10 +76,6 @@ | ||
| 202 | char incoming_speed_rating[8]; | ||
| 203 | char outgoing_speed_rating[8]; | ||
| 204 | |||
| 205 | - setlocale (LC_ALL, ""); | ||
| 206 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 207 | - textdomain (PACKAGE); | ||
| 208 | - | ||
| 209 | /* Parse extra opts if any */ | ||
| 210 | argv=np_extra_opts (&argc, argv, progname); | ||
| 211 | |||
| 212 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_mysql.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_mysql.c | ||
| 213 | --- nagios-plugins-1.4.13/plugins/check_mysql.c 2008-08-16 06:47:32.000000000 +0200 | ||
| 214 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_mysql.c 2008-12-15 22:10:58.000000000 +0100 | ||
| 215 | @@ -78,10 +78,6 @@ | ||
| 216 | char *error = NULL; | ||
| 217 | char slaveresult[SLAVERESULTSIZE]; | ||
| 218 | |||
| 219 | - setlocale (LC_ALL, ""); | ||
| 220 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 221 | - textdomain (PACKAGE); | ||
| 222 | - | ||
| 223 | /* Parse extra opts if any */ | ||
| 224 | argv=np_extra_opts (&argc, argv, progname); | ||
| 225 | |||
| 226 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_mysql_query.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_mysql_query.c | ||
| 227 | --- nagios-plugins-1.4.13/plugins/check_mysql_query.c 2008-08-16 06:47:32.000000000 +0200 | ||
| 228 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_mysql_query.c 2008-12-15 22:10:59.000000000 +0100 | ||
| 229 | @@ -74,10 +74,6 @@ | ||
| 230 | char *error = NULL; | ||
| 231 | int status; | ||
| 232 | |||
| 233 | - setlocale (LC_ALL, ""); | ||
| 234 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 235 | - textdomain (PACKAGE); | ||
| 236 | - | ||
| 237 | /* Parse extra opts if any */ | ||
| 238 | argv=np_extra_opts (&argc, argv, progname); | ||
| 239 | |||
| 240 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_nagios.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_nagios.c | ||
| 241 | --- nagios-plugins-1.4.13/plugins/check_nagios.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 242 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_nagios.c 2008-12-15 22:10:59.000000000 +0100 | ||
| 243 | @@ -84,10 +84,6 @@ | ||
| 244 | output chld_out, chld_err; | ||
| 245 | size_t i; | ||
| 246 | |||
| 247 | - setlocale (LC_ALL, ""); | ||
| 248 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 249 | - textdomain (PACKAGE); | ||
| 250 | - | ||
| 251 | /* Parse extra opts if any */ | ||
| 252 | argv=np_extra_opts (&argc, argv, progname); | ||
| 253 | |||
| 254 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_nt.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_nt.c | ||
| 255 | --- nagios-plugins-1.4.13/plugins/check_nt.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 256 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_nt.c 2008-12-15 22:10:59.000000000 +0100 | ||
| 257 | @@ -118,10 +118,6 @@ | ||
| 258 | int isPercent = FALSE; | ||
| 259 | int allRight = FALSE; | ||
| 260 | |||
| 261 | - setlocale (LC_ALL, ""); | ||
| 262 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 263 | - textdomain (PACKAGE); | ||
| 264 | - | ||
| 265 | /* Parse extra opts if any */ | ||
| 266 | argv=np_extra_opts (&argc, argv, progname); | ||
| 267 | |||
| 268 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_ntp.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_ntp.c | ||
| 269 | --- nagios-plugins-1.4.13/plugins/check_ntp.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 270 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_ntp.c 2008-12-15 22:10:59.000000000 +0100 | ||
| 271 | @@ -757,10 +757,6 @@ | ||
| 272 | double offset=0, jitter=0; | ||
| 273 | char *result_line, *perfdata_line; | ||
| 274 | |||
| 275 | - setlocale (LC_ALL, ""); | ||
| 276 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 277 | - textdomain (PACKAGE); | ||
| 278 | - | ||
| 279 | result = offset_result = jitter_result = STATE_OK; | ||
| 280 | |||
| 281 | /* Parse extra opts if any */ | ||
| 282 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_ntp_peer.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_ntp_peer.c | ||
| 283 | --- nagios-plugins-1.4.13/plugins/check_ntp_peer.c 2008-09-02 14:28:04.000000000 +0200 | ||
| 284 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_ntp_peer.c 2008-12-15 22:10:59.000000000 +0100 | ||
| 285 | @@ -589,10 +589,6 @@ | ||
| 286 | double offset=0, jitter=0; | ||
| 287 | char *result_line, *perfdata_line; | ||
| 288 | |||
| 289 | - setlocale (LC_ALL, ""); | ||
| 290 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 291 | - textdomain (PACKAGE); | ||
| 292 | - | ||
| 293 | /* Parse extra opts if any */ | ||
| 294 | argv=np_extra_opts (&argc, argv, progname); | ||
| 295 | |||
| 296 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_ntp_time.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_ntp_time.c | ||
| 297 | --- nagios-plugins-1.4.13/plugins/check_ntp_time.c 2008-09-01 16:04:22.000000000 +0200 | ||
| 298 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_ntp_time.c 2008-12-15 22:10:59.000000000 +0100 | ||
| 299 | @@ -539,10 +539,6 @@ | ||
| 300 | double offset=0; | ||
| 301 | char *result_line, *perfdata_line; | ||
| 302 | |||
| 303 | - setlocale (LC_ALL, ""); | ||
| 304 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 305 | - textdomain (PACKAGE); | ||
| 306 | - | ||
| 307 | result = offset_result = STATE_OK; | ||
| 308 | |||
| 309 | /* Parse extra opts if any */ | ||
| 310 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_nwstat.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_nwstat.c | ||
| 311 | --- nagios-plugins-1.4.13/plugins/check_nwstat.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 312 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_nwstat.c 2008-12-15 22:10:59.000000000 +0100 | ||
| 313 | @@ -166,10 +166,6 @@ | ||
| 314 | unsigned long sap_entries=0; | ||
| 315 | char uptime[MAX_INPUT_BUFFER]; | ||
| 316 | |||
| 317 | - setlocale (LC_ALL, ""); | ||
| 318 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 319 | - textdomain (PACKAGE); | ||
| 320 | - | ||
| 321 | /* Parse extra opts if any */ | ||
| 322 | argv=np_extra_opts(&argc, argv, progname); | ||
| 323 | |||
| 324 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_overcr.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_overcr.c | ||
| 325 | --- nagios-plugins-1.4.13/plugins/check_overcr.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 326 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_overcr.c 2008-12-15 22:10:59.000000000 +0100 | ||
| 327 | @@ -95,10 +95,6 @@ | ||
| 328 | int uptime_hours = 0; | ||
| 329 | int uptime_minutes = 0; | ||
| 330 | |||
| 331 | - setlocale (LC_ALL, ""); | ||
| 332 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 333 | - textdomain (PACKAGE); | ||
| 334 | - | ||
| 335 | /* Parse extra opts if any */ | ||
| 336 | argv=np_extra_opts (&argc, argv, progname); | ||
| 337 | |||
| 338 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_pgsql.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_pgsql.c | ||
| 339 | --- nagios-plugins-1.4.13/plugins/check_pgsql.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 340 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_pgsql.c 2008-12-15 22:10:59.000000000 +0100 | ||
| 341 | @@ -146,10 +146,6 @@ | ||
| 342 | pgoptions = NULL; /* special options to start up the backend server */ | ||
| 343 | pgtty = NULL; /* debugging tty for the backend server */ | ||
| 344 | |||
| 345 | - setlocale (LC_ALL, ""); | ||
| 346 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 347 | - textdomain (PACKAGE); | ||
| 348 | - | ||
| 349 | /* Parse extra opts if any */ | ||
| 350 | argv=np_extra_opts (&argc, argv, progname); | ||
| 351 | |||
| 352 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_ping.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_ping.c | ||
| 353 | --- nagios-plugins-1.4.13/plugins/check_ping.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 354 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_ping.c 2008-12-15 22:11:00.000000000 +0100 | ||
| 355 | @@ -84,11 +84,6 @@ | ||
| 356 | int this_result = STATE_UNKNOWN; | ||
| 357 | int i; | ||
| 358 | |||
| 359 | - setlocale (LC_ALL, ""); | ||
| 360 | - setlocale (LC_NUMERIC, "C"); | ||
| 361 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 362 | - textdomain (PACKAGE); | ||
| 363 | - | ||
| 364 | addresses = malloc (sizeof(char*) * max_addr); | ||
| 365 | addresses[0] = NULL; | ||
| 366 | |||
| 367 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_procs.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_procs.c | ||
| 368 | --- nagios-plugins-1.4.13/plugins/check_procs.c 2008-07-08 11:31:04.000000000 +0200 | ||
| 369 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_procs.c 2008-12-15 22:11:00.000000000 +0100 | ||
| 370 | @@ -133,11 +133,6 @@ | ||
| 371 | int result = STATE_UNKNOWN; | ||
| 372 | output chld_out, chld_err; | ||
| 373 | |||
| 374 | - setlocale (LC_ALL, ""); | ||
| 375 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 376 | - textdomain (PACKAGE); | ||
| 377 | - setlocale(LC_NUMERIC, "POSIX"); | ||
| 378 | - | ||
| 379 | input_buffer = malloc (MAX_INPUT_BUFFER); | ||
| 380 | procprog = malloc (MAX_INPUT_BUFFER); | ||
| 381 | |||
| 382 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_radius.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_radius.c | ||
| 383 | --- nagios-plugins-1.4.13/plugins/check_radius.c 2008-05-20 09:57:13.000000000 +0200 | ||
| 384 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_radius.c 2008-12-15 22:11:00.000000000 +0100 | ||
| 385 | @@ -145,10 +145,6 @@ | ||
| 386 | UINT4 client_id; | ||
| 387 | char *str; | ||
| 388 | |||
| 389 | - setlocale (LC_ALL, ""); | ||
| 390 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 391 | - textdomain (PACKAGE); | ||
| 392 | - | ||
| 393 | /* Parse extra opts if any */ | ||
| 394 | argv=np_extra_opts (&argc, argv, progname); | ||
| 395 | |||
| 396 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_real.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_real.c | ||
| 397 | --- nagios-plugins-1.4.13/plugins/check_real.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 398 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_real.c 2008-12-15 22:11:00.000000000 +0100 | ||
| 399 | @@ -73,10 +73,6 @@ | ||
| 400 | char buffer[MAX_INPUT_BUFFER]; | ||
| 401 | char *status_line = NULL; | ||
| 402 | |||
| 403 | - setlocale (LC_ALL, ""); | ||
| 404 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 405 | - textdomain (PACKAGE); | ||
| 406 | - | ||
| 407 | /* Parse extra opts if any */ | ||
| 408 | argv=np_extra_opts (&argc, argv, progname); | ||
| 409 | |||
| 410 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_smtp.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_smtp.c | ||
| 411 | --- nagios-plugins-1.4.13/plugins/check_smtp.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 412 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_smtp.c 2008-12-15 22:11:00.000000000 +0100 | ||
| 413 | @@ -133,10 +133,6 @@ | ||
| 414 | char *error_msg = ""; | ||
| 415 | struct timeval tv; | ||
| 416 | |||
| 417 | - setlocale (LC_ALL, ""); | ||
| 418 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 419 | - textdomain (PACKAGE); | ||
| 420 | - | ||
| 421 | /* Parse extra opts if any */ | ||
| 422 | argv=np_extra_opts (&argc, argv, progname); | ||
| 423 | |||
| 424 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_snmp.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_snmp.c | ||
| 425 | --- nagios-plugins-1.4.13/plugins/check_snmp.c 2008-07-09 23:53:12.000000000 +0200 | ||
| 426 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_snmp.c 2008-12-15 22:11:00.000000000 +0100 | ||
| 427 | @@ -154,10 +154,6 @@ | ||
| 428 | char *show = NULL; | ||
| 429 | char type[8] = ""; | ||
| 430 | |||
| 431 | - setlocale (LC_ALL, ""); | ||
| 432 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 433 | - textdomain (PACKAGE); | ||
| 434 | - | ||
| 435 | labels = malloc (labels_size); | ||
| 436 | unitv = malloc (unitv_size); | ||
| 437 | for (i = 0; i < MAX_OIDS; i++) | ||
| 438 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_ssh.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_ssh.c | ||
| 439 | --- nagios-plugins-1.4.13/plugins/check_ssh.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 440 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_ssh.c 2008-12-15 22:11:00.000000000 +0100 | ||
| 441 | @@ -66,10 +66,6 @@ | ||
| 442 | { | ||
| 443 | int result = STATE_UNKNOWN; | ||
| 444 | |||
| 445 | - setlocale (LC_ALL, ""); | ||
| 446 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 447 | - textdomain (PACKAGE); | ||
| 448 | - | ||
| 449 | /* Parse extra opts if any */ | ||
| 450 | argv=np_extra_opts (&argc, argv, progname); | ||
| 451 | |||
| 452 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_swap.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_swap.c | ||
| 453 | --- nagios-plugins-1.4.13/plugins/check_swap.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 454 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_swap.c 2008-12-15 22:11:00.000000000 +0100 | ||
| 455 | @@ -101,10 +101,6 @@ | ||
| 456 | char str[32]; | ||
| 457 | char *status; | ||
| 458 | |||
| 459 | - setlocale (LC_ALL, ""); | ||
| 460 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 461 | - textdomain (PACKAGE); | ||
| 462 | - | ||
| 463 | status = strdup (""); | ||
| 464 | |||
| 465 | /* Parse extra opts if any */ | ||
| 466 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_tcp.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_tcp.c | ||
| 467 | --- nagios-plugins-1.4.13/plugins/check_tcp.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 468 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_tcp.c 2008-12-15 22:11:00.000000000 +0100 | ||
| 469 | @@ -102,10 +102,6 @@ | ||
| 470 | size_t len; | ||
| 471 | int match = -1; | ||
| 472 | |||
| 473 | - setlocale (LC_ALL, ""); | ||
| 474 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 475 | - textdomain (PACKAGE); | ||
| 476 | - | ||
| 477 | /* determine program- and service-name quickly */ | ||
| 478 | progname = strrchr(argv[0], '/'); | ||
| 479 | if(progname != NULL) progname++; | ||
| 480 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_time.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_time.c | ||
| 481 | --- nagios-plugins-1.4.13/plugins/check_time.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 482 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_time.c 2008-12-15 22:11:00.000000000 +0100 | ||
| 483 | @@ -71,10 +71,6 @@ | ||
| 484 | int result = STATE_UNKNOWN; | ||
| 485 | time_t conntime; | ||
| 486 | |||
| 487 | - setlocale (LC_ALL, ""); | ||
| 488 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 489 | - textdomain (PACKAGE); | ||
| 490 | - | ||
| 491 | /* Parse extra opts if any */ | ||
| 492 | argv=np_extra_opts (&argc, argv, progname); | ||
| 493 | |||
| 494 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_ups.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_ups.c | ||
| 495 | --- nagios-plugins-1.4.13/plugins/check_ups.c 2008-07-10 12:03:43.000000000 +0200 | ||
| 496 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_ups.c 2008-12-15 22:11:00.000000000 +0100 | ||
| 497 | @@ -111,10 +111,6 @@ | ||
| 498 | double ups_utility_deviation = 0.0; | ||
| 499 | int res; | ||
| 500 | |||
| 501 | - setlocale (LC_ALL, ""); | ||
| 502 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 503 | - textdomain (PACKAGE); | ||
| 504 | - | ||
| 505 | ups_status = strdup ("N/A"); | ||
| 506 | data = strdup (""); | ||
| 507 | message = strdup (""); | ||
| 508 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/check_users.c nagios-plugins-1.4.13-no-buggy-locales/plugins/check_users.c | ||
| 509 | --- nagios-plugins-1.4.13/plugins/check_users.c 2008-05-07 12:02:42.000000000 +0200 | ||
| 510 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/check_users.c 2008-12-15 22:11:01.000000000 +0100 | ||
| 511 | @@ -59,10 +59,6 @@ | ||
| 512 | char input_buffer[MAX_INPUT_BUFFER]; | ||
| 513 | char *perf; | ||
| 514 | |||
| 515 | - setlocale (LC_ALL, ""); | ||
| 516 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 517 | - textdomain (PACKAGE); | ||
| 518 | - | ||
| 519 | perf = strdup(""); | ||
| 520 | |||
| 521 | /* Parse extra opts if any */ | ||
| 522 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/negate.c nagios-plugins-1.4.13-no-buggy-locales/plugins/negate.c | ||
| 523 | --- nagios-plugins-1.4.13/plugins/negate.c 2008-05-02 11:28:15.000000000 +0200 | ||
| 524 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/negate.c 2008-12-15 22:11:01.000000000 +0100 | ||
| 525 | @@ -67,10 +67,6 @@ | ||
| 526 | output chld_out, chld_err; | ||
| 527 | int i; | ||
| 528 | |||
| 529 | - setlocale (LC_ALL, ""); | ||
| 530 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 531 | - textdomain (PACKAGE); | ||
| 532 | - | ||
| 533 | command_line = (char **) process_arguments (argc, argv); | ||
| 534 | |||
| 535 | /* Set signal handling and alarm */ | ||
| 536 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins/urlize.c nagios-plugins-1.4.13-no-buggy-locales/plugins/urlize.c | ||
| 537 | --- nagios-plugins-1.4.13/plugins/urlize.c 2008-01-31 12:27:22.000000000 +0100 | ||
| 538 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins/urlize.c 2008-12-15 22:11:01.000000000 +0100 | ||
| 539 | @@ -67,10 +67,6 @@ | ||
| 540 | {0, 0, 0, 0} | ||
| 541 | }; | ||
| 542 | |||
| 543 | - setlocale (LC_ALL, ""); | ||
| 544 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 545 | - textdomain (PACKAGE); | ||
| 546 | - | ||
| 547 | /* Need at least 2 args */ | ||
| 548 | if (argc < 3) { | ||
| 549 | print_help(); | ||
| 550 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins-root/check_dhcp.c nagios-plugins-1.4.13-no-buggy-locales/plugins-root/check_dhcp.c | ||
| 551 | --- nagios-plugins-1.4.13/plugins-root/check_dhcp.c 2008-07-06 14:57:11.000000000 +0200 | ||
| 552 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins-root/check_dhcp.c 2008-12-15 22:11:01.000000000 +0100 | ||
| 553 | @@ -263,10 +263,6 @@ | ||
| 554 | int dhcp_socket; | ||
| 555 | int result = STATE_UNKNOWN; | ||
| 556 | |||
| 557 | - setlocale (LC_ALL, ""); | ||
| 558 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 559 | - textdomain (PACKAGE); | ||
| 560 | - | ||
| 561 | /* Parse extra opts if any */ | ||
| 562 | argv=np_extra_opts(&argc, argv, progname); | ||
| 563 | |||
| 564 | diff -Naur --exclude '*.orig' nagios-plugins-1.4.13/plugins-root/check_icmp.c nagios-plugins-1.4.13-no-buggy-locales/plugins-root/check_icmp.c | ||
| 565 | --- nagios-plugins-1.4.13/plugins-root/check_icmp.c 2008-08-08 04:08:08.000000000 +0200 | ||
| 566 | +++ nagios-plugins-1.4.13-no-buggy-locales/plugins-root/check_icmp.c 2008-12-15 22:11:01.000000000 +0100 | ||
| 567 | @@ -377,10 +377,6 @@ | ||
| 568 | int result; | ||
| 569 | struct rta_host *host; | ||
| 570 | |||
| 571 | - setlocale (LC_ALL, ""); | ||
| 572 | - bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 573 | - textdomain (PACKAGE); | ||
| 574 | - | ||
| 575 | /* print a helpful error message if geteuid != 0 */ | ||
| 576 | np_warn_if_not_root(); | ||
| 577 | |||
diff --git a/web/attachments/330612-rangesupport.patch b/web/attachments/330612-rangesupport.patch new file mode 100644 index 0000000..b32527a --- /dev/null +++ b/web/attachments/330612-rangesupport.patch | |||
| @@ -0,0 +1,326 @@ | |||
| 1 | diff --git a/plugins/check_nt.c b/plugins/check_nt.c | ||
| 2 | index d038efe..e2b8722 100644 | ||
| 3 | --- a/plugins/check_nt.c | ||
| 4 | +++ b/plugins/check_nt.c | ||
| 5 | @@ -65,8 +65,10 @@ int server_port=PORT; | ||
| 6 | char *value_list=NULL; | ||
| 7 | char *req_password=NULL; | ||
| 8 | unsigned long lvalue_list[MAX_VALUE_LIST]; | ||
| 9 | -unsigned long warning_value=0L; | ||
| 10 | -unsigned long critical_value=0L; | ||
| 11 | +range *warning_value=NULL; | ||
| 12 | +range *critical_value=NULL; | ||
| 13 | +const char *warning_value_string=""; | ||
| 14 | +const char *critical_value_string=""; | ||
| 15 | int check_warning_value=FALSE; | ||
| 16 | int check_critical_value=FALSE; | ||
| 17 | enum checkvars vars_to_check = CHECK_NONE; | ||
| 18 | @@ -81,6 +83,16 @@ int strtoularray(unsigned long *array, char *string, const char *delim); | ||
| 19 | void print_help(void); | ||
| 20 | void print_usage(void); | ||
| 21 | |||
| 22 | +bool allnumeric(const char* number) | ||
| 23 | +{ | ||
| 24 | + int i; | ||
| 25 | + for(i=0; number[i]; i++) | ||
| 26 | + { | ||
| 27 | + if(number[i]<'0'||number[i]>'9'){return false;} | ||
| 28 | + } | ||
| 29 | + return true; | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | int main(int argc, char **argv){ | ||
| 33 | |||
| 34 | /* should be int result = STATE_UNKNOWN; */ | ||
| 35 | @@ -224,8 +236,8 @@ int main(int argc, char **argv){ | ||
| 36 | |||
| 37 | if (total_disk_space>0 && free_disk_space>=0) { | ||
| 38 | percent_used_space = ((total_disk_space - free_disk_space) / total_disk_space) * 100; | ||
| 39 | - warning_used_space = ((float)warning_value / 100) * total_disk_space; | ||
| 40 | - critical_used_space = ((float)critical_value / 100) * total_disk_space; | ||
| 41 | + warning_used_space = ((float)(warning_value?warning_value->end:0) / 100) * total_disk_space; | ||
| 42 | + critical_used_space = ((float)(critical_value?critical_value->end:0) / 100) * total_disk_space; | ||
| 43 | |||
| 44 | asprintf(&temp_string,_("%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)"), | ||
| 45 | value_list, total_disk_space / 1073741824, (total_disk_space - free_disk_space) / 1073741824, | ||
| 46 | @@ -234,12 +246,33 @@ int main(int argc, char **argv){ | ||
| 47 | (total_disk_space - free_disk_space) / 1073741824, warning_used_space / 1073741824, | ||
| 48 | critical_used_space / 1073741824, total_disk_space / 1073741824); | ||
| 49 | |||
| 50 | - if(check_critical_value==TRUE && percent_used_space >= critical_value) | ||
| 51 | - return_code=STATE_CRITICAL; | ||
| 52 | - else if (check_warning_value==TRUE && percent_used_space >= warning_value) | ||
| 53 | - return_code=STATE_WARNING; | ||
| 54 | - else | ||
| 55 | - return_code=STATE_OK; | ||
| 56 | + if(allnumeric(critical_value_string)&&allnumeric(warning_value_string)) | ||
| 57 | + { | ||
| 58 | + if (critical_value > warning_value) | ||
| 59 | + { /* Normal thresholds */ | ||
| 60 | + if (check_critical_value == TRUE && percent_used_space >= critical_value->end) | ||
| 61 | + return_code = STATE_CRITICAL; | ||
| 62 | + else if (check_warning_value == TRUE && percent_used_space >= warning_value->end) | ||
| 63 | + return_code = STATE_WARNING; | ||
| 64 | + else | ||
| 65 | + return_code = STATE_OK; | ||
| 66 | + } | ||
| 67 | + else | ||
| 68 | + { /* inverse thresholds */ | ||
| 69 | + return_code = STATE_OK; | ||
| 70 | + if (check_critical_value == TRUE && percent_used_space <= critical_value->end) | ||
| 71 | + return_code = STATE_CRITICAL; | ||
| 72 | + else if (check_warning_value == TRUE && percent_used_space <= warning_value->end) | ||
| 73 | + return_code = STATE_WARNING; | ||
| 74 | + } | ||
| 75 | + }else{ | ||
| 76 | + if(check_critical_value==TRUE && check_range(percent_used_space, critical_value)) | ||
| 77 | + return_code=STATE_CRITICAL; | ||
| 78 | + else if (check_warning_value==TRUE && check_range(percent_used_space, warning_value)) | ||
| 79 | + return_code=STATE_WARNING; | ||
| 80 | + else | ||
| 81 | + return_code=STATE_OK; | ||
| 82 | + } | ||
| 83 | |||
| 84 | output_message = strdup (temp_string); | ||
| 85 | perfdata = temp_string_perf; | ||
| 86 | @@ -273,8 +306,8 @@ int main(int argc, char **argv){ | ||
| 87 | mem_commitLimit=atof(strtok(recv_buffer,"&")); | ||
| 88 | mem_commitByte=atof(strtok(NULL,"&")); | ||
| 89 | percent_used_space = (mem_commitByte / mem_commitLimit) * 100; | ||
| 90 | - warning_used_space = ((float)warning_value / 100) * mem_commitLimit; | ||
| 91 | - critical_used_space = ((float)critical_value / 100) * mem_commitLimit; | ||
| 92 | + warning_used_space = ((float)(warning_value?warning_value->end:0) / 100) * mem_commitLimit; | ||
| 93 | + critical_used_space = ((float)(warning_value?critical_value->end:0) / 100) * mem_commitLimit; | ||
| 94 | |||
| 95 | /* Divisor should be 1048567, not 3044515, as we are measuring "Commit Charge" here, | ||
| 96 | which equals RAM + Pagefiles. */ | ||
| 97 | @@ -284,12 +317,32 @@ int main(int argc, char **argv){ | ||
| 98 | asprintf(&perfdata,_("'Memory usage'=%.2fMb;%.2f;%.2f;0.00;%.2f"), mem_commitByte / 1048567, | ||
| 99 | warning_used_space / 1048567, critical_used_space / 1048567, mem_commitLimit / 1048567); | ||
| 100 | |||
| 101 | - return_code=STATE_OK; | ||
| 102 | - if(check_critical_value==TRUE && percent_used_space >= critical_value) | ||
| 103 | - return_code=STATE_CRITICAL; | ||
| 104 | - else if (check_warning_value==TRUE && percent_used_space >= warning_value) | ||
| 105 | - return_code=STATE_WARNING; | ||
| 106 | - | ||
| 107 | + if(allnumeric(critical_value_string)&&allnumeric(warning_value_string)) | ||
| 108 | + { | ||
| 109 | + if (critical_value > warning_value) | ||
| 110 | + { /* Normal thresholds */ | ||
| 111 | + if (check_critical_value == TRUE && percent_used_space >= critical_value->end) | ||
| 112 | + return_code = STATE_CRITICAL; | ||
| 113 | + else if (check_warning_value == TRUE && percent_used_space >= warning_value->end) | ||
| 114 | + return_code = STATE_WARNING; | ||
| 115 | + else | ||
| 116 | + return_code = STATE_OK; | ||
| 117 | + } | ||
| 118 | + else | ||
| 119 | + { /* inverse thresholds */ | ||
| 120 | + return_code = STATE_OK; | ||
| 121 | + if (check_critical_value == TRUE && percent_used_space <= critical_value->end) | ||
| 122 | + return_code = STATE_CRITICAL; | ||
| 123 | + else if (check_warning_value == TRUE && percent_used_space <= warning_value->end) | ||
| 124 | + return_code = STATE_WARNING; | ||
| 125 | + } | ||
| 126 | + }else{ | ||
| 127 | + return_code=STATE_OK; | ||
| 128 | + if(check_critical_value==TRUE && check_range(percent_used_space, critical_value)) | ||
| 129 | + return_code=STATE_CRITICAL; | ||
| 130 | + else if (check_warning_value==TRUE && check_range(percent_used_space, warning_value)) | ||
| 131 | + return_code=STATE_WARNING; | ||
| 132 | + } | ||
| 133 | break; | ||
| 134 | |||
| 135 | case CHECK_COUNTER: | ||
| 136 | @@ -373,29 +426,41 @@ int main(int argc, char **argv){ | ||
| 137 | } | ||
| 138 | asprintf (&output_message, "%s |", output_message); | ||
| 139 | asprintf (&output_message,"%s %s", output_message, | ||
| 140 | - fperfdata (description, counter_value, | ||
| 141 | - counter_unit, 1, warning_value, 1, critical_value, | ||
| 142 | + fperfdatarange (description, counter_value, | ||
| 143 | + counter_unit, warning_value_string, critical_value_string, | ||
| 144 | (!(isPercent) && (minval != NULL)), fminval, | ||
| 145 | (!(isPercent) && (minval != NULL)), fmaxval)); | ||
| 146 | } | ||
| 147 | } | ||
| 148 | |||
| 149 | - if (critical_value > warning_value) | ||
| 150 | - { /* Normal thresholds */ | ||
| 151 | - if (check_critical_value == TRUE && counter_value >= critical_value) | ||
| 152 | - return_code = STATE_CRITICAL; | ||
| 153 | - else if (check_warning_value == TRUE && counter_value >= warning_value) | ||
| 154 | - return_code = STATE_WARNING; | ||
| 155 | + if(allnumeric(critical_value_string)&&allnumeric(warning_value_string)) | ||
| 156 | + { | ||
| 157 | + if (critical_value > warning_value) | ||
| 158 | + { /* Normal thresholds */ | ||
| 159 | + if (check_critical_value == TRUE && counter_value >= critical_value->end) | ||
| 160 | + return_code = STATE_CRITICAL; | ||
| 161 | + else if (check_warning_value == TRUE && counter_value >= warning_value->end) | ||
| 162 | + return_code = STATE_WARNING; | ||
| 163 | + else | ||
| 164 | + return_code = STATE_OK; | ||
| 165 | + } | ||
| 166 | else | ||
| 167 | + { /* inverse thresholds */ | ||
| 168 | return_code = STATE_OK; | ||
| 169 | - } | ||
| 170 | - else | ||
| 171 | - { /* inverse thresholds */ | ||
| 172 | - return_code = STATE_OK; | ||
| 173 | - if (check_critical_value == TRUE && counter_value <= critical_value) | ||
| 174 | + if (check_critical_value == TRUE && counter_value <= critical_value->end) | ||
| 175 | + return_code = STATE_CRITICAL; | ||
| 176 | + else if (check_warning_value == TRUE && counter_value <= warning_value->end) | ||
| 177 | + return_code = STATE_WARNING; | ||
| 178 | + } | ||
| 179 | + }else{ | ||
| 180 | + if(check_critical_value == TRUE && check_range(counter_value, critical_value)) | ||
| 181 | + { | ||
| 182 | return_code = STATE_CRITICAL; | ||
| 183 | - else if (check_warning_value == TRUE && counter_value <= warning_value) | ||
| 184 | + }else if(check_warning_value == TRUE && check_range(counter_value, warning_value)) { | ||
| 185 | return_code = STATE_WARNING; | ||
| 186 | + }else{ | ||
| 187 | + return_code = STATE_OK; | ||
| 188 | + } | ||
| 189 | } | ||
| 190 | break; | ||
| 191 | |||
| 192 | @@ -411,21 +476,34 @@ int main(int argc, char **argv){ | ||
| 193 | description = strtok(NULL,"&"); | ||
| 194 | output_message = strdup (description); | ||
| 195 | |||
| 196 | - if (critical_value > warning_value) { /* Normal thresholds */ | ||
| 197 | - if(check_critical_value==TRUE && age_in_minutes >= critical_value) | ||
| 198 | - return_code=STATE_CRITICAL; | ||
| 199 | - else if (check_warning_value==TRUE && age_in_minutes >= warning_value) | ||
| 200 | - return_code=STATE_WARNING; | ||
| 201 | - else | ||
| 202 | - return_code=STATE_OK; | ||
| 203 | - } | ||
| 204 | - else { /* inverse thresholds */ | ||
| 205 | - if(check_critical_value==TRUE && age_in_minutes <= critical_value) | ||
| 206 | - return_code=STATE_CRITICAL; | ||
| 207 | - else if (check_warning_value==TRUE && age_in_minutes <= warning_value) | ||
| 208 | - return_code=STATE_WARNING; | ||
| 209 | + if(allnumeric(critical_value_string)&&allnumeric(warning_value_string)) | ||
| 210 | + { | ||
| 211 | + if (critical_value > warning_value) | ||
| 212 | + { /* Normal thresholds */ | ||
| 213 | + if (check_critical_value == TRUE && age_in_minutes >= critical_value->end) | ||
| 214 | + return_code = STATE_CRITICAL; | ||
| 215 | + else if (check_warning_value == TRUE && age_in_minutes >= warning_value->end) | ||
| 216 | + return_code = STATE_WARNING; | ||
| 217 | + else | ||
| 218 | + return_code = STATE_OK; | ||
| 219 | + } | ||
| 220 | else | ||
| 221 | - return_code=STATE_OK; | ||
| 222 | + { /* inverse thresholds */ | ||
| 223 | + return_code = STATE_OK; | ||
| 224 | + if (check_critical_value == TRUE && age_in_minutes <= critical_value->end) | ||
| 225 | + return_code = STATE_CRITICAL; | ||
| 226 | + else if (check_warning_value == TRUE && age_in_minutes <= warning_value->end) | ||
| 227 | + return_code = STATE_WARNING; | ||
| 228 | + } | ||
| 229 | + }else{ | ||
| 230 | + if(check_critical_value == TRUE && check_range(age_in_minutes, critical_value)) | ||
| 231 | + { | ||
| 232 | + return_code = STATE_CRITICAL; | ||
| 233 | + }else if(check_warning_value == TRUE && check_range(age_in_minutes, warning_value)) { | ||
| 234 | + return_code = STATE_WARNING; | ||
| 235 | + }else{ | ||
| 236 | + return_code = STATE_OK; | ||
| 237 | + } | ||
| 238 | } | ||
| 239 | } | ||
| 240 | break; | ||
| 241 | @@ -563,11 +641,13 @@ int process_arguments(int argc, char **argv){ | ||
| 242 | value_list = optarg; | ||
| 243 | break; | ||
| 244 | case 'w': /* warning threshold */ | ||
| 245 | - warning_value=strtoul(optarg,NULL,10); | ||
| 246 | + warning_value=parse_range_string(optarg); | ||
| 247 | + warning_value_string=optarg; | ||
| 248 | check_warning_value=TRUE; | ||
| 249 | break; | ||
| 250 | case 'c': /* critical threshold */ | ||
| 251 | - critical_value=strtoul(optarg,NULL,10); | ||
| 252 | + critical_value=parse_range_string(optarg); | ||
| 253 | + critical_value_string=optarg; | ||
| 254 | check_critical_value=TRUE; | ||
| 255 | break; | ||
| 256 | case 'd': /* Display select for services */ | ||
| 257 | diff --git a/plugins/utils.c b/plugins/utils.c | ||
| 258 | index 4537390..f4f6433 100644 | ||
| 259 | --- a/plugins/utils.c | ||
| 260 | +++ b/plugins/utils.c | ||
| 261 | @@ -600,3 +600,44 @@ char *fperfdata (const char *label, | ||
| 262 | |||
| 263 | return data; | ||
| 264 | } | ||
| 265 | + | ||
| 266 | +char *fperfdatarange (const char *label, | ||
| 267 | + double val, | ||
| 268 | + const char *uom, | ||
| 269 | + const char *warn, | ||
| 270 | + const char *crit, | ||
| 271 | + int minp, | ||
| 272 | + double minv, | ||
| 273 | + int maxp, | ||
| 274 | + double maxv) | ||
| 275 | +{ | ||
| 276 | + char *data = NULL; | ||
| 277 | + | ||
| 278 | + if (strpbrk (label, "'= ")) | ||
| 279 | + asprintf (&data, "'%s'=", label); | ||
| 280 | + else | ||
| 281 | + asprintf (&data, "%s=", label); | ||
| 282 | + | ||
| 283 | + asprintf (&data, "%s%f", data, val); | ||
| 284 | + asprintf (&data, "%s%s;", data, uom); | ||
| 285 | + | ||
| 286 | + if (warn) | ||
| 287 | + asprintf (&data, "%s%s", data, warn); | ||
| 288 | + | ||
| 289 | + asprintf (&data, "%s;", data); | ||
| 290 | + | ||
| 291 | + if (crit) | ||
| 292 | + asprintf (&data, "%s%s", data, crit); | ||
| 293 | + | ||
| 294 | + asprintf (&data, "%s;", data); | ||
| 295 | + | ||
| 296 | + if (minp) | ||
| 297 | + asprintf (&data, "%s%f", data, minv); | ||
| 298 | + | ||
| 299 | + if (maxp) { | ||
| 300 | + asprintf (&data, "%s;", data); | ||
| 301 | + asprintf (&data, "%s%f", data, maxv); | ||
| 302 | + } | ||
| 303 | + | ||
| 304 | + return data; | ||
| 305 | +} | ||
| 306 | diff --git a/plugins/utils.h b/plugins/utils.h | ||
| 307 | index d6e9c8f..bd8fe1d 100644 | ||
| 308 | --- a/plugins/utils.h | ||
| 309 | +++ b/plugins/utils.h | ||
| 310 | @@ -121,6 +121,16 @@ char *fperfdata (const char *, | ||
| 311 | int, | ||
| 312 | double); | ||
| 313 | |||
| 314 | +char *fperfdatarange (const char *, | ||
| 315 | + double, | ||
| 316 | + const char *, | ||
| 317 | + const char *, | ||
| 318 | + const char *, | ||
| 319 | + int, | ||
| 320 | + double, | ||
| 321 | + int, | ||
| 322 | + double); | ||
| 323 | + | ||
| 324 | /* The idea here is that, although not every plugin will use all of these, | ||
| 325 | most will or should. Therefore, for consistency, these very common | ||
| 326 | options should have only these meanings throughout the overall suite */ | ||
diff --git a/web/attachments/33077-nag.patch b/web/attachments/33077-nag.patch new file mode 100644 index 0000000..a9c1305 --- /dev/null +++ b/web/attachments/33077-nag.patch | |||
| @@ -0,0 +1,470 @@ | |||
| 1 | --- nagiosplug-1.3-beta1/acconfig.h Sun May 26 19:01:09 2002 | ||
| 2 | +++ nagiosplug-1.3-beta1.new/acconfig.h Mon Oct 14 12:21:57 2002 | ||
| 3 | @@ -35,6 +35,7 @@ | ||
| 4 | #undef SSH_COMMAND | ||
| 5 | #undef SWAP_COMMAND | ||
| 6 | #undef SWAP_FORMAT | ||
| 7 | +#undef SWAP_LINE | ||
| 8 | #undef USE_PS_VARS | ||
| 9 | #undef VSZ_COMMAND | ||
| 10 | #undef VSZ_FORMAT | ||
| 11 | --- nagiosplug-1.3-beta1/configure.in Wed Jun 12 20:03:07 2002 | ||
| 12 | +++ nagiosplug-1.3-beta1.new/configure.in Mon Oct 14 11:59:56 2002 | ||
| 13 | @@ -757,14 +757,18 @@ | ||
| 14 | if [swap -l 2>/dev/null | egrep -i "^lswap +path +pri +swaplo +blocks +free +maxswap" >/dev/null] | ||
| 15 | then | ||
| 16 | AC_DEFINE_UNQUOTED(SWAP_FORMAT,[" %*d %*s %*d,%*d %*d %*d %d %d"]) | ||
| 17 | + AC_DEFINE_UNQUOTED(SWAP_LINE,[""]) | ||
| 18 | echo " using IRIX format" | ||
| 19 | elif [swap -l 2>/dev/null | egrep -i "^swapfile +dev +swaplo +blocks +free" >/dev/null] | ||
| 20 | then | ||
| 21 | AC_DEFINE_UNQUOTED(SWAP_FORMAT,["%*s %*[[0-9,-]] %*d %d %d"]) | ||
| 22 | + AC_DEFINE_UNQUOTED(SWAP_LINE,[""]) | ||
| 23 | echo " using Solaris format" | ||
| 24 | fi | ||
| 25 | + | ||
| 26 | + | ||
| 27 | EXTRAS="$EXTRAS check_swap" | ||
| 28 | -elif [swapinfo -k 2>&1 | egrep -i "Device" >/dev/null] | ||
| 29 | +elif [swapinfo -k 2>&1 | egrep -i "^Device" >/dev/null] | ||
| 30 | then | ||
| 31 | echo "found swapinfo command" | ||
| 32 | AC_DEFINE(HAVE_SWAP) | ||
| 33 | @@ -773,8 +777,23 @@ | ||
| 34 | if [swapinfo -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null] | ||
| 35 | then | ||
| 36 | AC_DEFINE_UNQUOTED(SWAP_FORMAT,["%*s %d %*d %d"]) | ||
| 37 | + AC_DEFINE_UNQUOTED(SWAP_LINE,[""]) | ||
| 38 | +dnl AC_DEFINE_UNQUOTED(SWAP_LINE,["Total"]) | ||
| 39 | +dnl Can't exactly test the above, but thought it would be nice. | ||
| 40 | echo " using FreeBSD format" | ||
| 41 | fi | ||
| 42 | +elif [swapinfo 2>&1 | egrep -i "^memory" >/dev/null] | ||
| 43 | +then | ||
| 44 | + echo "found swapinfo command" | ||
| 45 | + AC_DEFINE(HAVE_SWAP) | ||
| 46 | + AC_PATH_PROG(PATH_TO_SWAP,swapinfo) | ||
| 47 | + AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$PATH_TO_SWAP") | ||
| 48 | + if [swapinfo 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE +USED" >/dev/null] | ||
| 49 | + then | ||
| 50 | + AC_DEFINE_UNQUOTED(SWAP_FORMAT,["%*s %d %*d %d"]) | ||
| 51 | + AC_DEFINE_UNQUOTED(SWAP_LINE,["memory"]) | ||
| 52 | + echo " using HP-UX format" | ||
| 53 | + fi | ||
| 54 | EXTRAS="$EXTRAS check_swap" | ||
| 55 | fi | ||
| 56 | |||
| 57 | --- nagiosplug-1.3-beta1/plugins/check_swap.c Wed Feb 27 22:42:59 2002 | ||
| 58 | +++ nagiosplug-1.3-beta1.new/plugins/check_swap.c Mon Oct 14 12:00:18 2002 | ||
| 59 | @@ -64,6 +64,7 @@ | ||
| 60 | fclose (fp); | ||
| 61 | #else | ||
| 62 | #ifdef HAVE_SWAP | ||
| 63 | + | ||
| 64 | child_process = spopen (SWAP_COMMAND); | ||
| 65 | if (child_process == NULL) { | ||
| 66 | printf ("Could not open pipe: %s\n", SWAP_COMMAND); | ||
| 67 | @@ -92,17 +93,19 @@ | ||
| 68 | |||
| 69 | status = ssprintf (status, "%s", "Swap used:"); | ||
| 70 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 71 | - sscanf (input_buffer, SWAP_FORMAT, &total_swap, &free_swap); | ||
| 72 | - used_swap = total_swap - free_swap; | ||
| 73 | - percent_used = 100 * ((float) used_swap) / ((float) total_swap); | ||
| 74 | - status = ssprintf | ||
| 75 | - (status, | ||
| 76 | - "%s %2d%% (%d bytes out of %d)", | ||
| 77 | - status, percent_used, used_swap, total_swap); | ||
| 78 | - if (percent_used >= crit_percent || free_swap <= crit_size) | ||
| 79 | - result = STATE_CRITICAL; | ||
| 80 | - else if (percent_used >= warn_percent || free_swap <= warn_size) | ||
| 81 | - result = STATE_WARNING; | ||
| 82 | + if (strstr (input_buffer, SWAP_LINE)) { | ||
| 83 | + sscanf (input_buffer, SWAP_FORMAT, &total_swap, &free_swap); | ||
| 84 | + used_swap = total_swap - free_swap; | ||
| 85 | + percent_used = 100 * ((float) used_swap) / ((float) total_swap); | ||
| 86 | + status = ssprintf | ||
| 87 | + (status, | ||
| 88 | + "%s %2d%% (%d bytes out of %d)", | ||
| 89 | + status, percent_used, used_swap, total_swap); | ||
| 90 | + if (percent_used >= crit_percent || free_swap <= crit_size) | ||
| 91 | + result = STATE_CRITICAL; | ||
| 92 | + else if (percent_used >= warn_percent || free_swap <= warn_size) | ||
| 93 | + result = STATE_WARNING; | ||
| 94 | + } | ||
| 95 | } | ||
| 96 | |||
| 97 | /* If we get anything on STDERR, at least set warning */ | ||
| 98 | --- nagiosplug-1.3-beta1/plugins/config.h.in Thu Jun 13 07:02:16 2002 | ||
| 99 | +++ nagiosplug-1.3-beta1.new/plugins/config.h.in Mon Oct 14 12:10:37 2002 | ||
| 100 | @@ -1,54 +1,4 @@ | ||
| 101 | -/* plugins/config.h.in. Generated automatically from configure.in by autoheader. */ | ||
| 102 | - | ||
| 103 | -/* Define to empty if the keyword does not work. */ | ||
| 104 | -#undef const | ||
| 105 | - | ||
| 106 | -/* Define for DGUX with <sys/dg_sys_info.h>. */ | ||
| 107 | -#undef DGUX | ||
| 108 | - | ||
| 109 | -/* Define if the `getloadavg' function needs to be run setuid or setgid. */ | ||
| 110 | -#undef GETLOADAVG_PRIVILEGED | ||
| 111 | - | ||
| 112 | -/* Define if your system has its own `getloadavg' function. */ | ||
| 113 | -#undef HAVE_GETLOADAVG | ||
| 114 | - | ||
| 115 | -/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ | ||
| 116 | -#undef HAVE_SYS_WAIT_H | ||
| 117 | - | ||
| 118 | -/* Define if your struct nlist has an n_un member. */ | ||
| 119 | -#undef NLIST_NAME_UNION | ||
| 120 | - | ||
| 121 | -/* Define if you have <nlist.h>. */ | ||
| 122 | -#undef NLIST_STRUCT | ||
| 123 | - | ||
| 124 | -/* Define to `int' if <sys/types.h> doesn't define. */ | ||
| 125 | -#undef pid_t | ||
| 126 | - | ||
| 127 | -/* Define as the return type of signal handlers (int or void). */ | ||
| 128 | -#undef RETSIGTYPE | ||
| 129 | - | ||
| 130 | -/* Define to `unsigned' if <sys/types.h> doesn't define. */ | ||
| 131 | -#undef size_t | ||
| 132 | - | ||
| 133 | -/* Define if you have the ANSI C header files. */ | ||
| 134 | -#undef STDC_HEADERS | ||
| 135 | - | ||
| 136 | -/* Define on System V Release 4. */ | ||
| 137 | -#undef SVR4 | ||
| 138 | - | ||
| 139 | -/* Define if you can safely include both <sys/time.h> and <time.h>. */ | ||
| 140 | -#undef TIME_WITH_SYS_TIME | ||
| 141 | - | ||
| 142 | -/* Define if your <sys/time.h> declares struct tm. */ | ||
| 143 | -#undef TM_IN_SYS_TIME | ||
| 144 | - | ||
| 145 | -/* Define for Encore UMAX. */ | ||
| 146 | -#undef UMAX | ||
| 147 | - | ||
| 148 | -/* Define for Encore UMAX 4.3 that has <inq_status/cpustats.h> | ||
| 149 | - instead of <sys/cpustats.h>. */ | ||
| 150 | -#undef UMAX4_3 | ||
| 151 | - | ||
| 152 | +/* plugins/config.h.in. Generated from configure.in by autoheader. */ | ||
| 153 | #undef CGIURL | ||
| 154 | #undef DF_COMMAND | ||
| 155 | #undef HAVE_GETOPT_H | ||
| 156 | @@ -86,6 +36,7 @@ | ||
| 157 | #undef SSH_COMMAND | ||
| 158 | #undef SWAP_COMMAND | ||
| 159 | #undef SWAP_FORMAT | ||
| 160 | +#undef SWAP_LINE | ||
| 161 | #undef USE_PS_VARS | ||
| 162 | #undef VSZ_COMMAND | ||
| 163 | #undef VSZ_FORMAT | ||
| 164 | @@ -93,137 +44,230 @@ | ||
| 165 | #undef PACKAGE | ||
| 166 | #undef VERSION | ||
| 167 | |||
| 168 | -/* Define if you have the getloadavg function. */ | ||
| 169 | -#undef HAVE_GETLOADAVG | ||
| 170 | +/* Define to 1 if using `getloadavg.c'. */ | ||
| 171 | +#undef C_GETLOADAVG | ||
| 172 | |||
| 173 | -/* Define if you have the getopt_long_only function. */ | ||
| 174 | -#undef HAVE_GETOPT_LONG_ONLY | ||
| 175 | +/* Define to 1 for DGUX with <sys/dg_sys_info.h>. */ | ||
| 176 | +#undef DGUX | ||
| 177 | |||
| 178 | -/* Define if you have the select function. */ | ||
| 179 | -#undef HAVE_SELECT | ||
| 180 | +/* Define to 1 if the `getloadavg' function needs to be run setuid or setgid. | ||
| 181 | + */ | ||
| 182 | +#undef GETLOADAVG_PRIVILEGED | ||
| 183 | |||
| 184 | -/* Define if you have the socket function. */ | ||
| 185 | -#undef HAVE_SOCKET | ||
| 186 | +/* Define to 1 if you have the <crypto.h> header file. */ | ||
| 187 | +#undef HAVE_CRYPTO_H | ||
| 188 | |||
| 189 | -/* Define if you have the strdup function. */ | ||
| 190 | -#undef HAVE_STRDUP | ||
| 191 | +/* Define to 1 if you have the <errno.h> header file. */ | ||
| 192 | +#undef HAVE_ERRNO_H | ||
| 193 | |||
| 194 | -/* Define if you have the strstr function. */ | ||
| 195 | -#undef HAVE_STRSTR | ||
| 196 | +/* Define to 1 if you have the <err.h> header file. */ | ||
| 197 | +#undef HAVE_ERR_H | ||
| 198 | |||
| 199 | -/* Define if you have the strtod function. */ | ||
| 200 | -#undef HAVE_STRTOD | ||
| 201 | +/* Define to 1 if you have the `getloadavg' function. */ | ||
| 202 | +#undef HAVE_GETLOADAVG | ||
| 203 | |||
| 204 | -/* Define if you have the strtol function. */ | ||
| 205 | -#undef HAVE_STRTOL | ||
| 206 | +/* Define to 1 if you have the `getopt_long_only' function. */ | ||
| 207 | +#undef HAVE_GETOPT_LONG_ONLY | ||
| 208 | |||
| 209 | -/* Define if you have the strtoul function. */ | ||
| 210 | -#undef HAVE_STRTOUL | ||
| 211 | +/* Define to 1 if you have the <inttypes.h> header file. */ | ||
| 212 | +#undef HAVE_INTTYPES_H | ||
| 213 | |||
| 214 | -/* Define if you have the <crypto.h> header file. */ | ||
| 215 | -#undef HAVE_CRYPTO_H | ||
| 216 | +/* Define to 1 if you have the `crypt' library (-lcrypt). */ | ||
| 217 | +#undef HAVE_LIBCRYPT | ||
| 218 | |||
| 219 | -/* Define if you have the <err.h> header file. */ | ||
| 220 | -#undef HAVE_ERR_H | ||
| 221 | +/* Define to 1 if you have the `crypto' library (-lcrypto). */ | ||
| 222 | +#undef HAVE_LIBCRYPTO | ||
| 223 | |||
| 224 | -/* Define if you have the <errno.h> header file. */ | ||
| 225 | -#undef HAVE_ERRNO_H | ||
| 226 | +/* Define to 1 if you have the `dgc' library (-ldgc). */ | ||
| 227 | +#undef HAVE_LIBDGC | ||
| 228 | + | ||
| 229 | +/* Define to 1 if you have the `kstat' library (-lkstat). */ | ||
| 230 | +#undef HAVE_LIBKSTAT | ||
| 231 | + | ||
| 232 | +/* Define to 1 if you have the `ldap' library (-lldap). */ | ||
| 233 | +#undef HAVE_LIBLDAP | ||
| 234 | + | ||
| 235 | +/* Define to 1 if you have the `pq' library (-lpq). */ | ||
| 236 | +#undef HAVE_LIBPQ | ||
| 237 | |||
| 238 | -/* Define if you have the <libpq-fe.h> header file. */ | ||
| 239 | +/* Define to 1 if you have the <libpq-fe.h> header file. */ | ||
| 240 | #undef HAVE_LIBPQ_FE_H | ||
| 241 | |||
| 242 | -/* Define if you have the <mach/mach.h> header file. */ | ||
| 243 | +/* Define to 1 if you have the `radiusclient' library (-lradiusclient). */ | ||
| 244 | +#undef HAVE_LIBRADIUSCLIENT | ||
| 245 | + | ||
| 246 | +/* Define to 1 if you have the <mach/mach.h> header file. */ | ||
| 247 | #undef HAVE_MACH_MACH_H | ||
| 248 | |||
| 249 | -/* Define if you have the <mysql/errmsg.h> header file. */ | ||
| 250 | +/* Define to 1 if you have the <memory.h> header file. */ | ||
| 251 | +#undef HAVE_MEMORY_H | ||
| 252 | + | ||
| 253 | +/* Define to 1 if you have the <mysql/errmsg.h> header file. */ | ||
| 254 | #undef HAVE_MYSQL_ERRMSG_H | ||
| 255 | |||
| 256 | -/* Define if you have the <mysql/mysql.h> header file. */ | ||
| 257 | +/* Define to 1 if you have the <mysql/mysql.h> header file. */ | ||
| 258 | #undef HAVE_MYSQL_MYSQL_H | ||
| 259 | |||
| 260 | -/* Define if you have the <openssl/crypto.h> header file. */ | ||
| 261 | +/* Define to 1 if you have the <nlist.h> header file. */ | ||
| 262 | +#undef HAVE_NLIST_H | ||
| 263 | + | ||
| 264 | +/* Define to 1 if you have the <openssl/crypto.h> header file. */ | ||
| 265 | #undef HAVE_OPENSSL_CRYPTO_H | ||
| 266 | |||
| 267 | -/* Define if you have the <openssl/err.h> header file. */ | ||
| 268 | +/* Define to 1 if you have the <openssl/err.h> header file. */ | ||
| 269 | #undef HAVE_OPENSSL_ERR_H | ||
| 270 | |||
| 271 | -/* Define if you have the <openssl/pem.h> header file. */ | ||
| 272 | +/* Define to 1 if you have the <openssl/pem.h> header file. */ | ||
| 273 | #undef HAVE_OPENSSL_PEM_H | ||
| 274 | |||
| 275 | -/* Define if you have the <openssl/rsa.h> header file. */ | ||
| 276 | +/* Define to 1 if you have the <openssl/rsa.h> header file. */ | ||
| 277 | #undef HAVE_OPENSSL_RSA_H | ||
| 278 | |||
| 279 | -/* Define if you have the <openssl/ssl.h> header file. */ | ||
| 280 | +/* Define to 1 if you have the <openssl/ssl.h> header file. */ | ||
| 281 | #undef HAVE_OPENSSL_SSL_H | ||
| 282 | |||
| 283 | -/* Define if you have the <openssl/x509.h> header file. */ | ||
| 284 | +/* Define to 1 if you have the <openssl/x509.h> header file. */ | ||
| 285 | #undef HAVE_OPENSSL_X509_H | ||
| 286 | |||
| 287 | -/* Define if you have the <pem.h> header file. */ | ||
| 288 | +/* Define to 1 if you have the <pem.h> header file. */ | ||
| 289 | #undef HAVE_PEM_H | ||
| 290 | |||
| 291 | -/* Define if you have the <pgsql/libpq-fe.h> header file. */ | ||
| 292 | +/* Define to 1 if you have the <pgsql/libpq-fe.h> header file. */ | ||
| 293 | #undef HAVE_PGSQL_LIBPQ_FE_H | ||
| 294 | |||
| 295 | -/* Define if you have the <postgresql/libpq-fe.h> header file. */ | ||
| 296 | +/* Define to 1 if you have the <postgresql/libpq-fe.h> header file. */ | ||
| 297 | #undef HAVE_POSTGRESQL_LIBPQ_FE_H | ||
| 298 | |||
| 299 | -/* Define if you have the <regex.h> header file. */ | ||
| 300 | +/* Define to 1 if you have the `pstat_getdynamic' function. */ | ||
| 301 | +#undef HAVE_PSTAT_GETDYNAMIC | ||
| 302 | + | ||
| 303 | +/* Define to 1 if you have the <regex.h> header file. */ | ||
| 304 | #undef HAVE_REGEX_H | ||
| 305 | |||
| 306 | -/* Define if you have the <rsa.h> header file. */ | ||
| 307 | +/* Define to 1 if you have the <rsa.h> header file. */ | ||
| 308 | #undef HAVE_RSA_H | ||
| 309 | |||
| 310 | -/* Define if you have the <signal.h> header file. */ | ||
| 311 | +/* Define to 1 if you have the `select' function. */ | ||
| 312 | +#undef HAVE_SELECT | ||
| 313 | + | ||
| 314 | +/* Define to 1 if you have the `setlocale' function. */ | ||
| 315 | +#undef HAVE_SETLOCALE | ||
| 316 | + | ||
| 317 | +/* Define to 1 if you have the <signal.h> header file. */ | ||
| 318 | #undef HAVE_SIGNAL_H | ||
| 319 | |||
| 320 | -/* Define if you have the <ssl.h> header file. */ | ||
| 321 | +/* Define to 1 if you have the `socket' function. */ | ||
| 322 | +#undef HAVE_SOCKET | ||
| 323 | + | ||
| 324 | +/* Define to 1 if you have the <ssl.h> header file. */ | ||
| 325 | #undef HAVE_SSL_H | ||
| 326 | |||
| 327 | -/* Define if you have the <string.h> header file. */ | ||
| 328 | -#undef HAVE_STRING_H | ||
| 329 | +/* Define to 1 if you have the <stdint.h> header file. */ | ||
| 330 | +#undef HAVE_STDINT_H | ||
| 331 | + | ||
| 332 | +/* Define to 1 if you have the <stdlib.h> header file. */ | ||
| 333 | +#undef HAVE_STDLIB_H | ||
| 334 | |||
| 335 | -/* Define if you have the <strings.h> header file. */ | ||
| 336 | +/* Define to 1 if you have the `strdup' function. */ | ||
| 337 | +#undef HAVE_STRDUP | ||
| 338 | + | ||
| 339 | +/* Define to 1 if you have the <strings.h> header file. */ | ||
| 340 | #undef HAVE_STRINGS_H | ||
| 341 | |||
| 342 | -/* Define if you have the <sys/loadavg.h> header file. */ | ||
| 343 | +/* Define to 1 if you have the <string.h> header file. */ | ||
| 344 | +#undef HAVE_STRING_H | ||
| 345 | + | ||
| 346 | +/* Define to 1 if you have the `strstr' function. */ | ||
| 347 | +#undef HAVE_STRSTR | ||
| 348 | + | ||
| 349 | +/* Define to 1 if you have the `strtod' function. */ | ||
| 350 | +#undef HAVE_STRTOD | ||
| 351 | + | ||
| 352 | +/* Define to 1 if you have the `strtol' function. */ | ||
| 353 | +#undef HAVE_STRTOL | ||
| 354 | + | ||
| 355 | +/* Define to 1 if you have the `strtoul' function. */ | ||
| 356 | +#undef HAVE_STRTOUL | ||
| 357 | + | ||
| 358 | +/* Define to 1 if `n_un.n_name' is member of `struct nlist'. */ | ||
| 359 | +#undef HAVE_STRUCT_NLIST_N_UN_N_NAME | ||
| 360 | + | ||
| 361 | +/* Define to 1 if you have the <syslog.h> header file. */ | ||
| 362 | +#undef HAVE_SYSLOG_H | ||
| 363 | + | ||
| 364 | +/* Define to 1 if you have the <sys/loadavg.h> header file. */ | ||
| 365 | #undef HAVE_SYS_LOADAVG_H | ||
| 366 | |||
| 367 | -/* Define if you have the <sys/socket.h> header file. */ | ||
| 368 | +/* Define to 1 if you have the <sys/socket.h> header file. */ | ||
| 369 | #undef HAVE_SYS_SOCKET_H | ||
| 370 | |||
| 371 | -/* Define if you have the <sys/time.h> header file. */ | ||
| 372 | +/* Define to 1 if you have the <sys/stat.h> header file. */ | ||
| 373 | +#undef HAVE_SYS_STAT_H | ||
| 374 | + | ||
| 375 | +/* Define to 1 if you have the <sys/time.h> header file. */ | ||
| 376 | #undef HAVE_SYS_TIME_H | ||
| 377 | |||
| 378 | -/* Define if you have the <sys/types.h> header file. */ | ||
| 379 | +/* Define to 1 if you have the <sys/types.h> header file. */ | ||
| 380 | #undef HAVE_SYS_TYPES_H | ||
| 381 | |||
| 382 | -/* Define if you have the <syslog.h> header file. */ | ||
| 383 | -#undef HAVE_SYSLOG_H | ||
| 384 | +/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ | ||
| 385 | +#undef HAVE_SYS_WAIT_H | ||
| 386 | |||
| 387 | -/* Define if you have the <uio.h> header file. */ | ||
| 388 | +/* Define to 1 if you have the <uio.h> header file. */ | ||
| 389 | #undef HAVE_UIO_H | ||
| 390 | |||
| 391 | -/* Define if you have the <unistd.h> header file. */ | ||
| 392 | +/* Define to 1 if you have the <unistd.h> header file. */ | ||
| 393 | #undef HAVE_UNISTD_H | ||
| 394 | |||
| 395 | -/* Define if you have the <x509.h> header file. */ | ||
| 396 | +/* Define to 1 if you have the <x509.h> header file. */ | ||
| 397 | #undef HAVE_X509_H | ||
| 398 | |||
| 399 | -/* Define if you have the crypt library (-lcrypt). */ | ||
| 400 | -#undef HAVE_LIBCRYPT | ||
| 401 | +/* Define to 1 if your `struct nlist' has an `n_un' member. Obsolete, depend | ||
| 402 | + on `HAVE_STRUCT_NLIST_N_UN_N_NAME */ | ||
| 403 | +#undef NLIST_NAME_UNION | ||
| 404 | |||
| 405 | -/* Define if you have the crypto library (-lcrypto). */ | ||
| 406 | -#undef HAVE_LIBCRYPTO | ||
| 407 | +/* Define to the address where bug reports for this package should be sent. */ | ||
| 408 | +#undef PACKAGE_BUGREPORT | ||
| 409 | |||
| 410 | -/* Define if you have the dgc library (-ldgc). */ | ||
| 411 | -#undef HAVE_LIBDGC | ||
| 412 | +/* Define to the full name of this package. */ | ||
| 413 | +#undef PACKAGE_NAME | ||
| 414 | |||
| 415 | -/* Define if you have the ldap library (-lldap). */ | ||
| 416 | -#undef HAVE_LIBLDAP | ||
| 417 | +/* Define to the full name and version of this package. */ | ||
| 418 | +#undef PACKAGE_STRING | ||
| 419 | |||
| 420 | -/* Define if you have the pq library (-lpq). */ | ||
| 421 | -#undef HAVE_LIBPQ | ||
| 422 | +/* Define to the one symbol short name of this package. */ | ||
| 423 | +#undef PACKAGE_TARNAME | ||
| 424 | |||
| 425 | -/* Define if you have the radiusclient library (-lradiusclient). */ | ||
| 426 | -#undef HAVE_LIBRADIUSCLIENT | ||
| 427 | +/* Define to the version of this package. */ | ||
| 428 | +#undef PACKAGE_VERSION | ||
| 429 | + | ||
| 430 | +/* Define as the return type of signal handlers (`int' or `void'). */ | ||
| 431 | +#undef RETSIGTYPE | ||
| 432 | + | ||
| 433 | +/* Define to 1 if you have the ANSI C header files. */ | ||
| 434 | +#undef STDC_HEADERS | ||
| 435 | + | ||
| 436 | +/* Define to 1 on System V Release 4. */ | ||
| 437 | +#undef SVR4 | ||
| 438 | + | ||
| 439 | +/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ | ||
| 440 | +#undef TIME_WITH_SYS_TIME | ||
| 441 | + | ||
| 442 | +/* Define to 1 if your <sys/time.h> declares `struct tm'. */ | ||
| 443 | +#undef TM_IN_SYS_TIME | ||
| 444 | + | ||
| 445 | +/* Define to 1 for Encore UMAX. */ | ||
| 446 | +#undef UMAX | ||
| 447 | + | ||
| 448 | +/* Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h> instead of | ||
| 449 | + <sys/cpustats.h>. */ | ||
| 450 | +#undef UMAX4_3 | ||
| 451 | + | ||
| 452 | +/* Define to empty if `const' does not conform to ANSI C. */ | ||
| 453 | +#undef const | ||
| 454 | + | ||
| 455 | +/* Define to `int' if <sys/types.h> does not define. */ | ||
| 456 | +#undef pid_t | ||
| 457 | + | ||
| 458 | +/* Define to `unsigned' if <sys/types.h> does not define. */ | ||
| 459 | +#undef size_t | ||
| 460 | --- nagiosplug-1.3-beta1/plugins/snprintf.c Wed Feb 27 22:42:59 2002 | ||
| 461 | +++ nagiosplug-1.3-beta1.new/plugins/snprintf.c Mon Oct 14 12:15:27 2002 | ||
| 462 | @@ -34,7 +34,7 @@ | ||
| 463 | |||
| 464 | /* Some changes made by bbraun@synack.net for use with xinetd */ | ||
| 465 | |||
| 466 | -#if !defined(HAVE_SNPRINTF) | ||
| 467 | +#if defined(HAVE_SNPRINTF) | ||
| 468 | |||
| 469 | /* Extracted from sendmail 8.8.5 */ | ||
| 470 | #ifndef lint | ||
diff --git a/web/attachments/331884-http_compliance.patch b/web/attachments/331884-http_compliance.patch new file mode 100644 index 0000000..b2e3e44 --- /dev/null +++ b/web/attachments/331884-http_compliance.patch | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | diff --git a/plugins/check_http.c b/plugins/check_http.c | ||
| 2 | index 79f6adf..a66ee9a 100644 | ||
| 3 | --- a/plugins/check_http.c | ||
| 4 | +++ b/plugins/check_http.c | ||
| 5 | @@ -802,11 +802,11 @@ check_http (void) | ||
| 6 | |||
| 7 | asprintf (&buf, "%s %s %s\r\n%s\r\n", http_method, server_url, host_name ? "H | ||
| 8 | |||
| 9 | - /* tell HTTP/1.1 servers not to keep the connection alive */ | ||
| 10 | - asprintf (&buf, "%sConnection: close\r\n", buf); | ||
| 11 | - | ||
| 12 | /* optionally send the host header info */ | ||
| 13 | if (host_name) { | ||
| 14 | + /* tell HTTP/1.1 servers not to keep the connection alive */ | ||
| 15 | + asprintf (&buf, "%sConnection: close\r\n", buf); | ||
| 16 | + | ||
| 17 | /* | ||
| 18 | * Specify the port only if we're using a non-default port (see RFC 2616, | ||
| 19 | * 14.23). Some server applications/configurations cause trouble if the | ||
diff --git a/web/attachments/332433-check_linux_raid__lenny_md10+_mn.diff b/web/attachments/332433-check_linux_raid__lenny_md10+_mn.diff new file mode 100644 index 0000000..db7b920 --- /dev/null +++ b/web/attachments/332433-check_linux_raid__lenny_md10+_mn.diff | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | --- /usr/lib/nagios/plugins/check_linux_raid.org 2009-06-25 19:06:27.000000000 +0200 | ||
| 2 | +++ /usr/lib/nagios/plugins/check_linux_raid 2009-06-25 19:16:45.000000000 +0200 | ||
| 3 | @@ -44,7 +44,7 @@ | ||
| 4 | |||
| 5 | my $nextdev; | ||
| 6 | if(defined $ARGV[0]) { $nextdev = shift; } | ||
| 7 | -else { $nextdev = "md[0-9]"; } | ||
| 8 | +else { $nextdev = "md[0-9]+"; } | ||
| 9 | |||
| 10 | my $code = "UNKNOWN"; | ||
| 11 | my $msg = ""; | ||
diff --git a/web/attachments/332975-check_asterisk.pl.diff b/web/attachments/332975-check_asterisk.pl.diff new file mode 100644 index 0000000..3bc7584 --- /dev/null +++ b/web/attachments/332975-check_asterisk.pl.diff | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | --- check_asterisk.orig.pl 2009-06-25 16:58:44.000000000 -0500 | ||
| 2 | +++ check_asterisk.pl 2009-06-25 16:55:44.000000000 -0500 | ||
| 3 | @@ -16,6 +16,7 @@ | ||
| 4 | $runmode, | ||
| 5 | $key, | ||
| 6 | $s, | ||
| 7 | + $p, | ||
| 8 | ); | ||
| 9 | my $stop = 0; | ||
| 10 | my $mgr_port = 5038; | ||
| 11 | @@ -178,6 +179,23 @@ | ||
| 12 | undef($s); | ||
| 13 | foreach $key (keys %channels) { | ||
| 14 | $s .= " " . $key . " (" . $channels{$key} . ")"; | ||
| 15 | + | ||
| 16 | + # Performance | ||
| 17 | + if (defined($p)) { | ||
| 18 | + $p .= " "; | ||
| 19 | + } | ||
| 20 | + $p .= $key . "=" . $channels{$key}; | ||
| 21 | + if (defined($warnval{$key})) { | ||
| 22 | + $p .= ";" . $warnval{$key}; | ||
| 23 | + } else { | ||
| 24 | + $p .= ";"; | ||
| 25 | + } | ||
| 26 | + if (defined($critval{$key})) { | ||
| 27 | + $p .= ";" . $critval{$key}; | ||
| 28 | + } else { | ||
| 29 | + $p .= ";"; | ||
| 30 | + } | ||
| 31 | + $p .= ";0"; | ||
| 32 | } | ||
| 33 | |||
| 34 | foreach $key (keys %critval) { | ||
| 35 | @@ -214,6 +232,8 @@ | ||
| 36 | } | ||
| 37 | |||
| 38 | print $cause; | ||
| 39 | + print "|"; | ||
| 40 | + print $p; | ||
| 41 | |||
| 42 | print "\n" if ($verbose); | ||
| 43 | |||
| 44 | |||
diff --git a/web/attachments/338026-0001-Attempt-at-detecting-64bit-compilation-flags-between.patch b/web/attachments/338026-0001-Attempt-at-detecting-64bit-compilation-flags-between.patch new file mode 100644 index 0000000..f31f482 --- /dev/null +++ b/web/attachments/338026-0001-Attempt-at-detecting-64bit-compilation-flags-between.patch | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | From 182964c5f6ca39f42f5225bc76f48a185eda04b8 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Thomas Guyot-Sionnest <dermoth@aei.ca> | ||
| 3 | Date: Wed, 5 Aug 2009 01:32:02 -0400 | ||
| 4 | Subject: [PATCH] Attempt at detecting 64bit compilation flags between gcc, old, and new versions of sun cc | ||
| 5 | |||
| 6 | Gcc accepts -m64, just as newer version of Suncc. | ||
| 7 | Older Suncc required -xarch=v9 (SPARC) or -xarch=amd64 (x86-64) to generate 64bit code. | ||
| 8 | --- | ||
| 9 | configure.in | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- | ||
| 10 | 1 files changed, 58 insertions(+), 2 deletions(-) | ||
| 11 | |||
| 12 | diff --git a/configure.in b/configure.in | ||
| 13 | index 68ac0a0..197b88e 100644 | ||
| 14 | --- a/configure.in | ||
| 15 | +++ b/configure.in | ||
| 16 | @@ -577,14 +577,70 @@ elif test "$ac_cv_uname_s" = "SunOS"; then | ||
| 17 | ac_cv_ps_cols=9 | ||
| 18 | AC_MSG_RESULT([using nagios-plugins internal ps command (pst3) for solaris]) | ||
| 19 | if test `isainfo -b` = 64 ; then | ||
| 20 | - PST3CFLAGS="-m64" | ||
| 21 | - AC_SUBST(PST3CFLAGS) | ||
| 22 | + pst3_use_64bit=1 | ||
| 23 | AC_MSG_NOTICE([using 64bit pst3]) | ||
| 24 | else | ||
| 25 | AC_MSG_NOTICE([using 32bit pst3]) | ||
| 26 | fi | ||
| 27 | EXTRAS_ROOT="$EXTRAS_ROOT pst3" | ||
| 28 | |||
| 29 | + if test "$pst3_use_64bit" = 1; then | ||
| 30 | + dnl Test if we can actually compile code in 64bit | ||
| 31 | + old_cflags=$CFLAGS | ||
| 32 | + CFLAGS="$CFLAGS -m64" | ||
| 33 | + pst3_64bit_working=0 | ||
| 34 | + AC_RUN_IFELSE( | ||
| 35 | + [AC_LANG_PROGRAM([], [ | ||
| 36 | +return sizeof(void*) == 8 ? 0 : 1; | ||
| 37 | + ]) | ||
| 38 | + ],[ | ||
| 39 | + PST3CFLAGS="-m64" | ||
| 40 | + AC_SUBST(PST3CFLAGS) | ||
| 41 | + pst3_64bit_working=1 | ||
| 42 | + ],[ | ||
| 43 | + pst3_64bit_working=0 | ||
| 44 | + AC_MSG_NOTICE([compiler do not like -m64]) | ||
| 45 | + ]) | ||
| 46 | + CFLAGS=$old_cflags | ||
| 47 | + if test "$pst3_64bit_working" = 0; then | ||
| 48 | + old_cflags=$CFLAGS | ||
| 49 | + CFLAGS="$CFLAGS -xarch=v9" | ||
| 50 | + AC_RUN_IFELSE( | ||
| 51 | + [AC_LANG_PROGRAM([], [ | ||
| 52 | +return sizeof(void*) == 8 ? 0 : 1; | ||
| 53 | + ]) | ||
| 54 | + ],[ | ||
| 55 | + PST3CFLAGS="-xarch=v9" | ||
| 56 | + AC_SUBST(PST3CFLAGS) | ||
| 57 | + pst3_64bit_working=1 | ||
| 58 | + ],[ | ||
| 59 | + pst3_64bit_working=0 | ||
| 60 | + AC_MSG_NOTICE([compiler do not like -xarch=v9]) | ||
| 61 | + ]) | ||
| 62 | + CFLAGS=$old_cflags | ||
| 63 | + fi | ||
| 64 | + if test "$pst3_64bit_working" = 0; then | ||
| 65 | + old_cflags=$CFLAGS | ||
| 66 | + CFLAGS="$CFLAGS -xarch=amd64" | ||
| 67 | + AC_RUN_IFELSE( | ||
| 68 | + [AC_LANG_PROGRAM([], [ | ||
| 69 | +return sizeof(void*) == 8 ? 0 : 1; | ||
| 70 | + ]) | ||
| 71 | + ],[ | ||
| 72 | + PST3CFLAGS="-xarch=amd64" | ||
| 73 | + AC_SUBST(PST3CFLAGS) | ||
| 74 | + pst3_64bit_working=1 | ||
| 75 | + ],[ | ||
| 76 | + pst3_64bit_working=0 | ||
| 77 | + AC_MSG_NOTICE([compiler do not like -xarch=amd64]) | ||
| 78 | + ]) | ||
| 79 | + CFLAGS=$old_cflags | ||
| 80 | + fi | ||
| 81 | + if test "$pst3_64bit_working" = 0; then | ||
| 82 | + AC_MSG_ERROR([Don't know how to build a 64-bit object.]) | ||
| 83 | + fi | ||
| 84 | + fi | ||
| 85 | + | ||
| 86 | dnl Removing this for the moment - Ton | ||
| 87 | dnl Using /usr/ucb/ps on Solaris systems, to avoid truncation | ||
| 88 | dnl Limitation that command name is not available | ||
| 89 | -- | ||
| 90 | 1.5.5 | ||
| 91 | |||
diff --git a/web/attachments/338743-check_http.revert-SNI.patch b/web/attachments/338743-check_http.revert-SNI.patch new file mode 100644 index 0000000..d19f2f1 --- /dev/null +++ b/web/attachments/338743-check_http.revert-SNI.patch | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | diff --git a/plugins/check_http.c b/plugins/check_http.c | ||
| 2 | index 0310203..79f6adf 100644 | ||
| 3 | --- a/plugins/check_http.c | ||
| 4 | +++ b/plugins/check_http.c | ||
| 5 | @@ -790,7 +790,7 @@ check_http (void) | ||
| 6 | die (STATE_CRITICAL, _("HTTP CRITICAL - Unable to open TCP socket\n")); | ||
| 7 | #ifdef HAVE_SSL | ||
| 8 | if (use_ssl == TRUE) { | ||
| 9 | - np_net_ssl_init(sd); | ||
| 10 | + np_net_ssl_init_with_hostname(sd, host_name); | ||
| 11 | if (check_cert == TRUE) { | ||
| 12 | result = np_net_ssl_check_cert(days_till_exp); | ||
| 13 | np_net_ssl_cleanup(); | ||
| 14 | diff --git a/plugins/netutils.h b/plugins/netutils.h | ||
| 15 | index b479b74..572a3ae 100644 | ||
| 16 | --- a/plugins/netutils.h | ||
| 17 | +++ b/plugins/netutils.h | ||
| 18 | @@ -99,6 +99,7 @@ extern int address_family; | ||
| 19 | #ifdef HAVE_SSL | ||
| 20 | /* maybe this could be merged with the above np_net_connect, via some flags */ | ||
| 21 | int np_net_ssl_init(int sd); | ||
| 22 | +int np_net_ssl_init_with_hostname(int sd, char *host_name); | ||
| 23 | void np_net_ssl_cleanup(); | ||
| 24 | int np_net_ssl_write(const void *buf, int num); | ||
| 25 | int np_net_ssl_read(void *buf, int num); | ||
| 26 | diff --git a/plugins/sslutils.c b/plugins/sslutils.c | ||
| 27 | index 1d4ef94..aa571b6 100644 | ||
| 28 | --- a/plugins/sslutils.c | ||
| 29 | +++ b/plugins/sslutils.c | ||
| 30 | @@ -35,7 +35,11 @@ static SSL_CTX *c=NULL; | ||
| 31 | static SSL *s=NULL; | ||
| 32 | static int initialized=0; | ||
| 33 | |||
| 34 | -int np_net_ssl_init (int sd){ | ||
| 35 | +int np_net_ssl_init (int sd) { | ||
| 36 | + return np_net_ssl_init_with_hostname(sd, NULL); | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +int np_net_ssl_init_with_hostname (int sd, char *host_name) { | ||
| 40 | if (!initialized) { | ||
| 41 | /* Initialize SSL context */ | ||
| 42 | SSLeay_add_ssl_algorithms (); | ||
| 43 | @@ -48,6 +52,10 @@ int np_net_ssl_init (int sd){ | ||
| 44 | return STATE_CRITICAL; | ||
| 45 | } | ||
| 46 | if ((s = SSL_new (c)) != NULL){ | ||
| 47 | +#ifdef SSL_set_tlsext_host_name | ||
| 48 | + if (host_name != NULL) | ||
| 49 | + SSL_set_tlsext_host_name(s, host_name); | ||
| 50 | +#endif | ||
| 51 | SSL_set_fd (s, sd); | ||
| 52 | if (SSL_connect(s) == 1){ | ||
| 53 | return OK; | ||
| 54 | @@ -65,6 +73,9 @@ int np_net_ssl_init (int sd){ | ||
| 55 | |||
| 56 | void np_net_ssl_cleanup (){ | ||
| 57 | if(s){ | ||
| 58 | +#ifdef SSL_set_tlsext_host_name | ||
| 59 | + SSL_set_tlsext_host_name(s, NULL); | ||
| 60 | +#endif | ||
| 61 | SSL_shutdown (s); | ||
| 62 | SSL_free (s); | ||
| 63 | if(c) { | ||
diff --git a/web/attachments/339420-check_procs_openvz.patch b/web/attachments/339420-check_procs_openvz.patch new file mode 100644 index 0000000..2a2a28c --- /dev/null +++ b/web/attachments/339420-check_procs_openvz.patch | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | diff --git a/plugins/check_procs.c b/plugins/check_procs.c | ||
| 2 | index 937c0ad..d1d5378 100644 | ||
| 3 | --- a/plugins/check_procs.c | ||
| 4 | +++ b/plugins/check_procs.c | ||
| 5 | @@ -203,6 +203,9 @@ main (int argc, char **argv) | ||
| 6 | |||
| 7 | /* Ignore self */ | ||
| 8 | if (mypid == procpid) continue; | ||
| 9 | + | ||
| 10 | + /* Ignore child containers if we're on an OpenVZ hardware node */ | ||
| 11 | + if (read_openvz_id(1) == 0 && read_openvz_id(procpid) != 0) continue; | ||
| 12 | |||
| 13 | if ((options & STAT) && (strstr (statopts, procstat))) | ||
| 14 | resultsum |= STAT; | ||
| 15 | @@ -666,6 +669,26 @@ convert_to_seconds(char *etime) { | ||
| 16 | return total; | ||
| 17 | } | ||
| 18 | |||
| 19 | +/* Returns the OpenVZ enviroment ID of the specified process, or -1 if we're not on OpenVZ */ | ||
| 20 | +int | ||
| 21 | +read_openvz_id(int procid) { | ||
| 22 | + FILE *file; | ||
| 23 | + char *filename = strdup(""); | ||
| 24 | + char line[64]; | ||
| 25 | + int result = -1; | ||
| 26 | + | ||
| 27 | + asprintf(&filename, "/proc/%d/status", procid); | ||
| 28 | + | ||
| 29 | + if ((file = fopen(filename, "r")) == NULL) return -1; | ||
| 30 | + | ||
| 31 | + while (fgets(line, sizeof(line), file) != NULL) { | ||
| 32 | + sscanf(line, "envID:\t%d", &result); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + fclose(file); | ||
| 36 | + return result; | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | |||
| 40 | void | ||
| 41 | print_help (void) | ||
diff --git a/web/attachments/34095-check_http.c.patch b/web/attachments/34095-check_http.c.patch new file mode 100644 index 0000000..0bf48b6 --- /dev/null +++ b/web/attachments/34095-check_http.c.patch | |||
| @@ -0,0 +1,140 @@ | |||
| 1 | --- plutins/check_http.c 2002-10-28 18:02:11.000000000 +0100 | ||
| 2 | +++ plugins/check_http.c 2002-10-28 19:42:30.000000000 +0100 | ||
| 3 | @@ -44,7 +44,7 @@ | ||
| 4 | \(-H <vhost> | -I <IP-address>) [-u <uri>] [-p <port>]\n\ | ||
| 5 | [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\ | ||
| 6 | [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\ | ||
| 7 | - [-s string] [-r <regex> | -R <case-insensitive regex>]\n\ | ||
| 8 | + [-s string] [-r <regex> | -R <case-insensitive regex>] [-x]\n\ | ||
| 9 | [-P string]" | ||
| 10 | |||
| 11 | #define LONGOPTIONS "\ | ||
| 12 | @@ -71,6 +71,8 @@ | ||
| 13 | Seconds before connection times out (default: %d)\n\ | ||
| 14 | -a, --authorization=AUTH_PAIR\n\ | ||
| 15 | Username:password on sites with basic authentication\n\ | ||
| 16 | + -x, --reverse\n\ | ||
| 17 | + Reverse the result of -r|-R|-s (like grep -v)\n\ | ||
| 18 | -L, --link=URL\n\ | ||
| 19 | Wrap output in HTML link (obsoleted by urlize)\n\ | ||
| 20 | -f, --onredirect=<ok|warning|critical|follow>\n\ | ||
| 21 | @@ -190,6 +192,7 @@ | ||
| 22 | int server_expect_yn = 0; | ||
| 23 | char server_expect[MAX_INPUT_BUFFER] = HTTP_EXPECT; | ||
| 24 | char string_expect[MAX_INPUT_BUFFER] = ""; | ||
| 25 | +int found_reverse = FALSE; /* grep -v */ | ||
| 26 | double warning_time = 0; | ||
| 27 | int check_warning_time = FALSE; | ||
| 28 | double critical_time = 0; | ||
| 29 | @@ -287,6 +290,7 @@ | ||
| 30 | {"regex", required_argument, 0, 'r'}, | ||
| 31 | {"ereg", required_argument, 0, 'r'}, | ||
| 32 | {"eregi", required_argument, 0, 'R'}, | ||
| 33 | + {"reverse", no_argument, 0, 'x'}, | ||
| 34 | {"onredirect", required_argument, 0, 'f'}, | ||
| 35 | {"certificate", required_argument, 0, 'C'}, | ||
| 36 | {0, 0, 0, 0} | ||
| 37 | @@ -309,7 +313,7 @@ | ||
| 38 | strcpy (argv[c], "-n"); | ||
| 39 | } | ||
| 40 | |||
| 41 | -#define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nLS" | ||
| 42 | +#define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nLSx" | ||
| 43 | |||
| 44 | while (1) { | ||
| 45 | #ifdef HAVE_GETOPT_H | ||
| 46 | @@ -442,6 +446,9 @@ | ||
| 47 | usage ("check_http: call for regex which was not a compiled option\n"); | ||
| 48 | #endif | ||
| 49 | break; | ||
| 50 | + case 'x': /* grep -v */ | ||
| 51 | + found_reverse = TRUE; | ||
| 52 | + break; | ||
| 53 | case 'v': /* verbose */ | ||
| 54 | verbose = TRUE; | ||
| 55 | break; | ||
| 56 | @@ -849,31 +856,69 @@ | ||
| 57 | |||
| 58 | if (strlen (string_expect)) { | ||
| 59 | if (strstr (page, string_expect)) { | ||
| 60 | - printf ("HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n", | ||
| 61 | - status_line, elapsed_time, | ||
| 62 | - timestamp, (display_html ? "</A>" : ""), elapsed_time); | ||
| 63 | - exit (STATE_OK); | ||
| 64 | + if (found_reverse) { /* grep -v */ | ||
| 65 | + printf ("HTTP CRITICAL: string found%s|time=%7.3f\n", | ||
| 66 | + (display_html ? "</A>" : ""), | ||
| 67 | + elapsed_time); | ||
| 68 | + exit (STATE_CRITICAL) ; | ||
| 69 | + } else { | ||
| 70 | + printf ("HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n", | ||
| 71 | + status_line, elapsed_time, | ||
| 72 | + timestamp, | ||
| 73 | + (display_html ? "</A>" : ""), | ||
| 74 | + elapsed_time); | ||
| 75 | + exit (STATE_OK); | ||
| 76 | + } | ||
| 77 | } | ||
| 78 | - else { | ||
| 79 | - printf ("HTTP CRITICAL: string not found%s|time=%7.3f\n", | ||
| 80 | - (display_html ? "</A>" : ""), elapsed_time); | ||
| 81 | - exit (STATE_CRITICAL); | ||
| 82 | + else { /* not found */ | ||
| 83 | + if (found_reverse) { /* grep -v */ | ||
| 84 | + printf ("HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n", | ||
| 85 | + status_line, elapsed_time, | ||
| 86 | + timestamp, | ||
| 87 | + (display_html ? "</A>" : ""), | ||
| 88 | + elapsed_time); | ||
| 89 | + exit (STATE_OK) ; | ||
| 90 | + } else { | ||
| 91 | + printf ("HTTP CRITICAL: string not found%s|time=%7.3f\n", | ||
| 92 | + (display_html ? "</A>" : ""), elapsed_time); | ||
| 93 | + exit (STATE_CRITICAL); | ||
| 94 | + } | ||
| 95 | } | ||
| 96 | } | ||
| 97 | #ifdef HAVE_REGEX_H | ||
| 98 | if (strlen (regexp)) { | ||
| 99 | errcode = regexec (&preg, page, REGS, pmatch, 0); | ||
| 100 | if (errcode == 0) { | ||
| 101 | - printf ("HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n", | ||
| 102 | - status_line, elapsed_time, | ||
| 103 | - timestamp, (display_html ? "</A>" : ""), elapsed_time); | ||
| 104 | - exit (STATE_OK); | ||
| 105 | + if (found_reverse) { /* grep -v */ | ||
| 106 | + printf ("HTTP CRITICAL: pattern found%s|time=%7.3f\n", | ||
| 107 | + (display_html ? "</A>" : ""), | ||
| 108 | + elapsed_time); | ||
| 109 | + exit (STATE_CRITICAL); | ||
| 110 | + } else { | ||
| 111 | + printf ("HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n", | ||
| 112 | + status_line, elapsed_time, | ||
| 113 | + timestamp, | ||
| 114 | + (display_html ? "</A>" : ""), | ||
| 115 | + elapsed_time); | ||
| 116 | + exit (STATE_OK); | ||
| 117 | + } | ||
| 118 | } | ||
| 119 | else { | ||
| 120 | if (errcode == REG_NOMATCH) { | ||
| 121 | - printf ("HTTP CRITICAL: pattern not found%s|time=%7.3f\n", | ||
| 122 | - (display_html ? "</A>" : ""), elapsed_time); | ||
| 123 | - exit (STATE_CRITICAL); | ||
| 124 | + if (found_reverse) { /* grep -v */ | ||
| 125 | + printf ("HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n", | ||
| 126 | + status_line, elapsed_time, | ||
| 127 | + timestamp, | ||
| 128 | + (display_html ? "</A>" : ""), | ||
| 129 | + elapsed_time); | ||
| 130 | + exit (STATE_OK); | ||
| 131 | + | ||
| 132 | + } else { | ||
| 133 | + printf ("HTTP CRITICAL: pattern not found%s|time=%7.3f\n", | ||
| 134 | + (display_html ? "</A>" : ""), | ||
| 135 | + elapsed_time); | ||
| 136 | + exit (STATE_CRITICAL); | ||
| 137 | + } | ||
| 138 | } | ||
| 139 | else { | ||
| 140 | regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER); | ||
diff --git a/web/attachments/343293-nagios-plugins-ping.patch b/web/attachments/343293-nagios-plugins-ping.patch new file mode 100644 index 0000000..232d97f --- /dev/null +++ b/web/attachments/343293-nagios-plugins-ping.patch | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | --- nagios-plugins-1.4.13/plugins/check_ping.c.org 2009-09-17 08:56:15.043692330 +0200 | ||
| 2 | +++ nagios-plugins-1.4.13/plugins/check_ping.c 2009-09-17 09:04:41.830352692 +0200 | ||
| 3 | @@ -519,12 +519,13 @@ | ||
| 4 | error_scan (char buf[MAX_INPUT_BUFFER], const char *addr) | ||
| 5 | { | ||
| 6 | if (strstr (buf, "Network is unreachable") || | ||
| 7 | - strstr (buf, "Destination Net Unreachable") | ||
| 8 | + strstr (buf, "Destination Net Unreachable") || | ||
| 9 | + strstr (buf, "No route") | ||
| 10 | ) | ||
| 11 | die (STATE_CRITICAL, _("CRITICAL - Network Unreachable (%s)"), addr); | ||
| 12 | - else if (strstr (buf, "Destination Host Unreachable")) | ||
| 13 | + else if (strstr (buf, "Destination Host Unreachable") || strstr(buf, "Address unreachable")) | ||
| 14 | die (STATE_CRITICAL, _("CRITICAL - Host Unreachable (%s)"), addr); | ||
| 15 | - else if (strstr (buf, "Destination Port Unreachable")) | ||
| 16 | + else if (strstr (buf, "Destination Port Unreachable") || strstr(buf, "Port unreachable")) | ||
| 17 | die (STATE_CRITICAL, _("CRITICAL - Bogus ICMP: Port Unreachable (%s)"), addr); | ||
| 18 | else if (strstr (buf, "Destination Protocol Unreachable")) | ||
| 19 | die (STATE_CRITICAL, _("CRITICAL - Bogus ICMP: Protocol Unreachable (%s)"), addr); | ||
| 20 | @@ -532,11 +533,11 @@ | ||
| 21 | die (STATE_CRITICAL, _("CRITICAL - Network Prohibited (%s)"), addr); | ||
| 22 | else if (strstr (buf, "Destination Host Prohibited")) | ||
| 23 | die (STATE_CRITICAL, _("CRITICAL - Host Prohibited (%s)"), addr); | ||
| 24 | - else if (strstr (buf, "Packet filtered")) | ||
| 25 | + else if (strstr (buf, "Packet filtered") || strstr(buf, "Administratively prohibited")) | ||
| 26 | die (STATE_CRITICAL, _("CRITICAL - Packet Filtered (%s)"), addr); | ||
| 27 | else if (strstr (buf, "unknown host" )) | ||
| 28 | die (STATE_CRITICAL, _("CRITICAL - Host not found (%s)"), addr); | ||
| 29 | - else if (strstr (buf, "Time to live exceeded")) | ||
| 30 | + else if (strstr (buf, "Time to live exceeded") || strstr(buf, "Time exceeded")) | ||
| 31 | die (STATE_CRITICAL, _("CRITICAL - Time to live exceeded (%s)"), addr); | ||
| 32 | |||
| 33 | if (strstr (buf, "(DUP!)") || strstr (buf, "DUPLICATES FOUND")) { | ||
diff --git a/web/attachments/343854-check_http.patch b/web/attachments/343854-check_http.patch new file mode 100644 index 0000000..d07b5d0 --- /dev/null +++ b/web/attachments/343854-check_http.patch | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | --- check_http.c.orig 2009-09-21 17:39:44.000000000 -0700 | ||
| 2 | +++ check_http.c 2009-09-21 17:32:14.000000000 -0700 | ||
| 3 | @@ -105,6 +105,7 @@ | ||
| 4 | double critical_time = 0; | ||
| 5 | int check_critical_time = FALSE; | ||
| 6 | char user_auth[MAX_INPUT_BUFFER] = ""; | ||
| 7 | +char proxy_auth[MAX_INPUT_BUFFER] = ""; | ||
| 8 | int display_html = FALSE; | ||
| 9 | char **http_opt_headers; | ||
| 10 | int http_opt_headers_count = 0; | ||
| 11 | @@ -192,6 +193,7 @@ | ||
| 12 | {"url", required_argument, 0, 'u'}, | ||
| 13 | {"port", required_argument, 0, 'p'}, | ||
| 14 | {"authorization", required_argument, 0, 'a'}, | ||
| 15 | + {"proxy_authorization", required_argument, 0, 'b'}, | ||
| 16 | {"string", required_argument, 0, 's'}, | ||
| 17 | {"expect", required_argument, 0, 'e'}, | ||
| 18 | {"regex", required_argument, 0, 'r'}, | ||
| 19 | @@ -229,7 +231,7 @@ | ||
| 20 | } | ||
| 21 | |||
| 22 | while (1) { | ||
| 23 | - c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 24 | + c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 25 | if (c == -1 || c == EOF) | ||
| 26 | break; | ||
| 27 | |||
| 28 | @@ -350,6 +352,10 @@ | ||
| 29 | strncpy (user_auth, optarg, MAX_INPUT_BUFFER - 1); | ||
| 30 | user_auth[MAX_INPUT_BUFFER - 1] = 0; | ||
| 31 | break; | ||
| 32 | + case 'b': /* proxy-authorization info */ | ||
| 33 | + strncpy (proxy_auth, optarg, MAX_INPUT_BUFFER - 1); | ||
| 34 | + proxy_auth[MAX_INPUT_BUFFER - 1] = 0; | ||
| 35 | + break; | ||
| 36 | case 'P': /* HTTP POST data in URL encoded format; ignored if settings already */ | ||
| 37 | if (! http_post_data) | ||
| 38 | http_post_data = strdup (optarg); | ||
| 39 | @@ -836,6 +842,12 @@ | ||
| 40 | asprintf (&buf, "%sAuthorization: Basic %s\r\n", buf, auth); | ||
| 41 | } | ||
| 42 | |||
| 43 | + /* optionally send the proxy authentication info */ | ||
| 44 | + if (strlen(proxy_auth)) { | ||
| 45 | + base64_encode_alloc (proxy_auth, strlen (proxy_auth), &auth); | ||
| 46 | + asprintf (&buf, "%sProxy-Authorization: Basic %s\r\n", buf, auth); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | /* either send http POST data (any data, not only POST)*/ | ||
| 50 | if (http_post_data) { | ||
| 51 | if (http_content_type) { | ||
| 52 | @@ -1346,6 +1358,8 @@ | ||
| 53 | |||
| 54 | printf (" %s\n", "-a, --authorization=AUTH_PAIR"); | ||
| 55 | printf (" %s\n", _("Username:password on sites with basic authentication")); | ||
| 56 | + printf (" %s\n", "-b, --proxy-authorization=AUTH_PAIR"); | ||
| 57 | + printf (" %s\n", _("Username:password on proxy-servers with basic authentication")); | ||
| 58 | printf (" %s\n", "-A, --useragent=STRING"); | ||
| 59 | printf (" %s\n", _("String to be sent in http header as \"User Agent\"")); | ||
| 60 | printf (" %s\n", "-k, --header=STRING"); | ||
| 61 | @@ -1407,7 +1421,7 @@ | ||
| 62 | printf (_("Usage:")); | ||
| 63 | printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname); | ||
| 64 | printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n"); | ||
| 65 | - printf (" [-a auth] [-f <ok | warn | critcal | follow | sticky | stickyport>]\n"); | ||
| 66 | + printf (" [-a auth] [-b proxy_auth] [-f <ok | warn | critcal | follow | sticky | stickyport>]\n"); | ||
| 67 | printf (" [-e <expect>] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n"); | ||
| 68 | printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); | ||
| 69 | printf (" [-A string] [-k string] [-S] [-C <age>] [-T <content-type>] [-j method]\n"); | ||
diff --git a/web/attachments/344003-0001-Sync-with-the-latest-Gnulib-code-d34f1e7.patch.gz b/web/attachments/344003-0001-Sync-with-the-latest-Gnulib-code-d34f1e7.patch.gz new file mode 100644 index 0000000..4f5b016 --- /dev/null +++ b/web/attachments/344003-0001-Sync-with-the-latest-Gnulib-code-d34f1e7.patch.gz | |||
| Binary files differ | |||
diff --git a/web/attachments/344028-check_ntp_time.c.diff b/web/attachments/344028-check_ntp_time.c.diff new file mode 100644 index 0000000..bb07962 --- /dev/null +++ b/web/attachments/344028-check_ntp_time.c.diff | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | Index: check_ntp_time.c | ||
| 2 | =================================================================== | ||
| 3 | --- check_ntp_time.c (revision 2244) | ||
| 4 | +++ check_ntp_time.c (working copy) | ||
| 5 | @@ -48,6 +48,7 @@ | ||
| 6 | static int quiet=0; | ||
| 7 | static char *owarn="60"; | ||
| 8 | static char *ocrit="120"; | ||
| 9 | +static int time_offset=0; | ||
| 10 | |||
| 11 | int process_arguments (int, char **); | ||
| 12 | thresholds *offset_thresholds = NULL; | ||
| 13 | @@ -394,7 +395,7 @@ | ||
| 14 | gettimeofday(&recv_time, NULL); | ||
| 15 | DBG(print_ntp_message(&req[i])); | ||
| 16 | respnum=servers[i].num_responses++; | ||
| 17 | - servers[i].offset[respnum]=calc_offset(&req[i], &recv_time); | ||
| 18 | + servers[i].offset[respnum]=calc_offset(&req[i], &recv_time)+time_offset; | ||
| 19 | if(verbose) { | ||
| 20 | printf("offset %.10g\n", servers[i].offset[respnum]); | ||
| 21 | } | ||
| 22 | @@ -449,6 +450,7 @@ | ||
| 23 | {"use-ipv4", no_argument, 0, '4'}, | ||
| 24 | {"use-ipv6", no_argument, 0, '6'}, | ||
| 25 | {"quiet", no_argument, 0, 'q'}, | ||
| 26 | + {"time-offset", optional_argument, 0, 'o'}, | ||
| 27 | {"warning", required_argument, 0, 'w'}, | ||
| 28 | {"critical", required_argument, 0, 'c'}, | ||
| 29 | {"timeout", required_argument, 0, 't'}, | ||
| 30 | @@ -462,7 +464,7 @@ | ||
| 31 | usage ("\n"); | ||
| 32 | |||
| 33 | while (1) { | ||
| 34 | - c = getopt_long (argc, argv, "Vhv46qw:c:t:H:p:", longopts, &option); | ||
| 35 | + c = getopt_long (argc, argv, "Vhv46qw:c:t:H:p:o:", longopts, &option); | ||
| 36 | if (c == -1 || c == EOF || c == 1) | ||
| 37 | break; | ||
| 38 | |||
| 39 | @@ -498,6 +500,9 @@ | ||
| 40 | case 't': | ||
| 41 | socket_timeout=atoi(optarg); | ||
| 42 | break; | ||
| 43 | + case 'o': | ||
| 44 | + time_offset=atoi(optarg); | ||
| 45 | + break; | ||
| 46 | case '4': | ||
| 47 | address_family = AF_INET; | ||
| 48 | break; | ||
| 49 | @@ -609,6 +614,8 @@ | ||
| 50 | printf (" %s\n", _("Offset to result in warning status (seconds)")); | ||
| 51 | printf (" %s\n", "-c, --critical=THRESHOLD"); | ||
| 52 | printf (" %s\n", _("Offset to result in critical status (seconds)")); | ||
| 53 | + printf (" %s\n", "-o, --time_offset="); | ||
| 54 | + printf (" %s\n", _("Offset of the ntp server relative to local server(seconds)")); | ||
| 55 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
| 56 | printf (_(UT_VERBOSE)); | ||
| 57 | |||
| 58 | @@ -639,6 +646,6 @@ | ||
| 59 | print_usage(void) | ||
| 60 | { | ||
| 61 | printf (_("Usage:")); | ||
| 62 | - printf(" %s -H <host> [-w <warn>] [-c <crit>] [-v verbose]\n", progname); | ||
| 63 | + printf(" %s -H <host> [-w <warn>] [-c <crit>] [-v verbose] [-o <time offset>]\n", progname); | ||
| 64 | } | ||
| 65 | |||
diff --git a/web/attachments/344042-39_check_ircd_fix_epn.dpatch b/web/attachments/344042-39_check_ircd_fix_epn.dpatch new file mode 100644 index 0000000..7956a4d --- /dev/null +++ b/web/attachments/344042-39_check_ircd_fix_epn.dpatch | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #! /bin/sh /usr/share/dpatch/dpatch-run | ||
| 2 | ## 39_check_ircd_fix_epn.dpatch by Alexander Wirt <formorer@formorer.de> | ||
| 3 | ## | ||
| 4 | ## DP: Fixes epn in check_ircd (#545940) | ||
| 5 | |||
| 6 | @DPATCH@ | ||
| 7 | |||
| 8 | --- nagios-plugins-1.4.12~/plugins-scripts/check_ircd.pl 2009-08-23 09:40:38.000000000 +0200 | ||
| 9 | +++ nagios-plugins-1.4.12/plugins-scripts/check_ircd.pl 2009-09-22 23:35:52.000000000 +0200 | ||
| 10 | @@ -194,19 +194,19 @@ | ||
| 11 | |||
| 12 | if ($opt_h) {print_help(); exit $ERRORS{'OK'};} | ||
| 13 | |||
| 14 | - ($opt_H) || ($opt_H = shift) || usage("Host name/address not specified\n"); | ||
| 15 | + ($opt_H) || usage("Host name/address not specified\n"); | ||
| 16 | my $remotehost = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/); | ||
| 17 | ($remotehost) || usage("Invalid host: $opt_H\n"); | ||
| 18 | |||
| 19 | - ($opt_w) || ($opt_w = shift) || ($opt_w = 50); | ||
| 20 | + ($opt_w) || ($opt_w = 50); | ||
| 21 | my $warn = $1 if ($opt_w =~ /^([0-9]+)$/); | ||
| 22 | ($warn) || usage("Invalid warning threshold: $opt_w\n"); | ||
| 23 | |||
| 24 | - ($opt_c) || ($opt_c = shift) || ($opt_c = 100); | ||
| 25 | + ($opt_c) || ($opt_c = 100); | ||
| 26 | my $crit = $1 if ($opt_c =~ /^([0-9]+)$/); | ||
| 27 | ($crit) || usage("Invalid critical threshold: $opt_c\n"); | ||
| 28 | |||
| 29 | - ($opt_p) || ($opt_p = shift) || ($opt_p = 6667); | ||
| 30 | + ($opt_p) || ($opt_p = 6667); | ||
| 31 | my $remoteport = $1 if ($opt_p =~ /^([0-9]+)$/); | ||
| 32 | ($remoteport) || usage("Invalid port: $opt_p\n"); | ||
| 33 | |||
diff --git a/web/attachments/345379-check_mount_opts.patch b/web/attachments/345379-check_mount_opts.patch new file mode 100644 index 0000000..52ea67f --- /dev/null +++ b/web/attachments/345379-check_mount_opts.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-10 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378824230" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378824230" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378824230" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378824230" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378824230'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=2872843&group_id=29880&atid=397597&file_id=345379" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/345594-check_disk.patch b/web/attachments/345594-check_disk.patch new file mode 100644 index 0000000..8070fb2 --- /dev/null +++ b/web/attachments/345594-check_disk.patch | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | diff -urpN nagios-plugins-1.4.14.orig/plugins/check_disk.c nagios-plugins-1.4.14/plugins/check_disk.c | ||
| 2 | --- nagios-plugins-1.4.14.orig/plugins/check_disk.c 2009-05-07 23:10:02.000000000 +0200 | ||
| 3 | +++ nagios-plugins-1.4.14/plugins/check_disk.c 2009-10-07 09:48:20.000000000 +0200 | ||
| 4 | @@ -58,7 +58,7 @@ static int inode_format = 1; | ||
| 5 | |||
| 6 | /* If nonzero, show even filesystems with zero size or | ||
| 7 | uninteresting types. */ | ||
| 8 | -static int show_all_fs = 1; | ||
| 9 | +static int show_all_fs = 0; | ||
| 10 | |||
| 11 | /* If nonzero, show only local filesystems. */ | ||
| 12 | static int show_local_fs = 0; | ||
diff --git a/web/attachments/345604-check_mount_opts.patch b/web/attachments/345604-check_mount_opts.patch new file mode 100644 index 0000000..c2b517c --- /dev/null +++ b/web/attachments/345604-check_mount_opts.patch | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | diff -rupN nagios-plugins-1.4.14.orig/gl/mountlist.c nagios-plugins-1.4.14/gl/mountlist.c | ||
| 2 | --- nagios-plugins-1.4.14.orig/gl/mountlist.c 2009-05-21 23:11:51.000000000 +0200 | ||
| 3 | +++ nagios-plugins-1.4.14/gl/mountlist.c 2009-10-07 10:57:16.000000000 +0200 | ||
| 4 | @@ -156,6 +156,11 @@ | ||
| 5 | || strcmp (Fs_type, "ignore") == 0) | ||
| 6 | #endif | ||
| 7 | |||
| 8 | +#ifndef ME_DUMMY_OPTS | ||
| 9 | +# define ME_DUMMY_OPTS(mount_options) \ | ||
| 10 | +(strstr(mount_options, ",bind")) | ||
| 11 | +#endif | ||
| 12 | + | ||
| 13 | #ifndef ME_REMOTE | ||
| 14 | /* A file system is `remote' if its Fs_name contains a `:' | ||
| 15 | or if (it is of type (smbfs or cifs) and its Fs_name starts with `//'). */ | ||
| 16 | @@ -388,7 +393,11 @@ read_file_system_list (bool need_fs_type | ||
| 17 | me->me_mountdir = xstrdup (mnt->mnt_dir); | ||
| 18 | me->me_type = xstrdup (mnt->mnt_type); | ||
| 19 | me->me_type_malloced = 1; | ||
| 20 | + #ifndef __linux__ | ||
| 21 | me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); | ||
| 22 | + #else | ||
| 23 | + me->me_dummy = ME_DUMMY (me->me_devname, me->me_type) || ME_DUMMY_OPTS(mnt->mnt_opts); | ||
| 24 | + #endif | ||
| 25 | me->me_remote = ME_REMOTE (me->me_devname, me->me_type); | ||
| 26 | me->me_dev = dev_from_mount_options (mnt->mnt_opts); | ||
| 27 | |||
diff --git a/web/attachments/349111-patch.txt b/web/attachments/349111-patch.txt new file mode 100644 index 0000000..2eae01d --- /dev/null +++ b/web/attachments/349111-patch.txt | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | --- check_asterisk.pl 2009-09-24 03:13:56.000000000 -0700 | ||
| 2 | +++ check_asterisk.pl.changed 2009-11-01 13:10:06.000000000 -0800 | ||
| 3 | @@ -31,7 +31,8 @@ | ||
| 4 | my $iax_timestamp = "00000000"; | ||
| 5 | my $iax_outbound_seq = "00"; | ||
| 6 | my $iax_inbound_seq = "00"; | ||
| 7 | -my $iax_type = "06"; #IAX_Control | ||
| 8 | +my $iax_type = "06"; #IAX_Control | ||
| 9 | +my $iax_frame_value = "1e"; #POKE | ||
| 10 | |||
| 11 | sub ok { | ||
| 12 | $s = shift; | ||
| 13 | @@ -224,7 +225,7 @@ | ||
| 14 | socket(PING, PF_INET, SOCK_DGRAM, getprotobyname("udp")); | ||
| 15 | |||
| 16 | $msg = pack "H24", $iax_src_call . $iax_dst_call . $iax_timestamp . | ||
| 17 | - $iax_outbound_seq . $iax_inbound_seq . $iax_type . $iax_type; | ||
| 18 | + $iax_outbound_seq . $iax_inbound_seq . $iax_type . $iax_frame_value ; | ||
| 19 | |||
| 20 | $ipaddr = inet_aton($host); | ||
| 21 | $sendto = sockaddr_in($port,$ipaddr); | ||
diff --git a/web/attachments/34950-diff.txt b/web/attachments/34950-diff.txt new file mode 100644 index 0000000..4276ba2 --- /dev/null +++ b/web/attachments/34950-diff.txt | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | Common subdirectories: nagiosplug/CVS and nagiosplug.old/CVS | ||
| 2 | diff nagiosplug/acconfig.h nagiosplug.old/acconfig.h | ||
| 3 | 5d4 | ||
| 4 | < #undef HAVE_C99_SNPRINTF | ||
| 5 | diff nagiosplug/configure.in nagiosplug.old/configure.in | ||
| 6 | 346,347c346 | ||
| 7 | < dnl Checks for library functions (deplace). | ||
| 8 | < AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul gettimeofday snprintf) | ||
| 9 | --- | ||
| 10 | > AC_CHECK_FUNCS(getopt_long_only,,LIBS="$LIBS -lgetopt" DEPLIBS="$DEPLIBS libgetopt.a") | ||
| 11 | 349,352c348 | ||
| 12 | < AC_CHECK_FUNC(getopt_long_only,[ nagiosplug_cv_bool_getoptlib="yes" ] ,[ nagiosplug_cv_bool_getoptlib="no" ]) | ||
| 13 | < | ||
| 14 | < AC_CHECK_FUNC(asprintf,[ nagiosplug_cv_bool_asprintf="yes" ] ,[ nagiosplug_cv_bool_asprintf="no" ]) | ||
| 15 | < AC_CHECK_FUNC(snprintf,[ nagiosplug_cv_bool_snprintf="yes" ] ,[ nagiosplug_cv_bool_snprintf="no" ]) | ||
| 16 | --- | ||
| 17 | > AC_CHECK_FUNC(asprintf,,LIBS="$LIBS -lsnprintf" DEPLIBS="$DEPLIBS libsnprintf.a") | ||
| 18 | 353a350,351 | ||
| 19 | > dnl Checks for library functions. | ||
| 20 | > AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul gettimeofday) | ||
| 21 | 819a818 | ||
| 22 | > AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$PATH_TO_SWAP -k",[Path to swap/swapinfo binary, with any args]) | ||
| 23 | 822d820 | ||
| 24 | < AC_DEFINE_UNQUOTED(SWAP_COMMAND,"$PATH_TO_SWAP -k",[Path to swap/swapinfo binary, with any args]) | ||
| 25 | 825,829d822 | ||
| 26 | < elif [swapinfo -d 2>/dev/null | egrep -i "^TYPE +AVAIL +USED +FREE" >/dev/null] | ||
| 27 | < then | ||
| 28 | < AC_DEFINE_UNQUOTED(SWAP_COMMAND,"/bin/sh '$PATH_TO_SWAP -d | /bin/tail -l +2'",[Path to swap/swapinfo binary, with any args]) | ||
| 29 | < AC_DEFINE_UNQUOTED(SWAP_FORMAT,["%*s %d %*d %d"],[Format string for parsing swap output ]) | ||
| 30 | < echo " NEW file format HP-UX !!" | ||
| 31 | 864,877d856 | ||
| 32 | < | ||
| 33 | < if test "$nagiosplug_cv_bool_getoptlib" = "no"; then | ||
| 34 | < LIBS="$LIBS -lgetopt" DEPLIBS="$DEPLIBS libgetopt.a" | ||
| 35 | < fi | ||
| 36 | < | ||
| 37 | < if test "$nagiosplug_cv_bool_asprintf" = "no"; then | ||
| 38 | < LIBS="$LIBS -lsnprintf" DEPLIBS="$DEPLIBS libsnprintf.a" | ||
| 39 | < fi | ||
| 40 | < | ||
| 41 | < if test "$nagiosplug_cv_bool_snprintf" = "yes"; then | ||
| 42 | < if test `uname -s` = 'HP-UX' ; then | ||
| 43 | < AC_DEFINE(HAVE_C99_SNPRINTF) | ||
| 44 | < fi | ||
| 45 | < fi | ||
| 46 | Common subdirectories: nagiosplug/contrib and nagiosplug.old/contrib | ||
| 47 | Common subdirectories: nagiosplug/doc and nagiosplug.old/doc | ||
| 48 | Common subdirectories: nagiosplug/plugins and nagiosplug.old/plugins | ||
| 49 | Common subdirectories: nagiosplug/plugins-scripts and nagiosplug.old/plugins-scripts | ||
| 50 | Common subdirectories: nagiosplug/tools and nagiosplug.old/tools | ||
diff --git a/web/attachments/350309-check_by_ssh_configfile.patch b/web/attachments/350309-check_by_ssh_configfile.patch new file mode 100644 index 0000000..b609165 --- /dev/null +++ b/web/attachments/350309-check_by_ssh_configfile.patch | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | Index: plugins/check_by_ssh.c | ||
| 2 | =================================================================== | ||
| 3 | 189a190 | ||
| 4 | > {"configfile", optional_argument, 0, 'F'}, | ||
| 5 | 201c202 | ||
| 6 | < c = getopt_long (argc, argv, "Vvh1246fqt:H:O:p:i:u:l:C:S::E::n:s:o:", longopts, | ||
| 7 | --- | ||
| 8 | > c = getopt_long (argc, argv, "Vvh1246fqt:H:O:p:i:u:l:C:S::E::n:s:o:F:", longopts, | ||
| 9 | 308a310,313 | ||
| 10 | > case 'F': /* ssh configfile */ | ||
| 11 | > comm_append("-F"); | ||
| 12 | > comm_append(optarg); | ||
| 13 | > break; | ||
| 14 | 422a428,429 | ||
| 15 | > printf (" %s\n","-F, --configfile"); | ||
| 16 | > printf (" %s\n", _("Tell ssh to use this configfile[optional]")); | ||
| 17 | 463c470 | ||
| 18 | < " [-p port] [-o ssh-option]\n", | ||
| 19 | --- | ||
| 20 | > " [-p port] [-o ssh-option] [-F configfile]\n", | ||
| 21 | Index: plugins/t/check_by_ssh.t | ||
| 22 | =================================================================== | ||
| 23 | 19a20,23 | ||
| 24 | > my $ssh_conf = getTestParameter( "NP_SSH_CONFIGFILE", | ||
| 25 | > "A config file with ssh settings", | ||
| 26 | > "~/.ssh/config"); | ||
| 27 | > | ||
| 28 | 22c26 | ||
| 29 | < plan tests => 40; | ||
| 30 | --- | ||
| 31 | > plan tests => 42; | ||
| 32 | 87a92,97 | ||
| 33 | > $result = NPTest->testCmd( | ||
| 34 | > "./check_by_ssh -i $ssh_key -H $ssh_service -F $ssh_conf -C 'exit 0'" | ||
| 35 | > ); | ||
| 36 | > cmp_ok($result->return_code, '==', 0, "Exit with return code 0 (OK)"); | ||
| 37 | > is($result->output, 'OK - check_by_ssh: Remote command \'exit 0\' returned status 0', "Status text if command returned none (OK)"); | ||
| 38 | > | ||
| 39 | 146d155 | ||
| 40 | < | ||
diff --git a/web/attachments/351231-check_nwstat.diff b/web/attachments/351231-check_nwstat.diff new file mode 100644 index 0000000..810eb9f --- /dev/null +++ b/web/attachments/351231-check_nwstat.diff | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | 48a49 | ||
| 2 | > VPU, /* check % used space on volume */ | ||
| 3 | 148a150,151 | ||
| 4 | > unsigned long used_disk_space=0L; | ||
| 5 | > unsigned long percent_used_disk_space=0L; | ||
| 6 | 454a458,484 | ||
| 7 | > /* check % used space on volume */ | ||
| 8 | > } else if (vars_to_check==VPU) { | ||
| 9 | > close(sd); | ||
| 10 | > my_tcp_connect (server_address, server_port, &sd); | ||
| 11 | > | ||
| 12 | > asprintf (&send_buffer,"VMU%s\r\n",volume_name); | ||
| 13 | > result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 14 | > if (result!=STATE_OK) | ||
| 15 | > return result; | ||
| 16 | > | ||
| 17 | > if (!strcmp(recv_buffer,"-1\n")) { | ||
| 18 | > | ||
| 19 | > asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); | ||
| 20 | > result=STATE_CRITICAL; | ||
| 21 | > | ||
| 22 | > } else { | ||
| 23 | > used_disk_space=strtoul(recv_buffer,NULL,10); | ||
| 24 | > close(sd); | ||
| 25 | > my_tcp_connect (server_address, server_port, &sd); | ||
| 26 | > /* get total volume in MB */ | ||
| 27 | > asprintf (&send_buffer,"VMS%s\r\n",volume_name); | ||
| 28 | > result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 29 | > if (result!=STATE_OK) | ||
| 30 | > return result; | ||
| 31 | > total_disk_space=strtoul(recv_buffer,NULL,10); | ||
| 32 | > /* calculate percent used on volume */ | ||
| 33 | > percent_used_disk_space=(unsigned long)(((double)used_disk_space/(double)total_disk_space)*100.0); | ||
| 34 | 455a486,501 | ||
| 35 | > if (check_critical_value==TRUE && percent_used_disk_space >= critical_value) | ||
| 36 | > result=STATE_CRITICAL; | ||
| 37 | > else if (check_warning_value==TRUE && percent_used_disk_space >= warning_value) | ||
| 38 | > result=STATE_WARNING; | ||
| 39 | > | ||
| 40 | > asprintf (&output_message,_("%lu MB (%lu%%) used on volume %s - total %lu MB|Used space in percent on %s=%lu;%lu;%lu;0;100"), | ||
| 41 | > used_disk_space, | ||
| 42 | > percent_used_disk_space, | ||
| 43 | > volume_name, | ||
| 44 | > total_disk_space, | ||
| 45 | > volume_name, | ||
| 46 | > percent_used_disk_space, | ||
| 47 | > warning_value, | ||
| 48 | > critical_value | ||
| 49 | > ); | ||
| 50 | > } | ||
| 51 | 1452a1499,1504 | ||
| 52 | > else if (strncmp(optarg,"VPU",3)==0) { | ||
| 53 | > vars_to_check=VPU; | ||
| 54 | > volume_name = strdup (optarg+3); | ||
| 55 | > if (!strcmp(volume_name,"")) | ||
| 56 | > volume_name = strdup ("SYS"); | ||
| 57 | > } | ||
| 58 | 1628a1681 | ||
| 59 | > printf (" %s\n", _(" VPU<vol> = percent used space on Volume <vol>")); | ||
diff --git a/web/attachments/352097-0001-move-nagios_die-out-of-N-P-Thresholds.patch b/web/attachments/352097-0001-move-nagios_die-out-of-N-P-Thresholds.patch new file mode 100644 index 0000000..449cdd9 --- /dev/null +++ b/web/attachments/352097-0001-move-nagios_die-out-of-N-P-Thresholds.patch | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | From c1f379dbeb62b56530a25319690977385ce6766f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Danijel Tasov <dt@korn.shell.la> | ||
| 3 | Date: Sun, 22 Nov 2009 14:25:33 +0100 | ||
| 4 | Subject: [PATCH] move nagios_die out of N::P::Thresholds. | ||
| 5 | |||
| 6 | N::P::Thresholds uses nagios_die. This is suboptimal for using | ||
| 7 | that Class in other Projects. Though one can set | ||
| 8 | N::P::F::_use_die, but then $@ contains get_shortname and a | ||
| 9 | STATUS_TEXT, which feels odd. | ||
| 10 | |||
| 11 | Signed-off-by: Danijel Tasov <dt@korn.shell.la> | ||
| 12 | --- | ||
| 13 | lib/Nagios/Plugin.pm | 7 ++++++- | ||
| 14 | lib/Nagios/Plugin/Threshold.pm | 7 ++++--- | ||
| 15 | 2 files changed, 10 insertions(+), 4 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/lib/Nagios/Plugin.pm b/lib/Nagios/Plugin.pm | ||
| 18 | index 697005a..958d617 100644 | ||
| 19 | --- a/lib/Nagios/Plugin.pm | ||
| 20 | +++ b/lib/Nagios/Plugin.pm | ||
| 21 | @@ -83,7 +83,12 @@ sub all_perfoutput { | ||
| 22 | sub set_thresholds { | ||
| 23 | my $self = shift; | ||
| 24 | require Nagios::Plugin::Threshold; | ||
| 25 | - return $self->threshold( Nagios::Plugin::Threshold->set_thresholds(@_)); | ||
| 26 | + eval { | ||
| 27 | + $self->threshold( Nagios::Plugin::Threshold->set_thresholds(@_)); | ||
| 28 | + }; if($@) { | ||
| 29 | + $self->nagios_die($@); | ||
| 30 | + } | ||
| 31 | + return $self->threshold; | ||
| 32 | } | ||
| 33 | |||
| 34 | # NP::Functions wrappers | ||
| 35 | diff --git a/lib/Nagios/Plugin/Threshold.pm b/lib/Nagios/Plugin/Threshold.pm | ||
| 36 | index 73fce53..e481cd4 100644 | ||
| 37 | --- a/lib/Nagios/Plugin/Threshold.pm | ||
| 38 | +++ b/lib/Nagios/Plugin/Threshold.pm | ||
| 39 | @@ -9,7 +9,8 @@ use base qw(Class::Accessor::Fast); | ||
| 40 | __PACKAGE__->mk_accessors(qw(warning critical)); | ||
| 41 | |||
| 42 | use Nagios::Plugin::Range; | ||
| 43 | -use Nagios::Plugin::Functions qw(:codes nagios_die); | ||
| 44 | +use Nagios::Plugin::Functions qw(:codes); | ||
| 45 | +use Carp; | ||
| 46 | our ($VERSION) = $Nagios::Plugin::Functions::VERSION; | ||
| 47 | |||
| 48 | sub get_status | ||
| 49 | @@ -34,7 +35,7 @@ sub _inflate | ||
| 50 | |||
| 51 | # For refs, check isa N::P::Range | ||
| 52 | if (ref $value) { | ||
| 53 | - nagios_die("Invalid $key object: type " . ref $value) | ||
| 54 | + croak("Invalid $key object: type " . ref $value) | ||
| 55 | unless $value->isa("Nagios::Plugin::Range"); | ||
| 56 | return $value; | ||
| 57 | } | ||
| 58 | @@ -44,7 +45,7 @@ sub _inflate | ||
| 59 | |||
| 60 | # Otherwise parse $value | ||
| 61 | my $range = Nagios::Plugin::Range->parse_range_string($value); | ||
| 62 | - nagios_die("Cannot parse $key range: '$value'") unless(defined($range)); | ||
| 63 | + croak("Cannot parse $key range: '$value'") unless(defined($range)); | ||
| 64 | return $range; | ||
| 65 | } | ||
| 66 | |||
| 67 | -- | ||
| 68 | 1.6.5.2.10.g754571 | ||
| 69 | |||
diff --git a/web/attachments/353739-bignumbers.patch b/web/attachments/353739-bignumbers.patch new file mode 100644 index 0000000..e873053 --- /dev/null +++ b/web/attachments/353739-bignumbers.patch | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | diff --git a/plugins/utils.c b/plugins/utils.c | ||
| 2 | index fee06cf..df8c979 100644 | ||
| 3 | --- a/plugins/utils.c | ||
| 4 | +++ b/plugins/utils.c | ||
| 5 | @@ -535,39 +535,39 @@ strpcat (char *dest, const char *src, const char *str) | ||
| 6 | ******************************************************************************/ | ||
| 7 | |||
| 8 | char *perfdata (const char *label, | ||
| 9 | - long int val, | ||
| 10 | + long long int val, | ||
| 11 | const char *uom, | ||
| 12 | int warnp, | ||
| 13 | - long int warn, | ||
| 14 | + long long int warn, | ||
| 15 | int critp, | ||
| 16 | - long int crit, | ||
| 17 | + long long int crit, | ||
| 18 | int minp, | ||
| 19 | - long int minv, | ||
| 20 | + long long int minv, | ||
| 21 | int maxp, | ||
| 22 | - long int maxv) | ||
| 23 | + long long int maxv) | ||
| 24 | { | ||
| 25 | char *data = NULL; | ||
| 26 | |||
| 27 | if (strpbrk (label, "'= ")) | ||
| 28 | - asprintf (&data, "'%s'=%ld%s;", label, val, uom); | ||
| 29 | + asprintf (&data, "'%s'=%lli%s;", label, val, uom); | ||
| 30 | else | ||
| 31 | - asprintf (&data, "%s=%ld%s;", label, val, uom); | ||
| 32 | + asprintf (&data, "%s=%lli%s;", label, val, uom); | ||
| 33 | |||
| 34 | if (warnp) | ||
| 35 | - asprintf (&data, "%s%ld;", data, warn); | ||
| 36 | + asprintf (&data, "%s%lli;", data, warn); | ||
| 37 | else | ||
| 38 | asprintf (&data, "%s;", data); | ||
| 39 | |||
| 40 | if (critp) | ||
| 41 | - asprintf (&data, "%s%ld;", data, crit); | ||
| 42 | + asprintf (&data, "%s%lli;", data, crit); | ||
| 43 | else | ||
| 44 | asprintf (&data, "%s;", data); | ||
| 45 | |||
| 46 | if (minp) | ||
| 47 | - asprintf (&data, "%s%ld", data, minv); | ||
| 48 | + asprintf (&data, "%s%lli", data, minv); | ||
| 49 | |||
| 50 | if (maxp) | ||
| 51 | - asprintf (&data, "%s;%ld", data, maxv); | ||
| 52 | + asprintf (&data, "%s;%lli", data, maxv); | ||
| 53 | |||
| 54 | return data; | ||
| 55 | } | ||
| 56 | diff --git a/plugins/utils.h b/plugins/utils.h | ||
| 57 | index 116f6c8..8a067fd 100644 | ||
| 58 | --- a/plugins/utils.h | ||
| 59 | +++ b/plugins/utils.h | ||
| 60 | @@ -99,16 +99,16 @@ const char *state_text (int); | ||
| 61 | #define min(a,b) (((a)<(b))?(a):(b)) | ||
| 62 | |||
| 63 | char *perfdata (const char *, | ||
| 64 | - long int, | ||
| 65 | + long long int, | ||
| 66 | const char *, | ||
| 67 | int, | ||
| 68 | - long int, | ||
| 69 | + long long int, | ||
| 70 | int, | ||
| 71 | - long int, | ||
| 72 | + long long int, | ||
| 73 | int, | ||
| 74 | - long int, | ||
| 75 | + long long int, | ||
| 76 | int, | ||
| 77 | - long int); | ||
| 78 | + long long int); | ||
| 79 | |||
| 80 | char *fperfdata (const char *, | ||
| 81 | double, | ||
diff --git a/web/attachments/35381-check_nagios.c.patch b/web/attachments/35381-check_nagios.c.patch new file mode 100644 index 0000000..1b96e5d --- /dev/null +++ b/web/attachments/35381-check_nagios.c.patch | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | --- check_nagios.c Wed Jun 19 07:11:52 2002 | ||
| 2 | +++ check_nagios.c.gyufi Thu Nov 14 08:39:19 2002 | ||
| 3 | @@ -263,5 +263,5 @@ | ||
| 4 | "-V, --version\n" | ||
| 5 | " Print version information\n\n" | ||
| 6 | "Example:\n" | ||
| 7 | - " ./check_nagios -H /usr/local/nagios/var/status.log -e 5 -C /usr/local/nagios/bin/nagios\n"); | ||
| 8 | + " ./check_nagios -F /usr/local/nagios/var/status.log -e 5 -C /usr/local/nagios/bin/nagios\n"); | ||
| 9 | } | ||
diff --git a/web/attachments/353909-0001-Detect-arguments-passed-via-with-ping-6-command-2908.patch b/web/attachments/353909-0001-Detect-arguments-passed-via-with-ping-6-command-2908.patch new file mode 100644 index 0000000..6dac847 --- /dev/null +++ b/web/attachments/353909-0001-Detect-arguments-passed-via-with-ping-6-command-2908.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-4 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378824522" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378824522" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378824522" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378824522" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378824522'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=2896201&group_id=29880&atid=397597&file_id=353909" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/353970-0001-Detect-arguments-passed-via-with-ping-6-command-2908.patch b/web/attachments/353970-0001-Detect-arguments-passed-via-with-ping-6-command-2908.patch new file mode 100644 index 0000000..60bda5c --- /dev/null +++ b/web/attachments/353970-0001-Detect-arguments-passed-via-with-ping-6-command-2908.patch | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | From 96a23a4c117a9c2665ca09e5964eacf028dbcdcf Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Thomas Guyot-Sionnest <dermoth@aei.ca> | ||
| 3 | Date: Fri, 4 Dec 2009 15:24:15 -0500 | ||
| 4 | Subject: [PATCH] Detect arguments passed via --with-ping[6]-command (#2908236) | ||
| 5 | |||
| 6 | --- | ||
| 7 | NEWS | 1 + | ||
| 8 | configure.in | 19 +++++++++++++++++-- | ||
| 9 | 2 files changed, 18 insertions(+), 2 deletions(-) | ||
| 10 | |||
| 11 | diff --git a/NEWS b/NEWS | ||
| 12 | index f5be201..667e1f0 100644 | ||
| 13 | --- a/NEWS | ||
| 14 | +++ b/NEWS | ||
| 15 | @@ -7,6 +7,7 @@ This file documents the major additions and syntax changes between releases. | ||
| 16 | Add proxy-authorization option to check_http (Marcel Kuiper - #1323230, Bryan Irvine - #2863925) | ||
| 17 | check_icmp now increment the sequence counter in each packet | ||
| 18 | Fix usage of repeated -o options in check_snmp | ||
| 19 | + Try to detect arguments passed via --with-ping[6]-command and set options accordingly (#2908236) | ||
| 20 | WARNINGS | ||
| 21 | Updated developer documentation to say that performance labels should not have an equals sign or | ||
| 22 | single quote in the label | ||
| 23 | diff --git a/configure.in b/configure.in | ||
| 24 | index f354734..d02d7f8 100644 | ||
| 25 | --- a/configure.in | ||
| 26 | +++ b/configure.in | ||
| 27 | @@ -877,10 +877,17 @@ ac_cv_ping_has_timeout=no | ||
| 28 | if test -n "$with_ping_command" | ||
| 29 | then | ||
| 30 | AC_MSG_RESULT([(command-line) $with_ping_command]) | ||
| 31 | - if test -n "$ac_cv_ping_packets_first" | ||
| 32 | + if echo "$with_ping_command" | grep '%d.*%d.*%s' >/dev/null | ||
| 33 | then | ||
| 34 | ac_cv_ping_packets_first=yes | ||
| 35 | ac_cv_ping_has_timeout=yes | ||
| 36 | + elif echo "$with_ping_command" | grep '%d.*%s.*%d' >/dev/null || \ | ||
| 37 | + echo "$with_ping_command" | grep '%s.*%d.*%d' >/dev/null | ||
| 38 | + then | ||
| 39 | + ac_cv_ping_has_timeout=yes | ||
| 40 | + elif echo "$with_ping_command" | grep '%d.*%s' >/dev/null | ||
| 41 | + then | ||
| 42 | + ac_cv_ping_packets_first=yes | ||
| 43 | fi | ||
| 44 | |||
| 45 | elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \ | ||
| 46 | @@ -981,7 +988,15 @@ ac_cv_ping6_packets_first=no | ||
| 47 | if test -n "$with_ping6_command" | ||
| 48 | then | ||
| 49 | AC_MSG_RESULT([(command-line) $with_ping6_command]) | ||
| 50 | - if test -n "$ac_cv_ping6_packets_first" | ||
| 51 | + if echo "$with_ping6_command" | grep '%d.*%d.*%s' >/dev/null | ||
| 52 | + then | ||
| 53 | + ac_cv_ping6_packets_first=yes | ||
| 54 | + elif echo "$with_ping6_command" | grep '%d.*%s.*%d' >/dev/null || \ | ||
| 55 | + echo "$with_ping6_command" | grep '%s.*%d.*%d' >/dev/null | ||
| 56 | + then | ||
| 57 | + # Just keep same logic as ping (IPv4) if we ever need ac_cv_ping6_has_timeout | ||
| 58 | + true | ||
| 59 | + elif echo "$with_ping6_command" | grep '%d.*%s' >/dev/null | ||
| 60 | then | ||
| 61 | ac_cv_ping6_packets_first=yes | ||
| 62 | fi | ||
| 63 | -- | ||
| 64 | 1.6.5.1 | ||
| 65 | |||
diff --git a/web/attachments/354010-41_check_ping_detect_args.dpatch b/web/attachments/354010-41_check_ping_detect_args.dpatch new file mode 100644 index 0000000..98e1d36 --- /dev/null +++ b/web/attachments/354010-41_check_ping_detect_args.dpatch | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | diff -uNr nagios-plugins-1.4.14-58-g96f2/configure nagios-plugins-1.4.14-59-g96a2/configure | ||
| 2 | --- nagios-plugins-1.4.14-58-g96f2/configure 2009-12-04 21:00:51.000000000 +0000 | ||
| 3 | +++ nagios-plugins-1.4.14-59-g96a2/configure 2009-12-05 20:02:24.000000000 +0000 | ||
| 4 | @@ -26914,10 +26914,17 @@ | ||
| 5 | then | ||
| 6 | { echo "$as_me:$LINENO: result: (command-line) $with_ping_command" >&5 | ||
| 7 | echo "${ECHO_T}(command-line) $with_ping_command" >&6; } | ||
| 8 | - if test -n "$ac_cv_ping_packets_first" | ||
| 9 | + if echo "$with_ping_command" | grep '%d.*%d.*%s' >/dev/null | ||
| 10 | then | ||
| 11 | ac_cv_ping_packets_first=yes | ||
| 12 | ac_cv_ping_has_timeout=yes | ||
| 13 | + elif echo "$with_ping_command" | grep '%d.*%s.*%d' >/dev/null || \ | ||
| 14 | + echo "$with_ping_command" | grep '%s.*%d.*%d' >/dev/null | ||
| 15 | + then | ||
| 16 | + ac_cv_ping_has_timeout=yes | ||
| 17 | + elif echo "$with_ping_command" | grep '%d.*%s' >/dev/null | ||
| 18 | + then | ||
| 19 | + ac_cv_ping_packets_first=yes | ||
| 20 | fi | ||
| 21 | |||
| 22 | elif [ "z$ac_cv_uname_s" = "zUnixWare" ] && \ | ||
| 23 | @@ -27042,7 +27049,15 @@ | ||
| 24 | then | ||
| 25 | { echo "$as_me:$LINENO: result: (command-line) $with_ping6_command" >&5 | ||
| 26 | echo "${ECHO_T}(command-line) $with_ping6_command" >&6; } | ||
| 27 | - if test -n "$ac_cv_ping6_packets_first" | ||
| 28 | + if echo "$with_ping6_command" | grep '%d.*%d.*%s' >/dev/null | ||
| 29 | + then | ||
| 30 | + ac_cv_ping6_packets_first=yes | ||
| 31 | + elif echo "$with_ping6_command" | grep '%d.*%s.*%d' >/dev/null || \ | ||
| 32 | + echo "$with_ping6_command" | grep '%s.*%d.*%d' >/dev/null | ||
| 33 | + then | ||
| 34 | + # Just keep same logic as ping (IPv4) if we ever need ac_cv_ping6_has_timeout | ||
| 35 | + true | ||
| 36 | + elif echo "$with_ping6_command" | grep '%d.*%s' >/dev/null | ||
| 37 | then | ||
| 38 | ac_cv_ping6_packets_first=yes | ||
| 39 | fi | ||
| 40 | diff -uNr nagios-plugins-1.4.14-58-g96f2/configure.in nagios-plugins-1.4.14-59-g96a2/configure.in | ||
| 41 | --- nagios-plugins-1.4.14-58-g96f2/configure.in 2009-12-04 21:00:08.000000000 +0000 | ||
| 42 | +++ nagios-plugins-1.4.14-59-g96a2/configure.in 2009-12-05 20:01:44.000000000 +0000 | ||
| 43 | @@ -877,10 +877,17 @@ | ||
| 44 | if test -n "$with_ping_command" | ||
| 45 | then | ||
| 46 | AC_MSG_RESULT([(command-line) $with_ping_command]) | ||
| 47 | - if test -n "$ac_cv_ping_packets_first" | ||
| 48 | + if echo "$with_ping_command" | grep '%d.*%d.*%s' >/dev/null | ||
| 49 | then | ||
| 50 | ac_cv_ping_packets_first=yes | ||
| 51 | ac_cv_ping_has_timeout=yes | ||
| 52 | + elif echo "$with_ping_command" | grep '%d.*%s.*%d' >/dev/null || \ | ||
| 53 | + echo "$with_ping_command" | grep '%s.*%d.*%d' >/dev/null | ||
| 54 | + then | ||
| 55 | + ac_cv_ping_has_timeout=yes | ||
| 56 | + elif echo "$with_ping_command" | grep '%d.*%s' >/dev/null | ||
| 57 | + then | ||
| 58 | + ac_cv_ping_packets_first=yes | ||
| 59 | fi | ||
| 60 | |||
| 61 | elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \ | ||
| 62 | @@ -981,7 +988,15 @@ | ||
| 63 | if test -n "$with_ping6_command" | ||
| 64 | then | ||
| 65 | AC_MSG_RESULT([(command-line) $with_ping6_command]) | ||
| 66 | - if test -n "$ac_cv_ping6_packets_first" | ||
| 67 | + if echo "$with_ping6_command" | grep '%d.*%d.*%s' >/dev/null | ||
| 68 | + then | ||
| 69 | + ac_cv_ping6_packets_first=yes | ||
| 70 | + elif echo "$with_ping6_command" | grep '%d.*%s.*%d' >/dev/null || \ | ||
| 71 | + echo "$with_ping6_command" | grep '%s.*%d.*%d' >/dev/null | ||
| 72 | + then | ||
| 73 | + # Just keep same logic as ping (IPv4) if we ever need ac_cv_ping6_has_timeout | ||
| 74 | + true | ||
| 75 | + elif echo "$with_ping6_command" | grep '%d.*%s' >/dev/null | ||
| 76 | then | ||
| 77 | ac_cv_ping6_packets_first=yes | ||
| 78 | fi | ||
diff --git a/web/attachments/354011-41_check_ping_detect_args_2.dpatch b/web/attachments/354011-41_check_ping_detect_args_2.dpatch new file mode 100644 index 0000000..351b506 --- /dev/null +++ b/web/attachments/354011-41_check_ping_detect_args_2.dpatch | |||
| @@ -0,0 +1,293 @@ | |||
| 1 | diff -uNr nagios-plugins-1.4.14-56-g4b226/configure nagios-plugins-1.4.14-59-g96a2/configure | ||
| 2 | --- nagios-plugins-1.4.14-56-g4b226/configure 2009-11-23 13:00:57.000000000 +0000 | ||
| 3 | +++ nagios-plugins-1.4.14-59-g96a2/configure 2009-12-05 20:02:24.000000000 +0000 | ||
| 4 | @@ -26914,17 +26914,24 @@ | ||
| 5 | then | ||
| 6 | { echo "$as_me:$LINENO: result: (command-line) $with_ping_command" >&5 | ||
| 7 | echo "${ECHO_T}(command-line) $with_ping_command" >&6; } | ||
| 8 | - if test -n "$ac_cv_ping_packets_first" | ||
| 9 | + if echo "$with_ping_command" | grep '%d.*%d.*%s' >/dev/null | ||
| 10 | then | ||
| 11 | ac_cv_ping_packets_first=yes | ||
| 12 | ac_cv_ping_has_timeout=yes | ||
| 13 | + elif echo "$with_ping_command" | grep '%d.*%s.*%d' >/dev/null || \ | ||
| 14 | + echo "$with_ping_command" | grep '%s.*%d.*%d' >/dev/null | ||
| 15 | + then | ||
| 16 | + ac_cv_ping_has_timeout=yes | ||
| 17 | + elif echo "$with_ping_command" | grep '%d.*%s' >/dev/null | ||
| 18 | + then | ||
| 19 | + ac_cv_ping_packets_first=yes | ||
| 20 | fi | ||
| 21 | |||
| 22 | elif [ "z$ac_cv_uname_s" = "zUnixWare" ] && \ | ||
| 23 | $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \ | ||
| 24 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 25 | then | ||
| 26 | - with_ping_command="$PATH_TO_PING -n -U -c %d %s" | ||
| 27 | + with_ping_command="$PATH_TO_PING -n -U -c %d %s" | ||
| 28 | ac_cv_ping_packets_first=yes | ||
| 29 | { echo "$as_me:$LINENO: result: $with_ping_command" >&5 | ||
| 30 | echo "${ECHO_T}$with_ping_command" >&6; } | ||
| 31 | @@ -26932,7 +26939,7 @@ | ||
| 32 | elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \ | ||
| 33 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 34 | then | ||
| 35 | - with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s" | ||
| 36 | + with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s" | ||
| 37 | ac_cv_ping_packets_first=yes | ||
| 38 | ac_cv_ping_has_timeout=yes | ||
| 39 | { echo "$as_me:$LINENO: result: $with_ping_command" >&5 | ||
| 40 | @@ -26941,7 +26948,7 @@ | ||
| 41 | elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \ | ||
| 42 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 43 | then | ||
| 44 | - with_ping_command="$PATH_TO_PING -n -U -c %d %s" | ||
| 45 | + with_ping_command="$PATH_TO_PING -n -U -c %d %s" | ||
| 46 | ac_cv_ping_packets_first=yes | ||
| 47 | { echo "$as_me:$LINENO: result: $with_ping_command" >&5 | ||
| 48 | echo "${ECHO_T}$with_ping_command" >&6; } | ||
| 49 | @@ -27042,7 +27049,15 @@ | ||
| 50 | then | ||
| 51 | { echo "$as_me:$LINENO: result: (command-line) $with_ping6_command" >&5 | ||
| 52 | echo "${ECHO_T}(command-line) $with_ping6_command" >&6; } | ||
| 53 | - if test -n "$ac_cv_ping6_packets_first" | ||
| 54 | + if echo "$with_ping6_command" | grep '%d.*%d.*%s' >/dev/null | ||
| 55 | + then | ||
| 56 | + ac_cv_ping6_packets_first=yes | ||
| 57 | + elif echo "$with_ping6_command" | grep '%d.*%s.*%d' >/dev/null || \ | ||
| 58 | + echo "$with_ping6_command" | grep '%s.*%d.*%d' >/dev/null | ||
| 59 | + then | ||
| 60 | + # Just keep same logic as ping (IPv4) if we ever need ac_cv_ping6_has_timeout | ||
| 61 | + true | ||
| 62 | + elif echo "$with_ping6_command" | grep '%d.*%s' >/dev/null | ||
| 63 | then | ||
| 64 | ac_cv_ping6_packets_first=yes | ||
| 65 | fi | ||
| 66 | @@ -27052,7 +27067,7 @@ | ||
| 67 | $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \ | ||
| 68 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 69 | then | ||
| 70 | - with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s" | ||
| 71 | + with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s" | ||
| 72 | ac_cv_ping6_packets_first=yes | ||
| 73 | { echo "$as_me:$LINENO: result: $with_ping6_command" >&5 | ||
| 74 | echo "${ECHO_T}$with_ping6_command" >&6; } | ||
| 75 | @@ -27069,7 +27084,7 @@ | ||
| 76 | elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \ | ||
| 77 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 78 | then | ||
| 79 | - with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s" | ||
| 80 | + with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s" | ||
| 81 | ac_cv_ping6_packets_first=yes | ||
| 82 | { echo "$as_me:$LINENO: result: $with_ping6_command" >&5 | ||
| 83 | echo "${ECHO_T}$with_ping6_command" >&6; } | ||
| 84 | @@ -27133,7 +27148,7 @@ | ||
| 85 | $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \ | ||
| 86 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 87 | then | ||
| 88 | - with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s" | ||
| 89 | + with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s" | ||
| 90 | ac_cv_ping6_packets_first=yes | ||
| 91 | { echo "$as_me:$LINENO: result: $with_ping6_command" >&5 | ||
| 92 | echo "${ECHO_T}$with_ping6_command" >&6; } | ||
| 93 | @@ -27141,7 +27156,7 @@ | ||
| 94 | elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \ | ||
| 95 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 96 | then | ||
| 97 | - with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s" | ||
| 98 | + with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s" | ||
| 99 | ac_cv_ping6_packets_first=yes | ||
| 100 | { echo "$as_me:$LINENO: result: $with_ping6_command" >&5 | ||
| 101 | echo "${ECHO_T}$with_ping6_command" >&6; } | ||
| 102 | @@ -28500,7 +28515,7 @@ | ||
| 103 | |||
| 104 | #include <unistd.h> | ||
| 105 | #include <sys/types.h> | ||
| 106 | - #include <sys/param.h> | ||
| 107 | + #include <sys/param.h> | ||
| 108 | #include <sys/stat.h> | ||
| 109 | #include <sys/swap.h> | ||
| 110 | |||
| 111 | @@ -28574,7 +28589,7 @@ | ||
| 112 | /* end confdefs.h. */ | ||
| 113 | |||
| 114 | #include <sys/types.h> | ||
| 115 | - #include <sys/param.h> | ||
| 116 | + #include <sys/param.h> | ||
| 117 | #include <sys/stat.h> | ||
| 118 | #include <sys/swap.h> | ||
| 119 | |||
| 120 | @@ -28641,7 +28656,7 @@ | ||
| 121 | /* end confdefs.h. */ | ||
| 122 | |||
| 123 | #include <sys/types.h> | ||
| 124 | - #include <sys/param.h> | ||
| 125 | + #include <sys/param.h> | ||
| 126 | #include <sys/stat.h> | ||
| 127 | #include <sys/swap.h> | ||
| 128 | |||
| 129 | @@ -28708,11 +28723,11 @@ | ||
| 130 | cat >>conftest.$ac_ext <<_ACEOF | ||
| 131 | /* end confdefs.h. */ | ||
| 132 | |||
| 133 | - #include <unistd.h> | ||
| 134 | - #include <sys/types.h> | ||
| 135 | - #include <sys/param.h> | ||
| 136 | - #include <sys/stat.h> | ||
| 137 | - #include <sys/swap.h> | ||
| 138 | + #include <unistd.h> | ||
| 139 | + #include <sys/types.h> | ||
| 140 | + #include <sys/param.h> | ||
| 141 | + #include <sys/stat.h> | ||
| 142 | + #include <sys/swap.h> | ||
| 143 | |||
| 144 | |||
| 145 | int | ||
| 146 | @@ -28754,11 +28769,11 @@ | ||
| 147 | cat >>conftest.$ac_ext <<_ACEOF | ||
| 148 | /* end confdefs.h. */ | ||
| 149 | |||
| 150 | - #include <unistd.h> | ||
| 151 | - #include <sys/types.h> | ||
| 152 | - #include <sys/param.h> | ||
| 153 | - #include <sys/stat.h> | ||
| 154 | - #include <sys/swap.h> | ||
| 155 | + #include <unistd.h> | ||
| 156 | + #include <sys/types.h> | ||
| 157 | + #include <sys/param.h> | ||
| 158 | + #include <sys/stat.h> | ||
| 159 | + #include <sys/swap.h> | ||
| 160 | |||
| 161 | |||
| 162 | int | ||
| 163 | diff -uNr nagios-plugins-1.4.14-56-g4b226/configure.in nagios-plugins-1.4.14-59-g96a2/configure.in | ||
| 164 | --- nagios-plugins-1.4.14-56-g4b226/configure.in 2009-11-23 12:00:03.000000000 +0000 | ||
| 165 | +++ nagios-plugins-1.4.14-59-g96a2/configure.in 2009-12-05 20:01:44.000000000 +0000 | ||
| 166 | @@ -877,24 +877,31 @@ | ||
| 167 | if test -n "$with_ping_command" | ||
| 168 | then | ||
| 169 | AC_MSG_RESULT([(command-line) $with_ping_command]) | ||
| 170 | - if test -n "$ac_cv_ping_packets_first" | ||
| 171 | + if echo "$with_ping_command" | grep '%d.*%d.*%s' >/dev/null | ||
| 172 | then | ||
| 173 | ac_cv_ping_packets_first=yes | ||
| 174 | ac_cv_ping_has_timeout=yes | ||
| 175 | + elif echo "$with_ping_command" | grep '%d.*%s.*%d' >/dev/null || \ | ||
| 176 | + echo "$with_ping_command" | grep '%s.*%d.*%d' >/dev/null | ||
| 177 | + then | ||
| 178 | + ac_cv_ping_has_timeout=yes | ||
| 179 | + elif echo "$with_ping_command" | grep '%d.*%s' >/dev/null | ||
| 180 | + then | ||
| 181 | + ac_cv_ping_packets_first=yes | ||
| 182 | fi | ||
| 183 | |||
| 184 | elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \ | ||
| 185 | $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \ | ||
| 186 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 187 | then | ||
| 188 | - with_ping_command="$PATH_TO_PING -n -U -c %d %s" | ||
| 189 | + with_ping_command="$PATH_TO_PING -n -U -c %d %s" | ||
| 190 | ac_cv_ping_packets_first=yes | ||
| 191 | AC_MSG_RESULT([$with_ping_command]) | ||
| 192 | |||
| 193 | elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \ | ||
| 194 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 195 | then | ||
| 196 | - with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s" | ||
| 197 | + with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s" | ||
| 198 | ac_cv_ping_packets_first=yes | ||
| 199 | ac_cv_ping_has_timeout=yes | ||
| 200 | AC_MSG_RESULT([$with_ping_command]) | ||
| 201 | @@ -902,7 +909,7 @@ | ||
| 202 | elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \ | ||
| 203 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 204 | then | ||
| 205 | - with_ping_command="$PATH_TO_PING -n -U -c %d %s" | ||
| 206 | + with_ping_command="$PATH_TO_PING -n -U -c %d %s" | ||
| 207 | ac_cv_ping_packets_first=yes | ||
| 208 | AC_MSG_RESULT([$with_ping_command]) | ||
| 209 | |||
| 210 | @@ -981,7 +988,15 @@ | ||
| 211 | if test -n "$with_ping6_command" | ||
| 212 | then | ||
| 213 | AC_MSG_RESULT([(command-line) $with_ping6_command]) | ||
| 214 | - if test -n "$ac_cv_ping6_packets_first" | ||
| 215 | + if echo "$with_ping6_command" | grep '%d.*%d.*%s' >/dev/null | ||
| 216 | + then | ||
| 217 | + ac_cv_ping6_packets_first=yes | ||
| 218 | + elif echo "$with_ping6_command" | grep '%d.*%s.*%d' >/dev/null || \ | ||
| 219 | + echo "$with_ping6_command" | grep '%s.*%d.*%d' >/dev/null | ||
| 220 | + then | ||
| 221 | + # Just keep same logic as ping (IPv4) if we ever need ac_cv_ping6_has_timeout | ||
| 222 | + true | ||
| 223 | + elif echo "$with_ping6_command" | grep '%d.*%s' >/dev/null | ||
| 224 | then | ||
| 225 | ac_cv_ping6_packets_first=yes | ||
| 226 | fi | ||
| 227 | @@ -991,7 +1006,7 @@ | ||
| 228 | $PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \ | ||
| 229 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 230 | then | ||
| 231 | - with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s" | ||
| 232 | + with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s" | ||
| 233 | ac_cv_ping6_packets_first=yes | ||
| 234 | AC_MSG_RESULT([$with_ping6_command]) | ||
| 235 | |||
| 236 | @@ -1006,7 +1021,7 @@ | ||
| 237 | elif $PATH_TO_PING6 -n -U -c 1 ::1 2>/dev/null | \ | ||
| 238 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 239 | then | ||
| 240 | - with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s" | ||
| 241 | + with_ping6_command="$PATH_TO_PING6 -n -U -c %d %s" | ||
| 242 | ac_cv_ping6_packets_first=yes | ||
| 243 | AC_MSG_RESULT([$with_ping6_command]) | ||
| 244 | |||
| 245 | @@ -1062,14 +1077,14 @@ | ||
| 246 | $PATH_TO_PING -A inet6 -n -s ::1 56 1 2>/dev/null | \ | ||
| 247 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 248 | then | ||
| 249 | - with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s" | ||
| 250 | + with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s" | ||
| 251 | ac_cv_ping6_packets_first=yes | ||
| 252 | AC_MSG_RESULT([$with_ping6_command]) | ||
| 253 | |||
| 254 | elif $PATH_TO_PING -A inet6 -n -U -c 1 ::1 2>/dev/null | \ | ||
| 255 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 256 | then | ||
| 257 | - with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s" | ||
| 258 | + with_ping6_command="$PATH_TO_PING -A inet6 -n -U -c %d %s" | ||
| 259 | ac_cv_ping6_packets_first=yes | ||
| 260 | AC_MSG_RESULT([$with_ping6_command]) | ||
| 261 | |||
| 262 | @@ -1411,23 +1426,23 @@ | ||
| 263 | AC_CHECK_DECLS([swapctl],,,[ | ||
| 264 | #include <unistd.h> | ||
| 265 | #include <sys/types.h> | ||
| 266 | - #include <sys/param.h> | ||
| 267 | + #include <sys/param.h> | ||
| 268 | #include <sys/stat.h> | ||
| 269 | #include <sys/swap.h> | ||
| 270 | ]) | ||
| 271 | AC_CHECK_TYPES([swaptbl_t, swapent_t],,,[ | ||
| 272 | #include <sys/types.h> | ||
| 273 | - #include <sys/param.h> | ||
| 274 | + #include <sys/param.h> | ||
| 275 | #include <sys/stat.h> | ||
| 276 | #include <sys/swap.h> | ||
| 277 | ]) | ||
| 278 | AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[ | ||
| 279 | - #include <unistd.h> | ||
| 280 | - #include <sys/types.h> | ||
| 281 | - #include <sys/param.h> | ||
| 282 | - #include <sys/stat.h> | ||
| 283 | - #include <sys/swap.h> | ||
| 284 | - ]) | ||
| 285 | + #include <unistd.h> | ||
| 286 | + #include <sys/types.h> | ||
| 287 | + #include <sys/param.h> | ||
| 288 | + #include <sys/stat.h> | ||
| 289 | + #include <sys/swap.h> | ||
| 290 | + ]) | ||
| 291 | |||
| 292 | if test "$ac_cv_have_decl_swapctl" = "yes"; | ||
| 293 | then | ||
diff --git a/web/attachments/35427-check_mrtgtraf.c.patch b/web/attachments/35427-check_mrtgtraf.c.patch new file mode 100644 index 0000000..3fb92b9 --- /dev/null +++ b/web/attachments/35427-check_mrtgtraf.c.patch | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | --- check_mrtgtraf.c Thu Nov 14 15:48:42 2002 | ||
| 2 | +++ check_mrtgtraf.c.orig Thu Nov 14 16:06:15 2002 | ||
| 3 | @@ -197,26 +197,27 @@ | ||
| 4 | if (incoming_rate > incoming_critical_threshold | ||
| 5 | || outgoing_rate > outgoing_critical_threshold) { | ||
| 6 | result = STATE_CRITICAL; | ||
| 7 | - asprintf (&error_message, "Traffic CRITICAL %s. In = %0.1f %s, %s. Out = %0.1f %s", | ||
| 8 | - (use_average == TRUE) ? "Avg" : "Max", adjusted_incoming_rate, | ||
| 9 | - incoming_speed_rating, (use_average == TRUE) ? "Avg" : "Max", | ||
| 10 | + asprintf (&error_message, "%s. In = %0.1f %s, %s. Out = %0.1f %s", | ||
| 11 | + (use_average == TRUE) ? "Ave" : "Max", adjusted_incoming_rate, | ||
| 12 | + incoming_speed_rating, (use_average == TRUE) ? "Ave" : "Max", | ||
| 13 | adjusted_outgoing_rate, outgoing_speed_rating); | ||
| 14 | } | ||
| 15 | else if (incoming_rate > incoming_warning_threshold | ||
| 16 | || outgoing_rate > outgoing_warning_threshold) { | ||
| 17 | result = STATE_WARNING; | ||
| 18 | - asprintf (&error_message, "Traffic WARNING %s. In = %0.1f %s, %s. Out = %0.1f %s", | ||
| 19 | - (use_average == TRUE) ? "Avg" : "Max", adjusted_incoming_rate, | ||
| 20 | - incoming_speed_rating, (use_average == TRUE) ? "Avg" : "Max", | ||
| 21 | + asprintf (&error_message, "%s. In = %0.1f %s, %s. Out = %0.1f %s", | ||
| 22 | + (use_average == TRUE) ? "Ave" : "Max", adjusted_incoming_rate, | ||
| 23 | + incoming_speed_rating, (use_average == TRUE) ? "Ave" : "Max", | ||
| 24 | adjusted_outgoing_rate, outgoing_speed_rating); | ||
| 25 | } | ||
| 26 | - else if (result == STATE_OK) | ||
| 27 | - printf ("Traffic OK - %s. In = %0.1f %s, %s. Out = %0.1f %s\n", | ||
| 28 | - (use_average == TRUE) ? "Avg" : "Max", adjusted_incoming_rate, | ||
| 29 | - incoming_speed_rating, (use_average == TRUE) ? "Avg" : "Max", | ||
| 30 | + | ||
| 31 | + if (result == STATE_OK) | ||
| 32 | + printf ("Traffic ok - %s. In = %0.1f %s, %s. Out = %0.1f %s\n", | ||
| 33 | + (use_average == TRUE) ? "Ave" : "Max", adjusted_incoming_rate, | ||
| 34 | + incoming_speed_rating, (use_average == TRUE) ? "Ave" : "Max", | ||
| 35 | adjusted_outgoing_rate, outgoing_speed_rating); | ||
| 36 | else | ||
| 37 | - printf ("UNKNOWN %s\n", error_message); | ||
| 38 | + printf ("%s\n", error_message); | ||
| 39 | |||
| 40 | return result; | ||
| 41 | } | ||
diff --git a/web/attachments/354598-patch-check_radius.c.txt b/web/attachments/354598-patch-check_radius.c.txt new file mode 100644 index 0000000..4a57128 --- /dev/null +++ b/web/attachments/354598-patch-check_radius.c.txt | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | --- plugins/check_radius.c.virgin 2009-12-09 18:04:27.000000000 -0800 | ||
| 2 | +++ plugins/check_radius.c 2009-12-09 18:27:42.000000000 -0800 | ||
| 3 | @@ -191,13 +191,16 @@ | ||
| 4 | die (STATE_CRITICAL, _("Timeout")); | ||
| 5 | if (result == ERROR_RC) | ||
| 6 | die (STATE_CRITICAL, _("Auth Error")); | ||
| 7 | - if (result == BADRESP_RC) | ||
| 8 | + if (result == REJECT_RC) | ||
| 9 | die (STATE_WARNING, _("Auth Failed")); | ||
| 10 | + if (result == BADRESP_RC) | ||
| 11 | + die (STATE_WARNING, _("Bad Response")); | ||
| 12 | if (expect && !strstr (msg, expect)) | ||
| 13 | die (STATE_WARNING, "%s", msg); | ||
| 14 | if (result == OK_RC) | ||
| 15 | die (STATE_OK, _("Auth OK")); | ||
| 16 | - return (0); | ||
| 17 | + (void)snprintf(msg, sizeof(msg), "unexpected result code %d", result); | ||
| 18 | + die (STATE_UNKNOWN, _(msg)); | ||
| 19 | } | ||
| 20 | |||
| 21 | |||
diff --git a/web/attachments/35463-check_ldap.c.patch b/web/attachments/35463-check_ldap.c.patch new file mode 100644 index 0000000..aca1f34 --- /dev/null +++ b/web/attachments/35463-check_ldap.c.patch | |||
| @@ -0,0 +1,302 @@ | |||
| 1 | --- check_ldap.c.orig Thu Nov 14 18:47:22 2002 | ||
| 2 | +++ check_ldap.c Fri Nov 15 13:54:00 2002 | ||
| 3 | @@ -7,7 +7,10 @@ | ||
| 4 | * | ||
| 5 | * Last Modified: $Date: 2002/02/28 06:42:57 $ | ||
| 6 | * | ||
| 7 | - * Command line: check_ldap -h <host> -b <base_dn> -p <port> -w <warn_time> -w <crit_time> | ||
| 8 | + * Command line: check_ldap -H <host> -b <base_dn> -p <port> [-f <attr>] | ||
| 9 | + * [-a <attr>] [-e <expect>] [-W <Warn_attr>] [-C <Crit_attr>] [-r] | ||
| 10 | + * [-D <binddn>] [-P <password>] | ||
| 11 | + * [-w <warn_time>] [-c <crit_time>] [-t timeout] [-v] | ||
| 12 | * | ||
| 13 | * Description: | ||
| 14 | * | ||
| 15 | @@ -17,6 +20,8 @@ | ||
| 16 | * | ||
| 17 | * 08-25-1999 Ethan Galstad (nagios@nagios.org) | ||
| 18 | * Modified to use common plugin include file | ||
| 19 | + * 11-15-2002 Gyula Szabo (gyufi@sztaki.hu) | ||
| 20 | + * Modified check_ldap.c | ||
| 21 | * | ||
| 22 | *****************************************************************************/ | ||
| 23 | |||
| 24 | @@ -41,6 +46,12 @@ | ||
| 25 | |||
| 26 | char ld_defattr[] = "(objectclass=*)"; | ||
| 27 | char *ld_attr = ld_defattr; | ||
| 28 | +char *attr = ""; | ||
| 29 | +char *expect = ""; | ||
| 30 | +int verbose = 0; | ||
| 31 | +int reverse = 0; | ||
| 32 | +char *attr_warn = "", *attr_crit = ""; | ||
| 33 | +long attr_warn_long, attr_crit_long; | ||
| 34 | char *ld_host = NULL, *ld_base = NULL, *ld_passwd = NULL, *ld_binddn = NULL; | ||
| 35 | unsigned int ld_port = 389; | ||
| 36 | int warn_time = UNKNOWN, crit_time = UNKNOWN; | ||
| 37 | @@ -50,14 +61,26 @@ | ||
| 38 | { | ||
| 39 | |||
| 40 | LDAP *ld; | ||
| 41 | - LDAPMessage *result; | ||
| 42 | + LDAPMessage *result, *e; | ||
| 43 | |||
| 44 | - int t_diff; | ||
| 45 | + int t_diff, i; | ||
| 46 | time_t time0, time1; | ||
| 47 | + BerElement *ber; | ||
| 48 | + char *a, *dn; | ||
| 49 | + char **vals; | ||
| 50 | + char * pEnd; | ||
| 51 | + char res[50] = ""; | ||
| 52 | |||
| 53 | if (process_arguments (argc, argv) == ERROR) | ||
| 54 | usage ("check_ldap: could not parse arguments\n"); | ||
| 55 | |||
| 56 | + if (validate_arguments () == ERROR) | ||
| 57 | + usage ("check_ldap: not valid arguments\n"); | ||
| 58 | + | ||
| 59 | + /* convert strings to long integers */ | ||
| 60 | + attr_warn_long = strtol (attr_warn,&pEnd,0); | ||
| 61 | + attr_crit_long = strtol (attr_crit,&pEnd,0); | ||
| 62 | + | ||
| 63 | /* initialize alarm signal handling */ | ||
| 64 | signal (SIGALRM, socket_timeout_alarm_handler); | ||
| 65 | |||
| 66 | @@ -70,7 +93,7 @@ | ||
| 67 | /* initialize ldap */ | ||
| 68 | if (!(ld = ldap_open (ld_host, ld_port))) { | ||
| 69 | /*ldap_perror(ld, "ldap_open"); */ | ||
| 70 | - printf ("Could not connect to the server at port %i\n", ld_port); | ||
| 71 | + printf ("LDAP critical - Could not connect to the server at port %i\n", ld_port); | ||
| 72 | return STATE_CRITICAL; | ||
| 73 | } | ||
| 74 | |||
| 75 | @@ -78,7 +101,7 @@ | ||
| 76 | if (ldap_bind_s (ld, ld_binddn, ld_passwd, LDAP_AUTH_SIMPLE) != | ||
| 77 | LDAP_SUCCESS) { | ||
| 78 | /*ldap_perror(ld, "ldap_bind"); */ | ||
| 79 | - printf ("Could not bind to the ldap-server\n"); | ||
| 80 | + printf ("LDAP critical - Could not bind to the ldap-server\n"); | ||
| 81 | return STATE_CRITICAL; | ||
| 82 | } | ||
| 83 | |||
| 84 | @@ -86,10 +109,68 @@ | ||
| 85 | if (ldap_search_s (ld, ld_base, LDAP_SCOPE_BASE, ld_attr, NULL, 0, &result) | ||
| 86 | != LDAP_SUCCESS) { | ||
| 87 | /*ldap_perror(ld, "ldap_search"); */ | ||
| 88 | - printf ("Could not search/find objectclasses in %s\n", ld_base); | ||
| 89 | + printf ("LDAP critical - Could not search/find objectclasses in %s\n", ld_base); | ||
| 90 | return STATE_CRITICAL; | ||
| 91 | } | ||
| 92 | |||
| 93 | + | ||
| 94 | + /* For each matching entry, print the entry name and its attributes. */ | ||
| 95 | + for ( e = ldap_first_entry( ld, result ); e != NULL; | ||
| 96 | + e = ldap_next_entry( ld, e ) ) { | ||
| 97 | + if ( ( dn = ldap_get_dn( ld, e ) ) != NULL ) { | ||
| 98 | + if (verbose) {printf( "dn: %s\n", dn );} | ||
| 99 | + ldap_memfree( dn ); | ||
| 100 | + } | ||
| 101 | + for ( a = ldap_first_attribute( ld, e, &ber ); a != NULL; | ||
| 102 | + a = ldap_next_attribute( ld, e, ber ) ) { | ||
| 103 | + if ( ( vals = ldap_get_values( ld, e, a ) ) != NULL ) { | ||
| 104 | + for ( i = 0; vals[i] != NULL; i++ ) { | ||
| 105 | + if (verbose) {printf( "%s: %s\n", a, vals[i] );} | ||
| 106 | + if ( strcmp (a,attr) == 0 ) { | ||
| 107 | + strcpy(res,a); | ||
| 108 | + strcat(res,": "); | ||
| 109 | + strncat(res,vals[i],30); | ||
| 110 | + | ||
| 111 | + if (strcmp(vals[i],expect) != 0 && strcmp("",expect) != 0 ) { | ||
| 112 | + printf ("LDAP critical - %s: %s \n", a, vals[i]); | ||
| 113 | + return STATE_CRITICAL; | ||
| 114 | + } | ||
| 115 | + if(reverse){ | ||
| 116 | + if (attr_crit_long && strtol(vals[i],&pEnd,0)<=attr_crit_long) { | ||
| 117 | + printf ("LDAP critical - %s: %s\n", a, vals[i]); | ||
| 118 | + return STATE_CRITICAL; | ||
| 119 | + } | ||
| 120 | + if (attr_warn_long && strtol(vals[i],&pEnd,0)<=attr_warn_long) { | ||
| 121 | + printf ("LDAP warning - %s: %s\n", a, vals[i]); | ||
| 122 | + return STATE_WARNING; | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | + else { | ||
| 126 | + if (attr_crit_long && strtol(vals[i],&pEnd,0)>=attr_crit_long) { | ||
| 127 | + printf ("LDAP critical - %s: %s\n", a, vals[i]); | ||
| 128 | + return STATE_CRITICAL; | ||
| 129 | + } | ||
| 130 | + if (attr_warn_long && strtol(vals[i],&pEnd,0)>=attr_warn_long) { | ||
| 131 | + printf ("LDAP warning - %s: %s\n", a, vals[i]); | ||
| 132 | + return STATE_WARNING; | ||
| 133 | + } | ||
| 134 | + } | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + } | ||
| 138 | + ldap_value_free( vals ); | ||
| 139 | + } | ||
| 140 | + ldap_memfree( a ); | ||
| 141 | + } | ||
| 142 | + if ( ber != NULL ) { | ||
| 143 | + ber_free( ber, 0 ); | ||
| 144 | + } | ||
| 145 | + printf( "\n" ); | ||
| 146 | + } | ||
| 147 | + ldap_msgfree( result ); | ||
| 148 | + | ||
| 149 | + | ||
| 150 | + | ||
| 151 | /* unbind from the ldap server */ | ||
| 152 | ldap_unbind (ld); | ||
| 153 | |||
| 154 | @@ -113,7 +194,8 @@ | ||
| 155 | } | ||
| 156 | |||
| 157 | /* print out the result */ | ||
| 158 | - printf ("LDAP ok - %i seconds response time\n", t_diff); | ||
| 159 | + if (strcmp(res,"") != 0) {printf ("LDAP ok - %i seconds response time, %s\n", t_diff, res);} | ||
| 160 | + else {printf ("LDAP ok - %i seconds response time\n", t_diff);} | ||
| 161 | |||
| 162 | return STATE_OK; | ||
| 163 | } | ||
| 164 | @@ -158,12 +240,15 @@ | ||
| 165 | {"timeout", required_argument, 0, 't'}, | ||
| 166 | {"host", required_argument, 0, 'H'}, | ||
| 167 | {"base", required_argument, 0, 'b'}, | ||
| 168 | + {"filter", required_argument, 0, 'f'}, | ||
| 169 | {"attr", required_argument, 0, 'a'}, | ||
| 170 | + {"expect", required_argument, 0, 'e'}, | ||
| 171 | {"bind", required_argument, 0, 'D'}, | ||
| 172 | {"pass", required_argument, 0, 'P'}, | ||
| 173 | {"port", required_argument, 0, 'p'}, | ||
| 174 | {"warn", required_argument, 0, 'w'}, | ||
| 175 | {"crit", required_argument, 0, 'c'}, | ||
| 176 | + {"verbose", required_argument, 0, 'v'}, | ||
| 177 | {0, 0, 0, 0} | ||
| 178 | }; | ||
| 179 | #endif | ||
| 180 | @@ -175,10 +260,10 @@ | ||
| 181 | while (1) { | ||
| 182 | #ifdef HAVE_GETOPT_H | ||
| 183 | c = | ||
| 184 | - getopt_long (argc, argv, "+hVt:c:w:H:b:p:a:D:P:", long_options, | ||
| 185 | + getopt_long (argc, argv, "+hVt:c:w:H:b:p:f:a:e:W:C:D:P:vr", long_options, | ||
| 186 | &option_index); | ||
| 187 | #else | ||
| 188 | - c = getopt (argc, argv, "+?hVt:c:w:H:b:p:a:D:P:"); | ||
| 189 | + c = getopt (argc, argv, "+?hVt:c:w:H:b:p:f:a:e:W:C:D:P:vr"); | ||
| 190 | #endif | ||
| 191 | |||
| 192 | if (c == -1 || c == EOF) | ||
| 193 | @@ -192,9 +277,14 @@ | ||
| 194 | case 'H': | ||
| 195 | case 'b': | ||
| 196 | case 'p': | ||
| 197 | + case 'f': | ||
| 198 | case 'a': | ||
| 199 | + case 'e': | ||
| 200 | + case 'W': | ||
| 201 | + case 'C': | ||
| 202 | case 'D': | ||
| 203 | case 'P': | ||
| 204 | + case 'v': | ||
| 205 | i++; | ||
| 206 | } | ||
| 207 | |||
| 208 | @@ -219,9 +309,28 @@ | ||
| 209 | case 'p': | ||
| 210 | ld_port = atoi (optarg); | ||
| 211 | break; | ||
| 212 | - case 'a': | ||
| 213 | + case 'f': | ||
| 214 | ld_attr = optarg; | ||
| 215 | break; | ||
| 216 | + case 'a': | ||
| 217 | + attr = optarg; | ||
| 218 | + break; | ||
| 219 | + case 'e': | ||
| 220 | + expect = optarg; | ||
| 221 | + break; | ||
| 222 | + case 'W': | ||
| 223 | + if (!is_intnonneg (optarg)) | ||
| 224 | + usage2 ("Warning value must be an integer", optarg); | ||
| 225 | + attr_warn = optarg; | ||
| 226 | + break; | ||
| 227 | + case 'C': | ||
| 228 | + if (!is_intnonneg (optarg)) | ||
| 229 | + usage2 ("Critical value must be an integer", optarg); | ||
| 230 | + attr_crit = optarg; | ||
| 231 | + break; | ||
| 232 | + case 'r': | ||
| 233 | + reverse = 1; | ||
| 234 | + break; | ||
| 235 | case 'D': | ||
| 236 | ld_binddn = optarg; | ||
| 237 | break; | ||
| 238 | @@ -234,6 +343,9 @@ | ||
| 239 | case 'c': | ||
| 240 | crit_time = atoi (optarg); | ||
| 241 | break; | ||
| 242 | + case 'v': | ||
| 243 | + verbose = 1; | ||
| 244 | + break; | ||
| 245 | default: | ||
| 246 | usage ("check_ldap: could not parse arguments\n"); | ||
| 247 | break; | ||
| 248 | @@ -247,7 +359,18 @@ | ||
| 249 | { | ||
| 250 | if (ld_host[0] == 0 || | ||
| 251 | ld_base[0] == 0 || | ||
| 252 | - ld_port == UNKNOWN || warn_time == UNKNOWN || crit_time == UNKNOWN) { | ||
| 253 | + ld_port == UNKNOWN || warn_time == UNKNOWN || crit_time == UNKNOWN || | ||
| 254 | + ( | ||
| 255 | + (attr != "" && expect == "") && | ||
| 256 | + (attr != "" && (attr_warn == "" || attr_crit == "")) | ||
| 257 | + ) || | ||
| 258 | + ( | ||
| 259 | + (attr_warn != "" || attr_crit != "" || expect != "") && (attr == "") | ||
| 260 | + ) || | ||
| 261 | + ( | ||
| 262 | + ((attr_warn != "" || attr_crit != "") && expect != "") | ||
| 263 | + ) | ||
| 264 | + ) { | ||
| 265 | return ERROR; | ||
| 266 | } | ||
| 267 | else { | ||
| 268 | @@ -270,13 +393,19 @@ | ||
| 269 | ("\n" | ||
| 270 | "Options:\n" | ||
| 271 | "\t-H [--host] ... host\n" | ||
| 272 | - "\t-a [--attr] ... ldap attribute to search (default: \"(objectclass=*)\"\n" | ||
| 273 | + "\t-f [--filter] ... ldap attribute to search (default: \"(objectclass=*)\"\n" | ||
| 274 | + "\t-a [--attr] ... ldap attribute to compare \n" | ||
| 275 | + "\t-e [--expect] ... expect string to match attribute - if not equal the STATE_CRITICAL will be returned\n" | ||
| 276 | + "\t-W [--Warn] ... Attribute value. - if the exceeds <Warn> the STATE_WARNING will be returned\n" | ||
| 277 | + "\t-C [--Crit] ... Attribute value. - if the exceeds <Crit> the STATE_CRITICAL will be returned\n" | ||
| 278 | + "\t-r [--reverse] ... Comparing attribute value is reverse (lower attribute value is abnormal)\n" | ||
| 279 | "\t-b [--base] ... ldap base (eg. ou=my unit, o=my org, c=at)\n" | ||
| 280 | "\t-D [--bind] ... ldap bind DN (if required)\n" | ||
| 281 | "\t-P [--pass] ... ldap password (if required)\n" | ||
| 282 | "\t-p [--port] ... ldap port (normaly 389)\n" | ||
| 283 | "\t-w [--warn] ... time in secs. - if the exceeds <warn> the STATE_WARNING will be returned\n" | ||
| 284 | "\t-c [--crit] ... time in secs. - if the exceeds <crit> the STATE_CRITICAL will be returned\n" | ||
| 285 | + "\t-v [--verbose] ... Verbose output, print all attributes\n" | ||
| 286 | "\n"); | ||
| 287 | } | ||
| 288 | |||
| 289 | @@ -285,7 +414,10 @@ | ||
| 290 | print_usage () | ||
| 291 | { | ||
| 292 | printf | ||
| 293 | - ("Usage: %s -H <host> -b <base_dn> -p <port> [-a <attr>] [-D <binddn>]\n" | ||
| 294 | - " [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n" | ||
| 295 | - "(Note: all times are in seconds.)\n", PROGNAME); | ||
| 296 | + ("Usage: %s -H <host> -b <base_dn> -p <port> [-f <attr>] \n" | ||
| 297 | + " [-a <attr>] [-e <expect>] [-W <Warn_attr>] [-C <Crit_attr>] [-r]\n" | ||
| 298 | + " [-D <binddn>] [-P <password>]\n" | ||
| 299 | + " [-w <warn_time>] [-c <crit_time>] [-t timeout] [-v]\n" | ||
| 300 | + "(Note: all times are in seconds,\n" | ||
| 301 | + " if you use -a then you\'ve to use -W and -C or -e alone.)\n", PROGNAME); | ||
| 302 | } | ||
diff --git a/web/attachments/355990-check_procs.c.patch b/web/attachments/355990-check_procs.c.patch new file mode 100644 index 0000000..f8806de --- /dev/null +++ b/web/attachments/355990-check_procs.c.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-10 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378825292" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378825292" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378825292" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378825292" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378825292'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=2918676&group_id=29880&atid=397599&file_id=355990" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/355994-check_procs.c.patch b/web/attachments/355994-check_procs.c.patch new file mode 100644 index 0000000..3aa9724 --- /dev/null +++ b/web/attachments/355994-check_procs.c.patch | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | *** plugins/check_procs.org.c Mon Dec 21 15:11:31 2009 | ||
| 2 | --- plugins/check_procs.c Mon Dec 21 15:12:17 2009 | ||
| 3 | *************** | ||
| 4 | *** 280,293 **** | ||
| 5 | } | ||
| 6 | |||
| 7 | if ( result == STATE_OK ) { | ||
| 8 | ! printf ("%s %s: ", metric_name, _("OK")); | ||
| 9 | } else if (result == STATE_WARNING) { | ||
| 10 | ! printf ("%s %s: ", metric_name, _("WARNING")); | ||
| 11 | if ( metric != METRIC_PROCS ) { | ||
| 12 | printf (_("%d warn out of "), warn); | ||
| 13 | } | ||
| 14 | } else if (result == STATE_CRITICAL) { | ||
| 15 | ! printf ("%s %s: ", metric_name, _("CRITICAL")); | ||
| 16 | if (metric != METRIC_PROCS) { | ||
| 17 | printf (_("%d crit, %d warn out of "), crit, warn); | ||
| 18 | } | ||
| 19 | --- 280,293 ---- | ||
| 20 | } | ||
| 21 | |||
| 22 | if ( result == STATE_OK ) { | ||
| 23 | ! printf ("%s %s - ", metric_name, _("OK")); | ||
| 24 | } else if (result == STATE_WARNING) { | ||
| 25 | ! printf ("%s %s - ", metric_name, _("WARNING")); | ||
| 26 | if ( metric != METRIC_PROCS ) { | ||
| 27 | printf (_("%d warn out of "), warn); | ||
| 28 | } | ||
| 29 | } else if (result == STATE_CRITICAL) { | ||
| 30 | ! printf ("%s %s - ", metric_name, _("CRITICAL")); | ||
| 31 | if (metric != METRIC_PROCS) { | ||
| 32 | printf (_("%d crit, %d warn out of "), crit, warn); | ||
| 33 | } | ||
| 34 | *************** | ||
| 35 | *** 301,306 **** | ||
| 36 | --- 301,310 ---- | ||
| 37 | if ( verbose >= 1 && strcmp(fails,"") ) | ||
| 38 | printf (" [%s]", fails); | ||
| 39 | |||
| 40 | + // Print performance statistics for drawing graphs etc. tayfunsen | ||
| 41 | + // Not sure what 0 in the end of the line is for. | ||
| 42 | + printf (" | processes=%d;%d;%d;0", procs, warn, crit); | ||
| 43 | + | ||
| 44 | printf ("\n"); | ||
| 45 | return result; | ||
| 46 | } | ||
diff --git a/web/attachments/356001-compile.log b/web/attachments/356001-compile.log new file mode 100644 index 0000000..453394c --- /dev/null +++ b/web/attachments/356001-compile.log | |||
| @@ -0,0 +1,1097 @@ | |||
| 1 | Script command is started on Mon Dec 21 14:27:11 2009. | ||
| 2 | root@:/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2# ./configure | ||
| 3 | checking for a BSD-compatible install... build-aux/install-sh -c | ||
| 4 | checking whether build environment is sane... yes | ||
| 5 | checking for a thread-safe mkdir -p... build-aux/install-sh -c -d | ||
| 6 | checking for gawk... no | ||
| 7 | checking for mawk... no | ||
| 8 | checking for nawk... nawk | ||
| 9 | checking whether make sets $(MAKE)... yes | ||
| 10 | checking build system type... powerpc-ibm-aix5.3.0.0 | ||
| 11 | checking host system type... powerpc-ibm-aix5.3.0.0 | ||
| 12 | checking for gcc... gcc | ||
| 13 | checking for C compiler default output file name... a.out | ||
| 14 | checking whether the C compiler works... yes | ||
| 15 | checking whether we are cross compiling... no | ||
| 16 | checking for suffix of executables... | ||
| 17 | checking for suffix of object files... o | ||
| 18 | checking whether we are using the GNU C compiler... yes | ||
| 19 | checking whether gcc accepts -g... yes | ||
| 20 | checking for gcc option to accept ISO C89... none needed | ||
| 21 | checking for style of include used by make... GNU | ||
| 22 | checking dependency style of gcc... gcc3 | ||
| 23 | checking for ranlib... ranlib | ||
| 24 | checking how to run the C preprocessor... gcc -E | ||
| 25 | checking for grep that handles long lines and -e... /bin/grep | ||
| 26 | checking for egrep... /bin/grep -E | ||
| 27 | checking for ANSI C header files... yes | ||
| 28 | checking for sys/types.h... yes | ||
| 29 | checking for sys/stat.h... yes | ||
| 30 | checking for stdlib.h... yes | ||
| 31 | checking for string.h... yes | ||
| 32 | checking for memory.h... yes | ||
| 33 | checking for strings.h... yes | ||
| 34 | checking for inttypes.h... yes | ||
| 35 | checking for stdint.h... yes | ||
| 36 | checking for unistd.h... yes | ||
| 37 | checking minix/config.h usability... no | ||
| 38 | checking minix/config.h presence... no | ||
| 39 | checking for minix/config.h... no | ||
| 40 | checking whether it is safe to define __EXTENSIONS__... yes | ||
| 41 | checking whether gcc needs -traditional... no | ||
| 42 | checking for a sed that does not truncate output... /bin/sed | ||
| 43 | checking for ld used by gcc... /usr/bin/ld | ||
| 44 | checking if the linker (/usr/bin/ld) is GNU ld... no | ||
| 45 | checking for /usr/bin/ld option to reload object files... -r | ||
| 46 | checking for BSD-compatible nm... /bin/nm -B | ||
| 47 | checking whether ln -s works... yes | ||
| 48 | checking how to recognize dependent libraries... pass_all | ||
| 49 | checking dlfcn.h usability... yes | ||
| 50 | checking dlfcn.h presence... yes | ||
| 51 | checking for dlfcn.h... yes | ||
| 52 | checking for g++... g++ | ||
| 53 | checking whether we are using the GNU C++ compiler... yes | ||
| 54 | checking whether g++ accepts -g... yes | ||
| 55 | checking dependency style of g++... gcc3 | ||
| 56 | checking how to run the C++ preprocessor... g++ -E | ||
| 57 | checking for g77... no | ||
| 58 | checking for xlf... no | ||
| 59 | checking for f77... no | ||
| 60 | checking for frt... no | ||
| 61 | checking for pgf77... no | ||
| 62 | checking for cf77... no | ||
| 63 | checking for fort77... no | ||
| 64 | checking for fl32... no | ||
| 65 | checking for af77... no | ||
| 66 | checking for xlf90... no | ||
| 67 | checking for f90... no | ||
| 68 | checking for pgf90... no | ||
| 69 | checking for pghpf... no | ||
| 70 | checking for epcf90... no | ||
| 71 | checking for gfortran... no | ||
| 72 | checking for g95... no | ||
| 73 | checking for xlf95... no | ||
| 74 | checking for f95... no | ||
| 75 | checking for fort... no | ||
| 76 | checking for ifort... no | ||
| 77 | checking for ifc... no | ||
| 78 | checking for efc... no | ||
| 79 | checking for pgf95... no | ||
| 80 | checking for lf95... no | ||
| 81 | checking for ftn... no | ||
| 82 | checking whether we are using the GNU Fortran 77 compiler... no | ||
| 83 | checking whether accepts -g... no | ||
| 84 | checking the maximum length of command line arguments... 786432 | ||
| 85 | checking command to parse /bin/nm -B output from gcc object... ok | ||
| 86 | checking for objdir... .libs | ||
| 87 | checking for ar... ar | ||
| 88 | checking for ranlib... (cached) ranlib | ||
| 89 | checking for strip... strip | ||
| 90 | checking if gcc supports -fno-rtti -fno-exceptions... no | ||
| 91 | checking for gcc option to produce PIC... | ||
| 92 | checking if gcc static flag -static works... no | ||
| 93 | checking if gcc supports -c -o file.o... yes | ||
| 94 | checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes | ||
| 95 | checking dynamic linker characteristics... aix5.3.0.0 ld.so | ||
| 96 | checking how to hardcode library paths into programs... immediate | ||
| 97 | checking whether stripping libraries is possible... no | ||
| 98 | checking if libtool supports shared libraries... yes | ||
| 99 | checking whether to build shared libraries... yes | ||
| 100 | checking whether to build static libraries... no | ||
| 101 | configure: creating libtool | ||
| 102 | appending configuration tag "CXX" to libtool | ||
| 103 | checking for ld used by g++... /usr/bin/ld | ||
| 104 | checking if the linker (/usr/bin/ld) is GNU ld... no | ||
| 105 | checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes | ||
| 106 | checking for g++ option to produce PIC... | ||
| 107 | checking if g++ static flag -static works... no | ||
| 108 | checking if g++ supports -c -o file.o... yes | ||
| 109 | checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes | ||
| 110 | checking dynamic linker characteristics... aix5.3.0.0 ld.so | ||
| 111 | (cached) (cached) checking how to hardcode library paths into programs... immediate | ||
| 112 | appending configuration tag "F77" to libtool | ||
| 113 | checking whether gcc and cc understand -c and -o together... yes | ||
| 114 | checking for error_at_line... no | ||
| 115 | checking for special C compiler options needed for large files... no | ||
| 116 | checking for _FILE_OFFSET_BITS value needed for large files... unknown | ||
| 117 | checking for _LARGE_FILES value needed for large files... 1 | ||
| 118 | checking for working strtod... yes | ||
| 119 | checking for python... /bin/python | ||
| 120 | checking for sh... /bin/sh | ||
| 121 | checking for perl... /bin/perl | ||
| 122 | checking for libgnutls-config... no | ||
| 123 | checking for hostname... /bin/hostname | ||
| 124 | checking for basename... /bin/basename | ||
| 125 | checking for main in -ldce... no | ||
| 126 | checking for main in -lnsl... yes | ||
| 127 | checking for socket in -lsocket... no | ||
| 128 | checking for main in -lresolv... no | ||
| 129 | checking math.h usability... yes | ||
| 130 | checking math.h presence... yes | ||
| 131 | checking for math.h... yes | ||
| 132 | checking for floor in -lm... yes | ||
| 133 | checking for plan_tests in -ltap... no | ||
| 134 | checking for main in -lcrypt... yes | ||
| 135 | checking for PQsetdbLogin in -lpq... no | ||
| 136 | configure: WARNING: Skipping PostgreSQL plugin (check_pgsql) | ||
| 137 | configure: WARNING: LIBS="-lcrypt " CPPFLAGS="" | ||
| 138 | configure: WARNING: install PostgreSQL libs to compile this plugin (see REQUIREMENTS). | ||
| 139 | checking for rc_read_config in -lradiusclient... no | ||
| 140 | checking for rc_read_config in -lradiusclient-ng... no | ||
| 141 | configure: WARNING: Skipping radius plugin | ||
| 142 | configure: WARNING: install radius libs to compile this plugin (see REQUIREMENTS). | ||
| 143 | checking for main in -lldap... yes | ||
| 144 | checking for ldap_set_option... yes | ||
| 145 | checking for ldap_init... yes | ||
| 146 | checking for ldap_set_option... (cached) yes | ||
| 147 | checking for ldap_get_option... yes | ||
| 148 | checking for ldap_start_tls_s... yes | ||
| 149 | checking linux/hdreg.h usability... no | ||
| 150 | checking linux/hdreg.h presence... no | ||
| 151 | checking for linux/hdreg.h... no | ||
| 152 | configure: WARNING: Skipping check_ide_smart plugin. | ||
| 153 | configure: WARNING: check_ide_smart is linux specific. It requires linux/hdreg.h and linux/types.h. | ||
| 154 | checking for mysql_config... no | ||
| 155 | configure: WARNING: Skipping mysql plugin | ||
| 156 | configure: WARNING: install mysql client libs to compile this plugin (see REQUIREMENTS). | ||
| 157 | checking for IPv6 support... yes | ||
| 158 | checking krb5.h usability... no | ||
| 159 | checking krb5.h presence... no | ||
| 160 | checking for krb5.h... no | ||
| 161 | checking krb5.h usability... no | ||
| 162 | checking krb5.h presence... no | ||
| 163 | checking for krb5.h... no | ||
| 164 | checking for dlopen in -ldl... yes | ||
| 165 | checking for shl_load in -ldl... no | ||
| 166 | checking openssl/ssl.h usability... yes | ||
| 167 | checking openssl/ssl.h presence... yes | ||
| 168 | checking for openssl/ssl.h... yes | ||
| 169 | checking openssl/x509.h usability... yes | ||
| 170 | checking openssl/x509.h presence... yes | ||
| 171 | checking for openssl/x509.h... yes | ||
| 172 | checking openssl/rsa.h usability... yes | ||
| 173 | checking openssl/rsa.h presence... yes | ||
| 174 | checking for openssl/rsa.h... yes | ||
| 175 | checking openssl/pem.h usability... yes | ||
| 176 | checking openssl/pem.h presence... yes | ||
| 177 | checking for openssl/pem.h... yes | ||
| 178 | checking openssl/crypto.h usability... yes | ||
| 179 | checking openssl/crypto.h presence... yes | ||
| 180 | checking for openssl/crypto.h... yes | ||
| 181 | checking openssl/err.h usability... yes | ||
| 182 | checking openssl/err.h presence... yes | ||
| 183 | checking for openssl/err.h... yes | ||
| 184 | checking for CRYPTO_lock in -lcrypto... yes | ||
| 185 | checking for main in -lssl... yes | ||
| 186 | checking whether time.h and sys/time.h may both be included... yes | ||
| 187 | checking for sys/wait.h that is POSIX.1 compatible... yes | ||
| 188 | checking signal.h usability... yes | ||
| 189 | checking signal.h presence... yes | ||
| 190 | checking for signal.h... yes | ||
| 191 | checking syslog.h usability... yes | ||
| 192 | checking syslog.h presence... yes | ||
| 193 | checking for syslog.h... yes | ||
| 194 | checking uio.h usability... no | ||
| 195 | checking uio.h presence... no | ||
| 196 | checking for uio.h... no | ||
| 197 | checking errno.h usability... yes | ||
| 198 | checking errno.h presence... yes | ||
| 199 | checking for errno.h... yes | ||
| 200 | checking sys/time.h usability... yes | ||
| 201 | checking sys/time.h presence... yes | ||
| 202 | checking for sys/time.h... yes | ||
| 203 | checking sys/socket.h usability... yes | ||
| 204 | checking sys/socket.h presence... yes | ||
| 205 | checking for sys/socket.h... yes | ||
| 206 | checking sys/un.h usability... yes | ||
| 207 | checking sys/un.h presence... yes | ||
| 208 | checking for sys/un.h... yes | ||
| 209 | checking sys/poll.h usability... yes | ||
| 210 | checking sys/poll.h presence... yes | ||
| 211 | checking for sys/poll.h... yes | ||
| 212 | checking features.h usability... no | ||
| 213 | checking features.h presence... no | ||
| 214 | checking for features.h... no | ||
| 215 | checking stdarg.h usability... yes | ||
| 216 | checking stdarg.h presence... yes | ||
| 217 | checking for stdarg.h... yes | ||
| 218 | checking sys/unistd.h usability... no | ||
| 219 | checking sys/unistd.h presence... no | ||
| 220 | checking for sys/unistd.h... no | ||
| 221 | checking ctype.h usability... yes | ||
| 222 | checking ctype.h presence... yes | ||
| 223 | checking for ctype.h... yes | ||
| 224 | checking for an ANSI C-conforming const... yes | ||
| 225 | checking whether struct tm is in sys/time.h or time.h... time.h | ||
| 226 | checking for pid_t... yes | ||
| 227 | checking for size_t... yes | ||
| 228 | checking return type of signal handlers... void | ||
| 229 | checking for va_copy... yes | ||
| 230 | checking for memmove... yes | ||
| 231 | checking for select... yes | ||
| 232 | checking for socket... yes | ||
| 233 | checking for strdup... yes | ||
| 234 | checking for strstr... yes | ||
| 235 | checking for strtol... yes | ||
| 236 | checking for strtoul... yes | ||
| 237 | checking for floor... no | ||
| 238 | checking for poll... yes | ||
| 239 | checking return type of socket size... int | ||
| 240 | checking for ps... /bin/ps | ||
| 241 | checking for ps syntax... /bin/ps -eo 'stat uid pid ppid vsz pcpu comm args' - with no RSS | ||
| 242 | checking for ping... /etc/ping | ||
| 243 | checking for ping6... no | ||
| 244 | checking for ICMP ping syntax... /etc/ping -n -c %d %s | ||
| 245 | checking for ICMPv6 ping syntax... none | ||
| 246 | checking for nslookup... /bin/nslookup | ||
| 247 | checking for nslookup syntax... /bin/nslookup | ||
| 248 | checking for number of cpus... sysconf(_SC_NPROCESSORS_CONF) | ||
| 249 | checking for uptime... /bin/uptime | ||
| 250 | checking for rpcinfo... /bin/rpcinfo | ||
| 251 | checking for lmstat... no | ||
| 252 | configure: WARNING: Get lmstat from Globetrotter Software to monitor flexlm licenses | ||
| 253 | checking for smbclient... no | ||
| 254 | configure: WARNING: Get smbclient from Samba.org to monitor SMB shares | ||
| 255 | checking for who... /bin/who | ||
| 256 | checking for snmpget... no | ||
| 257 | configure: WARNING: Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins | ||
| 258 | checking for snmpgetnext... no | ||
| 259 | configure: WARNING: Tried /bin/perl - install Net::SNMP perl module if you want to use the perl snmp plugins | ||
| 260 | checking for quakestat... no | ||
| 261 | checking for qstat... no | ||
| 262 | configure: WARNING: Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin | ||
| 263 | checking for fping... no | ||
| 264 | configure: WARNING: Get fping from http://www.fping.com in order to make check_fping plugin | ||
| 265 | checking for ssh... /bin/ssh | ||
| 266 | checking for mailq... no | ||
| 267 | configure: WARNING: Could not find mailq or eqivalent | ||
| 268 | checking for qmail-qstat... no | ||
| 269 | configure: WARNING: Could not find qmail-qstat or eqivalent | ||
| 270 | checking for swap... no | ||
| 271 | checking for swapinfo... no | ||
| 272 | checking for lsps... no | ||
| 273 | checking for sys/stat.h... (cached) yes | ||
| 274 | checking sys/param.h usability... yes | ||
| 275 | checking sys/param.h presence... yes | ||
| 276 | checking for sys/param.h... yes | ||
| 277 | checking for sys/swap.h... no | ||
| 278 | checking whether swapctl is declared... no | ||
| 279 | checking for swaptbl_t... no | ||
| 280 | checking for swapent_t... no | ||
| 281 | checking for struct swapent.se_nblks... no | ||
| 282 | checking for /proc/meminfo... no | ||
| 283 | checking for dig... /bin/dig | ||
| 284 | checking for apt-get... no | ||
| 285 | checking sys/sockio.h usability... no | ||
| 286 | checking sys/sockio.h presence... no | ||
| 287 | checking for sys/sockio.h... no | ||
| 288 | checking whether NLS is requested... yes | ||
| 289 | checking for msgfmt... /bin/msgfmt | ||
| 290 | checking for gmsgfmt... /bin/msgfmt | ||
| 291 | checking for xgettext... no | ||
| 292 | checking for msgmerge... no | ||
| 293 | checking for ld used by GCC... /usr/bin/ld | ||
| 294 | checking if the linker (/usr/bin/ld) is GNU ld... no | ||
| 295 | checking for shared library run path origin... done | ||
| 296 | checking for CFPreferencesCopyAppValue... no | ||
| 297 | checking for CFLocaleCopyCurrent... no | ||
| 298 | checking for GNU gettext in libc... no | ||
| 299 | checking for iconv... yes | ||
| 300 | checking for working iconv... no | ||
| 301 | checking for GNU gettext in libintl... yes | ||
| 302 | checking whether to use NLS... yes | ||
| 303 | checking where the gettext function comes from... external libintl | ||
| 304 | checking how to link with libintl... /lib/libintl.a | ||
| 305 | checking for main in -lpthread... yes | ||
| 306 | checking for working alloca.h... yes | ||
| 307 | checking for alloca... yes | ||
| 308 | checking arpa/inet.h usability... yes | ||
| 309 | checking arpa/inet.h presence... yes | ||
| 310 | checking for arpa/inet.h... yes | ||
| 311 | checking for errno.h... (cached) yes | ||
| 312 | checking fcntl.h usability... yes | ||
| 313 | checking fcntl.h presence... yes | ||
| 314 | checking for fcntl.h... yes | ||
| 315 | checking float.h usability... yes | ||
| 316 | checking float.h presence... yes | ||
| 317 | checking for float.h... yes | ||
| 318 | checking for sys/param.h... (cached) yes | ||
| 319 | checking sys/vfs.h usability... yes | ||
| 320 | checking sys/vfs.h presence... yes | ||
| 321 | checking for sys/vfs.h... yes | ||
| 322 | checking sys/fs_types.h usability... no | ||
| 323 | checking sys/fs_types.h presence... no | ||
| 324 | checking for sys/fs_types.h... no | ||
| 325 | checking for sys/socket.h... (cached) yes | ||
| 326 | checking netdb.h usability... yes | ||
| 327 | checking netdb.h presence... yes | ||
| 328 | checking for netdb.h... yes | ||
| 329 | checking netinet/in.h usability... yes | ||
| 330 | checking netinet/in.h presence... yes | ||
| 331 | checking for netinet/in.h... yes | ||
| 332 | checking for math.h... (cached) yes | ||
| 333 | checking for unistd.h... (cached) yes | ||
| 334 | checking sys/statvfs.h usability... yes | ||
| 335 | checking sys/statvfs.h presence... yes | ||
| 336 | checking for sys/statvfs.h... yes | ||
| 337 | checking locale.h usability... yes | ||
| 338 | checking locale.h presence... yes | ||
| 339 | checking for locale.h... yes | ||
| 340 | checking for stdint.h... (cached) yes | ||
| 341 | checking wchar.h usability... yes | ||
| 342 | checking wchar.h presence... yes | ||
| 343 | checking for wchar.h... yes | ||
| 344 | checking stdio.h usability... yes | ||
| 345 | checking stdio.h presence... yes | ||
| 346 | checking for stdio.h... yes | ||
| 347 | checking for stdlib.h... (cached) yes | ||
| 348 | checking for string.h... (cached) yes | ||
| 349 | checking time.h usability... yes | ||
| 350 | checking time.h presence... yes | ||
| 351 | checking for time.h... yes | ||
| 352 | checking for sys/time.h... (cached) yes | ||
| 353 | checking wctype.h usability... yes | ||
| 354 | checking wctype.h presence... yes | ||
| 355 | checking for wctype.h... yes | ||
| 356 | checking whether the preprocessor supports include_next... yes | ||
| 357 | checking for inline... inline | ||
| 358 | checking for C/C++ restrict keyword... __restrict | ||
| 359 | checking for btowc... yes | ||
| 360 | checking for mbsinit... yes | ||
| 361 | checking for mbrtowc... yes | ||
| 362 | checking for alarm... yes | ||
| 363 | checking for isblank... yes | ||
| 364 | checking for iswctype... yes | ||
| 365 | checking for wcscoll... yes | ||
| 366 | checking for pipe... yes | ||
| 367 | checking for vasnprintf... no | ||
| 368 | checking for wcrtomb... yes | ||
| 369 | checking for iswcntrl... yes | ||
| 370 | checking for nl_langinfo and CODESET... yes | ||
| 371 | checking for a traditional french locale... none | ||
| 372 | checking whether system is Windows or MSDOS... no | ||
| 373 | checking whether // is distinct from /... no | ||
| 374 | checking for complete errno.h... yes | ||
| 375 | checking whether strerror_r is declared... yes | ||
| 376 | checking for strerror_r... yes | ||
| 377 | checking whether strerror_r returns char *... no | ||
| 378 | checking whether <sys/socket.h> is self-contained... yes | ||
| 379 | checking for shutdown... yes | ||
| 380 | checking whether <sys/socket.h> defines the SHUT_* macros... yes | ||
| 381 | checking for struct sockaddr_storage... yes | ||
| 382 | checking for library containing gethostbyname... none required | ||
| 383 | checking for gethostbyname... yes | ||
| 384 | checking for library containing getservbyname... none required | ||
| 385 | checking for getservbyname... yes | ||
| 386 | checking for IPv4 sockets... yes | ||
| 387 | checking for IPv6 sockets... yes | ||
| 388 | checking getopt.h usability... no | ||
| 389 | checking getopt.h presence... no | ||
| 390 | checking for getopt.h... no | ||
| 391 | checking whether getenv is declared... yes | ||
| 392 | checking whether getc_unlocked is declared... yes | ||
| 393 | checking whether we are using the GNU C Library 2.1 or newer... no | ||
| 394 | checking whether malloc, realloc, calloc are POSIX compliant... yes | ||
| 395 | checking for mbstate_t... yes | ||
| 396 | checking for a traditional japanese locale... none | ||
| 397 | checking for a transitional chinese locale... none | ||
| 398 | checking for a french Unicode locale... none | ||
| 399 | checking for ssize_t... yes | ||
| 400 | checking whether snprintf is declared... yes | ||
| 401 | checking for stdbool.h that conforms to C99... yes | ||
| 402 | checking for _Bool... yes | ||
| 403 | checking for long long int... yes | ||
| 404 | checking for unsigned long long int... yes | ||
| 405 | checking whether strdup is declared... yes | ||
| 406 | checking for working strerror function... yes | ||
| 407 | checking whether strndup is declared... yes | ||
| 408 | checking whether strnlen is declared... yes | ||
| 409 | checking for struct timespec in <time.h>... yes | ||
| 410 | checking for wchar_t... yes | ||
| 411 | checking for wint_t... yes | ||
| 412 | checking for inttypes.h... yes | ||
| 413 | checking for stdint.h... yes | ||
| 414 | checking for intmax_t... yes | ||
| 415 | checking for snprintf... yes | ||
| 416 | checking for strnlen... yes | ||
| 417 | checking for wcslen... yes | ||
| 418 | checking for wcsnlen... yes | ||
| 419 | checking for mbrtowc... (cached) yes | ||
| 420 | checking for wcrtomb... (cached) yes | ||
| 421 | checking whether _snprintf is declared... no | ||
| 422 | checking whether vsnprintf is declared... yes | ||
| 423 | checking for alloca as a compiler built-in... yes | ||
| 424 | checking for a thread-safe mkdir -p... build-aux/install-sh -c -d | ||
| 425 | checking whether btowc(EOF) is correct... guessing yes | ||
| 426 | checking whether // is distinct from /... (cached) no | ||
| 427 | checking for error_at_line... (cached) no | ||
| 428 | checking for working fcntl.h... no (bad O_NOATIME, O_NOFOLLOW) | ||
| 429 | checking whether floorf is declared... yes | ||
| 430 | checking for sys/mount.h... no | ||
| 431 | configure: checking how to get file system space usage | ||
| 432 | checking for statvfs function (SVR4)... yes | ||
| 433 | checking dustat.h usability... no | ||
| 434 | checking dustat.h presence... no | ||
| 435 | checking for dustat.h... no | ||
| 436 | checking sys/fs/s5param.h usability... no | ||
| 437 | checking sys/fs/s5param.h presence... no | ||
| 438 | checking for sys/fs/s5param.h... no | ||
| 439 | checking sys/filsys.h usability... yes | ||
| 440 | checking sys/filsys.h presence... yes | ||
| 441 | checking for sys/filsys.h... yes | ||
| 442 | checking sys/statfs.h usability... yes | ||
| 443 | checking sys/statfs.h presence... yes | ||
| 444 | checking for sys/statfs.h... yes | ||
| 445 | checking for statfs that truncates block counts... no | ||
| 446 | configure: checking how to do getaddrinfo, freeaddrinfo and getnameinfo | ||
| 447 | checking for library containing getaddrinfo... none required | ||
| 448 | checking for getaddrinfo... yes | ||
| 449 | checking for gai_strerror (possibly via ws2tcpip.h)... yes | ||
| 450 | checking for struct sockaddr.sa_len... yes | ||
| 451 | checking whether getaddrinfo is declared... yes | ||
| 452 | checking whether freeaddrinfo is declared... yes | ||
| 453 | checking whether gai_strerror is declared... yes | ||
| 454 | checking whether getnameinfo is declared... yes | ||
| 455 | checking for struct addrinfo... yes | ||
| 456 | checking for gethostname... yes | ||
| 457 | checking for getloadavg... no | ||
| 458 | checking for pstat_getdynamic... no | ||
| 459 | checking for kstat_open in -lkstat... no | ||
| 460 | checking for perfstat_cpu_total in -lperfstat... yes | ||
| 461 | checking for getloadavg... no | ||
| 462 | checking sys/dg_sys_info.h usability... no | ||
| 463 | checking sys/dg_sys_info.h presence... no | ||
| 464 | checking for sys/dg_sys_info.h... no | ||
| 465 | checking inq_stats/cpustats.h usability... no | ||
| 466 | checking inq_stats/cpustats.h presence... no | ||
| 467 | checking for inq_stats/cpustats.h... no | ||
| 468 | checking sys/cpustats.h usability... no | ||
| 469 | checking sys/cpustats.h presence... no | ||
| 470 | checking for sys/cpustats.h... no | ||
| 471 | checking mach/mach.h usability... no | ||
| 472 | checking mach/mach.h presence... no | ||
| 473 | checking for mach/mach.h... no | ||
| 474 | checking nlist.h usability... yes | ||
| 475 | checking nlist.h presence... yes | ||
| 476 | checking for nlist.h... yes | ||
| 477 | checking for struct nlist.n_un.n_name... no | ||
| 478 | checking whether getloadavg requires setgid... no | ||
| 479 | checking sys/loadavg.h usability... no | ||
| 480 | checking sys/loadavg.h presence... no | ||
| 481 | checking for sys/loadavg.h... no | ||
| 482 | checking whether getloadavg is declared... no | ||
| 483 | checking for library containing gethostbyname... (cached) none required | ||
| 484 | checking for gethostbyname... (cached) yes | ||
| 485 | checking for library containing inet_ntop... none required | ||
| 486 | checking whether inet_ntop is declared... yes | ||
| 487 | checking whether the compiler generally respects inline... yes | ||
| 488 | checking for stdlib.h... (cached) yes | ||
| 489 | checking for GNU libc compatible malloc... no | ||
| 490 | checking whether NAN macro works... yes | ||
| 491 | checking whether HUGE_VAL works... yes | ||
| 492 | checking whether mbrtowc handles incomplete characters... guessing yes | ||
| 493 | checking whether mbrtowc works as well as mbtowc... guessing yes | ||
| 494 | checking whether mbrtowc handles a NULL string argument... guessing yes | ||
| 495 | checking whether mbrtowc has a correct return value... guessing yes | ||
| 496 | checking whether mbrtowc returns 0 when parsing a NUL character... guessing yes | ||
| 497 | checking whether mbrtowc handles incomplete characters... (cached) guessing yes | ||
| 498 | checking whether mbrtowc works as well as mbtowc... (cached) guessing yes | ||
| 499 | checking for working mktime... no | ||
| 500 | checking for listmntent... no | ||
| 501 | checking for getmntinfo... no | ||
| 502 | checking for sys/ucred.h... no | ||
| 503 | checking for sys/mount.h... (cached) no | ||
| 504 | checking mntent.h usability... yes | ||
| 505 | checking mntent.h presence... yes | ||
| 506 | checking for mntent.h... yes | ||
| 507 | checking for sys/fs_types.h... (cached) no | ||
| 508 | checking for struct fsstat.f_fstypename... no | ||
| 509 | checking for library containing getmntent... none required | ||
| 510 | checking for getmntent... yes | ||
| 511 | checking for listmntent of Cray/Unicos-9... no | ||
| 512 | checking for mntctl function and struct vmount... yes | ||
| 513 | checking sys/mntent.h usability... no | ||
| 514 | checking sys/mntent.h presence... no | ||
| 515 | checking for sys/mntent.h... no | ||
| 516 | checking for struct statfs.f_fstypename... no | ||
| 517 | checking whether <netinet/in.h> is self-contained... yes | ||
| 518 | checking for a thread-safe mkdir -p... build-aux/install-sh -c -d | ||
| 519 | checking whether open recognizes a trailing slash... no | ||
| 520 | checking for working re_compile_pattern... no | ||
| 521 | checking libintl.h usability... yes | ||
| 522 | checking libintl.h presence... yes | ||
| 523 | checking for libintl.h... yes | ||
| 524 | checking whether isblank is declared... yes | ||
| 525 | checking for library containing getservbyname... (cached) none required | ||
| 526 | checking for getservbyname... (cached) yes | ||
| 527 | checking for stdint.h... (cached) yes | ||
| 528 | checking for SIZE_MAX... yes | ||
| 529 | checking for snprintf... (cached) yes | ||
| 530 | checking whether snprintf respects a size of 1... yes | ||
| 531 | checking for socklen_t... yes | ||
| 532 | checking for ssize_t... (cached) yes | ||
| 533 | checking whether stdint.h conforms to C99... no | ||
| 534 | checking sys/inttypes.h usability... yes | ||
| 535 | checking sys/inttypes.h presence... yes | ||
| 536 | checking for sys/inttypes.h... yes | ||
| 537 | checking sys/bitypes.h usability... no | ||
| 538 | checking sys/bitypes.h presence... no | ||
| 539 | checking for sys/bitypes.h... no | ||
| 540 | checking for bit size of ptrdiff_t... 32 | ||
| 541 | checking for bit size of size_t... 32 | ||
| 542 | checking for bit size of sig_atomic_t... 32 | ||
| 543 | checking for bit size of wchar_t... 16 | ||
| 544 | checking for bit size of wint_t... 32 | ||
| 545 | checking whether sig_atomic_t is signed... yes | ||
| 546 | checking whether wchar_t is signed... no | ||
| 547 | checking whether wint_t is signed... yes | ||
| 548 | checking for ptrdiff_t integer literal suffix... l | ||
| 549 | checking for size_t integer literal suffix... ul | ||
| 550 | checking for sig_atomic_t integer literal suffix... | ||
| 551 | checking for wchar_t integer literal suffix... no | ||
| 552 | checking for wint_t integer literal suffix... | ||
| 553 | checking for random.h... no | ||
| 554 | checking for struct random_data... no | ||
| 555 | checking for strdup... (cached) yes | ||
| 556 | checking for working strndup... yes | ||
| 557 | checking for working strnlen... yes | ||
| 558 | checking whether <sys/socket.h> is self-contained... (cached) yes | ||
| 559 | checking for shutdown... (cached) yes | ||
| 560 | checking whether <sys/socket.h> defines the SHUT_* macros... (cached) yes | ||
| 561 | checking for struct sockaddr_storage... (cached) yes | ||
| 562 | checking for a thread-safe mkdir -p... build-aux/install-sh -c -d | ||
| 563 | checking whether localtime_r is compatible with its POSIX signature... yes | ||
| 564 | checking for ptrdiff_t... yes | ||
| 565 | checking for vasprintf... no | ||
| 566 | checking for vsnprintf... yes | ||
| 567 | checking whether snprintf respects a size of 1... (cached) yes | ||
| 568 | checking whether <wchar.h> is standalone... yes | ||
| 569 | checking whether mbrtowc handles incomplete characters... (cached) guessing yes | ||
| 570 | checking whether mbrtowc works as well as mbtowc... (cached) guessing yes | ||
| 571 | checking whether wcrtomb return value is correct... guessing yes | ||
| 572 | checking whether iswcntrl works... yes | ||
| 573 | checking for stdint.h... (cached) yes | ||
| 574 | configure: creating ./config.status | ||
| 575 | config.status: creating gl/Makefile | ||
| 576 | config.status: creating Makefile | ||
| 577 | config.status: creating tap/Makefile | ||
| 578 | config.status: creating lib/Makefile | ||
| 579 | config.status: creating plugins/Makefile | ||
| 580 | config.status: creating lib/tests/Makefile | ||
| 581 | config.status: creating plugins-root/Makefile | ||
| 582 | config.status: creating plugins-scripts/Makefile | ||
| 583 | config.status: creating plugins-scripts/subst | ||
| 584 | config.status: creating plugins-scripts/utils.pm | ||
| 585 | config.status: creating plugins-scripts/utils.sh | ||
| 586 | config.status: creating perlmods/Makefile | ||
| 587 | config.status: creating command.cfg | ||
| 588 | config.status: creating test.pl | ||
| 589 | config.status: creating pkg/solaris/pkginfo | ||
| 590 | config.status: creating po/Makefile.in | ||
| 591 | config.status: creating config.h | ||
| 592 | config.status: config.h is unchanged | ||
| 593 | config.status: executing depfiles commands | ||
| 594 | config.status: executing po-directories commands | ||
| 595 | config.status: creating po/POTFILES | ||
| 596 | config.status: creating po/Makefile | ||
| 597 | --with-apt-get-command: | ||
| 598 | --with-ping6-command: | ||
| 599 | --with-ping-command: /etc/ping -n -c %d %s | ||
| 600 | --with-ipv6: yes | ||
| 601 | --with-mysql: no | ||
| 602 | --with-openssl: yes | ||
| 603 | --with-gnutls: no | ||
| 604 | --enable-extra-opts: no | ||
| 605 | --with-perl: /bin/perl | ||
| 606 | --enable-perl-modules: no | ||
| 607 | --with-cgiurl: /nagios/cgi-bin | ||
| 608 | --with-trusted-path: /bin:/sbin:/usr/bin:/usr/sbin | ||
| 609 | --enable-libtap: no | ||
| 610 | root@:/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2# make | ||
| 611 | make all-recursive | ||
| 612 | Making all in gl | ||
| 613 | rm -f configmake.h-t | ||
| 614 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; echo '#define PREFIX "/usr/local/nagios"'; echo '#define EXEC_PREFIX "/usr/local/nagios"'; echo '#define BINDIR "/usr/local/nagios/bin"'; echo '#define SBINDIR "/usr/local/nagios/sbin"'; echo '#define LIBEXECDIR "/usr/local/nagios/libexec"'; echo '#define DATAROOTDIR "/usr/local/nagios/share"'; echo '#define DATADIR "/usr/local/nagios/share"'; echo '#define SYSCONFDIR "/usr/local/nagios/etc"'; echo '#define SHAREDSTATEDIR "/usr/local/nagios/com"'; echo '#define LOCALSTATEDIR "/usr/local/nagios/var"'; echo '#define INCLUDEDIR "/usr/local/nagios/include"'; echo '#define OLDINCLUDEDIR "/usr/include"'; echo '#define DOCDIR "/usr/local/nagios/share/doc/nagios-plugins"'; echo '#define INFODIR "/usr/local/nagios/share/info"'; echo '#define HTMLDIR "/usr/local/nagios/share/doc/nagios-plugins"'; echo '#define DVIDIR "/usr/local/nagios/share/doc/nagios-plugins"'; echo '#define PDFDIR "/usr/local/nagios/share/doc/nagios-plugins"'; echo '#define PSDIR "/usr/local/nagios/share/doc/nagios-plugins"'; echo '#define LIBDIR "/usr/local/nagios/lib"'; echo '#define LISPDIR ""'; echo '#define LOCALEDIR "/usr/local/nagios/share/locale"'; echo '#define MANDIR "/usr/local/nagios/share/man"'; echo '#define MANEXT ""'; echo '#define PKGDATADIR "/usr/local/nagios/share/nagios-plugins"'; echo '#define PKGINCLUDEDIR "/usr/local/nagios/include/nagios-plugins"'; echo '#define PKGLIBDIR "/usr/local/nagios/lib/nagios-plugins"'; echo '#define PKGLIBEXECDIR ""'; } | sed '/""/d' > configmake.h-t | ||
| 615 | if test -f configmake.h && cmp configmake.h-t configmake.h > /dev/null; then rm -f configmake.h-t; else rm -f configmake.h; mv configmake.h-t configmake.h; fi | ||
| 616 | make all-recursive | ||
| 617 | rm -f configmake.h-t | ||
| 618 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; echo '#define PREFIX "/usr/local/nagios"'; echo '#define EXEC_PREFIX "/usr/local/nagios"'; echo '#define BINDIR "/usr/local/nagios/bin"'; echo '#define SBINDIR "/usr/local/nagios/sbin"'; echo '#define LIBEXECDIR "/usr/local/nagios/libexec"'; echo '#define DATAROOTDIR "/usr/local/nagios/share"'; echo '#define DATADIR "/usr/local/nagios/share"'; echo '#define SYSCONFDIR "/usr/local/nagios/etc"'; echo '#define SHAREDSTATEDIR "/usr/local/nagios/com"'; echo '#define LOCALSTATEDIR "/usr/local/nagios/var"'; echo '#define INCLUDEDIR "/usr/local/nagios/include"'; echo '#define OLDINCLUDEDIR "/usr/include"'; echo '#define DOCDIR "/usr/local/nagios/share/doc/nagios-plugins"'; echo '#define INFODIR "/usr/local/nagios/share/info"'; echo '#define HTMLDIR "/usr/local/nagios/share/doc/nagios-plugins"'; echo '#define DVIDIR "/usr/local/nagios/share/doc/nagios-plugins"'; echo '#define PDFDIR "/usr/local/nagios/share/doc/nagios-plugins"'; echo '#define PSDIR "/usr/local/nagios/share/doc/nagios-plugins"'; echo '#define LIBDIR "/usr/local/nagios/lib"'; echo '#define LISPDIR ""'; echo '#define LOCALEDIR "/usr/local/nagios/share/locale"'; echo '#define MANDIR "/usr/local/nagios/share/man"'; echo '#define MANEXT ""'; echo '#define PKGDATADIR "/usr/local/nagios/share/nagios-plugins"'; echo '#define PKGINCLUDEDIR "/usr/local/nagios/include/nagios-plugins"'; echo '#define PKGLIBDIR "/usr/local/nagios/lib/nagios-plugins"'; echo '#define PKGLIBEXECDIR ""'; } | sed '/""/d' > configmake.h-t | ||
| 619 | if test -f configmake.h && cmp configmake.h-t configmake.h > /dev/null; then rm -f configmake.h-t; else rm -f configmake.h; mv configmake.h-t configmake.h; fi | ||
| 620 | Target "all-am" is up to date. | ||
| 621 | Making all in tap | ||
| 622 | Target "all" is up to date. | ||
| 623 | Making all in lib | ||
| 624 | Making all in . | ||
| 625 | Target "all-am" is up to date. | ||
| 626 | Making all in tests | ||
| 627 | Target "all" is up to date. | ||
| 628 | Target "all" is up to date. | ||
| 629 | Making all in plugins | ||
| 630 | Target "all" is up to date. | ||
| 631 | Making all in plugins-scripts | ||
| 632 | Target "all" is up to date. | ||
| 633 | Making all in plugins-root | ||
| 634 | Target "all" is up to date. | ||
| 635 | Making all in po | ||
| 636 | Target "all" is up to date. | ||
| 637 | Target "all-am" is up to date. | ||
| 638 | root@:/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2# make clean | ||
| 639 | Making clean in po | ||
| 640 | rm -f remove-potcdate.sed | ||
| 641 | rm -f stamp-poT | ||
| 642 | rm -f core core.* nagios-plugins.po nagios-plugins.1po nagios-plugins.2po *.new.po | ||
| 643 | rm -fr *.o | ||
| 644 | Target "clean" is up to date. | ||
| 645 | Making clean in plugins-root | ||
| 646 | rm -rf .libs _libs | ||
| 647 | rm -f NP-VERSION-FILE | ||
| 648 | rm -f check_dhcp check_dhcp | ||
| 649 | rm -f check_icmp check_icmp | ||
| 650 | rm -f *.o | ||
| 651 | rm -f *.lo | ||
| 652 | Target "clean" is up to date. | ||
| 653 | Making clean in plugins-scripts | ||
| 654 | test -z "check_breeze check_disk_smb check_flexlm check_ircd check_log check_oracle check_rpc check_sensors check_wave check_ifstatus check_ifoperstatus check_mailq check_file_age utils.sh utils.pm" || rm -f check_breeze check_disk_smb check_flexlm check_ircd check_log check_oracle check_rpc check_sensors check_wave check_ifstatus check_ifoperstatus check_mailq check_file_age utils.sh utils.pm | ||
| 655 | rm -rf .libs _libs | ||
| 656 | rm -f NP-VERSION-FILE | ||
| 657 | rm -f *.lo | ||
| 658 | Target "clean" is up to date. | ||
| 659 | Making clean in plugins | ||
| 660 | rm -f check_apt check_apt | ||
| 661 | rm -f check_cluster check_cluster | ||
| 662 | rm -f check_disk check_disk | ||
| 663 | rm -f check_dummy check_dummy | ||
| 664 | rm -f check_http check_http | ||
| 665 | rm -f check_load check_load | ||
| 666 | rm -f check_mrtg check_mrtg | ||
| 667 | rm -f check_mrtgtraf check_mrtgtraf | ||
| 668 | rm -f check_ntp check_ntp | ||
| 669 | rm -f check_ntp_peer check_ntp_peer | ||
| 670 | rm -f check_nwstat check_nwstat | ||
| 671 | rm -f check_overcr check_overcr | ||
| 672 | rm -f check_ping check_ping | ||
| 673 | rm -f check_real check_real | ||
| 674 | rm -f check_smtp check_smtp | ||
| 675 | rm -f check_ssh check_ssh | ||
| 676 | rm -f check_tcp check_tcp | ||
| 677 | rm -f check_time check_time | ||
| 678 | rm -f check_ntp_time check_ntp_time | ||
| 679 | rm -f check_ups check_ups | ||
| 680 | rm -f check_users check_users | ||
| 681 | rm -f negate negate | ||
| 682 | rm -f urlize urlize | ||
| 683 | rm -f check_ldap check_ldap | ||
| 684 | rm -f check_procs check_procs | ||
| 685 | rm -f check_nagios check_nagios | ||
| 686 | rm -f check_dns check_dns | ||
| 687 | rm -f check_by_ssh check_by_ssh | ||
| 688 | rm -f check_dig check_dig | ||
| 689 | rm -f check_nt check_nt | ||
| 690 | rm -rf .libs _libs | ||
| 691 | rm -f check_ftp check_imap check_nntp check_pop check_udp check_clamd check_simap check_spop check_jabber check_nntps check_ssmtp | ||
| 692 | rm -f NP-VERSION-FILE | ||
| 693 | rm -f *.o | ||
| 694 | rm -f *.lo | ||
| 695 | Target "clean" is up to date. | ||
| 696 | Making clean in lib | ||
| 697 | Making clean in tests | ||
| 698 | rm -rf .libs _libs | ||
| 699 | rm -f *.o | ||
| 700 | rm -f *.lo | ||
| 701 | Target "clean" is up to date. | ||
| 702 | Making clean in . | ||
| 703 | rm -rf .libs _libs | ||
| 704 | test -z "libnagiosplug.a" || rm -f libnagiosplug.a | ||
| 705 | rm -f *.o | ||
| 706 | rm -f *.lo | ||
| 707 | Target "clean-am" is up to date. | ||
| 708 | Target "clean" is up to date. | ||
| 709 | Making clean in tap | ||
| 710 | rm -rf .libs _libs | ||
| 711 | test -z "" || rm -f | ||
| 712 | rm -f *.o | ||
| 713 | rm -f *.lo | ||
| 714 | Target "clean" is up to date. | ||
| 715 | Making clean in gl | ||
| 716 | Making clean in . | ||
| 717 | test -z "configmake.h configmake.h-t charset.alias ref-add.sed ref-del.sed" || rm -f configmake.h configmake.h-t charset.alias ref-add.sed ref-del.sed | ||
| 718 | rm -rf .libs _libs | ||
| 719 | test -z "libgnu.a" || rm -f libgnu.a | ||
| 720 | test -z "" || rm -f | ||
| 721 | rm -f *.o | ||
| 722 | test -z "core *.stackdump alloca.h alloca.h-t arpa/inet.h arpa/inet.h-t errno.h errno.h-t fcntl.h fcntl.h-t float.h float.h-t getopt.h getopt.h-t math.h math.h-t netdb.h netdb.h-t netinet/in.h netinet/in.h-t stdbool.h stdbool.h-t stdint.h stdint.h-t stdio.h stdio.h-t stdlib.h stdlib.h-t string.h string.h-t sys/socket.h sys/socket.h-t time.h time.h-t unistd.h unistd.h-t wchar.h wchar.h-t wctype.h wctype.h-t" || rm -f core *.stackdump alloca.h alloca.h-t arpa/inet.h arpa/inet.h-t errno.h errno.h-t fcntl.h fcntl.h-t float.h float.h-t getopt.h getopt.h-t math.h math.h-t netdb.h netdb.h-t netinet/in.h netinet/in.h-t stdbool.h stdbool.h-t stdint.h stdint.h-t stdio.h stdio.h-t stdlib.h stdlib.h-t string.h string.h-t sys/socket.h sys/socket.h-t time.h time.h-t unistd.h unistd.h-t wchar.h wchar.h-t wctype.h wctype.h-t | ||
| 723 | rm -f *.lo | ||
| 724 | rmdir arpa | ||
| 725 | Target "clean-am" is up to date. | ||
| 726 | Target "clean" is up to date. | ||
| 727 | Making clean in . | ||
| 728 | rm -rf .libs _libs | ||
| 729 | rm -f *.lo | ||
| 730 | Target "clean-am" is up to date. | ||
| 731 | Target "clean" is up to date. | ||
| 732 | root@:/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2# make | ||
| 733 | make all-recursive | ||
| 734 | Making all in gl | ||
| 735 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; cat ./alloca.in.h; } > alloca.h-t | ||
| 736 | mv -f alloca.h-t alloca.h | ||
| 737 | ../build-aux/install-sh -c -d arpa | ||
| 738 | rm -f arpa/inet.h-t arpa/inet.h | ||
| 739 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; sed -e 's|@''INCLUDE_NEXT''@|include_next|g' -e 's|@''PRAGMA_SYSTEM_HEADER''@|#pragma GCC system_header|g' -e 's|@''NEXT_ARPA_INET_H''@|<arpa/inet.h>|g' -e 's|@''HAVE_ARPA_INET_H''@|1|g' -e 's|@''GNULIB_INET_NTOP''@|1|g' -e 's|@''GNULIB_INET_PTON''@|0|g' -e 's|@''HAVE_DECL_INET_NTOP''@|1|g' -e 's|@''HAVE_DECL_INET_PTON''@|1|g' -e '/definition of GL_LINK_WARNING/r ../build-aux/link-warning.h' < ./arpa_inet.in.h; } > arpa/inet.h-t | ||
| 740 | mv arpa/inet.h-t arpa/inet.h | ||
| 741 | rm -f configmake.h-t | ||
| 742 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; echo '#define PREFIX "/usr/local/nagios"'; echo '#define EXEC_PREFIX "/usr/local/nagios"'; echo '#define BINDIR "/usr/local/nagios/bin"'; echo '#define SBINDIR "/usr/local/nagios/sbin"'; echo '#define LIBEXECDIR "/usr/local/nagios/libexec"'; echo '#define DATAROOTDIR "/usr/local/nagios/share"'; echo '#define DATADIR "/usr/local/nagios/share"'; echo '#define SYSCONFDIR "/usr/local/nagios/etc"'; echo '#define SHAREDSTATEDIR "/usr/local/nagios/com"'; echo '#define LOCALSTATEDIR "/usr/local/nagios/var"'; echo '#define INCLUDEDIR "/usr/local/nagios/include"'; echo '#define OLDINCLUDEDIR "/usr/include"'; echo '#define DOCDIR "/usr/local/nagios/share/doc/nagios-plugins"'; echo '#define INFODIR "/usr/local/nagios/share/info"'; echo '#define HTMLDIR "/usr/local/nagios/share/doc/nagios-plugins"'; echo '#define DVIDIR "/usr/local/nagios/share/doc/nagios-plugins"'; echo '#define PDFDIR "/usr/local/nagios/share/doc/nagios-plugins"'; echo '#define PSDIR "/usr/local/nagios/share/doc/nagios-plugins"'; echo '#define LIBDIR "/usr/local/nagios/lib"'; echo '#define LISPDIR ""'; echo '#define LOCALEDIR "/usr/local/nagios/share/locale"'; echo '#define MANDIR "/usr/local/nagios/share/man"'; echo '#define MANEXT ""'; echo '#define PKGDATADIR "/usr/local/nagios/share/nagios-plugins"'; echo '#define PKGINCLUDEDIR "/usr/local/nagios/include/nagios-plugins"'; echo '#define PKGLIBDIR "/usr/local/nagios/lib/nagios-plugins"'; echo '#define PKGLIBEXECDIR ""'; } | sed '/""/d' > configmake.h-t | ||
| 743 | if test -f configmake.h && cmp configmake.h-t configmake.h > /dev/null; then rm -f configmake.h-t; else rm -f configmake.h; mv configmake.h-t configmake.h; fi | ||
| 744 | rm -f fcntl.h-t fcntl.h | ||
| 745 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; sed -e 's|@''INCLUDE_NEXT''@|include_next|g' -e 's|@''PRAGMA_SYSTEM_HEADER''@|#pragma GCC system_header|g' -e 's|@''NEXT_FCNTL_H''@|<fcntl.h>|g' -e 's|@''GNULIB_OPEN''@|1|g' -e 's|@''REPLACE_OPEN''@|1|g' < ./fcntl.in.h; } > fcntl.h-t | ||
| 746 | mv fcntl.h-t fcntl.h | ||
| 747 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; cat ./getopt.in.h; } > getopt.h-t | ||
| 748 | mv -f getopt.h-t getopt.h | ||
| 749 | rm -f math.h-t math.h | ||
| 750 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && sed -e 's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|include_next|g' -e 's|@''PRAGMA_SYSTEM_HEADER''@|#pragma GCC system_header|g' -e 's|@''NEXT_MATH_H''@|<math.h>|g' -e 's|@''GNULIB_CEILF''@|0|g' -e 's|@''GNULIB_CEILL''@|0|g' -e 's|@''GNULIB_FLOORF''@|1|g' -e 's|@''GNULIB_FLOORL''@|0|g' -e 's|@''GNULIB_FREXP''@|0|g' -e 's|@''GNULIB_FREXPL''@|0|g' -e 's|@''GNULIB_ISFINITE''@|0|g' -e 's|@''GNULIB_ISINF''@|0|g' -e 's|@''GNULIB_ISNAN''@|0|g' -e 's|@''GNULIB_ISNANF''@|0|g' -e 's|@''GNULIB_ISNAND''@|0|g' -e 's|@''GNULIB_ISNANL''@|0|g' -e 's|@''GNULIB_LDEXPL''@|0|g' -e 's|@''GNULIB_MATHL''@|0|g' -e 's|@''GNULIB_ROUND''@|0|g' -e 's|@''GNULIB_ROUNDF''@|0|g' -e 's|@''GNULIB_ROUNDL''@|0|g' -e 's|@''GNULIB_SIGNBIT''@|0|g' -e 's|@''GNULIB_TRUNC''@|0|g' -e 's|@''GNULIB_TRUNCF''@|0|g' -e 's|@''GNULIB_TRUNCL''@|0|g' -e 's|@''HAVE_ISNANF''@|1|g' -e 's|@''HAVE_ISNAND''@|1|g' -e 's|@''HAVE_ISNANL''@|1|g' -e 's|@''HAVE_DECL_ACOSL''@|1|g' -e 's|@''HAVE_DECL_ASINL''@|1|g' -e 's|@''HAVE_DECL_ATANL''@|1|g' -e 's|@''HAVE_DECL_COSL''@|1|g' -e 's|@''HAVE_DECL_EXPL''@|1|g' -e 's|@''HAVE_DECL_FREXPL''@|1|g' -e 's|@''HAVE_DECL_LDEXPL''@|1|g' -e 's|@''HAVE_DECL_LOGL''@|1|g' -e 's|@''HAVE_DECL_SINL''@|1|g' -e 's|@''HAVE_DECL_SQRTL''@|1|g' -e 's|@''HAVE_DECL_TANL''@|1|g' -e 's|@''HAVE_DECL_TRUNC''@|1|g' -e 's|@''HAVE_DECL_TRUNCF''@|1|g' -e 's|@''REPLACE_CEILF''@|0|g' -e 's|@''REPLACE_CEILL''@|0|g' -e 's|@''REPLACE_FLOORF''@|0|g' -e 's|@''REPLACE_FLOORL''@|0|g' -e 's|@''REPLACE_FREXP''@|0|g' -e 's|@''REPLACE_FREXPL''@|0|g' -e 's|@''REPLACE_HUGE_VAL''@|0|g' -e 's|@''REPLACE_ISFINITE''@|0|g' -e 's|@''REPLACE_ISINF''@|0|g' -e 's|@''REPLACE_ISNAN''@|0|g' -e 's|@''REPLACE_LDEXPL''@|0|g' -e 's|@''REPLACE_NAN''@|0|g' -e 's|@''REPLACE_ROUND''@|0|g' -e 's|@''REPLACE_ROUNDF''@|0|g' -e 's|@''REPLACE_ROUNDL''@|0|g' -e 's|@''REPLACE_SIGNBIT''@|0|g' -e 's|@''REPLACE_SIGNBIT_USING_GCC''@|0|g' -e 's|@''REPLACE_TRUNCL''@|0|g' -e '/definition of GL_LINK_WARNING/r ../build-aux/link-warning.h' < ./math.in.h; } > math.h-t | ||
| 751 | mv math.h-t math.h | ||
| 752 | rm -f netdb.h-t netdb.h | ||
| 753 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; sed -e 's|@''INCLUDE_NEXT''@|include_next|g' -e 's|@''PRAGMA_SYSTEM_HEADER''@|#pragma GCC system_header|g' -e 's|@''NEXT_NETDB_H''@|<netdb.h>|g' -e 's|@''HAVE_NETDB_H''@|1|g' -e 's|@''GNULIB_GETADDRINFO''@|1|g' -e 's|@''HAVE_STRUCT_ADDRINFO''@|1|g' -e 's|@''HAVE_DECL_FREEADDRINFO''@|1|g' -e 's|@''HAVE_DECL_GAI_STRERROR''@|1|g' -e 's|@''HAVE_DECL_GETADDRINFO''@|1|g' -e 's|@''HAVE_DECL_GETNAMEINFO''@|1|g' < ./netdb.in.h; } > netdb.h-t | ||
| 754 | mv netdb.h-t netdb.h | ||
| 755 | rm -f stdint.h-t stdint.h | ||
| 756 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; sed -e 's/@''HAVE_STDINT_H''@/1/g' -e 's|@''INCLUDE_NEXT''@|include_next|g' -e 's|@''PRAGMA_SYSTEM_HEADER''@|#pragma GCC system_header|g' -e 's|@''NEXT_STDINT_H''@|<stdint.h>|g' -e 's/@''HAVE_SYS_TYPES_H''@/1/g' -e 's/@''HAVE_INTTYPES_H''@/1/g' -e 's/@''HAVE_SYS_INTTYPES_H''@/1/g' -e 's/@''HAVE_SYS_BITYPES_H''@/0/g' -e 's/@''HAVE_LONG_LONG_INT''@/1/g' -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/1/g' -e 's/@''APPLE_UNIVERSAL_BUILD''@/0/g' -e 's/@''BITSIZEOF_PTRDIFF_T''@/32/g' -e 's/@''PTRDIFF_T_SUFFIX''@/l/g' -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/32/g' -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/1/g' -e 's/@''SIG_ATOMIC_T_SUFFIX''@//g' -e 's/@''BITSIZEOF_SIZE_T''@/32/g' -e 's/@''SIZE_T_SUFFIX''@/ul/g' -e 's/@''BITSIZEOF_WCHAR_T''@/16/g' -e 's/@''HAVE_SIGNED_WCHAR_T''@/0/g' -e 's/@''WCHAR_T_SUFFIX''@//g' -e 's/@''BITSIZEOF_WINT_T''@/32/g' -e 's/@''HAVE_SIGNED_WINT_T''@/1/g' -e 's/@''WINT_T_SUFFIX''@//g' < ./stdint.in.h; } > stdint.h-t | ||
| 757 | mv stdint.h-t stdint.h | ||
| 758 | rm -f stdio.h-t stdio.h | ||
| 759 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && sed -e 's|@''INCLUDE_NEXT''@|include_next|g' -e 's|@''PRAGMA_SYSTEM_HEADER''@|#pragma GCC system_header|g' -e 's|@''NEXT_STDIO_H''@|<stdio.h>|g' -e 's|@''GNULIB_FPRINTF''@|1|g' -e 's|@''GNULIB_FPRINTF_POSIX''@|0|g' -e 's|@''GNULIB_PRINTF''@|1|g' -e 's|@''GNULIB_PRINTF_POSIX''@|0|g' -e 's|@''GNULIB_SNPRINTF''@|1|g' -e 's|@''GNULIB_SPRINTF_POSIX''@|0|g' -e 's|@''GNULIB_VFPRINTF''@|1|g' -e 's|@''GNULIB_VFPRINTF_POSIX''@|0|g' -e 's|@''GNULIB_VPRINTF''@|1|g' -e 's|@''GNULIB_VPRINTF_POSIX''@|0|g' -e 's|@''GNULIB_VSNPRINTF''@|1|g' -e 's|@''GNULIB_VSPRINTF_POSIX''@|0|g' -e 's|@''GNULIB_DPRINTF''@|0|g' -e 's|@''GNULIB_VDPRINTF''@|0|g' -e 's|@''GNULIB_VASPRINTF''@|1|g' -e 's|@''GNULIB_OBSTACK_PRINTF''@|0|g' -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|0|g' -e 's|@''GNULIB_FOPEN''@|0|g' -e 's|@''GNULIB_FREOPEN''@|0|g' -e 's|@''GNULIB_FSEEK''@|0|g' -e 's|@''GNULIB_FSEEKO''@|0|g' -e 's|@''GNULIB_FTELL''@|0|g' -e 's|@''GNULIB_FTELLO''@|0|g' -e 's|@''GNULIB_FFLUSH''@|0|g' -e 's|@''GNULIB_FCLOSE''@|0|g' -e 's|@''GNULIB_FPUTC''@|1|g' -e 's|@''GNULIB_PUTC''@|1|g' -e 's|@''GNULIB_PUTCHAR''@|1|g' -e 's|@''GNULIB_FPUTS''@|1|g' -e 's|@''GNULIB_PUTS''@|1|g' -e 's|@''GNULIB_FWRITE''@|1|g' -e 's|@''GNULIB_GETDELIM''@|0|g' -e 's|@''GNULIB_GETLINE''@|0|g' -e 's|@''GNULIB_PERROR''@|0|g' -e 's|@''GNULIB_STDIO_H_SIGPIPE''@|0|g' -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|0|g' -e 's|@''REPLACE_FPRINTF''@|0|g' -e 's|@''REPLACE_VFPRINTF''@|0|g' -e 's|@''REPLACE_PRINTF''@|0|g' -e 's|@''REPLACE_VPRINTF''@|0|g' -e 's|@''REPLACE_SNPRINTF''@|0|g' -e 's|@''HAVE_DECL_SNPRINTF''@|1|g' -e 's|@''REPLACE_VSNPRINTF''@|0|g' -e 's|@''HAVE_DECL_VSNPRINTF''@|1|g' -e 's|@''REPLACE_SPRINTF''@|0|g' -e 's|@''REPLACE_VSPRINTF''@|0|g' -e 's|@''HAVE_DPRINTF''@|1|g' -e 's|@''REPLACE_DPRINTF''@|0|g' -e 's|@''HAVE_VDPRINTF''@|1|g' -e 's|@''REPLACE_VDPRINTF''@|0|g' -e 's|@''HAVE_VASPRINTF''@|0|g' -e 's|@''REPLACE_VASPRINTF''@|0|g' -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|1|g' -e 's|@''REPLACE_OBSTACK_PRINTF''@|0|g' -e 's|@''REPLACE_FOPEN''@|0|g' -e 's|@''REPLACE_FREOPEN''@|0|g' -e 's|@''REPLACE_FSEEKO''@|0|g' -e 's|@''REPLACE_FSEEK''@|0|g' -e 's|@''REPLACE_FTELLO''@|0|g' -e 's|@''REPLACE_FTELL''@|0|g' -e 's|@''REPLACE_FFLUSH''@|0|g' -e 's|@''REPLACE_FCLOSE''@|0|g' -e 's|@''HAVE_DECL_GETDELIM''@|1|g' -e 's|@''HAVE_DECL_GETLINE''@|1|g' -e 's|@''REPLACE_GETLINE''@|0|g' -e 's|@''REPLACE_PERROR''@|0|g' -e '/definition of GL_LINK_WARNING/r ../build-aux/link-warning.h' < ./stdio.in.h; } > stdio.h-t | ||
| 760 | mv stdio.h-t stdio.h | ||
| 761 | rm -f stdlib.h-t stdlib.h | ||
| 762 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && sed -e 's|@''INCLUDE_NEXT''@|include_next|g' -e 's|@''PRAGMA_SYSTEM_HEADER''@|#pragma GCC system_header|g' -e 's|@''NEXT_STDLIB_H''@|<stdlib.h>|g' -e 's|@''HAVE_RANDOM_H''@|0|g' -e 's|@''GNULIB_MALLOC_POSIX''@|1|g' -e 's|@''GNULIB_REALLOC_POSIX''@|0|g' -e 's|@''GNULIB_CALLOC_POSIX''@|0|g' -e 's|@''GNULIB_ATOLL''@|0|g' -e 's|@''GNULIB_GETLOADAVG''@|1|g' -e 's|@''GNULIB_GETSUBOPT''@|0|g' -e 's|@''GNULIB_MKDTEMP''@|0|g' -e 's|@''GNULIB_MKSTEMP''@|0|g' -e 's|@''GNULIB_PUTENV''@|0|g' -e 's|@''GNULIB_RANDOM_R''@|0|g' -e 's|@''GNULIB_RPMATCH''@|0|g' -e 's|@''GNULIB_SETENV''@|0|g' -e 's|@''GNULIB_STRTOD''@|0|g' -e 's|@''GNULIB_STRTOLL''@|0|g' -e 's|@''GNULIB_STRTOULL''@|0|g' -e 's|@''GNULIB_UNSETENV''@|0|g' -e 's|@''HAVE_ATOLL''@|1|g' -e 's|@''HAVE_CALLOC_POSIX''@|1|g' -e 's|@''HAVE_GETSUBOPT''@|1|g' -e 's|@''HAVE_MALLOC_POSIX''@|1|g' -e 's|@''HAVE_MKDTEMP''@|1|g' -e 's|@''HAVE_REALLOC_POSIX''@|1|g' -e 's|@''HAVE_RANDOM_R''@|1|g' -e 's|@''HAVE_RPMATCH''@|1|g' -e 's|@''HAVE_SETENV''@|1|g' -e 's|@''HAVE_STRTOD''@|1|g' -e 's|@''HAVE_STRTOLL''@|1|g' -e 's|@''HAVE_STRTOULL''@|1|g' -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|0|g' -e 's|@''HAVE_SYS_LOADAVG_H''@|0|g' -e 's|@''HAVE_UNSETENV''@|1|g' -e 's|@''HAVE_DECL_GETLOADAVG''@|0|g' -e 's|@''REPLACE_MKSTEMP''@|0|g' -e 's|@''REPLACE_PUTENV''@|0|g' -e 's|@''REPLACE_STRTOD''@|0|g' -e 's|@''VOID_UNSETENV''@|0|g' -e '/definition of GL_LINK_WARNING/r ../build-aux/link-warning.h' < ./stdlib.in.h; } > stdlib.h-t | ||
| 763 | mv stdlib.h-t stdlib.h | ||
| 764 | rm -f string.h-t string.h | ||
| 765 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && sed -e 's|@''INCLUDE_NEXT''@|include_next|g' -e 's|@''PRAGMA_SYSTEM_HEADER''@|#pragma GCC system_header|g' -e 's|@''NEXT_STRING_H''@|<string.h>|g' -e 's|@''GNULIB_MBSLEN''@|0|g' -e 's|@''GNULIB_MBSNLEN''@|0|g' -e 's|@''GNULIB_MBSCHR''@|0|g' -e 's|@''GNULIB_MBSRCHR''@|0|g' -e 's|@''GNULIB_MBSSTR''@|0|g' -e 's|@''GNULIB_MBSCASECMP''@|0|g' -e 's|@''GNULIB_MBSNCASECMP''@|0|g' -e 's|@''GNULIB_MBSPCASECMP''@|0|g' -e 's|@''GNULIB_MBSCASESTR''@|0|g' -e 's|@''GNULIB_MBSCSPN''@|0|g' -e 's|@''GNULIB_MBSPBRK''@|0|g' -e 's|@''GNULIB_MBSSPN''@|0|g' -e 's|@''GNULIB_MBSSEP''@|0|g' -e 's|@''GNULIB_MBSTOK_R''@|0|g' -e 's|@''GNULIB_MEMMEM''@|0|g' -e 's|@''GNULIB_MEMPCPY''@|0|g' -e 's|@''GNULIB_MEMRCHR''@|0|g' -e 's|@''GNULIB_RAWMEMCHR''@|0|g' -e 's|@''GNULIB_STPCPY''@|0|g' -e 's|@''GNULIB_STPNCPY''@|0|g' -e 's|@''GNULIB_STRCHRNUL''@|0|g' -e 's|@''GNULIB_STRDUP''@|1|g' -e 's|@''GNULIB_STRNDUP''@|1|g' -e 's|@''GNULIB_STRNLEN''@|1|g' -e 's|@''GNULIB_STRPBRK''@|0|g' -e 's|@''GNULIB_STRSEP''@|0|g' -e 's|@''GNULIB_STRSTR''@|0|g' -e 's|@''GNULIB_STRCASESTR''@|0|g' -e 's|@''GNULIB_STRTOK_R''@|0|g' -e 's|@''GNULIB_STRERROR''@|1|g' -e 's|@''GNULIB_STRSIGNAL''@|0|g' -e 's|@''GNULIB_STRVERSCMP''@|0|g' -e 's|@''HAVE_DECL_MEMMEM''@|1|g' -e 's|@''HAVE_MEMPCPY''@|1|g' -e 's|@''HAVE_DECL_MEMRCHR''@|1|g' -e 's|@''HAVE_RAWMEMCHR''@|1|g' -e 's|@''HAVE_STPCPY''@|1|g' -e 's|@''HAVE_STPNCPY''@|1|g' -e 's|@''HAVE_STRCHRNUL''@|1|g' -e 's|@''HAVE_DECL_STRDUP''@|1|g' -e 's|@''HAVE_STRNDUP''@|1|g' -e 's|@''HAVE_DECL_STRNDUP''@|1|g' -e 's|@''HAVE_DECL_STRNLEN''@|1|g' -e 's|@''HAVE_STRPBRK''@|1|g' -e 's|@''HAVE_STRSEP''@|1|g' -e 's|@''HAVE_STRCASESTR''@|1|g' -e 's|@''HAVE_DECL_STRTOK_R''@|1|g' -e 's|@''HAVE_DECL_STRERROR''@|1|g' -e 's|@''HAVE_DECL_STRSIGNAL''@|1|g' -e 's|@''HAVE_STRVERSCMP''@|1|g' -e 's|@''REPLACE_MEMMEM''@|0|g' -e 's|@''REPLACE_STRCASESTR''@|0|g' -e 's|@''REPLACE_STRDUP''@|0|g' -e 's|@''REPLACE_STRSTR''@|0|g' -e 's|@''REPLACE_STRERROR''@|0|g' -e 's|@''REPLACE_STRSIGNAL''@|0|g' -e '/definition of GL_LINK_WARNING/r ../build-aux/link-warning.h' < ./string.in.h; } > string.h-t | ||
| 766 | mv string.h-t string.h | ||
| 767 | rm -f time.h-t time.h | ||
| 768 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && sed -e 's|@''INCLUDE_NEXT''@|include_next|g' -e 's|@''PRAGMA_SYSTEM_HEADER''@|#pragma GCC system_header|g' -e 's|@NEXT_TIME_H''@|<time.h>|g' -e 's|@REPLACE_LOCALTIME_R''@|0|g' -e 's|@REPLACE_NANOSLEEP''@|GNULIB_PORTCHECK|g' -e 's|@REPLACE_STRPTIME''@|GNULIB_PORTCHECK|g' -e 's|@REPLACE_TIMEGM''@|1|g' -e 's|@SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|0|g' -e 's|@TIME_H_DEFINES_STRUCT_TIMESPEC''@|1|g' < ./time.in.h; } > time.h-t | ||
| 769 | mv time.h-t time.h | ||
| 770 | rm -f unistd.h-t unistd.h | ||
| 771 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; sed -e 's|@''HAVE_UNISTD_H''@|1|g' -e 's|@''INCLUDE_NEXT''@|include_next|g' -e 's|@''PRAGMA_SYSTEM_HEADER''@|#pragma GCC system_header|g' -e 's|@''NEXT_UNISTD_H''@|<unistd.h>|g' -e 's|@''GNULIB_CHOWN''@|0|g' -e 's|@''GNULIB_CLOSE''@|0|g' -e 's|@''GNULIB_DUP2''@|0|g' -e 's|@''GNULIB_ENVIRON''@|0|g' -e 's|@''GNULIB_EUIDACCESS''@|0|g' -e 's|@''GNULIB_FCHDIR''@|0|g' -e 's|@''GNULIB_FSYNC''@|0|g' -e 's|@''GNULIB_FTRUNCATE''@|0|g' -e 's|@''GNULIB_GETCWD''@|0|g' -e 's|@''GNULIB_GETDOMAINNAME''@|0|g' -e 's|@''GNULIB_GETDTABLESIZE''@|0|g' -e 's|@''GNULIB_GETHOSTNAME''@|1|g' -e 's|@''GNULIB_GETLOGIN_R''@|0|g' -e 's|@''GNULIB_GETPAGESIZE''@|0|g' -e 's|@''GNULIB_GETUSERSHELL''@|0|g' -e 's|@''GNULIB_LCHOWN''@|0|g' -e 's|@''GNULIB_LINK''@|0|g' -e 's|@''GNULIB_LSEEK''@|0|g' -e 's|@''GNULIB_READLINK''@|0|g' -e 's|@''GNULIB_SLEEP''@|0|g' -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|0|g' -e 's|@''GNULIB_WRITE''@|1|g' -e 's|@''HAVE_DUP2''@|1|g' -e 's|@''HAVE_EUIDACCESS''@|1|g' -e 's|@''HAVE_FSYNC''@|1|g' -e 's|@''HAVE_FTRUNCATE''@|1|g' -e 's|@''HAVE_GETDOMAINNAME''@|1|g' -e 's|@''HAVE_GETDTABLESIZE''@|1|g' -e 's|@''HAVE_GETHOSTNAME''@|1|g' -e 's|@''HAVE_GETPAGESIZE''@|1|g' -e 's|@''HAVE_GETUSERSHELL''@|1|g' -e 's|@''HAVE_LINK''@|1|g' -e 's|@''HAVE_READLINK''@|1|g' -e 's|@''HAVE_SLEEP''@|1|g' -e 's|@''HAVE_DECL_ENVIRON''@|1|g' -e 's|@''HAVE_DECL_GETLOGIN_R''@|1|g' -e 's|@''HAVE_OS_H''@|0|g' -e 's|@''HAVE_SYS_PARAM_H''@|0|g' -e 's|@''REPLACE_CHOWN''@|0|g' -e 's|@''REPLACE_CLOSE''@|0|g' -e 's|@''REPLACE_FCHDIR''@|0|g' -e 's|@''REPLACE_GETCWD''@|0|g' -e 's|@''REPLACE_GETPAGESIZE''@|0|g' -e 's|@''REPLACE_LCHOWN''@|0|g' -e 's|@''REPLACE_LSEEK''@|0|g' -e 's|@''REPLACE_WRITE''@|0|g' -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|0|g' -e '/definition of GL_LINK_WARNING/r ../build-aux/link-warning.h' < ./unistd.in.h; } > unistd.h-t | ||
| 772 | mv unistd.h-t unistd.h | ||
| 773 | make all-recursive | ||
| 774 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT base64.o -MD -MP -MF .deps/base64.Tpo -c -o base64.o base64.c | ||
| 775 | mv -f .deps/base64.Tpo .deps/base64.Po | ||
| 776 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT full-read.o -MD -MP -MF .deps/full-read.Tpo -c -o full-read.o full-read.c | ||
| 777 | mv -f .deps/full-read.Tpo .deps/full-read.Po | ||
| 778 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT full-write.o -MD -MP -MF .deps/full-write.Tpo -c -o full-write.o full-write.c | ||
| 779 | mv -f .deps/full-write.Tpo .deps/full-write.Po | ||
| 780 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT localcharset.o -MD -MP -MF .deps/localcharset.Tpo -c -o localcharset.o localcharset.c | ||
| 781 | mv -f .deps/localcharset.Tpo .deps/localcharset.Po | ||
| 782 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT xalloc-die.o -MD -MP -MF .deps/xalloc-die.Tpo -c -o xalloc-die.o xalloc-die.c | ||
| 783 | mv -f .deps/xalloc-die.Tpo .deps/xalloc-die.Po | ||
| 784 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT xstrndup.o -MD -MP -MF .deps/xstrndup.Tpo -c -o xstrndup.o xstrndup.c | ||
| 785 | mv -f .deps/xstrndup.Tpo .deps/xstrndup.Po | ||
| 786 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT asnprintf.o -MD -MP -MF .deps/asnprintf.Tpo -c -o asnprintf.o asnprintf.c | ||
| 787 | mv -f .deps/asnprintf.Tpo .deps/asnprintf.Po | ||
| 788 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT asprintf.o -MD -MP -MF .deps/asprintf.Tpo -c -o asprintf.o asprintf.c | ||
| 789 | mv -f .deps/asprintf.Tpo .deps/asprintf.Po | ||
| 790 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT basename.o -MD -MP -MF .deps/basename.Tpo -c -o basename.o basename.c | ||
| 791 | mv -f .deps/basename.Tpo .deps/basename.Po | ||
| 792 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT c-strtod.o -MD -MP -MF .deps/c-strtod.Tpo -c -o c-strtod.o c-strtod.c | ||
| 793 | mv -f .deps/c-strtod.Tpo .deps/c-strtod.Po | ||
| 794 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT cloexec.o -MD -MP -MF .deps/cloexec.Tpo -c -o cloexec.o cloexec.c | ||
| 795 | mv -f .deps/cloexec.Tpo .deps/cloexec.Po | ||
| 796 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT creat-safer.o -MD -MP -MF .deps/creat-safer.Tpo -c -o creat-safer.o creat-safer.c | ||
| 797 | mv -f .deps/creat-safer.Tpo .deps/creat-safer.Po | ||
| 798 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT dirname.o -MD -MP -MF .deps/dirname.Tpo -c -o dirname.o dirname.c | ||
| 799 | mv -f .deps/dirname.Tpo .deps/dirname.Po | ||
| 800 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT dup-safer.o -MD -MP -MF .deps/dup-safer.Tpo -c -o dup-safer.o dup-safer.c | ||
| 801 | mv -f .deps/dup-safer.Tpo .deps/dup-safer.Po | ||
| 802 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT error.o -MD -MP -MF .deps/error.Tpo -c -o error.o error.c | ||
| 803 | mv -f .deps/error.Tpo .deps/error.Po | ||
| 804 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT exitfail.o -MD -MP -MF .deps/exitfail.Tpo -c -o exitfail.o exitfail.c | ||
| 805 | mv -f .deps/exitfail.Tpo .deps/exitfail.Po | ||
| 806 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT fd-safer.o -MD -MP -MF .deps/fd-safer.Tpo -c -o fd-safer.o fd-safer.c | ||
| 807 | mv -f .deps/fd-safer.Tpo .deps/fd-safer.Po | ||
| 808 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT fsusage.o -MD -MP -MF .deps/fsusage.Tpo -c -o fsusage.o fsusage.c | ||
| 809 | mv -f .deps/fsusage.Tpo .deps/fsusage.Po | ||
| 810 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT getloadavg.o -MD -MP -MF .deps/getloadavg.Tpo -c -o getloadavg.o getloadavg.c | ||
| 811 | mv -f .deps/getloadavg.Tpo .deps/getloadavg.Po | ||
| 812 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT getopt.o -MD -MP -MF .deps/getopt.Tpo -c -o getopt.o getopt.c | ||
| 813 | mv -f .deps/getopt.Tpo .deps/getopt.Po | ||
| 814 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT getopt1.o -MD -MP -MF .deps/getopt1.Tpo -c -o getopt1.o getopt1.c | ||
| 815 | mv -f .deps/getopt1.Tpo .deps/getopt1.Po | ||
| 816 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT malloc.o -MD -MP -MF .deps/malloc.Tpo -c -o malloc.o malloc.c | ||
| 817 | mv -f .deps/malloc.Tpo .deps/malloc.Po | ||
| 818 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT mktime.o -MD -MP -MF .deps/mktime.Tpo -c -o mktime.o mktime.c | ||
| 819 | mv -f .deps/mktime.Tpo .deps/mktime.Po | ||
| 820 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT mountlist.o -MD -MP -MF .deps/mountlist.Tpo -c -o mountlist.o mountlist.c | ||
| 821 | mountlist.c: In function 'read_file_system_list': | ||
| 822 | mountlist.c:797: warning: passing argument 3 of 'mntctl' from incompatible pointer type | ||
| 823 | mountlist.c:802: warning: passing argument 3 of 'mntctl' from incompatible pointer type | ||
| 824 | mv -f .deps/mountlist.Tpo .deps/mountlist.Po | ||
| 825 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT open.o -MD -MP -MF .deps/open.Tpo -c -o open.o open.c | ||
| 826 | mv -f .deps/open.Tpo .deps/open.Po | ||
| 827 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT open-safer.o -MD -MP -MF .deps/open-safer.Tpo -c -o open-safer.o open-safer.c | ||
| 828 | mv -f .deps/open-safer.Tpo .deps/open-safer.Po | ||
| 829 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT pipe-safer.o -MD -MP -MF .deps/pipe-safer.Tpo -c -o pipe-safer.o pipe-safer.c | ||
| 830 | mv -f .deps/pipe-safer.Tpo .deps/pipe-safer.Po | ||
| 831 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT printf-args.o -MD -MP -MF .deps/printf-args.Tpo -c -o printf-args.o printf-args.c | ||
| 832 | mv -f .deps/printf-args.Tpo .deps/printf-args.Po | ||
| 833 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT printf-parse.o -MD -MP -MF .deps/printf-parse.Tpo -c -o printf-parse.o printf-parse.c | ||
| 834 | mv -f .deps/printf-parse.Tpo .deps/printf-parse.Po | ||
| 835 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT regex.o -MD -MP -MF .deps/regex.Tpo -c -o regex.o regex.c | ||
| 836 | mv -f .deps/regex.Tpo .deps/regex.Po | ||
| 837 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT safe-read.o -MD -MP -MF .deps/safe-read.Tpo -c -o safe-read.o safe-read.c | ||
| 838 | mv -f .deps/safe-read.Tpo .deps/safe-read.Po | ||
| 839 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT safe-write.o -MD -MP -MF .deps/safe-write.Tpo -c -o safe-write.o safe-write.c | ||
| 840 | mv -f .deps/safe-write.Tpo .deps/safe-write.Po | ||
| 841 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT stripslash.o -MD -MP -MF .deps/stripslash.Tpo -c -o stripslash.o stripslash.c | ||
| 842 | mv -f .deps/stripslash.Tpo .deps/stripslash.Po | ||
| 843 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT timegm.o -MD -MP -MF .deps/timegm.Tpo -c -o timegm.o timegm.c | ||
| 844 | mv -f .deps/timegm.Tpo .deps/timegm.Po | ||
| 845 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT vasnprintf.o -MD -MP -MF .deps/vasnprintf.Tpo -c -o vasnprintf.o vasnprintf.c | ||
| 846 | mv -f .deps/vasnprintf.Tpo .deps/vasnprintf.Po | ||
| 847 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT vasprintf.o -MD -MP -MF .deps/vasprintf.Tpo -c -o vasprintf.o vasprintf.c | ||
| 848 | mv -f .deps/vasprintf.Tpo .deps/vasprintf.Po | ||
| 849 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -I/include -g -O2 -MT xmalloc.o -MD -MP -MF .deps/xmalloc.Tpo -c -o xmalloc.o xmalloc.c | ||
| 850 | mv -f .deps/xmalloc.Tpo .deps/xmalloc.Po | ||
| 851 | rm -f libgnu.a | ||
| 852 | ar cru libgnu.a base64.o full-read.o full-write.o localcharset.o xalloc-die.o xstrndup.o asnprintf.o asprintf.o basename.o c-strtod.o cloexec.o creat-safer.o dirname.o dup-safer.o error.o exitfail.o fd-safer.o fsusage.o getloadavg.o getopt.o getopt1.o malloc.o mktime.o mountlist.o open.o open-safer.o pipe-safer.o printf-args.o printf-parse.o regex.o safe-read.o safe-write.o stripslash.o timegm.o vasnprintf.o vasprintf.o xmalloc.o | ||
| 853 | ranlib libgnu.a | ||
| 854 | rm -f t-charset.alias charset.alias | ||
| 855 | /bin/sh ./config.charset 'powerpc-ibm-aix5.3.0.0' > t-charset.alias | ||
| 856 | mv t-charset.alias charset.alias | ||
| 857 | rm -f t-ref-add.sed ref-add.sed | ||
| 858 | sed -e '/^#/d' -e 's/@''PACKAGE''@/nagios-plugins/g' ref-add.sin > t-ref-add.sed | ||
| 859 | mv t-ref-add.sed ref-add.sed | ||
| 860 | rm -f t-ref-del.sed ref-del.sed | ||
| 861 | sed -e '/^#/d' -e 's/@''PACKAGE''@/nagios-plugins/g' ref-del.sin > t-ref-del.sed | ||
| 862 | mv t-ref-del.sed ref-del.sed | ||
| 863 | Target "all-am" is up to date. | ||
| 864 | Making all in tap | ||
| 865 | Target "all" is up to date. | ||
| 866 | Making all in lib | ||
| 867 | Making all in . | ||
| 868 | gcc -DHAVE_CONFIG_H -I. -I.. -I. -I../gl -I../intl -I../plugins -I/include -g -O2 -MT utils_base.o -MD -MP -MF .deps/utils_base.Tpo -c -o utils_base.o utils_base.c | ||
| 869 | mv -f .deps/utils_base.Tpo .deps/utils_base.Po | ||
| 870 | gcc -DHAVE_CONFIG_H -I. -I.. -I. -I../gl -I../intl -I../plugins -I/include -g -O2 -MT utils_disk.o -MD -MP -MF .deps/utils_disk.Tpo -c -o utils_disk.o utils_disk.c | ||
| 871 | mv -f .deps/utils_disk.Tpo .deps/utils_disk.Po | ||
| 872 | gcc -DHAVE_CONFIG_H -I. -I.. -I. -I../gl -I../intl -I../plugins -I/include -g -O2 -MT utils_tcp.o -MD -MP -MF .deps/utils_tcp.Tpo -c -o utils_tcp.o utils_tcp.c | ||
| 873 | mv -f .deps/utils_tcp.Tpo .deps/utils_tcp.Po | ||
| 874 | gcc -DHAVE_CONFIG_H -I. -I.. -I. -I../gl -I../intl -I../plugins -I/include -g -O2 -MT utils_cmd.o -MD -MP -MF .deps/utils_cmd.Tpo -c -o utils_cmd.o utils_cmd.c | ||
| 875 | mv -f .deps/utils_cmd.Tpo .deps/utils_cmd.Po | ||
| 876 | rm -f libnagiosplug.a | ||
| 877 | ar cru libnagiosplug.a utils_base.o utils_disk.o utils_tcp.o utils_cmd.o | ||
| 878 | ranlib libnagiosplug.a | ||
| 879 | Target "all-am" is up to date. | ||
| 880 | Making all in tests | ||
| 881 | Target "all" is up to date. | ||
| 882 | Target "all" is up to date. | ||
| 883 | Making all in plugins | ||
| 884 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_apt.o -MD -MP -MF .deps/check_apt.Tpo -c -o check_apt.o check_apt.c | ||
| 885 | mv -f .deps/check_apt.Tpo .deps/check_apt.Po | ||
| 886 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT utils.o -MD -MP -MF .deps/utils.Tpo -c -o utils.o utils.c | ||
| 887 | mv -f .deps/utils.Tpo .deps/utils.Po | ||
| 888 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT runcmd.o -MD -MP -MF .deps/runcmd.Tpo -c -o runcmd.o runcmd.c | ||
| 889 | mv -f .deps/runcmd.Tpo .deps/runcmd.Po | ||
| 890 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_apt check_apt.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a runcmd.o -L/lib -lintl -lpthread -ldl | ||
| 891 | mkdir .libs | ||
| 892 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_apt check_apt.o utils.o runcmd.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lintl -lpthread -ldl | ||
| 893 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_cluster.o -MD -MP -MF .deps/check_cluster.Tpo -c -o check_cluster.o check_cluster.c | ||
| 894 | mv -f .deps/check_cluster.Tpo .deps/check_cluster.Po | ||
| 895 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_cluster check_cluster.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -L/lib -lintl -lpthread -ldl | ||
| 896 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_cluster check_cluster.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lintl -lpthread -ldl | ||
| 897 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_disk.o -MD -MP -MF .deps/check_disk.Tpo -c -o check_disk.o check_disk.c | ||
| 898 | mv -f .deps/check_disk.Tpo .deps/check_disk.Po | ||
| 899 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT popen.o -MD -MP -MF .deps/popen.Tpo -c -o popen.o popen.c | ||
| 900 | mv -f .deps/popen.Tpo .deps/popen.Po | ||
| 901 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_disk check_disk.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a popen.o -L/lib -lintl -lpthread -ldl | ||
| 902 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_disk check_disk.o utils.o popen.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lintl -lpthread -ldl | ||
| 903 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_dummy.o -MD -MP -MF .deps/check_dummy.Tpo -c -o check_dummy.o check_dummy.c | ||
| 904 | mv -f .deps/check_dummy.Tpo .deps/check_dummy.Po | ||
| 905 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_dummy check_dummy.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -L/lib -lintl -lpthread -ldl | ||
| 906 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_dummy check_dummy.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lintl -lpthread -ldl | ||
| 907 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_http.o -MD -MP -MF .deps/check_http.Tpo -c -o check_http.o check_http.c | ||
| 908 | mv -f .deps/check_http.Tpo .deps/check_http.Po | ||
| 909 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT sslutils.o -MD -MP -MF .deps/sslutils.Tpo -c -o sslutils.o sslutils.c | ||
| 910 | mv -f .deps/sslutils.Tpo .deps/sslutils.Po | ||
| 911 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT netutils.o -MD -MP -MF .deps/netutils.Tpo -c -o netutils.o netutils.c | ||
| 912 | mv -f .deps/netutils.Tpo .deps/netutils.Po | ||
| 913 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_http check_http.o sslutils.o netutils.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lssl -lcrypto -L/lib -lintl -lpthread -ldl | ||
| 914 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_http check_http.o sslutils.o netutils.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lssl -lcrypto -lintl -lpthread -ldl | ||
| 915 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_load.o -MD -MP -MF .deps/check_load.Tpo -c -o check_load.o check_load.c | ||
| 916 | mv -f .deps/check_load.Tpo .deps/check_load.Po | ||
| 917 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_load check_load.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a popen.o -L/lib -lintl -lpthread -ldl | ||
| 918 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_load check_load.o utils.o popen.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lintl -lpthread -ldl | ||
| 919 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_mrtg.o -MD -MP -MF .deps/check_mrtg.Tpo -c -o check_mrtg.o check_mrtg.c | ||
| 920 | mv -f .deps/check_mrtg.Tpo .deps/check_mrtg.Po | ||
| 921 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_mrtg check_mrtg.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -L/lib -lintl -lpthread -ldl | ||
| 922 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_mrtg check_mrtg.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lintl -lpthread -ldl | ||
| 923 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_mrtgtraf.o -MD -MP -MF .deps/check_mrtgtraf.Tpo -c -o check_mrtgtraf.o check_mrtgtraf.c | ||
| 924 | mv -f .deps/check_mrtgtraf.Tpo .deps/check_mrtgtraf.Po | ||
| 925 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_mrtgtraf check_mrtgtraf.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -L/lib -lintl -lpthread -ldl | ||
| 926 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_mrtgtraf check_mrtgtraf.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lintl -lpthread -ldl | ||
| 927 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_ntp.o -MD -MP -MF .deps/check_ntp.Tpo -c -o check_ntp.o check_ntp.c | ||
| 928 | mv -f .deps/check_ntp.Tpo .deps/check_ntp.Po | ||
| 929 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_ntp check_ntp.o netutils.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lm -L/lib -lintl -lpthread -ldl | ||
| 930 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_ntp check_ntp.o netutils.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lm -lintl -lpthread -ldl | ||
| 931 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_ntp_peer.o -MD -MP -MF .deps/check_ntp_peer.Tpo -c -o check_ntp_peer.o check_ntp_peer.c | ||
| 932 | mv -f .deps/check_ntp_peer.Tpo .deps/check_ntp_peer.Po | ||
| 933 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_ntp_peer check_ntp_peer.o netutils.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lm -L/lib -lintl -lpthread -ldl | ||
| 934 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_ntp_peer check_ntp_peer.o netutils.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lm -lintl -lpthread -ldl | ||
| 935 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_nwstat.o -MD -MP -MF .deps/check_nwstat.Tpo -c -o check_nwstat.o check_nwstat.c | ||
| 936 | mv -f .deps/check_nwstat.Tpo .deps/check_nwstat.Po | ||
| 937 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_nwstat check_nwstat.o netutils.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -L/lib -lintl -lpthread -ldl | ||
| 938 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_nwstat check_nwstat.o netutils.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lintl -lpthread -ldl | ||
| 939 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_overcr.o -MD -MP -MF .deps/check_overcr.Tpo -c -o check_overcr.o check_overcr.c | ||
| 940 | mv -f .deps/check_overcr.Tpo .deps/check_overcr.Po | ||
| 941 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_overcr check_overcr.o netutils.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -L/lib -lintl -lpthread -ldl | ||
| 942 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_overcr check_overcr.o netutils.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lintl -lpthread -ldl | ||
| 943 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_ping.o -MD -MP -MF .deps/check_ping.Tpo -c -o check_ping.o check_ping.c | ||
| 944 | mv -f .deps/check_ping.Tpo .deps/check_ping.Po | ||
| 945 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_ping check_ping.o netutils.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl popen.o -L/lib -lintl -lpthread -ldl | ||
| 946 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_ping check_ping.o netutils.o utils.o popen.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lintl -lpthread -ldl | ||
| 947 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_real.o -MD -MP -MF .deps/check_real.Tpo -c -o check_real.o check_real.c | ||
| 948 | mv -f .deps/check_real.Tpo .deps/check_real.Po | ||
| 949 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_real check_real.o netutils.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -L/lib -lintl -lpthread -ldl | ||
| 950 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_real check_real.o netutils.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lintl -lpthread -ldl | ||
| 951 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_smtp.o -MD -MP -MF .deps/check_smtp.Tpo -c -o check_smtp.o check_smtp.c | ||
| 952 | mv -f .deps/check_smtp.Tpo .deps/check_smtp.Po | ||
| 953 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_smtp check_smtp.o sslutils.o netutils.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lssl -lcrypto -L/lib -lintl -lpthread -ldl | ||
| 954 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_smtp check_smtp.o sslutils.o netutils.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lssl -lcrypto -lintl -lpthread -ldl | ||
| 955 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_ssh.o -MD -MP -MF .deps/check_ssh.Tpo -c -o check_ssh.o check_ssh.c | ||
| 956 | mv -f .deps/check_ssh.Tpo .deps/check_ssh.Po | ||
| 957 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_ssh check_ssh.o netutils.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -L/lib -lintl -lpthread -ldl | ||
| 958 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_ssh check_ssh.o netutils.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lintl -lpthread -ldl | ||
| 959 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_tcp.o -MD -MP -MF .deps/check_tcp.Tpo -c -o check_tcp.o check_tcp.c | ||
| 960 | mv -f .deps/check_tcp.Tpo .deps/check_tcp.Po | ||
| 961 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_tcp check_tcp.o sslutils.o netutils.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lssl -lcrypto -L/lib -lintl -lpthread -ldl | ||
| 962 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_tcp check_tcp.o sslutils.o netutils.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lssl -lcrypto -lintl -lpthread -ldl | ||
| 963 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_time.o -MD -MP -MF .deps/check_time.Tpo -c -o check_time.o check_time.c | ||
| 964 | mv -f .deps/check_time.Tpo .deps/check_time.Po | ||
| 965 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_time check_time.o netutils.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -L/lib -lintl -lpthread -ldl | ||
| 966 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_time check_time.o netutils.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lintl -lpthread -ldl | ||
| 967 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_ntp_time.o -MD -MP -MF .deps/check_ntp_time.Tpo -c -o check_ntp_time.o check_ntp_time.c | ||
| 968 | mv -f .deps/check_ntp_time.Tpo .deps/check_ntp_time.Po | ||
| 969 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_ntp_time check_ntp_time.o netutils.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lm -L/lib -lintl -lpthread -ldl | ||
| 970 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_ntp_time check_ntp_time.o netutils.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lm -lintl -lpthread -ldl | ||
| 971 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_ups.o -MD -MP -MF .deps/check_ups.Tpo -c -o check_ups.o check_ups.c | ||
| 972 | mv -f .deps/check_ups.Tpo .deps/check_ups.Po | ||
| 973 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_ups check_ups.o netutils.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -L/lib -lintl -lpthread -ldl | ||
| 974 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_ups check_ups.o netutils.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lintl -lpthread -ldl | ||
| 975 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_users.o -MD -MP -MF .deps/check_users.Tpo -c -o check_users.o check_users.c | ||
| 976 | mv -f .deps/check_users.Tpo .deps/check_users.Po | ||
| 977 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_users check_users.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a popen.o -L/lib -lintl -lpthread -ldl | ||
| 978 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_users check_users.o utils.o popen.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lintl -lpthread -ldl | ||
| 979 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT negate.o -MD -MP -MF .deps/negate.Tpo -c -o negate.o negate.c | ||
| 980 | mv -f .deps/negate.Tpo .deps/negate.Po | ||
| 981 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o negate negate.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -L/lib -lintl -lpthread -ldl | ||
| 982 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o negate negate.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lintl -lpthread -ldl | ||
| 983 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT urlize.o -MD -MP -MF .deps/urlize.Tpo -c -o urlize.o urlize.c | ||
| 984 | mv -f .deps/urlize.Tpo .deps/urlize.Po | ||
| 985 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o urlize urlize.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a popen.o -L/lib -lintl -lpthread -ldl | ||
| 986 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o urlize urlize.o utils.o popen.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lintl -lpthread -ldl | ||
| 987 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_ldap.o -MD -MP -MF .deps/check_ldap.Tpo -c -o check_ldap.o check_ldap.c | ||
| 988 | mv -f .deps/check_ldap.Tpo .deps/check_ldap.Po | ||
| 989 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_ldap check_ldap.o netutils.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lldap -llber -L/lib -lintl -lpthread -ldl | ||
| 990 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_ldap check_ldap.o netutils.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -L/opt/freeware/lib -lldap -L/opt/freeware/src/packages/BUILD/openldap-2.0.21/libraries -lssl -lcrypto -ls -llber -lintl -lpthread -ldl -Wl,-blibpath:/opt/freeware/lib:/opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.0:/opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.0/../../..:/usr/lib:/lib | ||
| 991 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_procs.o -MD -MP -MF .deps/check_procs.Tpo -c -o check_procs.o check_procs.c | ||
| 992 | mv -f .deps/check_procs.Tpo .deps/check_procs.Po | ||
| 993 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_procs check_procs.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -L/lib -lintl -lpthread -ldl | ||
| 994 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_procs check_procs.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lintl -lpthread -ldl | ||
| 995 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_nagios.o -MD -MP -MF .deps/check_nagios.Tpo -c -o check_nagios.o check_nagios.c | ||
| 996 | mv -f .deps/check_nagios.Tpo .deps/check_nagios.Po | ||
| 997 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_nagios check_nagios.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a runcmd.o -L/lib -lintl -lpthread -ldl | ||
| 998 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_nagios check_nagios.o utils.o runcmd.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lintl -lpthread -ldl | ||
| 999 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_dns.o -MD -MP -MF .deps/check_dns.Tpo -c -o check_dns.o check_dns.c | ||
| 1000 | mv -f .deps/check_dns.Tpo .deps/check_dns.Po | ||
| 1001 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_dns check_dns.o netutils.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl runcmd.o -L/lib -lintl -lpthread -ldl | ||
| 1002 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_dns check_dns.o netutils.o utils.o runcmd.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lintl -lpthread -ldl | ||
| 1003 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_by_ssh.o -MD -MP -MF .deps/check_by_ssh.Tpo -c -o check_by_ssh.o check_by_ssh.c | ||
| 1004 | mv -f .deps/check_by_ssh.Tpo .deps/check_by_ssh.Po | ||
| 1005 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_by_ssh check_by_ssh.o netutils.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -L/lib -lintl -lpthread -ldl | ||
| 1006 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_by_ssh check_by_ssh.o netutils.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lintl -lpthread -ldl | ||
| 1007 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_dig.o -MD -MP -MF .deps/check_dig.Tpo -c -o check_dig.o check_dig.c | ||
| 1008 | mv -f .deps/check_dig.Tpo .deps/check_dig.Po | ||
| 1009 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_dig check_dig.o netutils.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl runcmd.o -L/lib -lintl -lpthread -ldl | ||
| 1010 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_dig check_dig.o netutils.o utils.o runcmd.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lintl -lpthread -ldl | ||
| 1011 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_nt.o -MD -MP -MF .deps/check_nt.Tpo -c -o check_nt.o check_nt.c | ||
| 1012 | mv -f .deps/check_nt.Tpo .deps/check_nt.Po | ||
| 1013 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_nt check_nt.o netutils.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -L/lib -lintl -lpthread -ldl | ||
| 1014 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_nt check_nt.o netutils.o utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins -L/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lintl -lpthread -ldl | ||
| 1015 | rm -f check_ftp | ||
| 1016 | ln -s check_tcp check_ftp | ||
| 1017 | rm -f check_imap | ||
| 1018 | ln -s check_tcp check_imap | ||
| 1019 | rm -f check_nntp | ||
| 1020 | ln -s check_tcp check_nntp | ||
| 1021 | rm -f check_pop | ||
| 1022 | ln -s check_tcp check_pop | ||
| 1023 | rm -f check_udp | ||
| 1024 | ln -s check_tcp check_udp | ||
| 1025 | rm -f check_clamd | ||
| 1026 | ln -s check_tcp check_clamd | ||
| 1027 | rm -f check_simap | ||
| 1028 | ln -s check_tcp check_simap | ||
| 1029 | rm -f check_spop | ||
| 1030 | ln -s check_tcp check_spop | ||
| 1031 | rm -f check_jabber | ||
| 1032 | ln -s check_tcp check_jabber | ||
| 1033 | rm -f check_nntps | ||
| 1034 | ln -s check_tcp check_nntps | ||
| 1035 | rm -f check_ssmtp | ||
| 1036 | ln -s check_tcp check_ssmtp | ||
| 1037 | Target "all" is up to date. | ||
| 1038 | Making all in plugins-scripts | ||
| 1039 | NP_VERSION=1.4.14-61-g45e2 nawk -f ./subst check_breeze.pl > check_breeze | ||
| 1040 | chmod +x check_breeze | ||
| 1041 | NP_VERSION=1.4.14-61-g45e2 nawk -f ./subst check_disk_smb.pl > check_disk_smb | ||
| 1042 | chmod +x check_disk_smb | ||
| 1043 | NP_VERSION=1.4.14-61-g45e2 nawk -f ./subst check_flexlm.pl > check_flexlm | ||
| 1044 | chmod +x check_flexlm | ||
| 1045 | NP_VERSION=1.4.14-61-g45e2 nawk -f ./subst check_ircd.pl > check_ircd | ||
| 1046 | chmod +x check_ircd | ||
| 1047 | NP_VERSION=1.4.14-61-g45e2 nawk -f ./subst check_log.sh > check_log | ||
| 1048 | chmod +x check_log | ||
| 1049 | NP_VERSION=1.4.14-61-g45e2 nawk -f ./subst check_oracle.sh > check_oracle | ||
| 1050 | chmod +x check_oracle | ||
| 1051 | NP_VERSION=1.4.14-61-g45e2 nawk -f ./subst check_rpc.pl > check_rpc | ||
| 1052 | chmod +x check_rpc | ||
| 1053 | NP_VERSION=1.4.14-61-g45e2 nawk -f ./subst check_sensors.sh > check_sensors | ||
| 1054 | chmod +x check_sensors | ||
| 1055 | NP_VERSION=1.4.14-61-g45e2 nawk -f ./subst check_wave.pl > check_wave | ||
| 1056 | chmod +x check_wave | ||
| 1057 | NP_VERSION=1.4.14-61-g45e2 nawk -f ./subst check_ifstatus.pl > check_ifstatus | ||
| 1058 | chmod +x check_ifstatus | ||
| 1059 | NP_VERSION=1.4.14-61-g45e2 nawk -f ./subst check_ifoperstatus.pl > check_ifoperstatus | ||
| 1060 | chmod +x check_ifoperstatus | ||
| 1061 | NP_VERSION=1.4.14-61-g45e2 nawk -f ./subst check_mailq.pl > check_mailq | ||
| 1062 | chmod +x check_mailq | ||
| 1063 | NP_VERSION=1.4.14-61-g45e2 nawk -f ./subst check_file_age.pl > check_file_age | ||
| 1064 | chmod +x check_file_age | ||
| 1065 | cd .. && /bin/sh ./config.status plugins-scripts/utils.sh | ||
| 1066 | config.status: creating plugins-scripts/utils.sh | ||
| 1067 | cd .. && /bin/sh ./config.status plugins-scripts/utils.pm | ||
| 1068 | config.status: creating plugins-scripts/utils.pm | ||
| 1069 | Target "all" is up to date. | ||
| 1070 | Making all in plugins-root | ||
| 1071 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I../plugins -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_dhcp.o -MD -MP -MF .deps/check_dhcp.Tpo -c -o check_dhcp.o check_dhcp.c | ||
| 1072 | check_dhcp.c: In function 'add_dhcp_offer': | ||
| 1073 | check_dhcp.c:843: warning: comparison is always false due to limited range of data type | ||
| 1074 | mv -f .deps/check_dhcp.Tpo .deps/check_dhcp.Po | ||
| 1075 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_dhcp check_dhcp.o -L/lib -lintl ../plugins/netutils.o ../plugins/utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lpthread -ldl | ||
| 1076 | mkdir .libs | ||
| 1077 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_dhcp check_dhcp.o ../plugins/netutils.o ../plugins/utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins-root -L/lib -lintl ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lpthread -ldl | ||
| 1078 | gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I../plugins -I/include -I/include -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -MT check_icmp.o -MD -MP -MF .deps/check_icmp.Tpo -c -o check_icmp.o check_icmp.c | ||
| 1079 | check_icmp.c: In function 'recvfrom_wto': | ||
| 1080 | check_icmp.c:903: warning: passing argument 6 of 'nrecvfrom' from incompatible pointer type | ||
| 1081 | mv -f .deps/check_icmp.Tpo .deps/check_icmp.Po | ||
| 1082 | /bin/sh ../libtool --tag=CC --mode=link gcc -DNP_VERSION='"1.4.14-61-g45e2"' -g -O2 -L. -L/lib -o check_icmp check_icmp.o -L/lib -lintl ../plugins/netutils.o ../plugins/utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lnsl -lpthread -ldl | ||
| 1083 | gcc -DNP_VERSION=\"1.4.14-61-g45e2\" -g -O2 -o check_icmp check_icmp.o ../plugins/netutils.o ../plugins/utils.o -L/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2/plugins-root -L/lib -lintl ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lpthread -ldl | ||
| 1084 | Target "all" is up to date. | ||
| 1085 | Making all in po | ||
| 1086 | Target "all" is up to date. | ||
| 1087 | Target "all-am" is up to date. | ||
| 1088 | root@:/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2# gvv cc ^C | ||
| 1089 | root@:/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2# gcc -v | ||
| 1090 | Using built-in specs. | ||
| 1091 | Target: powerpc-ibm-aix5.3.0.0 | ||
| 1092 | Configured with: ../configure --with-as=/usr/bin/as --with-ld=/usr/bin/ld --disable-nls --enable-languages=c,c++ --prefix=/opt/freeware --enable-threads --enable-version-specific-runtime-libs --host=powerpc-ibm-aix5.3.0.0 | ||
| 1093 | Thread model: aix | ||
| 1094 | gcc version 4.0.0 | ||
| 1095 | root@:/usr/src/packages/BUILD/nagios-plugins-1.4.14-61-g45e2# ^D | ||
| 1096 | |||
| 1097 | Script command is complete on Mon Dec 21 14:51:51 2009. | ||
diff --git a/web/attachments/357353-interdiff.txt b/web/attachments/357353-interdiff.txt new file mode 100644 index 0000000..aaf3299 --- /dev/null +++ b/web/attachments/357353-interdiff.txt | |||
| @@ -0,0 +1,107 @@ | |||
| 1 | --- nagios-plugins-1.4.13+git200906171200.orig/plugins/check_disk.c | ||
| 2 | +++ nagios-plugins-1.4.13+git200906171200/plugins/check_disk.c | ||
| 3 | @@ -3,7 +3,7 @@ | ||
| 4 | * Nagios check_disk plugin | ||
| 5 | * | ||
| 6 | * License: GPL | ||
| 7 | -* Copyright (c) 1999-2008 Nagios Plugins Development Team | ||
| 8 | +* Copyright (c) 1999-2010 Nagios Plugins Development Team | ||
| 9 | * | ||
| 10 | * Description: | ||
| 11 | * | ||
| 12 | @@ -28,7 +28,7 @@ | ||
| 13 | |||
| 14 | const char *progname = "check_disk"; | ||
| 15 | const char *program_name = "check_disk"; /* Required for coreutils libs */ | ||
| 16 | -const char *copyright = "1999-2008"; | ||
| 17 | +const char *copyright = "1999-2010"; | ||
| 18 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 19 | |||
| 20 | |||
| 21 | @@ -51,6 +51,7 @@ | ||
| 22 | # include <limits.h> | ||
| 23 | #endif | ||
| 24 | #include "regex.h" | ||
| 25 | +#include "human.h" | ||
| 26 | |||
| 27 | |||
| 28 | /* If nonzero, show inode information. */ | ||
| 29 | @@ -129,6 +130,7 @@ | ||
| 30 | char *exclude_device; | ||
| 31 | char *units; | ||
| 32 | uintmax_t mult = 1024 * 1024; | ||
| 33 | +int human_readable_units = FALSE; | ||
| 34 | int verbose = 0; | ||
| 35 | int erronly = FALSE; | ||
| 36 | int display_mntp = FALSE; | ||
| 37 | @@ -167,6 +169,8 @@ | ||
| 38 | double warning_high_tide; | ||
| 39 | double critical_high_tide; | ||
| 40 | int temp_result; | ||
| 41 | + char buf[LONGEST_HUMAN_READABLE]; | ||
| 42 | + int human_opts = human_suppress_point_zero | human_autoscale | human_SI | human_group_digits | human_base_1024; | ||
| 43 | |||
| 44 | struct mount_entry *me; | ||
| 45 | struct fs_usage fsp, tmpfsp; | ||
| 46 | @@ -389,12 +393,19 @@ | ||
| 47 | if (disk_result==STATE_OK && erronly && !verbose) | ||
| 48 | continue; | ||
| 49 | |||
| 50 | - asprintf (&output, "%s %s %.0f %s (%.0f%%", | ||
| 51 | - output, | ||
| 52 | - (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
| 53 | - dfree_units, | ||
| 54 | - units, | ||
| 55 | - dfree_pct); | ||
| 56 | + if (human_readable_units) | ||
| 57 | + asprintf (&output, "%s %s %s (%.0f%%", | ||
| 58 | + output, | ||
| 59 | + (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
| 60 | + human_readable (available, buf, human_opts, fsp.fsu_blocksize, 1), | ||
| 61 | + dfree_pct); | ||
| 62 | + else | ||
| 63 | + asprintf (&output, "%s %s %.0f %s (%.0f%%", | ||
| 64 | + output, | ||
| 65 | + (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
| 66 | + dfree_units, | ||
| 67 | + units, | ||
| 68 | + dfree_pct); | ||
| 69 | if (dused_inodes_percent < 0) { | ||
| 70 | asprintf(&output, "%s inode=-);", output); | ||
| 71 | } else { | ||
| 72 | @@ -473,6 +484,7 @@ | ||
| 73 | {"kilobytes", no_argument, 0, 'k'}, | ||
| 74 | {"megabytes", no_argument, 0, 'm'}, | ||
| 75 | {"units", required_argument, 0, 'u'}, | ||
| 76 | + {"human-readable", no_argument, 0, 'Z'}, | ||
| 77 | {"path", required_argument, 0, 'p'}, | ||
| 78 | {"partition", required_argument, 0, 'p'}, | ||
| 79 | {"exclude_device", required_argument, 0, 'x'}, | ||
| 80 | @@ -601,6 +613,9 @@ | ||
| 81 | if (units == NULL) | ||
| 82 | die (STATE_UNKNOWN, _("failed allocating storage for '%s'\n"), "units"); | ||
| 83 | break; | ||
| 84 | + case 'Z': /* human readable */ | ||
| 85 | + human_readable_units = TRUE; | ||
| 86 | + break; | ||
| 87 | case 'k': /* display mountpoint */ | ||
| 88 | mult = 1024; | ||
| 89 | if (units) | ||
| 90 | @@ -958,6 +973,8 @@ | ||
| 91 | printf (_(UT_VERBOSE)); | ||
| 92 | printf (" %s\n", "-X, --exclude-type=TYPE"); | ||
| 93 | printf (" %s\n", _("Ignore all filesystems of indicated type (may be repeated)")); | ||
| 94 | + printf (" %s\n", "--human-readable"); | ||
| 95 | + printf (" %s\n", _("Print sizes in human readable format (e.g., 1K 234M 2G)")); | ||
| 96 | |||
| 97 | #ifdef NP_EXTRA_OPTS | ||
| 98 | printf ("\n"); | ||
| 99 | @@ -986,7 +1003,7 @@ | ||
| 100 | printf (_("Usage:")); | ||
| 101 | printf (" %s -w limit -c limit [-W limit] [-K limit] {-p path | -x device}\n", progname); | ||
| 102 | printf ("[-C] [-E] [-e] [-g group ] [-k] [-l] [-M] [-m] [-R path ] [-r path ]\n"); | ||
| 103 | - printf ("[-t timeout] [-u unit] [-v] [-X type]\n"); | ||
| 104 | + printf ("[-t timeout] [-u unit] [-v] [-X type] [--human-readable]\n"); | ||
| 105 | } | ||
| 106 | |||
| 107 | void | ||
diff --git a/web/attachments/35776-check_tcp.diff b/web/attachments/35776-check_tcp.diff new file mode 100644 index 0000000..b461a63 --- /dev/null +++ b/web/attachments/35776-check_tcp.diff | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | --- check_tcp.c.orig Wed Nov 20 12:15:44 2002 | ||
| 2 | +++ check_tcp.c Wed Nov 20 12:15:03 2002 | ||
| 3 | @@ -241,19 +241,20 @@ | ||
| 4 | |||
| 5 | /* watch for the expect string */ | ||
| 6 | #ifdef HAVE_SSL | ||
| 7 | - if (use_ssl && SSL_read (ssl, buffer, MAX_INPUT_BUFFER - 1)>=0) | ||
| 8 | + if (use_ssl && SSL_read (ssl, buffer, MAX_INPUT_BUFFER - 1)>0) | ||
| 9 | status = strscat(status,buffer); | ||
| 10 | else | ||
| 11 | #endif | ||
| 12 | { | ||
| 13 | - if (recv (sd, buffer, MAX_INPUT_BUFFER - 1, 0) >= 0) | ||
| 14 | + if (recv (sd, buffer, MAX_INPUT_BUFFER - 1, 0) > 0) | ||
| 15 | status = strscat (status, buffer); | ||
| 16 | } | ||
| 17 | - strip (status); | ||
| 18 | |||
| 19 | /* return a CRITICAL status if we couldn't read any data */ | ||
| 20 | if (status == NULL) | ||
| 21 | terminate (STATE_CRITICAL, "No data received from host\n"); | ||
| 22 | + | ||
| 23 | + strip (status); | ||
| 24 | |||
| 25 | if (status && verbose) | ||
| 26 | printf ("%s\n", status); | ||
diff --git a/web/attachments/36305-check_procs_1.5.txt b/web/attachments/36305-check_procs_1.5.txt new file mode 100644 index 0000000..2cac0d2 --- /dev/null +++ b/web/attachments/36305-check_procs_1.5.txt | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | --- nagios-plugins-1.3.0-beta2.orig/plugins/check_procs.c Fri Nov 22 02:33:26 2002 | ||
| 2 | +++ nagios-plugins-1.3.0-beta2/plugins/check_procs.c Wed Nov 27 16:21:10 2002 | ||
| 3 | @@ -72,10 +72,10 @@ | ||
| 4 | int verbose = FALSE; | ||
| 5 | int uid; | ||
| 6 | int ppid; | ||
| 7 | -char *statopts = NULL; | ||
| 8 | -char *prog = NULL; | ||
| 9 | -char *args = NULL; | ||
| 10 | -char *fmt = NULL; | ||
| 11 | +char *statopts = ""; | ||
| 12 | +char *prog = ""; | ||
| 13 | +char *args = ""; | ||
| 14 | +char *fmt = ""; | ||
| 15 | char tmp[MAX_INPUT_BUFFER]; | ||
| 16 | |||
| 17 | int | ||
| 18 | @@ -275,7 +275,6 @@ | ||
| 19 | }; | ||
| 20 | #endif | ||
| 21 | |||
| 22 | - asprintf (&fmt, ""); | ||
| 23 | |||
| 24 | for (c = 1; c < argc; c++) | ||
| 25 | if (strcmp ("-to", argv[c]) == 0) | ||
diff --git a/web/attachments/364105-check_http_memory_leak.patch b/web/attachments/364105-check_http_memory_leak.patch new file mode 100644 index 0000000..49a35b8 --- /dev/null +++ b/web/attachments/364105-check_http_memory_leak.patch | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | diff --git a/plugins/check_http.c b/plugins/check_http.c | ||
| 2 | index 0a4b12b..5cdf144 100644 | ||
| 3 | --- a/plugins/check_http.c | ||
| 4 | +++ b/plugins/check_http.c | ||
| 5 | @@ -784,6 +784,7 @@ check_http (void) | ||
| 6 | int i = 0; | ||
| 7 | size_t pagesize = 0; | ||
| 8 | char *full_page; | ||
| 9 | + char *full_page_new; | ||
| 10 | char *buf; | ||
| 11 | char *pos; | ||
| 12 | long microsec; | ||
| 13 | @@ -871,7 +872,9 @@ check_http (void) | ||
| 14 | full_page = strdup(""); | ||
| 15 | while ((i = my_recv (buffer, MAX_INPUT_BUFFER-1)) > 0) { | ||
| 16 | buffer[i] = '\0'; | ||
| 17 | - asprintf (&full_page, "%s%s", full_page, buffer); | ||
| 18 | + asprintf (&full_page_new, "%s%s", full_page, buffer); | ||
| 19 | + free (full_page); | ||
| 20 | + full_page = full_page_new; | ||
| 21 | pagesize += i; | ||
| 22 | |||
| 23 | if (no_body && document_headers_done (full_page)) { | ||
diff --git a/web/attachments/366210-check_dhcp.patch b/web/attachments/366210-check_dhcp.patch new file mode 100644 index 0000000..845bc95 --- /dev/null +++ b/web/attachments/366210-check_dhcp.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-5 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378824602" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378824602" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378824602" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378824602" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378824602'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=2968305&group_id=29880&atid=397599&file_id=366210" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/366211-check_dhcp.patch b/web/attachments/366211-check_dhcp.patch new file mode 100644 index 0000000..5dbc924 --- /dev/null +++ b/web/attachments/366211-check_dhcp.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-10 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378824600" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378824600" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378824600" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378824600" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378824600'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=2968305&group_id=29880&atid=397599&file_id=366211" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/366213-check_dhcp.patch b/web/attachments/366213-check_dhcp.patch new file mode 100644 index 0000000..729b46c --- /dev/null +++ b/web/attachments/366213-check_dhcp.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-5 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378824599" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378824599" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378824599" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378824599" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378824599'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=2968305&group_id=29880&atid=397599&file_id=366213" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/366214-check_dhcp.patch b/web/attachments/366214-check_dhcp.patch new file mode 100644 index 0000000..7fb76be --- /dev/null +++ b/web/attachments/366214-check_dhcp.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-3 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378824599" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378824599" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378824599" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378824599" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378824599'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=2968305&group_id=29880&atid=397599&file_id=366214" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/366217-check_dhcp.patch b/web/attachments/366217-check_dhcp.patch new file mode 100644 index 0000000..f22685a --- /dev/null +++ b/web/attachments/366217-check_dhcp.patch | |||
| @@ -0,0 +1,418 @@ | |||
| 1 | --- /home/thunderboltFS/mike/usr/local/src/nagios-plugins-1.4.14/plugins-root/check_dhcp.c.old 2010-03-05 11:26:26.000000000 -0600 | ||
| 2 | +++ /home/thunderboltFS/mike/usr/local/src/nagios-plugins-1.4.14/plugins-root/check_dhcp.c 2010-03-10 17:36:02.313724052 -0600 | ||
| 3 | @@ -291,6 +291,9 @@ | ||
| 4 | /* wait for a DHCPOFFER packet */ | ||
| 5 | get_dhcp_offer(dhcp_socket); | ||
| 6 | |||
| 7 | + /* send DHCPREQUEST packet */ | ||
| 8 | + send_dhcp_request(dhcp_socket); | ||
| 9 | + | ||
| 10 | /* close socket we created */ | ||
| 11 | close_dhcp_socket(dhcp_socket); | ||
| 12 | |||
| 13 | @@ -411,7 +414,7 @@ | ||
| 14 | print_hardware_address(client_hardware_address); | ||
| 15 | |||
| 16 | return OK; | ||
| 17 | - } | ||
| 18 | + } | ||
| 19 | |||
| 20 | /* determines IP address of the client interface */ | ||
| 21 | int get_ip_address(int sock,char *interface_name){ | ||
| 22 | @@ -444,7 +447,7 @@ | ||
| 23 | int send_dhcp_discover(int sock){ | ||
| 24 | dhcp_packet discover_packet; | ||
| 25 | struct sockaddr_in sockaddr_broadcast; | ||
| 26 | - unsigned short opts; | ||
| 27 | + unsigned short opts; | ||
| 28 | |||
| 29 | |||
| 30 | /* clear the packet data structure */ | ||
| 31 | @@ -490,7 +493,7 @@ | ||
| 32 | discover_packet.options[2]='\x53'; | ||
| 33 | discover_packet.options[3]='\x63'; | ||
| 34 | |||
| 35 | - opts = 4; | ||
| 36 | + opts = 4; | ||
| 37 | /* DHCP message type is embedded in options field */ | ||
| 38 | discover_packet.options[opts++]=DHCP_OPTION_MESSAGE_TYPE; /* DHCP message type option identifier */ | ||
| 39 | discover_packet.options[opts++]='\x01'; /* DHCP message option length in bytes */ | ||
| 40 | @@ -502,7 +505,7 @@ | ||
| 41 | discover_packet.options[opts++]='\x04'; | ||
| 42 | memcpy(&discover_packet.options[opts],&requested_address,sizeof(requested_address)); | ||
| 43 | opts += sizeof(requested_address); | ||
| 44 | - } | ||
| 45 | + } | ||
| 46 | discover_packet.options[opts++]=DHCP_OPTION_END; | ||
| 47 | |||
| 48 | /* unicast fields */ | ||
| 49 | @@ -513,8 +516,8 @@ | ||
| 50 | discover_packet.hops = unicast ? 1 : 0; | ||
| 51 | |||
| 52 | /* send the DHCPDISCOVER packet to broadcast address */ | ||
| 53 | - sockaddr_broadcast.sin_family=AF_INET; | ||
| 54 | - sockaddr_broadcast.sin_port=htons(DHCP_SERVER_PORT); | ||
| 55 | + sockaddr_broadcast.sin_family=AF_INET; | ||
| 56 | + sockaddr_broadcast.sin_port=htons(DHCP_SERVER_PORT); | ||
| 57 | sockaddr_broadcast.sin_addr.s_addr = unicast ? dhcp_ip.s_addr : INADDR_BROADCAST; | ||
| 58 | bzero(&sockaddr_broadcast.sin_zero,sizeof(sockaddr_broadcast.sin_zero)); | ||
| 59 | |||
| 60 | @@ -522,10 +525,10 @@ | ||
| 61 | if(verbose){ | ||
| 62 | printf(_("DHCPDISCOVER to %s port %d\n"),inet_ntoa(sockaddr_broadcast.sin_addr),ntohs(sockaddr_broadcast.sin_port)); | ||
| 63 | printf("DHCPDISCOVER XID: %u (0x%X)\n",ntohl(discover_packet.xid),ntohl(discover_packet.xid)); | ||
| 64 | - printf("DHCDISCOVER ciaddr: %s\n",inet_ntoa(discover_packet.ciaddr)); | ||
| 65 | - printf("DHCDISCOVER yiaddr: %s\n",inet_ntoa(discover_packet.yiaddr)); | ||
| 66 | - printf("DHCDISCOVER siaddr: %s\n",inet_ntoa(discover_packet.siaddr)); | ||
| 67 | - printf("DHCDISCOVER giaddr: %s\n",inet_ntoa(discover_packet.giaddr)); | ||
| 68 | + printf("DHCPDISCOVER ciaddr: %s\n",inet_ntoa(discover_packet.ciaddr)); | ||
| 69 | + printf("DHCPDISCOVER yiaddr: %s\n",inet_ntoa(discover_packet.yiaddr)); | ||
| 70 | + printf("DHCPDISCOVER siaddr: %s\n",inet_ntoa(discover_packet.siaddr)); | ||
| 71 | + printf("DHCPDISCOVER giaddr: %s\n",inet_ntoa(discover_packet.giaddr)); | ||
| 72 | } | ||
| 73 | |||
| 74 | /* send the DHCPDISCOVER packet out */ | ||
| 75 | @@ -535,9 +538,110 @@ | ||
| 76 | printf("\n\n"); | ||
| 77 | |||
| 78 | return OK; | ||
| 79 | - } | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | +/* sends a DHCPREQUEST broadcast message in an attempt to allow DHCP servers to drop any OFFER reservations and return those IPs to their free pools */ | ||
| 83 | +int send_dhcp_request(int sock){ | ||
| 84 | + dhcp_packet discover_packet; | ||
| 85 | + struct sockaddr_in sockaddr_broadcast; | ||
| 86 | + unsigned short opts; | ||
| 87 | + | ||
| 88 | + | ||
| 89 | + /* clear the packet data structure */ | ||
| 90 | + bzero(&discover_packet,sizeof(discover_packet)); | ||
| 91 | + | ||
| 92 | + | ||
| 93 | + /* boot request flag (backward compatible with BOOTP servers) */ | ||
| 94 | + discover_packet.op=BOOTREQUEST; | ||
| 95 | + | ||
| 96 | + /* hardware address type */ | ||
| 97 | + discover_packet.htype=ETHERNET_HARDWARE_ADDRESS; | ||
| 98 | + | ||
| 99 | + /* length of our hardware address */ | ||
| 100 | + discover_packet.hlen=ETHERNET_HARDWARE_ADDRESS_LENGTH; | ||
| 101 | + | ||
| 102 | + /* | ||
| 103 | + * transaction ID is supposed to be random. We won't use the address so | ||
| 104 | + * we don't care about high entropy here. time(2) is good enough. | ||
| 105 | + */ | ||
| 106 | + srand(time(NULL)); | ||
| 107 | + packet_xid=random(); | ||
| 108 | + discover_packet.xid=htonl(packet_xid); | ||
| 109 | + | ||
| 110 | + /**** WHAT THE HECK IS UP WITH THIS?!? IF I DON'T MAKE THIS CALL, ONLY ONE SERVER RESPONSE IS PROCESSED!!!! ****/ | ||
| 111 | + /* downright bizzarre... */ | ||
| 112 | + ntohl(discover_packet.xid); | ||
| 113 | + | ||
| 114 | + /*discover_packet.secs=htons(65535);*/ | ||
| 115 | + discover_packet.secs=0xFF; | ||
| 116 | + | ||
| 117 | + /* | ||
| 118 | + * server needs to know if it should broadcast or unicast its response: | ||
| 119 | + * 0x8000L == 32768 == 1 << 15 == broadcast, 0 == unicast | ||
| 120 | + */ | ||
| 121 | + discover_packet.flags = unicast ? 0 : htons(DHCP_BROADCAST_FLAG); | ||
| 122 | + | ||
| 123 | + /* our hardware address */ | ||
| 124 | + memcpy(discover_packet.chaddr,client_hardware_address,ETHERNET_HARDWARE_ADDRESS_LENGTH); | ||
| 125 | + | ||
| 126 | + /* first four bytes of options field is magic cookie (as per RFC 2132) */ | ||
| 127 | + discover_packet.options[0]='\x63'; | ||
| 128 | + discover_packet.options[1]='\x82'; | ||
| 129 | + discover_packet.options[2]='\x53'; | ||
| 130 | + discover_packet.options[3]='\x63'; | ||
| 131 | + | ||
| 132 | + opts = 4; | ||
| 133 | + /* DHCP message type is embedded in options field */ | ||
| 134 | + discover_packet.options[opts++]=DHCP_OPTION_MESSAGE_TYPE; /* DHCP message type option identifier */ | ||
| 135 | + discover_packet.options[opts++]='\x01'; /* DHCP message option length in bytes */ | ||
| 136 | + discover_packet.options[opts++]=DHCPREQUEST; | ||
| 137 | + | ||
| 138 | + /* the IP address we're requesting */ | ||
| 139 | + if(request_specific_address==TRUE){ | ||
| 140 | + discover_packet.options[opts++]=DHCP_OPTION_REQUESTED_ADDRESS; | ||
| 141 | + discover_packet.options[opts++]='\x04'; | ||
| 142 | + memcpy(&discover_packet.options[opts],&requested_address,sizeof(requested_address)); | ||
| 143 | + opts += sizeof(requested_address); | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + /* Set the server identifier to our own address, so that no other DHCP server will match */ | ||
| 147 | + discover_packet.options[opts++]=DHCP_OPTION_SERVER_IDENTIFIER; | ||
| 148 | + discover_packet.options[opts++]='\x04'; | ||
| 149 | + memcpy(&discover_packet.options[opts],&discover_packet.ciaddr,sizeof(discover_packet.ciaddr)); | ||
| 150 | + | ||
| 151 | + discover_packet.options[opts++]=DHCP_OPTION_END; | ||
| 152 | + | ||
| 153 | + /* unicast fields */ | ||
| 154 | + if(unicast) | ||
| 155 | + discover_packet.giaddr.s_addr = my_ip.s_addr; | ||
| 156 | + | ||
| 157 | + /* see RFC 1542, 4.1.1 */ | ||
| 158 | + discover_packet.hops = unicast ? 1 : 0; | ||
| 159 | + | ||
| 160 | + /* send the DHCPREQUEST packet to broadcast address */ | ||
| 161 | + sockaddr_broadcast.sin_family=AF_INET; | ||
| 162 | + sockaddr_broadcast.sin_port=htons(DHCP_SERVER_PORT); | ||
| 163 | + sockaddr_broadcast.sin_addr.s_addr = unicast ? dhcp_ip.s_addr : INADDR_BROADCAST; | ||
| 164 | + bzero(&sockaddr_broadcast.sin_zero,sizeof(sockaddr_broadcast.sin_zero)); | ||
| 165 | + | ||
| 166 | |||
| 167 | + if(verbose){ | ||
| 168 | + printf(_("DHCPREQUEST to %s port %d\n"),inet_ntoa(sockaddr_broadcast.sin_addr),ntohs(sockaddr_broadcast.sin_port)); | ||
| 169 | + printf("DHCPREQUEST XID: %u (0x%X)\n",ntohl(discover_packet.xid),ntohl(discover_packet.xid)); | ||
| 170 | + printf("DHCPREQUEST ciaddr: %s\n",inet_ntoa(discover_packet.ciaddr)); | ||
| 171 | + printf("DHCPREQUEST yiaddr: %s\n",inet_ntoa(discover_packet.yiaddr)); | ||
| 172 | + printf("DHCPREQUEST siaddr: %s\n",inet_ntoa(discover_packet.siaddr)); | ||
| 173 | + printf("DHCPREQUEST giaddr: %s\n",inet_ntoa(discover_packet.giaddr)); | ||
| 174 | + } | ||
| 175 | |||
| 176 | + /* send the DHCPREQUEST packet out */ | ||
| 177 | + send_dhcp_packet(&discover_packet,sizeof(discover_packet),sock,&sockaddr_broadcast); | ||
| 178 | + | ||
| 179 | + if(verbose) | ||
| 180 | + printf("\n\n"); | ||
| 181 | + | ||
| 182 | + return OK; | ||
| 183 | + } | ||
| 184 | |||
| 185 | |||
| 186 | /* waits for a DHCPOFFER message from one or more DHCP servers */ | ||
| 187 | @@ -604,7 +708,7 @@ | ||
| 188 | printf(_("DHCPOFFER XID (%u) did not match DHCPDISCOVER XID (%u) - ignoring packet\n"),ntohl(offer_packet.xid),packet_xid); | ||
| 189 | |||
| 190 | continue; | ||
| 191 | - } | ||
| 192 | + } | ||
| 193 | |||
| 194 | /* check hardware address */ | ||
| 195 | result=OK; | ||
| 196 | @@ -626,7 +730,7 @@ | ||
| 197 | printf(_("DHCPOFFER hardware address did not match our own - ignoring packet\n")); | ||
| 198 | |||
| 199 | continue; | ||
| 200 | - } | ||
| 201 | + } | ||
| 202 | |||
| 203 | if(verbose){ | ||
| 204 | printf("DHCPOFFER ciaddr: %s\n",inet_ntoa(offer_packet.ciaddr)); | ||
| 205 | @@ -638,7 +742,7 @@ | ||
| 206 | add_dhcp_offer(source.sin_addr,&offer_packet); | ||
| 207 | |||
| 208 | valid_responses++; | ||
| 209 | - } | ||
| 210 | + } | ||
| 211 | |||
| 212 | if(verbose){ | ||
| 213 | printf(_("Total responses seen on the wire: %d\n"),responses); | ||
| 214 | @@ -646,7 +750,7 @@ | ||
| 215 | } | ||
| 216 | |||
| 217 | return OK; | ||
| 218 | - } | ||
| 219 | + } | ||
| 220 | |||
| 221 | |||
| 222 | |||
| 223 | @@ -663,7 +767,7 @@ | ||
| 224 | return ERROR; | ||
| 225 | |||
| 226 | return OK; | ||
| 227 | - } | ||
| 228 | + } | ||
| 229 | |||
| 230 | |||
| 231 | |||
| 232 | @@ -713,7 +817,7 @@ | ||
| 233 | printf("errno: (%d) -> %s\n",errno,strerror(errno)); | ||
| 234 | } | ||
| 235 | return ERROR; | ||
| 236 | - } | ||
| 237 | + } | ||
| 238 | else{ | ||
| 239 | if(verbose){ | ||
| 240 | printf(_("receive_dhcp_packet() result: %d\n"),recv_result); | ||
| 241 | @@ -722,11 +826,11 @@ | ||
| 242 | |||
| 243 | memcpy(address,&source_address,sizeof(source_address)); | ||
| 244 | return OK; | ||
| 245 | - } | ||
| 246 | - } | ||
| 247 | + } | ||
| 248 | + } | ||
| 249 | |||
| 250 | return OK; | ||
| 251 | - } | ||
| 252 | + } | ||
| 253 | |||
| 254 | |||
| 255 | /* creates a socket for DHCP communication */ | ||
| 256 | @@ -749,7 +853,7 @@ | ||
| 257 | if(sock<0){ | ||
| 258 | printf(_("Error: Could not create socket!\n")); | ||
| 259 | exit(STATE_UNKNOWN); | ||
| 260 | - } | ||
| 261 | + } | ||
| 262 | |||
| 263 | if(verbose) | ||
| 264 | printf("DHCP socket: %d\n",sock); | ||
| 265 | @@ -759,13 +863,13 @@ | ||
| 266 | if(setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,(char *)&flag,sizeof(flag))<0){ | ||
| 267 | printf(_("Error: Could not set reuse address option on DHCP socket!\n")); | ||
| 268 | exit(STATE_UNKNOWN); | ||
| 269 | - } | ||
| 270 | + } | ||
| 271 | |||
| 272 | /* set the broadcast option - we need this to listen to DHCP broadcast messages */ | ||
| 273 | if(!unicast && setsockopt(sock,SOL_SOCKET,SO_BROADCAST,(char *)&flag,sizeof flag)<0){ | ||
| 274 | printf(_("Error: Could not set broadcast option on DHCP socket!\n")); | ||
| 275 | exit(STATE_UNKNOWN); | ||
| 276 | - } | ||
| 277 | + } | ||
| 278 | |||
| 279 | /* bind socket to interface */ | ||
| 280 | #if defined(__linux__) | ||
| 281 | @@ -774,7 +878,7 @@ | ||
| 282 | if(setsockopt(sock,SOL_SOCKET,SO_BINDTODEVICE,(char *)&interface,sizeof(interface))<0){ | ||
| 283 | printf(_("Error: Could not bind socket to interface %s. Check your privileges...\n"),network_interface_name); | ||
| 284 | exit(STATE_UNKNOWN); | ||
| 285 | - } | ||
| 286 | + } | ||
| 287 | |||
| 288 | #else | ||
| 289 | strncpy(interface.ifr_name,network_interface_name,IFNAMSIZ-1); | ||
| 290 | @@ -785,10 +889,10 @@ | ||
| 291 | if(bind(sock,(struct sockaddr *)&myname,sizeof(myname))<0){ | ||
| 292 | printf(_("Error: Could not bind to DHCP socket (port %d)! Check your privileges...\n"),DHCP_CLIENT_PORT); | ||
| 293 | exit(STATE_UNKNOWN); | ||
| 294 | - } | ||
| 295 | + } | ||
| 296 | |||
| 297 | return sock; | ||
| 298 | - } | ||
| 299 | + } | ||
| 300 | |||
| 301 | |||
| 302 | /* closes DHCP socket */ | ||
| 303 | @@ -820,7 +924,7 @@ | ||
| 304 | printf(_("Requested server address: %s\n"),inet_ntoa(new_server->server_address)); | ||
| 305 | |||
| 306 | return OK; | ||
| 307 | - } | ||
| 308 | + } | ||
| 309 | |||
| 310 | |||
| 311 | |||
| 312 | @@ -924,7 +1028,7 @@ | ||
| 313 | dhcp_offer_list=new_offer; | ||
| 314 | |||
| 315 | return OK; | ||
| 316 | - } | ||
| 317 | + } | ||
| 318 | |||
| 319 | |||
| 320 | /* frees memory allocated to DHCP OFFER list */ | ||
| 321 | @@ -938,7 +1042,7 @@ | ||
| 322 | } | ||
| 323 | |||
| 324 | return OK; | ||
| 325 | - } | ||
| 326 | + } | ||
| 327 | |||
| 328 | |||
| 329 | /* frees memory allocated to requested server list */ | ||
| 330 | @@ -949,10 +1053,10 @@ | ||
| 331 | for(this_server=requested_server_list;this_server!=NULL;this_server=next_server){ | ||
| 332 | next_server=this_server->next; | ||
| 333 | free(this_server); | ||
| 334 | - } | ||
| 335 | + } | ||
| 336 | |||
| 337 | return OK; | ||
| 338 | - } | ||
| 339 | + } | ||
| 340 | |||
| 341 | |||
| 342 | /* gets state and plugin output to return */ | ||
| 343 | @@ -993,11 +1097,11 @@ | ||
| 344 | requested_responses++; | ||
| 345 | temp_server->answered=TRUE; | ||
| 346 | } | ||
| 347 | - } | ||
| 348 | - } | ||
| 349 | - } | ||
| 350 | + } | ||
| 351 | + } | ||
| 352 | + } | ||
| 353 | |||
| 354 | - } | ||
| 355 | + } | ||
| 356 | |||
| 357 | /* else check and see if we got our requested address from any server */ | ||
| 358 | else{ | ||
| 359 | @@ -1011,8 +1115,8 @@ | ||
| 360 | /* see if we got the address we requested */ | ||
| 361 | if(!memcmp(&requested_address,&temp_offer->offered_address,sizeof(requested_address))) | ||
| 362 | received_requested_address=TRUE; | ||
| 363 | - } | ||
| 364 | - } | ||
| 365 | + } | ||
| 366 | + } | ||
| 367 | |||
| 368 | result=STATE_OK; | ||
| 369 | if(valid_responses==0) | ||
| 370 | @@ -1037,7 +1141,7 @@ | ||
| 371 | if(dhcp_offer_list==NULL){ | ||
| 372 | printf(_("No DHCPOFFERs were received.\n")); | ||
| 373 | return result; | ||
| 374 | - } | ||
| 375 | + } | ||
| 376 | |||
| 377 | printf(_("Received %d DHCPOFFER(s)"),valid_responses); | ||
| 378 | |||
| 379 | @@ -1056,7 +1160,7 @@ | ||
| 380 | printf(".\n"); | ||
| 381 | |||
| 382 | return result; | ||
| 383 | - } | ||
| 384 | + } | ||
| 385 | |||
| 386 | |||
| 387 | /* process command-line arguments */ | ||
| 388 | @@ -1076,7 +1180,7 @@ | ||
| 389 | } | ||
| 390 | |||
| 391 | return validate_arguments(); | ||
| 392 | - } | ||
| 393 | + } | ||
| 394 | |||
| 395 | |||
| 396 | |||
| 397 | @@ -1181,17 +1285,17 @@ | ||
| 398 | |||
| 399 | default: | ||
| 400 | break; | ||
| 401 | - } | ||
| 402 | - } | ||
| 403 | + } | ||
| 404 | + } | ||
| 405 | |||
| 406 | return i; | ||
| 407 | - } | ||
| 408 | + } | ||
| 409 | |||
| 410 | |||
| 411 | int validate_arguments(void){ | ||
| 412 | |||
| 413 | return OK; | ||
| 414 | - } | ||
| 415 | + } | ||
| 416 | |||
| 417 | |||
| 418 | #if defined(__sun__) || defined(__solaris__) || defined(__hpux__) | ||
diff --git a/web/attachments/36739-check_dns.diff b/web/attachments/36739-check_dns.diff new file mode 100644 index 0000000..c0eb4c6 --- /dev/null +++ b/web/attachments/36739-check_dns.diff | |||
| @@ -0,0 +1,913 @@ | |||
| 1 | --- check_dns_resolver/check_dns_resolver.c Mon Nov 25 18:01:26 2002 | ||
| 2 | +++ TarZip/nagiosplug-1.3-beta1/plugins/check_dns.c Thu Feb 28 01:42:57 2002 | ||
| 3 | @@ -1,508 +1,415 @@ | ||
| 4 | -/* | ||
| 5 | - * check_dns_resolver is a version of check_dns (for nagios) that | ||
| 6 | - * talks to the nameservers without using nslookup | ||
| 7 | - * | ||
| 8 | - * Author: Roy Marantz (marantz@nbcs.rutgers.edu) | ||
| 9 | - * no copyrite - do what you want with this. | ||
| 10 | - * | ||
| 11 | - * $Id: check_dns_resolver.c,v 1.1.1.1 2002/11/25 23:01:26 marantz Exp $ | ||
| 12 | - * | ||
| 13 | - * solaris build instructions | ||
| 14 | - * cc -o check_dns_resolver check_dns_resolver.c -lresolv -lsocket -lnsl | ||
| 15 | - * | ||
| 16 | - */ | ||
| 17 | - | ||
| 18 | -#include <stdio.h> | ||
| 19 | -#include <signal.h> | ||
| 20 | -#include <sys/types.h> | ||
| 21 | -#include <netinet/in.h> | ||
| 22 | -#include <arpa/nameser.h> | ||
| 23 | -#include <resolv.h> | ||
| 24 | -#include <netdb.h> | ||
| 25 | -#include <arpa/inet.h> | ||
| 26 | -#include <time.h> | ||
| 27 | -#include <sys/socket.h> | ||
| 28 | -#include <strings.h> | ||
| 29 | -#include <stdlib.h> | ||
| 30 | - | ||
| 31 | -#define MAXPACKET 8192 /* BIND maximum packet size */ | ||
| 32 | - | ||
| 33 | -void catch_alarm(int ignored) { | ||
| 34 | - printf("query timed out\n"); | ||
| 35 | - exit(2); | ||
| 36 | +/****************************************************************************** | ||
| 37 | + * | ||
| 38 | + * CHECK_DNS.C | ||
| 39 | + * | ||
| 40 | + * Program: DNS plugin for Nagios | ||
| 41 | + * License: GPL | ||
| 42 | + * Copyright (c) 1999 Ethan Galstad (nagios@nagios.org) | ||
| 43 | + * | ||
| 44 | + * Last Modified: $Date: 2002/02/28 06:42:57 $ | ||
| 45 | + * | ||
| 46 | + * Notes: | ||
| 47 | + * - Safe popen added by Karl DeBisschop 9-11-99 | ||
| 48 | + * | ||
| 49 | + * Command line: CHECK_DNS <query_address> [dns_server] | ||
| 50 | + * | ||
| 51 | + * Description: | ||
| 52 | + * | ||
| 53 | + * This program will use the nslookup program to obtain the IP address | ||
| 54 | + * for a given host name. A optional DNS server may be specified. If | ||
| 55 | + * no DNS server is specified, the default server(s) for the system | ||
| 56 | + * are used. | ||
| 57 | + * | ||
| 58 | + * Return Values: | ||
| 59 | + * OK The DNS query was successful (host IP address was returned). | ||
| 60 | + * WARNING The DNS server responded, but could not fulfill the request. | ||
| 61 | + * CRITICAL The DNS server is not responding or encountered an error. | ||
| 62 | + * | ||
| 63 | + * License Information: | ||
| 64 | + * | ||
| 65 | + * This program is free software; you can redistribute it and/or modify | ||
| 66 | + * it under the terms of the GNU General Public License as published by | ||
| 67 | + * the Free Software Foundation; either version 2 of the License, or | ||
| 68 | + * (at your option) any later version. | ||
| 69 | + * | ||
| 70 | + * This program is distributed in the hope that it will be useful, | ||
| 71 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 72 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 73 | + * GNU General Public License for more details. | ||
| 74 | + * | ||
| 75 | + * You should have received a copy of the GNU General Public License | ||
| 76 | + * along with this program; if not, write to the Free Software | ||
| 77 | + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 78 | + * | ||
| 79 | + *****************************************************************************/ | ||
| 80 | + | ||
| 81 | +#include "common.h" | ||
| 82 | +#include "popen.h" | ||
| 83 | +#include "utils.h" | ||
| 84 | + | ||
| 85 | +int process_arguments (int, char **); | ||
| 86 | +int call_getopt (int, char **); | ||
| 87 | +int validate_arguments (void); | ||
| 88 | +void print_usage (char *); | ||
| 89 | +void print_help (char *); | ||
| 90 | +int error_scan (char *); | ||
| 91 | + | ||
| 92 | +#define ADDRESS_LENGTH 256 | ||
| 93 | +char query_address[ADDRESS_LENGTH] = ""; | ||
| 94 | +char dns_server[ADDRESS_LENGTH] = ""; | ||
| 95 | +char ptr_server[ADDRESS_LENGTH] = ""; | ||
| 96 | +int verbose = FALSE; | ||
| 97 | + | ||
| 98 | +int | ||
| 99 | +main (int argc, char **argv) | ||
| 100 | +{ | ||
| 101 | + char *command_line = NULL; | ||
| 102 | + char input_buffer[MAX_INPUT_BUFFER]; | ||
| 103 | + char *output = NULL; | ||
| 104 | + char *address = NULL; | ||
| 105 | + char *temp_buffer = NULL; | ||
| 106 | + int result = STATE_UNKNOWN; | ||
| 107 | + | ||
| 108 | + /* Set signal handling and alarm */ | ||
| 109 | + if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { | ||
| 110 | + printf ("Cannot catch SIGALRM"); | ||
| 111 | + return STATE_UNKNOWN; | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + if (process_arguments (argc, argv) != OK) { | ||
| 115 | + print_usage (my_basename (argv[0])); | ||
| 116 | + return STATE_UNKNOWN; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + /* get the command to run */ | ||
| 120 | + command_line = ssprintf (command_line, "%s %s %s", NSLOOKUP_COMMAND, | ||
| 121 | + query_address, dns_server); | ||
| 122 | + | ||
| 123 | + alarm (timeout_interval); | ||
| 124 | + time (&start_time); | ||
| 125 | + | ||
| 126 | + if (verbose) | ||
| 127 | + printf ("%s\n", command_line); | ||
| 128 | + /* run the command */ | ||
| 129 | + child_process = spopen (command_line); | ||
| 130 | + if (child_process == NULL) { | ||
| 131 | + printf ("Could not open pipe: %s\n", command_line); | ||
| 132 | + return STATE_UNKNOWN; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 136 | + if (child_stderr == NULL) | ||
| 137 | + printf ("Could not open stderr for %s\n", command_line); | ||
| 138 | + | ||
| 139 | + /* scan stdout */ | ||
| 140 | + while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 141 | + | ||
| 142 | + if (verbose) | ||
| 143 | + printf ("%s\n", input_buffer); | ||
| 144 | + | ||
| 145 | + if (strstr (input_buffer, ".in-addr.arpa")) { | ||
| 146 | + if ((temp_buffer = strstr (input_buffer, "name = "))) | ||
| 147 | + address = strscpy (address, temp_buffer + 7); | ||
| 148 | + else { | ||
| 149 | + output = strscpy (output, "Unknown error (plugin)"); | ||
| 150 | + result = STATE_WARNING; | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + /* the server is responding, we just got the host name... */ | ||
| 155 | + if (strstr (input_buffer, "Name:")) { | ||
| 156 | + | ||
| 157 | + /* get the host address */ | ||
| 158 | + if (!fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) | ||
| 159 | + break; | ||
| 160 | + | ||
| 161 | + if (verbose) | ||
| 162 | + printf ("%s\n", input_buffer); | ||
| 163 | + | ||
| 164 | + if ((temp_buffer = index (input_buffer, ':'))) { | ||
| 165 | + address = strscpy (address, temp_buffer + 2); | ||
| 166 | + strip (address); | ||
| 167 | + result = STATE_OK; | ||
| 168 | + } | ||
| 169 | + else { | ||
| 170 | + output = strscpy (output, "Unknown error (plugin)"); | ||
| 171 | + result = STATE_WARNING; | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + break; | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + result = error_scan (input_buffer); | ||
| 178 | + if (result != STATE_OK) { | ||
| 179 | + output = strscpy (output, 1 + index (input_buffer, ':')); | ||
| 180 | + break; | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + /* scan stderr */ | ||
| 186 | + while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { | ||
| 187 | + if (error_scan (input_buffer) != STATE_OK) { | ||
| 188 | + result = max (result, error_scan (input_buffer)); | ||
| 189 | + output = strscpy (output, 1 + index (input_buffer, ':')); | ||
| 190 | + } | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + /* close stderr */ | ||
| 194 | + (void) fclose (child_stderr); | ||
| 195 | + | ||
| 196 | + /* close stdout */ | ||
| 197 | + if (spclose (child_process)) { | ||
| 198 | + result = max (result, STATE_WARNING); | ||
| 199 | + if (!strcmp (output, "")) | ||
| 200 | + output = strscpy (output, "nslookup returned error status"); | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + (void) time (&end_time); | ||
| 204 | + | ||
| 205 | + if (result == STATE_OK) | ||
| 206 | + printf ("DNS ok - %d seconds response time, Address(es) is/are %s\n", | ||
| 207 | + (int) (end_time - start_time), address); | ||
| 208 | + else if (result == STATE_WARNING) | ||
| 209 | + printf ("DNS WARNING - %s\n", | ||
| 210 | + !strcmp (output, "") ? " Probably a non-existent host/domain" : output); | ||
| 211 | + else if (result == STATE_CRITICAL) | ||
| 212 | + printf ("DNS CRITICAL - %s\n", | ||
| 213 | + !strcmp (output, "") ? " Probably a non-existent host/domain" : output); | ||
| 214 | + else | ||
| 215 | + printf ("DNS problem - %s\n", | ||
| 216 | + !strcmp (output, "") ? " Probably a non-existent host/domain" : output); | ||
| 217 | + | ||
| 218 | + return result; | ||
| 219 | } | ||
| 220 | |||
| 221 | -typedef union { | ||
| 222 | - HEADER hdr; | ||
| 223 | - u_char buf[MAXPACKET]; | ||
| 224 | -} querybuf; | ||
| 225 | - | ||
| 226 | -static struct hostent * | ||
| 227 | -getanswer(const querybuf *answer, | ||
| 228 | - int anslen, | ||
| 229 | - const char *qname, | ||
| 230 | - int qtype); | ||
| 231 | - | ||
| 232 | -int debugging = 0; | ||
| 233 | - | ||
| 234 | -int main (int argc, char **argv) { | ||
| 235 | - int n; | ||
| 236 | - time_t start_time, end_time; | ||
| 237 | - querybuf answer; | ||
| 238 | - struct hostent *hentry; | ||
| 239 | - register char **h; | ||
| 240 | - | ||
| 241 | - int norecurse = 0; | ||
| 242 | - int timeout = 30; | ||
| 243 | - char *host = NULL; | ||
| 244 | - char *server = NULL; | ||
| 245 | - | ||
| 246 | -/* if (process_arguments (argc, argv) != OK) { | ||
| 247 | - print_usage (my_basename (argv[0])); | ||
| 248 | - exit(1); | ||
| 249 | - } | ||
| 250 | -*/ | ||
| 251 | - | ||
| 252 | - { | ||
| 253 | - int c; | ||
| 254 | - int errflg = 0; | ||
| 255 | - int showversion = 0; | ||
| 256 | - char *pgm = argv[0]; | ||
| 257 | - extern char *optarg; | ||
| 258 | - extern int optind; | ||
| 259 | - | ||
| 260 | - while ((c = getopt(argc, argv, "dhrt:s:H:V")) != EOF) | ||
| 261 | - switch (c) { | ||
| 262 | - case 't': timeout = atoi(optarg); break; | ||
| 263 | - case 's': server = optarg; break; | ||
| 264 | - case 'H': host = optarg; break; | ||
| 265 | - case 'r': norecurse = 1; break; | ||
| 266 | - case 'd': debugging++; break; | ||
| 267 | - case 'V': showversion++; break; | ||
| 268 | - case 'h': | ||
| 269 | - case '?': errflg++; | ||
| 270 | - } | ||
| 271 | - if (host == NULL || errflg || optind != argc) { | ||
| 272 | - fprintf(stderr, "usage: %s %s\n%s %d\n%s\n%s\n%s\n%s\n%s\n", | ||
| 273 | - pgm, | ||
| 274 | - "[-d] [-V] [-r] [-t timeout] [-s server] -H host", | ||
| 275 | - "where: timeout is time (in seconds) to wait for dns server, default", | ||
| 276 | - timeout, | ||
| 277 | - " host is the fully qualified hostname to ask address of", | ||
| 278 | - " server is the IP address or hostname of the nameserver to ask, default from /etc/resolv.conf", | ||
| 279 | - " -r turns off recursive resolver lookups", | ||
| 280 | - " -d turns on resolver debugging", | ||
| 281 | - " -V prints program version" | ||
| 282 | - ); | ||
| 283 | - exit (2); | ||
| 284 | - } | ||
| 285 | - if (showversion) { | ||
| 286 | - printf("%s version $Revision: 1.1.1.1 $\n", pgm); | ||
| 287 | - exit(0); | ||
| 288 | - } | ||
| 289 | - } | ||
| 290 | - | ||
| 291 | - | ||
| 292 | - /* Set signal handling and alarm */ | ||
| 293 | - if (signal (SIGALRM, catch_alarm) == SIG_ERR) { | ||
| 294 | - printf("DNS problem - Cannot set ALRM handler"); | ||
| 295 | - exit(33); | ||
| 296 | - } | ||
| 297 | - | ||
| 298 | - /* process /etc/resolv.conf */ | ||
| 299 | - if (res_init() == -1) { | ||
| 300 | - printf("DNS problem - Cannot call res_init \n"); | ||
| 301 | - exit(33); | ||
| 302 | - } | ||
| 303 | - | ||
| 304 | - if (debugging) { | ||
| 305 | - _res.options |= RES_DEBUG; /* turn on resolver debugging */ | ||
| 306 | - } | ||
| 307 | - | ||
| 308 | - if (norecurse) { | ||
| 309 | - _res.options &= ~RES_RECURSE; /* turn off recursive lookup */ | ||
| 310 | - } | ||
| 311 | - | ||
| 312 | - if (server) { | ||
| 313 | - struct hostent *hp; | ||
| 314 | - static struct sockaddr_in *a; | ||
| 315 | - in_addr_t s; | ||
| 316 | - | ||
| 317 | - /* override the nameservers from resolv.conf */ | ||
| 318 | - _res.nscount = 1; | ||
| 319 | - a = &_res.nsaddr_list[0]; | ||
| 320 | - /* a->sin_port = ... leave the port alone */ | ||
| 321 | - | ||
| 322 | - hp = gethostbyname(server); | ||
| 323 | - if (hp && hp->h_addr_list[0] != NULL) { | ||
| 324 | - a->sin_family = hp->h_addrtype; | ||
| 325 | - bcopy(hp->h_addr_list[0], &a->sin_addr, hp->h_length); | ||
| 326 | - } else { | ||
| 327 | - /* assume a dotted quad address */ | ||
| 328 | - s = inet_addr(server); | ||
| 329 | - if (s == -1) { | ||
| 330 | - printf("DNS problem - Cannot resolve server %s\n", server); | ||
| 331 | - exit(33); | ||
| 332 | - } | ||
| 333 | - a->sin_family = AF_INET; | ||
| 334 | - bcopy(&s, &a->sin_addr, sizeof(in_addr_t)); | ||
| 335 | - } | ||
| 336 | - } | ||
| 337 | - | ||
| 338 | - time (&start_time); | ||
| 339 | - alarm (timeout); | ||
| 340 | - | ||
| 341 | - n = res_query(host, C_IN, T_A, answer.buf, sizeof(answer)); | ||
| 342 | - | ||
| 343 | - alarm(0); /* cancel pending alarm */ | ||
| 344 | - (void) time (&end_time); | ||
| 345 | - | ||
| 346 | - if (n < 0) { | ||
| 347 | - printf("DNS CRITICAL - query failed: %d\n", n); | ||
| 348 | - exit(n); | ||
| 349 | - } | ||
| 350 | - | ||
| 351 | - hentry = getanswer(&answer, n, host, T_A); | ||
| 352 | - if (hentry == NULL) { | ||
| 353 | - printf("DNS WARNING - no answer\n"); | ||
| 354 | - exit(2); | ||
| 355 | - } | ||
| 356 | - printf("DNS ok - %d seconds response time, Address(es) is/are", | ||
| 357 | - (int) (end_time - start_time)); | ||
| 358 | - for(h=hentry->h_addr_list; *h; h++) { | ||
| 359 | - struct in_addr a; | ||
| 360 | - bcopy(*h, &a, hentry->h_length); | ||
| 361 | - printf(" %s", inet_ntoa(a)); | ||
| 362 | - } | ||
| 363 | - printf("\n"); | ||
| 364 | +int | ||
| 365 | +error_scan (char *input_buffer) | ||
| 366 | +{ | ||
| 367 | + | ||
| 368 | + /* the DNS lookup timed out */ | ||
| 369 | + if (strstr (input_buffer, | ||
| 370 | + "Note: nslookup is deprecated and may be removed from future releases.") | ||
| 371 | + || strstr (input_buffer, | ||
| 372 | + "Consider using the `dig' or `host' programs instead. Run nslookup with") | ||
| 373 | + || strstr (input_buffer, | ||
| 374 | + "the `-sil[ent]' option to prevent this message from appearing.")) | ||
| 375 | + return STATE_OK; | ||
| 376 | + | ||
| 377 | + /* the DNS lookup timed out */ | ||
| 378 | + else if (strstr (input_buffer, "Timed out")) | ||
| 379 | + return STATE_WARNING; | ||
| 380 | + | ||
| 381 | + /* DNS server is not running... */ | ||
| 382 | + else if (strstr (input_buffer, "No response from server")) | ||
| 383 | + return STATE_CRITICAL; | ||
| 384 | + | ||
| 385 | + /* Host name is valid, but server doesn't have records... */ | ||
| 386 | + else if (strstr (input_buffer, "No records")) | ||
| 387 | + return STATE_WARNING; | ||
| 388 | + | ||
| 389 | + /* Host or domain name does not exist */ | ||
| 390 | + else if (strstr (input_buffer, "Non-existent")) | ||
| 391 | + return STATE_CRITICAL; | ||
| 392 | + else if (strstr (input_buffer, "** server can't find")) | ||
| 393 | + return STATE_CRITICAL; | ||
| 394 | + else if(strstr(input_buffer,"NXDOMAIN")) /* 9.x */ | ||
| 395 | + return STATE_CRITICAL; | ||
| 396 | + | ||
| 397 | + /* Connection was refused */ | ||
| 398 | + else if (strstr (input_buffer, "Connection refused")) | ||
| 399 | + return STATE_CRITICAL; | ||
| 400 | + | ||
| 401 | + /* Network is unreachable */ | ||
| 402 | + else if (strstr (input_buffer, "Network is unreachable")) | ||
| 403 | + return STATE_CRITICAL; | ||
| 404 | + | ||
| 405 | + /* Internal server failure */ | ||
| 406 | + else if (strstr (input_buffer, "Server failure")) | ||
| 407 | + return STATE_CRITICAL; | ||
| 408 | + | ||
| 409 | + /* DNS server refused to service request */ | ||
| 410 | + else if (strstr (input_buffer, "Refused")) | ||
| 411 | + return STATE_CRITICAL; | ||
| 412 | + | ||
| 413 | + /* Request error */ | ||
| 414 | + else if (strstr (input_buffer, "Format error")) | ||
| 415 | + return STATE_WARNING; | ||
| 416 | + | ||
| 417 | + else | ||
| 418 | + return STATE_OK; | ||
| 419 | |||
| 420 | - exit(0); | ||
| 421 | } | ||
| 422 | |||
| 423 | +/* process command-line arguments */ | ||
| 424 | +int | ||
| 425 | +process_arguments (int argc, char **argv) | ||
| 426 | +{ | ||
| 427 | + int c; | ||
| 428 | + | ||
| 429 | + if (argc < 2) | ||
| 430 | + return ERROR; | ||
| 431 | |||
| 432 | + for (c = 1; c < argc; c++) | ||
| 433 | + if (strcmp ("-to", argv[c]) == 0) | ||
| 434 | + strcpy (argv[c], "-t"); | ||
| 435 | + | ||
| 436 | + c = 0; | ||
| 437 | + while (c += (call_getopt (argc - c, &argv[c]))) { | ||
| 438 | + if (argc <= c) | ||
| 439 | + break; | ||
| 440 | + if (query_address[0] == 0) { | ||
| 441 | + if (is_host (argv[c]) == FALSE) { | ||
| 442 | + printf ("Invalid name/address: %s\n\n", argv[c]); | ||
| 443 | + return ERROR; | ||
| 444 | + } | ||
| 445 | + if (strlen (argv[c]) >= ADDRESS_LENGTH) | ||
| 446 | + terminate (STATE_UNKNOWN, "Input buffer overflow\n"); | ||
| 447 | + strcpy (query_address, argv[c]); | ||
| 448 | + } | ||
| 449 | + else if (dns_server[0] == 0) { | ||
| 450 | + if (is_host (argv[c]) == FALSE) { | ||
| 451 | + printf ("Invalid name/address: %s\n\n", argv[c]); | ||
| 452 | + return ERROR; | ||
| 453 | + } | ||
| 454 | + if (strlen (argv[c]) >= ADDRESS_LENGTH) | ||
| 455 | + terminate (STATE_UNKNOWN, "Input buffer overflow\n"); | ||
| 456 | + strcpy (dns_server, argv[c]); | ||
| 457 | + } | ||
| 458 | + } | ||
| 459 | |||
| 460 | -/* stripped down getanswer */ | ||
| 461 | + return validate_arguments (); | ||
| 462 | + | ||
| 463 | +} | ||
| 464 | |||
| 465 | -/* | ||
| 466 | - * Copyright (c) 1985, 1988, 1993 | ||
| 467 | - * The Regents of the University of California. All rights reserved. | ||
| 468 | - * | ||
| 469 | - * Redistribution and use in source and binary forms, with or without | ||
| 470 | - * modification, are permitted provided that the following conditions | ||
| 471 | - * are met: | ||
| 472 | - * 1. Redistributions of source code must retain the above copyright | ||
| 473 | - * notice, this list of conditions and the following disclaimer. | ||
| 474 | - * 2. Redistributions in binary form must reproduce the above copyright | ||
| 475 | - * notice, this list of conditions and the following disclaimer in the | ||
| 476 | - * documentation and/or other materials provided with the distribution. | ||
| 477 | - * 3. All advertising materials mentioning features or use of this software | ||
| 478 | - * must display the following acknowledgement: | ||
| 479 | - * This product includes software developed by the University of | ||
| 480 | - * California, Berkeley and its contributors. | ||
| 481 | - * 4. Neither the name of the University nor the names of its contributors | ||
| 482 | - * may be used to endorse or promote products derived from this software | ||
| 483 | - * without specific prior written permission. | ||
| 484 | - * | ||
| 485 | - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
| 486 | - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 487 | - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 488 | - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
| 489 | - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 490 | - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 491 | - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 492 | - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 493 | - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 494 | - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 495 | - * SUCH DAMAGE. | ||
| 496 | - * - | ||
| 497 | - * Portions Copyright (c) 1993 by Digital Equipment Corporation. | ||
| 498 | - * | ||
| 499 | - * Permission to use, copy, modify, and distribute this software for any | ||
| 500 | - * purpose with or without fee is hereby granted, provided that the above | ||
| 501 | - * copyright notice and this permission notice appear in all copies, and that | ||
| 502 | - * the name of Digital Equipment Corporation not be used in advertising or | ||
| 503 | - * publicity pertaining to distribution of the document or software without | ||
| 504 | - * specific, written prior permission. | ||
| 505 | - * | ||
| 506 | - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL | ||
| 507 | - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES | ||
| 508 | - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT | ||
| 509 | - * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL | ||
| 510 | - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR | ||
| 511 | - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS | ||
| 512 | - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | ||
| 513 | - * SOFTWARE. | ||
| 514 | - * - | ||
| 515 | - * --Copyright-- | ||
| 516 | - */ | ||
| 517 | - | ||
| 518 | -static const char AskedForGot[] = | ||
| 519 | - "gethostby*.getanswer: asked for \"%s\", got \"%s\""; | ||
| 520 | -static char *h_addr_ptrs[MAXADDRS + 1]; | ||
| 521 | - | ||
| 522 | -static struct hostent host; | ||
| 523 | -static char *host_aliases[MAXALIASES]; | ||
| 524 | -static char hostbuf[8*1024]; | ||
| 525 | -static u_char host_addr[16]; /* IPv4 or IPv6 */ | ||
| 526 | -static FILE *hostf = NULL; | ||
| 527 | -static int stayopen = 0; | ||
| 528 | - | ||
| 529 | - | ||
| 530 | -typedef union { | ||
| 531 | - int32_t al; | ||
| 532 | - char ac; | ||
| 533 | -} align; | ||
| 534 | - | ||
| 535 | -#define dprintf printf | ||
| 536 | - | ||
| 537 | -static struct hostent * | ||
| 538 | -getanswer(const querybuf *answer, | ||
| 539 | - int anslen, | ||
| 540 | - const char *qname, | ||
| 541 | - int qtype) | ||
| 542 | +int | ||
| 543 | +call_getopt (int argc, char **argv) | ||
| 544 | { | ||
| 545 | - register const HEADER *hp; | ||
| 546 | - register const u_char *cp; | ||
| 547 | - register int n; | ||
| 548 | - const u_char *eom; | ||
| 549 | - char *bp, **ap, **hap; | ||
| 550 | - int type, class, buflen, ancount, qdcount; | ||
| 551 | - int haveanswer, had_error; | ||
| 552 | - int toobig = 0; | ||
| 553 | - char tbuf[MAXDNAME]; | ||
| 554 | - const char *tname; | ||
| 555 | - int (*name_ok) __P((const char *)); | ||
| 556 | - | ||
| 557 | - tname = qname; | ||
| 558 | - host.h_name = NULL; | ||
| 559 | - host.h_length = INADDRSZ; | ||
| 560 | - host.h_addrtype = AF_INET; | ||
| 561 | - | ||
| 562 | - eom = answer->buf + anslen; | ||
| 563 | - switch (qtype) { | ||
| 564 | - case T_A: | ||
| 565 | - case T_AAAA: | ||
| 566 | - name_ok = res_hnok; | ||
| 567 | - break; | ||
| 568 | - case T_PTR: | ||
| 569 | - name_ok = res_dnok; | ||
| 570 | - break; | ||
| 571 | - default: | ||
| 572 | - return (NULL); /* XXX should be abort(); */ | ||
| 573 | - } | ||
| 574 | - /* | ||
| 575 | - * find first satisfactory answer | ||
| 576 | - */ | ||
| 577 | - hp = &answer->hdr; | ||
| 578 | - ancount = ntohs(hp->ancount); | ||
| 579 | - qdcount = ntohs(hp->qdcount); | ||
| 580 | - bp = hostbuf; | ||
| 581 | - buflen = sizeof hostbuf; | ||
| 582 | - cp = answer->buf + HFIXEDSZ; | ||
| 583 | - if (qdcount != 1) { | ||
| 584 | - h_errno = NO_RECOVERY; | ||
| 585 | - return (NULL); | ||
| 586 | - } | ||
| 587 | - n = dn_expand(answer->buf, eom, cp, bp, buflen); | ||
| 588 | - if ((n < 0) || !(*name_ok)(bp)) { | ||
| 589 | - h_errno = NO_RECOVERY; | ||
| 590 | - return (NULL); | ||
| 591 | - } | ||
| 592 | - cp += n + QFIXEDSZ; | ||
| 593 | - if (qtype == T_A || qtype == T_AAAA) { | ||
| 594 | - /* res_send() has already verified that the query name is the | ||
| 595 | - * same as the one we sent; this just gets the expanded name | ||
| 596 | - * (i.e., with the succeeding search-domain tacked on). | ||
| 597 | - */ | ||
| 598 | - n = strlen(bp) + 1; /* for the \0 */ | ||
| 599 | - host.h_name = bp; | ||
| 600 | - bp += n; | ||
| 601 | - buflen -= n; | ||
| 602 | - /* The qname can be abbreviated, but h_name is now absolute. */ | ||
| 603 | - qname = host.h_name; | ||
| 604 | - } | ||
| 605 | - ap = host_aliases; | ||
| 606 | - *ap = NULL; | ||
| 607 | - host.h_aliases = host_aliases; | ||
| 608 | - hap = h_addr_ptrs; | ||
| 609 | - *hap = NULL; | ||
| 610 | - host.h_addr_list = h_addr_ptrs; | ||
| 611 | - haveanswer = 0; | ||
| 612 | - had_error = 0; | ||
| 613 | - while (ancount-- > 0 && cp < eom && !had_error) { | ||
| 614 | - n = dn_expand(answer->buf, eom, cp, bp, buflen); | ||
| 615 | - if ((n < 0) || !(*name_ok)(bp)) { | ||
| 616 | - had_error++; | ||
| 617 | - continue; | ||
| 618 | - } | ||
| 619 | - | ||
| 620 | - cp += n; /* name */ | ||
| 621 | - type = _getshort(cp); | ||
| 622 | - cp += INT16SZ; /* type */ | ||
| 623 | - class = _getshort(cp); | ||
| 624 | - cp += INT16SZ + INT32SZ; /* class, TTL */ | ||
| 625 | - n = _getshort(cp); | ||
| 626 | - cp += INT16SZ; /* len */ | ||
| 627 | - if (class != C_IN) { | ||
| 628 | - /* XXX - debug? syslog? */ | ||
| 629 | - cp += n; | ||
| 630 | - continue; /* XXX - had_error++ ? */ | ||
| 631 | - } | ||
| 632 | - if ((qtype == T_A || qtype == T_AAAA) && type == T_CNAME) { | ||
| 633 | - if (ap >= &host_aliases[MAXALIASES-1]) | ||
| 634 | - continue; | ||
| 635 | - n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf); | ||
| 636 | - if ((n < 0) || !(*name_ok)(tbuf)) { | ||
| 637 | - had_error++; | ||
| 638 | - continue; | ||
| 639 | - } | ||
| 640 | - cp += n; | ||
| 641 | - /* Store alias. */ | ||
| 642 | - *ap++ = bp; | ||
| 643 | - n = strlen(bp) + 1; /* for the \0 */ | ||
| 644 | - bp += n; | ||
| 645 | - buflen -= n; | ||
| 646 | - /* Get canonical name. */ | ||
| 647 | - n = strlen(tbuf) + 1; /* for the \0 */ | ||
| 648 | - if (n > buflen) { | ||
| 649 | - had_error++; | ||
| 650 | - continue; | ||
| 651 | - } | ||
| 652 | - strcpy(bp, tbuf); | ||
| 653 | - host.h_name = bp; | ||
| 654 | - bp += n; | ||
| 655 | - buflen -= n; | ||
| 656 | - continue; | ||
| 657 | - } | ||
| 658 | - | ||
| 659 | - if (qtype == T_PTR && type == T_CNAME) { | ||
| 660 | - n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf); | ||
| 661 | - if ((n < 0) || !res_hnok(tbuf)) { | ||
| 662 | - had_error++; | ||
| 663 | - continue; | ||
| 664 | - } | ||
| 665 | - cp += n; | ||
| 666 | - /* Get canonical name. */ | ||
| 667 | - n = strlen(tbuf) + 1; /* for the \0 */ | ||
| 668 | - if (n > buflen) { | ||
| 669 | - had_error++; | ||
| 670 | - continue; | ||
| 671 | - } | ||
| 672 | - strcpy(bp, tbuf); | ||
| 673 | - tname = bp; | ||
| 674 | - bp += n; | ||
| 675 | - buflen -= n; | ||
| 676 | - continue; | ||
| 677 | - } | ||
| 678 | - if (type != qtype) { | ||
| 679 | - dprintf("gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"", | ||
| 680 | - qname, p_class(C_IN), p_type(qtype), | ||
| 681 | - p_type(type)); | ||
| 682 | - cp += n; | ||
| 683 | - continue; /* XXX - had_error++ ? */ | ||
| 684 | - } | ||
| 685 | - switch (type) { | ||
| 686 | - case T_PTR: | ||
| 687 | - if (strcasecmp(tname, bp) != 0) { | ||
| 688 | - dprintf(AskedForGot, qname, bp); | ||
| 689 | - cp += n; | ||
| 690 | - continue; /* XXX - had_error++ ? */ | ||
| 691 | - } | ||
| 692 | - n = dn_expand(answer->buf, eom, cp, bp, buflen); | ||
| 693 | - if ((n < 0) || !res_hnok(bp)) { | ||
| 694 | - had_error++; | ||
| 695 | - break; | ||
| 696 | - } | ||
| 697 | -#if MULTI_PTRS_ARE_ALIASES | ||
| 698 | - cp += n; | ||
| 699 | - if (!haveanswer) | ||
| 700 | - host.h_name = bp; | ||
| 701 | - else if (ap < &host_aliases[MAXALIASES-1]) | ||
| 702 | - *ap++ = bp; | ||
| 703 | - else | ||
| 704 | - n = -1; | ||
| 705 | - if (n != -1) { | ||
| 706 | - n = strlen(bp) + 1; /* for the \0 */ | ||
| 707 | - bp += n; | ||
| 708 | - buflen -= n; | ||
| 709 | - } | ||
| 710 | - break; | ||
| 711 | + int c, i = 1; | ||
| 712 | |||
| 713 | +#ifdef HAVE_GETOPT_H | ||
| 714 | + int opt_index = 0; | ||
| 715 | + static struct option long_opts[] = { | ||
| 716 | + {"help", no_argument, 0, 'h'}, | ||
| 717 | + {"version", no_argument, 0, 'V'}, | ||
| 718 | + {"verbose", no_argument, 0, 'v'}, | ||
| 719 | + {"timeout", required_argument, 0, 't'}, | ||
| 720 | + {"hostname", required_argument, 0, 'H'}, | ||
| 721 | + {"server", required_argument, 0, 's'}, | ||
| 722 | + {"reverse-server", required_argument, 0, 'r'}, | ||
| 723 | + {0, 0, 0, 0} | ||
| 724 | + }; | ||
| 725 | +#endif | ||
| 726 | + | ||
| 727 | + | ||
| 728 | + while (1) { | ||
| 729 | +#ifdef HAVE_GETOPT_H | ||
| 730 | + c = getopt_long (argc, argv, "+?hVvt:H:s:r:", long_opts, &opt_index); | ||
| 731 | #else | ||
| 732 | - host.h_name = bp; | ||
| 733 | - h_errno = NETDB_SUCCESS; | ||
| 734 | - return (&host); | ||
| 735 | + c = getopt (argc, argv, "+?hVvt:H:s:r:"); | ||
| 736 | #endif | ||
| 737 | - case T_A: | ||
| 738 | - case T_AAAA: | ||
| 739 | - if (strcasecmp(host.h_name, bp) != 0) { | ||
| 740 | - dprintf(AskedForGot, host.h_name, bp); | ||
| 741 | - cp += n; | ||
| 742 | - continue; /* XXX - had_error++ ? */ | ||
| 743 | - } | ||
| 744 | - if (n != host.h_length) { | ||
| 745 | - cp += n; | ||
| 746 | - continue; | ||
| 747 | - } | ||
| 748 | - if (!haveanswer) { | ||
| 749 | - register int nn; | ||
| 750 | - | ||
| 751 | - host.h_name = bp; | ||
| 752 | - nn = strlen(bp) + 1; /* for the \0 */ | ||
| 753 | - bp += nn; | ||
| 754 | - buflen -= nn; | ||
| 755 | - } | ||
| 756 | - | ||
| 757 | - bp += sizeof(align) - ((u_long)bp % sizeof(align)); | ||
| 758 | - | ||
| 759 | - if (bp + n >= &hostbuf[sizeof hostbuf]) { | ||
| 760 | - dprintf("size (%d) too big\n", n); | ||
| 761 | - had_error++; | ||
| 762 | - continue; | ||
| 763 | - } | ||
| 764 | - if (hap >= &h_addr_ptrs[MAXADDRS-1]) { | ||
| 765 | - if (!toobig++) | ||
| 766 | - dprintf("Too many addresses (%d)\n", | ||
| 767 | - MAXADDRS); | ||
| 768 | - cp += n; | ||
| 769 | - continue; | ||
| 770 | - } | ||
| 771 | - bcopy(cp, *hap++ = bp, n); | ||
| 772 | - bp += n; | ||
| 773 | - buflen -= n; | ||
| 774 | - cp += n; | ||
| 775 | - break; | ||
| 776 | - default: | ||
| 777 | - abort(); | ||
| 778 | - } | ||
| 779 | - if (!had_error) | ||
| 780 | - haveanswer++; | ||
| 781 | - } | ||
| 782 | - if (haveanswer) { | ||
| 783 | - *ap = NULL; | ||
| 784 | - *hap = NULL; | ||
| 785 | -# if defined(RESOLVSORT) | ||
| 786 | - /* | ||
| 787 | - * Note: we sort even if host can take only one address | ||
| 788 | - * in its return structures - should give it the "best" | ||
| 789 | - * address in that case, not some random one | ||
| 790 | - */ | ||
| 791 | - if (_res.nsort && haveanswer > 1 && qtype == T_A) | ||
| 792 | - addrsort(h_addr_ptrs, haveanswer); | ||
| 793 | -# endif /*RESOLVSORT*/ | ||
| 794 | - if (!host.h_name) { | ||
| 795 | - n = strlen(qname) + 1; /* for the \0 */ | ||
| 796 | - if (n > buflen) | ||
| 797 | - goto try_again; | ||
| 798 | - strcpy(bp, qname); | ||
| 799 | - host.h_name = bp; | ||
| 800 | - bp += n; | ||
| 801 | - buflen -= n; | ||
| 802 | - } | ||
| 803 | - h_errno = NETDB_SUCCESS; | ||
| 804 | - return (&host); | ||
| 805 | - } | ||
| 806 | - try_again: | ||
| 807 | - h_errno = TRY_AGAIN; | ||
| 808 | - return (NULL); | ||
| 809 | + | ||
| 810 | + if (c == -1 || c == EOF) | ||
| 811 | + break; | ||
| 812 | + | ||
| 813 | + i++; | ||
| 814 | + switch (c) { | ||
| 815 | + case 't': | ||
| 816 | + case 'H': | ||
| 817 | + case 's': | ||
| 818 | + case 'r': | ||
| 819 | + i++; | ||
| 820 | + } | ||
| 821 | + | ||
| 822 | + switch (c) { | ||
| 823 | + case '?': /* args not parsable */ | ||
| 824 | + printf ("%s: Unknown argument: %s\n\n", my_basename (argv[0]), optarg); | ||
| 825 | + print_usage (my_basename (argv[0])); | ||
| 826 | + exit (STATE_UNKNOWN); | ||
| 827 | + case 'h': /* help */ | ||
| 828 | + print_help (my_basename (argv[0])); | ||
| 829 | + exit (STATE_OK); | ||
| 830 | + case 'V': /* version */ | ||
| 831 | + print_revision (my_basename (argv[0]), "$Revision: 1.1.1.1 $"); | ||
| 832 | + exit (STATE_OK); | ||
| 833 | + case 'v': /* version */ | ||
| 834 | + verbose = TRUE; | ||
| 835 | + break; | ||
| 836 | + case 't': /* timeout period */ | ||
| 837 | + timeout_interval = atoi (optarg); | ||
| 838 | + break; | ||
| 839 | + case 'H': /* hostname */ | ||
| 840 | + if (is_host (optarg) == FALSE) { | ||
| 841 | + printf ("Invalid host name/address\n\n"); | ||
| 842 | + print_usage (my_basename (argv[0])); | ||
| 843 | + exit (STATE_UNKNOWN); | ||
| 844 | + } | ||
| 845 | + if (strlen (optarg) >= ADDRESS_LENGTH) | ||
| 846 | + terminate (STATE_UNKNOWN, "Input buffer overflow\n"); | ||
| 847 | + strcpy (query_address, optarg); | ||
| 848 | + break; | ||
| 849 | + case 's': /* server name */ | ||
| 850 | + if (is_host (optarg) == FALSE) { | ||
| 851 | + printf ("Invalid server name/address\n\n"); | ||
| 852 | + print_usage (my_basename (argv[0])); | ||
| 853 | + exit (STATE_UNKNOWN); | ||
| 854 | + } | ||
| 855 | + if (strlen (optarg) >= ADDRESS_LENGTH) | ||
| 856 | + terminate (STATE_UNKNOWN, "Input buffer overflow\n"); | ||
| 857 | + strcpy (dns_server, optarg); | ||
| 858 | + break; | ||
| 859 | + case 'r': /* reverse server name */ | ||
| 860 | + if (is_host (optarg) == FALSE) { | ||
| 861 | + printf ("Invalid host name/address\n\n"); | ||
| 862 | + print_usage (my_basename (argv[0])); | ||
| 863 | + exit (STATE_UNKNOWN); | ||
| 864 | + } | ||
| 865 | + if (strlen (optarg) >= ADDRESS_LENGTH) | ||
| 866 | + terminate (STATE_UNKNOWN, "Input buffer overflow\n"); | ||
| 867 | + strcpy (ptr_server, optarg); | ||
| 868 | + break; | ||
| 869 | + } | ||
| 870 | + } | ||
| 871 | + return i; | ||
| 872 | +} | ||
| 873 | + | ||
| 874 | +int | ||
| 875 | +validate_arguments () | ||
| 876 | +{ | ||
| 877 | + if (query_address[0] == 0) | ||
| 878 | + return ERROR; | ||
| 879 | + else | ||
| 880 | + return OK; | ||
| 881 | +} | ||
| 882 | + | ||
| 883 | +void | ||
| 884 | +print_usage (char *cmd) | ||
| 885 | +{ | ||
| 886 | + printf ("Usage: %s -H host [-s server] [-t timeout]\n" " %s --help\n" | ||
| 887 | + " %s --version\n", cmd, cmd, cmd); | ||
| 888 | +} | ||
| 889 | + | ||
| 890 | +void | ||
| 891 | +print_help (char *cmd) | ||
| 892 | +{ | ||
| 893 | + print_revision (cmd, "$Revision: 1.1.1.1 $"); | ||
| 894 | + printf ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n\n"); | ||
| 895 | + print_usage (cmd); | ||
| 896 | + printf ("\n"); | ||
| 897 | + printf | ||
| 898 | + ("-H, --hostname=HOST\n" | ||
| 899 | + " The name or address you want to query\n" | ||
| 900 | + "-s, --server=HOST\n" | ||
| 901 | + " Optional DNS server you want to use for the lookup\n" | ||
| 902 | + "-t, --timeout=INTEGER\n" | ||
| 903 | + " Seconds before connection times out (default: %d)\n" | ||
| 904 | + "-h, --help\n" | ||
| 905 | + " Print detailed help\n" | ||
| 906 | + "-V, --version\n" | ||
| 907 | + " Print version numbers and license information\n" | ||
| 908 | + "\n" | ||
| 909 | + "This plugin uses the nslookup program to obtain the IP address\n" | ||
| 910 | + "for the given host/domain query. A optional DNS server to use may\n" | ||
| 911 | + "be specified. If no DNS server is specified, the default server(s)\n" | ||
| 912 | + "specified in /etc/resolv.conf will be used.\n", DEFAULT_SOCKET_TIMEOUT); | ||
| 913 | } | ||
diff --git a/web/attachments/36789-NSClient-1.07.0_1.patch b/web/attachments/36789-NSClient-1.07.0_1.patch new file mode 100644 index 0000000..7ce4552 --- /dev/null +++ b/web/attachments/36789-NSClient-1.07.0_1.patch | |||
| @@ -0,0 +1,240 @@ | |||
| 1 | diff -uNr NSClient-1.07.0.orig/UnixSource/check_nt.c NSClient-1.07.0/UnixSource/check_nt.c | ||
| 2 | --- NSClient-1.07.0.orig/UnixSource/check_nt.c Sun Feb 24 14:55:48 2002 | ||
| 3 | +++ NSClient-1.07.0/UnixSource/check_nt.c Wed Nov 27 12:10:46 2002 | ||
| 4 | @@ -95,7 +95,7 @@ | ||
| 5 | int updays=0; | ||
| 6 | int uphours=0; | ||
| 7 | int upminutes=0; | ||
| 8 | - req_password=strscpy(req_password,"None"); | ||
| 9 | + asprintf(&req_password,"None"); | ||
| 10 | |||
| 11 | if(process_arguments(argc,argv)==ERROR) | ||
| 12 | usage("Could not parse arguments\n"); | ||
| 13 | @@ -108,11 +108,11 @@ | ||
| 14 | |||
| 15 | if (vars_to_check==CHECK_CLIENTVERSION) { | ||
| 16 | |||
| 17 | - send_buffer = strscpy(send_buffer,strcat(req_password,"&1")); | ||
| 18 | + asprintf(&send_buffer,strcat(req_password,"&1")); | ||
| 19 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 20 | if(result!=STATE_OK) | ||
| 21 | return result; | ||
| 22 | - output_message = strscpy(output_message,recv_buffer); | ||
| 23 | + asprintf(&output_message,recv_buffer); | ||
| 24 | return_code=STATE_OK; | ||
| 25 | } | ||
| 26 | else if(vars_to_check==CHECK_CPULOAD){ | ||
| 27 | @@ -121,14 +121,14 @@ | ||
| 28 | if (strtolarray(&lvalue_list,value_list,",")==TRUE) { | ||
| 29 | // -l parameters is present with only integers | ||
| 30 | return_code=STATE_OK; | ||
| 31 | - temp_string = strscpy(temp_string,"CPU Load"); | ||
| 32 | + asprintf(&temp_string,"CPU Load"); | ||
| 33 | while (lvalue_list[0+offset]>0 && lvalue_list[0+offset]<=17280 && | ||
| 34 | lvalue_list[1+offset]>=0 && lvalue_list[1+offset]<=100 && | ||
| 35 | lvalue_list[2+offset]>=0 && lvalue_list[2+offset]<=100) { | ||
| 36 | // loop until one of the parameters is wrong or not present | ||
| 37 | |||
| 38 | // Send request and retrieve data | ||
| 39 | - send_buffer = ssprintf(send_buffer,"%s&2&%lu",req_password,lvalue_list[0+offset]); | ||
| 40 | + asprintf(&send_buffer,"%s&2&%lu",req_password,lvalue_list[0+offset]); | ||
| 41 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 42 | if(result!=STATE_OK) | ||
| 43 | return result; | ||
| 44 | @@ -146,27 +146,27 @@ | ||
| 45 | else if(utilization >= lvalue_list[1+offset] && return_code<STATE_WARNING) | ||
| 46 | return_code=STATE_WARNING; | ||
| 47 | |||
| 48 | - output_message = ssprintf(output_message," (%lu min. %lu%)",lvalue_list[0+offset], utilization); | ||
| 49 | - temp_string = strscat(temp_string,output_message); | ||
| 50 | + asprintf(&output_message," (%lu min. %lu%)",lvalue_list[0+offset], utilization); | ||
| 51 | + asprintf(&temp_string,"%s%s",temp_string,output_message); | ||
| 52 | offset+=3; //move accross the array | ||
| 53 | } | ||
| 54 | if (strlen(temp_string)>10) { | ||
| 55 | // we had at least on loop | ||
| 56 | - output_message = ssprintf(output_message,"%s",temp_string); | ||
| 57 | + asprintf(&output_message,"%s",temp_string); | ||
| 58 | } | ||
| 59 | else | ||
| 60 | - output_message = strscpy(output_message,"not enough values for -l parameters"); | ||
| 61 | + asprintf(&output_message,"%s","not enough values for -l parameters"); | ||
| 62 | |||
| 63 | } else | ||
| 64 | - output_message = strscpy(output_message,"wrong -l parameter."); | ||
| 65 | + asprintf(&output_message,"wrong -l parameter."); | ||
| 66 | |||
| 67 | } else | ||
| 68 | - output_message = strscpy(output_message,"missing -l parameters"); | ||
| 69 | + asprintf(&output_message,"missing -l parameters"); | ||
| 70 | } | ||
| 71 | |||
| 72 | else if(vars_to_check==CHECK_UPTIME){ | ||
| 73 | |||
| 74 | - send_buffer = strscpy(send_buffer,strcat(req_password,"&3")); | ||
| 75 | + asprintf(&send_buffer,strcat(req_password,"&3")); | ||
| 76 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 77 | if(result!=STATE_OK) | ||
| 78 | return result; | ||
| 79 | @@ -180,7 +180,7 @@ | ||
| 80 | updays = uptime / 86400; | ||
| 81 | uphours = (uptime % 86400) / 3600; | ||
| 82 | upminutes = ((uptime % 86400) % 3600) / 60; | ||
| 83 | - output_message = ssprintf(output_message,"System Uptime : %u day(s) %u hour(s) %u minute(s)",updays,uphours, upminutes); | ||
| 84 | + asprintf(&output_message,"System Uptime : %u day(s) %u hour(s) %u minute(s)",updays,uphours, upminutes); | ||
| 85 | return_code=STATE_OK; | ||
| 86 | } | ||
| 87 | |||
| 88 | @@ -189,7 +189,7 @@ | ||
| 89 | return_code=STATE_UNKNOWN; | ||
| 90 | if (check_value_list==TRUE) { | ||
| 91 | if (strlen(value_list)==1) { | ||
| 92 | - send_buffer = ssprintf(send_buffer,"%s&4&%s", req_password, value_list); | ||
| 93 | + asprintf(&send_buffer,"%s&4&%s", req_password, value_list); | ||
| 94 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 95 | if(result!=STATE_OK) | ||
| 96 | return result; | ||
| 97 | @@ -204,7 +204,7 @@ | ||
| 98 | percent_used_space = ((total_disk_space - free_disk_space) / total_disk_space) * 100; | ||
| 99 | |||
| 100 | if (free_disk_space>=0) { | ||
| 101 | - temp_string = ssprintf(temp_string,"%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)", | ||
| 102 | + asprintf(&temp_string,"%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)", | ||
| 103 | value_list, total_disk_space / 1073741824, (total_disk_space - free_disk_space) / 1073741824, percent_used_space, | ||
| 104 | free_disk_space / 1073741824, (free_disk_space / total_disk_space)*100); | ||
| 105 | |||
| 106 | @@ -216,18 +216,18 @@ | ||
| 107 | else | ||
| 108 | return_code=STATE_OK; | ||
| 109 | |||
| 110 | - output_message = ssprintf(output_message,"%s",temp_string); | ||
| 111 | + asprintf(&output_message,"%s",temp_string); | ||
| 112 | |||
| 113 | } | ||
| 114 | else { | ||
| 115 | - output_message = ssprintf(output_message,"Free disk space : Invalid drive "); | ||
| 116 | + asprintf(&output_message,"Free disk space : Invalid drive "); | ||
| 117 | return_code=STATE_UNKNOWN; | ||
| 118 | } | ||
| 119 | } | ||
| 120 | else | ||
| 121 | - output_message = strscpy(output_message,"wrong -l argument"); | ||
| 122 | + asprintf(&output_message,"wrong -l argument"); | ||
| 123 | } else | ||
| 124 | - output_message = strscpy(output_message,"missing -l parameters"); | ||
| 125 | + asprintf(&output_message,"missing -l parameters"); | ||
| 126 | |||
| 127 | } | ||
| 128 | |||
| 129 | @@ -235,7 +235,7 @@ | ||
| 130 | |||
| 131 | if (check_value_list==TRUE) { | ||
| 132 | preparelist(value_list); // replace , between services with & to send the request | ||
| 133 | - send_buffer = ssprintf(send_buffer,"%s&%u&%s&%s", req_password,(vars_to_check==CHECK_SERVICESTATE)?5:6, | ||
| 134 | + asprintf(&send_buffer,"%s&%u&%s&%s", req_password,(vars_to_check==CHECK_SERVICESTATE)?5:6, | ||
| 135 | (show_all==TRUE)?"ShowAll":"ShowFail",value_list); | ||
| 136 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 137 | if(result!=STATE_OK) | ||
| 138 | @@ -247,15 +247,15 @@ | ||
| 139 | } | ||
| 140 | return_code=atoi(strtok(recv_buffer,"&")); | ||
| 141 | temp_string=strtok(NULL,"&"); | ||
| 142 | - output_message = ssprintf(output_message, "%s",temp_string); | ||
| 143 | + asprintf(&output_message, "%s",temp_string); | ||
| 144 | } | ||
| 145 | else | ||
| 146 | - output_message = strscpy(output_message,"No service/process specified"); | ||
| 147 | + asprintf(&output_message,"No service/process specified"); | ||
| 148 | } | ||
| 149 | |||
| 150 | else if(vars_to_check==CHECK_MEMUSE) { | ||
| 151 | |||
| 152 | - send_buffer = ssprintf(send_buffer,"%s&7", req_password); | ||
| 153 | + asprintf(&send_buffer,"%s&7", req_password); | ||
| 154 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 155 | if (result!=STATE_OK) | ||
| 156 | return result; | ||
| 157 | @@ -268,7 +268,7 @@ | ||
| 158 | mem_commitLimit=atof(strtok(recv_buffer,"&")); | ||
| 159 | mem_commitByte=atof(strtok(NULL,"&")); | ||
| 160 | percent_used_space = (mem_commitByte / mem_commitLimit) * 100; | ||
| 161 | - output_message = ssprintf(output_message,"Memory usage: total:%.2f Mb - used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)", | ||
| 162 | + asprintf(&output_message,"Memory usage: total:%.2f Mb - used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)", | ||
| 163 | mem_commitLimit / 1048576, mem_commitByte / 1048567, percent_used_space, | ||
| 164 | (mem_commitLimit - mem_commitByte) / 1048576, (mem_commitLimit - mem_commitByte) / mem_commitLimit * 100); | ||
| 165 | |||
| 166 | @@ -285,7 +285,7 @@ | ||
| 167 | |||
| 168 | if (check_value_list==TRUE) { | ||
| 169 | preparelist(value_list); // replace , between services with & to send the request | ||
| 170 | - send_buffer = ssprintf(send_buffer,"%s&8&%s", req_password,value_list); | ||
| 171 | + asprintf(&send_buffer,"%s&8&%s", req_password,value_list); | ||
| 172 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 173 | if (result!=STATE_OK) | ||
| 174 | return result; | ||
| 175 | @@ -299,9 +299,9 @@ | ||
| 176 | description = strtok(NULL,"&"); | ||
| 177 | counter_value = atof(recv_buffer); | ||
| 178 | if (description == NULL) | ||
| 179 | - output_message = ssprintf(output_message, "%.f", counter_value); | ||
| 180 | + asprintf(&output_message, "%.f", counter_value); | ||
| 181 | else | ||
| 182 | - output_message = ssprintf(output_message, description, counter_value); | ||
| 183 | + asprintf(&output_message, description, counter_value); | ||
| 184 | |||
| 185 | if (critical_value > warning_value) { | ||
| 186 | // Normal thresholds | ||
| 187 | @@ -324,7 +324,7 @@ | ||
| 188 | |||
| 189 | } | ||
| 190 | else { | ||
| 191 | - output_message = strscpy(output_message,"No counter specified"); | ||
| 192 | + asprintf(&output_message,"No counter specified"); | ||
| 193 | result=STATE_UNKNOWN; | ||
| 194 | } | ||
| 195 | } | ||
| 196 | @@ -332,7 +332,7 @@ | ||
| 197 | |||
| 198 | if (check_value_list==TRUE) { | ||
| 199 | preparelist(value_list); // replace , between services with & to send the request | ||
| 200 | - send_buffer = ssprintf(send_buffer,"%s&9&%s", req_password,value_list); | ||
| 201 | + asprintf(&send_buffer,"%s&9&%s", req_password,value_list); | ||
| 202 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 203 | if (result!=STATE_OK) | ||
| 204 | return result; | ||
| 205 | @@ -344,7 +344,7 @@ | ||
| 206 | |||
| 207 | age_in_minutes = atoi(strtok(recv_buffer,"&")); | ||
| 208 | description = strtok(NULL,"&"); | ||
| 209 | - output_message = ssprintf(output_message, description); | ||
| 210 | + asprintf(&output_message, description); | ||
| 211 | |||
| 212 | if (critical_value > warning_value) { | ||
| 213 | // Normal thresholds | ||
| 214 | @@ -367,7 +367,7 @@ | ||
| 215 | |||
| 216 | } | ||
| 217 | else { | ||
| 218 | - output_message = strscpy(output_message,"No file specified"); | ||
| 219 | + asprintf(&output_message,"No file specified"); | ||
| 220 | result=STATE_UNKNOWN; | ||
| 221 | } | ||
| 222 | } | ||
| 223 | @@ -447,7 +447,7 @@ | ||
| 224 | server_address=optarg; | ||
| 225 | break; | ||
| 226 | case 's': /* password */ | ||
| 227 | - req_password=strscpy(req_password,optarg); | ||
| 228 | + asprintf(&req_password,optarg); | ||
| 229 | break; | ||
| 230 | case 'p': /* port */ | ||
| 231 | if (is_intnonneg(optarg)) | ||
| 232 | @@ -480,7 +480,7 @@ | ||
| 233 | return ERROR; | ||
| 234 | break; | ||
| 235 | case 'l': /* value list */ | ||
| 236 | - value_list=strscpy(value_list,optarg); | ||
| 237 | + asprintf(&value_list,optarg); | ||
| 238 | check_value_list=TRUE; | ||
| 239 | break; | ||
| 240 | case 'w': /* warning threshold */ | ||
diff --git a/web/attachments/367917-check_http.HTTP_CONNECT_patch b/web/attachments/367917-check_http.HTTP_CONNECT_patch new file mode 100644 index 0000000..00a4008 --- /dev/null +++ b/web/attachments/367917-check_http.HTTP_CONNECT_patch | |||
| @@ -0,0 +1,145 @@ | |||
| 1 | *** plugins/check_http.c.orig 2010-03-18 15:05:53.000000000 -0400 | ||
| 2 | --- plugins/check_http.c 2010-03-23 14:26:48.000000000 -0400 | ||
| 3 | *************** | ||
| 4 | *** 121,126 **** | ||
| 5 | --- 121,127 ---- | ||
| 6 | char *http_post_data; | ||
| 7 | char *http_content_type; | ||
| 8 | char buffer[MAX_INPUT_BUFFER]; | ||
| 9 | + int http_connect = FALSE; | ||
| 10 | |||
| 11 | int process_arguments (int, char **); | ||
| 12 | int check_http (void); | ||
| 13 | *************** | ||
| 14 | *** 186,191 **** | ||
| 15 | --- 187,193 ---- | ||
| 16 | {"link", no_argument, 0, 'L'}, | ||
| 17 | {"nohtml", no_argument, 0, 'n'}, | ||
| 18 | {"ssl", no_argument, 0, 'S'}, | ||
| 19 | + {"http-connect", no_argument, 0, 'K'}, | ||
| 20 | {"post", required_argument, 0, 'P'}, | ||
| 21 | {"method", required_argument, 0, 'j'}, | ||
| 22 | {"IP-address", required_argument, 0, 'I'}, | ||
| 23 | *************** | ||
| 24 | *** 229,235 **** | ||
| 25 | } | ||
| 26 | |||
| 27 | while (1) { | ||
| 28 | ! c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 29 | if (c == -1 || c == EOF) | ||
| 30 | break; | ||
| 31 | |||
| 32 | --- 231,237 ---- | ||
| 33 | } | ||
| 34 | |||
| 35 | while (1) { | ||
| 36 | ! c = getopt_long (argc, argv, "Vvh46Kt:c:w:A:k:H:P:j:T:I:a:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 37 | if (c == -1 || c == EOF) | ||
| 38 | break; | ||
| 39 | |||
| 40 | *************** | ||
| 41 | *** 401,406 **** | ||
| 42 | --- 403,411 ---- | ||
| 43 | usage4 (_("IPv6 support not available")); | ||
| 44 | #endif | ||
| 45 | break; | ||
| 46 | + case 'K': /* use http-connect */ | ||
| 47 | + http_connect = TRUE; | ||
| 48 | + break; | ||
| 49 | case 'v': /* verbose */ | ||
| 50 | verbose = TRUE; | ||
| 51 | break; | ||
| 52 | *************** | ||
| 53 | *** 790,795 **** | ||
| 54 | --- 795,807 ---- | ||
| 55 | die (STATE_CRITICAL, _("HTTP CRITICAL - Unable to open TCP socket\n")); | ||
| 56 | #ifdef HAVE_SSL | ||
| 57 | if (use_ssl == TRUE) { | ||
| 58 | + | ||
| 59 | + if (http_connect == TRUE) { | ||
| 60 | + /* only using port 443 */ | ||
| 61 | + if (http_connect_through_proxy(host_name, 443, user_agent, sd) != STATE_OK) | ||
| 62 | + die (STATE_CRITICAL, _("HTTP CRITICAL - Unable to open proxy tunnel TCP socket\n")); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | np_net_ssl_init_with_hostname(sd, host_name); | ||
| 66 | if (check_cert == TRUE) { | ||
| 67 | result = np_net_ssl_check_cert(days_till_exp); | ||
| 68 | *************** | ||
| 69 | *** 1234,1239 **** | ||
| 70 | --- 1246,1290 ---- | ||
| 71 | } | ||
| 72 | |||
| 73 | |||
| 74 | + | ||
| 75 | + /* start the HTTP CONNECT method exchange with a proxy host */ | ||
| 76 | + int | ||
| 77 | + http_connect_through_proxy (char *host_name, int port, char *user_agent, int sd) | ||
| 78 | + { | ||
| 79 | + int result; | ||
| 80 | + char *send_buffer=NULL; | ||
| 81 | + char recv_buffer[MAX_INPUT_BUFFER]; | ||
| 82 | + char *status_line; | ||
| 83 | + char *status_code; | ||
| 84 | + int http_status; | ||
| 85 | + | ||
| 86 | + asprintf( &send_buffer, "CONNECT %s:%d HTTP/1.0\r\nUser-agent: %s\r\n\r\n", host_name, port, user_agent); | ||
| 87 | + | ||
| 88 | + result = STATE_OK; | ||
| 89 | + result = send_tcp_request (sd, send_buffer, recv_buffer, sizeof(recv_buffer)); | ||
| 90 | + if (result != STATE_OK) | ||
| 91 | + return result; | ||
| 92 | + | ||
| 93 | + status_line = recv_buffer; | ||
| 94 | + status_line[strcspn(status_line, "\r\n")] = 0; | ||
| 95 | + strip (status_line); | ||
| 96 | + if (verbose) | ||
| 97 | + printf ("HTTP_CONNECT STATUS: %s\n", status_line); | ||
| 98 | + | ||
| 99 | + status_code = strchr (status_line, ' ') + sizeof (char); | ||
| 100 | + if (strspn (status_code, "1234567890") != 3) | ||
| 101 | + die (STATE_CRITICAL, _("HTTP CRITICAL: HTTP_CONNECT Returns Invalid Status Line (%s)\n"), status_line); | ||
| 102 | + | ||
| 103 | + http_status = atoi (status_code); | ||
| 104 | + | ||
| 105 | + if (http_status != 200) { | ||
| 106 | + die (STATE_CRITICAL, _("HTTP CRITICAL: Invalid HTTP Connect Proxy Status (%s)\n"), status_line); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + return STATE_OK; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + | ||
| 113 | int | ||
| 114 | server_type_check (const char *type) | ||
| 115 | { | ||
| 116 | *************** | ||
| 117 | *** 1308,1313 **** | ||
| 118 | --- 1359,1368 ---- | ||
| 119 | #ifdef HAVE_SSL | ||
| 120 | printf (" %s\n", "-S, --ssl"); | ||
| 121 | printf (" %s\n", _("Connect via SSL. Port defaults to 443")); | ||
| 122 | + printf (" %s\n", "-K, --http-connect"); | ||
| 123 | + printf (" %s\n", _("Connect to a proxy using the HTTP CONNECT protocol (SSL tunnel).")); | ||
| 124 | + printf (" %s\n", _("Requires -S option. Will only connect to host through tunnel")); | ||
| 125 | + printf (" %s\n", _("on port 443.")); | ||
| 126 | printf (" %s\n", "-C, --certificate=INTEGER"); | ||
| 127 | printf (" %s\n", _("Minimum number of days a certificate has to be valid. Port defaults to 443")); | ||
| 128 | printf (" %s\n", _("(when this option is used the URL is not checked.)\n")); | ||
| 129 | *************** | ||
| 130 | *** 1406,1412 **** | ||
| 131 | { | ||
| 132 | printf (_("Usage:")); | ||
| 133 | printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname); | ||
| 134 | ! printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n"); | ||
| 135 | printf (" [-a auth] [-f <ok | warn | critcal | follow | sticky | stickyport>]\n"); | ||
| 136 | printf (" [-e <expect>] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n"); | ||
| 137 | printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); | ||
| 138 | --- 1461,1467 ---- | ||
| 139 | { | ||
| 140 | printf (_("Usage:")); | ||
| 141 | printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname); | ||
| 142 | ! printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L] [-K]\n"); | ||
| 143 | printf (" [-a auth] [-f <ok | warn | critcal | follow | sticky | stickyport>]\n"); | ||
| 144 | printf (" [-e <expect>] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n"); | ||
| 145 | printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); | ||
diff --git a/web/attachments/368326-check_ide_smart.c.patch b/web/attachments/368326-check_ide_smart.c.patch new file mode 100644 index 0000000..f357216 --- /dev/null +++ b/web/attachments/368326-check_ide_smart.c.patch | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | --- plugins/check_ide_smart.c Mon Dec 1 00:23:18 2008 | ||
| 2 | +++ plugins/check_ide_smart.c.new Fri Mar 26 17:38:17 2010 | ||
| 3 | @@ -158,9 +158,6 @@ | ||
| 4 | values_t values; | ||
| 5 | int fd; | ||
| 6 | |||
| 7 | - /* Parse extra opts if any */ | ||
| 8 | - argv=np_extra_opts (&argc, argv, progname); | ||
| 9 | - | ||
| 10 | static struct option longopts[] = { | ||
| 11 | {"device", required_argument, 0, 'd'}, | ||
| 12 | {"immediate", no_argument, 0, 'i'}, | ||
| 13 | @@ -173,6 +170,9 @@ | ||
| 14 | {0, 0, 0, 0} | ||
| 15 | }; | ||
| 16 | |||
| 17 | + /* Parse extra opts if any */ | ||
| 18 | + argv=np_extra_opts (&argc, argv, progname); | ||
| 19 | + | ||
| 20 | setlocale (LC_ALL, ""); | ||
| 21 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 22 | textdomain (PACKAGE); | ||
diff --git a/web/attachments/371559-check_nt.c b/web/attachments/371559-check_nt.c new file mode 100644 index 0000000..f21a17a --- /dev/null +++ b/web/attachments/371559-check_nt.c | |||
| @@ -0,0 +1,772 @@ | |||
| 1 | /***************************************************************************** | ||
| 2 | * | ||
| 3 | * Nagios check_nt plugin | ||
| 4 | * | ||
| 5 | * License: GPL | ||
| 6 | * Copyright (c) 2000-2002 Yves Rubin (rubiyz@yahoo.com) | ||
| 7 | * Copyright (c) 2003-2007 Nagios Plugins Development Team | ||
| 8 | * | ||
| 9 | * Description: | ||
| 10 | * | ||
| 11 | * This file contains the check_nt plugin | ||
| 12 | * | ||
| 13 | * This plugin collects data from the NSClient service running on a | ||
| 14 | * Windows NT/2000/XP/2003 server. | ||
| 15 | * This plugin requires NSClient software to run on NT | ||
| 16 | * (http://nsclient.ready2run.nl/) | ||
| 17 | * | ||
| 18 | * | ||
| 19 | * This program is free software: you can redistribute it and/or modify | ||
| 20 | * it under the terms of the GNU General Public License as published by | ||
| 21 | * the Free Software Foundation, either version 3 of the License, or | ||
| 22 | * (at your option) any later version. | ||
| 23 | * | ||
| 24 | * This program is distributed in the hope that it will be useful, | ||
| 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 27 | * GNU General Public License for more details. | ||
| 28 | * | ||
| 29 | * You should have received a copy of the GNU General Public License | ||
| 30 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 31 | * | ||
| 32 | * | ||
| 33 | *****************************************************************************/ | ||
| 34 | |||
| 35 | const char *progname = "check_nt"; | ||
| 36 | const char *copyright = "2000-2007"; | ||
| 37 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 38 | |||
| 39 | #include "common.h" | ||
| 40 | #include "netutils.h" | ||
| 41 | #include "utils.h" | ||
| 42 | |||
| 43 | enum checkvars { | ||
| 44 | CHECK_NONE, | ||
| 45 | CHECK_CLIENTVERSION, | ||
| 46 | CHECK_CPULOAD, | ||
| 47 | CHECK_UPTIME, | ||
| 48 | CHECK_USEDDISKSPACE, | ||
| 49 | CHECK_SERVICESTATE, | ||
| 50 | CHECK_PROCSTATE, | ||
| 51 | CHECK_MEMUSE, | ||
| 52 | CHECK_COUNTER, | ||
| 53 | CHECK_FILEAGE, | ||
| 54 | CHECK_INSTANCES | ||
| 55 | }; | ||
| 56 | |||
| 57 | enum { | ||
| 58 | MAX_VALUE_LIST = 30, | ||
| 59 | PORT = 1248 | ||
| 60 | }; | ||
| 61 | |||
| 62 | char *server_address=NULL; | ||
| 63 | char *volume_name=NULL; | ||
| 64 | int server_port=PORT; | ||
| 65 | char *value_list=NULL; | ||
| 66 | char *req_password=NULL; | ||
| 67 | unsigned long lvalue_list[MAX_VALUE_LIST]; | ||
| 68 | unsigned long warning_value=0L; | ||
| 69 | unsigned long critical_value=0L; | ||
| 70 | int check_warning_value=FALSE; | ||
| 71 | int check_critical_value=FALSE; | ||
| 72 | enum checkvars vars_to_check = CHECK_NONE; | ||
| 73 | int show_all=FALSE; | ||
| 74 | |||
| 75 | char recv_buffer[MAX_INPUT_BUFFER]; | ||
| 76 | |||
| 77 | void fetch_data (const char* address, int port, const char* sendb); | ||
| 78 | int process_arguments(int, char **); | ||
| 79 | void preparelist(char *string); | ||
| 80 | int strtoularray(unsigned long *array, char *string, const char *delim); | ||
| 81 | void print_help(void); | ||
| 82 | void print_usage(void); | ||
| 83 | |||
| 84 | int main(int argc, char **argv){ | ||
| 85 | |||
| 86 | /* should be int result = STATE_UNKNOWN; */ | ||
| 87 | |||
| 88 | int return_code = STATE_UNKNOWN; | ||
| 89 | char *send_buffer=NULL; | ||
| 90 | char *output_message=NULL; | ||
| 91 | char *perfdata=NULL; | ||
| 92 | char *temp_string=NULL; | ||
| 93 | char *temp_string_perf=NULL; | ||
| 94 | char *description=NULL,*counter_unit = NULL; | ||
| 95 | char *minval = NULL, *maxval = NULL, *errcvt = NULL; | ||
| 96 | char *fds=NULL, *tds=NULL; | ||
| 97 | |||
| 98 | double total_disk_space=0; | ||
| 99 | double free_disk_space=0; | ||
| 100 | double percent_used_space=0; | ||
| 101 | double warning_used_space=0; | ||
| 102 | double critical_used_space=0; | ||
| 103 | double mem_commitLimit=0; | ||
| 104 | double mem_commitByte=0; | ||
| 105 | double fminval = 0, fmaxval = 0; | ||
| 106 | unsigned long utilization; | ||
| 107 | unsigned long uptime; | ||
| 108 | unsigned long age_in_minutes; | ||
| 109 | double counter_value = 0.0; | ||
| 110 | int offset=0; | ||
| 111 | int updays=0; | ||
| 112 | int uphours=0; | ||
| 113 | int upminutes=0; | ||
| 114 | |||
| 115 | int isPercent = FALSE; | ||
| 116 | int allRight = FALSE; | ||
| 117 | |||
| 118 | setlocale (LC_ALL, ""); | ||
| 119 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 120 | textdomain (PACKAGE); | ||
| 121 | |||
| 122 | /* Parse extra opts if any */ | ||
| 123 | argv=np_extra_opts (&argc, argv, progname); | ||
| 124 | |||
| 125 | if(process_arguments(argc,argv) == ERROR) | ||
| 126 | usage4 (_("Could not parse arguments")); | ||
| 127 | |||
| 128 | /* initialize alarm signal handling */ | ||
| 129 | signal(SIGALRM,socket_timeout_alarm_handler); | ||
| 130 | |||
| 131 | /* set socket timeout */ | ||
| 132 | alarm(socket_timeout); | ||
| 133 | |||
| 134 | switch (vars_to_check) { | ||
| 135 | |||
| 136 | case CHECK_CLIENTVERSION: | ||
| 137 | |||
| 138 | asprintf(&send_buffer, "%s&1", req_password); | ||
| 139 | fetch_data (server_address, server_port, send_buffer); | ||
| 140 | if (value_list != NULL && strcmp(recv_buffer, value_list) != 0) { | ||
| 141 | asprintf (&output_message, _("Wrong client version - running: %s, required: %s"), recv_buffer, value_list); | ||
| 142 | return_code = STATE_WARNING; | ||
| 143 | } else { | ||
| 144 | asprintf (&output_message, "%s", recv_buffer); | ||
| 145 | return_code = STATE_OK; | ||
| 146 | } | ||
| 147 | break; | ||
| 148 | |||
| 149 | case CHECK_CPULOAD: | ||
| 150 | |||
| 151 | if (value_list==NULL) | ||
| 152 | output_message = strdup (_("missing -l parameters")); | ||
| 153 | else if (strtoularray(lvalue_list,value_list,",")==FALSE) | ||
| 154 | output_message = strdup (_("wrong -l parameter.")); | ||
| 155 | else { | ||
| 156 | /* -l parameters is present with only integers */ | ||
| 157 | return_code=STATE_OK; | ||
| 158 | temp_string = strdup (_("CPU Load")); | ||
| 159 | temp_string_perf = strdup (" "); | ||
| 160 | |||
| 161 | /* loop until one of the parameters is wrong or not present */ | ||
| 162 | while (lvalue_list[0+offset]> (unsigned long)0 && | ||
| 163 | lvalue_list[0+offset]<=(unsigned long)17280 && | ||
| 164 | lvalue_list[1+offset]> (unsigned long)0 && | ||
| 165 | lvalue_list[1+offset]<=(unsigned long)100 && | ||
| 166 | lvalue_list[2+offset]> (unsigned long)0 && | ||
| 167 | lvalue_list[2+offset]<=(unsigned long)100) { | ||
| 168 | |||
| 169 | /* Send request and retrieve data */ | ||
| 170 | asprintf(&send_buffer,"%s&2&%lu",req_password,lvalue_list[0+offset]); | ||
| 171 | fetch_data (server_address, server_port, send_buffer); | ||
| 172 | |||
| 173 | utilization=strtoul(recv_buffer,NULL,10); | ||
| 174 | |||
| 175 | /* Check if any of the request is in a warning or critical state */ | ||
| 176 | if(utilization >= lvalue_list[2+offset]) | ||
| 177 | return_code=STATE_CRITICAL; | ||
| 178 | else if(utilization >= lvalue_list[1+offset] && return_code<STATE_WARNING) | ||
| 179 | return_code=STATE_WARNING; | ||
| 180 | |||
| 181 | asprintf(&output_message,_(" %lu%% (%lu min average)"), utilization, lvalue_list[0+offset]); | ||
| 182 | asprintf(&temp_string,"%s%s",temp_string,output_message); | ||
| 183 | asprintf(&perfdata,_(" '%lu min avg Load'=%lu%%;%lu;%lu;0;100"), lvalue_list[0+offset], utilization, | ||
| 184 | lvalue_list[1+offset], lvalue_list[2+offset]); | ||
| 185 | asprintf(&temp_string_perf,"%s%s",temp_string_perf,perfdata); | ||
| 186 | offset+=3; /* move across the array */ | ||
| 187 | } | ||
| 188 | |||
| 189 | if (strlen(temp_string)>10) { /* we had at least one loop */ | ||
| 190 | output_message = strdup (temp_string); | ||
| 191 | perfdata = temp_string_perf; | ||
| 192 | } else | ||
| 193 | output_message = strdup (_("not enough values for -l parameters")); | ||
| 194 | } | ||
| 195 | break; | ||
| 196 | |||
| 197 | case CHECK_UPTIME: | ||
| 198 | |||
| 199 | asprintf(&send_buffer, "%s&3", req_password); | ||
| 200 | fetch_data (server_address, server_port, send_buffer); | ||
| 201 | uptime=strtoul(recv_buffer,NULL,10); | ||
| 202 | updays = uptime / 86400; | ||
| 203 | uphours = (uptime % 86400) / 3600; | ||
| 204 | upminutes = ((uptime % 86400) % 3600) / 60; | ||
| 205 | asprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes); | ||
| 206 | return_code=STATE_OK; | ||
| 207 | break; | ||
| 208 | |||
| 209 | case CHECK_USEDDISKSPACE: | ||
| 210 | |||
| 211 | if (value_list==NULL) | ||
| 212 | output_message = strdup (_("missing -l parameters")); | ||
| 213 | else if (strlen(value_list)!=1) | ||
| 214 | output_message = strdup (_("wrong -l argument")); | ||
| 215 | else { | ||
| 216 | asprintf(&send_buffer,"%s&4&%s", req_password, value_list); | ||
| 217 | fetch_data (server_address, server_port, send_buffer); | ||
| 218 | fds=strtok(recv_buffer,"&"); | ||
| 219 | tds=strtok(NULL,"&"); | ||
| 220 | if(fds!=NULL) | ||
| 221 | free_disk_space=atof(fds); | ||
| 222 | if(tds!=NULL) | ||
| 223 | total_disk_space=atof(tds); | ||
| 224 | |||
| 225 | if (total_disk_space>0 && free_disk_space>=0) { | ||
| 226 | percent_used_space = ((total_disk_space - free_disk_space) / total_disk_space) * 100; | ||
| 227 | warning_used_space = ((float)warning_value / 100) * total_disk_space; | ||
| 228 | critical_used_space = ((float)critical_value / 100) * total_disk_space; | ||
| 229 | |||
| 230 | asprintf(&temp_string,_("%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)"), | ||
| 231 | value_list, total_disk_space / 1073741824, (total_disk_space - free_disk_space) / 1073741824, | ||
| 232 | percent_used_space, free_disk_space / 1073741824, (free_disk_space / total_disk_space)*100); | ||
| 233 | asprintf(&temp_string_perf,_("'%s:\\ Used Space'=%.2fGb;%.2f;%.2f;0.00;%.2f"), value_list, | ||
| 234 | (total_disk_space - free_disk_space) / 1073741824, warning_used_space / 1073741824, | ||
| 235 | critical_used_space / 1073741824, total_disk_space / 1073741824); | ||
| 236 | |||
| 237 | if(check_critical_value==TRUE && percent_used_space >= critical_value) | ||
| 238 | return_code=STATE_CRITICAL; | ||
| 239 | else if (check_warning_value==TRUE && percent_used_space >= warning_value) | ||
| 240 | return_code=STATE_WARNING; | ||
| 241 | else | ||
| 242 | return_code=STATE_OK; | ||
| 243 | |||
| 244 | output_message = strdup (temp_string); | ||
| 245 | perfdata = temp_string_perf; | ||
| 246 | } else { | ||
| 247 | output_message = strdup (_("Free disk space : Invalid drive")); | ||
| 248 | return_code=STATE_UNKNOWN; | ||
| 249 | } | ||
| 250 | } | ||
| 251 | break; | ||
| 252 | |||
| 253 | case CHECK_SERVICESTATE: | ||
| 254 | case CHECK_PROCSTATE: | ||
| 255 | |||
| 256 | if (value_list==NULL) | ||
| 257 | output_message = strdup (_("No service/process specified")); | ||
| 258 | else { | ||
| 259 | preparelist(value_list); /* replace , between services with & to send the request */ | ||
| 260 | asprintf(&send_buffer,"%s&%u&%s&%s", req_password,(vars_to_check==CHECK_SERVICESTATE)?5:6, | ||
| 261 | (show_all==TRUE) ? "ShowAll" : "ShowFail",value_list); | ||
| 262 | fetch_data (server_address, server_port, send_buffer); | ||
| 263 | if (strstr(recv_buffer, "&")) { | ||
| 264 | return_code=atoi(strtok(recv_buffer,"&")); | ||
| 265 | temp_string=strtok(NULL,"&"); | ||
| 266 | output_message = strdup (temp_string); | ||
| 267 | } else { | ||
| 268 | asprintf(&temp_string,"Remote server error:[%s]", recv_buffer); | ||
| 269 | output_message = temp_string; | ||
| 270 | return_code=STATE_UNKNOWN; | ||
| 271 | } | ||
| 272 | } | ||
| 273 | break; | ||
| 274 | |||
| 275 | case CHECK_MEMUSE: | ||
| 276 | |||
| 277 | asprintf(&send_buffer,"%s&7", req_password); | ||
| 278 | fetch_data (server_address, server_port, send_buffer); | ||
| 279 | mem_commitLimit=atof(strtok(recv_buffer,"&")); | ||
| 280 | mem_commitByte=atof(strtok(NULL,"&")); | ||
| 281 | percent_used_space = (mem_commitByte / mem_commitLimit) * 100; | ||
| 282 | warning_used_space = ((float)warning_value / 100) * mem_commitLimit; | ||
| 283 | critical_used_space = ((float)critical_value / 100) * mem_commitLimit; | ||
| 284 | |||
| 285 | /* Divisor should be 1048567, not 3044515, as we are measuring "Commit Charge" here, | ||
| 286 | which equals RAM + Pagefiles. */ | ||
| 287 | asprintf(&output_message,_("Memory usage: total:%.2f Mb - used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)"), | ||
| 288 | mem_commitLimit / 1048567, mem_commitByte / 1048567, percent_used_space, | ||
| 289 | (mem_commitLimit - mem_commitByte) / 1048567, (mem_commitLimit - mem_commitByte) / mem_commitLimit * 100); | ||
| 290 | asprintf(&perfdata,_("'Memory usage'=%.2fMb;%.2f;%.2f;0.00;%.2f"), mem_commitByte / 1048567, | ||
| 291 | warning_used_space / 1048567, critical_used_space / 1048567, mem_commitLimit / 1048567); | ||
| 292 | |||
| 293 | return_code=STATE_OK; | ||
| 294 | if(check_critical_value==TRUE && percent_used_space >= critical_value) | ||
| 295 | return_code=STATE_CRITICAL; | ||
| 296 | else if (check_warning_value==TRUE && percent_used_space >= warning_value) | ||
| 297 | return_code=STATE_WARNING; | ||
| 298 | |||
| 299 | break; | ||
| 300 | |||
| 301 | case CHECK_COUNTER: | ||
| 302 | |||
| 303 | |||
| 304 | /* | ||
| 305 | CHECK_COUNTER has been modified to provide extensive perfdata information. | ||
| 306 | In order to do this, some modifications have been done to the code | ||
| 307 | and some constraints have been introduced. | ||
| 308 | |||
| 309 | 1) For the sake of simplicity of the code, perfdata information will only be | ||
| 310 | provided when the "description" field is added. | ||
| 311 | |||
| 312 | 2) If the counter you're going to measure is percent-based, the code will detect | ||
| 313 | the percent sign in its name and will attribute minimum (0%) and maximum (100%) | ||
| 314 | values automagically, as well the %" sign to graph units. | ||
| 315 | |||
| 316 | 3) OTOH, if the counter is "absolute", you'll have to provide the following | ||
| 317 | the counter unit - that is, the dimensions of the counter you're getting. Examples: | ||
| 318 | pages/s, packets transferred, etc. | ||
| 319 | |||
| 320 | 4) If you want, you may provide the minimum and maximum values to expect. They aren't mandatory, | ||
| 321 | but once specified they MUST have the same order of magnitude and units of -w and -c; otherwise. | ||
| 322 | strange things will happen when you make graphs of your data. | ||
| 323 | */ | ||
| 324 | |||
| 325 | if (value_list == NULL) | ||
| 326 | output_message = strdup (_("No counter specified")); | ||
| 327 | else | ||
| 328 | { | ||
| 329 | preparelist (value_list); /* replace , between services with & to send the request */ | ||
| 330 | isPercent = (strchr (value_list, '%') != NULL); | ||
| 331 | |||
| 332 | strtok (value_list, "&"); /* burn the first parameters */ | ||
| 333 | description = strtok (NULL, "&"); | ||
| 334 | counter_unit = strtok (NULL, "&"); | ||
| 335 | asprintf (&send_buffer, "%s&8&%s", req_password, value_list); | ||
| 336 | fetch_data (server_address, server_port, send_buffer); | ||
| 337 | counter_value = atof (recv_buffer); | ||
| 338 | |||
| 339 | if (description == NULL) | ||
| 340 | asprintf (&output_message, "%.f", counter_value); | ||
| 341 | else if (isPercent) | ||
| 342 | { | ||
| 343 | counter_unit = strdup ("%"); | ||
| 344 | allRight = TRUE; | ||
| 345 | } | ||
| 346 | |||
| 347 | if ((counter_unit != NULL) && (!allRight)) | ||
| 348 | { | ||
| 349 | minval = strtok (NULL, "&"); | ||
| 350 | maxval = strtok (NULL, "&"); | ||
| 351 | |||
| 352 | /* All parameters specified. Let's check the numbers */ | ||
| 353 | |||
| 354 | fminval = (minval != NULL) ? strtod (minval, &errcvt) : -1; | ||
| 355 | fmaxval = (minval != NULL) ? strtod (maxval, &errcvt) : -1; | ||
| 356 | |||
| 357 | if ((fminval == 0) && (minval == errcvt)) | ||
| 358 | output_message = strdup (_("Minimum value contains non-numbers")); | ||
| 359 | else | ||
| 360 | { | ||
| 361 | if ((fmaxval == 0) && (maxval == errcvt)) | ||
| 362 | output_message = strdup (_("Maximum value contains non-numbers")); | ||
| 363 | else | ||
| 364 | allRight = TRUE; /* Everything is OK. */ | ||
| 365 | |||
| 366 | } | ||
| 367 | } | ||
| 368 | else if ((counter_unit == NULL) && (description != NULL)) | ||
| 369 | output_message = strdup (_("No unit counter specified")); | ||
| 370 | |||
| 371 | if (allRight) | ||
| 372 | { | ||
| 373 | /* Let's format the output string, finally... */ | ||
| 374 | if (strstr(description, "%") == NULL) { | ||
| 375 | asprintf (&output_message, "%s = %.2f %s", description, counter_value, counter_unit); | ||
| 376 | } else { | ||
| 377 | /* has formatting, will segv if wrong */ | ||
| 378 | asprintf (&output_message, description, counter_value); | ||
| 379 | } | ||
| 380 | asprintf (&output_message, "%s |", output_message); | ||
| 381 | asprintf (&output_message,"%s %s", output_message, | ||
| 382 | fperfdata (description, counter_value, | ||
| 383 | counter_unit, 1, warning_value, 1, critical_value, | ||
| 384 | (!(isPercent) && (minval != NULL)), fminval, | ||
| 385 | (!(isPercent) && (minval != NULL)), fmaxval)); | ||
| 386 | } | ||
| 387 | } | ||
| 388 | |||
| 389 | if (critical_value > warning_value) | ||
| 390 | { /* Normal thresholds */ | ||
| 391 | if (check_critical_value == TRUE && counter_value >= critical_value) | ||
| 392 | return_code = STATE_CRITICAL; | ||
| 393 | else if (check_warning_value == TRUE && counter_value >= warning_value) | ||
| 394 | return_code = STATE_WARNING; | ||
| 395 | else | ||
| 396 | return_code = STATE_OK; | ||
| 397 | } | ||
| 398 | else | ||
| 399 | { /* inverse thresholds */ | ||
| 400 | return_code = STATE_OK; | ||
| 401 | if (check_critical_value == TRUE && counter_value <= critical_value) | ||
| 402 | return_code = STATE_CRITICAL; | ||
| 403 | else if (check_warning_value == TRUE && counter_value <= warning_value) | ||
| 404 | return_code = STATE_WARNING; | ||
| 405 | } | ||
| 406 | break; | ||
| 407 | |||
| 408 | case CHECK_FILEAGE: | ||
| 409 | |||
| 410 | if (value_list==NULL) | ||
| 411 | output_message = strdup (_("No counter specified")); | ||
| 412 | else { | ||
| 413 | preparelist(value_list); /* replace , between services with & to send the request */ | ||
| 414 | asprintf(&send_buffer,"%s&9&%s", req_password,value_list); | ||
| 415 | fetch_data (server_address, server_port, send_buffer); | ||
| 416 | age_in_minutes = atoi(strtok(recv_buffer,"&")); | ||
| 417 | description = strtok(NULL,"&"); | ||
| 418 | output_message = strdup (description); | ||
| 419 | |||
| 420 | if (critical_value > warning_value) { /* Normal thresholds */ | ||
| 421 | if(check_critical_value==TRUE && age_in_minutes >= critical_value) | ||
| 422 | return_code=STATE_CRITICAL; | ||
| 423 | else if (check_warning_value==TRUE && age_in_minutes >= warning_value) | ||
| 424 | return_code=STATE_WARNING; | ||
| 425 | else | ||
| 426 | return_code=STATE_OK; | ||
| 427 | } | ||
| 428 | else { /* inverse thresholds */ | ||
| 429 | if(check_critical_value==TRUE && age_in_minutes <= critical_value) | ||
| 430 | return_code=STATE_CRITICAL; | ||
| 431 | else if (check_warning_value==TRUE && age_in_minutes <= warning_value) | ||
| 432 | return_code=STATE_WARNING; | ||
| 433 | else | ||
| 434 | return_code=STATE_OK; | ||
| 435 | } | ||
| 436 | } | ||
| 437 | break; | ||
| 438 | |||
| 439 | case CHECK_INSTANCES: | ||
| 440 | if (value_list==NULL) | ||
| 441 | output_message = strdup (_("No counter specified")); | ||
| 442 | else { | ||
| 443 | asprintf(&send_buffer,"%s&10&%s", req_password,value_list); | ||
| 444 | fetch_data (server_address, server_port, send_buffer); | ||
| 445 | if (!strncmp(recv_buffer,"ERROR",5)) { | ||
| 446 | printf("NSClient - %s\n",recv_buffer); | ||
| 447 | exit(STATE_UNKNOWN); | ||
| 448 | } | ||
| 449 | asprintf(&output_message,"%s",recv_buffer); | ||
| 450 | return_code=STATE_OK; | ||
| 451 | } | ||
| 452 | break; | ||
| 453 | |||
| 454 | case CHECK_NONE: | ||
| 455 | default: | ||
| 456 | usage4 (_("Please specify a variable to check")); | ||
| 457 | break; | ||
| 458 | |||
| 459 | } | ||
| 460 | |||
| 461 | /* reset timeout */ | ||
| 462 | alarm(0); | ||
| 463 | |||
| 464 | if (perfdata==NULL) | ||
| 465 | printf("%s\n",output_message); | ||
| 466 | else | ||
| 467 | printf("%s | %s\n",output_message,perfdata); | ||
| 468 | return return_code; | ||
| 469 | } | ||
| 470 | |||
| 471 | |||
| 472 | |||
| 473 | /* process command-line arguments */ | ||
| 474 | int process_arguments(int argc, char **argv){ | ||
| 475 | int c; | ||
| 476 | |||
| 477 | int option = 0; | ||
| 478 | static struct option longopts[] = | ||
| 479 | { | ||
| 480 | {"port", required_argument,0,'p'}, | ||
| 481 | {"timeout", required_argument,0,'t'}, | ||
| 482 | {"critical", required_argument,0,'c'}, | ||
| 483 | {"warning", required_argument,0,'w'}, | ||
| 484 | {"variable", required_argument,0,'v'}, | ||
| 485 | {"hostname", required_argument,0,'H'}, | ||
| 486 | {"params", required_argument,0,'l'}, | ||
| 487 | {"secret", required_argument,0,'s'}, | ||
| 488 | {"display", required_argument,0,'d'}, | ||
| 489 | {"unknown-timeout", no_argument, 0, 'u'}, | ||
| 490 | {"version", no_argument, 0,'V'}, | ||
| 491 | {"help", no_argument, 0,'h'}, | ||
| 492 | {0,0,0,0} | ||
| 493 | }; | ||
| 494 | |||
| 495 | /* no options were supplied */ | ||
| 496 | if(argc<2) return ERROR; | ||
| 497 | |||
| 498 | /* backwards compatibility */ | ||
| 499 | if (! is_option(argv[1])) { | ||
| 500 | server_address = strdup(argv[1]); | ||
| 501 | argv[1]=argv[0]; | ||
| 502 | argv=&argv[1]; | ||
| 503 | argc--; | ||
| 504 | } | ||
| 505 | |||
| 506 | for (c=1;c<argc;c++) { | ||
| 507 | if(strcmp("-to",argv[c])==0) | ||
| 508 | strcpy(argv[c],"-t"); | ||
| 509 | else if (strcmp("-wv",argv[c])==0) | ||
| 510 | strcpy(argv[c],"-w"); | ||
| 511 | else if (strcmp("-cv",argv[c])==0) | ||
| 512 | strcpy(argv[c],"-c"); | ||
| 513 | } | ||
| 514 | |||
| 515 | while (1) { | ||
| 516 | c = getopt_long(argc,argv,"+hVH:t:c:w:p:v:l:s:d:u",longopts,&option); | ||
| 517 | |||
| 518 | if (c==-1||c==EOF||c==1) | ||
| 519 | break; | ||
| 520 | |||
| 521 | switch (c) { | ||
| 522 | case '?': /* print short usage statement if args not parsable */ | ||
| 523 | usage5 (); | ||
| 524 | case 'h': /* help */ | ||
| 525 | print_help(); | ||
| 526 | exit(STATE_OK); | ||
| 527 | case 'V': /* version */ | ||
| 528 | print_revision(progname, NP_VERSION); | ||
| 529 | exit(STATE_OK); | ||
| 530 | case 'H': /* hostname */ | ||
| 531 | server_address = optarg; | ||
| 532 | break; | ||
| 533 | case 's': /* password */ | ||
| 534 | req_password = optarg; | ||
| 535 | break; | ||
| 536 | case 'p': /* port */ | ||
| 537 | if (is_intnonneg(optarg)) | ||
| 538 | server_port=atoi(optarg); | ||
| 539 | else | ||
| 540 | die(STATE_UNKNOWN,_("Server port must be an integer\n")); | ||
| 541 | break; | ||
| 542 | case 'v': | ||
| 543 | if(strlen(optarg)<4) | ||
| 544 | return ERROR; | ||
| 545 | if(!strcmp(optarg,"CLIENTVERSION")) | ||
| 546 | vars_to_check=CHECK_CLIENTVERSION; | ||
| 547 | else if(!strcmp(optarg,"CPULOAD")) | ||
| 548 | vars_to_check=CHECK_CPULOAD; | ||
| 549 | else if(!strcmp(optarg,"UPTIME")) | ||
| 550 | vars_to_check=CHECK_UPTIME; | ||
| 551 | else if(!strcmp(optarg,"USEDDISKSPACE")) | ||
| 552 | vars_to_check=CHECK_USEDDISKSPACE; | ||
| 553 | else if(!strcmp(optarg,"SERVICESTATE")) | ||
| 554 | vars_to_check=CHECK_SERVICESTATE; | ||
| 555 | else if(!strcmp(optarg,"PROCSTATE")) | ||
| 556 | vars_to_check=CHECK_PROCSTATE; | ||
| 557 | else if(!strcmp(optarg,"MEMUSE")) | ||
| 558 | vars_to_check=CHECK_MEMUSE; | ||
| 559 | else if(!strcmp(optarg,"COUNTER")) | ||
| 560 | vars_to_check=CHECK_COUNTER; | ||
| 561 | else if(!strcmp(optarg,"FILEAGE")) | ||
| 562 | vars_to_check=CHECK_FILEAGE; | ||
| 563 | else if(!strcmp(optarg,"INSTANCES")) | ||
| 564 | vars_to_check=CHECK_INSTANCES; | ||
| 565 | else | ||
| 566 | return ERROR; | ||
| 567 | break; | ||
| 568 | case 'l': /* value list */ | ||
| 569 | value_list = optarg; | ||
| 570 | break; | ||
| 571 | case 'w': /* warning threshold */ | ||
| 572 | warning_value=strtoul(optarg,NULL,10); | ||
| 573 | check_warning_value=TRUE; | ||
| 574 | break; | ||
| 575 | case 'c': /* critical threshold */ | ||
| 576 | critical_value=strtoul(optarg,NULL,10); | ||
| 577 | check_critical_value=TRUE; | ||
| 578 | break; | ||
| 579 | case 'd': /* Display select for services */ | ||
| 580 | if (!strcmp(optarg,"SHOWALL")) | ||
| 581 | show_all = TRUE; | ||
| 582 | break; | ||
| 583 | case 'u': | ||
| 584 | socket_timeout_state=STATE_UNKNOWN; | ||
| 585 | break; | ||
| 586 | case 't': /* timeout */ | ||
| 587 | socket_timeout=atoi(optarg); | ||
| 588 | if(socket_timeout<=0) | ||
| 589 | return ERROR; | ||
| 590 | } | ||
| 591 | |||
| 592 | } | ||
| 593 | if (server_address == NULL) | ||
| 594 | usage4 (_("You must provide a server address or host name")); | ||
| 595 | |||
| 596 | if (vars_to_check==CHECK_NONE) | ||
| 597 | return ERROR; | ||
| 598 | |||
| 599 | if (req_password == NULL) | ||
| 600 | req_password = strdup (_("None")); | ||
| 601 | |||
| 602 | return OK; | ||
| 603 | } | ||
| 604 | |||
| 605 | |||
| 606 | |||
| 607 | void fetch_data (const char *address, int port, const char *sendb) { | ||
| 608 | int result; | ||
| 609 | |||
| 610 | result=process_tcp_request(address, port, sendb, recv_buffer,sizeof(recv_buffer)); | ||
| 611 | |||
| 612 | if(result!=STATE_OK) | ||
| 613 | die (result, _("could not fetch information from server\n")); | ||
| 614 | |||
| 615 | if (!strncmp(recv_buffer,"ERROR",5)) | ||
| 616 | die (STATE_UNKNOWN, "NSClient - %s\n",recv_buffer); | ||
| 617 | } | ||
| 618 | |||
| 619 | int strtoularray(unsigned long *array, char *string, const char *delim) { | ||
| 620 | /* split a <delim> delimited string into a long array */ | ||
| 621 | int idx=0; | ||
| 622 | char *t1; | ||
| 623 | |||
| 624 | for (idx=0;idx<MAX_VALUE_LIST;idx++) | ||
| 625 | array[idx]=0; | ||
| 626 | |||
| 627 | idx=0; | ||
| 628 | for(t1 = strtok(string,delim);t1 != NULL; t1 = strtok(NULL, delim)) { | ||
| 629 | if (is_numeric(t1) && idx<MAX_VALUE_LIST) { | ||
| 630 | array[idx]=strtoul(t1,NULL,10); | ||
| 631 | idx++; | ||
| 632 | } else | ||
| 633 | return FALSE; | ||
| 634 | } | ||
| 635 | return TRUE; | ||
| 636 | } | ||
| 637 | |||
| 638 | void preparelist(char *string) { | ||
| 639 | /* Replace all , with & which is the delimiter for the request */ | ||
| 640 | int i; | ||
| 641 | |||
| 642 | for (i = 0; (size_t)i < strlen(string); i++) | ||
| 643 | if (string[i] == ',') { | ||
| 644 | string[i]='&'; | ||
| 645 | } | ||
| 646 | } | ||
| 647 | |||
| 648 | |||
| 649 | |||
| 650 | void print_help(void) | ||
| 651 | { | ||
| 652 | print_revision(progname, NP_VERSION); | ||
| 653 | |||
| 654 | printf ("Copyright (c) 2000 Yves Rubin (rubiyz@yahoo.com)\n"); | ||
| 655 | printf (COPYRIGHT, copyright, email); | ||
| 656 | |||
| 657 | printf ("%s\n", _("This plugin collects data from the NSClient service running on a")); | ||
| 658 | printf ("%s\n", _("Windows NT/2000/XP/2003 server.")); | ||
| 659 | |||
| 660 | printf ("\n\n"); | ||
| 661 | |||
| 662 | print_usage(); | ||
| 663 | |||
| 664 | printf (_(UT_HELP_VRSN)); | ||
| 665 | printf (_(UT_EXTRA_OPTS)); | ||
| 666 | |||
| 667 | printf ("%s\n", _("Options:")); | ||
| 668 | printf (" %s\n", "-H, --hostname=HOST"); | ||
| 669 | printf (" %s\n", _("Name of the host to check")); | ||
| 670 | printf (" %s\n", "-p, --port=INTEGER"); | ||
| 671 | printf (" %s", _("Optional port number (default: ")); | ||
| 672 | printf ("%d)\n", PORT); | ||
| 673 | printf (" %s\n", "-s, --secret=<password>"); | ||
| 674 | printf (" %s\n", _("Password needed for the request")); | ||
| 675 | printf (" %s\n", "-w, --warning=INTEGER"); | ||
| 676 | printf (" %s\n", _("Threshold which will result in a warning status")); | ||
| 677 | printf (" %s\n", "-c, --critical=INTEGER"); | ||
| 678 | printf (" %s\n", _("Threshold which will result in a critical status")); | ||
| 679 | printf (" %s\n", "-t, --timeout=INTEGER"); | ||
| 680 | printf (" %s", _("Seconds before connection attempt times out (default: ")); | ||
| 681 | printf (" %s\n", "-l, --params=<parameters>"); | ||
| 682 | printf (" %s", _("Parameters passed to specified check (see below)")); | ||
| 683 | printf (" %s\n", "-d, --display={SHOWALL}"); | ||
| 684 | printf (" %s", _("Display options (currently only SHOWALL works)")); | ||
| 685 | printf (" %s\n", "-u, --unknown-timeout"); | ||
| 686 | printf (" %s", _("Return UNKNOWN on timeouts")); | ||
| 687 | printf ("%d)\n", DEFAULT_SOCKET_TIMEOUT); | ||
| 688 | printf (" %s\n", "-h, --help"); | ||
| 689 | printf (" %s\n", _("Print this help screen")); | ||
| 690 | printf (" %s\n", "-V, --version"); | ||
| 691 | printf (" %s\n", _("Print version information")); | ||
| 692 | printf (" %s\n", "-v, --variable=STRING"); | ||
| 693 | printf (" %s\n\n", _("Variable to check")); | ||
| 694 | printf ("%s\n", _("Valid variables are:")); | ||
| 695 | printf (" %s", "CLIENTVERSION ="); | ||
| 696 | printf (" %s\n", _("Get the NSClient version")); | ||
| 697 | printf (" %s\n", _("If -l <version> is specified, will return warning if versions differ.")); | ||
| 698 | printf (" %s\n", "CPULOAD ="); | ||
| 699 | printf (" %s\n", _("Average CPU load on last x minutes.")); | ||
| 700 | printf (" %s\n", _("Request a -l parameter with the following syntax:")); | ||
| 701 | printf (" %s\n", _("-l <minutes range>,<warning threshold>,<critical threshold>.")); | ||
| 702 | printf (" %s\n", _("<minute range> should be less than 24*60.")); | ||
| 703 | printf (" %s\n", _("Thresholds are percentage and up to 10 requests can be done in one shot.")); | ||
| 704 | printf (" %s\n", "ie: -l 60,90,95,120,90,95"); | ||
| 705 | printf (" %s\n", "UPTIME ="); | ||
| 706 | printf (" %s\n", _("Get the uptime of the machine.")); | ||
| 707 | printf (" %s\n", _("No specific parameters. No warning or critical threshold")); | ||
| 708 | printf (" %s\n", "USEDDISKSPACE ="); | ||
| 709 | printf (" %s\n", _("Size and percentage of disk use.")); | ||
| 710 | printf (" %s\n", _("Request a -l parameter containing the drive letter only.")); | ||
| 711 | printf (" %s\n", _("Warning and critical thresholds can be specified with -w and -c.")); | ||
| 712 | printf (" %s\n", "MEMUSE ="); | ||
| 713 | printf (" %s\n", _("Memory use.")); | ||
| 714 | printf (" %s\n", _("Warning and critical thresholds can be specified with -w and -c.")); | ||
| 715 | printf (" %s\n", "SERVICESTATE ="); | ||
| 716 | printf (" %s\n", _("Check the state of one or several services.")); | ||
| 717 | printf (" %s\n", _("Request a -l parameters with the following syntax:")); | ||
| 718 | printf (" %s\n", _("-l <service1>,<service2>,<service3>,...")); | ||
| 719 | printf (" %s\n", _("You can specify -d SHOWALL in case you want to see working services")); | ||
| 720 | printf (" %s\n", _("in the returned string.")); | ||
| 721 | printf (" %s\n", "PROCSTATE ="); | ||
| 722 | printf (" %s\n", _("Check if one or several process are running.")); | ||
| 723 | printf (" %s\n", _("Same syntax as SERVICESTATE.")); | ||
| 724 | printf (" %s\n", "COUNTER ="); | ||
| 725 | printf (" %s\n", _("Check any performance counter of Windows NT/2000.")); | ||
| 726 | printf (" %s\n", _("Request a -l parameters with the following syntax:")); | ||
| 727 | printf (" %s\n", _("-l \"\\\\<performance object>\\\\counter\",\"<description>")); | ||
| 728 | printf (" %s\n", _("The <description> parameter is optional and is given to a printf ")); | ||
| 729 | printf (" %s\n", _("output command which requires a float parameter.")); | ||
| 730 | printf (" %s\n", _("If <description> does not include \"%%\", it is used as a label.")); | ||
| 731 | printf (" %s\n", _("Some examples:")); | ||
| 732 | printf (" %s\n", "\"Paging file usage is %%.2f %%%%\""); | ||
| 733 | printf (" %s\n", "\"%%.f %%%% paging file used.\""); | ||
| 734 | printf (" %s\n", "INSTANCES ="); | ||
| 735 | printf (" %s\n", _("Check any performance counter object of Windows NT/2000.")); | ||
| 736 | printf (" %s\n", _("Syntax: check_nt -H <hostname> -p <port> -v INSTANCES -l <counter object>")); | ||
| 737 | printf (" %s\n", _("<counter object> is a Windows Perfmon Counter object (eg. Process),")); | ||
| 738 | printf (" %s\n", _("if it is two words, it should be enclosed in quotes")); | ||
| 739 | printf (" %s\n", _("The returned results will be a comma-separated list of instances on ")); | ||
| 740 | printf (" %s\n", _(" the selected computer for that object.")); | ||
| 741 | printf (" %s\n", _("The purpose of this is to be run from command line to determine what instances")); | ||
| 742 | printf (" %s\n", _(" are available for monitoring without having to log onto the Windows server")); | ||
| 743 | printf (" %s\n", _(" to run Perfmon directly.")); | ||
| 744 | printf (" %s\n", _("It can also be used in scripts that automatically create Nagios service")); | ||
| 745 | printf (" %s\n", _(" configuration files.")); | ||
| 746 | printf (" %s\n", _("Some examples:")); | ||
| 747 | printf (" %s\n\n", _("check_nt -H 192.168.1.1 -p 1248 -v INSTANCES -l Process")); | ||
| 748 | |||
| 749 | printf ("%s\n", _("Notes:")); | ||
| 750 | printf (" %s\n", _("- The NSClient service should be running on the server to get any information")); | ||
| 751 | printf (" %s\n", "(http://nsclient.ready2run.nl)."); | ||
| 752 | printf (" %s\n", _("- Critical thresholds should be lower than warning thresholds")); | ||
| 753 | printf (" %s\n", _("- Default port 1248 is sometimes in use by other services. The error")); | ||
| 754 | printf (" %s\n", _("output when this happens contains \"Cannot map xxxxx to protocol number\".")); | ||
| 755 | printf (" %s\n", _("One fix for this is to change the port to something else on check_nt ")); | ||
| 756 | printf (" %s\n", _("and on the client service it\'s connecting to.")); | ||
| 757 | #ifdef NP_EXTRA_OPTS | ||
| 758 | printf (" -%s", _(UT_EXTRA_OPTS_NOTES)); | ||
| 759 | #endif | ||
| 760 | |||
| 761 | printf (_(UT_SUPPORT)); | ||
| 762 | } | ||
| 763 | |||
| 764 | |||
| 765 | |||
| 766 | void print_usage(void) | ||
| 767 | { | ||
| 768 | printf (_("Usage:")); | ||
| 769 | printf ("%s -H host -v variable [-p port] [-w warning] [-c critical]\n",progname); | ||
| 770 | printf ("[-l params] [-d SHOWALL] [-u] [-t timeout]\n"); | ||
| 771 | } | ||
| 772 | |||
diff --git a/web/attachments/37289-nagiosplugins-cvs-20021210-ipv6.diff b/web/attachments/37289-nagiosplugins-cvs-20021210-ipv6.diff new file mode 100644 index 0000000..bc3a280 --- /dev/null +++ b/web/attachments/37289-nagiosplugins-cvs-20021210-ipv6.diff | |||
| @@ -0,0 +1,609 @@ | |||
| 1 | Index: configure.in | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/configure.in,v | ||
| 4 | retrieving revision 1.29 | ||
| 5 | diff -u -r1.29 configure.in | ||
| 6 | --- configure.in 22 Nov 2002 02:46:49 -0000 1.29 | ||
| 7 | +++ configure.in 10 Dec 2002 19:43:09 -0000 | ||
| 8 | @@ -703,6 +703,57 @@ | ||
| 9 | fi | ||
| 10 | AC_DEFINE_UNQUOTED(PING_COMMAND,"$PING_COMMAND",[path and args for ping command]) | ||
| 11 | |||
| 12 | +AC_PATH_PROG(PATH_TO_PING6,ping6) | ||
| 13 | + | ||
| 14 | +AC_ARG_WITH(ping6_command,--with-ping6-command=<syntax> sets syntax for ping,PING6_COMMAND=$withval) | ||
| 15 | +if test -n "$PING6_COMMAND" | ||
| 16 | +then | ||
| 17 | + echo " ping6 syntax... (command-line) $PING6_COMMAND" | ||
| 18 | + if test -n "$PING6_PACKETS_FIRST" | ||
| 19 | + then | ||
| 20 | + AC_DEFINE_UNQUOTED(PING6_PACKETS_FIRST,"$PING6_COMMAND",[Define if packet count must precede host]) | ||
| 21 | + fi | ||
| 22 | +elif [ping6 -n -U -c 1 ::1 2>/dev/null | egrep -i "^round-trip|^rtt" >/dev/null] | ||
| 23 | +then | ||
| 24 | + PING6_COMMAND="$PATH_TO_PING6 -n -U -c %d %s" | ||
| 25 | + AC_DEFINE_UNQUOTED(PING6_PACKETS_FIRST,"$PING6_COMMAND",[Define if packet count must precede host]) | ||
| 26 | + echo " ping6 syntax... $PATH_TO_PING6 -n -U -c <count> <host>" | ||
| 27 | +elif [ping6 -n -c 1 ::1 2>/dev/null | egrep -i "^round-trip|^rtt" >/dev/null] | ||
| 28 | +then | ||
| 29 | + PING6_COMMAND="$PATH_TO_PING6 -n -c %d %s" | ||
| 30 | + AC_DEFINE_UNQUOTED(PING6_PACKETS_FIRST,"$PING6_COMMAND",[Define if packet count must precede host]) | ||
| 31 | + echo " ping6 syntax... $PATH_TO_PING6 -n -c <count> <host>" | ||
| 32 | +elif [ping6 -n ::1 -c 1 2>/dev/null | egrep -i "^round-trip|^rtt" >/dev/null] | ||
| 33 | +then | ||
| 34 | + PING6_COMMAND="$PATH_TO_PING6 -n %s -c %d" | ||
| 35 | + echo " ping6 syntax... $PATH_TO_PING6 -n <host> -c <count>" | ||
| 36 | +elif [ping6 ::1 -n 1 2>/dev/null | egrep -i "^round-trip|^rtt" >/dev/null] | ||
| 37 | +then | ||
| 38 | + PING6_COMMAND="$PATH_TO_PING6 %s -n %d" | ||
| 39 | + echo " ping6 syntax... $PATH_TO_PING6 <host> -n <count>" | ||
| 40 | +elif [ping6 -n -s ::1 56 1 2>/dev/null | egrep -i "^round-trip|^rtt" >/dev/null] | ||
| 41 | +then | ||
| 42 | + PING6_COMMAND="$PATH_TO_PING6 -n -s %s 56 %d" | ||
| 43 | + echo " ping6 syntax... $PATH_TO_PING6 -n -s <host> 56 <count>" | ||
| 44 | +elif [ping6 -n -h ::1 -s 56 -c 1 2>/dev/null | egrep -i "^round-trip|^rtt" >/dev/null] | ||
| 45 | +then | ||
| 46 | + PING6_COMMAND="$PATH_TO_PING6 -n -h %s -s 56 -c %d" | ||
| 47 | + echo " ping6 syntax... $PATH_TO_PING6 -n -h <host> -s 56 -c <count>" | ||
| 48 | +elif [ping6 -n -s 56 -c 1 ::1 2>/dev/null | egrep -i "^round-trip|^rtt" >/dev/null] | ||
| 49 | +then | ||
| 50 | + PING6_COMMAND="$PATH_TO_PING6 -n -s 56 -c %d %s" | ||
| 51 | + AC_DEFINE_UNQUOTED(PING6_PACKETS_FIRST,"$PING6_COMMAND",[Define if packet count must precede host]) | ||
| 52 | + echo " ping6 syntax... $PATH_TO_PING6 -n -s 56 -c <count> <host>" | ||
| 53 | +elif [ping6 -n -c 1 ::1 2>/dev/null | egrep -i "^round-trip|^rtt" >/dev/null] | ||
| 54 | +then | ||
| 55 | + PING6_COMMAND="$PATH_TO_PING6 -n -c %d %s" | ||
| 56 | + AC_DEFINE_UNQUOTED(PING6_PACKETS_FIRST,"$PING6_COMMAND",[Define if packet count must precede host]) | ||
| 57 | + echo " ping6 syntax... $PATH_TO_PING6 -n -c <count> <host>" | ||
| 58 | +else | ||
| 59 | + AC_MSG_WARN("unable to find usable ping6 syntax") | ||
| 60 | +fi | ||
| 61 | +AC_DEFINE_UNQUOTED(PING6_COMMAND,"$PING6_COMMAND",[path and args for ping command]) | ||
| 62 | + | ||
| 63 | AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup) | ||
| 64 | if test -n "$ac_cv_path_PATH_TO_NSLOOKUP" | ||
| 65 | then | ||
| 66 | Index: plugins/check_dig.c | ||
| 67 | =================================================================== | ||
| 68 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_dig.c,v | ||
| 69 | retrieving revision 1.7 | ||
| 70 | diff -u -r1.7 check_dig.c | ||
| 71 | --- plugins/check_dig.c 21 Nov 2002 12:40:58 -0000 1.7 | ||
| 72 | +++ plugins/check_dig.c 10 Dec 2002 19:43:09 -0000 | ||
| 73 | @@ -57,7 +57,7 @@ | ||
| 74 | usage ("Could not parse arguments\n"); | ||
| 75 | |||
| 76 | /* get the command to run */ | ||
| 77 | - asprintf (&command_line, "%s @%s %s", PATH_TO_DIG, dns_server, query_address); | ||
| 78 | + asprintf (&command_line, "%s -t any @%s %s", PATH_TO_DIG, dns_server, query_address); | ||
| 79 | |||
| 80 | alarm (timeout_interval); | ||
| 81 | time (&start_time); | ||
| 82 | Index: plugins/check_dns.c | ||
| 83 | =================================================================== | ||
| 84 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_dns.c,v | ||
| 85 | retrieving revision 1.5 | ||
| 86 | diff -u -r1.5 check_dns.c | ||
| 87 | --- plugins/check_dns.c 14 Nov 2002 02:26:34 -0000 1.5 | ||
| 88 | +++ plugins/check_dns.c 10 Dec 2002 19:43:10 -0000 | ||
| 89 | @@ -308,7 +308,7 @@ | ||
| 90 | timeout_interval = atoi (optarg); | ||
| 91 | break; | ||
| 92 | case 'H': /* hostname */ | ||
| 93 | - if (is_host (optarg) == FALSE) { | ||
| 94 | + if ((is_host (optarg)) == FALSE) { | ||
| 95 | printf ("Invalid host name/address\n\n"); | ||
| 96 | print_usage (); | ||
| 97 | exit (STATE_UNKNOWN); | ||
| 98 | @@ -318,7 +318,7 @@ | ||
| 99 | strcpy (query_address, optarg); | ||
| 100 | break; | ||
| 101 | case 's': /* server name */ | ||
| 102 | - if (is_host (optarg) == FALSE) { | ||
| 103 | + if ((is_host (optarg)) == FALSE) { | ||
| 104 | printf ("Invalid server name/address\n\n"); | ||
| 105 | print_usage (); | ||
| 106 | exit (STATE_UNKNOWN); | ||
| 107 | @@ -328,7 +328,7 @@ | ||
| 108 | strcpy (dns_server, optarg); | ||
| 109 | break; | ||
| 110 | case 'r': /* reverse server name */ | ||
| 111 | - if (is_host (optarg) == FALSE) { | ||
| 112 | + if ((is_host (optarg)) == FALSE) { | ||
| 113 | printf ("Invalid host name/address\n\n"); | ||
| 114 | print_usage (); | ||
| 115 | exit (STATE_UNKNOWN); | ||
| 116 | @@ -338,7 +338,7 @@ | ||
| 117 | strcpy (ptr_server, optarg); | ||
| 118 | break; | ||
| 119 | case 'a': /* expected address */ | ||
| 120 | - if (is_dotted_quad (optarg) == FALSE) { | ||
| 121 | + if ((is_ipv4_addr (optarg)) == FALSE) { | ||
| 122 | printf ("Invalid expected address\n\n"); | ||
| 123 | print_usage (); | ||
| 124 | exit (STATE_UNKNOWN); | ||
| 125 | @@ -352,8 +352,8 @@ | ||
| 126 | } | ||
| 127 | |||
| 128 | c = optind; | ||
| 129 | - if (query_address[0] == 0) { | ||
| 130 | - if (is_host (argv[c]) == FALSE) { | ||
| 131 | + if (query_address== NULL) { | ||
| 132 | + if ((is_host (argv[c])) == FALSE) { | ||
| 133 | printf ("Invalid name/address: %s\n\n", argv[c]); | ||
| 134 | return ERROR; | ||
| 135 | } | ||
| 136 | @@ -362,8 +362,8 @@ | ||
| 137 | strcpy (query_address, argv[c++]); | ||
| 138 | } | ||
| 139 | |||
| 140 | - if (dns_server[0] == 0) { | ||
| 141 | - if (is_host (argv[c]) == FALSE) { | ||
| 142 | + if (dns_server == NULL) { | ||
| 143 | + if ((is_host (argv[c])) == FALSE) { | ||
| 144 | printf ("Invalid name/address: %s\n\n", argv[c]); | ||
| 145 | return ERROR; | ||
| 146 | } | ||
| 147 | Index: plugins/check_ldap.c | ||
| 148 | =================================================================== | ||
| 149 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ldap.c,v | ||
| 150 | retrieving revision 1.2 | ||
| 151 | diff -u -r1.2 check_ldap.c | ||
| 152 | --- plugins/check_ldap.c 14 Nov 2002 02:26:34 -0000 1.2 | ||
| 153 | +++ plugins/check_ldap.c 10 Dec 2002 19:43:10 -0000 | ||
| 154 | @@ -7,7 +7,7 @@ | ||
| 155 | * | ||
| 156 | * Last Modified: $Date: 2002/11/14 02:26:34 $ | ||
| 157 | * | ||
| 158 | - * Command line: check_ldap -h <host> -b <base_dn> -p <port> -w <warn_time> -w <crit_time> | ||
| 159 | + * Command line: check_ldap -H <host> -b <base_dn> -p <port> -w <warn_time> -w <crit_time> | ||
| 160 | * | ||
| 161 | * Description: | ||
| 162 | * | ||
| 163 | @@ -197,7 +197,7 @@ | ||
| 164 | crit_time = atoi (optarg); | ||
| 165 | break; | ||
| 166 | default: | ||
| 167 | - usage ("check_ldap: could not parse arguments\n"); | ||
| 168 | + usage ("check_ldap: could not parse unknown arguments\n"); | ||
| 169 | break; | ||
| 170 | } | ||
| 171 | } | ||
| 172 | @@ -253,6 +253,6 @@ | ||
| 173 | { | ||
| 174 | printf | ||
| 175 | ("Usage: %s -H <host> -b <base_dn> -p <port> [-a <attr>] [-D <binddn>]\n" | ||
| 176 | - " [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n" | ||
| 177 | + " [-P <password>] -w <warn_time> -c <crit_time> [-t timeout]\n" | ||
| 178 | "(Note: all times are in seconds.)\n", PROGNAME); | ||
| 179 | } | ||
| 180 | Index: plugins/check_ping.c | ||
| 181 | =================================================================== | ||
| 182 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ping.c,v | ||
| 183 | retrieving revision 1.10 | ||
| 184 | diff -u -r1.10 check_ping.c | ||
| 185 | --- plugins/check_ping.c 13 Nov 2002 11:50:54 -0000 1.10 | ||
| 186 | +++ plugins/check_ping.c 10 Dec 2002 19:43:10 -0000 | ||
| 187 | @@ -88,9 +88,15 @@ | ||
| 188 | |||
| 189 | /* does the host address of number of packets argument come first? */ | ||
| 190 | #ifdef PING_PACKETS_FIRST | ||
| 191 | - asprintf (&command_line, PING_COMMAND, max_packets, server_address); | ||
| 192 | + if (is_ipv6_addr (server_address)) | ||
| 193 | + asprintf (&command_line, PING6_COMMAND, max_packets, server_address); | ||
| 194 | + else | ||
| 195 | + asprintf (&command_line, PING_COMMAND, max_packets, server_address); | ||
| 196 | #else | ||
| 197 | - asprintf (&command_line, PING_COMMAND, server_address, max_packets); | ||
| 198 | + if (is_ipv6_addr (server_address)) | ||
| 199 | + asprintf (&command_line, PING6_COMMAND, server_address, max_packets); | ||
| 200 | + else | ||
| 201 | + asprintf (&command_line, PING_COMMAND, server_address, max_packets); | ||
| 202 | #endif | ||
| 203 | |||
| 204 | /* Set signal handling and alarm */ | ||
| 205 | Index: plugins/netutils.c | ||
| 206 | =================================================================== | ||
| 207 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.c,v | ||
| 208 | retrieving revision 1.1.1.1 | ||
| 209 | diff -u -r1.1.1.1 netutils.c | ||
| 210 | --- plugins/netutils.c 28 Feb 2002 06:42:59 -0000 1.1.1.1 | ||
| 211 | +++ plugins/netutils.c 10 Dec 2002 19:43:10 -0000 | ||
| 212 | @@ -48,8 +48,6 @@ | ||
| 213 | int my_udp_connect (char *, int, int *); | ||
| 214 | int my_connect (char *, int, int *, char *); | ||
| 215 | |||
| 216 | -int my_inet_aton (register const char *, struct in_addr *); | ||
| 217 | - | ||
| 218 | /* handles socket timeouts */ | ||
| 219 | void | ||
| 220 | socket_timeout_alarm_handler (int sig) | ||
| 221 | @@ -265,167 +263,70 @@ | ||
| 222 | int | ||
| 223 | my_connect (char *host_name, int port, int *sd, char *proto) | ||
| 224 | { | ||
| 225 | - struct sockaddr_in servaddr; | ||
| 226 | - struct hostent *hp; | ||
| 227 | - struct protoent *ptrp; | ||
| 228 | - int result; | ||
| 229 | - | ||
| 230 | - bzero ((char *) &servaddr, sizeof (servaddr)); | ||
| 231 | - servaddr.sin_family = AF_INET; | ||
| 232 | - servaddr.sin_port = htons (port); | ||
| 233 | - | ||
| 234 | - /* try to bypass using a DNS lookup if this is just an IP address */ | ||
| 235 | - if (!my_inet_aton (host_name, &servaddr.sin_addr)) { | ||
| 236 | - | ||
| 237 | - /* else do a DNS lookup */ | ||
| 238 | - hp = gethostbyname ((const char *) host_name); | ||
| 239 | - if (hp == NULL) { | ||
| 240 | - printf ("Invalid host name '%s'\n", host_name); | ||
| 241 | - return STATE_UNKNOWN; | ||
| 242 | - } | ||
| 243 | - | ||
| 244 | - memcpy (&servaddr.sin_addr, hp->h_addr, hp->h_length); | ||
| 245 | - } | ||
| 246 | - | ||
| 247 | - /* map transport protocol name to protocol number */ | ||
| 248 | - if ((ptrp = getprotobyname (proto)) == NULL) { | ||
| 249 | - printf ("Cannot map \"%s\" to protocol number\n", proto); | ||
| 250 | - return STATE_UNKNOWN; | ||
| 251 | - } | ||
| 252 | - | ||
| 253 | - /* create a socket */ | ||
| 254 | - *sd = | ||
| 255 | - socket (PF_INET, (!strcmp (proto, "udp")) ? SOCK_DGRAM : SOCK_STREAM, | ||
| 256 | - ptrp->p_proto); | ||
| 257 | - if (*sd < 0) { | ||
| 258 | - printf ("Socket creation failed\n"); | ||
| 259 | - return STATE_UNKNOWN; | ||
| 260 | - } | ||
| 261 | - | ||
| 262 | - /* open a connection */ | ||
| 263 | - result = connect (*sd, (struct sockaddr *) &servaddr, sizeof (servaddr)); | ||
| 264 | - if (result < 0) { | ||
| 265 | - switch (errno) { | ||
| 266 | - case ECONNREFUSED: | ||
| 267 | - printf ("Connection refused by host\n"); | ||
| 268 | - break; | ||
| 269 | - case ETIMEDOUT: | ||
| 270 | - printf ("Timeout while attempting connection\n"); | ||
| 271 | - break; | ||
| 272 | - case ENETUNREACH: | ||
| 273 | - printf ("Network is unreachable\n"); | ||
| 274 | - break; | ||
| 275 | - default: | ||
| 276 | - printf ("Connection refused or timed out\n"); | ||
| 277 | - } | ||
| 278 | - | ||
| 279 | - return STATE_CRITICAL; | ||
| 280 | - } | ||
| 281 | - | ||
| 282 | - return STATE_OK; | ||
| 283 | -} | ||
| 284 | - | ||
| 285 | - | ||
| 286 | - | ||
| 287 | -/* This code was taken from Fyodor's nmap utility, which was originally | ||
| 288 | - taken from the GLIBC 2.0.6 libraries because Solaris doesn't contain | ||
| 289 | - the inet_aton() funtion. */ | ||
| 290 | -int | ||
| 291 | -my_inet_aton (register const char *cp, struct in_addr *addr) | ||
| 292 | -{ | ||
| 293 | - register unsigned int val; /* changed from u_long --david */ | ||
| 294 | - register int base, n; | ||
| 295 | - register char c; | ||
| 296 | - u_int parts[4]; | ||
| 297 | - register u_int *pp = parts; | ||
| 298 | - | ||
| 299 | - c = *cp; | ||
| 300 | - | ||
| 301 | - for (;;) { | ||
| 302 | - | ||
| 303 | - /* | ||
| 304 | - * Collect number up to ``.''. | ||
| 305 | - * Values are specified as for C: | ||
| 306 | - * 0x=hex, 0=octal, isdigit=decimal. | ||
| 307 | - */ | ||
| 308 | - if (!isdigit ((int) c)) | ||
| 309 | - return (0); | ||
| 310 | - val = 0; | ||
| 311 | - base = 10; | ||
| 312 | - | ||
| 313 | - if (c == '0') { | ||
| 314 | - c = *++cp; | ||
| 315 | - if (c == 'x' || c == 'X') | ||
| 316 | - base = 16, c = *++cp; | ||
| 317 | - else | ||
| 318 | - base = 8; | ||
| 319 | - } | ||
| 320 | - | ||
| 321 | - for (;;) { | ||
| 322 | - if (isascii ((int) c) && isdigit ((int) c)) { | ||
| 323 | - val = (val * base) + (c - '0'); | ||
| 324 | - c = *++cp; | ||
| 325 | - } | ||
| 326 | - else if (base == 16 && isascii ((int) c) && isxdigit ((int) c)) { | ||
| 327 | - val = (val << 4) | (c + 10 - (islower ((int) c) ? 'a' : 'A')); | ||
| 328 | - c = *++cp; | ||
| 329 | - } | ||
| 330 | - else | ||
| 331 | - break; | ||
| 332 | - } | ||
| 333 | - | ||
| 334 | - if (c == '.') { | ||
| 335 | - | ||
| 336 | - /* | ||
| 337 | - * Internet format: | ||
| 338 | - * a.b.c.d | ||
| 339 | - * a.b.c (with c treated as 16 bits) | ||
| 340 | - * a.b (with b treated as 24 bits) | ||
| 341 | - */ | ||
| 342 | - if (pp >= parts + 3) | ||
| 343 | - return (0); | ||
| 344 | - *pp++ = val; | ||
| 345 | - c = *++cp; | ||
| 346 | - } | ||
| 347 | - else | ||
| 348 | - break; | ||
| 349 | - } | ||
| 350 | - | ||
| 351 | - /* Check for trailing characters */ | ||
| 352 | - if (c != '\0' && (!isascii ((int) c) || !isspace ((int) c))) | ||
| 353 | - return (0); | ||
| 354 | - | ||
| 355 | - /* Concoct the address according to the number of parts specified */ | ||
| 356 | - n = pp - parts + 1; | ||
| 357 | - switch (n) { | ||
| 358 | - | ||
| 359 | - case 0: | ||
| 360 | - return (0); /* initial nondigit */ | ||
| 361 | - | ||
| 362 | - case 1: /* a -- 32 bits */ | ||
| 363 | - break; | ||
| 364 | - | ||
| 365 | - case 2: /* a.b -- 8.24 bits */ | ||
| 366 | - if (val > 0xffffff) | ||
| 367 | - return (0); | ||
| 368 | - val |= parts[0] << 24; | ||
| 369 | - break; | ||
| 370 | - | ||
| 371 | - case 3: /* a.b.c -- 8.8.16 bits */ | ||
| 372 | - if (val > 0xffff) | ||
| 373 | - return (0); | ||
| 374 | - val |= (parts[0] << 24) | (parts[1] << 16); | ||
| 375 | - break; | ||
| 376 | - | ||
| 377 | - case 4: /* a.b.c.d -- 8.8.8.8 bits */ | ||
| 378 | - if (val > 0xff) | ||
| 379 | - return (0); | ||
| 380 | - val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); | ||
| 381 | - break; | ||
| 382 | + struct addrinfo hints; | ||
| 383 | + struct addrinfo *res; | ||
| 384 | + struct protoent *ptrp; | ||
| 385 | + char port_str[6]; | ||
| 386 | + char nbuf[NI_MAXHOST]; | ||
| 387 | + int result; | ||
| 388 | + | ||
| 389 | + /* map the transport protocol name to protocol number */ | ||
| 390 | + ptrp = getprotobyname ((const char *)proto); | ||
| 391 | + if (ptrp == NULL) | ||
| 392 | + { | ||
| 393 | + printf ("Cannot map %s to protocol number\n", proto); | ||
| 394 | + return STATE_UNKNOWN; | ||
| 395 | + } | ||
| 396 | + | ||
| 397 | + memset (&hints, 0, sizeof (hints)); | ||
| 398 | + hints.ai_family = PF_UNSPEC; | ||
| 399 | + hints.ai_protocol = ptrp->p_proto; | ||
| 400 | + | ||
| 401 | + snprintf(port_str, sizeof(port_str), "%d", port); | ||
| 402 | + /* nice clean AF-independent code doesn't matter if passed hostname or IP address */ | ||
| 403 | + result = getaddrinfo (host_name, port_str, &hints, &res); | ||
| 404 | + | ||
| 405 | + if (result != 0) | ||
| 406 | + { | ||
| 407 | + printf ("%s\n", gai_strerror (result)); | ||
| 408 | + return STATE_UNKNOWN; | ||
| 409 | } | ||
| 410 | - | ||
| 411 | - if (addr) | ||
| 412 | - addr->s_addr = htonl (val); | ||
| 413 | - | ||
| 414 | - return (1); | ||
| 415 | + else | ||
| 416 | + { | ||
| 417 | + while (res) | ||
| 418 | + { | ||
| 419 | + /* attempt to create a socket */ | ||
| 420 | + *sd = socket (res->ai_family, (!strcasecmp (proto, "udp")) ? SOCK_DGRAM : SOCK_STREAM, res->ai_protocol); | ||
| 421 | + | ||
| 422 | + if (*sd < 0) { | ||
| 423 | + printf ("Socket creation failed\n"); | ||
| 424 | + freeaddrinfo (res); | ||
| 425 | + return STATE_UNKNOWN; | ||
| 426 | + } | ||
| 427 | + | ||
| 428 | + /* Little debugging here */ | ||
| 429 | + result = getnameinfo (res->ai_addr, res->ai_addrlen, | ||
| 430 | + nbuf, sizeof (nbuf), NULL, 0, NI_NUMERICHOST); | ||
| 431 | + printf ("Connect attempt on socket %d to %s", | ||
| 432 | + *sd, nbuf); | ||
| 433 | + | ||
| 434 | + /* attempt to open a connection */ | ||
| 435 | + result = connect (*sd, res->ai_addr, res->ai_addrlen); | ||
| 436 | + | ||
| 437 | + if (result == 0) | ||
| 438 | + break; | ||
| 439 | + | ||
| 440 | + close(*sd); | ||
| 441 | + res = res->ai_next; | ||
| 442 | + } | ||
| 443 | + freeaddrinfo (res); | ||
| 444 | + } | ||
| 445 | + | ||
| 446 | + if (result == 0) | ||
| 447 | + return STATE_OK; | ||
| 448 | + else | ||
| 449 | + { | ||
| 450 | + printf ("%s\n", strerror(errno)); | ||
| 451 | + return STATE_CRITICAL; | ||
| 452 | + } | ||
| 453 | } | ||
| 454 | Index: plugins/netutils.h.in | ||
| 455 | =================================================================== | ||
| 456 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.h.in,v | ||
| 457 | retrieving revision 1.1.1.1 | ||
| 458 | diff -u -r1.1.1.1 netutils.h.in | ||
| 459 | --- plugins/netutils.h.in 28 Feb 2002 06:42:59 -0000 1.1.1.1 | ||
| 460 | +++ plugins/netutils.h.in 10 Dec 2002 19:43:10 -0000 | ||
| 461 | @@ -54,8 +54,6 @@ | ||
| 462 | int my_udp_connect (char *address, int port, int *sd); | ||
| 463 | int my_connect (char *address, int port, int *sd, char *proto); | ||
| 464 | |||
| 465 | -int my_inet_aton (register const char *cp, struct in_addr *addr); | ||
| 466 | - | ||
| 467 | #ifndef DEFAULT_SOCKET_TIMEOUT | ||
| 468 | #include "config.h" | ||
| 469 | #include "common.h" | ||
| 470 | Index: plugins/utils.c | ||
| 471 | =================================================================== | ||
| 472 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.c,v | ||
| 473 | retrieving revision 1.13 | ||
| 474 | diff -u -r1.13 utils.c | ||
| 475 | --- plugins/utils.c 18 Nov 2002 07:22:28 -0000 1.13 | ||
| 476 | +++ plugins/utils.c 10 Dec 2002 19:43:10 -0000 | ||
| 477 | @@ -16,6 +16,9 @@ | ||
| 478 | #include "version.h" | ||
| 479 | #include <stdarg.h> | ||
| 480 | #include <limits.h> | ||
| 481 | +#include <sys/socket.h> | ||
| 482 | +#include <arpa/inet.h> | ||
| 483 | +#include <netdb.h> | ||
| 484 | |||
| 485 | extern int timeout_interval; | ||
| 486 | |||
| 487 | @@ -27,7 +30,8 @@ | ||
| 488 | RETSIGTYPE timeout_alarm_handler (int); | ||
| 489 | |||
| 490 | int is_host (char *); | ||
| 491 | -int is_dotted_quad (char *); | ||
| 492 | +int is_ipv4_addr (char *); | ||
| 493 | +int is_ipv6_addr (char *); | ||
| 494 | int is_hostname (char *); | ||
| 495 | |||
| 496 | int is_integer (char *); | ||
| 497 | @@ -154,25 +158,51 @@ | ||
| 498 | int | ||
| 499 | is_host (char *address) | ||
| 500 | { | ||
| 501 | - if (is_dotted_quad (address) || is_hostname (address)) | ||
| 502 | + if (is_ipv4_addr (address) || is_ipv6_addr (address) || | ||
| 503 | + is_hostname (address)) | ||
| 504 | return (TRUE); | ||
| 505 | + | ||
| 506 | return (FALSE); | ||
| 507 | } | ||
| 508 | |||
| 509 | int | ||
| 510 | -is_dotted_quad (char *address) | ||
| 511 | +is_ipv4_addr (char *address) | ||
| 512 | { | ||
| 513 | - int o1, o2, o3, o4; | ||
| 514 | - char c[1]; | ||
| 515 | + struct addrinfo hints; | ||
| 516 | + struct addrinfo *res; | ||
| 517 | + int retval; | ||
| 518 | |||
| 519 | - if (sscanf (address, "%d.%d.%d.%d%c", &o1, &o2, &o3, &o4, c) != 4) | ||
| 520 | - return FALSE; | ||
| 521 | - else if (o1 > 255 || o2 > 255 || o3 > 255 || o4 > 255) | ||
| 522 | + memset (&hints, 0, sizeof (hints)); | ||
| 523 | + hints.ai_family = PF_INET; | ||
| 524 | + retval = getaddrinfo (address, NULL, &hints, &res); | ||
| 525 | + | ||
| 526 | + if (retval != 0) | ||
| 527 | return FALSE; | ||
| 528 | - else if (o1 < 0 || o2 < 0 || o3 < 0 || o4 < 0) | ||
| 529 | + else | ||
| 530 | + { | ||
| 531 | + freeaddrinfo (res); | ||
| 532 | + return TRUE; | ||
| 533 | + } | ||
| 534 | +} | ||
| 535 | + | ||
| 536 | +int | ||
| 537 | +is_ipv6_addr (char *address) | ||
| 538 | +{ | ||
| 539 | + struct addrinfo hints; | ||
| 540 | + struct addrinfo *res; | ||
| 541 | + int retval; | ||
| 542 | + | ||
| 543 | + memset (&hints, 0, sizeof (hints)); | ||
| 544 | + hints.ai_family = PF_INET6; | ||
| 545 | + retval = getaddrinfo (address, NULL, &hints, &res); | ||
| 546 | + | ||
| 547 | + if (retval != 0) | ||
| 548 | return FALSE; | ||
| 549 | else | ||
| 550 | + { | ||
| 551 | + freeaddrinfo (res); | ||
| 552 | return TRUE; | ||
| 553 | + } | ||
| 554 | } | ||
| 555 | |||
| 556 | /* from RFC-1035 | ||
| 557 | @@ -185,22 +215,21 @@ | ||
| 558 | int | ||
| 559 | is_hostname (char *s1) | ||
| 560 | { | ||
| 561 | - if (strlen (s1) > 63) | ||
| 562 | - return FALSE; | ||
| 563 | - if (strcspn | ||
| 564 | - (s1, | ||
| 565 | - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUWVXYZ0123456789-.") != | ||
| 566 | - 0) return FALSE; | ||
| 567 | - if (strspn (s1, "0123456789-.") == 1) | ||
| 568 | + struct addrinfo hints; | ||
| 569 | + struct addrinfo *res; | ||
| 570 | + int retval; | ||
| 571 | + | ||
| 572 | + memset (&hints, 0, sizeof (hints)); | ||
| 573 | + hints.ai_family = PF_UNSPEC; | ||
| 574 | + retval = getaddrinfo (s1, NULL, &hints, &res); | ||
| 575 | + | ||
| 576 | + if (retval != 0) | ||
| 577 | return FALSE; | ||
| 578 | - while ((s1 = index (s1, '.'))) { | ||
| 579 | - s1++; | ||
| 580 | - if (strspn (s1, "0123456789-.") == 1) { | ||
| 581 | - printf ("%s\n", s1); | ||
| 582 | - return FALSE; | ||
| 583 | - } | ||
| 584 | + else | ||
| 585 | + { | ||
| 586 | + freeaddrinfo (res); | ||
| 587 | + return TRUE; | ||
| 588 | } | ||
| 589 | - return TRUE; | ||
| 590 | } | ||
| 591 | |||
| 592 | int | ||
| 593 | Index: plugins/utils.h.in | ||
| 594 | =================================================================== | ||
| 595 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.h.in,v | ||
| 596 | retrieving revision 1.7 | ||
| 597 | diff -u -r1.7 utils.h.in | ||
| 598 | --- plugins/utils.h.in 9 Nov 2002 03:39:35 -0000 1.7 | ||
| 599 | +++ plugins/utils.h.in 10 Dec 2002 19:43:10 -0000 | ||
| 600 | @@ -28,7 +28,8 @@ | ||
| 601 | /* Test input types */ | ||
| 602 | |||
| 603 | int is_host (char *); | ||
| 604 | -int is_dotted_quad (char *); | ||
| 605 | +int is_ipv4_addr (char *); | ||
| 606 | +int is_ipv6_addr (char *); | ||
| 607 | int is_hostname (char *); | ||
| 608 | |||
| 609 | int is_integer (char *); | ||
diff --git a/web/attachments/37323-nagiosplugins-cvs-20021210-ipv6.diff b/web/attachments/37323-nagiosplugins-cvs-20021210-ipv6.diff new file mode 100644 index 0000000..da47ec3 --- /dev/null +++ b/web/attachments/37323-nagiosplugins-cvs-20021210-ipv6.diff | |||
| @@ -0,0 +1,740 @@ | |||
| 1 | Index: check_dig.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_dig.c,v | ||
| 4 | retrieving revision 1.7 | ||
| 5 | diff -u -r1.7 check_dig.c | ||
| 6 | --- check_dig.c 21 Nov 2002 12:40:58 -0000 1.7 | ||
| 7 | +++ check_dig.c 11 Dec 2002 02:39:50 -0000 | ||
| 8 | @@ -57,7 +57,7 @@ | ||
| 9 | usage ("Could not parse arguments\n"); | ||
| 10 | |||
| 11 | /* get the command to run */ | ||
| 12 | - asprintf (&command_line, "%s @%s %s", PATH_TO_DIG, dns_server, query_address); | ||
| 13 | + asprintf (&command_line, "%s -t any @%s %s", PATH_TO_DIG, dns_server, query_address); | ||
| 14 | |||
| 15 | alarm (timeout_interval); | ||
| 16 | time (&start_time); | ||
| 17 | Index: check_dns.c | ||
| 18 | =================================================================== | ||
| 19 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_dns.c,v | ||
| 20 | retrieving revision 1.5 | ||
| 21 | diff -u -r1.5 check_dns.c | ||
| 22 | --- check_dns.c 14 Nov 2002 02:26:34 -0000 1.5 | ||
| 23 | +++ check_dns.c 11 Dec 2002 02:39:50 -0000 | ||
| 24 | @@ -308,7 +308,7 @@ | ||
| 25 | timeout_interval = atoi (optarg); | ||
| 26 | break; | ||
| 27 | case 'H': /* hostname */ | ||
| 28 | - if (is_host (optarg) == FALSE) { | ||
| 29 | + if ((is_host (optarg)) == FALSE) { | ||
| 30 | printf ("Invalid host name/address\n\n"); | ||
| 31 | print_usage (); | ||
| 32 | exit (STATE_UNKNOWN); | ||
| 33 | @@ -318,7 +318,7 @@ | ||
| 34 | strcpy (query_address, optarg); | ||
| 35 | break; | ||
| 36 | case 's': /* server name */ | ||
| 37 | - if (is_host (optarg) == FALSE) { | ||
| 38 | + if ((is_host (optarg)) == FALSE) { | ||
| 39 | printf ("Invalid server name/address\n\n"); | ||
| 40 | print_usage (); | ||
| 41 | exit (STATE_UNKNOWN); | ||
| 42 | @@ -328,7 +328,7 @@ | ||
| 43 | strcpy (dns_server, optarg); | ||
| 44 | break; | ||
| 45 | case 'r': /* reverse server name */ | ||
| 46 | - if (is_host (optarg) == FALSE) { | ||
| 47 | + if ((is_host (optarg)) == FALSE) { | ||
| 48 | printf ("Invalid host name/address\n\n"); | ||
| 49 | print_usage (); | ||
| 50 | exit (STATE_UNKNOWN); | ||
| 51 | @@ -338,7 +338,7 @@ | ||
| 52 | strcpy (ptr_server, optarg); | ||
| 53 | break; | ||
| 54 | case 'a': /* expected address */ | ||
| 55 | - if (is_dotted_quad (optarg) == FALSE) { | ||
| 56 | + if ((is_ipv4_addr (optarg)) == FALSE) { | ||
| 57 | printf ("Invalid expected address\n\n"); | ||
| 58 | print_usage (); | ||
| 59 | exit (STATE_UNKNOWN); | ||
| 60 | @@ -352,8 +352,8 @@ | ||
| 61 | } | ||
| 62 | |||
| 63 | c = optind; | ||
| 64 | - if (query_address[0] == 0) { | ||
| 65 | - if (is_host (argv[c]) == FALSE) { | ||
| 66 | + if (query_address == NULL) { | ||
| 67 | + if ((is_host (argv[c])) == FALSE) { | ||
| 68 | printf ("Invalid name/address: %s\n\n", argv[c]); | ||
| 69 | return ERROR; | ||
| 70 | } | ||
| 71 | @@ -362,8 +362,8 @@ | ||
| 72 | strcpy (query_address, argv[c++]); | ||
| 73 | } | ||
| 74 | |||
| 75 | - if (dns_server[0] == 0) { | ||
| 76 | - if (is_host (argv[c]) == FALSE) { | ||
| 77 | + if (dns_server == NULL) { | ||
| 78 | + if ((is_host (argv[c])) == FALSE) { | ||
| 79 | printf ("Invalid name/address: %s\n\n", argv[c]); | ||
| 80 | return ERROR; | ||
| 81 | } | ||
| 82 | Index: check_ldap.c | ||
| 83 | =================================================================== | ||
| 84 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ldap.c,v | ||
| 85 | retrieving revision 1.2 | ||
| 86 | diff -u -r1.2 check_ldap.c | ||
| 87 | --- check_ldap.c 14 Nov 2002 02:26:34 -0000 1.2 | ||
| 88 | +++ check_ldap.c 11 Dec 2002 02:39:50 -0000 | ||
| 89 | @@ -7,7 +7,7 @@ | ||
| 90 | * | ||
| 91 | * Last Modified: $Date: 2002/11/14 02:26:34 $ | ||
| 92 | * | ||
| 93 | - * Command line: check_ldap -h <host> -b <base_dn> -p <port> -w <warn_time> -w <crit_time> | ||
| 94 | + * Command line: check_ldap -H <host> -b <base_dn> -p <port> -w <warn_time> -w <crit_time> | ||
| 95 | * | ||
| 96 | * Description: | ||
| 97 | * | ||
| 98 | @@ -197,7 +197,7 @@ | ||
| 99 | crit_time = atoi (optarg); | ||
| 100 | break; | ||
| 101 | default: | ||
| 102 | - usage ("check_ldap: could not parse arguments\n"); | ||
| 103 | + usage ("check_ldap: could not parse unknown arguments\n"); | ||
| 104 | break; | ||
| 105 | } | ||
| 106 | } | ||
| 107 | @@ -253,6 +253,6 @@ | ||
| 108 | { | ||
| 109 | printf | ||
| 110 | ("Usage: %s -H <host> -b <base_dn> -p <port> [-a <attr>] [-D <binddn>]\n" | ||
| 111 | - " [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n" | ||
| 112 | + " [-P <password>] -w <warn_time> -c <crit_time> [-t timeout]\n" | ||
| 113 | "(Note: all times are in seconds.)\n", PROGNAME); | ||
| 114 | } | ||
| 115 | Index: check_ping.c | ||
| 116 | =================================================================== | ||
| 117 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ping.c,v | ||
| 118 | retrieving revision 1.10 | ||
| 119 | diff -u -r1.10 check_ping.c | ||
| 120 | --- check_ping.c 13 Nov 2002 11:50:54 -0000 1.10 | ||
| 121 | +++ check_ping.c 11 Dec 2002 02:39:50 -0000 | ||
| 122 | @@ -88,9 +88,15 @@ | ||
| 123 | |||
| 124 | /* does the host address of number of packets argument come first? */ | ||
| 125 | #ifdef PING_PACKETS_FIRST | ||
| 126 | - asprintf (&command_line, PING_COMMAND, max_packets, server_address); | ||
| 127 | + if (is_ipv6_addr (server_address)) | ||
| 128 | + asprintf (&command_line, PING6_COMMAND, max_packets, server_address); | ||
| 129 | + else | ||
| 130 | + asprintf (&command_line, PING_COMMAND, max_packets, server_address); | ||
| 131 | #else | ||
| 132 | - asprintf (&command_line, PING_COMMAND, server_address, max_packets); | ||
| 133 | + if (is_ipv6_addr (server_address)) | ||
| 134 | + asprintf (&command_line, PING6_COMMAND, server_address, max_packets); | ||
| 135 | + else | ||
| 136 | + asprintf (&command_line, PING_COMMAND, server_address, max_packets); | ||
| 137 | #endif | ||
| 138 | |||
| 139 | /* Set signal handling and alarm */ | ||
| 140 | Index: check_tcp.c | ||
| 141 | =================================================================== | ||
| 142 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_tcp.c,v | ||
| 143 | retrieving revision 1.8 | ||
| 144 | diff -u -r1.8 check_tcp.c | ||
| 145 | --- check_tcp.c 25 Nov 2002 12:00:17 -0000 1.8 | ||
| 146 | +++ check_tcp.c 11 Dec 2002 02:39:50 -0000 | ||
| 147 | @@ -225,8 +225,12 @@ | ||
| 148 | { | ||
| 149 | if (PROTOCOL == UDP_PROTOCOL) | ||
| 150 | result = my_udp_connect (server_address, server_port, &sd); | ||
| 151 | - else /* default is TCP */ | ||
| 152 | - result = my_tcp_connect (server_address, server_port, &sd); | ||
| 153 | + else | ||
| 154 | + /* default is TCP */ | ||
| 155 | + // result = my_tcp_connect (server_address, server_port, &sd); | ||
| 156 | + result = my_connect (server_address, server_port, &sd, IPPROTO_TCP); | ||
| 157 | +printf ("Catch value: %d\n", result); | ||
| 158 | +printf ("XXX: Check valve\n"); | ||
| 159 | } | ||
| 160 | |||
| 161 | if (result == STATE_CRITICAL) | ||
| 162 | Index: check_udp.c | ||
| 163 | =================================================================== | ||
| 164 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_udp.c,v | ||
| 165 | retrieving revision 1.2 | ||
| 166 | diff -u -r1.2 check_udp.c | ||
| 167 | --- check_udp.c 30 Oct 2002 18:46:01 -0000 1.2 | ||
| 168 | +++ check_udp.c 11 Dec 2002 02:39:50 -0000 | ||
| 169 | @@ -74,9 +74,8 @@ | ||
| 170 | alarm (socket_timeout); | ||
| 171 | |||
| 172 | time (&start_time); | ||
| 173 | - result = | ||
| 174 | - process_udp_request (server_address, server_port, server_send, | ||
| 175 | - recv_buffer, MAX_INPUT_BUFFER - 1); | ||
| 176 | + result = process_udp_request (server_address, server_port, server_send, | ||
| 177 | + recv_buffer, MAX_INPUT_BUFFER - 1); | ||
| 178 | time (&end_time); | ||
| 179 | |||
| 180 | if (result != STATE_OK) { | ||
| 181 | Index: netutils.c | ||
| 182 | =================================================================== | ||
| 183 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.c,v | ||
| 184 | retrieving revision 1.1.1.1 | ||
| 185 | diff -u -r1.1.1.1 netutils.c | ||
| 186 | --- netutils.c 28 Feb 2002 06:42:59 -0000 1.1.1.1 | ||
| 187 | +++ netutils.c 11 Dec 2002 02:39:50 -0000 | ||
| 188 | @@ -42,13 +42,11 @@ | ||
| 189 | int process_tcp_request2 (char *, int, char *, char *, int); | ||
| 190 | int process_tcp_request (char *, int, char *, char *, int); | ||
| 191 | int process_udp_request (char *, int, char *, char *, int); | ||
| 192 | -int process_request (char *, int, char *, char *, char *, int); | ||
| 193 | +int process_request (char *, int, int, char *, char *, int); | ||
| 194 | |||
| 195 | int my_tcp_connect (char *, int, int *); | ||
| 196 | int my_udp_connect (char *, int, int *); | ||
| 197 | -int my_connect (char *, int, int *, char *); | ||
| 198 | - | ||
| 199 | -int my_inet_aton (register const char *, struct in_addr *); | ||
| 200 | +int my_connect (char *, int, int *, int); | ||
| 201 | |||
| 202 | /* handles socket timeouts */ | ||
| 203 | void | ||
| 204 | @@ -64,47 +62,29 @@ | ||
| 205 | /* connects to a host on a specified TCP port, sends a string, | ||
| 206 | and gets a response */ | ||
| 207 | int | ||
| 208 | -process_tcp_request (char *server_address, | ||
| 209 | - int server_port, | ||
| 210 | - char *send_buffer, char *recv_buffer, int recv_size) | ||
| 211 | +process_tcp_request (char *server_address, int server_port, | ||
| 212 | + char *send_buffer, char *recv_buffer, int recv_size) | ||
| 213 | { | ||
| 214 | - int result; | ||
| 215 | - char proto[4] = "tcp"; | ||
| 216 | - | ||
| 217 | - result = process_request (server_address, | ||
| 218 | - server_port, | ||
| 219 | - proto, send_buffer, recv_buffer, recv_size); | ||
| 220 | - | ||
| 221 | - return result; | ||
| 222 | + return process_request (server_address, server_port, IPPROTO_TCP, | ||
| 223 | + send_buffer, recv_buffer, recv_size); | ||
| 224 | } | ||
| 225 | |||
| 226 | - | ||
| 227 | /* connects to a host on a specified UDP port, sends a string, and gets a | ||
| 228 | response */ | ||
| 229 | int | ||
| 230 | -process_udp_request (char *server_address, | ||
| 231 | - int server_port, | ||
| 232 | - char *send_buffer, char *recv_buffer, int recv_size) | ||
| 233 | +process_udp_request (char *server_address, int server_port, | ||
| 234 | + char *send_buffer, char *recv_buffer, int recv_size) | ||
| 235 | { | ||
| 236 | - int result; | ||
| 237 | - char proto[4] = "udp"; | ||
| 238 | - | ||
| 239 | - result = process_request (server_address, | ||
| 240 | - server_port, | ||
| 241 | - proto, send_buffer, recv_buffer, recv_size); | ||
| 242 | - | ||
| 243 | - return result; | ||
| 244 | + return process_request (server_address, server_port, IPPROTO_UDP, | ||
| 245 | + send_buffer, recv_buffer, recv_size); | ||
| 246 | } | ||
| 247 | |||
| 248 | - | ||
| 249 | - | ||
| 250 | /* connects to a host on a specified tcp port, sends a string, and gets a | ||
| 251 | response. loops on select-recv until timeout or eof to get all of a | ||
| 252 | multi-packet answer */ | ||
| 253 | int | ||
| 254 | -process_tcp_request2 (char *server_address, | ||
| 255 | - int server_port, | ||
| 256 | - char *send_buffer, char *recv_buffer, int recv_size) | ||
| 257 | +process_tcp_request2 (char *server_address, int server_port, | ||
| 258 | + char *send_buffer, char *recv_buffer, int recv_size) | ||
| 259 | { | ||
| 260 | |||
| 261 | int result; | ||
| 262 | @@ -115,7 +95,7 @@ | ||
| 263 | fd_set readfds; | ||
| 264 | int recv_length = 0; | ||
| 265 | |||
| 266 | - result = my_connect (server_address, server_port, &sd, "tcp"); | ||
| 267 | + result = my_connect (server_address, server_port, &sd, IPPROTO_TCP); | ||
| 268 | if (result != STATE_OK) | ||
| 269 | return STATE_CRITICAL; | ||
| 270 | |||
| 271 | @@ -149,24 +129,30 @@ | ||
| 272 | else { /* it has */ | ||
| 273 | recv_result = | ||
| 274 | recv (sd, recv_buffer + recv_length, recv_size - recv_length - 1, 0); | ||
| 275 | - if (recv_result == -1) { /* recv failed, bail out */ | ||
| 276 | + if (recv_result == -1) { | ||
| 277 | + /* recv failed, bail out */ | ||
| 278 | strcpy (recv_buffer + recv_length, ""); | ||
| 279 | result = STATE_WARNING; | ||
| 280 | break; | ||
| 281 | } | ||
| 282 | - else if (recv_result == 0) { /* end of file ? */ | ||
| 283 | + else if (recv_result == 0) { | ||
| 284 | + /* end of file ? */ | ||
| 285 | recv_buffer[recv_length] = 0; | ||
| 286 | break; | ||
| 287 | } | ||
| 288 | - else { /* we got data! */ | ||
| 289 | + else { | ||
| 290 | + /* we got data! */ | ||
| 291 | recv_length += recv_result; | ||
| 292 | - if (recv_length >= recv_size - 1) { /* buffer full, we're done */ | ||
| 293 | + if (recv_length >= recv_size - 1) { | ||
| 294 | + /* buffer full, we're done */ | ||
| 295 | recv_buffer[recv_size - 1] = 0; | ||
| 296 | break; | ||
| 297 | } | ||
| 298 | } | ||
| 299 | - } /* end if(!FD_ISSET(sd,&readfds)) */ | ||
| 300 | - } /* end while(1) */ | ||
| 301 | + } | ||
| 302 | + /* end if(!FD_ISSET(sd,&readfds)) */ | ||
| 303 | + } | ||
| 304 | + /* end while(1) */ | ||
| 305 | |||
| 306 | close (sd); | ||
| 307 | return result; | ||
| 308 | @@ -175,10 +161,8 @@ | ||
| 309 | /* connects to a host on a specified port, sends a string, and gets a | ||
| 310 | response */ | ||
| 311 | int | ||
| 312 | -process_request (char *server_address, | ||
| 313 | - int server_port, | ||
| 314 | - char *proto, | ||
| 315 | - char *send_buffer, char *recv_buffer, int recv_size) | ||
| 316 | +process_request (char *server_address, int server_port, int proto, | ||
| 317 | + char *send_buffer, char *recv_buffer, int recv_size) | ||
| 318 | { | ||
| 319 | int result; | ||
| 320 | int send_result; | ||
| 321 | @@ -218,7 +202,7 @@ | ||
| 322 | recv_result = recv (sd, recv_buffer, recv_size - 1, 0); | ||
| 323 | if (recv_result == -1) { | ||
| 324 | strcpy (recv_buffer, ""); | ||
| 325 | - if (!strcmp (proto, "tcp")) | ||
| 326 | + if (proto != IPPROTO_TCP) | ||
| 327 | printf ("recv() failed\n"); | ||
| 328 | result = STATE_WARNING; | ||
| 329 | } | ||
| 330 | @@ -236,196 +220,74 @@ | ||
| 331 | |||
| 332 | |||
| 333 | /* opens a connection to a remote host/tcp port */ | ||
| 334 | + | ||
| 335 | int | ||
| 336 | my_tcp_connect (char *host_name, int port, int *sd) | ||
| 337 | { | ||
| 338 | - int result; | ||
| 339 | - char proto[4] = "tcp"; | ||
| 340 | - | ||
| 341 | - result = my_connect (host_name, port, sd, proto); | ||
| 342 | - | ||
| 343 | - return result; | ||
| 344 | + return my_connect (host_name, port, sd, IPPROTO_TCP); | ||
| 345 | } | ||
| 346 | |||
| 347 | - | ||
| 348 | /* opens a connection to a remote host/udp port */ | ||
| 349 | int | ||
| 350 | my_udp_connect (char *host_name, int port, int *sd) | ||
| 351 | { | ||
| 352 | - int result; | ||
| 353 | - char proto[4] = "udp"; | ||
| 354 | - | ||
| 355 | - result = my_connect (host_name, port, sd, proto); | ||
| 356 | - | ||
| 357 | - return result; | ||
| 358 | + return my_connect (host_name, port, sd, IPPROTO_UDP); | ||
| 359 | } | ||
| 360 | |||
| 361 | |||
| 362 | /* opens a tcp or udp connection to a remote host */ | ||
| 363 | int | ||
| 364 | -my_connect (char *host_name, int port, int *sd, char *proto) | ||
| 365 | -{ | ||
| 366 | - struct sockaddr_in servaddr; | ||
| 367 | - struct hostent *hp; | ||
| 368 | - struct protoent *ptrp; | ||
| 369 | - int result; | ||
| 370 | - | ||
| 371 | - bzero ((char *) &servaddr, sizeof (servaddr)); | ||
| 372 | - servaddr.sin_family = AF_INET; | ||
| 373 | - servaddr.sin_port = htons (port); | ||
| 374 | - | ||
| 375 | - /* try to bypass using a DNS lookup if this is just an IP address */ | ||
| 376 | - if (!my_inet_aton (host_name, &servaddr.sin_addr)) { | ||
| 377 | - | ||
| 378 | - /* else do a DNS lookup */ | ||
| 379 | - hp = gethostbyname ((const char *) host_name); | ||
| 380 | - if (hp == NULL) { | ||
| 381 | - printf ("Invalid host name '%s'\n", host_name); | ||
| 382 | - return STATE_UNKNOWN; | ||
| 383 | - } | ||
| 384 | - | ||
| 385 | - memcpy (&servaddr.sin_addr, hp->h_addr, hp->h_length); | ||
| 386 | - } | ||
| 387 | - | ||
| 388 | - /* map transport protocol name to protocol number */ | ||
| 389 | - if ((ptrp = getprotobyname (proto)) == NULL) { | ||
| 390 | - printf ("Cannot map \"%s\" to protocol number\n", proto); | ||
| 391 | - return STATE_UNKNOWN; | ||
| 392 | - } | ||
| 393 | - | ||
| 394 | - /* create a socket */ | ||
| 395 | - *sd = | ||
| 396 | - socket (PF_INET, (!strcmp (proto, "udp")) ? SOCK_DGRAM : SOCK_STREAM, | ||
| 397 | - ptrp->p_proto); | ||
| 398 | - if (*sd < 0) { | ||
| 399 | - printf ("Socket creation failed\n"); | ||
| 400 | - return STATE_UNKNOWN; | ||
| 401 | - } | ||
| 402 | - | ||
| 403 | - /* open a connection */ | ||
| 404 | - result = connect (*sd, (struct sockaddr *) &servaddr, sizeof (servaddr)); | ||
| 405 | - if (result < 0) { | ||
| 406 | - switch (errno) { | ||
| 407 | - case ECONNREFUSED: | ||
| 408 | - printf ("Connection refused by host\n"); | ||
| 409 | - break; | ||
| 410 | - case ETIMEDOUT: | ||
| 411 | - printf ("Timeout while attempting connection\n"); | ||
| 412 | - break; | ||
| 413 | - case ENETUNREACH: | ||
| 414 | - printf ("Network is unreachable\n"); | ||
| 415 | - break; | ||
| 416 | - default: | ||
| 417 | - printf ("Connection refused or timed out\n"); | ||
| 418 | - } | ||
| 419 | - | ||
| 420 | - return STATE_CRITICAL; | ||
| 421 | - } | ||
| 422 | - | ||
| 423 | - return STATE_OK; | ||
| 424 | -} | ||
| 425 | - | ||
| 426 | - | ||
| 427 | - | ||
| 428 | -/* This code was taken from Fyodor's nmap utility, which was originally | ||
| 429 | - taken from the GLIBC 2.0.6 libraries because Solaris doesn't contain | ||
| 430 | - the inet_aton() funtion. */ | ||
| 431 | -int | ||
| 432 | -my_inet_aton (register const char *cp, struct in_addr *addr) | ||
| 433 | +my_connect (char *host_name, int port, int *sd, int proto) | ||
| 434 | { | ||
| 435 | - register unsigned int val; /* changed from u_long --david */ | ||
| 436 | - register int base, n; | ||
| 437 | - register char c; | ||
| 438 | - u_int parts[4]; | ||
| 439 | - register u_int *pp = parts; | ||
| 440 | - | ||
| 441 | - c = *cp; | ||
| 442 | - | ||
| 443 | - for (;;) { | ||
| 444 | - | ||
| 445 | - /* | ||
| 446 | - * Collect number up to ``.''. | ||
| 447 | - * Values are specified as for C: | ||
| 448 | - * 0x=hex, 0=octal, isdigit=decimal. | ||
| 449 | - */ | ||
| 450 | - if (!isdigit ((int) c)) | ||
| 451 | - return (0); | ||
| 452 | - val = 0; | ||
| 453 | - base = 10; | ||
| 454 | - | ||
| 455 | - if (c == '0') { | ||
| 456 | - c = *++cp; | ||
| 457 | - if (c == 'x' || c == 'X') | ||
| 458 | - base = 16, c = *++cp; | ||
| 459 | - else | ||
| 460 | - base = 8; | ||
| 461 | - } | ||
| 462 | - | ||
| 463 | - for (;;) { | ||
| 464 | - if (isascii ((int) c) && isdigit ((int) c)) { | ||
| 465 | - val = (val * base) + (c - '0'); | ||
| 466 | - c = *++cp; | ||
| 467 | - } | ||
| 468 | - else if (base == 16 && isascii ((int) c) && isxdigit ((int) c)) { | ||
| 469 | - val = (val << 4) | (c + 10 - (islower ((int) c) ? 'a' : 'A')); | ||
| 470 | - c = *++cp; | ||
| 471 | - } | ||
| 472 | - else | ||
| 473 | - break; | ||
| 474 | - } | ||
| 475 | - | ||
| 476 | - if (c == '.') { | ||
| 477 | - | ||
| 478 | - /* | ||
| 479 | - * Internet format: | ||
| 480 | - * a.b.c.d | ||
| 481 | - * a.b.c (with c treated as 16 bits) | ||
| 482 | - * a.b (with b treated as 24 bits) | ||
| 483 | - */ | ||
| 484 | - if (pp >= parts + 3) | ||
| 485 | - return (0); | ||
| 486 | - *pp++ = val; | ||
| 487 | - c = *++cp; | ||
| 488 | - } | ||
| 489 | - else | ||
| 490 | - break; | ||
| 491 | - } | ||
| 492 | - | ||
| 493 | - /* Check for trailing characters */ | ||
| 494 | - if (c != '\0' && (!isascii ((int) c) || !isspace ((int) c))) | ||
| 495 | - return (0); | ||
| 496 | - | ||
| 497 | - /* Concoct the address according to the number of parts specified */ | ||
| 498 | - n = pp - parts + 1; | ||
| 499 | - switch (n) { | ||
| 500 | - | ||
| 501 | - case 0: | ||
| 502 | - return (0); /* initial nondigit */ | ||
| 503 | - | ||
| 504 | - case 1: /* a -- 32 bits */ | ||
| 505 | - break; | ||
| 506 | - | ||
| 507 | - case 2: /* a.b -- 8.24 bits */ | ||
| 508 | - if (val > 0xffffff) | ||
| 509 | - return (0); | ||
| 510 | - val |= parts[0] << 24; | ||
| 511 | - break; | ||
| 512 | - | ||
| 513 | - case 3: /* a.b.c -- 8.8.16 bits */ | ||
| 514 | - if (val > 0xffff) | ||
| 515 | - return (0); | ||
| 516 | - val |= (parts[0] << 24) | (parts[1] << 16); | ||
| 517 | - break; | ||
| 518 | - | ||
| 519 | - case 4: /* a.b.c.d -- 8.8.8.8 bits */ | ||
| 520 | - if (val > 0xff) | ||
| 521 | - return (0); | ||
| 522 | - val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); | ||
| 523 | - break; | ||
| 524 | - } | ||
| 525 | - | ||
| 526 | - if (addr) | ||
| 527 | - addr->s_addr = htonl (val); | ||
| 528 | - | ||
| 529 | - return (1); | ||
| 530 | + struct addrinfo hints; | ||
| 531 | + struct addrinfo *res; | ||
| 532 | + struct protoent *ptrp; | ||
| 533 | + char port_str[6]; | ||
| 534 | + int result; | ||
| 535 | + | ||
| 536 | + memset (&hints, 0, sizeof (hints)); | ||
| 537 | + hints.ai_family = PF_UNSPEC; | ||
| 538 | + hints.ai_protocol = proto; | ||
| 539 | + | ||
| 540 | + snprintf(port_str, sizeof(port_str), "%d", port); | ||
| 541 | + /* nice clean AF-independent code doesn't matter if passed hostname or IP address */ | ||
| 542 | + result = getaddrinfo (host_name, port_str, &hints, &res); | ||
| 543 | + | ||
| 544 | + if (result != 0) | ||
| 545 | + { | ||
| 546 | + printf ("%s\n", gai_strerror (result)); | ||
| 547 | + return STATE_UNKNOWN; | ||
| 548 | + } | ||
| 549 | + else | ||
| 550 | + { | ||
| 551 | + while (res) | ||
| 552 | + { | ||
| 553 | + /* attempt to create a socket */ | ||
| 554 | + *sd = socket (res->ai_family, (proto == IPPROTO_UDP) ? SOCK_DGRAM : SOCK_STREAM, res->ai_protocol); | ||
| 555 | + | ||
| 556 | + if (*sd < 0) { | ||
| 557 | + printf ("Socket creation failed\n"); | ||
| 558 | + freeaddrinfo (res); | ||
| 559 | + return STATE_UNKNOWN; | ||
| 560 | + } | ||
| 561 | + | ||
| 562 | + /* attempt to open a connection */ | ||
| 563 | + result = connect (*sd, res->ai_addr, res->ai_addrlen); | ||
| 564 | + | ||
| 565 | + if (result == 0) | ||
| 566 | + break; | ||
| 567 | + | ||
| 568 | + close(*sd); | ||
| 569 | + res = res->ai_next; | ||
| 570 | + } | ||
| 571 | + freeaddrinfo (res); | ||
| 572 | + } | ||
| 573 | + | ||
| 574 | + if (result == 0) | ||
| 575 | + return STATE_OK; | ||
| 576 | + else | ||
| 577 | + { | ||
| 578 | + printf ("%s\n", strerror(errno)); | ||
| 579 | + return STATE_CRITICAL; | ||
| 580 | + } | ||
| 581 | } | ||
| 582 | Index: netutils.h.in | ||
| 583 | =================================================================== | ||
| 584 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.h.in,v | ||
| 585 | retrieving revision 1.1.1.1 | ||
| 586 | diff -u -r1.1.1.1 netutils.h.in | ||
| 587 | --- netutils.h.in 28 Feb 2002 06:42:59 -0000 1.1.1.1 | ||
| 588 | +++ netutils.h.in 11 Dec 2002 02:39:50 -0000 | ||
| 589 | @@ -42,19 +42,17 @@ | ||
| 590 | void socket_timeout_alarm_handler (int); | ||
| 591 | |||
| 592 | int process_tcp_request2 (char *address, int port, char *sbuffer, | ||
| 593 | - char *rbuffer, int rsize); | ||
| 594 | + char *rbuffer, int rsize); | ||
| 595 | int process_tcp_request (char *address, int port, char *sbuffer, | ||
| 596 | - char *rbuffer, int rsize); | ||
| 597 | + char *rbuffer, int rsize); | ||
| 598 | int process_udp_request (char *address, int port, char *sbuffer, | ||
| 599 | - char *rbuffer, int rsize); | ||
| 600 | -int process_request (char *address, int port, char *proto, char *sbuffer, | ||
| 601 | - char *rbuffer, int rsize); | ||
| 602 | + char *rbuffer, int rsize); | ||
| 603 | +int process_request (char *address, int port, int proto, char *sbuffer, | ||
| 604 | + char *rbuffer, int rsize); | ||
| 605 | |||
| 606 | int my_tcp_connect (char *address, int port, int *sd); | ||
| 607 | int my_udp_connect (char *address, int port, int *sd); | ||
| 608 | -int my_connect (char *address, int port, int *sd, char *proto); | ||
| 609 | - | ||
| 610 | -int my_inet_aton (register const char *cp, struct in_addr *addr); | ||
| 611 | +int my_connect (char *address, int port, int *sd, int proto); | ||
| 612 | |||
| 613 | #ifndef DEFAULT_SOCKET_TIMEOUT | ||
| 614 | #include "config.h" | ||
| 615 | Index: utils.c | ||
| 616 | =================================================================== | ||
| 617 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.c,v | ||
| 618 | retrieving revision 1.13 | ||
| 619 | diff -u -r1.13 utils.c | ||
| 620 | --- utils.c 18 Nov 2002 07:22:28 -0000 1.13 | ||
| 621 | +++ utils.c 11 Dec 2002 02:39:50 -0000 | ||
| 622 | @@ -16,6 +16,9 @@ | ||
| 623 | #include "version.h" | ||
| 624 | #include <stdarg.h> | ||
| 625 | #include <limits.h> | ||
| 626 | +#include <sys/socket.h> | ||
| 627 | +#include <arpa/inet.h> | ||
| 628 | +#include <netdb.h> | ||
| 629 | |||
| 630 | extern int timeout_interval; | ||
| 631 | |||
| 632 | @@ -27,7 +30,9 @@ | ||
| 633 | RETSIGTYPE timeout_alarm_handler (int); | ||
| 634 | |||
| 635 | int is_host (char *); | ||
| 636 | -int is_dotted_quad (char *); | ||
| 637 | +int resolve_host_or_addr (char *, int); | ||
| 638 | +int is_ipv4_addr (char *); | ||
| 639 | +int is_ipv6_addr (char *); | ||
| 640 | int is_hostname (char *); | ||
| 641 | |||
| 642 | int is_integer (char *); | ||
| 643 | @@ -154,53 +159,49 @@ | ||
| 644 | int | ||
| 645 | is_host (char *address) | ||
| 646 | { | ||
| 647 | - if (is_dotted_quad (address) || is_hostname (address)) | ||
| 648 | + if (is_ipv4_addr (address) || is_ipv6_addr (address) || | ||
| 649 | + is_hostname (address)) | ||
| 650 | return (TRUE); | ||
| 651 | + | ||
| 652 | return (FALSE); | ||
| 653 | } | ||
| 654 | |||
| 655 | int | ||
| 656 | -is_dotted_quad (char *address) | ||
| 657 | +resolve_host_or_addr (char *address, int family) | ||
| 658 | { | ||
| 659 | - int o1, o2, o3, o4; | ||
| 660 | - char c[1]; | ||
| 661 | + struct addrinfo hints; | ||
| 662 | + struct addrinfo *res; | ||
| 663 | + int retval; | ||
| 664 | |||
| 665 | - if (sscanf (address, "%d.%d.%d.%d%c", &o1, &o2, &o3, &o4, c) != 4) | ||
| 666 | - return FALSE; | ||
| 667 | - else if (o1 > 255 || o2 > 255 || o3 > 255 || o4 > 255) | ||
| 668 | - return FALSE; | ||
| 669 | - else if (o1 < 0 || o2 < 0 || o3 < 0 || o4 < 0) | ||
| 670 | + memset (&hints, 0, sizeof (hints)); | ||
| 671 | + hints.ai_family = family; | ||
| 672 | + retval = getaddrinfo (address, NULL, &hints, &res); | ||
| 673 | + | ||
| 674 | + if (retval != 0) | ||
| 675 | return FALSE; | ||
| 676 | else | ||
| 677 | + { | ||
| 678 | + freeaddrinfo (res); | ||
| 679 | return TRUE; | ||
| 680 | + } | ||
| 681 | } | ||
| 682 | |||
| 683 | -/* from RFC-1035 | ||
| 684 | - * | ||
| 685 | - * The labels must follow the rules for ARPANET host names. They must | ||
| 686 | - * start with a letter, end with a letter or digit, and have as interior | ||
| 687 | - * characters only letters, digits, and hyphen. There are also some | ||
| 688 | - * restrictions on the length. Labels must be 63 characters or less. */ | ||
| 689 | +int | ||
| 690 | +is_ipv4_addr (char *address) | ||
| 691 | +{ | ||
| 692 | + return resolve_host_or_addr (address, AF_INET); | ||
| 693 | +} | ||
| 694 | + | ||
| 695 | +int | ||
| 696 | +is_ipv6_addr (char *address) | ||
| 697 | +{ | ||
| 698 | + return resolve_host_or_addr (address, AF_INET6); | ||
| 699 | +} | ||
| 700 | |||
| 701 | int | ||
| 702 | is_hostname (char *s1) | ||
| 703 | { | ||
| 704 | - if (strlen (s1) > 63) | ||
| 705 | - return FALSE; | ||
| 706 | - if (strcspn | ||
| 707 | - (s1, | ||
| 708 | - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUWVXYZ0123456789-.") != | ||
| 709 | - 0) return FALSE; | ||
| 710 | - if (strspn (s1, "0123456789-.") == 1) | ||
| 711 | - return FALSE; | ||
| 712 | - while ((s1 = index (s1, '.'))) { | ||
| 713 | - s1++; | ||
| 714 | - if (strspn (s1, "0123456789-.") == 1) { | ||
| 715 | - printf ("%s\n", s1); | ||
| 716 | - return FALSE; | ||
| 717 | - } | ||
| 718 | - } | ||
| 719 | - return TRUE; | ||
| 720 | + return resolve_host_or_addr (s1, AF_UNSPEC); | ||
| 721 | } | ||
| 722 | |||
| 723 | int | ||
| 724 | Index: utils.h.in | ||
| 725 | =================================================================== | ||
| 726 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.h.in,v | ||
| 727 | retrieving revision 1.7 | ||
| 728 | diff -u -r1.7 utils.h.in | ||
| 729 | --- utils.h.in 9 Nov 2002 03:39:35 -0000 1.7 | ||
| 730 | +++ utils.h.in 11 Dec 2002 02:39:50 -0000 | ||
| 731 | @@ -28,7 +28,8 @@ | ||
| 732 | /* Test input types */ | ||
| 733 | |||
| 734 | int is_host (char *); | ||
| 735 | -int is_dotted_quad (char *); | ||
| 736 | +int is_ipv4_addr (char *); | ||
| 737 | +int is_ipv6_addr (char *); | ||
| 738 | int is_hostname (char *); | ||
| 739 | |||
| 740 | int is_integer (char *); | ||
diff --git a/web/attachments/37324-nagiosplugins-netutils-20021210.diff b/web/attachments/37324-nagiosplugins-netutils-20021210.diff new file mode 100644 index 0000000..06cdcbb --- /dev/null +++ b/web/attachments/37324-nagiosplugins-netutils-20021210.diff | |||
| @@ -0,0 +1,434 @@ | |||
| 1 | Index: netutils.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.c,v | ||
| 4 | retrieving revision 1.1.1.1 | ||
| 5 | diff -u -r1.1.1.1 netutils.c | ||
| 6 | --- netutils.c 28 Feb 2002 06:42:59 -0000 1.1.1.1 | ||
| 7 | +++ netutils.c 11 Dec 2002 02:38:43 -0000 | ||
| 8 | @@ -42,13 +42,11 @@ | ||
| 9 | int process_tcp_request2 (char *, int, char *, char *, int); | ||
| 10 | int process_tcp_request (char *, int, char *, char *, int); | ||
| 11 | int process_udp_request (char *, int, char *, char *, int); | ||
| 12 | -int process_request (char *, int, char *, char *, char *, int); | ||
| 13 | +int process_request (char *, int, int, char *, char *, int); | ||
| 14 | |||
| 15 | int my_tcp_connect (char *, int, int *); | ||
| 16 | int my_udp_connect (char *, int, int *); | ||
| 17 | -int my_connect (char *, int, int *, char *); | ||
| 18 | - | ||
| 19 | -int my_inet_aton (register const char *, struct in_addr *); | ||
| 20 | +int my_connect (char *, int, int *, int); | ||
| 21 | |||
| 22 | /* handles socket timeouts */ | ||
| 23 | void | ||
| 24 | @@ -64,47 +62,29 @@ | ||
| 25 | /* connects to a host on a specified TCP port, sends a string, | ||
| 26 | and gets a response */ | ||
| 27 | int | ||
| 28 | -process_tcp_request (char *server_address, | ||
| 29 | - int server_port, | ||
| 30 | - char *send_buffer, char *recv_buffer, int recv_size) | ||
| 31 | +process_tcp_request (char *server_address, int server_port, | ||
| 32 | + char *send_buffer, char *recv_buffer, int recv_size) | ||
| 33 | { | ||
| 34 | - int result; | ||
| 35 | - char proto[4] = "tcp"; | ||
| 36 | - | ||
| 37 | - result = process_request (server_address, | ||
| 38 | - server_port, | ||
| 39 | - proto, send_buffer, recv_buffer, recv_size); | ||
| 40 | - | ||
| 41 | - return result; | ||
| 42 | + return process_request (server_address, server_port, IPPROTO_TCP, | ||
| 43 | + send_buffer, recv_buffer, recv_size); | ||
| 44 | } | ||
| 45 | |||
| 46 | - | ||
| 47 | /* connects to a host on a specified UDP port, sends a string, and gets a | ||
| 48 | response */ | ||
| 49 | int | ||
| 50 | -process_udp_request (char *server_address, | ||
| 51 | - int server_port, | ||
| 52 | - char *send_buffer, char *recv_buffer, int recv_size) | ||
| 53 | +process_udp_request (char *server_address, int server_port, | ||
| 54 | + char *send_buffer, char *recv_buffer, int recv_size) | ||
| 55 | { | ||
| 56 | - int result; | ||
| 57 | - char proto[4] = "udp"; | ||
| 58 | - | ||
| 59 | - result = process_request (server_address, | ||
| 60 | - server_port, | ||
| 61 | - proto, send_buffer, recv_buffer, recv_size); | ||
| 62 | - | ||
| 63 | - return result; | ||
| 64 | + return process_request (server_address, server_port, IPPROTO_UDP, | ||
| 65 | + send_buffer, recv_buffer, recv_size); | ||
| 66 | } | ||
| 67 | |||
| 68 | - | ||
| 69 | - | ||
| 70 | /* connects to a host on a specified tcp port, sends a string, and gets a | ||
| 71 | response. loops on select-recv until timeout or eof to get all of a | ||
| 72 | multi-packet answer */ | ||
| 73 | int | ||
| 74 | -process_tcp_request2 (char *server_address, | ||
| 75 | - int server_port, | ||
| 76 | - char *send_buffer, char *recv_buffer, int recv_size) | ||
| 77 | +process_tcp_request2 (char *server_address, int server_port, | ||
| 78 | + char *send_buffer, char *recv_buffer, int recv_size) | ||
| 79 | { | ||
| 80 | |||
| 81 | int result; | ||
| 82 | @@ -115,7 +95,7 @@ | ||
| 83 | fd_set readfds; | ||
| 84 | int recv_length = 0; | ||
| 85 | |||
| 86 | - result = my_connect (server_address, server_port, &sd, "tcp"); | ||
| 87 | + result = my_connect (server_address, server_port, &sd, IPPROTO_TCP); | ||
| 88 | if (result != STATE_OK) | ||
| 89 | return STATE_CRITICAL; | ||
| 90 | |||
| 91 | @@ -149,24 +129,30 @@ | ||
| 92 | else { /* it has */ | ||
| 93 | recv_result = | ||
| 94 | recv (sd, recv_buffer + recv_length, recv_size - recv_length - 1, 0); | ||
| 95 | - if (recv_result == -1) { /* recv failed, bail out */ | ||
| 96 | + if (recv_result == -1) { | ||
| 97 | + /* recv failed, bail out */ | ||
| 98 | strcpy (recv_buffer + recv_length, ""); | ||
| 99 | result = STATE_WARNING; | ||
| 100 | break; | ||
| 101 | } | ||
| 102 | - else if (recv_result == 0) { /* end of file ? */ | ||
| 103 | + else if (recv_result == 0) { | ||
| 104 | + /* end of file ? */ | ||
| 105 | recv_buffer[recv_length] = 0; | ||
| 106 | break; | ||
| 107 | } | ||
| 108 | - else { /* we got data! */ | ||
| 109 | + else { | ||
| 110 | + /* we got data! */ | ||
| 111 | recv_length += recv_result; | ||
| 112 | - if (recv_length >= recv_size - 1) { /* buffer full, we're done */ | ||
| 113 | + if (recv_length >= recv_size - 1) { | ||
| 114 | + /* buffer full, we're done */ | ||
| 115 | recv_buffer[recv_size - 1] = 0; | ||
| 116 | break; | ||
| 117 | } | ||
| 118 | } | ||
| 119 | - } /* end if(!FD_ISSET(sd,&readfds)) */ | ||
| 120 | - } /* end while(1) */ | ||
| 121 | + } | ||
| 122 | + /* end if(!FD_ISSET(sd,&readfds)) */ | ||
| 123 | + } | ||
| 124 | + /* end while(1) */ | ||
| 125 | |||
| 126 | close (sd); | ||
| 127 | return result; | ||
| 128 | @@ -175,10 +161,8 @@ | ||
| 129 | /* connects to a host on a specified port, sends a string, and gets a | ||
| 130 | response */ | ||
| 131 | int | ||
| 132 | -process_request (char *server_address, | ||
| 133 | - int server_port, | ||
| 134 | - char *proto, | ||
| 135 | - char *send_buffer, char *recv_buffer, int recv_size) | ||
| 136 | +process_request (char *server_address, int server_port, int proto, | ||
| 137 | + char *send_buffer, char *recv_buffer, int recv_size) | ||
| 138 | { | ||
| 139 | int result; | ||
| 140 | int send_result; | ||
| 141 | @@ -218,7 +202,7 @@ | ||
| 142 | recv_result = recv (sd, recv_buffer, recv_size - 1, 0); | ||
| 143 | if (recv_result == -1) { | ||
| 144 | strcpy (recv_buffer, ""); | ||
| 145 | - if (!strcmp (proto, "tcp")) | ||
| 146 | + if (proto != IPPROTO_TCP) | ||
| 147 | printf ("recv() failed\n"); | ||
| 148 | result = STATE_WARNING; | ||
| 149 | } | ||
| 150 | @@ -236,196 +220,74 @@ | ||
| 151 | |||
| 152 | |||
| 153 | /* opens a connection to a remote host/tcp port */ | ||
| 154 | + | ||
| 155 | int | ||
| 156 | my_tcp_connect (char *host_name, int port, int *sd) | ||
| 157 | { | ||
| 158 | - int result; | ||
| 159 | - char proto[4] = "tcp"; | ||
| 160 | - | ||
| 161 | - result = my_connect (host_name, port, sd, proto); | ||
| 162 | - | ||
| 163 | - return result; | ||
| 164 | + return my_connect (host_name, port, sd, IPPROTO_TCP); | ||
| 165 | } | ||
| 166 | |||
| 167 | - | ||
| 168 | /* opens a connection to a remote host/udp port */ | ||
| 169 | int | ||
| 170 | my_udp_connect (char *host_name, int port, int *sd) | ||
| 171 | { | ||
| 172 | - int result; | ||
| 173 | - char proto[4] = "udp"; | ||
| 174 | - | ||
| 175 | - result = my_connect (host_name, port, sd, proto); | ||
| 176 | - | ||
| 177 | - return result; | ||
| 178 | + return my_connect (host_name, port, sd, IPPROTO_UDP); | ||
| 179 | } | ||
| 180 | |||
| 181 | |||
| 182 | /* opens a tcp or udp connection to a remote host */ | ||
| 183 | int | ||
| 184 | -my_connect (char *host_name, int port, int *sd, char *proto) | ||
| 185 | -{ | ||
| 186 | - struct sockaddr_in servaddr; | ||
| 187 | - struct hostent *hp; | ||
| 188 | - struct protoent *ptrp; | ||
| 189 | - int result; | ||
| 190 | - | ||
| 191 | - bzero ((char *) &servaddr, sizeof (servaddr)); | ||
| 192 | - servaddr.sin_family = AF_INET; | ||
| 193 | - servaddr.sin_port = htons (port); | ||
| 194 | - | ||
| 195 | - /* try to bypass using a DNS lookup if this is just an IP address */ | ||
| 196 | - if (!my_inet_aton (host_name, &servaddr.sin_addr)) { | ||
| 197 | - | ||
| 198 | - /* else do a DNS lookup */ | ||
| 199 | - hp = gethostbyname ((const char *) host_name); | ||
| 200 | - if (hp == NULL) { | ||
| 201 | - printf ("Invalid host name '%s'\n", host_name); | ||
| 202 | - return STATE_UNKNOWN; | ||
| 203 | - } | ||
| 204 | - | ||
| 205 | - memcpy (&servaddr.sin_addr, hp->h_addr, hp->h_length); | ||
| 206 | - } | ||
| 207 | - | ||
| 208 | - /* map transport protocol name to protocol number */ | ||
| 209 | - if ((ptrp = getprotobyname (proto)) == NULL) { | ||
| 210 | - printf ("Cannot map \"%s\" to protocol number\n", proto); | ||
| 211 | - return STATE_UNKNOWN; | ||
| 212 | - } | ||
| 213 | - | ||
| 214 | - /* create a socket */ | ||
| 215 | - *sd = | ||
| 216 | - socket (PF_INET, (!strcmp (proto, "udp")) ? SOCK_DGRAM : SOCK_STREAM, | ||
| 217 | - ptrp->p_proto); | ||
| 218 | - if (*sd < 0) { | ||
| 219 | - printf ("Socket creation failed\n"); | ||
| 220 | - return STATE_UNKNOWN; | ||
| 221 | - } | ||
| 222 | - | ||
| 223 | - /* open a connection */ | ||
| 224 | - result = connect (*sd, (struct sockaddr *) &servaddr, sizeof (servaddr)); | ||
| 225 | - if (result < 0) { | ||
| 226 | - switch (errno) { | ||
| 227 | - case ECONNREFUSED: | ||
| 228 | - printf ("Connection refused by host\n"); | ||
| 229 | - break; | ||
| 230 | - case ETIMEDOUT: | ||
| 231 | - printf ("Timeout while attempting connection\n"); | ||
| 232 | - break; | ||
| 233 | - case ENETUNREACH: | ||
| 234 | - printf ("Network is unreachable\n"); | ||
| 235 | - break; | ||
| 236 | - default: | ||
| 237 | - printf ("Connection refused or timed out\n"); | ||
| 238 | - } | ||
| 239 | - | ||
| 240 | - return STATE_CRITICAL; | ||
| 241 | - } | ||
| 242 | - | ||
| 243 | - return STATE_OK; | ||
| 244 | -} | ||
| 245 | - | ||
| 246 | - | ||
| 247 | - | ||
| 248 | -/* This code was taken from Fyodor's nmap utility, which was originally | ||
| 249 | - taken from the GLIBC 2.0.6 libraries because Solaris doesn't contain | ||
| 250 | - the inet_aton() funtion. */ | ||
| 251 | -int | ||
| 252 | -my_inet_aton (register const char *cp, struct in_addr *addr) | ||
| 253 | +my_connect (char *host_name, int port, int *sd, int proto) | ||
| 254 | { | ||
| 255 | - register unsigned int val; /* changed from u_long --david */ | ||
| 256 | - register int base, n; | ||
| 257 | - register char c; | ||
| 258 | - u_int parts[4]; | ||
| 259 | - register u_int *pp = parts; | ||
| 260 | - | ||
| 261 | - c = *cp; | ||
| 262 | - | ||
| 263 | - for (;;) { | ||
| 264 | - | ||
| 265 | - /* | ||
| 266 | - * Collect number up to ``.''. | ||
| 267 | - * Values are specified as for C: | ||
| 268 | - * 0x=hex, 0=octal, isdigit=decimal. | ||
| 269 | - */ | ||
| 270 | - if (!isdigit ((int) c)) | ||
| 271 | - return (0); | ||
| 272 | - val = 0; | ||
| 273 | - base = 10; | ||
| 274 | - | ||
| 275 | - if (c == '0') { | ||
| 276 | - c = *++cp; | ||
| 277 | - if (c == 'x' || c == 'X') | ||
| 278 | - base = 16, c = *++cp; | ||
| 279 | - else | ||
| 280 | - base = 8; | ||
| 281 | - } | ||
| 282 | - | ||
| 283 | - for (;;) { | ||
| 284 | - if (isascii ((int) c) && isdigit ((int) c)) { | ||
| 285 | - val = (val * base) + (c - '0'); | ||
| 286 | - c = *++cp; | ||
| 287 | - } | ||
| 288 | - else if (base == 16 && isascii ((int) c) && isxdigit ((int) c)) { | ||
| 289 | - val = (val << 4) | (c + 10 - (islower ((int) c) ? 'a' : 'A')); | ||
| 290 | - c = *++cp; | ||
| 291 | - } | ||
| 292 | - else | ||
| 293 | - break; | ||
| 294 | - } | ||
| 295 | - | ||
| 296 | - if (c == '.') { | ||
| 297 | - | ||
| 298 | - /* | ||
| 299 | - * Internet format: | ||
| 300 | - * a.b.c.d | ||
| 301 | - * a.b.c (with c treated as 16 bits) | ||
| 302 | - * a.b (with b treated as 24 bits) | ||
| 303 | - */ | ||
| 304 | - if (pp >= parts + 3) | ||
| 305 | - return (0); | ||
| 306 | - *pp++ = val; | ||
| 307 | - c = *++cp; | ||
| 308 | - } | ||
| 309 | - else | ||
| 310 | - break; | ||
| 311 | - } | ||
| 312 | - | ||
| 313 | - /* Check for trailing characters */ | ||
| 314 | - if (c != '\0' && (!isascii ((int) c) || !isspace ((int) c))) | ||
| 315 | - return (0); | ||
| 316 | - | ||
| 317 | - /* Concoct the address according to the number of parts specified */ | ||
| 318 | - n = pp - parts + 1; | ||
| 319 | - switch (n) { | ||
| 320 | - | ||
| 321 | - case 0: | ||
| 322 | - return (0); /* initial nondigit */ | ||
| 323 | - | ||
| 324 | - case 1: /* a -- 32 bits */ | ||
| 325 | - break; | ||
| 326 | - | ||
| 327 | - case 2: /* a.b -- 8.24 bits */ | ||
| 328 | - if (val > 0xffffff) | ||
| 329 | - return (0); | ||
| 330 | - val |= parts[0] << 24; | ||
| 331 | - break; | ||
| 332 | - | ||
| 333 | - case 3: /* a.b.c -- 8.8.16 bits */ | ||
| 334 | - if (val > 0xffff) | ||
| 335 | - return (0); | ||
| 336 | - val |= (parts[0] << 24) | (parts[1] << 16); | ||
| 337 | - break; | ||
| 338 | - | ||
| 339 | - case 4: /* a.b.c.d -- 8.8.8.8 bits */ | ||
| 340 | - if (val > 0xff) | ||
| 341 | - return (0); | ||
| 342 | - val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); | ||
| 343 | - break; | ||
| 344 | - } | ||
| 345 | - | ||
| 346 | - if (addr) | ||
| 347 | - addr->s_addr = htonl (val); | ||
| 348 | - | ||
| 349 | - return (1); | ||
| 350 | + struct addrinfo hints; | ||
| 351 | + struct addrinfo *res; | ||
| 352 | + struct protoent *ptrp; | ||
| 353 | + char port_str[6]; | ||
| 354 | + int result; | ||
| 355 | + | ||
| 356 | + memset (&hints, 0, sizeof (hints)); | ||
| 357 | + hints.ai_family = PF_UNSPEC; | ||
| 358 | + hints.ai_protocol = proto; | ||
| 359 | + | ||
| 360 | + snprintf(port_str, sizeof(port_str), "%d", port); | ||
| 361 | + /* nice clean AF-independent code doesn't matter if passed hostname or IP address */ | ||
| 362 | + result = getaddrinfo (host_name, port_str, &hints, &res); | ||
| 363 | + | ||
| 364 | + if (result != 0) | ||
| 365 | + { | ||
| 366 | + printf ("%s\n", gai_strerror (result)); | ||
| 367 | + return STATE_UNKNOWN; | ||
| 368 | + } | ||
| 369 | + else | ||
| 370 | + { | ||
| 371 | + while (res) | ||
| 372 | + { | ||
| 373 | + /* attempt to create a socket */ | ||
| 374 | + *sd = socket (res->ai_family, (proto == IPPROTO_UDP) ? SOCK_DGRAM : SOCK_STREAM, res->ai_protocol); | ||
| 375 | + | ||
| 376 | + if (*sd < 0) { | ||
| 377 | + printf ("Socket creation failed\n"); | ||
| 378 | + freeaddrinfo (res); | ||
| 379 | + return STATE_UNKNOWN; | ||
| 380 | + } | ||
| 381 | + | ||
| 382 | + /* attempt to open a connection */ | ||
| 383 | + result = connect (*sd, res->ai_addr, res->ai_addrlen); | ||
| 384 | + | ||
| 385 | + if (result == 0) | ||
| 386 | + break; | ||
| 387 | + | ||
| 388 | + close(*sd); | ||
| 389 | + res = res->ai_next; | ||
| 390 | + } | ||
| 391 | + freeaddrinfo (res); | ||
| 392 | + } | ||
| 393 | + | ||
| 394 | + if (result == 0) | ||
| 395 | + return STATE_OK; | ||
| 396 | + else | ||
| 397 | + { | ||
| 398 | + printf ("%s\n", strerror(errno)); | ||
| 399 | + return STATE_CRITICAL; | ||
| 400 | + } | ||
| 401 | } | ||
| 402 | Index: netutils.h.in | ||
| 403 | =================================================================== | ||
| 404 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.h.in,v | ||
| 405 | retrieving revision 1.1.1.1 | ||
| 406 | diff -u -r1.1.1.1 netutils.h.in | ||
| 407 | --- netutils.h.in 28 Feb 2002 06:42:59 -0000 1.1.1.1 | ||
| 408 | +++ netutils.h.in 11 Dec 2002 02:38:43 -0000 | ||
| 409 | @@ -42,19 +42,17 @@ | ||
| 410 | void socket_timeout_alarm_handler (int); | ||
| 411 | |||
| 412 | int process_tcp_request2 (char *address, int port, char *sbuffer, | ||
| 413 | - char *rbuffer, int rsize); | ||
| 414 | + char *rbuffer, int rsize); | ||
| 415 | int process_tcp_request (char *address, int port, char *sbuffer, | ||
| 416 | - char *rbuffer, int rsize); | ||
| 417 | + char *rbuffer, int rsize); | ||
| 418 | int process_udp_request (char *address, int port, char *sbuffer, | ||
| 419 | - char *rbuffer, int rsize); | ||
| 420 | -int process_request (char *address, int port, char *proto, char *sbuffer, | ||
| 421 | - char *rbuffer, int rsize); | ||
| 422 | + char *rbuffer, int rsize); | ||
| 423 | +int process_request (char *address, int port, int proto, char *sbuffer, | ||
| 424 | + char *rbuffer, int rsize); | ||
| 425 | |||
| 426 | int my_tcp_connect (char *address, int port, int *sd); | ||
| 427 | int my_udp_connect (char *address, int port, int *sd); | ||
| 428 | -int my_connect (char *address, int port, int *sd, char *proto); | ||
| 429 | - | ||
| 430 | -int my_inet_aton (register const char *cp, struct in_addr *addr); | ||
| 431 | +int my_connect (char *address, int port, int *sd, int proto); | ||
| 432 | |||
| 433 | #ifndef DEFAULT_SOCKET_TIMEOUT | ||
| 434 | #include "config.h" | ||
diff --git a/web/attachments/37325-nagiosplugins-utils-20021210.diff b/web/attachments/37325-nagiosplugins-utils-20021210.diff new file mode 100644 index 0000000..3295f2e --- /dev/null +++ b/web/attachments/37325-nagiosplugins-utils-20021210.diff | |||
| @@ -0,0 +1,126 @@ | |||
| 1 | Index: utils.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.c,v | ||
| 4 | retrieving revision 1.13 | ||
| 5 | diff -u -r1.13 utils.c | ||
| 6 | --- utils.c 18 Nov 2002 07:22:28 -0000 1.13 | ||
| 7 | +++ utils.c 11 Dec 2002 02:39:17 -0000 | ||
| 8 | @@ -16,6 +16,9 @@ | ||
| 9 | #include "version.h" | ||
| 10 | #include <stdarg.h> | ||
| 11 | #include <limits.h> | ||
| 12 | +#include <sys/socket.h> | ||
| 13 | +#include <arpa/inet.h> | ||
| 14 | +#include <netdb.h> | ||
| 15 | |||
| 16 | extern int timeout_interval; | ||
| 17 | |||
| 18 | @@ -27,7 +30,9 @@ | ||
| 19 | RETSIGTYPE timeout_alarm_handler (int); | ||
| 20 | |||
| 21 | int is_host (char *); | ||
| 22 | -int is_dotted_quad (char *); | ||
| 23 | +int resolve_host_or_addr (char *, int); | ||
| 24 | +int is_ipv4_addr (char *); | ||
| 25 | +int is_ipv6_addr (char *); | ||
| 26 | int is_hostname (char *); | ||
| 27 | |||
| 28 | int is_integer (char *); | ||
| 29 | @@ -154,53 +159,49 @@ | ||
| 30 | int | ||
| 31 | is_host (char *address) | ||
| 32 | { | ||
| 33 | - if (is_dotted_quad (address) || is_hostname (address)) | ||
| 34 | + if (is_ipv4_addr (address) || is_ipv6_addr (address) || | ||
| 35 | + is_hostname (address)) | ||
| 36 | return (TRUE); | ||
| 37 | + | ||
| 38 | return (FALSE); | ||
| 39 | } | ||
| 40 | |||
| 41 | int | ||
| 42 | -is_dotted_quad (char *address) | ||
| 43 | +resolve_host_or_addr (char *address, int family) | ||
| 44 | { | ||
| 45 | - int o1, o2, o3, o4; | ||
| 46 | - char c[1]; | ||
| 47 | + struct addrinfo hints; | ||
| 48 | + struct addrinfo *res; | ||
| 49 | + int retval; | ||
| 50 | |||
| 51 | - if (sscanf (address, "%d.%d.%d.%d%c", &o1, &o2, &o3, &o4, c) != 4) | ||
| 52 | - return FALSE; | ||
| 53 | - else if (o1 > 255 || o2 > 255 || o3 > 255 || o4 > 255) | ||
| 54 | - return FALSE; | ||
| 55 | - else if (o1 < 0 || o2 < 0 || o3 < 0 || o4 < 0) | ||
| 56 | + memset (&hints, 0, sizeof (hints)); | ||
| 57 | + hints.ai_family = family; | ||
| 58 | + retval = getaddrinfo (address, NULL, &hints, &res); | ||
| 59 | + | ||
| 60 | + if (retval != 0) | ||
| 61 | return FALSE; | ||
| 62 | else | ||
| 63 | + { | ||
| 64 | + freeaddrinfo (res); | ||
| 65 | return TRUE; | ||
| 66 | + } | ||
| 67 | } | ||
| 68 | |||
| 69 | -/* from RFC-1035 | ||
| 70 | - * | ||
| 71 | - * The labels must follow the rules for ARPANET host names. They must | ||
| 72 | - * start with a letter, end with a letter or digit, and have as interior | ||
| 73 | - * characters only letters, digits, and hyphen. There are also some | ||
| 74 | - * restrictions on the length. Labels must be 63 characters or less. */ | ||
| 75 | +int | ||
| 76 | +is_ipv4_addr (char *address) | ||
| 77 | +{ | ||
| 78 | + return resolve_host_or_addr (address, AF_INET); | ||
| 79 | +} | ||
| 80 | + | ||
| 81 | +int | ||
| 82 | +is_ipv6_addr (char *address) | ||
| 83 | +{ | ||
| 84 | + return resolve_host_or_addr (address, AF_INET6); | ||
| 85 | +} | ||
| 86 | |||
| 87 | int | ||
| 88 | is_hostname (char *s1) | ||
| 89 | { | ||
| 90 | - if (strlen (s1) > 63) | ||
| 91 | - return FALSE; | ||
| 92 | - if (strcspn | ||
| 93 | - (s1, | ||
| 94 | - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUWVXYZ0123456789-.") != | ||
| 95 | - 0) return FALSE; | ||
| 96 | - if (strspn (s1, "0123456789-.") == 1) | ||
| 97 | - return FALSE; | ||
| 98 | - while ((s1 = index (s1, '.'))) { | ||
| 99 | - s1++; | ||
| 100 | - if (strspn (s1, "0123456789-.") == 1) { | ||
| 101 | - printf ("%s\n", s1); | ||
| 102 | - return FALSE; | ||
| 103 | - } | ||
| 104 | - } | ||
| 105 | - return TRUE; | ||
| 106 | + return resolve_host_or_addr (s1, AF_UNSPEC); | ||
| 107 | } | ||
| 108 | |||
| 109 | int | ||
| 110 | Index: utils.h.in | ||
| 111 | =================================================================== | ||
| 112 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.h.in,v | ||
| 113 | retrieving revision 1.7 | ||
| 114 | diff -u -r1.7 utils.h.in | ||
| 115 | --- utils.h.in 9 Nov 2002 03:39:35 -0000 1.7 | ||
| 116 | +++ utils.h.in 11 Dec 2002 02:39:17 -0000 | ||
| 117 | @@ -28,7 +28,8 @@ | ||
| 118 | /* Test input types */ | ||
| 119 | |||
| 120 | int is_host (char *); | ||
| 121 | -int is_dotted_quad (char *); | ||
| 122 | +int is_ipv4_addr (char *); | ||
| 123 | +int is_ipv6_addr (char *); | ||
| 124 | int is_hostname (char *); | ||
| 125 | |||
| 126 | int is_integer (char *); | ||
diff --git a/web/attachments/37326-nagiosplugins-updates-20021210.diff b/web/attachments/37326-nagiosplugins-updates-20021210.diff new file mode 100644 index 0000000..a8f81ad --- /dev/null +++ b/web/attachments/37326-nagiosplugins-updates-20021210.diff | |||
| @@ -0,0 +1,180 @@ | |||
| 1 | Index: check_dig.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_dig.c,v | ||
| 4 | retrieving revision 1.7 | ||
| 5 | diff -u -r1.7 check_dig.c | ||
| 6 | --- check_dig.c 21 Nov 2002 12:40:58 -0000 1.7 | ||
| 7 | +++ check_dig.c 11 Dec 2002 02:40:59 -0000 | ||
| 8 | @@ -57,7 +57,7 @@ | ||
| 9 | usage ("Could not parse arguments\n"); | ||
| 10 | |||
| 11 | /* get the command to run */ | ||
| 12 | - asprintf (&command_line, "%s @%s %s", PATH_TO_DIG, dns_server, query_address); | ||
| 13 | + asprintf (&command_line, "%s -t any @%s %s", PATH_TO_DIG, dns_server, query_address); | ||
| 14 | |||
| 15 | alarm (timeout_interval); | ||
| 16 | time (&start_time); | ||
| 17 | Index: check_dns.c | ||
| 18 | =================================================================== | ||
| 19 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_dns.c,v | ||
| 20 | retrieving revision 1.5 | ||
| 21 | diff -u -r1.5 check_dns.c | ||
| 22 | --- check_dns.c 14 Nov 2002 02:26:34 -0000 1.5 | ||
| 23 | +++ check_dns.c 11 Dec 2002 02:40:59 -0000 | ||
| 24 | @@ -308,7 +308,7 @@ | ||
| 25 | timeout_interval = atoi (optarg); | ||
| 26 | break; | ||
| 27 | case 'H': /* hostname */ | ||
| 28 | - if (is_host (optarg) == FALSE) { | ||
| 29 | + if ((is_host (optarg)) == FALSE) { | ||
| 30 | printf ("Invalid host name/address\n\n"); | ||
| 31 | print_usage (); | ||
| 32 | exit (STATE_UNKNOWN); | ||
| 33 | @@ -318,7 +318,7 @@ | ||
| 34 | strcpy (query_address, optarg); | ||
| 35 | break; | ||
| 36 | case 's': /* server name */ | ||
| 37 | - if (is_host (optarg) == FALSE) { | ||
| 38 | + if ((is_host (optarg)) == FALSE) { | ||
| 39 | printf ("Invalid server name/address\n\n"); | ||
| 40 | print_usage (); | ||
| 41 | exit (STATE_UNKNOWN); | ||
| 42 | @@ -328,7 +328,7 @@ | ||
| 43 | strcpy (dns_server, optarg); | ||
| 44 | break; | ||
| 45 | case 'r': /* reverse server name */ | ||
| 46 | - if (is_host (optarg) == FALSE) { | ||
| 47 | + if ((is_host (optarg)) == FALSE) { | ||
| 48 | printf ("Invalid host name/address\n\n"); | ||
| 49 | print_usage (); | ||
| 50 | exit (STATE_UNKNOWN); | ||
| 51 | @@ -338,7 +338,7 @@ | ||
| 52 | strcpy (ptr_server, optarg); | ||
| 53 | break; | ||
| 54 | case 'a': /* expected address */ | ||
| 55 | - if (is_dotted_quad (optarg) == FALSE) { | ||
| 56 | + if ((is_ipv4_addr (optarg)) == FALSE) { | ||
| 57 | printf ("Invalid expected address\n\n"); | ||
| 58 | print_usage (); | ||
| 59 | exit (STATE_UNKNOWN); | ||
| 60 | @@ -352,8 +352,8 @@ | ||
| 61 | } | ||
| 62 | |||
| 63 | c = optind; | ||
| 64 | - if (query_address[0] == 0) { | ||
| 65 | - if (is_host (argv[c]) == FALSE) { | ||
| 66 | + if (query_address == NULL) { | ||
| 67 | + if ((is_host (argv[c])) == FALSE) { | ||
| 68 | printf ("Invalid name/address: %s\n\n", argv[c]); | ||
| 69 | return ERROR; | ||
| 70 | } | ||
| 71 | @@ -362,8 +362,8 @@ | ||
| 72 | strcpy (query_address, argv[c++]); | ||
| 73 | } | ||
| 74 | |||
| 75 | - if (dns_server[0] == 0) { | ||
| 76 | - if (is_host (argv[c]) == FALSE) { | ||
| 77 | + if (dns_server == NULL) { | ||
| 78 | + if ((is_host (argv[c])) == FALSE) { | ||
| 79 | printf ("Invalid name/address: %s\n\n", argv[c]); | ||
| 80 | return ERROR; | ||
| 81 | } | ||
| 82 | Index: check_ldap.c | ||
| 83 | =================================================================== | ||
| 84 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ldap.c,v | ||
| 85 | retrieving revision 1.2 | ||
| 86 | diff -u -r1.2 check_ldap.c | ||
| 87 | --- check_ldap.c 14 Nov 2002 02:26:34 -0000 1.2 | ||
| 88 | +++ check_ldap.c 11 Dec 2002 02:40:59 -0000 | ||
| 89 | @@ -7,7 +7,7 @@ | ||
| 90 | * | ||
| 91 | * Last Modified: $Date: 2002/11/14 02:26:34 $ | ||
| 92 | * | ||
| 93 | - * Command line: check_ldap -h <host> -b <base_dn> -p <port> -w <warn_time> -w <crit_time> | ||
| 94 | + * Command line: check_ldap -H <host> -b <base_dn> -p <port> -w <warn_time> -w <crit_time> | ||
| 95 | * | ||
| 96 | * Description: | ||
| 97 | * | ||
| 98 | @@ -197,7 +197,7 @@ | ||
| 99 | crit_time = atoi (optarg); | ||
| 100 | break; | ||
| 101 | default: | ||
| 102 | - usage ("check_ldap: could not parse arguments\n"); | ||
| 103 | + usage ("check_ldap: could not parse unknown arguments\n"); | ||
| 104 | break; | ||
| 105 | } | ||
| 106 | } | ||
| 107 | @@ -253,6 +253,6 @@ | ||
| 108 | { | ||
| 109 | printf | ||
| 110 | ("Usage: %s -H <host> -b <base_dn> -p <port> [-a <attr>] [-D <binddn>]\n" | ||
| 111 | - " [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n" | ||
| 112 | + " [-P <password>] -w <warn_time> -c <crit_time> [-t timeout]\n" | ||
| 113 | "(Note: all times are in seconds.)\n", PROGNAME); | ||
| 114 | } | ||
| 115 | Index: check_ping.c | ||
| 116 | =================================================================== | ||
| 117 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ping.c,v | ||
| 118 | retrieving revision 1.10 | ||
| 119 | diff -u -r1.10 check_ping.c | ||
| 120 | --- check_ping.c 13 Nov 2002 11:50:54 -0000 1.10 | ||
| 121 | +++ check_ping.c 11 Dec 2002 02:40:59 -0000 | ||
| 122 | @@ -88,9 +88,15 @@ | ||
| 123 | |||
| 124 | /* does the host address of number of packets argument come first? */ | ||
| 125 | #ifdef PING_PACKETS_FIRST | ||
| 126 | - asprintf (&command_line, PING_COMMAND, max_packets, server_address); | ||
| 127 | + if (is_ipv6_addr (server_address)) | ||
| 128 | + asprintf (&command_line, PING6_COMMAND, max_packets, server_address); | ||
| 129 | + else | ||
| 130 | + asprintf (&command_line, PING_COMMAND, max_packets, server_address); | ||
| 131 | #else | ||
| 132 | - asprintf (&command_line, PING_COMMAND, server_address, max_packets); | ||
| 133 | + if (is_ipv6_addr (server_address)) | ||
| 134 | + asprintf (&command_line, PING6_COMMAND, server_address, max_packets); | ||
| 135 | + else | ||
| 136 | + asprintf (&command_line, PING_COMMAND, server_address, max_packets); | ||
| 137 | #endif | ||
| 138 | |||
| 139 | /* Set signal handling and alarm */ | ||
| 140 | Index: check_tcp.c | ||
| 141 | =================================================================== | ||
| 142 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_tcp.c,v | ||
| 143 | retrieving revision 1.8 | ||
| 144 | diff -u -r1.8 check_tcp.c | ||
| 145 | --- check_tcp.c 25 Nov 2002 12:00:17 -0000 1.8 | ||
| 146 | +++ check_tcp.c 11 Dec 2002 02:40:59 -0000 | ||
| 147 | @@ -225,8 +225,12 @@ | ||
| 148 | { | ||
| 149 | if (PROTOCOL == UDP_PROTOCOL) | ||
| 150 | result = my_udp_connect (server_address, server_port, &sd); | ||
| 151 | - else /* default is TCP */ | ||
| 152 | - result = my_tcp_connect (server_address, server_port, &sd); | ||
| 153 | + else | ||
| 154 | + /* default is TCP */ | ||
| 155 | + // result = my_tcp_connect (server_address, server_port, &sd); | ||
| 156 | + result = my_connect (server_address, server_port, &sd, IPPROTO_TCP); | ||
| 157 | +printf ("Catch value: %d\n", result); | ||
| 158 | +printf ("XXX: Check valve\n"); | ||
| 159 | } | ||
| 160 | |||
| 161 | if (result == STATE_CRITICAL) | ||
| 162 | Index: check_udp.c | ||
| 163 | =================================================================== | ||
| 164 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_udp.c,v | ||
| 165 | retrieving revision 1.2 | ||
| 166 | diff -u -r1.2 check_udp.c | ||
| 167 | --- check_udp.c 30 Oct 2002 18:46:01 -0000 1.2 | ||
| 168 | +++ check_udp.c 11 Dec 2002 02:40:59 -0000 | ||
| 169 | @@ -74,9 +74,8 @@ | ||
| 170 | alarm (socket_timeout); | ||
| 171 | |||
| 172 | time (&start_time); | ||
| 173 | - result = | ||
| 174 | - process_udp_request (server_address, server_port, server_send, | ||
| 175 | - recv_buffer, MAX_INPUT_BUFFER - 1); | ||
| 176 | + result = process_udp_request (server_address, server_port, server_send, | ||
| 177 | + recv_buffer, MAX_INPUT_BUFFER - 1); | ||
| 178 | time (&end_time); | ||
| 179 | |||
| 180 | if (result != STATE_OK) { | ||
diff --git a/web/attachments/373544-nagiosplug_check_http_search_string_in_not_found_output.patch b/web/attachments/373544-nagiosplug_check_http_search_string_in_not_found_output.patch new file mode 100644 index 0000000..1a27819 --- /dev/null +++ b/web/attachments/373544-nagiosplug_check_http_search_string_in_not_found_output.patch | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | diff --git a/plugins/check_http.c b/plugins/check_http.c | ||
| 2 | index 7f773c8..d363c17 100644 | ||
| 3 | --- a/plugins/check_http.c | ||
| 4 | +++ b/plugins/check_http.c | ||
| 5 | @@ -100,6 +100,7 @@ int server_url_length; | ||
| 6 | int server_expect_yn = 0; | ||
| 7 | char server_expect[MAX_INPUT_BUFFER] = HTTP_EXPECT; | ||
| 8 | char string_expect[MAX_INPUT_BUFFER] = ""; | ||
| 9 | +int output_string_match = FALSE; | ||
| 10 | double warning_time = 0; | ||
| 11 | int check_warning_time = FALSE; | ||
| 12 | double critical_time = 0; | ||
| 13 | @@ -198,6 +199,7 @@ process_arguments (int argc, char **argv) | ||
| 14 | {"authorization", required_argument, 0, 'a'}, | ||
| 15 | {"proxy_authorization", required_argument, 0, 'b'}, | ||
| 16 | {"string", required_argument, 0, 's'}, | ||
| 17 | + {"output-string-match", no_argument, 0, 'o'}, | ||
| 18 | {"expect", required_argument, 0, 'e'}, | ||
| 19 | {"regex", required_argument, 0, 'r'}, | ||
| 20 | {"ereg", required_argument, 0, 'r'}, | ||
| 21 | @@ -234,7 +236,7 @@ process_arguments (int argc, char **argv) | ||
| 22 | } | ||
| 23 | |||
| 24 | while (1) { | ||
| 25 | - c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 26 | + c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:e:p:s:oR:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 27 | if (c == -1 || c == EOF) | ||
| 28 | break; | ||
| 29 | |||
| 30 | @@ -377,6 +379,9 @@ process_arguments (int argc, char **argv) | ||
| 31 | strncpy (string_expect, optarg, MAX_INPUT_BUFFER - 1); | ||
| 32 | string_expect[MAX_INPUT_BUFFER - 1] = 0; | ||
| 33 | break; | ||
| 34 | + case 'o': /* output 'string' in STDOUT 'string not found' msg */ | ||
| 35 | + output_string_match = TRUE; | ||
| 36 | + break; | ||
| 37 | case 'e': /* string or substring */ | ||
| 38 | strncpy (server_expect, optarg, MAX_INPUT_BUFFER - 1); | ||
| 39 | server_expect[MAX_INPUT_BUFFER - 1] = 0; | ||
| 40 | @@ -1037,7 +1042,11 @@ check_http (void) | ||
| 41 | |||
| 42 | if (strlen (string_expect)) { | ||
| 43 | if (!strstr (page, string_expect)) { | ||
| 44 | - asprintf (&msg, _("%sstring not found, "), msg); | ||
| 45 | + if(!output_string_match){ | ||
| 46 | + asprintf (&msg, _("%sstring not found, "), msg); | ||
| 47 | + } else { | ||
| 48 | + asprintf (&msg, _("%sstring '%s' not found, "), msg, string_expect); | ||
| 49 | + } | ||
| 50 | result = STATE_CRITICAL; | ||
| 51 | } | ||
| 52 | } | ||
| 53 | @@ -1346,6 +1355,8 @@ print_help (void) | ||
| 54 | printf (" %s\n", _("If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)")); | ||
| 55 | printf (" %s\n", "-s, --string=STRING"); | ||
| 56 | printf (" %s\n", _("String to expect in the content")); | ||
| 57 | + printf (" %s\n", "-o, --output-string-match"); | ||
| 58 | + printf (" %s\n", _("Show given string as 'string xxx not found' message")); | ||
| 59 | printf (" %s\n", "-u, --url=PATH"); | ||
| 60 | printf (" %s\n", _("URL to GET or POST (default: /)")); | ||
| 61 | printf (" %s\n", "-P, --post=STRING"); | ||
diff --git a/web/attachments/37370-configure.in.patch b/web/attachments/37370-configure.in.patch new file mode 100644 index 0000000..d18d3ca --- /dev/null +++ b/web/attachments/37370-configure.in.patch | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | --- configure.in.original Thu Dec 5 20:33:08 2002 | ||
| 2 | +++ configure.in Thu Dec 5 22:42:50 2002 | ||
| 3 | @@ -620,6 +620,23 @@ | ||
| 4 | AC_DEFINE_UNQUOTED(RSS_COMMAND,"$PATH_TO_PS glaxen",[]) | ||
| 5 | AC_DEFINE_UNQUOTED(RSS_FORMAT,"%*s %*s %*s %*s %*s %*s %*s %d",[]) | ||
| 6 | echo " ps syntax... $PATH_TO_PS glaxen" | ||
| 7 | +dnl MacOSX / Darwin | ||
| 8 | +dnl MacOSX has commands with spaces which will cause problems to PS_FORMAT | ||
| 9 | +dnl STAT VSZ RSS UID USER PPID UCOMM COMMAND | ||
| 10 | +dnl Ss 1308 272 0 root 0 init /sbin/init | ||
| 11 | +elif [ps waxo 'state vsz rss uid user ppid ucomm command' 2>/dev/null | egrep -i "^STAT +VSZ +RSS +UID +USER +PPID +UCOMM +COMMAND" >/dev/null] | ||
| 12 | +then | ||
| 13 | + AC_DEFINE(USE_PS_VARS,1,[Define if we use custom variable list for sscanf]) | ||
| 14 | + AC_DEFINE_UNQUOTED(PS_VARLIST,[procstat,&procuid,&procppid,procprog,&pos],[]) | ||
| 15 | + AC_DEFINE_UNQUOTED(PS_RAW_COMMAND,"$PATH_TO_PS waxo 'state uid ppid command'",[]) | ||
| 16 | + EXTRAS="$EXTRAS check_nagios" | ||
| 17 | + AC_DEFINE_UNQUOTED(PS_COMMAND,"$PATH_TO_PS waxo 'state uid ppid ucomm command'",[]) | ||
| 18 | + AC_DEFINE_UNQUOTED(PS_FORMAT,"%s %d %d %s %n",[Format string for scanning ps output in check_procs]) | ||
| 19 | + AC_DEFINE_UNQUOTED(VSZ_COMMAND,"$PATH_TO_PS waxco 'vsz command'",[]) | ||
| 20 | + AC_DEFINE_UNQUOTED(VSZ_FORMAT,"%d %s",[]) | ||
| 21 | + AC_DEFINE_UNQUOTED(RSS_COMMAND,"$PATH_TO_PS waxco 'rss command'",[]) | ||
| 22 | + AC_DEFINE_UNQUOTED(RSS_FORMAT,"%d %s",[]) | ||
| 23 | + echo " ps syntax... $PATH_TO_PS waxo 'state vsz rss command'" | ||
| 24 | else | ||
| 25 | echo "** Unable to find usable ps syntax" | ||
| 26 | fi | ||
diff --git a/web/attachments/37372-plugins-Makefile.am.patch b/web/attachments/37372-plugins-Makefile.am.patch new file mode 100644 index 0000000..ed969e9 --- /dev/null +++ b/web/attachments/37372-plugins-Makefile.am.patch | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | --- Makefile.am.original Sat Dec 7 16:06:44 2002 | ||
| 2 | +++ Makefile.am Thu Dec 5 21:01:50 2002 | ||
| 3 | @@ -127,6 +127,7 @@ | ||
| 4 | |||
| 5 | libgetopt.a: getopt.o getopt1.o | ||
| 6 | $(AR) -r $@ getopt.o getopt1.o | ||
| 7 | + $(RANLIB) $@ | ||
| 8 | |||
| 9 | libsnprintf.a: snprintf.o | ||
| 10 | $(AR) -r $@ snprintf.o | ||
diff --git a/web/attachments/37373-check_procs.c.patch b/web/attachments/37373-check_procs.c.patch new file mode 100644 index 0000000..5cb9fe3 --- /dev/null +++ b/web/attachments/37373-check_procs.c.patch | |||
| @@ -0,0 +1,105 @@ | |||
| 1 | <!DOCTYPE html> | ||
| 2 | <!DOCTYPE html> | ||
| 3 | <html lang="en"> | ||
| 4 | <head> | ||
| 5 | <meta charset="utf-8" /> | ||
| 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 7 | <title>SourceForge - Unable to display the page requested</title> | ||
| 8 | <link href="//fonts.googleapis.com/css?family=Ubuntu:regular" rel="stylesheet"> | ||
| 9 | <style type="text/css"> | ||
| 10 | html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; } | ||
| 11 | body { line-height: 1; } | ||
| 12 | ol, ul { list-style: none; } | ||
| 13 | table { border-collapse: collapse; border-spacing: 0; } | ||
| 14 | caption, th, td { text-align: left; font-weight: normal; vertical-align: middle; } | ||
| 15 | q, blockquote { quotes: none; } | ||
| 16 | q:before, q:after, blockquote:before, blockquote:after { content: ""; content: none; } | ||
| 17 | a img { border: none; } | ||
| 18 | article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary { display: block; } | ||
| 19 | body { background: #fff; color: #333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin: 0; padding: 0; } | ||
| 20 | a { color: #07a; } | ||
| 21 | #header { background: #eee; border-bottom: 1px solid #aaa; height: 50px; -moz-box-shadow: 0px 2px 4px 0px #cccccc; -webkit-box-shadow: 0px 2px 4px 0px #cccccc; -o-box-shadow: 0px 2px 4px 0px #cccccc; box-shadow: 0px 2px 4px 0px #cccccc; } | ||
| 22 | #header section { margin: 0 auto; width: 960px; padding: 5px 0; } | ||
| 23 | #content { margin: 0 auto; width: 960px; } | ||
| 24 | #content h1 { font-family: Ubuntu; font-size: 47px; font-weight: bold; margin: 40px 0 20px 0; } | ||
| 25 | #content p { margin-bottom: 60px; font-size: 16px; } | ||
| 26 | #content #error-message { float: left; margin-right: 20px; } | ||
| 27 | #content #twitter { float: left; position: relative; } | ||
| 28 | #content #twitter #twitter-bird { position: absolute; top: 40px; } | ||
| 29 | #content #twitter #message-bubble { position: relative; background: url("//a.fsdn.com/sorry/bubble.png") no-repeat; left: 60px; top: 18px; width: 333px; height: 150px; padding: 9px 28px; } | ||
| 30 | </style> | ||
| 31 | </head> | ||
| 32 | <body> | ||
| 33 | <header id="header"> | ||
| 34 | <section> | ||
| 35 | <a id="logo" href="http://sourceforge.net"><img src="//a.fsdn.com/sorry/logo.png" alt="SourceForge Logo" /></a> | ||
| 36 | </section> | ||
| 37 | </header> | ||
| 38 | <section id="content"> | ||
| 39 | <h1>Oops, looks like something went wrong.</h1> | ||
| 40 | <p> | ||
| 41 | For updates, follow us on <a href="http://twitter.com/sfnet_ops" title="@sfnet_ops">twitter</a> or check the <a href="http://sourceforge.net/sitestatus" title="Listing of services and their status">status dashboard</a>. | ||
| 42 | While we fix the issue checkout <a href="http://slashdot.org" title="News for Nerds">Slashdot</a> or <a href="http://thinkgeek.com" title="Stuff for smart masses">Thinkgeek</a>. | ||
| 43 | </p> | ||
| 44 | <img src="//a.fsdn.com/sorry/500.png" alt="500 Error" id="error-message"/> | ||
| 45 | <section id="twitter"> | ||
| 46 | <img id="twitter-bird" src="//a.fsdn.com/sorry/twitter_bird.png" alt="Twitter Bird" /> | ||
| 47 | <div id="message-bubble"> | ||
| 48 | <a class="twitter-timeline" data-dnt="true" href="https://twitter.com/sfnet_ops" data-widget-id="347335110670049280" data-tweet-limit="1" width="330" height="115" data-chrome="nofooter noborders noscrollbar">Tweets by @sfnet_ops</a> | ||
| 49 | <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> | ||
| 50 | </div> | ||
| 51 | </section> | ||
| 52 | </section> | ||
| 53 | <script type="text/javascript"> | ||
| 54 | var url, filename, project; | ||
| 55 | |||
| 56 | /* | ||
| 57 | Match: | ||
| 58 | /projects/xyz/files/a/download | ||
| 59 | /a/b/c/download | ||
| 60 | /a/download?use_mirror=m (url params aren't in window.location.pathname) | ||
| 61 | non-greedy match on project name | ||
| 62 | optional greedy match on file path including trailing slash | ||
| 63 | regular match on base file name | ||
| 64 | */ | ||
| 65 | var regexp = new RegExp('^/projects/(.+?)/files/(.*/)?(.+)/download$'); | ||
| 66 | var matches = window.location.pathname.match(regexp); | ||
| 67 | if (matches) { | ||
| 68 | project = matches[1]; | ||
| 69 | var path = matches[2] || ''; // may be undefined | ||
| 70 | filename = matches[3]; | ||
| 71 | url = '//downloads.sourceforge.net/project/' + project + '/' + path + filename; | ||
| 72 | } | ||
| 73 | |||
| 74 | if (window.location.pathname === '/project/downloading.php') { | ||
| 75 | /* | ||
| 76 | match: | ||
| 77 | /project/downloading.php?groupname=xyz&filename=abc.zip | ||
| 78 | abc.zip&use_mirror=m | ||
| 79 | non-greedy match on project name | ||
| 80 | non-greedy match on filename, terminated by EOL or '&' | ||
| 81 | */ | ||
| 82 | var legacy_re = new RegExp('groupname=(.+?)&filename=(.+?)($|&)'); | ||
| 83 | var legacy_matches = window.location.search.match(legacy_re); | ||
| 84 | if (legacy_matches) { | ||
| 85 | project = legacy_matches[1]; | ||
| 86 | filename = legacy_matches[2]; | ||
| 87 | url = '//downloads.sourceforge.net/' + project + '/' + filename; | ||
| 88 | } | ||
| 89 | } | ||
| 90 | |||
| 91 | /*global console*/ | ||
| 92 | if (url && filename) { | ||
| 93 | url += '?fromerrorjs=1'; | ||
| 94 | if (window.location.hostname === 'sourceforge.net') { | ||
| 95 | window.location = url; | ||
| 96 | } else if (window.console) { | ||
| 97 | console.log('redirecting to ' + url); | ||
| 98 | } | ||
| 99 | document.title = 'Downloading ' + decodeURIComponent(filename) + ' [Internal Code - ' + document.title + ']'; | ||
| 100 | // h2 with large font instead of h1, so that a styling is correct | ||
| 101 | document.getElementById('doc4').innerHTML = '<h2 style="margin:5em;font-size:150%">Downloading <a href="' + url + '">' + decodeURIComponent(filename) + '<\/a> ...<\/h2>'; | ||
| 102 | } | ||
| 103 | </script> | ||
| 104 | </body> | ||
| 105 | </html> | ||
diff --git a/web/attachments/37375-check_vsz.c.patch b/web/attachments/37375-check_vsz.c.patch new file mode 100644 index 0000000..6a0488a --- /dev/null +++ b/web/attachments/37375-check_vsz.c.patch | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | --- check_vsz.c.original Sat Dec 7 17:21:29 2002 | ||
| 2 | +++ check_vsz.c Sat Dec 7 17:20:44 2002 | ||
| 3 | @@ -63,7 +63,7 @@ | ||
| 4 | char proc_name[MAX_INPUT_BUFFER]; | ||
| 5 | char *message = ""; | ||
| 6 | |||
| 7 | - if (!process_arguments (argc, argv)) { | ||
| 8 | + if (process_arguments (argc, argv) == ERROR ) { | ||
| 9 | printf ("%s: failure parsing arguments\n", my_basename (argv[0])); | ||
| 10 | print_help (my_basename (argv[0])); | ||
| 11 | return STATE_UNKNOWN; | ||
| 12 | @@ -94,7 +94,7 @@ | ||
| 13 | asprintf (&message, "%s %s(%d)", message, proc_name, proc_size); | ||
| 14 | result = max_state (result, STATE_WARNING); | ||
| 15 | } | ||
| 16 | - if (proc_size > crit) { | ||
| 17 | + if (crit != -1 && proc_size > crit) { | ||
| 18 | result = STATE_CRITICAL; | ||
| 19 | } | ||
| 20 | } | ||
| 21 | @@ -103,7 +103,7 @@ | ||
| 22 | if (proc_size > warn) { | ||
| 23 | result = max_state (result, STATE_WARNING); | ||
| 24 | } | ||
| 25 | - if (proc_size > crit) { | ||
| 26 | + if (crit != -1 && proc_size > crit) { | ||
| 27 | result = STATE_CRITICAL; | ||
| 28 | } | ||
| 29 | } | ||
| 30 | @@ -121,7 +121,7 @@ | ||
| 31 | result = max_state (result, STATE_WARNING); | ||
| 32 | |||
| 33 | if (result == STATE_OK) | ||
| 34 | - printf ("ok (all VSZ<%d): %s\n", warn, message); | ||
| 35 | + printf ("OK (all VSZ<%d): %s\n", warn, message); | ||
| 36 | else if (result == STATE_UNKNOWN) | ||
| 37 | printf ("Unable to read output\n"); | ||
| 38 | else if (result == STATE_WARNING) | ||
| 39 | @@ -166,7 +166,6 @@ | ||
| 40 | |||
| 41 | switch (c) { | ||
| 42 | case '?': /* help */ | ||
| 43 | - printf ("%s: Unknown argument: %s\n\n", my_basename (argv[0]), optarg); | ||
| 44 | print_usage (my_basename (argv[0])); | ||
| 45 | exit (STATE_UNKNOWN); | ||
| 46 | case 'h': /* help */ | ||
| 47 | @@ -200,7 +199,7 @@ | ||
| 48 | } | ||
| 49 | |||
| 50 | c = optind; | ||
| 51 | - if (warn == -1) { | ||
| 52 | + if (warn == -1 && argv[c]) { | ||
| 53 | if (!is_intnonneg (argv[c])) { | ||
| 54 | printf ("%s: critical threshold must be an integer: %s\n", | ||
| 55 | PROGNAME, argv[c]); | ||
| 56 | @@ -210,7 +209,7 @@ | ||
| 57 | warn = atoi (argv[c++]); | ||
| 58 | } | ||
| 59 | |||
| 60 | - if (crit == -1) { | ||
| 61 | + if (crit == -1 && argv[c]) { | ||
| 62 | if (!is_intnonneg (argv[c])) { | ||
| 63 | printf ("%s: critical threshold must be an integer: %s\n", | ||
| 64 | PROGNAME, argv[c]); | ||
| 65 | @@ -222,6 +221,17 @@ | ||
| 66 | |||
| 67 | if (proc == NULL) | ||
| 68 | proc = argv[c]; | ||
| 69 | + | ||
| 70 | + // Validate arguments | ||
| 71 | + if (warn == -1) { | ||
| 72 | + if (crit != -1) | ||
| 73 | + warn = crit; | ||
| 74 | + else { | ||
| 75 | + printf ("%s: Must specify a critical or warning threshold\n", PROGNAME); | ||
| 76 | + print_usage (PROGNAME); | ||
| 77 | + exit (STATE_UNKNOWN); | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | |||
| 81 | return c; | ||
| 82 | } | ||
diff --git a/web/attachments/37563-nagiosplug-check_ssh-20021213.diff b/web/attachments/37563-nagiosplug-check_ssh-20021213.diff new file mode 100644 index 0000000..091b5bf --- /dev/null +++ b/web/attachments/37563-nagiosplug-check_ssh-20021213.diff | |||
| @@ -0,0 +1,126 @@ | |||
| 1 | Index: plugins/check_ssh.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ssh.c,v | ||
| 4 | retrieving revision 1.3 | ||
| 5 | diff -u -r1.3 check_ssh.c | ||
| 6 | --- plugins/check_ssh.c 30 Oct 2002 18:44:43 -0000 1.3 | ||
| 7 | +++ plugins/check_ssh.c 14 Dec 2002 04:31:32 -0000 | ||
| 8 | @@ -34,7 +34,6 @@ | ||
| 9 | void print_help (void); | ||
| 10 | void print_usage (void); | ||
| 11 | |||
| 12 | -char *ssh_resolve (char *hostname); | ||
| 13 | int ssh_connect (char *haddr, short hport); | ||
| 14 | |||
| 15 | int | ||
| 16 | @@ -49,7 +48,7 @@ | ||
| 17 | alarm (socket_timeout); | ||
| 18 | |||
| 19 | /* ssh_connect exits if error is found */ | ||
| 20 | - ssh_connect (ssh_resolve (server_name), port); | ||
| 21 | + ssh_connect (server_name, port); | ||
| 22 | |||
| 23 | alarm (0); | ||
| 24 | |||
| 25 | @@ -109,6 +108,8 @@ | ||
| 26 | socket_timeout = atoi (optarg); | ||
| 27 | break; | ||
| 28 | case 'H': /* host */ | ||
| 29 | + if (is_host (optarg) == FALSE) | ||
| 30 | + usage ("Invalid host name/addresss\n"); | ||
| 31 | server_name = optarg; | ||
| 32 | break; | ||
| 33 | case 'p': /* port */ | ||
| 34 | @@ -125,7 +126,8 @@ | ||
| 35 | |||
| 36 | c = optind; | ||
| 37 | if (server_name == NULL && argv[c]) { | ||
| 38 | - server_name = argv[c++]; | ||
| 39 | + if (is_host (argv[c++])) | ||
| 40 | + server_name = argv[c++]; | ||
| 41 | } | ||
| 42 | else if (port == -1 && argv[c]) { | ||
| 43 | if (is_intpos (argv[c])) { | ||
| 44 | @@ -153,26 +155,6 @@ | ||
| 45 | |||
| 46 | /************************************************************************ | ||
| 47 | * | ||
| 48 | -* Resolve hostname into IP address | ||
| 49 | -* | ||
| 50 | -*-----------------------------------------------------------------------*/ | ||
| 51 | - | ||
| 52 | -char * | ||
| 53 | -ssh_resolve (char *hostname) | ||
| 54 | -{ | ||
| 55 | - struct hostent *host; | ||
| 56 | - | ||
| 57 | - host = gethostbyname (hostname); | ||
| 58 | - if (!host) { | ||
| 59 | - herror (hostname); | ||
| 60 | - exit (STATE_CRITICAL); | ||
| 61 | - } | ||
| 62 | - return (host->h_addr); | ||
| 63 | -} | ||
| 64 | - | ||
| 65 | - | ||
| 66 | -/************************************************************************ | ||
| 67 | -* | ||
| 68 | * Try to connect to SSH server at specified server and port | ||
| 69 | * | ||
| 70 | *-----------------------------------------------------------------------*/ | ||
| 71 | @@ -180,39 +162,24 @@ | ||
| 72 | int | ||
| 73 | ssh_connect (char *haddr, short hport) | ||
| 74 | { | ||
| 75 | - int s; | ||
| 76 | - struct sockaddr_in addr; | ||
| 77 | - int addrlen; | ||
| 78 | - int len; | ||
| 79 | + int result; | ||
| 80 | + int sock; | ||
| 81 | char *output = NULL; | ||
| 82 | char *buffer = NULL; | ||
| 83 | char *ssh_proto = NULL; | ||
| 84 | char *ssh_server = NULL; | ||
| 85 | char revision[20]; | ||
| 86 | |||
| 87 | - sscanf ("$Revision: 1.3 $", "$Revision: %[0123456789.]", revision); | ||
| 88 | + sscanf ("$Revision: 1.3 $", "$Revision: %[0-9.]", revision); | ||
| 89 | |||
| 90 | - addrlen = sizeof (addr); | ||
| 91 | - memset (&addr, 0, addrlen); | ||
| 92 | - addr.sin_port = htons (hport); | ||
| 93 | - addr.sin_family = AF_INET; | ||
| 94 | - bcopy (haddr, (void *) &addr.sin_addr.s_addr, 4); | ||
| 95 | - | ||
| 96 | - s = socket (AF_INET, SOCK_STREAM, 0); | ||
| 97 | - if (!s) { | ||
| 98 | - printf ("socket(): %s for %s:%d\n", strerror (errno), server_name, hport); | ||
| 99 | - exit (STATE_CRITICAL); | ||
| 100 | - } | ||
| 101 | + result = my_tcp_connect (haddr, hport, &sock); | ||
| 102 | |||
| 103 | - if (connect (s, (struct sockaddr *) &addr, addrlen)) { | ||
| 104 | - printf ("connect(): %s for %s:%d\n", strerror (errno), server_name, | ||
| 105 | - hport); | ||
| 106 | - exit (STATE_CRITICAL); | ||
| 107 | - } | ||
| 108 | + if (result != STATE_OK) | ||
| 109 | + return result; | ||
| 110 | |||
| 111 | output = (char *) malloc (BUFF_SZ + 1); | ||
| 112 | memset (output, 0, BUFF_SZ + 1); | ||
| 113 | - recv (s, output, BUFF_SZ, 0); | ||
| 114 | + recv (sock, output, BUFF_SZ, 0); | ||
| 115 | if (strncmp (output, "SSH", 3)) { | ||
| 116 | printf ("Server answer: %s", output); | ||
| 117 | exit (STATE_CRITICAL); | ||
| 118 | @@ -228,7 +195,7 @@ | ||
| 119 | ("SSH ok - %s (protocol %s)\n", | ||
| 120 | ssh_server, ssh_proto); | ||
| 121 | asprintf (&buffer, "SSH-%s-check_ssh_%s\r\n", ssh_proto, revision); | ||
| 122 | - send (s, buffer, strlen (buffer), MSG_DONTWAIT); | ||
| 123 | + send (sock, buffer, strlen (buffer), MSG_DONTWAIT); | ||
| 124 | if (verbose) | ||
| 125 | printf ("%s\n", buffer); | ||
| 126 | exit (STATE_OK); | ||
diff --git a/web/attachments/376677-nagiosplug_check_http_search_string_in_not_found_output.patch b/web/attachments/376677-nagiosplug_check_http_search_string_in_not_found_output.patch new file mode 100644 index 0000000..ac18fe2 --- /dev/null +++ b/web/attachments/376677-nagiosplug_check_http_search_string_in_not_found_output.patch | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | diff --git a/plugins/check_http.c b/plugins/check_http.c | ||
| 2 | index 7f773c8..3fe6998 100644 | ||
| 3 | --- a/plugins/check_http.c | ||
| 4 | +++ b/plugins/check_http.c | ||
| 5 | @@ -100,6 +100,7 @@ int server_url_length; | ||
| 6 | int server_expect_yn = 0; | ||
| 7 | char server_expect[MAX_INPUT_BUFFER] = HTTP_EXPECT; | ||
| 8 | char string_expect[MAX_INPUT_BUFFER] = ""; | ||
| 9 | +int output_string_match = FALSE; | ||
| 10 | double warning_time = 0; | ||
| 11 | int check_warning_time = FALSE; | ||
| 12 | double critical_time = 0; | ||
| 13 | @@ -198,6 +199,7 @@ process_arguments (int argc, char **argv) | ||
| 14 | {"authorization", required_argument, 0, 'a'}, | ||
| 15 | {"proxy_authorization", required_argument, 0, 'b'}, | ||
| 16 | {"string", required_argument, 0, 's'}, | ||
| 17 | + {"output-string-match", no_argument, 0, 'o'}, | ||
| 18 | {"expect", required_argument, 0, 'e'}, | ||
| 19 | {"regex", required_argument, 0, 'r'}, | ||
| 20 | {"ereg", required_argument, 0, 'r'}, | ||
| 21 | @@ -234,7 +236,7 @@ process_arguments (int argc, char **argv) | ||
| 22 | } | ||
| 23 | |||
| 24 | while (1) { | ||
| 25 | - c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 26 | + c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:e:p:s:oR:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 27 | if (c == -1 || c == EOF) | ||
| 28 | break; | ||
| 29 | |||
| 30 | @@ -377,6 +379,9 @@ process_arguments (int argc, char **argv) | ||
| 31 | strncpy (string_expect, optarg, MAX_INPUT_BUFFER - 1); | ||
| 32 | string_expect[MAX_INPUT_BUFFER - 1] = 0; | ||
| 33 | break; | ||
| 34 | + case 'o': /* output 'string' in STDOUT 'string not found' msg */ | ||
| 35 | + output_string_match = TRUE; | ||
| 36 | + break; | ||
| 37 | case 'e': /* string or substring */ | ||
| 38 | strncpy (server_expect, optarg, MAX_INPUT_BUFFER - 1); | ||
| 39 | server_expect[MAX_INPUT_BUFFER - 1] = 0; | ||
| 40 | @@ -1037,7 +1042,11 @@ check_http (void) | ||
| 41 | |||
| 42 | if (strlen (string_expect)) { | ||
| 43 | if (!strstr (page, string_expect)) { | ||
| 44 | - asprintf (&msg, _("%sstring not found, "), msg); | ||
| 45 | + if(!output_string_match){ | ||
| 46 | + asprintf (&msg, _("%sstring not found, "), msg); | ||
| 47 | + } else { | ||
| 48 | + asprintf (&msg, _("%sstring '%s' not found on '%s://%s:%d%s', "), msg, string_expect, use_ssl ? "https" : "http", host_name ? host_name : server_address, server_port, server_url); | ||
| 49 | + } | ||
| 50 | result = STATE_CRITICAL; | ||
| 51 | } | ||
| 52 | } | ||
| 53 | @@ -1346,6 +1355,8 @@ print_help (void) | ||
| 54 | printf (" %s\n", _("If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)")); | ||
| 55 | printf (" %s\n", "-s, --string=STRING"); | ||
| 56 | printf (" %s\n", _("String to expect in the content")); | ||
| 57 | + printf (" %s\n", "-o, --output-string-match"); | ||
| 58 | + printf (" %s\n", _("Show given string as 'string xxx not found' message")); | ||
| 59 | printf (" %s\n", "-u, --url=PATH"); | ||
| 60 | printf (" %s\n", _("URL to GET or POST (default: /)")); | ||
| 61 | printf (" %s\n", "-P, --post=STRING"); | ||
diff --git a/web/attachments/379681-check_sip.diff b/web/attachments/379681-check_sip.diff new file mode 100644 index 0000000..f73f7a9 --- /dev/null +++ b/web/attachments/379681-check_sip.diff | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | 28c28 | ||
| 2 | < use lib "/usr/lib/nagios/plugins"; | ||
| 3 | --- | ||
| 4 | > use lib "/usr/local/nagios/libexec"; | ||
diff --git a/web/attachments/382256-nagios-plugins-check_disk_usage.patch b/web/attachments/382256-nagios-plugins-check_disk_usage.patch new file mode 100644 index 0000000..8beefc1 --- /dev/null +++ b/web/attachments/382256-nagios-plugins-check_disk_usage.patch | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | diff -urN nagios-plugins-1.4.15/plugins/check_disk.c nagios-plugins-1.4.15.new/plugins/check_disk.c | ||
| 2 | --- nagios-plugins-1.4.15/plugins/check_disk.c 2010-07-27 22:47:16.000000000 +0200 | ||
| 3 | +++ nagios-plugins-1.4.15.new/plugins/check_disk.c 2010-08-04 13:49:46.000000000 +0200 | ||
| 4 | @@ -148,6 +148,7 @@ | ||
| 5 | int path_selected = FALSE; | ||
| 6 | char *group = NULL; | ||
| 7 | struct stat *stat_buf; | ||
| 8 | +int output_usage = FALSE; | ||
| 9 | |||
| 10 | |||
| 11 | int | ||
| 12 | @@ -173,7 +174,6 @@ | ||
| 13 | struct parameter_list *temp_list, *path; | ||
| 14 | struct name_list *seen = NULL; | ||
| 15 | |||
| 16 | - preamble = strdup (" - free space:"); | ||
| 17 | output = strdup (""); | ||
| 18 | details = strdup (""); | ||
| 19 | perf = strdup (""); | ||
| 20 | @@ -191,6 +191,12 @@ | ||
| 21 | if (process_arguments (argc, argv) == ERROR) | ||
| 22 | usage4 (_("Could not parse arguments")); | ||
| 23 | |||
| 24 | + if (output_usage) { | ||
| 25 | + preamble = strdup (" - used space:"); | ||
| 26 | + } else { | ||
| 27 | + preamble = strdup (" - free space:"); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | /* If a list of paths has not been selected, find entire | ||
| 31 | mount list and create list of paths | ||
| 32 | */ | ||
| 33 | @@ -392,9 +398,9 @@ | ||
| 34 | asprintf (&output, "%s %s %.0f %s (%.0f%%", | ||
| 35 | output, | ||
| 36 | (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
| 37 | - dfree_units, | ||
| 38 | + output_usage ? dused_units : dfree_units, | ||
| 39 | units, | ||
| 40 | - dfree_pct); | ||
| 41 | + output_usage ? 100-dfree_pct : dfree_pct); | ||
| 42 | if (dused_inodes_percent < 0) { | ||
| 43 | asprintf(&output, "%s inode=-);", output); | ||
| 44 | } else { | ||
| 45 | @@ -495,6 +501,7 @@ | ||
| 46 | {"verbose", no_argument, 0, 'v'}, | ||
| 47 | {"quiet", no_argument, 0, 'q'}, | ||
| 48 | {"clear", no_argument, 0, 'C'}, | ||
| 49 | + {"usage", no_argument, 0, 'U'}, | ||
| 50 | {"version", no_argument, 0, 'V'}, | ||
| 51 | {"help", no_argument, 0, 'h'}, | ||
| 52 | {0, 0, 0, 0} | ||
| 53 | @@ -510,7 +517,7 @@ | ||
| 54 | strcpy (argv[c], "-t"); | ||
| 55 | |||
| 56 | while (1) { | ||
| 57 | - c = getopt_long (argc, argv, "+?VqhveCt:c:w:K:W:u:p:x:X:mklLg:R:r:i:I:MEA", longopts, &option); | ||
| 58 | + c = getopt_long (argc, argv, "+?VqhveUCt:c:w:K:W:u:p:x:X:mklLg:R:r:i:I:MEA", longopts, &option); | ||
| 59 | |||
| 60 | if (c == -1 || c == EOF) | ||
| 61 | break; | ||
| 62 | @@ -782,6 +789,9 @@ | ||
| 63 | path_selected = FALSE; | ||
| 64 | group = NULL; | ||
| 65 | break; | ||
| 66 | + case 'U': /* display used space */ | ||
| 67 | + output_usage = TRUE; | ||
| 68 | + break; | ||
| 69 | case 'V': /* version */ | ||
| 70 | print_revision (progname, NP_VERSION); | ||
| 71 | exit (STATE_OK); | ||
| 72 | @@ -958,6 +968,8 @@ | ||
| 73 | printf (UT_VERBOSE); | ||
| 74 | printf (" %s\n", "-X, --exclude-type=TYPE"); | ||
| 75 | printf (" %s\n", _("Ignore all filesystems of indicated type (may be repeated)")); | ||
| 76 | + printf (" %s\n", "-U, --usage"); | ||
| 77 | + printf (" %s\n", _("Output used space not free space")); | ||
| 78 | |||
| 79 | printf ("\n"); | ||
| 80 | printf ("%s\n", _("Examples:")); | ||
| 81 | @@ -980,7 +992,7 @@ | ||
| 82 | printf ("%s\n", _("Usage:")); | ||
| 83 | printf (" %s -w limit -c limit [-W limit] [-K limit] {-p path | -x device}\n", progname); | ||
| 84 | printf ("[-C] [-E] [-e] [-g group ] [-k] [-l] [-M] [-m] [-R path ] [-r path ]\n"); | ||
| 85 | - printf ("[-t timeout] [-u unit] [-v] [-X type]\n"); | ||
| 86 | + printf ("[-t timeout] [-u unit] [-v] [-X type] [-U]\n"); | ||
| 87 | } | ||
| 88 | |||
| 89 | void | ||
diff --git a/web/attachments/382258-nagios-plugins-check_disk_smb.patch b/web/attachments/382258-nagios-plugins-check_disk_smb.patch new file mode 100644 index 0000000..31c6873 --- /dev/null +++ b/web/attachments/382258-nagios-plugins-check_disk_smb.patch | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | diff -urN nagios-plugins-1.4.15/plugins-scripts/check_disk_smb.pl nagios-plugins-1.4.15.new/plugins-scripts/check_disk_smb.pl | ||
| 2 | --- nagios-plugins-1.4.15/plugins-scripts/check_disk_smb.pl 2010-07-27 22:47:16.000000000 +0200 | ||
| 3 | +++ nagios-plugins-1.4.15.new/plugins-scripts/check_disk_smb.pl 2010-08-04 14:06:46.000000000 +0200 | ||
| 4 | @@ -208,7 +208,11 @@ | ||
| 5 | my ($avail_bytes) = $avail; | ||
| 6 | my ($capper) = int(($3/$1)*100); | ||
| 7 | my ($mountpt) = "\\\\$host\\$share"; | ||
| 8 | - | ||
| 9 | + my ($mountptprint) = "//$host/$share"; | ||
| 10 | + my $warn_bytes; | ||
| 11 | + my $crit_bytes; | ||
| 12 | + my ($tot_bytes) = ($1*$2)/1024; | ||
| 13 | + my ($used_bytes) = (($1-$3)*$2)/1024; | ||
| 14 | |||
| 15 | if (int($avail / 1024) > 0) { | ||
| 16 | $avail = int($avail / 1024); | ||
| 17 | @@ -221,19 +225,33 @@ | ||
| 18 | } else { | ||
| 19 | $avail = $avail ."K"; | ||
| 20 | } | ||
| 21 | + | ||
| 22 | + if ($warn_type eq "P") { | ||
| 23 | + $warn_bytes=int($tot_bytes/100*$warn); | ||
| 24 | + } else { | ||
| 25 | + $warn_bytes=$warn; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + if ($crit_type eq "P") { | ||
| 29 | + $crit_bytes=int($tot_bytes/100*$crit); | ||
| 30 | + } else { | ||
| 31 | + $crit_bytes=$crit; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + my ($perfdata) = "$mountptprint=$used_bytes;$warn_bytes;$crit_bytes;0;$tot_bytes"; | ||
| 35 | |||
| 36 | #print ":$warn:$warn_type:\n"; | ||
| 37 | #print ":$crit:$crit_type:\n"; | ||
| 38 | #print ":$avail:$avail_bytes:$capper:$mountpt:\n"; | ||
| 39 | |||
| 40 | if ((($warn_type eq "P") && (100 - $capper) < $warn) || (($warn_type eq "K") && ($avail_bytes > $warn))) { | ||
| 41 | - $answer = "Disk ok - $avail ($capper%) free on $mountpt\n"; | ||
| 42 | + $answer = "Disk ok - $avail ($capper%) free on $mountptprint|$perfdata\n"; | ||
| 43 | } elsif ((($crit_type eq "P") && (100 - $capper) < $crit) || (($crit_type eq "K") && ($avail_bytes > $crit))) { | ||
| 44 | $state = "WARNING"; | ||
| 45 | - $answer = "WARNING: Only $avail ($capper%) free on $mountpt\n"; | ||
| 46 | + $answer = "WARNING: Only $avail ($capper%) free on $mountptprint|$perfdata\n"; | ||
| 47 | } else { | ||
| 48 | $state = "CRITICAL"; | ||
| 49 | - $answer = "CRITICAL: Only $avail ($capper%) free on $mountpt\n"; | ||
| 50 | + $answer = "CRITICAL: Only $avail ($capper%) free on $mountptprint|$perfdata\n"; | ||
| 51 | } | ||
| 52 | } else { | ||
| 53 | $answer = "Result from smbclient not suitable\n"; | ||
| 54 | @@ -250,7 +268,7 @@ | ||
| 55 | last; | ||
| 56 | } | ||
| 57 | if (/(You specified an invalid share name|NT_STATUS_BAD_NETWORK_NAME)/) { | ||
| 58 | - $answer = "Invalid share name \\\\$host\\$share\n"; | ||
| 59 | + $answer = "Invalid share name //$host//$share\n"; | ||
| 60 | $state = "CRITICAL"; | ||
| 61 | last; | ||
| 62 | } | ||
diff --git a/web/attachments/38607-patch-nagiosplug_plugins_check_nagios.c b/web/attachments/38607-patch-nagiosplug_plugins_check_nagios.c new file mode 100644 index 0000000..17f672d --- /dev/null +++ b/web/attachments/38607-patch-nagiosplug_plugins_check_nagios.c | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | Index: nagiosplug/plugins/check_nagios.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_nagios.c,v | ||
| 4 | retrieving revision 1.2 | ||
| 5 | diff -u -r1.2 check_nagios.c | ||
| 6 | --- nagiosplug/plugins/check_nagios.c 19 Jun 2002 05:11:52 -0000 1.2 | ||
| 7 | +++ nagiosplug/plugins/check_nagios.c 1 Jan 2003 22:18:50 -0000 | ||
| 8 | @@ -93,9 +93,9 @@ | ||
| 9 | printf ("Could not open stderr for %s\n", PS_RAW_COMMAND); | ||
| 10 | } | ||
| 11 | |||
| 12 | - /* cound the number of matching Nagios processes... */ | ||
| 13 | + /* count the number of matching Nagios processes... */ | ||
| 14 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 15 | - if (strstr (input_buffer, process_string)) | ||
| 16 | + if ((!strstr (input_buffer, argv[0])) && (strstr (input_buffer, process_string))) | ||
| 17 | proc_entries++; | ||
| 18 | } | ||
| 19 | |||
| 20 | @@ -263,5 +263,5 @@ | ||
| 21 | "-V, --version\n" | ||
| 22 | " Print version information\n\n" | ||
| 23 | "Example:\n" | ||
| 24 | - " ./check_nagios -H /usr/local/nagios/var/status.log -e 5 -C /usr/local/nagios/bin/nagios\n"); | ||
| 25 | + " ./check_nagios -F /usr/local/nagios/var/status.log -e 5 -C /usr/local/nagios/bin/nagios\n"); | ||
| 26 | } | ||
diff --git a/web/attachments/38638-patch-nagiosplug-tcp_refusal b/web/attachments/38638-patch-nagiosplug-tcp_refusal new file mode 100644 index 0000000..a7629f2 --- /dev/null +++ b/web/attachments/38638-patch-nagiosplug-tcp_refusal | |||
| @@ -0,0 +1,142 @@ | |||
| 1 | Index: nagiosplug/plugins/check_tcp.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_tcp.c,v | ||
| 4 | retrieving revision 1.10 | ||
| 5 | diff -u -r1.10 check_tcp.c | ||
| 6 | --- nagiosplug/plugins/check_tcp.c 19 Dec 2002 19:30:52 -0000 1.10 | ||
| 7 | +++ nagiosplug/plugins/check_tcp.c 30 Dec 2002 23:07:44 -0000 | ||
| 8 | @@ -307,9 +307,11 @@ | ||
| 9 | alarm (0); | ||
| 10 | |||
| 11 | printf | ||
| 12 | - ("%s %s - %7.3f second response time on port %d", | ||
| 13 | + ("%s %s%s - %7.3f second response time on port %d", | ||
| 14 | SERVICE, | ||
| 15 | - state_text (result), elapsed_time, server_port); | ||
| 16 | + state_text (result), | ||
| 17 | + (was_refused)?" (refused)":"", | ||
| 18 | + elapsed_time, server_port); | ||
| 19 | |||
| 20 | if (status && strlen(status) > 0) | ||
| 21 | printf (" [%s]", status); | ||
| 22 | @@ -346,6 +348,7 @@ | ||
| 23 | {"expect", required_argument, 0, 'e'}, | ||
| 24 | {"quit", required_argument, 0, 'q'}, | ||
| 25 | {"delay", required_argument, 0, 'd'}, | ||
| 26 | + {"refuse", required_argument, 0, 'r'}, | ||
| 27 | {"verbose", no_argument, 0, 'v'}, | ||
| 28 | {"version", no_argument, 0, 'V'}, | ||
| 29 | {"help", no_argument, 0, 'h'}, | ||
| 30 | @@ -376,10 +379,10 @@ | ||
| 31 | while (1) { | ||
| 32 | #ifdef HAVE_GETOPT_H | ||
| 33 | c = | ||
| 34 | - getopt_long (argc, argv, "+hVvH:s:e:q:c:w:t:p:C:W:d:S", long_options, | ||
| 35 | + getopt_long (argc, argv, "+hVvH:s:e:q:c:w:t:p:C:W:d:Sr:", long_options, | ||
| 36 | &option_index); | ||
| 37 | #else | ||
| 38 | - c = getopt (argc, argv, "+hVvH:s:e:q:c:w:t:p:C:W:d:S"); | ||
| 39 | + c = getopt (argc, argv, "+hVvH:s:e:q:c:w:t:p:C:W:d:Sr:"); | ||
| 40 | #endif | ||
| 41 | |||
| 42 | if (c == -1 || c == EOF || c == 1) | ||
| 43 | @@ -448,6 +451,16 @@ | ||
| 44 | case 'q': | ||
| 45 | server_quit = optarg; | ||
| 46 | break; | ||
| 47 | + case 'r': | ||
| 48 | + if (!strncmp(optarg,"ok",2)) | ||
| 49 | + econn_refuse_state = STATE_OK; | ||
| 50 | + else if (!strncmp(optarg,"warn",4)) | ||
| 51 | + econn_refuse_state = STATE_WARNING; | ||
| 52 | + else if (!strncmp(optarg,"crit",4)) | ||
| 53 | + econn_refuse_state = STATE_CRITICAL; | ||
| 54 | + else | ||
| 55 | + usage ("Refuse mut be one of ok, warn, crit\n"); | ||
| 56 | + break; | ||
| 57 | case 'd': | ||
| 58 | if (is_intpos (optarg)) | ||
| 59 | delay = atoi (optarg); | ||
| 60 | @@ -479,7 +492,8 @@ | ||
| 61 | { | ||
| 62 | printf | ||
| 63 | ("Usage: %s -H host -p port [-w warn_time] [-c crit_time] [-s send]\n" | ||
| 64 | - " [-e expect] [-W wait] [-t to_sec] [-v]\n", PROGNAME); | ||
| 65 | + " [-e expect] [-W wait] [-t to_sec] [-R refuse_state] [-v]\n", | ||
| 66 | + PROGNAME); | ||
| 67 | } | ||
| 68 | |||
| 69 | |||
| 70 | @@ -514,6 +528,8 @@ | ||
| 71 | " Response time to result in critical status (seconds)\n" | ||
| 72 | " -t, --timeout=INTEGER\n" | ||
| 73 | " Seconds before connection times out (default: %d)\n" | ||
| 74 | + " -r, --refuse=ok|warn|crit\n" | ||
| 75 | + " Accept tcp refusals with states ok,warn, crit (default: crit)\n" | ||
| 76 | " -v" | ||
| 77 | " Show details for command-line debugging (do not use with nagios server)\n" | ||
| 78 | " -h, --help\n" | ||
| 79 | @@ -549,7 +565,7 @@ | ||
| 80 | time (&start_time); | ||
| 81 | |||
| 82 | /* Make TCP connection */ | ||
| 83 | - if (my_tcp_connect (server_address, server_port, &sd) == STATE_OK) | ||
| 84 | + if (my_tcp_connect (server_address, server_port, &sd) == STATE_OK && was_refused == FALSE) | ||
| 85 | { | ||
| 86 | /* Do the SSL handshake */ | ||
| 87 | if ((ssl = SSL_new (ctx)) != NULL) | ||
| 88 | Index: nagiosplug/plugins/netutils.c | ||
| 89 | =================================================================== | ||
| 90 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.c,v | ||
| 91 | retrieving revision 1.1.1.1 | ||
| 92 | diff -u -r1.1.1.1 netutils.c | ||
| 93 | --- nagiosplug/plugins/netutils.c 28 Feb 2002 06:42:59 -0000 1.1.1.1 | ||
| 94 | +++ nagiosplug/plugins/netutils.c 30 Dec 2002 23:07:44 -0000 | ||
| 95 | @@ -39,6 +39,9 @@ | ||
| 96 | extern int socket_timeout; | ||
| 97 | RETSIGTYPE socket_timeout_alarm_handler (int); | ||
| 98 | |||
| 99 | +extern int econn_refuse_state; | ||
| 100 | +extern int was_refused; | ||
| 101 | + | ||
| 102 | int process_tcp_request2 (char *, int, char *, char *, int); | ||
| 103 | int process_tcp_request (char *, int, char *, char *, int); | ||
| 104 | int process_udp_request (char *, int, char *, char *, int); | ||
| 105 | @@ -307,7 +310,14 @@ | ||
| 106 | if (result < 0) { | ||
| 107 | switch (errno) { | ||
| 108 | case ECONNREFUSED: | ||
| 109 | - printf ("Connection refused by host\n"); | ||
| 110 | + switch (econn_refuse_state) { | ||
| 111 | + case STATE_OK: | ||
| 112 | + case STATE_WARNING: | ||
| 113 | + was_refused = TRUE; | ||
| 114 | + return econn_refuse_state; | ||
| 115 | + default: | ||
| 116 | + printf ("Connection refused by host\n"); | ||
| 117 | + } | ||
| 118 | break; | ||
| 119 | case ETIMEDOUT: | ||
| 120 | printf ("Timeout while attempting connection\n"); | ||
| 121 | @@ -316,7 +326,7 @@ | ||
| 122 | printf ("Network is unreachable\n"); | ||
| 123 | break; | ||
| 124 | default: | ||
| 125 | - printf ("Connection refused or timed out\n"); | ||
| 126 | + printf ("Connection refused or timed out: %s\n",strerror (errno)); | ||
| 127 | } | ||
| 128 | |||
| 129 | return STATE_CRITICAL; | ||
| 130 | Index: nagiosplug/plugins/netutils.h.in | ||
| 131 | =================================================================== | ||
| 132 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.h.in,v | ||
| 133 | retrieving revision 1.1.1.1 | ||
| 134 | diff -u -r1.1.1.1 netutils.h.in | ||
| 135 | --- nagiosplug/plugins/netutils.h.in 28 Feb 2002 06:42:59 -0000 1.1.1.1 | ||
| 136 | +++ nagiosplug/plugins/netutils.h.in 30 Dec 2002 23:07:44 -0000 | ||
| 137 | @@ -61,3 +61,5 @@ | ||
| 138 | #include "common.h" | ||
| 139 | #endif | ||
| 140 | int socket_timeout = DEFAULT_SOCKET_TIMEOUT; | ||
| 141 | +int econn_refuse_state = STATE_CRITICAL; | ||
| 142 | +int was_refused = FALSE; | ||
diff --git a/web/attachments/388024-sslutils.patch b/web/attachments/388024-sslutils.patch new file mode 100644 index 0000000..417c6be --- /dev/null +++ b/web/attachments/388024-sslutils.patch | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | --- plugins/sslutils.c 2010-07-27 16:47:16.000000000 -0400 | ||
| 2 | +++ sslutils.c 2010-09-27 10:16:20.000000000 -0400 | ||
| 3 | @@ -51,24 +51,40 @@ | ||
| 4 | printf ("%s\n", _("CRITICAL - Cannot create SSL context.")); | ||
| 5 | return STATE_CRITICAL; | ||
| 6 | } | ||
| 7 | - if ((s = SSL_new (c)) != NULL){ | ||
| 8 | + if ((s = SSL_new (c)) == NULL){ | ||
| 9 | + printf ("%s\n", _("CRITICAL - Cannot initiate SSL handshake.")); | ||
| 10 | + return STATE_CRITICAL; | ||
| 11 | + } | ||
| 12 | #ifdef SSL_set_tlsext_host_name | ||
| 13 | - if (host_name != NULL) | ||
| 14 | - SSL_set_tlsext_host_name(s, host_name); | ||
| 15 | + if (host_name != NULL) | ||
| 16 | + SSL_set_tlsext_host_name(s, host_name); | ||
| 17 | #endif | ||
| 18 | - SSL_set_fd (s, sd); | ||
| 19 | - if (SSL_connect(s) == 1){ | ||
| 20 | - return OK; | ||
| 21 | - } else { | ||
| 22 | - printf ("%s\n", _("CRITICAL - Cannot make SSL connection ")); | ||
| 23 | -# ifdef USE_OPENSSL /* XXX look into ERR_error_string */ | ||
| 24 | - ERR_print_errors_fp (stdout); | ||
| 25 | -# endif /* USE_OPENSSL */ | ||
| 26 | - } | ||
| 27 | - } else { | ||
| 28 | - printf ("%s\n", _("CRITICAL - Cannot initiate SSL handshake.")); | ||
| 29 | - } | ||
| 30 | - return STATE_CRITICAL; | ||
| 31 | + SSL_set_fd (s, sd); | ||
| 32 | + if (SSL_connect(s) == 1) | ||
| 33 | + return OK; | ||
| 34 | + | ||
| 35 | + // Try TLS | ||
| 36 | + // Free old pointers | ||
| 37 | + SSL_CTX_free(c); | ||
| 38 | + SSL_free(s); | ||
| 39 | + | ||
| 40 | + if ((c = SSL_CTX_new(TLSv1_client_method())) == NULL) { | ||
| 41 | + printf("%s\n", _("CRITICAL - Cannot create SSL context.")); | ||
| 42 | + return STATE_CRITICAL; | ||
| 43 | + } | ||
| 44 | + if ((s = SSL_new(c)) == NULL) { | ||
| 45 | + printf("%s\n", _("CRITICAL - Cannot initiate SSL handshake.")); | ||
| 46 | + return STATE_CRITICAL; | ||
| 47 | + } | ||
| 48 | +#ifdef SSL_set_tlsext_host_name | ||
| 49 | + if (host_name != NULL) | ||
| 50 | + SSL_set_tlsext_host_name(s, host_name); | ||
| 51 | +#endif | ||
| 52 | + SSL_set_fd(s, sd); | ||
| 53 | + if (SSL_connect(s) == 1){ | ||
| 54 | + return OK; | ||
| 55 | + } | ||
| 56 | + return STATE_CRITICAL; | ||
| 57 | } | ||
| 58 | |||
| 59 | void np_net_ssl_cleanup (){ | ||
diff --git a/web/attachments/38944-check_ldap.c.patch b/web/attachments/38944-check_ldap.c.patch new file mode 100644 index 0000000..50c5f86 --- /dev/null +++ b/web/attachments/38944-check_ldap.c.patch | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | --- check_ldap.c Thu Nov 14 17:04:51 2002 | ||
| 2 | +++ check_ldap.c.new Mon Jan 6 02:15:41 2003 | ||
| 3 | @@ -32,6 +32,7 @@ | ||
| 4 | #include <ldap.h> | ||
| 5 | |||
| 6 | #define UNKNOWN -1 | ||
| 7 | +#define E_MOREARGS 3 | ||
| 8 | |||
| 9 | int process_arguments (int, char **); | ||
| 10 | int validate_arguments (void); | ||
| 11 | @@ -53,10 +54,11 @@ | ||
| 12 | |||
| 13 | int t_diff; | ||
| 14 | time_t time0, time1; | ||
| 15 | - | ||
| 16 | - if (process_arguments (argc, argv) == ERROR) | ||
| 17 | + int state = process_arguments (argc, argv); | ||
| 18 | + if (state == ERROR) | ||
| 19 | usage ("check_ldap: could not parse arguments\n"); | ||
| 20 | - | ||
| 21 | + if (state == E_MOREARGS) | ||
| 22 | + usage ("check_ldap: four arguments are required\n"); | ||
| 23 | /* initialize alarm signal handling */ | ||
| 24 | signal (SIGALRM, socket_timeout_alarm_handler); | ||
| 25 | |||
| 26 | @@ -143,7 +145,7 @@ | ||
| 27 | #endif | ||
| 28 | |||
| 29 | if (argc < 2) | ||
| 30 | - return ERROR; | ||
| 31 | + return E_MOREARGS; | ||
| 32 | |||
| 33 | for (c = 1; c < argc; c++) { | ||
| 34 | if (strcmp ("-to", argv[c]) == 0) | ||
| 35 | @@ -212,10 +214,10 @@ | ||
| 36 | int | ||
| 37 | validate_arguments () | ||
| 38 | { | ||
| 39 | - if (ld_host[0] == 0 || | ||
| 40 | - ld_base[0] == 0 || | ||
| 41 | + if (ld_host == 0 || | ||
| 42 | + ld_base == 0 || | ||
| 43 | ld_port == UNKNOWN || warn_time == UNKNOWN || crit_time == UNKNOWN) { | ||
| 44 | - return ERROR; | ||
| 45 | + return E_MOREARGS; | ||
| 46 | } | ||
| 47 | else { | ||
| 48 | return OK; | ||
| 49 | @@ -241,7 +243,7 @@ | ||
| 50 | "\t-b [--base] ... ldap base (eg. ou=my unit, o=my org, c=at)\n" | ||
| 51 | "\t-D [--bind] ... ldap bind DN (if required)\n" | ||
| 52 | "\t-P [--pass] ... ldap password (if required)\n" | ||
| 53 | - "\t-p [--port] ... ldap port (normaly 389)\n" | ||
| 54 | + "\t-p [--port] ... ldap port (defaults to 389)\n" | ||
| 55 | "\t-w [--warn] ... time in secs. - if the exceeds <warn> the STATE_WARNING will be returned\n" | ||
| 56 | "\t-c [--crit] ... time in secs. - if the exceeds <crit> the STATE_CRITICAL will be returned\n" | ||
| 57 | "\n"); | ||
| 58 | @@ -252,7 +254,7 @@ | ||
| 59 | print_usage () | ||
| 60 | { | ||
| 61 | printf | ||
| 62 | - ("Usage: %s -H <host> -b <base_dn> -p <port> [-a <attr>] [-D <binddn>]\n" | ||
| 63 | - " [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n" | ||
| 64 | + ("Usage: %s -H <host> -b <base_dn> -w <warn_time> -c <crit_time>\n" | ||
| 65 | + "[-p <port>] [-a <attr>] [-D <binddn>] [-P <password>] [-t time out]\n" | ||
| 66 | "(Note: all times are in seconds.)\n", PROGNAME); | ||
| 67 | } | ||
diff --git a/web/attachments/390908-critical.txt b/web/attachments/390908-critical.txt new file mode 100644 index 0000000..db717d6 --- /dev/null +++ b/web/attachments/390908-critical.txt | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | DHCP socket: 4 | ||
| 2 | Hardware address: 00:0f:fe:26:df:10 | ||
| 3 | DHCPDISCOVER to 255.255.255.255 port 67 | ||
| 4 | DHCPDISCOVER XID: 444910351 (0x1A84CB0F) | ||
| 5 | DHCDISCOVER ciaddr: 0.0.0.0 | ||
| 6 | DHCDISCOVER yiaddr: 0.0.0.0 | ||
| 7 | DHCDISCOVER siaddr: 0.0.0.0 | ||
| 8 | DHCDISCOVER giaddr: 0.0.0.0 | ||
| 9 | send_dhcp_packet result: 548 | ||
| 10 | |||
| 11 | |||
| 12 | |||
| 13 | |||
| 14 | recv_result_1: 300 | ||
| 15 | recv_result_2: 300 | ||
| 16 | receive_dhcp_packet() result: 300 | ||
| 17 | receive_dhcp_packet() source: 10.1.164.180 | ||
| 18 | Result=OK | ||
| 19 | DHCPOFFER from IP address 10.1.164.1 via 10.1.164.180 | ||
| 20 | DHCPOFFER XID: 444910351 (0x1A84CB0F) | ||
| 21 | DHCPOFFER chaddr: 000FFE26DF10 | ||
| 22 | DHCPOFFER ciaddr: 0.0.0.0 | ||
| 23 | DHCPOFFER yiaddr: 10.1.164.8 | ||
| 24 | DHCPOFFER siaddr: 10.1.164.1 | ||
| 25 | DHCPOFFER giaddr: 0.0.0.0 | ||
| 26 | Option: 53 (0x01) | ||
| 27 | Option: 1 (0x04) | ||
| 28 | Option: 58 (0x04) | ||
| 29 | Option: 59 (0x04) | ||
| 30 | Lease Time: 0 seconds | ||
| 31 | Renewal Time: 1800 seconds | ||
| 32 | Rebinding Time: 3150 seconds | ||
| 33 | Added offer from server @ 10.1.164.1 of IP address 10.1.164.8 | ||
| 34 | |||
| 35 | |||
| 36 | recv_result_1: 300 | ||
| 37 | recv_result_2: 300 | ||
| 38 | receive_dhcp_packet() result: 300 | ||
| 39 | receive_dhcp_packet() source: 10.1.164.254 | ||
| 40 | Result=OK | ||
| 41 | DHCPOFFER from IP address 10.1.164.1 via 10.1.164.254 | ||
| 42 | DHCPOFFER XID: 444910351 (0x1A84CB0F) | ||
| 43 | DHCPOFFER chaddr: 000FFE26DF10 | ||
| 44 | DHCPOFFER ciaddr: 0.0.0.0 | ||
| 45 | DHCPOFFER yiaddr: 10.1.164.8 | ||
| 46 | DHCPOFFER siaddr: 10.1.164.1 | ||
| 47 | DHCPOFFER giaddr: 10.1.164.254 | ||
| 48 | Option: 53 (0x01) | ||
| 49 | Option: 1 (0x04) | ||
| 50 | Option: 58 (0x04) | ||
| 51 | Option: 59 (0x04) | ||
| 52 | Lease Time: 0 seconds | ||
| 53 | Renewal Time: 1800 seconds | ||
| 54 | Rebinding Time: 3150 seconds | ||
| 55 | Added offer from server @ 10.1.164.1 of IP address 10.1.164.8 | ||
| 56 | |||
| 57 | |||
| 58 | No (more) data received (nfound: 0) | ||
| 59 | Result=ERROR | ||
| 60 | Total responses seen on the wire: 2 | ||
| 61 | Valid responses for this machine: 2 | ||
| 62 | CRITICAL: Received 2 DHCPOFFER(s), 0 of 1 requested servers responded, max lease time = 0 sec. | ||
diff --git a/web/attachments/390909-ok.txt b/web/attachments/390909-ok.txt new file mode 100644 index 0000000..5b97579 --- /dev/null +++ b/web/attachments/390909-ok.txt | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | DHCP socket: 4 | ||
| 2 | Hardware address: 00:0f:fe:26:df:10 | ||
| 3 | DHCPDISCOVER to 255.255.255.255 port 67 | ||
| 4 | DHCPDISCOVER XID: 641711297 (0x263FBCC1) | ||
| 5 | DHCDISCOVER ciaddr: 0.0.0.0 | ||
| 6 | DHCDISCOVER yiaddr: 0.0.0.0 | ||
| 7 | DHCDISCOVER siaddr: 0.0.0.0 | ||
| 8 | DHCDISCOVER giaddr: 0.0.0.0 | ||
| 9 | send_dhcp_packet result: 548 | ||
| 10 | |||
| 11 | |||
| 12 | |||
| 13 | |||
| 14 | recv_result_1: 300 | ||
| 15 | recv_result_2: 300 | ||
| 16 | receive_dhcp_packet() result: 300 | ||
| 17 | receive_dhcp_packet() source: 10.1.164.180 | ||
| 18 | Result=OK | ||
| 19 | DHCPOFFER from IP address 10.1.164.180 via 10.1.164.180 | ||
| 20 | DHCPOFFER XID: 641711297 (0x263FBCC1) | ||
| 21 | DHCPOFFER chaddr: 000FFE26DF10 | ||
| 22 | DHCPOFFER ciaddr: 0.0.0.0 | ||
| 23 | DHCPOFFER yiaddr: 10.1.164.8 | ||
| 24 | DHCPOFFER siaddr: 10.1.164.180 | ||
| 25 | DHCPOFFER giaddr: 0.0.0.0 | ||
| 26 | Option: 53 (0x01) | ||
| 27 | Option: 1 (0x04) | ||
| 28 | Option: 58 (0x04) | ||
| 29 | Option: 59 (0x04) | ||
| 30 | Lease Time: 0 seconds | ||
| 31 | Renewal Time: 1800 seconds | ||
| 32 | Rebinding Time: 3150 seconds | ||
| 33 | Added offer from server @ 10.1.164.180 of IP address 10.1.164.8 | ||
| 34 | |||
| 35 | |||
| 36 | recv_result_1: 300 | ||
| 37 | recv_result_2: 300 | ||
| 38 | receive_dhcp_packet() result: 300 | ||
| 39 | receive_dhcp_packet() source: 10.1.164.254 | ||
| 40 | Result=OK | ||
| 41 | DHCPOFFER from IP address 10.1.164.180 via 10.1.164.254 | ||
| 42 | DHCPOFFER XID: 641711297 (0x263FBCC1) | ||
| 43 | DHCPOFFER chaddr: 000FFE26DF10 | ||
| 44 | DHCPOFFER ciaddr: 0.0.0.0 | ||
| 45 | DHCPOFFER yiaddr: 10.1.164.8 | ||
| 46 | DHCPOFFER siaddr: 10.1.164.180 | ||
| 47 | DHCPOFFER giaddr: 10.1.164.254 | ||
| 48 | Option: 53 (0x01) | ||
| 49 | Option: 1 (0x04) | ||
| 50 | Option: 58 (0x04) | ||
| 51 | Option: 59 (0x04) | ||
| 52 | Lease Time: 0 seconds | ||
| 53 | Renewal Time: 1800 seconds | ||
| 54 | Rebinding Time: 3150 seconds | ||
| 55 | Added offer from server @ 10.1.164.180 of IP address 10.1.164.8 | ||
| 56 | |||
| 57 | |||
| 58 | No (more) data received (nfound: 0) | ||
| 59 | Result=ERROR | ||
| 60 | Total responses seen on the wire: 2 | ||
| 61 | Valid responses for this machine: 2 | ||
| 62 | DHCP Server Match: Offerer=10.1.164.180 Requested=10.1.164.180 | ||
| 63 | DHCP Server Match: Offerer=10.1.164.180 Requested=10.1.164.180 (duplicate) | ||
| 64 | OK: Received 2 DHCPOFFER(s), 1 of 1 requested servers responded, max lease time = 0 sec. | ||
diff --git a/web/attachments/39204-contrib-brylon.tar.gz b/web/attachments/39204-contrib-brylon.tar.gz new file mode 100644 index 0000000..622588e --- /dev/null +++ b/web/attachments/39204-contrib-brylon.tar.gz | |||
| Binary files differ | |||
diff --git a/web/attachments/392414-nagios-plugins-1.4.15-sslworkarounds.patch.txt b/web/attachments/392414-nagios-plugins-1.4.15-sslworkarounds.patch.txt new file mode 100644 index 0000000..ffe72ca --- /dev/null +++ b/web/attachments/392414-nagios-plugins-1.4.15-sslworkarounds.patch.txt | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | --- nagios-plugins-1.4.15-orig/plugins/sslutils.c 2010-07-27 16:47:16.000000000 -0400 | ||
| 2 | +++ nagios-plugins-1.4.15/plugins/sslutils.c 2010-11-06 08:45:59.000000000 -0400 | ||
| 3 | @@ -51,6 +51,11 @@ | ||
| 4 | printf ("%s\n", _("CRITICAL - Cannot create SSL context.")); | ||
| 5 | return STATE_CRITICAL; | ||
| 6 | } | ||
| 7 | +#ifndef SSL_enforce_sanity | ||
| 8 | + if (c) { | ||
| 9 | + SSL_CTX_set_options(c,SSL_OP_ALL); | ||
| 10 | + } | ||
| 11 | +#endif | ||
| 12 | if ((s = SSL_new (c)) != NULL){ | ||
| 13 | #ifdef SSL_set_tlsext_host_name | ||
| 14 | if (host_name != NULL) | ||
diff --git a/web/attachments/393797-mq-d b/web/attachments/393797-mq-d new file mode 100644 index 0000000..2bc96c1 --- /dev/null +++ b/web/attachments/393797-mq-d | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | --- check_mailq.pl 2010-11-19 10:09:30.871245273 -0500 | ||
| 2 | +++ /home/jwm/check_mailq 2010-11-19 10:13:33.060816778 -0500 | ||
| 3 | @@ -130,7 +130,26 @@ | ||
| 4 | ##/var/spool/mqueue/qF/df is empty | ||
| 5 | ## Total Requests: 1 | ||
| 6 | |||
| 7 | - | ||
| 8 | +# separate submission/transport queues, empty | ||
| 9 | +## MSP Queue status... | ||
| 10 | +## /var/spool/mqueue-client is empty | ||
| 11 | +## Total requests: 0 | ||
| 12 | +## MTA Queue status... | ||
| 13 | +## /var/spool/mqueue is empty | ||
| 14 | +## Total requests: 0 | ||
| 15 | +# separate submission/transport queues: 1 | ||
| 16 | +## MSP Queue status... | ||
| 17 | +## /var/spool/mqueue-client (1 request) | ||
| 18 | +## -----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient----------- | ||
| 19 | +## oAJEfhdW014123 5 Fri Nov 19 14:41 jwm | ||
| 20 | +## (Deferred: Connection refused by [127.0.0.1]) | ||
| 21 | +## root | ||
| 22 | +## Total requests: 1 | ||
| 23 | +## MTA Queue status... | ||
| 24 | +## /var/spool/mqueue is empty | ||
| 25 | +## Total requests: 0 | ||
| 26 | + | ||
| 27 | + my $this_msg_q = 0; | ||
| 28 | while (<MAILQ>) { | ||
| 29 | |||
| 30 | # match email addr on queue listing | ||
| 31 | @@ -170,13 +189,18 @@ | ||
| 32 | # | ||
| 33 | # single queue: first line | ||
| 34 | # multi queue: one for each queue. overwrite on multi queue below | ||
| 35 | - $msg_q = $1 ; | ||
| 36 | + $this_msg_q = $1 ; | ||
| 37 | + $msg_q += $1 ; | ||
| 38 | } | ||
| 39 | } elsif (/^\s+Total\sRequests:\s(\d+)$/i) { | ||
| 40 | - print "$utils::PATH_TO_MAILQ = $_ \n" if $verbose ; | ||
| 41 | - # | ||
| 42 | - # multi queue: last line | ||
| 43 | - $msg_q = $1 ; | ||
| 44 | + if ($this_msg_q) { | ||
| 45 | + $this_msg_q = 0 ; | ||
| 46 | + } else { | ||
| 47 | + print "$utils::PATH_TO_MAILQ = $_ \n" if $verbose ; | ||
| 48 | + # | ||
| 49 | + # multi queue: last line | ||
| 50 | + $msg_q += $1 ; | ||
| 51 | + } | ||
| 52 | } | ||
| 53 | |||
| 54 | } | ||
diff --git a/web/attachments/394815-woo b/web/attachments/394815-woo new file mode 100644 index 0000000..352f7de --- /dev/null +++ b/web/attachments/394815-woo | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | --- orig/plugins/check_hpjd.c 2010-07-27 21:47:16.000000000 +0100 | ||
| 2 | +++ new/plugins/check_hpjd.c 2010-11-30 12:25:56.000000000 +0000 | ||
| 3 | @@ -41,7 +41,7 @@ | ||
| 4 | #define DEFAULT_COMMUNITY "public" | ||
| 5 | |||
| 6 | |||
| 7 | -const char *option_summary = "-H host [-C community]\n"; | ||
| 8 | +const char *option_summary = "-H host [-C community] [-p port]\n"; | ||
| 9 | |||
| 10 | #define HPJD_LINE_STATUS ".1.3.6.1.4.1.11.2.3.9.1.1.2.1" | ||
| 11 | #define HPJD_PAPER_STATUS ".1.3.6.1.4.1.11.2.3.9.1.1.2.2" | ||
| 12 | @@ -66,6 +66,7 @@ | ||
| 13 | |||
| 14 | char *community = NULL; | ||
| 15 | char *address = NULL; | ||
| 16 | +short port = 161; | ||
| 17 | |||
| 18 | int | ||
| 19 | main (int argc, char **argv) | ||
| 20 | @@ -119,8 +120,8 @@ | ||
| 21 | HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY); | ||
| 22 | |||
| 23 | /* get the command to run */ | ||
| 24 | - sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET, community, | ||
| 25 | - address, query_string); | ||
| 26 | + sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s:%hd %s", PATH_TO_SNMPGET, community, | ||
| 27 | + address, port, query_string); | ||
| 28 | |||
| 29 | /* run the command */ | ||
| 30 | child_process = spopen (command_line); | ||
| 31 | @@ -324,7 +325,7 @@ | ||
| 32 | |||
| 33 | |||
| 34 | while (1) { | ||
| 35 | - c = getopt_long (argc, argv, "+hVH:C:", longopts, &option); | ||
| 36 | + c = getopt_long (argc, argv, "+hVH:C:p:", longopts, &option); | ||
| 37 | |||
| 38 | if (c == -1 || c == EOF || c == 1) | ||
| 39 | break; | ||
| 40 | @@ -347,6 +348,9 @@ | ||
| 41 | case 'h': /* help */ | ||
| 42 | print_help (); | ||
| 43 | exit (STATE_OK); | ||
| 44 | + case 'p': /* port */ | ||
| 45 | + port = (short) atoi(optarg); | ||
| 46 | + break; | ||
| 47 | case '?': /* help */ | ||
| 48 | usage5 (); | ||
| 49 | } | ||
diff --git a/web/attachments/394886-time-rfc822.diff b/web/attachments/394886-time-rfc822.diff new file mode 100644 index 0000000..e2e0d84 --- /dev/null +++ b/web/attachments/394886-time-rfc822.diff | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | --- nagios-plugins-1.4.15/plugins/sslutils.c 2010-07-27 20:47:16.000000000 +0000 | ||
| 2 | +++ nagios-plugins-1.4.15.new/plugins/sslutils.c 2010-11-30 21:37:29.616606174 +0000 | ||
| 3 | @@ -102,7 +102,7 @@ | ||
| 4 | struct tm stamp; | ||
| 5 | float time_left; | ||
| 6 | int days_left; | ||
| 7 | - char timestamp[17] = ""; | ||
| 8 | + char timestamp[128] = ""; | ||
| 9 | |||
| 10 | certificate=SSL_get_peer_certificate(s); | ||
| 11 | if(! certificate){ | ||
| 12 | @@ -149,10 +149,9 @@ | ||
| 13 | |||
| 14 | time_left = difftime(timegm(&stamp), time(NULL)); | ||
| 15 | days_left = time_left / 86400; | ||
| 16 | - snprintf | ||
| 17 | - (timestamp, 17, "%02d/%02d/%04d %02d:%02d", | ||
| 18 | - stamp.tm_mon + 1, | ||
| 19 | - stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min); | ||
| 20 | + | ||
| 21 | + stamp.tm_mon++; | ||
| 22 | + strftime (timestamp, sizeof (timestamp), "%a, %d %b %Y %H:%M:%S %z", &stamp); | ||
| 23 | |||
| 24 | if (days_left > 0 && days_left <= days_till_exp) { | ||
| 25 | printf (_("WARNING - Certificate expires in %d day(s) (%s).\n"), days_left, timestamp); | ||
diff --git a/web/attachments/39582-check_http_patch b/web/attachments/39582-check_http_patch new file mode 100644 index 0000000..cb9f624 --- /dev/null +++ b/web/attachments/39582-check_http_patch | |||
| @@ -0,0 +1,123 @@ | |||
| 1 | Index: plugins/check_http.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_http.c,v | ||
| 4 | retrieving revision 1.13 | ||
| 5 | diff -c -r1.13 check_http.c | ||
| 6 | *** plugins/check_http.c 19 Dec 2002 19:20:25 -0000 1.13 | ||
| 7 | --- plugins/check_http.c 13 Jan 2003 03:52:29 -0000 | ||
| 8 | *************** | ||
| 9 | *** 44,50 **** | ||
| 10 | \(-H <vhost> | -I <IP-address>) [-u <uri>] [-p <port>]\n\ | ||
| 11 | [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\ | ||
| 12 | [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\ | ||
| 13 | ! [-s string] [-r <regex> | -R <case-insensitive regex>]\n\ | ||
| 14 | [-P string]" | ||
| 15 | |||
| 16 | #define LONGOPTIONS "\ | ||
| 17 | --- 44,50 ---- | ||
| 18 | \(-H <vhost> | -I <IP-address>) [-u <uri>] [-p <port>]\n\ | ||
| 19 | [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\ | ||
| 20 | [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\ | ||
| 21 | ! [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\ | ||
| 22 | [-P string]" | ||
| 23 | |||
| 24 | #define LONGOPTIONS "\ | ||
| 25 | *************** | ||
| 26 | *** 75,80 **** | ||
| 27 | --- 75,82 ---- | ||
| 28 | Wrap output in HTML link (obsoleted by urlize)\n\ | ||
| 29 | -f, --onredirect=<ok|warning|critical|follow>\n\ | ||
| 30 | How to handle redirected pages\n%s\ | ||
| 31 | + -l, --linespan\n\ | ||
| 32 | + Allow regex to span newlines (must precede -r or -R)\n\ | ||
| 33 | -v, --verbose\n\ | ||
| 34 | Show details for command-line debugging (do not use with nagios server)\n\ | ||
| 35 | -h, --help\n\ | ||
| 36 | *************** | ||
| 37 | *** 286,291 **** | ||
| 38 | --- 288,294 ---- | ||
| 39 | {"regex", required_argument, 0, 'r'}, | ||
| 40 | {"ereg", required_argument, 0, 'r'}, | ||
| 41 | {"eregi", required_argument, 0, 'R'}, | ||
| 42 | + {"linespan", no_argument, 0, 'l'}, | ||
| 43 | {"onredirect", required_argument, 0, 'f'}, | ||
| 44 | {"certificate", required_argument, 0, 'C'}, | ||
| 45 | {0, 0, 0, 0} | ||
| 46 | *************** | ||
| 47 | *** 308,314 **** | ||
| 48 | strcpy (argv[c], "-n"); | ||
| 49 | } | ||
| 50 | |||
| 51 | ! #define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nLS" | ||
| 52 | |||
| 53 | while (1) { | ||
| 54 | #ifdef HAVE_GETOPT_H | ||
| 55 | --- 311,317 ---- | ||
| 56 | strcpy (argv[c], "-n"); | ||
| 57 | } | ||
| 58 | |||
| 59 | ! #define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:lu:f:C:nLS" | ||
| 60 | |||
| 61 | while (1) { | ||
| 62 | #ifdef HAVE_GETOPT_H | ||
| 63 | *************** | ||
| 64 | *** 420,434 **** | ||
| 65 | server_expect[MAX_INPUT_BUFFER - 1] = 0; | ||
| 66 | server_expect_yn = 1; | ||
| 67 | break; | ||
| 68 | case 'R': /* regex */ | ||
| 69 | ! #ifdef HAVE_REGEX_H | ||
| 70 | ! cflags = REG_ICASE; | ||
| 71 | ! #else | ||
| 72 | usage ("check_http: call for regex which was not a compiled option\n"); | ||
| 73 | ! #endif | ||
| 74 | case 'r': /* regex */ | ||
| 75 | ! #ifdef HAVE_REGEX_H | ||
| 76 | cflags |= REG_EXTENDED | REG_NOSUB | REG_NEWLINE; | ||
| 77 | strncpy (regexp, optarg, MAX_RE_SIZE - 1); | ||
| 78 | regexp[MAX_RE_SIZE - 1] = 0; | ||
| 79 | errcode = regcomp (&preg, regexp, cflags); | ||
| 80 | --- 423,444 ---- | ||
| 81 | server_expect[MAX_INPUT_BUFFER - 1] = 0; | ||
| 82 | server_expect_yn = 1; | ||
| 83 | break; | ||
| 84 | + #ifndef HAVE_REGEX_H | ||
| 85 | + case 'l': /* linespan */ | ||
| 86 | case 'R': /* regex */ | ||
| 87 | ! case 'r': /* regex */ | ||
| 88 | usage ("check_http: call for regex which was not a compiled option\n"); | ||
| 89 | ! break; | ||
| 90 | ! #else | ||
| 91 | ! case 'l': /* linespan */ | ||
| 92 | ! cflags &= ~REG_NEWLINE; | ||
| 93 | ! break; | ||
| 94 | ! case 'R': /* regex */ | ||
| 95 | ! cflags |= REG_ICASE; | ||
| 96 | case 'r': /* regex */ | ||
| 97 | ! /* this is not required here, as it's initialized | ||
| 98 | cflags |= REG_EXTENDED | REG_NOSUB | REG_NEWLINE; | ||
| 99 | + */ | ||
| 100 | strncpy (regexp, optarg, MAX_RE_SIZE - 1); | ||
| 101 | regexp[MAX_RE_SIZE - 1] = 0; | ||
| 102 | errcode = regcomp (&preg, regexp, cflags); | ||
| 103 | *************** | ||
| 104 | *** 437,446 **** | ||
| 105 | printf ("Could Not Compile Regular Expression: %s", errbuf); | ||
| 106 | return ERROR; | ||
| 107 | } | ||
| 108 | - #else | ||
| 109 | - usage ("check_http: call for regex which was not a compiled option\n"); | ||
| 110 | - #endif | ||
| 111 | break; | ||
| 112 | case 'v': /* verbose */ | ||
| 113 | verbose = TRUE; | ||
| 114 | break; | ||
| 115 | --- 447,454 ---- | ||
| 116 | printf ("Could Not Compile Regular Expression: %s", errbuf); | ||
| 117 | return ERROR; | ||
| 118 | } | ||
| 119 | break; | ||
| 120 | + #endif | ||
| 121 | case 'v': /* verbose */ | ||
| 122 | verbose = TRUE; | ||
| 123 | break; | ||
diff --git a/web/attachments/396435-nagios-plugins-1.4.15-ssl-date-clarification.patch b/web/attachments/396435-nagios-plugins-1.4.15-ssl-date-clarification.patch new file mode 100644 index 0000000..61cd623 --- /dev/null +++ b/web/attachments/396435-nagios-plugins-1.4.15-ssl-date-clarification.patch | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | --- nagios-plugins-1.4.15.orig/plugins/sslutils.c 2010-12-19 00:24:23.000000000 +0100 | ||
| 2 | +++ nagios-plugins-1.4.15/plugins/sslutils.c 2010-12-19 00:34:57.000000000 +0100 | ||
| 3 | @@ -165,7 +165,7 @@ | ||
| 4 | return STATE_WARNING; | ||
| 5 | } | ||
| 6 | |||
| 7 | - printf (_("OK - Certificate will expire on %s.\n"), timestamp); | ||
| 8 | + printf (_("OK - Certificate will expire on %s (MM/DD/YYYY HH:MM).\n"), timestamp); | ||
| 9 | X509_free (certificate); | ||
| 10 | return STATE_OK; | ||
| 11 | # else /* ifndef USE_OPENSSL */ | ||
diff --git a/web/attachments/396772-sslutils_proper_date.patch b/web/attachments/396772-sslutils_proper_date.patch new file mode 100644 index 0000000..6e0ebe0 --- /dev/null +++ b/web/attachments/396772-sslutils_proper_date.patch | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | --- sslutils.c 2010-12-23 09:23:37.000000000 +1100 | ||
| 2 | +++ sslutils.c.orig 2009-05-22 07:11:51.000000000 +1000 | ||
| 3 | @@ -102,8 +102,7 @@ | ||
| 4 | struct tm stamp; | ||
| 5 | float time_left; | ||
| 6 | int days_left; | ||
| 7 | -// char timestamp[17] = ""; | ||
| 8 | - char *timestamp; | ||
| 9 | + char timestamp[17] = ""; | ||
| 10 | |||
| 11 | certificate=SSL_get_peer_certificate(s); | ||
| 12 | if(! certificate){ | ||
| 13 | @@ -150,13 +149,10 @@ | ||
| 14 | |||
| 15 | time_left = difftime(timegm(&stamp), time(NULL)); | ||
| 16 | days_left = time_left / 86400; | ||
| 17 | -/* | ||
| 18 | snprintf | ||
| 19 | (timestamp, 17, "%02d/%02d/%04d %02d:%02d", | ||
| 20 | stamp.tm_mon + 1, | ||
| 21 | stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min); | ||
| 22 | -*/ | ||
| 23 | - timestamp = asctime(&stamp); | ||
| 24 | |||
| 25 | if (days_left > 0 && days_left <= days_till_exp) { | ||
| 26 | printf (_("WARNING - Certificate expires in %d day(s) (%s).\n"), days_left, timestamp); | ||
| 27 | |||
diff --git a/web/attachments/39883-check_oracle.patch b/web/attachments/39883-check_oracle.patch new file mode 100644 index 0000000..1978e30 --- /dev/null +++ b/web/attachments/39883-check_oracle.patch | |||
| @@ -0,0 +1,95 @@ | |||
| 1 | *** check_oracle.original Mon Dec 9 15:57:44 2002 | ||
| 2 | --- check_oracle Mon Dec 9 16:24:28 2002 | ||
| 3 | *************** | ||
| 4 | *** 36,41 **** | ||
| 5 | --- 36,42 ---- | ||
| 6 | echo "Usage:" | ||
| 7 | echo " $PROGNAME --tns <Oracle Sid or Hostname/IP address>" | ||
| 8 | echo " $PROGNAME --db <ORACLE_SID>" | ||
| 9 | + echo " $PROGNAME --login <ORACLE_SID>" | ||
| 10 | echo " $PROGNAME --oranames <Hostname>" | ||
| 11 | echo " $PROGNAME --help" | ||
| 12 | echo " $PROGNAME --version" | ||
| 13 | *************** | ||
| 14 | *** 53,58 **** | ||
| 15 | --- 54,61 ---- | ||
| 16 | echo "--db=SID" | ||
| 17 | echo " Check local database (search /bin/ps for PMON process and check" | ||
| 18 | echo " filesystem for sgadefORACLE_SID.dbf" | ||
| 19 | + echo "--login=SID" | ||
| 20 | + echo " Attempt a dummy login and alert if not ORA-01017: invalid username/password" | ||
| 21 | echo "--oranames=Hostname" | ||
| 22 | echo " Check remote Oracle Names server" | ||
| 23 | echo "--help" | ||
| 24 | *************** | ||
| 25 | *** 81,86 **** | ||
| 26 | --- 84,109 ---- | ||
| 27 | ;; | ||
| 28 | esac | ||
| 29 | |||
| 30 | + # Information options | ||
| 31 | + case "$cmd" in | ||
| 32 | + --help) | ||
| 33 | + print_help | ||
| 34 | + exit $STATE_OK | ||
| 35 | + ;; | ||
| 36 | + -h) | ||
| 37 | + print_help | ||
| 38 | + exit $STATE_OK | ||
| 39 | + ;; | ||
| 40 | + --version) | ||
| 41 | + print_revision $PLUGIN $REVISION | ||
| 42 | + exit $STATE_OK | ||
| 43 | + ;; | ||
| 44 | + -V) | ||
| 45 | + print_revision $PLUGIN $REVISION | ||
| 46 | + exit $STATE_OK | ||
| 47 | + ;; | ||
| 48 | + esac | ||
| 49 | + | ||
| 50 | # Hunt down a reasonable ORACLE_HOME | ||
| 51 | if [ -z "$ORACLE_HOME" ] ; then | ||
| 52 | # Adjust to taste | ||
| 53 | *************** | ||
| 54 | *** 156,177 **** | ||
| 55 | exit $STATE_CRITICAL | ||
| 56 | fi | ||
| 57 | ;; | ||
| 58 | ! --help) | ||
| 59 | ! print_help | ||
| 60 | ! exit $STATE_OK | ||
| 61 | ;; | ||
| 62 | - -h) | ||
| 63 | - print_help | ||
| 64 | - exit $STATE_OK | ||
| 65 | - ;; | ||
| 66 | - --version) | ||
| 67 | - print_revision $PLUGIN $REVISION | ||
| 68 | - exit $STATE_OK | ||
| 69 | - ;; | ||
| 70 | - -V) | ||
| 71 | - print_revision $PLUGIN $REVISION | ||
| 72 | - exit $STATE_OK | ||
| 73 | - ;; | ||
| 74 | *) | ||
| 75 | print_usage | ||
| 76 | exit $STATE_UNKNOWN | ||
| 77 | --- 179,196 ---- | ||
| 78 | exit $STATE_CRITICAL | ||
| 79 | fi | ||
| 80 | ;; | ||
| 81 | ! --login) | ||
| 82 | ! loginchk=`sqlplus dummy/user@$2 < /dev/null` | ||
| 83 | ! loginchk2=` echo $loginchk | grep -c ORA-01017` | ||
| 84 | ! if [ ${loginchk2} -eq 1 ] ; then | ||
| 85 | ! echo "OK - dummy login connected" | ||
| 86 | ! exit $STATE_OK | ||
| 87 | ! else | ||
| 88 | ! loginchk3=` echo "$loginchk" | grep "ORA-" | head -1` | ||
| 89 | ! echo "CRITICAL - $loginchk3" | ||
| 90 | ! exit $STATE_CRITICAL | ||
| 91 | ! fi | ||
| 92 | ;; | ||
| 93 | *) | ||
| 94 | print_usage | ||
| 95 | exit $STATE_UNKNOWN | ||
diff --git a/web/attachments/39884-check_oracle.patch b/web/attachments/39884-check_oracle.patch new file mode 100644 index 0000000..b52a536 --- /dev/null +++ b/web/attachments/39884-check_oracle.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-6 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378818336" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378818336" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378818336" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378818336" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378818336'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=650970&group_id=29880&atid=397599&file_id=39884" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/39885-plugins-Makefile.am.patch b/web/attachments/39885-plugins-Makefile.am.patch new file mode 100644 index 0000000..2ec6522 --- /dev/null +++ b/web/attachments/39885-plugins-Makefile.am.patch | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | *** Makefile.am.original Fri Jan 17 14:43:26 2003 | ||
| 2 | --- Makefile.am Fri Jan 17 15:19:59 2003 | ||
| 3 | *************** | ||
| 4 | *** 12,18 **** | ||
| 5 | |||
| 6 | EXTRA_PROGRAMS = check_mysql check_radius check_pgsql check_snmp check_hpjd \ | ||
| 7 | check_swap check_fping check_ldap check_game check_dig \ | ||
| 8 | ! check_nagios check_by_ssh check_dns | ||
| 9 | |||
| 10 | check_tcp_programs = check_ftp check_imap check_nntp check_pop | ||
| 11 | |||
| 12 | --- 12,18 ---- | ||
| 13 | |||
| 14 | EXTRA_PROGRAMS = check_mysql check_radius check_pgsql check_snmp check_hpjd \ | ||
| 15 | check_swap check_fping check_ldap check_game check_dig \ | ||
| 16 | ! check_nagios check_by_ssh check_dns check_nt | ||
| 17 | |||
| 18 | check_tcp_programs = check_ftp check_imap check_nntp check_pop | ||
| 19 | |||
| 20 | *************** | ||
| 21 | *** 19,24 **** | ||
| 22 | --- 19,27 ---- | ||
| 23 | EXTRA_DIST = t utils.c netutils.c popen.c getopt.h getopt.c getopt1.c \ | ||
| 24 | snprintf.c getloadavg.c | ||
| 25 | |||
| 26 | + # Find check_nt.c at http://nsclient.ready2run.nl/ | ||
| 27 | + nodist_check_nt_SOURCES = check_nt.c | ||
| 28 | + | ||
| 29 | PLUGINHDRS = common.h config.h | ||
| 30 | |||
| 31 | BASEOBJS = utils.o | ||
| 32 | *************** | ||
| 33 | *** 51,56 **** | ||
| 34 | --- 54,60 ---- | ||
| 35 | check_mrtgtraf_LDADD = $(BASEOBJS) | ||
| 36 | check_mysql_LDADD = $(BASEOBJS) $(MYSQLLIBS) | ||
| 37 | check_nagios_LDADD = $(BASEOBJS) popen.o | ||
| 38 | + check_nt_LDADD = $(NETLIBS) | ||
| 39 | check_nwstat_LDADD = $(NETLIBS) | ||
| 40 | check_overcr_LDADD = $(NETLIBS) | ||
| 41 | check_pgsql_LDADD = $(BASEOBJS) $(PGLIBS) | ||
| 42 | *************** | ||
| 43 | *** 86,91 **** | ||
| 44 | --- 90,96 ---- | ||
| 45 | check_mrtgtraf_DEPENDENCIES = check_mrtgtraf.c $(DEPLIBS) | ||
| 46 | check_mysql_DEPENDENCIES = check_mysql.c $(DEPLIBS) | ||
| 47 | check_nagios_DEPENDENCIES = check_nagios.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 48 | + check_nt_DEPENDENCIES = check_nt.c $(BASEOBJS) $(DEPLIBS) | ||
| 49 | check_nwstat_DEPENDENCIES = check_nwstat.c $(NETOBJS) $(DEPLIBS) | ||
| 50 | check_overcr_DEPENDENCIES = check_overcr.c $(NETOBJS) $(DEPLIBS) | ||
| 51 | check_pgsql_DEPENDENCIES = check_pgsql.c $(DEPLIBS) | ||
diff --git a/web/attachments/39886-plugins-Makefile.am.patch b/web/attachments/39886-plugins-Makefile.am.patch new file mode 100644 index 0000000..c5bceba --- /dev/null +++ b/web/attachments/39886-plugins-Makefile.am.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-5 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378818378" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378818378" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378818378" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378818378" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378818378'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=651369&group_id=29880&atid=397599&file_id=39886" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/399439-0001-Fix-bug-ID-2946553-Match-the-server-used-in-the-l.patch b/web/attachments/399439-0001-Fix-bug-ID-2946553-Match-the-server-used-in-the-l.patch new file mode 100644 index 0000000..cf33a5a --- /dev/null +++ b/web/attachments/399439-0001-Fix-bug-ID-2946553-Match-the-server-used-in-the-l.patch | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | From ab90d186ad54de0fe73304bae5771f10a167fd3f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Matthew Kent <matt@bravenet.com> | ||
| 3 | Date: Fri, 21 Jan 2011 11:54:30 -0800 | ||
| 4 | Subject: [PATCH] Fix bug ID: 2946553 - Match the server used in the lookup for older versions of bind. | ||
| 5 | |||
| 6 | --- | ||
| 7 | plugins/check_dns.c | 22 ++++++++++++++++++++++ | ||
| 8 | 1 files changed, 22 insertions(+), 0 deletions(-) | ||
| 9 | |||
| 10 | diff --git a/plugins/check_dns.c b/plugins/check_dns.c | ||
| 11 | index 73b560c..04b8baf 100644 | ||
| 12 | --- a/plugins/check_dns.c | ||
| 13 | +++ b/plugins/check_dns.c | ||
| 14 | @@ -136,6 +136,28 @@ main (int argc, char **argv) | ||
| 15 | } | ||
| 16 | } | ||
| 17 | |||
| 18 | + /* bug ID: 2946553 - Older versions of bind will use all available dns | ||
| 19 | + servers, we have to match the one specified */ | ||
| 20 | + if (strstr (chld_out.line[i], "Server:") && strlen(dns_server) > 0) { | ||
| 21 | + temp_buffer = index (chld_out.line[i], ':'); | ||
| 22 | + temp_buffer++; | ||
| 23 | + | ||
| 24 | + /* Strip leading tabs */ | ||
| 25 | + for (; *temp_buffer != '\0' && *temp_buffer == '\t'; temp_buffer++) | ||
| 26 | + /* NOOP */; | ||
| 27 | + | ||
| 28 | + strip(temp_buffer); | ||
| 29 | + if (temp_buffer==NULL || strlen(temp_buffer)==0) { | ||
| 30 | + die (STATE_CRITICAL, | ||
| 31 | + _("DNS CRITICAL - '%s' returned empty server string\n"), | ||
| 32 | + NSLOOKUP_COMMAND); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + if (strcmp(temp_buffer, dns_server) != 0) { | ||
| 36 | + die (STATE_CRITICAL, _("No response from DNS %s\n"), dns_server); | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | /* the server is responding, we just got the host name... */ | ||
| 41 | if (strstr (chld_out.line[i], "Name:")) | ||
| 42 | parse_address = TRUE; | ||
| 43 | -- | ||
| 44 | 1.5.5.6 | ||
| 45 | |||
diff --git a/web/attachments/399715-check_disk.patch b/web/attachments/399715-check_disk.patch new file mode 100644 index 0000000..7f8a4f3 --- /dev/null +++ b/web/attachments/399715-check_disk.patch | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | 161a162 | ||
| 2 | > char *flag_header; | ||
| 3 | 222d222 | ||
| 4 | < | ||
| 5 | 357d356 | ||
| 6 | < | ||
| 7 | 391,393c390,397 | ||
| 8 | < | ||
| 9 | < asprintf (&output, "%s %s %.0f %s (%.0f%%", | ||
| 10 | < output, | ||
| 11 | --- | ||
| 12 | > | ||
| 13 | > if(disk_result && verbose >= 1) { | ||
| 14 | > asprintf(&flag_header, " %s [", state_text (disk_result)); | ||
| 15 | > } else { | ||
| 16 | > asprintf(&flag_header, ""); | ||
| 17 | > } | ||
| 18 | > asprintf (&output, "%s%s %s %.0f %s (%.0f%%", | ||
| 19 | > output, flag_header, | ||
| 20 | 399c403 | ||
| 21 | < asprintf(&output, "%s inode=-);", output); | ||
| 22 | --- | ||
| 23 | > asprintf(&output, "%s inode=-)%s;", output, (disk_result ? "]" : "")); | ||
| 24 | 401c405 | ||
| 25 | < asprintf(&output, "%s inode=%.0f%%);", output, dfree_inodes_percent ); | ||
| 26 | --- | ||
| 27 | > asprintf(&output, "%s inode=%.0f%%)%s;", output, dfree_inodes_percent, ((disk_result && verbose >= 1) ? "]" : "")); | ||
| 28 | 403c407 | ||
| 29 | < | ||
| 30 | --- | ||
| 31 | > free(flag_header); | ||
diff --git a/web/attachments/401743-check_smtp.patch b/web/attachments/401743-check_smtp.patch new file mode 100644 index 0000000..bf9811e --- /dev/null +++ b/web/attachments/401743-check_smtp.patch | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | diff -ru nagios-plugins-1.4.15/plugins/check_smtp.c mine/plugins/check_smtp.c | ||
| 2 | --- nagios-plugins-1.4.15/plugins/check_smtp.c 2010-07-27 21:47:16.000000000 +0100 | ||
| 3 | +++ mine/plugins/check_smtp.c 2011-02-03 16:17:29.000000000 +0000 | ||
| 4 | @@ -190,14 +190,19 @@ | ||
| 5 | printf ("%s", buffer); | ||
| 6 | /* strip the buffer of carriage returns */ | ||
| 7 | strip (buffer); | ||
| 8 | - /* make sure we find the response we are looking for */ | ||
| 9 | - if (!strstr (buffer, server_expect)) { | ||
| 10 | - if (server_port == SMTP_PORT) | ||
| 11 | - printf (_("Invalid SMTP response received from host: %s\n"), buffer); | ||
| 12 | - else | ||
| 13 | - printf (_("Invalid SMTP response received from host on port %d: %s\n"), | ||
| 14 | - server_port, buffer); | ||
| 15 | - result = STATE_WARNING; | ||
| 16 | + /* make sure we got a valid connect response */ | ||
| 17 | + if (!strstr (buffer, "220")) { | ||
| 18 | + /* make sure we find the response we are looking for */ | ||
| 19 | + if (!strstr (buffer, server_expect)) { | ||
| 20 | + if (server_port == SMTP_PORT) | ||
| 21 | + printf (_("Invalid SMTP response received from host: %s\n"), buffer); | ||
| 22 | + else | ||
| 23 | + printf (_("Invalid SMTP response received from host on port %d: %s\n"), | ||
| 24 | + server_port, buffer); | ||
| 25 | + result = STATE_WARNING; | ||
| 26 | + } | ||
| 27 | + /* Failed to connect, so bail */ | ||
| 28 | + return result; | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
diff --git a/web/attachments/40409-utils.pm.in.diff b/web/attachments/40409-utils.pm.in.diff new file mode 100644 index 0000000..cb2ea12 --- /dev/null +++ b/web/attachments/40409-utils.pm.in.diff | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | *** utils.pm.in.orig Wed Jan 22 15:39:22 2003 | ||
| 2 | --- utils.pm.in Wed Jan 22 16:39:06 2003 | ||
| 3 | *************** | ||
| 4 | *** 19,25 **** | ||
| 5 | |||
| 6 | require Exporter; | ||
| 7 | @ISA = qw(Exporter); | ||
| 8 | ! @EXPORT_OK = qw($TIMEOUT %ERRORS &print_revision &support &usage); | ||
| 9 | |||
| 10 | #use strict; | ||
| 11 | #use vars($TIMEOUT %ERRORS); | ||
| 12 | --- 19,25 ---- | ||
| 13 | |||
| 14 | require Exporter; | ||
| 15 | @ISA = qw(Exporter); | ||
| 16 | ! @EXPORT_OK = qw($TIMEOUT %ERRORS &print_revision &support &usage &config_value &config_values); | ||
| 17 | |||
| 18 | #use strict; | ||
| 19 | #use vars($TIMEOUT %ERRORS); | ||
| 20 | *************** | ||
| 21 | *** 27,34 **** | ||
| 22 | --- 27,38 ---- | ||
| 23 | sub usage; | ||
| 24 | sub support(); | ||
| 25 | sub is_hostname; | ||
| 26 | + sub config_value ($); | ||
| 27 | + sub config_values ($); | ||
| 28 | |||
| 29 | ## updated by autoconf | ||
| 30 | + $prefix = "@prefix@"; | ||
| 31 | + $sysconfdir = "@sysconfdir@"; | ||
| 32 | $PATH_TO_RPCINFO = "@PATH_TO_RPCINFO@" ; | ||
| 33 | $PATH_TO_NTPDATE = "@PATH_TO_NTPDATE@" ; | ||
| 34 | $PATH_TO_NTPDC = "@PATH_TO_NTPDC@" ; | ||
| 35 | *************** | ||
| 36 | *** 72,75 **** | ||
| 37 | --- 76,124 ---- | ||
| 38 | } | ||
| 39 | } | ||
| 40 | |||
| 41 | + ## subroutines to read nagios.cfg and return values of config items. | ||
| 42 | + $parsedConfig = 0; | ||
| 43 | + %configItems = {}; | ||
| 44 | + | ||
| 45 | + sub read_config { | ||
| 46 | + my $configFile = "$sysconfdir/nagios.cfg"; | ||
| 47 | + | ||
| 48 | + return 1 if $parsedConfig; | ||
| 49 | + | ||
| 50 | + if (! open CONFIG, "<$configFile") { | ||
| 51 | + print "$configFile: $!\n"; | ||
| 52 | + return 0; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + while (<CONFIG>) { | ||
| 56 | + next unless /^\s*([^=\s]+)=(.*)$/; | ||
| 57 | + | ||
| 58 | + if (defined(@{$configItems{$1}})) { | ||
| 59 | + $configItems{$1} = [@{$configItems{$1}}, $2]; | ||
| 60 | + } else { | ||
| 61 | + $configItems{$1} = [$2]; | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + close CONFIG; | ||
| 65 | + | ||
| 66 | + $parsedConfig = 1; | ||
| 67 | + return 1; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + ## Returns the value/values of a config item. If called in array context, | ||
| 71 | + ## a list of values is returned, otherwise the first value of the item | ||
| 72 | + ## is returned. (Most Nagios config items have only one value, but some | ||
| 73 | + ## such as cfg_file can be specified more than once.) | ||
| 74 | + ## | ||
| 75 | + ## ex: @cfg_files = &config_value('cfg_file'); | ||
| 76 | + ## ex: $resource_file = &config_value('resource_file'); | ||
| 77 | + sub config_value ($) { | ||
| 78 | + my $key = shift; | ||
| 79 | + return undef unless &read_config; | ||
| 80 | + if (wantarray) { | ||
| 81 | + return @{$configItems{$key}}; | ||
| 82 | + } | ||
| 83 | + return $configItems{$key}->[0]; | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | 1; | ||
diff --git a/web/attachments/40514-check_file_age b/web/attachments/40514-check_file_age new file mode 100644 index 0000000..498c650 --- /dev/null +++ b/web/attachments/40514-check_file_age | |||
| @@ -0,0 +1,112 @@ | |||
| 1 | #!/bin/perl -w | ||
| 2 | # $Id$ | ||
| 3 | |||
| 4 | # check_file.pl Copyright (C) 2003 Steven Grimm <koreth-nagios@midwinter.com> | ||
| 5 | # | ||
| 6 | # Checks a file's size and modification time to make sure it's not empty | ||
| 7 | # and that it's sufficiently recent. | ||
| 8 | # | ||
| 9 | # | ||
| 10 | # This program is free software; you can redistribute it and/or | ||
| 11 | # modify it under the terms of the GNU General Public License | ||
| 12 | # as published by the Free Software Foundation; either version 2 | ||
| 13 | # of the License, or (at your option) any later version. | ||
| 14 | # | ||
| 15 | # This program is distributed in the hope that it will be useful, | ||
| 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty | ||
| 17 | # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | # GNU General Public License for more details. | ||
| 19 | # | ||
| 20 | # you should have received a copy of the GNU General Public License | ||
| 21 | # along with this program (or with Nagios); if not, write to the | ||
| 22 | # Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 23 | # Boston, MA 02111-1307, USA | ||
| 24 | |||
| 25 | use strict; | ||
| 26 | use English; | ||
| 27 | use Getopt::Long; | ||
| 28 | use File::stat; | ||
| 29 | use vars qw($PROGNAME); | ||
| 30 | use utils qw (%ERRORS &print_revision &support); | ||
| 31 | |||
| 32 | sub print_help (); | ||
| 33 | sub print_usage (); | ||
| 34 | |||
| 35 | my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V); | ||
| 36 | my ($result, $message, $age, $size, $st); | ||
| 37 | |||
| 38 | $PROGNAME="check_file"; | ||
| 39 | |||
| 40 | $opt_w = 240; | ||
| 41 | $opt_c = 600; | ||
| 42 | $opt_W = 0; | ||
| 43 | $opt_C = 0; | ||
| 44 | $opt_f = ""; | ||
| 45 | |||
| 46 | Getopt::Long::Configure('bundling'); | ||
| 47 | GetOptions( | ||
| 48 | "V" => \$opt_V, "version" => \$opt_V, | ||
| 49 | "h" => \$opt_h, "help" => \$opt_h, | ||
| 50 | "f=s" => \$opt_f, "file" => \$opt_f, | ||
| 51 | "w=f" => \$opt_w, "warning-age=f" => \$opt_w, | ||
| 52 | "W=f" => \$opt_W, "warning-size=f" => \$opt_W, | ||
| 53 | "c=f" => \$opt_c, "critical-age=f" => \$opt_c, | ||
| 54 | "C=f" => \$opt_C, "critical-size=f" => \$opt_C); | ||
| 55 | |||
| 56 | if ($opt_V) { | ||
| 57 | print_revision($PROGNAME, '$Id$'); | ||
| 58 | exit $ERRORS{'OK'}; | ||
| 59 | } | ||
| 60 | |||
| 61 | if ($opt_h) { | ||
| 62 | print_help(); | ||
| 63 | exit $ERRORS{'OK'}; | ||
| 64 | } | ||
| 65 | |||
| 66 | $opt_f = shift unless ($opt_f); | ||
| 67 | |||
| 68 | if (! $opt_f) { | ||
| 69 | print "No file specified\n"; | ||
| 70 | exit $ERRORS{'UNKNOWN'}; | ||
| 71 | } | ||
| 72 | |||
| 73 | # Examine the file. | ||
| 74 | unless (-f $opt_f) { | ||
| 75 | print "$opt_f: File not found\n"; | ||
| 76 | exit $ERRORS{'UNKNOWN'}; | ||
| 77 | } | ||
| 78 | |||
| 79 | $st = File::stat::stat($opt_f); | ||
| 80 | $age = time - $st->mtime; | ||
| 81 | $size = $st->size; | ||
| 82 | |||
| 83 | |||
| 84 | $result = 'OK'; | ||
| 85 | |||
| 86 | if (($opt_c and $age > $opt_c) or ($opt_C and $size < $opt_C)) { | ||
| 87 | $result = 'CRITICAL'; | ||
| 88 | } | ||
| 89 | elsif (($opt_w and $age > $opt_w) or ($opt_W and $size < $opt_W)) { | ||
| 90 | $result = 'WARNING'; | ||
| 91 | } | ||
| 92 | |||
| 93 | print "$result - $opt_f is $age seconds old and $size bytes\n"; | ||
| 94 | exit $ERRORS{$result}; | ||
| 95 | |||
| 96 | sub print_usage () { | ||
| 97 | print "Usage:\n"; | ||
| 98 | print " $PROGNAME [-w <secs>] [-c <secs>] [-W <size>] [-C <size>] -f <file>\n"; | ||
| 99 | print " $PROGNAME [-h | --help]\n"; | ||
| 100 | print " $PROGNAME [-V | --version]\n"; | ||
| 101 | } | ||
| 102 | |||
| 103 | sub print_help () { | ||
| 104 | print_revision($PROGNAME, '$Id$'); | ||
| 105 | print "Copyright (c) 2003 Steven Grimm\n\n"; | ||
| 106 | print_usage(); | ||
| 107 | print "\n"; | ||
| 108 | print " <secs> File must be no more than this many seconds old\n"; | ||
| 109 | print " <size> File must be at least this many bytes long\n"; | ||
| 110 | print "\n"; | ||
| 111 | support(); | ||
| 112 | } | ||
diff --git a/web/attachments/40524-check_by_ssh.diff b/web/attachments/40524-check_by_ssh.diff new file mode 100644 index 0000000..7ed93fe --- /dev/null +++ b/web/attachments/40524-check_by_ssh.diff | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | *** check_by_ssh.c.orig Thu Jan 23 23:16:08 2003 | ||
| 2 | --- check_by_ssh.c Thu Jan 23 23:36:15 2003 | ||
| 3 | *************** | ||
| 4 | *** 256,262 **** | ||
| 5 | while (p2 = index (p1, ':')) { | ||
| 6 | *p2 = '\0'; | ||
| 7 | asprintf (&service[services-1], "%s", p1); | ||
| 8 | ! service = realloc (service, ++services); | ||
| 9 | p1 = p2 + 1; | ||
| 10 | } | ||
| 11 | asprintf (&service[services-1], "%s", p1); | ||
| 12 | --- 256,262 ---- | ||
| 13 | while (p2 = index (p1, ':')) { | ||
| 14 | *p2 = '\0'; | ||
| 15 | asprintf (&service[services-1], "%s", p1); | ||
| 16 | ! service = realloc (service, sizeof(char *) * ++services); | ||
| 17 | p1 = p2 + 1; | ||
| 18 | } | ||
| 19 | asprintf (&service[services-1], "%s", p1); | ||
diff --git a/web/attachments/405293-check_file_age-diff b/web/attachments/405293-check_file_age-diff new file mode 100644 index 0000000..6b32f0d --- /dev/null +++ b/web/attachments/405293-check_file_age-diff | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | --- /usr/libexec/nagios/plugins/check_file_age 2011-03-23 12:17:55.000000000 -0400 | ||
| 2 | +++ /home/vargo/tmp/excavate/check_file_age 2011-03-23 12:18:49.000000000 -0400 | ||
| 3 | @@ -32,7 +32,7 @@ | ||
| 4 | sub print_help (); | ||
| 5 | sub print_usage (); | ||
| 6 | |||
| 7 | -my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V); | ||
| 8 | +my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V, $opt_i); | ||
| 9 | my ($result, $message, $age, $size, $st); | ||
| 10 | |||
| 11 | $PROGNAME="check_file_age"; | ||
| 12 | @@ -47,6 +47,7 @@ | ||
| 13 | GetOptions( | ||
| 14 | "V" => \$opt_V, "version" => \$opt_V, | ||
| 15 | "h" => \$opt_h, "help" => \$opt_h, | ||
| 16 | + "i" => \$opt_i, "ignore-missing" => \$opt_i, | ||
| 17 | "f=s" => \$opt_f, "file" => \$opt_f, | ||
| 18 | "w=f" => \$opt_w, "warning-age=f" => \$opt_w, | ||
| 19 | "W=f" => \$opt_W, "warning-size=f" => \$opt_W, | ||
| 20 | @@ -72,8 +73,15 @@ | ||
| 21 | |||
| 22 | # Check that file exists (can be directory or link) | ||
| 23 | unless (-e $opt_f) { | ||
| 24 | - print "FILE_AGE CRITICAL: File not found - $opt_f\n"; | ||
| 25 | - exit $ERRORS{'CRITICAL'}; | ||
| 26 | + if ($opt_i) { | ||
| 27 | + $result = 'OK'; | ||
| 28 | + print "FILE_AGE $result: $opt_f doesn't exist, but ignore-missing was set\n"; | ||
| 29 | + exit $ERRORS{$result}; | ||
| 30 | + | ||
| 31 | + } else { | ||
| 32 | + print "FILE_AGE CRITICAL: File not found - $opt_f\n"; | ||
| 33 | + exit $ERRORS{'CRITICAL'}; | ||
| 34 | + } | ||
| 35 | } | ||
| 36 | |||
| 37 | $st = File::stat::stat($opt_f); | ||
| 38 | @@ -95,7 +103,7 @@ | ||
| 39 | |||
| 40 | sub print_usage () { | ||
| 41 | print "Usage:\n"; | ||
| 42 | - print " $PROGNAME [-w <secs>] [-c <secs>] [-W <size>] [-C <size>] -f <file>\n"; | ||
| 43 | + print " $PROGNAME [-w <secs>] [-c <secs>] [-W <size>] [-C <size>] [-i] -f <file>\n"; | ||
| 44 | print " $PROGNAME [-h | --help]\n"; | ||
| 45 | print " $PROGNAME [-V | --version]\n"; | ||
| 46 | } | ||
| 47 | @@ -105,6 +113,7 @@ | ||
| 48 | print "Copyright (c) 2003 Steven Grimm\n\n"; | ||
| 49 | print_usage(); | ||
| 50 | print "\n"; | ||
| 51 | + print " -i | --ignore-missing : return OK if the file does not exist\n"; | ||
| 52 | print " <secs> File must be no more than this many seconds old (default: warn 240 secs, crit 600)\n"; | ||
| 53 | print " <size> File must be at least this many bytes long (default: crit 0 bytes)\n"; | ||
| 54 | print "\n"; | ||
diff --git a/web/attachments/405415-0001-check_ssh-add-perfdata.patch b/web/attachments/405415-0001-check_ssh-add-perfdata.patch new file mode 100644 index 0000000..a724a29 --- /dev/null +++ b/web/attachments/405415-0001-check_ssh-add-perfdata.patch | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | From 9e3ec39e4388677d2b4fdf7730384e49778aeee9 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Marco Beck <mbeck@miamod.de> | ||
| 3 | Date: Mon, 7 Feb 2011 16:21:07 +0100 | ||
| 4 | Subject: [PATCH] check_ssh: add perfdata | ||
| 5 | |||
| 6 | --- | ||
| 7 | plugins/check_ssh.c | 11 +++++++++-- | ||
| 8 | 1 files changed, 9 insertions(+), 2 deletions(-) | ||
| 9 | |||
| 10 | diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c | ||
| 11 | index 2509b86..20e3f16 100644 | ||
| 12 | --- a/plugins/check_ssh.c | ||
| 13 | +++ b/plugins/check_ssh.c | ||
| 14 | @@ -215,6 +215,10 @@ ssh_connect (char *haddr, int hport, char *remote_version) | ||
| 15 | char *ssh_proto = NULL; | ||
| 16 | char *ssh_server = NULL; | ||
| 17 | static char *rev_no = VERSION; | ||
| 18 | + struct timeval tv; | ||
| 19 | + double elapsed_time; | ||
| 20 | + | ||
| 21 | + gettimeofday(&tv, NULL); | ||
| 22 | |||
| 23 | result = my_tcp_connect (haddr, hport, &sd); | ||
| 24 | |||
| 25 | @@ -250,9 +254,12 @@ ssh_connect (char *haddr, int hport, char *remote_version) | ||
| 26 | exit (STATE_WARNING); | ||
| 27 | } | ||
| 28 | |||
| 29 | + elapsed_time = (double)deltime(tv) / 1.0e6; | ||
| 30 | + | ||
| 31 | printf | ||
| 32 | - (_("SSH OK - %s (protocol %s)\n"), | ||
| 33 | - ssh_server, ssh_proto); | ||
| 34 | + (_("SSH OK - %s (protocol %s) | %s\n"), | ||
| 35 | + ssh_server, ssh_proto, fperfdata("time", elapsed_time, "s", | ||
| 36 | + FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); | ||
| 37 | close(sd); | ||
| 38 | exit (STATE_OK); | ||
| 39 | } | ||
| 40 | -- | ||
| 41 | 1.7.3.5 | ||
| 42 | |||
diff --git a/web/attachments/406534-nagiosplug_mysql.diff b/web/attachments/406534-nagiosplug_mysql.diff new file mode 100644 index 0000000..991ce1a --- /dev/null +++ b/web/attachments/406534-nagiosplug_mysql.diff | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | diff --git a/REQUIREMENTS b/REQUIREMENTS | ||
| 2 | index fd41ded..33c5eb9 100644 | ||
| 3 | --- a/REQUIREMENTS | ||
| 4 | +++ b/REQUIREMENTS | ||
| 5 | @@ -36,10 +36,9 @@ check_ldap: | ||
| 6 | |||
| 7 | check_mysql, check_mysql_query: | ||
| 8 | - Requires the MySQL libraries available from | ||
| 9 | - http://www.mysql.org/ | ||
| 10 | + http://dev.mysql.com/downloads/ | ||
| 11 | Lib: libmysql, libmysqlclient | ||
| 12 | - Redhat Powertools Source: mysql-3.20.32a-3.i386.rpm, mysql-devel-3.20.32a-3.i386.rpm (these seem to be broken, however) | ||
| 13 | - RPMS from www.mysql.org work better | ||
| 14 | + Redhat Source (RHEL6, YUM): mysql-devel, mysql-libs | ||
| 15 | Must have mysql_config in PATH or specified with --with-mysql=DIR for DIR/bin/mysql_config | ||
| 16 | |||
| 17 | check_pqsql: | ||
| 18 | diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c | ||
| 19 | index d9b4e53..0dfb1fd 100644 | ||
| 20 | --- a/plugins/check_mysql.c | ||
| 21 | +++ b/plugins/check_mysql.c | ||
| 22 | @@ -5,7 +5,7 @@ | ||
| 23 | * License: GPL | ||
| 24 | * Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at) | ||
| 25 | * Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net) | ||
| 26 | -* Copyright (c) 1999-2009 Nagios Plugins Development Team | ||
| 27 | +* Copyright (c) 1999-2011 Nagios Plugins Development Team | ||
| 28 | * | ||
| 29 | * Description: | ||
| 30 | * | ||
| 31 | @@ -31,7 +31,7 @@ | ||
| 32 | *****************************************************************************/ | ||
| 33 | |||
| 34 | const char *progname = "check_mysql"; | ||
| 35 | -const char *copyright = "1999-2007"; | ||
| 36 | +const char *copyright = "1999-2011"; | ||
| 37 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 38 | |||
| 39 | #define SLAVERESULTSIZE 70 | ||
| 40 | @@ -157,7 +157,7 @@ main (int argc, char **argv) | ||
| 41 | } | ||
| 42 | |||
| 43 | } else { | ||
| 44 | - /* mysql 4.x.x */ | ||
| 45 | + /* mysql 4.x.x and mysql 5.x.x */ | ||
| 46 | int slave_io_field = -1 , slave_sql_field = -1, seconds_behind_field = -1, i, num_fields; | ||
| 47 | MYSQL_FIELD* fields; | ||
| 48 | |||
| 49 | @@ -178,13 +178,17 @@ main (int argc, char **argv) | ||
| 50 | } | ||
| 51 | } | ||
| 52 | |||
| 53 | + /* Check if slave status is available */ | ||
| 54 | if ((slave_io_field < 0) || (slave_sql_field < 0) || (num_fields == 0)) { | ||
| 55 | mysql_free_result (res); | ||
| 56 | mysql_close (&mysql); | ||
| 57 | die (STATE_CRITICAL, "Slave status unavailable\n"); | ||
| 58 | } | ||
| 59 | |||
| 60 | + /* Save slave status in slaveresult */ | ||
| 61 | snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s Seconds Behind Master: %s", row[slave_io_field], row[slave_sql_field], seconds_behind_field!=-1?row[seconds_behind_field]:"Unknown"); | ||
| 62 | + | ||
| 63 | + /* Raise critical error if SQL THREAD or IO THREAD are stopped */ | ||
| 64 | if (strcmp (row[slave_io_field], "Yes") != 0 || strcmp (row[slave_sql_field], "Yes") != 0) { | ||
| 65 | mysql_free_result (res); | ||
| 66 | mysql_close (&mysql); | ||
| 67 | @@ -199,6 +203,7 @@ main (int argc, char **argv) | ||
| 68 | } | ||
| 69 | } | ||
| 70 | |||
| 71 | + /* Check Seconds Behind against threshold */ | ||
| 72 | if ((seconds_behind_field != -1) && (strcmp (row[seconds_behind_field], "NULL") != 0)) { | ||
| 73 | double value = atof(row[seconds_behind_field]); | ||
| 74 | int status; | ||
diff --git a/web/attachments/407004-timeout-lowercase.patch b/web/attachments/407004-timeout-lowercase.patch new file mode 100644 index 0000000..1cbce5f --- /dev/null +++ b/web/attachments/407004-timeout-lowercase.patch | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | diff --git a/plugins-scripts/check_mssql.pl b/plugins-scripts/check_mssql.pl | ||
| 2 | index 9a8fc51..17e6d33 100755 | ||
| 3 | --- a/plugins-scripts/check_mssql.pl | ||
| 4 | +++ b/plugins-scripts/check_mssql.pl | ||
| 5 | @@ -49,7 +49,7 @@ $SIG{'ALRM'} = sub { | ||
| 6 | print ("SQL UNKNOWN: ERROR connection $server (alarm timeout)\n"); | ||
| 7 | exit $ERRORS{"UNKNOWN"}; | ||
| 8 | }; | ||
| 9 | -alarm($TIMEOUT); | ||
| 10 | +alarm($timeout); | ||
| 11 | |||
| 12 | unless ($dbh = DBI->connect("dbi:Sybase:server=".uc($server), "$username", "$password")) { | ||
| 13 | printf "SQL CRITICAL: Can't connect to mssql server $DBI::errstr\n"; | ||
diff --git a/web/attachments/407261-check_sensors-fault b/web/attachments/407261-check_sensors-fault new file mode 100644 index 0000000..64b5201 --- /dev/null +++ b/web/attachments/407261-check_sensors-fault | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | Description: check for lmsensors 'FAULT' status as well as 'ALARM' | ||
| 2 | Author: Jonathan Wiltshire <jmw@debian.org> | ||
| 3 | Last-Update: 2011-02-25 | ||
| 4 | |||
| 5 | --- nagios-plugins-1.4.15.orig/plugins-scripts/check_sensors.sh | ||
| 6 | +++ nagios-plugins-1.4.15/plugins-scripts/check_sensors.sh | ||
| 7 | @@ -57,6 +57,9 @@ | ||
| 8 | if echo ${sensordata} | egrep ALARM > /dev/null; then | ||
| 9 | echo SENSOR CRITICAL - Sensor alarm detected! | ||
| 10 | exit 2 | ||
| 11 | + elif echo ${sensordata} | egrep FAULT > /dev/null; then | ||
| 12 | + echo SENSOR CRITICAL - Sensor reported fault | ||
| 13 | + exit 2 | ||
| 14 | else | ||
| 15 | echo sensor ok | ||
| 16 | exit 0 | ||
diff --git a/web/attachments/408370-ssl_version.patch b/web/attachments/408370-ssl_version.patch new file mode 100644 index 0000000..dde90e8 --- /dev/null +++ b/web/attachments/408370-ssl_version.patch | |||
| @@ -0,0 +1,130 @@ | |||
| 1 | --- nagios-plugins-1.4.15/plugins/sslutils.c 2010-07-27 20:47:16.000000000 +0000 | ||
| 2 | +++ nagios-plugins-1.4.15-patched/plugins/sslutils.c 2011-04-12 14:13:29.035426121 +0000 | ||
| 3 | @@ -40,6 +40,28 @@ | ||
| 4 | } | ||
| 5 | |||
| 6 | int np_net_ssl_init_with_hostname (int sd, char *host_name) { | ||
| 7 | + return np_net_ssl_init_with_hostname_and_version (sd, host_name, 0); | ||
| 8 | +} | ||
| 9 | + | ||
| 10 | +int np_net_ssl_init_with_hostname_and_version (int sd, char *host_name, int version) { | ||
| 11 | + const SSL_METHOD * method = NULL; | ||
| 12 | + switch ( version ) { | ||
| 13 | + case 0: /* Deafult to auto negotiation */ | ||
| 14 | + method = SSLv23_client_method(); | ||
| 15 | + break; | ||
| 16 | + case 1: /* TLSv1 protocol */ | ||
| 17 | + method = TLSv1_client_method(); | ||
| 18 | + break; | ||
| 19 | + case 2: /* SSLv2 protocol */ | ||
| 20 | + method = SSLv2_client_method(); | ||
| 21 | + break; | ||
| 22 | + case 3: /* SSLv3 protocol */ | ||
| 23 | + method = SSLv3_client_method(); | ||
| 24 | + break; | ||
| 25 | + default: /* Unsupported */ | ||
| 26 | + printf ("%s\n", _("CRITICAL - Unsupported SSL Protocol Version.")); | ||
| 27 | + return STATE_CRITICAL; | ||
| 28 | + } | ||
| 29 | if (!initialized) { | ||
| 30 | /* Initialize SSL context */ | ||
| 31 | SSLeay_add_ssl_algorithms (); | ||
| 32 | @@ -47,7 +69,7 @@ | ||
| 33 | OpenSSL_add_all_algorithms (); | ||
| 34 | initialized = 1; | ||
| 35 | } | ||
| 36 | - if ((c = SSL_CTX_new (SSLv23_client_method ())) == NULL) { | ||
| 37 | + if ((c = SSL_CTX_new (method)) == NULL) { | ||
| 38 | printf ("%s\n", _("CRITICAL - Cannot create SSL context.")); | ||
| 39 | return STATE_CRITICAL; | ||
| 40 | } | ||
| 41 | |||
| 42 | |||
| 43 | --- nagios-plugins-1.4.15/plugins/check_http.c 2010-07-27 20:47:16.000000000 +0000 | ||
| 44 | +++ nagios-plugins-1.4.15-patched/plugins/check_http.c 2011-04-12 14:14:58.426446596 +0000 | ||
| 45 | @@ -34,7 +34,7 @@ | ||
| 46 | /* splint -I. -I../../plugins -I../../lib/ -I/usr/kerberos/include/ ../../plugins/check_http.c */ | ||
| 47 | |||
| 48 | const char *progname = "check_http"; | ||
| 49 | -const char *copyright = "1999-2008"; | ||
| 50 | +const char *copyright = "1999-2011"; | ||
| 51 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 52 | |||
| 53 | #include "common.h" | ||
| 54 | @@ -59,6 +59,7 @@ | ||
| 55 | #ifdef HAVE_SSL | ||
| 56 | int check_cert = FALSE; | ||
| 57 | int days_till_exp; | ||
| 58 | +int ssl_version; | ||
| 59 | char *randbuff; | ||
| 60 | X509 *server_cert; | ||
| 61 | # define my_recv(buf, len) ((use_ssl) ? np_net_ssl_read(buf, len) : read(sd, buf, len)) | ||
| 62 | @@ -189,7 +190,7 @@ | ||
| 63 | STD_LONG_OPTS, | ||
| 64 | {"link", no_argument, 0, 'L'}, | ||
| 65 | {"nohtml", no_argument, 0, 'n'}, | ||
| 66 | - {"ssl", no_argument, 0, 'S'}, | ||
| 67 | + {"ssl", optional_argument, 0, 'S'}, | ||
| 68 | {"sni", no_argument, 0, SNI_OPTION}, | ||
| 69 | {"post", required_argument, 0, 'P'}, | ||
| 70 | {"method", required_argument, 0, 'j'}, | ||
| 71 | @@ -235,7 +236,7 @@ | ||
| 72 | } | ||
| 73 | |||
| 74 | while (1) { | ||
| 75 | - c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 76 | + c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:e:p:s:R:r:u:f:C:nlLS::m:M:N", longopts, &option); | ||
| 77 | if (c == -1 || c == EOF) | ||
| 78 | break; | ||
| 79 | |||
| 80 | @@ -305,6 +306,21 @@ | ||
| 81 | usage4 (_("Invalid option - SSL is not available")); | ||
| 82 | #endif | ||
| 83 | use_ssl = TRUE; | ||
| 84 | + if (optarg == NULL) | ||
| 85 | + ssl_version = 0; | ||
| 86 | + else if (!is_intnonneg (optarg)) | ||
| 87 | + usage4 (_("Invalid option - Valid values for SSL Version are 1 (TLSv1), 2 (SSLv2) or 3 (SSLv3)")); | ||
| 88 | + else { | ||
| 89 | + ssl_version = atoi( optarg ); | ||
| 90 | + switch ( ssl_version ) { | ||
| 91 | + case 1: | ||
| 92 | + case 2: | ||
| 93 | + case 3: break; | ||
| 94 | + default: | ||
| 95 | + usage4 (_("Invalid option - Valid values for SSL Version are 1 (TLSv1), 2 (SSLv2) or 3 (SSLv3)")); | ||
| 96 | + break; | ||
| 97 | + } | ||
| 98 | + } | ||
| 99 | if (specify_port == FALSE) | ||
| 100 | server_port = HTTPS_PORT; | ||
| 101 | break; | ||
| 102 | @@ -807,7 +823,7 @@ | ||
| 103 | die (STATE_CRITICAL, _("HTTP CRITICAL - Unable to open TCP socket\n")); | ||
| 104 | #ifdef HAVE_SSL | ||
| 105 | if (use_ssl == TRUE) { | ||
| 106 | - np_net_ssl_init_with_hostname(sd, (use_sni ? host_name : NULL)); | ||
| 107 | + np_net_ssl_init_with_hostname_and_version(sd, (use_sni ? host_name : NULL), ssl_version); | ||
| 108 | if (check_cert == TRUE) { | ||
| 109 | result = np_net_ssl_check_cert(days_till_exp); | ||
| 110 | np_net_ssl_cleanup(); | ||
| 111 | @@ -1335,8 +1351,10 @@ | ||
| 112 | printf (UT_IPv46); | ||
| 113 | |||
| 114 | #ifdef HAVE_SSL | ||
| 115 | - printf (" %s\n", "-S, --ssl"); | ||
| 116 | + printf (" %s\n", "-S, --ssl=VERSION"); | ||
| 117 | printf (" %s\n", _("Connect via SSL. Port defaults to 443")); | ||
| 118 | + printf (" %s\n", _("VERSION is optional, and prevents auto negotiation.")); | ||
| 119 | + printf (" %s\n", _("1 = TLSv1, 2 = SSLv2, 3 = SSLv3.")); | ||
| 120 | printf (" %s\n", "--sni"); | ||
| 121 | printf (" %s\n", _("Enable SSL/TLS hostname extension support (SNI)")); | ||
| 122 | printf (" %s\n", "-C, --certificate=INTEGER"); | ||
| 123 | @@ -1441,6 +1459,6 @@ | ||
| 124 | printf (" [-b proxy_auth] [-f <ok|warning|critcal|follow|sticky|stickyport>]\n"); | ||
| 125 | printf (" [-e <expect>] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n"); | ||
| 126 | printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); | ||
| 127 | - printf (" [-A string] [-k string] [-S] [--sni] [-C <age>] [-T <content-type>]\n"); | ||
| 128 | + printf (" [-A string] [-k string] [-S <version>] [--sni] [-C <age>] [-T <content-type>]\n"); | ||
| 129 | printf (" [-j method]\n"); | ||
| 130 | } | ||
diff --git a/web/attachments/40985-check_oracle.patch b/web/attachments/40985-check_oracle.patch new file mode 100644 index 0000000..384d33e --- /dev/null +++ b/web/attachments/40985-check_oracle.patch | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | --- new/check_oracle.sh Wed Jan 29 14:38:44 2003 | ||
| 2 | +++ jjm/check_oracle.sh Wed Jan 29 15:17:01 2003 | ||
| 3 | @@ -1,4 +1,4 @@ | ||
| 4 | -#!/bin/sh | ||
| 5 | +#!/bin/bash | ||
| 6 | # | ||
| 7 | # latigid010@yahoo.com | ||
| 8 | # 01/06/2000 | ||
| 9 | @@ -37,6 +37,8 @@ | ||
| 10 | echo " $PROGNAME --tns <Oracle Sid or Hostname/IP address>" | ||
| 11 | echo " $PROGNAME --db <ORACLE_SID>" | ||
| 12 | echo " $PROGNAME --login <ORACLE_SID>" | ||
| 13 | + echo " $PROGNAME --cache <USER> <PASS> <INST> <CRITICAL> <WARNING>" | ||
| 14 | + echo " $PROGNAME --tablespace <USER> <PASS> <INST> <TABLESPACE> <CRITICAL> <WARNING>" | ||
| 15 | echo " $PROGNAME --oranames <Hostname>" | ||
| 16 | echo " $PROGNAME --help" | ||
| 17 | echo " $PROGNAME --version" | ||
| 18 | @@ -56,6 +58,14 @@ | ||
| 19 | echo " filesystem for sgadefORACLE_SID.dbf" | ||
| 20 | echo "--login=SID" | ||
| 21 | echo " Attempt a dummy login and alert if not ORA-01017: invalid username/password" | ||
| 22 | + echo "--cache" | ||
| 23 | + echo " Check local database for library and buffer cache hit ratios" | ||
| 24 | + echo " ---> Requires Oracle user/password and SID specified." | ||
| 25 | + echo " ---> Requires select on v_$sysstat and v_$librarycache" | ||
| 26 | + echo "--tablespace" | ||
| 27 | + echo " Check local database for tablespace capacity in ORACLE_SID" | ||
| 28 | + echo " ---> Requires Oracle user/password specified." | ||
| 29 | + echo " ---> Requires select on dba_data_files and dba_free_space" | ||
| 30 | echo "--oranames=Hostname" | ||
| 31 | echo " Check remote Oracle Names server" | ||
| 32 | echo "--help" | ||
| 33 | @@ -191,6 +201,71 @@ | ||
| 34 | exit $STATE_CRITICAL | ||
| 35 | fi | ||
| 36 | ;; | ||
| 37 | +--cache) | ||
| 38 | + if [ ${5} -gt ${6} ] ; then | ||
| 39 | + echo "UNKNOWN - Warning level is less then Crit" | ||
| 40 | + exit $STATE_UNKNOWN | ||
| 41 | + fi | ||
| 42 | + result=`sqlplus -s ${2}/${3}@${4} << EOF | ||
| 43 | + set pagesize 0 | ||
| 44 | + | ||
| 45 | +select (1-(pr.value/(dbg.value+cg.value)))*100 \ | ||
| 46 | +from v\\$sysstat pr, v\\$sysstat dbg, v\\$sysstat cg \ | ||
| 47 | +where pr.name = 'physical reads' \ | ||
| 48 | + and dbg.name='db block gets' \ | ||
| 49 | + and cg.name='consistent gets'; ` | ||
| 50 | + | ||
| 51 | + buf_hr=`echo $result | awk '{print int($1)}'` | ||
| 52 | + result=`sqlplus -s ${2}/${3}@${4} << EOF | ||
| 53 | + set pagesize 0 | ||
| 54 | + | ||
| 55 | +select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 \ | ||
| 56 | +from v\\$librarycache lc ; ` | ||
| 57 | + | ||
| 58 | + lib_hr=`echo $result | awk '{print int($1)}'` | ||
| 59 | + | ||
| 60 | + if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then | ||
| 61 | + echo "${3} : ${4} CRITICAL - Cache Hit Rates: $lib_hr % Lib -- $buf_hr % Buff" | ||
| 62 | + exit $STATE_CRITICAL | ||
| 63 | + fi | ||
| 64 | + if [ $buf_hr -le ${6} -o $lib_hr -le ${6} ] ; then | ||
| 65 | + echo "${3} : ${4} WARNING - Cache Hit Rates: $lib_hr % Lib -- $buf_hr % Buff" | ||
| 66 | + exit $STATE_WARNING | ||
| 67 | + fi | ||
| 68 | + echo "${3} : ${4} OK - Cache Hit Rates: $lib_hr % Lib -- $buf_hr % Buff" | ||
| 69 | + | ||
| 70 | + exit $STATE_OK | ||
| 71 | + ;; | ||
| 72 | +--tablespace) | ||
| 73 | + if [ ${6} -lt ${7} ] ; then | ||
| 74 | + echo "UNKNOWN - Warning level is more then Crit" | ||
| 75 | + exit $STATE_UNKNOWN | ||
| 76 | + fi | ||
| 77 | + result=`sqlplus -s ${2}/${3}@${4} << EOF | ||
| 78 | + set pagesize 0 | ||
| 79 | + | ||
| 80 | +select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc \ | ||
| 81 | +from ( \ | ||
| 82 | +select tablespace_name,sum(bytes)/1024/1024 total \ | ||
| 83 | +from dba_data_files group by tablespace_name) A, \ | ||
| 84 | +( select tablespace_name,sum(bytes)/1024/1024 free \ | ||
| 85 | +from dba_Free_space group by tablespace_name) B \ | ||
| 86 | +where a.tablespace_name=b.tablespace_name and a.tablespace_name='${5}'; ` | ||
| 87 | + | ||
| 88 | + ts_free=`echo $result | awk '{print int($1)}'` | ||
| 89 | + ts_total=`echo $result | awk '{print int($2)}'` | ||
| 90 | + ts_pct=`echo $result | awk '{print int($3)}'` | ||
| 91 | + if [ $ts_pct -ge ${6} ] ; then | ||
| 92 | + echo "${4} : ${5} CRITICAL - $ts_pct% used [ $ts_free / $ts_total MB available ]" | ||
| 93 | + exit $STATE_CRITICAL | ||
| 94 | + fi | ||
| 95 | + if [ $ts_pct -ge ${7} ] ; then | ||
| 96 | + echo "${4} : ${5} WARNING - $ts_pct% used [ $ts_free / $ts_total MB available ]" | ||
| 97 | + exit $STATE_WARNING | ||
| 98 | + fi | ||
| 99 | + echo "${4} : ${5} OK - $ts_pct% used [ $ts_free / $ts_total MB available ]" | ||
| 100 | + exit $STATE_OK | ||
| 101 | + ;; | ||
| 102 | *) | ||
| 103 | print_usage | ||
| 104 | exit $STATE_UNKNOWN | ||
diff --git a/web/attachments/410030-checkhttpgzipdeflate.patch b/web/attachments/410030-checkhttpgzipdeflate.patch new file mode 100644 index 0000000..0850a70 --- /dev/null +++ b/web/attachments/410030-checkhttpgzipdeflate.patch | |||
| @@ -0,0 +1,328 @@ | |||
| 1 | diff --git a/plugins/check_http.c b/plugins/check_http.c | ||
| 2 | index 433c28e..a71cfe6 100644 | ||
| 3 | --- a/plugins/check_http.c | ||
| 4 | +++ b/plugins/check_http.c | ||
| 5 | @@ -41,7 +41,9 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 6 | #include "netutils.h" | ||
| 7 | #include "utils.h" | ||
| 8 | #include "base64.h" | ||
| 9 | +#include "zlib.h" | ||
| 10 | #include <ctype.h> | ||
| 11 | +#include <stdlib.h> | ||
| 12 | |||
| 13 | #define INPUT_DELIMITER ";" | ||
| 14 | #define STICKY_NONE 0 | ||
| 15 | @@ -114,6 +116,8 @@ int followsticky = STICKY_NONE; | ||
| 16 | int use_ssl = FALSE; | ||
| 17 | int use_sni = FALSE; | ||
| 18 | int verbose = FALSE; | ||
| 19 | +int decompress = FALSE; | ||
| 20 | +int chunked = FALSE; | ||
| 21 | int sd; | ||
| 22 | int min_page_len = 0; | ||
| 23 | int max_page_len = 0; | ||
| 24 | @@ -134,6 +138,14 @@ char *perfd_size (int page_len); | ||
| 25 | void print_help (void); | ||
| 26 | void print_usage (void); | ||
| 27 | |||
| 28 | +int page_content_decompress(const char *in_buf,int in_size, | ||
| 29 | + char **data,int *out_size,int type); | ||
| 30 | +int find_header_info(const char* header, | ||
| 31 | + char* content,const char* keyword); | ||
| 32 | +int get_content_encoding(const char* header); | ||
| 33 | +int get_transfer_encoding(const char* header); | ||
| 34 | +char* decodechunked(char * chunked, unsigned int *inputlen); | ||
| 35 | + | ||
| 36 | int | ||
| 37 | main (int argc, char **argv) | ||
| 38 | { | ||
| 39 | @@ -214,6 +226,8 @@ process_arguments (int argc, char **argv) | ||
| 40 | {"invert-regex", no_argument, NULL, INVERT_REGEX}, | ||
| 41 | {"use-ipv4", no_argument, 0, '4'}, | ||
| 42 | {"use-ipv6", no_argument, 0, '6'}, | ||
| 43 | + {"decompress",no_argument,0,'d'}, | ||
| 44 | + {"chunked",no_argument,0,'X'}, | ||
| 45 | {0, 0, 0, 0} | ||
| 46 | }; | ||
| 47 | |||
| 48 | @@ -234,7 +248,7 @@ process_arguments (int argc, char **argv) | ||
| 49 | } | ||
| 50 | |||
| 51 | while (1) { | ||
| 52 | - c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 53 | + c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:e:p:s:R:r:u:f:C:nlLSm:M:NdX", longopts, &option); | ||
| 54 | if (c == -1 || c == EOF) | ||
| 55 | break; | ||
| 56 | |||
| 57 | @@ -406,6 +420,12 @@ process_arguments (int argc, char **argv) | ||
| 58 | case 'v': /* verbose */ | ||
| 59 | verbose = TRUE; | ||
| 60 | break; | ||
| 61 | + case 'd': /* decompress */ | ||
| 62 | + decompress = TRUE; | ||
| 63 | + break; | ||
| 64 | + case 'X': /*chunked*/ | ||
| 65 | + chunked = TRUE; | ||
| 66 | + break; | ||
| 67 | case 'm': /* min_page_length */ | ||
| 68 | { | ||
| 69 | char *tmp; | ||
| 70 | @@ -793,6 +813,9 @@ check_http (void) | ||
| 71 | int page_len = 0; | ||
| 72 | int result = STATE_OK; | ||
| 73 | |||
| 74 | + char *uncompress_page; | ||
| 75 | + int uncompress_page_size; | ||
| 76 | + | ||
| 77 | /* try to connect to the host at the given port number */ | ||
| 78 | if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) | ||
| 79 | die (STATE_CRITICAL, _("HTTP CRITICAL - Unable to open TCP socket\n")); | ||
| 80 | @@ -870,18 +893,15 @@ check_http (void) | ||
| 81 | my_send (buf, strlen (buf)); | ||
| 82 | |||
| 83 | /* fetch the page */ | ||
| 84 | - full_page = strdup(""); | ||
| 85 | + full_page =(char*)malloc(sizeof(char)*4096); | ||
| 86 | while ((i = my_recv (buffer, MAX_INPUT_BUFFER-1)) > 0) { | ||
| 87 | - buffer[i] = '\0'; | ||
| 88 | - asprintf (&full_page_new, "%s%s", full_page, buffer); | ||
| 89 | - free (full_page); | ||
| 90 | - full_page = full_page_new; | ||
| 91 | + full_page = realloc(full_page, pagesize + i); | ||
| 92 | + memcpy(full_page + pagesize, buffer, i); | ||
| 93 | pagesize += i; | ||
| 94 | - | ||
| 95 | - if (no_body && document_headers_done (full_page)) { | ||
| 96 | - i = 0; | ||
| 97 | - break; | ||
| 98 | - } | ||
| 99 | + if (no_body && document_headers_done (full_page)) { | ||
| 100 | + i = 0; | ||
| 101 | + break; | ||
| 102 | + } | ||
| 103 | } | ||
| 104 | |||
| 105 | if (i < 0 && errno != ECONNRESET) { | ||
| 106 | @@ -951,6 +971,28 @@ check_http (void) | ||
| 107 | } | ||
| 108 | page += (size_t) strspn (page, "\r\n"); | ||
| 109 | header[pos - header] = 0; | ||
| 110 | + | ||
| 111 | + /*deal chunked data*/ | ||
| 112 | + if(get_transfer_encoding(header)==1 && chunked) { | ||
| 113 | + pagesize = pagesize - (page-header); | ||
| 114 | + page = decodechunked(page,&pagesize); | ||
| 115 | + } | ||
| 116 | + else { | ||
| 117 | + pagesize = get_content_length(header); | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + /*decompress the page content*/ | ||
| 121 | + int content_encoding = get_content_encoding(header); | ||
| 122 | + if(decompress && (content_encoding == 1 || content_encoding == 2)) { | ||
| 123 | + result = page_content_decompress(page,pagesize,&uncompress_page, | ||
| 124 | + &uncompress_page_size,content_encoding); | ||
| 125 | + | ||
| 126 | + if(result == 0) { | ||
| 127 | + page = uncompress_page; | ||
| 128 | + pagesize = uncompress_page_size; | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | if (verbose) | ||
| 133 | printf ("**** HEADER ****\n%s\n**** CONTENT ****\n%s\n", header, | ||
| 134 | (no_body ? " [[ skipped ]]" : page)); | ||
| 135 | @@ -1384,6 +1426,8 @@ print_help (void) | ||
| 136 | printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); | ||
| 137 | |||
| 138 | printf (UT_VERBOSE); | ||
| 139 | + printf (UT_DECOMPRESS); | ||
| 140 | + printf (UT_CHUNKED); | ||
| 141 | |||
| 142 | printf ("\n"); | ||
| 143 | printf ("%s\n", _("Notes:")); | ||
| 144 | @@ -1432,3 +1476,167 @@ print_usage (void) | ||
| 145 | printf (" [-A string] [-k string] [-S] [--sni] [-C <age>] [-T <content-type>]\n"); | ||
| 146 | printf (" [-j method]\n"); | ||
| 147 | } | ||
| 148 | + | ||
| 149 | +/* HTTP gzip or deflate decompress; | ||
| 150 | + * type = 1 represent gzip format | ||
| 151 | + * type = 2 represent deflate format */ | ||
| 152 | +int page_content_decompress(const char *in_buf,int in_size, | ||
| 153 | + char **out_buf_ptr, int *out_size,int type) | ||
| 154 | +{ | ||
| 155 | + z_stream stream = {0}; /* decompression stream */ | ||
| 156 | + char *out_buf = NULL; | ||
| 157 | + int out_buf_bytes = 0; | ||
| 158 | + char tmp_buf[4096]; | ||
| 159 | + int result; | ||
| 160 | + int new_bytes; | ||
| 161 | + | ||
| 162 | + stream.zalloc = (alloc_func)0; | ||
| 163 | + stream.zfree = (free_func)0; | ||
| 164 | + stream.opaque = (voidpf)0; | ||
| 165 | + stream.next_in = (void*) in_buf; | ||
| 166 | + stream.avail_in = in_size; | ||
| 167 | + stream.next_out = tmp_buf; | ||
| 168 | + stream.avail_out = sizeof tmp_buf; | ||
| 169 | + | ||
| 170 | + switch (type) { | ||
| 171 | + case 1: /*gzip*/ | ||
| 172 | + if(inflateInit2(&stream,MAX_WBITS+32) != Z_OK) | ||
| 173 | + return -1; | ||
| 174 | + break; | ||
| 175 | + case 2: /*deflate*/ | ||
| 176 | + if(inflateInit2(&stream,-MAX_WBITS) != Z_OK) | ||
| 177 | + return -1; | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + do { | ||
| 181 | + result = inflate(&stream,Z_NO_FLUSH); | ||
| 182 | + switch (result) { | ||
| 183 | + case Z_BUF_ERROR: | ||
| 184 | + if(stream.avail_in == 0) | ||
| 185 | + goto DONE; /*zlib bug */ | ||
| 186 | + case Z_ERRNO: | ||
| 187 | + case Z_NEED_DICT: | ||
| 188 | + case Z_MEM_ERROR: | ||
| 189 | + case Z_DATA_ERROR: | ||
| 190 | + inflateEnd(&stream); | ||
| 191 | + free(out_buf); | ||
| 192 | + return -1; | ||
| 193 | + } | ||
| 194 | + if(stream.avail_out < sizeof tmp_buf) { | ||
| 195 | + new_bytes = sizeof tmp_buf - stream.avail_out; | ||
| 196 | + out_buf = realloc(out_buf,out_buf_bytes + new_bytes); | ||
| 197 | + memcpy (out_buf + out_buf_bytes,tmp_buf,new_bytes); | ||
| 198 | + out_buf_bytes += new_bytes; | ||
| 199 | + stream.next_out = tmp_buf; | ||
| 200 | + stream.avail_out = sizeof tmp_buf; | ||
| 201 | + } | ||
| 202 | + else { | ||
| 203 | + inflateEnd(&stream); | ||
| 204 | + free(out_buf); | ||
| 205 | + return -1; | ||
| 206 | + } | ||
| 207 | + } | ||
| 208 | + while(result != Z_STREAM_END); | ||
| 209 | + | ||
| 210 | +DONE: | ||
| 211 | + | ||
| 212 | + if(inflateEnd(&stream) != Z_OK) { | ||
| 213 | + free(out_buf); | ||
| 214 | + return -1; | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + *out_size = out_buf_bytes; | ||
| 218 | + out_buf = realloc(out_buf,out_buf_bytes + 1); | ||
| 219 | + out_buf[out_buf_bytes] = 0; | ||
| 220 | + *out_buf_ptr = out_buf; | ||
| 221 | + | ||
| 222 | + return 0; | ||
| 223 | +} | ||
| 224 | + | ||
| 225 | +/*find content from header data by keyword*/ | ||
| 226 | +int find_header_info(const char* header,char* content,const char* keyword) { | ||
| 227 | + char* start = strstr(header,keyword); | ||
| 228 | + if(start != 0) { | ||
| 229 | + start = start + strcspn(start,": "); | ||
| 230 | + start += strspn(start,": "); | ||
| 231 | + char* end = start + strcspn(start," \r\n"); | ||
| 232 | + if( content != NULL) { | ||
| 233 | + memcpy(content,start,end-start); | ||
| 234 | + } | ||
| 235 | + return 1; | ||
| 236 | + } | ||
| 237 | + else{ | ||
| 238 | + return 0; | ||
| 239 | + } | ||
| 240 | +} | ||
| 241 | + | ||
| 242 | +/*find Content-Encoding from the header info; | ||
| 243 | + *if Content-Encoding equal 'gzip' return 1,or return 0. | ||
| 244 | + */ | ||
| 245 | +int get_content_encoding(const char* header) { | ||
| 246 | + int result = 0; | ||
| 247 | + int ret = 0; | ||
| 248 | + char* content_encoding = (char*)malloc(sizeof(char)*10); | ||
| 249 | + result = find_header_info(header,content_encoding,"Content-Encoding"); | ||
| 250 | + | ||
| 251 | + if(result && strncmp(content_encoding,"gzip",4)==0) { | ||
| 252 | + ret = 1; | ||
| 253 | + } | ||
| 254 | + else if(result && strncmp(content_encoding,"deflate",7)==0) { | ||
| 255 | + ret = 2; | ||
| 256 | + } | ||
| 257 | + else { | ||
| 258 | + ret = 0; | ||
| 259 | + } | ||
| 260 | + if(content_encoding != NULL) { | ||
| 261 | + free(content_encoding); | ||
| 262 | + } | ||
| 263 | + return ret; | ||
| 264 | +} | ||
| 265 | + | ||
| 266 | +/*find Transfer-Encoding from the header info; | ||
| 267 | + * if Content-Encoding equal 'chunked' return 1,or return 0. | ||
| 268 | + */ | ||
| 269 | +int get_transfer_encoding(const char* header) { | ||
| 270 | + int result = 0; | ||
| 271 | + int ret = 0; | ||
| 272 | + char *transfer_encoding = (char*)malloc(sizeof(char)*10); | ||
| 273 | + result = find_header_info(header,transfer_encoding,"Transfer-Encoding"); | ||
| 274 | + | ||
| 275 | + if(result && strncmp(transfer_encoding,"chunked",7)==0){ | ||
| 276 | + ret = 1; | ||
| 277 | + } | ||
| 278 | + else { | ||
| 279 | + ret = 0; | ||
| 280 | + } | ||
| 281 | + | ||
| 282 | + if(transfer_encoding != NULL) { | ||
| 283 | + free(transfer_encoding); | ||
| 284 | + } | ||
| 285 | + return ret; | ||
| 286 | +} | ||
| 287 | + | ||
| 288 | +/* Returns NULL on invalid input */ | ||
| 289 | +char* decodechunked(char * chunked, unsigned int *inputlen) { | ||
| 290 | + char *orig = chunked, *dest = chunked; | ||
| 291 | + unsigned long chunklen; | ||
| 292 | + while((chunklen = strtoul(orig, &orig, 16))) { | ||
| 293 | + /* process one more chunk: */ | ||
| 294 | + /* skip chunk-extension part */ | ||
| 295 | + while(*orig && (*orig != '\r')) | ||
| 296 | + orig++; | ||
| 297 | + /* skip '\r\n' after chunk length */ | ||
| 298 | + orig += 2; | ||
| 299 | + if(( chunklen > (chunked + *inputlen - orig))) | ||
| 300 | + /* insane chunk length. Well... */ | ||
| 301 | + return NULL; | ||
| 302 | + memmove(dest, orig, chunklen); | ||
| 303 | + dest += chunklen; | ||
| 304 | + orig += chunklen; | ||
| 305 | + /* and go to the next chunk */ | ||
| 306 | + } | ||
| 307 | + *dest = '\0'; | ||
| 308 | + *inputlen = dest - chunked; | ||
| 309 | + | ||
| 310 | + return chunked; | ||
| 311 | +} | ||
| 312 | diff --git a/plugins/utils.h b/plugins/utils.h | ||
| 313 | index 3c3f189..78a74aa 100644 | ||
| 314 | --- a/plugins/utils.h | ||
| 315 | +++ b/plugins/utils.h | ||
| 316 | @@ -204,4 +204,12 @@ The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n\ | ||
| 317 | copies of the plugins under the terms of the GNU General Public License.\n\ | ||
| 318 | For more information about these matters, see the file named COPYING.\n") | ||
| 319 | |||
| 320 | +#define UT_DECOMPRESS _("\ | ||
| 321 | + -d, --decompress\n\ | ||
| 322 | + Decompress the contents of page which were compressed by gzip or deflate.\n") | ||
| 323 | + | ||
| 324 | +#define UT_CHUNKED _("\ | ||
| 325 | + -X, --chunked\n\ | ||
| 326 | + Deal with the data which was transferred by chunked encoding.") | ||
| 327 | + | ||
| 328 | #endif /* NP_UTILS_H */ | ||
diff --git a/web/attachments/41141-check_procs.c.patch b/web/attachments/41141-check_procs.c.patch new file mode 100644 index 0000000..c152d1b --- /dev/null +++ b/web/attachments/41141-check_procs.c.patch | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | *** check_procs.c.original Fri Jan 31 10:44:15 2003 | ||
| 2 | --- check_procs.c Fri Jan 31 10:44:27 2003 | ||
| 3 | *************** | ||
| 4 | *** 77,82 **** | ||
| 5 | --- 77,83 ---- | ||
| 6 | char *args = ""; | ||
| 7 | char *fmt = ""; | ||
| 8 | char tmp[MAX_INPUT_BUFFER]; | ||
| 9 | + const char *zombie = "Z"; | ||
| 10 | |||
| 11 | int | ||
| 12 | main (int argc, char **argv) | ||
| 13 | *************** | ||
| 14 | *** 93,98 **** | ||
| 15 | --- 94,100 ---- | ||
| 16 | int found = 0; /* counter for number of lines returned in `ps` output */ | ||
| 17 | int procs = 0; /* counter for number of processes meeting filter criteria */ | ||
| 18 | int pos; /* number of spaces before 'args' in `ps` output */ | ||
| 19 | + int cols; /* number of columns in ps output */ | ||
| 20 | |||
| 21 | int result = STATE_UNKNOWN; | ||
| 22 | |||
| 23 | *************** | ||
| 24 | *** 115,128 **** | ||
| 25 | fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process); | ||
| 26 | |||
| 27 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 28 | - if ( | ||
| 29 | #ifdef USE_PS_VARS | ||
| 30 | ! sscanf (input_buffer, PS_FORMAT, PS_VARLIST) >= 4 | ||
| 31 | #else | ||
| 32 | ! sscanf (input_buffer, PS_FORMAT, procstat, &procuid, &procppid, &pos, | ||
| 33 | ! procprog) >= 4 | ||
| 34 | #endif | ||
| 35 | ! ) { | ||
| 36 | found++; | ||
| 37 | resultsum = 0; | ||
| 38 | asprintf (&procargs, "%s", input_buffer + pos); | ||
| 39 | --- 117,134 ---- | ||
| 40 | fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process); | ||
| 41 | |||
| 42 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 43 | #ifdef USE_PS_VARS | ||
| 44 | ! cols = sscanf (input_buffer, PS_FORMAT, PS_VARLIST); | ||
| 45 | #else | ||
| 46 | ! cols = sscanf (input_buffer, PS_FORMAT, procstat, &procuid, | ||
| 47 | ! &procppid, &pos, procprog); | ||
| 48 | #endif | ||
| 49 | ! /* Zombie processes do not give a procprog command */ | ||
| 50 | ! if ( cols == 3 && strstr(procstat, zombie) ) { | ||
| 51 | ! strcpy(procprog, ""); | ||
| 52 | ! cols = 4; | ||
| 53 | ! } | ||
| 54 | ! if ( cols >= 4 ) { | ||
| 55 | found++; | ||
| 56 | resultsum = 0; | ||
| 57 | asprintf (&procargs, "%s", input_buffer + pos); | ||
| 58 | *************** | ||
| 59 | *** 147,152 **** | ||
| 60 | --- 153,162 ---- | ||
| 61 | #endif | ||
| 62 | if (options == resultsum) | ||
| 63 | procs++; | ||
| 64 | + } | ||
| 65 | + /* This should not happen */ | ||
| 66 | + else if (verbose) { | ||
| 67 | + printf("Not parseable: %s", input_buffer); | ||
| 68 | } | ||
| 69 | } | ||
| 70 | |||
diff --git a/web/attachments/41142-check_procs.c.patch b/web/attachments/41142-check_procs.c.patch new file mode 100644 index 0000000..efbdfe4 --- /dev/null +++ b/web/attachments/41142-check_procs.c.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-7 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378818434" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378818434" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378818434" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378818434" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378818434'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=677803&group_id=29880&atid=397597&file_id=41142" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/411426-check_mysql_query.diff b/web/attachments/411426-check_mysql_query.diff new file mode 100644 index 0000000..c635d34 --- /dev/null +++ b/web/attachments/411426-check_mysql_query.diff | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | --- check_mysql_query.c 2010-07-27 22:47:16.000000000 +0200 | ||
| 2 | +++ /home/psy/check_mysql_query_psy.c 2011-05-12 17:01:19.000000000 +0200 | ||
| 3 | @@ -67,8 +67,9 @@ | ||
| 4 | MYSQL_ROW row; | ||
| 5 | |||
| 6 | double value; | ||
| 7 | + char perfmin[20],perfmax[20]; | ||
| 8 | char *error = NULL; | ||
| 9 | - int status; | ||
| 10 | + int status,cols; | ||
| 11 | |||
| 12 | setlocale (LC_ALL, ""); | ||
| 13 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 14 | @@ -128,6 +129,7 @@ | ||
| 15 | die (STATE_CRITICAL, "QUERY %s: Fetch row error - %s\n", _("CRITICAL"), error); | ||
| 16 | } | ||
| 17 | |||
| 18 | + cols = mysql_num_fields(res); | ||
| 19 | /* free the result */ | ||
| 20 | mysql_free_result (res); | ||
| 21 | |||
| 22 | @@ -140,20 +142,31 @@ | ||
| 23 | |||
| 24 | value = strtod(row[0], NULL); | ||
| 25 | |||
| 26 | + if ( (cols >= 2) && (is_numeric(row[1])) ) | ||
| 27 | + sprintf(perfmin,"%g",strtod(row[1],NULL)); | ||
| 28 | + else | ||
| 29 | + sprintf(perfmin, ""); | ||
| 30 | + | ||
| 31 | + if ( (cols >= 3) && (is_numeric(row[2])) ) | ||
| 32 | + sprintf(perfmax,"%g",strtod(row[2],NULL)); | ||
| 33 | + else | ||
| 34 | + sprintf(perfmax, ""); | ||
| 35 | + | ||
| 36 | if (verbose >= 3) | ||
| 37 | printf("mysql result: %f\n", value); | ||
| 38 | |||
| 39 | status = get_status(value, my_thresholds); | ||
| 40 | |||
| 41 | if (status == STATE_OK) { | ||
| 42 | - printf("QUERY %s: ", _("OK")); | ||
| 43 | + printf("QUERY %s: returned %g", _("OK"),value); | ||
| 44 | } else if (status == STATE_WARNING) { | ||
| 45 | - printf("QUERY %s: ", _("WARNING")); | ||
| 46 | + printf("QUERY %s: returned %g", _("WARNING"),value); | ||
| 47 | } else if (status == STATE_CRITICAL) { | ||
| 48 | - printf("QUERY %s: ", _("CRITICAL")); | ||
| 49 | + printf("QUERY %s: returned %g", _("CRITICAL"),value); | ||
| 50 | } | ||
| 51 | - printf(_("'%s' returned %f"), sql_query, value); | ||
| 52 | printf("\n"); | ||
| 53 | + printf(_("'%s'\n"), sql_query); | ||
| 54 | + printf("| value=%g;;;%s;%s\n",value,perfmin,perfmax); | ||
| 55 | |||
| 56 | return status; | ||
| 57 | } | ||
diff --git a/web/attachments/412453-check_disk.diff b/web/attachments/412453-check_disk.diff new file mode 100644 index 0000000..0d72272 --- /dev/null +++ b/web/attachments/412453-check_disk.diff | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | commit 81feafc3746e7e63d9dea923d56b327b7d134f3b | ||
| 2 | Author: Alex Dehnert <adehnert@mit.edu> | ||
| 3 | Date: Mon May 23 03:50:26 2011 -0400 | ||
| 4 | |||
| 5 | check_disk: Use multiline output format | ||
| 6 | |||
| 7 | diff --git a/plugins/check_disk.c b/plugins/check_disk.c | ||
| 8 | index f889764..f6e9e5b 100644 | ||
| 9 | --- a/plugins/check_disk.c | ||
| 10 | +++ b/plugins/check_disk.c | ||
| 11 | @@ -159,6 +159,8 @@ main (int argc, char **argv) | ||
| 12 | int result = STATE_UNKNOWN; | ||
| 13 | int disk_result = STATE_UNKNOWN; | ||
| 14 | char *output; | ||
| 15 | + char *output_long; | ||
| 16 | + char *line; | ||
| 17 | char *details; | ||
| 18 | char *perf; | ||
| 19 | char *preamble; | ||
| 20 | @@ -173,6 +175,7 @@ main (int argc, char **argv) | ||
| 21 | |||
| 22 | preamble = strdup (" - free space:"); | ||
| 23 | output = strdup (""); | ||
| 24 | + output_long = strdup (""); | ||
| 25 | details = strdup (""); | ||
| 26 | perf = strdup (""); | ||
| 27 | stat_buf = malloc(sizeof *stat_buf); | ||
| 28 | @@ -331,17 +334,19 @@ main (int argc, char **argv) | ||
| 29 | if (disk_result==STATE_OK && erronly && !verbose) | ||
| 30 | continue; | ||
| 31 | |||
| 32 | - asprintf (&output, "%s %s %.0f %s (%.0f%%", | ||
| 33 | - output, | ||
| 34 | + line = strdup (""); | ||
| 35 | + asprintf (&line, "%s %.0f %s (%.0f%%", | ||
| 36 | (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
| 37 | path->dfree_units, | ||
| 38 | units, | ||
| 39 | path->dfree_pct); | ||
| 40 | if (path->dused_inodes_percent < 0) { | ||
| 41 | - asprintf(&output, "%s inode=-);", output); | ||
| 42 | + asprintf(&line, "%s inode=-)", line); | ||
| 43 | } else { | ||
| 44 | - asprintf(&output, "%s inode=%.0f%%);", output, path->dfree_inodes_percent ); | ||
| 45 | + asprintf(&line, "%s inode=%.0f%%)", line, path->dfree_inodes_percent ); | ||
| 46 | } | ||
| 47 | + asprintf(&output, "%s %s:", output, line); | ||
| 48 | + asprintf(&output_long, "%s%s\n", output_long, line); | ||
| 49 | |||
| 50 | /* TODO: Need to do a similar debug line | ||
| 51 | asprintf (&details, _("%s\n\ | ||
| 52 | @@ -360,6 +365,7 @@ main (int argc, char **argv) | ||
| 53 | |||
| 54 | |||
| 55 | printf ("DISK %s%s%s|%s\n", state_text (result), (erronly && result==STATE_OK) ? "" : preamble, output, perf); | ||
| 56 | + printf ("%s", output_long); | ||
| 57 | return result; | ||
| 58 | } | ||
| 59 | |||
diff --git a/web/attachments/41358-check_snmp.c.diff b/web/attachments/41358-check_snmp.c.diff new file mode 100644 index 0000000..c5d28be --- /dev/null +++ b/web/attachments/41358-check_snmp.c.diff | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | --- check_snmp.c.orig 2002-11-16 06:06:02.000000000 +0100 | ||
| 2 | +++ check_snmp.c 2003-02-03 11:12:38.000000000 +0100 | ||
| 3 | @@ -319,6 +319,7 @@ | ||
| 4 | eval_method[i] & WARN_EQ || | ||
| 5 | eval_method[i] & WARN_NE) { | ||
| 6 | p2 = strpbrk (p2, "0123456789"); | ||
| 7 | + if (p2 == NULL) terminate (STATE_UNKNOWN,"No valid data returned"); | ||
| 8 | response_value[i] = strtoul (p2, NULL, 10); | ||
| 9 | iresult = check_num (i); | ||
| 10 | asprintf (&show, "%lu", response_value[i]); | ||
diff --git a/web/attachments/41359-check_snmp.c.diff b/web/attachments/41359-check_snmp.c.diff new file mode 100644 index 0000000..98cb017 --- /dev/null +++ b/web/attachments/41359-check_snmp.c.diff | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | --- plugins/check_snmp.c.orig 2002-11-16 06:06:02.000000000 +0100 | ||
| 2 | +++ plugins/check_snmp.c 2003-01-31 11:47:23.000000000 +0100 | ||
| 3 | @@ -299,6 +299,8 @@ | ||
| 4 | show = strstr (response, "Gauge32: ") + 9; | ||
| 5 | else if (strstr (response, "INTEGER: ")) | ||
| 6 | show = strstr (response, "INTEGER: ") + 9; | ||
| 7 | + else if (strstr (response, "STRING: ")) | ||
| 8 | + show = strstr (response, "STRING: ") + 8; | ||
| 9 | else | ||
| 10 | show = response; | ||
| 11 | p2 = show; \ No newline at end of file | ||
diff --git a/web/attachments/41389-plugins-scripts-Makefile.am.patch b/web/attachments/41389-plugins-scripts-Makefile.am.patch new file mode 100644 index 0000000..7b08f2b --- /dev/null +++ b/web/attachments/41389-plugins-scripts-Makefile.am.patch | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | --- Makefile.am.original 2002-10-30 19:49:19.000000000 +0100 | ||
| 2 | +++ Makefile.am 2003-02-03 19:21:01.000000000 +0100 | ||
| 3 | @@ -14,10 +14,12 @@ | ||
| 4 | |||
| 5 | TESTS_ENVIRONMENT=perl -I $(top_builddir) -I $(top_srcdir) | ||
| 6 | |||
| 7 | TESTS = @SCRIPT_TEST@ | ||
| 8 | |||
| 9 | +AM_INSTALL_PROGRAM_FLAGS = @INSTALL_OPTS@ | ||
| 10 | + | ||
| 11 | test: | ||
| 12 | perl -I $(top_builddir) -I $(top_srcdir) ../test.pl | ||
| 13 | |||
| 14 | CLEANFILES=$(libexec_SCRIPTS) | ||
| 15 | |||
diff --git a/web/attachments/41390-plugins-scripts-Makefile.am.patch b/web/attachments/41390-plugins-scripts-Makefile.am.patch new file mode 100644 index 0000000..a09c02a --- /dev/null +++ b/web/attachments/41390-plugins-scripts-Makefile.am.patch | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | --- Makefile.am.original 2002-10-30 19:49:19.000000000 +0100 | ||
| 2 | +++ Makefile.am 2003-02-03 19:45:17.000000000 +0100 | ||
| 3 | @@ -19,10 +19,12 @@ | ||
| 4 | test: | ||
| 5 | perl -I $(top_builddir) -I $(top_srcdir) ../test.pl | ||
| 6 | |||
| 7 | CLEANFILES=$(libexec_SCRIPTS) | ||
| 8 | |||
| 9 | +AM_INSTALL_PROGRAM_FLAGS = @INSTALL_OPTS@ | ||
| 10 | + | ||
| 11 | .pl : | ||
| 12 | $(AWK) -f ./subst $< > $@ | ||
| 13 | chmod +x $@ | ||
| 14 | |||
| 15 | .sh : | ||
diff --git a/web/attachments/414810-check_http.c.patch b/web/attachments/414810-check_http.c.patch new file mode 100644 index 0000000..6a189b5 --- /dev/null +++ b/web/attachments/414810-check_http.c.patch | |||
| @@ -0,0 +1,135 @@ | |||
| 1 | diff --git a/plugins/check_http.c b/plugins/check_http.c | ||
| 2 | index 433c28e..6a8a90a 100644 | ||
| 3 | --- a/plugins/check_http.c | ||
| 4 | +++ b/plugins/check_http.c | ||
| 5 | @@ -84,6 +84,7 @@ int errcode; | ||
| 6 | int invert_regex = 0; | ||
| 7 | |||
| 8 | struct timeval tv; | ||
| 9 | +struct timeval tv_temp; | ||
| 10 | |||
| 11 | #define HTTP_URL "/" | ||
| 12 | #define CRLF "\r\n" | ||
| 13 | @@ -130,6 +131,11 @@ void redir (char *pos, char *status_line); | ||
| 14 | int server_type_check(const char *type); | ||
| 15 | int server_port_check(int ssl_flag); | ||
| 16 | char *perfd_time (double microsec); | ||
| 17 | +char *perfd_time_connect (double microsec); | ||
| 18 | +char *perfd_time_ssl (double microsec); | ||
| 19 | +char *perfd_time_firstbyte (double microsec); | ||
| 20 | +char *perfd_time_headers (double microsec); | ||
| 21 | +char *perfd_time_transfer (double microsec); | ||
| 22 | char *perfd_size (int page_len); | ||
| 23 | void print_help (void); | ||
| 24 | void print_usage (void); | ||
| 25 | @@ -790,15 +796,31 @@ check_http (void) | ||
| 26 | char *pos; | ||
| 27 | long microsec; | ||
| 28 | double elapsed_time; | ||
| 29 | + long microsec_connect; | ||
| 30 | + double elapsed_time_connect; | ||
| 31 | + long microsec_ssl; | ||
| 32 | + double elapsed_time_ssl; | ||
| 33 | + long microsec_firstbyte; | ||
| 34 | + double elapsed_time_firstbyte; | ||
| 35 | + long microsec_headers; | ||
| 36 | + double elapsed_time_headers; | ||
| 37 | + long microsec_transfer; | ||
| 38 | + double elapsed_time_transfer; | ||
| 39 | int page_len = 0; | ||
| 40 | int result = STATE_OK; | ||
| 41 | |||
| 42 | /* try to connect to the host at the given port number */ | ||
| 43 | + gettimeofday (&tv_temp, NULL); | ||
| 44 | if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) | ||
| 45 | die (STATE_CRITICAL, _("HTTP CRITICAL - Unable to open TCP socket\n")); | ||
| 46 | + microsec_connect = deltime (tv_temp); | ||
| 47 | #ifdef HAVE_SSL | ||
| 48 | + elapsed_time_connect = (double)microsec_connect / 1.0e6; | ||
| 49 | if (use_ssl == TRUE) { | ||
| 50 | + gettimeofday (&tv_temp, NULL); | ||
| 51 | np_net_ssl_init_with_hostname(sd, (use_sni ? host_name : NULL)); | ||
| 52 | + microsec_ssl = deltime (tv_temp); | ||
| 53 | + elapsed_time_ssl = (double)microsec_ssl / 1.0e6; | ||
| 54 | if (check_cert == TRUE) { | ||
| 55 | result = np_net_ssl_check_cert(days_till_exp); | ||
| 56 | np_net_ssl_cleanup(); | ||
| 57 | @@ -867,11 +889,19 @@ check_http (void) | ||
| 58 | } | ||
| 59 | |||
| 60 | if (verbose) printf ("%s\n", buf); | ||
| 61 | + gettimeofday (&tv_temp, NULL); | ||
| 62 | my_send (buf, strlen (buf)); | ||
| 63 | + microsec_headers = deltime (tv_temp); | ||
| 64 | + elapsed_time_headers = (double)microsec_headers / 1.0e6; | ||
| 65 | |||
| 66 | /* fetch the page */ | ||
| 67 | full_page = strdup(""); | ||
| 68 | + gettimeofday (&tv_temp, NULL); | ||
| 69 | while ((i = my_recv (buffer, MAX_INPUT_BUFFER-1)) > 0) { | ||
| 70 | + if ((i >= 1) && (elapsed_time_firstbyte <= 0.000001)) { | ||
| 71 | + microsec_firstbyte = deltime (tv_temp); | ||
| 72 | + elapsed_time_firstbyte = (double)microsec_firstbyte / 1.0e6; | ||
| 73 | + } | ||
| 74 | buffer[i] = '\0'; | ||
| 75 | asprintf (&full_page_new, "%s%s", full_page, buffer); | ||
| 76 | free (full_page); | ||
| 77 | @@ -883,6 +913,8 @@ check_http (void) | ||
| 78 | break; | ||
| 79 | } | ||
| 80 | } | ||
| 81 | + microsec_transfer = deltime (tv_temp); | ||
| 82 | + elapsed_time_transfer = (double)microsec_transfer / 1.0e6; | ||
| 83 | |||
| 84 | if (i < 0 && errno != ECONNRESET) { | ||
| 85 | #ifdef HAVE_SSL | ||
| 86 | @@ -1085,10 +1117,16 @@ check_http (void) | ||
| 87 | |||
| 88 | /* check elapsed time */ | ||
| 89 | asprintf (&msg, | ||
| 90 | - _("%s - %d bytes in %.3f second response time %s|%s %s"), | ||
| 91 | + _("%s - %d bytes in %.3f second response time %s|%s %s %s %s %s %s %s"), | ||
| 92 | msg, page_len, elapsed_time, | ||
| 93 | (display_html ? "</A>" : ""), | ||
| 94 | - perfd_time (elapsed_time), perfd_size (page_len)); | ||
| 95 | + perfd_time (elapsed_time), | ||
| 96 | + perfd_size (page_len), | ||
| 97 | + perfd_time_connect (elapsed_time_connect), | ||
| 98 | + perfd_time_ssl (elapsed_time_ssl), | ||
| 99 | + perfd_time_headers (elapsed_time_headers), | ||
| 100 | + perfd_time_firstbyte (elapsed_time_firstbyte), | ||
| 101 | + perfd_time_transfer (elapsed_time_transfer)); | ||
| 102 | |||
| 103 | result = max_state_alt(get_status(elapsed_time, thlds), result); | ||
| 104 | |||
| 105 | @@ -1277,7 +1315,30 @@ char *perfd_time (double elapsed_time) | ||
| 106 | TRUE, 0, FALSE, 0); | ||
| 107 | } | ||
| 108 | |||
| 109 | +char *perfd_time_connect (double elapsed_time_connect) | ||
| 110 | +{ | ||
| 111 | + return fperfdata ("time_connect", elapsed_time_connect, "s", FALSE, 0, FALSE, 0, FALSE, 0, FALSE, 0); | ||
| 112 | +} | ||
| 113 | |||
| 114 | +char *perfd_time_ssl (double elapsed_time_ssl) | ||
| 115 | +{ | ||
| 116 | + return fperfdata ("time_ssl", elapsed_time_ssl, "s", FALSE, 0, FALSE, 0, FALSE, 0, FALSE, 0); | ||
| 117 | +} | ||
| 118 | + | ||
| 119 | +char *perfd_time_headers (double elapsed_time_headers) | ||
| 120 | +{ | ||
| 121 | + return fperfdata ("time_headers", elapsed_time_headers, "s", FALSE, 0, FALSE, 0, FALSE, 0, FALSE, 0); | ||
| 122 | +} | ||
| 123 | + | ||
| 124 | +char *perfd_time_firstbyte (double elapsed_time_firstbyte) | ||
| 125 | +{ | ||
| 126 | + return fperfdata ("time_firstbyte", elapsed_time_firstbyte, "s", FALSE, 0, FALSE, 0, FALSE, 0, FALSE, 0); | ||
| 127 | +} | ||
| 128 | + | ||
| 129 | +char *perfd_time_transfer (double elapsed_time_transfer) | ||
| 130 | +{ | ||
| 131 | + return fperfdata ("time_transfer", elapsed_time_transfer, "s", FALSE, 0, FALSE, 0, FALSE, 0, FALSE, 0); | ||
| 132 | +} | ||
| 133 | |||
| 134 | char *perfd_size (int page_len) | ||
| 135 | { | ||
diff --git a/web/attachments/41493-http.patch b/web/attachments/41493-http.patch new file mode 100644 index 0000000..8492cb2 --- /dev/null +++ b/web/attachments/41493-http.patch | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | Index: check_http.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_http.c,v | ||
| 4 | retrieving revision 1.15 | ||
| 5 | diff -u -p -r1.15 check_http.c | ||
| 6 | --- check_http.c 16 Jan 2003 06:29:02 -0000 1.15 | ||
| 7 | +++ check_http.c 22 Jan 2003 17:53:43 -0000 | ||
| 8 | @@ -45,7 +45,7 @@ certificate expiration times.\n" | ||
| 9 | [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\ | ||
| 10 | [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\ | ||
| 11 | [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\ | ||
| 12 | - [-P string]" | ||
| 13 | + [-P string] [-m min_pg_size]" | ||
| 14 | |||
| 15 | #define LONGOPTIONS "\ | ||
| 16 | -H, --hostname=ADDRESS\n\ | ||
| 17 | @@ -75,6 +75,8 @@ certificate expiration times.\n" | ||
| 18 | Wrap output in HTML link (obsoleted by urlize)\n\ | ||
| 19 | -f, --onredirect=<ok|warning|critical|follow>\n\ | ||
| 20 | How to handle redirected pages\n%s%s\ | ||
| 21 | + -m, --min=INTEGER\n\ | ||
| 22 | + Minimum page size required (bytes)\n\ | ||
| 23 | -v, --verbose\n\ | ||
| 24 | Show details for command-line debugging (do not use with nagios server)\n\ | ||
| 25 | -h, --help\n\ | ||
| 26 | @@ -212,6 +214,7 @@ int onredirect = STATE_OK; | ||
| 27 | int use_ssl = FALSE; | ||
| 28 | int verbose = FALSE; | ||
| 29 | int sd; | ||
| 30 | +int min_page_len = 0; | ||
| 31 | /*@null@*/ char *http_method = NULL; | ||
| 32 | /*@null@*/ char *http_post_data = NULL; | ||
| 33 | char buffer[MAX_INPUT_BUFFER]; | ||
| 34 | @@ -301,6 +304,7 @@ process_arguments (int argc, char **argv | ||
| 35 | {"linespan", no_argument, 0, 'l'}, | ||
| 36 | {"onredirect", required_argument, 0, 'f'}, | ||
| 37 | {"certificate", required_argument, 0, 'C'}, | ||
| 38 | + {"min",required_argument,0,'m'}, | ||
| 39 | {0, 0, 0, 0} | ||
| 40 | }; | ||
| 41 | #endif | ||
| 42 | @@ -321,7 +325,7 @@ process_arguments (int argc, char **argv | ||
| 43 | strcpy (argv[c], "-n"); | ||
| 44 | } | ||
| 45 | |||
| 46 | -#define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLS" | ||
| 47 | +#define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLSm:" | ||
| 48 | |||
| 49 | while (1) { | ||
| 50 | #ifdef HAVE_GETOPT_H | ||
| 51 | @@ -459,6 +463,9 @@ process_arguments (int argc, char **argv | ||
| 52 | case 'v': /* verbose */ | ||
| 53 | verbose = TRUE; | ||
| 54 | break; | ||
| 55 | + case 'm': /* min_page_length */ | ||
| 56 | + min_page_len = atoi (optarg); | ||
| 57 | + break; | ||
| 58 | } | ||
| 59 | } | ||
| 60 | |||
| 61 | @@ -548,6 +555,7 @@ check_http (void) | ||
| 62 | char *x = NULL; | ||
| 63 | char *orig_url = NULL; | ||
| 64 | double elapsed_time; | ||
| 65 | + int page_len = 0; | ||
| 66 | |||
| 67 | /* try to connect to the host at the given port number */ | ||
| 68 | #ifdef HAVE_SSL | ||
| 69 | @@ -895,6 +903,13 @@ check_http (void) | ||
| 70 | } | ||
| 71 | #endif | ||
| 72 | |||
| 73 | + /* make sure the page is of an appropriate size */ | ||
| 74 | + page_len = strlen (page); | ||
| 75 | + if ((min_page_len > 0) && (page_len < min_page_len)) { | ||
| 76 | + printf ("HTTP WARNING: page size too small%s|size=%i\n", | ||
| 77 | + (display_html ? "</A>" : ""), page_len ); | ||
| 78 | + exit (STATE_WARNING); | ||
| 79 | + } | ||
| 80 | /* We only get here if all tests have been passed */ | ||
| 81 | asprintf (&msg, "HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n", | ||
| 82 | status_line, (float)elapsed_time, | ||
diff --git a/web/attachments/415177-check_icmp.patch b/web/attachments/415177-check_icmp.patch new file mode 100644 index 0000000..570e4f7 --- /dev/null +++ b/web/attachments/415177-check_icmp.patch | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | --- check_icmp.c.orig 2011-06-12 13:05:39.000000000 +0200 | ||
| 2 | +++ check_icmp.c 2011-06-12 13:21:28.000000000 +0200 | ||
| 3 | @@ -204,7 +204,7 @@ | ||
| 4 | /** global variables **/ | ||
| 5 | static struct rta_host **table, *cursor, *list; | ||
| 6 | static threshold crit = {80, 500000}, warn = {40, 200000}; | ||
| 7 | -static int mode, protocols, sockets, debug = 0, timeout = 10; | ||
| 8 | +static int mode, protocols, sockets, debug = 0, timeout = 10, allperf = 1; | ||
| 9 | static unsigned short icmp_data_size = DEFAULT_PING_DATA_SIZE; | ||
| 10 | static unsigned short icmp_pkt_size = DEFAULT_PING_DATA_SIZE + ICMP_MINLEN; | ||
| 11 | |||
| 12 | @@ -456,7 +456,7 @@ | ||
| 13 | |||
| 14 | /* parse the arguments */ | ||
| 15 | for(i = 1; i < argc; i++) { | ||
| 16 | - while((arg = getopt(argc, argv, "vhVw:c:n:p:t:H:s:i:b:I:l:m:")) != EOF) { | ||
| 17 | + while((arg = getopt(argc, argv, "vhVaw:c:n:p:t:H:s:i:b:I:l:m:")) != EOF) { | ||
| 18 | long size; | ||
| 19 | switch(arg) { | ||
| 20 | case 'v': | ||
| 21 | @@ -512,6 +512,9 @@ | ||
| 22 | case 's': /* specify source IP address */ | ||
| 23 | set_source_ip(optarg); | ||
| 24 | break; | ||
| 25 | + case 'a': | ||
| 26 | + allperf = 0; | ||
| 27 | + break; | ||
| 28 | case 'V': /* version */ | ||
| 29 | print_revision (progname, NP_VERSION); | ||
| 30 | exit (STATE_OK); | ||
| 31 | @@ -1002,12 +1005,16 @@ | ||
| 32 | host = list; | ||
| 33 | while(host) { | ||
| 34 | if(debug) puts(""); | ||
| 35 | - printf("%srta=%0.3fms;%0.3f;%0.3f;0; %spl=%u%%;%u;%u;; %srtmax=%0.3fms;;;; %srtmin=%0.3fms;;;; ", | ||
| 36 | + if(allperf) printf("%srta=%0.3fms;%0.3f;%0.3f;0; %spl=%u%%;%u;%u;; %srtmax=%0.3fms;;;; %srtmin=%0.3fms;;;; ", | ||
| 37 | (targets > 1) ? host->name : "", | ||
| 38 | host->rta / 1000, (float)warn.rta / 1000, (float)crit.rta / 1000, | ||
| 39 | (targets > 1) ? host->name : "", host->pl, warn.pl, crit.pl, | ||
| 40 | (targets > 1) ? host->name : "", (float)host->rtmax / 1000, | ||
| 41 | (targets > 1) ? host->name : "", (host->rtmin < DBL_MAX) ? (float)host->rtmin / 1000 : (float)0); | ||
| 42 | + else printf("%srta=%0.3fms;%0.3f;%0.3f;0; %spl=%u%%;%u;%u;; ", | ||
| 43 | + (targets > 1) ? host->name : "", | ||
| 44 | + host->rta / 1000, (float)warn.rta / 1000, (float)crit.rta / 1000, | ||
| 45 | + (targets > 1) ? host->name : "", host->pl, warn.pl, crit.pl); | ||
| 46 | |||
| 47 | host = host->next; | ||
| 48 | } | ||
| 49 | @@ -1315,6 +1322,8 @@ | ||
| 50 | printf (" %s\n", "-b"); | ||
| 51 | printf (" %s\n", _("Number of icmp data bytes to send")); | ||
| 52 | printf (" %s %u + %d)\n", _("Packet size will be data bytes + icmp header (currently"),icmp_data_size, ICMP_MINLEN); | ||
| 53 | + printf (" %s\n", "-a"); | ||
| 54 | + printf (" %s\n",_("no rtmin/rtmax performance data")); | ||
| 55 | printf (" %s\n", "-v"); | ||
| 56 | printf (" %s\n", _("verbose")); | ||
| 57 | |||
diff --git a/web/attachments/41661-check_disk.patch b/web/attachments/41661-check_disk.patch new file mode 100644 index 0000000..ef6ce3e --- /dev/null +++ b/web/attachments/41661-check_disk.patch | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | Index: check_disk.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_disk.c,v | ||
| 4 | retrieving revision 1.7 | ||
| 5 | diff -r1.7 check_disk.c | ||
| 6 | 30a31,32 | ||
| 7 | > * - Modification by www.datux.nl 2003-01-24 | ||
| 8 | > * added performance data output | ||
| 9 | 66a69,71 | ||
| 10 | > int perf_total_disk = 0; | ||
| 11 | > int perf_free_disk = 0; | ||
| 12 | > int perf_used_disk = 0; | ||
| 13 | 98a104 | ||
| 14 | > /* did we get some usefull output from the 'df' process? */ | ||
| 15 | 120a127,129 | ||
| 16 | > perf_total_disk+=total_disk; | ||
| 17 | > perf_free_disk+=free_disk; | ||
| 18 | > perf_used_disk+=used_disk; | ||
| 19 | 150,151c159,166 | ||
| 20 | < printf ("DISK %s%s\n", state_text (result), output); | ||
| 21 | < | ||
| 22 | --- | ||
| 23 | > printf ("DISK %s%s|total=%d,used=%d,free=%d,used_perc=%f,free_perc=%f\n", | ||
| 24 | > state_text (result), | ||
| 25 | > output, | ||
| 26 | > perf_total_disk, | ||
| 27 | > perf_used_disk, | ||
| 28 | > perf_free_disk, | ||
| 29 | > 100-((float)perf_free_disk*100/(float)perf_total_disk), | ||
| 30 | > ((float)perf_free_disk*100/(float)perf_total_disk)); | ||
diff --git a/web/attachments/41662-check_load.patch b/web/attachments/41662-check_load.patch new file mode 100644 index 0000000..93311be --- /dev/null +++ b/web/attachments/41662-check_load.patch | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | Index: check_load.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_load.c,v | ||
| 4 | retrieving revision 1.5 | ||
| 5 | diff -r1.5 check_load.c | ||
| 6 | 21a22,24 | ||
| 7 | > * 20/01/2003 - Now returns performance data | ||
| 8 | > * mods by Edwin Eefting (www.DatuX.nl) | ||
| 9 | > * | ||
| 10 | 141a145,148 | ||
| 11 | > | ||
| 12 | > /* performance data */ | ||
| 13 | > printf ("|load1=%.2f,load5=%.2f,load15=%.2f", la1, la5, la15); | ||
| 14 | > | ||
diff --git a/web/attachments/41663-check_load.patch b/web/attachments/41663-check_load.patch new file mode 100644 index 0000000..93311be --- /dev/null +++ b/web/attachments/41663-check_load.patch | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | Index: check_load.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_load.c,v | ||
| 4 | retrieving revision 1.5 | ||
| 5 | diff -r1.5 check_load.c | ||
| 6 | 21a22,24 | ||
| 7 | > * 20/01/2003 - Now returns performance data | ||
| 8 | > * mods by Edwin Eefting (www.DatuX.nl) | ||
| 9 | > * | ||
| 10 | 141a145,148 | ||
| 11 | > | ||
| 12 | > /* performance data */ | ||
| 13 | > printf ("|load1=%.2f,load5=%.2f,load15=%.2f", la1, la5, la15); | ||
| 14 | > | ||
diff --git a/web/attachments/41664-check_ping.patch b/web/attachments/41664-check_ping.patch new file mode 100644 index 0000000..a65f132 --- /dev/null +++ b/web/attachments/41664-check_ping.patch | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | Index: check_ping.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ping.c,v | ||
| 4 | retrieving revision 1.11 | ||
| 5 | diff -r1.11 check_ping.c | ||
| 6 | 10a11,14 | ||
| 7 | > * updated Mon Jan 20 19:03:57 CET 2003 by Edwin Eefting (DatuX.nl) | ||
| 8 | > * -minor bugfixes | ||
| 9 | > * -now returns performance data | ||
| 10 | > * | ||
| 11 | 21c25 | ||
| 12 | < -H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n\ | ||
| 13 | --- | ||
| 14 | > -H <host_address> -w <wrta>,<wpl>% -c <crta>,<cpl>%\n\ | ||
| 15 | 138c142,147 | ||
| 16 | < printf ("\n"); | ||
| 17 | --- | ||
| 18 | > | ||
| 19 | > /* print performance data */ | ||
| 20 | > printf("|loss=%d",pl); | ||
| 21 | > if (pl != 100) | ||
| 22 | > printf(",rta=%f",rta); | ||
| 23 | > printf("\n"); | ||
| 24 | 145c154 | ||
| 25 | < | ||
| 26 | --- | ||
| 27 | > | ||
| 28 | 343c352 | ||
| 29 | < max_seconds = crta / 1000.0 * max_packets + max_packets; | ||
| 30 | --- | ||
| 31 | > max_seconds = crta / 1000.0 * max_packets + max_packets + 10; | ||
diff --git a/web/attachments/416883-check_mysql.patch b/web/attachments/416883-check_mysql.patch new file mode 100644 index 0000000..9643a98 --- /dev/null +++ b/web/attachments/416883-check_mysql.patch | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | --- a/nagios-plugins-1.4.15/plugins/check_mysql.c 2010-07-27 22:47:16.000000000 +0200 | ||
| 2 | +++ b/nagios-plugins-1.4.15/plugins/check_mysql.c 2011-06-30 11:12:09.000000000 +0200 | ||
| 3 | @@ -34,7 +34,7 @@ | ||
| 4 | const char *copyright = "1999-2007"; | ||
| 5 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 6 | |||
| 7 | -#define SLAVERESULTSIZE 70 | ||
| 8 | +#define SLAVERESULTSIZE 120 | ||
| 9 | |||
| 10 | #include "common.h" | ||
| 11 | #include "utils.h" | ||
| 12 | @@ -158,7 +158,7 @@ | ||
| 13 | |||
| 14 | } else { | ||
| 15 | /* mysql 4.x.x */ | ||
| 16 | - int slave_io_field = -1 , slave_sql_field = -1, seconds_behind_field = -1, i, num_fields; | ||
| 17 | + int slave_io_field = -1 , slave_sql_field = -1, seconds_behind_field = -1, until_cond_field = -1, last_errno_field = -1, i, num_fields; | ||
| 18 | MYSQL_FIELD* fields; | ||
| 19 | |||
| 20 | num_fields = mysql_num_fields(res); | ||
| 21 | @@ -176,16 +176,25 @@ | ||
| 22 | seconds_behind_field = i; | ||
| 23 | continue; | ||
| 24 | } | ||
| 25 | + if (strcmp(fields[i].name, "Until_Condition") == 0) { | ||
| 26 | + until_cond_field = i; | ||
| 27 | + continue; | ||
| 28 | + } | ||
| 29 | + if (strcmp(fields[i].name, "Last_Errno") == 0) { | ||
| 30 | + last_errno_field = i; | ||
| 31 | + continue; | ||
| 32 | + } | ||
| 33 | } | ||
| 34 | |||
| 35 | - if ((slave_io_field < 0) || (slave_sql_field < 0) || (num_fields == 0)) { | ||
| 36 | + if ((slave_io_field < 0) || (slave_sql_field < 0) || (last_errno_field < 0) || (num_fields == 0)) { | ||
| 37 | mysql_free_result (res); | ||
| 38 | mysql_close (&mysql); | ||
| 39 | die (STATE_CRITICAL, "Slave status unavailable\n"); | ||
| 40 | } | ||
| 41 | |||
| 42 | - snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s Seconds Behind Master: %s", row[slave_io_field], row[slave_sql_field], seconds_behind_field!=-1?row[seconds_behind_field]:"Unknown"); | ||
| 43 | - if (strcmp (row[slave_io_field], "Yes") != 0 || strcmp (row[slave_sql_field], "Yes") != 0) { | ||
| 44 | + snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s Seconds Behind Master: %s Until Condition: %s Last Errno: %s", row[slave_io_field], row[slave_sql_field], seconds_behind_field!=-1?row[seconds_behind_field]:"Unknown", row[until_cond_field], last_errno_field!=-1?row[last_errno_field]:"No Error"); | ||
| 45 | + | ||
| 46 | + if ((strcmp(row[until_cond_field], "None") == 0 && (strcmp (row[slave_io_field], "Yes") != 0 || strcmp (row[slave_sql_field], "Yes") != 0) ) || (strcmp(row[last_errno_field], "0") != 0)) { | ||
| 47 | mysql_free_result (res); | ||
| 48 | mysql_close (&mysql); | ||
| 49 | die (STATE_CRITICAL, "%s\n", slaveresult); | ||
| 50 | @@ -197,9 +206,19 @@ | ||
| 51 | } else { | ||
| 52 | printf ("seconds_behind_field(index %d)=%s\n", seconds_behind_field, row[seconds_behind_field]); | ||
| 53 | } | ||
| 54 | + if (until_cond_field == -1) { | ||
| 55 | + printf("until_cond_field not found\n"); | ||
| 56 | + } else { | ||
| 57 | + printf ("until_cond_field(index %d)=%s\n", until_cond_field, row[until_cond_field]); | ||
| 58 | + } | ||
| 59 | + if (last_errno_field == -1) { | ||
| 60 | + printf("last_errno_field not found\n"); | ||
| 61 | + } else { | ||
| 62 | + printf("last_errno_field(index %d)=%s\n", last_errno_field, row[last_errno_field]); | ||
| 63 | + } | ||
| 64 | } | ||
| 65 | |||
| 66 | - if ((seconds_behind_field != -1) && (strcmp (row[seconds_behind_field], "NULL") != 0)) { | ||
| 67 | + if ((seconds_behind_field != -1) && (row[seconds_behind_field] != NULL && (strcmp (row[seconds_behind_field], "NULL") != 0)) && (strcmp(row[until_cond_field], "None") == 0)) { | ||
| 68 | double value = atof(row[seconds_behind_field]); | ||
| 69 | int status; | ||
| 70 | |||
diff --git a/web/attachments/417469-check_smtp.c.patch b/web/attachments/417469-check_smtp.c.patch new file mode 100644 index 0000000..3c6a812 --- /dev/null +++ b/web/attachments/417469-check_smtp.c.patch | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c | ||
| 2 | index ed49163..80cc0eb 100644 | ||
| 3 | --- a/plugins/check_smtp.c | ||
| 4 | +++ b/plugins/check_smtp.c | ||
| 5 | @@ -129,6 +129,9 @@ main (int argc, char **argv) | ||
| 6 | char *error_msg = ""; | ||
| 7 | struct timeval tv; | ||
| 8 | |||
| 9 | + /* catch pipe errors in read.write */ | ||
| 10 | + (void) signal (SIGPIPE, SIG_IGN); | ||
| 11 | + | ||
| 12 | setlocale (LC_ALL, ""); | ||
| 13 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 14 | textdomain (PACKAGE); | ||
| 15 | @@ -662,8 +665,20 @@ void | ||
| 16 | smtp_quit(void) | ||
| 17 | { | ||
| 18 | int bytes; | ||
| 19 | + int n; | ||
| 20 | + | ||
| 21 | + n = my_send(SMTP_QUIT, strlen(SMTP_QUIT)); | ||
| 22 | + if(n != 0) { | ||
| 23 | + if(verbose) { | ||
| 24 | + /* Not sure this is really an unknown state so just print out instead | ||
| 25 | + die (STATE_UNKNOWN, | ||
| 26 | + */ | ||
| 27 | + printf( | ||
| 28 | + _("Connection was closed by server before we could send QUIT command\n")); | ||
| 29 | + } | ||
| 30 | + return; | ||
| 31 | + } | ||
| 32 | |||
| 33 | - my_send(SMTP_QUIT, strlen(SMTP_QUIT)); | ||
| 34 | if (verbose) | ||
| 35 | printf(_("sent %s\n"), "QUIT"); | ||
| 36 | |||
diff --git a/web/attachments/418216-check_smtp.c.reworked.patch b/web/attachments/418216-check_smtp.c.reworked.patch new file mode 100644 index 0000000..729986c --- /dev/null +++ b/web/attachments/418216-check_smtp.c.reworked.patch | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | diff -ru nagios-plugins-1.4.15.orig/plugins/check_smtp.c nagios-plugins-1.4.15/plugins/check_smtp.c | ||
| 2 | --- nagios-plugins-1.4.15.orig/plugins/check_smtp.c 2010-07-27 20:47:16.000000000 +0000 | ||
| 3 | +++ nagios-plugins-1.4.15/plugins/check_smtp.c 2011-07-15 10:51:11.000000000 +0000 | ||
| 4 | @@ -114,6 +114,7 @@ | ||
| 5 | TCP_PROTOCOL = 1, | ||
| 6 | UDP_PROTOCOL = 2, | ||
| 7 | }; | ||
| 8 | +int ignore_send_quit_failure = FALSE; | ||
| 9 | |||
| 10 | |||
| 11 | int | ||
| 12 | @@ -129,6 +130,9 @@ | ||
| 13 | char *error_msg = ""; | ||
| 14 | struct timeval tv; | ||
| 15 | |||
| 16 | + /* catch pipe errors in read.write */ | ||
| 17 | + (void) signal (SIGPIPE, SIG_IGN); | ||
| 18 | + | ||
| 19 | setlocale (LC_ALL, ""); | ||
| 20 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 21 | textdomain (PACKAGE); | ||
| 22 | @@ -476,6 +480,7 @@ | ||
| 23 | {"help", no_argument, 0, 'h'}, | ||
| 24 | {"starttls",no_argument,0,'S'}, | ||
| 25 | {"certificate",required_argument,0,'D'}, | ||
| 26 | + {"ignore-quit-failure",no_argument,0,'q'}, | ||
| 27 | {0, 0, 0, 0} | ||
| 28 | }; | ||
| 29 | |||
| 30 | @@ -492,7 +497,7 @@ | ||
| 31 | } | ||
| 32 | |||
| 33 | while (1) { | ||
| 34 | - c = getopt_long (argc, argv, "+hVv46t:p:f:e:c:w:H:C:R:SD:F:A:U:P:", | ||
| 35 | + c = getopt_long (argc, argv, "+hVv46t:p:f:e:c:w:H:C:R:SD:F:A:U:P:q", | ||
| 36 | longopts, &option); | ||
| 37 | |||
| 38 | if (c == -1 || c == EOF) | ||
| 39 | @@ -579,6 +584,9 @@ | ||
| 40 | case 'v': /* verbose */ | ||
| 41 | verbose++; | ||
| 42 | break; | ||
| 43 | + case 'q': | ||
| 44 | + ignore_send_quit_failure++; /* ignore problem sending QUIT */ | ||
| 45 | + break; | ||
| 46 | case 't': /* timeout */ | ||
| 47 | if (is_intnonneg (optarg)) { | ||
| 48 | socket_timeout = atoi (optarg); | ||
| 49 | @@ -662,8 +670,21 @@ | ||
| 50 | smtp_quit(void) | ||
| 51 | { | ||
| 52 | int bytes; | ||
| 53 | + int n; | ||
| 54 | + | ||
| 55 | + n = my_send(SMTP_QUIT, strlen(SMTP_QUIT)); | ||
| 56 | + if(n != 0) { | ||
| 57 | + if(ignore_send_quit_failure) { | ||
| 58 | + if(verbose) { | ||
| 59 | + printf( | ||
| 60 | + _("Connection closed by server before sending QUIT command\n")); | ||
| 61 | + } | ||
| 62 | + return; | ||
| 63 | + } | ||
| 64 | + die (STATE_UNKNOWN, | ||
| 65 | + _("Connection closed by server before sending QUIT command\n")); | ||
| 66 | + } | ||
| 67 | |||
| 68 | - my_send(SMTP_QUIT, strlen(SMTP_QUIT)); | ||
| 69 | if (verbose) | ||
| 70 | printf(_("sent %s\n"), "QUIT"); | ||
| 71 | |||
| 72 | @@ -797,7 +818,9 @@ | ||
| 73 | printf (" %s\n", _("SMTP AUTH username")); | ||
| 74 | printf (" %s\n", "-P, --authpass=STRING"); | ||
| 75 | printf (" %s\n", _("SMTP AUTH password")); | ||
| 76 | - | ||
| 77 | + printf (" %s\n", "-q, --ignore-quit-failure"); | ||
| 78 | + printf (" %s\n", _("Ignore failure when sending QUIT command to server")); | ||
| 79 | + | ||
| 80 | printf (UT_WARN_CRIT); | ||
| 81 | |||
| 82 | printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); | ||
| 83 | @@ -821,6 +844,6 @@ | ||
| 84 | printf ("%s\n", _("Usage:")); | ||
| 85 | printf ("%s -H host [-p port] [-e expect] [-C command] [-f from addr]", progname); | ||
| 86 | printf ("[-A authtype -U authuser -P authpass] [-w warn] [-c crit] [-t timeout]\n"); | ||
| 87 | - printf ("[-F fqdn] [-S] [-D days] [-v] [-4|-6]\n"); | ||
| 88 | + printf ("[-F fqdn] [-S] [-D days] [-v] [-4|-6] [-q]\n"); | ||
| 89 | } | ||
| 90 | |||
diff --git a/web/attachments/418908-0001-check_users-use-utxent-functions-to-get-data.patch b/web/attachments/418908-0001-check_users-use-utxent-functions-to-get-data.patch new file mode 100644 index 0000000..84043bd --- /dev/null +++ b/web/attachments/418908-0001-check_users-use-utxent-functions-to-get-data.patch | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | From 10d9e2aadb3f7db0ab784a1843abcea570adf9ec Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Marc Remy <mremy@gmx.ch> | ||
| 3 | Date: Wed, 20 Jul 2011 21:18:42 +0200 | ||
| 4 | Subject: [PATCH] check_users: use utxent functions to get data | ||
| 5 | |||
| 6 | --- | ||
| 7 | plugins/Makefile.am | 2 +- | ||
| 8 | plugins/check_users.c | 38 ++++++++------------------------------ | ||
| 9 | 2 files changed, 9 insertions(+), 31 deletions(-) | ||
| 10 | |||
| 11 | diff --git a/plugins/Makefile.am b/plugins/Makefile.am | ||
| 12 | index 36a28b0..3a2afc1 100644 | ||
| 13 | --- a/plugins/Makefile.am | ||
| 14 | +++ b/plugins/Makefile.am | ||
| 15 | @@ -101,7 +101,7 @@ check_tcp_LDADD = $(SSLOBJS) $(NETLIBS) $(SSLLIBS) | ||
| 16 | check_time_LDADD = $(NETLIBS) | ||
| 17 | check_ntp_time_LDADD = $(NETLIBS) $(MATHLIBS) | ||
| 18 | check_ups_LDADD = $(NETLIBS) | ||
| 19 | -check_users_LDADD = $(BASEOBJS) popen.o | ||
| 20 | +check_users_LDADD = $(BASEOBJS) | ||
| 21 | check_by_ssh_LDADD = $(NETLIBS) | ||
| 22 | check_ide_smart_LDADD = $(BASEOBJS) | ||
| 23 | negate_LDADD = $(BASEOBJS) | ||
| 24 | diff --git a/plugins/check_users.c b/plugins/check_users.c | ||
| 25 | index 8368612..fb8bcca 100644 | ||
| 26 | --- a/plugins/check_users.c | ||
| 27 | +++ b/plugins/check_users.c | ||
| 28 | @@ -35,8 +35,8 @@ const char *copyright = "2000-2007"; | ||
| 29 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 30 | |||
| 31 | #include "common.h" | ||
| 32 | -#include "popen.h" | ||
| 33 | #include "utils.h" | ||
| 34 | +#include <utmpx.h> | ||
| 35 | |||
| 36 | #define possibly_set(a,b) ((a) == 0 ? (b) : 0) | ||
| 37 | |||
| 38 | @@ -54,6 +54,7 @@ main (int argc, char **argv) | ||
| 39 | int result = STATE_UNKNOWN; | ||
| 40 | char input_buffer[MAX_INPUT_BUFFER]; | ||
| 41 | char *perf; | ||
| 42 | + struct utmpx *putmpx; | ||
| 43 | |||
| 44 | setlocale (LC_ALL, ""); | ||
| 45 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 46 | @@ -67,43 +68,20 @@ main (int argc, char **argv) | ||
| 47 | if (process_arguments (argc, argv) == ERROR) | ||
| 48 | usage4 (_("Could not parse arguments")); | ||
| 49 | |||
| 50 | - /* run the command */ | ||
| 51 | - child_process = spopen (WHO_COMMAND); | ||
| 52 | - if (child_process == NULL) { | ||
| 53 | - printf (_("Could not open pipe: %s\n"), WHO_COMMAND); | ||
| 54 | - return STATE_UNKNOWN; | ||
| 55 | - } | ||
| 56 | - | ||
| 57 | - child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 58 | - if (child_stderr == NULL) | ||
| 59 | - printf (_("Could not open stderr for %s\n"), WHO_COMMAND); | ||
| 60 | - | ||
| 61 | users = 0; | ||
| 62 | |||
| 63 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 64 | + /* get currently logged users from utmpx */ | ||
| 65 | + setutxent(); | ||
| 66 | |||
| 67 | - /* increment 'users' on all lines except total user count */ | ||
| 68 | - if (input_buffer[0] != '#') { | ||
| 69 | + while( (putmpx=getutxent()) ) { | ||
| 70 | + if( (putmpx->ut_type==USER_PROCESS) ) { | ||
| 71 | users++; | ||
| 72 | - continue; | ||
| 73 | } | ||
| 74 | - | ||
| 75 | - /* get total logged in users */ | ||
| 76 | - if (sscanf (input_buffer, _("# users=%d"), &users) == 1) | ||
| 77 | - break; | ||
| 78 | - | ||
| 79 | } | ||
| 80 | |||
| 81 | - /* check STDERR */ | ||
| 82 | - if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) | ||
| 83 | - result = possibly_set (result, STATE_UNKNOWN); | ||
| 84 | - (void) fclose (child_stderr); | ||
| 85 | - | ||
| 86 | - /* close the pipe */ | ||
| 87 | - if (spclose (child_process)) | ||
| 88 | - result = possibly_set (result, STATE_UNKNOWN); | ||
| 89 | + endutxent(); | ||
| 90 | |||
| 91 | - /* else check the user count against warning and critical thresholds */ | ||
| 92 | + /* check the user count against warning and critical thresholds */ | ||
| 93 | if (users > cusers) | ||
| 94 | result = STATE_CRITICAL; | ||
| 95 | else if (users > wusers) | ||
| 96 | -- | ||
| 97 | 1.7.2.5 | ||
| 98 | |||
diff --git a/web/attachments/419185-check_oracle_1.4.15_tsmax.patch b/web/attachments/419185-check_oracle_1.4.15_tsmax.patch new file mode 100644 index 0000000..86a3232 --- /dev/null +++ b/web/attachments/419185-check_oracle_1.4.15_tsmax.patch | |||
| @@ -0,0 +1,95 @@ | |||
| 1 | --- check_oracle 2010-10-07 17:11:31.000000000 +0200 | ||
| 2 | +++ check_oracle_tsmax 2011-07-22 15:12:42.000000000 +0200 | ||
| 3 | @@ -8,7 +8,7 @@ | ||
| 4 | |||
| 5 | PROGNAME=`basename $0` | ||
| 6 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` | ||
| 7 | -REVISION="1.4.15" | ||
| 8 | +REVISION="1.4.15-tsmax" | ||
| 9 | |||
| 10 | . $PROGPATH/utils.sh | ||
| 11 | |||
| 12 | @@ -19,7 +19,7 @@ | ||
| 13 | echo " $PROGNAME --db <ORACLE_SID>" | ||
| 14 | echo " $PROGNAME --login <ORACLE_SID>" | ||
| 15 | echo " $PROGNAME --cache <ORACLE_SID> <USER> <PASS> <CRITICAL> <WARNING>" | ||
| 16 | - echo " $PROGNAME --tablespace <ORACLE_SID> <USER> <PASS> <TABLESPACE> <CRITICAL> <WARNING>" | ||
| 17 | + echo " $PROGNAME --tablespace <ORACLE_SID> <USER> <PASS> <TABLESPACE> <CRITICAL> <WARNING> [maxbytes]" | ||
| 18 | echo " $PROGNAME --oranames <Hostname>" | ||
| 19 | echo " $PROGNAME --help" | ||
| 20 | echo " $PROGNAME --version" | ||
| 21 | @@ -42,7 +42,7 @@ | ||
| 22 | echo "--cache" | ||
| 23 | echo " Check local database for library and buffer cache hit ratios" | ||
| 24 | echo " ---> Requires Oracle user/password and SID specified." | ||
| 25 | - echo " ---> Requires select on v_$sysstat and v_$librarycache" | ||
| 26 | + echo " ---> Requires select on v_\$sysstat and v_\$librarycache" | ||
| 27 | echo "--tablespace" | ||
| 28 | echo " Check local database for tablespace capacity in ORACLE_SID" | ||
| 29 | echo " ---> Requires Oracle user/password specified." | ||
| 30 | @@ -246,12 +246,12 @@ | ||
| 31 | result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 32 | set pagesize 0 | ||
| 33 | set numf '9999999.99' | ||
| 34 | -select NVL(b.free,0.0),a.total,100 - trunc(NVL(b.free,0.0)/a.total * 1000) / 10 prc | ||
| 35 | +select ROUND(a.maxi,0) MAXI, ROUND(a.total,0) ALLOCATED, ROUND(a.total-b.free,0) USED, ROUND(b.free,0) FREE, ROUND(a.maxi-a.total+b.free,0) FREEMAXI | ||
| 36 | from ( | ||
| 37 | -select tablespace_name,sum(bytes)/1024/1024 total | ||
| 38 | +select tablespace_name,sum(NVL(bytes,0))/1024/1024 total,sum(NVL(maxbytes,0))/1024/1024 maxi | ||
| 39 | from dba_data_files group by tablespace_name) A | ||
| 40 | LEFT OUTER JOIN | ||
| 41 | -( select tablespace_name,sum(bytes)/1024/1024 free | ||
| 42 | +( select tablespace_name,sum(NVL(bytes,0))/1024/1024 free | ||
| 43 | from dba_free_space group by tablespace_name) B | ||
| 44 | ON a.tablespace_name=b.tablespace_name WHERE a.tablespace_name='${5}'; | ||
| 45 | EOF` | ||
| 46 | @@ -262,23 +262,42 @@ | ||
| 47 | exit $STATE_CRITICAL | ||
| 48 | fi | ||
| 49 | |||
| 50 | - ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}'` | ||
| 51 | - ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}'` | ||
| 52 | - ts_pct=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'` | ||
| 53 | - ts_pctx=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print $3}'` | ||
| 54 | + ts_total= | ||
| 55 | + ts_used= | ||
| 56 | + ts_free= | ||
| 57 | + if [ "${8}" = "max" ]; then | ||
| 58 | + ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}'` | ||
| 59 | + ts_used=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'` | ||
| 60 | + ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($5)}'` | ||
| 61 | + else | ||
| 62 | + ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}'` | ||
| 63 | + ts_used=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'` | ||
| 64 | + ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($4)}'` | ||
| 65 | + fi | ||
| 66 | + | ||
| 67 | + compwarn=$7; compcrit=$6 | ||
| 68 | + | ||
| 69 | + if [ "$ts_total" = "" ]; then | ||
| 70 | + echo "${2} : ${5} UNKNOWN - no data was returned|${5}=0%;$compwarn%;$compcrit%;0;100" | ||
| 71 | + exit $STATE_UNKNOWN | ||
| 72 | + fi | ||
| 73 | + | ||
| 74 | + ts_pctx=`echo "scale=2; $ts_used/$ts_total * 100" | bc -l` | ||
| 75 | + ts_pct=`echo "scale=0; $ts_used/$ts_total * 100" | bc -l` | ||
| 76 | + | ||
| 77 | if [ "$ts_free" -eq 0 -a "$ts_total" -eq 0 -a "$ts_pct" -eq 0 ] ; then | ||
| 78 | echo "No data returned by Oracle - tablespace $5 not found?" | ||
| 79 | exit $STATE_UNKNOWN | ||
| 80 | fi | ||
| 81 | if [ "$ts_pct" -ge ${6} ] ; then | ||
| 82 | - echo "${2} : ${5} CRITICAL - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | ||
| 83 | + echo "${2} : ${5} CRITICAL - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;$compwarn%;$compcrit%;0;100" | ||
| 84 | exit $STATE_CRITICAL | ||
| 85 | fi | ||
| 86 | if [ "$ts_pct" -ge ${7} ] ; then | ||
| 87 | - echo "${2} : ${5} WARNING - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | ||
| 88 | + echo "${2} : ${5} WARNING - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;$compwarn%;$compcrit%;0;100" | ||
| 89 | exit $STATE_WARNING | ||
| 90 | fi | ||
| 91 | - echo "${2} : ${5} OK - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | ||
| 92 | + echo "${2} : ${5} OK - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;$compwarn%;$compcrit%;0;100" | ||
| 93 | exit $STATE_OK | ||
| 94 | ;; | ||
| 95 | *) | ||
diff --git a/web/attachments/419186-check_oracle_1.4.15_easylogin.patch b/web/attachments/419186-check_oracle_1.4.15_easylogin.patch new file mode 100644 index 0000000..445161a --- /dev/null +++ b/web/attachments/419186-check_oracle_1.4.15_easylogin.patch | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | --- check_oracle 2010-10-07 17:11:31.000000000 +0200 | ||
| 2 | +++ check_oracle_easylogin 2011-07-22 15:23:13.000000000 +0200 | ||
| 3 | @@ -8,7 +8,7 @@ | ||
| 4 | |||
| 5 | PROGNAME=`basename $0` | ||
| 6 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` | ||
| 7 | -REVISION="1.4.15" | ||
| 8 | +REVISION="1.4.15-easylogin" | ||
| 9 | |||
| 10 | . $PROGPATH/utils.sh | ||
| 11 | |||
| 12 | @@ -54,6 +54,8 @@ | ||
| 13 | echo "--version" | ||
| 14 | echo " Print version and license information" | ||
| 15 | echo "" | ||
| 16 | + echo "If <USER> and <PASS> are left blank, ie. \"\", \`sqlplus -s / as sysdba\` is tried instead." | ||
| 17 | + echo "" | ||
| 18 | echo "If the plugin doesn't work, check that the ORACLE_HOME environment" | ||
| 19 | echo "variable is set, that ORACLE_HOME/bin is in your PATH, and the" | ||
| 20 | echo "tnsnames.ora file is locatable and is properly configured." | ||
| 21 | @@ -192,7 +194,9 @@ | ||
| 22 | echo "UNKNOWN - Warning level is less then Crit" | ||
| 23 | exit $STATE_UNKNOWN | ||
| 24 | fi | ||
| 25 | - result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 26 | + cmdsqlplus="sqlplus -s / as sysdba" | ||
| 27 | + [ "$3" != "" ] && [ "$4" != "" ] && cmdsqlplus="sqlplus -s ${3}/${4}@${2}" | ||
| 28 | + result=`$cmdsqlplus << EOF | ||
| 29 | set pagesize 0 | ||
| 30 | set numf '9999999.99' | ||
| 31 | select (1-(pr.value/(dbg.value+cg.value)))*100 | ||
| 32 | @@ -243,7 +247,9 @@ | ||
| 33 | echo "UNKNOWN - Warning level is more then Crit" | ||
| 34 | exit $STATE_UNKNOWN | ||
| 35 | fi | ||
| 36 | - result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 37 | + cmdsqlplus="sqlplus -s / as sysdba" | ||
| 38 | + [ "$3" != "" ] && [ "$4" != "" ] && cmdsqlplus="sqlplus -s ${3}/${4}@${2}" | ||
| 39 | + result=`$cmdsqlplus << EOF | ||
| 40 | set pagesize 0 | ||
| 41 | set numf '9999999.99' | ||
| 42 | select NVL(b.free,0.0),a.total,100 - trunc(NVL(b.free,0.0)/a.total * 1000) / 10 prc | ||
diff --git a/web/attachments/419187-check_oracle_negativewarncrit.patch b/web/attachments/419187-check_oracle_negativewarncrit.patch new file mode 100644 index 0000000..2319b8b --- /dev/null +++ b/web/attachments/419187-check_oracle_negativewarncrit.patch | |||
| @@ -0,0 +1,201 @@ | |||
| 1 | --- check_oracle 2010-10-07 17:11:31.000000000 +0200 | ||
| 2 | +++ check_oracle_negativewarncrit 2011-07-22 19:28:28.000000000 +0200 | ||
| 3 | @@ -8,10 +8,15 @@ | ||
| 4 | |||
| 5 | PROGNAME=`basename $0` | ||
| 6 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` | ||
| 7 | -REVISION="1.4.15" | ||
| 8 | +REVISION="1.4.15-negativewarncrit" | ||
| 9 | |||
| 10 | . $PROGPATH/utils.sh | ||
| 11 | |||
| 12 | +dflt_cachwarn="85%" | ||
| 13 | +dflt_cachcrit="95%" | ||
| 14 | +dflt_tswarn="85%" | ||
| 15 | +dflt_tscrit="95%" | ||
| 16 | + | ||
| 17 | |||
| 18 | print_usage() { | ||
| 19 | echo "Usage:" | ||
| 20 | @@ -40,11 +45,11 @@ | ||
| 21 | echo "--login SID" | ||
| 22 | echo " Attempt a dummy login and alert if not ORA-01017: invalid username/password" | ||
| 23 | echo "--cache" | ||
| 24 | - echo " Check local database for library and buffer cache hit ratios" | ||
| 25 | + echo " Check local database for library and buffer cache hit ratios (default warn:$dflt_cachwarn,crit:$dflt_cachcrit)" | ||
| 26 | echo " ---> Requires Oracle user/password and SID specified." | ||
| 27 | echo " ---> Requires select on v_$sysstat and v_$librarycache" | ||
| 28 | echo "--tablespace" | ||
| 29 | - echo " Check local database for tablespace capacity in ORACLE_SID" | ||
| 30 | + echo " Check local database for tablespace capacity in ORACLE_SID (default warn:$dflt_tswarn,crit:$dflt_tscrit)" | ||
| 31 | echo " ---> Requires Oracle user/password specified." | ||
| 32 | echo " ---> Requires select on dba_data_files and dba_free_space" | ||
| 33 | echo "--oranames Hostname" | ||
| 34 | @@ -54,6 +59,10 @@ | ||
| 35 | echo "--version" | ||
| 36 | echo " Print version and license information" | ||
| 37 | echo "" | ||
| 38 | + echo " <WARNING>/<CRITICAL> can either be a percentage (ie. '15%') or a size in Mega/Giga/Terabyte (ie. '2G'; dflt: M)" | ||
| 39 | + echo " Prepend the size with minus to be notified for a certain level below the maximum value," | ||
| 40 | + echo " ie. '-2G' to be warned 2G before 'SIZE' (-t) or 'MAXBYTES' (-T) tablespace runs out." | ||
| 41 | + echo "" | ||
| 42 | echo "If the plugin doesn't work, check that the ORACLE_HOME environment" | ||
| 43 | echo "variable is set, that ORACLE_HOME/bin is in your PATH, and the" | ||
| 44 | echo "tnsnames.ora file is locatable and is properly configured." | ||
| 45 | @@ -66,6 +75,54 @@ | ||
| 46 | support | ||
| 47 | } | ||
| 48 | |||
| 49 | + | ||
| 50 | +# convert_warncrit_val( warnlevel/critlevel ): returns in either % or units of M, no matter what input the user provided | ||
| 51 | +ReturnVal= | ||
| 52 | +ReturnUnit= | ||
| 53 | +convert_warncrit_val() { | ||
| 54 | + input=$1; totalsize=$2 | ||
| 55 | + tmp=""; tmpunit="" | ||
| 56 | + [ `expr index "$input" "%"` -gt 1 ] && tmp=`echo "scale=0; ${input%*%} * $totalsize" | bc | sed 's/\.[0-9]*$//g'` && tmpunit="%" | ||
| 57 | + if [ "$tmp" = "" ]; then | ||
| 58 | + [ `expr index "$input" "G"` -gt 1 ] && tmp=$[ ${input%*G}*1000 ] && tmpunit="M" | ||
| 59 | + [ `expr index "$input" "T"` -gt 1 ] && tmp=$[ ${input%*T}*1000*1000 ] && tmpunit="M" | ||
| 60 | + if [ "$tmp" = "" ]; then # default: M | ||
| 61 | + foo=$input | ||
| 62 | + [ `expr index "$input" "M"` -gt 1 ] && foo=$[ ${input%*M} ] && tmpunit="M" | ||
| 63 | + tmp=$foo | ||
| 64 | + fi | ||
| 65 | + fi | ||
| 66 | + | ||
| 67 | + [ $tmp -lt 0 ] && tmp=$[ $totalsize + $tmp ] # ie. -2G | ||
| 68 | + [ $tmp -lt 0 ] && tmp=0 # ie. the result of the line before was below zero => set to zero. | ||
| 69 | + | ||
| 70 | + ReturnVal=$tmp | ||
| 71 | + ReturnUnit=$tmpunit | ||
| 72 | + return | ||
| 73 | +} | ||
| 74 | + | ||
| 75 | + | ||
| 76 | +# do_warncrit_test(warnlevel, critlevel) | ||
| 77 | +do_warncrit_test() { | ||
| 78 | + convert_warncrit_val $1 100; tmpwarn=$ReturnVal # use "100" as "size" for percentile checks, since we don't have that already | ||
| 79 | + convert_warncrit_val $2 100; tmpcrit=$ReturnVal | ||
| 80 | + | ||
| 81 | + if [ $tmpwarn -lt 0 ]; then # ie. -2G | ||
| 82 | + if [ $tmpwarn -gt $tmpcrit ]; then | ||
| 83 | + echo "UNKNOWN - Warning level is less than Crit" | ||
| 84 | + exit $STATE_UNKNOWN | ||
| 85 | + fi | ||
| 86 | + else | ||
| 87 | + if [ $tmpwarn -gt $tmpcrit ]; then | ||
| 88 | + echo "UNKNOWN - Warning level is more than Crit" | ||
| 89 | + exit $STATE_UNKNOWN | ||
| 90 | + fi | ||
| 91 | + fi | ||
| 92 | +} | ||
| 93 | + | ||
| 94 | + | ||
| 95 | + | ||
| 96 | + | ||
| 97 | case "$1" in | ||
| 98 | 1) | ||
| 99 | cmd='--tns' | ||
| 100 | @@ -188,10 +245,14 @@ | ||
| 101 | fi | ||
| 102 | ;; | ||
| 103 | --cache) | ||
| 104 | - if [ ${5} -gt ${6} ] ; then | ||
| 105 | - echo "UNKNOWN - Warning level is less then Crit" | ||
| 106 | - exit $STATE_UNKNOWN | ||
| 107 | + | ||
| 108 | + do_warncrit_test "$6" "$5" | ||
| 109 | + | ||
| 110 | + if [ `expr index "$6" "%"` -lt 1 ]; then | ||
| 111 | + echo "${2} UNKNOWN - cache check can only use % value for warn/crit level." | ||
| 112 | + exit $STATE_UNKNOWN | ||
| 113 | fi | ||
| 114 | + | ||
| 115 | result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 116 | set pagesize 0 | ||
| 117 | set numf '9999999.99' | ||
| 118 | @@ -226,23 +287,32 @@ | ||
| 119 | lib_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` | ||
| 120 | lib_hrx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'` | ||
| 121 | |||
| 122 | - if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then | ||
| 123 | - echo "${2} CRITICAL - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" | ||
| 124 | + # for actually usable warn/crit levels with higher precision number | ||
| 125 | + convert_warncrit_val "$6" 10000; compwarn=$ReturnVal # $ReturnUnit is being used directly, should be of same type. | ||
| 126 | + convert_warncrit_val "$5" 10000; compcrit=$ReturnVal | ||
| 127 | + # just snip of the % of the input to get perfdata | ||
| 128 | + perfwarn=${6%*%} | ||
| 129 | + perfcrit=${5%*%} | ||
| 130 | + | ||
| 131 | + newbufhr=`echo "$buf_hrx * 10000" | bc -l | sed 's/\.[0-9]*$//g'` | ||
| 132 | + newlibhr=`echo "$lib_hrx * 10000" | bc -l | sed 's/\.[0-9]*$//g'` | ||
| 133 | + | ||
| 134 | + if [ $newbufhr -le $compcrit -o $newlibhr -le $compcrit ] ; then | ||
| 135 | + echo "${2} CRITICAL - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0;100 buffer=$buf_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0;100" | ||
| 136 | exit $STATE_CRITICAL | ||
| 137 | fi | ||
| 138 | - if [ $buf_hr -le ${6} -o $lib_hr -le ${6} ] ; then | ||
| 139 | - echo "${2} WARNING - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" | ||
| 140 | + if [ $newbufhr -le $compwarn -o $newlibhr -le $compwarn ] ; then | ||
| 141 | + echo "${2} WARNING - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0;100 buffer=$buf_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0;100" | ||
| 142 | exit $STATE_WARNING | ||
| 143 | fi | ||
| 144 | - echo "${2} OK - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" | ||
| 145 | + echo "${2} OK - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0;100 buffer=$buf_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0;100" | ||
| 146 | |||
| 147 | exit $STATE_OK | ||
| 148 | ;; | ||
| 149 | --tablespace) | ||
| 150 | - if [ ${6} -lt ${7} ] ; then | ||
| 151 | - echo "UNKNOWN - Warning level is more then Crit" | ||
| 152 | - exit $STATE_UNKNOWN | ||
| 153 | - fi | ||
| 154 | + | ||
| 155 | + do_warncrit_test "$7" "$6" | ||
| 156 | + | ||
| 157 | result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 158 | set pagesize 0 | ||
| 159 | set numf '9999999.99' | ||
| 160 | @@ -258,7 +328,7 @@ | ||
| 161 | |||
| 162 | if [ -n "`echo $result | grep ORA-`" ] ; then | ||
| 163 | error=` echo "$result" | grep "ORA-" | head -1` | ||
| 164 | - echo "CRITICAL - $error" | ||
| 165 | + echo "${2} : ${5} CRITICAL - $error" | ||
| 166 | exit $STATE_CRITICAL | ||
| 167 | fi | ||
| 168 | |||
| 169 | @@ -266,19 +336,26 @@ | ||
| 170 | ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}'` | ||
| 171 | ts_pct=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'` | ||
| 172 | ts_pctx=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print $3}'` | ||
| 173 | + | ||
| 174 | + convert_warncrit_val "$7" $ts_total; compwarn=$ReturnVal # $ReturnUnit is either % or M for the perfdata | ||
| 175 | + convert_warncrit_val "$6" $ts_total; compcrit=$ReturnVal | ||
| 176 | + | ||
| 177 | + perfused=$ts_pctx | ||
| 178 | + [ "$ReturnUnit" != "%" ] && perfused=$[ $ts_total - $ts_free ] && ReturnUnit="M" | ||
| 179 | + | ||
| 180 | if [ "$ts_free" -eq 0 -a "$ts_total" -eq 0 -a "$ts_pct" -eq 0 ] ; then | ||
| 181 | - echo "No data returned by Oracle - tablespace $5 not found?" | ||
| 182 | + echo "${2} : ${5} UNKNOWN - No data returned by Oracle - tablespace $5 not found?" | ||
| 183 | exit $STATE_UNKNOWN | ||
| 184 | fi | ||
| 185 | - if [ "$ts_pct" -ge ${6} ] ; then | ||
| 186 | - echo "${2} : ${5} CRITICAL - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | ||
| 187 | + if [ "$ts_pct" -ge "$compcrit" ] ; then | ||
| 188 | + echo "${2} : ${5} CRITICAL - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$perfused$ReturnUnit;$compwarn$ReturnUnit;$compcrit$ReturnUnit;0;100" | ||
| 189 | exit $STATE_CRITICAL | ||
| 190 | fi | ||
| 191 | - if [ "$ts_pct" -ge ${7} ] ; then | ||
| 192 | - echo "${2} : ${5} WARNING - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | ||
| 193 | + if [ "$ts_pct" -ge "$compwarn" ] ; then | ||
| 194 | + echo "${2} : ${5} WARNING - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$perfused$ReturnUnit;$compwarn$ReturnUnit;$compcrit$ReturnUnit;0;100" | ||
| 195 | exit $STATE_WARNING | ||
| 196 | fi | ||
| 197 | - echo "${2} : ${5} OK - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | ||
| 198 | + echo "${2} : ${5} OK - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$perfused$ReturnUnit;$compwarn$ReturnUnit;$compcrit$ReturnUnit;0;100" | ||
| 199 | exit $STATE_OK | ||
| 200 | ;; | ||
| 201 | *) | ||
diff --git a/web/attachments/41928-check_ssh.diff b/web/attachments/41928-check_ssh.diff new file mode 100644 index 0000000..fce5ad2 --- /dev/null +++ b/web/attachments/41928-check_ssh.diff | |||
| @@ -0,0 +1,139 @@ | |||
| 1 | Index: plugins/check_ssh.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ssh.c,v | ||
| 4 | retrieving revision 1.4 | ||
| 5 | diff -u -r1.4 check_ssh.c | ||
| 6 | --- plugins/check_ssh.c 13 Jan 2003 12:15:16 -0000 1.4 | ||
| 7 | +++ plugins/check_ssh.c 9 Feb 2003 19:32:30 -0000 | ||
| 8 | @@ -34,7 +34,6 @@ | ||
| 9 | void print_help (void); | ||
| 10 | void print_usage (void); | ||
| 11 | |||
| 12 | -char *ssh_resolve (char *hostname); | ||
| 13 | int ssh_connect (char *haddr, short hport); | ||
| 14 | |||
| 15 | int | ||
| 16 | @@ -49,7 +48,7 @@ | ||
| 17 | alarm (socket_timeout); | ||
| 18 | |||
| 19 | /* ssh_connect exits if error is found */ | ||
| 20 | - ssh_connect (ssh_resolve (server_name), port); | ||
| 21 | + ssh_connect (server_name, port); | ||
| 22 | |||
| 23 | alarm (0); | ||
| 24 | |||
| 25 | @@ -62,6 +61,7 @@ | ||
| 26 | process_arguments (int argc, char **argv) | ||
| 27 | { | ||
| 28 | int c; | ||
| 29 | + char *tmp = NULL; | ||
| 30 | |||
| 31 | #ifdef HAVE_GETOPT_H | ||
| 32 | int option_index = 0; | ||
| 33 | @@ -109,6 +109,8 @@ | ||
| 34 | socket_timeout = atoi (optarg); | ||
| 35 | break; | ||
| 36 | case 'H': /* host */ | ||
| 37 | + if (is_host (optarg) == FALSE) | ||
| 38 | + usage ("Invalid hostname/address\n"); | ||
| 39 | server_name = optarg; | ||
| 40 | break; | ||
| 41 | case 'p': /* port */ | ||
| 42 | @@ -125,9 +127,12 @@ | ||
| 43 | |||
| 44 | c = optind; | ||
| 45 | if (server_name == NULL && argv[c]) { | ||
| 46 | - server_name = argv[c++]; | ||
| 47 | + if (is_host (argv[c])) { | ||
| 48 | + server_name = argv[c++]; | ||
| 49 | + } | ||
| 50 | } | ||
| 51 | - else if (port == -1 && argv[c]) { | ||
| 52 | + | ||
| 53 | + if (port == -1 && argv[c]) { | ||
| 54 | if (is_intpos (argv[c])) { | ||
| 55 | port = atoi (argv[c++]); | ||
| 56 | } | ||
| 57 | @@ -153,26 +158,6 @@ | ||
| 58 | |||
| 59 | /************************************************************************ | ||
| 60 | * | ||
| 61 | -* Resolve hostname into IP address | ||
| 62 | -* | ||
| 63 | -*-----------------------------------------------------------------------*/ | ||
| 64 | - | ||
| 65 | -char * | ||
| 66 | -ssh_resolve (char *hostname) | ||
| 67 | -{ | ||
| 68 | - struct hostent *host; | ||
| 69 | - | ||
| 70 | - host = gethostbyname (hostname); | ||
| 71 | - if (!host) { | ||
| 72 | - herror (hostname); | ||
| 73 | - exit (STATE_CRITICAL); | ||
| 74 | - } | ||
| 75 | - return (host->h_addr); | ||
| 76 | -} | ||
| 77 | - | ||
| 78 | - | ||
| 79 | -/************************************************************************ | ||
| 80 | -* | ||
| 81 | * Try to connect to SSH server at specified server and port | ||
| 82 | * | ||
| 83 | *-----------------------------------------------------------------------*/ | ||
| 84 | @@ -180,39 +165,24 @@ | ||
| 85 | int | ||
| 86 | ssh_connect (char *haddr, short hport) | ||
| 87 | { | ||
| 88 | - int s; | ||
| 89 | - struct sockaddr_in addr; | ||
| 90 | - int addrlen; | ||
| 91 | - int len; | ||
| 92 | + int sock; | ||
| 93 | + int result; | ||
| 94 | char *output = NULL; | ||
| 95 | char *buffer = NULL; | ||
| 96 | char *ssh_proto = NULL; | ||
| 97 | char *ssh_server = NULL; | ||
| 98 | char revision[20]; | ||
| 99 | |||
| 100 | - sscanf ("$Revision: 1.4 $", "$Revision: %[0123456789.]", revision); | ||
| 101 | + sscanf ("$Revision: 1.4 $", "$Revision: %[0-9.]", revision); | ||
| 102 | |||
| 103 | - addrlen = sizeof (addr); | ||
| 104 | - memset (&addr, 0, addrlen); | ||
| 105 | - addr.sin_port = htons (hport); | ||
| 106 | - addr.sin_family = AF_INET; | ||
| 107 | - bcopy (haddr, (void *) &addr.sin_addr.s_addr, 4); | ||
| 108 | - | ||
| 109 | - s = socket (AF_INET, SOCK_STREAM, 0); | ||
| 110 | - if (!s) { | ||
| 111 | - printf ("socket(): %s for %s:%d\n", strerror (errno), server_name, hport); | ||
| 112 | - exit (STATE_CRITICAL); | ||
| 113 | - } | ||
| 114 | + result = my_tcp_connect (haddr, hport, &sock); | ||
| 115 | |||
| 116 | - if (connect (s, (struct sockaddr *) &addr, addrlen)) { | ||
| 117 | - printf ("connect(): %s for %s:%d\n", strerror (errno), server_name, | ||
| 118 | - hport); | ||
| 119 | - exit (STATE_CRITICAL); | ||
| 120 | - } | ||
| 121 | + if (result != STATE_OK) | ||
| 122 | + return result; | ||
| 123 | |||
| 124 | output = (char *) malloc (BUFF_SZ + 1); | ||
| 125 | memset (output, 0, BUFF_SZ + 1); | ||
| 126 | - recv (s, output, BUFF_SZ, 0); | ||
| 127 | + recv (sock, output, BUFF_SZ, 0); | ||
| 128 | if (strncmp (output, "SSH", 3)) { | ||
| 129 | printf ("Server answer: %s", output); | ||
| 130 | exit (STATE_CRITICAL); | ||
| 131 | @@ -228,7 +198,7 @@ | ||
| 132 | ("SSH ok - %s (protocol %s)\n", | ||
| 133 | ssh_server, ssh_proto); | ||
| 134 | asprintf (&buffer, "SSH-%s-check_ssh_%s\r\n", ssh_proto, revision); | ||
| 135 | - send (s, buffer, strlen (buffer), MSG_DONTWAIT); | ||
| 136 | + send (sock, buffer, strlen (buffer), MSG_DONTWAIT); | ||
| 137 | if (verbose) | ||
| 138 | printf ("%s\n", buffer); | ||
| 139 | exit (STATE_OK); | ||
diff --git a/web/attachments/420073-check_oracle_1.4.15_tsmax_negwarncritlev_easymode_bugfixcache_bugfixperfdatatsmax.patch b/web/attachments/420073-check_oracle_1.4.15_tsmax_negwarncritlev_easymode_bugfixcache_bugfixperfdatatsmax.patch new file mode 100644 index 0000000..c4b1b19 --- /dev/null +++ b/web/attachments/420073-check_oracle_1.4.15_tsmax_negwarncritlev_easymode_bugfixcache_bugfixperfdatatsmax.patch | |||
| @@ -0,0 +1,298 @@ | |||
| 1 | --- check_oracle 2010-10-07 17:11:31.000000000 +0200 | ||
| 2 | +++ co 2011-08-02 18:23:37.000000000 +0200 | ||
| 3 | @@ -8,18 +8,24 @@ | ||
| 4 | |||
| 5 | PROGNAME=`basename $0` | ||
| 6 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` | ||
| 7 | -REVISION="1.4.15" | ||
| 8 | +REVISION="1.4.15-negativewarncrit" | ||
| 9 | |||
| 10 | . $PROGPATH/utils.sh | ||
| 11 | |||
| 12 | +dflt_cachwarn="95%" | ||
| 13 | +dflt_cachcrit="97%" | ||
| 14 | +dflt_tswarn="85%" | ||
| 15 | +dflt_tscrit="95%" | ||
| 16 | +dflt_tsname="SYSTEM" | ||
| 17 | + | ||
| 18 | |||
| 19 | print_usage() { | ||
| 20 | echo "Usage:" | ||
| 21 | echo " $PROGNAME --tns <Oracle Sid or Hostname/IP address>" | ||
| 22 | echo " $PROGNAME --db <ORACLE_SID>" | ||
| 23 | echo " $PROGNAME --login <ORACLE_SID>" | ||
| 24 | - echo " $PROGNAME --cache <ORACLE_SID> <USER> <PASS> <CRITICAL> <WARNING>" | ||
| 25 | - echo " $PROGNAME --tablespace <ORACLE_SID> <USER> <PASS> <TABLESPACE> <CRITICAL> <WARNING>" | ||
| 26 | + echo " $PROGNAME --cache <ORACLE_SID> [USER] [PASS] [CRITICAL] [WARNING]" | ||
| 27 | + echo " $PROGNAME --tablespace <ORACLE_SID> [USER] [PASS] [TABLESPACE] [CRITICAL] [WARNING] [maxbytes]" | ||
| 28 | echo " $PROGNAME --oranames <Hostname>" | ||
| 29 | echo " $PROGNAME --help" | ||
| 30 | echo " $PROGNAME --version" | ||
| 31 | @@ -40,11 +46,11 @@ | ||
| 32 | echo "--login SID" | ||
| 33 | echo " Attempt a dummy login and alert if not ORA-01017: invalid username/password" | ||
| 34 | echo "--cache" | ||
| 35 | - echo " Check local database for library and buffer cache hit ratios" | ||
| 36 | + echo " Check local database for library and buffer cache hit ratios (default warn:$dflt_cachwarn,crit:$dflt_cachcrit)" | ||
| 37 | echo " ---> Requires Oracle user/password and SID specified." | ||
| 38 | - echo " ---> Requires select on v_$sysstat and v_$librarycache" | ||
| 39 | + echo " ---> Requires select on v_\$sysstat and v_\$librarycache" | ||
| 40 | echo "--tablespace" | ||
| 41 | - echo " Check local database for tablespace capacity in ORACLE_SID" | ||
| 42 | + echo " Check local database for tablespace capacity in ORACLE_SID (default warn:$dflt_tswarn,crit:$dflt_tscrit,ts:$dflt_tsname)" | ||
| 43 | echo " ---> Requires Oracle user/password specified." | ||
| 44 | echo " ---> Requires select on dba_data_files and dba_free_space" | ||
| 45 | echo "--oranames Hostname" | ||
| 46 | @@ -54,6 +60,12 @@ | ||
| 47 | echo "--version" | ||
| 48 | echo " Print version and license information" | ||
| 49 | echo "" | ||
| 50 | + echo " <WARNING>/<CRITICAL> can either be a percentage (ie. '15%') or a size in Mega/Giga/Terabyte (ie. '2G'; dflt: M)" | ||
| 51 | + echo " Prepend the size with minus to be notified for a certain level below the maximum value," | ||
| 52 | + echo " ie. '-2G' to be warned 2G before 'SIZE' (-t) or 'MAXBYTES' (-T) tablespace runs out." | ||
| 53 | + echo "" | ||
| 54 | + echo "If <USER> and <PASS> are left blank, ie. \"\", \`sqlplus -s / as sysdba\` is tried instead." | ||
| 55 | + echo "" | ||
| 56 | echo "If the plugin doesn't work, check that the ORACLE_HOME environment" | ||
| 57 | echo "variable is set, that ORACLE_HOME/bin is in your PATH, and the" | ||
| 58 | echo "tnsnames.ora file is locatable and is properly configured." | ||
| 59 | @@ -66,6 +78,54 @@ | ||
| 60 | support | ||
| 61 | } | ||
| 62 | |||
| 63 | + | ||
| 64 | +# convert_warncrit_val( warnlevel/critlevel ): returns in either % or units of M, no matter what input the user provided | ||
| 65 | +ReturnVal= | ||
| 66 | +ReturnUnit= | ||
| 67 | +convert_warncrit_val() { | ||
| 68 | + input=$1; totalsize=$2 | ||
| 69 | + tmp=0; tmpunit="" | ||
| 70 | + [ `expr index "$input" "%"` -gt 1 ] && tmp=`echo "scale=0; ${input%*%} * $totalsize" | bc | sed 's/\.[0-9]*$//g'` && tmpunit="%" | ||
| 71 | + if [ "$tmp" = "0" ]; then | ||
| 72 | + [ `expr index "$input" "G"` -gt 1 ] && tmp=$[ ${input%*G}*1000 ] && tmpunit="M" | ||
| 73 | + [ `expr index "$input" "T"` -gt 1 ] && tmp=$[ ${input%*T}*1000*1000 ] && tmpunit="M" | ||
| 74 | + if [ "$tmp" = "0" ]; then # default: M | ||
| 75 | + foo=$input | ||
| 76 | + [ `expr index "$input" "M"` -gt 1 ] && foo=$[ ${input%*M} ] && tmpunit="M" | ||
| 77 | + tmp=$foo | ||
| 78 | + fi | ||
| 79 | + fi | ||
| 80 | + | ||
| 81 | + [ $tmp -lt 0 ] && tmp=$[ $totalsize + $tmp ] # ie. -2G | ||
| 82 | + [ $tmp -lt 0 ] && tmp=0 # ie. the result of the line before was below zero => set to zero. | ||
| 83 | + | ||
| 84 | + ReturnVal=$tmp | ||
| 85 | + ReturnUnit=$tmpunit | ||
| 86 | + return | ||
| 87 | +} | ||
| 88 | + | ||
| 89 | + | ||
| 90 | +# do_warncrit_test(warnlevel, critlevel) | ||
| 91 | +do_warncrit_test() { | ||
| 92 | + convert_warncrit_val $1 100; tmpwarn=$ReturnVal # use "100" as "size" for percentile checks, since we don't have that already | ||
| 93 | + convert_warncrit_val $2 100; tmpcrit=$ReturnVal | ||
| 94 | + | ||
| 95 | + if [ $tmpwarn -lt 0 ]; then # ie. -2G | ||
| 96 | + if [ $tmpwarn -gt $tmpcrit ]; then | ||
| 97 | + echo "UNKNOWN - Warning level is less than Crit" | ||
| 98 | + exit $STATE_UNKNOWN | ||
| 99 | + fi | ||
| 100 | + else | ||
| 101 | + if [ $tmpwarn -gt $tmpcrit ]; then | ||
| 102 | + echo "UNKNOWN - Warning level is more than Crit" | ||
| 103 | + exit $STATE_UNKNOWN | ||
| 104 | + fi | ||
| 105 | + fi | ||
| 106 | +} | ||
| 107 | + | ||
| 108 | + | ||
| 109 | + | ||
| 110 | + | ||
| 111 | case "$1" in | ||
| 112 | 1) | ||
| 113 | cmd='--tns' | ||
| 114 | @@ -171,8 +231,13 @@ | ||
| 115 | #exit $STATE_OK | ||
| 116 | #fi | ||
| 117 | else | ||
| 118 | - echo "${2} Database is DOWN" | ||
| 119 | - exit $STATE_CRITICAL | ||
| 120 | + if [ "${2}" != "" ]; then | ||
| 121 | + echo "${2} - Database is DOWN (or doesn't exist)" | ||
| 122 | + exit $STATE_CRITICAL | ||
| 123 | + else | ||
| 124 | + echo "UNKNOWN - Please supply a database name" | ||
| 125 | + exit $STATE_UNKNOWN | ||
| 126 | + fi | ||
| 127 | fi | ||
| 128 | ;; | ||
| 129 | --login) | ||
| 130 | @@ -188,11 +253,24 @@ | ||
| 131 | fi | ||
| 132 | ;; | ||
| 133 | --cache) | ||
| 134 | - if [ ${5} -gt ${6} ] ; then | ||
| 135 | - echo "UNKNOWN - Warning level is less then Crit" | ||
| 136 | - exit $STATE_UNKNOWN | ||
| 137 | + | ||
| 138 | + [ "$#" -lt 2 ] && print_usage && exit # use empty user/pass for default connection / as sysdba, use empty warncrit for dflt-warncrit | ||
| 139 | + | ||
| 140 | + realwarn=$dflt_cachwarn | ||
| 141 | + realcrit=$dflt_cachcrit | ||
| 142 | + [ "$6" != "" ] && realwarn=$6 | ||
| 143 | + [ "$5" != "" ] && realcrit=$5 | ||
| 144 | + | ||
| 145 | + do_warncrit_test "$realwarn" "$realcrit" | ||
| 146 | + | ||
| 147 | + if [ `expr index "$realwarn" "%"` -lt 1 ]; then | ||
| 148 | + echo "${2} UNKNOWN - cache check can only use % value for warn/crit level." | ||
| 149 | + exit $STATE_UNKNOWN | ||
| 150 | fi | ||
| 151 | - result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 152 | + | ||
| 153 | + cmdsqlplus="sqlplus -s / as sysdba" | ||
| 154 | + [ "$3" != "" ] && [ "$4" != "" ] && cmdsqlplus="sqlplus -s ${3}/${4}@${2}" | ||
| 155 | + result=`$cmdsqlplus << EOF | ||
| 156 | set pagesize 0 | ||
| 157 | set numf '9999999.99' | ||
| 158 | select (1-(pr.value/(dbg.value+cg.value)))*100 | ||
| 159 | @@ -210,7 +288,7 @@ | ||
| 160 | |||
| 161 | buf_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` | ||
| 162 | buf_hrx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'` | ||
| 163 | - result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 164 | + result=`$cmdsqlplus << EOF | ||
| 165 | set pagesize 0 | ||
| 166 | set numf '9999999.99' | ||
| 167 | select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 | ||
| 168 | @@ -226,59 +304,105 @@ | ||
| 169 | lib_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` | ||
| 170 | lib_hrx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'` | ||
| 171 | |||
| 172 | - if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then | ||
| 173 | - echo "${2} CRITICAL - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" | ||
| 174 | + # for actually usable warn/crit levels with higher precision number | ||
| 175 | + convert_warncrit_val "$realwarn" 10000; compwarn=$ReturnVal # $ReturnUnit is being used directly, should be of same type. | ||
| 176 | + convert_warncrit_val "$realcrit" 10000; compcrit=$ReturnVal | ||
| 177 | + # just snip of the % of the input to get perfdata | ||
| 178 | + perfwarn=${realwarn%*%} | ||
| 179 | + perfcrit=${realcrit%*%} | ||
| 180 | + | ||
| 181 | + newbufhr=`echo "$buf_hrx * 10000" | bc -l | sed 's/\.[0-9]*$//g'` | ||
| 182 | + newlibhr=`echo "$lib_hrx * 10000" | bc -l | sed 's/\.[0-9]*$//g'` | ||
| 183 | + | ||
| 184 | + if [ $newbufhr -le $compcrit -o $newlibhr -le $compcrit ] ; then | ||
| 185 | + echo "${2} CRITICAL - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0; buffer=$buf_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0;" | ||
| 186 | exit $STATE_CRITICAL | ||
| 187 | fi | ||
| 188 | - if [ $buf_hr -le ${6} -o $lib_hr -le ${6} ] ; then | ||
| 189 | - echo "${2} WARNING - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" | ||
| 190 | + if [ $newbufhr -le $compwarn -o $newlibhr -le $compwarn ] ; then | ||
| 191 | + echo "${2} WARNING - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0; buffer=$buf_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0;" | ||
| 192 | exit $STATE_WARNING | ||
| 193 | fi | ||
| 194 | - echo "${2} OK - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" | ||
| 195 | + echo "${2} OK - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0; buffer=$buf_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0;" | ||
| 196 | |||
| 197 | exit $STATE_OK | ||
| 198 | ;; | ||
| 199 | --tablespace) | ||
| 200 | - if [ ${6} -lt ${7} ] ; then | ||
| 201 | - echo "UNKNOWN - Warning level is more then Crit" | ||
| 202 | - exit $STATE_UNKNOWN | ||
| 203 | - fi | ||
| 204 | - result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 205 | + | ||
| 206 | + [ "$#" -lt 2 ] && print_usage && exit # use empty user/pass for default connection / as sysdba, use empty warncrit for dflt-warncrit... | ||
| 207 | + | ||
| 208 | + tsname="$dflt_tsname" | ||
| 209 | + [ -n "$5" ] && tsname="$5" | ||
| 210 | + | ||
| 211 | + realwarn="$dflt_tswarn" | ||
| 212 | + realcrit="$dflt_tscrit" | ||
| 213 | + [ "$7" != "" ] && realwarn="$7" | ||
| 214 | + [ "$6" != "" ] && realcrit="$6" | ||
| 215 | + do_warncrit_test "$realwarn" "$realcrit" | ||
| 216 | + | ||
| 217 | + cmdsqlplus="sqlplus -s / as sysdba" | ||
| 218 | + [ "$3" != "" ] && [ "$4" != "" ] && cmdsqlplus="sqlplus -s ${3}/${4}@${2}" | ||
| 219 | + result=`$cmdsqlplus << EOF | ||
| 220 | set pagesize 0 | ||
| 221 | set numf '9999999.99' | ||
| 222 | -select NVL(b.free,0.0),a.total,100 - trunc(NVL(b.free,0.0)/a.total * 1000) / 10 prc | ||
| 223 | +select ROUND(a.maxi,0) MAXI, ROUND(a.total,0) ALLOCATED, ROUND(a.total-b.free,0) USED, ROUND(b.free,0) FREE, ROUND(a.maxi-a.total+b.free,0) FREEMAXI | ||
| 224 | from ( | ||
| 225 | -select tablespace_name,sum(bytes)/1024/1024 total | ||
| 226 | +select tablespace_name,sum(NVL(bytes,0))/1024/1024 total,sum(NVL(maxbytes,0))/1024/1024 maxi | ||
| 227 | from dba_data_files group by tablespace_name) A | ||
| 228 | LEFT OUTER JOIN | ||
| 229 | -( select tablespace_name,sum(bytes)/1024/1024 free | ||
| 230 | +( select tablespace_name,sum(NVL(bytes,0))/1024/1024 free | ||
| 231 | from dba_free_space group by tablespace_name) B | ||
| 232 | -ON a.tablespace_name=b.tablespace_name WHERE a.tablespace_name='${5}'; | ||
| 233 | +ON a.tablespace_name=b.tablespace_name WHERE a.tablespace_name='${tsname}'; | ||
| 234 | EOF` | ||
| 235 | |||
| 236 | if [ -n "`echo $result | grep ORA-`" ] ; then | ||
| 237 | error=` echo "$result" | grep "ORA-" | head -1` | ||
| 238 | - echo "CRITICAL - $error" | ||
| 239 | + echo "${2} : ${tsname} CRITICAL - $error" | ||
| 240 | exit $STATE_CRITICAL | ||
| 241 | fi | ||
| 242 | |||
| 243 | - ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}'` | ||
| 244 | - ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}'` | ||
| 245 | - ts_pct=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'` | ||
| 246 | - ts_pctx=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print $3}'` | ||
| 247 | + ts_total= | ||
| 248 | + ts_used= | ||
| 249 | + ts_free= | ||
| 250 | + if [ "${8}" = "max" ]; then | ||
| 251 | + ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}'` | ||
| 252 | + ts_used=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'` | ||
| 253 | + ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($5)}'` | ||
| 254 | + else | ||
| 255 | + ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}'` | ||
| 256 | + ts_used=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'` | ||
| 257 | + ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($4)}'` | ||
| 258 | + fi | ||
| 259 | + | ||
| 260 | + if [ "$ts_total" = "" ]; then | ||
| 261 | + echo "${2} : ${tsname} UNKNOWN - no data was returned" | ||
| 262 | + exit $STATE_UNKNOWN | ||
| 263 | + fi | ||
| 264 | + | ||
| 265 | + ts_pctx=`echo "scale=2; $ts_used/$ts_total * 100" | bc -l` | ||
| 266 | + ts_pct=`echo "scale=0; $ts_used/$ts_total * 100" | bc -l` | ||
| 267 | + | ||
| 268 | + # if percentage supplied, use percentage in perfdata | ||
| 269 | + [ `expr index "%" "$realwarn"` -gt 0 ] && ts_total=1 | ||
| 270 | + | ||
| 271 | + convert_warncrit_val "$realwarn" $ts_total; compwarn=$ReturnVal # $ReturnUnit is either % or M for the perfdata | ||
| 272 | + convert_warncrit_val "$realcrit" $ts_total; compcrit=$ReturnVal | ||
| 273 | + | ||
| 274 | + perfused=$ts_pctx | ||
| 275 | + [ "$ReturnUnit" != "%" ] && perfused=$[ $ts_total - $ts_free ] && ReturnUnit="M" | ||
| 276 | + | ||
| 277 | if [ "$ts_free" -eq 0 -a "$ts_total" -eq 0 -a "$ts_pct" -eq 0 ] ; then | ||
| 278 | - echo "No data returned by Oracle - tablespace $5 not found?" | ||
| 279 | + echo "${2} : ${tsname} UNKNOWN - No data returned by Oracle - tablespace ${tsname} not found?" | ||
| 280 | exit $STATE_UNKNOWN | ||
| 281 | fi | ||
| 282 | - if [ "$ts_pct" -ge ${6} ] ; then | ||
| 283 | - echo "${2} : ${5} CRITICAL - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | ||
| 284 | + if [ "$ts_pct" -ge "$compcrit" ] ; then | ||
| 285 | + echo "${2} : ${tsname} CRITICAL - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${tsname}=$perfused$ReturnUnit;$compwarn$ReturnUnit;$compcrit$ReturnUnit;0;" | ||
| 286 | exit $STATE_CRITICAL | ||
| 287 | fi | ||
| 288 | - if [ "$ts_pct" -ge ${7} ] ; then | ||
| 289 | - echo "${2} : ${5} WARNING - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | ||
| 290 | + if [ "$ts_pct" -ge "$compwarn" ] ; then | ||
| 291 | + echo "${2} : ${tsname} WARNING - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${tsname}=$perfused$ReturnUnit;$compwarn$ReturnUnit;$compcrit$ReturnUnit;0;" | ||
| 292 | exit $STATE_WARNING | ||
| 293 | fi | ||
| 294 | - echo "${2} : ${5} OK - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | ||
| 295 | + echo "${2} : ${tsname} OK - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${tsname}=$perfused$ReturnUnit;$compwarn$ReturnUnit;$compcrit$ReturnUnit;0;" | ||
| 296 | exit $STATE_OK | ||
| 297 | ;; | ||
| 298 | *) | ||
diff --git a/web/attachments/420074-check_oracle_1.4.15_tsmax_negwarncritlev_easymode_bugfixcache_bugfixperfdatatsmax.patch b/web/attachments/420074-check_oracle_1.4.15_tsmax_negwarncritlev_easymode_bugfixcache_bugfixperfdatatsmax.patch new file mode 100644 index 0000000..c4b1b19 --- /dev/null +++ b/web/attachments/420074-check_oracle_1.4.15_tsmax_negwarncritlev_easymode_bugfixcache_bugfixperfdatatsmax.patch | |||
| @@ -0,0 +1,298 @@ | |||
| 1 | --- check_oracle 2010-10-07 17:11:31.000000000 +0200 | ||
| 2 | +++ co 2011-08-02 18:23:37.000000000 +0200 | ||
| 3 | @@ -8,18 +8,24 @@ | ||
| 4 | |||
| 5 | PROGNAME=`basename $0` | ||
| 6 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` | ||
| 7 | -REVISION="1.4.15" | ||
| 8 | +REVISION="1.4.15-negativewarncrit" | ||
| 9 | |||
| 10 | . $PROGPATH/utils.sh | ||
| 11 | |||
| 12 | +dflt_cachwarn="95%" | ||
| 13 | +dflt_cachcrit="97%" | ||
| 14 | +dflt_tswarn="85%" | ||
| 15 | +dflt_tscrit="95%" | ||
| 16 | +dflt_tsname="SYSTEM" | ||
| 17 | + | ||
| 18 | |||
| 19 | print_usage() { | ||
| 20 | echo "Usage:" | ||
| 21 | echo " $PROGNAME --tns <Oracle Sid or Hostname/IP address>" | ||
| 22 | echo " $PROGNAME --db <ORACLE_SID>" | ||
| 23 | echo " $PROGNAME --login <ORACLE_SID>" | ||
| 24 | - echo " $PROGNAME --cache <ORACLE_SID> <USER> <PASS> <CRITICAL> <WARNING>" | ||
| 25 | - echo " $PROGNAME --tablespace <ORACLE_SID> <USER> <PASS> <TABLESPACE> <CRITICAL> <WARNING>" | ||
| 26 | + echo " $PROGNAME --cache <ORACLE_SID> [USER] [PASS] [CRITICAL] [WARNING]" | ||
| 27 | + echo " $PROGNAME --tablespace <ORACLE_SID> [USER] [PASS] [TABLESPACE] [CRITICAL] [WARNING] [maxbytes]" | ||
| 28 | echo " $PROGNAME --oranames <Hostname>" | ||
| 29 | echo " $PROGNAME --help" | ||
| 30 | echo " $PROGNAME --version" | ||
| 31 | @@ -40,11 +46,11 @@ | ||
| 32 | echo "--login SID" | ||
| 33 | echo " Attempt a dummy login and alert if not ORA-01017: invalid username/password" | ||
| 34 | echo "--cache" | ||
| 35 | - echo " Check local database for library and buffer cache hit ratios" | ||
| 36 | + echo " Check local database for library and buffer cache hit ratios (default warn:$dflt_cachwarn,crit:$dflt_cachcrit)" | ||
| 37 | echo " ---> Requires Oracle user/password and SID specified." | ||
| 38 | - echo " ---> Requires select on v_$sysstat and v_$librarycache" | ||
| 39 | + echo " ---> Requires select on v_\$sysstat and v_\$librarycache" | ||
| 40 | echo "--tablespace" | ||
| 41 | - echo " Check local database for tablespace capacity in ORACLE_SID" | ||
| 42 | + echo " Check local database for tablespace capacity in ORACLE_SID (default warn:$dflt_tswarn,crit:$dflt_tscrit,ts:$dflt_tsname)" | ||
| 43 | echo " ---> Requires Oracle user/password specified." | ||
| 44 | echo " ---> Requires select on dba_data_files and dba_free_space" | ||
| 45 | echo "--oranames Hostname" | ||
| 46 | @@ -54,6 +60,12 @@ | ||
| 47 | echo "--version" | ||
| 48 | echo " Print version and license information" | ||
| 49 | echo "" | ||
| 50 | + echo " <WARNING>/<CRITICAL> can either be a percentage (ie. '15%') or a size in Mega/Giga/Terabyte (ie. '2G'; dflt: M)" | ||
| 51 | + echo " Prepend the size with minus to be notified for a certain level below the maximum value," | ||
| 52 | + echo " ie. '-2G' to be warned 2G before 'SIZE' (-t) or 'MAXBYTES' (-T) tablespace runs out." | ||
| 53 | + echo "" | ||
| 54 | + echo "If <USER> and <PASS> are left blank, ie. \"\", \`sqlplus -s / as sysdba\` is tried instead." | ||
| 55 | + echo "" | ||
| 56 | echo "If the plugin doesn't work, check that the ORACLE_HOME environment" | ||
| 57 | echo "variable is set, that ORACLE_HOME/bin is in your PATH, and the" | ||
| 58 | echo "tnsnames.ora file is locatable and is properly configured." | ||
| 59 | @@ -66,6 +78,54 @@ | ||
| 60 | support | ||
| 61 | } | ||
| 62 | |||
| 63 | + | ||
| 64 | +# convert_warncrit_val( warnlevel/critlevel ): returns in either % or units of M, no matter what input the user provided | ||
| 65 | +ReturnVal= | ||
| 66 | +ReturnUnit= | ||
| 67 | +convert_warncrit_val() { | ||
| 68 | + input=$1; totalsize=$2 | ||
| 69 | + tmp=0; tmpunit="" | ||
| 70 | + [ `expr index "$input" "%"` -gt 1 ] && tmp=`echo "scale=0; ${input%*%} * $totalsize" | bc | sed 's/\.[0-9]*$//g'` && tmpunit="%" | ||
| 71 | + if [ "$tmp" = "0" ]; then | ||
| 72 | + [ `expr index "$input" "G"` -gt 1 ] && tmp=$[ ${input%*G}*1000 ] && tmpunit="M" | ||
| 73 | + [ `expr index "$input" "T"` -gt 1 ] && tmp=$[ ${input%*T}*1000*1000 ] && tmpunit="M" | ||
| 74 | + if [ "$tmp" = "0" ]; then # default: M | ||
| 75 | + foo=$input | ||
| 76 | + [ `expr index "$input" "M"` -gt 1 ] && foo=$[ ${input%*M} ] && tmpunit="M" | ||
| 77 | + tmp=$foo | ||
| 78 | + fi | ||
| 79 | + fi | ||
| 80 | + | ||
| 81 | + [ $tmp -lt 0 ] && tmp=$[ $totalsize + $tmp ] # ie. -2G | ||
| 82 | + [ $tmp -lt 0 ] && tmp=0 # ie. the result of the line before was below zero => set to zero. | ||
| 83 | + | ||
| 84 | + ReturnVal=$tmp | ||
| 85 | + ReturnUnit=$tmpunit | ||
| 86 | + return | ||
| 87 | +} | ||
| 88 | + | ||
| 89 | + | ||
| 90 | +# do_warncrit_test(warnlevel, critlevel) | ||
| 91 | +do_warncrit_test() { | ||
| 92 | + convert_warncrit_val $1 100; tmpwarn=$ReturnVal # use "100" as "size" for percentile checks, since we don't have that already | ||
| 93 | + convert_warncrit_val $2 100; tmpcrit=$ReturnVal | ||
| 94 | + | ||
| 95 | + if [ $tmpwarn -lt 0 ]; then # ie. -2G | ||
| 96 | + if [ $tmpwarn -gt $tmpcrit ]; then | ||
| 97 | + echo "UNKNOWN - Warning level is less than Crit" | ||
| 98 | + exit $STATE_UNKNOWN | ||
| 99 | + fi | ||
| 100 | + else | ||
| 101 | + if [ $tmpwarn -gt $tmpcrit ]; then | ||
| 102 | + echo "UNKNOWN - Warning level is more than Crit" | ||
| 103 | + exit $STATE_UNKNOWN | ||
| 104 | + fi | ||
| 105 | + fi | ||
| 106 | +} | ||
| 107 | + | ||
| 108 | + | ||
| 109 | + | ||
| 110 | + | ||
| 111 | case "$1" in | ||
| 112 | 1) | ||
| 113 | cmd='--tns' | ||
| 114 | @@ -171,8 +231,13 @@ | ||
| 115 | #exit $STATE_OK | ||
| 116 | #fi | ||
| 117 | else | ||
| 118 | - echo "${2} Database is DOWN" | ||
| 119 | - exit $STATE_CRITICAL | ||
| 120 | + if [ "${2}" != "" ]; then | ||
| 121 | + echo "${2} - Database is DOWN (or doesn't exist)" | ||
| 122 | + exit $STATE_CRITICAL | ||
| 123 | + else | ||
| 124 | + echo "UNKNOWN - Please supply a database name" | ||
| 125 | + exit $STATE_UNKNOWN | ||
| 126 | + fi | ||
| 127 | fi | ||
| 128 | ;; | ||
| 129 | --login) | ||
| 130 | @@ -188,11 +253,24 @@ | ||
| 131 | fi | ||
| 132 | ;; | ||
| 133 | --cache) | ||
| 134 | - if [ ${5} -gt ${6} ] ; then | ||
| 135 | - echo "UNKNOWN - Warning level is less then Crit" | ||
| 136 | - exit $STATE_UNKNOWN | ||
| 137 | + | ||
| 138 | + [ "$#" -lt 2 ] && print_usage && exit # use empty user/pass for default connection / as sysdba, use empty warncrit for dflt-warncrit | ||
| 139 | + | ||
| 140 | + realwarn=$dflt_cachwarn | ||
| 141 | + realcrit=$dflt_cachcrit | ||
| 142 | + [ "$6" != "" ] && realwarn=$6 | ||
| 143 | + [ "$5" != "" ] && realcrit=$5 | ||
| 144 | + | ||
| 145 | + do_warncrit_test "$realwarn" "$realcrit" | ||
| 146 | + | ||
| 147 | + if [ `expr index "$realwarn" "%"` -lt 1 ]; then | ||
| 148 | + echo "${2} UNKNOWN - cache check can only use % value for warn/crit level." | ||
| 149 | + exit $STATE_UNKNOWN | ||
| 150 | fi | ||
| 151 | - result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 152 | + | ||
| 153 | + cmdsqlplus="sqlplus -s / as sysdba" | ||
| 154 | + [ "$3" != "" ] && [ "$4" != "" ] && cmdsqlplus="sqlplus -s ${3}/${4}@${2}" | ||
| 155 | + result=`$cmdsqlplus << EOF | ||
| 156 | set pagesize 0 | ||
| 157 | set numf '9999999.99' | ||
| 158 | select (1-(pr.value/(dbg.value+cg.value)))*100 | ||
| 159 | @@ -210,7 +288,7 @@ | ||
| 160 | |||
| 161 | buf_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` | ||
| 162 | buf_hrx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'` | ||
| 163 | - result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 164 | + result=`$cmdsqlplus << EOF | ||
| 165 | set pagesize 0 | ||
| 166 | set numf '9999999.99' | ||
| 167 | select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 | ||
| 168 | @@ -226,59 +304,105 @@ | ||
| 169 | lib_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` | ||
| 170 | lib_hrx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'` | ||
| 171 | |||
| 172 | - if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then | ||
| 173 | - echo "${2} CRITICAL - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" | ||
| 174 | + # for actually usable warn/crit levels with higher precision number | ||
| 175 | + convert_warncrit_val "$realwarn" 10000; compwarn=$ReturnVal # $ReturnUnit is being used directly, should be of same type. | ||
| 176 | + convert_warncrit_val "$realcrit" 10000; compcrit=$ReturnVal | ||
| 177 | + # just snip of the % of the input to get perfdata | ||
| 178 | + perfwarn=${realwarn%*%} | ||
| 179 | + perfcrit=${realcrit%*%} | ||
| 180 | + | ||
| 181 | + newbufhr=`echo "$buf_hrx * 10000" | bc -l | sed 's/\.[0-9]*$//g'` | ||
| 182 | + newlibhr=`echo "$lib_hrx * 10000" | bc -l | sed 's/\.[0-9]*$//g'` | ||
| 183 | + | ||
| 184 | + if [ $newbufhr -le $compcrit -o $newlibhr -le $compcrit ] ; then | ||
| 185 | + echo "${2} CRITICAL - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0; buffer=$buf_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0;" | ||
| 186 | exit $STATE_CRITICAL | ||
| 187 | fi | ||
| 188 | - if [ $buf_hr -le ${6} -o $lib_hr -le ${6} ] ; then | ||
| 189 | - echo "${2} WARNING - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" | ||
| 190 | + if [ $newbufhr -le $compwarn -o $newlibhr -le $compwarn ] ; then | ||
| 191 | + echo "${2} WARNING - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0; buffer=$buf_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0;" | ||
| 192 | exit $STATE_WARNING | ||
| 193 | fi | ||
| 194 | - echo "${2} OK - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" | ||
| 195 | + echo "${2} OK - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0; buffer=$buf_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0;" | ||
| 196 | |||
| 197 | exit $STATE_OK | ||
| 198 | ;; | ||
| 199 | --tablespace) | ||
| 200 | - if [ ${6} -lt ${7} ] ; then | ||
| 201 | - echo "UNKNOWN - Warning level is more then Crit" | ||
| 202 | - exit $STATE_UNKNOWN | ||
| 203 | - fi | ||
| 204 | - result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 205 | + | ||
| 206 | + [ "$#" -lt 2 ] && print_usage && exit # use empty user/pass for default connection / as sysdba, use empty warncrit for dflt-warncrit... | ||
| 207 | + | ||
| 208 | + tsname="$dflt_tsname" | ||
| 209 | + [ -n "$5" ] && tsname="$5" | ||
| 210 | + | ||
| 211 | + realwarn="$dflt_tswarn" | ||
| 212 | + realcrit="$dflt_tscrit" | ||
| 213 | + [ "$7" != "" ] && realwarn="$7" | ||
| 214 | + [ "$6" != "" ] && realcrit="$6" | ||
| 215 | + do_warncrit_test "$realwarn" "$realcrit" | ||
| 216 | + | ||
| 217 | + cmdsqlplus="sqlplus -s / as sysdba" | ||
| 218 | + [ "$3" != "" ] && [ "$4" != "" ] && cmdsqlplus="sqlplus -s ${3}/${4}@${2}" | ||
| 219 | + result=`$cmdsqlplus << EOF | ||
| 220 | set pagesize 0 | ||
| 221 | set numf '9999999.99' | ||
| 222 | -select NVL(b.free,0.0),a.total,100 - trunc(NVL(b.free,0.0)/a.total * 1000) / 10 prc | ||
| 223 | +select ROUND(a.maxi,0) MAXI, ROUND(a.total,0) ALLOCATED, ROUND(a.total-b.free,0) USED, ROUND(b.free,0) FREE, ROUND(a.maxi-a.total+b.free,0) FREEMAXI | ||
| 224 | from ( | ||
| 225 | -select tablespace_name,sum(bytes)/1024/1024 total | ||
| 226 | +select tablespace_name,sum(NVL(bytes,0))/1024/1024 total,sum(NVL(maxbytes,0))/1024/1024 maxi | ||
| 227 | from dba_data_files group by tablespace_name) A | ||
| 228 | LEFT OUTER JOIN | ||
| 229 | -( select tablespace_name,sum(bytes)/1024/1024 free | ||
| 230 | +( select tablespace_name,sum(NVL(bytes,0))/1024/1024 free | ||
| 231 | from dba_free_space group by tablespace_name) B | ||
| 232 | -ON a.tablespace_name=b.tablespace_name WHERE a.tablespace_name='${5}'; | ||
| 233 | +ON a.tablespace_name=b.tablespace_name WHERE a.tablespace_name='${tsname}'; | ||
| 234 | EOF` | ||
| 235 | |||
| 236 | if [ -n "`echo $result | grep ORA-`" ] ; then | ||
| 237 | error=` echo "$result" | grep "ORA-" | head -1` | ||
| 238 | - echo "CRITICAL - $error" | ||
| 239 | + echo "${2} : ${tsname} CRITICAL - $error" | ||
| 240 | exit $STATE_CRITICAL | ||
| 241 | fi | ||
| 242 | |||
| 243 | - ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}'` | ||
| 244 | - ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}'` | ||
| 245 | - ts_pct=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'` | ||
| 246 | - ts_pctx=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print $3}'` | ||
| 247 | + ts_total= | ||
| 248 | + ts_used= | ||
| 249 | + ts_free= | ||
| 250 | + if [ "${8}" = "max" ]; then | ||
| 251 | + ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}'` | ||
| 252 | + ts_used=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'` | ||
| 253 | + ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($5)}'` | ||
| 254 | + else | ||
| 255 | + ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}'` | ||
| 256 | + ts_used=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'` | ||
| 257 | + ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($4)}'` | ||
| 258 | + fi | ||
| 259 | + | ||
| 260 | + if [ "$ts_total" = "" ]; then | ||
| 261 | + echo "${2} : ${tsname} UNKNOWN - no data was returned" | ||
| 262 | + exit $STATE_UNKNOWN | ||
| 263 | + fi | ||
| 264 | + | ||
| 265 | + ts_pctx=`echo "scale=2; $ts_used/$ts_total * 100" | bc -l` | ||
| 266 | + ts_pct=`echo "scale=0; $ts_used/$ts_total * 100" | bc -l` | ||
| 267 | + | ||
| 268 | + # if percentage supplied, use percentage in perfdata | ||
| 269 | + [ `expr index "%" "$realwarn"` -gt 0 ] && ts_total=1 | ||
| 270 | + | ||
| 271 | + convert_warncrit_val "$realwarn" $ts_total; compwarn=$ReturnVal # $ReturnUnit is either % or M for the perfdata | ||
| 272 | + convert_warncrit_val "$realcrit" $ts_total; compcrit=$ReturnVal | ||
| 273 | + | ||
| 274 | + perfused=$ts_pctx | ||
| 275 | + [ "$ReturnUnit" != "%" ] && perfused=$[ $ts_total - $ts_free ] && ReturnUnit="M" | ||
| 276 | + | ||
| 277 | if [ "$ts_free" -eq 0 -a "$ts_total" -eq 0 -a "$ts_pct" -eq 0 ] ; then | ||
| 278 | - echo "No data returned by Oracle - tablespace $5 not found?" | ||
| 279 | + echo "${2} : ${tsname} UNKNOWN - No data returned by Oracle - tablespace ${tsname} not found?" | ||
| 280 | exit $STATE_UNKNOWN | ||
| 281 | fi | ||
| 282 | - if [ "$ts_pct" -ge ${6} ] ; then | ||
| 283 | - echo "${2} : ${5} CRITICAL - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | ||
| 284 | + if [ "$ts_pct" -ge "$compcrit" ] ; then | ||
| 285 | + echo "${2} : ${tsname} CRITICAL - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${tsname}=$perfused$ReturnUnit;$compwarn$ReturnUnit;$compcrit$ReturnUnit;0;" | ||
| 286 | exit $STATE_CRITICAL | ||
| 287 | fi | ||
| 288 | - if [ "$ts_pct" -ge ${7} ] ; then | ||
| 289 | - echo "${2} : ${5} WARNING - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | ||
| 290 | + if [ "$ts_pct" -ge "$compwarn" ] ; then | ||
| 291 | + echo "${2} : ${tsname} WARNING - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${tsname}=$perfused$ReturnUnit;$compwarn$ReturnUnit;$compcrit$ReturnUnit;0;" | ||
| 292 | exit $STATE_WARNING | ||
| 293 | fi | ||
| 294 | - echo "${2} : ${5} OK - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | ||
| 295 | + echo "${2} : ${tsname} OK - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${tsname}=$perfused$ReturnUnit;$compwarn$ReturnUnit;$compcrit$ReturnUnit;0;" | ||
| 296 | exit $STATE_OK | ||
| 297 | ;; | ||
| 298 | *) | ||
diff --git a/web/attachments/420075-check_oracle_1.4.15_tsmax_negwarncritlev_easymode_bugfixcache_bugfixperfdatatsmax.patch b/web/attachments/420075-check_oracle_1.4.15_tsmax_negwarncritlev_easymode_bugfixcache_bugfixperfdatatsmax.patch new file mode 100644 index 0000000..c4b1b19 --- /dev/null +++ b/web/attachments/420075-check_oracle_1.4.15_tsmax_negwarncritlev_easymode_bugfixcache_bugfixperfdatatsmax.patch | |||
| @@ -0,0 +1,298 @@ | |||
| 1 | --- check_oracle 2010-10-07 17:11:31.000000000 +0200 | ||
| 2 | +++ co 2011-08-02 18:23:37.000000000 +0200 | ||
| 3 | @@ -8,18 +8,24 @@ | ||
| 4 | |||
| 5 | PROGNAME=`basename $0` | ||
| 6 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` | ||
| 7 | -REVISION="1.4.15" | ||
| 8 | +REVISION="1.4.15-negativewarncrit" | ||
| 9 | |||
| 10 | . $PROGPATH/utils.sh | ||
| 11 | |||
| 12 | +dflt_cachwarn="95%" | ||
| 13 | +dflt_cachcrit="97%" | ||
| 14 | +dflt_tswarn="85%" | ||
| 15 | +dflt_tscrit="95%" | ||
| 16 | +dflt_tsname="SYSTEM" | ||
| 17 | + | ||
| 18 | |||
| 19 | print_usage() { | ||
| 20 | echo "Usage:" | ||
| 21 | echo " $PROGNAME --tns <Oracle Sid or Hostname/IP address>" | ||
| 22 | echo " $PROGNAME --db <ORACLE_SID>" | ||
| 23 | echo " $PROGNAME --login <ORACLE_SID>" | ||
| 24 | - echo " $PROGNAME --cache <ORACLE_SID> <USER> <PASS> <CRITICAL> <WARNING>" | ||
| 25 | - echo " $PROGNAME --tablespace <ORACLE_SID> <USER> <PASS> <TABLESPACE> <CRITICAL> <WARNING>" | ||
| 26 | + echo " $PROGNAME --cache <ORACLE_SID> [USER] [PASS] [CRITICAL] [WARNING]" | ||
| 27 | + echo " $PROGNAME --tablespace <ORACLE_SID> [USER] [PASS] [TABLESPACE] [CRITICAL] [WARNING] [maxbytes]" | ||
| 28 | echo " $PROGNAME --oranames <Hostname>" | ||
| 29 | echo " $PROGNAME --help" | ||
| 30 | echo " $PROGNAME --version" | ||
| 31 | @@ -40,11 +46,11 @@ | ||
| 32 | echo "--login SID" | ||
| 33 | echo " Attempt a dummy login and alert if not ORA-01017: invalid username/password" | ||
| 34 | echo "--cache" | ||
| 35 | - echo " Check local database for library and buffer cache hit ratios" | ||
| 36 | + echo " Check local database for library and buffer cache hit ratios (default warn:$dflt_cachwarn,crit:$dflt_cachcrit)" | ||
| 37 | echo " ---> Requires Oracle user/password and SID specified." | ||
| 38 | - echo " ---> Requires select on v_$sysstat and v_$librarycache" | ||
| 39 | + echo " ---> Requires select on v_\$sysstat and v_\$librarycache" | ||
| 40 | echo "--tablespace" | ||
| 41 | - echo " Check local database for tablespace capacity in ORACLE_SID" | ||
| 42 | + echo " Check local database for tablespace capacity in ORACLE_SID (default warn:$dflt_tswarn,crit:$dflt_tscrit,ts:$dflt_tsname)" | ||
| 43 | echo " ---> Requires Oracle user/password specified." | ||
| 44 | echo " ---> Requires select on dba_data_files and dba_free_space" | ||
| 45 | echo "--oranames Hostname" | ||
| 46 | @@ -54,6 +60,12 @@ | ||
| 47 | echo "--version" | ||
| 48 | echo " Print version and license information" | ||
| 49 | echo "" | ||
| 50 | + echo " <WARNING>/<CRITICAL> can either be a percentage (ie. '15%') or a size in Mega/Giga/Terabyte (ie. '2G'; dflt: M)" | ||
| 51 | + echo " Prepend the size with minus to be notified for a certain level below the maximum value," | ||
| 52 | + echo " ie. '-2G' to be warned 2G before 'SIZE' (-t) or 'MAXBYTES' (-T) tablespace runs out." | ||
| 53 | + echo "" | ||
| 54 | + echo "If <USER> and <PASS> are left blank, ie. \"\", \`sqlplus -s / as sysdba\` is tried instead." | ||
| 55 | + echo "" | ||
| 56 | echo "If the plugin doesn't work, check that the ORACLE_HOME environment" | ||
| 57 | echo "variable is set, that ORACLE_HOME/bin is in your PATH, and the" | ||
| 58 | echo "tnsnames.ora file is locatable and is properly configured." | ||
| 59 | @@ -66,6 +78,54 @@ | ||
| 60 | support | ||
| 61 | } | ||
| 62 | |||
| 63 | + | ||
| 64 | +# convert_warncrit_val( warnlevel/critlevel ): returns in either % or units of M, no matter what input the user provided | ||
| 65 | +ReturnVal= | ||
| 66 | +ReturnUnit= | ||
| 67 | +convert_warncrit_val() { | ||
| 68 | + input=$1; totalsize=$2 | ||
| 69 | + tmp=0; tmpunit="" | ||
| 70 | + [ `expr index "$input" "%"` -gt 1 ] && tmp=`echo "scale=0; ${input%*%} * $totalsize" | bc | sed 's/\.[0-9]*$//g'` && tmpunit="%" | ||
| 71 | + if [ "$tmp" = "0" ]; then | ||
| 72 | + [ `expr index "$input" "G"` -gt 1 ] && tmp=$[ ${input%*G}*1000 ] && tmpunit="M" | ||
| 73 | + [ `expr index "$input" "T"` -gt 1 ] && tmp=$[ ${input%*T}*1000*1000 ] && tmpunit="M" | ||
| 74 | + if [ "$tmp" = "0" ]; then # default: M | ||
| 75 | + foo=$input | ||
| 76 | + [ `expr index "$input" "M"` -gt 1 ] && foo=$[ ${input%*M} ] && tmpunit="M" | ||
| 77 | + tmp=$foo | ||
| 78 | + fi | ||
| 79 | + fi | ||
| 80 | + | ||
| 81 | + [ $tmp -lt 0 ] && tmp=$[ $totalsize + $tmp ] # ie. -2G | ||
| 82 | + [ $tmp -lt 0 ] && tmp=0 # ie. the result of the line before was below zero => set to zero. | ||
| 83 | + | ||
| 84 | + ReturnVal=$tmp | ||
| 85 | + ReturnUnit=$tmpunit | ||
| 86 | + return | ||
| 87 | +} | ||
| 88 | + | ||
| 89 | + | ||
| 90 | +# do_warncrit_test(warnlevel, critlevel) | ||
| 91 | +do_warncrit_test() { | ||
| 92 | + convert_warncrit_val $1 100; tmpwarn=$ReturnVal # use "100" as "size" for percentile checks, since we don't have that already | ||
| 93 | + convert_warncrit_val $2 100; tmpcrit=$ReturnVal | ||
| 94 | + | ||
| 95 | + if [ $tmpwarn -lt 0 ]; then # ie. -2G | ||
| 96 | + if [ $tmpwarn -gt $tmpcrit ]; then | ||
| 97 | + echo "UNKNOWN - Warning level is less than Crit" | ||
| 98 | + exit $STATE_UNKNOWN | ||
| 99 | + fi | ||
| 100 | + else | ||
| 101 | + if [ $tmpwarn -gt $tmpcrit ]; then | ||
| 102 | + echo "UNKNOWN - Warning level is more than Crit" | ||
| 103 | + exit $STATE_UNKNOWN | ||
| 104 | + fi | ||
| 105 | + fi | ||
| 106 | +} | ||
| 107 | + | ||
| 108 | + | ||
| 109 | + | ||
| 110 | + | ||
| 111 | case "$1" in | ||
| 112 | 1) | ||
| 113 | cmd='--tns' | ||
| 114 | @@ -171,8 +231,13 @@ | ||
| 115 | #exit $STATE_OK | ||
| 116 | #fi | ||
| 117 | else | ||
| 118 | - echo "${2} Database is DOWN" | ||
| 119 | - exit $STATE_CRITICAL | ||
| 120 | + if [ "${2}" != "" ]; then | ||
| 121 | + echo "${2} - Database is DOWN (or doesn't exist)" | ||
| 122 | + exit $STATE_CRITICAL | ||
| 123 | + else | ||
| 124 | + echo "UNKNOWN - Please supply a database name" | ||
| 125 | + exit $STATE_UNKNOWN | ||
| 126 | + fi | ||
| 127 | fi | ||
| 128 | ;; | ||
| 129 | --login) | ||
| 130 | @@ -188,11 +253,24 @@ | ||
| 131 | fi | ||
| 132 | ;; | ||
| 133 | --cache) | ||
| 134 | - if [ ${5} -gt ${6} ] ; then | ||
| 135 | - echo "UNKNOWN - Warning level is less then Crit" | ||
| 136 | - exit $STATE_UNKNOWN | ||
| 137 | + | ||
| 138 | + [ "$#" -lt 2 ] && print_usage && exit # use empty user/pass for default connection / as sysdba, use empty warncrit for dflt-warncrit | ||
| 139 | + | ||
| 140 | + realwarn=$dflt_cachwarn | ||
| 141 | + realcrit=$dflt_cachcrit | ||
| 142 | + [ "$6" != "" ] && realwarn=$6 | ||
| 143 | + [ "$5" != "" ] && realcrit=$5 | ||
| 144 | + | ||
| 145 | + do_warncrit_test "$realwarn" "$realcrit" | ||
| 146 | + | ||
| 147 | + if [ `expr index "$realwarn" "%"` -lt 1 ]; then | ||
| 148 | + echo "${2} UNKNOWN - cache check can only use % value for warn/crit level." | ||
| 149 | + exit $STATE_UNKNOWN | ||
| 150 | fi | ||
| 151 | - result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 152 | + | ||
| 153 | + cmdsqlplus="sqlplus -s / as sysdba" | ||
| 154 | + [ "$3" != "" ] && [ "$4" != "" ] && cmdsqlplus="sqlplus -s ${3}/${4}@${2}" | ||
| 155 | + result=`$cmdsqlplus << EOF | ||
| 156 | set pagesize 0 | ||
| 157 | set numf '9999999.99' | ||
| 158 | select (1-(pr.value/(dbg.value+cg.value)))*100 | ||
| 159 | @@ -210,7 +288,7 @@ | ||
| 160 | |||
| 161 | buf_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` | ||
| 162 | buf_hrx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'` | ||
| 163 | - result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 164 | + result=`$cmdsqlplus << EOF | ||
| 165 | set pagesize 0 | ||
| 166 | set numf '9999999.99' | ||
| 167 | select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 | ||
| 168 | @@ -226,59 +304,105 @@ | ||
| 169 | lib_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` | ||
| 170 | lib_hrx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'` | ||
| 171 | |||
| 172 | - if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then | ||
| 173 | - echo "${2} CRITICAL - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" | ||
| 174 | + # for actually usable warn/crit levels with higher precision number | ||
| 175 | + convert_warncrit_val "$realwarn" 10000; compwarn=$ReturnVal # $ReturnUnit is being used directly, should be of same type. | ||
| 176 | + convert_warncrit_val "$realcrit" 10000; compcrit=$ReturnVal | ||
| 177 | + # just snip of the % of the input to get perfdata | ||
| 178 | + perfwarn=${realwarn%*%} | ||
| 179 | + perfcrit=${realcrit%*%} | ||
| 180 | + | ||
| 181 | + newbufhr=`echo "$buf_hrx * 10000" | bc -l | sed 's/\.[0-9]*$//g'` | ||
| 182 | + newlibhr=`echo "$lib_hrx * 10000" | bc -l | sed 's/\.[0-9]*$//g'` | ||
| 183 | + | ||
| 184 | + if [ $newbufhr -le $compcrit -o $newlibhr -le $compcrit ] ; then | ||
| 185 | + echo "${2} CRITICAL - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0; buffer=$buf_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0;" | ||
| 186 | exit $STATE_CRITICAL | ||
| 187 | fi | ||
| 188 | - if [ $buf_hr -le ${6} -o $lib_hr -le ${6} ] ; then | ||
| 189 | - echo "${2} WARNING - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" | ||
| 190 | + if [ $newbufhr -le $compwarn -o $newlibhr -le $compwarn ] ; then | ||
| 191 | + echo "${2} WARNING - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0; buffer=$buf_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0;" | ||
| 192 | exit $STATE_WARNING | ||
| 193 | fi | ||
| 194 | - echo "${2} OK - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" | ||
| 195 | + echo "${2} OK - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0; buffer=$buf_hrx$ReturnUnit;$perfwarn$ReturnUnit;$perfcrit$ReturnUnit;0;" | ||
| 196 | |||
| 197 | exit $STATE_OK | ||
| 198 | ;; | ||
| 199 | --tablespace) | ||
| 200 | - if [ ${6} -lt ${7} ] ; then | ||
| 201 | - echo "UNKNOWN - Warning level is more then Crit" | ||
| 202 | - exit $STATE_UNKNOWN | ||
| 203 | - fi | ||
| 204 | - result=`sqlplus -s ${3}/${4}@${2} << EOF | ||
| 205 | + | ||
| 206 | + [ "$#" -lt 2 ] && print_usage && exit # use empty user/pass for default connection / as sysdba, use empty warncrit for dflt-warncrit... | ||
| 207 | + | ||
| 208 | + tsname="$dflt_tsname" | ||
| 209 | + [ -n "$5" ] && tsname="$5" | ||
| 210 | + | ||
| 211 | + realwarn="$dflt_tswarn" | ||
| 212 | + realcrit="$dflt_tscrit" | ||
| 213 | + [ "$7" != "" ] && realwarn="$7" | ||
| 214 | + [ "$6" != "" ] && realcrit="$6" | ||
| 215 | + do_warncrit_test "$realwarn" "$realcrit" | ||
| 216 | + | ||
| 217 | + cmdsqlplus="sqlplus -s / as sysdba" | ||
| 218 | + [ "$3" != "" ] && [ "$4" != "" ] && cmdsqlplus="sqlplus -s ${3}/${4}@${2}" | ||
| 219 | + result=`$cmdsqlplus << EOF | ||
| 220 | set pagesize 0 | ||
| 221 | set numf '9999999.99' | ||
| 222 | -select NVL(b.free,0.0),a.total,100 - trunc(NVL(b.free,0.0)/a.total * 1000) / 10 prc | ||
| 223 | +select ROUND(a.maxi,0) MAXI, ROUND(a.total,0) ALLOCATED, ROUND(a.total-b.free,0) USED, ROUND(b.free,0) FREE, ROUND(a.maxi-a.total+b.free,0) FREEMAXI | ||
| 224 | from ( | ||
| 225 | -select tablespace_name,sum(bytes)/1024/1024 total | ||
| 226 | +select tablespace_name,sum(NVL(bytes,0))/1024/1024 total,sum(NVL(maxbytes,0))/1024/1024 maxi | ||
| 227 | from dba_data_files group by tablespace_name) A | ||
| 228 | LEFT OUTER JOIN | ||
| 229 | -( select tablespace_name,sum(bytes)/1024/1024 free | ||
| 230 | +( select tablespace_name,sum(NVL(bytes,0))/1024/1024 free | ||
| 231 | from dba_free_space group by tablespace_name) B | ||
| 232 | -ON a.tablespace_name=b.tablespace_name WHERE a.tablespace_name='${5}'; | ||
| 233 | +ON a.tablespace_name=b.tablespace_name WHERE a.tablespace_name='${tsname}'; | ||
| 234 | EOF` | ||
| 235 | |||
| 236 | if [ -n "`echo $result | grep ORA-`" ] ; then | ||
| 237 | error=` echo "$result" | grep "ORA-" | head -1` | ||
| 238 | - echo "CRITICAL - $error" | ||
| 239 | + echo "${2} : ${tsname} CRITICAL - $error" | ||
| 240 | exit $STATE_CRITICAL | ||
| 241 | fi | ||
| 242 | |||
| 243 | - ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}'` | ||
| 244 | - ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}'` | ||
| 245 | - ts_pct=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'` | ||
| 246 | - ts_pctx=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print $3}'` | ||
| 247 | + ts_total= | ||
| 248 | + ts_used= | ||
| 249 | + ts_free= | ||
| 250 | + if [ "${8}" = "max" ]; then | ||
| 251 | + ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}'` | ||
| 252 | + ts_used=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'` | ||
| 253 | + ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($5)}'` | ||
| 254 | + else | ||
| 255 | + ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}'` | ||
| 256 | + ts_used=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'` | ||
| 257 | + ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($4)}'` | ||
| 258 | + fi | ||
| 259 | + | ||
| 260 | + if [ "$ts_total" = "" ]; then | ||
| 261 | + echo "${2} : ${tsname} UNKNOWN - no data was returned" | ||
| 262 | + exit $STATE_UNKNOWN | ||
| 263 | + fi | ||
| 264 | + | ||
| 265 | + ts_pctx=`echo "scale=2; $ts_used/$ts_total * 100" | bc -l` | ||
| 266 | + ts_pct=`echo "scale=0; $ts_used/$ts_total * 100" | bc -l` | ||
| 267 | + | ||
| 268 | + # if percentage supplied, use percentage in perfdata | ||
| 269 | + [ `expr index "%" "$realwarn"` -gt 0 ] && ts_total=1 | ||
| 270 | + | ||
| 271 | + convert_warncrit_val "$realwarn" $ts_total; compwarn=$ReturnVal # $ReturnUnit is either % or M for the perfdata | ||
| 272 | + convert_warncrit_val "$realcrit" $ts_total; compcrit=$ReturnVal | ||
| 273 | + | ||
| 274 | + perfused=$ts_pctx | ||
| 275 | + [ "$ReturnUnit" != "%" ] && perfused=$[ $ts_total - $ts_free ] && ReturnUnit="M" | ||
| 276 | + | ||
| 277 | if [ "$ts_free" -eq 0 -a "$ts_total" -eq 0 -a "$ts_pct" -eq 0 ] ; then | ||
| 278 | - echo "No data returned by Oracle - tablespace $5 not found?" | ||
| 279 | + echo "${2} : ${tsname} UNKNOWN - No data returned by Oracle - tablespace ${tsname} not found?" | ||
| 280 | exit $STATE_UNKNOWN | ||
| 281 | fi | ||
| 282 | - if [ "$ts_pct" -ge ${6} ] ; then | ||
| 283 | - echo "${2} : ${5} CRITICAL - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | ||
| 284 | + if [ "$ts_pct" -ge "$compcrit" ] ; then | ||
| 285 | + echo "${2} : ${tsname} CRITICAL - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${tsname}=$perfused$ReturnUnit;$compwarn$ReturnUnit;$compcrit$ReturnUnit;0;" | ||
| 286 | exit $STATE_CRITICAL | ||
| 287 | fi | ||
| 288 | - if [ "$ts_pct" -ge ${7} ] ; then | ||
| 289 | - echo "${2} : ${5} WARNING - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | ||
| 290 | + if [ "$ts_pct" -ge "$compwarn" ] ; then | ||
| 291 | + echo "${2} : ${tsname} WARNING - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${tsname}=$perfused$ReturnUnit;$compwarn$ReturnUnit;$compcrit$ReturnUnit;0;" | ||
| 292 | exit $STATE_WARNING | ||
| 293 | fi | ||
| 294 | - echo "${2} : ${5} OK - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | ||
| 295 | + echo "${2} : ${tsname} OK - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${tsname}=$perfused$ReturnUnit;$compwarn$ReturnUnit;$compcrit$ReturnUnit;0;" | ||
| 296 | exit $STATE_OK | ||
| 297 | ;; | ||
| 298 | *) | ||
diff --git a/web/attachments/420256-check_snmp_64bit_fix.diff b/web/attachments/420256-check_snmp_64bit_fix.diff new file mode 100644 index 0000000..78bf767 --- /dev/null +++ b/web/attachments/420256-check_snmp_64bit_fix.diff | |||
| @@ -0,0 +1,155 @@ | |||
| 1 | *** check_snmp.c Thu Aug 4 14:33:54 2011 | ||
| 2 | --- check_snmp_64bit_fix.c Thu Aug 4 14:17:49 2011 | ||
| 3 | *************** | ||
| 4 | *** 85,91 **** | ||
| 5 | |||
| 6 | int process_arguments (int, char **); | ||
| 7 | int validate_arguments (void); | ||
| 8 | ! char *thisarg (char *str); | ||
| 9 | char *nextarg (char *str); | ||
| 10 | void print_usage (void); | ||
| 11 | void print_help (void); | ||
| 12 | --- 85,91 ---- | ||
| 13 | |||
| 14 | int process_arguments (int, char **); | ||
| 15 | int validate_arguments (void); | ||
| 16 | ! char *trimstring (char *str); | ||
| 17 | char *nextarg (char *str); | ||
| 18 | void print_usage (void); | ||
| 19 | void print_help (void); | ||
| 20 | *************** | ||
| 21 | *** 180,187 **** | ||
| 22 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 23 | textdomain (PACKAGE); | ||
| 24 | |||
| 25 | ! labels = malloc (labels_size); | ||
| 26 | ! unitv = malloc (unitv_size); | ||
| 27 | for (i = 0; i < MAX_OIDS; i++) | ||
| 28 | eval_method[i] = CHECK_UNDEF; | ||
| 29 | |||
| 30 | --- 180,187 ---- | ||
| 31 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 32 | textdomain (PACKAGE); | ||
| 33 | |||
| 34 | ! labels = malloc (sizeof(char *) * labels_size); | ||
| 35 | ! unitv = malloc (sizeof(char *) * unitv_size); | ||
| 36 | for (i = 0; i < MAX_OIDS; i++) | ||
| 37 | eval_method[i] = CHECK_UNDEF; | ||
| 38 | |||
| 39 | *************** | ||
| 40 | *** 737,760 **** | ||
| 41 | nlabels++; | ||
| 42 | if (nlabels >= labels_size) { | ||
| 43 | labels_size += 8; | ||
| 44 | ! labels = realloc (labels, labels_size); | ||
| 45 | if (labels == NULL) | ||
| 46 | die (STATE_UNKNOWN, _("Could not reallocate labels[%d]"), (int)nlabels); | ||
| 47 | } | ||
| 48 | ! labels[nlabels - 1] = optarg; | ||
| 49 | ! ptr = thisarg (optarg); | ||
| 50 | labels[nlabels - 1] = ptr; | ||
| 51 | if (strstr (ptr, "'") == ptr) | ||
| 52 | labels[nlabels - 1] = ptr + 1; | ||
| 53 | while (ptr && (ptr = nextarg (ptr))) { | ||
| 54 | if (nlabels >= labels_size) { | ||
| 55 | labels_size += 8; | ||
| 56 | ! labels = realloc (labels, labels_size); | ||
| 57 | if (labels == NULL) | ||
| 58 | die (STATE_UNKNOWN, _("Could not reallocate labels\n")); | ||
| 59 | } | ||
| 60 | labels++; | ||
| 61 | ! ptr = thisarg (ptr); | ||
| 62 | if (strstr (ptr, "'") == ptr) | ||
| 63 | labels[nlabels - 1] = ptr + 1; | ||
| 64 | else | ||
| 65 | --- 738,760 ---- | ||
| 66 | nlabels++; | ||
| 67 | if (nlabels >= labels_size) { | ||
| 68 | labels_size += 8; | ||
| 69 | ! labels = realloc (labels, sizeof(char *) * labels_size); | ||
| 70 | if (labels == NULL) | ||
| 71 | die (STATE_UNKNOWN, _("Could not reallocate labels[%d]"), (int)nlabels); | ||
| 72 | } | ||
| 73 | ! ptr = trimstring (optarg); | ||
| 74 | labels[nlabels - 1] = ptr; | ||
| 75 | if (strstr (ptr, "'") == ptr) | ||
| 76 | labels[nlabels - 1] = ptr + 1; | ||
| 77 | while (ptr && (ptr = nextarg (ptr))) { | ||
| 78 | if (nlabels >= labels_size) { | ||
| 79 | labels_size += 8; | ||
| 80 | ! labels = realloc (labels, sizeof(char *) * labels_size); | ||
| 81 | if (labels == NULL) | ||
| 82 | die (STATE_UNKNOWN, _("Could not reallocate labels\n")); | ||
| 83 | } | ||
| 84 | labels++; | ||
| 85 | ! ptr = trimstring (ptr); | ||
| 86 | if (strstr (ptr, "'") == ptr) | ||
| 87 | labels[nlabels - 1] = ptr + 1; | ||
| 88 | else | ||
| 89 | *************** | ||
| 90 | *** 766,789 **** | ||
| 91 | nunits++; | ||
| 92 | if (nunits >= unitv_size) { | ||
| 93 | unitv_size += 8; | ||
| 94 | ! unitv = realloc (unitv, unitv_size); | ||
| 95 | if (unitv == NULL) | ||
| 96 | die (STATE_UNKNOWN, _("Could not reallocate units [%d]\n"), (int)nunits); | ||
| 97 | } | ||
| 98 | ! unitv[nunits - 1] = optarg; | ||
| 99 | ! ptr = thisarg (optarg); | ||
| 100 | unitv[nunits - 1] = ptr; | ||
| 101 | if (strstr (ptr, "'") == ptr) | ||
| 102 | unitv[nunits - 1] = ptr + 1; | ||
| 103 | while (ptr && (ptr = nextarg (ptr))) { | ||
| 104 | if (nunits >= unitv_size) { | ||
| 105 | unitv_size += 8; | ||
| 106 | ! unitv = realloc (unitv, unitv_size); | ||
| 107 | if (units == NULL) | ||
| 108 | die (STATE_UNKNOWN, _("Could not realloc() units\n")); | ||
| 109 | } | ||
| 110 | nunits++; | ||
| 111 | ! ptr = thisarg (ptr); | ||
| 112 | if (strstr (ptr, "'") == ptr) | ||
| 113 | unitv[nunits - 1] = ptr + 1; | ||
| 114 | else | ||
| 115 | --- 766,788 ---- | ||
| 116 | nunits++; | ||
| 117 | if (nunits >= unitv_size) { | ||
| 118 | unitv_size += 8; | ||
| 119 | ! unitv = realloc (unitv, sizeof(char *) * unitv_size); | ||
| 120 | if (unitv == NULL) | ||
| 121 | die (STATE_UNKNOWN, _("Could not reallocate units [%d]\n"), (int)nunits); | ||
| 122 | } | ||
| 123 | ! ptr = trimstring (optarg); | ||
| 124 | unitv[nunits - 1] = ptr; | ||
| 125 | if (strstr (ptr, "'") == ptr) | ||
| 126 | unitv[nunits - 1] = ptr + 1; | ||
| 127 | while (ptr && (ptr = nextarg (ptr))) { | ||
| 128 | if (nunits >= unitv_size) { | ||
| 129 | unitv_size += 8; | ||
| 130 | ! unitv = realloc (unitv, sizeof(char *) * unitv_size); | ||
| 131 | if (units == NULL) | ||
| 132 | die (STATE_UNKNOWN, _("Could not realloc() units\n")); | ||
| 133 | } | ||
| 134 | nunits++; | ||
| 135 | ! ptr = trimstring (ptr); | ||
| 136 | if (strstr (ptr, "'") == ptr) | ||
| 137 | unitv[nunits - 1] = ptr + 1; | ||
| 138 | else | ||
| 139 | *************** | ||
| 140 | *** 936,942 **** | ||
| 141 | if there is a leading quote, make sure it balances */ | ||
| 142 | |||
| 143 | char * | ||
| 144 | ! thisarg (char *str) | ||
| 145 | { | ||
| 146 | str += strspn (str, " \t\r\n"); /* trim any leading whitespace */ | ||
| 147 | if (strstr (str, "'") == str) { /* handle SIMPLE quoted strings */ | ||
| 148 | --- 935,941 ---- | ||
| 149 | if there is a leading quote, make sure it balances */ | ||
| 150 | |||
| 151 | char * | ||
| 152 | ! trimstring (char *str) | ||
| 153 | { | ||
| 154 | str += strspn (str, " \t\r\n"); /* trim any leading whitespace */ | ||
| 155 | if (strstr (str, "'") == str) { /* handle SIMPLE quoted strings */ | ||
diff --git a/web/attachments/420257-check_snmp_numeric_fix.diff b/web/attachments/420257-check_snmp_numeric_fix.diff new file mode 100644 index 0000000..8c645e1 --- /dev/null +++ b/web/attachments/420257-check_snmp_numeric_fix.diff | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | *** check_snmp.c Thu Aug 4 14:33:54 2011 | ||
| 2 | --- check_snmp_numeric_fix.c Thu Aug 4 14:33:13 2011 | ||
| 3 | *************** | ||
| 4 | *** 331,337 **** | ||
| 5 | /* Clean up type array - Sol10 does not necessarily zero it out */ | ||
| 6 | bzero(type, sizeof(type)); | ||
| 7 | |||
| 8 | ! is_counter=0; | ||
| 9 | /* We strip out the datatype indicator for PHBs */ | ||
| 10 | if (strstr (response, "Gauge: ")) { | ||
| 11 | show = strstr (response, "Gauge: ") + 7; | ||
| 12 | --- 331,338 ---- | ||
| 13 | /* Clean up type array - Sol10 does not necessarily zero it out */ | ||
| 14 | bzero(type, sizeof(type)); | ||
| 15 | |||
| 16 | ! is_counter = 0; | ||
| 17 | ! is_numeric = 0; | ||
| 18 | /* We strip out the datatype indicator for PHBs */ | ||
| 19 | if (strstr (response, "Gauge: ")) { | ||
| 20 | show = strstr (response, "Gauge: ") + 7; | ||
diff --git a/web/attachments/420708-check_oracle_1.4.15_tnsstringmatchfix.patch b/web/attachments/420708-check_oracle_1.4.15_tnsstringmatchfix.patch new file mode 100644 index 0000000..47d42c6 --- /dev/null +++ b/web/attachments/420708-check_oracle_1.4.15_tnsstringmatchfix.patch | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | --- check_oracle 2011-08-09 20:28:19.000000000 +0200 | ||
| 2 | +++ /check_oracle_tns_stringmatchfixed 2011-08-09 20:28:14.000000000 +0200 | ||
| 3 | @@ -133,7 +133,7 @@ | ||
| 4 | tnschk=` tnsping $2` | ||
| 5 | tnschk2=` echo $tnschk | grep -c OK` | ||
| 6 | if [ ${tnschk2} -eq 1 ] ; then | ||
| 7 | - tnschk3=` echo $tnschk | sed -e 's/.*(//' -e 's/).*//'` | ||
| 8 | + tnschk3=${tnschk##*(}; tnschk3=${tnschk3%)*} | ||
| 9 | echo "OK - reply time ${tnschk3} from $2" | ||
| 10 | exit $STATE_OK | ||
| 11 | else | ||
diff --git a/web/attachments/42131-check_ntp.diff b/web/attachments/42131-check_ntp.diff new file mode 100644 index 0000000..43fdd6a --- /dev/null +++ b/web/attachments/42131-check_ntp.diff | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | Index: plugins-scripts/check_ntp.pl | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins-scripts/check_ntp.pl,v | ||
| 4 | retrieving revision 1.12 | ||
| 5 | diff -u -r1.12 check_ntp.pl | ||
| 6 | --- plugins-scripts/check_ntp.pl 4 Feb 2003 05:54:39 -0000 1.12 | ||
| 7 | +++ plugins-scripts/check_ntp.pl 11 Feb 2003 21:10:26 -0000 | ||
| 8 | @@ -249,7 +249,7 @@ | ||
| 9 | } | ||
| 10 | |||
| 11 | # match sys.peer or pps.peer | ||
| 12 | - if (/^(\*|o)([-0-9.\s]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([lumb]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/) { | ||
| 13 | + if (/^(\*|o)([-0-9.\s]+)\s+([-0-9WVGPS.]+)\s+([-0-9.]+)\s+([lumb-]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/) { | ||
| 14 | $syspeer = $2; | ||
| 15 | $jitter = $11; | ||
| 16 | print "match $_ \n" if $verbose; | ||
diff --git a/web/attachments/42137-typescript b/web/attachments/42137-typescript new file mode 100644 index 0000000..85c6751 --- /dev/null +++ b/web/attachments/42137-typescript | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | Script started on Tue Feb 11 17:09:58 2003 | ||
| 2 | bash-2.05b$ bash-2.05b$ bash-2.05b$ s bash-2.05b$ s bash-2.05b$ st bash-2.05b$ st bash-2.05b$ str bash-2.05b$ str bash-2.05b$ stra bash-2.05b$ stra bash-2.05b$ strac bash-2.05b$ strac bash-2.05b$ strace bash-2.05b$ strace bash-2.05b$ strace bash-2.05b$ strace bash-2.05b$ strace / bash-2.05b$ strace / bash-2.05b$ strace /u bash-2.05b$ strace /u bash-2.05b$ strace /us bash-2.05b$ strace /us bash-2.05b$ strace /usr/ bash-2.05b$ strace /usr/ bash-2.05b$ strace /usr/l bash-2.05b$ strace /usr/l bash-2.05b$ strace /usr/lo bash-2.05b$ strace /usr/lo bash-2.05b$ strace /usr/loc bash-2.05b$ strace /usr/loc bash-2.05b$ strace /usr/local/ bash-2.05b$ strace /usr/local/ bash-2.05b$ strace /usr/local/n bash-2.05b$ strace /usr/local/n bash-2.05b$ strace /usr/local/nagios/ bash-2.05b$ strace /usr/local/nagios/ bash-2.05b$ strace /usr/local/nagios/l bash-2.05b$ strace /usr/local/nagios/l bash-2.05b$ strace /usr/local/nagios/li bash-2.05b$ strace /usr/local/nagios/li bash-2.05b$ strace /usr/local/nagios/libexec/ bash-2.05b$ strace /usr/local/nagios/libexec/ bash-2.05b$ strace /usr/local/nagios/libexec/c bash-2.05b$ strace /usr/local/nagios/libexec/c bash-2.05b$ strace /usr/local/nagios/libexec/ch bash-2.05b$ strace /usr/local/nagios/libexec/ch bash-2.05b$ strace /usr/local/nagios/libexec/check_ bash-2.05b$ strace /usr/local/nagios/libexec/check_ bash-2.05b$ strace /usr/local/nagios/libexec/check_m bash-2.05b$ strace /usr/local/nagios/libexec/check_m bash-2.05b$ strace /usr/local/nagios/libexec/check_my bash-2.05b$ strace /usr/local/nagios/libexec/check_my bash-2.05b$ strace /usr/local/nagios/libexec/check_mys bash-2.05b$ strace /usr/local/nagios/libexec/check_mys bash-2.05b$ strace /usr/local/nagios/libexec/check_mysq bash-2.05b$ strace /usr/local/nagios/libexec/check_mysq bash-2.05b$ strace /usr/local/nagios/libexec/check_mysql bash-2.05b$ strace /usr/local/nagios/libexec/check_mysql | ||
| 3 | execve("/usr/local/nagios/libexec/check_mysql", ["/usr/local/nagios/libexec/check_mysql"], [/* 21 vars */]) = 0 | ||
| 4 | uname({sys="Linux", node="foo", ...}) = 0 | ||
| 5 | brk(0) = 0x806c5e0 | ||
| 6 | open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory) | ||
| 7 | open("/etc/ld.so.cache", O_RDONLY) = 3 | ||
| 8 | fstat64(3, {st_mode=S_IFREG|0644, st_size=38234, ...}) = 0 | ||
| 9 | old_mmap(NULL, 38234, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40013000 | ||
| 10 | close(3) = 0 | ||
| 11 | open("/usr/lib/libz.so.1", O_RDONLY) = 3 | ||
| 12 | read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320\30"..., 1024) = 1024 | ||
| 13 | fstat64(3, {st_mode=S_IFREG|0755, st_size=60805, ...}) = 0 | ||
| 14 | old_mmap(NULL, 55308, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4001d000 | ||
| 15 | mprotect(0x40029000, 6156, PROT_NONE) = 0 | ||
| 16 | old_mmap(0x40029000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0xb000) = 0x40029000 | ||
| 17 | close(3) = 0 | ||
| 18 | open("/lib/libutil.so.1", O_RDONLY) = 3 | ||
| 19 | read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`\16\0\000"..., 1024) = 1024 | ||
| 20 | fstat64(3, {st_mode=S_IFREG|0755, st_size=10421, ...}) = 0 | ||
| 21 | old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4002b000 | ||
| 22 | old_mmap(NULL, 10704, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4002c000 | ||
| 23 | mprotect(0x4002e000, 2512, PROT_NONE) = 0 | ||
| 24 | old_mmap(0x4002e000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x1000) = 0x4002e000 | ||
| 25 | close(3) = 0 | ||
| 26 | open("/lib/i686/libc.so.6", O_RDONLY) = 3 | ||
| 27 | read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\220Y\1"..., 1024) = 1024 | ||
| 28 | fstat64(3, {st_mode=S_IFREG|0755, st_size=1395734, ...}) = 0 | ||
| 29 | old_mmap(0x42000000, 1239844, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x42000000 | ||
| 30 | mprotect(0x42126000, 35620, PROT_NONE) = 0 | ||
| 31 | old_mmap(0x42126000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x126000) = 0x42126000 | ||
| 32 | old_mmap(0x4212b000, 15140, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4212b000 | ||
| 33 | close(3) = 0 | ||
| 34 | munmap(0x40013000, 38234) = 0 | ||
| 35 | --- SIGSEGV (Segmentation fault) --- | ||
| 36 | +++ killed by SIGSEGV +++ | ||
| 37 | bash-2.05b$ bash-2.05b$ exit | ||
| 38 | |||
| 39 | Script done on Tue Feb 11 17:10:08 2003 | ||
diff --git a/web/attachments/421612-check_mysql_performance.patch b/web/attachments/421612-check_mysql_performance.patch new file mode 100644 index 0000000..79945e5 --- /dev/null +++ b/web/attachments/421612-check_mysql_performance.patch | |||
| @@ -0,0 +1,111 @@ | |||
| 1 | diff --git a/libexec/check_mysql_performance b/libexec/check_mysql_performance | ||
| 2 | index 9a7e0a5..0e59d35 100755 | ||
| 3 | --- a/libexec/check_mysql_performance | ||
| 4 | +++ b/libexec/check_mysql_performance | ||
| 5 | @@ -11,9 +11,9 @@ use Nagios::Plugin; | ||
| 6 | |||
| 7 | my $np = Nagios::Plugin->new( | ||
| 8 | 'usage' => <<EOH, | ||
| 9 | -Usage: %s [-H host] [-d DSN] -u -p --group | ||
| 10 | +Usage: %s [-H host] [-d DSN] [--perfdata ] [[-u] [-p]|--extra-opts=[section][\@file]] --group | ||
| 11 | EOH | ||
| 12 | - 'version' => '1.00', | ||
| 13 | + 'version' => '1.10', | ||
| 14 | 'url' => 'http://www.capside.com', | ||
| 15 | 'extra' => <<EOH, | ||
| 16 | |||
| 17 | @@ -21,16 +21,15 @@ Threshold formats are specified at: | ||
| 18 | http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT | ||
| 19 | |||
| 20 | 'blurb' => qq{Copyright (c) CAPSiDE. | ||
| 21 | - | ||
| 22 | -This plugin montitors the % use of CPU usage on Linux systems for various types of CPU usage. | ||
| 23 | EOH | ||
| 24 | ); | ||
| 25 | |||
| 26 | $np->add_arg( | ||
| 27 | spec => 'perfdata=s', | ||
| 28 | help => <<EOH, | ||
| 29 | ---perfdata performance data to output | ||
| 30 | - Host to query | ||
| 31 | +--perfdata performance data to check and output | ||
| 32 | + e.g. metric[=warn_range;][critcal_range],metric,... | ||
| 33 | + note semicolons will need escaping when entered in the UI | ||
| 34 | EOH | ||
| 35 | required => 0, | ||
| 36 | ); | ||
| 37 | @@ -108,7 +107,8 @@ $SIG{'ALRM'} = sub { | ||
| 38 | $np->nagios_exit( CRITICAL, 'ERROR: Timed out.' ); | ||
| 39 | }; | ||
| 40 | |||
| 41 | -my ( $code, $message ) = ( OK, 'All parameters OK' ); | ||
| 42 | +my ( $code, $message ) = ( undef, undef ); | ||
| 43 | +$np->add_message( OK, "All parameters OK" ); | ||
| 44 | |||
| 45 | my @fields; | ||
| 46 | if ( not $np->opts->perfdata ) { | ||
| 47 | @@ -116,30 +116,50 @@ if ( not $np->opts->perfdata ) { | ||
| 48 | } | ||
| 49 | else { | ||
| 50 | @fields = split( /,/, $np->opts->perfdata ); | ||
| 51 | - | ||
| 52 | - # @fields = split /,/, join ',', @{$np->opts->perfdata}; | ||
| 53 | } | ||
| 54 | |||
| 55 | # Add all performance data | ||
| 56 | +my $thresholds; | ||
| 57 | +my $value; | ||
| 58 | +my $warning; | ||
| 59 | +my $critical; | ||
| 60 | +my $minimum; | ||
| 61 | +my $maximum; | ||
| 62 | foreach my $key (@fields) { | ||
| 63 | + if ( $key =~ /=/ ) { | ||
| 64 | + ($key, $thresholds) = split( /=/, $key ); | ||
| 65 | + ($warning, $critical) = split ( /;/, $thresholds ); | ||
| 66 | + } else { | ||
| 67 | + $thresholds = undef; | ||
| 68 | + $warning = undef; | ||
| 69 | + $critical = undef; | ||
| 70 | + } | ||
| 71 | if ( $mysql->{'stats'}->{$key}->{'type'} eq 'ABS' ) { | ||
| 72 | next if ( not defined $read_data->{$key} ); | ||
| 73 | - $np->add_perfdata( | ||
| 74 | - 'label' => $key, | ||
| 75 | - 'value' => $read_data->{$key}, | ||
| 76 | - 'uom' => '', | ||
| 77 | - ); | ||
| 78 | - } | ||
| 79 | - elsif ( $mysql->{'stats'}->{$key}->{'type'} eq 'DERIVE' ) { | ||
| 80 | + $value = $read_data->{$key}; | ||
| 81 | + } elsif ( $mysql->{'stats'}->{$key}->{'type'} eq 'DERIVE' ) { | ||
| 82 | next if ( not defined $stat->{$key} ); | ||
| 83 | - $np->add_perfdata( | ||
| 84 | - 'label' => $key, | ||
| 85 | - 'value' => $stat->{$key}, | ||
| 86 | - 'uom' => '', | ||
| 87 | + $value = $stat->{$key}; | ||
| 88 | + } | ||
| 89 | + $np->add_perfdata( | ||
| 90 | + 'label' => $key, | ||
| 91 | + 'value' => $value, | ||
| 92 | + 'uom' => '', | ||
| 93 | + 'warning' => $warning, | ||
| 94 | + 'critical' => $critical, | ||
| 95 | + ); | ||
| 96 | + if ( $thresholds ) { | ||
| 97 | + $code = $np->check_threshold( | ||
| 98 | + 'check' => $value, | ||
| 99 | + 'warning' => $warning, | ||
| 100 | + 'critical' => $critical, | ||
| 101 | ); | ||
| 102 | + if ( $code ) { | ||
| 103 | + $np->add_message($code, "$key beyond thresholds,"); | ||
| 104 | + } | ||
| 105 | } | ||
| 106 | } | ||
| 107 | - | ||
| 108 | +($code, $message) = $np->check_messages(); | ||
| 109 | $np->nagios_exit( $code, $message ); | ||
| 110 | |||
| 111 | package MySQL::Stats; | ||
diff --git a/web/attachments/422303-check_oracle-1.4.15-bashprofile.patch b/web/attachments/422303-check_oracle-1.4.15-bashprofile.patch new file mode 100644 index 0000000..dfa7cee --- /dev/null +++ b/web/attachments/422303-check_oracle-1.4.15-bashprofile.patch | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | --- /usr/lib64/nagios/plugins/check_oracle 2011-08-29 15:39:13.000000000 +0200 | ||
| 2 | +++ /usr/lib64/nagios/plugins/check_oracle-bashprofile 2011-08-29 15:49:30.000000000 +0200 | ||
| 3 | @@ -12,6 +12,12 @@ | ||
| 4 | |||
| 5 | . $PROGPATH/utils.sh | ||
| 6 | |||
| 7 | +# workaround for sudo -u foo kinda calls and the ensueing env problem | ||
| 8 | +USERHOMEDIR=`grep "^$USER" /etc/passwd | cut -d: -f6` | ||
| 9 | +if [ -e $USERHOMEDIR/.bash_profile ]; then | ||
| 10 | + . $USERHOMEDIR/.bash_profile | ||
| 11 | +fi | ||
| 12 | + | ||
| 13 | |||
| 14 | print_usage() { | ||
| 15 | echo "Usage:" | ||
diff --git a/web/attachments/423473-nagiosplug-HEAD-mysql_noauth.patch b/web/attachments/423473-nagiosplug-HEAD-mysql_noauth.patch new file mode 100644 index 0000000..e414423 --- /dev/null +++ b/web/attachments/423473-nagiosplug-HEAD-mysql_noauth.patch | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | diff -Naur nagiosplug/plugins/check_mysql.c nagiosplug.new/plugins/check_mysql.c | ||
| 2 | --- nagiosplug/plugins/check_mysql.c 2011-09-13 15:56:05.667051730 +0300 | ||
| 3 | +++ nagiosplug.new/plugins/check_mysql.c 2011-09-13 15:57:08.786832084 +0300 | ||
| 4 | @@ -42,6 +42,7 @@ | ||
| 5 | #include "netutils.h" | ||
| 6 | |||
| 7 | #include <mysql.h> | ||
| 8 | +#include <mysqld_error.h> | ||
| 9 | #include <errmsg.h> | ||
| 10 | |||
| 11 | char *db_user = NULL; | ||
| 12 | @@ -51,6 +52,7 @@ | ||
| 13 | char *db = NULL; | ||
| 14 | unsigned int db_port = MYSQL_PORT; | ||
| 15 | int check_slave = 0, warn_sec = 0, crit_sec = 0; | ||
| 16 | +int ignore_auth = 0; | ||
| 17 | int verbose = 0; | ||
| 18 | |||
| 19 | thresholds *my_threshold = NULL; | ||
| 20 | @@ -91,7 +93,16 @@ | ||
| 21 | |||
| 22 | /* establish a connection to the server and error checking */ | ||
| 23 | if (!mysql_real_connect(&mysql,db_host,db_user,db_pass,db,db_port,db_socket,0)) { | ||
| 24 | - if (mysql_errno (&mysql) == CR_UNKNOWN_HOST) | ||
| 25 | + if (ignore_auth && mysql_errno (&mysql) == ER_ACCESS_DENIED_ERROR) | ||
| 26 | + { | ||
| 27 | + printf("MySQL OK - Version: %s (protocol %d)\n", | ||
| 28 | + mysql_get_server_info(&mysql), | ||
| 29 | + mysql_get_proto_info(&mysql) | ||
| 30 | + ); | ||
| 31 | + mysql_close (&mysql); | ||
| 32 | + return STATE_OK; | ||
| 33 | + } | ||
| 34 | + else if (mysql_errno (&mysql) == CR_UNKNOWN_HOST) | ||
| 35 | die (STATE_WARNING, "%s\n", mysql_error (&mysql)); | ||
| 36 | else if (mysql_errno (&mysql) == CR_VERSION_ERROR) | ||
| 37 | die (STATE_WARNING, "%s\n", mysql_error (&mysql)); | ||
| 38 | @@ -252,6 +263,7 @@ | ||
| 39 | {"critical", required_argument, 0, 'c'}, | ||
| 40 | {"warning", required_argument, 0, 'w'}, | ||
| 41 | {"check-slave", no_argument, 0, 'S'}, | ||
| 42 | + {"ignore-auth", no_argument, 0, 'n'}, | ||
| 43 | {"verbose", no_argument, 0, 'v'}, | ||
| 44 | {"version", no_argument, 0, 'V'}, | ||
| 45 | {"help", no_argument, 0, 'h'}, | ||
| 46 | @@ -262,7 +274,7 @@ | ||
| 47 | return ERROR; | ||
| 48 | |||
| 49 | while (1) { | ||
| 50 | - c = getopt_long (argc, argv, "hvVSP:p:u:d:H:s:c:w:", longopts, &option); | ||
| 51 | + c = getopt_long (argc, argv, "hvVSnP:p:u:d:H:s:c:w:", longopts, &option); | ||
| 52 | |||
| 53 | if (c == -1 || c == EOF) | ||
| 54 | break; | ||
| 55 | @@ -300,6 +312,9 @@ | ||
| 56 | case 'S': | ||
| 57 | check_slave = 1; /* check-slave */ | ||
| 58 | break; | ||
| 59 | + case 'n': | ||
| 60 | + ignore_auth = 1; /* ignore-auth */ | ||
| 61 | + break; | ||
| 62 | case 'w': | ||
| 63 | warning = optarg; | ||
| 64 | break; | ||
| 65 | @@ -385,6 +400,9 @@ | ||
| 66 | printf (UT_EXTRA_OPTS); | ||
| 67 | |||
| 68 | printf (UT_HOST_PORT, 'P', myport); | ||
| 69 | + printf (" %s\n", "-n, --ignore-auth"); | ||
| 70 | + printf (" %s\n", _("Ignore authentication failure and check for mysql connectivity only")); | ||
| 71 | + | ||
| 72 | printf (" %s\n", "-s, --socket=STRING"); | ||
| 73 | printf (" %s\n", _("Use the specified socket (has no effect if -H is used)")); | ||
| 74 | |||
diff --git a/web/attachments/424694-nagiosplug_check_http_connect_method.patch b/web/attachments/424694-nagiosplug_check_http_connect_method.patch new file mode 100644 index 0000000..cbf0870 --- /dev/null +++ b/web/attachments/424694-nagiosplug_check_http_connect_method.patch | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | diff -ur nagios-plugins-1.4.15.orig/plugins/check_http.c nagios-plugins-1.4.15/plugins/check_http.c | ||
| 2 | --- nagios-plugins-1.4.15.orig/plugins/check_http.c 2010-07-27 20:47:16.000000000 +0000 | ||
| 3 | +++ nagios-plugins-1.4.15/plugins/check_http.c 2011-09-09 14:03:49.000000000 +0000 | ||
| 4 | @@ -805,9 +805,34 @@ | ||
| 5 | /* try to connect to the host at the given port number */ | ||
| 6 | if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) | ||
| 7 | die (STATE_CRITICAL, _("HTTP CRITICAL - Unable to open TCP socket\n")); | ||
| 8 | + | ||
| 9 | + /* if we are called with the -I option, the -j method is CONNECT and */ | ||
| 10 | + /* we received -S for SSL, then we tunnel the request through a proxy*/ | ||
| 11 | + /* @20100414, public[at]frank4dd.com, http://www.frank4dd.com/howto */ | ||
| 12 | + | ||
| 13 | + if ( server_address != NULL && strcmp(http_method, "CONNECT") == 0 | ||
| 14 | + && host_name != NULL && use_ssl == TRUE) { | ||
| 15 | + | ||
| 16 | + if (verbose) printf ("Entering CONNECT tunnel mode with proxy %s:%d to dst %s:%d\n", server_address, server_port, host_name, HTTPS_PORT); | ||
| 17 | + asprintf (&buf, "%s %s:%d HTTP/1.1\r\n%s\r\n", http_method, host_name, HTTPS_PORT, user_agent); | ||
| 18 | + asprintf (&buf, "%sProxy-Connection: keep-alive\r\n", buf); | ||
| 19 | + asprintf (&buf, "%sHost: %s\r\n", buf, host_name); | ||
| 20 | + /* we finished our request, send empty line with CRLF */ | ||
| 21 | + asprintf (&buf, "%s%s", buf, CRLF); | ||
| 22 | + if (verbose) printf ("%s\n", buf); | ||
| 23 | + send(sd, buf, strlen (buf), 0); | ||
| 24 | + buf[0]='\0'; | ||
| 25 | + | ||
| 26 | + if (verbose) printf ("Receive response from proxy\n"); | ||
| 27 | + read (sd, buffer, MAX_INPUT_BUFFER-1); | ||
| 28 | + if (verbose) printf ("%s", buffer); | ||
| 29 | + /* Here we should check if we got HTTP/1.1 200 Connection established */ | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | #ifdef HAVE_SSL | ||
| 33 | if (use_ssl == TRUE) { | ||
| 34 | np_net_ssl_init_with_hostname(sd, (use_sni ? host_name : NULL)); | ||
| 35 | + if (verbose) printf ("SSL initialized\n"); | ||
| 36 | if (check_cert == TRUE) { | ||
| 37 | result = np_net_ssl_check_cert(days_till_exp); | ||
| 38 | np_net_ssl_cleanup(); | ||
| 39 | @@ -817,7 +842,11 @@ | ||
| 40 | } | ||
| 41 | #endif /* HAVE_SSL */ | ||
| 42 | |||
| 43 | - asprintf (&buf, "%s %s %s\r\n%s\r\n", http_method, server_url, host_name ? "HTTP/1.1" : "HTTP/1.0", user_agent); | ||
| 44 | + if ( server_address != NULL && strcmp(http_method, "CONNECT") == 0 | ||
| 45 | + && host_name != NULL && use_ssl == TRUE) | ||
| 46 | + asprintf (&buf, "%s %s %s\r\n%s\r\n", "GET", server_url, host_name ? "HTTP/1.1" : "HTTP/1.0", user_agent); | ||
| 47 | + else | ||
| 48 | + asprintf (&buf, "%s %s %s\r\n%s\r\n", http_method, server_url, host_name ? "HTTP/1.1" : "HTTP/1.0", user_agent); | ||
| 49 | |||
| 50 | /* tell HTTP/1.1 servers not to keep the connection alive */ | ||
| 51 | asprintf (&buf, "%sConnection: close\r\n", buf); | ||
| 52 | @@ -830,7 +859,9 @@ | ||
| 53 | * (default) port is explicitly specified in the "Host:" header line. | ||
| 54 | */ | ||
| 55 | if ((use_ssl == FALSE && server_port == HTTP_PORT) || | ||
| 56 | - (use_ssl == TRUE && server_port == HTTPS_PORT)) | ||
| 57 | + (use_ssl == TRUE && server_port == HTTPS_PORT) || | ||
| 58 | + ( server_address != NULL && strcmp(http_method, "CONNECT") == 0 | ||
| 59 | + && host_name != NULL && use_ssl == TRUE)) | ||
| 60 | asprintf (&buf, "%sHost: %s\r\n", buf, host_name); | ||
| 61 | else | ||
| 62 | asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port); | ||
| 63 | @@ -1355,7 +1386,7 @@ | ||
| 64 | printf (" %s\n", _("URL to GET or POST (default: /)")); | ||
| 65 | printf (" %s\n", "-P, --post=STRING"); | ||
| 66 | printf (" %s\n", _("URL encoded http POST data")); | ||
| 67 | - printf (" %s\n", "-j, --method=STRING (for example: HEAD, OPTIONS, TRACE, PUT, DELETE)"); | ||
| 68 | + printf (" %s\n", "-j, --method=STRING (for example: HEAD, OPTIONS, TRACE, PUT, DELETE, CONNECT)"); | ||
| 69 | printf (" %s\n", _("Set HTTP method.")); | ||
| 70 | printf (" %s\n", "-N, --no-body"); | ||
| 71 | printf (" %s\n", _("Don't wait for document body: stop reading after headers.")); | ||
| 72 | @@ -1423,7 +1454,15 @@ | ||
| 73 | printf (" %s\n", _("When the certificate of 'www.verisign.com' is valid for more than 14 days,")); | ||
| 74 | printf (" %s\n", _("a STATE_OK is returned. When the certificate is still valid, but for less than")); | ||
| 75 | printf (" %s\n", _("14 days, a STATE_WARNING is returned. A STATE_CRITICAL will be returned when")); | ||
| 76 | - printf (" %s\n", _("the certificate is expired.")); | ||
| 77 | + printf (" %s\n\n", _("the certificate is expired.")); | ||
| 78 | + | ||
| 79 | + printf (" %s\n\n", "CHECK SSL WEBSERVER CONTENT VIA PROXY USING HTTP 1.1 CONNECT: "); | ||
| 80 | + printf (" %s\n\n", _("check_http -I 192.168.100.35 -p 80 -u https://www.verisign.com/ -S -j CONNECT -H www.verisign.com ")); | ||
| 81 | + printf (" %s\n", _("All these options are needed: -I <proxy> -p <proxy-port> -u <check-url> -S(sl) -j CONNECT -H <webserver>")); | ||
| 82 | + printf (" %s\n", _("A STATE_OK will be returned. When the server returns its content but exceeds")); | ||
| 83 | + printf (" %s\n", _("the 5-second threshold, a STATE_WARNING will be returned. When an error occurs,")); | ||
| 84 | + printf (" %s\n", _("a STATE_CRITICAL will be returned.")); | ||
| 85 | + | ||
| 86 | #endif | ||
| 87 | |||
| 88 | printf (UT_SUPPORT); | ||
diff --git a/web/attachments/426873-check_ide_smart-fix-threshold.patch b/web/attachments/426873-check_ide_smart-fix-threshold.patch new file mode 100644 index 0000000..422ead1 --- /dev/null +++ b/web/attachments/426873-check_ide_smart-fix-threshold.patch | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | diff -r -u nagiosplug-2011-10-26/plugins/check_ide_smart.c nagiosplug/plugins/check_ide_smart.c | ||
| 2 | --- nagiosplug-2011-10-26/plugins/check_ide_smart.c 2011-10-25 10:56:37.534927918 +0200 | ||
| 3 | +++ nagiosplug/plugins/check_ide_smart.c 2011-10-25 11:01:51.867256194 +0200 | ||
| 4 | @@ -311,7 +311,7 @@ | ||
| 5 | int i; | ||
| 6 | for (i = 0; i < NR_ATTRIBUTES; i++) { | ||
| 7 | if (value->id && threshold->id && value->id == threshold->id) { | ||
| 8 | - if (value->value <= threshold->threshold) { | ||
| 9 | + if (value->value < threshold->threshold) { | ||
| 10 | ++failed; | ||
| 11 | } | ||
| 12 | else { | ||
| 13 | @@ -340,7 +340,7 @@ | ||
| 14 | int i; | ||
| 15 | for (i = 0; i < NR_ATTRIBUTES; i++) { | ||
| 16 | if (value->id && threshold->id && value->id == threshold->id) { | ||
| 17 | - if (value->value <= threshold->threshold) { | ||
| 18 | + if (value->value < threshold->threshold) { | ||
| 19 | ++failed; | ||
| 20 | if (value->status & 1) { | ||
| 21 | status = PREFAILURE; | ||
| 22 | @@ -397,7 +397,7 @@ | ||
| 23 | printf ("Id=%3d, Status=%2d {%s , %s}, Value=%3d, Threshold=%3d, %s\n", | ||
| 24 | p->id, p->status, p->status & 1 ? "PreFailure" : "Advisory ", | ||
| 25 | p->status & 2 ? "OnLine " : "OffLine", p->value, t->threshold, | ||
| 26 | - p->value > t->threshold ? "Passed" : "Failed"); | ||
| 27 | + p->value >= t->threshold ? "Passed" : "Failed"); | ||
| 28 | } | ||
| 29 | |||
| 30 | |||
diff --git a/web/attachments/427519-http-parser.bundle b/web/attachments/427519-http-parser.bundle new file mode 100644 index 0000000..74ab9e4 --- /dev/null +++ b/web/attachments/427519-http-parser.bundle | |||
| @@ -0,0 +1,1396 @@ | |||
| 1 | From 256d8d15acf98ee405f79b75a52692531d173f49 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Ferenc Wagner <wferi@niif.hu> | ||
| 3 | Date: Wed, 2 Nov 2011 10:03:38 +0100 | ||
| 4 | Subject: [PATCH 0/9] check_http: add support for chunked encoding via http-parser | ||
| 5 | |||
| 6 | Hi, | ||
| 7 | |||
| 8 | Here is an attempt to add support for chunked encoding in check_http | ||
| 9 | by switching to the third-party HTTP parser from Joyent hosted at | ||
| 10 | https://github.com/joyent/http-parser. The switch makes much of the | ||
| 11 | in-house ad-hoc parsing code redundant, and induces some changes in | ||
| 12 | the semantics of the -e switch, but that should be regarded as a step | ||
| 13 | forward, since the role of that switch was to verify HTTP correctness | ||
| 14 | (at least in part) and now we have a much better mechanism for that: | ||
| 15 | the parser itself. The pagesize limits (-m switch) also gained a | ||
| 16 | clearer semantics: they check the content size now, as that may be | ||
| 17 | available even when -N is used, and does not depend on the transfer | ||
| 18 | encoding. | ||
| 19 | |||
| 20 | Ferenc Wagner (9): | ||
| 21 | check_http: do not print page length if body was not read | ||
| 22 | Add lib/http-parser submodule and adjust Makefile.am to use it in | ||
| 23 | check_http | ||
| 24 | check_http: move status code and redirect location parsing to | ||
| 25 | http-parser | ||
| 26 | check_http: whitespace change to fix up indentation by removing dummy | ||
| 27 | block | ||
| 28 | check_http: constify and rename the location argument for redir() | ||
| 29 | check_http: make list of parsed headers configurable | ||
| 30 | check_http: use header parsing machinery in check_document_dates() | ||
| 31 | check_http: also read the response content via http-parse | ||
| 32 | check_http: check content length instead of response length | ||
| 33 | |||
| 34 | .gitmodules | 3 + | ||
| 35 | lib/Makefile.am | 10 +- | ||
| 36 | lib/http-parser | 1 + | ||
| 37 | plugins/Makefile.am | 9 +- | ||
| 38 | plugins/check_http.c | 596 ++++++++++++++++++++------------------------------ | ||
| 39 | 5 files changed, 256 insertions(+), 363 deletions(-) | ||
| 40 | create mode 100644 .gitmodules | ||
| 41 | create mode 160000 lib/http-parser | ||
| 42 | |||
| 43 | -- | ||
| 44 | 1.7.2.5 | ||
| 45 | |||
| 46 | From abc1d1c539376cb5531a9686e581ff62acf421e5 Mon Sep 17 00:00:00 2001 | ||
| 47 | From: Ferenc Wagner <wferi@niif.hu> | ||
| 48 | Date: Mon, 31 Oct 2011 15:10:54 +0100 | ||
| 49 | Subject: [PATCH 1/9] check_http: do not print page length if body was not read | ||
| 50 | |||
| 51 | |||
| 52 | Signed-off-by: Ferenc Wagner <wferi@niif.hu> | ||
| 53 | --- | ||
| 54 | plugins/check_http.c | 2 +- | ||
| 55 | 1 files changed, 1 insertions(+), 1 deletions(-) | ||
| 56 | |||
| 57 | diff --git a/plugins/check_http.c b/plugins/check_http.c | ||
| 58 | index 433c28e..6df9d23 100644 | ||
| 59 | --- a/plugins/check_http.c | ||
| 60 | +++ b/plugins/check_http.c | ||
| 61 | @@ -923,7 +923,7 @@ check_http (void) | ||
| 62 | /* leave full_page untouched so we can free it later */ | ||
| 63 | page = full_page; | ||
| 64 | |||
| 65 | - if (verbose) | ||
| 66 | + if (verbose && !no_body) | ||
| 67 | printf ("%s://%s:%d%s is %d characters\n", | ||
| 68 | use_ssl ? "https" : "http", server_address, | ||
| 69 | server_port, server_url, (int)pagesize); | ||
| 70 | -- | ||
| 71 | 1.7.2.5 | ||
| 72 | |||
| 73 | |||
| 74 | From 27536d84b73489308f129ff5623ffd1445dfc5fb Mon Sep 17 00:00:00 2001 | ||
| 75 | From: Ferenc Wagner <wferi@niif.hu> | ||
| 76 | Date: Mon, 31 Oct 2011 15:14:38 +0100 | ||
| 77 | Subject: [PATCH 2/9] Add lib/http-parser submodule and adjust Makefile.am to use it in check_http | ||
| 78 | |||
| 79 | |||
| 80 | Signed-off-by: Ferenc Wagner <wferi@niif.hu> | ||
| 81 | --- | ||
| 82 | .gitmodules | 3 +++ | ||
| 83 | lib/Makefile.am | 10 +++++++++- | ||
| 84 | lib/http-parser | 1 + | ||
| 85 | plugins/Makefile.am | 9 +++++---- | ||
| 86 | 4 files changed, 18 insertions(+), 5 deletions(-) | ||
| 87 | create mode 100644 .gitmodules | ||
| 88 | create mode 160000 lib/http-parser | ||
| 89 | |||
| 90 | diff --git a/.gitmodules b/.gitmodules | ||
| 91 | new file mode 100644 | ||
| 92 | index 0000000..5270743 | ||
| 93 | --- /dev/null | ||
| 94 | +++ b/.gitmodules | ||
| 95 | @@ -0,0 +1,3 @@ | ||
| 96 | +[submodule "lib/http-parser"] | ||
| 97 | + path = lib/http-parser | ||
| 98 | + url = git://github.com/joyent/http-parser.git | ||
| 99 | diff --git a/lib/Makefile.am b/lib/Makefile.am | ||
| 100 | index 99fa591..561b7cf 100644 | ||
| 101 | --- a/lib/Makefile.am | ||
| 102 | +++ b/lib/Makefile.am | ||
| 103 | @@ -2,7 +2,7 @@ | ||
| 104 | |||
| 105 | SUBDIRS = . tests | ||
| 106 | |||
| 107 | -noinst_LIBRARIES = libnagiosplug.a | ||
| 108 | +noinst_LIBRARIES = libnagiosplug.a http-parser/libhttp_parser.a | ||
| 109 | |||
| 110 | AM_CPPFLAGS = -DNP_STATE_DIR_PREFIX=\"$(localstatedir)\" | ||
| 111 | |||
| 112 | @@ -18,3 +18,11 @@ INCLUDES = -I$(srcdir) -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/p | ||
| 113 | test test-debug: | ||
| 114 | cd tests && make $@ | ||
| 115 | |||
| 116 | +http-parser/libhttp_parser.a: | ||
| 117 | + cd http-parser && $(MAKE) package | ||
| 118 | + | ||
| 119 | +mostlyclean-local: | ||
| 120 | + cd http-parser && $(MAKE) clean | ||
| 121 | + | ||
| 122 | +check-local: | ||
| 123 | + cd http-parser && $(MAKE) test | ||
| 124 | diff --git a/lib/http-parser b/lib/http-parser | ||
| 125 | new file mode 160000 | ||
| 126 | index 0000000..f1d48aa | ||
| 127 | --- /dev/null | ||
| 128 | +++ b/lib/http-parser | ||
| 129 | @@ -0,0 +1 @@ | ||
| 130 | +Subproject commit f1d48aa31c932f80a64122a75a87bc909b4073f9 | ||
| 131 | diff --git a/plugins/Makefile.am b/plugins/Makefile.am | ||
| 132 | index 36a28b0..2df105e 100644 | ||
| 133 | --- a/plugins/Makefile.am | ||
| 134 | +++ b/plugins/Makefile.am | ||
| 135 | @@ -13,7 +13,7 @@ AM_CFLAGS = -DNP_VERSION='"$(NP_VERSION)"' | ||
| 136 | |||
| 137 | VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plugins/t | ||
| 138 | |||
| 139 | -INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl @LDAPINCLUDE@ @PGINCLUDE@ @SSLINCLUDE@ | ||
| 140 | +INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/lib/http-parser -I$(top_srcdir)/gl -I$(top_srcdir)/intl @LDAPINCLUDE@ @PGINCLUDE@ @SSLINCLUDE@ | ||
| 141 | |||
| 142 | localedir = $(datadir)/locale | ||
| 143 | # gettext docs say to use AM_CPPFLAGS, but per module_CPPFLAGS override this | ||
| 144 | @@ -48,6 +48,7 @@ BASEOBJS = utils.o ../lib/libnagiosplug.a ../gl/libgnu.a | ||
| 145 | NETOBJS = netutils.o $(BASEOBJS) $(EXTRA_NETOBJS) | ||
| 146 | SSLOBJS = sslutils.o | ||
| 147 | NETLIBS = $(NETOBJS) $(SOCKETLIBS) | ||
| 148 | +HTTPPARSER = ../lib/http-parser/libhttp_parser.a | ||
| 149 | |||
| 150 | TESTS_ENVIRONMENT = perl -I $(top_builddir) -I $(top_srcdir) | ||
| 151 | |||
| 152 | @@ -70,7 +71,7 @@ check_dns_LDADD = $(NETLIBS) runcmd.o | ||
| 153 | check_dummy_LDADD = $(BASEOBJS) | ||
| 154 | check_fping_LDADD = $(NETLIBS) popen.o | ||
| 155 | check_game_LDADD = $(BASEOBJS) runcmd.o | ||
| 156 | -check_http_LDADD = $(SSLOBJS) $(NETLIBS) $(SSLLIBS) | ||
| 157 | +check_http_LDADD = $(SSLOBJS) $(NETLIBS) $(SSLLIBS) $(HTTPPARSER) | ||
| 158 | check_hpjd_LDADD = $(NETLIBS) popen.o | ||
| 159 | check_ldap_LDADD = $(NETLIBS) $(LDAPLIBS) | ||
| 160 | check_load_LDADD = $(BASEOBJS) popen.o | ||
| 161 | @@ -115,7 +116,7 @@ check_dns_DEPENDENCIES = check_dns.c $(NETOBJS) runcmd.o $(DEPLIBS) | ||
| 162 | check_dummy_DEPENDENCIES = check_dummy.c $(DEPLIBS) | ||
| 163 | check_fping_DEPENDENCIES = check_fping.c $(NETOBJS) popen.o $(DEPLIBS) | ||
| 164 | check_game_DEPENDENCIES = check_game.c $(DEPLIBS) runcmd.o | ||
| 165 | -check_http_DEPENDENCIES = check_http.c $(SSLOBJS) $(NETOBJS) $(DEPLIBS) | ||
| 166 | +check_http_DEPENDENCIES = check_http.c $(SSLOBJS) $(NETOBJS) $(DEPLIBS) $(HTTPPARSER) | ||
| 167 | check_hpjd_DEPENDENCIES = check_hpjd.c $(NETOBJS) popen.o $(DEPLIBS) | ||
| 168 | check_ide_smart_DEPENDENCIES = check_ide_smart.c $(BASEOBJS) $(DEPLIBS) | ||
| 169 | check_ldap_DEPENDENCIES = check_ldap.c $(NETOBJS) $(DEPLIBS) | ||
| 170 | @@ -170,7 +171,7 @@ install-exec-hook: | ||
| 171 | cd $(DESTDIR)$(libexecdir) && \ | ||
| 172 | for i in $(check_tcp_programs) ; do rm -f $$i; ln -s check_tcp $$i ; done ;\ | ||
| 173 | if [ -x check_ldap ] ; then rm -f check_ldaps ; ln -s check_ldap check_ldaps ; fi | ||
| 174 | - | ||
| 175 | + | ||
| 176 | clean-local: | ||
| 177 | rm -f $(check_tcp_programs) | ||
| 178 | rm -f NP-VERSION-FILE | ||
| 179 | -- | ||
| 180 | 1.7.2.5 | ||
| 181 | |||
| 182 | |||
| 183 | From e8b35f17bf23515dc43233ebbde1c0ccb11d5ecb Mon Sep 17 00:00:00 2001 | ||
| 184 | From: Ferenc Wagner <wferi@niif.hu> | ||
| 185 | Date: Mon, 31 Oct 2011 15:20:48 +0100 | ||
| 186 | Subject: [PATCH 3/9] check_http: move status code and redirect location parsing to http-parser | ||
| 187 | |||
| 188 | This changes the semantics of the -e switch, as http-parser doesn't make | ||
| 189 | the status string available. But it does substantial HTTP verification, | ||
| 190 | so much of the original functionality will be regained once HTTP parsing | ||
| 191 | errors become CRITICAL. | ||
| 192 | |||
| 193 | This introduces some new gettext strings. | ||
| 194 | |||
| 195 | Signed-off-by: Ferenc Wagner <wferi@niif.hu> | ||
| 196 | --- | ||
| 197 | plugins/check_http.c | 264 +++++++++++++++++++++++++------------------------- | ||
| 198 | 1 files changed, 131 insertions(+), 133 deletions(-) | ||
| 199 | |||
| 200 | diff --git a/plugins/check_http.c b/plugins/check_http.c | ||
| 201 | index 6df9d23..ada7a95 100644 | ||
| 202 | --- a/plugins/check_http.c | ||
| 203 | +++ b/plugins/check_http.c | ||
| 204 | @@ -41,6 +41,7 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 205 | #include "netutils.h" | ||
| 206 | #include "utils.h" | ||
| 207 | #include "base64.h" | ||
| 208 | +#include "http_parser.h" | ||
| 209 | #include <ctype.h> | ||
| 210 | |||
| 211 | #define INPUT_DELIMITER ";" | ||
| 212 | @@ -48,7 +49,15 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 213 | #define STICKY_HOST 1 | ||
| 214 | #define STICKY_PORT 2 | ||
| 215 | |||
| 216 | -#define HTTP_EXPECT "HTTP/1." | ||
| 217 | +struct parser_data_t { | ||
| 218 | + enum http_errno prev_callback; /* use HPE_CB_ macros for identifying callbacks */ | ||
| 219 | + char *current_header; | ||
| 220 | + size_t current_header_length; | ||
| 221 | + int parsing_location; | ||
| 222 | + char *location; | ||
| 223 | + size_t location_length; | ||
| 224 | +}; | ||
| 225 | + | ||
| 226 | enum { | ||
| 227 | MAX_IPV4_HOSTLENGTH = 255, | ||
| 228 | HTTP_PORT = 80, | ||
| 229 | @@ -97,8 +106,7 @@ char *host_name; | ||
| 230 | char *server_url; | ||
| 231 | char *user_agent; | ||
| 232 | int server_url_length; | ||
| 233 | -int server_expect_yn = 0; | ||
| 234 | -char server_expect[MAX_INPUT_BUFFER] = HTTP_EXPECT; | ||
| 235 | +int status_expect = -1; | ||
| 236 | char string_expect[MAX_INPUT_BUFFER] = ""; | ||
| 237 | char output_string_search[30] = ""; | ||
| 238 | char *warning_thresholds = NULL; | ||
| 239 | @@ -126,7 +134,7 @@ char buffer[MAX_INPUT_BUFFER]; | ||
| 240 | |||
| 241 | int process_arguments (int, char **); | ||
| 242 | int check_http (void); | ||
| 243 | -void redir (char *pos, char *status_line); | ||
| 244 | +void redir (char *pos); | ||
| 245 | int server_type_check(const char *type); | ||
| 246 | int server_port_check(int ssl_flag); | ||
| 247 | char *perfd_time (double microsec); | ||
| 248 | @@ -367,10 +375,8 @@ process_arguments (int argc, char **argv) | ||
| 249 | strncpy (string_expect, optarg, MAX_INPUT_BUFFER - 1); | ||
| 250 | string_expect[MAX_INPUT_BUFFER - 1] = 0; | ||
| 251 | break; | ||
| 252 | - case 'e': /* string or substring */ | ||
| 253 | - strncpy (server_expect, optarg, MAX_INPUT_BUFFER - 1); | ||
| 254 | - server_expect[MAX_INPUT_BUFFER - 1] = 0; | ||
| 255 | - server_expect_yn = 1; | ||
| 256 | + case 'e': /* expected HTTP response code */ | ||
| 257 | + status_expect = atoi (optarg); | ||
| 258 | break; | ||
| 259 | case 'T': /* Content-type */ | ||
| 260 | asprintf (&http_content_type, "%s", optarg); | ||
| 261 | @@ -589,26 +595,6 @@ parse_time_string (const char *string) | ||
| 262 | } | ||
| 263 | } | ||
| 264 | |||
| 265 | -/* Checks if the server 'reply' is one of the expected 'statuscodes' */ | ||
| 266 | -static int | ||
| 267 | -expected_statuscode (const char *reply, const char *statuscodes) | ||
| 268 | -{ | ||
| 269 | - char *expected, *code; | ||
| 270 | - int result = 0; | ||
| 271 | - | ||
| 272 | - if ((expected = strdup (statuscodes)) == NULL) | ||
| 273 | - die (STATE_UNKNOWN, _("HTTP UNKNOWN - Memory allocation error\n")); | ||
| 274 | - | ||
| 275 | - for (code = strtok (expected, ","); code != NULL; code = strtok (NULL, ",")) | ||
| 276 | - if (strstr (reply, code) != NULL) { | ||
| 277 | - result = 1; | ||
| 278 | - break; | ||
| 279 | - } | ||
| 280 | - | ||
| 281 | - free (expected); | ||
| 282 | - return result; | ||
| 283 | -} | ||
| 284 | - | ||
| 285 | static int | ||
| 286 | check_document_dates (const char *headers, char **msg) | ||
| 287 | { | ||
| 288 | @@ -772,16 +758,78 @@ prepend_slash (char *path) | ||
| 289 | return newpath; | ||
| 290 | } | ||
| 291 | |||
| 292 | +/* | ||
| 293 | +Returns 0 on success, 1 if allocation fails. | ||
| 294 | +Works on binary data, but also zero-terminates the result | ||
| 295 | +for easier string handling. | ||
| 296 | +*/ | ||
| 297 | +int | ||
| 298 | +append (char **orig, size_t *orig_len, const char *extra, size_t len) | ||
| 299 | +{ | ||
| 300 | + *orig = realloc (*orig, *orig_len + len + 1); | ||
| 301 | + if (!*orig) return 1; | ||
| 302 | + memcpy (*orig + *orig_len, extra, len); | ||
| 303 | + *orig_len += len; | ||
| 304 | + (*orig)[*orig_len] = 0; | ||
| 305 | + return 0; | ||
| 306 | +} | ||
| 307 | + | ||
| 308 | +int | ||
| 309 | +header_field_callback (http_parser *parser, const char *at, size_t length) | ||
| 310 | +{ | ||
| 311 | + struct parser_data_t *data = parser->data; | ||
| 312 | + | ||
| 313 | + switch (data->prev_callback) { | ||
| 314 | + case HPE_CB_header_value: | ||
| 315 | + data->current_header_length = 0; | ||
| 316 | + /* fall through */ | ||
| 317 | + case 0: | ||
| 318 | + data->prev_callback = HPE_CB_header_field; | ||
| 319 | + /* fall through */ | ||
| 320 | + case HPE_CB_header_field: | ||
| 321 | + return append (&data->current_header, &data->current_header_length, at, length); | ||
| 322 | + default: | ||
| 323 | + return 1; | ||
| 324 | + } | ||
| 325 | +} | ||
| 326 | + | ||
| 327 | +int | ||
| 328 | +header_value_callback (http_parser *parser, const char *at, size_t length) | ||
| 329 | +{ | ||
| 330 | + struct parser_data_t *data = parser->data; | ||
| 331 | + | ||
| 332 | + switch (data->prev_callback) { | ||
| 333 | + case HPE_CB_header_field: | ||
| 334 | + data->parsing_location = !strcasecmp (data->current_header, "location"); | ||
| 335 | + data->prev_callback = HPE_CB_header_value; | ||
| 336 | + /* fall through */ | ||
| 337 | + case HPE_CB_header_value: | ||
| 338 | + return data->parsing_location && | ||
| 339 | + append (&data->location, &data->location_length, at, length); | ||
| 340 | + default: | ||
| 341 | + return 1; | ||
| 342 | + } | ||
| 343 | +} | ||
| 344 | + | ||
| 345 | +int | ||
| 346 | +headers_complete_callback (http_parser *parser) | ||
| 347 | +{ | ||
| 348 | + struct parser_data_t *data = parser->data; | ||
| 349 | + | ||
| 350 | + data->prev_callback = HPE_CB_headers_complete; | ||
| 351 | + | ||
| 352 | + if (no_body) /* Terminate parsing (thus reading) if the -N option is set */ | ||
| 353 | + return 2; /* 1 means don't expect body in this callback */ | ||
| 354 | + return 0; | ||
| 355 | +} | ||
| 356 | + | ||
| 357 | int | ||
| 358 | check_http (void) | ||
| 359 | { | ||
| 360 | char *msg; | ||
| 361 | - char *status_line; | ||
| 362 | - char *status_code; | ||
| 363 | char *header; | ||
| 364 | char *page; | ||
| 365 | char *auth; | ||
| 366 | - int http_status; | ||
| 367 | int i = 0; | ||
| 368 | size_t pagesize = 0; | ||
| 369 | char *full_page; | ||
| 370 | @@ -792,6 +840,9 @@ check_http (void) | ||
| 371 | double elapsed_time; | ||
| 372 | int page_len = 0; | ||
| 373 | int result = STATE_OK; | ||
| 374 | + http_parser_settings settings; | ||
| 375 | + http_parser parser; | ||
| 376 | + struct parser_data_t parser_data; | ||
| 377 | |||
| 378 | /* try to connect to the host at the given port number */ | ||
| 379 | if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) | ||
| 380 | @@ -869,9 +920,29 @@ check_http (void) | ||
| 381 | if (verbose) printf ("%s\n", buf); | ||
| 382 | my_send (buf, strlen (buf)); | ||
| 383 | |||
| 384 | + /* Initialize the HTTP parser */ | ||
| 385 | + http_parser_init (&parser, HTTP_RESPONSE); | ||
| 386 | + memset (&parser_data, 0, sizeof parser_data); | ||
| 387 | + parser.data = &parser_data; | ||
| 388 | + memset (&settings, 0, sizeof settings); | ||
| 389 | + settings.on_header_field = header_field_callback; | ||
| 390 | + settings.on_header_value = header_value_callback; | ||
| 391 | + settings.on_headers_complete = headers_complete_callback; | ||
| 392 | + | ||
| 393 | /* fetch the page */ | ||
| 394 | full_page = strdup(""); | ||
| 395 | - while ((i = my_recv (buffer, MAX_INPUT_BUFFER-1)) > 0) { | ||
| 396 | + while ((i = my_recv (buffer, MAX_INPUT_BUFFER-1)) >= 0) { | ||
| 397 | + int nparsed = http_parser_execute(&parser, &settings, buffer, i); | ||
| 398 | + if (nparsed != i) { | ||
| 399 | + enum http_errno code = HTTP_PARSER_ERRNO (&parser); | ||
| 400 | + if (code == HPE_CB_headers_complete) { /* the -N check fired */ | ||
| 401 | + /* break; FIXME this would break the current header code */ | ||
| 402 | + } else { | ||
| 403 | + printf ("http_parser_execute returned %d instead of %i: %s\n", | ||
| 404 | + nparsed, i, http_errno_description (code)); | ||
| 405 | + } | ||
| 406 | + } | ||
| 407 | + if (i == 0) break; | ||
| 408 | buffer[i] = '\0'; | ||
| 409 | asprintf (&full_page_new, "%s%s", full_page, buffer); | ||
| 410 | free (full_page); | ||
| 411 | @@ -928,15 +999,9 @@ check_http (void) | ||
| 412 | use_ssl ? "https" : "http", server_address, | ||
| 413 | server_port, server_url, (int)pagesize); | ||
| 414 | |||
| 415 | - /* find status line and null-terminate it */ | ||
| 416 | - status_line = page; | ||
| 417 | + /* skip status line */ | ||
| 418 | page += (size_t) strcspn (page, "\r\n"); | ||
| 419 | - pos = page; | ||
| 420 | page += (size_t) strspn (page, "\r\n"); | ||
| 421 | - status_line[strcspn(status_line, "\r\n")] = 0; | ||
| 422 | - strip (status_line); | ||
| 423 | - if (verbose) | ||
| 424 | - printf ("STATUS: %s\n", status_line); | ||
| 425 | |||
| 426 | /* find header info and null-terminate it */ | ||
| 427 | header = page; | ||
| 428 | @@ -955,68 +1020,38 @@ check_http (void) | ||
| 429 | printf ("**** HEADER ****\n%s\n**** CONTENT ****\n%s\n", header, | ||
| 430 | (no_body ? " [[ skipped ]]" : page)); | ||
| 431 | |||
| 432 | - /* make sure the status line matches the response we are looking for */ | ||
| 433 | - if (!expected_statuscode (status_line, server_expect)) { | ||
| 434 | - if (server_port == HTTP_PORT) | ||
| 435 | - asprintf (&msg, | ||
| 436 | - _("Invalid HTTP response received from host: %s\n"), | ||
| 437 | - status_line); | ||
| 438 | - else | ||
| 439 | - asprintf (&msg, | ||
| 440 | - _("Invalid HTTP response received from host on port %d: %s\n"), | ||
| 441 | - server_port, status_line); | ||
| 442 | - die (STATE_CRITICAL, "HTTP CRITICAL - %s", msg); | ||
| 443 | - } | ||
| 444 | - | ||
| 445 | - /* Bypass normal status line check if server_expect was set by user and not default */ | ||
| 446 | - /* NOTE: After this if/else block msg *MUST* be an asprintf-allocated string */ | ||
| 447 | - if ( server_expect_yn ) { | ||
| 448 | - asprintf (&msg, | ||
| 449 | - _("Status line output matched \"%s\" - "), server_expect); | ||
| 450 | - if (verbose) | ||
| 451 | - printf ("%s\n",msg); | ||
| 452 | - } | ||
| 453 | - else { | ||
| 454 | - /* Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF */ | ||
| 455 | - /* HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT */ | ||
| 456 | - /* Status-Code = 3 DIGITS */ | ||
| 457 | - | ||
| 458 | - status_code = strchr (status_line, ' ') + sizeof (char); | ||
| 459 | - if (strspn (status_code, "1234567890") != 3) | ||
| 460 | - die (STATE_CRITICAL, _("HTTP CRITICAL: Invalid Status Line (%s)\n"), status_line); | ||
| 461 | - | ||
| 462 | - http_status = atoi (status_code); | ||
| 463 | - | ||
| 464 | - /* check the return code */ | ||
| 465 | - | ||
| 466 | - if (http_status >= 600 || http_status < 100) { | ||
| 467 | - die (STATE_CRITICAL, _("HTTP CRITICAL: Invalid Status (%s)\n"), status_line); | ||
| 468 | + if (status_expect != -1) { | ||
| 469 | + if (parser.status_code == status_expect) | ||
| 470 | + asprintf (&msg, _("Got expected code %d - "), status_expect); | ||
| 471 | + else { | ||
| 472 | + asprintf (&msg, _("Invalid HTTP status received from host: %d\n"), | ||
| 473 | + parser.status_code); | ||
| 474 | + die (STATE_CRITICAL, "HTTP CRITICAL - %s", msg); | ||
| 475 | + } | ||
| 476 | + } else { | ||
| 477 | + if (parser.status_code >= 600 || parser.status_code < 100) { | ||
| 478 | + die (STATE_CRITICAL, _("HTTP CRITICAL: Invalid Status (%d)\n"), parser.status_code); | ||
| 479 | } | ||
| 480 | /* server errors result in a critical state */ | ||
| 481 | - else if (http_status >= 500) { | ||
| 482 | - asprintf (&msg, _("%s - "), status_line); | ||
| 483 | + else if (parser.status_code >= 500) { | ||
| 484 | result = STATE_CRITICAL; | ||
| 485 | } | ||
| 486 | /* client errors result in a warning state */ | ||
| 487 | - else if (http_status >= 400) { | ||
| 488 | - asprintf (&msg, _("%s - "), status_line); | ||
| 489 | + else if (parser.status_code >= 400) { | ||
| 490 | result = max_state_alt(STATE_WARNING, result); | ||
| 491 | } | ||
| 492 | /* check redirected page if specified */ | ||
| 493 | - else if (http_status >= 300) { | ||
| 494 | - | ||
| 495 | - if (onredirect == STATE_DEPENDENT) | ||
| 496 | - redir (header, status_line); | ||
| 497 | + else if (parser.status_code >= 300) { | ||
| 498 | + if (onredirect == STATE_DEPENDENT) { | ||
| 499 | + if (parser_data.location) | ||
| 500 | + redir (parser_data.location); | ||
| 501 | + else die (STATE_CRITICAL, _("Redirect without Location header\n")); | ||
| 502 | + } | ||
| 503 | else | ||
| 504 | result = max_state_alt(onredirect, result); | ||
| 505 | - asprintf (&msg, _("%s - "), status_line); | ||
| 506 | - } /* end if (http_status >= 300) */ | ||
| 507 | - else { | ||
| 508 | - /* Print OK status anyway */ | ||
| 509 | - asprintf (&msg, _("%s - "), status_line); | ||
| 510 | } | ||
| 511 | - | ||
| 512 | - } /* end else (server_expect_yn) */ | ||
| 513 | + asprintf (&msg, _("%d - "), parser.status_code); | ||
| 514 | + } | ||
| 515 | |||
| 516 | /* reset the alarm - must be called *after* redir or we'll never die on redirects! */ | ||
| 517 | alarm (0); | ||
| 518 | @@ -1111,11 +1146,10 @@ check_http (void) | ||
| 519 | #define HD5 URI_PATH | ||
| 520 | |||
| 521 | void | ||
| 522 | -redir (char *pos, char *status_line) | ||
| 523 | +redir (char *pos) | ||
| 524 | { | ||
| 525 | int i = 0; | ||
| 526 | char *x; | ||
| 527 | - char xx[2]; | ||
| 528 | char type[6]; | ||
| 529 | char *addr; | ||
| 530 | char *url; | ||
| 531 | @@ -1124,41 +1158,11 @@ redir (char *pos, char *status_line) | ||
| 532 | if (addr == NULL) | ||
| 533 | die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate addr\n")); | ||
| 534 | |||
| 535 | - url = malloc (strcspn (pos, "\r\n")); | ||
| 536 | + url = malloc (strlen (pos) + 1); | ||
| 537 | if (url == NULL) | ||
| 538 | die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate URL\n")); | ||
| 539 | |||
| 540 | - while (pos) { | ||
| 541 | - sscanf (pos, "%1[Ll]%*1[Oo]%*1[Cc]%*1[Aa]%*1[Tt]%*1[Ii]%*1[Oo]%*1[Nn]:%n", xx, &i); | ||
| 542 | - if (i == 0) { | ||
| 543 | - pos += (size_t) strcspn (pos, "\r\n"); | ||
| 544 | - pos += (size_t) strspn (pos, "\r\n"); | ||
| 545 | - if (strlen(pos) == 0) | ||
| 546 | - die (STATE_UNKNOWN, | ||
| 547 | - _("HTTP UNKNOWN - Could not find redirect location - %s%s\n"), | ||
| 548 | - status_line, (display_html ? "</A>" : "")); | ||
| 549 | - continue; | ||
| 550 | - } | ||
| 551 | - | ||
| 552 | - pos += i; | ||
| 553 | - pos += strspn (pos, " \t"); | ||
| 554 | - | ||
| 555 | - /* | ||
| 556 | - * RFC 2616 (4.2): ``Header fields can be extended over multiple lines by | ||
| 557 | - * preceding each extra line with at least one SP or HT.'' | ||
| 558 | - */ | ||
| 559 | - for (; (i = strspn (pos, "\r\n")); pos += i) { | ||
| 560 | - pos += i; | ||
| 561 | - if (!(i = strspn (pos, " \t"))) { | ||
| 562 | - die (STATE_UNKNOWN, _("HTTP UNKNOWN - Empty redirect location%s\n"), | ||
| 563 | - display_html ? "</A>" : ""); | ||
| 564 | - } | ||
| 565 | - } | ||
| 566 | - | ||
| 567 | - url = realloc (url, strcspn (pos, "\r\n") + 1); | ||
| 568 | - if (url == NULL) | ||
| 569 | - die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate URL\n")); | ||
| 570 | - | ||
| 571 | + { /* dummy block to reduce patch diff */ | ||
| 572 | /* URI_HTTP, URI_HOST, URI_PORT, URI_PATH */ | ||
| 573 | if (sscanf (pos, HD1, type, addr, &i, url) == 4) { | ||
| 574 | url = prepend_slash (url); | ||
| 575 | @@ -1203,10 +1207,7 @@ redir (char *pos, char *status_line) | ||
| 576 | _("HTTP UNKNOWN - Could not parse redirect location - %s%s\n"), | ||
| 577 | pos, (display_html ? "</A>" : "")); | ||
| 578 | } | ||
| 579 | - | ||
| 580 | - break; | ||
| 581 | - | ||
| 582 | - } /* end while (pos) */ | ||
| 583 | + } | ||
| 584 | |||
| 585 | if (++redir_depth > max_depth) | ||
| 586 | die (STATE_WARNING, | ||
| 587 | @@ -1332,11 +1333,8 @@ print_help (void) | ||
| 588 | printf (" %s\n", _("(when this option is used the URL is not checked.)\n")); | ||
| 589 | #endif | ||
| 590 | |||
| 591 | - printf (" %s\n", "-e, --expect=STRING"); | ||
| 592 | - printf (" %s\n", _("Comma-delimited list of strings, at least one of them is expected in")); | ||
| 593 | - printf (" %s", _("the first (status) line of the server response (default: ")); | ||
| 594 | - printf ("%s)\n", HTTP_EXPECT); | ||
| 595 | - printf (" %s\n", _("If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)")); | ||
| 596 | + printf (" %s\n", "-e, --expect=INTEGER"); | ||
| 597 | + printf (" %s\n", _("Expected HTTP status code, overriding the default logic")); | ||
| 598 | printf (" %s\n", "-s, --string=STRING"); | ||
| 599 | printf (" %s\n", _("String to expect in the content")); | ||
| 600 | printf (" %s\n", "-u, --url=PATH"); | ||
| 601 | -- | ||
| 602 | 1.7.2.5 | ||
| 603 | |||
| 604 | |||
| 605 | From a35b05d935f975478c90360ab56fb54d2d82e9c6 Mon Sep 17 00:00:00 2001 | ||
| 606 | From: Ferenc Wagner <wferi@niif.hu> | ||
| 607 | Date: Wed, 2 Nov 2011 09:52:19 +0100 | ||
| 608 | Subject: [PATCH 4/9] check_http: whitespace change to fix up indentation by removing dummy block | ||
| 609 | |||
| 610 | |||
| 611 | Signed-off-by: Ferenc Wagner <wferi@niif.hu> | ||
| 612 | --- | ||
| 613 | plugins/check_http.c | 76 ++++++++++++++++++++++++------------------------- | ||
| 614 | 1 files changed, 37 insertions(+), 39 deletions(-) | ||
| 615 | |||
| 616 | diff --git a/plugins/check_http.c b/plugins/check_http.c | ||
| 617 | index ada7a95..3966ab4 100644 | ||
| 618 | --- a/plugins/check_http.c | ||
| 619 | +++ b/plugins/check_http.c | ||
| 620 | @@ -1162,51 +1162,49 @@ redir (char *pos) | ||
| 621 | if (url == NULL) | ||
| 622 | die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate URL\n")); | ||
| 623 | |||
| 624 | - { /* dummy block to reduce patch diff */ | ||
| 625 | - /* URI_HTTP, URI_HOST, URI_PORT, URI_PATH */ | ||
| 626 | - if (sscanf (pos, HD1, type, addr, &i, url) == 4) { | ||
| 627 | - url = prepend_slash (url); | ||
| 628 | - use_ssl = server_type_check (type); | ||
| 629 | - } | ||
| 630 | + /* URI_HTTP, URI_HOST, URI_PORT, URI_PATH */ | ||
| 631 | + if (sscanf (pos, HD1, type, addr, &i, url) == 4) { | ||
| 632 | + url = prepend_slash (url); | ||
| 633 | + use_ssl = server_type_check (type); | ||
| 634 | + } | ||
| 635 | |||
| 636 | - /* URI_HTTP URI_HOST URI_PATH */ | ||
| 637 | - else if (sscanf (pos, HD2, type, addr, url) == 3 ) { | ||
| 638 | - url = prepend_slash (url); | ||
| 639 | - use_ssl = server_type_check (type); | ||
| 640 | - i = server_port_check (use_ssl); | ||
| 641 | - } | ||
| 642 | + /* URI_HTTP URI_HOST URI_PATH */ | ||
| 643 | + else if (sscanf (pos, HD2, type, addr, url) == 3 ) { | ||
| 644 | + url = prepend_slash (url); | ||
| 645 | + use_ssl = server_type_check (type); | ||
| 646 | + i = server_port_check (use_ssl); | ||
| 647 | + } | ||
| 648 | |||
| 649 | - /* URI_HTTP URI_HOST URI_PORT */ | ||
| 650 | - else if (sscanf (pos, HD3, type, addr, &i) == 3) { | ||
| 651 | - strcpy (url, HTTP_URL); | ||
| 652 | - use_ssl = server_type_check (type); | ||
| 653 | - } | ||
| 654 | + /* URI_HTTP URI_HOST URI_PORT */ | ||
| 655 | + else if (sscanf (pos, HD3, type, addr, &i) == 3) { | ||
| 656 | + strcpy (url, HTTP_URL); | ||
| 657 | + use_ssl = server_type_check (type); | ||
| 658 | + } | ||
| 659 | |||
| 660 | - /* URI_HTTP URI_HOST */ | ||
| 661 | - else if (sscanf (pos, HD4, type, addr) == 2) { | ||
| 662 | - strcpy (url, HTTP_URL); | ||
| 663 | - use_ssl = server_type_check (type); | ||
| 664 | - i = server_port_check (use_ssl); | ||
| 665 | - } | ||
| 666 | + /* URI_HTTP URI_HOST */ | ||
| 667 | + else if (sscanf (pos, HD4, type, addr) == 2) { | ||
| 668 | + strcpy (url, HTTP_URL); | ||
| 669 | + use_ssl = server_type_check (type); | ||
| 670 | + i = server_port_check (use_ssl); | ||
| 671 | + } | ||
| 672 | |||
| 673 | - /* URI_PATH */ | ||
| 674 | - else if (sscanf (pos, HD5, url) == 1) { | ||
| 675 | - /* relative url */ | ||
| 676 | - if ((url[0] != '/')) { | ||
| 677 | - if ((x = strrchr(server_url, '/'))) | ||
| 678 | - *x = '\0'; | ||
| 679 | - asprintf (&url, "%s/%s", server_url, url); | ||
| 680 | - } | ||
| 681 | - i = server_port; | ||
| 682 | - strcpy (type, server_type); | ||
| 683 | - strcpy (addr, host_name ? host_name : server_address); | ||
| 684 | + /* URI_PATH */ | ||
| 685 | + else if (sscanf (pos, HD5, url) == 1) { | ||
| 686 | + /* relative url */ | ||
| 687 | + if ((url[0] != '/')) { | ||
| 688 | + if ((x = strrchr(server_url, '/'))) | ||
| 689 | + *x = '\0'; | ||
| 690 | + asprintf (&url, "%s/%s", server_url, url); | ||
| 691 | } | ||
| 692 | + i = server_port; | ||
| 693 | + strcpy (type, server_type); | ||
| 694 | + strcpy (addr, host_name ? host_name : server_address); | ||
| 695 | + } | ||
| 696 | |||
| 697 | - else { | ||
| 698 | - die (STATE_UNKNOWN, | ||
| 699 | - _("HTTP UNKNOWN - Could not parse redirect location - %s%s\n"), | ||
| 700 | - pos, (display_html ? "</A>" : "")); | ||
| 701 | - } | ||
| 702 | + else { | ||
| 703 | + die (STATE_UNKNOWN, | ||
| 704 | + _("HTTP UNKNOWN - Could not parse redirect location - %s%s\n"), | ||
| 705 | + pos, (display_html ? "</A>" : "")); | ||
| 706 | } | ||
| 707 | |||
| 708 | if (++redir_depth > max_depth) | ||
| 709 | -- | ||
| 710 | 1.7.2.5 | ||
| 711 | |||
| 712 | |||
| 713 | From 3f410b149eb7cd112466bbb147525c1d497adaa2 Mon Sep 17 00:00:00 2001 | ||
| 714 | From: Ferenc Wagner <wferi@niif.hu> | ||
| 715 | Date: Mon, 31 Oct 2011 17:45:49 +0100 | ||
| 716 | Subject: [PATCH 5/9] check_http: constify and rename the location argument for redir() | ||
| 717 | |||
| 718 | |||
| 719 | Signed-off-by: Ferenc Wagner <wferi@niif.hu> | ||
| 720 | --- | ||
| 721 | plugins/check_http.c | 18 +++++++++--------- | ||
| 722 | 1 files changed, 9 insertions(+), 9 deletions(-) | ||
| 723 | |||
| 724 | diff --git a/plugins/check_http.c b/plugins/check_http.c | ||
| 725 | index 3966ab4..c4586d5 100644 | ||
| 726 | --- a/plugins/check_http.c | ||
| 727 | +++ b/plugins/check_http.c | ||
| 728 | @@ -134,7 +134,7 @@ char buffer[MAX_INPUT_BUFFER]; | ||
| 729 | |||
| 730 | int process_arguments (int, char **); | ||
| 731 | int check_http (void); | ||
| 732 | -void redir (char *pos); | ||
| 733 | +void redir (const char *location); | ||
| 734 | int server_type_check(const char *type); | ||
| 735 | int server_port_check(int ssl_flag); | ||
| 736 | char *perfd_time (double microsec); | ||
| 737 | @@ -1146,7 +1146,7 @@ check_http (void) | ||
| 738 | #define HD5 URI_PATH | ||
| 739 | |||
| 740 | void | ||
| 741 | -redir (char *pos) | ||
| 742 | +redir (const char *location) | ||
| 743 | { | ||
| 744 | int i = 0; | ||
| 745 | char *x; | ||
| 746 | @@ -1158,38 +1158,38 @@ redir (char *pos) | ||
| 747 | if (addr == NULL) | ||
| 748 | die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate addr\n")); | ||
| 749 | |||
| 750 | - url = malloc (strlen (pos) + 1); | ||
| 751 | + url = malloc (strlen (location) + 1); | ||
| 752 | if (url == NULL) | ||
| 753 | die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate URL\n")); | ||
| 754 | |||
| 755 | /* URI_HTTP, URI_HOST, URI_PORT, URI_PATH */ | ||
| 756 | - if (sscanf (pos, HD1, type, addr, &i, url) == 4) { | ||
| 757 | + if (sscanf (location, HD1, type, addr, &i, url) == 4) { | ||
| 758 | url = prepend_slash (url); | ||
| 759 | use_ssl = server_type_check (type); | ||
| 760 | } | ||
| 761 | |||
| 762 | /* URI_HTTP URI_HOST URI_PATH */ | ||
| 763 | - else if (sscanf (pos, HD2, type, addr, url) == 3 ) { | ||
| 764 | + else if (sscanf (location, HD2, type, addr, url) == 3 ) { | ||
| 765 | url = prepend_slash (url); | ||
| 766 | use_ssl = server_type_check (type); | ||
| 767 | i = server_port_check (use_ssl); | ||
| 768 | } | ||
| 769 | |||
| 770 | /* URI_HTTP URI_HOST URI_PORT */ | ||
| 771 | - else if (sscanf (pos, HD3, type, addr, &i) == 3) { | ||
| 772 | + else if (sscanf (location, HD3, type, addr, &i) == 3) { | ||
| 773 | strcpy (url, HTTP_URL); | ||
| 774 | use_ssl = server_type_check (type); | ||
| 775 | } | ||
| 776 | |||
| 777 | /* URI_HTTP URI_HOST */ | ||
| 778 | - else if (sscanf (pos, HD4, type, addr) == 2) { | ||
| 779 | + else if (sscanf (location, HD4, type, addr) == 2) { | ||
| 780 | strcpy (url, HTTP_URL); | ||
| 781 | use_ssl = server_type_check (type); | ||
| 782 | i = server_port_check (use_ssl); | ||
| 783 | } | ||
| 784 | |||
| 785 | /* URI_PATH */ | ||
| 786 | - else if (sscanf (pos, HD5, url) == 1) { | ||
| 787 | + else if (sscanf (location, HD5, url) == 1) { | ||
| 788 | /* relative url */ | ||
| 789 | if ((url[0] != '/')) { | ||
| 790 | if ((x = strrchr(server_url, '/'))) | ||
| 791 | @@ -1204,7 +1204,7 @@ redir (char *pos) | ||
| 792 | else { | ||
| 793 | die (STATE_UNKNOWN, | ||
| 794 | _("HTTP UNKNOWN - Could not parse redirect location - %s%s\n"), | ||
| 795 | - pos, (display_html ? "</A>" : "")); | ||
| 796 | + location, (display_html ? "</A>" : "")); | ||
| 797 | } | ||
| 798 | |||
| 799 | if (++redir_depth > max_depth) | ||
| 800 | -- | ||
| 801 | 1.7.2.5 | ||
| 802 | |||
| 803 | |||
| 804 | From d1b806941bf6bf94754e86e832a11eabc003a656 Mon Sep 17 00:00:00 2001 | ||
| 805 | From: Ferenc Wagner <wferi@niif.hu> | ||
| 806 | Date: Mon, 31 Oct 2011 17:47:47 +0100 | ||
| 807 | Subject: [PATCH 6/9] check_http: make list of parsed headers configurable | ||
| 808 | |||
| 809 | |||
| 810 | Signed-off-by: Ferenc Wagner <wferi@niif.hu> | ||
| 811 | --- | ||
| 812 | plugins/check_http.c | 58 +++++++++++++++++++++++++++++++++++++++---------- | ||
| 813 | 1 files changed, 46 insertions(+), 12 deletions(-) | ||
| 814 | |||
| 815 | diff --git a/plugins/check_http.c b/plugins/check_http.c | ||
| 816 | index c4586d5..5466e06 100644 | ||
| 817 | --- a/plugins/check_http.c | ||
| 818 | +++ b/plugins/check_http.c | ||
| 819 | @@ -49,13 +49,17 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 820 | #define STICKY_HOST 1 | ||
| 821 | #define STICKY_PORT 2 | ||
| 822 | |||
| 823 | +struct header_data_t { | ||
| 824 | + const char *field; | ||
| 825 | + char *value; | ||
| 826 | +}; | ||
| 827 | + | ||
| 828 | struct parser_data_t { | ||
| 829 | enum http_errno prev_callback; /* use HPE_CB_ macros for identifying callbacks */ | ||
| 830 | - char *current_header; | ||
| 831 | - size_t current_header_length; | ||
| 832 | - int parsing_location; | ||
| 833 | - char *location; | ||
| 834 | - size_t location_length; | ||
| 835 | + char *current_field; | ||
| 836 | + size_t current_length; | ||
| 837 | + struct header_data_t *current_header; | ||
| 838 | + struct header_data_t *headers; | ||
| 839 | }; | ||
| 840 | |||
| 841 | enum { | ||
| 842 | @@ -758,6 +762,17 @@ prepend_slash (char *path) | ||
| 843 | return newpath; | ||
| 844 | } | ||
| 845 | |||
| 846 | +const char * | ||
| 847 | +get_value (const struct header_data_t *header, const char *field) | ||
| 848 | +{ | ||
| 849 | + while (header->field) { | ||
| 850 | + if (!strcasecmp (header->field, field)) | ||
| 851 | + return header->value; | ||
| 852 | + header++; | ||
| 853 | + } | ||
| 854 | + return 0; | ||
| 855 | +} | ||
| 856 | + | ||
| 857 | /* | ||
| 858 | Returns 0 on success, 1 if allocation fails. | ||
| 859 | Works on binary data, but also zero-terminates the result | ||
| 860 | @@ -781,13 +796,13 @@ header_field_callback (http_parser *parser, const char *at, size_t length) | ||
| 861 | |||
| 862 | switch (data->prev_callback) { | ||
| 863 | case HPE_CB_header_value: | ||
| 864 | - data->current_header_length = 0; | ||
| 865 | + data->current_length = 0; | ||
| 866 | /* fall through */ | ||
| 867 | case 0: | ||
| 868 | data->prev_callback = HPE_CB_header_field; | ||
| 869 | /* fall through */ | ||
| 870 | case HPE_CB_header_field: | ||
| 871 | - return append (&data->current_header, &data->current_header_length, at, length); | ||
| 872 | + return append (&data->current_field, &data->current_length, at, length); | ||
| 873 | default: | ||
| 874 | return 1; | ||
| 875 | } | ||
| 876 | @@ -797,15 +812,23 @@ int | ||
| 877 | header_value_callback (http_parser *parser, const char *at, size_t length) | ||
| 878 | { | ||
| 879 | struct parser_data_t *data = parser->data; | ||
| 880 | + struct header_data_t *header; | ||
| 881 | |||
| 882 | switch (data->prev_callback) { | ||
| 883 | case HPE_CB_header_field: | ||
| 884 | - data->parsing_location = !strcasecmp (data->current_header, "location"); | ||
| 885 | + data->current_header = 0; | ||
| 886 | + data->current_length = 0; | ||
| 887 | + for (header = data->headers; header->field; header++) | ||
| 888 | + if (!strcasecmp (data->current_field, header->field)) { | ||
| 889 | + data->current_header = header; | ||
| 890 | + break; | ||
| 891 | + } | ||
| 892 | data->prev_callback = HPE_CB_header_value; | ||
| 893 | /* fall through */ | ||
| 894 | case HPE_CB_header_value: | ||
| 895 | - return data->parsing_location && | ||
| 896 | - append (&data->location, &data->location_length, at, length); | ||
| 897 | + return data->current_header && | ||
| 898 | + append (&(data->current_header->value), | ||
| 899 | + &data->current_length, at, length); | ||
| 900 | default: | ||
| 901 | return 1; | ||
| 902 | } | ||
| 903 | @@ -816,6 +839,13 @@ headers_complete_callback (http_parser *parser) | ||
| 904 | { | ||
| 905 | struct parser_data_t *data = parser->data; | ||
| 906 | |||
| 907 | + if (verbose) { | ||
| 908 | + const struct header_data_t *header; | ||
| 909 | + printf ("Parsed headers:\n"); | ||
| 910 | + for (header = data->headers; header->field; header++) | ||
| 911 | + printf ("%s: %s\n", header->field, header->value); | ||
| 912 | + } | ||
| 913 | + | ||
| 914 | data->prev_callback = HPE_CB_headers_complete; | ||
| 915 | |||
| 916 | if (no_body) /* Terminate parsing (thus reading) if the -N option is set */ | ||
| 917 | @@ -843,6 +873,8 @@ check_http (void) | ||
| 918 | http_parser_settings settings; | ||
| 919 | http_parser parser; | ||
| 920 | struct parser_data_t parser_data; | ||
| 921 | + struct header_data_t interesting_headers[] = | ||
| 922 | + {{"location", 0}, {"date", 0}, {"last-modified", 0}, {0, 0}}; | ||
| 923 | |||
| 924 | /* try to connect to the host at the given port number */ | ||
| 925 | if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) | ||
| 926 | @@ -923,6 +955,7 @@ check_http (void) | ||
| 927 | /* Initialize the HTTP parser */ | ||
| 928 | http_parser_init (&parser, HTTP_RESPONSE); | ||
| 929 | memset (&parser_data, 0, sizeof parser_data); | ||
| 930 | + parser_data.headers = interesting_headers; | ||
| 931 | parser.data = &parser_data; | ||
| 932 | memset (&settings, 0, sizeof settings); | ||
| 933 | settings.on_header_field = header_field_callback; | ||
| 934 | @@ -1043,8 +1076,9 @@ check_http (void) | ||
| 935 | /* check redirected page if specified */ | ||
| 936 | else if (parser.status_code >= 300) { | ||
| 937 | if (onredirect == STATE_DEPENDENT) { | ||
| 938 | - if (parser_data.location) | ||
| 939 | - redir (parser_data.location); | ||
| 940 | + const char *location = get_value (parser_data.headers, "location"); | ||
| 941 | + if (location) | ||
| 942 | + redir (location); | ||
| 943 | else die (STATE_CRITICAL, _("Redirect without Location header\n")); | ||
| 944 | } | ||
| 945 | else | ||
| 946 | -- | ||
| 947 | 1.7.2.5 | ||
| 948 | |||
| 949 | |||
| 950 | From 62e8868bb24c2161ccb7748dba82c6a90618aac3 Mon Sep 17 00:00:00 2001 | ||
| 951 | From: Ferenc Wagner <wferi@niif.hu> | ||
| 952 | Date: Mon, 31 Oct 2011 17:57:11 +0100 | ||
| 953 | Subject: [PATCH 7/9] check_http: use header parsing machinery in check_document_dates() | ||
| 954 | |||
| 955 | |||
| 956 | Signed-off-by: Ferenc Wagner <wferi@niif.hu> | ||
| 957 | --- | ||
| 958 | plugins/check_http.c | 61 +++---------------------------------------------- | ||
| 959 | 1 files changed, 4 insertions(+), 57 deletions(-) | ||
| 960 | |||
| 961 | diff --git a/plugins/check_http.c b/plugins/check_http.c | ||
| 962 | index 5466e06..423bb22 100644 | ||
| 963 | --- a/plugins/check_http.c | ||
| 964 | +++ b/plugins/check_http.c | ||
| 965 | @@ -600,63 +600,10 @@ parse_time_string (const char *string) | ||
| 966 | } | ||
| 967 | |||
| 968 | static int | ||
| 969 | -check_document_dates (const char *headers, char **msg) | ||
| 970 | +check_document_dates (const char *server_date, const char *document_date, char **msg) | ||
| 971 | { | ||
| 972 | - const char *s; | ||
| 973 | - char *server_date = 0; | ||
| 974 | - char *document_date = 0; | ||
| 975 | int date_result = STATE_OK; | ||
| 976 | |||
| 977 | - s = headers; | ||
| 978 | - while (*s) { | ||
| 979 | - const char *field = s; | ||
| 980 | - const char *value = 0; | ||
| 981 | - | ||
| 982 | - /* Find the end of the header field */ | ||
| 983 | - while (*s && !isspace(*s) && *s != ':') | ||
| 984 | - s++; | ||
| 985 | - | ||
| 986 | - /* Remember the header value, if any. */ | ||
| 987 | - if (*s == ':') | ||
| 988 | - value = ++s; | ||
| 989 | - | ||
| 990 | - /* Skip to the end of the header, including continuation lines. */ | ||
| 991 | - while (*s && !(*s == '\n' && (s[1] != ' ' && s[1] != '\t'))) | ||
| 992 | - s++; | ||
| 993 | - | ||
| 994 | - /* Avoid stepping over end-of-string marker */ | ||
| 995 | - if (*s) | ||
| 996 | - s++; | ||
| 997 | - | ||
| 998 | - /* Process this header. */ | ||
| 999 | - if (value && value > field+2) { | ||
| 1000 | - char *ff = (char *) malloc (value-field); | ||
| 1001 | - char *ss = ff; | ||
| 1002 | - while (field < value-1) | ||
| 1003 | - *ss++ = tolower(*field++); | ||
| 1004 | - *ss++ = 0; | ||
| 1005 | - | ||
| 1006 | - if (!strcmp (ff, "date") || !strcmp (ff, "last-modified")) { | ||
| 1007 | - const char *e; | ||
| 1008 | - while (*value && isspace (*value)) | ||
| 1009 | - value++; | ||
| 1010 | - for (e = value; *e && *e != '\r' && *e != '\n'; e++) | ||
| 1011 | - ; | ||
| 1012 | - ss = (char *) malloc (e - value + 1); | ||
| 1013 | - strncpy (ss, value, e - value); | ||
| 1014 | - ss[e - value] = 0; | ||
| 1015 | - if (!strcmp (ff, "date")) { | ||
| 1016 | - if (server_date) free (server_date); | ||
| 1017 | - server_date = ss; | ||
| 1018 | - } else { | ||
| 1019 | - if (document_date) free (document_date); | ||
| 1020 | - document_date = ss; | ||
| 1021 | - } | ||
| 1022 | - } | ||
| 1023 | - free (ff); | ||
| 1024 | - } | ||
| 1025 | - } | ||
| 1026 | - | ||
| 1027 | /* Done parsing the body. Now check the dates we (hopefully) parsed. */ | ||
| 1028 | if (!server_date || !*server_date) { | ||
| 1029 | asprintf (msg, _("%sServer date unknown, "), *msg); | ||
| 1030 | @@ -687,8 +634,6 @@ check_document_dates (const char *headers, char **msg) | ||
| 1031 | date_result = max_state_alt(STATE_CRITICAL, date_result); | ||
| 1032 | } | ||
| 1033 | } | ||
| 1034 | - free (server_date); | ||
| 1035 | - free (document_date); | ||
| 1036 | } | ||
| 1037 | return date_result; | ||
| 1038 | } | ||
| 1039 | @@ -1091,7 +1036,9 @@ check_http (void) | ||
| 1040 | alarm (0); | ||
| 1041 | |||
| 1042 | if (maximum_age >= 0) { | ||
| 1043 | - result = max_state_alt(check_document_dates(header, &msg), result); | ||
| 1044 | + result = max_state_alt(check_document_dates(get_value (parser_data.headers, "date"), | ||
| 1045 | + get_value (parser_data.headers, "last-modified"), &msg), | ||
| 1046 | + result); | ||
| 1047 | } | ||
| 1048 | |||
| 1049 | /* Page and Header content checks go here */ | ||
| 1050 | -- | ||
| 1051 | 1.7.2.5 | ||
| 1052 | |||
| 1053 | |||
| 1054 | From efe4e949ae4ba64f333f402d0f4b54f07b18164c Mon Sep 17 00:00:00 2001 | ||
| 1055 | From: Ferenc Wagner <wferi@niif.hu> | ||
| 1056 | Date: Tue, 1 Nov 2011 16:17:00 +0100 | ||
| 1057 | Subject: [PATCH 8/9] check_http: also read the response content via http-parse | ||
| 1058 | |||
| 1059 | This gets rid of good a bunch of code, and also gives free decoding of | ||
| 1060 | Transfer-Encoding: chunked, which all HTTP/1.1 clients must support. | ||
| 1061 | |||
| 1062 | Signed-off-by: Ferenc Wagner <wferi@niif.hu> | ||
| 1063 | --- | ||
| 1064 | plugins/check_http.c | 86 ++++++++++++------------------------------------- | ||
| 1065 | 1 files changed, 21 insertions(+), 65 deletions(-) | ||
| 1066 | |||
| 1067 | diff --git a/plugins/check_http.c b/plugins/check_http.c | ||
| 1068 | index 423bb22..deea38c 100644 | ||
| 1069 | --- a/plugins/check_http.c | ||
| 1070 | +++ b/plugins/check_http.c | ||
| 1071 | @@ -60,6 +60,7 @@ struct parser_data_t { | ||
| 1072 | size_t current_length; | ||
| 1073 | struct header_data_t *current_header; | ||
| 1074 | struct header_data_t *headers; | ||
| 1075 | + char *content; | ||
| 1076 | }; | ||
| 1077 | |||
| 1078 | enum { | ||
| 1079 | @@ -488,26 +489,6 @@ process_arguments (int argc, char **argv) | ||
| 1080 | return TRUE; | ||
| 1081 | } | ||
| 1082 | |||
| 1083 | - | ||
| 1084 | - | ||
| 1085 | -/* Returns 1 if we're done processing the document body; 0 to keep going */ | ||
| 1086 | -static int | ||
| 1087 | -document_headers_done (char *full_page) | ||
| 1088 | -{ | ||
| 1089 | - const char *body; | ||
| 1090 | - | ||
| 1091 | - for (body = full_page; *body; body++) { | ||
| 1092 | - if (!strncmp (body, "\n\n", 2) || !strncmp (body, "\n\r\n", 3)) | ||
| 1093 | - break; | ||
| 1094 | - } | ||
| 1095 | - | ||
| 1096 | - if (!*body) | ||
| 1097 | - return 0; /* haven't read end of headers yet */ | ||
| 1098 | - | ||
| 1099 | - full_page[body - full_page] = 0; | ||
| 1100 | - return 1; | ||
| 1101 | -} | ||
| 1102 | - | ||
| 1103 | static time_t | ||
| 1104 | parse_time_string (const char *string) | ||
| 1105 | { | ||
| 1106 | @@ -792,6 +773,7 @@ headers_complete_callback (http_parser *parser) | ||
| 1107 | } | ||
| 1108 | |||
| 1109 | data->prev_callback = HPE_CB_headers_complete; | ||
| 1110 | + data->current_length = 0; /* prepare for the body */ | ||
| 1111 | |||
| 1112 | if (no_body) /* Terminate parsing (thus reading) if the -N option is set */ | ||
| 1113 | return 2; /* 1 means don't expect body in this callback */ | ||
| 1114 | @@ -799,16 +781,20 @@ headers_complete_callback (http_parser *parser) | ||
| 1115 | } | ||
| 1116 | |||
| 1117 | int | ||
| 1118 | +body_callback (http_parser *parser, const char *at, size_t length) | ||
| 1119 | +{ | ||
| 1120 | + struct parser_data_t *data = parser->data; | ||
| 1121 | + | ||
| 1122 | + return append (&data->content, &data->current_length, at, length); | ||
| 1123 | +} | ||
| 1124 | + | ||
| 1125 | +int | ||
| 1126 | check_http (void) | ||
| 1127 | { | ||
| 1128 | char *msg; | ||
| 1129 | - char *header; | ||
| 1130 | - char *page; | ||
| 1131 | char *auth; | ||
| 1132 | int i = 0; | ||
| 1133 | size_t pagesize = 0; | ||
| 1134 | - char *full_page; | ||
| 1135 | - char *full_page_new; | ||
| 1136 | char *buf; | ||
| 1137 | char *pos; | ||
| 1138 | long microsec; | ||
| 1139 | @@ -906,31 +892,19 @@ check_http (void) | ||
| 1140 | settings.on_header_field = header_field_callback; | ||
| 1141 | settings.on_header_value = header_value_callback; | ||
| 1142 | settings.on_headers_complete = headers_complete_callback; | ||
| 1143 | + settings.on_body = body_callback; | ||
| 1144 | |||
| 1145 | /* fetch the page */ | ||
| 1146 | - full_page = strdup(""); | ||
| 1147 | while ((i = my_recv (buffer, MAX_INPUT_BUFFER-1)) >= 0) { | ||
| 1148 | int nparsed = http_parser_execute(&parser, &settings, buffer, i); | ||
| 1149 | + pagesize += i; | ||
| 1150 | if (nparsed != i) { | ||
| 1151 | enum http_errno code = HTTP_PARSER_ERRNO (&parser); | ||
| 1152 | - if (code == HPE_CB_headers_complete) { /* the -N check fired */ | ||
| 1153 | - /* break; FIXME this would break the current header code */ | ||
| 1154 | - } else { | ||
| 1155 | - printf ("http_parser_execute returned %d instead of %i: %s\n", | ||
| 1156 | - nparsed, i, http_errno_description (code)); | ||
| 1157 | - } | ||
| 1158 | + if (code == HPE_CB_headers_complete) break; /* the -N check fired */ | ||
| 1159 | + else die (STATE_CRITICAL, _("HTTP CRITICAL - error parsing response: %s"), | ||
| 1160 | + http_errno_description (code)); | ||
| 1161 | } | ||
| 1162 | if (i == 0) break; | ||
| 1163 | - buffer[i] = '\0'; | ||
| 1164 | - asprintf (&full_page_new, "%s%s", full_page, buffer); | ||
| 1165 | - free (full_page); | ||
| 1166 | - full_page = full_page_new; | ||
| 1167 | - pagesize += i; | ||
| 1168 | - | ||
| 1169 | - if (no_body && document_headers_done (full_page)) { | ||
| 1170 | - i = 0; | ||
| 1171 | - break; | ||
| 1172 | - } | ||
| 1173 | } | ||
| 1174 | |||
| 1175 | if (i < 0 && errno != ECONNRESET) { | ||
| 1176 | @@ -969,34 +943,16 @@ check_http (void) | ||
| 1177 | microsec = deltime (tv); | ||
| 1178 | elapsed_time = (double)microsec / 1.0e6; | ||
| 1179 | |||
| 1180 | - /* leave full_page untouched so we can free it later */ | ||
| 1181 | - page = full_page; | ||
| 1182 | - | ||
| 1183 | if (verbose && !no_body) | ||
| 1184 | printf ("%s://%s:%d%s is %d characters\n", | ||
| 1185 | use_ssl ? "https" : "http", server_address, | ||
| 1186 | server_port, server_url, (int)pagesize); | ||
| 1187 | |||
| 1188 | - /* skip status line */ | ||
| 1189 | - page += (size_t) strcspn (page, "\r\n"); | ||
| 1190 | - page += (size_t) strspn (page, "\r\n"); | ||
| 1191 | - | ||
| 1192 | - /* find header info and null-terminate it */ | ||
| 1193 | - header = page; | ||
| 1194 | - while (strcspn (page, "\r\n") > 0) { | ||
| 1195 | - page += (size_t) strcspn (page, "\r\n"); | ||
| 1196 | - pos = page; | ||
| 1197 | - if ((strspn (page, "\r") == 1 && strspn (page, "\r\n") >= 2) || | ||
| 1198 | - (strspn (page, "\n") == 1 && strspn (page, "\r\n") >= 2)) | ||
| 1199 | - page += (size_t) 2; | ||
| 1200 | - else | ||
| 1201 | - page += (size_t) 1; | ||
| 1202 | + if (verbose && !no_body) { | ||
| 1203 | + puts ("**** CONTENT ****"); | ||
| 1204 | + fwrite (parser_data.content, parser_data.current_length, 1, stdout); | ||
| 1205 | + putchar ('\n'); | ||
| 1206 | } | ||
| 1207 | - page += (size_t) strspn (page, "\r\n"); | ||
| 1208 | - header[pos - header] = 0; | ||
| 1209 | - if (verbose) | ||
| 1210 | - printf ("**** HEADER ****\n%s\n**** CONTENT ****\n%s\n", header, | ||
| 1211 | - (no_body ? " [[ skipped ]]" : page)); | ||
| 1212 | |||
| 1213 | if (status_expect != -1) { | ||
| 1214 | if (parser.status_code == status_expect) | ||
| 1215 | @@ -1044,7 +1000,7 @@ check_http (void) | ||
| 1216 | /* Page and Header content checks go here */ | ||
| 1217 | |||
| 1218 | if (strlen (string_expect)) { | ||
| 1219 | - if (!strstr (page, string_expect)) { | ||
| 1220 | + if (!strstr (parser_data.content, string_expect)) { | ||
| 1221 | strncpy(&output_string_search[0],string_expect,sizeof(output_string_search)); | ||
| 1222 | if(output_string_search[sizeof(output_string_search)-1]!='\0') { | ||
| 1223 | bcopy("...",&output_string_search[sizeof(output_string_search)-4],4); | ||
| 1224 | @@ -1055,7 +1011,7 @@ check_http (void) | ||
| 1225 | } | ||
| 1226 | |||
| 1227 | if (strlen (regexp)) { | ||
| 1228 | - errcode = regexec (&preg, page, REGS, pmatch, 0); | ||
| 1229 | + errcode = regexec (&preg, parser_data.content, REGS, pmatch, 0); | ||
| 1230 | if ((errcode == 0 && invert_regex == 0) || (errcode == REG_NOMATCH && invert_regex == 1)) { | ||
| 1231 | /* OK - No-op to avoid changing the logic around it */ | ||
| 1232 | result = max_state_alt(STATE_OK, result); | ||
| 1233 | -- | ||
| 1234 | 1.7.2.5 | ||
| 1235 | |||
| 1236 | |||
| 1237 | From 256d8d15acf98ee405f79b75a52692531d173f49 Mon Sep 17 00:00:00 2001 | ||
| 1238 | From: Ferenc Wagner <wferi@niif.hu> | ||
| 1239 | Date: Wed, 2 Nov 2011 07:57:30 +0100 | ||
| 1240 | Subject: [PATCH 9/9] check_http: check content length instead of response length | ||
| 1241 | |||
| 1242 | The content length does not depend on the transfer encoding and may | ||
| 1243 | be possible to derive without fetching the entire body (cf. -N option). | ||
| 1244 | |||
| 1245 | Signed-off-by: Ferenc Wagner <wferi@niif.hu> | ||
| 1246 | --- | ||
| 1247 | plugins/check_http.c | 93 +++++++++++--------------------------------------- | ||
| 1248 | 1 files changed, 20 insertions(+), 73 deletions(-) | ||
| 1249 | |||
| 1250 | diff --git a/plugins/check_http.c b/plugins/check_http.c | ||
| 1251 | index deea38c..27f5cd3 100644 | ||
| 1252 | --- a/plugins/check_http.c | ||
| 1253 | +++ b/plugins/check_http.c | ||
| 1254 | @@ -619,59 +619,6 @@ check_document_dates (const char *server_date, const char *document_date, char * | ||
| 1255 | return date_result; | ||
| 1256 | } | ||
| 1257 | |||
| 1258 | -int | ||
| 1259 | -get_content_length (const char *headers) | ||
| 1260 | -{ | ||
| 1261 | - const char *s; | ||
| 1262 | - int content_length = 0; | ||
| 1263 | - | ||
| 1264 | - s = headers; | ||
| 1265 | - while (*s) { | ||
| 1266 | - const char *field = s; | ||
| 1267 | - const char *value = 0; | ||
| 1268 | - | ||
| 1269 | - /* Find the end of the header field */ | ||
| 1270 | - while (*s && !isspace(*s) && *s != ':') | ||
| 1271 | - s++; | ||
| 1272 | - | ||
| 1273 | - /* Remember the header value, if any. */ | ||
| 1274 | - if (*s == ':') | ||
| 1275 | - value = ++s; | ||
| 1276 | - | ||
| 1277 | - /* Skip to the end of the header, including continuation lines. */ | ||
| 1278 | - while (*s && !(*s == '\n' && (s[1] != ' ' && s[1] != '\t'))) | ||
| 1279 | - s++; | ||
| 1280 | - | ||
| 1281 | - /* Avoid stepping over end-of-string marker */ | ||
| 1282 | - if (*s) | ||
| 1283 | - s++; | ||
| 1284 | - | ||
| 1285 | - /* Process this header. */ | ||
| 1286 | - if (value && value > field+2) { | ||
| 1287 | - char *ff = (char *) malloc (value-field); | ||
| 1288 | - char *ss = ff; | ||
| 1289 | - while (field < value-1) | ||
| 1290 | - *ss++ = tolower(*field++); | ||
| 1291 | - *ss++ = 0; | ||
| 1292 | - | ||
| 1293 | - if (!strcmp (ff, "content-length")) { | ||
| 1294 | - const char *e; | ||
| 1295 | - while (*value && isspace (*value)) | ||
| 1296 | - value++; | ||
| 1297 | - for (e = value; *e && *e != '\r' && *e != '\n'; e++) | ||
| 1298 | - ; | ||
| 1299 | - ss = (char *) malloc (e - value + 1); | ||
| 1300 | - strncpy (ss, value, e - value); | ||
| 1301 | - ss[e - value] = 0; | ||
| 1302 | - content_length = atoi(ss); | ||
| 1303 | - free (ss); | ||
| 1304 | - } | ||
| 1305 | - free (ff); | ||
| 1306 | - } | ||
| 1307 | - } | ||
| 1308 | - return (content_length); | ||
| 1309 | -} | ||
| 1310 | - | ||
| 1311 | char * | ||
| 1312 | prepend_slash (char *path) | ||
| 1313 | { | ||
| 1314 | @@ -799,13 +746,13 @@ check_http (void) | ||
| 1315 | char *pos; | ||
| 1316 | long microsec; | ||
| 1317 | double elapsed_time; | ||
| 1318 | - int page_len = 0; | ||
| 1319 | + int page_len = -1; | ||
| 1320 | int result = STATE_OK; | ||
| 1321 | http_parser_settings settings; | ||
| 1322 | http_parser parser; | ||
| 1323 | struct parser_data_t parser_data; | ||
| 1324 | struct header_data_t interesting_headers[] = | ||
| 1325 | - {{"location", 0}, {"date", 0}, {"last-modified", 0}, {0, 0}}; | ||
| 1326 | + {{"location", 0}, {"date", 0}, {"last-modified", 0}, {"content-length", 0}, {0, 0}}; | ||
| 1327 | |||
| 1328 | /* try to connect to the host at the given port number */ | ||
| 1329 | if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) | ||
| 1330 | @@ -1031,21 +978,21 @@ check_http (void) | ||
| 1331 | } | ||
| 1332 | } | ||
| 1333 | |||
| 1334 | - /* make sure the page is of an appropriate size */ | ||
| 1335 | - /* page_len = get_content_length(header); */ | ||
| 1336 | - /* FIXME: Will this work with -N ? IMHO we should use | ||
| 1337 | - * get_content_length(header) and always check if it's different than the | ||
| 1338 | - * returned pagesize | ||
| 1339 | - */ | ||
| 1340 | - /* FIXME: IIRC pagesize returns headers - shouldn't we make | ||
| 1341 | - * it == get_content_length(header) ?? | ||
| 1342 | - */ | ||
| 1343 | - page_len = pagesize; | ||
| 1344 | - if ((max_page_len > 0) && (page_len > max_page_len)) { | ||
| 1345 | - asprintf (&msg, _("%spage size %d too large, "), msg, page_len); | ||
| 1346 | - result = max_state_alt(STATE_WARNING, result); | ||
| 1347 | - } else if ((min_page_len > 0) && (page_len < min_page_len)) { | ||
| 1348 | - asprintf (&msg, _("%spage size %d too small, "), msg, page_len); | ||
| 1349 | + /* make sure the content is of an appropriate size */ | ||
| 1350 | + if (no_body) { | ||
| 1351 | + const char *content_length = get_value (parser_data.headers, "content-length"); | ||
| 1352 | + if (content_length) page_len = atol (content_length); | ||
| 1353 | + } else page_len = parser_data.current_length; | ||
| 1354 | + if (page_len != -1) { | ||
| 1355 | + if ((max_page_len > 0) && (page_len > max_page_len)) { | ||
| 1356 | + asprintf (&msg, _("%spage size %d too large, "), msg, page_len); | ||
| 1357 | + result = max_state_alt(STATE_WARNING, result); | ||
| 1358 | + } else if ((min_page_len > 0) && (page_len < min_page_len)) { | ||
| 1359 | + asprintf (&msg, _("%spage size %d too small, "), msg, page_len); | ||
| 1360 | + result = max_state_alt(STATE_WARNING, result); | ||
| 1361 | + } | ||
| 1362 | + } else if (max_page_len > 0 || min_page_len > 0) { | ||
| 1363 | + asprintf (&msg, _("%spage size unknown, "), msg); | ||
| 1364 | result = max_state_alt(STATE_WARNING, result); | ||
| 1365 | } | ||
| 1366 | |||
| 1367 | @@ -1058,7 +1005,7 @@ check_http (void) | ||
| 1368 | /* check elapsed time */ | ||
| 1369 | asprintf (&msg, | ||
| 1370 | _("%s - %d bytes in %.3f second response time %s|%s %s"), | ||
| 1371 | - msg, page_len, elapsed_time, | ||
| 1372 | + msg, pagesize, elapsed_time, | ||
| 1373 | (display_html ? "</A>" : ""), | ||
| 1374 | perfd_time (elapsed_time), perfd_size (page_len)); | ||
| 1375 | |||
| 1376 | @@ -1310,7 +1257,7 @@ print_help (void) | ||
| 1377 | printf (" %s\n", _("How to handle redirected pages. sticky is like follow but stick to the")); | ||
| 1378 | printf (" %s\n", _("specified IP address. stickyport also ensures port stays the same.")); | ||
| 1379 | printf (" %s\n", "-m, --pagesize=INTEGER<:INTEGER>"); | ||
| 1380 | - printf (" %s\n", _("Minimum page size required (bytes) : Maximum page size required (bytes)")); | ||
| 1381 | + printf (" %s\n", _("Minimum content size required (bytes) : Maximum content size required (bytes)")); | ||
| 1382 | |||
| 1383 | printf (UT_WARN_CRIT); | ||
| 1384 | |||
| 1385 | @@ -1361,7 +1308,7 @@ print_usage (void) | ||
| 1386 | printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L] [-a auth]\n"); | ||
| 1387 | printf (" [-b proxy_auth] [-f <ok|warning|critcal|follow|sticky|stickyport>]\n"); | ||
| 1388 | printf (" [-e <expect>] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n"); | ||
| 1389 | - printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); | ||
| 1390 | + printf (" [-P string] [-m <min_cnt_size>:<max_cnt_size>] [-4|-6] [-N] [-M <age>]\n"); | ||
| 1391 | printf (" [-A string] [-k string] [-S] [--sni] [-C <age>] [-T <content-type>]\n"); | ||
| 1392 | printf (" [-j method]\n"); | ||
| 1393 | } | ||
| 1394 | -- | ||
| 1395 | 1.7.2.5 | ||
| 1396 | |||
diff --git a/web/attachments/427640-nagios-plugins-openvz-beans.diff b/web/attachments/427640-nagios-plugins-openvz-beans.diff new file mode 100644 index 0000000..47a8f40 --- /dev/null +++ b/web/attachments/427640-nagios-plugins-openvz-beans.diff | |||
| @@ -0,0 +1,1771 @@ | |||
| 1 | diff -urN nothing/check_openvz_beans.py nagios-plugins-openvz-beans/check_openvz_beans.py | ||
| 2 | --- nothing/check_openvz_beans.py 1970-01-01 01:00:00.000000000 +0100 | ||
| 3 | +++ nagios-plugins-openvz-beans/check_openvz_beans.py 2011-11-01 19:04:11.133266362 +0100 | ||
| 4 | @@ -0,0 +1,589 @@ | ||
| 5 | +#!/usr/bin/python | ||
| 6 | +# | ||
| 7 | +# Nagios check for OpenVZ bean counters | ||
| 8 | +# | ||
| 9 | +# usage: | ||
| 10 | +# check_openvz_beans.py [options] | ||
| 11 | +# | ||
| 12 | +# see "check_openvz_beans.py -h" for detailed options | ||
| 13 | +# | ||
| 14 | +# Licensed under GPLv2 (or later) | ||
| 15 | +# | ||
| 16 | +# Copyright (C) 2011 NOKIA | ||
| 17 | +# Written by Andreas Kotes <andreas.kotes@nokia.com> | ||
| 18 | +# | ||
| 19 | +# Reviewed-by: Pascal Hahn <pascal.hahn@nokia.com> | ||
| 20 | +# Signed-Off-by: Pascal Hahn <pascal.hahn@nokia.com> | ||
| 21 | +# Signed-Off-by: Jessvin Thomas <jessvin.thomas@nokia.com> | ||
| 22 | +# | ||
| 23 | + | ||
| 24 | +import os | ||
| 25 | +import re | ||
| 26 | +import errno | ||
| 27 | +import sys | ||
| 28 | +import socket | ||
| 29 | + | ||
| 30 | +# using 'optparse' for Python 2.4 compatibility | ||
| 31 | +import optparse | ||
| 32 | +# using subprocess for clean sudo handling | ||
| 33 | +import subprocess | ||
| 34 | + | ||
| 35 | +__author__ = ('Andreas Kotes <andreas.kotes@nokia.com>') | ||
| 36 | + | ||
| 37 | +OPENVZ_CONFPATH = '/etc/vz/conf' | ||
| 38 | +OPENVZ_UBCSTORE = '/tmp/vzubc.store' | ||
| 39 | + | ||
| 40 | +class Error(Exception): | ||
| 41 | + """Module level error.""" | ||
| 42 | + pass | ||
| 43 | + | ||
| 44 | + | ||
| 45 | +class NoBeanCountersFoundError(Error): | ||
| 46 | + "No BeanCounters could be found in output.""" | ||
| 47 | + pass | ||
| 48 | + | ||
| 49 | + | ||
| 50 | +class BeanCounter(object): | ||
| 51 | + """Object storing OpenVZ beancounter information""" | ||
| 52 | + FIND_BEAN_COUNTER_RE = r'''(?xms) # verbose, multiline, special | ||
| 53 | + ^ # begin entry | ||
| 54 | + \s*(?P<resource>\S+) # resource name | ||
| 55 | + \s*(?P<held>\d+) # held count | ||
| 56 | + \s*(?P<maxheld>\d+) # maximum held | ||
| 57 | + \s*(?P<barrier>\d+) # barrier | ||
| 58 | + \s*(?P<limit>\d+) # limit | ||
| 59 | + \s*(?P<failcnt>\d+) # failure counter | ||
| 60 | + ''' | ||
| 61 | + def __init__(self, uid, resource_txt, use_absolute_failcnt=False, storepath=OPENVZ_UBCSTORE): | ||
| 62 | + """Create object storing OpenVZ beancounter information | ||
| 63 | + | ||
| 64 | + Args | ||
| 65 | + uid: int - OpenVZ context identifier | ||
| 66 | + resource_txt: str - OpenVZ resource | ||
| 67 | + use_absolute_failcnt: | ||
| 68 | + bool - Whether to use delta failcnts or not | ||
| 69 | + storepath: str - Path to OpenVZ's vzubc's data storage | ||
| 70 | + """ | ||
| 71 | + self.uid = uid | ||
| 72 | + | ||
| 73 | + # extract data from text line | ||
| 74 | + resourcedata = re.match(BeanCounter.FIND_BEAN_COUNTER_RE, resource_txt).groupdict() | ||
| 75 | + self.resource = resourcedata['resource'] | ||
| 76 | + self.held = int(resourcedata['held']) | ||
| 77 | + self.maxheld = int(resourcedata['maxheld']) | ||
| 78 | + self.barrier = int(resourcedata['barrier']) | ||
| 79 | + self.limit = int(resourcedata['limit']) | ||
| 80 | + self.failcnt = int(resourcedata['failcnt']) | ||
| 81 | + | ||
| 82 | + if not use_absolute_failcnt: | ||
| 83 | + prev_failcnt = self.read_vzubc_failcnt(storepath) | ||
| 84 | + # don't update from stale / lower value | ||
| 85 | + if (prev_failcnt <= self.failcnt): | ||
| 86 | + self.failcnt -= prev_failcnt | ||
| 87 | + | ||
| 88 | + def read_vzubc_failcnt(self, storepath=OPENVZ_UBCSTORE): | ||
| 89 | + """Read data stored by vzubc -r. | ||
| 90 | + | ||
| 91 | + Args | ||
| 92 | + uid: int - OpenVZ context identifier | ||
| 93 | + storepath: str - Path to OpenVZ's vzubc's data storage | ||
| 94 | + | ||
| 95 | + Returns: | ||
| 96 | + int - stored value or 0 | ||
| 97 | + """ | ||
| 98 | + filename = os.path.join(storepath, "ubc.%d.%s.failcnt" % (self.uid, self.resource)) | ||
| 99 | + if os.path.exists(filename): | ||
| 100 | + return int(open(filename, "r").read()) | ||
| 101 | + else: | ||
| 102 | + return 0 | ||
| 103 | + | ||
| 104 | + def __repr__(self): | ||
| 105 | + return ('<BeanCounter for uid %d resource %s: held %d maxheld %d barrier %d limit %d failcnt %d>' % | ||
| 106 | + (self.uid, self.resource, self.held, self.maxheld, self.barrier, self.limit, self.failcnt)) | ||
| 107 | + | ||
| 108 | + def __eq__(self, other): | ||
| 109 | + if (self.uid == other.uid and | ||
| 110 | + self.resource == other.resource and | ||
| 111 | + self.held == other.held and | ||
| 112 | + self.maxheld == other.maxheld and | ||
| 113 | + self.barrier == other.barrier and | ||
| 114 | + self.limit == other.limit and | ||
| 115 | + self.failcnt == other.failcnt): | ||
| 116 | + return True | ||
| 117 | + else: | ||
| 118 | + return False | ||
| 119 | + | ||
| 120 | + | ||
| 121 | +class BeanCounterParser(object): | ||
| 122 | + """Parse bean counter information.""" | ||
| 123 | + FIND_BEAN_COUNTER_GROUP_RE = r'''(?xms) # verbose, multline, special | ||
| 124 | + ^ # begin entry | ||
| 125 | + \s*(?P<uid>\d+): # group / context number | ||
| 126 | + (?P<beancounters>[^:]*)$ # everything up to next group/EOF | ||
| 127 | + ''' | ||
| 128 | + | ||
| 129 | + def parse_beancounters(self, beancounters_data, use_absolute_failcnt=False, storepath=OPENVZ_UBCSTORE): | ||
| 130 | + """Populate BeanCounter objects with data. | ||
| 131 | + | ||
| 132 | + Args: | ||
| 133 | + beancounters_data: str - containing the unparsed | ||
| 134 | + use_absolute_failcnt: | ||
| 135 | + bool - Whether to use delta failcnts or not | ||
| 136 | + storepath: str - Path to OpenVZ's vzubc's data storage | ||
| 137 | + | ||
| 138 | + Raises: | ||
| 139 | + NoBeanCountersFoundError - in case no counters where found | ||
| 140 | + """ | ||
| 141 | + # find all beans blocks | ||
| 142 | + result = re.findall(BeanCounterParser.FIND_BEAN_COUNTER_GROUP_RE, beancounters_data) | ||
| 143 | + if not result: | ||
| 144 | + raise NoBeanCountersFoundError | ||
| 145 | + self.beancounters = [] | ||
| 146 | + for uid, resource_txt in result: | ||
| 147 | + for line in resource_txt.split("\n"): | ||
| 148 | + if line: | ||
| 149 | + self.beancounters.append(BeanCounter(int(uid), line, use_absolute_failcnt, storepath)) | ||
| 150 | + return self.beancounters | ||
| 151 | + | ||
| 152 | + def __init__(self, beancounters_data, use_absolute_failcnt=False, storepath=OPENVZ_UBCSTORE): | ||
| 153 | + """Create a new BeanCounter object | ||
| 154 | + | ||
| 155 | + Args: | ||
| 156 | + beancounters_data: str - containing the unparsed | ||
| 157 | + contents of /proc/user_beancounters | ||
| 158 | + use_absolute_failcnt: | ||
| 159 | + bool - Whether to use delta failcnts or not | ||
| 160 | + storepath: str - Path to OpenVZ's vzubc's data storage | ||
| 161 | + """ | ||
| 162 | + self.parse_beancounters(beancounters_data, use_absolute_failcnt, storepath) | ||
| 163 | + | ||
| 164 | + def get_beancounters(self): | ||
| 165 | + return self.beancounters | ||
| 166 | + | ||
| 167 | + | ||
| 168 | +class BeanCounterThreshold(object): | ||
| 169 | + """Holds threshold values for BeanCounters""" | ||
| 170 | + THRESHOLD_KEYS = { | ||
| 171 | + # relevant threshold limiting in OpenVZ | ||
| 172 | + # see http://wiki.openvz.org/UBC_parameter_properties | ||
| 173 | + # NOTE: custom/missing beancounters are treated limited by limit | ||
| 174 | + 'limit' : ['lockedpages', 'numfile' , 'numiptent', 'numothersock', 'numproc', 'numpty', 'numsiginfo', 'numtcpsock', 'shmpages'], | ||
| 175 | + 'barrier': ['dcachesize', 'dgramrcvbuf', 'kmemsize', 'numflock', 'oomguarpages', 'othersockbuf', 'privvmpages', 'tcprcvbuf', 'tcpsndbuf', 'vmguarpages'], | ||
| 176 | + 'none' : ['physpages'] | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + def __init__(self, resource=None, critical=95, warning=90): | ||
| 180 | + """Create a new verifier. | ||
| 181 | + | ||
| 182 | + Args: | ||
| 183 | + resource: str - resource name (None = wildcard match all resources) | ||
| 184 | + critical: int - critical level (percentage of limit) | ||
| 185 | + warning: int - critical level (percentage of limit) | ||
| 186 | + """ | ||
| 187 | + self.resource = resource | ||
| 188 | + self.critical = critical | ||
| 189 | + self.warning = warning | ||
| 190 | + | ||
| 191 | + def __repr__(self): | ||
| 192 | + if not self.resource: | ||
| 193 | + resource = '*' | ||
| 194 | + else: | ||
| 195 | + resource = self.resource | ||
| 196 | + return ('<BeanCounterThreshold for resource %s: critical %d warning %d>' % | ||
| 197 | + (resource, self.critical, self.warning)) | ||
| 198 | + | ||
| 199 | + def check(self, beancounter, use_maxheld=False): | ||
| 200 | + """Check a threshold | ||
| 201 | + | ||
| 202 | + Args: | ||
| 203 | + beancounter: BeanCounter object | ||
| 204 | + use_maxheld: bool - use maxheld instead of held counter for limits | ||
| 205 | + | ||
| 206 | + Returns: | ||
| 207 | + None or BeanCounterViolation (or subclass) | ||
| 208 | + """ | ||
| 209 | + if not self.resource or beancounter.resource == self.resource: | ||
| 210 | + if beancounter.failcnt: | ||
| 211 | + return BeanCounterFailure(beancounter.resource, beancounter.uid, beancounter.failcnt) | ||
| 212 | + | ||
| 213 | + # what are we measuring against? | ||
| 214 | + if beancounter.resource in BeanCounterThreshold.THRESHOLD_KEYS['barrier']: | ||
| 215 | + quota = beancounter.barrier | ||
| 216 | + else: | ||
| 217 | + quota = beancounter.limit | ||
| 218 | + | ||
| 219 | + # what are we measuring? | ||
| 220 | + if use_maxheld: | ||
| 221 | + value = beancounter.maxheld | ||
| 222 | + else: | ||
| 223 | + value = beancounter.held | ||
| 224 | + | ||
| 225 | + if value > quota: | ||
| 226 | + return BeanCounterOvershoot(beancounter.resource, beancounter.uid, value - quota) | ||
| 227 | + | ||
| 228 | + # check for critical / warning by comparing our value with the relevant | ||
| 229 | + # percentage of our quota. return an object with information how much | ||
| 230 | + # over quota we are. | ||
| 231 | + if quota and self.critical >= 0 and value >= (quota * (float(self.critical)/100)): | ||
| 232 | + return BeanCounterCritical(beancounter.resource, beancounter.uid, value - int((quota * (float(self.critical)/100)))) | ||
| 233 | + if quota and self.warning >= 0 and value >= (quota * (float(self.warning)/100)): | ||
| 234 | + return BeanCounterWarning(beancounter.resource, beancounter.uid, value - int((quota * (float(self.warning)/100)))) | ||
| 235 | + return None | ||
| 236 | + | ||
| 237 | + | ||
| 238 | +class BeanCounterViolation(object): | ||
| 239 | + """Alert containing a BeanCounter violation.""" | ||
| 240 | + def __init__(self, resource, uid, excess): | ||
| 241 | + """Create a new BeanCounter violation. | ||
| 242 | + | ||
| 243 | + Args: | ||
| 244 | + resource: str - resource name | ||
| 245 | + uid: int - context uid | ||
| 246 | + excess: int - how much the limit was exceeded | ||
| 247 | + """ | ||
| 248 | + self.tag = 'VIOL' | ||
| 249 | + self.resource = resource | ||
| 250 | + self.uid = uid | ||
| 251 | + self.excess = excess | ||
| 252 | + | ||
| 253 | + def __repr__(self): | ||
| 254 | + return ('<%s %s: resource %s in context %d by %d>' % | ||
| 255 | + (self.__class__.__name__, self.tag, self.resource, self.uid, self.excess)) | ||
| 256 | + | ||
| 257 | + | ||
| 258 | +class BeanCounterFailure(BeanCounterViolation): | ||
| 259 | + """Alert containing a BeanCounter failure.""" | ||
| 260 | + def __init__(self, resource, uid, excess): | ||
| 261 | + """Create a new BeanCounter failure. | ||
| 262 | + | ||
| 263 | + Args: | ||
| 264 | + resource: str - resource name | ||
| 265 | + uid: int - context uid | ||
| 266 | + excess: int - how much the limit was exceeded | ||
| 267 | + """ | ||
| 268 | + super(BeanCounterFailure, self).__init__(resource, uid, excess) | ||
| 269 | + self.tag = 'FAIL' | ||
| 270 | + | ||
| 271 | + | ||
| 272 | +class BeanCounterOvershoot(BeanCounterViolation): | ||
| 273 | + """Alert containing a BeanCounter overshoot.""" | ||
| 274 | + def __init__(self, resource, uid, excess): | ||
| 275 | + """Create a new BeanCounter overshoot. | ||
| 276 | + | ||
| 277 | + Args: | ||
| 278 | + resource: str - resource name | ||
| 279 | + uid: int - context uid | ||
| 280 | + excess: int - how much the limit was exceeded | ||
| 281 | + """ | ||
| 282 | + super(BeanCounterOvershoot, self).__init__(resource, uid, excess) | ||
| 283 | + self.tag = 'OVER' | ||
| 284 | + | ||
| 285 | + | ||
| 286 | +class BeanCounterCritical(BeanCounterViolation): | ||
| 287 | + """Alert containing a BeanCounter critical.""" | ||
| 288 | + def __init__(self, resource, uid, excess): | ||
| 289 | + """Create a new BeanCounter critical alert | ||
| 290 | + | ||
| 291 | + Args: | ||
| 292 | + resource: str - resource name | ||
| 293 | + uid: int - context uid | ||
| 294 | + excess: int - how much the limit was exceeded | ||
| 295 | + """ | ||
| 296 | + super(BeanCounterCritical, self).__init__(resource, uid, excess) | ||
| 297 | + self.tag = 'CRIT' | ||
| 298 | + | ||
| 299 | + | ||
| 300 | +class BeanCounterWarning(BeanCounterViolation): | ||
| 301 | + """Alert containing a BeanCounter warning.""" | ||
| 302 | + def __init__(self, resource, uid, excess): | ||
| 303 | + """Create a new BeanCounter warning alert | ||
| 304 | + | ||
| 305 | + Args: | ||
| 306 | + resource: str - resource name | ||
| 307 | + uid: int - context uid | ||
| 308 | + excess: int - how much the limit was exceeded | ||
| 309 | + """ | ||
| 310 | + super(BeanCounterWarning, self).__init__(resource, uid, excess) | ||
| 311 | + self.tag = 'WARN' | ||
| 312 | + | ||
| 313 | + | ||
| 314 | +class BeanCounterVerifier(object): | ||
| 315 | + """Verifier wrapper for bean counters.""" | ||
| 316 | + def __init__(self, options): | ||
| 317 | + """Create a new set of verifiers | ||
| 318 | + | ||
| 319 | + Args: | ||
| 320 | + options: optparse.Values, options used: | ||
| 321 | + warning: int - generic warning level | ||
| 322 | + critical: int - generic critical level | ||
| 323 | + res_warning: dict - resource name:int level | ||
| 324 | + res_critical: dict - resource name:int level | ||
| 325 | + """ | ||
| 326 | + # add common thresholds | ||
| 327 | + self.thresholds = [BeanCounterThreshold(None, options.critical, options.warning)] | ||
| 328 | + for resource, level in options.res_warning.items(): | ||
| 329 | + # has both critical and warning values? | ||
| 330 | + if resource in options.res_critical: | ||
| 331 | + self.thresholds.append(BeanCounterThreshold(resource, options.res_critical[resource], level)) | ||
| 332 | + else: | ||
| 333 | + self.thresholds.append(BeanCounterThreshold(resource, -1, level)) | ||
| 334 | + for resource, level in options.res_critical.iteritems(): | ||
| 335 | + # already defined during warning value loop? | ||
| 336 | + if not resource in options.res_warning: | ||
| 337 | + self.thresholds.append(BeanCounterThreshold(resource, level, -1)) | ||
| 338 | + | ||
| 339 | + def verify(self, beancounters, use_maxheld=False): | ||
| 340 | + """Verify BeanCounters | ||
| 341 | + | ||
| 342 | + Args: | ||
| 343 | + beancounters: list of BeanCounters | ||
| 344 | + use_maxheld: bool - use maxheld instead of held counter for limits | ||
| 345 | + | ||
| 346 | + Returns: | ||
| 347 | + list of lists (see BeanCounterThreshold.check) | ||
| 348 | + """ | ||
| 349 | + results = [] | ||
| 350 | + for beancounter in beancounters: | ||
| 351 | + for threshold in self.thresholds: | ||
| 352 | + result = threshold.check(beancounter, use_maxheld) | ||
| 353 | + if result: | ||
| 354 | + results.append(result) | ||
| 355 | + return results | ||
| 356 | + | ||
| 357 | + | ||
| 358 | +def shorten_hostname(hostname, parts=2): | ||
| 359 | + """Shorten hostname by taking only certain parts from the beginning of it. | ||
| 360 | + | ||
| 361 | + Args: | ||
| 362 | + hostname: str - FQDN | ||
| 363 | + parts: int - number of parts to keep | ||
| 364 | + """ | ||
| 365 | + # return at least the hostname | ||
| 366 | + if (parts < 1): | ||
| 367 | + parts = 1 | ||
| 368 | + if hostname: | ||
| 369 | + return '.'.join(hostname.split('.')[:parts]) | ||
| 370 | + return None | ||
| 371 | + | ||
| 372 | + | ||
| 373 | +def get_vm_hostname(uid, confpath=OPENVZ_CONFPATH): | ||
| 374 | + """Get hostname for a vm by getting the hostname from config file | ||
| 375 | + | ||
| 376 | + Args: | ||
| 377 | + uid: int - uid / container context number of vm | ||
| 378 | + confpath: str - folder in which to find <uid>.conf | ||
| 379 | + | ||
| 380 | + Returns: | ||
| 381 | + str: FQDN as configured, or None | ||
| 382 | + """ | ||
| 383 | + try: | ||
| 384 | + result = re.search(r'HOSTNAME="(.*)"', open(confpath+"/"+str(uid)+".conf", "r").read()) | ||
| 385 | + if result: | ||
| 386 | + return result.group(1) | ||
| 387 | + except IOError: | ||
| 388 | + return None | ||
| 389 | + | ||
| 390 | + | ||
| 391 | +def get_local_fqdn(): | ||
| 392 | + """Get local hostname.""" | ||
| 393 | + return socket.gethostname() | ||
| 394 | + | ||
| 395 | + | ||
| 396 | +def get_hostname(uid, confpath=OPENVZ_CONFPATH, parts=2): | ||
| 397 | + """Get and shorten OpenVZ vm hostname | ||
| 398 | + | ||
| 399 | + Args: | ||
| 400 | + uid: ints - uid / container context number | ||
| 401 | + confpath: str - folder in which to find <uid>.conf | ||
| 402 | + parts: int - number of hostname parts to return | ||
| 403 | + | ||
| 404 | + Returns: | ||
| 405 | + str: hostname | ||
| 406 | + """ | ||
| 407 | + # the hypervisor itself, or a VM -> use local hostname | ||
| 408 | + # NOTE: this assumes a correct confpath and non-existence of it on VMs. | ||
| 409 | + if uid == 0 or not os.path.exists(confpath): | ||
| 410 | + hostname = get_local_fqdn() | ||
| 411 | + else: | ||
| 412 | + hostname = get_vm_hostname(uid, confpath) | ||
| 413 | + # drop ending domain parts of FQDN | ||
| 414 | + return shorten_hostname(hostname, parts) | ||
| 415 | + | ||
| 416 | + | ||
| 417 | +def read_data(options): | ||
| 418 | + """Read OpenVZ counter data from system | ||
| 419 | + | ||
| 420 | + Args: | ||
| 421 | + options: optparse object: | ||
| 422 | + sudo: bool - use sudo to read file or not | ||
| 423 | + filename: str - filename to read | ||
| 424 | + | ||
| 425 | + Return: | ||
| 426 | + str: verbatim file contents | ||
| 427 | + | ||
| 428 | + Sideeffects: | ||
| 429 | + May exit to system directly. | ||
| 430 | + """ | ||
| 431 | + # read into a string directly, or with a "sudo cat" | ||
| 432 | + if not options.sudo: | ||
| 433 | + try: | ||
| 434 | + data = open(options.filename, "r").read() | ||
| 435 | + except IOError, (errorcode, errorstr): | ||
| 436 | + # file not found? not an OpenVZ system! | ||
| 437 | + if (errorcode == errno.ENOENT): | ||
| 438 | + print "OK: Not an OpenVZ system, no need to worry about beancounters." | ||
| 439 | + sys.exit(0) | ||
| 440 | + elif (errorcode == errno.EACCES): | ||
| 441 | + print "UNKNOWN: Not permitted to read beancounter information." | ||
| 442 | + sys.exit(3) | ||
| 443 | + else: | ||
| 444 | + print "CRITICAL: Unknown problem reading beancounters." | ||
| 445 | + sys.exit(2) | ||
| 446 | + else: | ||
| 447 | + # call a non-interactive sudo to read the file | ||
| 448 | + # needs to be configured via e.g. /etc/sudoers | ||
| 449 | + try: | ||
| 450 | + data = subprocess.Popen(["/usr/bin/sudo", "-n", "cat", options.filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0] | ||
| 451 | + except OSError, (errorcode, errorstr): | ||
| 452 | + print "CRITICAL: Can't execute sudo to read beancounters. (%d - %s)" % (errorcode, errorstr) | ||
| 453 | + sys.exit(2) | ||
| 454 | + if not data: | ||
| 455 | + print "CRITICAL: Trying to read beancounters with sudo didn't yield data." | ||
| 456 | + sys.exit(2) | ||
| 457 | + return data | ||
| 458 | + | ||
| 459 | + | ||
| 460 | +def create_optionsparser(): | ||
| 461 | + """Create optparse.OptionParser object for us | ||
| 462 | + | ||
| 463 | + Returns: | ||
| 464 | + optparse.OptionParser object | ||
| 465 | + """ | ||
| 466 | + usage = "usage: %prog [options]" | ||
| 467 | + parser = optparse.OptionParser(usage=usage, option_class=ExtOption) | ||
| 468 | + parser.add_option("-w", "--warning", dest="warning", default=90, | ||
| 469 | + action="store_int", help="default warning threshold percentage for everything (default: %default)") | ||
| 470 | + parser.add_option("-c", "--critical", dest="critical", default=95, | ||
| 471 | + action="store_int", help="default critical threshold percentage for everything (default: %default)") | ||
| 472 | + parser.add_option("-W", "--resource-warning", dest="res_warning", default={}, | ||
| 473 | + action="keyvalgroup", help="resource specific warning percentage (e.g. foo:50,bar:60)") | ||
| 474 | + parser.add_option("-C", "--resource-critical", dest="res_critical", default={}, | ||
| 475 | + action="keyvalgroup", help="resource-specific critical percentage (e.g. foo:90,bar:95)") | ||
| 476 | + parser.add_option("-f", "--file", dest="filename", default='/proc/user_beancounters', | ||
| 477 | + action="store", help="read beancounters from file (default: %default)") | ||
| 478 | + parser.add_option("-s", "--sudo", dest="sudo", default=False, | ||
| 479 | + action="store_true", help="use 'sudo cat filename' to read file as root (filename see -f)") | ||
| 480 | + parser.add_option("-p", "--configs", dest="confpath", default=OPENVZ_CONFPATH, | ||
| 481 | + action="store", help="path for OpenVZ config path (to get hostnames, default: %default)") | ||
| 482 | + parser.add_option("-d", "--domainparts", dest="domainparts", default=2, | ||
| 483 | + action="store_int", help="how many domain parts of the hostname to keep (default: %default)") | ||
| 484 | + parser.add_option("-u", "--ubc-store-path", dest="storepath", default=OPENVZ_UBCSTORE, | ||
| 485 | + action="store", help="path for vzubc relative information (default: %default)") | ||
| 486 | + parser.add_option("-m", "--use-maxheld", dest="use_maxheld", default=False, | ||
| 487 | + action="store_true", help="use resource's maxheld instead of current_held (default: %default)") | ||
| 488 | + parser.add_option("-a", "--absolute-fails", dest="use_absolute_failcnt", default=False, | ||
| 489 | + action="store_true", help="don't use vzubc's relative fail counters (default: %default)") | ||
| 490 | + return parser | ||
| 491 | + | ||
| 492 | + | ||
| 493 | +class ExtOption(optparse.Option): | ||
| 494 | + """Specialized Option class which parses key:val,key:val parameters and integers | ||
| 495 | + See optparse documentation for detailed explanation of how this works.""" | ||
| 496 | + ACTIONS = optparse.Option.ACTIONS + ("keyvalgroup", "store_int",) | ||
| 497 | + STORE_ACTIONS = optparse.Option.STORE_ACTIONS + ("keyvalgroup", "store_int",) | ||
| 498 | + TYPED_ACTIONS = optparse.Option.TYPED_ACTIONS + ("keyvalgroup", "store_int",) | ||
| 499 | + ALWAYS_TYPED_ACTIONS = optparse.Option.ALWAYS_TYPED_ACTIONS + ("keyvalgroup", "store_int",) | ||
| 500 | + | ||
| 501 | + def take_action(self, action, dest, opt, value, values, parser): | ||
| 502 | + if action == "keyvalgroup": | ||
| 503 | + keyvals = value.split(",") | ||
| 504 | + for keyval in keyvals: | ||
| 505 | + key, val = keyval.split(":") | ||
| 506 | + if re.match(r'\d+', val): | ||
| 507 | + val = int(val) | ||
| 508 | + values.ensure_value(dest, {}).update({key:val}) | ||
| 509 | + elif action == "store_int": | ||
| 510 | + setattr(values, dest, int(value)) | ||
| 511 | + else: | ||
| 512 | + optparse.Option.take_action(self, action, dest, opt, value, values, parser) | ||
| 513 | + | ||
| 514 | + | ||
| 515 | +def __main__(): | ||
| 516 | + optionsparser = create_optionsparser() | ||
| 517 | + # args parsing will exit the program if options are used wrong or help is | ||
| 518 | + # requested. optionsparser.error exists to system as well - we call it when | ||
| 519 | + # extra arguments are given. none are expected, we use options only. | ||
| 520 | + options, args = optionsparser.parse_args() | ||
| 521 | + if args: | ||
| 522 | + optionsparser.error("incorrect number of arguments") | ||
| 523 | + | ||
| 524 | + # NOTE: read_data itself may exit to system in some cases | ||
| 525 | + data = read_data(options) | ||
| 526 | + if not data: | ||
| 527 | + print "CRITICAL: No data given while reading beancounters." | ||
| 528 | + sys.exit(2) | ||
| 529 | + | ||
| 530 | + # parse beancounters, create verifiers, verify beancounters | ||
| 531 | + try: | ||
| 532 | + beancounterparser = BeanCounterParser(data, options.use_absolute_failcnt, options.storepath) | ||
| 533 | + except NoBeanCountersFoundError: | ||
| 534 | + print "CRITICAL: No beancounters found in data read." | ||
| 535 | + sys.exit(2) | ||
| 536 | + | ||
| 537 | + beancounterverifier = BeanCounterVerifier(options) | ||
| 538 | + beancounteralerts = beancounterverifier.verify(beancounterparser.get_beancounters(), options.use_maxheld) | ||
| 539 | + | ||
| 540 | + # find uids and combine alert groups | ||
| 541 | + fail = {} | ||
| 542 | + over = {} | ||
| 543 | + crit = {} | ||
| 544 | + warn = {} | ||
| 545 | + for alert in beancounteralerts: | ||
| 546 | + if isinstance (alert, BeanCounterFailure): | ||
| 547 | + fail.setdefault(alert.uid, {}) | ||
| 548 | + fail[alert.uid][alert.resource] = alert.excess | ||
| 549 | + elif isinstance (alert, BeanCounterOvershoot): | ||
| 550 | + over.setdefault(alert.uid, {}) | ||
| 551 | + over[alert.uid][alert.resource] = alert.excess | ||
| 552 | + elif isinstance (alert, BeanCounterCritical): | ||
| 553 | + crit.setdefault(alert.uid, {}) | ||
| 554 | + crit[alert.uid][alert.resource] = alert.excess | ||
| 555 | + elif isinstance (alert, BeanCounterWarning): | ||
| 556 | + warn.setdefault(alert.uid, {}) | ||
| 557 | + warn[alert.uid][alert.resource] = alert.excess | ||
| 558 | + | ||
| 559 | + # default message & exitcode if everything is fine | ||
| 560 | + message = "OK: all beancounters below configured thresholds" | ||
| 561 | + perfdata = "" | ||
| 562 | + exitcode = 0 | ||
| 563 | + | ||
| 564 | + # set message prefix and errocode accordingly | ||
| 565 | + if fail or over or crit: | ||
| 566 | + message = "CRITICAL:" | ||
| 567 | + exitcode = 2 | ||
| 568 | + elif warn: | ||
| 569 | + message = "WARNING:" | ||
| 570 | + exitcode = 1 | ||
| 571 | + | ||
| 572 | + # combine specific Nagios message(s) | ||
| 573 | + for level, tag in (fail, 'FAIL'), (over, 'OVER'), (crit, 'CRIT'), (warn, 'WARN'): | ||
| 574 | + if level: | ||
| 575 | + message += " %s:" % tag | ||
| 576 | + perfdata += " %s:" % tag | ||
| 577 | + for uid, counters in level.items(): | ||
| 578 | + hostname = get_hostname(uid, options.confpath, options.domainparts) | ||
| 579 | + message += " %s(%d)" % (hostname, uid) | ||
| 580 | + perfdata += " HOST %s(%d):" % (hostname, uid) | ||
| 581 | + for resource, counter in counters.items(): | ||
| 582 | + perfdata += " %s(+%d)" % (resource, counter) | ||
| 583 | + | ||
| 584 | + # output message & exit | ||
| 585 | + if len(perfdata): | ||
| 586 | + print "%s|%s" % (message, perfdata) | ||
| 587 | + else: | ||
| 588 | + print message | ||
| 589 | + sys.exit(exitcode) | ||
| 590 | + | ||
| 591 | + | ||
| 592 | +if __name__ == "__main__": | ||
| 593 | + __main__() | ||
| 594 | Binary files nothing/check_openvz_beans.pyc and nagios-plugins-openvz-beans/check_openvz_beans.pyc differ | ||
| 595 | diff -urN nothing/check_openvz_beans-test.py nagios-plugins-openvz-beans/check_openvz_beans-test.py | ||
| 596 | --- nothing/check_openvz_beans-test.py 1970-01-01 01:00:00.000000000 +0100 | ||
| 597 | +++ nagios-plugins-openvz-beans/check_openvz_beans-test.py 2011-11-01 18:28:47.867345265 +0100 | ||
| 598 | @@ -0,0 +1,775 @@ | ||
| 599 | +#!/usr/bin/python | ||
| 600 | +"""check_openvz_beans unit tests.""" | ||
| 601 | + | ||
| 602 | +__author__ = 'Andreas Kotes <andreas.kotes@nokia.com>' | ||
| 603 | + | ||
| 604 | +import __builtin__ | ||
| 605 | +import os | ||
| 606 | +import sys | ||
| 607 | +import unittest | ||
| 608 | +import mox | ||
| 609 | +import optparse | ||
| 610 | +import StringIO | ||
| 611 | +import subprocess | ||
| 612 | +import check_openvz_beans | ||
| 613 | + | ||
| 614 | +class BeanCounterTest(mox.MoxTestBase): | ||
| 615 | + """Test the BeanCounter class.""" | ||
| 616 | + def testCreate(self): | ||
| 617 | + beancounter = check_openvz_beans.BeanCounter(123, "dummy 1 2 3 4 5") | ||
| 618 | + self.assertEquals(beancounter.uid, 123) | ||
| 619 | + self.assertEquals(beancounter.resource, 'dummy') | ||
| 620 | + self.assertEquals(beancounter.held, 1) | ||
| 621 | + self.assertEquals(beancounter.maxheld, 2) | ||
| 622 | + self.assertEquals(beancounter.barrier, 3) | ||
| 623 | + self.assertEquals(beancounter.limit, 4) | ||
| 624 | + self.assertEquals(beancounter.failcnt, 5) | ||
| 625 | + self.assertEquals(beancounter.__repr__(), | ||
| 626 | + '<BeanCounter for uid 123 resource dummy: held 1 maxheld 2 barrier 3 limit 4 failcnt 5>') | ||
| 627 | + self.assertTrue(beancounter == check_openvz_beans.BeanCounter(123, "dummy 1 2 3 4 5")) | ||
| 628 | + self.assertFalse(beancounter == check_openvz_beans.BeanCounter(124, "dummy 1 2 3 4 5")) | ||
| 629 | + self.assertFalse(beancounter == check_openvz_beans.BeanCounter(123, "yummy 1 2 3 4 5")) | ||
| 630 | + self.assertFalse(beancounter == check_openvz_beans.BeanCounter(123, "dummy 2 2 3 4 5")) | ||
| 631 | + self.assertFalse(beancounter == check_openvz_beans.BeanCounter(123, "dummy 1 3 3 4 5")) | ||
| 632 | + self.assertFalse(beancounter == check_openvz_beans.BeanCounter(123, "dummy 1 2 4 4 5")) | ||
| 633 | + self.assertFalse(beancounter == check_openvz_beans.BeanCounter(123, "dummy 1 2 3 5 5")) | ||
| 634 | + self.assertFalse(beancounter == check_openvz_beans.BeanCounter(123, "dummy 1 2 3 4 6")) | ||
| 635 | + | ||
| 636 | + | ||
| 637 | +class BeanCounterParserTest(mox.MoxTestBase): | ||
| 638 | + """Test the BeanCounterParser class.""" | ||
| 639 | + def setUp(self): | ||
| 640 | + super(BeanCounterParserTest, self).setUp() | ||
| 641 | + | ||
| 642 | + def test_init_and_parsebeancounters(self): | ||
| 643 | + beancounters = check_openvz_beans.BeanCounterParser("123: dummy1 1 2 3 4 5\n dummy2 54 63 62 13 53\n234: dummy3 9 8 7 6 5\n") | ||
| 644 | + self.assertEquals(beancounters.get_beancounters(), [ | ||
| 645 | + check_openvz_beans.BeanCounter(123, ' dummy1 1 2 3 4 5'), | ||
| 646 | + check_openvz_beans.BeanCounter(123, ' dummy2 54 63 62 13 53'), | ||
| 647 | + check_openvz_beans.BeanCounter(234, ' dummy3 9 8 7 6 5')]) | ||
| 648 | + | ||
| 649 | + def test_parsefail(self): | ||
| 650 | + # FIXME: check the Exception value. assertRaisesRegexp() is only available in Python unittest 2.7+ | ||
| 651 | + self.assertRaises(check_openvz_beans.NoBeanCountersFoundError, check_openvz_beans.BeanCounterParser, "nonsense") | ||
| 652 | + | ||
| 653 | + | ||
| 654 | +class BeanCounterThresholdTest(mox.MoxTestBase): | ||
| 655 | + """Test the BeanCounterThreshold class.""" | ||
| 656 | + def setUp(self): | ||
| 657 | + super(BeanCounterThresholdTest, self).setUp() | ||
| 658 | + # Mock BeanCounters | ||
| 659 | + self.beancounter_mock = self.mox.CreateMock(check_openvz_beans.BeanCounter) | ||
| 660 | + self.beancounter_mock.uid = 123 | ||
| 661 | + self.beancounter_mock.failcnt = 0 | ||
| 662 | + | ||
| 663 | + def testCreateSimple(self): | ||
| 664 | + threshold = check_openvz_beans.BeanCounterThreshold() | ||
| 665 | + self.assertEquals(threshold.resource, None) | ||
| 666 | + self.assertEquals(threshold.critical, 95) | ||
| 667 | + self.assertEquals(threshold.warning, 90) | ||
| 668 | + self.assertEquals(threshold.__repr__(), | ||
| 669 | + '<BeanCounterThreshold for resource *: critical 95 warning 90>') | ||
| 670 | + | ||
| 671 | + def testCreateCustom(self): | ||
| 672 | + threshold = check_openvz_beans.BeanCounterThreshold('dummy', 70, 60) | ||
| 673 | + self.assertEquals(threshold.resource, 'dummy') | ||
| 674 | + self.assertEquals(threshold.critical, 70) | ||
| 675 | + self.assertEquals(threshold.warning, 60) | ||
| 676 | + self.assertEquals(threshold.__repr__(), | ||
| 677 | + '<BeanCounterThreshold for resource dummy: critical 70 warning 60>') | ||
| 678 | + | ||
| 679 | + def testCheckSimpleOkay(self): | ||
| 680 | + self.beancounter_mock.resource = 'dummy_okay' | ||
| 681 | + self.beancounter_mock.held = 1 | ||
| 682 | + self.beancounter_mock.maxheld = 2 | ||
| 683 | + self.beancounter_mock.barrier = 3 | ||
| 684 | + self.beancounter_mock.limit = 4 | ||
| 685 | + threshold = check_openvz_beans.BeanCounterThreshold() | ||
| 686 | + self.assertFalse(threshold.check(self.beancounter_mock)) | ||
| 687 | + | ||
| 688 | + def testCheckSimpleOkayNegWarn(self): | ||
| 689 | + self.beancounter_mock.resource = 'dummy_okay' | ||
| 690 | + self.beancounter_mock.held = 1 | ||
| 691 | + self.beancounter_mock.maxheld = 2 | ||
| 692 | + self.beancounter_mock.barrier = 3 | ||
| 693 | + self.beancounter_mock.limit = 4 | ||
| 694 | + threshold = check_openvz_beans.BeanCounterThreshold(warning=-1) | ||
| 695 | + self.assertEqual(threshold.check(self.beancounter_mock), None) | ||
| 696 | + | ||
| 697 | + def testCheckSimpleOkayNegCrit(self): | ||
| 698 | + self.beancounter_mock.resource = 'dummy_okay' | ||
| 699 | + self.beancounter_mock.held = 1 | ||
| 700 | + self.beancounter_mock.maxheld = 2 | ||
| 701 | + self.beancounter_mock.barrier = 3 | ||
| 702 | + self.beancounter_mock.limit = 4 | ||
| 703 | + threshold = check_openvz_beans.BeanCounterThreshold(critical=-1) | ||
| 704 | + self.assertEqual(threshold.check(self.beancounter_mock), None) | ||
| 705 | + | ||
| 706 | + def testCheckSimpleFail(self): | ||
| 707 | + # failcnt engaged | ||
| 708 | + self.beancounter_mock.resource = 'dummy_fail' | ||
| 709 | + self.beancounter_mock.held = 1 | ||
| 710 | + self.beancounter_mock.maxheld = 2 | ||
| 711 | + self.beancounter_mock.barrier = 3 | ||
| 712 | + self.beancounter_mock.limit = 4 | ||
| 713 | + self.beancounter_mock.failcnt = 1 | ||
| 714 | + threshold = check_openvz_beans.BeanCounterThreshold() | ||
| 715 | + result = threshold.check(self.beancounter_mock) | ||
| 716 | + self.assertTrue(result) | ||
| 717 | + self.assertEquals(result.tag, 'FAIL') | ||
| 718 | + | ||
| 719 | + def testCheckSimpleEqual(self): | ||
| 720 | + # eq Limit | ||
| 721 | + self.beancounter_mock.resource = 'dummy_equal' | ||
| 722 | + self.beancounter_mock.held = 50 | ||
| 723 | + self.beancounter_mock.maxheld = 100 | ||
| 724 | + self.beancounter_mock.barrier = 100 | ||
| 725 | + self.beancounter_mock.limit = 100 | ||
| 726 | + threshold = check_openvz_beans.BeanCounterThreshold(critical=101, warning=101) | ||
| 727 | + self.assertFalse(threshold.check(self.beancounter_mock)) | ||
| 728 | + | ||
| 729 | + def testCheckSimpleOverGt(self): | ||
| 730 | + # over Limit | ||
| 731 | + self.beancounter_mock.resource = 'dummy_over' | ||
| 732 | + self.beancounter_mock.held = 4 | ||
| 733 | + self.beancounter_mock.maxheld = 4 | ||
| 734 | + self.beancounter_mock.barrier = 3 | ||
| 735 | + self.beancounter_mock.limit = 3 | ||
| 736 | + threshold = check_openvz_beans.BeanCounterThreshold() | ||
| 737 | + result = threshold.check(self.beancounter_mock) | ||
| 738 | + self.assertTrue(result) | ||
| 739 | + self.assertEquals(result.tag, 'OVER') | ||
| 740 | + | ||
| 741 | + def testCheckSimpleCritEq(self): | ||
| 742 | + # eq critical value | ||
| 743 | + self.beancounter_mock.resource = 'dummy_crit_eq' | ||
| 744 | + self.beancounter_mock.held = 95 | ||
| 745 | + self.beancounter_mock.maxheld = 95 | ||
| 746 | + self.beancounter_mock.barrier = 100 | ||
| 747 | + self.beancounter_mock.limit = 100 | ||
| 748 | + threshold = check_openvz_beans.BeanCounterThreshold() | ||
| 749 | + result = threshold.check(self.beancounter_mock) | ||
| 750 | + self.assertTrue(result) | ||
| 751 | + self.assertEquals(result.tag, 'CRIT') | ||
| 752 | + | ||
| 753 | + def testCheckSimpleCritGt(self): | ||
| 754 | + # gt critical value | ||
| 755 | + self.beancounter_mock.resource = 'dummy_crit_gt' | ||
| 756 | + self.beancounter_mock.held = 96 | ||
| 757 | + self.beancounter_mock.maxheld = 96 | ||
| 758 | + self.beancounter_mock.barrier = 100 | ||
| 759 | + self.beancounter_mock.limit = 100 | ||
| 760 | + threshold = check_openvz_beans.BeanCounterThreshold() | ||
| 761 | + result = threshold.check(self.beancounter_mock) | ||
| 762 | + self.assertTrue(result) | ||
| 763 | + self.assertEquals(result.tag, 'CRIT') | ||
| 764 | + | ||
| 765 | + def testCheckSimpleWarnEq(self): | ||
| 766 | + # eq warning value | ||
| 767 | + self.beancounter_mock.resource = 'dummy_warn_eq' | ||
| 768 | + self.beancounter_mock.held = 90 | ||
| 769 | + self.beancounter_mock.maxheld = 90 | ||
| 770 | + self.beancounter_mock.barrier = 100 | ||
| 771 | + self.beancounter_mock.limit = 100 | ||
| 772 | + threshold = check_openvz_beans.BeanCounterThreshold() | ||
| 773 | + result = threshold.check(self.beancounter_mock) | ||
| 774 | + self.assertTrue(result) | ||
| 775 | + self.assertEquals(result.tag, 'WARN') | ||
| 776 | + | ||
| 777 | + def testCheckSimpleWarnGt(self): | ||
| 778 | + # gt warning value | ||
| 779 | + self.beancounter_mock.resource = 'dummy_warn_gt' | ||
| 780 | + self.beancounter_mock.held = 91 | ||
| 781 | + self.beancounter_mock.maxheld = 91 | ||
| 782 | + self.beancounter_mock.barrier = 100 | ||
| 783 | + self.beancounter_mock.limit = 100 | ||
| 784 | + threshold = check_openvz_beans.BeanCounterThreshold() | ||
| 785 | + result = threshold.check(self.beancounter_mock) | ||
| 786 | + self.assertTrue(result) | ||
| 787 | + self.assertEquals(result.tag, 'WARN') | ||
| 788 | + | ||
| 789 | + def testCheckBarrierQuota(self): | ||
| 790 | + # limited by barrier -> would not warn if limited by limit | ||
| 791 | + self.beancounter_mock.resource = 'numflock' | ||
| 792 | + self.beancounter_mock.held = 45 | ||
| 793 | + self.beancounter_mock.maxheld = 45 | ||
| 794 | + self.beancounter_mock.barrier = 50 | ||
| 795 | + self.beancounter_mock.limit = 100 | ||
| 796 | + threshold = check_openvz_beans.BeanCounterThreshold() | ||
| 797 | + result = threshold.check(self.beancounter_mock) | ||
| 798 | + self.assertTrue(result) | ||
| 799 | + self.assertEquals(result.tag, 'WARN') | ||
| 800 | + | ||
| 801 | + def testCheckLimitQuota(self): | ||
| 802 | + # limited by limit -> would be over if limited by barrier | ||
| 803 | + self.beancounter_mock.resource = 'numproc' | ||
| 804 | + self.beancounter_mock.held = 50 | ||
| 805 | + self.beancounter_mock.maxheld = 56 | ||
| 806 | + self.beancounter_mock.barrier = 50 | ||
| 807 | + self.beancounter_mock.limit = 100 | ||
| 808 | + threshold = check_openvz_beans.BeanCounterThreshold() | ||
| 809 | + self.assertFalse(threshold.check(self.beancounter_mock)) | ||
| 810 | + | ||
| 811 | + def testCheckNotResponsible(self): | ||
| 812 | + # gt critical value | ||
| 813 | + self.beancounter_mock.resource = 'dummy_crit_gt' | ||
| 814 | + self.beancounter_mock.held = 50 | ||
| 815 | + self.beancounter_mock.maxheld = 96 | ||
| 816 | + self.beancounter_mock.barrier = 100 | ||
| 817 | + self.beancounter_mock.limit = 100 | ||
| 818 | + threshold = check_openvz_beans.BeanCounterThreshold('differentresource') | ||
| 819 | + self.assertFalse(threshold.check(self.beancounter_mock)) | ||
| 820 | + | ||
| 821 | + | ||
| 822 | +class BeanCounterViolationTest(unittest.TestCase): | ||
| 823 | + """Test the BeanCounterViolation class.""" | ||
| 824 | + def testCreate(self): | ||
| 825 | + violation = check_openvz_beans.BeanCounterViolation('dummy', 123, 10) | ||
| 826 | + self.assertEquals(violation.uid, 123) | ||
| 827 | + self.assertEquals(violation.resource, 'dummy') | ||
| 828 | + self.assertEquals(violation.tag, 'VIOL') | ||
| 829 | + self.assertEquals(violation.excess, 10) | ||
| 830 | + self.assertEquals(violation.__repr__(), | ||
| 831 | + '<BeanCounterViolation VIOL: resource dummy in context 123 by 10>') | ||
| 832 | + | ||
| 833 | + | ||
| 834 | +class BeanCounterFailureTest(unittest.TestCase): | ||
| 835 | + """Test the BeanCounterFailure class.""" | ||
| 836 | + def testCreate(self): | ||
| 837 | + violation = check_openvz_beans.BeanCounterFailure('dummy', 123, 10) | ||
| 838 | + self.assertEquals(violation.uid, 123) | ||
| 839 | + self.assertEquals(violation.resource, 'dummy') | ||
| 840 | + self.assertEquals(violation.tag, 'FAIL') | ||
| 841 | + self.assertEquals(violation.excess, 10) | ||
| 842 | + self.assertEquals(violation.__repr__(), | ||
| 843 | + '<BeanCounterFailure FAIL: resource dummy in context 123 by 10>') | ||
| 844 | + | ||
| 845 | + | ||
| 846 | +class BeanCounterOvershootTest(unittest.TestCase): | ||
| 847 | + """Test the BeanCounterOvershoot class.""" | ||
| 848 | + def testCreate(self): | ||
| 849 | + violation = check_openvz_beans.BeanCounterOvershoot('dummy', 123, 10) | ||
| 850 | + self.assertEquals(violation.uid, 123) | ||
| 851 | + self.assertEquals(violation.resource, 'dummy') | ||
| 852 | + self.assertEquals(violation.tag, 'OVER') | ||
| 853 | + self.assertEquals(violation.excess, 10) | ||
| 854 | + self.assertEquals(violation.__repr__(), | ||
| 855 | + '<BeanCounterOvershoot OVER: resource dummy in context 123 by 10>') | ||
| 856 | + | ||
| 857 | + | ||
| 858 | +class BeanCounterCritical(unittest.TestCase): | ||
| 859 | + """Test the BeanCounterCritical class.""" | ||
| 860 | + def testCreate(self): | ||
| 861 | + violation = check_openvz_beans.BeanCounterCritical('dummy', 123, 10) | ||
| 862 | + self.assertEquals(violation.uid, 123) | ||
| 863 | + self.assertEquals(violation.resource, 'dummy') | ||
| 864 | + self.assertEquals(violation.tag, 'CRIT') | ||
| 865 | + self.assertEquals(violation.excess, 10) | ||
| 866 | + self.assertEquals(violation.__repr__(), | ||
| 867 | + '<BeanCounterCritical CRIT: resource dummy in context 123 by 10>') | ||
| 868 | + | ||
| 869 | + | ||
| 870 | +class BeanCounterWarningTest(unittest.TestCase): | ||
| 871 | + """Test the BeanCounterWarning class.""" | ||
| 872 | + def testCreate(self): | ||
| 873 | + violation = check_openvz_beans.BeanCounterWarning('dummy', 123, 10) | ||
| 874 | + self.assertEquals(violation.uid, 123) | ||
| 875 | + self.assertEquals(violation.resource, 'dummy') | ||
| 876 | + self.assertEquals(violation.tag, 'WARN') | ||
| 877 | + self.assertEquals(violation.excess, 10) | ||
| 878 | + self.assertEquals(violation.__repr__(), | ||
| 879 | + '<BeanCounterWarning WARN: resource dummy in context 123 by 10>') | ||
| 880 | + | ||
| 881 | + | ||
| 882 | +class BeanCounterVerifierInitTest(mox.MoxTestBase): | ||
| 883 | + """Test the BeanCounterVerifier class (1/2).""" | ||
| 884 | + def setUp(self): | ||
| 885 | + super(BeanCounterVerifierInitTest, self).setUp() | ||
| 886 | + # Mock BeanCounterThresholds | ||
| 887 | + self.values_mock = self.mox.CreateMock(optparse.Values) | ||
| 888 | + self.threshold_mock = self.mox.CreateMock(check_openvz_beans.BeanCounterThreshold) | ||
| 889 | + self.mox.StubOutWithMock(check_openvz_beans, 'BeanCounterThreshold') | ||
| 890 | + | ||
| 891 | + # check with common thresholds | ||
| 892 | + self.values_mock.critical = 95 | ||
| 893 | + self.values_mock.warning = 90 | ||
| 894 | + check_openvz_beans.BeanCounterThreshold(None, 95, 90) | ||
| 895 | + | ||
| 896 | + # check with resource-specific thresholds | ||
| 897 | + self.values_mock.res_critical = {'foo':20, 'bar':30} | ||
| 898 | + self.values_mock.res_warning = {'foo':10, 'baz':20} | ||
| 899 | + check_openvz_beans.BeanCounterThreshold('foo', 20, 10) | ||
| 900 | + check_openvz_beans.BeanCounterThreshold('baz', -1, 20) | ||
| 901 | + check_openvz_beans.BeanCounterThreshold('bar', 30, -1) | ||
| 902 | + | ||
| 903 | + self.mox.ReplayAll() | ||
| 904 | + | ||
| 905 | + def test_init(self): | ||
| 906 | + beancounterverifier = check_openvz_beans.BeanCounterVerifier(self.values_mock) | ||
| 907 | + | ||
| 908 | + | ||
| 909 | +class BeanCounterVerifierVerifyTest(mox.MoxTestBase): | ||
| 910 | + """Test the BeanCounterVerifier class (2/2).""" | ||
| 911 | + def setUp(self): | ||
| 912 | + super(BeanCounterVerifierVerifyTest, self).setUp() | ||
| 913 | + # Mock BeanCounterThresholds | ||
| 914 | + self.values_mock = self.mox.CreateMock(optparse.Values) | ||
| 915 | + self.threshold_mock = self.mox.CreateMock(check_openvz_beans.BeanCounterThreshold) | ||
| 916 | + self.beancounter_mock = self.mox.CreateMock(check_openvz_beans.BeanCounter) | ||
| 917 | + self.violation_mock = self.mox.CreateMock(check_openvz_beans.BeanCounterViolation) | ||
| 918 | + self.mox.StubOutWithMock(check_openvz_beans, 'BeanCounterThreshold') | ||
| 919 | + self.mox.StubOutWithMock(check_openvz_beans.BeanCounterThreshold, 'check') | ||
| 920 | + | ||
| 921 | + # check with common thresholds | ||
| 922 | + self.values_mock.critical = 95 | ||
| 923 | + self.values_mock.warning = 90 | ||
| 924 | + self.values_mock.res_critical = {} | ||
| 925 | + self.values_mock.res_warning = {} | ||
| 926 | + check_openvz_beans.BeanCounterThreshold(None, 95, 90).AndReturn(self.threshold_mock) | ||
| 927 | + self.threshold_mock.check(mox.IsA(check_openvz_beans.BeanCounter), False) | ||
| 928 | + self.threshold_mock.check(mox.IsA(check_openvz_beans.BeanCounter), False).AndReturn(self.violation_mock) | ||
| 929 | + self.threshold_mock.check(mox.IsA(check_openvz_beans.BeanCounter), False).AndReturn(self.violation_mock) | ||
| 930 | + self.threshold_mock.check(mox.IsA(check_openvz_beans.BeanCounter), False).AndReturn(self.violation_mock) | ||
| 931 | + | ||
| 932 | + self.mox.ReplayAll() | ||
| 933 | + | ||
| 934 | + def test_verify(self): | ||
| 935 | + beancounterverifier = check_openvz_beans.BeanCounterVerifier(self.values_mock) | ||
| 936 | + beancounter_mock = self.mox.CreateMock(check_openvz_beans.BeanCounter) | ||
| 937 | + # first one is okay | ||
| 938 | + self.assertEquals(len(beancounterverifier.verify([beancounter_mock,], False)), 0) | ||
| 939 | + # second one has a violation | ||
| 940 | + self.assertEquals(len(beancounterverifier.verify([beancounter_mock,], False)), 1) | ||
| 941 | + # third + fourth each have a violation | ||
| 942 | + self.assertEquals(len(beancounterverifier.verify([beancounter_mock, beancounter_mock], False)), 2) | ||
| 943 | + | ||
| 944 | + | ||
| 945 | +class ExtOptionTest(mox.MoxTestBase): | ||
| 946 | + """Test the ExtOption class.""" | ||
| 947 | + def setUp(self): | ||
| 948 | + super(ExtOptionTest, self).setUp() | ||
| 949 | + # Mock optparse objects | ||
| 950 | + self.values1 = self.mox.CreateMockAnything() | ||
| 951 | + self.values1.ensure_value('foobar', {}).AndReturn(self.values1) | ||
| 952 | + self.values1.update({'key1': 'val1'}) | ||
| 953 | + self.values1.ensure_value('foobar', {}).AndReturn(self.values1) | ||
| 954 | + self.values1.update({'key2': 'val2'}) | ||
| 955 | + | ||
| 956 | + self.values2 = self.mox.CreateMockAnything() | ||
| 957 | + self.values2.intval = 0 | ||
| 958 | + | ||
| 959 | + self.values3 = self.mox.CreateMockAnything() | ||
| 960 | + | ||
| 961 | + self.mox.StubOutWithMock(optparse.Option, '__init__') | ||
| 962 | + self.mox.StubOutWithMock(optparse.Option, 'take_action') | ||
| 963 | + optparse.Option.__init__() | ||
| 964 | + optparse.Option.take_action(mox.IsA(optparse.Option), 'something_else', None, None, None, None, None) | ||
| 965 | + | ||
| 966 | + self.mox.ReplayAll() | ||
| 967 | + | ||
| 968 | + def test_take_action(self): | ||
| 969 | + option = check_openvz_beans.ExtOption() | ||
| 970 | + option.take_action('keyvalgroup', 'foobar', 'dunno', 'key1:val1,key2:val2', self.values1, 'dunno') | ||
| 971 | + | ||
| 972 | + self.assertEquals(self.values2.intval, 0) | ||
| 973 | + option.take_action('store_int', 'intval', 'dunno', '10', self.values2, 'dunno') | ||
| 974 | + self.assertEquals(self.values2.intval, 10) | ||
| 975 | + | ||
| 976 | + option.take_action('something_else', None, None, None, None, None) | ||
| 977 | + | ||
| 978 | + | ||
| 979 | +class ReadDataTest(mox.MoxTestBase): | ||
| 980 | + """Check read_data functions without sudo.""" | ||
| 981 | + def setUp(self): | ||
| 982 | + super(ReadDataTest, self).setUp() | ||
| 983 | + # Mock optparse objects | ||
| 984 | + self.options_mock = self.mox.CreateMock(optparse.Values) | ||
| 985 | + self.popen_mock = self.mox.CreateMock(subprocess.Popen) | ||
| 986 | + self.mox.StubOutWithMock(subprocess, 'Popen') | ||
| 987 | + self.saved_stdout = sys.stdout | ||
| 988 | + sys.stdout = StringIO.StringIO() | ||
| 989 | + | ||
| 990 | + def tearDown(self): | ||
| 991 | + super(ReadDataTest, self).tearDown() | ||
| 992 | + sys.stdout = self.saved_stdout | ||
| 993 | + | ||
| 994 | + def test_read_data(self): | ||
| 995 | + """Test reading OpenVZ counter data from system without sudo - existing file.""" | ||
| 996 | + self.options_mock.sudo = False | ||
| 997 | + self.options_mock.filename = 'testdata/hostcrit.bcs' | ||
| 998 | + self.mox.ReplayAll() | ||
| 999 | + | ||
| 1000 | + result = check_openvz_beans.read_data(self.options_mock) | ||
| 1001 | + | ||
| 1002 | + self.assertTrue(isinstance(result, str)) | ||
| 1003 | + self.assertEquals(len(result), os.path.getsize(self.options_mock.filename)) | ||
| 1004 | + | ||
| 1005 | + def test_read_data_missing_file(self): | ||
| 1006 | + """Test reading OpenVZ counter data from system without sudo - missing file.""" | ||
| 1007 | + self.options_mock.sudo = False | ||
| 1008 | + self.options_mock.filename = '/nonexisting/foobar' | ||
| 1009 | + self.mox.ReplayAll() | ||
| 1010 | + | ||
| 1011 | + # FIXME: check the Exception value. assertRaisesRegexp() is only available in Python unittest 2.7+ | ||
| 1012 | + self.assertRaises(SystemExit, check_openvz_beans.read_data, self.options_mock) | ||
| 1013 | + self.assertEqual(sys.stdout.getvalue(), 'OK: Not an OpenVZ system, no need to worry about beancounters.\n') | ||
| 1014 | + | ||
| 1015 | + def test_read_data_missing_file(self): | ||
| 1016 | + """Test reading OpenVZ counter data from system without sudo - unreadable file.""" | ||
| 1017 | + self.options_mock.sudo = False | ||
| 1018 | + self.options_mock.filename = 'testdata/unreadable.bcs' | ||
| 1019 | + try: | ||
| 1020 | + os.unlink(self.options_mock.filename) | ||
| 1021 | + except OSError: | ||
| 1022 | + pass | ||
| 1023 | + | ||
| 1024 | + open(self.options_mock.filename, 'w').close() | ||
| 1025 | + os.chmod(self.options_mock.filename, 0000) | ||
| 1026 | + | ||
| 1027 | + self.mox.ReplayAll() | ||
| 1028 | + | ||
| 1029 | + # FIXME: check the Exception value. assertRaisesRegexp() is only available in Python unittest 2.7+ | ||
| 1030 | + self.assertRaises(SystemExit, check_openvz_beans.read_data, self.options_mock) | ||
| 1031 | + self.assertEqual(sys.stdout.getvalue(), 'UNKNOWN: Not permitted to read beancounter information.\n') | ||
| 1032 | + | ||
| 1033 | + try: | ||
| 1034 | + os.unlink(self.options_mock.filename) | ||
| 1035 | + except OSError: | ||
| 1036 | + pass | ||
| 1037 | + | ||
| 1038 | + # FIXME: not all code pathes completely tested due to unmockability of open() | ||
| 1039 | + | ||
| 1040 | + def test_read_data_sudo(self): | ||
| 1041 | + """Test reading OpenVZ counter data from system with sudo - sucess.""" | ||
| 1042 | + self.options_mock.sudo = True | ||
| 1043 | + self.options_mock.filename = 'irrelevant' | ||
| 1044 | + subprocess.Popen(['/usr/bin/sudo', '-n', 'cat', 'irrelevant'], stderr=-1, stdout=-1).AndReturn(self.popen_mock) | ||
| 1045 | + self.popen_mock.communicate().AndReturn(['somedata']) | ||
| 1046 | + self.mox.ReplayAll() | ||
| 1047 | + | ||
| 1048 | + result = check_openvz_beans.read_data(self.options_mock) | ||
| 1049 | + | ||
| 1050 | + self.assertTrue(isinstance(result, str)) | ||
| 1051 | + self.assertEquals(result, 'somedata') | ||
| 1052 | + | ||
| 1053 | + def test_read_data_sudo_oserror(self): | ||
| 1054 | + """Test reading OpenVZ counter data from system with sudo - OSError.""" | ||
| 1055 | + self.options_mock.sudo = True | ||
| 1056 | + self.options_mock.filename = 'irrelevant' | ||
| 1057 | + subprocess.Popen(['/usr/bin/sudo', '-n', 'cat', 'irrelevant'], stderr=-1, stdout=-1).AndRaise(OSError(42, 'mocketimock')) | ||
| 1058 | + self.mox.ReplayAll() | ||
| 1059 | + | ||
| 1060 | + # FIXME: check the Exception value. assertRaisesRegexp() is only available in Python unittest 2.7+ | ||
| 1061 | + self.assertRaises(SystemExit, check_openvz_beans.read_data, self.options_mock) | ||
| 1062 | + self.assertEqual(sys.stdout.getvalue(), "CRITICAL: Can't execute sudo to read beancounters. (42 - mocketimock)\n") | ||
| 1063 | + | ||
| 1064 | + def test_read_data_sudo_nodata(self): | ||
| 1065 | + """Test reading OpenVZ counter data from system with sudo - no data.""" | ||
| 1066 | + self.options_mock.sudo = True | ||
| 1067 | + self.options_mock.filename = 'irrelevant' | ||
| 1068 | + | ||
| 1069 | + subprocess.Popen(['/usr/bin/sudo', '-n', 'cat', 'irrelevant'], stderr=-1, stdout=-1).AndReturn(self.popen_mock) | ||
| 1070 | + self.popen_mock.communicate().AndReturn(['']) | ||
| 1071 | + self.mox.ReplayAll() | ||
| 1072 | + | ||
| 1073 | + # FIXME: check the Exception value. assertRaisesRegexp() is only available in Python unittest 2.7+ | ||
| 1074 | + self.assertRaises(SystemExit, check_openvz_beans.read_data, self.options_mock) | ||
| 1075 | + self.assertEqual(sys.stdout.getvalue(), "CRITICAL: Trying to read beancounters with sudo didn't yield data.\n") | ||
| 1076 | + | ||
| 1077 | + | ||
| 1078 | +class GlobalsTest(mox.MoxTestBase): | ||
| 1079 | + """Check global functions.""" | ||
| 1080 | + def setUp(self): | ||
| 1081 | + super(GlobalsTest, self).setUp() | ||
| 1082 | + self.saved_stdout, sys.stdout = sys.stdout, StringIO.StringIO() | ||
| 1083 | + | ||
| 1084 | + def tearDown(self): | ||
| 1085 | + super(GlobalsTest, self).tearDown() | ||
| 1086 | + sys.stdout = self.saved_stdout | ||
| 1087 | + | ||
| 1088 | + def test_shorten_hostname(self): | ||
| 1089 | + """Test shortening hostnames.""" | ||
| 1090 | + self.testfqdn = "hostname.with.long.domain.name" | ||
| 1091 | + # the (short) hostname should be returned in any case | ||
| 1092 | + self.assertEqual(check_openvz_beans.shorten_hostname(self.testfqdn, 0), "hostname") | ||
| 1093 | + self.assertEqual(check_openvz_beans.shorten_hostname(self.testfqdn, 1), "hostname") | ||
| 1094 | + # various lengths should be returned properly | ||
| 1095 | + self.assertEqual(check_openvz_beans.shorten_hostname(self.testfqdn, 2), "hostname.with") | ||
| 1096 | + self.assertEqual(check_openvz_beans.shorten_hostname(self.testfqdn, 5), "hostname.with.long.domain.name") | ||
| 1097 | + # if more is requested than is there, just give all there is | ||
| 1098 | + self.assertEqual(check_openvz_beans.shorten_hostname(self.testfqdn, 42), "hostname.with.long.domain.name") | ||
| 1099 | + | ||
| 1100 | + def test_get_vm_hostname(self): | ||
| 1101 | + """Test getting vm hostnames.""" | ||
| 1102 | + # two known existing hosts | ||
| 1103 | + self.assertEqual(check_openvz_beans.get_vm_hostname(10, 'testdata'), 'vmokay.pr.foo.test.your.do.main') | ||
| 1104 | + self.assertEqual(check_openvz_beans.get_vm_hostname(60, 'testdata'), 'vmover1.st.foo.test.your.do.main') | ||
| 1105 | + # one host whose config file doesn't contain a hostname | ||
| 1106 | + self.assertEqual(check_openvz_beans.get_vm_hostname(99, 'testdata'), None) | ||
| 1107 | + # one host where no config file exists | ||
| 1108 | + self.assertEqual(check_openvz_beans.get_vm_hostname(90, 'testdata'), None) | ||
| 1109 | + | ||
| 1110 | + def test_get_local_fqdn(self): | ||
| 1111 | + """Test getting local hostnames.""" | ||
| 1112 | + # due to the local nature of hostnames we can only check wether it has a qualifying '.' in it | ||
| 1113 | + self.assertTrue(check_openvz_beans.get_local_fqdn().find('.') > 0) | ||
| 1114 | + | ||
| 1115 | + def test_get_hostname(self): | ||
| 1116 | + """Test getting and shortening hostnames.""" | ||
| 1117 | + self.mox.StubOutWithMock(check_openvz_beans, 'get_vm_hostname') | ||
| 1118 | + self.mox.StubOutWithMock(check_openvz_beans, 'get_local_fqdn') | ||
| 1119 | + check_openvz_beans.get_local_fqdn().AndReturn('localhost.localdomain') | ||
| 1120 | + check_openvz_beans.get_local_fqdn().AndReturn('localhost.localdomain') | ||
| 1121 | + check_openvz_beans.get_vm_hostname(10, 'testdata').AndReturn('hostname.with.long.domain.name') | ||
| 1122 | + self.mox.ReplayAll() | ||
| 1123 | + | ||
| 1124 | + self.assertEqual(check_openvz_beans.get_hostname(0, 'testdata'), 'localhost.localdomain') | ||
| 1125 | + self.assertEqual(check_openvz_beans.get_hostname(99, 'nonexistent'), 'localhost.localdomain') | ||
| 1126 | + self.assertEqual(check_openvz_beans.get_hostname(10, 'testdata'), 'hostname.with') | ||
| 1127 | + | ||
| 1128 | + self.mox.VerifyAll() | ||
| 1129 | + self.mox.UnsetStubs() | ||
| 1130 | + | ||
| 1131 | + def test_create_optionsparser(self): | ||
| 1132 | + """Test creating a custom OptionParser.""" | ||
| 1133 | + parser = check_openvz_beans.create_optionsparser() | ||
| 1134 | + self.assertTrue(isinstance(parser, optparse.OptionParser)) | ||
| 1135 | + # FIXME: do we want to check more? | ||
| 1136 | + | ||
| 1137 | + | ||
| 1138 | +class MainEarlyFailuresTest(mox.MoxTestBase): | ||
| 1139 | + def setUp(self): | ||
| 1140 | + super(MainEarlyFailuresTest, self).setUp() | ||
| 1141 | + self.saved_stdout, sys.stdout = sys.stdout, StringIO.StringIO() | ||
| 1142 | + self.option_mock = self.mox.CreateMock(optparse.Values) | ||
| 1143 | + self.option_mock.use_absolute_failcnt = False | ||
| 1144 | + self.option_mock.storepath = 'testdata' | ||
| 1145 | + | ||
| 1146 | + def tearDown(self): | ||
| 1147 | + sys.stdout = self.saved_stdout | ||
| 1148 | + | ||
| 1149 | + def test___main___wrongargs(self): | ||
| 1150 | + """Test the __main__ function -- wrong args.""" | ||
| 1151 | + optionsparser_mock = self.mox.CreateMock(optparse.OptionParser) | ||
| 1152 | + self.mox.StubOutWithMock(check_openvz_beans, 'create_optionsparser') | ||
| 1153 | + check_openvz_beans.create_optionsparser().AndReturn(optionsparser_mock) | ||
| 1154 | + optionsparser_mock.parse_args().AndReturn((self.option_mock, ['arg',])) | ||
| 1155 | + optionsparser_mock.error('incorrect number of arguments').AndRaise(SystemExit) | ||
| 1156 | + | ||
| 1157 | + self.mox.ReplayAll() | ||
| 1158 | + | ||
| 1159 | + # FIXME: check the Exception value. assertRaisesRegexp() is only available in Python unittest 2.7+ | ||
| 1160 | + self.assertRaises(SystemExit, check_openvz_beans.__main__) | ||
| 1161 | + | ||
| 1162 | + def test___main___nodata(self): | ||
| 1163 | + """Test the __main__ function -- no data.""" | ||
| 1164 | + optionsparser_mock = self.mox.CreateMock(optparse.OptionParser) | ||
| 1165 | + self.mox.StubOutWithMock(check_openvz_beans, 'create_optionsparser') | ||
| 1166 | + check_openvz_beans.create_optionsparser().AndReturn(optionsparser_mock) | ||
| 1167 | + optionsparser_mock.parse_args().AndReturn((self.option_mock, [])) | ||
| 1168 | + | ||
| 1169 | + self.mox.StubOutWithMock(check_openvz_beans, 'read_data') | ||
| 1170 | + check_openvz_beans.read_data(mox.IsA(optparse.Values)).AndReturn('') | ||
| 1171 | + | ||
| 1172 | + self.mox.ReplayAll() | ||
| 1173 | + | ||
| 1174 | + # FIXME: check the Exception value. assertRaisesRegexp() is only available in Python unittest 2.7+ | ||
| 1175 | + self.assertRaises(SystemExit, check_openvz_beans.__main__) | ||
| 1176 | + self.assertEqual(sys.stdout.getvalue(), 'CRITICAL: No data given while reading beancounters.\n') | ||
| 1177 | + | ||
| 1178 | + def test___main___nobeancounters(self): | ||
| 1179 | + """Test the __main__ function -- no beancounters""" | ||
| 1180 | + optionsparser_mock = self.mox.CreateMock(optparse.OptionParser) | ||
| 1181 | + self.mox.StubOutWithMock(check_openvz_beans, 'create_optionsparser') | ||
| 1182 | + check_openvz_beans.create_optionsparser().AndReturn(optionsparser_mock) | ||
| 1183 | + optionsparser_mock.parse_args().AndReturn((self.option_mock, [])) | ||
| 1184 | + | ||
| 1185 | + self.mox.StubOutWithMock(check_openvz_beans, 'read_data') | ||
| 1186 | + check_openvz_beans.read_data(mox.IsA(optparse.Values)).AndReturn('somedata') | ||
| 1187 | + | ||
| 1188 | + beancounterparser_mock = self.mox.CreateMock(check_openvz_beans.BeanCounterParser) | ||
| 1189 | + self.mox.StubOutWithMock(check_openvz_beans, 'BeanCounterParser') | ||
| 1190 | + check_openvz_beans.BeanCounterParser('somedata', False, 'testdata').AndRaise(check_openvz_beans.NoBeanCountersFoundError) | ||
| 1191 | + | ||
| 1192 | + self.mox.ReplayAll() | ||
| 1193 | + | ||
| 1194 | + # FIXME: check the Exception value. assertRaisesRegexp() is only available in Python unittest 2.7+ | ||
| 1195 | + self.assertRaises(SystemExit, check_openvz_beans.__main__) | ||
| 1196 | + self.assertEqual(sys.stdout.getvalue(), 'CRITICAL: No beancounters found in data read.\n') | ||
| 1197 | + | ||
| 1198 | + | ||
| 1199 | +class MainRegularTest(mox.MoxTestBase): | ||
| 1200 | + def setUp(self): | ||
| 1201 | + super(MainRegularTest, self).setUp() | ||
| 1202 | + self.saved_stdout, sys.stdout = sys.stdout, StringIO.StringIO() | ||
| 1203 | + | ||
| 1204 | + self.optionsparser_mock = self.mox.CreateMock(optparse.OptionParser) | ||
| 1205 | + self.option_mock = self.mox.CreateMock(optparse.Values) | ||
| 1206 | + self.option_mock.confpath = 'irrelevant' | ||
| 1207 | + self.option_mock.domainparts = 21 | ||
| 1208 | + self.option_mock.use_absolute_failcnt = False | ||
| 1209 | + self.option_mock.storepath = 'testdata' | ||
| 1210 | + self.option_mock.use_maxheld = False | ||
| 1211 | + self.mox.StubOutWithMock(check_openvz_beans, 'create_optionsparser') | ||
| 1212 | + check_openvz_beans.create_optionsparser().AndReturn(self.optionsparser_mock) | ||
| 1213 | + self.optionsparser_mock.parse_args().AndReturn((self.option_mock, [])) | ||
| 1214 | + | ||
| 1215 | + self.mox.StubOutWithMock(check_openvz_beans, 'read_data') | ||
| 1216 | + check_openvz_beans.read_data(mox.IsA(optparse.Values)).AndReturn('somedata') | ||
| 1217 | + | ||
| 1218 | + self.beancounterparser_mock = self.mox.CreateMock(check_openvz_beans.BeanCounterParser) | ||
| 1219 | + self.mox.StubOutWithMock(check_openvz_beans, 'BeanCounterParser') | ||
| 1220 | + check_openvz_beans.BeanCounterParser('somedata', False, 'testdata').AndReturn(self.beancounterparser_mock) | ||
| 1221 | + self.beancounterparser_mock.get_beancounters().AndReturn(None) | ||
| 1222 | + | ||
| 1223 | + self.beancounterverifier_mock = self.mox.CreateMock(check_openvz_beans.BeanCounterVerifier) | ||
| 1224 | + self.mox.StubOutWithMock(check_openvz_beans, 'BeanCounterVerifier') | ||
| 1225 | + check_openvz_beans.BeanCounterVerifier(mox.IsA(optparse.Values)).AndReturn(self.beancounterverifier_mock) | ||
| 1226 | + | ||
| 1227 | + def tearDown(self): | ||
| 1228 | + sys.stdout = self.saved_stdout | ||
| 1229 | + | ||
| 1230 | + def test___main___noalerts(self): | ||
| 1231 | + """Test the __main__ function -- no alerts.""" | ||
| 1232 | + self.beancounterverifier_mock.verify(None, False).AndReturn([]) | ||
| 1233 | + | ||
| 1234 | + self.mox.ReplayAll() | ||
| 1235 | + | ||
| 1236 | + # FIXME: check the Exception value. assertRaisesRegexp() is only available in Python unittest 2.7+ | ||
| 1237 | + self.assertRaises(SystemExit, check_openvz_beans.__main__) | ||
| 1238 | + self.assertEqual(sys.stdout.getvalue(), 'OK: all beancounters below configured thresholds\n') | ||
| 1239 | + | ||
| 1240 | + def test___main___nospecificalert(self): | ||
| 1241 | + """Test the __main__ function -- no alerts.""" | ||
| 1242 | + beancounteralert_mock = self.mox.CreateMock(check_openvz_beans.BeanCounterViolation) | ||
| 1243 | + self.beancounterverifier_mock.verify(None, False).AndReturn([beancounteralert_mock,]) | ||
| 1244 | + | ||
| 1245 | + self.mox.ReplayAll() | ||
| 1246 | + | ||
| 1247 | + # FIXME: check the Exception value. assertRaisesRegexp() is only available in Python unittest 2.7+ | ||
| 1248 | + self.assertRaises(SystemExit, check_openvz_beans.__main__) | ||
| 1249 | + self.assertEqual(sys.stdout.getvalue(), 'OK: all beancounters below configured thresholds\n') | ||
| 1250 | + | ||
| 1251 | + def test___main___failalert(self): | ||
| 1252 | + """Test the __main__ function -- fail alert.""" | ||
| 1253 | + beancounteralert_mock = self.mox.CreateMock(check_openvz_beans.BeanCounterFailure) | ||
| 1254 | + beancounteralert_mock.uid = 123 | ||
| 1255 | + beancounteralert_mock.excess = 987 | ||
| 1256 | + beancounteralert_mock.resource = 'resource' | ||
| 1257 | + self.beancounterverifier_mock.verify(None, False).AndReturn([beancounteralert_mock,]) | ||
| 1258 | + | ||
| 1259 | + self.mox.StubOutWithMock(check_openvz_beans, 'get_hostname') | ||
| 1260 | + check_openvz_beans.get_hostname(123, 'irrelevant', 21).AndReturn('dummy') | ||
| 1261 | + | ||
| 1262 | + self.mox.ReplayAll() | ||
| 1263 | + | ||
| 1264 | + # FIXME: check the Exception value. assertRaisesRegexp() is only available in Python unittest 2.7+ | ||
| 1265 | + self.assertRaises(SystemExit, check_openvz_beans.__main__) | ||
| 1266 | + self.assertEqual(sys.stdout.getvalue(), 'CRITICAL: FAIL: dummy(123)| FAIL: HOST dummy(123): resource(+987)\n') | ||
| 1267 | + | ||
| 1268 | + def test___main___overalert(self): | ||
| 1269 | + """Test the __main__ function -- over alert.""" | ||
| 1270 | + beancounteralert_mock = self.mox.CreateMock(check_openvz_beans.BeanCounterOvershoot) | ||
| 1271 | + beancounteralert_mock.uid = 123 | ||
| 1272 | + beancounteralert_mock.excess = 987 | ||
| 1273 | + beancounteralert_mock.resource = 'resource' | ||
| 1274 | + self.beancounterverifier_mock.verify(None, False).AndReturn([beancounteralert_mock,]) | ||
| 1275 | + | ||
| 1276 | + self.mox.StubOutWithMock(check_openvz_beans, 'get_hostname') | ||
| 1277 | + check_openvz_beans.get_hostname(123, 'irrelevant', 21).AndReturn('dummy') | ||
| 1278 | + | ||
| 1279 | + self.mox.ReplayAll() | ||
| 1280 | + | ||
| 1281 | + # FIXME: check the Exception value. assertRaisesRegexp() is only available in Python unittest 2.7+ | ||
| 1282 | + self.assertRaises(SystemExit, check_openvz_beans.__main__) | ||
| 1283 | + self.assertEqual(sys.stdout.getvalue(), 'CRITICAL: OVER: dummy(123)| OVER: HOST dummy(123): resource(+987)\n') | ||
| 1284 | + | ||
| 1285 | + def test___main___critalert(self): | ||
| 1286 | + """Test the __main__ function -- crit alert.""" | ||
| 1287 | + beancounteralert_mock = self.mox.CreateMock(check_openvz_beans.BeanCounterCritical) | ||
| 1288 | + beancounteralert_mock.uid = 123 | ||
| 1289 | + beancounteralert_mock.excess = 987 | ||
| 1290 | + beancounteralert_mock.resource = 'resource' | ||
| 1291 | + self.beancounterverifier_mock.verify(None, False).AndReturn([beancounteralert_mock,]) | ||
| 1292 | + | ||
| 1293 | + self.mox.StubOutWithMock(check_openvz_beans, 'get_hostname') | ||
| 1294 | + check_openvz_beans.get_hostname(123, 'irrelevant', 21).AndReturn('dummy') | ||
| 1295 | + | ||
| 1296 | + self.mox.ReplayAll() | ||
| 1297 | + | ||
| 1298 | + # FIXME: check the Exception value. assertRaisesRegexp() is only available in Python unittest 2.7+ | ||
| 1299 | + self.assertRaises(SystemExit, check_openvz_beans.__main__) | ||
| 1300 | + self.assertEqual(sys.stdout.getvalue(), 'CRITICAL: CRIT: dummy(123)| CRIT: HOST dummy(123): resource(+987)\n') | ||
| 1301 | + | ||
| 1302 | + def test___main___warnalert(self): | ||
| 1303 | + """Test the __main__ function -- warn alert.""" | ||
| 1304 | + beancounteralert_mock = self.mox.CreateMock(check_openvz_beans.BeanCounterWarning) | ||
| 1305 | + beancounteralert_mock.uid = 123 | ||
| 1306 | + beancounteralert_mock.excess = 987 | ||
| 1307 | + beancounteralert_mock.resource = 'resource' | ||
| 1308 | + self.beancounterverifier_mock.verify(None, False).AndReturn([beancounteralert_mock,]) | ||
| 1309 | + | ||
| 1310 | + self.mox.StubOutWithMock(check_openvz_beans, 'get_hostname') | ||
| 1311 | + check_openvz_beans.get_hostname(123, 'irrelevant', 21).AndReturn('dummy') | ||
| 1312 | + | ||
| 1313 | + self.mox.ReplayAll() | ||
| 1314 | + | ||
| 1315 | + # FIXME: check the Exception value. assertRaisesRegexp() is only available in Python unittest 2.7+ | ||
| 1316 | + self.assertRaises(SystemExit, check_openvz_beans.__main__) | ||
| 1317 | + self.assertEqual(sys.stdout.getvalue(), 'WARNING: WARN: dummy(123)| WARN: HOST dummy(123): resource(+987)\n') | ||
| 1318 | + | ||
| 1319 | + def test___main___failwarnalert(self): | ||
| 1320 | + """Test the __main__ function -- failwarn alert.""" | ||
| 1321 | + beancounteralert_fail_mock = self.mox.CreateMock(check_openvz_beans.BeanCounterFailure) | ||
| 1322 | + beancounteralert_fail_mock.uid = 123 | ||
| 1323 | + beancounteralert_fail_mock.excess = 987 | ||
| 1324 | + beancounteralert_fail_mock.resource = 'resource' | ||
| 1325 | + beancounteralert_warn_mock = self.mox.CreateMock(check_openvz_beans.BeanCounterWarning) | ||
| 1326 | + beancounteralert_warn_mock.uid = 234 | ||
| 1327 | + beancounteralert_warn_mock.excess = 896 | ||
| 1328 | + beancounteralert_warn_mock.resource = 'resource' | ||
| 1329 | + self.beancounterverifier_mock.verify(None, False).AndReturn([beancounteralert_fail_mock, beancounteralert_warn_mock]) | ||
| 1330 | + | ||
| 1331 | + self.mox.StubOutWithMock(check_openvz_beans, 'get_hostname') | ||
| 1332 | + check_openvz_beans.get_hostname(123, 'irrelevant', 21).AndReturn('foo') | ||
| 1333 | + check_openvz_beans.get_hostname(234, 'irrelevant', 21).AndReturn('bar') | ||
| 1334 | + | ||
| 1335 | + self.mox.ReplayAll() | ||
| 1336 | + | ||
| 1337 | + # FIXME: check the Exception value. assertRaisesRegexp() is only available in Python unittest 2.7+ | ||
| 1338 | + self.assertRaises(SystemExit, check_openvz_beans.__main__) | ||
| 1339 | + self.assertEqual(sys.stdout.getvalue(), 'CRITICAL: FAIL: foo(123) WARN: bar(234)| FAIL: HOST foo(123): resource(+987) WARN: HOST bar(234): resource(+896)\n') | ||
| 1340 | + | ||
| 1341 | + def test___main___multifailwarnalert(self): | ||
| 1342 | + """Test the __main__ function -- failwarn alert.""" | ||
| 1343 | + beancounteralert_fail1_mock = self.mox.CreateMock(check_openvz_beans.BeanCounterFailure) | ||
| 1344 | + beancounteralert_fail1_mock.uid = 123 | ||
| 1345 | + beancounteralert_fail1_mock.excess = 987 | ||
| 1346 | + beancounteralert_fail1_mock.resource = 'resource1' | ||
| 1347 | + beancounteralert_fail2_mock = self.mox.CreateMock(check_openvz_beans.BeanCounterFailure) | ||
| 1348 | + beancounteralert_fail2_mock.uid = 123 | ||
| 1349 | + beancounteralert_fail2_mock.excess = 987 | ||
| 1350 | + beancounteralert_fail2_mock.resource = 'resource2' | ||
| 1351 | + beancounteralert_warn1_mock = self.mox.CreateMock(check_openvz_beans.BeanCounterWarning) | ||
| 1352 | + beancounteralert_warn1_mock.uid = 234 | ||
| 1353 | + beancounteralert_warn1_mock.excess = 896 | ||
| 1354 | + beancounteralert_warn1_mock.resource = 'resource' | ||
| 1355 | + beancounteralert_warn2_mock = self.mox.CreateMock(check_openvz_beans.BeanCounterWarning) | ||
| 1356 | + beancounteralert_warn2_mock.uid = 345 | ||
| 1357 | + beancounteralert_warn2_mock.excess = 896 | ||
| 1358 | + beancounteralert_warn2_mock.resource = 'resource' | ||
| 1359 | + self.beancounterverifier_mock.verify(None, False).AndReturn([beancounteralert_fail1_mock, beancounteralert_fail2_mock, beancounteralert_warn1_mock, beancounteralert_warn2_mock]) | ||
| 1360 | + | ||
| 1361 | + self.mox.StubOutWithMock(check_openvz_beans, 'get_hostname') | ||
| 1362 | + check_openvz_beans.get_hostname(123, 'irrelevant', 21).AndReturn('foo') | ||
| 1363 | + check_openvz_beans.get_hostname(345, 'irrelevant', 21).AndReturn('baz') | ||
| 1364 | + check_openvz_beans.get_hostname(234, 'irrelevant', 21).AndReturn('bar') | ||
| 1365 | + | ||
| 1366 | + self.mox.ReplayAll() | ||
| 1367 | + | ||
| 1368 | + # FIXME: check the Exception value. assertRaisesRegexp() is only available in Python unittest 2.7+ | ||
| 1369 | + self.assertRaises(SystemExit, check_openvz_beans.__main__) | ||
| 1370 | + self.assertEqual(sys.stdout.getvalue(), 'CRITICAL: FAIL: foo(123) WARN: baz(345) bar(234)| FAIL: HOST foo(123): resource1(+987) resource2(+987) WARN: HOST baz(345): resource(+896) HOST bar(234): resource(+896)\n') | ||
| 1371 | + | ||
| 1372 | +if __name__ == '__main__': | ||
| 1373 | + unittest.main() | ||
| 1374 | diff -urN nothing/debian/changelog nagios-plugins-openvz-beans/debian/changelog | ||
| 1375 | --- nothing/debian/changelog 1970-01-01 01:00:00.000000000 +0100 | ||
| 1376 | +++ nagios-plugins-openvz-beans/debian/changelog 2011-11-01 18:30:10.247574999 +0100 | ||
| 1377 | @@ -0,0 +1,5 @@ | ||
| 1378 | +nagios-plugins-openvz-beans (0.5-0) stable; urgency=low | ||
| 1379 | + | ||
| 1380 | + * initial release packaging | ||
| 1381 | + | ||
| 1382 | + -- Andreas Kotes <andreas.kotes@nokia.com> Thu, 01 Nov 2011 18:30:23 +0100 | ||
| 1383 | diff -urN nothing/debian/compat nagios-plugins-openvz-beans/debian/compat | ||
| 1384 | --- nothing/debian/compat 1970-01-01 01:00:00.000000000 +0100 | ||
| 1385 | +++ nagios-plugins-openvz-beans/debian/compat 2011-10-17 14:23:00.655695188 +0200 | ||
| 1386 | @@ -0,0 +1 @@ | ||
| 1387 | +5 | ||
| 1388 | diff -urN nothing/debian/control nagios-plugins-openvz-beans/debian/control | ||
| 1389 | --- nothing/debian/control 1970-01-01 01:00:00.000000000 +0100 | ||
| 1390 | +++ nagios-plugins-openvz-beans/debian/control 2011-11-01 16:54:48.381618568 +0100 | ||
| 1391 | @@ -0,0 +1,9 @@ | ||
| 1392 | +Source: nagios-plugins-openvz-beans | ||
| 1393 | +Section: net | ||
| 1394 | +Priority: extra | ||
| 1395 | +Maintainer: Andreas Kotes <andreas.kotes@nokia.com> | ||
| 1396 | + | ||
| 1397 | +Package: nagios-plugins-openvz-beans | ||
| 1398 | +Architecture: all | ||
| 1399 | +Depends: python-minimal | ||
| 1400 | +Description: Nagios Plugin to check OpenVZ Bean Counters | ||
| 1401 | diff -urN nothing/debian/.gitignore nagios-plugins-openvz-beans/debian/.gitignore | ||
| 1402 | --- nothing/debian/.gitignore 1970-01-01 01:00:00.000000000 +0100 | ||
| 1403 | +++ nagios-plugins-openvz-beans/debian/.gitignore 2011-10-17 14:23:00.655695188 +0200 | ||
| 1404 | @@ -0,0 +1,4 @@ | ||
| 1405 | +files | ||
| 1406 | +nagios-plugins-openvz-beans.debhelper.log | ||
| 1407 | +nagios-plugins-openvz-beans.substvars | ||
| 1408 | +nagios-plugins-openvz-beans/ | ||
| 1409 | diff -urN nothing/debian/rules nagios-plugins-openvz-beans/debian/rules | ||
| 1410 | --- nothing/debian/rules 1970-01-01 01:00:00.000000000 +0100 | ||
| 1411 | +++ nagios-plugins-openvz-beans/debian/rules 2011-11-01 18:28:09.727238903 +0100 | ||
| 1412 | @@ -0,0 +1,33 @@ | ||
| 1413 | +#!/usr/bin/make -f | ||
| 1414 | +DEBIANDIR=$(CURDIR)/debian | ||
| 1415 | + | ||
| 1416 | +%: | ||
| 1417 | + dh $@ | ||
| 1418 | + | ||
| 1419 | +install: build | ||
| 1420 | + dh_testdir | ||
| 1421 | + dh_testroot | ||
| 1422 | + dh_clean -k | ||
| 1423 | + dh_installdirs | ||
| 1424 | + | ||
| 1425 | + install -d -m0755 $(DEBIANDIR)/nagios-plugins-openvz-beans/usr/lib/nagios/plugins | ||
| 1426 | + install -m0755 check_openvz_beans.py $(DEBIANDIR)/nagios-plugins-openvz-beans/usr/lib/nagios/plugins | ||
| 1427 | + install -d -m0755 $(DEBIANDIR)/nagios-plugins-openvz-beans/usr/share/doc/nagios-plugins-openvz-beans | ||
| 1428 | + install -m0644 README $(DEBIANDIR)/nagios-plugins-openvz-beans/usr/share/doc/nagios-plugins-openvz-beans | ||
| 1429 | + | ||
| 1430 | +# Build architecture-independent files here. | ||
| 1431 | +binary-indep: build install | ||
| 1432 | + dh_testdir -i | ||
| 1433 | + dh_testroot -i | ||
| 1434 | + dh_installchangelogs -i | ||
| 1435 | + dh_installdocs -i | ||
| 1436 | + dh_link -i | ||
| 1437 | + dh_compress -i | ||
| 1438 | + dh_fixperms -i | ||
| 1439 | + dh_installdeb -i | ||
| 1440 | + dh_gencontrol -i | ||
| 1441 | + dh_md5sums -i | ||
| 1442 | + dh_builddeb -i | ||
| 1443 | + | ||
| 1444 | +binary: binary-indep | ||
| 1445 | +.PHONY: build clean binary-indep binary install | ||
| 1446 | diff -urN nothing/.gitignore nagios-plugins-openvz-beans/.gitignore | ||
| 1447 | --- nothing/.gitignore 1970-01-01 01:00:00.000000000 +0100 | ||
| 1448 | +++ nagios-plugins-openvz-beans/.gitignore 2011-10-17 14:23:00.695695306 +0200 | ||
| 1449 | @@ -0,0 +1 @@ | ||
| 1450 | +*.pyc | ||
| 1451 | diff -urN nothing/nagios-plugins-openvz-beans.spec nagios-plugins-openvz-beans/nagios-plugins-openvz-beans.spec | ||
| 1452 | --- nothing/nagios-plugins-openvz-beans.spec 1970-01-01 01:00:00.000000000 +0100 | ||
| 1453 | +++ nagios-plugins-openvz-beans/nagios-plugins-openvz-beans.spec 2011-11-01 16:54:35.621582988 +0100 | ||
| 1454 | @@ -0,0 +1,34 @@ | ||
| 1455 | +Name: nagios-plugins-openvz-beans | ||
| 1456 | +Version: 0.5 | ||
| 1457 | +Release: 0 | ||
| 1458 | +Summary: Nagios Plugin to check OpenVZ Bean Counters | ||
| 1459 | +License: GPL | ||
| 1460 | +Group: Applications/System | ||
| 1461 | +Source: check_openvz_beans.py | ||
| 1462 | + | ||
| 1463 | +Autoreq: 0 | ||
| 1464 | +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root | ||
| 1465 | +BuildArch: noarch | ||
| 1466 | +Requires: python | ||
| 1467 | + | ||
| 1468 | +%description | ||
| 1469 | +Nagios Plugin to check OpenVZ Bean Counters | ||
| 1470 | + | ||
| 1471 | +%prep | ||
| 1472 | +rm -rf %{buildroot} | ||
| 1473 | + | ||
| 1474 | +%install | ||
| 1475 | +install -d -m0755 %{buildroot}%{_libdir}/nagios/plugins/contrib/ | ||
| 1476 | +install -m0755 %{_sourcefile} %{buildroot}%{_libdir}/nagios/plugins/contrib/ | ||
| 1477 | + | ||
| 1478 | + | ||
| 1479 | +%clean | ||
| 1480 | +rm -rf %{buildroot} | ||
| 1481 | + | ||
| 1482 | +%files | ||
| 1483 | +%dir %{_libdir}/nagios/plugins/contrib | ||
| 1484 | +%attr(755, root, root) %{_libdir}/nagios/plugins/contrib/check_openvz_beans.py | ||
| 1485 | + | ||
| 1486 | +%changelog | ||
| 1487 | +* Thu Oct 13 2011 Andreas Kotes <andreas.kotes@nokia.com> 0.5 | ||
| 1488 | + - initial release packaging | ||
| 1489 | diff -urN nothing/README nagios-plugins-openvz-beans/README | ||
| 1490 | --- nothing/README 1970-01-01 01:00:00.000000000 +0100 | ||
| 1491 | +++ nagios-plugins-openvz-beans/README 2011-11-01 18:04:40.633309403 +0100 | ||
| 1492 | @@ -0,0 +1,75 @@ | ||
| 1493 | +Nagios check for OpenVZ bean counters | ||
| 1494 | +===================================== | ||
| 1495 | + | ||
| 1496 | +General | ||
| 1497 | +------- | ||
| 1498 | + | ||
| 1499 | +This Nagios plugin allows to define and check for thresholds against bean | ||
| 1500 | +counters defined in /proc/user_beancounters, which are available in both OpenVZ | ||
| 1501 | +hypervisors and VMs. | ||
| 1502 | + | ||
| 1503 | +It's possible to set global thresholds via '-c' (for critical) and '-w' (for | ||
| 1504 | +warning) which apply to all resources checked. | ||
| 1505 | + | ||
| 1506 | +Tresholds for individual resources can be set by using '-C'/'-W' and giving | ||
| 1507 | +comma-separated key:value pairs. | ||
| 1508 | + | ||
| 1509 | +The script was written to be compatible with Python 2.4 and later. | ||
| 1510 | + | ||
| 1511 | +Reading /proc/user_beancounters | ||
| 1512 | +------------------------------- | ||
| 1513 | + | ||
| 1514 | +Since /proc/user_beancounters is only readable by the root user - and running | ||
| 1515 | +Nagios plugins as the root user is highly discouraged - you can either copy | ||
| 1516 | +this file and check against the copy using the -f option. Or - if you have set | ||
| 1517 | +up your /etc/sudoers file to allow it - you can use the -s option, which lets | ||
| 1518 | +check_openvz_beans use 'sudo cat /proc/user_beancounters' to read the file. | ||
| 1519 | + | ||
| 1520 | +Hostname handling | ||
| 1521 | +----------------- | ||
| 1522 | +The OpenVZ context IDs are resolved by grepping for the HOSTNAME variable in | ||
| 1523 | +the uid's config file found in the path given by '-p'. | ||
| 1524 | + | ||
| 1525 | +Hostnames (e.g. this.is.a.very.long.hostname) are shortened to their first two | ||
| 1526 | +components per default (e.g. this.is for the former one), but this length can | ||
| 1527 | +be configured using -d (e.g. '-d 1' for 'this', '-d 3' for 'this.is.a'), | ||
| 1528 | +allowing you to identify the affected VM(s) in the Nagios alert message | ||
| 1529 | +already. | ||
| 1530 | + | ||
| 1531 | +Output | ||
| 1532 | +------ | ||
| 1533 | + | ||
| 1534 | +The output follows the Nagios Plugin API 3.0, i.e. the script gives the proper | ||
| 1535 | +exit codes (0 = OK, 1 = Warning, 2 = Critical, 3 = Unknown), a simple single | ||
| 1536 | +line of text, and additional perf-data. | ||
| 1537 | + | ||
| 1538 | +The single line of text informs about WARNING or CRITICAL state, and what's a | ||
| 1539 | +problem: | ||
| 1540 | + | ||
| 1541 | +FAIL - a resource against its limit and the was blocked by kernel | ||
| 1542 | +OVER - a resource was over its relevant threshold and will cause problems | ||
| 1543 | +CRIT - a resource ran close to its threshold by given (critical) percentage | ||
| 1544 | +WARN - a resource ran close to its threshold by given (warning) percentage | ||
| 1545 | + | ||
| 1546 | +Data used | ||
| 1547 | +--------- | ||
| 1548 | + | ||
| 1549 | +The value checked for each resource is the 'held' value, but you could use '-m' | ||
| 1550 | +to use the 'maxheld' value instead. You'll not be able to reset that value, | ||
| 1551 | +though, so any Nagios warning/failure status will stay until the next | ||
| 1552 | +hypervisor reboot. | ||
| 1553 | + | ||
| 1554 | +Failure counters can't be reset either, but the plugin reads the data stored by | ||
| 1555 | +vzubc's relative mode, i.e. if you inspect the problem with 'vzubc -r', the | ||
| 1556 | +critical status will be resolved. This behaviour can be turned off with '-a'. | ||
| 1557 | + | ||
| 1558 | +If you are storing data somewhere else than the default '/tmp/vzubc.store', you | ||
| 1559 | +can change that via '-u'. | ||
| 1560 | + | ||
| 1561 | +vzubc is provided by the vzctl package which isn't used by this code directly, | ||
| 1562 | +nor is there a dependency - you'll have to install it yourself if you want to | ||
| 1563 | +use this functionality. | ||
| 1564 | + | ||
| 1565 | +Each group lists the hostname & uid of the VM in the regular message, | ||
| 1566 | +additionally the resource name and how much its threshold was exeeded are given | ||
| 1567 | +in the perfdata line. | ||
| 1568 | diff -urN nothing/README.source nagios-plugins-openvz-beans/README.source | ||
| 1569 | --- nothing/README.source 1970-01-01 01:00:00.000000000 +0100 | ||
| 1570 | +++ nagios-plugins-openvz-beans/README.source 2011-11-01 16:29:20.667358270 +0100 | ||
| 1571 | @@ -0,0 +1,16 @@ | ||
| 1572 | +The implementation can be tested by calling its test scripts | ||
| 1573 | +./check_openvz_beans-test.py, which runs unit tests for almost all of its code, | ||
| 1574 | +and requires Python unittest >= 2.4 as well as pymox. | ||
| 1575 | + | ||
| 1576 | +Current code coverage of the unit tests is >95%. | ||
| 1577 | + | ||
| 1578 | +RPMs can be build using the following commandline: | ||
| 1579 | + | ||
| 1580 | +rpmbuild -bb -D "_sourcefile `pwd`/check_openvz_beans.py" nagios-plugins-openvz-beans.spec | ||
| 1581 | + | ||
| 1582 | +Debian / Ubuntu packages can be build by simply calling: | ||
| 1583 | + | ||
| 1584 | +dpkg-buildpackage | ||
| 1585 | + | ||
| 1586 | +... in both cases the proper developer tools for the corresponding distribution | ||
| 1587 | +have to be installed. | ||
| 1588 | diff -urN nothing/testdata/10.conf nagios-plugins-openvz-beans/testdata/10.conf | ||
| 1589 | --- nothing/testdata/10.conf 1970-01-01 01:00:00.000000000 +0100 | ||
| 1590 | +++ nagios-plugins-openvz-beans/testdata/10.conf 2011-11-01 19:09:28.124150356 +0100 | ||
| 1591 | @@ -0,0 +1 @@ | ||
| 1592 | +HOSTNAME="vmokay.pr.foo.test.your.do.main" | ||
| 1593 | diff -urN nothing/testdata/60.conf nagios-plugins-openvz-beans/testdata/60.conf | ||
| 1594 | --- nothing/testdata/60.conf 1970-01-01 01:00:00.000000000 +0100 | ||
| 1595 | +++ nagios-plugins-openvz-beans/testdata/60.conf 2011-11-01 19:09:32.834163485 +0100 | ||
| 1596 | @@ -0,0 +1 @@ | ||
| 1597 | +HOSTNAME="vmover1.st.foo.test.your.do.main" | ||
| 1598 | diff -urN nothing/testdata/hostcrit.bcs nagios-plugins-openvz-beans/testdata/hostcrit.bcs | ||
| 1599 | --- nothing/testdata/hostcrit.bcs 1970-01-01 01:00:00.000000000 +0100 | ||
| 1600 | +++ nagios-plugins-openvz-beans/testdata/hostcrit.bcs 2011-11-01 19:07:53.643886880 +0100 | ||
| 1601 | @@ -0,0 +1,170 @@ | ||
| 1602 | +Version: 2.5 | ||
| 1603 | + uid resource held maxheld barrier limit failcnt | ||
| 1604 | + 40: kmemsize 12345678 33456789 34567890 40000000 0 | ||
| 1605 | + lockedpages 0 5859 32768 65536 0 | ||
| 1606 | + privvmpages 1234567 2345678 3276800 9223372036854775807 0 | ||
| 1607 | + shmpages 688 1344 9223372036854775807 9223372036854775807 0 | ||
| 1608 | + dummy 0 0 0 0 0 | ||
| 1609 | + numproc 75 88 8000 8000 0 | ||
| 1610 | + physpages 199301 239798 0 9223372036854775807 0 | ||
| 1611 | + vmguarpages 0 0 4194304 9223372036854775807 0 | ||
| 1612 | + oomguarpages 199301 239798 4186112 9223372036854775807 0 | ||
| 1613 | + numtcpsock 16 21 9223372036854775807 9223372036854775807 0 | ||
| 1614 | + numflock 4 14 200 220 0 | ||
| 1615 | + numpty 1 2 64 64 0 | ||
| 1616 | + numsiginfo 0 9 512 512 0 | ||
| 1617 | + tcpsndbuf 278016 547280 2703360 9223372036854775807 0 | ||
| 1618 | + tcprcvbuf 262144 769968 2703360 9223372036854775807 0 | ||
| 1619 | + othersockbuf 158304 197424 9223372036854775807 9223372036854775807 0 | ||
| 1620 | + dgramrcvbuf 0 58680 262144 262144 0 | ||
| 1621 | + numothersock 115 125 360 360 0 | ||
| 1622 | + dcachesize 0 0 9223372036854775807 9223372036854775807 0 | ||
| 1623 | + numfile 1655 1958 9312 9312 0 | ||
| 1624 | + dummy 0 0 0 0 0 | ||
| 1625 | + dummy 0 0 0 0 0 | ||
| 1626 | + dummy 0 0 0 0 0 | ||
| 1627 | + numiptent 20 20 128 128 0 | ||
| 1628 | + 20: kmemsize 12345678 23456789 34567890 40000000 0 | ||
| 1629 | + lockedpages 0 5859 32768 65536 0 | ||
| 1630 | + privvmpages 1234567 2345678 3276800 9223372036854775807 3 | ||
| 1631 | + shmpages 688 1344 9223372036854775807 9223372036854775807 0 | ||
| 1632 | + dummy 0 0 0 0 0 | ||
| 1633 | + numproc 75 88 8000 8000 0 | ||
| 1634 | + physpages 199301 239798 0 9223372036854775807 0 | ||
| 1635 | + vmguarpages 0 0 4194304 9223372036854775807 0 | ||
| 1636 | + oomguarpages 199301 239798 4186112 9223372036854775807 0 | ||
| 1637 | + numtcpsock 16 21 9223372036854775807 9223372036854775807 0 | ||
| 1638 | + numflock 4 14 200 220 0 | ||
| 1639 | + numpty 1 2 64 64 0 | ||
| 1640 | + numsiginfo 0 9 512 512 0 | ||
| 1641 | + tcpsndbuf 278016 547280 2703360 9223372036854775807 0 | ||
| 1642 | + tcprcvbuf 262144 769968 2703360 9223372036854775807 0 | ||
| 1643 | + othersockbuf 158304 197424 9223372036854775807 9223372036854775807 0 | ||
| 1644 | + dgramrcvbuf 0 58680 262144 262144 0 | ||
| 1645 | + numothersock 115 125 360 360 0 | ||
| 1646 | + dcachesize 0 0 9223372036854775807 9223372036854775807 0 | ||
| 1647 | + numfile 1655 1958 9312 9312 0 | ||
| 1648 | + dummy 0 0 0 0 0 | ||
| 1649 | + dummy 0 0 0 0 0 | ||
| 1650 | + dummy 0 0 0 0 0 | ||
| 1651 | + numiptent 20 20 128 128 0 | ||
| 1652 | + 30: kmemsize 12345678 23456789 34567890 40000000 0 | ||
| 1653 | + lockedpages 0 5859 32768 65536 0 | ||
| 1654 | + privvmpages 1234567 2345678 3276800 9223372036854775807 3 | ||
| 1655 | + shmpages 688 1344 9223372036854775807 9223372036854775807 0 | ||
| 1656 | + dummy 0 0 0 0 0 | ||
| 1657 | + numproc 75 88 100 120 2 | ||
| 1658 | + physpages 199301 239798 0 9223372036854775807 0 | ||
| 1659 | + vmguarpages 0 0 4194304 9223372036854775807 0 | ||
| 1660 | + oomguarpages 199301 239798 4186112 9223372036854775807 0 | ||
| 1661 | + numtcpsock 16 21 9223372036854775807 9223372036854775807 0 | ||
| 1662 | + numflock 4 14 200 220 0 | ||
| 1663 | + numpty 1 2 64 64 0 | ||
| 1664 | + numsiginfo 0 9 512 512 0 | ||
| 1665 | + tcpsndbuf 278016 547280 2703360 9223372036854775807 0 | ||
| 1666 | + tcprcvbuf 262144 769968 2703360 9223372036854775807 0 | ||
| 1667 | + othersockbuf 158304 197424 9223372036854775807 9223372036854775807 0 | ||
| 1668 | + dgramrcvbuf 0 58680 262144 262144 0 | ||
| 1669 | + numothersock 115 125 360 360 0 | ||
| 1670 | + dcachesize 0 0 9223372036854775807 9223372036854775807 0 | ||
| 1671 | + numfile 1655 1958 9312 9312 0 | ||
| 1672 | + dummy 0 0 0 0 0 | ||
| 1673 | + dummy 0 0 0 0 0 | ||
| 1674 | + dummy 0 0 0 0 0 | ||
| 1675 | + numiptent 20 20 128 128 0 | ||
| 1676 | + 10: kmemsize 12345678 30456789 34567890 40000000 0 | ||
| 1677 | + lockedpages 0 5859 32768 65536 0 | ||
| 1678 | + privvmpages 1234567 2345678 3276800 9223372036854775807 0 | ||
| 1679 | + shmpages 688 1344 9223372036854775807 9223372036854775807 0 | ||
| 1680 | + dummy 0 0 0 0 0 | ||
| 1681 | + numproc 75 88 8000 8000 0 | ||
| 1682 | + physpages 199301 239798 0 9223372036854775807 0 | ||
| 1683 | + vmguarpages 0 0 4194304 9223372036854775807 0 | ||
| 1684 | + oomguarpages 199301 239798 4186112 9223372036854775807 0 | ||
| 1685 | + numtcpsock 16 21 9223372036854775807 9223372036854775807 0 | ||
| 1686 | + numflock 4 14 200 220 0 | ||
| 1687 | + numpty 1 2 64 64 0 | ||
| 1688 | + numsiginfo 0 9 512 512 0 | ||
| 1689 | + tcpsndbuf 278016 547280 2703360 9223372036854775807 0 | ||
| 1690 | + tcprcvbuf 262144 769968 2703360 9223372036854775807 0 | ||
| 1691 | + othersockbuf 158304 197424 9223372036854775807 9223372036854775807 0 | ||
| 1692 | + dgramrcvbuf 0 58680 262144 262144 0 | ||
| 1693 | + numothersock 115 125 360 360 0 | ||
| 1694 | + dcachesize 0 0 9223372036854775807 9223372036854775807 0 | ||
| 1695 | + numfile 1655 1958 9312 9312 0 | ||
| 1696 | + dummy 0 0 0 0 0 | ||
| 1697 | + dummy 0 0 0 0 0 | ||
| 1698 | + dummy 0 0 0 0 0 | ||
| 1699 | + numiptent 20 20 128 128 0 | ||
| 1700 | + 50: kmemsize 12345678 31456789 34567890 40000000 0 | ||
| 1701 | + lockedpages 0 5859 32768 65536 0 | ||
| 1702 | + privvmpages 1234567 2345678 3276800 9223372036854775807 0 | ||
| 1703 | + shmpages 688 1344 9223372036854775807 9223372036854775807 0 | ||
| 1704 | + dummy 0 0 0 0 0 | ||
| 1705 | + numproc 75 88 8000 8000 0 | ||
| 1706 | + physpages 199301 239798 0 9223372036854775807 0 | ||
| 1707 | + vmguarpages 0 0 4194304 9223372036854775807 0 | ||
| 1708 | + oomguarpages 199301 239798 4186112 9223372036854775807 0 | ||
| 1709 | + numtcpsock 16 21 9223372036854775807 9223372036854775807 0 | ||
| 1710 | + numflock 4 14 200 220 0 | ||
| 1711 | + numpty 1 2 64 64 0 | ||
| 1712 | + numsiginfo 0 9 512 512 0 | ||
| 1713 | + tcpsndbuf 278016 547280 2703360 9223372036854775807 0 | ||
| 1714 | + tcprcvbuf 262144 769968 2703360 9223372036854775807 0 | ||
| 1715 | + othersockbuf 158304 197424 9223372036854775807 9223372036854775807 0 | ||
| 1716 | + dgramrcvbuf 0 58680 262144 262144 0 | ||
| 1717 | + numothersock 115 125 360 360 0 | ||
| 1718 | + dcachesize 0 0 9223372036854775807 9223372036854775807 0 | ||
| 1719 | + numfile 1655 1958 9312 9312 0 | ||
| 1720 | + dummy 0 0 0 0 0 | ||
| 1721 | + dummy 0 0 0 0 0 | ||
| 1722 | + dummy 0 0 0 0 0 | ||
| 1723 | + numiptent 20 20 128 128 0 | ||
| 1724 | + 60: kmemsize 12345678 40000001 34567890 40000000 0 | ||
| 1725 | + lockedpages 0 5859 32768 65536 0 | ||
| 1726 | + privvmpages 1234567 2345678 3276800 9223372036854775807 0 | ||
| 1727 | + shmpages 688 1344 9223372036854775807 9223372036854775807 0 | ||
| 1728 | + dummy 0 0 0 0 0 | ||
| 1729 | + numproc 75 88 8000 8000 0 | ||
| 1730 | + physpages 199301 239798 0 9223372036854775807 0 | ||
| 1731 | + vmguarpages 0 0 4194304 9223372036854775807 0 | ||
| 1732 | + oomguarpages 199301 239798 4186112 9223372036854775807 0 | ||
| 1733 | + numtcpsock 16 21 9223372036854775807 9223372036854775807 0 | ||
| 1734 | + numflock 4 14 200 220 0 | ||
| 1735 | + numpty 1 2 64 64 0 | ||
| 1736 | + numsiginfo 0 9 512 512 0 | ||
| 1737 | + tcpsndbuf 278016 547280 2703360 9223372036854775807 0 | ||
| 1738 | + tcprcvbuf 262144 769968 2703360 9223372036854775807 0 | ||
| 1739 | + othersockbuf 158304 197424 9223372036854775807 9223372036854775807 0 | ||
| 1740 | + dgramrcvbuf 0 58680 262144 262144 0 | ||
| 1741 | + numothersock 115 125 360 360 0 | ||
| 1742 | + dcachesize 0 0 9223372036854775807 9223372036854775807 0 | ||
| 1743 | + numfile 1655 1958 9312 9312 0 | ||
| 1744 | + dummy 0 0 0 0 0 | ||
| 1745 | + dummy 0 0 0 0 0 | ||
| 1746 | + dummy 0 0 0 0 0 | ||
| 1747 | + numiptent 20 20 128 128 0 | ||
| 1748 | + 0: kmemsize 15408521 33415719 9223372036854775807 9223372036854775807 0 | ||
| 1749 | + lockedpages 8789 12353 9223372036854775807 9223372036854775807 0 | ||
| 1750 | + privvmpages 41072 104930 9223372036854775807 9223372036854775807 0 | ||
| 1751 | + shmpages 730 1706 9223372036854775807 9223372036854775807 0 | ||
| 1752 | + dummy 0 0 9223372036854775807 9223372036854775807 0 | ||
| 1753 | + numproc 291 472 9223372036854775807 9223372036854775807 0 | ||
| 1754 | + physpages 9432 54303 9223372036854775807 9223372036854775807 0 | ||
| 1755 | + vmguarpages 0 0 9223372036854775807 9223372036854775807 0 | ||
| 1756 | + oomguarpages 9432 54303 9223372036854775807 9223372036854775807 0 | ||
| 1757 | + numtcpsock 13 21 9223372036854775807 9223372036854775807 0 | ||
| 1758 | + numflock 5 22 9223372036854775807 9223372036854775807 0 | ||
| 1759 | + numpty 1 1 9223372036854775807 9223372036854775807 0 | ||
| 1760 | + numsiginfo 0 6 9223372036854775807 9223372036854775807 0 | ||
| 1761 | + tcpsndbuf 773048 924800 9223372036854775807 9223372036854775807 0 | ||
| 1762 | + tcprcvbuf 212992 854408 9223372036854775807 9223372036854775807 0 | ||
| 1763 | + othersockbuf 204864 283784 9223372036854775807 9223372036854775807 0 | ||
| 1764 | + dgramrcvbuf 0 16944 9223372036854775807 9223372036854775807 0 | ||
| 1765 | + numothersock 178 225 9223372036854775807 9223372036854775807 0 | ||
| 1766 | + dcachesize 0 0 9223372036854775807 9223372036854775807 0 | ||
| 1767 | + numfile 5141 6779 9223372036854775807 9223372036854775807 0 | ||
| 1768 | + dummy 0 0 9223372036854775807 9223372036854775807 0 | ||
| 1769 | + dummy 0 0 9223372036854775807 9223372036854775807 0 | ||
| 1770 | + dummy 0 0 9223372036854775807 9223372036854775807 0 | ||
| 1771 | + numiptent 51 51 9223372036854775807 9223372036854775807 0 | ||
diff --git a/web/attachments/427934-check_nt-uptime-perfdata.diff b/web/attachments/427934-check_nt-uptime-perfdata.diff new file mode 100644 index 0000000..2423c42 --- /dev/null +++ b/web/attachments/427934-check_nt-uptime-perfdata.diff | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | --- plugins/check_nt.c.v0 2011-11-07 22:02:22.000000000 +0100 | ||
| 2 | +++ plugins/check_nt.c 2011-11-07 22:05:00.000000000 +0100 | ||
| 3 | @@ -202,7 +202,7 @@ int main(int argc, char **argv){ | ||
| 4 | updays = uptime / 86400; | ||
| 5 | uphours = (uptime % 86400) / 3600; | ||
| 6 | upminutes = ((uptime % 86400) % 3600) / 60; | ||
| 7 | - asprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes); | ||
| 8 | + asprintf(&output_message, _("System Uptime - %u day(s) %u hour(s) %u minute(s)|uptime=%lu"), updays, uphours, upminutes, uptime); | ||
| 9 | return_code=STATE_OK; | ||
| 10 | break; | ||
diff --git a/web/attachments/428489-check_ping-seconds-perfdata.diff b/web/attachments/428489-check_ping-seconds-perfdata.diff new file mode 100644 index 0000000..78b01f6 --- /dev/null +++ b/web/attachments/428489-check_ping-seconds-perfdata.diff | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | diff -u -p -b check_ping.c.v0 check_ping.c | ||
| 2 | --- check_ping.c.v0 2011-11-15 13:00:48.823063478 +0100 | ||
| 3 | +++ check_ping.c 2011-11-15 13:28:40.819060887 +0100 | ||
| 4 | @@ -54,6 +54,7 @@ void print_usage (void); | ||
| 5 | void print_help (void); | ||
| 6 | |||
| 7 | int display_html = FALSE; | ||
| 8 | +int perfdata_seconds = FALSE; | ||
| 9 | int wpl = UNKNOWN_PACKET_LOSS; | ||
| 10 | int cpl = UNKNOWN_PACKET_LOSS; | ||
| 11 | float wrta = UNKNOWN_TRIP_TIME; | ||
| 12 | @@ -163,6 +164,12 @@ main (int argc, char **argv) | ||
| 13 | printf ("</A>"); | ||
| 14 | |||
| 15 | /* Print performance data */ | ||
| 16 | + if (perfdata_seconds) | ||
| 17 | + printf("|%s", fperfdata ("rta", (double) (rta/1000), "s", | ||
| 18 | + wrta>0?TRUE:FALSE, wrta/1000, | ||
| 19 | + crta>0?TRUE:FALSE, crta/1000, | ||
| 20 | + TRUE, 0, FALSE, 0)); | ||
| 21 | + else | ||
| 22 | printf("|%s", fperfdata ("rta", (double) rta, "ms", | ||
| 23 | wrta>0?TRUE:FALSE, wrta, | ||
| 24 | crta>0?TRUE:FALSE, crta, | ||
| 25 | @@ -200,6 +207,7 @@ process_arguments (int argc, char **argv | ||
| 26 | {"link", no_argument, 0, 'L'}, | ||
| 27 | {"use-ipv4", no_argument, 0, '4'}, | ||
| 28 | {"use-ipv6", no_argument, 0, '6'}, | ||
| 29 | + {"seconds", no_argument, 0, 's'}, | ||
| 30 | {0, 0, 0, 0} | ||
| 31 | }; | ||
| 32 | |||
| 33 | @@ -214,7 +222,7 @@ process_arguments (int argc, char **argv | ||
| 34 | } | ||
| 35 | |||
| 36 | while (1) { | ||
| 37 | - c = getopt_long (argc, argv, "VvhnL46t:c:w:H:p:", longopts, &option); | ||
| 38 | + c = getopt_long (argc, argv, "VvhnL46st:c:w:H:p:", longopts, &option); | ||
| 39 | |||
| 40 | if (c == -1 || c == EOF) | ||
| 41 | break; | ||
| 42 | @@ -283,6 +291,9 @@ process_arguments (int argc, char **argv | ||
| 43 | case 'w': | ||
| 44 | get_threshold (optarg, &wrta, &wpl); | ||
| 45 | break; | ||
| 46 | + case 's': | ||
| 47 | + perfdata_seconds = TRUE; | ||
| 48 | + break; | ||
| 49 | } | ||
| 50 | } | ||
| 51 | |||
| 52 | @@ -578,6 +589,8 @@ print_help (void) | ||
| 53 | printf (_("(Default: %d)\n"), DEFAULT_MAX_PACKETS); | ||
| 54 | printf (" %s\n", "-L, --link"); | ||
| 55 | printf (" %s\n", _("show HTML in the plugin output (obsoleted by urlize)")); | ||
| 56 | + printf (" %s\n", "-s, --seconds"); | ||
| 57 | + printf (" %s\n", _("output performance data in seconds rather than milliseconds")); | ||
| 58 | |||
| 59 | printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); | ||
| 60 | |||
| 61 | @@ -600,5 +613,5 @@ print_usage (void) | ||
| 62 | { | ||
| 63 | printf ("%s\n", _("Usage:")); | ||
| 64 | printf ("%s -H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n", progname); | ||
| 65 | - printf (" [-p packets] [-t timeout] [-4|-6]\n"); | ||
| 66 | + printf (" [-p packets] [-t timeout] [-4|-6] [-s]\n"); | ||
| 67 | } | ||
diff --git a/web/attachments/42908-check_dns_freebsd.patch b/web/attachments/42908-check_dns_freebsd.patch new file mode 100644 index 0000000..c856ab9 --- /dev/null +++ b/web/attachments/42908-check_dns_freebsd.patch | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | --- check_dns.c.orig Wed Feb 19 21:01:54 2003 | ||
| 2 | +++ check_dns.c Wed Feb 19 21:07:22 2003 | ||
| 3 | @@ -132,7 +132,10 @@ | ||
| 4 | printf ("%s\n", input_buffer); | ||
| 5 | |||
| 6 | if ((temp_buffer = index (input_buffer, ':'))) { | ||
| 7 | - address = strscpy (address, temp_buffer + 2); | ||
| 8 | + temp_buffer++; | ||
| 9 | + for(; *temp_buffer != '\0' && *temp_buffer == ' '; temp_buffer++) | ||
| 10 | + /* NOOP */; | ||
| 11 | + address = strscpy (address, temp_buffer); | ||
| 12 | strip (address); | ||
| 13 | result = STATE_OK; | ||
| 14 | } | ||
diff --git a/web/attachments/429277-check_http.patch b/web/attachments/429277-check_http.patch new file mode 100644 index 0000000..3f52985 --- /dev/null +++ b/web/attachments/429277-check_http.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-3 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378824926" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378824926" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378824926" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378824926" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378824926'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=3442015&group_id=29880&atid=397599&file_id=429277" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/429681-check_http.patch b/web/attachments/429681-check_http.patch new file mode 100644 index 0000000..ae9d48a --- /dev/null +++ b/web/attachments/429681-check_http.patch | |||
| @@ -0,0 +1,80 @@ | |||
| 1 | --- nagios-plugins-1.4.15/plugins/check_http.c 2011-11-28 16:35:25.000000000 +0000 | ||
| 2 | +++ nagios-plugins-1.4.15.new/plugins/check_http.c 2011-11-28 13:26:56.000000000 +0000 | ||
| 3 | @@ -90,10 +90,12 @@ | ||
| 4 | |||
| 5 | int specify_port = FALSE; | ||
| 6 | int server_port = HTTP_PORT; | ||
| 7 | +int virtual_port = 0; | ||
| 8 | char server_port_text[6] = ""; | ||
| 9 | char server_type[6] = "http"; | ||
| 10 | char *server_address; | ||
| 11 | char *host_name; | ||
| 12 | +int host_name_length; | ||
| 13 | char *server_url; | ||
| 14 | char *user_agent; | ||
| 15 | int server_url_length; | ||
| 16 | @@ -334,11 +336,25 @@ | ||
| 17 | case 'H': /* Host Name (virtual host) */ | ||
| 18 | host_name = strdup (optarg); | ||
| 19 | if (host_name[0] == '[') { | ||
| 20 | - if ((p = strstr (host_name, "]:")) != NULL) /* [IPv6]:port */ | ||
| 21 | - server_port = atoi (p + 2); | ||
| 22 | + if ((p = strstr (host_name, "]:")) != NULL) { /* [IPv6]:port */ | ||
| 23 | + virtual_port = atoi (p + 2); | ||
| 24 | + /* cut off the port */ | ||
| 25 | + host_name_length = strlen (host_name) - strlen (p) - 1; | ||
| 26 | + free (host_name); | ||
| 27 | + host_name = strndup (optarg, host_name_length); | ||
| 28 | + if (specify_port == FALSE) | ||
| 29 | + server_port = virtual_port; | ||
| 30 | + } | ||
| 31 | } else if ((p = strchr (host_name, ':')) != NULL | ||
| 32 | - && strchr (++p, ':') == NULL) /* IPv4:port or host:port */ | ||
| 33 | - server_port = atoi (p); | ||
| 34 | + && strchr (++p, ':') == NULL) { /* IPv4:port or host:port */ | ||
| 35 | + virtual_port = atoi (p); | ||
| 36 | + /* cut off the port */ | ||
| 37 | + host_name_length = strlen (host_name) - strlen (p) - 1; | ||
| 38 | + free (host_name); | ||
| 39 | + host_name = strndup (optarg, host_name_length); | ||
| 40 | + if (specify_port == FALSE) | ||
| 41 | + server_port = virtual_port; | ||
| 42 | + } | ||
| 43 | break; | ||
| 44 | case 'I': /* Server IP-address */ | ||
| 45 | server_address = strdup (optarg); | ||
| 46 | @@ -484,6 +500,9 @@ | ||
| 47 | if (http_method == NULL) | ||
| 48 | http_method = strdup ("GET"); | ||
| 49 | |||
| 50 | + if (virtual_port == 0) | ||
| 51 | + virtual_port = server_port; | ||
| 52 | + | ||
| 53 | return TRUE; | ||
| 54 | } | ||
| 55 | |||
| 56 | @@ -829,11 +848,11 @@ | ||
| 57 | * 14.23). Some server applications/configurations cause trouble if the | ||
| 58 | * (default) port is explicitly specified in the "Host:" header line. | ||
| 59 | */ | ||
| 60 | - if ((use_ssl == FALSE && server_port == HTTP_PORT) || | ||
| 61 | - (use_ssl == TRUE && server_port == HTTPS_PORT)) | ||
| 62 | + if ((use_ssl == FALSE && virtual_port == HTTP_PORT) || | ||
| 63 | + (use_ssl == TRUE && virtual_port == HTTPS_PORT)) | ||
| 64 | asprintf (&buf, "%sHost: %s\r\n", buf, host_name); | ||
| 65 | else | ||
| 66 | - asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port); | ||
| 67 | + asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, virtual_port); | ||
| 68 | } | ||
| 69 | |||
| 70 | /* optionally send any other header tag */ | ||
| 71 | @@ -1255,6 +1274,9 @@ | ||
| 72 | MAX_PORT, server_type, server_address, server_port, server_url, | ||
| 73 | display_html ? "</A>" : ""); | ||
| 74 | |||
| 75 | + /* reset virtual port */ | ||
| 76 | + virtual_port = server_port; | ||
| 77 | + | ||
| 78 | if (verbose) | ||
| 79 | printf (_("Redirection to %s://%s:%d%s\n"), server_type, | ||
| 80 | host_name ? host_name : server_address, server_port, server_url); | ||
diff --git a/web/attachments/430067-check_proc-perfdata.patch b/web/attachments/430067-check_proc-perfdata.patch new file mode 100644 index 0000000..a7f409a --- /dev/null +++ b/web/attachments/430067-check_proc-perfdata.patch | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | --- nagios-plugins-1.4.15/plugins/check_procs.c 2010-07-27 22:47:16.000000000 +0200 | ||
| 2 | +++ /home/goesta/Projekte/Nagios/nagios-plugins_procs_perfpatch/plugins/check_procs.c 2009-12-19 01:12:49.924399127 +0100 | ||
| 3 | @@ -92,6 +92,7 @@ | ||
| 4 | char *fmt; | ||
| 5 | char *fails; | ||
| 6 | char tmp[MAX_INPUT_BUFFER]; | ||
| 7 | +int print_perfdata = 0; | ||
| 8 | |||
| 9 | FILE *ps_input = NULL; | ||
| 10 | |||
| 11 | @@ -293,6 +294,9 @@ | ||
| 12 | } | ||
| 13 | } | ||
| 14 | printf (ngettext ("%d process", "%d processes", (unsigned long) procs), procs); | ||
| 15 | + if ( print_perfdata == 1 ) { | ||
| 16 | + printf ("|procs=%d;%d;%d;0;", procs, wmax, cmax); | ||
| 17 | + } | ||
| 18 | |||
| 19 | if (strcmp(fmt,"") != 0) { | ||
| 20 | printf (_(" with %s"), fmt); | ||
| 21 | @@ -331,6 +335,7 @@ | ||
| 22 | {"pcpu", required_argument, 0, 'P'}, | ||
| 23 | {"elapsed", required_argument, 0, 'e'}, | ||
| 24 | {"argument-array", required_argument, 0, 'a'}, | ||
| 25 | + {"perfdata", no_argument, 0, 'd'}, | ||
| 26 | {"help", no_argument, 0, 'h'}, | ||
| 27 | {"version", no_argument, 0, 'V'}, | ||
| 28 | {"verbose", no_argument, 0, 'v'}, | ||
| 29 | @@ -344,7 +349,7 @@ | ||
| 30 | strcpy (argv[c], "-t"); | ||
| 31 | |||
| 32 | while (1) { | ||
| 33 | - c = getopt_long (argc, argv, "Vvht:c:w:p:s:u:C:a:z:r:m:P:", | ||
| 34 | + c = getopt_long (argc, argv, "Vvhdt:c:w:p:s:u:C:a:z:r:m:P:", | ||
| 35 | longopts, &option); | ||
| 36 | |||
| 37 | if (c == -1 || c == EOF) | ||
| 38 | @@ -505,6 +510,9 @@ | ||
| 39 | case CHAR_MAX+2: | ||
| 40 | input_filename = optarg; | ||
| 41 | break; | ||
| 42 | + case 'd': | ||
| 43 | + print_perfdata = 1; | ||
| 44 | + break; | ||
| 45 | } | ||
| 46 | } | ||
| 47 | |||
diff --git a/web/attachments/430613-check_fping.c_patch b/web/attachments/430613-check_fping.c_patch new file mode 100644 index 0000000..4c661a8 --- /dev/null +++ b/web/attachments/430613-check_fping.c_patch | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | 68d67 | ||
| 2 | < int alive_p = FALSE; | ||
| 3 | 154,166d152 | ||
| 4 | < if (alive_p && strstr (buf, "avg, 0% loss)")){ | ||
| 5 | < rtastr = strstr (buf, "ms ("); | ||
| 6 | < rtastr = 1 + index (rtastr, '('); | ||
| 7 | < rta = strtod (rtastr, NULL); | ||
| 8 | < loss=strtod ("0",NULL); | ||
| 9 | < die (STATE_OK, | ||
| 10 | < _("FPING %s - %s (rta=%f ms)|%s %s\n"), | ||
| 11 | < state_text (STATE_OK), server_name,rta, | ||
| 12 | < perfdata ("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, TRUE, 0, TRUE, 100), | ||
| 13 | < fperfdata ("rta", rta/1.0e3, "s", wrta_p, wrta/1.0e3, crta_p, crta/1.0e3, TRUE, 0, FALSE, 0)); | ||
| 14 | < | ||
| 15 | < } | ||
| 16 | < | ||
| 17 | 275c261 | ||
| 18 | < c = getopt_long (argc, argv, "+hVvaH:c:w:b:n:T:i:", longopts, &option); | ||
| 19 | --- | ||
| 20 | > c = getopt_long (argc, argv, "+hVvH:c:w:b:n:T:i:", longopts, &option); | ||
| 21 | 292,294d277 | ||
| 22 | < case 'a': /* host alive mode */ | ||
| 23 | < alive_p = TRUE; | ||
| 24 | < break; | ||
| 25 | 436,438d418 | ||
| 26 | < printf (" %s\n", "-a"); | ||
| 27 | < printf (" %s\n", _("Return OK after first successfull reply")); | ||
| 28 | < | ||
diff --git a/web/attachments/431216-check_http-dateformat-subjectname.diff b/web/attachments/431216-check_http-dateformat-subjectname.diff new file mode 100644 index 0000000..28592c1 --- /dev/null +++ b/web/attachments/431216-check_http-dateformat-subjectname.diff | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | diff -u -p nagios-plugins-1.4.15/plugins/sslutils.c.v0 nagios-plugins-1.4.15/plugins/sslutils.c | ||
| 2 | --- nagios-plugins-1.4.15/plugins/sslutils.c.v0 2011-12-19 17:42:22.000000000 +0100 | ||
| 3 | +++ nagios-plugins-1.4.15/plugins/sslutils.c 2011-12-19 17:57:14.000000000 +0100 | ||
| 4 | @@ -103,6 +103,7 @@ int np_net_ssl_check_cert(int days_till_ | ||
| 5 | float time_left; | ||
| 6 | int days_left; | ||
| 7 | char timestamp[17] = ""; | ||
| 8 | + char subject[256]; | ||
| 9 | |||
| 10 | certificate=SSL_get_peer_certificate(s); | ||
| 11 | if(! certificate){ | ||
| 12 | @@ -113,10 +114,14 @@ int np_net_ssl_check_cert(int days_till_ | ||
| 13 | /* Retrieve timestamp of certificate */ | ||
| 14 | tm = X509_get_notAfter (certificate); | ||
| 15 | |||
| 16 | + /* Retrieve subject name in certificate. */ | ||
| 17 | + *subject = '\0'; | ||
| 18 | + X509_NAME_get_text_by_NID(X509_get_subject_name(certificate), NID_commonName, subject, 256); | ||
| 19 | + | ||
| 20 | /* Generate tm structure to process timestamp */ | ||
| 21 | if (tm->type == V_ASN1_UTCTIME) { | ||
| 22 | if (tm->length < 10) { | ||
| 23 | - printf ("%s\n", _("CRITICAL - Wrong time format in certificate.")); | ||
| 24 | + printf ("%s\n", _("CRITICAL - Wrong time format in certificate %s."), subject); | ||
| 25 | return STATE_CRITICAL; | ||
| 26 | } else { | ||
| 27 | stamp.tm_year = (tm->data[0] - '0') * 10 + (tm->data[1] - '0'); | ||
| 28 | @@ -126,7 +131,7 @@ int np_net_ssl_check_cert(int days_till_ | ||
| 29 | } | ||
| 30 | } else { | ||
| 31 | if (tm->length < 12) { | ||
| 32 | - printf ("%s\n", _("CRITICAL - Wrong time format in certificate.")); | ||
| 33 | + printf ("%s\n", _("CRITICAL - Wrong time format in certificate %s."), subject); | ||
| 34 | return STATE_CRITICAL; | ||
| 35 | } else { | ||
| 36 | stamp.tm_year = | ||
| 37 | @@ -149,23 +154,30 @@ int np_net_ssl_check_cert(int days_till_ | ||
| 38 | |||
| 39 | time_left = difftime(timegm(&stamp), time(NULL)); | ||
| 40 | days_left = time_left / 86400; | ||
| 41 | +#ifdef AMERICAN_DATE_FORMAT | ||
| 42 | snprintf | ||
| 43 | (timestamp, 17, "%02d/%02d/%04d %02d:%02d", | ||
| 44 | stamp.tm_mon + 1, | ||
| 45 | stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min); | ||
| 46 | +#else | ||
| 47 | + snprintf | ||
| 48 | + (timestamp, 17, "%04d-%02d-%02d %02d:%02d", | ||
| 49 | + stamp.tm_year + 1900, | ||
| 50 | + stamp.tm_mon + 1, stamp.tm_mday, stamp.tm_hour, stamp.tm_min); | ||
| 51 | +#endif | ||
| 52 | |||
| 53 | if (days_left > 0 && days_left <= days_till_exp) { | ||
| 54 | - printf (_("WARNING - Certificate expires in %d day(s) (%s).\n"), days_left, timestamp); | ||
| 55 | + printf (_("WARNING - Certificate %s expires in %d day(s) (%s).\n"), subject, days_left, timestamp); | ||
| 56 | return STATE_WARNING; | ||
| 57 | } else if (time_left < 0) { | ||
| 58 | - printf (_("CRITICAL - Certificate expired on %s.\n"), timestamp); | ||
| 59 | + printf (_("CRITICAL - Certificate %s expired on %s.\n"), subject, timestamp); | ||
| 60 | return STATE_CRITICAL; | ||
| 61 | } else if (days_left == 0) { | ||
| 62 | - printf (_("WARNING - Certificate expires today (%s).\n"), timestamp); | ||
| 63 | + printf (_("WARNING - Certificate %s expires today (%s).\n"), subject, timestamp); | ||
| 64 | return STATE_WARNING; | ||
| 65 | } | ||
| 66 | |||
| 67 | - printf (_("OK - Certificate will expire on %s.\n"), timestamp); | ||
| 68 | + printf (_("OK - Certificate %s will expire on %s.\n"), subject, timestamp); | ||
| 69 | X509_free (certificate); | ||
| 70 | return STATE_OK; | ||
| 71 | # else /* ifndef USE_OPENSSL */ | ||
diff --git a/web/attachments/43177-check_ifstatus.txt b/web/attachments/43177-check_ifstatus.txt new file mode 100644 index 0000000..476923a --- /dev/null +++ b/web/attachments/43177-check_ifstatus.txt | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | --- check_ifstatus.orig Sat Feb 22 18:18:00 2003 | ||
| 2 | +++ check_ifstatus Sat Feb 22 17:37:06 2003 | ||
| 3 | @@ -156,6 +156,7 @@ | ||
| 4 | |||
| 5 | push(@snmpoids,$snmpIfOperStatus); | ||
| 6 | push(@snmpoids,$snmpIfAdminStatus); | ||
| 7 | +push(@snmpoids,$snmpLocIfDescr); | ||
| 8 | push(@snmpoids,$snmpIfDescr); | ||
| 9 | push(@snmpoids,$snmpIfType); | ||
| 10 | push(@snmpoids,$snmpIfName) if ( defined $ifXTable); | ||
| 11 | @@ -177,6 +178,7 @@ | ||
| 12 | $key = $1; | ||
| 13 | $ifStatus{$key}{$snmpoid} = $response->{$snmpkey}; | ||
| 14 | } | ||
| 15 | +print $snmpLocIfDescr; | ||
| 16 | } | ||
| 17 | |||
| 18 | |||
| 19 | @@ -193,7 +195,7 @@ | ||
| 20 | $ifdown++ ; | ||
| 21 | $ifmessage .= sprintf("%s: down -> %s<BR>", | ||
| 22 | $ifStatus{$key}{$snmpIfDescr}, | ||
| 23 | - $ifStatus{$key}{$snmpIfName}); | ||
| 24 | + $ifStatus{$key}{$snmpLocIfDescr}); | ||
| 25 | } | ||
| 26 | if ($ifStatus{$key}{$snmpIfOperStatus} == 5 ) { $ifdormant++ ;} | ||
| 27 | } | ||
diff --git a/web/attachments/43179-check_ifstatus.txt b/web/attachments/43179-check_ifstatus.txt new file mode 100644 index 0000000..69b540a --- /dev/null +++ b/web/attachments/43179-check_ifstatus.txt | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | --- check_ifstatus.orig Sat Feb 22 18:18:00 2003 | ||
| 2 | +++ check_ifstatus Sat Feb 22 18:23:32 2003 | ||
| 3 | @@ -156,6 +156,7 @@ | ||
| 4 | |||
| 5 | push(@snmpoids,$snmpIfOperStatus); | ||
| 6 | push(@snmpoids,$snmpIfAdminStatus); | ||
| 7 | +push(@snmpoids,$snmpLocIfDescr); | ||
| 8 | push(@snmpoids,$snmpIfDescr); | ||
| 9 | push(@snmpoids,$snmpIfType); | ||
| 10 | push(@snmpoids,$snmpIfName) if ( defined $ifXTable); | ||
| 11 | @@ -193,7 +194,7 @@ | ||
| 12 | $ifdown++ ; | ||
| 13 | $ifmessage .= sprintf("%s: down -> %s<BR>", | ||
| 14 | $ifStatus{$key}{$snmpIfDescr}, | ||
| 15 | - $ifStatus{$key}{$snmpIfName}); | ||
| 16 | + $ifStatus{$key}{$snmpLocIfDescr}); | ||
| 17 | } | ||
| 18 | if ($ifStatus{$key}{$snmpIfOperStatus} == 5 ) { $ifdormant++ ;} | ||
| 19 | } \ No newline at end of file | ||
diff --git a/web/attachments/432136-check_http.patch b/web/attachments/432136-check_http.patch new file mode 100644 index 0000000..827bfba --- /dev/null +++ b/web/attachments/432136-check_http.patch | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | --- check_http.c.old 2010-07-27 12:47:16.000000000 -0700 | ||
| 2 | +++ check_http.c 2012-01-03 16:43:56.000000000 -0800 | ||
| 3 | @@ -99,7 +99,9 @@ | ||
| 4 | int server_url_length; | ||
| 5 | int server_expect_yn = 0; | ||
| 6 | char server_expect[MAX_INPUT_BUFFER] = HTTP_EXPECT; | ||
| 7 | +char header_expect[MAX_INPUT_BUFFER] = ""; | ||
| 8 | char string_expect[MAX_INPUT_BUFFER] = ""; | ||
| 9 | +char output_header_search[30] = ""; | ||
| 10 | char output_string_search[30] = ""; | ||
| 11 | double warning_time = 0; | ||
| 12 | int check_warning_time = FALSE; | ||
| 13 | @@ -198,6 +200,7 @@ | ||
| 14 | {"port", required_argument, 0, 'p'}, | ||
| 15 | {"authorization", required_argument, 0, 'a'}, | ||
| 16 | {"proxy_authorization", required_argument, 0, 'b'}, | ||
| 17 | + {"return_header", required_argument, 0, 'd'}, | ||
| 18 | {"string", required_argument, 0, 's'}, | ||
| 19 | {"expect", required_argument, 0, 'e'}, | ||
| 20 | {"regex", required_argument, 0, 'r'}, | ||
| 21 | @@ -235,7 +238,7 @@ | ||
| 22 | } | ||
| 23 | |||
| 24 | while (1) { | ||
| 25 | - c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 26 | + c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:d:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); | ||
| 27 | if (c == -1 || c == EOF) | ||
| 28 | break; | ||
| 29 | |||
| 30 | @@ -374,6 +377,10 @@ | ||
| 31 | free(http_method); | ||
| 32 | http_method = strdup (optarg); | ||
| 33 | break; | ||
| 34 | + case 'd': /* string or substring */ | ||
| 35 | + strncpy (header_expect, optarg, MAX_INPUT_BUFFER - 1); | ||
| 36 | + header_expect[MAX_INPUT_BUFFER - 1] = 0; | ||
| 37 | + break; | ||
| 38 | case 's': /* string or substring */ | ||
| 39 | strncpy (string_expect, optarg, MAX_INPUT_BUFFER - 1); | ||
| 40 | string_expect[MAX_INPUT_BUFFER - 1] = 0; | ||
| 41 | @@ -1036,6 +1043,18 @@ | ||
| 42 | |||
| 43 | /* Page and Header content checks go here */ | ||
| 44 | |||
| 45 | + if (strlen (header_expect)) { | ||
| 46 | + if (!strstr (header, header_expect)) { | ||
| 47 | + strncpy(&output_header_search[0],header_expect,sizeof(output_header_search)); | ||
| 48 | + if(output_header_search[sizeof(output_header_search)-1]!='\0') { | ||
| 49 | + bcopy("...",&output_header_search[sizeof(output_header_search)-4],4); | ||
| 50 | + } | ||
| 51 | + asprintf (&msg, _("%sheader '%s' not found on '%s://%s:%d%s', "), msg, output_header_search, use_ssl ? "https" : "http", host_name ? host_name : server_address, server_port, server_url); | ||
| 52 | + result = STATE_CRITICAL; | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + | ||
| 57 | if (strlen (string_expect)) { | ||
| 58 | if (!strstr (page, string_expect)) { | ||
| 59 | strncpy(&output_string_search[0],string_expect,sizeof(output_string_search)); | ||
| 60 | @@ -1368,6 +1387,8 @@ | ||
| 61 | |||
| 62 | printf (" %s\n", "-l, --linespan"); | ||
| 63 | printf (" %s\n", _("Allow regex to span newlines (must precede -r or -R)")); | ||
| 64 | + printf (" %s\n", "-d, --header-string=STRING"); | ||
| 65 | + printf (" %s\n", _("Search header for regex STRING")); | ||
| 66 | printf (" %s\n", "-r, --regex, --ereg=STRING"); | ||
| 67 | printf (" %s\n", _("Search page for regex STRING")); | ||
| 68 | printf (" %s\n", "-R, --eregi=STRING"); | ||
| 69 | @@ -1438,7 +1459,7 @@ | ||
| 70 | printf ("%s\n", _("Usage:")); | ||
| 71 | printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname); | ||
| 72 | printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L] [-a auth]\n"); | ||
| 73 | - printf (" [-b proxy_auth] [-f <ok|warning|critcal|follow|sticky|stickyport>]\n"); | ||
| 74 | + printf (" [-b proxy_auth] [-d string] [-f <ok|warning|critcal|follow|sticky|stickyport>]\n"); | ||
| 75 | printf (" [-e <expect>] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n"); | ||
| 76 | printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); | ||
| 77 | printf (" [-A string] [-k string] [-S] [--sni] [-C <age>] [-T <content-type>]\n"); | ||
diff --git a/web/attachments/43214-check_bgpstate.pl b/web/attachments/43214-check_bgpstate.pl new file mode 100644 index 0000000..9f867ff --- /dev/null +++ b/web/attachments/43214-check_bgpstate.pl | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | --- check_bgpstate.pl.orig Sat Feb 22 18:38:39 2003 | ||
| 2 | +++ check_bgpstate.pl Sat Feb 22 18:38:53 2003 | ||
| 3 | @@ -141,7 +141,7 @@ | ||
| 4 | $answer=$session->error; | ||
| 5 | $session->close; | ||
| 6 | $state = 'CRITICAL'; | ||
| 7 | - print ("$state: $answer,$community,$snmpkey"); | ||
| 8 | + print ("$state: $answer,$snmpkey"); | ||
| 9 | exit $ERRORS{$state}; | ||
| 10 | } \ No newline at end of file | ||
diff --git a/web/attachments/43217-check_ifstatus-snmplocifdescr.patch b/web/attachments/43217-check_ifstatus-snmplocifdescr.patch new file mode 100644 index 0000000..7fdd656 --- /dev/null +++ b/web/attachments/43217-check_ifstatus-snmplocifdescr.patch | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | --- check_ifstatus.orig Sat Feb 22 18:18:00 2003 | ||
| 2 | +++ check_ifstatus Sun Feb 23 11:23:53 2003 | ||
| 3 | @@ -160,6 +160,9 @@ | ||
| 4 | push(@snmpoids,$snmpIfType); | ||
| 5 | push(@snmpoids,$snmpIfName) if ( defined $ifXTable); | ||
| 6 | |||
| 7 | +if (defined($response = $session->get_table($snmpLocIfDescr))) { | ||
| 8 | +push(@snmpoids,$snmpLocIfDescr); | ||
| 9 | +} | ||
| 10 | |||
| 11 | |||
| 12 | foreach $snmpoid (@snmpoids) { | ||
| 13 | @@ -191,10 +194,17 @@ | ||
| 14 | if ($ifStatus{$key}{$snmpIfOperStatus} == 1 ) { $ifup++ ;} | ||
| 15 | if ($ifStatus{$key}{$snmpIfOperStatus} == 2 ) { | ||
| 16 | $ifdown++ ; | ||
| 17 | - $ifmessage .= sprintf("%s: down -> %s<BR>", | ||
| 18 | + if (defined($ifStatus{$key}{$snmpLocIfDescr})) { | ||
| 19 | + $ifmessage .= sprintf("%s: down -> %s, ", | ||
| 20 | + $ifStatus{$key}{$snmpIfDescr}, | ||
| 21 | + $ifStatus{$key}{$snmpLocIfDescr}); | ||
| 22 | + } | ||
| 23 | + if (!defined($ifStatus{$key}{$snmpLocIfDescr})) { | ||
| 24 | + $ifmessage .= sprintf("%s: down -> %s, ", | ||
| 25 | $ifStatus{$key}{$snmpIfDescr}, | ||
| 26 | - $ifStatus{$key}{$snmpIfName}); | ||
| 27 | + $ifStatus{$key}{$snmpIfDescr}); | ||
| 28 | } | ||
| 29 | + } | ||
| 30 | if ($ifStatus{$key}{$snmpIfOperStatus} == 5 ) { $ifdormant++ ;} | ||
| 31 | } | ||
| 32 | } | ||
| 33 | @@ -203,7 +213,7 @@ | ||
| 34 | |||
| 35 | if ($ifdown > 0) { | ||
| 36 | $state = 'CRITICAL'; | ||
| 37 | - $answer = sprintf("host '%s', interfaces up: %d, down: %d, dormant: %d<BR>", | ||
| 38 | + $answer = sprintf("host '%s', interfaces up: %d, down: %d, dormant: %d, ", | ||
| 39 | $hostname, | ||
| 40 | $ifup, | ||
| 41 | $ifdown, | ||
diff --git a/web/attachments/432992-nagios-plugins-1.4.15-certexpire_warncrit.patch b/web/attachments/432992-nagios-plugins-1.4.15-certexpire_warncrit.patch new file mode 100644 index 0000000..a3935e8 --- /dev/null +++ b/web/attachments/432992-nagios-plugins-1.4.15-certexpire_warncrit.patch | |||
| @@ -0,0 +1,293 @@ | |||
| 1 | diff -ru nagios-plugins-1.4.15/plugins/check_http.c nagios-plugins-1.4.15-modified/plugins/check_http.c | ||
| 2 | --- nagios-plugins-1.4.15/plugins/check_http.c 2010-07-27 20:47:16.000000000 +0000 | ||
| 3 | +++ nagios-plugins-1.4.15-modified/plugins/check_http.c 2012-01-11 04:03:34.000000000 +0000 | ||
| 4 | @@ -58,7 +58,7 @@ | ||
| 5 | |||
| 6 | #ifdef HAVE_SSL | ||
| 7 | int check_cert = FALSE; | ||
| 8 | -int days_till_exp; | ||
| 9 | +int days_till_exp_warn, days_till_exp_crit; | ||
| 10 | char *randbuff; | ||
| 11 | X509 *server_cert; | ||
| 12 | # define my_recv(buf, len) ((use_ssl) ? np_net_ssl_read(buf, len) : read(sd, buf, len)) | ||
| 13 | @@ -178,6 +178,7 @@ | ||
| 14 | { | ||
| 15 | int c = 1; | ||
| 16 | char *p; | ||
| 17 | + char *temp; | ||
| 18 | |||
| 19 | enum { | ||
| 20 | INVERT_REGEX = CHAR_MAX + 1, | ||
| 21 | @@ -292,13 +293,25 @@ | ||
| 22 | break; | ||
| 23 | case 'C': /* Check SSL cert validity */ | ||
| 24 | #ifdef HAVE_SSL | ||
| 25 | - if (!is_intnonneg (optarg)) | ||
| 26 | - usage2 (_("Invalid certificate expiration period"), optarg); | ||
| 27 | + if ((temp=strchr(optarg,','))!=NULL) { | ||
| 28 | + *temp='\0'; | ||
| 29 | + if (!is_intnonneg (temp)) | ||
| 30 | + usage2 (_("Invalid certificate expiration period"), optarg); | ||
| 31 | + days_till_exp_warn = atoi(optarg); | ||
| 32 | + *temp=','; | ||
| 33 | + temp++; | ||
| 34 | + if (!is_intnonneg (temp)) | ||
| 35 | + usage2 (_("Invalid certificate expiration period"), temp); | ||
| 36 | + days_till_exp_crit = atoi (temp); | ||
| 37 | + } | ||
| 38 | else { | ||
| 39 | - days_till_exp = atoi (optarg); | ||
| 40 | - check_cert = TRUE; | ||
| 41 | + days_till_exp_crit=0; | ||
| 42 | + if (!is_intnonneg (optarg)) | ||
| 43 | + usage2 (_("Invalid certificate expiration period"), optarg); | ||
| 44 | + days_till_exp_warn = atoi (optarg); | ||
| 45 | } | ||
| 46 | - /* Fall through to -S option */ | ||
| 47 | + check_cert = TRUE; | ||
| 48 | + /* Fall through to -S option */ | ||
| 49 | #endif | ||
| 50 | case 'S': /* use SSL */ | ||
| 51 | #ifndef HAVE_SSL | ||
| 52 | @@ -809,7 +822,7 @@ | ||
| 53 | if (use_ssl == TRUE) { | ||
| 54 | np_net_ssl_init_with_hostname(sd, (use_sni ? host_name : NULL)); | ||
| 55 | if (check_cert == TRUE) { | ||
| 56 | - result = np_net_ssl_check_cert(days_till_exp); | ||
| 57 | + result = np_net_ssl_check_cert(days_till_exp_warn, days_till_exp_crit); | ||
| 58 | np_net_ssl_cleanup(); | ||
| 59 | if (sd) close(sd); | ||
| 60 | return result; | ||
| 61 | @@ -1424,6 +1437,13 @@ | ||
| 62 | printf (" %s\n", _("a STATE_OK is returned. When the certificate is still valid, but for less than")); | ||
| 63 | printf (" %s\n", _("14 days, a STATE_WARNING is returned. A STATE_CRITICAL will be returned when")); | ||
| 64 | printf (" %s\n", _("the certificate is expired.")); | ||
| 65 | + | ||
| 66 | + printf (" %s\n\n", "CHECK CERTIFICATE: check_http -H www.verisign.com -C 30,14"); | ||
| 67 | + printf (" %s\n", _("When the certificate of 'www.verisign.com' is valid for more than 30 days,")); | ||
| 68 | + printf (" %s\n", _("a STATE_OK is returned. When the certificate is still valid, but for less than")); | ||
| 69 | + printf (" %s\n", _("30 days, but more than 14 days, a STATE_WARNING is returned.")); | ||
| 70 | + printf (" %s\n", _("A STATE_CRITICAL will be returned when certificate expires in less than 14 days")); | ||
| 71 | + | ||
| 72 | #endif | ||
| 73 | |||
| 74 | printf (UT_SUPPORT); | ||
| 75 | @@ -1441,6 +1461,6 @@ | ||
| 76 | printf (" [-b proxy_auth] [-f <ok|warning|critcal|follow|sticky|stickyport>]\n"); | ||
| 77 | printf (" [-e <expect>] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n"); | ||
| 78 | printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); | ||
| 79 | - printf (" [-A string] [-k string] [-S] [--sni] [-C <age>] [-T <content-type>]\n"); | ||
| 80 | - printf (" [-j method]\n"); | ||
| 81 | + printf (" [-A string] [-k string] [-S] [--sni] [-C <warn_age>[,<crit_age>]]\n"); | ||
| 82 | + printf (" [-T <content-type>] [-j method]\n"); | ||
| 83 | } | ||
| 84 | diff -ru nagios-plugins-1.4.15/plugins/check_smtp.c nagios-plugins-1.4.15-modified/plugins/check_smtp.c | ||
| 85 | --- nagios-plugins-1.4.15/plugins/check_smtp.c 2010-07-27 20:47:16.000000000 +0000 | ||
| 86 | +++ nagios-plugins-1.4.15-modified/plugins/check_smtp.c 2012-01-11 04:19:41.000000000 +0000 | ||
| 87 | @@ -41,7 +41,7 @@ | ||
| 88 | |||
| 89 | #ifdef HAVE_SSL | ||
| 90 | int check_cert = FALSE; | ||
| 91 | -int days_till_exp; | ||
| 92 | +int days_till_exp_warn, days_till_exp_crit; | ||
| 93 | # define my_recv(buf, len) ((use_ssl && ssl_established) ? np_net_ssl_read(buf, len) : read(sd, buf, len)) | ||
| 94 | # define my_send(buf, len) ((use_ssl && ssl_established) ? np_net_ssl_write(buf, len) : send(sd, buf, len, 0)) | ||
| 95 | #else /* ifndef HAVE_SSL */ | ||
| 96 | @@ -271,7 +271,7 @@ | ||
| 97 | |||
| 98 | # ifdef USE_OPENSSL | ||
| 99 | if ( check_cert ) { | ||
| 100 | - result = np_net_ssl_check_cert(days_till_exp); | ||
| 101 | + result = np_net_ssl_check_cert(days_till_exp_warn, days_till_exp_crit); | ||
| 102 | if(result != STATE_OK){ | ||
| 103 | printf ("%s\n", _("CRITICAL - Cannot retrieve server certificate.")); | ||
| 104 | } | ||
| 105 | @@ -453,6 +453,7 @@ | ||
| 106 | process_arguments (int argc, char **argv) | ||
| 107 | { | ||
| 108 | int c; | ||
| 109 | + char* temp; | ||
| 110 | |||
| 111 | int option = 0; | ||
| 112 | static struct option longopts[] = { | ||
| 113 | @@ -595,12 +596,26 @@ | ||
| 114 | case 'D': | ||
| 115 | /* Check SSL cert validity */ | ||
| 116 | #ifdef USE_OPENSSL | ||
| 117 | - if (!is_intnonneg (optarg)) | ||
| 118 | - usage2 ("Invalid certificate expiration period",optarg); | ||
| 119 | - days_till_exp = atoi (optarg); | ||
| 120 | - check_cert = TRUE; | ||
| 121 | + if ((temp=strchr(optarg,','))!=NULL) { | ||
| 122 | + *temp='\0'; | ||
| 123 | + if (!is_intnonneg (temp)) | ||
| 124 | + usage2 ("Invalid certificate expiration period", optarg); | ||
| 125 | + days_till_exp_warn = atoi(optarg); | ||
| 126 | + *temp=','; | ||
| 127 | + temp++; | ||
| 128 | + if (!is_intnonneg (temp)) | ||
| 129 | + usage2 (_("Invalid certificate expiration period"), temp); | ||
| 130 | + days_till_exp_crit = atoi (temp); | ||
| 131 | + } | ||
| 132 | + else { | ||
| 133 | + days_till_exp_crit=0; | ||
| 134 | + if (!is_intnonneg (optarg)) | ||
| 135 | + usage2 ("Invalid certificate expiration period", optarg); | ||
| 136 | + days_till_exp_warn = atoi (optarg); | ||
| 137 | + } | ||
| 138 | + check_cert = TRUE; | ||
| 139 | #else | ||
| 140 | - usage (_("SSL support not available - install OpenSSL and recompile")); | ||
| 141 | + usage (_("SSL support not available - install OpenSSL and recompile")); | ||
| 142 | #endif | ||
| 143 | break; | ||
| 144 | case '4': | ||
| 145 | @@ -785,7 +800,7 @@ | ||
| 146 | printf (" %s\n", "-F, --fqdn=STRING"); | ||
| 147 | printf (" %s\n", _("FQDN used for HELO")); | ||
| 148 | #ifdef HAVE_SSL | ||
| 149 | - printf (" %s\n", "-D, --certificate=INTEGER"); | ||
| 150 | + printf (" %s\n", "-D, --certificate=INTEGER[,INTEGER]"); | ||
| 151 | printf (" %s\n", _("Minimum number of days a certificate has to be valid.")); | ||
| 152 | printf (" %s\n", "-S, --starttls"); | ||
| 153 | printf (" %s\n", _("Use STARTTLS for the connection.")); | ||
| 154 | @@ -819,8 +834,8 @@ | ||
| 155 | print_usage (void) | ||
| 156 | { | ||
| 157 | printf ("%s\n", _("Usage:")); | ||
| 158 | - printf ("%s -H host [-p port] [-e expect] [-C command] [-f from addr]", progname); | ||
| 159 | - printf ("[-A authtype -U authuser -P authpass] [-w warn] [-c crit] [-t timeout]\n"); | ||
| 160 | - printf ("[-F fqdn] [-S] [-D days] [-v] [-4|-6]\n"); | ||
| 161 | + printf ("%s -H host [-p port] [-4|-6] [-e expect] [-C command] [-f from addr]\n", progname); | ||
| 162 | + printf ("[-A authtype -U authuser -P authpass] [-w warn] [-c crit] [-t timeout] [-v]\n"); | ||
| 163 | + printf ("[-F fqdn] [-S] [-D <warn days to cert expiry>[<crit days to warn expire>]\n"); | ||
| 164 | } | ||
| 165 | |||
| 166 | diff -ru nagios-plugins-1.4.15/plugins/check_tcp.c nagios-plugins-1.4.15-modified/plugins/check_tcp.c | ||
| 167 | --- nagios-plugins-1.4.15/plugins/check_tcp.c 2010-07-27 20:47:16.000000000 +0000 | ||
| 168 | +++ nagios-plugins-1.4.15-modified/plugins/check_tcp.c 2012-01-11 04:20:15.000000000 +0000 | ||
| 169 | @@ -39,7 +39,7 @@ | ||
| 170 | |||
| 171 | #ifdef HAVE_SSL | ||
| 172 | static int check_cert = FALSE; | ||
| 173 | -static int days_till_exp; | ||
| 174 | +static int days_till_exp_warn, days_till_exp_crit; | ||
| 175 | # define my_recv(buf, len) ((flags & FLAG_SSL) ? np_net_ssl_read(buf, len) : read(sd, buf, len)) | ||
| 176 | # define my_send(buf, len) ((flags & FLAG_SSL) ? np_net_ssl_write(buf, len) : send(sd, buf, len, 0)) | ||
| 177 | #else | ||
| 178 | @@ -235,8 +235,8 @@ | ||
| 179 | if (flags & FLAG_SSL){ | ||
| 180 | result = np_net_ssl_init(sd); | ||
| 181 | if (result == STATE_OK && check_cert == TRUE) { | ||
| 182 | - result = np_net_ssl_check_cert(days_till_exp); | ||
| 183 | - if(result != STATE_OK) { | ||
| 184 | + result = np_net_ssl_check_cert(days_till_exp_warn, days_till_exp_crit); | ||
| 185 | + if (result != STATE_OK) { | ||
| 186 | printf(_("CRITICAL - Cannot retrieve server certificate.\n")); | ||
| 187 | } | ||
| 188 | } | ||
| 189 | @@ -383,6 +383,7 @@ | ||
| 190 | { | ||
| 191 | int c; | ||
| 192 | int escape = 0; | ||
| 193 | + char *temp; | ||
| 194 | |||
| 195 | int option = 0; | ||
| 196 | static struct option longopts[] = { | ||
| 197 | @@ -555,9 +556,22 @@ | ||
| 198 | case 'D': /* Check SSL cert validity - days 'til certificate expiration */ | ||
| 199 | #ifdef HAVE_SSL | ||
| 200 | # ifdef USE_OPENSSL /* XXX */ | ||
| 201 | - if (!is_intnonneg (optarg)) | ||
| 202 | + if ((temp=strchr(optarg,','))!=NULL) { | ||
| 203 | + *temp='\0'; | ||
| 204 | + if (!is_intnonneg (temp)) | ||
| 205 | + usage2 (_("Invalid certificate expiration period"), optarg); days_till_exp_warn = atoi(optarg); | ||
| 206 | + *temp=','; | ||
| 207 | + temp++; | ||
| 208 | + if (!is_intnonneg (temp)) | ||
| 209 | + usage2 (_("Invalid certificate expiration period"), temp); | ||
| 210 | + days_till_exp_crit = atoi (temp); | ||
| 211 | + } | ||
| 212 | + else { | ||
| 213 | + days_till_exp_crit=0; | ||
| 214 | + if (!is_intnonneg (optarg)) | ||
| 215 | usage2 (_("Invalid certificate expiration period"), optarg); | ||
| 216 | - days_till_exp = atoi (optarg); | ||
| 217 | + days_till_exp_warn = atoi (optarg); | ||
| 218 | + } | ||
| 219 | check_cert = TRUE; | ||
| 220 | flags |= FLAG_SSL; | ||
| 221 | break; | ||
| 222 | @@ -629,8 +643,9 @@ | ||
| 223 | printf (" %s\n", _("Seconds to wait between sending string and polling for response")); | ||
| 224 | |||
| 225 | #ifdef HAVE_SSL | ||
| 226 | - printf (" %s\n", "-D, --certificate=INTEGER"); | ||
| 227 | + printf (" %s\n", "-D, --certificate=INTEGER[,INTEGER]"); | ||
| 228 | printf (" %s\n", _("Minimum number of days a certificate has to be valid.")); | ||
| 229 | + printf (" %s\n", _("1st is #days for warning, 2nd is critical (if not specified - 0).")); | ||
| 230 | printf (" %s\n", "-S, --ssl"); | ||
| 231 | printf (" %s\n", _("Use SSL for the connection.")); | ||
| 232 | #endif | ||
| 233 | @@ -652,6 +667,6 @@ | ||
| 234 | printf ("%s -H host -p port [-w <warning time>] [-c <critical time>] [-s <send string>]\n",progname); | ||
| 235 | printf ("[-e <expect string>] [-q <quit string>][-m <maximum bytes>] [-d <delay>]\n"); | ||
| 236 | printf ("[-t <timeout seconds>] [-r <refuse state>] [-M <mismatch state>] [-v] [-4|-6] [-j]\n"); | ||
| 237 | - printf ("[-D <days to cert expiry>] [-S <use SSL>] [-E]\n"); | ||
| 238 | + printf ("[-D <warn days to cert expiry>[,<crit days to warn expire>]] [-S <use SSL>] [-E]\n"); | ||
| 239 | } | ||
| 240 | |||
| 241 | Only in nagios-plugins-1.4.15-modified/plugins: .deps | ||
| 242 | Only in nagios-plugins-1.4.15-modified/plugins: Makefile | ||
| 243 | diff -ru nagios-plugins-1.4.15/plugins/netutils.h nagios-plugins-1.4.15-modified/plugins/netutils.h | ||
| 244 | --- nagios-plugins-1.4.15/plugins/netutils.h 2010-07-27 20:47:16.000000000 +0000 | ||
| 245 | +++ nagios-plugins-1.4.15-modified/plugins/netutils.h 2012-01-11 03:52:18.000000000 +0000 | ||
| 246 | @@ -103,7 +103,7 @@ | ||
| 247 | void np_net_ssl_cleanup(); | ||
| 248 | int np_net_ssl_write(const void *buf, int num); | ||
| 249 | int np_net_ssl_read(void *buf, int num); | ||
| 250 | -int np_net_ssl_check_cert(int days_till_exp); | ||
| 251 | +int np_net_ssl_check_cert(int days_till_exp_warn, int days_till_exp_crit); | ||
| 252 | #endif /* HAVE_SSL */ | ||
| 253 | |||
| 254 | #endif /* _NETUTILS_H_ */ | ||
| 255 | diff -ru nagios-plugins-1.4.15/plugins/sslutils.c nagios-plugins-1.4.15-modified/plugins/sslutils.c | ||
| 256 | --- nagios-plugins-1.4.15/plugins/sslutils.c 2010-07-27 20:47:16.000000000 +0000 | ||
| 257 | +++ nagios-plugins-1.4.15-modified/plugins/sslutils.c 2012-01-11 03:51:39.000000000 +0000 | ||
| 258 | @@ -94,7 +94,7 @@ | ||
| 259 | return SSL_read(s, buf, num); | ||
| 260 | } | ||
| 261 | |||
| 262 | -int np_net_ssl_check_cert(int days_till_exp){ | ||
| 263 | +int np_net_ssl_check_cert(int days_till_exp_warn, int days_till_exp_crit){ | ||
| 264 | # ifdef USE_OPENSSL | ||
| 265 | X509 *certificate=NULL; | ||
| 266 | ASN1_STRING *tm; | ||
| 267 | @@ -154,15 +154,21 @@ | ||
| 268 | stamp.tm_mon + 1, | ||
| 269 | stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min); | ||
| 270 | |||
| 271 | - if (days_left > 0 && days_left <= days_till_exp) { | ||
| 272 | - printf (_("WARNING - Certificate expires in %d day(s) (%s).\n"), days_left, timestamp); | ||
| 273 | - return STATE_WARNING; | ||
| 274 | + if (days_left > 0 && days_left <= days_till_exp_warn) { | ||
| 275 | + printf (_("%s - Certificate expires in %d day(s) (%s).\n"), (days_left>days_till_exp_crit)?"CRITICAL":"WARNING", days_left, timestamp); | ||
| 276 | + if (days_left > days_till_exp_crit) | ||
| 277 | + return STATE_WARNING; | ||
| 278 | + else | ||
| 279 | + return STATE_CRITICAL; | ||
| 280 | } else if (time_left < 0) { | ||
| 281 | printf (_("CRITICAL - Certificate expired on %s.\n"), timestamp); | ||
| 282 | return STATE_CRITICAL; | ||
| 283 | } else if (days_left == 0) { | ||
| 284 | - printf (_("WARNING - Certificate expires today (%s).\n"), timestamp); | ||
| 285 | - return STATE_WARNING; | ||
| 286 | + printf (_("%s - Certificate expires today (%s).\n"), (days_left>days_till_exp_crit)?"CRITICAL":"WARNING", timestamp); | ||
| 287 | + if (days_left > days_till_exp_crit) | ||
| 288 | + return STATE_WARNING; | ||
| 289 | + else | ||
| 290 | + return STATE_CRITICAL; | ||
| 291 | } | ||
| 292 | |||
| 293 | printf (_("OK - Certificate will expire on %s.\n"), timestamp); | ||
diff --git a/web/attachments/436432-check_fping_ipv6_support.patch b/web/attachments/436432-check_fping_ipv6_support.patch new file mode 100644 index 0000000..121a527 --- /dev/null +++ b/web/attachments/436432-check_fping_ipv6_support.patch | |||
| @@ -0,0 +1,106 @@ | |||
| 1 | diff --git a/configure.in b/configure.in | ||
| 2 | index 1d16bcd..fec55a0 100644 | ||
| 3 | --- a/configure.in | ||
| 4 | +++ b/configure.in | ||
| 5 | @@ -1364,6 +1364,17 @@ else | ||
| 6 | AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin]) | ||
| 7 | fi | ||
| 8 | |||
| 9 | +AC_PATH_PROG(PATH_TO_FPING6,fping6) | ||
| 10 | +AC_ARG_WITH(fping6_command, | ||
| 11 | + ACX_HELP_STRING([--with-fping6-command=PATH], | ||
| 12 | + [Path to fping6 command]), PATH_TO_FPING6=$withval) | ||
| 13 | +if test -n "$PATH_TO_FPING6" | ||
| 14 | +then | ||
| 15 | + AC_DEFINE_UNQUOTED(PATH_TO_FPING6,"$PATH_TO_FPING6",[path to fping6]) | ||
| 16 | +else | ||
| 17 | + AC_MSG_WARN([Get fping6 from http://www.fping.com in order to make check_fping plugin]) | ||
| 18 | +fi | ||
| 19 | + | ||
| 20 | AC_PATH_PROG(PATH_TO_SSH,ssh) | ||
| 21 | AC_ARG_WITH(ssh_command, | ||
| 22 | ACX_HELP_STRING([--with-ssh-command=PATH], | ||
| 23 | diff --git a/plugins/check_fping.c b/plugins/check_fping.c | ||
| 24 | index dd3f86d..d45e76b 100644 | ||
| 25 | --- a/plugins/check_fping.c | ||
| 26 | +++ b/plugins/check_fping.c | ||
| 27 | @@ -72,6 +72,7 @@ main (int argc, char **argv) | ||
| 28 | /* normaly should be int result = STATE_UNKNOWN; */ | ||
| 29 | |||
| 30 | int status = STATE_UNKNOWN; | ||
| 31 | + char *fping_prog = NULL; | ||
| 32 | char *server = NULL; | ||
| 33 | char *command_line = NULL; | ||
| 34 | char *input_buffer = NULL; | ||
| 35 | @@ -96,7 +97,16 @@ main (int argc, char **argv) | ||
| 36 | if (packet_interval) | ||
| 37 | asprintf(&option_string, "%s-p %d ", option_string, packet_interval); | ||
| 38 | |||
| 39 | - asprintf (&command_line, "%s %s-b %d -c %d %s", PATH_TO_FPING, | ||
| 40 | +#ifdef USE_IPV6 | ||
| 41 | + if (address_family == AF_INET6) | ||
| 42 | + fping_prog = strdup(PATH_TO_FPING6); | ||
| 43 | + else | ||
| 44 | + fping_prog = strdup(PATH_TO_FPING); | ||
| 45 | +#else | ||
| 46 | + fping_prog = strdup(PATH_TO_FPING); | ||
| 47 | +#endif | ||
| 48 | + | ||
| 49 | + asprintf (&command_line, "%s %s-b %d -c %d %s", fping_prog, | ||
| 50 | option_string, packet_size, packet_count, server); | ||
| 51 | |||
| 52 | if (verbose) | ||
| 53 | @@ -241,6 +251,8 @@ process_arguments (int argc, char **argv) | ||
| 54 | {"verbose", no_argument, 0, 'v'}, | ||
| 55 | {"version", no_argument, 0, 'V'}, | ||
| 56 | {"help", no_argument, 0, 'h'}, | ||
| 57 | + {"use-ipv4", no_argument, 0, '4'}, | ||
| 58 | + {"use-ipv6", no_argument, 0, '6'}, | ||
| 59 | {0, 0, 0, 0} | ||
| 60 | }; | ||
| 61 | |||
| 62 | @@ -258,7 +270,7 @@ process_arguments (int argc, char **argv) | ||
| 63 | } | ||
| 64 | |||
| 65 | while (1) { | ||
| 66 | - c = getopt_long (argc, argv, "+hVvH:c:w:b:n:T:i:", longopts, &option); | ||
| 67 | + c = getopt_long (argc, argv, "+hVvH:c:w:b:n:T:i:46", longopts, &option); | ||
| 68 | |||
| 69 | if (c == -1 || c == EOF || c == 1) | ||
| 70 | break; | ||
| 71 | @@ -281,6 +293,16 @@ process_arguments (int argc, char **argv) | ||
| 72 | } | ||
| 73 | server_name = strscpy (server_name, optarg); | ||
| 74 | break; | ||
| 75 | + case '4': /* IPv4 only */ | ||
| 76 | + address_family = AF_INET; | ||
| 77 | + break; | ||
| 78 | + case '6': /* IPv6 only */ | ||
| 79 | +#ifdef USE_IPV6 | ||
| 80 | + address_family = AF_INET6; | ||
| 81 | +#else | ||
| 82 | + usage (_("IPv6 support not available\n")); | ||
| 83 | +#endif | ||
| 84 | + break; | ||
| 85 | case 'c': | ||
| 86 | get_threshold (optarg, rv); | ||
| 87 | if (rv[RTA]) { | ||
| 88 | @@ -402,6 +424,8 @@ print_help (void) | ||
| 89 | printf (UT_HELP_VRSN); | ||
| 90 | printf (UT_EXTRA_OPTS); | ||
| 91 | |||
| 92 | + printf (UT_IPv46); | ||
| 93 | + | ||
| 94 | printf (" %s\n", "-H, --hostname=HOST"); | ||
| 95 | printf (" %s\n", _("name or IP Address of host to ping (IP Address bypasses name lookup, reducing system load)")); | ||
| 96 | printf (" %s\n", "-w, --warning=THRESHOLD"); | ||
| 97 | @@ -422,6 +446,9 @@ print_help (void) | ||
| 98 | printf (" %s\n", _("which triggers a WARNING or CRITICAL state, and <pl> is the percentage of")); | ||
| 99 | printf (" %s\n", _("packet loss to trigger an alarm state.")); | ||
| 100 | |||
| 101 | + printf ("\n"); | ||
| 102 | + printf (" %s\n", _("IPv4 is used by default. Specify -6 to use IPv6.")); | ||
| 103 | + | ||
| 104 | printf (UT_SUPPORT); | ||
| 105 | } | ||
| 106 | |||
diff --git a/web/attachments/439112-check_pgsql.c.patch b/web/attachments/439112-check_pgsql.c.patch new file mode 100644 index 0000000..62e2db4 --- /dev/null +++ b/web/attachments/439112-check_pgsql.c.patch | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | *** check_pgsql.c.old Thu Mar 22 09:58:45 2012 | ||
| 2 | --- check_pgsql.c Thu Mar 22 10:05:08 2012 | ||
| 3 | *************** | ||
| 4 | *** 32,37 **** | ||
| 5 | --- 32,39 ---- | ||
| 6 | const char *copyright = "1999-2007"; | ||
| 7 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 8 | |||
| 9 | + #include <sys/stat.h> | ||
| 10 | + | ||
| 11 | #include "common.h" | ||
| 12 | #include "utils.h" | ||
| 13 | |||
| 14 | *************** | ||
| 15 | *** 57,62 **** | ||
| 16 | --- 59,65 ---- | ||
| 17 | void print_help (void); | ||
| 18 | int is_pg_dbname (char *); | ||
| 19 | int is_pg_logname (char *); | ||
| 20 | + int is_directory(char *); | ||
| 21 | |||
| 22 | char *pghost = NULL; /* host name of the backend server */ | ||
| 23 | char *pgport = NULL; /* port of the backend server */ | ||
| 24 | *************** | ||
| 25 | *** 265,272 **** | ||
| 26 | twarn = strtod (optarg, NULL); | ||
| 27 | break; | ||
| 28 | case 'H': /* host */ | ||
| 29 | ! if (!is_host (optarg)) | ||
| 30 | ! usage2 (_("Invalid hostname/address"), optarg); | ||
| 31 | else | ||
| 32 | pghost = optarg; | ||
| 33 | break; | ||
| 34 | --- 268,275 ---- | ||
| 35 | twarn = strtod (optarg, NULL); | ||
| 36 | break; | ||
| 37 | case 'H': /* host */ | ||
| 38 | ! if (!is_host (optarg) && !is_directory(optarg)) | ||
| 39 | ! usage2 (_("Invalid hostname/address/directory"), optarg); | ||
| 40 | else | ||
| 41 | pghost = optarg; | ||
| 42 | break; | ||
| 43 | *************** | ||
| 44 | *** 411,416 **** | ||
| 45 | --- 414,432 ---- | ||
| 46 | -@@ | ||
| 47 | ******************************************************************************/ | ||
| 48 | |||
| 49 | + int | ||
| 50 | + is_directory (char *pathname) | ||
| 51 | + { | ||
| 52 | + struct stat s; | ||
| 53 | + | ||
| 54 | + if (lstat(pathname, &s) != 0) | ||
| 55 | + return (FALSE); | ||
| 56 | + | ||
| 57 | + if (S_ISDIR(s.st_mode)) | ||
| 58 | + return (TRUE); | ||
| 59 | + else | ||
| 60 | + return (FALSE); | ||
| 61 | + } | ||
| 62 | |||
| 63 | |||
| 64 | void | ||
diff --git a/web/attachments/440468-check_dig.patch.gz b/web/attachments/440468-check_dig.patch.gz new file mode 100644 index 0000000..6c9100e --- /dev/null +++ b/web/attachments/440468-check_dig.patch.gz | |||
| Binary files differ | |||
diff --git a/web/attachments/440895-check_dhcp.fix-option-parsing.diff b/web/attachments/440895-check_dhcp.fix-option-parsing.diff new file mode 100644 index 0000000..d4ffe87 --- /dev/null +++ b/web/attachments/440895-check_dhcp.fix-option-parsing.diff | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c | ||
| 2 | index 2a1875c..b1a7713 100644 | ||
| 3 | --- a/plugins-root/check_dhcp.c | ||
| 4 | +++ b/plugins-root/check_dhcp.c | ||
| 5 | @@ -839,8 +839,7 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){ | ||
| 6 | /* process all DHCP options present in the packet */ | ||
| 7 | for(x=4;x<MAX_DHCP_OPTIONS_LENGTH;){ | ||
| 8 | |||
| 9 | - /* end of options (0 is really just a pad, but bail out anyway) */ | ||
| 10 | - if((int)offer_packet->options[x]==-1 || (int)offer_packet->options[x]==0) | ||
| 11 | + if((int)offer_packet->options[x]==-1) | ||
| 12 | break; | ||
| 13 | |||
| 14 | /* get option type */ | ||
diff --git a/web/attachments/443468-nonrootthreshold.patch b/web/attachments/443468-nonrootthreshold.patch new file mode 100644 index 0000000..c05cd80 --- /dev/null +++ b/web/attachments/443468-nonrootthreshold.patch | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | Author: Stephen Baynes <stephen.baynes@smoothwall.net> | ||
| 2 | Description: Calculate performance data thresholds with non-root | ||
| 3 | figures so consistent with % free and check status. | ||
| 4 | --- a/plugins/check_disk.c | ||
| 5 | +++ b/plugins/check_disk.c | ||
| 6 | @@ -160,9 +160,9 @@ | ||
| 7 | char *perf; | ||
| 8 | char *preamble; | ||
| 9 | double inode_space_pct; | ||
| 10 | - uintmax_t total, available, available_to_root, used; | ||
| 11 | + uintmax_t total, total_not_root, available, available_to_root, used; | ||
| 12 | double dfree_pct = -1, dused_pct = -1; | ||
| 13 | - double dused_units, dfree_units, dtotal_units; | ||
| 14 | + double dused_units, dfree_units, dtotal_units, dtotal_not_root_units; | ||
| 15 | double dused_inodes_percent, dfree_inodes_percent; | ||
| 16 | double warning_high_tide; | ||
| 17 | double critical_high_tide; | ||
| 18 | @@ -308,23 +308,25 @@ | ||
| 19 | available = fsp.fsu_bavail > fsp.fsu_bfree ? 0 : fsp.fsu_bavail; | ||
| 20 | available_to_root = fsp.fsu_bfree; | ||
| 21 | used = total - available_to_root; | ||
| 22 | + total_not_root = used + available; | ||
| 23 | |||
| 24 | if (verbose >= 3) | ||
| 25 | - printf ("For %s, total=%llu, available=%llu, available_to_root=%llu, used=%llu, fsp.fsu_files=%llu, fsp.fsu_ffree=%llu\n", | ||
| 26 | - me->me_mountdir, total, available, available_to_root, used, fsp.fsu_files, fsp.fsu_ffree); | ||
| 27 | + printf ("For %s, total=%llu, total_not_root=%llu, available=%llu, available_to_root=%llu, used=%llu, fsp.fsu_files=%llu, fsp.fsu_ffree=%llu\n", | ||
| 28 | + me->me_mountdir, total, total_not_root, available, available_to_root, used, fsp.fsu_files, fsp.fsu_ffree); | ||
| 29 | |||
| 30 | - dused_pct = calculate_percent( used, used + available ); /* used + available can never be > uintmax */ | ||
| 31 | + dused_pct = calculate_percent( used, total_not_root ); /* used + available can never be > uintmax */ | ||
| 32 | |||
| 33 | dfree_pct = 100 - dused_pct; | ||
| 34 | dused_units = used*fsp.fsu_blocksize/mult; | ||
| 35 | dfree_units = available*fsp.fsu_blocksize/mult; | ||
| 36 | dtotal_units = total*fsp.fsu_blocksize/mult; | ||
| 37 | + dtotal_not_root_units = total_not_root*fsp.fsu_blocksize/mult; | ||
| 38 | dused_inodes_percent = calculate_percent(fsp.fsu_files - fsp.fsu_ffree, fsp.fsu_files); | ||
| 39 | dfree_inodes_percent = 100 - dused_inodes_percent; | ||
| 40 | |||
| 41 | if (verbose >= 3) { | ||
| 42 | - printf ("For %s, used_pct=%g free_pct=%g used_units=%g free_units=%g total_units=%g used_inodes_pct=%g free_inodes_pct=%g fsp.fsu_blocksize=%llu mult=%llu\n", | ||
| 43 | - me->me_mountdir, dused_pct, dfree_pct, dused_units, dfree_units, dtotal_units, dused_inodes_percent, dfree_inodes_percent, fsp.fsu_blocksize, mult); | ||
| 44 | + printf ("For %s, used_pct=%g free_pct=%g used_units=%g free_units=%g total_units=%g total_not_root_units=%g used_inodes_pct=%g free_inodes_pct=%g fsp.fsu_blocksize=%llu mult=%llu\n", | ||
| 45 | + me->me_mountdir, dused_pct, dfree_pct, dused_units, dfree_units, dtotal_units, dtotal_not_root_units, dused_inodes_percent, dfree_inodes_percent, fsp.fsu_blocksize, mult); | ||
| 46 | } | ||
| 47 | |||
| 48 | /* Threshold comparisons */ | ||
| 49 | @@ -368,13 +370,13 @@ | ||
| 50 | warning_high_tide = dtotal_units - path->freespace_units->warning->end; | ||
| 51 | } | ||
| 52 | if (path->freespace_percent->warning != NULL) { | ||
| 53 | - warning_high_tide = abs( min( (double) warning_high_tide, (double) (1.0 - path->freespace_percent->warning->end/100)*dtotal_units )); | ||
| 54 | + warning_high_tide = abs( min( (double) warning_high_tide, (double) (1.0 - path->freespace_percent->warning->end/100)*dtotal_not_root_units )); | ||
| 55 | } | ||
| 56 | if (path->freespace_units->critical != NULL) { | ||
| 57 | critical_high_tide = dtotal_units - path->freespace_units->critical->end; | ||
| 58 | } | ||
| 59 | if (path->freespace_percent->critical != NULL) { | ||
| 60 | - critical_high_tide = abs( min( (double) critical_high_tide, (double) (1.0 - path->freespace_percent->critical->end/100)*dtotal_units )); | ||
| 61 | + critical_high_tide = abs( min( (double) critical_high_tide, (double) (1.0 - path->freespace_percent->critical->end/100)*dtotal_not_root_units )); | ||
| 62 | } | ||
| 63 | |||
| 64 | /* Nb: *_high_tide are unset when == UINT_MAX */ | ||
diff --git a/web/attachments/446102-patch b/web/attachments/446102-patch new file mode 100644 index 0000000..57fe747 --- /dev/null +++ b/web/attachments/446102-patch | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | diff --git a/plugins/check_ping.c b/plugins/check_ping.c | ||
| 2 | index 1367e90..bfdee49 100644 | ||
| 3 | --- a/plugins/check_ping.c | ||
| 4 | +++ b/plugins/check_ping.c | ||
| 5 | @@ -500,9 +500,7 @@ run_ping (const char *cmd, const char *addr) | ||
| 6 | (void) fclose (child_stderr); | ||
| 7 | |||
| 8 | |||
| 9 | - /* close the pipe - WARNING if status is set */ | ||
| 10 | - if (spclose (child_process)) | ||
| 11 | - result = max_state (result, STATE_WARNING); | ||
| 12 | + spclose (child_process); | ||
| 13 | |||
| 14 | if (warn_text == NULL) | ||
| 15 | warn_text = strdup(""); | ||
diff --git a/web/attachments/44653-check_ifstatus_errors.txt b/web/attachments/44653-check_ifstatus_errors.txt new file mode 100644 index 0000000..3116fd7 --- /dev/null +++ b/web/attachments/44653-check_ifstatus_errors.txt | |||
| @@ -0,0 +1,231 @@ | |||
| 1 | #! /usr/bin/perl -w | ||
| 2 | # | ||
| 3 | # check_ifstatus.pl - nagios plugin | ||
| 4 | # | ||
| 5 | # | ||
| 6 | # Copyright (C) 2000 Christoph Kron | ||
| 7 | # Modified 5/2002 to conform to updated Nagios Plugin Guidelines (S. Ghosh) | ||
| 8 | # | ||
| 9 | # This program is free software; you can redistribute it and/or | ||
| 10 | # modify it under the terms of the GNU General Public License | ||
| 11 | # as published by the Free Software Foundation; either version 2 | ||
| 12 | # of the License, or (at your option) any later version. | ||
| 13 | # | ||
| 14 | # This program is distributed in the hope that it will be useful, | ||
| 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | # GNU General Public License for more details. | ||
| 18 | # | ||
| 19 | # You should have received a copy of the GNU General Public License | ||
| 20 | # along with this program; if not, write to the Free Software | ||
| 21 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 22 | # | ||
| 23 | # | ||
| 24 | # Report bugs to: ck@zet.net, nagiosplug-help@lists.sf.net | ||
| 25 | # | ||
| 26 | # 11.01.2000 Version 1.0 | ||
| 27 | # | ||
| 28 | # $Id: check_ifstatus.pl,v 1.3 2003/02/03 05:29:54 sghosh Exp $ | ||
| 29 | |||
| 30 | use POSIX; | ||
| 31 | use strict; | ||
| 32 | use lib "/usr/lib/nagios/plugins" ; | ||
| 33 | use utils qw($TIMEOUT %ERRORS &print_revision &support); | ||
| 34 | |||
| 35 | use Net::SNMP; | ||
| 36 | use Getopt::Long; | ||
| 37 | Getopt::Long::Configure('bundling'); | ||
| 38 | |||
| 39 | my $PROGNAME = "check_ifstatus"; | ||
| 40 | |||
| 41 | |||
| 42 | my $status; | ||
| 43 | my %ifOperStatus = ('1','up', | ||
| 44 | '2','down', | ||
| 45 | '3','testing', | ||
| 46 | '4','unknown', | ||
| 47 | '5','dormant', | ||
| 48 | '6','notPresent'); | ||
| 49 | |||
| 50 | my $state = "UNKNOWN"; | ||
| 51 | my $answer = ""; | ||
| 52 | my $snmpkey=0; | ||
| 53 | my $snmpoid=0; | ||
| 54 | my $key=0; | ||
| 55 | my $community = "public"; | ||
| 56 | my $port = 161; | ||
| 57 | my @snmpoids; | ||
| 58 | my $snmpifInErrors = '1.3.6.1.2.1.2.2.1.14'; | ||
| 59 | my $snmpifOutErrors = '1.3.6.1.2.1.2.2.1.20'; | ||
| 60 | my $snmpIfName = '1.3.6.1.2.1.2.2.1.2'; | ||
| 61 | my $hostname; | ||
| 62 | my $session; | ||
| 63 | my $error; | ||
| 64 | my $response; | ||
| 65 | my $ifup =0 ; | ||
| 66 | my $ifdown =0; | ||
| 67 | my $ifdormant = 0; | ||
| 68 | my $ifmessage = ""; | ||
| 69 | my $snmp_version = 1; | ||
| 70 | my $ifXTable; | ||
| 71 | my $opt_h ; | ||
| 72 | my $opt_V ; | ||
| 73 | my $warn_level = 1000; | ||
| 74 | my %ifStatus; | ||
| 75 | my $iferrors = 0; | ||
| 76 | |||
| 77 | |||
| 78 | |||
| 79 | |||
| 80 | |||
| 81 | # Just in case of problems, let's not hang Nagios | ||
| 82 | $SIG{'ALRM'} = sub { | ||
| 83 | print ("ERROR: No snmp response from $hostname (alarm timeout)\n"); | ||
| 84 | exit $ERRORS{"UNKNOWN"}; | ||
| 85 | }; | ||
| 86 | alarm($TIMEOUT); | ||
| 87 | |||
| 88 | |||
| 89 | |||
| 90 | #Option checking | ||
| 91 | $status = GetOptions( | ||
| 92 | "V" => \$opt_V, "version" => \$opt_V, | ||
| 93 | "h" => \$opt_h, "help" => \$opt_h, | ||
| 94 | "v=i" => \$snmp_version, "snmp_version=i" => \$snmp_version, | ||
| 95 | "C=s" =>\$community,"community=s" => \$community, | ||
| 96 | "p=i" =>\$port, "port=i" => \$port, | ||
| 97 | "H=s" => \$hostname, "hostname=s" => \$hostname, | ||
| 98 | "I" => \$ifXTable, "ifmib" => \$ifXTable ); | ||
| 99 | |||
| 100 | if ($status == 0) | ||
| 101 | { | ||
| 102 | print_help() ; | ||
| 103 | exit $ERRORS{'OK'}; | ||
| 104 | } | ||
| 105 | |||
| 106 | |||
| 107 | if ($opt_V) { | ||
| 108 | print_revision($PROGNAME,'$Revision: 1.3 $ '); | ||
| 109 | exit $ERRORS{'OK'}; | ||
| 110 | } | ||
| 111 | |||
| 112 | if ($opt_h) { | ||
| 113 | print_help(); | ||
| 114 | exit $ERRORS{'OK'}; | ||
| 115 | } | ||
| 116 | |||
| 117 | if (! utils::is_hostname($hostname)){ | ||
| 118 | usage(); | ||
| 119 | exit $ERRORS{"UNKNOWN"}; | ||
| 120 | } | ||
| 121 | |||
| 122 | if ( ! $snmp_version ) { | ||
| 123 | $snmp_version =1 ; | ||
| 124 | }else{ | ||
| 125 | if ( $snmp_version =~ /[12]/ ) { | ||
| 126 | |||
| 127 | ($session, $error) = Net::SNMP->session( | ||
| 128 | -hostname => $hostname, | ||
| 129 | -community => $community, | ||
| 130 | -port => $port, | ||
| 131 | -version => $snmp_version | ||
| 132 | ); | ||
| 133 | |||
| 134 | if (!defined($session)) { | ||
| 135 | $state='UNKNOWN'; | ||
| 136 | $answer=$error; | ||
| 137 | print ("$state: $answer"); | ||
| 138 | exit $ERRORS{$state}; | ||
| 139 | } | ||
| 140 | |||
| 141 | |||
| 142 | }elsif ( $snmp_version =~ /3/ ) { | ||
| 143 | $state='UNKNOWN'; | ||
| 144 | print ("$state: No support for SNMP v3 yet\n"); | ||
| 145 | exit $ERRORS{$state}; | ||
| 146 | }else{ | ||
| 147 | $state='UNKNOWN'; | ||
| 148 | print ("$state: No support for SNMP v$snmp_version yet\n"); | ||
| 149 | exit $ERRORS{$state}; | ||
| 150 | } | ||
| 151 | } | ||
| 152 | |||
| 153 | |||
| 154 | |||
| 155 | push(@snmpoids,$snmpifInErrors); | ||
| 156 | push(@snmpoids,$snmpifOutErrors); | ||
| 157 | push(@snmpoids,$snmpIfName); | ||
| 158 | |||
| 159 | |||
| 160 | foreach $snmpoid (@snmpoids) { | ||
| 161 | |||
| 162 | if (!defined($response = $session->get_table($snmpoid))) { | ||
| 163 | $answer=$session->error; | ||
| 164 | $session->close; | ||
| 165 | $state = 'CRITICAL'; | ||
| 166 | print ("$state: $answer for $snmpoid with snmp version $snmp_version\n"); | ||
| 167 | exit $ERRORS{$state}; | ||
| 168 | } | ||
| 169 | |||
| 170 | foreach $snmpkey (keys %{$response}) { | ||
| 171 | $snmpkey =~ /.*\.(\d+)$/; | ||
| 172 | $key = $1; | ||
| 173 | $ifStatus{$key}{$snmpoid} = $response->{$snmpkey}; | ||
| 174 | } | ||
| 175 | } | ||
| 176 | |||
| 177 | |||
| 178 | $session->close; | ||
| 179 | |||
| 180 | foreach $key (keys %ifStatus) { | ||
| 181 | #print "DEBG : $key :: $ifStatus{$key}{$snmpIfName} \n"; | ||
| 182 | |||
| 183 | if (defined($ifStatus{$key}{$snmpifInErrors})) { | ||
| 184 | if ($ifStatus{$key}{$snmpifInErrors} >= $warn_level ) { | ||
| 185 | $iferrors++; | ||
| 186 | $ifmessage .= sprintf("%s: has %s errors<BR>", | ||
| 187 | $ifStatus{$key}{$snmpIfName}, | ||
| 188 | $ifStatus{$key}{$snmpifInErrors}); | ||
| 189 | } | ||
| 190 | } | ||
| 191 | } | ||
| 192 | |||
| 193 | if ($iferrors > 0) { | ||
| 194 | $state = 'WARNING'; | ||
| 195 | } | ||
| 196 | else { | ||
| 197 | $state = 'OK'; | ||
| 198 | } | ||
| 199 | |||
| 200 | print ("$state: $ifmessage\n"); | ||
| 201 | exit $ERRORS{$state}; | ||
| 202 | |||
| 203 | sub usage { | ||
| 204 | printf "\nMissing arguments!\n"; | ||
| 205 | printf "\n"; | ||
| 206 | printf "check_ifstatus_errors -C <READCOMMUNITY> -p <PORT> -H <HOSTNAME>\n"; | ||
| 207 | printf "Copyright (C) 2000 Christoph Kron\n"; | ||
| 208 | printf "Updates 5/2002 Subhendu Ghosh\n"; | ||
| 209 | printf "\n\n"; | ||
| 210 | support(); | ||
| 211 | exit $ERRORS{"UNKNOWN"}; | ||
| 212 | } | ||
| 213 | |||
| 214 | sub print_help { | ||
| 215 | printf "check_ifstatus plugin for Nagios monitors operational \n"; | ||
| 216 | printf "status of each network interface (except PPP interfaces) on the target host\n"; | ||
| 217 | printf "\nUsage:\n"; | ||
| 218 | printf " -H (--hostname) Hostname to query - (required)\n"; | ||
| 219 | printf " -C (--community) SNMP read community (defaults to public,\n"; | ||
| 220 | printf " used with SNMP v1 and v2c\n"; | ||
| 221 | printf " -v (--snmp_version) 1 for SNMP v1 (default)\n"; | ||
| 222 | printf " 2 for SNMP v2c\n"; | ||
| 223 | printf " SNMP v2c will use get_bulk for less overhead\n"; | ||
| 224 | printf " -p (--port) SNMP port (default 161)\n"; | ||
| 225 | printf " -I (--ifmib) Agent supports IFMIB ifXTable. Do not use if\n"; | ||
| 226 | printf " you don't know what this is.\n"; | ||
| 227 | printf " -V (--version) Plugin version\n"; | ||
| 228 | printf " -h (--help) usage help \n\n"; | ||
| 229 | print_revision($PROGNAME, '$Revision: 1.3 $'); | ||
| 230 | |||
| 231 | } | ||
diff --git a/web/attachments/448048-nagios-plugins-1.4.16-check_ldap_certificate.patch b/web/attachments/448048-nagios-plugins-1.4.16-check_ldap_certificate.patch new file mode 100644 index 0000000..6eb2b0c --- /dev/null +++ b/web/attachments/448048-nagios-plugins-1.4.16-check_ldap_certificate.patch | |||
| @@ -0,0 +1,188 @@ | |||
| 1 | diff -Naur -x '*~' -x '*.orig' -x '*.rej' nagios-plugins-1.4.16/plugins/check_ldap.c nagios-plugins-1.4.16-check_ldap_certificate/plugins/check_ldap.c | ||
| 2 | --- nagios-plugins-1.4.16/plugins/check_ldap.c 2012-06-27 19:32:47.000000000 +0200 | ||
| 3 | +++ nagios-plugins-1.4.16-check_ldap_certificate/plugins/check_ldap.c 2012-07-06 12:57:15.562316155 +0200 | ||
| 4 | @@ -72,6 +72,9 @@ | ||
| 5 | int ssl_on_connect = FALSE; | ||
| 6 | int verbose = 0; | ||
| 7 | |||
| 8 | +int check_cert = FALSE; | ||
| 9 | +int days_till_exp_warn, days_till_exp_crit; | ||
| 10 | + | ||
| 11 | /* for ldap tls */ | ||
| 12 | |||
| 13 | char *SERVICE = "LDAP"; | ||
| 14 | @@ -157,6 +160,9 @@ | ||
| 15 | printf (_("Could not init TLS at port %i!\n"), ld_port); | ||
| 16 | return STATE_CRITICAL; | ||
| 17 | } | ||
| 18 | + | ||
| 19 | + if (check_cert == TRUE) | ||
| 20 | + return ldap_check_cert(ld); | ||
| 21 | #else | ||
| 22 | printf (_("TLS not supported by the libraries!\n")); | ||
| 23 | return STATE_CRITICAL; | ||
| 24 | @@ -181,6 +187,9 @@ | ||
| 25 | printf (_("Could not init startTLS at port %i!\n"), ld_port); | ||
| 26 | return STATE_CRITICAL; | ||
| 27 | } | ||
| 28 | + | ||
| 29 | + if (check_cert == TRUE) | ||
| 30 | + return ldap_check_cert(ld); | ||
| 31 | #else | ||
| 32 | printf (_("startTLS not supported by the library, needs LDAPv3!\n")); | ||
| 33 | return STATE_CRITICAL; | ||
| 34 | @@ -240,6 +249,7 @@ | ||
| 35 | process_arguments (int argc, char **argv) | ||
| 36 | { | ||
| 37 | int c; | ||
| 38 | + char *temp; | ||
| 39 | |||
| 40 | int option = 0; | ||
| 41 | /* initialize the long option struct */ | ||
| 42 | @@ -258,6 +268,7 @@ | ||
| 43 | #endif | ||
| 44 | {"starttls", no_argument, 0, 'T'}, | ||
| 45 | {"ssl", no_argument, 0, 'S'}, | ||
| 46 | + {"certificate", required_argument, 0, 'C'}, | ||
| 47 | {"use-ipv4", no_argument, 0, '4'}, | ||
| 48 | {"use-ipv6", no_argument, 0, '6'}, | ||
| 49 | {"port", required_argument, 0, 'p'}, | ||
| 50 | @@ -276,7 +287,7 @@ | ||
| 51 | } | ||
| 52 | |||
| 53 | while (1) { | ||
| 54 | - c = getopt_long (argc, argv, "hvV234TS6t:c:w:H:b:p:a:D:P:", longopts, &option); | ||
| 55 | + c = getopt_long (argc, argv, "hvV234TS6t:c:w:H:b:p:a:D:P:C:", longopts, &option); | ||
| 56 | |||
| 57 | if (c == -1 || c == EOF) | ||
| 58 | break; | ||
| 59 | @@ -338,6 +349,33 @@ | ||
| 60 | else | ||
| 61 | usage_va(_("%s cannot be combined with %s"), "-T/--starttls", "-S/--ssl"); | ||
| 62 | break; | ||
| 63 | + case 'C': /* Check SSL cert validity */ | ||
| 64 | +#ifndef HAVE_SSL | ||
| 65 | + usage4 (_("Invalid option - SSL is not available")); | ||
| 66 | +#else | ||
| 67 | + if (starttls || ssl_on_connect || strstr(argv[0],"check_ldaps")) { | ||
| 68 | + if ((temp=strchr(optarg,','))!=NULL) { | ||
| 69 | + *temp = '\0'; | ||
| 70 | + if (!is_intnonneg (temp)) | ||
| 71 | + usage2 (_("Invalid certificate expiration period"), optarg); | ||
| 72 | + days_till_exp_warn = atoi(optarg); | ||
| 73 | + *temp = ','; | ||
| 74 | + temp++; | ||
| 75 | + if (!is_intnonneg (temp)) | ||
| 76 | + usage2 (_("Invalid certificate expiration period"), temp); | ||
| 77 | + days_till_exp_crit = atoi (temp); | ||
| 78 | + } else { | ||
| 79 | + days_till_exp_crit = 0; | ||
| 80 | + if (!is_intnonneg (optarg)) | ||
| 81 | + usage2 (_("Invalid certificate expiration period"), optarg); | ||
| 82 | + days_till_exp_warn = atoi (optarg); | ||
| 83 | + } | ||
| 84 | + check_cert = TRUE; | ||
| 85 | + } else { | ||
| 86 | + usage_va(_("%s requires either %s or %s"), "-C/--certificate", "-S/--ssl", "-T/--starttls"); | ||
| 87 | + } | ||
| 88 | + break; | ||
| 89 | +#endif | ||
| 90 | case 'S': | ||
| 91 | if (! starttls) { | ||
| 92 | ssl_on_connect = TRUE; | ||
| 93 | @@ -420,6 +458,9 @@ | ||
| 94 | printf (" %s\n", "-S [--ssl]"); | ||
| 95 | printf (" %s %i\n", _("use ldaps (ldap v2 ssl method). this also sets the default port to"), LDAPS_PORT); | ||
| 96 | |||
| 97 | + printf (" %s\n", "-C [--certificate]"); | ||
| 98 | + printf (" %s\n", _("Minimum number of days a certificate has to be valid")); | ||
| 99 | + | ||
| 100 | #ifdef HAVE_LDAP_SET_OPTION | ||
| 101 | printf (" %s\n", "-2 [--ver2]"); | ||
| 102 | printf (" %s\n", _("use ldap protocol version 2")); | ||
| 103 | @@ -455,7 +496,7 @@ | ||
| 104 | { | ||
| 105 | printf ("%s\n", _("Usage:")); | ||
| 106 | printf (" %s -H <host> -b <base_dn> [-p <port>] [-a <attr>] [-D <binddn>]",progname); | ||
| 107 | - printf ("\n [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]%s\n", | ||
| 108 | + printf ("\n [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout] [-C <age>]%s\n", | ||
| 109 | #ifdef HAVE_LDAP_SET_OPTION | ||
| 110 | "\n [-2|-3] [-4|-6]" | ||
| 111 | #else | ||
| 112 | @@ -463,3 +504,16 @@ | ||
| 113 | #endif | ||
| 114 | ); | ||
| 115 | } | ||
| 116 | + | ||
| 117 | +int ldap_check_cert (LDAP *ld) | ||
| 118 | +{ | ||
| 119 | + SSL *ssl; | ||
| 120 | + int rc; | ||
| 121 | + | ||
| 122 | + rc = ldap_get_option(ld, LDAP_OPT_X_TLS_SSL_CTX, &ssl); | ||
| 123 | + if (rc == LDAP_OPT_ERROR || ssl == NULL) { | ||
| 124 | + printf ("%s\n",_("CRITICAL - Cannot retrieve ssl session from connection.")); | ||
| 125 | + return STATE_CRITICAL; | ||
| 126 | + } | ||
| 127 | + return np_net_ssl_check_cert_real(ssl, days_till_exp_warn, days_till_exp_crit); | ||
| 128 | +} | ||
| 129 | diff -Naur -x '*~' -x '*.orig' -x '*.rej' nagios-plugins-1.4.16/plugins/Makefile.am nagios-plugins-1.4.16-check_ldap_certificate/plugins/Makefile.am | ||
| 130 | --- nagios-plugins-1.4.16/plugins/Makefile.am 2012-06-27 19:32:47.000000000 +0200 | ||
| 131 | +++ nagios-plugins-1.4.16-check_ldap_certificate/plugins/Makefile.am 2012-07-04 11:03:00.888343446 +0200 | ||
| 132 | @@ -72,7 +72,7 @@ | ||
| 133 | check_game_LDADD = $(BASEOBJS) runcmd.o | ||
| 134 | check_http_LDADD = $(SSLOBJS) $(NETLIBS) $(SSLLIBS) | ||
| 135 | check_hpjd_LDADD = $(NETLIBS) popen.o | ||
| 136 | -check_ldap_LDADD = $(NETLIBS) $(LDAPLIBS) | ||
| 137 | +check_ldap_LDADD = $(SSLOBJS) $(NETLIBS) $(LDAPLIBS) $(SSLLIBS) | ||
| 138 | check_load_LDADD = $(BASEOBJS) popen.o | ||
| 139 | check_mrtg_LDADD = $(BASEOBJS) | ||
| 140 | check_mrtgtraf_LDADD = $(BASEOBJS) | ||
| 141 | @@ -118,7 +118,7 @@ | ||
| 142 | check_http_DEPENDENCIES = check_http.c $(SSLOBJS) $(NETOBJS) $(DEPLIBS) | ||
| 143 | check_hpjd_DEPENDENCIES = check_hpjd.c $(NETOBJS) popen.o $(DEPLIBS) | ||
| 144 | check_ide_smart_DEPENDENCIES = check_ide_smart.c $(BASEOBJS) $(DEPLIBS) | ||
| 145 | -check_ldap_DEPENDENCIES = check_ldap.c $(NETOBJS) $(DEPLIBS) | ||
| 146 | +check_ldap_DEPENDENCIES = check_ldap.c $(SSLOBJS) $(NETOBJS) $(DEPLIBS) | ||
| 147 | check_load_DEPENDENCIES = check_load.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
| 148 | check_mrtg_DEPENDENCIES = check_mrtg.c $(DEPLIBS) | ||
| 149 | check_mrtgtraf_DEPENDENCIES = check_mrtgtraf.c $(DEPLIBS) | ||
| 150 | diff -Naur -x '*~' -x '*.orig' -x '*.rej' nagios-plugins-1.4.16/plugins/netutils.h nagios-plugins-1.4.16-check_ldap_certificate/plugins/netutils.h | ||
| 151 | --- nagios-plugins-1.4.16/plugins/netutils.h 2012-06-27 19:32:47.000000000 +0200 | ||
| 152 | +++ nagios-plugins-1.4.16-check_ldap_certificate/plugins/netutils.h 2012-07-04 11:03:56.291891100 +0200 | ||
| 153 | @@ -104,6 +104,7 @@ | ||
| 154 | int np_net_ssl_write(const void *buf, int num); | ||
| 155 | int np_net_ssl_read(void *buf, int num); | ||
| 156 | int np_net_ssl_check_cert(int days_till_exp_warn, int days_till_exp_crit); | ||
| 157 | +int np_net_ssl_check_cert_real(SSL *ssl, int days_till_exp_warn, int days_till_exp_crit); | ||
| 158 | #endif /* HAVE_SSL */ | ||
| 159 | |||
| 160 | #endif /* _NETUTILS_H_ */ | ||
| 161 | diff -Naur -x '*~' -x '*.orig' -x '*.rej' nagios-plugins-1.4.16/plugins/sslutils.c nagios-plugins-1.4.16-check_ldap_certificate/plugins/sslutils.c | ||
| 162 | --- nagios-plugins-1.4.16/plugins/sslutils.c 2012-06-27 19:32:47.000000000 +0200 | ||
| 163 | +++ nagios-plugins-1.4.16-check_ldap_certificate/plugins/sslutils.c 2012-07-06 13:11:37.469453627 +0200 | ||
| 164 | @@ -128,6 +128,15 @@ | ||
| 165 | |||
| 166 | int np_net_ssl_check_cert(int days_till_exp_warn, int days_till_exp_crit){ | ||
| 167 | # ifdef USE_OPENSSL | ||
| 168 | + return np_net_ssl_check_cert_real(s, days_till_exp_warn, days_till_exp_crit); | ||
| 169 | +# else /* ifndef USE_OPENSSL */ | ||
| 170 | + printf ("%s\n", _("WARNING - Plugin does not support checking certificates.")); | ||
| 171 | + return STATE_WARNING; | ||
| 172 | +# endif /* USE_OPENSSL */ | ||
| 173 | +} | ||
| 174 | + | ||
| 175 | +int np_net_ssl_check_cert_real(SSL *ssl, int days_till_exp_warn, int days_till_exp_crit){ | ||
| 176 | +# ifdef USE_OPENSSL | ||
| 177 | X509 *certificate=NULL; | ||
| 178 | X509_NAME *subj=NULL; | ||
| 179 | char cn[MAX_CN_LENGTH]= ""; | ||
| 180 | @@ -141,7 +150,7 @@ | ||
| 181 | int days_left; | ||
| 182 | char timestamp[17] = ""; | ||
| 183 | |||
| 184 | - certificate=SSL_get_peer_certificate(s); | ||
| 185 | + certificate=SSL_get_peer_certificate(ssl); | ||
| 186 | if (!certificate) { | ||
| 187 | printf("%s\n",_("CRITICAL - Cannot retrieve server certificate.")); | ||
| 188 | return STATE_CRITICAL; | ||
diff --git a/web/attachments/450266-nagios.build.txt b/web/attachments/450266-nagios.build.txt new file mode 100644 index 0000000..e18df70 --- /dev/null +++ b/web/attachments/450266-nagios.build.txt | |||
| @@ -0,0 +1,2145 @@ | |||
| 1 | ./configure | ||
| 2 | checking for a BSD-compatible install... /usr/bin/install -c | ||
| 3 | checking whether build environment is sane... yes | ||
| 4 | checking for a thread-safe mkdir -p... /bin/mkdir -p | ||
| 5 | checking for gawk... gawk | ||
| 6 | checking whether make sets $(MAKE)... yes | ||
| 7 | checking build system type... x86_64-unknown-linux-gnu | ||
| 8 | checking host system type... x86_64-unknown-linux-gnu | ||
| 9 | checking for gcc... gcc | ||
| 10 | checking whether the C compiler works... yes | ||
| 11 | checking for C compiler default output file name... a.out | ||
| 12 | checking for suffix of executables... | ||
| 13 | checking whether we are cross compiling... no | ||
| 14 | checking for suffix of object files... o | ||
| 15 | checking whether we are using the GNU C compiler... yes | ||
| 16 | checking whether gcc accepts -g... yes | ||
| 17 | checking for gcc option to accept ISO C89... none needed | ||
| 18 | checking for style of include used by make... GNU | ||
| 19 | checking dependency style of gcc... gcc3 | ||
| 20 | ./configure: line 4100: gl_EARLY: command not found | ||
| 21 | checking how to run the C preprocessor... gcc -E | ||
| 22 | checking for grep that handles long lines and -e... /bin/grep | ||
| 23 | checking for egrep... /bin/grep -E | ||
| 24 | checking whether gcc needs -traditional... no | ||
| 25 | checking how to print strings... printf | ||
| 26 | checking for a sed that does not truncate output... /bin/sed | ||
| 27 | checking for fgrep... /bin/grep -F | ||
| 28 | checking for ld used by gcc... /usr/bin/ld | ||
| 29 | checking if the linker (/usr/bin/ld) is GNU ld... yes | ||
| 30 | checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B | ||
| 31 | checking the name lister (/usr/bin/nm -B) interface... BSD nm | ||
| 32 | checking whether ln -s works... yes | ||
| 33 | checking the maximum length of command line arguments... 1572864 | ||
| 34 | checking whether the shell understands some XSI constructs... yes | ||
| 35 | checking whether the shell understands "+="... yes | ||
| 36 | checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop | ||
| 37 | checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop | ||
| 38 | checking for /usr/bin/ld option to reload object files... -r | ||
| 39 | checking for objdump... objdump | ||
| 40 | checking how to recognize dependent libraries... pass_all | ||
| 41 | checking for dlltool... no | ||
| 42 | checking how to associate runtime and link libraries... printf %s\n | ||
| 43 | checking for ar... ar | ||
| 44 | checking for archiver @FILE support... @ | ||
| 45 | checking for strip... strip | ||
| 46 | checking for ranlib... ranlib | ||
| 47 | checking command to parse /usr/bin/nm -B output from gcc object... ok | ||
| 48 | checking for sysroot... no | ||
| 49 | checking for mt... mt | ||
| 50 | checking if mt is a manifest tool... no | ||
| 51 | checking for ANSI C header files... yes | ||
| 52 | checking for sys/types.h... yes | ||
| 53 | checking for sys/stat.h... yes | ||
| 54 | checking for stdlib.h... yes | ||
| 55 | checking for string.h... yes | ||
| 56 | checking for memory.h... yes | ||
| 57 | checking for strings.h... yes | ||
| 58 | checking for inttypes.h... yes | ||
| 59 | checking for stdint.h... yes | ||
| 60 | checking for unistd.h... yes | ||
| 61 | checking for dlfcn.h... yes | ||
| 62 | checking for objdir... .libs | ||
| 63 | checking if gcc supports -fno-rtti -fno-exceptions... no | ||
| 64 | checking for gcc option to produce PIC... -fPIC -DPIC | ||
| 65 | checking if gcc PIC flag -fPIC -DPIC works... yes | ||
| 66 | checking if gcc static flag -static works... yes | ||
| 67 | checking if gcc supports -c -o file.o... yes | ||
| 68 | checking if gcc supports -c -o file.o... (cached) yes | ||
| 69 | checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes | ||
| 70 | checking whether -lc should be explicitly linked in... no | ||
| 71 | checking dynamic linker characteristics... GNU/Linux ld.so | ||
| 72 | checking how to hardcode library paths into programs... immediate | ||
| 73 | checking whether stripping libraries is possible... yes | ||
| 74 | checking if libtool supports shared libraries... yes | ||
| 75 | checking whether to build shared libraries... yes | ||
| 76 | checking whether to build static libraries... yes | ||
| 77 | checking whether gcc and cc understand -c and -o together... yes | ||
| 78 | checking for error_at_line... yes | ||
| 79 | checking for special C compiler options needed for large files... no | ||
| 80 | checking for _FILE_OFFSET_BITS value needed for large files... no | ||
| 81 | checking for working strtod... yes | ||
| 82 | checking for python... /usr/bin/python | ||
| 83 | checking for sh... /bin/sh | ||
| 84 | checking for perl... /usr/bin/perl | ||
| 85 | checking for libgnutls-config... no | ||
| 86 | checking for hostname... /bin/hostname | ||
| 87 | checking for basename... /usr/bin/basename | ||
| 88 | checking for main in -ldce... no | ||
| 89 | checking for main in -lnsl... yes | ||
| 90 | checking for socket in -lsocket... no | ||
| 91 | checking for main in -lresolv... yes | ||
| 92 | checking math.h usability... yes | ||
| 93 | checking math.h presence... yes | ||
| 94 | checking for math.h... yes | ||
| 95 | checking for floor in -lm... yes | ||
| 96 | checking mp.h usability... no | ||
| 97 | checking mp.h presence... no | ||
| 98 | checking for mp.h... no | ||
| 99 | checking for pow in -lbsd... no | ||
| 100 | checking for plan_tests in -ltap... no | ||
| 101 | checking for main in -lcrypt... yes | ||
| 102 | checking for PQsetdbLogin in -lpq... no | ||
| 103 | configure: WARNING: Skipping PostgreSQL plugin (check_pgsql) | ||
| 104 | configure: WARNING: LIBS="-lcrypt " CPPFLAGS="" | ||
| 105 | configure: WARNING: install PostgreSQL libs to compile this plugin (see REQUIREMENTS). | ||
| 106 | checking for dbi_initialize in -ldbi... no | ||
| 107 | configure: WARNING: Skipping dbi plugin | ||
| 108 | configure: WARNING: install DBI libs to compile this plugin (see REQUIREMENTS). | ||
| 109 | checking for rc_read_config in -lradiusclient... no | ||
| 110 | checking for rc_read_config in -lradiusclient-ng... no | ||
| 111 | configure: WARNING: Skipping radius plugin | ||
| 112 | configure: WARNING: install radius libs to compile this plugin (see REQUIREMENTS). | ||
| 113 | checking for main in -lldap... no | ||
| 114 | configure: WARNING: Skipping LDAP plugin | ||
| 115 | configure: WARNING: install LDAP libs to compile this plugin (see REQUIREMENTS). | ||
| 116 | checking linux/hdreg.h usability... yes | ||
| 117 | checking linux/hdreg.h presence... yes | ||
| 118 | checking for linux/hdreg.h... yes | ||
| 119 | checking linux/types.h usability... yes | ||
| 120 | checking linux/types.h presence... yes | ||
| 121 | checking for linux/types.h... yes | ||
| 122 | ./configure: line 13278: np_mysqlclient: command not found | ||
| 123 | ./configure: line 13279: test: =: unary operator expected | ||
| 124 | checking for IPv6 support... yes | ||
| 125 | checking krb5.h usability... no | ||
| 126 | checking krb5.h presence... no | ||
| 127 | checking for krb5.h... no | ||
| 128 | checking krb5.h usability... no | ||
| 129 | checking krb5.h presence... no | ||
| 130 | checking for krb5.h... no | ||
| 131 | checking for dlopen in -ldl... yes | ||
| 132 | checking for shl_load in -ldl... no | ||
| 133 | checking openssl/ssl.h usability... yes | ||
| 134 | checking openssl/ssl.h presence... yes | ||
| 135 | checking for openssl/ssl.h... yes | ||
| 136 | checking openssl/x509.h usability... yes | ||
| 137 | checking openssl/x509.h presence... yes | ||
| 138 | checking for openssl/x509.h... yes | ||
| 139 | checking openssl/rsa.h usability... yes | ||
| 140 | checking openssl/rsa.h presence... yes | ||
| 141 | checking for openssl/rsa.h... yes | ||
| 142 | checking openssl/pem.h usability... yes | ||
| 143 | checking openssl/pem.h presence... yes | ||
| 144 | checking for openssl/pem.h... yes | ||
| 145 | checking openssl/crypto.h usability... yes | ||
| 146 | checking openssl/crypto.h presence... yes | ||
| 147 | checking for openssl/crypto.h... yes | ||
| 148 | checking openssl/err.h usability... yes | ||
| 149 | checking openssl/err.h presence... yes | ||
| 150 | checking for openssl/err.h... yes | ||
| 151 | checking for CRYPTO_lock in -lcrypto... yes | ||
| 152 | checking for main in -lssl... yes | ||
| 153 | checking whether time.h and sys/time.h may both be included... yes | ||
| 154 | checking for sys/wait.h that is POSIX.1 compatible... yes | ||
| 155 | checking signal.h usability... yes | ||
| 156 | checking signal.h presence... yes | ||
| 157 | checking for signal.h... yes | ||
| 158 | checking syslog.h usability... yes | ||
| 159 | checking syslog.h presence... yes | ||
| 160 | checking for syslog.h... yes | ||
| 161 | checking uio.h usability... no | ||
| 162 | checking uio.h presence... no | ||
| 163 | checking for uio.h... no | ||
| 164 | checking errno.h usability... yes | ||
| 165 | checking errno.h presence... yes | ||
| 166 | checking for errno.h... yes | ||
| 167 | checking sys/time.h usability... yes | ||
| 168 | checking sys/time.h presence... yes | ||
| 169 | checking for sys/time.h... yes | ||
| 170 | checking sys/socket.h usability... yes | ||
| 171 | checking sys/socket.h presence... yes | ||
| 172 | checking for sys/socket.h... yes | ||
| 173 | checking sys/un.h usability... yes | ||
| 174 | checking sys/un.h presence... yes | ||
| 175 | checking for sys/un.h... yes | ||
| 176 | checking sys/poll.h usability... yes | ||
| 177 | checking sys/poll.h presence... yes | ||
| 178 | checking for sys/poll.h... yes | ||
| 179 | checking features.h usability... yes | ||
| 180 | checking features.h presence... yes | ||
| 181 | checking for features.h... yes | ||
| 182 | checking stdarg.h usability... yes | ||
| 183 | checking stdarg.h presence... yes | ||
| 184 | checking for stdarg.h... yes | ||
| 185 | checking sys/unistd.h usability... yes | ||
| 186 | checking sys/unistd.h presence... yes | ||
| 187 | checking for sys/unistd.h... yes | ||
| 188 | checking ctype.h usability... yes | ||
| 189 | checking ctype.h presence... yes | ||
| 190 | checking for ctype.h... yes | ||
| 191 | checking for an ANSI C-conforming const... yes | ||
| 192 | checking whether struct tm is in sys/time.h or time.h... time.h | ||
| 193 | checking for pid_t... yes | ||
| 194 | checking for size_t... yes | ||
| 195 | checking return type of signal handlers... void | ||
| 196 | checking for va_copy... yes | ||
| 197 | checking for memmove... yes | ||
| 198 | checking for select... yes | ||
| 199 | checking for socket... yes | ||
| 200 | checking for strdup... yes | ||
| 201 | checking for strstr... yes | ||
| 202 | checking for strtol... yes | ||
| 203 | checking for strtoul... yes | ||
| 204 | checking for floor... no | ||
| 205 | checking for poll... yes | ||
| 206 | checking return type of socket size... int | ||
| 207 | checking for ps... /bin/ps | ||
| 208 | checking for ps syntax... /bin/ps axwo 'stat uid pid ppid vsz rss pcpu comm args' | ||
| 209 | checking for ping... /bin/ping | ||
| 210 | checking for ping6... /bin/ping6 | ||
| 211 | checking for ICMP ping syntax... /bin/ping -n -U -w %d -c %d %s | ||
| 212 | checking for ICMPv6 ping syntax... /bin/ping6 -n -U -w %d -c %d %s | ||
| 213 | checking for nslookup... /usr/bin/nslookup | ||
| 214 | checking for nslookup syntax... /usr/bin/nslookup -sil | ||
| 215 | checking for number of cpus... sysconf(_SC_NPROCESSORS_CONF) | ||
| 216 | checking for uptime... /usr/bin/uptime | ||
| 217 | checking for rpcinfo... /usr/bin/rpcinfo | ||
| 218 | checking for lmstat... no | ||
| 219 | configure: WARNING: Get lmstat from Globetrotter Software to monitor flexlm licenses | ||
| 220 | checking for smbclient... /usr/bin/smbclient | ||
| 221 | checking for who... /usr/bin/who | ||
| 222 | checking for snmpget... /usr/bin/snmpget | ||
| 223 | checking for snmpgetnext... /usr/bin/snmpgetnext | ||
| 224 | checking for Net::SNMP perl module... found | ||
| 225 | checking for quakestat... /usr/bin/quakestat | ||
| 226 | checking for qstat... no | ||
| 227 | checking for fping... /usr/bin/fping | ||
| 228 | checking for ssh... /usr/bin/ssh | ||
| 229 | checking for mailq... /usr/bin/mailq | ||
| 230 | checking for qmail-qstat... no | ||
| 231 | configure: WARNING: Could not find qmail-qstat or eqivalent | ||
| 232 | checking for swap... no | ||
| 233 | checking for swapinfo... no | ||
| 234 | checking for lsps... no | ||
| 235 | checking for sys/stat.h... (cached) yes | ||
| 236 | checking sys/param.h usability... yes | ||
| 237 | checking sys/param.h presence... yes | ||
| 238 | checking for sys/param.h... yes | ||
| 239 | checking for sys/swap.h... yes | ||
| 240 | checking whether swapctl is declared... no | ||
| 241 | checking for swaptbl_t... no | ||
| 242 | checking for swapent_t... no | ||
| 243 | checking for struct swapent.se_nblks... no | ||
| 244 | checking for /proc/meminfo... found /proc/meminfo | ||
| 245 | checking for dig... /usr/bin/dig | ||
| 246 | checking for apt-get... /usr/bin/apt-get | ||
| 247 | checking sys/sockio.h usability... no | ||
| 248 | checking sys/sockio.h presence... no | ||
| 249 | checking for sys/sockio.h... no | ||
| 250 | checking whether NLS is requested... yes | ||
| 251 | checking for msgfmt... /usr/bin/msgfmt | ||
| 252 | checking for gmsgfmt... /usr/bin/msgfmt | ||
| 253 | checking for xgettext... /usr/bin/xgettext | ||
| 254 | checking for msgmerge... /usr/bin/msgmerge | ||
| 255 | checking for ld used by GCC... /usr/bin/ld -m elf_x86_64 | ||
| 256 | checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes | ||
| 257 | checking for shared library run path origin... done | ||
| 258 | checking for CFPreferencesCopyAppValue... no | ||
| 259 | checking for CFLocaleCopyCurrent... no | ||
| 260 | checking for GNU gettext in libc... yes | ||
| 261 | checking whether to use NLS... yes | ||
| 262 | checking where the gettext function comes from... libc | ||
| 263 | checking for main in -lpthread... yes | ||
| 264 | ./configure: line 18615: gl_INIT: command not found | ||
| 265 | configure: creating ./config.status | ||
| 266 | config.status: creating gl/Makefile | ||
| 267 | config.status: creating nagios-plugins.spec | ||
| 268 | config.status: creating Makefile | ||
| 269 | config.status: creating tap/Makefile | ||
| 270 | config.status: creating lib/Makefile | ||
| 271 | config.status: creating plugins/Makefile | ||
| 272 | config.status: creating lib/tests/Makefile | ||
| 273 | config.status: creating plugins-root/Makefile | ||
| 274 | config.status: creating plugins-scripts/Makefile | ||
| 275 | config.status: creating plugins-scripts/subst | ||
| 276 | config.status: creating plugins-scripts/utils.pm | ||
| 277 | config.status: creating plugins-scripts/utils.sh | ||
| 278 | config.status: creating perlmods/Makefile | ||
| 279 | config.status: creating command.cfg | ||
| 280 | config.status: creating test.pl | ||
| 281 | config.status: creating pkg/solaris/pkginfo | ||
| 282 | config.status: creating po/Makefile.in | ||
| 283 | config.status: creating config.h | ||
| 284 | config.status: config.h is unchanged | ||
| 285 | config.status: executing depfiles commands | ||
| 286 | config.status: executing libtool commands | ||
| 287 | config.status: executing po-directories commands | ||
| 288 | config.status: creating po/POTFILES | ||
| 289 | config.status: creating po/Makefile | ||
| 290 | --with-apt-get-command: /usr/bin/apt-get | ||
| 291 | --with-ping6-command: /bin/ping6 -n -U -w %d -c %d %s | ||
| 292 | --with-ping-command: /bin/ping -n -U -w %d -c %d %s | ||
| 293 | --with-ipv6: yes | ||
| 294 | --with-mysql: | ||
| 295 | --with-openssl: yes | ||
| 296 | --with-gnutls: no | ||
| 297 | --enable-extra-opts: no | ||
| 298 | --with-perl: /usr/bin/perl | ||
| 299 | --enable-perl-modules: no | ||
| 300 | --with-cgiurl: /nagios/cgi-bin | ||
| 301 | --with-trusted-path: /bin:/sbin:/usr/bin:/usr/sbin | ||
| 302 | --enable-libtap: no | ||
| 303 | dataloader% make | ||
| 304 | make all-recursive | ||
| 305 | make[1]: Entering directory `/home/bryan/tmp/nagiosplug' | ||
| 306 | Making all in gl | ||
| 307 | make[2]: Entering directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 308 | rm -f configmake.h-t && \ | ||
| 309 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 310 | echo '#define PREFIX "/usr/local/nagios"'; \ | ||
| 311 | echo '#define EXEC_PREFIX "/usr/local/nagios"'; \ | ||
| 312 | echo '#define BINDIR "/usr/local/nagios/bin"'; \ | ||
| 313 | echo '#define SBINDIR "/usr/local/nagios/sbin"'; \ | ||
| 314 | echo '#define LIBEXECDIR "/usr/local/nagios/libexec"'; \ | ||
| 315 | echo '#define DATAROOTDIR "/usr/local/nagios/share"'; \ | ||
| 316 | echo '#define DATADIR "/usr/local/nagios/share"'; \ | ||
| 317 | echo '#define SYSCONFDIR "/usr/local/nagios/etc"'; \ | ||
| 318 | echo '#define SHAREDSTATEDIR "/usr/local/nagios/com"'; \ | ||
| 319 | echo '#define LOCALSTATEDIR "/usr/local/nagios/var"'; \ | ||
| 320 | echo '#define INCLUDEDIR "/usr/local/nagios/include"'; \ | ||
| 321 | echo '#define OLDINCLUDEDIR "/usr/include"'; \ | ||
| 322 | echo '#define DOCDIR "/usr/local/nagios/share/doc/nagios-plugins"'; \ | ||
| 323 | echo '#define INFODIR "/usr/local/nagios/share/info"'; \ | ||
| 324 | echo '#define HTMLDIR "/usr/local/nagios/share/doc/nagios-plugins"'; \ | ||
| 325 | echo '#define DVIDIR "/usr/local/nagios/share/doc/nagios-plugins"'; \ | ||
| 326 | echo '#define PDFDIR "/usr/local/nagios/share/doc/nagios-plugins"'; \ | ||
| 327 | echo '#define PSDIR "/usr/local/nagios/share/doc/nagios-plugins"'; \ | ||
| 328 | echo '#define LIBDIR "/usr/local/nagios/lib"'; \ | ||
| 329 | echo '#define LISPDIR ""'; \ | ||
| 330 | echo '#define LOCALEDIR "/usr/local/nagios/share/locale"'; \ | ||
| 331 | echo '#define MANDIR "/usr/local/nagios/share/man"'; \ | ||
| 332 | echo '#define MANEXT ""'; \ | ||
| 333 | echo '#define PKGDATADIR "/usr/local/nagios/share/nagios-plugins"'; \ | ||
| 334 | echo '#define PKGINCLUDEDIR "/usr/local/nagios/include/nagios-plugins"'; \ | ||
| 335 | echo '#define PKGLIBDIR "/usr/local/nagios/lib/nagios-plugins"'; \ | ||
| 336 | echo '#define PKGLIBEXECDIR "/usr/local/nagios/libexec/nagios-plugins"'; \ | ||
| 337 | } | sed '/""/d' > configmake.h-t && \ | ||
| 338 | if test -f configmake.h && cmp configmake.h-t configmake.h > /dev/null; then \ | ||
| 339 | rm -f configmake.h-t; \ | ||
| 340 | else \ | ||
| 341 | rm -f configmake.h; mv configmake.h-t configmake.h; \ | ||
| 342 | fi | ||
| 343 | make all-recursive | ||
| 344 | make[3]: Entering directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 345 | make[4]: Entering directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 346 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -g -O2 -MT base64.o -MD -MP -MF .deps/base64.Tpo -c -o base64.o base64.c | ||
| 347 | In file included from base64.c:47:0: | ||
| 348 | base64.h:40:49: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’ | ||
| 349 | base64.h:48:53: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’ | ||
| 350 | In file included from base64.c:50:0: | ||
| 351 | ./stdlib.h:20:1: error: stray ‘@’ in program | ||
| 352 | ./stdlib.h:20:1: error: stray ‘@’ in program | ||
| 353 | In file included from base64.c:50:0: | ||
| 354 | ./stdlib.h:43:7: error: operator '||' has no left operand | ||
| 355 | ./stdlib.h:49:5: error: #if with no expression | ||
| 356 | ./stdlib.h:53:7: error: operator '!' has no right operand | ||
| 357 | ./stdlib.h:58:6: error: operator '!' has no right operand | ||
| 358 | ./stdlib.h:71:7: error: operator '||' has no left operand | ||
| 359 | In file included from base64.c:50:0: | ||
| 360 | ./stdlib.h:410:5: error: #if with no expression | ||
| 361 | ./stdlib.h:426:5: error: #if with no expression | ||
| 362 | ./stdlib.h:445:5: error: #if with no expression | ||
| 363 | ./stdlib.h:469:5: error: #if with no expression | ||
| 364 | ./stdlib.h:488:5: error: #if with no expression | ||
| 365 | ./stdlib.h:516:5: error: #if with no expression | ||
| 366 | ./stdlib.h:532:5: error: #if with no expression | ||
| 367 | ./stdlib.h:551:5: error: #if with no expression | ||
| 368 | ./stdlib.h:570:5: error: #if with no expression | ||
| 369 | ./stdlib.h:597:5: error: #if with no expression | ||
| 370 | ./stdlib.h:627:5: error: #if with no expression | ||
| 371 | ./stdlib.h:658:5: error: #if with no expression | ||
| 372 | ./stdlib.h:683:5: error: #if with no expression | ||
| 373 | ./stdlib.h:699:5: error: #if with no expression | ||
| 374 | ./stdlib.h:714:5: error: #if with no expression | ||
| 375 | ./stdlib.h:722:5: error: #if with no expression | ||
| 376 | ./stdlib.h:737:5: error: #if with no expression | ||
| 377 | ./stdlib.h:754:5: error: #if with no expression | ||
| 378 | ./stdlib.h:773:5: error: #if with no expression | ||
| 379 | ./stdlib.h:791:5: error: #if with no expression | ||
| 380 | ./stdlib.h:810:5: error: #if with no expression | ||
| 381 | ./stdlib.h:834:5: error: #if with no expression | ||
| 382 | ./stdlib.h:850:5: error: #if with no expression | ||
| 383 | ./stdlib.h:881:5: error: #if with no expression | ||
| 384 | ./stdlib.h:906:5: error: #if with no expression | ||
| 385 | ./stdlib.h:931:5: error: #if with no expression | ||
| 386 | ./stdlib.h:956:5: error: #if with no expression | ||
| 387 | ./stdlib.h:972:5: error: #if with no expression | ||
| 388 | In file included from base64.c:55:0: | ||
| 389 | ./string.h:23:1: error: stray ‘@’ in program | ||
| 390 | In file included from base64.c:50:0: | ||
| 391 | ./stdlib.h:20:2: error: unknown type name ‘PRAGMA_SYSTEM_HEADER’ | ||
| 392 | In file included from base64.c:55:0: | ||
| 393 | ./string.h:23:1: error: stray ‘@’ in program | ||
| 394 | In file included from base64.c:55:0: | ||
| 395 | ./string.h:36:6: error: operator '&&' has no left operand | ||
| 396 | ./string.h:371:5: error: #if with no expression | ||
| 397 | ./string.h:409:5: error: #if with no expression | ||
| 398 | ./string.h:444:5: error: #if with no expression | ||
| 399 | ./string.h:464:5: error: #if with no expression | ||
| 400 | ./string.h:494:5: error: #if with no expression | ||
| 401 | ./string.h:522:5: error: #if with no expression | ||
| 402 | ./string.h:541:5: error: #if with no expression | ||
| 403 | ./string.h:584:5: error: #if with no expression | ||
| 404 | ./string.h:612:5: error: #if with no expression | ||
| 405 | ./string.h:636:5: error: #if with no expression | ||
| 406 | ./string.h:658:5: error: #if with no expression | ||
| 407 | ./string.h:686:5: error: #if with no expression | ||
| 408 | ./string.h:726:5: error: #if with no expression | ||
| 409 | ./string.h:800:5: error: #if with no expression | ||
| 410 | ./string.h:823:5: error: #if with no expression | ||
| 411 | ./string.h:864:5: error: #if with no expression | ||
| 412 | ./string.h:931:5: error: #if with no expression | ||
| 413 | ./string.h:976:5: error: #if with no expression | ||
| 414 | ./string.h:995:5: error: #if with no expression | ||
| 415 | ./string.h:1002:5: error: #if with no expression | ||
| 416 | ./string.h:1022:5: error: #if with no expression | ||
| 417 | ./string.h:1042:5: error: #if with no expression | ||
| 418 | ./string.h:1051:5: error: #if with no expression | ||
| 419 | ./string.h:1062:5: error: #if with no expression | ||
| 420 | ./string.h:1076:5: error: #if with no expression | ||
| 421 | ./string.h:1090:5: error: #if with no expression | ||
| 422 | ./string.h:1100:5: error: #if with no expression | ||
| 423 | ./string.h:1110:5: error: #if with no expression | ||
| 424 | ./string.h:1130:5: error: #if with no expression | ||
| 425 | ./string.h:1140:5: error: #if with no expression | ||
| 426 | ./string.h:1159:5: error: #if with no expression | ||
| 427 | ./string.h:1181:5: error: #if with no expression | ||
| 428 | ./string.h:1200:5: error: #if with no expression | ||
| 429 | ./string.h:1224:5: error: #if with no expression | ||
| 430 | base64.c:58:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘static’ | ||
| 431 | base64.c:69:37: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’ | ||
| 432 | base64.c: In function ‘base64_encode_alloc’: | ||
| 433 | base64.c:138:10: warning: incompatible implicit declaration of built-in function ‘malloc’ [enabled by default] | ||
| 434 | base64.c: At top level: | ||
| 435 | base64.c:321:29: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token | ||
| 436 | base64.c:374:32: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’ | ||
| 437 | base64.c:460:41: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’ | ||
| 438 | base64.c: In function ‘base64_decode_alloc_ctx’: | ||
| 439 | base64.c:561:10: warning: incompatible implicit declaration of built-in function ‘malloc’ [enabled by default] | ||
| 440 | base64.c:567:7: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default] | ||
| 441 | make[4]: *** [base64.o] Error 1 | ||
| 442 | make[4]: Leaving directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 443 | make[3]: *** [all-recursive] Error 1 | ||
| 444 | make[3]: Leaving directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 445 | make[2]: *** [all] Error 2 | ||
| 446 | make[2]: Leaving directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 447 | make[1]: *** [all-recursive] Error 1 | ||
| 448 | make[1]: Leaving directory `/home/bryan/tmp/nagiosplug' | ||
| 449 | make: *** [all] Error 2 | ||
| 450 | dataloader% make clean | ||
| 451 | Making clean in po | ||
| 452 | make[1]: Entering directory `/home/bryan/tmp/nagiosplug/po' | ||
| 453 | rm -f remove-potcdate.sed | ||
| 454 | rm -f stamp-poT | ||
| 455 | rm -f core core.* nagios-plugins.po nagios-plugins.1po nagios-plugins.2po *.new.po | ||
| 456 | rm -fr *.o | ||
| 457 | make[1]: Leaving directory `/home/bryan/tmp/nagiosplug/po' | ||
| 458 | Making clean in plugins-root | ||
| 459 | make[1]: Entering directory `/home/bryan/tmp/nagiosplug/plugins-root' | ||
| 460 | NP_VERSION = 1.4.16.29.g3c10 | ||
| 461 | make[1]: Leaving directory `/home/bryan/tmp/nagiosplug/plugins-root' | ||
| 462 | make[1]: Entering directory `/home/bryan/tmp/nagiosplug/plugins-root' | ||
| 463 | rm -rf .libs _libs | ||
| 464 | rm -f NP-VERSION-FILE | ||
| 465 | rm -f check_dhcp check_icmp | ||
| 466 | rm -f *.o | ||
| 467 | rm -f *.lo | ||
| 468 | make[1]: Leaving directory `/home/bryan/tmp/nagiosplug/plugins-root' | ||
| 469 | Making clean in plugins-scripts | ||
| 470 | make[1]: Entering directory `/home/bryan/tmp/nagiosplug/plugins-scripts' | ||
| 471 | NP_VERSION = 1.4.16.29.g3c10 | ||
| 472 | make[1]: Leaving directory `/home/bryan/tmp/nagiosplug/plugins-scripts' | ||
| 473 | make[1]: Entering directory `/home/bryan/tmp/nagiosplug/plugins-scripts' | ||
| 474 | test -z "check_breeze check_disk_smb check_flexlm check_ircd check_log check_oracle check_rpc check_sensors check_wave check_ifstatus check_ifoperstatus check_mailq check_file_age utils.sh utils.pm" || rm -f check_breeze check_disk_smb check_flexlm check_ircd check_log check_oracle check_rpc check_sensors check_wave check_ifstatus check_ifoperstatus check_mailq check_file_age utils.sh utils.pm | ||
| 475 | rm -rf .libs _libs | ||
| 476 | rm -f NP-VERSION-FILE | ||
| 477 | rm -f *.lo | ||
| 478 | make[1]: Leaving directory `/home/bryan/tmp/nagiosplug/plugins-scripts' | ||
| 479 | Making clean in plugins | ||
| 480 | make[1]: Entering directory `/home/bryan/tmp/nagiosplug/plugins' | ||
| 481 | NP_VERSION = 1.4.16.29.g3c10 | ||
| 482 | make[1]: Leaving directory `/home/bryan/tmp/nagiosplug/plugins' | ||
| 483 | make[1]: Entering directory `/home/bryan/tmp/nagiosplug/plugins' | ||
| 484 | rm -f check_apt check_cluster check_disk check_dummy check_http check_load check_mrtg check_mrtgtraf check_ntp check_ntp_peer check_nwstat check_overcr check_ping check_real check_smtp check_ssh check_tcp check_time check_ntp_time check_ups check_users negate urlize check_ide_smart check_mysql check_mysql_query check_procs check_nagios check_dns check_hpjd check_snmp check_game check_fping check_by_ssh check_swap check_dig check_apt check_nt | ||
| 485 | rm -rf .libs _libs | ||
| 486 | rm -f check_ftp check_imap check_nntp check_pop check_udp check_clamd check_simap check_spop check_jabber check_nntps check_ssmtp | ||
| 487 | rm -f NP-VERSION-FILE | ||
| 488 | rm -f *.o | ||
| 489 | rm -f *.lo | ||
| 490 | make[1]: Leaving directory `/home/bryan/tmp/nagiosplug/plugins' | ||
| 491 | Making clean in lib | ||
| 492 | make[1]: Entering directory `/home/bryan/tmp/nagiosplug/lib' | ||
| 493 | Making clean in tests | ||
| 494 | make[2]: Entering directory `/home/bryan/tmp/nagiosplug/lib/tests' | ||
| 495 | rm -rf .libs _libs | ||
| 496 | rm -f *.o | ||
| 497 | rm -f *.lo | ||
| 498 | make[2]: Leaving directory `/home/bryan/tmp/nagiosplug/lib/tests' | ||
| 499 | Making clean in . | ||
| 500 | make[2]: Entering directory `/home/bryan/tmp/nagiosplug/lib' | ||
| 501 | rm -rf .libs _libs | ||
| 502 | test -z "libnagiosplug.a" || rm -f libnagiosplug.a | ||
| 503 | rm -f *.o | ||
| 504 | rm -f *.lo | ||
| 505 | make[2]: Leaving directory `/home/bryan/tmp/nagiosplug/lib' | ||
| 506 | make[1]: Leaving directory `/home/bryan/tmp/nagiosplug/lib' | ||
| 507 | Making clean in tap | ||
| 508 | make[1]: Entering directory `/home/bryan/tmp/nagiosplug/tap' | ||
| 509 | rm -rf .libs _libs | ||
| 510 | test -z "" || rm -f | ||
| 511 | rm -f *.o | ||
| 512 | rm -f *.lo | ||
| 513 | make[1]: Leaving directory `/home/bryan/tmp/nagiosplug/tap' | ||
| 514 | Making clean in gl | ||
| 515 | make[1]: Entering directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 516 | Making clean in . | ||
| 517 | make[2]: Entering directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 518 | test -z "configmake.h configmake.h-t charset.alias ref-add.sed ref-del.sed" || rm -f configmake.h configmake.h-t charset.alias ref-add.sed ref-del.sed | ||
| 519 | rm -rf .libs _libs | ||
| 520 | test -z "libgnu.a" || rm -f libgnu.a | ||
| 521 | test -z "" || rm -f | ||
| 522 | rm -f *.o | ||
| 523 | test -z "core *.stackdump alloca.h alloca.h-t arg-nonnull.h arg-nonnull.h-t arpa/inet.h arpa/inet.h-t c++defs.h c++defs.h-t errno.h errno.h-t fcntl.h fcntl.h-t float.h float.h-t getopt.h getopt.h-t langinfo.h langinfo.h-t locale.h locale.h-t math.h math.h-t netdb.h netdb.h-t netinet/in.h netinet/in.h-t stdbool.h stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t stdio.h stdio.h-t stdlib.h stdlib.h-t string.h string.h-t sys/socket.h sys/socket.h-t sys/stat.h sys/stat.h-t time.h time.h-t unistd.h unistd.h-t warn-on-use.h warn-on-use.h-t wchar.h wchar.h-t wctype.h wctype.h-t" || rm -f core *.stackdump alloca.h alloca.h-t arg-nonnull.h arg-nonnull.h-t arpa/inet.h arpa/inet.h-t c++defs.h c++defs.h-t errno.h errno.h-t fcntl.h fcntl.h-t float.h float.h-t getopt.h getopt.h-t langinfo.h langinfo.h-t locale.h locale.h-t math.h math.h-t netdb.h netdb.h-t netinet/in.h netinet/in.h-t stdbool.h stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t stdio.h stdio.h-t stdlib.h stdlib.h-t string.h string.h-t sys/socket.h sys/socket.h-t sys/stat.h sys/stat.h-t time.h time.h-t unistd.h unistd.h-t warn-on-use.h warn-on-use.h-t wchar.h wchar.h-t wctype.h wctype.h-t | ||
| 524 | rm -f *.lo | ||
| 525 | rmdir arpa | ||
| 526 | rmdir sys | ||
| 527 | make[2]: Leaving directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 528 | make[1]: Leaving directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 529 | Making clean in . | ||
| 530 | make[1]: Entering directory `/home/bryan/tmp/nagiosplug' | ||
| 531 | rm -rf .libs _libs | ||
| 532 | rm -f *.lo | ||
| 533 | make[1]: Leaving directory `/home/bryan/tmp/nagiosplug' | ||
| 534 | dataloader% make | ||
| 535 | make all-recursive | ||
| 536 | make[1]: Entering directory `/home/bryan/tmp/nagiosplug' | ||
| 537 | Making all in gl | ||
| 538 | make[2]: Entering directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 539 | rm -f arg-nonnull.h-t arg-nonnull.h && \ | ||
| 540 | sed -n -e '/GL_ARG_NONNULL/,$p' \ | ||
| 541 | < ../build-aux/arg-nonnull.h \ | ||
| 542 | > arg-nonnull.h-t && \ | ||
| 543 | mv arg-nonnull.h-t arg-nonnull.h | ||
| 544 | rm -f warn-on-use.h-t warn-on-use.h && \ | ||
| 545 | sed -n -e '/^.ifndef/,$p' \ | ||
| 546 | < ../build-aux/warn-on-use.h \ | ||
| 547 | > warn-on-use.h-t && \ | ||
| 548 | mv warn-on-use.h-t warn-on-use.h | ||
| 549 | /bin/mkdir -p arpa | ||
| 550 | rm -f arpa/inet.h-t arpa/inet.h && \ | ||
| 551 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 552 | sed -e 's|@''INCLUDE_NEXT''@||g' \ | ||
| 553 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 554 | -e 's|@''NEXT_ARPA_INET_H''@||g' \ | ||
| 555 | -e 's|@''HAVE_ARPA_INET_H''@||g' \ | ||
| 556 | -e 's|@''GNULIB_INET_NTOP''@||g' \ | ||
| 557 | -e 's|@''GNULIB_INET_PTON''@||g' \ | ||
| 558 | -e 's|@''HAVE_DECL_INET_NTOP''@||g' \ | ||
| 559 | -e 's|@''HAVE_DECL_INET_PTON''@||g' \ | ||
| 560 | -e '/definition of _GL_ARG_NONNULL/r arg-nonnull.h' \ | ||
| 561 | -e '/definition of _GL_WARN_ON_USE/r warn-on-use.h' \ | ||
| 562 | < ./arpa_inet.in.h; \ | ||
| 563 | } > arpa/inet.h-t && \ | ||
| 564 | mv arpa/inet.h-t arpa/inet.h | ||
| 565 | rm -f c++defs.h-t c++defs.h && \ | ||
| 566 | sed -n -e '/_GL_CXXDEFS/,$p' \ | ||
| 567 | < ../build-aux/c++defs.h \ | ||
| 568 | > c++defs.h-t && \ | ||
| 569 | mv c++defs.h-t c++defs.h | ||
| 570 | rm -f configmake.h-t && \ | ||
| 571 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 572 | echo '#define PREFIX "/usr/local/nagios"'; \ | ||
| 573 | echo '#define EXEC_PREFIX "/usr/local/nagios"'; \ | ||
| 574 | echo '#define BINDIR "/usr/local/nagios/bin"'; \ | ||
| 575 | echo '#define SBINDIR "/usr/local/nagios/sbin"'; \ | ||
| 576 | echo '#define LIBEXECDIR "/usr/local/nagios/libexec"'; \ | ||
| 577 | echo '#define DATAROOTDIR "/usr/local/nagios/share"'; \ | ||
| 578 | echo '#define DATADIR "/usr/local/nagios/share"'; \ | ||
| 579 | echo '#define SYSCONFDIR "/usr/local/nagios/etc"'; \ | ||
| 580 | echo '#define SHAREDSTATEDIR "/usr/local/nagios/com"'; \ | ||
| 581 | echo '#define LOCALSTATEDIR "/usr/local/nagios/var"'; \ | ||
| 582 | echo '#define INCLUDEDIR "/usr/local/nagios/include"'; \ | ||
| 583 | echo '#define OLDINCLUDEDIR "/usr/include"'; \ | ||
| 584 | echo '#define DOCDIR "/usr/local/nagios/share/doc/nagios-plugins"'; \ | ||
| 585 | echo '#define INFODIR "/usr/local/nagios/share/info"'; \ | ||
| 586 | echo '#define HTMLDIR "/usr/local/nagios/share/doc/nagios-plugins"'; \ | ||
| 587 | echo '#define DVIDIR "/usr/local/nagios/share/doc/nagios-plugins"'; \ | ||
| 588 | echo '#define PDFDIR "/usr/local/nagios/share/doc/nagios-plugins"'; \ | ||
| 589 | echo '#define PSDIR "/usr/local/nagios/share/doc/nagios-plugins"'; \ | ||
| 590 | echo '#define LIBDIR "/usr/local/nagios/lib"'; \ | ||
| 591 | echo '#define LISPDIR ""'; \ | ||
| 592 | echo '#define LOCALEDIR "/usr/local/nagios/share/locale"'; \ | ||
| 593 | echo '#define MANDIR "/usr/local/nagios/share/man"'; \ | ||
| 594 | echo '#define MANEXT ""'; \ | ||
| 595 | echo '#define PKGDATADIR "/usr/local/nagios/share/nagios-plugins"'; \ | ||
| 596 | echo '#define PKGINCLUDEDIR "/usr/local/nagios/include/nagios-plugins"'; \ | ||
| 597 | echo '#define PKGLIBDIR "/usr/local/nagios/lib/nagios-plugins"'; \ | ||
| 598 | echo '#define PKGLIBEXECDIR "/usr/local/nagios/libexec/nagios-plugins"'; \ | ||
| 599 | } | sed '/""/d' > configmake.h-t && \ | ||
| 600 | if test -f configmake.h && cmp configmake.h-t configmake.h > /dev/null; then \ | ||
| 601 | rm -f configmake.h-t; \ | ||
| 602 | else \ | ||
| 603 | rm -f configmake.h; mv configmake.h-t configmake.h; \ | ||
| 604 | fi | ||
| 605 | rm -f fcntl.h-t fcntl.h && \ | ||
| 606 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 607 | sed -e 's|@''INCLUDE_NEXT''@||g' \ | ||
| 608 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 609 | -e 's|@''NEXT_FCNTL_H''@||g' \ | ||
| 610 | -e 's|@''GNULIB_FCNTL''@||g' \ | ||
| 611 | -e 's|@''GNULIB_OPEN''@||g' \ | ||
| 612 | -e 's|@''GNULIB_OPENAT''@||g' \ | ||
| 613 | -e 's|@''HAVE_FCNTL''@||g' \ | ||
| 614 | -e 's|@''HAVE_OPENAT''@||g' \ | ||
| 615 | -e 's|@''REPLACE_FCNTL''@||g' \ | ||
| 616 | -e 's|@''REPLACE_OPEN''@||g' \ | ||
| 617 | -e 's|@''REPLACE_OPENAT''@||g' \ | ||
| 618 | -e '/definitions of _GL_FUNCDECL_RPL/r c++defs.h' \ | ||
| 619 | -e '/definition of _GL_ARG_NONNULL/r arg-nonnull.h' \ | ||
| 620 | -e '/definition of _GL_WARN_ON_USE/r warn-on-use.h' \ | ||
| 621 | < ./fcntl.in.h; \ | ||
| 622 | } > fcntl.h-t && \ | ||
| 623 | mv fcntl.h-t fcntl.h | ||
| 624 | rm -f langinfo.h-t langinfo.h && \ | ||
| 625 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 626 | sed -e 's|@''HAVE_LANGINFO_H''@||g' \ | ||
| 627 | -e 's|@''INCLUDE_NEXT''@||g' \ | ||
| 628 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 629 | -e 's|@''NEXT_LANGINFO_H''@||g' \ | ||
| 630 | -e 's|@''GNULIB_NL_LANGINFO''@||g' \ | ||
| 631 | -e 's|@''HAVE_LANGINFO_CODESET''@||g' \ | ||
| 632 | -e 's|@''HAVE_LANGINFO_ERA''@||g' \ | ||
| 633 | -e 's|@''HAVE_NL_LANGINFO''@||g' \ | ||
| 634 | -e 's|@''REPLACE_NL_LANGINFO''@||g' \ | ||
| 635 | -e '/definitions of _GL_FUNCDECL_RPL/r c++defs.h' \ | ||
| 636 | -e '/definition of _GL_WARN_ON_USE/r warn-on-use.h' \ | ||
| 637 | < ./langinfo.in.h; \ | ||
| 638 | } > langinfo.h-t && \ | ||
| 639 | mv langinfo.h-t langinfo.h | ||
| 640 | rm -f locale.h-t locale.h && \ | ||
| 641 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ | ||
| 642 | sed -e 's|@''INCLUDE_NEXT''@||g' \ | ||
| 643 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 644 | -e 's|@''NEXT_LOCALE_H''@||g' \ | ||
| 645 | -e 's|@''GNULIB_DUPLOCALE''@||g' \ | ||
| 646 | -e 's|@''HAVE_DUPLOCALE''@||g' \ | ||
| 647 | -e 's|@''HAVE_XLOCALE_H''@||g' \ | ||
| 648 | -e 's|@''REPLACE_DUPLOCALE''@||g' \ | ||
| 649 | -e '/definitions of _GL_FUNCDECL_RPL/r c++defs.h' \ | ||
| 650 | -e '/definition of _GL_ARG_NONNULL/r arg-nonnull.h' \ | ||
| 651 | -e '/definition of _GL_WARN_ON_USE/r warn-on-use.h' \ | ||
| 652 | < ./locale.in.h; \ | ||
| 653 | } > locale.h-t && \ | ||
| 654 | mv locale.h-t locale.h | ||
| 655 | rm -f math.h-t math.h && \ | ||
| 656 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ | ||
| 657 | sed -e 's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@||g' \ | ||
| 658 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 659 | -e 's|@''NEXT_AS_FIRST_DIRECTIVE_MATH_H''@||g' \ | ||
| 660 | -e 's|@''GNULIB_ACOSL''@||g' \ | ||
| 661 | -e 's|@''GNULIB_ASINL''@||g' \ | ||
| 662 | -e 's|@''GNULIB_ATANL''@||g' \ | ||
| 663 | -e 's|@''GNULIB_CEILF''@||g' \ | ||
| 664 | -e 's|@''GNULIB_CEILL''@||g' \ | ||
| 665 | -e 's|@''GNULIB_COSL''@||g' \ | ||
| 666 | -e 's|@''GNULIB_EXPL''@||g' \ | ||
| 667 | -e 's|@''GNULIB_FLOORF''@||g' \ | ||
| 668 | -e 's|@''GNULIB_FLOORL''@||g' \ | ||
| 669 | -e 's|@''GNULIB_FREXP''@||g' \ | ||
| 670 | -e 's|@''GNULIB_FREXPL''@||g' \ | ||
| 671 | -e 's|@''GNULIB_ISFINITE''@||g' \ | ||
| 672 | -e 's|@''GNULIB_ISINF''@||g' \ | ||
| 673 | -e 's|@''GNULIB_ISNAN''@||g' \ | ||
| 674 | -e 's|@''GNULIB_ISNANF''@||g' \ | ||
| 675 | -e 's|@''GNULIB_ISNAND''@||g' \ | ||
| 676 | -e 's|@''GNULIB_ISNANL''@||g' \ | ||
| 677 | -e 's|@''GNULIB_LDEXPL''@||g' \ | ||
| 678 | -e 's|@''GNULIB_LOGB''@||g' \ | ||
| 679 | -e 's|@''GNULIB_LOGL''@||g' \ | ||
| 680 | -e 's|@''GNULIB_ROUND''@||g' \ | ||
| 681 | -e 's|@''GNULIB_ROUNDF''@||g' \ | ||
| 682 | -e 's|@''GNULIB_ROUNDL''@||g' \ | ||
| 683 | -e 's|@''GNULIB_SIGNBIT''@||g' \ | ||
| 684 | -e 's|@''GNULIB_SINL''@||g' \ | ||
| 685 | -e 's|@''GNULIB_SQRTL''@||g' \ | ||
| 686 | -e 's|@''GNULIB_TANL''@||g' \ | ||
| 687 | -e 's|@''GNULIB_TRUNC''@||g' \ | ||
| 688 | -e 's|@''GNULIB_TRUNCF''@||g' \ | ||
| 689 | -e 's|@''GNULIB_TRUNCL''@||g' \ | ||
| 690 | -e 's|@''HAVE_ACOSL''@||g' \ | ||
| 691 | -e 's|@''HAVE_ASINL''@||g' \ | ||
| 692 | -e 's|@''HAVE_ATANL''@||g' \ | ||
| 693 | -e 's|@''HAVE_COSL''@||g' \ | ||
| 694 | -e 's|@''HAVE_EXPL''@||g' \ | ||
| 695 | -e 's|@''HAVE_ISNANF''@||g' \ | ||
| 696 | -e 's|@''HAVE_ISNAND''@||g' \ | ||
| 697 | -e 's|@''HAVE_ISNANL''@||g' \ | ||
| 698 | -e 's|@''HAVE_LOGL''@||g' \ | ||
| 699 | -e 's|@''HAVE_SINL''@||g' \ | ||
| 700 | -e 's|@''HAVE_SQRTL''@||g' \ | ||
| 701 | -e 's|@''HAVE_TANL''@||g' \ | ||
| 702 | -e 's|@''HAVE_DECL_ACOSL''@||g' \ | ||
| 703 | -e 's|@''HAVE_DECL_ASINL''@||g' \ | ||
| 704 | -e 's|@''HAVE_DECL_ATANL''@||g' \ | ||
| 705 | -e 's|@''HAVE_DECL_CEILF''@||g' \ | ||
| 706 | -e 's|@''HAVE_DECL_CEILL''@||g' \ | ||
| 707 | -e 's|@''HAVE_DECL_COSL''@||g' \ | ||
| 708 | -e 's|@''HAVE_DECL_EXPL''@||g' \ | ||
| 709 | -e 's|@''HAVE_DECL_FLOORF''@||g' \ | ||
| 710 | -e 's|@''HAVE_DECL_FLOORL''@||g' \ | ||
| 711 | -e 's|@''HAVE_DECL_FREXPL''@||g' \ | ||
| 712 | -e 's|@''HAVE_DECL_LDEXPL''@||g' \ | ||
| 713 | -e 's|@''HAVE_DECL_LOGB''@||g' \ | ||
| 714 | -e 's|@''HAVE_DECL_LOGL''@||g' \ | ||
| 715 | -e 's|@''HAVE_DECL_ROUND''@||g' \ | ||
| 716 | -e 's|@''HAVE_DECL_ROUNDF''@||g' \ | ||
| 717 | -e 's|@''HAVE_DECL_ROUNDL''@||g' \ | ||
| 718 | -e 's|@''HAVE_DECL_SINL''@||g' \ | ||
| 719 | -e 's|@''HAVE_DECL_SQRTL''@||g' \ | ||
| 720 | -e 's|@''HAVE_DECL_TANL''@||g' \ | ||
| 721 | -e 's|@''HAVE_DECL_TRUNC''@||g' \ | ||
| 722 | -e 's|@''HAVE_DECL_TRUNCF''@||g' \ | ||
| 723 | -e 's|@''HAVE_DECL_TRUNCL''@||g' \ | ||
| 724 | -e 's|@''REPLACE_CEILF''@||g' \ | ||
| 725 | -e 's|@''REPLACE_CEILL''@||g' \ | ||
| 726 | -e 's|@''REPLACE_FLOORF''@||g' \ | ||
| 727 | -e 's|@''REPLACE_FLOORL''@||g' \ | ||
| 728 | -e 's|@''REPLACE_FREXP''@||g' \ | ||
| 729 | -e 's|@''REPLACE_FREXPL''@||g' \ | ||
| 730 | -e 's|@''REPLACE_HUGE_VAL''@||g' \ | ||
| 731 | -e 's|@''REPLACE_ISFINITE''@||g' \ | ||
| 732 | -e 's|@''REPLACE_ISINF''@||g' \ | ||
| 733 | -e 's|@''REPLACE_ISNAN''@||g' \ | ||
| 734 | -e 's|@''REPLACE_LDEXPL''@||g' \ | ||
| 735 | -e 's|@''REPLACE_NAN''@||g' \ | ||
| 736 | -e 's|@''REPLACE_ROUND''@||g' \ | ||
| 737 | -e 's|@''REPLACE_ROUNDF''@||g' \ | ||
| 738 | -e 's|@''REPLACE_ROUNDL''@||g' \ | ||
| 739 | -e 's|@''REPLACE_SIGNBIT''@||g' \ | ||
| 740 | -e 's|@''REPLACE_SIGNBIT_USING_GCC''@||g' \ | ||
| 741 | -e 's|@''REPLACE_TRUNCL''@||g' \ | ||
| 742 | -e '/definitions of _GL_FUNCDECL_RPL/r c++defs.h' \ | ||
| 743 | -e '/definition of _GL_ARG_NONNULL/r arg-nonnull.h' \ | ||
| 744 | -e '/definition of _GL_WARN_ON_USE/r warn-on-use.h' \ | ||
| 745 | < ./math.in.h; \ | ||
| 746 | } > math.h-t && \ | ||
| 747 | mv math.h-t math.h | ||
| 748 | rm -f netdb.h-t netdb.h && \ | ||
| 749 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 750 | sed -e 's|@''INCLUDE_NEXT''@||g' \ | ||
| 751 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 752 | -e 's|@''NEXT_NETDB_H''@||g' \ | ||
| 753 | -e 's|@''HAVE_NETDB_H''@||g' \ | ||
| 754 | -e 's|@''GNULIB_GETADDRINFO''@||g' \ | ||
| 755 | -e 's|@''HAVE_STRUCT_ADDRINFO''@||g' \ | ||
| 756 | -e 's|@''HAVE_DECL_FREEADDRINFO''@||g' \ | ||
| 757 | -e 's|@''HAVE_DECL_GAI_STRERROR''@||g' \ | ||
| 758 | -e 's|@''HAVE_DECL_GETADDRINFO''@||g' \ | ||
| 759 | -e 's|@''HAVE_DECL_GETNAMEINFO''@||g' \ | ||
| 760 | -e '/definition of _GL_ARG_NONNULL/r arg-nonnull.h' \ | ||
| 761 | -e '/definition of _GL_WARN_ON_USE/r warn-on-use.h' \ | ||
| 762 | < ./netdb.in.h; \ | ||
| 763 | } > netdb.h-t && \ | ||
| 764 | mv netdb.h-t netdb.h | ||
| 765 | rm -f stdio.h-t stdio.h && \ | ||
| 766 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ | ||
| 767 | sed -e 's|@''INCLUDE_NEXT''@||g' \ | ||
| 768 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 769 | -e 's|@''NEXT_STDIO_H''@||g' \ | ||
| 770 | -e 's|@''GNULIB_DPRINTF''@||g' \ | ||
| 771 | -e 's|@''GNULIB_FCLOSE''@||g' \ | ||
| 772 | -e 's|@''GNULIB_FFLUSH''@||g' \ | ||
| 773 | -e 's|@''GNULIB_FOPEN''@||g' \ | ||
| 774 | -e 's|@''GNULIB_FPRINTF''@||g' \ | ||
| 775 | -e 's|@''GNULIB_FPRINTF_POSIX''@||g' \ | ||
| 776 | -e 's|@''GNULIB_FPURGE''@||g' \ | ||
| 777 | -e 's|@''GNULIB_FPUTC''@||g' \ | ||
| 778 | -e 's|@''GNULIB_FPUTS''@||g' \ | ||
| 779 | -e 's|@''GNULIB_FREOPEN''@||g' \ | ||
| 780 | -e 's|@''GNULIB_FSEEK''@||g' \ | ||
| 781 | -e 's|@''GNULIB_FSEEKO''@||g' \ | ||
| 782 | -e 's|@''GNULIB_FTELL''@||g' \ | ||
| 783 | -e 's|@''GNULIB_FTELLO''@||g' \ | ||
| 784 | -e 's|@''GNULIB_FWRITE''@||g' \ | ||
| 785 | -e 's|@''GNULIB_GETDELIM''@||g' \ | ||
| 786 | -e 's|@''GNULIB_GETLINE''@||g' \ | ||
| 787 | -e 's|@''GNULIB_OBSTACK_PRINTF''@||g' \ | ||
| 788 | -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@||g' \ | ||
| 789 | -e 's|@''GNULIB_PERROR''@||g' \ | ||
| 790 | -e 's|@''GNULIB_POPEN''@||g' \ | ||
| 791 | -e 's|@''GNULIB_PRINTF''@||g' \ | ||
| 792 | -e 's|@''GNULIB_PRINTF_POSIX''@||g' \ | ||
| 793 | -e 's|@''GNULIB_PUTC''@||g' \ | ||
| 794 | -e 's|@''GNULIB_PUTCHAR''@||g' \ | ||
| 795 | -e 's|@''GNULIB_PUTS''@||g' \ | ||
| 796 | -e 's|@''GNULIB_REMOVE''@||g' \ | ||
| 797 | -e 's|@''GNULIB_RENAME''@||g' \ | ||
| 798 | -e 's|@''GNULIB_RENAMEAT''@||g' \ | ||
| 799 | -e 's|@''GNULIB_SNPRINTF''@||g' \ | ||
| 800 | -e 's|@''GNULIB_SPRINTF_POSIX''@||g' \ | ||
| 801 | -e 's|@''GNULIB_STDIO_H_SIGPIPE''@||g' \ | ||
| 802 | -e 's|@''GNULIB_TMPFILE''@||g' \ | ||
| 803 | -e 's|@''GNULIB_VASPRINTF''@||g' \ | ||
| 804 | -e 's|@''GNULIB_VDPRINTF''@||g' \ | ||
| 805 | -e 's|@''GNULIB_VFPRINTF''@||g' \ | ||
| 806 | -e 's|@''GNULIB_VFPRINTF_POSIX''@||g' \ | ||
| 807 | -e 's|@''GNULIB_VPRINTF''@||g' \ | ||
| 808 | -e 's|@''GNULIB_VPRINTF_POSIX''@||g' \ | ||
| 809 | -e 's|@''GNULIB_VSNPRINTF''@||g' \ | ||
| 810 | -e 's|@''GNULIB_VSPRINTF_POSIX''@||g' \ | ||
| 811 | < ./stdio.in.h | \ | ||
| 812 | sed -e 's|@''HAVE_DECL_FPURGE''@||g' \ | ||
| 813 | -e 's|@''HAVE_DECL_GETDELIM''@||g' \ | ||
| 814 | -e 's|@''HAVE_DECL_GETLINE''@||g' \ | ||
| 815 | -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@||g' \ | ||
| 816 | -e 's|@''HAVE_DECL_SNPRINTF''@||g' \ | ||
| 817 | -e 's|@''HAVE_DECL_VSNPRINTF''@||g' \ | ||
| 818 | -e 's|@''HAVE_DPRINTF''@||g' \ | ||
| 819 | -e 's|@''HAVE_FSEEKO''@||g' \ | ||
| 820 | -e 's|@''HAVE_FTELLO''@||g' \ | ||
| 821 | -e 's|@''HAVE_RENAMEAT''@||g' \ | ||
| 822 | -e 's|@''HAVE_VASPRINTF''@||g' \ | ||
| 823 | -e 's|@''HAVE_VDPRINTF''@||g' \ | ||
| 824 | -e 's|@''REPLACE_DPRINTF''@||g' \ | ||
| 825 | -e 's|@''REPLACE_FCLOSE''@||g' \ | ||
| 826 | -e 's|@''REPLACE_FFLUSH''@||g' \ | ||
| 827 | -e 's|@''REPLACE_FOPEN''@||g' \ | ||
| 828 | -e 's|@''REPLACE_FPRINTF''@||g' \ | ||
| 829 | -e 's|@''REPLACE_FPURGE''@||g' \ | ||
| 830 | -e 's|@''REPLACE_FREOPEN''@||g' \ | ||
| 831 | -e 's|@''REPLACE_FSEEK''@||g' \ | ||
| 832 | -e 's|@''REPLACE_FSEEKO''@||g' \ | ||
| 833 | -e 's|@''REPLACE_FTELL''@||g' \ | ||
| 834 | -e 's|@''REPLACE_FTELLO''@||g' \ | ||
| 835 | -e 's|@''REPLACE_GETDELIM''@||g' \ | ||
| 836 | -e 's|@''REPLACE_GETLINE''@||g' \ | ||
| 837 | -e 's|@''REPLACE_OBSTACK_PRINTF''@||g' \ | ||
| 838 | -e 's|@''REPLACE_PERROR''@||g' \ | ||
| 839 | -e 's|@''REPLACE_POPEN''@||g' \ | ||
| 840 | -e 's|@''REPLACE_PRINTF''@||g' \ | ||
| 841 | -e 's|@''REPLACE_REMOVE''@||g' \ | ||
| 842 | -e 's|@''REPLACE_RENAME''@||g' \ | ||
| 843 | -e 's|@''REPLACE_RENAMEAT''@||g' \ | ||
| 844 | -e 's|@''REPLACE_SNPRINTF''@||g' \ | ||
| 845 | -e 's|@''REPLACE_SPRINTF''@||g' \ | ||
| 846 | -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@||g' \ | ||
| 847 | -e 's|@''REPLACE_TMPFILE''@||g' \ | ||
| 848 | -e 's|@''REPLACE_VASPRINTF''@||g' \ | ||
| 849 | -e 's|@''REPLACE_VDPRINTF''@||g' \ | ||
| 850 | -e 's|@''REPLACE_VFPRINTF''@||g' \ | ||
| 851 | -e 's|@''REPLACE_VPRINTF''@||g' \ | ||
| 852 | -e 's|@''REPLACE_VSNPRINTF''@||g' \ | ||
| 853 | -e 's|@''REPLACE_VSPRINTF''@||g' \ | ||
| 854 | -e 's|@''ASM_SYMBOL_PREFIX''@||g' \ | ||
| 855 | -e '/definitions of _GL_FUNCDECL_RPL/r c++defs.h' \ | ||
| 856 | -e '/definition of _GL_ARG_NONNULL/r arg-nonnull.h' \ | ||
| 857 | -e '/definition of _GL_WARN_ON_USE/r warn-on-use.h'; \ | ||
| 858 | } > stdio.h-t && \ | ||
| 859 | mv stdio.h-t stdio.h | ||
| 860 | rm -f stdlib.h-t stdlib.h && \ | ||
| 861 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ | ||
| 862 | sed -e 's|@''INCLUDE_NEXT''@||g' \ | ||
| 863 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 864 | -e 's|@''NEXT_STDLIB_H''@||g' \ | ||
| 865 | -e 's|@''GNULIB_ATOLL''@||g' \ | ||
| 866 | -e 's|@''GNULIB_CALLOC_POSIX''@||g' \ | ||
| 867 | -e 's|@''GNULIB_CANONICALIZE_FILE_NAME''@||g' \ | ||
| 868 | -e 's|@''GNULIB_GETLOADAVG''@||g' \ | ||
| 869 | -e 's|@''GNULIB_GETSUBOPT''@||g' \ | ||
| 870 | -e 's|@''GNULIB_GRANTPT''@||g' \ | ||
| 871 | -e 's|@''GNULIB_MALLOC_POSIX''@||g' \ | ||
| 872 | -e 's|@''GNULIB_MKDTEMP''@||g' \ | ||
| 873 | -e 's|@''GNULIB_MKOSTEMP''@||g' \ | ||
| 874 | -e 's|@''GNULIB_MKOSTEMPS''@||g' \ | ||
| 875 | -e 's|@''GNULIB_MKSTEMP''@||g' \ | ||
| 876 | -e 's|@''GNULIB_MKSTEMPS''@||g' \ | ||
| 877 | -e 's|@''GNULIB_PTSNAME''@||g' \ | ||
| 878 | -e 's|@''GNULIB_PUTENV''@||g' \ | ||
| 879 | -e 's|@''GNULIB_RANDOM_R''@||g' \ | ||
| 880 | -e 's|@''GNULIB_REALLOC_POSIX''@||g' \ | ||
| 881 | -e 's|@''GNULIB_REALPATH''@||g' \ | ||
| 882 | -e 's|@''GNULIB_RPMATCH''@||g' \ | ||
| 883 | -e 's|@''GNULIB_SETENV''@||g' \ | ||
| 884 | -e 's|@''GNULIB_STRTOD''@||g' \ | ||
| 885 | -e 's|@''GNULIB_STRTOLL''@||g' \ | ||
| 886 | -e 's|@''GNULIB_STRTOULL''@||g' \ | ||
| 887 | -e 's|@''GNULIB_UNLOCKPT''@||g' \ | ||
| 888 | -e 's|@''GNULIB_UNSETENV''@||g' \ | ||
| 889 | -e 's|@''HAVE_ATOLL''@||g' \ | ||
| 890 | -e 's|@''HAVE_CALLOC_POSIX''@||g' \ | ||
| 891 | -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@||g' \ | ||
| 892 | -e 's|@''HAVE_DECL_GETLOADAVG''@||g' \ | ||
| 893 | -e 's|@''HAVE_GETSUBOPT''@||g' \ | ||
| 894 | -e 's|@''HAVE_GRANTPT''@||g' \ | ||
| 895 | -e 's|@''HAVE_MALLOC_POSIX''@||g' \ | ||
| 896 | -e 's|@''HAVE_MKDTEMP''@||g' \ | ||
| 897 | -e 's|@''HAVE_MKOSTEMP''@||g' \ | ||
| 898 | -e 's|@''HAVE_MKOSTEMPS''@||g' \ | ||
| 899 | -e 's|@''HAVE_MKSTEMP''@||g' \ | ||
| 900 | -e 's|@''HAVE_MKSTEMPS''@||g' \ | ||
| 901 | -e 's|@''HAVE_PTSNAME''@||g' \ | ||
| 902 | -e 's|@''HAVE_RANDOM_H''@||g' \ | ||
| 903 | -e 's|@''HAVE_RANDOM_R''@||g' \ | ||
| 904 | -e 's|@''HAVE_REALLOC_POSIX''@||g' \ | ||
| 905 | -e 's|@''HAVE_REALPATH''@||g' \ | ||
| 906 | -e 's|@''HAVE_RPMATCH''@||g' \ | ||
| 907 | -e 's|@''HAVE_SETENV''@||g' \ | ||
| 908 | -e 's|@''HAVE_STRTOD''@||g' \ | ||
| 909 | -e 's|@''HAVE_STRTOLL''@||g' \ | ||
| 910 | -e 's|@''HAVE_STRTOULL''@||g' \ | ||
| 911 | -e 's|@''HAVE_STRUCT_RANDOM_DATA''@||g' \ | ||
| 912 | -e 's|@''HAVE_SYS_LOADAVG_H''@||g' \ | ||
| 913 | -e 's|@''HAVE_UNLOCKPT''@||g' \ | ||
| 914 | -e 's|@''HAVE_UNSETENV''@||g' \ | ||
| 915 | -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@||g' \ | ||
| 916 | -e 's|@''REPLACE_MKSTEMP''@||g' \ | ||
| 917 | -e 's|@''REPLACE_PUTENV''@||g' \ | ||
| 918 | -e 's|@''REPLACE_REALPATH''@||g' \ | ||
| 919 | -e 's|@''REPLACE_SETENV''@||g' \ | ||
| 920 | -e 's|@''REPLACE_STRTOD''@||g' \ | ||
| 921 | -e 's|@''REPLACE_UNSETENV''@||g' \ | ||
| 922 | -e '/definitions of _GL_FUNCDECL_RPL/r c++defs.h' \ | ||
| 923 | -e '/definition of _GL_ARG_NONNULL/r arg-nonnull.h' \ | ||
| 924 | -e '/definition of _GL_WARN_ON_USE/r warn-on-use.h' \ | ||
| 925 | < ./stdlib.in.h; \ | ||
| 926 | } > stdlib.h-t && \ | ||
| 927 | mv stdlib.h-t stdlib.h | ||
| 928 | rm -f string.h-t string.h && \ | ||
| 929 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ | ||
| 930 | sed -e 's|@''INCLUDE_NEXT''@||g' \ | ||
| 931 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 932 | -e 's|@''NEXT_STRING_H''@||g' \ | ||
| 933 | -e 's|@''GNULIB_MBSLEN''@||g' \ | ||
| 934 | -e 's|@''GNULIB_MBSNLEN''@||g' \ | ||
| 935 | -e 's|@''GNULIB_MBSCHR''@||g' \ | ||
| 936 | -e 's|@''GNULIB_MBSRCHR''@||g' \ | ||
| 937 | -e 's|@''GNULIB_MBSSTR''@||g' \ | ||
| 938 | -e 's|@''GNULIB_MBSCASECMP''@||g' \ | ||
| 939 | -e 's|@''GNULIB_MBSNCASECMP''@||g' \ | ||
| 940 | -e 's|@''GNULIB_MBSPCASECMP''@||g' \ | ||
| 941 | -e 's|@''GNULIB_MBSCASESTR''@||g' \ | ||
| 942 | -e 's|@''GNULIB_MBSCSPN''@||g' \ | ||
| 943 | -e 's|@''GNULIB_MBSPBRK''@||g' \ | ||
| 944 | -e 's|@''GNULIB_MBSSPN''@||g' \ | ||
| 945 | -e 's|@''GNULIB_MBSSEP''@||g' \ | ||
| 946 | -e 's|@''GNULIB_MBSTOK_R''@||g' \ | ||
| 947 | -e 's|@''GNULIB_MEMCHR''@||g' \ | ||
| 948 | -e 's|@''GNULIB_MEMMEM''@||g' \ | ||
| 949 | -e 's|@''GNULIB_MEMPCPY''@||g' \ | ||
| 950 | -e 's|@''GNULIB_MEMRCHR''@||g' \ | ||
| 951 | -e 's|@''GNULIB_RAWMEMCHR''@||g' \ | ||
| 952 | -e 's|@''GNULIB_STPCPY''@||g' \ | ||
| 953 | -e 's|@''GNULIB_STPNCPY''@||g' \ | ||
| 954 | -e 's|@''GNULIB_STRCHRNUL''@||g' \ | ||
| 955 | -e 's|@''GNULIB_STRDUP''@||g' \ | ||
| 956 | -e 's|@''GNULIB_STRNCAT''@||g' \ | ||
| 957 | -e 's|@''GNULIB_STRNDUP''@||g' \ | ||
| 958 | -e 's|@''GNULIB_STRNLEN''@||g' \ | ||
| 959 | -e 's|@''GNULIB_STRPBRK''@||g' \ | ||
| 960 | -e 's|@''GNULIB_STRSEP''@||g' \ | ||
| 961 | -e 's|@''GNULIB_STRSTR''@||g' \ | ||
| 962 | -e 's|@''GNULIB_STRCASESTR''@||g' \ | ||
| 963 | -e 's|@''GNULIB_STRTOK_R''@||g' \ | ||
| 964 | -e 's|@''GNULIB_STRERROR''@||g' \ | ||
| 965 | -e 's|@''GNULIB_STRSIGNAL''@||g' \ | ||
| 966 | -e 's|@''GNULIB_STRVERSCMP''@||g' \ | ||
| 967 | < ./string.in.h | \ | ||
| 968 | sed -e 's|@''HAVE_MBSLEN''@||g' \ | ||
| 969 | -e 's|@''HAVE_MEMCHR''@||g' \ | ||
| 970 | -e 's|@''HAVE_DECL_MEMMEM''@||g' \ | ||
| 971 | -e 's|@''HAVE_MEMPCPY''@||g' \ | ||
| 972 | -e 's|@''HAVE_DECL_MEMRCHR''@||g' \ | ||
| 973 | -e 's|@''HAVE_RAWMEMCHR''@||g' \ | ||
| 974 | -e 's|@''HAVE_STPCPY''@||g' \ | ||
| 975 | -e 's|@''HAVE_STPNCPY''@||g' \ | ||
| 976 | -e 's|@''HAVE_STRCHRNUL''@||g' \ | ||
| 977 | -e 's|@''HAVE_DECL_STRDUP''@||g' \ | ||
| 978 | -e 's|@''HAVE_DECL_STRNDUP''@||g' \ | ||
| 979 | -e 's|@''HAVE_DECL_STRNLEN''@||g' \ | ||
| 980 | -e 's|@''HAVE_STRPBRK''@||g' \ | ||
| 981 | -e 's|@''HAVE_STRSEP''@||g' \ | ||
| 982 | -e 's|@''HAVE_STRCASESTR''@||g' \ | ||
| 983 | -e 's|@''HAVE_DECL_STRTOK_R''@||g' \ | ||
| 984 | -e 's|@''HAVE_DECL_STRSIGNAL''@||g' \ | ||
| 985 | -e 's|@''HAVE_STRVERSCMP''@||g' \ | ||
| 986 | -e 's|@''REPLACE_STPNCPY''@||g' \ | ||
| 987 | -e 's|@''REPLACE_MEMCHR''@||g' \ | ||
| 988 | -e 's|@''REPLACE_MEMMEM''@||g' \ | ||
| 989 | -e 's|@''REPLACE_STRCASESTR''@||g' \ | ||
| 990 | -e 's|@''REPLACE_STRDUP''@||g' \ | ||
| 991 | -e 's|@''REPLACE_STRSTR''@||g' \ | ||
| 992 | -e 's|@''REPLACE_STRERROR''@||g' \ | ||
| 993 | -e 's|@''REPLACE_STRNCAT''@||g' \ | ||
| 994 | -e 's|@''REPLACE_STRNDUP''@||g' \ | ||
| 995 | -e 's|@''REPLACE_STRNLEN''@||g' \ | ||
| 996 | -e 's|@''REPLACE_STRSIGNAL''@||g' \ | ||
| 997 | -e 's|@''REPLACE_STRTOK_R''@||g' \ | ||
| 998 | -e 's|@''UNDEFINE_STRTOK_R''@||g' \ | ||
| 999 | -e '/definitions of _GL_FUNCDECL_RPL/r c++defs.h' \ | ||
| 1000 | -e '/definition of _GL_ARG_NONNULL/r arg-nonnull.h' \ | ||
| 1001 | -e '/definition of _GL_WARN_ON_USE/r warn-on-use.h'; \ | ||
| 1002 | < ./string.in.h; \ | ||
| 1003 | } > string.h-t && \ | ||
| 1004 | mv string.h-t string.h | ||
| 1005 | /bin/mkdir -p sys | ||
| 1006 | rm -f sys/socket.h-t sys/socket.h && \ | ||
| 1007 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 1008 | sed -e 's|@''INCLUDE_NEXT''@||g' \ | ||
| 1009 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 1010 | -e 's|@''NEXT_SYS_SOCKET_H''@||g' \ | ||
| 1011 | -e 's|@''HAVE_SYS_SOCKET_H''@||g' \ | ||
| 1012 | -e 's|@''GNULIB_CLOSE''@||g' \ | ||
| 1013 | -e 's|@''GNULIB_SOCKET''@||g' \ | ||
| 1014 | -e 's|@''GNULIB_CONNECT''@||g' \ | ||
| 1015 | -e 's|@''GNULIB_ACCEPT''@||g' \ | ||
| 1016 | -e 's|@''GNULIB_BIND''@||g' \ | ||
| 1017 | -e 's|@''GNULIB_GETPEERNAME''@||g' \ | ||
| 1018 | -e 's|@''GNULIB_GETSOCKNAME''@||g' \ | ||
| 1019 | -e 's|@''GNULIB_GETSOCKOPT''@||g' \ | ||
| 1020 | -e 's|@''GNULIB_LISTEN''@||g' \ | ||
| 1021 | -e 's|@''GNULIB_RECV''@||g' \ | ||
| 1022 | -e 's|@''GNULIB_SEND''@||g' \ | ||
| 1023 | -e 's|@''GNULIB_RECVFROM''@||g' \ | ||
| 1024 | -e 's|@''GNULIB_SENDTO''@||g' \ | ||
| 1025 | -e 's|@''GNULIB_SETSOCKOPT''@||g' \ | ||
| 1026 | -e 's|@''GNULIB_SHUTDOWN''@||g' \ | ||
| 1027 | -e 's|@''GNULIB_ACCEPT4''@||g' \ | ||
| 1028 | -e 's|@''HAVE_WINSOCK2_H''@||g' \ | ||
| 1029 | -e 's|@''HAVE_WS2TCPIP_H''@||g' \ | ||
| 1030 | -e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE''@||g' \ | ||
| 1031 | -e 's|@''HAVE_SA_FAMILY_T''@||g' \ | ||
| 1032 | -e 's|@''HAVE_ACCEPT4''@||g' \ | ||
| 1033 | -e '/definitions of _GL_FUNCDECL_RPL/r c++defs.h' \ | ||
| 1034 | -e '/definition of _GL_ARG_NONNULL/r arg-nonnull.h' \ | ||
| 1035 | -e '/definition of _GL_WARN_ON_USE/r warn-on-use.h' \ | ||
| 1036 | < ./sys_socket.in.h; \ | ||
| 1037 | } > sys/socket.h-t && \ | ||
| 1038 | mv -f sys/socket.h-t sys/socket.h | ||
| 1039 | /bin/mkdir -p sys | ||
| 1040 | rm -f sys/stat.h-t sys/stat.h && \ | ||
| 1041 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 1042 | sed -e 's|@''INCLUDE_NEXT''@||g' \ | ||
| 1043 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 1044 | -e 's|@''NEXT_SYS_STAT_H''@||g' \ | ||
| 1045 | -e 's|@''GNULIB_FCHMODAT''@||g' \ | ||
| 1046 | -e 's|@''GNULIB_FSTATAT''@||g' \ | ||
| 1047 | -e 's|@''GNULIB_FUTIMENS''@||g' \ | ||
| 1048 | -e 's|@''GNULIB_LCHMOD''@||g' \ | ||
| 1049 | -e 's|@''GNULIB_LSTAT''@||g' \ | ||
| 1050 | -e 's|@''GNULIB_MKDIRAT''@||g' \ | ||
| 1051 | -e 's|@''GNULIB_MKFIFO''@||g' \ | ||
| 1052 | -e 's|@''GNULIB_MKFIFOAT''@||g' \ | ||
| 1053 | -e 's|@''GNULIB_MKNOD''@||g' \ | ||
| 1054 | -e 's|@''GNULIB_MKNODAT''@||g' \ | ||
| 1055 | -e 's|@''GNULIB_STAT''@||g' \ | ||
| 1056 | -e 's|@''GNULIB_UTIMENSAT''@||g' \ | ||
| 1057 | -e 's|@''HAVE_FCHMODAT''@||g' \ | ||
| 1058 | -e 's|@''HAVE_FSTATAT''@||g' \ | ||
| 1059 | -e 's|@''HAVE_FUTIMENS''@||g' \ | ||
| 1060 | -e 's|@''HAVE_LCHMOD''@||g' \ | ||
| 1061 | -e 's|@''HAVE_LSTAT''@||g' \ | ||
| 1062 | -e 's|@''HAVE_MKDIRAT''@||g' \ | ||
| 1063 | -e 's|@''HAVE_MKFIFO''@||g' \ | ||
| 1064 | -e 's|@''HAVE_MKFIFOAT''@||g' \ | ||
| 1065 | -e 's|@''HAVE_MKNOD''@||g' \ | ||
| 1066 | -e 's|@''HAVE_MKNODAT''@||g' \ | ||
| 1067 | -e 's|@''HAVE_UTIMENSAT''@||g' \ | ||
| 1068 | -e 's|@''REPLACE_FSTAT''@||g' \ | ||
| 1069 | -e 's|@''REPLACE_FSTATAT''@||g' \ | ||
| 1070 | -e 's|@''REPLACE_FUTIMENS''@||g' \ | ||
| 1071 | -e 's|@''REPLACE_LSTAT''@||g' \ | ||
| 1072 | -e 's|@''REPLACE_MKDIR''@||g' \ | ||
| 1073 | -e 's|@''REPLACE_MKFIFO''@||g' \ | ||
| 1074 | -e 's|@''REPLACE_MKNOD''@||g' \ | ||
| 1075 | -e 's|@''REPLACE_STAT''@||g' \ | ||
| 1076 | -e 's|@''REPLACE_UTIMENSAT''@||g' \ | ||
| 1077 | -e '/definitions of _GL_FUNCDECL_RPL/r c++defs.h' \ | ||
| 1078 | -e '/definition of _GL_ARG_NONNULL/r arg-nonnull.h' \ | ||
| 1079 | -e '/definition of _GL_WARN_ON_USE/r warn-on-use.h' \ | ||
| 1080 | < ./sys_stat.in.h; \ | ||
| 1081 | } > sys/stat.h-t && \ | ||
| 1082 | mv sys/stat.h-t sys/stat.h | ||
| 1083 | rm -f time.h-t time.h && \ | ||
| 1084 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ | ||
| 1085 | sed -e 's|@''INCLUDE_NEXT''@||g' \ | ||
| 1086 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 1087 | -e 's|@''NEXT_TIME_H''@||g' \ | ||
| 1088 | -e 's|@''GNULIB_MKTIME''@||g' \ | ||
| 1089 | -e 's|@''GNULIB_NANOSLEEP''@||g' \ | ||
| 1090 | -e 's|@''GNULIB_STRPTIME''@||g' \ | ||
| 1091 | -e 's|@''GNULIB_TIMEGM''@||g' \ | ||
| 1092 | -e 's|@''GNULIB_TIME_R''@||g' \ | ||
| 1093 | -e 's|@''HAVE_LOCALTIME_R''@||g' \ | ||
| 1094 | -e 's|@''HAVE_NANOSLEEP''@||g' \ | ||
| 1095 | -e 's|@''HAVE_STRPTIME''@||g' \ | ||
| 1096 | -e 's|@''HAVE_TIMEGM''@||g' \ | ||
| 1097 | -e 's|@''REPLACE_LOCALTIME_R''@||g' \ | ||
| 1098 | -e 's|@''REPLACE_MKTIME''@||g' \ | ||
| 1099 | -e 's|@''REPLACE_NANOSLEEP''@||g' \ | ||
| 1100 | -e 's|@''REPLACE_TIMEGM''@||g' \ | ||
| 1101 | -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@||g' \ | ||
| 1102 | -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@||g' \ | ||
| 1103 | -e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@||g' \ | ||
| 1104 | -e '/definitions of _GL_FUNCDECL_RPL/r c++defs.h' \ | ||
| 1105 | -e '/definition of _GL_ARG_NONNULL/r arg-nonnull.h' \ | ||
| 1106 | -e '/definition of _GL_WARN_ON_USE/r warn-on-use.h' \ | ||
| 1107 | < ./time.in.h; \ | ||
| 1108 | } > time.h-t && \ | ||
| 1109 | mv time.h-t time.h | ||
| 1110 | rm -f unistd.h-t unistd.h && \ | ||
| 1111 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 1112 | sed -e 's|@''HAVE_UNISTD_H''@||g' \ | ||
| 1113 | -e 's|@''INCLUDE_NEXT''@||g' \ | ||
| 1114 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 1115 | -e 's|@''NEXT_UNISTD_H''@||g' \ | ||
| 1116 | -e 's|@''GNULIB_CHOWN''@||g' \ | ||
| 1117 | -e 's|@''GNULIB_CLOSE''@||g' \ | ||
| 1118 | -e 's|@''GNULIB_DUP2''@||g' \ | ||
| 1119 | -e 's|@''GNULIB_DUP3''@||g' \ | ||
| 1120 | -e 's|@''GNULIB_ENVIRON''@||g' \ | ||
| 1121 | -e 's|@''GNULIB_EUIDACCESS''@||g' \ | ||
| 1122 | -e 's|@''GNULIB_FACCESSAT''@||g' \ | ||
| 1123 | -e 's|@''GNULIB_FCHDIR''@||g' \ | ||
| 1124 | -e 's|@''GNULIB_FCHOWNAT''@||g' \ | ||
| 1125 | -e 's|@''GNULIB_FSYNC''@||g' \ | ||
| 1126 | -e 's|@''GNULIB_FTRUNCATE''@||g' \ | ||
| 1127 | -e 's|@''GNULIB_GETCWD''@||g' \ | ||
| 1128 | -e 's|@''GNULIB_GETDOMAINNAME''@||g' \ | ||
| 1129 | -e 's|@''GNULIB_GETDTABLESIZE''@||g' \ | ||
| 1130 | -e 's|@''GNULIB_GETGROUPS''@||g' \ | ||
| 1131 | -e 's|@''GNULIB_GETHOSTNAME''@||g' \ | ||
| 1132 | -e 's|@''GNULIB_GETLOGIN''@||g' \ | ||
| 1133 | -e 's|@''GNULIB_GETLOGIN_R''@||g' \ | ||
| 1134 | -e 's|@''GNULIB_GETPAGESIZE''@||g' \ | ||
| 1135 | -e 's|@''GNULIB_GETUSERSHELL''@||g' \ | ||
| 1136 | -e 's|@''GNULIB_LCHOWN''@||g' \ | ||
| 1137 | -e 's|@''GNULIB_LINK''@||g' \ | ||
| 1138 | -e 's|@''GNULIB_LINKAT''@||g' \ | ||
| 1139 | -e 's|@''GNULIB_LSEEK''@||g' \ | ||
| 1140 | -e 's|@''GNULIB_PIPE2''@||g' \ | ||
| 1141 | -e 's|@''GNULIB_PREAD''@||g' \ | ||
| 1142 | -e 's|@''GNULIB_PWRITE''@||g' \ | ||
| 1143 | -e 's|@''GNULIB_READLINK''@||g' \ | ||
| 1144 | -e 's|@''GNULIB_READLINKAT''@||g' \ | ||
| 1145 | -e 's|@''GNULIB_RMDIR''@||g' \ | ||
| 1146 | -e 's|@''GNULIB_SLEEP''@||g' \ | ||
| 1147 | -e 's|@''GNULIB_SYMLINK''@||g' \ | ||
| 1148 | -e 's|@''GNULIB_SYMLINKAT''@||g' \ | ||
| 1149 | -e 's|@''GNULIB_TTYNAME_R''@||g' \ | ||
| 1150 | -e 's|@''GNULIB_UNISTD_H_GETOPT''@||g' \ | ||
| 1151 | -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@||g' \ | ||
| 1152 | -e 's|@''GNULIB_UNLINK''@||g' \ | ||
| 1153 | -e 's|@''GNULIB_UNLINKAT''@||g' \ | ||
| 1154 | -e 's|@''GNULIB_USLEEP''@||g' \ | ||
| 1155 | -e 's|@''GNULIB_WRITE''@||g' \ | ||
| 1156 | < ./unistd.in.h | \ | ||
| 1157 | sed -e 's|@''HAVE_CHOWN''@||g' \ | ||
| 1158 | -e 's|@''HAVE_DUP2''@||g' \ | ||
| 1159 | -e 's|@''HAVE_DUP3''@||g' \ | ||
| 1160 | -e 's|@''HAVE_EUIDACCESS''@||g' \ | ||
| 1161 | -e 's|@''HAVE_FACCESSAT''@||g' \ | ||
| 1162 | -e 's|@''HAVE_FCHDIR''@||g' \ | ||
| 1163 | -e 's|@''HAVE_FCHOWNAT''@||g' \ | ||
| 1164 | -e 's|@''HAVE_FSYNC''@||g' \ | ||
| 1165 | -e 's|@''HAVE_FTRUNCATE''@||g' \ | ||
| 1166 | -e 's|@''HAVE_GETDOMAINNAME''@||g' \ | ||
| 1167 | -e 's|@''HAVE_GETDTABLESIZE''@||g' \ | ||
| 1168 | -e 's|@''HAVE_GETGROUPS''@||g' \ | ||
| 1169 | -e 's|@''HAVE_GETHOSTNAME''@||g' \ | ||
| 1170 | -e 's|@''HAVE_GETLOGIN''@||g' \ | ||
| 1171 | -e 's|@''HAVE_GETPAGESIZE''@||g' \ | ||
| 1172 | -e 's|@''HAVE_LCHOWN''@||g' \ | ||
| 1173 | -e 's|@''HAVE_LINK''@||g' \ | ||
| 1174 | -e 's|@''HAVE_LINKAT''@||g' \ | ||
| 1175 | -e 's|@''HAVE_PIPE2''@||g' \ | ||
| 1176 | -e 's|@''HAVE_PREAD''@||g' \ | ||
| 1177 | -e 's|@''HAVE_PWRITE''@||g' \ | ||
| 1178 | -e 's|@''HAVE_READLINK''@||g' \ | ||
| 1179 | -e 's|@''HAVE_READLINKAT''@||g' \ | ||
| 1180 | -e 's|@''HAVE_SLEEP''@||g' \ | ||
| 1181 | -e 's|@''HAVE_SYMLINK''@||g' \ | ||
| 1182 | -e 's|@''HAVE_SYMLINKAT''@||g' \ | ||
| 1183 | -e 's|@''HAVE_TTYNAME_R''@||g' \ | ||
| 1184 | -e 's|@''HAVE_UNLINKAT''@||g' \ | ||
| 1185 | -e 's|@''HAVE_USLEEP''@||g' \ | ||
| 1186 | -e 's|@''HAVE_DECL_ENVIRON''@||g' \ | ||
| 1187 | -e 's|@''HAVE_DECL_GETLOGIN_R''@||g' \ | ||
| 1188 | -e 's|@''HAVE_DECL_GETPAGESIZE''@||g' \ | ||
| 1189 | -e 's|@''HAVE_DECL_GETUSERSHELL''@||g' \ | ||
| 1190 | -e 's|@''HAVE_OS_H''@||g' \ | ||
| 1191 | -e 's|@''HAVE_SYS_PARAM_H''@||g' \ | ||
| 1192 | -e 's|@''REPLACE_CHOWN''@||g' \ | ||
| 1193 | -e 's|@''REPLACE_CLOSE''@||g' \ | ||
| 1194 | -e 's|@''REPLACE_DUP''@||g' \ | ||
| 1195 | -e 's|@''REPLACE_DUP2''@||g' \ | ||
| 1196 | -e 's|@''REPLACE_FCHOWNAT''@||g' \ | ||
| 1197 | -e 's|@''REPLACE_GETCWD''@||g' \ | ||
| 1198 | -e 's|@''REPLACE_GETGROUPS''@||g' \ | ||
| 1199 | -e 's|@''REPLACE_GETPAGESIZE''@||g' \ | ||
| 1200 | -e 's|@''REPLACE_LCHOWN''@||g' \ | ||
| 1201 | -e 's|@''REPLACE_LINK''@||g' \ | ||
| 1202 | -e 's|@''REPLACE_LINKAT''@||g' \ | ||
| 1203 | -e 's|@''REPLACE_LSEEK''@||g' \ | ||
| 1204 | -e 's|@''REPLACE_PREAD''@||g' \ | ||
| 1205 | -e 's|@''REPLACE_PWRITE''@||g' \ | ||
| 1206 | -e 's|@''REPLACE_READLINK''@||g' \ | ||
| 1207 | -e 's|@''REPLACE_RMDIR''@||g' \ | ||
| 1208 | -e 's|@''REPLACE_SLEEP''@||g' \ | ||
| 1209 | -e 's|@''REPLACE_SYMLINK''@||g' \ | ||
| 1210 | -e 's|@''REPLACE_TTYNAME_R''@||g' \ | ||
| 1211 | -e 's|@''REPLACE_UNLINK''@||g' \ | ||
| 1212 | -e 's|@''REPLACE_UNLINKAT''@||g' \ | ||
| 1213 | -e 's|@''REPLACE_USLEEP''@||g' \ | ||
| 1214 | -e 's|@''REPLACE_WRITE''@||g' \ | ||
| 1215 | -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@||g' \ | ||
| 1216 | -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@||g' \ | ||
| 1217 | -e '/definitions of _GL_FUNCDECL_RPL/r c++defs.h' \ | ||
| 1218 | -e '/definition of _GL_ARG_NONNULL/r arg-nonnull.h' \ | ||
| 1219 | -e '/definition of _GL_WARN_ON_USE/r warn-on-use.h'; \ | ||
| 1220 | } > unistd.h-t && \ | ||
| 1221 | mv unistd.h-t unistd.h | ||
| 1222 | rm -f wchar.h-t wchar.h && \ | ||
| 1223 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 1224 | sed -e 's|@''INCLUDE_NEXT''@||g' \ | ||
| 1225 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 1226 | -e 's|@''NEXT_WCHAR_H''@||g' \ | ||
| 1227 | -e 's|@''HAVE_WCHAR_H''@||g' \ | ||
| 1228 | -e 's|@''GNULIB_BTOWC''@||g' \ | ||
| 1229 | -e 's|@''GNULIB_WCTOB''@||g' \ | ||
| 1230 | -e 's|@''GNULIB_MBSINIT''@||g' \ | ||
| 1231 | -e 's|@''GNULIB_MBRTOWC''@||g' \ | ||
| 1232 | -e 's|@''GNULIB_MBRLEN''@||g' \ | ||
| 1233 | -e 's|@''GNULIB_MBSRTOWCS''@||g' \ | ||
| 1234 | -e 's|@''GNULIB_MBSNRTOWCS''@||g' \ | ||
| 1235 | -e 's|@''GNULIB_WCRTOMB''@||g' \ | ||
| 1236 | -e 's|@''GNULIB_WCSRTOMBS''@||g' \ | ||
| 1237 | -e 's|@''GNULIB_WCSNRTOMBS''@||g' \ | ||
| 1238 | -e 's|@''GNULIB_WCWIDTH''@||g' \ | ||
| 1239 | -e 's|@''HAVE_WINT_T''@||g' \ | ||
| 1240 | -e 's|@''HAVE_BTOWC''@||g' \ | ||
| 1241 | -e 's|@''HAVE_MBSINIT''@||g' \ | ||
| 1242 | -e 's|@''HAVE_MBRTOWC''@||g' \ | ||
| 1243 | -e 's|@''HAVE_MBRLEN''@||g' \ | ||
| 1244 | -e 's|@''HAVE_MBSRTOWCS''@||g' \ | ||
| 1245 | -e 's|@''HAVE_MBSNRTOWCS''@||g' \ | ||
| 1246 | -e 's|@''HAVE_WCRTOMB''@||g' \ | ||
| 1247 | -e 's|@''HAVE_WCSRTOMBS''@||g' \ | ||
| 1248 | -e 's|@''HAVE_WCSNRTOMBS''@||g' \ | ||
| 1249 | -e 's|@''HAVE_DECL_WCTOB''@||g' \ | ||
| 1250 | -e 's|@''HAVE_DECL_WCWIDTH''@||g' \ | ||
| 1251 | -e 's|@''REPLACE_MBSTATE_T''@||g' \ | ||
| 1252 | -e 's|@''REPLACE_BTOWC''@||g' \ | ||
| 1253 | -e 's|@''REPLACE_WCTOB''@||g' \ | ||
| 1254 | -e 's|@''REPLACE_MBSINIT''@||g' \ | ||
| 1255 | -e 's|@''REPLACE_MBRTOWC''@||g' \ | ||
| 1256 | -e 's|@''REPLACE_MBRLEN''@||g' \ | ||
| 1257 | -e 's|@''REPLACE_MBSRTOWCS''@||g' \ | ||
| 1258 | -e 's|@''REPLACE_MBSNRTOWCS''@||g' \ | ||
| 1259 | -e 's|@''REPLACE_WCRTOMB''@||g' \ | ||
| 1260 | -e 's|@''REPLACE_WCSRTOMBS''@||g' \ | ||
| 1261 | -e 's|@''REPLACE_WCSNRTOMBS''@||g' \ | ||
| 1262 | -e 's|@''REPLACE_WCWIDTH''@||g' \ | ||
| 1263 | -e '/definitions of _GL_FUNCDECL_RPL/r c++defs.h' \ | ||
| 1264 | -e '/definition of _GL_ARG_NONNULL/r arg-nonnull.h' \ | ||
| 1265 | -e '/definition of _GL_WARN_ON_USE/r warn-on-use.h' \ | ||
| 1266 | < ./wchar.in.h; \ | ||
| 1267 | } > wchar.h-t && \ | ||
| 1268 | mv wchar.h-t wchar.h | ||
| 1269 | rm -f wctype.h-t wctype.h && \ | ||
| 1270 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 1271 | sed -e 's/@''HAVE_WCTYPE_H''@//g' \ | ||
| 1272 | -e 's|@''INCLUDE_NEXT''@||g' \ | ||
| 1273 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 1274 | -e 's|@''NEXT_WCTYPE_H''@||g' \ | ||
| 1275 | -e 's/@''HAVE_ISWBLANK''@//g' \ | ||
| 1276 | -e 's/@''HAVE_ISWCNTRL''@//g' \ | ||
| 1277 | -e 's/@''HAVE_WINT_T''@//g' \ | ||
| 1278 | -e 's/@''REPLACE_ISWCNTRL''@//g' \ | ||
| 1279 | -e '/definitions of _GL_FUNCDECL_RPL/r c++defs.h' \ | ||
| 1280 | -e '/definition of _GL_WARN_ON_USE/r warn-on-use.h' \ | ||
| 1281 | < ./wctype.in.h; \ | ||
| 1282 | } > wctype.h-t && \ | ||
| 1283 | mv wctype.h-t wctype.h | ||
| 1284 | make all-recursive | ||
| 1285 | make[3]: Entering directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 1286 | make[4]: Entering directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 1287 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -g -O2 -MT base64.o -MD -MP -MF .deps/base64.Tpo -c -o base64.o base64.c | ||
| 1288 | In file included from base64.c:47:0: | ||
| 1289 | base64.h:40:49: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’ | ||
| 1290 | base64.h:48:53: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’ | ||
| 1291 | In file included from base64.c:50:0: | ||
| 1292 | ./stdlib.h:20:1: error: stray ‘@’ in program | ||
| 1293 | ./stdlib.h:20:1: error: stray ‘@’ in program | ||
| 1294 | In file included from base64.c:50:0: | ||
| 1295 | ./stdlib.h:43:7: error: operator '||' has no left operand | ||
| 1296 | ./stdlib.h:49:5: error: #if with no expression | ||
| 1297 | ./stdlib.h:53:7: error: operator '!' has no right operand | ||
| 1298 | ./stdlib.h:58:6: error: operator '!' has no right operand | ||
| 1299 | ./stdlib.h:71:7: error: operator '||' has no left operand | ||
| 1300 | In file included from base64.c:50:0: | ||
| 1301 | ./stdlib.h:410:5: error: #if with no expression | ||
| 1302 | ./stdlib.h:426:5: error: #if with no expression | ||
| 1303 | ./stdlib.h:445:5: error: #if with no expression | ||
| 1304 | ./stdlib.h:469:5: error: #if with no expression | ||
| 1305 | ./stdlib.h:488:5: error: #if with no expression | ||
| 1306 | ./stdlib.h:516:5: error: #if with no expression | ||
| 1307 | ./stdlib.h:532:5: error: #if with no expression | ||
| 1308 | ./stdlib.h:551:5: error: #if with no expression | ||
| 1309 | ./stdlib.h:570:5: error: #if with no expression | ||
| 1310 | ./stdlib.h:597:5: error: #if with no expression | ||
| 1311 | ./stdlib.h:627:5: error: #if with no expression | ||
| 1312 | ./stdlib.h:658:5: error: #if with no expression | ||
| 1313 | ./stdlib.h:683:5: error: #if with no expression | ||
| 1314 | ./stdlib.h:699:5: error: #if with no expression | ||
| 1315 | ./stdlib.h:714:5: error: #if with no expression | ||
| 1316 | ./stdlib.h:722:5: error: #if with no expression | ||
| 1317 | ./stdlib.h:737:5: error: #if with no expression | ||
| 1318 | ./stdlib.h:754:5: error: #if with no expression | ||
| 1319 | ./stdlib.h:773:5: error: #if with no expression | ||
| 1320 | ./stdlib.h:791:5: error: #if with no expression | ||
| 1321 | ./stdlib.h:810:5: error: #if with no expression | ||
| 1322 | ./stdlib.h:834:5: error: #if with no expression | ||
| 1323 | ./stdlib.h:850:5: error: #if with no expression | ||
| 1324 | ./stdlib.h:881:5: error: #if with no expression | ||
| 1325 | ./stdlib.h:906:5: error: #if with no expression | ||
| 1326 | ./stdlib.h:931:5: error: #if with no expression | ||
| 1327 | ./stdlib.h:956:5: error: #if with no expression | ||
| 1328 | ./stdlib.h:972:5: error: #if with no expression | ||
| 1329 | In file included from base64.c:55:0: | ||
| 1330 | ./string.h:23:1: error: stray ‘@’ in program | ||
| 1331 | In file included from base64.c:50:0: | ||
| 1332 | ./stdlib.h:20:2: error: unknown type name ‘PRAGMA_SYSTEM_HEADER’ | ||
| 1333 | In file included from base64.c:55:0: | ||
| 1334 | ./string.h:23:1: error: stray ‘@’ in program | ||
| 1335 | In file included from base64.c:55:0: | ||
| 1336 | ./string.h:36:6: error: operator '&&' has no left operand | ||
| 1337 | ./string.h:371:5: error: #if with no expression | ||
| 1338 | ./string.h:409:5: error: #if with no expression | ||
| 1339 | ./string.h:444:5: error: #if with no expression | ||
| 1340 | ./string.h:464:5: error: #if with no expression | ||
| 1341 | ./string.h:494:5: error: #if with no expression | ||
| 1342 | ./string.h:522:5: error: #if with no expression | ||
| 1343 | ./string.h:541:5: error: #if with no expression | ||
| 1344 | ./string.h:584:5: error: #if with no expression | ||
| 1345 | ./string.h:612:5: error: #if with no expression | ||
| 1346 | ./string.h:636:5: error: #if with no expression | ||
| 1347 | ./string.h:658:5: error: #if with no expression | ||
| 1348 | ./string.h:686:5: error: #if with no expression | ||
| 1349 | ./string.h:726:5: error: #if with no expression | ||
| 1350 | ./string.h:800:5: error: #if with no expression | ||
| 1351 | ./string.h:823:5: error: #if with no expression | ||
| 1352 | ./string.h:864:5: error: #if with no expression | ||
| 1353 | ./string.h:931:5: error: #if with no expression | ||
| 1354 | ./string.h:976:5: error: #if with no expression | ||
| 1355 | ./string.h:995:5: error: #if with no expression | ||
| 1356 | ./string.h:1002:5: error: #if with no expression | ||
| 1357 | ./string.h:1022:5: error: #if with no expression | ||
| 1358 | ./string.h:1042:5: error: #if with no expression | ||
| 1359 | ./string.h:1051:5: error: #if with no expression | ||
| 1360 | ./string.h:1062:5: error: #if with no expression | ||
| 1361 | ./string.h:1076:5: error: #if with no expression | ||
| 1362 | ./string.h:1090:5: error: #if with no expression | ||
| 1363 | ./string.h:1100:5: error: #if with no expression | ||
| 1364 | ./string.h:1110:5: error: #if with no expression | ||
| 1365 | ./string.h:1130:5: error: #if with no expression | ||
| 1366 | ./string.h:1140:5: error: #if with no expression | ||
| 1367 | ./string.h:1159:5: error: #if with no expression | ||
| 1368 | ./string.h:1181:5: error: #if with no expression | ||
| 1369 | ./string.h:1200:5: error: #if with no expression | ||
| 1370 | ./string.h:1224:5: error: #if with no expression | ||
| 1371 | base64.c:58:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘static’ | ||
| 1372 | base64.c:69:37: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’ | ||
| 1373 | base64.c: In function ‘base64_encode_alloc’: | ||
| 1374 | base64.c:138:10: warning: incompatible implicit declaration of built-in function ‘malloc’ [enabled by default] | ||
| 1375 | base64.c: At top level: | ||
| 1376 | base64.c:321:29: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token | ||
| 1377 | base64.c:374:32: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’ | ||
| 1378 | base64.c:460:41: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’ | ||
| 1379 | base64.c: In function ‘base64_decode_alloc_ctx’: | ||
| 1380 | base64.c:561:10: warning: incompatible implicit declaration of built-in function ‘malloc’ [enabled by default] | ||
| 1381 | base64.c:567:7: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default] | ||
| 1382 | make[4]: *** [base64.o] Error 1 | ||
| 1383 | make[4]: Leaving directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 1384 | make[3]: *** [all-recursive] Error 1 | ||
| 1385 | make[3]: Leaving directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 1386 | make[2]: *** [all] Error 2 | ||
| 1387 | make[2]: Leaving directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 1388 | make[1]: *** [all-recursive] Error 1 | ||
| 1389 | make[1]: Leaving directory `/home/bryan/tmp/nagiosplug' | ||
| 1390 | make: *** [all] Error 2 | ||
| 1391 | dataloader% | ||
| 1392 | dataloader% | ||
| 1393 | dataloader% ./configure | ||
| 1394 | checking for a BSD-compatible install... /usr/bin/install -c | ||
| 1395 | checking whether build environment is sane... yes | ||
| 1396 | checking for a thread-safe mkdir -p... /bin/mkdir -p | ||
| 1397 | checking for gawk... gawk | ||
| 1398 | checking whether make sets $(MAKE)... yes | ||
| 1399 | checking build system type... x86_64-unknown-linux-gnu | ||
| 1400 | checking host system type... x86_64-unknown-linux-gnu | ||
| 1401 | checking for gcc... gcc | ||
| 1402 | checking whether the C compiler works... yes | ||
| 1403 | checking for C compiler default output file name... a.out | ||
| 1404 | checking for suffix of executables... | ||
| 1405 | checking whether we are cross compiling... no | ||
| 1406 | checking for suffix of object files... o | ||
| 1407 | checking whether we are using the GNU C compiler... yes | ||
| 1408 | checking whether gcc accepts -g... yes | ||
| 1409 | checking for gcc option to accept ISO C89... none needed | ||
| 1410 | checking for style of include used by make... GNU | ||
| 1411 | checking dependency style of gcc... gcc3 | ||
| 1412 | ./configure: line 4100: gl_EARLY: command not found | ||
| 1413 | checking how to run the C preprocessor... gcc -E | ||
| 1414 | checking for grep that handles long lines and -e... /bin/grep | ||
| 1415 | checking for egrep... /bin/grep -E | ||
| 1416 | checking whether gcc needs -traditional... no | ||
| 1417 | checking how to print strings... printf | ||
| 1418 | checking for a sed that does not truncate output... /bin/sed | ||
| 1419 | checking for fgrep... /bin/grep -F | ||
| 1420 | checking for ld used by gcc... /usr/bin/ld | ||
| 1421 | checking if the linker (/usr/bin/ld) is GNU ld... yes | ||
| 1422 | checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B | ||
| 1423 | checking the name lister (/usr/bin/nm -B) interface... BSD nm | ||
| 1424 | checking whether ln -s works... yes | ||
| 1425 | checking the maximum length of command line arguments... 1572864 | ||
| 1426 | checking whether the shell understands some XSI constructs... yes | ||
| 1427 | checking whether the shell understands "+="... yes | ||
| 1428 | checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop | ||
| 1429 | checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop | ||
| 1430 | checking for /usr/bin/ld option to reload object files... -r | ||
| 1431 | checking for objdump... objdump | ||
| 1432 | checking how to recognize dependent libraries... pass_all | ||
| 1433 | checking for dlltool... no | ||
| 1434 | checking how to associate runtime and link libraries... printf %s\n | ||
| 1435 | checking for ar... ar | ||
| 1436 | checking for archiver @FILE support... @ | ||
| 1437 | checking for strip... strip | ||
| 1438 | checking for ranlib... ranlib | ||
| 1439 | checking command to parse /usr/bin/nm -B output from gcc object... ok | ||
| 1440 | checking for sysroot... no | ||
| 1441 | checking for mt... mt | ||
| 1442 | checking if mt is a manifest tool... no | ||
| 1443 | checking for ANSI C header files... yes | ||
| 1444 | checking for sys/types.h... yes | ||
| 1445 | checking for sys/stat.h... yes | ||
| 1446 | checking for stdlib.h... yes | ||
| 1447 | checking for string.h... yes | ||
| 1448 | checking for memory.h... yes | ||
| 1449 | checking for strings.h... yes | ||
| 1450 | checking for inttypes.h... yes | ||
| 1451 | checking for stdint.h... yes | ||
| 1452 | checking for unistd.h... yes | ||
| 1453 | checking for dlfcn.h... yes | ||
| 1454 | checking for objdir... .libs | ||
| 1455 | checking if gcc supports -fno-rtti -fno-exceptions... no | ||
| 1456 | checking for gcc option to produce PIC... -fPIC -DPIC | ||
| 1457 | checking if gcc PIC flag -fPIC -DPIC works... yes | ||
| 1458 | checking if gcc static flag -static works... yes | ||
| 1459 | checking if gcc supports -c -o file.o... yes | ||
| 1460 | checking if gcc supports -c -o file.o... (cached) yes | ||
| 1461 | checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes | ||
| 1462 | checking whether -lc should be explicitly linked in... no | ||
| 1463 | checking dynamic linker characteristics... GNU/Linux ld.so | ||
| 1464 | checking how to hardcode library paths into programs... immediate | ||
| 1465 | checking whether stripping libraries is possible... yes | ||
| 1466 | checking if libtool supports shared libraries... yes | ||
| 1467 | checking whether to build shared libraries... yes | ||
| 1468 | checking whether to build static libraries... yes | ||
| 1469 | checking whether gcc and cc understand -c and -o together... yes | ||
| 1470 | checking for error_at_line... yes | ||
| 1471 | checking for special C compiler options needed for large files... no | ||
| 1472 | checking for _FILE_OFFSET_BITS value needed for large files... no | ||
| 1473 | checking for working strtod... yes | ||
| 1474 | checking for python... /usr/bin/python | ||
| 1475 | checking for sh... /bin/sh | ||
| 1476 | checking for perl... /usr/bin/perl | ||
| 1477 | checking for libgnutls-config... no | ||
| 1478 | checking for hostname... /bin/hostname | ||
| 1479 | checking for basename... /usr/bin/basename | ||
| 1480 | checking for main in -ldce... no | ||
| 1481 | checking for main in -lnsl... yes | ||
| 1482 | checking for socket in -lsocket... no | ||
| 1483 | checking for main in -lresolv... yes | ||
| 1484 | checking math.h usability... yes | ||
| 1485 | checking math.h presence... yes | ||
| 1486 | checking for math.h... yes | ||
| 1487 | checking for floor in -lm... yes | ||
| 1488 | checking mp.h usability... no | ||
| 1489 | checking mp.h presence... no | ||
| 1490 | checking for mp.h... no | ||
| 1491 | checking for pow in -lbsd... no | ||
| 1492 | checking for plan_tests in -ltap... no | ||
| 1493 | checking for main in -lcrypt... yes | ||
| 1494 | checking for PQsetdbLogin in -lpq... no | ||
| 1495 | configure: WARNING: Skipping PostgreSQL plugin (check_pgsql) | ||
| 1496 | configure: WARNING: LIBS="-lcrypt " CPPFLAGS="" | ||
| 1497 | configure: WARNING: install PostgreSQL libs to compile this plugin (see REQUIREMENTS). | ||
| 1498 | checking for dbi_initialize in -ldbi... no | ||
| 1499 | configure: WARNING: Skipping dbi plugin | ||
| 1500 | configure: WARNING: install DBI libs to compile this plugin (see REQUIREMENTS). | ||
| 1501 | checking for rc_read_config in -lradiusclient... no | ||
| 1502 | checking for rc_read_config in -lradiusclient-ng... no | ||
| 1503 | configure: WARNING: Skipping radius plugin | ||
| 1504 | configure: WARNING: install radius libs to compile this plugin (see REQUIREMENTS). | ||
| 1505 | checking for main in -lldap... no | ||
| 1506 | configure: WARNING: Skipping LDAP plugin | ||
| 1507 | configure: WARNING: install LDAP libs to compile this plugin (see REQUIREMENTS). | ||
| 1508 | checking linux/hdreg.h usability... yes | ||
| 1509 | checking linux/hdreg.h presence... yes | ||
| 1510 | checking for linux/hdreg.h... yes | ||
| 1511 | checking linux/types.h usability... yes | ||
| 1512 | checking linux/types.h presence... yes | ||
| 1513 | checking for linux/types.h... yes | ||
| 1514 | ./configure: line 13278: np_mysqlclient: command not found | ||
| 1515 | ./configure: line 13279: test: =: unary operator expected | ||
| 1516 | checking for IPv6 support... yes | ||
| 1517 | checking krb5.h usability... no | ||
| 1518 | checking krb5.h presence... no | ||
| 1519 | checking for krb5.h... no | ||
| 1520 | checking krb5.h usability... no | ||
| 1521 | checking krb5.h presence... no | ||
| 1522 | checking for krb5.h... no | ||
| 1523 | checking for dlopen in -ldl... yes | ||
| 1524 | checking for shl_load in -ldl... no | ||
| 1525 | checking openssl/ssl.h usability... yes | ||
| 1526 | checking openssl/ssl.h presence... yes | ||
| 1527 | checking for openssl/ssl.h... yes | ||
| 1528 | checking openssl/x509.h usability... yes | ||
| 1529 | checking openssl/x509.h presence... yes | ||
| 1530 | checking for openssl/x509.h... yes | ||
| 1531 | checking openssl/rsa.h usability... yes | ||
| 1532 | checking openssl/rsa.h presence... yes | ||
| 1533 | checking for openssl/rsa.h... yes | ||
| 1534 | checking openssl/pem.h usability... yes | ||
| 1535 | checking openssl/pem.h presence... yes | ||
| 1536 | checking for openssl/pem.h... yes | ||
| 1537 | checking openssl/crypto.h usability... yes | ||
| 1538 | checking openssl/crypto.h presence... yes | ||
| 1539 | checking for openssl/crypto.h... yes | ||
| 1540 | checking openssl/err.h usability... yes | ||
| 1541 | checking openssl/err.h presence... yes | ||
| 1542 | checking for openssl/err.h... yes | ||
| 1543 | checking for CRYPTO_lock in -lcrypto... yes | ||
| 1544 | checking for main in -lssl... yes | ||
| 1545 | checking whether time.h and sys/time.h may both be included... yes | ||
| 1546 | checking for sys/wait.h that is POSIX.1 compatible... yes | ||
| 1547 | checking signal.h usability... yes | ||
| 1548 | checking signal.h presence... yes | ||
| 1549 | checking for signal.h... yes | ||
| 1550 | checking syslog.h usability... yes | ||
| 1551 | checking syslog.h presence... yes | ||
| 1552 | checking for syslog.h... yes | ||
| 1553 | checking uio.h usability... no | ||
| 1554 | checking uio.h presence... no | ||
| 1555 | checking for uio.h... no | ||
| 1556 | checking errno.h usability... yes | ||
| 1557 | checking errno.h presence... yes | ||
| 1558 | checking for errno.h... yes | ||
| 1559 | checking sys/time.h usability... yes | ||
| 1560 | checking sys/time.h presence... yes | ||
| 1561 | checking for sys/time.h... yes | ||
| 1562 | checking sys/socket.h usability... yes | ||
| 1563 | checking sys/socket.h presence... yes | ||
| 1564 | checking for sys/socket.h... yes | ||
| 1565 | checking sys/un.h usability... yes | ||
| 1566 | checking sys/un.h presence... yes | ||
| 1567 | checking for sys/un.h... yes | ||
| 1568 | checking sys/poll.h usability... yes | ||
| 1569 | checking sys/poll.h presence... yes | ||
| 1570 | checking for sys/poll.h... yes | ||
| 1571 | checking features.h usability... yes | ||
| 1572 | checking features.h presence... yes | ||
| 1573 | checking for features.h... yes | ||
| 1574 | checking stdarg.h usability... yes | ||
| 1575 | checking stdarg.h presence... yes | ||
| 1576 | checking for stdarg.h... yes | ||
| 1577 | checking sys/unistd.h usability... yes | ||
| 1578 | checking sys/unistd.h presence... yes | ||
| 1579 | checking for sys/unistd.h... yes | ||
| 1580 | checking ctype.h usability... yes | ||
| 1581 | checking ctype.h presence... yes | ||
| 1582 | checking for ctype.h... yes | ||
| 1583 | checking for an ANSI C-conforming const... yes | ||
| 1584 | checking whether struct tm is in sys/time.h or time.h... time.h | ||
| 1585 | checking for pid_t... yes | ||
| 1586 | checking for size_t... yes | ||
| 1587 | checking return type of signal handlers... void | ||
| 1588 | checking for va_copy... yes | ||
| 1589 | checking for memmove... yes | ||
| 1590 | checking for select... yes | ||
| 1591 | checking for socket... yes | ||
| 1592 | checking for strdup... yes | ||
| 1593 | checking for strstr... yes | ||
| 1594 | checking for strtol... yes | ||
| 1595 | checking for strtoul... yes | ||
| 1596 | checking for floor... no | ||
| 1597 | checking for poll... yes | ||
| 1598 | checking return type of socket size... int | ||
| 1599 | checking for ps... /bin/ps | ||
| 1600 | checking for ps syntax... /bin/ps axwo 'stat uid pid ppid vsz rss pcpu comm args' | ||
| 1601 | checking for ping... /bin/ping | ||
| 1602 | checking for ping6... /bin/ping6 | ||
| 1603 | checking for ICMP ping syntax... /bin/ping -n -U -w %d -c %d %s | ||
| 1604 | checking for ICMPv6 ping syntax... /bin/ping6 -n -U -w %d -c %d %s | ||
| 1605 | checking for nslookup... /usr/bin/nslookup | ||
| 1606 | checking for nslookup syntax... /usr/bin/nslookup -sil | ||
| 1607 | checking for number of cpus... sysconf(_SC_NPROCESSORS_CONF) | ||
| 1608 | checking for uptime... /usr/bin/uptime | ||
| 1609 | checking for rpcinfo... /usr/bin/rpcinfo | ||
| 1610 | checking for lmstat... no | ||
| 1611 | configure: WARNING: Get lmstat from Globetrotter Software to monitor flexlm licenses | ||
| 1612 | checking for smbclient... /usr/bin/smbclient | ||
| 1613 | checking for who... /usr/bin/who | ||
| 1614 | checking for snmpget... /usr/bin/snmpget | ||
| 1615 | checking for snmpgetnext... /usr/bin/snmpgetnext | ||
| 1616 | checking for Net::SNMP perl module... found | ||
| 1617 | checking for quakestat... /usr/bin/quakestat | ||
| 1618 | checking for qstat... no | ||
| 1619 | checking for fping... /usr/bin/fping | ||
| 1620 | checking for ssh... /usr/bin/ssh | ||
| 1621 | checking for mailq... /usr/bin/mailq | ||
| 1622 | checking for qmail-qstat... no | ||
| 1623 | configure: WARNING: Could not find qmail-qstat or eqivalent | ||
| 1624 | checking for swap... no | ||
| 1625 | checking for swapinfo... no | ||
| 1626 | checking for lsps... no | ||
| 1627 | checking for sys/stat.h... (cached) yes | ||
| 1628 | checking sys/param.h usability... yes | ||
| 1629 | checking sys/param.h presence... yes | ||
| 1630 | checking for sys/param.h... yes | ||
| 1631 | checking for sys/swap.h... yes | ||
| 1632 | checking whether swapctl is declared... no | ||
| 1633 | checking for swaptbl_t... no | ||
| 1634 | checking for swapent_t... no | ||
| 1635 | checking for struct swapent.se_nblks... no | ||
| 1636 | checking for /proc/meminfo... found /proc/meminfo | ||
| 1637 | checking for dig... /usr/bin/dig | ||
| 1638 | checking for apt-get... /usr/bin/apt-get | ||
| 1639 | checking sys/sockio.h usability... no | ||
| 1640 | checking sys/sockio.h presence... no | ||
| 1641 | checking for sys/sockio.h... no | ||
| 1642 | checking whether NLS is requested... yes | ||
| 1643 | checking for msgfmt... /usr/bin/msgfmt | ||
| 1644 | checking for gmsgfmt... /usr/bin/msgfmt | ||
| 1645 | checking for xgettext... /usr/bin/xgettext | ||
| 1646 | checking for msgmerge... /usr/bin/msgmerge | ||
| 1647 | checking for ld used by GCC... /usr/bin/ld -m elf_x86_64 | ||
| 1648 | checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes | ||
| 1649 | checking for shared library run path origin... done | ||
| 1650 | checking for CFPreferencesCopyAppValue... no | ||
| 1651 | checking for CFLocaleCopyCurrent... no | ||
| 1652 | checking for GNU gettext in libc... yes | ||
| 1653 | checking whether to use NLS... yes | ||
| 1654 | checking where the gettext function comes from... libc | ||
| 1655 | checking for main in -lpthread... yes | ||
| 1656 | ./configure: line 18615: gl_INIT: command not found | ||
| 1657 | configure: creating ./config.status | ||
| 1658 | config.status: creating gl/Makefile | ||
| 1659 | config.status: creating nagios-plugins.spec | ||
| 1660 | config.status: creating Makefile | ||
| 1661 | config.status: creating tap/Makefile | ||
| 1662 | config.status: creating lib/Makefile | ||
| 1663 | config.status: creating plugins/Makefile | ||
| 1664 | config.status: creating lib/tests/Makefile | ||
| 1665 | config.status: creating plugins-root/Makefile | ||
| 1666 | config.status: creating plugins-scripts/Makefile | ||
| 1667 | config.status: creating plugins-scripts/subst | ||
| 1668 | config.status: creating plugins-scripts/utils.pm | ||
| 1669 | config.status: creating plugins-scripts/utils.sh | ||
| 1670 | config.status: creating perlmods/Makefile | ||
| 1671 | config.status: creating command.cfg | ||
| 1672 | config.status: creating test.pl | ||
| 1673 | config.status: creating pkg/solaris/pkginfo | ||
| 1674 | config.status: creating po/Makefile.in | ||
| 1675 | config.status: creating config.h | ||
| 1676 | config.status: config.h is unchanged | ||
| 1677 | config.status: executing depfiles commands | ||
| 1678 | config.status: executing libtool commands | ||
| 1679 | config.status: executing po-directories commands | ||
| 1680 | config.status: creating po/POTFILES | ||
| 1681 | config.status: creating po/Makefile | ||
| 1682 | --with-apt-get-command: /usr/bin/apt-get | ||
| 1683 | --with-ping6-command: /bin/ping6 -n -U -w %d -c %d %s | ||
| 1684 | --with-ping-command: /bin/ping -n -U -w %d -c %d %s | ||
| 1685 | --with-ipv6: yes | ||
| 1686 | --with-mysql: | ||
| 1687 | --with-openssl: yes | ||
| 1688 | --with-gnutls: no | ||
| 1689 | --enable-extra-opts: no | ||
| 1690 | --with-perl: /usr/bin/perl | ||
| 1691 | --enable-perl-modules: no | ||
| 1692 | --with-cgiurl: /nagios/cgi-bin | ||
| 1693 | --with-trusted-path: /bin:/sbin:/usr/bin:/usr/sbin | ||
| 1694 | --enable-libtap: no | ||
| 1695 | dataloader% ./configure | ||
| 1696 | checking for a BSD-compatible install... /usr/bin/install -c | ||
| 1697 | checking whether build environment is sane... yes | ||
| 1698 | checking for a thread-safe mkdir -p... /bin/mkdir -p | ||
| 1699 | checking for gawk... gawk | ||
| 1700 | checking whether make sets $(MAKE)... yes | ||
| 1701 | checking build system type... x86_64-unknown-linux-gnu | ||
| 1702 | checking host system type... x86_64-unknown-linux-gnu | ||
| 1703 | checking for gcc... gcc | ||
| 1704 | checking whether the C compiler works... yes | ||
| 1705 | checking for C compiler default output file name... a.out | ||
| 1706 | checking for suffix of executables... | ||
| 1707 | checking whether we are cross compiling... no | ||
| 1708 | checking for suffix of object files... o | ||
| 1709 | checking whether we are using the GNU C compiler... yes | ||
| 1710 | checking whether gcc accepts -g... yes | ||
| 1711 | checking for gcc option to accept ISO C89... none needed | ||
| 1712 | checking for style of include used by make... GNU | ||
| 1713 | checking dependency style of gcc... gcc3 | ||
| 1714 | ./configure: line 4100: gl_EARLY: command not found | ||
| 1715 | checking how to run the C preprocessor... gcc -E | ||
| 1716 | checking for grep that handles long lines and -e... /bin/grep | ||
| 1717 | checking for egrep... /bin/grep -E | ||
| 1718 | checking whether gcc needs -traditional... no | ||
| 1719 | checking how to print strings... printf | ||
| 1720 | checking for a sed that does not truncate output... /bin/sed | ||
| 1721 | checking for fgrep... /bin/grep -F | ||
| 1722 | checking for ld used by gcc... /usr/bin/ld | ||
| 1723 | checking if the linker (/usr/bin/ld) is GNU ld... yes | ||
| 1724 | checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B | ||
| 1725 | checking the name lister (/usr/bin/nm -B) interface... BSD nm | ||
| 1726 | checking whether ln -s works... yes | ||
| 1727 | checking the maximum length of command line arguments... 1572864 | ||
| 1728 | checking whether the shell understands some XSI constructs... yes | ||
| 1729 | checking whether the shell understands "+="... yes | ||
| 1730 | checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop | ||
| 1731 | checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop | ||
| 1732 | checking for /usr/bin/ld option to reload object files... -r | ||
| 1733 | checking for objdump... objdump | ||
| 1734 | checking how to recognize dependent libraries... pass_all | ||
| 1735 | checking for dlltool... no | ||
| 1736 | checking how to associate runtime and link libraries... printf %s\n | ||
| 1737 | checking for ar... ar | ||
| 1738 | checking for archiver @FILE support... @ | ||
| 1739 | checking for strip... strip | ||
| 1740 | checking for ranlib... ranlib | ||
| 1741 | checking command to parse /usr/bin/nm -B output from gcc object... ok | ||
| 1742 | checking for sysroot... no | ||
| 1743 | checking for mt... mt | ||
| 1744 | checking if mt is a manifest tool... no | ||
| 1745 | checking for ANSI C header files... yes | ||
| 1746 | checking for sys/types.h... yes | ||
| 1747 | checking for sys/stat.h... yes | ||
| 1748 | checking for stdlib.h... yes | ||
| 1749 | checking for string.h... yes | ||
| 1750 | checking for memory.h... yes | ||
| 1751 | checking for strings.h... yes | ||
| 1752 | checking for inttypes.h... yes | ||
| 1753 | checking for stdint.h... yes | ||
| 1754 | checking for unistd.h... yes | ||
| 1755 | checking for dlfcn.h... yes | ||
| 1756 | checking for objdir... .libs | ||
| 1757 | checking if gcc supports -fno-rtti -fno-exceptions... no | ||
| 1758 | checking for gcc option to produce PIC... -fPIC -DPIC | ||
| 1759 | checking if gcc PIC flag -fPIC -DPIC works... yes | ||
| 1760 | checking if gcc static flag -static works... yes | ||
| 1761 | checking if gcc supports -c -o file.o... yes | ||
| 1762 | checking if gcc supports -c -o file.o... (cached) yes | ||
| 1763 | checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes | ||
| 1764 | checking whether -lc should be explicitly linked in... no | ||
| 1765 | checking dynamic linker characteristics... GNU/Linux ld.so | ||
| 1766 | checking how to hardcode library paths into programs... immediate | ||
| 1767 | checking whether stripping libraries is possible... yes | ||
| 1768 | checking if libtool supports shared libraries... yes | ||
| 1769 | checking whether to build shared libraries... yes | ||
| 1770 | checking whether to build static libraries... yes | ||
| 1771 | checking whether gcc and cc understand -c and -o together... yes | ||
| 1772 | checking for error_at_line... yes | ||
| 1773 | checking for special C compiler options needed for large files... no | ||
| 1774 | checking for _FILE_OFFSET_BITS value needed for large files... no | ||
| 1775 | checking for working strtod... yes | ||
| 1776 | checking for python... /usr/bin/python | ||
| 1777 | checking for sh... /bin/sh | ||
| 1778 | checking for perl... /usr/bin/perl | ||
| 1779 | checking for libgnutls-config... no | ||
| 1780 | checking for hostname... /bin/hostname | ||
| 1781 | checking for basename... /usr/bin/basename | ||
| 1782 | checking for main in -ldce... no | ||
| 1783 | checking for main in -lnsl... yes | ||
| 1784 | checking for socket in -lsocket... no | ||
| 1785 | checking for main in -lresolv... yes | ||
| 1786 | checking math.h usability... yes | ||
| 1787 | checking math.h presence... yes | ||
| 1788 | checking for math.h... yes | ||
| 1789 | checking for floor in -lm... yes | ||
| 1790 | checking mp.h usability... no | ||
| 1791 | checking mp.h presence... no | ||
| 1792 | checking for mp.h... no | ||
| 1793 | checking for pow in -lbsd... no | ||
| 1794 | checking for plan_tests in -ltap... no | ||
| 1795 | checking for main in -lcrypt... yes | ||
| 1796 | checking for PQsetdbLogin in -lpq... no | ||
| 1797 | configure: WARNING: Skipping PostgreSQL plugin (check_pgsql) | ||
| 1798 | configure: WARNING: LIBS="-lcrypt " CPPFLAGS="" | ||
| 1799 | configure: WARNING: install PostgreSQL libs to compile this plugin (see REQUIREMENTS). | ||
| 1800 | checking for dbi_initialize in -ldbi... no | ||
| 1801 | configure: WARNING: Skipping dbi plugin | ||
| 1802 | configure: WARNING: install DBI libs to compile this plugin (see REQUIREMENTS). | ||
| 1803 | checking for rc_read_config in -lradiusclient... no | ||
| 1804 | checking for rc_read_config in -lradiusclient-ng... no | ||
| 1805 | configure: WARNING: Skipping radius plugin | ||
| 1806 | configure: WARNING: install radius libs to compile this plugin (see REQUIREMENTS). | ||
| 1807 | checking for main in -lldap... no | ||
| 1808 | configure: WARNING: Skipping LDAP plugin | ||
| 1809 | configure: WARNING: install LDAP libs to compile this plugin (see REQUIREMENTS). | ||
| 1810 | checking linux/hdreg.h usability... yes | ||
| 1811 | checking linux/hdreg.h presence... yes | ||
| 1812 | checking for linux/hdreg.h... yes | ||
| 1813 | checking linux/types.h usability... yes | ||
| 1814 | checking linux/types.h presence... yes | ||
| 1815 | checking for linux/types.h... yes | ||
| 1816 | ./configure: line 13278: np_mysqlclient: command not found | ||
| 1817 | ./configure: line 13279: test: =: unary operator expected | ||
| 1818 | checking for IPv6 support... yes | ||
| 1819 | checking krb5.h usability... no | ||
| 1820 | checking krb5.h presence... no | ||
| 1821 | checking for krb5.h... no | ||
| 1822 | checking krb5.h usability... no | ||
| 1823 | checking krb5.h presence... no | ||
| 1824 | checking for krb5.h... no | ||
| 1825 | checking for dlopen in -ldl... yes | ||
| 1826 | checking for shl_load in -ldl... no | ||
| 1827 | checking openssl/ssl.h usability... yes | ||
| 1828 | checking openssl/ssl.h presence... yes | ||
| 1829 | checking for openssl/ssl.h... yes | ||
| 1830 | checking openssl/x509.h usability... yes | ||
| 1831 | checking openssl/x509.h presence... yes | ||
| 1832 | checking for openssl/x509.h... yes | ||
| 1833 | checking openssl/rsa.h usability... yes | ||
| 1834 | checking openssl/rsa.h presence... yes | ||
| 1835 | checking for openssl/rsa.h... yes | ||
| 1836 | checking openssl/pem.h usability... yes | ||
| 1837 | checking openssl/pem.h presence... yes | ||
| 1838 | checking for openssl/pem.h... yes | ||
| 1839 | checking openssl/crypto.h usability... yes | ||
| 1840 | checking openssl/crypto.h presence... yes | ||
| 1841 | checking for openssl/crypto.h... yes | ||
| 1842 | checking openssl/err.h usability... yes | ||
| 1843 | checking openssl/err.h presence... yes | ||
| 1844 | checking for openssl/err.h... yes | ||
| 1845 | checking for CRYPTO_lock in -lcrypto... yes | ||
| 1846 | checking for main in -lssl... yes | ||
| 1847 | checking whether time.h and sys/time.h may both be included... yes | ||
| 1848 | checking for sys/wait.h that is POSIX.1 compatible... yes | ||
| 1849 | checking signal.h usability... yes | ||
| 1850 | checking signal.h presence... yes | ||
| 1851 | checking for signal.h... yes | ||
| 1852 | checking syslog.h usability... yes | ||
| 1853 | checking syslog.h presence... yes | ||
| 1854 | checking for syslog.h... yes | ||
| 1855 | checking uio.h usability... no | ||
| 1856 | checking uio.h presence... no | ||
| 1857 | checking for uio.h... no | ||
| 1858 | checking errno.h usability... yes | ||
| 1859 | checking errno.h presence... yes | ||
| 1860 | checking for errno.h... yes | ||
| 1861 | checking sys/time.h usability... yes | ||
| 1862 | checking sys/time.h presence... yes | ||
| 1863 | checking for sys/time.h... yes | ||
| 1864 | checking sys/socket.h usability... yes | ||
| 1865 | checking sys/socket.h presence... yes | ||
| 1866 | checking for sys/socket.h... yes | ||
| 1867 | checking sys/un.h usability... yes | ||
| 1868 | checking sys/un.h presence... yes | ||
| 1869 | checking for sys/un.h... yes | ||
| 1870 | checking sys/poll.h usability... yes | ||
| 1871 | checking sys/poll.h presence... yes | ||
| 1872 | checking for sys/poll.h... yes | ||
| 1873 | checking features.h usability... yes | ||
| 1874 | checking features.h presence... yes | ||
| 1875 | checking for features.h... yes | ||
| 1876 | checking stdarg.h usability... yes | ||
| 1877 | checking stdarg.h presence... yes | ||
| 1878 | checking for stdarg.h... yes | ||
| 1879 | checking sys/unistd.h usability... yes | ||
| 1880 | checking sys/unistd.h presence... yes | ||
| 1881 | checking for sys/unistd.h... yes | ||
| 1882 | checking ctype.h usability... yes | ||
| 1883 | checking ctype.h presence... yes | ||
| 1884 | checking for ctype.h... yes | ||
| 1885 | checking for an ANSI C-conforming const... yes | ||
| 1886 | checking whether struct tm is in sys/time.h or time.h... time.h | ||
| 1887 | checking for pid_t... yes | ||
| 1888 | checking for size_t... yes | ||
| 1889 | checking return type of signal handlers... void | ||
| 1890 | checking for va_copy... yes | ||
| 1891 | checking for memmove... yes | ||
| 1892 | checking for select... yes | ||
| 1893 | checking for socket... yes | ||
| 1894 | checking for strdup... yes | ||
| 1895 | checking for strstr... yes | ||
| 1896 | checking for strtol... yes | ||
| 1897 | checking for strtoul... yes | ||
| 1898 | checking for floor... no | ||
| 1899 | checking for poll... yes | ||
| 1900 | checking return type of socket size... int | ||
| 1901 | checking for ps... /bin/ps | ||
| 1902 | checking for ps syntax... /bin/ps axwo 'stat uid pid ppid vsz rss pcpu comm args' | ||
| 1903 | checking for ping... /bin/ping | ||
| 1904 | checking for ping6... /bin/ping6 | ||
| 1905 | checking for ICMP ping syntax... /bin/ping -n -U -w %d -c %d %s | ||
| 1906 | checking for ICMPv6 ping syntax... /bin/ping6 -n -U -w %d -c %d %s | ||
| 1907 | checking for nslookup... /usr/bin/nslookup | ||
| 1908 | checking for nslookup syntax... /usr/bin/nslookup -sil | ||
| 1909 | checking for number of cpus... sysconf(_SC_NPROCESSORS_CONF) | ||
| 1910 | checking for uptime... /usr/bin/uptime | ||
| 1911 | checking for rpcinfo... /usr/bin/rpcinfo | ||
| 1912 | checking for lmstat... no | ||
| 1913 | configure: WARNING: Get lmstat from Globetrotter Software to monitor flexlm licenses | ||
| 1914 | checking for smbclient... /usr/bin/smbclient | ||
| 1915 | checking for who... /usr/bin/who | ||
| 1916 | checking for snmpget... /usr/bin/snmpget | ||
| 1917 | checking for snmpgetnext... /usr/bin/snmpgetnext | ||
| 1918 | checking for Net::SNMP perl module... found | ||
| 1919 | checking for quakestat... /usr/bin/quakestat | ||
| 1920 | checking for qstat... no | ||
| 1921 | checking for fping... /usr/bin/fping | ||
| 1922 | checking for ssh... /usr/bin/ssh | ||
| 1923 | checking for mailq... /usr/bin/mailq | ||
| 1924 | checking for qmail-qstat... no | ||
| 1925 | configure: WARNING: Could not find qmail-qstat or eqivalent | ||
| 1926 | checking for swap... no | ||
| 1927 | checking for swapinfo... no | ||
| 1928 | checking for lsps... no | ||
| 1929 | checking for sys/stat.h... (cached) yes | ||
| 1930 | checking sys/param.h usability... yes | ||
| 1931 | checking sys/param.h presence... yes | ||
| 1932 | checking for sys/param.h... yes | ||
| 1933 | checking for sys/swap.h... yes | ||
| 1934 | checking whether swapctl is declared... no | ||
| 1935 | checking for swaptbl_t... no | ||
| 1936 | checking for swapent_t... no | ||
| 1937 | checking for struct swapent.se_nblks... no | ||
| 1938 | checking for /proc/meminfo... found /proc/meminfo | ||
| 1939 | checking for dig... /usr/bin/dig | ||
| 1940 | checking for apt-get... /usr/bin/apt-get | ||
| 1941 | checking sys/sockio.h usability... no | ||
| 1942 | checking sys/sockio.h presence... no | ||
| 1943 | checking for sys/sockio.h... no | ||
| 1944 | checking whether NLS is requested... yes | ||
| 1945 | checking for msgfmt... /usr/bin/msgfmt | ||
| 1946 | checking for gmsgfmt... /usr/bin/msgfmt | ||
| 1947 | checking for xgettext... /usr/bin/xgettext | ||
| 1948 | checking for msgmerge... /usr/bin/msgmerge | ||
| 1949 | checking for ld used by GCC... /usr/bin/ld -m elf_x86_64 | ||
| 1950 | checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes | ||
| 1951 | checking for shared library run path origin... done | ||
| 1952 | checking for CFPreferencesCopyAppValue... no | ||
| 1953 | checking for CFLocaleCopyCurrent... no | ||
| 1954 | checking for GNU gettext in libc... yes | ||
| 1955 | checking whether to use NLS... yes | ||
| 1956 | checking where the gettext function comes from... libc | ||
| 1957 | checking for main in -lpthread... yes | ||
| 1958 | ./configure: line 18615: gl_INIT: command not found | ||
| 1959 | configure: creating ./config.status | ||
| 1960 | config.status: creating gl/Makefile | ||
| 1961 | config.status: creating nagios-plugins.spec | ||
| 1962 | config.status: creating Makefile | ||
| 1963 | config.status: creating tap/Makefile | ||
| 1964 | config.status: creating lib/Makefile | ||
| 1965 | config.status: creating plugins/Makefile | ||
| 1966 | config.status: creating lib/tests/Makefile | ||
| 1967 | config.status: creating plugins-root/Makefile | ||
| 1968 | config.status: creating plugins-scripts/Makefile | ||
| 1969 | config.status: creating plugins-scripts/subst | ||
| 1970 | config.status: creating plugins-scripts/utils.pm | ||
| 1971 | config.status: creating plugins-scripts/utils.sh | ||
| 1972 | config.status: creating perlmods/Makefile | ||
| 1973 | config.status: creating command.cfg | ||
| 1974 | config.status: creating test.pl | ||
| 1975 | config.status: creating pkg/solaris/pkginfo | ||
| 1976 | config.status: creating po/Makefile.in | ||
| 1977 | config.status: creating config.h | ||
| 1978 | config.status: config.h is unchanged | ||
| 1979 | config.status: executing depfiles commands | ||
| 1980 | config.status: executing libtool commands | ||
| 1981 | config.status: executing po-directories commands | ||
| 1982 | config.status: creating po/POTFILES | ||
| 1983 | config.status: creating po/Makefile | ||
| 1984 | --with-apt-get-command: /usr/bin/apt-get | ||
| 1985 | --with-ping6-command: /bin/ping6 -n -U -w %d -c %d %s | ||
| 1986 | --with-ping-command: /bin/ping -n -U -w %d -c %d %s | ||
| 1987 | --with-ipv6: yes | ||
| 1988 | --with-mysql: | ||
| 1989 | --with-openssl: yes | ||
| 1990 | --with-gnutls: no | ||
| 1991 | --enable-extra-opts: no | ||
| 1992 | --with-perl: /usr/bin/perl | ||
| 1993 | --enable-perl-modules: no | ||
| 1994 | --with-cgiurl: /nagios/cgi-bin | ||
| 1995 | --with-trusted-path: /bin:/sbin:/usr/bin:/usr/sbin | ||
| 1996 | --enable-libtap: no | ||
| 1997 | dataloader% make | ||
| 1998 | make all-recursive | ||
| 1999 | make[1]: Entering directory `/home/bryan/tmp/nagiosplug' | ||
| 2000 | Making all in gl | ||
| 2001 | make[2]: Entering directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 2002 | rm -f configmake.h-t && \ | ||
| 2003 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 2004 | echo '#define PREFIX "/usr/local/nagios"'; \ | ||
| 2005 | echo '#define EXEC_PREFIX "/usr/local/nagios"'; \ | ||
| 2006 | echo '#define BINDIR "/usr/local/nagios/bin"'; \ | ||
| 2007 | echo '#define SBINDIR "/usr/local/nagios/sbin"'; \ | ||
| 2008 | echo '#define LIBEXECDIR "/usr/local/nagios/libexec"'; \ | ||
| 2009 | echo '#define DATAROOTDIR "/usr/local/nagios/share"'; \ | ||
| 2010 | echo '#define DATADIR "/usr/local/nagios/share"'; \ | ||
| 2011 | echo '#define SYSCONFDIR "/usr/local/nagios/etc"'; \ | ||
| 2012 | echo '#define SHAREDSTATEDIR "/usr/local/nagios/com"'; \ | ||
| 2013 | echo '#define LOCALSTATEDIR "/usr/local/nagios/var"'; \ | ||
| 2014 | echo '#define INCLUDEDIR "/usr/local/nagios/include"'; \ | ||
| 2015 | echo '#define OLDINCLUDEDIR "/usr/include"'; \ | ||
| 2016 | echo '#define DOCDIR "/usr/local/nagios/share/doc/nagios-plugins"'; \ | ||
| 2017 | echo '#define INFODIR "/usr/local/nagios/share/info"'; \ | ||
| 2018 | echo '#define HTMLDIR "/usr/local/nagios/share/doc/nagios-plugins"'; \ | ||
| 2019 | echo '#define DVIDIR "/usr/local/nagios/share/doc/nagios-plugins"'; \ | ||
| 2020 | echo '#define PDFDIR "/usr/local/nagios/share/doc/nagios-plugins"'; \ | ||
| 2021 | echo '#define PSDIR "/usr/local/nagios/share/doc/nagios-plugins"'; \ | ||
| 2022 | echo '#define LIBDIR "/usr/local/nagios/lib"'; \ | ||
| 2023 | echo '#define LISPDIR ""'; \ | ||
| 2024 | echo '#define LOCALEDIR "/usr/local/nagios/share/locale"'; \ | ||
| 2025 | echo '#define MANDIR "/usr/local/nagios/share/man"'; \ | ||
| 2026 | echo '#define MANEXT ""'; \ | ||
| 2027 | echo '#define PKGDATADIR "/usr/local/nagios/share/nagios-plugins"'; \ | ||
| 2028 | echo '#define PKGINCLUDEDIR "/usr/local/nagios/include/nagios-plugins"'; \ | ||
| 2029 | echo '#define PKGLIBDIR "/usr/local/nagios/lib/nagios-plugins"'; \ | ||
| 2030 | echo '#define PKGLIBEXECDIR "/usr/local/nagios/libexec/nagios-plugins"'; \ | ||
| 2031 | } | sed '/""/d' > configmake.h-t && \ | ||
| 2032 | if test -f configmake.h && cmp configmake.h-t configmake.h > /dev/null; then \ | ||
| 2033 | rm -f configmake.h-t; \ | ||
| 2034 | else \ | ||
| 2035 | rm -f configmake.h; mv configmake.h-t configmake.h; \ | ||
| 2036 | fi | ||
| 2037 | make all-recursive | ||
| 2038 | make[3]: Entering directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 2039 | make[4]: Entering directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 2040 | gcc -DHAVE_CONFIG_H -I. -I.. -I../intl -g -O2 -MT base64.o -MD -MP -MF .deps/base64.Tpo -c -o base64.o base64.c | ||
| 2041 | In file included from base64.c:47:0: | ||
| 2042 | base64.h:40:49: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’ | ||
| 2043 | base64.h:48:53: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’ | ||
| 2044 | In file included from base64.c:50:0: | ||
| 2045 | ./stdlib.h:20:1: error: stray ‘@’ in program | ||
| 2046 | ./stdlib.h:20:1: error: stray ‘@’ in program | ||
| 2047 | In file included from base64.c:50:0: | ||
| 2048 | ./stdlib.h:43:7: error: operator '||' has no left operand | ||
| 2049 | ./stdlib.h:49:5: error: #if with no expression | ||
| 2050 | ./stdlib.h:53:7: error: operator '!' has no right operand | ||
| 2051 | ./stdlib.h:58:6: error: operator '!' has no right operand | ||
| 2052 | ./stdlib.h:71:7: error: operator '||' has no left operand | ||
| 2053 | In file included from base64.c:50:0: | ||
| 2054 | ./stdlib.h:410:5: error: #if with no expression | ||
| 2055 | ./stdlib.h:426:5: error: #if with no expression | ||
| 2056 | ./stdlib.h:445:5: error: #if with no expression | ||
| 2057 | ./stdlib.h:469:5: error: #if with no expression | ||
| 2058 | ./stdlib.h:488:5: error: #if with no expression | ||
| 2059 | ./stdlib.h:516:5: error: #if with no expression | ||
| 2060 | ./stdlib.h:532:5: error: #if with no expression | ||
| 2061 | ./stdlib.h:551:5: error: #if with no expression | ||
| 2062 | ./stdlib.h:570:5: error: #if with no expression | ||
| 2063 | ./stdlib.h:597:5: error: #if with no expression | ||
| 2064 | ./stdlib.h:627:5: error: #if with no expression | ||
| 2065 | ./stdlib.h:658:5: error: #if with no expression | ||
| 2066 | ./stdlib.h:683:5: error: #if with no expression | ||
| 2067 | ./stdlib.h:699:5: error: #if with no expression | ||
| 2068 | ./stdlib.h:714:5: error: #if with no expression | ||
| 2069 | ./stdlib.h:722:5: error: #if with no expression | ||
| 2070 | ./stdlib.h:737:5: error: #if with no expression | ||
| 2071 | ./stdlib.h:754:5: error: #if with no expression | ||
| 2072 | ./stdlib.h:773:5: error: #if with no expression | ||
| 2073 | ./stdlib.h:791:5: error: #if with no expression | ||
| 2074 | ./stdlib.h:810:5: error: #if with no expression | ||
| 2075 | ./stdlib.h:834:5: error: #if with no expression | ||
| 2076 | ./stdlib.h:850:5: error: #if with no expression | ||
| 2077 | ./stdlib.h:881:5: error: #if with no expression | ||
| 2078 | ./stdlib.h:906:5: error: #if with no expression | ||
| 2079 | ./stdlib.h:931:5: error: #if with no expression | ||
| 2080 | ./stdlib.h:956:5: error: #if with no expression | ||
| 2081 | ./stdlib.h:972:5: error: #if with no expression | ||
| 2082 | In file included from base64.c:55:0: | ||
| 2083 | ./string.h:23:1: error: stray ‘@’ in program | ||
| 2084 | In file included from base64.c:50:0: | ||
| 2085 | ./stdlib.h:20:2: error: unknown type name ‘PRAGMA_SYSTEM_HEADER’ | ||
| 2086 | In file included from base64.c:55:0: | ||
| 2087 | ./string.h:23:1: error: stray ‘@’ in program | ||
| 2088 | In file included from base64.c:55:0: | ||
| 2089 | ./string.h:36:6: error: operator '&&' has no left operand | ||
| 2090 | ./string.h:371:5: error: #if with no expression | ||
| 2091 | ./string.h:409:5: error: #if with no expression | ||
| 2092 | ./string.h:444:5: error: #if with no expression | ||
| 2093 | ./string.h:464:5: error: #if with no expression | ||
| 2094 | ./string.h:494:5: error: #if with no expression | ||
| 2095 | ./string.h:522:5: error: #if with no expression | ||
| 2096 | ./string.h:541:5: error: #if with no expression | ||
| 2097 | ./string.h:584:5: error: #if with no expression | ||
| 2098 | ./string.h:612:5: error: #if with no expression | ||
| 2099 | ./string.h:636:5: error: #if with no expression | ||
| 2100 | ./string.h:658:5: error: #if with no expression | ||
| 2101 | ./string.h:686:5: error: #if with no expression | ||
| 2102 | ./string.h:726:5: error: #if with no expression | ||
| 2103 | ./string.h:800:5: error: #if with no expression | ||
| 2104 | ./string.h:823:5: error: #if with no expression | ||
| 2105 | ./string.h:864:5: error: #if with no expression | ||
| 2106 | ./string.h:931:5: error: #if with no expression | ||
| 2107 | ./string.h:976:5: error: #if with no expression | ||
| 2108 | ./string.h:995:5: error: #if with no expression | ||
| 2109 | ./string.h:1002:5: error: #if with no expression | ||
| 2110 | ./string.h:1022:5: error: #if with no expression | ||
| 2111 | ./string.h:1042:5: error: #if with no expression | ||
| 2112 | ./string.h:1051:5: error: #if with no expression | ||
| 2113 | ./string.h:1062:5: error: #if with no expression | ||
| 2114 | ./string.h:1076:5: error: #if with no expression | ||
| 2115 | ./string.h:1090:5: error: #if with no expression | ||
| 2116 | ./string.h:1100:5: error: #if with no expression | ||
| 2117 | ./string.h:1110:5: error: #if with no expression | ||
| 2118 | ./string.h:1130:5: error: #if with no expression | ||
| 2119 | ./string.h:1140:5: error: #if with no expression | ||
| 2120 | ./string.h:1159:5: error: #if with no expression | ||
| 2121 | ./string.h:1181:5: error: #if with no expression | ||
| 2122 | ./string.h:1200:5: error: #if with no expression | ||
| 2123 | ./string.h:1224:5: error: #if with no expression | ||
| 2124 | base64.c:58:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘static’ | ||
| 2125 | base64.c:69:37: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’ | ||
| 2126 | base64.c: In function ‘base64_encode_alloc’: | ||
| 2127 | base64.c:138:10: warning: incompatible implicit declaration of built-in function ‘malloc’ [enabled by default] | ||
| 2128 | base64.c: At top level: | ||
| 2129 | base64.c:321:29: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token | ||
| 2130 | base64.c:374:32: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’ | ||
| 2131 | base64.c:460:41: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’ | ||
| 2132 | base64.c: In function ‘base64_decode_alloc_ctx’: | ||
| 2133 | base64.c:561:10: warning: incompatible implicit declaration of built-in function ‘malloc’ [enabled by default] | ||
| 2134 | base64.c:567:7: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default] | ||
| 2135 | make[4]: *** [base64.o] Error 1 | ||
| 2136 | make[4]: Leaving directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 2137 | make[3]: *** [all-recursive] Error 1 | ||
| 2138 | make[3]: Leaving directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 2139 | make[2]: *** [all] Error 2 | ||
| 2140 | make[2]: Leaving directory `/home/bryan/tmp/nagiosplug/gl' | ||
| 2141 | make[1]: *** [all-recursive] Error 1 | ||
| 2142 | make[1]: Leaving directory `/home/bryan/tmp/nagiosplug' | ||
| 2143 | make: *** [all] Error 2 | ||
| 2144 | d | ||
| 2145 | |||
diff --git a/web/attachments/450267-nagios-plugins-1.4.15-vserver.patch b/web/attachments/450267-nagios-plugins-1.4.15-vserver.patch new file mode 100644 index 0000000..5ecaf89 --- /dev/null +++ b/web/attachments/450267-nagios-plugins-1.4.15-vserver.patch | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | --- configure.in.orig 2010-07-30 16:22:01.000000000 +0200 | ||
| 2 | +++ configure.in 2010-07-30 16:24:30.000000000 +0200 | ||
| 3 | @@ -94,6 +94,8 @@ | ||
| 4 | REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'` | ||
| 5 | REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'` | ||
| 6 | |||
| 7 | +first_ip=`/sbin/ifconfig | egrep -m1 "inet addr:" | sed 's/^.*inet addr:\([[0-9.]]*\).*/\1/'` | ||
| 8 | + | ||
| 9 | AC_SUBST(PKG_ARCH) | ||
| 10 | AC_SUBST(REV_DATESTAMP) | ||
| 11 | AC_SUBST(REV_TIMESTAMP) | ||
| 12 | @@ -950,14 +952,14 @@ | ||
| 13 | fi | ||
| 14 | |||
| 15 | elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \ | ||
| 16 | - $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \ | ||
| 17 | + $PATH_TO_PING -n -s $first_ip 56 1 2>/dev/null | \ | ||
| 18 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 19 | then | ||
| 20 | with_ping_command="$PATH_TO_PING -n -U -c %d %s" | ||
| 21 | ac_cv_ping_packets_first=yes | ||
| 22 | AC_MSG_RESULT([$with_ping_command]) | ||
| 23 | |||
| 24 | -elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \ | ||
| 25 | +elif $PATH_TO_PING -n -U -w 10 -c 1 $first_ip 2>/dev/null | \ | ||
| 26 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 27 | then | ||
| 28 | with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s" | ||
| 29 | @@ -965,52 +967,52 @@ | ||
| 30 | ac_cv_ping_has_timeout=yes | ||
| 31 | AC_MSG_RESULT([$with_ping_command]) | ||
| 32 | |||
| 33 | -elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \ | ||
| 34 | +elif $PATH_TO_PING -n -U -c 1 $first_ip 2>/dev/null | \ | ||
| 35 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 36 | then | ||
| 37 | with_ping_command="$PATH_TO_PING -n -U -c %d %s" | ||
| 38 | ac_cv_ping_packets_first=yes | ||
| 39 | AC_MSG_RESULT([$with_ping_command]) | ||
| 40 | |||
| 41 | -elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \ | ||
| 42 | +elif $PATH_TO_PING -n -c 1 $first_ip 2>/dev/null | \ | ||
| 43 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 44 | then | ||
| 45 | with_ping_command="$PATH_TO_PING -n -c %d %s" | ||
| 46 | ac_cv_ping_packets_first=yes | ||
| 47 | AC_MSG_RESULT([$with_ping_command]) | ||
| 48 | |||
| 49 | -elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \ | ||
| 50 | +elif $PATH_TO_PING -n $first_ip -c 1 2>/dev/null | \ | ||
| 51 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 52 | then | ||
| 53 | with_ping_command="$PATH_TO_PING -n %s -c %d" | ||
| 54 | AC_MSG_RESULT([$with_ping_command]) | ||
| 55 | |||
| 56 | -elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \ | ||
| 57 | +elif $PATH_TO_PING $first_ip -n 1 2>/dev/null | \ | ||
| 58 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 59 | then | ||
| 60 | with_ping_command="$PATH_TO_PING %s -n %d" | ||
| 61 | AC_MSG_RESULT([$with_ping_command]) | ||
| 62 | |||
| 63 | -elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \ | ||
| 64 | +elif $PATH_TO_PING -n -s $first_ip 56 1 2>/dev/null | \ | ||
| 65 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 66 | then | ||
| 67 | with_ping_command="$PATH_TO_PING -n -s %s 56 %d" | ||
| 68 | AC_MSG_RESULT([$with_ping_command]) | ||
| 69 | |||
| 70 | -elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \ | ||
| 71 | +elif $PATH_TO_PING -n -h $first_ip -s 56 -c 1 2>/dev/null | \ | ||
| 72 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 73 | then | ||
| 74 | with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d" | ||
| 75 | AC_MSG_RESULT([$with_ping_command]) | ||
| 76 | |||
| 77 | -elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \ | ||
| 78 | +elif $PATH_TO_PING -n -s 56 -c 1 $first_ip 2>/dev/null | \ | ||
| 79 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 80 | then | ||
| 81 | with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s" | ||
| 82 | ac_cv_ping_packets_first=yes | ||
| 83 | AC_MSG_RESULT([$with_ping_command]) | ||
| 84 | |||
| 85 | -elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \ | ||
| 86 | +elif $PATH_TO_PING -n -c 1 $first_ip 2>/dev/null | \ | ||
| 87 | egrep -i "^round-trip|^rtt" >/dev/null | ||
| 88 | then | ||
| 89 | with_ping_command="$PATH_TO_PING -n -c %d %s" | ||
| 90 | @@ -1221,7 +1223,7 @@ | ||
| 91 | if test -n "$PATH_TO_NSLOOKUP" | ||
| 92 | then | ||
| 93 | AC_MSG_CHECKING(for nslookup syntax) | ||
| 94 | - if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null | ||
| 95 | + if $PATH_TO_NSLOOKUP -sil $first_ip 2>&1 | grep ["Invalid option: sil"] >/dev/null | ||
| 96 | then | ||
| 97 | ac_cv_nslookup_command="$PATH_TO_NSLOOKUP" | ||
| 98 | AC_MSG_RESULT([$ac_cv_nslookup_command]) | ||
diff --git a/web/attachments/450268-nagios-plugins.patch b/web/attachments/450268-nagios-plugins.patch new file mode 100644 index 0000000..f70b810 --- /dev/null +++ b/web/attachments/450268-nagios-plugins.patch | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | diff -r ./config.h nagios-plugins/config.h | ||
| 2 | 1539,1541d1538 | ||
| 3 | < /* path and args for ICMP ping command with defined source */ | ||
| 4 | < #define PING_COMMAND_SOURCE "/sbin/ping -S %s -n -c %d %s" | ||
| 5 | < | ||
| 6 | Только в .: nagios-plugins | ||
| 7 | Только в .: nagios-plugins.patch | ||
| 8 | diff -r ./plugins/check_ping.c nagios-plugins/plugins/check_ping.c | ||
| 9 | 39d38 | ||
| 10 | < #include "arpa/inet.h" | ||
| 11 | 63d61 | ||
| 12 | < char *source = NULL; | ||
| 13 | 73a72,73 | ||
| 14 | > | ||
| 15 | > | ||
| 16 | 90a91 | ||
| 17 | > /* Parse extra opts if any */ | ||
| 18 | 115,118c116 | ||
| 19 | < if (source == NULL) | ||
| 20 | < rawcmd = strdup(PING_COMMAND); | ||
| 21 | < else | ||
| 22 | < rawcmd = strdup(PING_COMMAND_SOURCE); | ||
| 23 | --- | ||
| 24 | > rawcmd = strdup(PING_COMMAND); | ||
| 25 | 120c118 | ||
| 26 | < rawcmd = strdup(PING_COMMAND_SOURCE); | ||
| 27 | --- | ||
| 28 | > rawcmd = strdup(PING_COMMAND); | ||
| 29 | 128c126 | ||
| 30 | < asprintf (&cmd, rawcmd, source, max_packets, addresses[i]); | ||
| 31 | --- | ||
| 32 | > asprintf (&cmd, rawcmd, max_packets, addresses[i]); | ||
| 33 | 205d202 | ||
| 34 | < {"source", optional_argument, 0, 'S'}, | ||
| 35 | 220c217 | ||
| 36 | < c = getopt_long (argc, argv, "VvhnL46t:c:w:H:p:S:", longopts, &option); | ||
| 37 | --- | ||
| 38 | > c = getopt_long (argc, argv, "VvhnL46t:c:w:H:p:", longopts, &option); | ||
| 39 | 271,278d267 | ||
| 40 | < case 'S': /* source address */ | ||
| 41 | < ptr = optarg; | ||
| 42 | < source = ptr; | ||
| 43 | < struct sockaddr_in sa; | ||
| 44 | < char str[INET_ADDRSTRLEN]; | ||
| 45 | < if (inet_pton(AF_INET, source, &(sa.sin_addr)) != 0) | ||
| 46 | < die (STATE_UNKNOWN, _("Bad local source\n")); | ||
| 47 | < break; | ||
| 48 | 580d568 | ||
| 49 | < printf (" %s\n", "-S, --source=IP"); | ||
| 50 | 612c600 | ||
| 51 | < printf ("%s -S <source_address> -H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n", progname); | ||
| 52 | --- | ||
| 53 | > printf ("%s -H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n", progname); | ||
diff --git a/web/attachments/450269-nagios-plugins-1.4.15-snmp_conf.patch b/web/attachments/450269-nagios-plugins-1.4.15-snmp_conf.patch new file mode 100644 index 0000000..7d5689b --- /dev/null +++ b/web/attachments/450269-nagios-plugins-1.4.15-snmp_conf.patch | |||
| @@ -0,0 +1,205 @@ | |||
| 1 | --- nagios-plugins-1.4.15/plugins/check_snmp.c.conf 2011-07-22 09:23:17.000000000 -0400 | ||
| 2 | +++ nagios-plugins-1.4.15/plugins/check_snmp.c 2011-07-26 15:41:43.000000000 -0400 | ||
| 3 | @@ -259,26 +259,29 @@ | ||
| 4 | asprintf (&command_line[4], "%d", retries); | ||
| 5 | command_line[5] = strdup ("-m"); | ||
| 6 | command_line[6] = strdup (miblist); | ||
| 7 | - command_line[7] = "-v"; | ||
| 8 | - command_line[8] = strdup (proto); | ||
| 9 | |||
| 10 | for (i = 0; i < numauthpriv; i++) { | ||
| 11 | - command_line[9 + i] = authpriv[i]; | ||
| 12 | + command_line[7 + i] = authpriv[i]; | ||
| 13 | } | ||
| 14 | |||
| 15 | - asprintf (&command_line[9 + numauthpriv], "%s:%s", server_address, port); | ||
| 16 | + asprintf (&command_line[7 + numauthpriv], "%s:%s", server_address, port); | ||
| 17 | |||
| 18 | /* This is just for display purposes, so it can remain a string */ | ||
| 19 | - asprintf(&cl_hidden_auth, "%s -t %d -r %d -m %s -v %s %s %s:%s", | ||
| 20 | - snmpcmd, timeout_interval, retries, strlen(miblist) ? miblist : "''", proto, "[authpriv]", | ||
| 21 | - server_address, port); | ||
| 22 | + if (proto != NULL) | ||
| 23 | + asprintf(&cl_hidden_auth, "%s -t %d -r %d -m %s -v %s %s %s:%s", | ||
| 24 | + snmpcmd, timeout_interval, retries, strlen(miblist) ? miblist : "''", proto, "[authpriv]", | ||
| 25 | + server_address, port); | ||
| 26 | + else | ||
| 27 | + asprintf(&cl_hidden_auth, "%s -t %d -r %d -m %s %s %s:%s", | ||
| 28 | + snmpcmd, timeout_interval, retries, strlen(miblist) ? miblist : "''", "[authpriv]", | ||
| 29 | + server_address, port); | ||
| 30 | |||
| 31 | for (i = 0; i < numoids; i++) { | ||
| 32 | - command_line[9 + numauthpriv + 1 + i] = oids[i]; | ||
| 33 | + command_line[7 + numauthpriv + 1 + i] = oids[i]; | ||
| 34 | asprintf(&cl_hidden_auth, "%s %s", cl_hidden_auth, oids[i]); | ||
| 35 | } | ||
| 36 | |||
| 37 | - command_line[9 + numauthpriv + 1 + numoids] = NULL; | ||
| 38 | + command_line[7 + numauthpriv + 1 + numoids] = NULL; | ||
| 39 | |||
| 40 | if (verbose) | ||
| 41 | printf ("%s\n", cl_hidden_auth); | ||
| 42 | @@ -835,9 +838,36 @@ | ||
| 43 | |||
| 44 | |||
| 45 | |||
| 46 | +void addParam(char *flag, char*val) { | ||
| 47 | + // We are lazy. Verify if the value is null and, if not, add it | ||
| 48 | + if (flag != NULL && val != NULL) { | ||
| 49 | + // Raise the amount of space required for our array | ||
| 50 | + numauthpriv+=2; | ||
| 51 | + | ||
| 52 | + if (authpriv == NULL) | ||
| 53 | + authpriv = calloc(numauthpriv, sizeof(char *)); | ||
| 54 | + else | ||
| 55 | + authpriv = realloc(authpriv, numauthpriv * sizeof(char *)); | ||
| 56 | + | ||
| 57 | + authpriv[numauthpriv-2] = strdup(flag); | ||
| 58 | + authpriv[numauthpriv-1] = strdup(val); | ||
| 59 | + } | ||
| 60 | +} | ||
| 61 | + | ||
| 62 | +/* | ||
| 63 | +Protocol Security Params Reason | ||
| 64 | +NULL NULL -c,-a,-u,-A,-x,-X We don't know what the user wants. We overwrite anything provided. | ||
| 65 | +1 * -v,-c SNMP v1 supports only community | ||
| 66 | +2c * -v,-c SNMP v2c supports only community | ||
| 67 | +3 NULL -v,-u,-a,-A,-x,-X We don't know the security required in snmp.conf. We provide anything | ||
| 68 | +3 authPriv -v,-l,-u,-a,-A,-x,-X We overwrite any Authentication of privacy setting of snmp.conf by command line | ||
| 69 | +3 noAuthNoPriv -v,-l,-u We provide version, security level and security name | ||
| 70 | +3 authNoPriv -v,-l,-u,-a,-A We provide version, security level, security name and password | ||
| 71 | +*/ | ||
| 72 | int | ||
| 73 | validate_arguments () | ||
| 74 | { | ||
| 75 | + numauthpriv=0; | ||
| 76 | /* check whether to load locally installed MIBS (CPU/disk intensive) */ | ||
| 77 | if (miblist == NULL) { | ||
| 78 | if ( needmibs == TRUE ) { | ||
| 79 | @@ -855,75 +885,38 @@ | ||
| 80 | if (numoids == 0) | ||
| 81 | die(STATE_UNKNOWN, _("No OIDs specified\n")); | ||
| 82 | |||
| 83 | - if (proto == NULL) | ||
| 84 | - asprintf(&proto, DEFAULT_PROTOCOL); | ||
| 85 | |||
| 86 | - if ((strcmp(proto,"1") == 0) || (strcmp(proto, "2c")==0)) { /* snmpv1 or snmpv2c */ | ||
| 87 | - numauthpriv = 2; | ||
| 88 | - authpriv = calloc (numauthpriv, sizeof (char *)); | ||
| 89 | - authpriv[0] = strdup ("-c"); | ||
| 90 | - authpriv[1] = strdup (community); | ||
| 91 | - } | ||
| 92 | - else if ( strcmp (proto, "3") == 0 ) { /* snmpv3 args */ | ||
| 93 | - if (seclevel == NULL) | ||
| 94 | - asprintf(&seclevel, "noAuthNoPriv"); | ||
| 95 | - | ||
| 96 | - if (strcmp(seclevel, "noAuthNoPriv") == 0) { | ||
| 97 | - numauthpriv = 2; | ||
| 98 | - authpriv = calloc (numauthpriv, sizeof (char *)); | ||
| 99 | - authpriv[0] = strdup ("-l"); | ||
| 100 | - authpriv[1] = strdup ("noAuthNoPriv"); | ||
| 101 | + if (proto == NULL || strcmp (proto, "3") == 0) { | ||
| 102 | + // No protocol will pass any valid parameter. See note before function for more explanation | ||
| 103 | + if (proto == NULL) { | ||
| 104 | + addParam("-c",community); | ||
| 105 | } else { | ||
| 106 | - if (! ( (strcmp(seclevel, "authNoPriv")==0) || (strcmp(seclevel, "authPriv")==0) ) ) { | ||
| 107 | - usage2 (_("Invalid seclevel"), seclevel); | ||
| 108 | - } | ||
| 109 | - | ||
| 110 | - if (authproto == NULL ) | ||
| 111 | - asprintf(&authproto, DEFAULT_AUTH_PROTOCOL); | ||
| 112 | - | ||
| 113 | - if (secname == NULL) | ||
| 114 | - die(STATE_UNKNOWN, _("Required parameter: %s\n"), "secname"); | ||
| 115 | - | ||
| 116 | - if (authpasswd == NULL) | ||
| 117 | - die(STATE_UNKNOWN, _("Required parameter: %s\n"), "authpasswd"); | ||
| 118 | - | ||
| 119 | - if ( strcmp(seclevel, "authNoPriv") == 0 ) { | ||
| 120 | - numauthpriv = 8; | ||
| 121 | - authpriv = calloc (numauthpriv, sizeof (char *)); | ||
| 122 | - authpriv[0] = strdup ("-l"); | ||
| 123 | - authpriv[1] = strdup ("authNoPriv"); | ||
| 124 | - authpriv[2] = strdup ("-a"); | ||
| 125 | - authpriv[3] = strdup (authproto); | ||
| 126 | - authpriv[4] = strdup ("-u"); | ||
| 127 | - authpriv[5] = strdup (secname); | ||
| 128 | - authpriv[6] = strdup ("-A"); | ||
| 129 | - authpriv[7] = strdup (authpasswd); | ||
| 130 | - } else if ( strcmp(seclevel, "authPriv") == 0 ) { | ||
| 131 | - if (privproto == NULL ) | ||
| 132 | - asprintf(&privproto, DEFAULT_PRIV_PROTOCOL); | ||
| 133 | - | ||
| 134 | - if (privpasswd == NULL) | ||
| 135 | - die(STATE_UNKNOWN, _("Required parameter: %s\n"), "privpasswd"); | ||
| 136 | - | ||
| 137 | - numauthpriv = 12; | ||
| 138 | - authpriv = calloc (numauthpriv, sizeof (char *)); | ||
| 139 | - authpriv[0] = strdup ("-l"); | ||
| 140 | - authpriv[1] = strdup ("authPriv"); | ||
| 141 | - authpriv[2] = strdup ("-a"); | ||
| 142 | - authpriv[3] = strdup (authproto); | ||
| 143 | - authpriv[4] = strdup ("-u"); | ||
| 144 | - authpriv[5] = strdup (secname); | ||
| 145 | - authpriv[6] = strdup ("-A"); | ||
| 146 | - authpriv[7] = strdup (authpasswd); | ||
| 147 | - authpriv[8] = strdup ("-x"); | ||
| 148 | - authpriv[9] = strdup (privproto); | ||
| 149 | - authpriv[10] = strdup ("-X"); | ||
| 150 | - authpriv[11] = strdup (privpasswd); | ||
| 151 | - } | ||
| 152 | + addParam("-v",proto); | ||
| 153 | } | ||
| 154 | + addParam("-u",secname); | ||
| 155 | |||
| 156 | - } | ||
| 157 | - else { | ||
| 158 | + if (seclevel == NULL || strcmp(seclevel, "authPriv")==0) { | ||
| 159 | + addParam("-l",seclevel); | ||
| 160 | + addParam("-a",authproto); | ||
| 161 | + addParam("-A",authpasswd); | ||
| 162 | + addParam("-x",privproto); | ||
| 163 | + addParam("-X",privpasswd); | ||
| 164 | + } else if (strcmp(seclevel, "noAuthNoPriv") == 0) { | ||
| 165 | + addParam("-v",proto); | ||
| 166 | + addParam("-l",seclevel); | ||
| 167 | + } else if (strcmp(seclevel, "authNoPriv")==0) { | ||
| 168 | + addParam("-v",proto); | ||
| 169 | + addParam("-l",seclevel); | ||
| 170 | + addParam("-a",authproto); | ||
| 171 | + addParam("-A",authpasswd); | ||
| 172 | + } else { | ||
| 173 | + usage2 (_("Invalid seclevel"), seclevel); | ||
| 174 | + } | ||
| 175 | + } else if ((strcmp(proto,"1") == 0) || (strcmp(proto, "2c")==0)) { /* snmpv1 or snmpv2c */ | ||
| 176 | + // If we specified protocol v2, the only param that is usefull is community string (if specified). | ||
| 177 | + addParam("-v",proto); | ||
| 178 | + addParam("-c",community); | ||
| 179 | + } else { | ||
| 180 | usage2 (_("Invalid SNMP version"), proto); | ||
| 181 | } | ||
| 182 | |||
| 183 | @@ -1011,12 +1004,11 @@ | ||
| 184 | printf (" %s\n", "-a, --authproto=[MD5|SHA]"); | ||
| 185 | printf (" %s\n", _("SNMPv3 auth proto")); | ||
| 186 | printf (" %s\n", "-x, --privproto=[DES|AES]"); | ||
| 187 | - printf (" %s\n", _("SNMPv3 priv proto (default DES)")); | ||
| 188 | + printf (" %s\n", _("SNMPv3 priv proto")); | ||
| 189 | |||
| 190 | /* Authentication Tokens*/ | ||
| 191 | printf (" %s\n", "-C, --community=STRING"); | ||
| 192 | printf (" %s ", _("Optional community string for SNMP communication")); | ||
| 193 | - printf ("(%s \"%s\")\n", _("default is") ,DEFAULT_COMMUNITY); | ||
| 194 | printf (" %s\n", "-U, --secname=USERNAME"); | ||
| 195 | printf (" %s\n", _("SNMPv3 username")); | ||
| 196 | printf (" %s\n", "-A, --authpassword=PASSWORD"); | ||
| 197 | @@ -1076,6 +1068,8 @@ | ||
| 198 | |||
| 199 | printf ("\n"); | ||
| 200 | printf ("%s\n", _("Notes:")); | ||
| 201 | + printf (" %s\n", _("- Default configurations are retrieved from /etc/snmp/snmp.conf. See man page of")); | ||
| 202 | + printf (" %s\n", _("snmp.conf for more information.")); | ||
| 203 | printf (" %s\n", _("- Multiple OIDs may be indicated by a comma or space-delimited list (lists with")); | ||
| 204 | printf (" %s %i %s\n", _("internal spaces must be quoted). Maximum:"), MAX_OIDS, _("OIDs.")); | ||
| 205 | |||
diff --git a/web/attachments/450270-nagios-plugins-1.4.15-snmp_conf_final.patch b/web/attachments/450270-nagios-plugins-1.4.15-snmp_conf_final.patch new file mode 100644 index 0000000..a1bb976 --- /dev/null +++ b/web/attachments/450270-nagios-plugins-1.4.15-snmp_conf_final.patch | |||
| @@ -0,0 +1,217 @@ | |||
| 1 | # This patch remove the SNMP configuration verification and allow using null parameters. | ||
| 2 | # This allows the user to configure SNMP in /etc/snmp/snmp.conf and not use the command line | ||
| 3 | --- nagios-plugins-1.4.15/plugins/check_snmp.c.conf 2011-07-22 09:23:17.000000000 -0400 | ||
| 4 | +++ nagios-plugins-1.4.15/plugins/check_snmp.c 2011-07-26 16:47:28.000000000 -0400 | ||
| 5 | @@ -259,26 +259,29 @@ | ||
| 6 | asprintf (&command_line[4], "%d", retries); | ||
| 7 | command_line[5] = strdup ("-m"); | ||
| 8 | command_line[6] = strdup (miblist); | ||
| 9 | - command_line[7] = "-v"; | ||
| 10 | - command_line[8] = strdup (proto); | ||
| 11 | |||
| 12 | for (i = 0; i < numauthpriv; i++) { | ||
| 13 | - command_line[9 + i] = authpriv[i]; | ||
| 14 | + command_line[7 + i] = authpriv[i]; | ||
| 15 | } | ||
| 16 | |||
| 17 | - asprintf (&command_line[9 + numauthpriv], "%s:%s", server_address, port); | ||
| 18 | + asprintf (&command_line[7 + numauthpriv], "%s:%s", server_address, port); | ||
| 19 | |||
| 20 | /* This is just for display purposes, so it can remain a string */ | ||
| 21 | - asprintf(&cl_hidden_auth, "%s -t %d -r %d -m %s -v %s %s %s:%s", | ||
| 22 | - snmpcmd, timeout_interval, retries, strlen(miblist) ? miblist : "''", proto, "[authpriv]", | ||
| 23 | - server_address, port); | ||
| 24 | + if (proto != NULL) | ||
| 25 | + asprintf(&cl_hidden_auth, "%s -t %d -r %d -m %s -v %s %s %s:%s", | ||
| 26 | + snmpcmd, timeout_interval, retries, strlen(miblist) ? miblist : "''", proto, "[authpriv]", | ||
| 27 | + server_address, port); | ||
| 28 | + else | ||
| 29 | + asprintf(&cl_hidden_auth, "%s -t %d -r %d -m %s %s %s:%s", | ||
| 30 | + snmpcmd, timeout_interval, retries, strlen(miblist) ? miblist : "''", "[authpriv]", | ||
| 31 | + server_address, port); | ||
| 32 | |||
| 33 | for (i = 0; i < numoids; i++) { | ||
| 34 | - command_line[9 + numauthpriv + 1 + i] = oids[i]; | ||
| 35 | + command_line[7 + numauthpriv + 1 + i] = oids[i]; | ||
| 36 | asprintf(&cl_hidden_auth, "%s %s", cl_hidden_auth, oids[i]); | ||
| 37 | } | ||
| 38 | |||
| 39 | - command_line[9 + numauthpriv + 1 + numoids] = NULL; | ||
| 40 | + command_line[7 + numauthpriv + 1 + numoids] = NULL; | ||
| 41 | |||
| 42 | if (verbose) | ||
| 43 | printf ("%s\n", cl_hidden_auth); | ||
| 44 | @@ -808,9 +811,6 @@ | ||
| 45 | if (server_address == NULL) | ||
| 46 | server_address = argv[optind]; | ||
| 47 | |||
| 48 | - if (community == NULL) | ||
| 49 | - community = strdup (DEFAULT_COMMUNITY); | ||
| 50 | - | ||
| 51 | return validate_arguments (); | ||
| 52 | } | ||
| 53 | |||
| 54 | @@ -835,9 +835,36 @@ | ||
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | +void addParam(char *flag, char*val) { | ||
| 59 | + // We are lazy. Verify if the value is null and, if not, add it | ||
| 60 | + if (flag != NULL && val != NULL) { | ||
| 61 | + // Raise the amount of space required for our array | ||
| 62 | + numauthpriv+=2; | ||
| 63 | + | ||
| 64 | + if (authpriv == NULL) | ||
| 65 | + authpriv = calloc(numauthpriv, sizeof(char *)); | ||
| 66 | + else | ||
| 67 | + authpriv = realloc(authpriv, numauthpriv * sizeof(char *)); | ||
| 68 | + | ||
| 69 | + authpriv[numauthpriv-2] = strdup(flag); | ||
| 70 | + authpriv[numauthpriv-1] = strdup(val); | ||
| 71 | + } | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +/* | ||
| 75 | +Protocol Security Params Reason | ||
| 76 | +NULL NULL -c,-a,-u,-A,-x,-X We don't know what the user wants. We overwrite anything provided. | ||
| 77 | +1 * -v,-c SNMP v1 supports only community | ||
| 78 | +2c * -v,-c SNMP v2c supports only community | ||
| 79 | +3 NULL -v,-u,-a,-A,-x,-X We don't know the security required in snmp.conf. We provide anything | ||
| 80 | +3 authPriv -v,-l,-u,-a,-A,-x,-X We overwrite any Authentication of privacy setting of snmp.conf by command line | ||
| 81 | +3 noAuthNoPriv -v,-l,-u We provide version, security level and security name | ||
| 82 | +3 authNoPriv -v,-l,-u,-a,-A We provide version, security level, security name and password | ||
| 83 | +*/ | ||
| 84 | int | ||
| 85 | validate_arguments () | ||
| 86 | { | ||
| 87 | + numauthpriv=0; | ||
| 88 | /* check whether to load locally installed MIBS (CPU/disk intensive) */ | ||
| 89 | if (miblist == NULL) { | ||
| 90 | if ( needmibs == TRUE ) { | ||
| 91 | @@ -855,75 +882,38 @@ | ||
| 92 | if (numoids == 0) | ||
| 93 | die(STATE_UNKNOWN, _("No OIDs specified\n")); | ||
| 94 | |||
| 95 | - if (proto == NULL) | ||
| 96 | - asprintf(&proto, DEFAULT_PROTOCOL); | ||
| 97 | |||
| 98 | - if ((strcmp(proto,"1") == 0) || (strcmp(proto, "2c")==0)) { /* snmpv1 or snmpv2c */ | ||
| 99 | - numauthpriv = 2; | ||
| 100 | - authpriv = calloc (numauthpriv, sizeof (char *)); | ||
| 101 | - authpriv[0] = strdup ("-c"); | ||
| 102 | - authpriv[1] = strdup (community); | ||
| 103 | - } | ||
| 104 | - else if ( strcmp (proto, "3") == 0 ) { /* snmpv3 args */ | ||
| 105 | - if (seclevel == NULL) | ||
| 106 | - asprintf(&seclevel, "noAuthNoPriv"); | ||
| 107 | - | ||
| 108 | - if (strcmp(seclevel, "noAuthNoPriv") == 0) { | ||
| 109 | - numauthpriv = 2; | ||
| 110 | - authpriv = calloc (numauthpriv, sizeof (char *)); | ||
| 111 | - authpriv[0] = strdup ("-l"); | ||
| 112 | - authpriv[1] = strdup ("noAuthNoPriv"); | ||
| 113 | + if (proto == NULL || strcmp (proto, "3") == 0) { | ||
| 114 | + // No protocol will pass any valid parameter. See note before function for more explanation | ||
| 115 | + if (proto == NULL) { | ||
| 116 | + addParam("-c",community); | ||
| 117 | } else { | ||
| 118 | - if (! ( (strcmp(seclevel, "authNoPriv")==0) || (strcmp(seclevel, "authPriv")==0) ) ) { | ||
| 119 | - usage2 (_("Invalid seclevel"), seclevel); | ||
| 120 | - } | ||
| 121 | - | ||
| 122 | - if (authproto == NULL ) | ||
| 123 | - asprintf(&authproto, DEFAULT_AUTH_PROTOCOL); | ||
| 124 | - | ||
| 125 | - if (secname == NULL) | ||
| 126 | - die(STATE_UNKNOWN, _("Required parameter: %s\n"), "secname"); | ||
| 127 | - | ||
| 128 | - if (authpasswd == NULL) | ||
| 129 | - die(STATE_UNKNOWN, _("Required parameter: %s\n"), "authpasswd"); | ||
| 130 | - | ||
| 131 | - if ( strcmp(seclevel, "authNoPriv") == 0 ) { | ||
| 132 | - numauthpriv = 8; | ||
| 133 | - authpriv = calloc (numauthpriv, sizeof (char *)); | ||
| 134 | - authpriv[0] = strdup ("-l"); | ||
| 135 | - authpriv[1] = strdup ("authNoPriv"); | ||
| 136 | - authpriv[2] = strdup ("-a"); | ||
| 137 | - authpriv[3] = strdup (authproto); | ||
| 138 | - authpriv[4] = strdup ("-u"); | ||
| 139 | - authpriv[5] = strdup (secname); | ||
| 140 | - authpriv[6] = strdup ("-A"); | ||
| 141 | - authpriv[7] = strdup (authpasswd); | ||
| 142 | - } else if ( strcmp(seclevel, "authPriv") == 0 ) { | ||
| 143 | - if (privproto == NULL ) | ||
| 144 | - asprintf(&privproto, DEFAULT_PRIV_PROTOCOL); | ||
| 145 | - | ||
| 146 | - if (privpasswd == NULL) | ||
| 147 | - die(STATE_UNKNOWN, _("Required parameter: %s\n"), "privpasswd"); | ||
| 148 | - | ||
| 149 | - numauthpriv = 12; | ||
| 150 | - authpriv = calloc (numauthpriv, sizeof (char *)); | ||
| 151 | - authpriv[0] = strdup ("-l"); | ||
| 152 | - authpriv[1] = strdup ("authPriv"); | ||
| 153 | - authpriv[2] = strdup ("-a"); | ||
| 154 | - authpriv[3] = strdup (authproto); | ||
| 155 | - authpriv[4] = strdup ("-u"); | ||
| 156 | - authpriv[5] = strdup (secname); | ||
| 157 | - authpriv[6] = strdup ("-A"); | ||
| 158 | - authpriv[7] = strdup (authpasswd); | ||
| 159 | - authpriv[8] = strdup ("-x"); | ||
| 160 | - authpriv[9] = strdup (privproto); | ||
| 161 | - authpriv[10] = strdup ("-X"); | ||
| 162 | - authpriv[11] = strdup (privpasswd); | ||
| 163 | - } | ||
| 164 | + addParam("-v",proto); | ||
| 165 | } | ||
| 166 | + addParam("-u",secname); | ||
| 167 | |||
| 168 | - } | ||
| 169 | - else { | ||
| 170 | + if (seclevel == NULL || strcmp(seclevel, "authPriv")==0) { | ||
| 171 | + addParam("-l",seclevel); | ||
| 172 | + addParam("-a",authproto); | ||
| 173 | + addParam("-A",authpasswd); | ||
| 174 | + addParam("-x",privproto); | ||
| 175 | + addParam("-X",privpasswd); | ||
| 176 | + } else if (strcmp(seclevel, "noAuthNoPriv") == 0) { | ||
| 177 | + addParam("-v",proto); | ||
| 178 | + addParam("-l",seclevel); | ||
| 179 | + } else if (strcmp(seclevel, "authNoPriv")==0) { | ||
| 180 | + addParam("-v",proto); | ||
| 181 | + addParam("-l",seclevel); | ||
| 182 | + addParam("-a",authproto); | ||
| 183 | + addParam("-A",authpasswd); | ||
| 184 | + } else { | ||
| 185 | + usage2 (_("Invalid seclevel"), seclevel); | ||
| 186 | + } | ||
| 187 | + } else if ((strcmp(proto,"1") == 0) || (strcmp(proto, "2c")==0)) { /* snmpv1 or snmpv2c */ | ||
| 188 | + // If we specified protocol v2, the only param that is usefull is community string (if specified). | ||
| 189 | + addParam("-v",proto); | ||
| 190 | + addParam("-c",community); | ||
| 191 | + } else { | ||
| 192 | usage2 (_("Invalid SNMP version"), proto); | ||
| 193 | } | ||
| 194 | |||
| 195 | @@ -1011,12 +1001,11 @@ | ||
| 196 | printf (" %s\n", "-a, --authproto=[MD5|SHA]"); | ||
| 197 | printf (" %s\n", _("SNMPv3 auth proto")); | ||
| 198 | printf (" %s\n", "-x, --privproto=[DES|AES]"); | ||
| 199 | - printf (" %s\n", _("SNMPv3 priv proto (default DES)")); | ||
| 200 | + printf (" %s\n", _("SNMPv3 priv proto")); | ||
| 201 | |||
| 202 | /* Authentication Tokens*/ | ||
| 203 | printf (" %s\n", "-C, --community=STRING"); | ||
| 204 | printf (" %s ", _("Optional community string for SNMP communication")); | ||
| 205 | - printf ("(%s \"%s\")\n", _("default is") ,DEFAULT_COMMUNITY); | ||
| 206 | printf (" %s\n", "-U, --secname=USERNAME"); | ||
| 207 | printf (" %s\n", _("SNMPv3 username")); | ||
| 208 | printf (" %s\n", "-A, --authpassword=PASSWORD"); | ||
| 209 | @@ -1076,6 +1065,8 @@ | ||
| 210 | |||
| 211 | printf ("\n"); | ||
| 212 | printf ("%s\n", _("Notes:")); | ||
| 213 | + printf (" %s\n", _("- Default configurations are retrieved from /etc/snmp/snmp.conf. See man page of")); | ||
| 214 | + printf (" %s\n", _("snmp.conf for more information.")); | ||
| 215 | printf (" %s\n", _("- Multiple OIDs may be indicated by a comma or space-delimited list (lists with")); | ||
| 216 | printf (" %s %i %s\n", _("internal spaces must be quoted). Maximum:"), MAX_OIDS, _("OIDs.")); | ||
| 217 | |||
diff --git a/web/attachments/450271-check_http.c.patch b/web/attachments/450271-check_http.c.patch new file mode 100644 index 0000000..aa0fd6d --- /dev/null +++ b/web/attachments/450271-check_http.c.patch | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | --- check_http.c.orig 2010-07-27 16:47:16.000000000 -0400 | ||
| 2 | +++ check_http.c 2011-04-05 12:02:56.000000000 -0400 | ||
| 3 | @@ -94,6 +94,7 @@ | ||
| 4 | char server_type[6] = "http"; | ||
| 5 | char *server_address; | ||
| 6 | char *host_name; | ||
| 7 | +char *host_header; | ||
| 8 | char *server_url; | ||
| 9 | char *user_agent; | ||
| 10 | int server_url_length; | ||
| 11 | @@ -346,6 +347,13 @@ | ||
| 12 | case 'u': /* URL path */ | ||
| 13 | server_url = strdup (optarg); | ||
| 14 | server_url_length = strlen (server_url); | ||
| 15 | + // Also set HTTP host header | ||
| 16 | + char delim[] = "/"; | ||
| 17 | + if (!strncmp(optarg, "http://", 7) ) { | ||
| 18 | + host_header=strdup(strtok(optarg+7, delim)); | ||
| 19 | + } else if (!strncmp(optarg, "https://", 8) ) { | ||
| 20 | + host_header=strdup(strtok(optarg+8, delim)); | ||
| 21 | + } | ||
| 22 | break; | ||
| 23 | case 'p': /* Server port */ | ||
| 24 | if (!is_intnonneg (optarg)) | ||
| 25 | @@ -823,7 +831,10 @@ | ||
| 26 | asprintf (&buf, "%sConnection: close\r\n", buf); | ||
| 27 | |||
| 28 | /* optionally send the host header info */ | ||
| 29 | - if (host_name) { | ||
| 30 | + if (!host_header) { | ||
| 31 | + host_header=strdup(host_name); | ||
| 32 | + } | ||
| 33 | + if (host_header) { | ||
| 34 | /* | ||
| 35 | * Specify the port only if we're using a non-default port (see RFC 2616, | ||
| 36 | * 14.23). Some server applications/configurations cause trouble if the | ||
| 37 | @@ -831,9 +842,9 @@ | ||
| 38 | */ | ||
| 39 | if ((use_ssl == FALSE && server_port == HTTP_PORT) || | ||
| 40 | (use_ssl == TRUE && server_port == HTTPS_PORT)) | ||
| 41 | - asprintf (&buf, "%sHost: %s\r\n", buf, host_name); | ||
| 42 | + asprintf (&buf, "%sHost: %s\r\n", buf, host_header); | ||
| 43 | else | ||
| 44 | - asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port); | ||
| 45 | + asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_header, server_port); | ||
| 46 | } | ||
| 47 | |||
| 48 | /* optionally send any other header tag */ | ||
diff --git a/web/attachments/450273-nagios-jabbers2s.patch b/web/attachments/450273-nagios-jabbers2s.patch new file mode 100644 index 0000000..b0ec71f --- /dev/null +++ b/web/attachments/450273-nagios-jabbers2s.patch | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | --- check_tcp.c.orig 2010-07-18 02:21:29.000000000 +0200 | ||
| 2 | +++ check_tcp.c 2010-07-18 02:22:35.000000000 +0200 | ||
| 3 | @@ -169,6 +169,13 @@ | ||
| 4 | flags |= FLAG_HIDE_OUTPUT; | ||
| 5 | PORT = 5222; | ||
| 6 | } | ||
| 7 | + else if (!strncmp(SERVICE, "JABBERS2S", 9)) { | ||
| 8 | + SEND = "<stream:stream to=\'host\' xmlns=\'jabber:server\' xmlns:stream=\'http://etherx.jabber.org/streams\' version=\'1.0\'>\n"; | ||
| 9 | + EXPECT = "<?xml version=\'1.0\'?><stream:stream xmlns:stream=\'http://etherx.jabber.org/streams\' xmlns=\'jabber:server\'"; | ||
| 10 | + QUIT = "</stream:stream>\n"; | ||
| 11 | + flags |= FLAG_HIDE_OUTPUT; | ||
| 12 | + PORT = 5269; | ||
| 13 | + } | ||
| 14 | else if (!strncmp (SERVICE, "NNTPS", 5)) { | ||
| 15 | server_expect_count = 2; | ||
| 16 | server_expect[0] = "200"; | ||
diff --git a/web/attachments/453401-fsusage-config.patch b/web/attachments/453401-fsusage-config.patch new file mode 100644 index 0000000..52d860a --- /dev/null +++ b/web/attachments/453401-fsusage-config.patch | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | --- a/gl/m4/fsusage.m4 2012-09-19 10:30:40.000000000 +0200 | ||
| 2 | +++ b/gl/m4/fsusage.m4 2012-09-19 10:31:22.000000000 +0200 | ||
| 3 | @@ -47,12 +47,14 @@ | ||
| 4 | # SVR4 | ||
| 5 | AC_CACHE_CHECK([for statvfs function (SVR4)], [fu_cv_sys_stat_statvfs], | ||
| 6 | [AC_TRY_LINK([#include <sys/types.h> | ||
| 7 | -#if defined __GLIBC__ && defined __linux__ | ||
| 8 | -Do not use statvfs on systems with GNU libc on Linux, because that function | ||
| 9 | -stats all preceding entries in /proc/mounts, and that makes df hang if even | ||
| 10 | -one of the corresponding file systems is hard-mounted, but not available. | ||
| 11 | -statvfs in GNU libc on Hurd, BeOS, Haiku operates differently: it only makes | ||
| 12 | -a system call. | ||
| 13 | +#ifndef __UCLIBC__ | ||
| 14 | + #if defined __GLIBC__ && defined __linux__ | ||
| 15 | + Do not use statvfs on systems with GNU libc on Linux, because that function | ||
| 16 | + stats all preceding entries in /proc/mounts, and that makes df hang if even | ||
| 17 | + one of the corresponding file systems is hard-mounted, but not available. | ||
| 18 | + statvfs in GNU libc on Hurd, BeOS, Haiku operates differently: it only makes | ||
| 19 | + a system call. | ||
| 20 | + #endif | ||
| 21 | #endif | ||
| 22 | |||
| 23 | #ifdef __osf__ | ||
diff --git a/web/attachments/454482-check_ping.c b/web/attachments/454482-check_ping.c new file mode 100644 index 0000000..6e0d2ed --- /dev/null +++ b/web/attachments/454482-check_ping.c | |||
| @@ -0,0 +1,622 @@ | |||
| 1 | /***************************************************************************** | ||
| 2 | * | ||
| 3 | * Nagios check_ping plugin | ||
| 4 | * | ||
| 5 | * License: GPL | ||
| 6 | * Copyright (c) 2000-2007 Nagios Plugins Development Team | ||
| 7 | * | ||
| 8 | * Description: | ||
| 9 | * | ||
| 10 | * This file contains the check_ping plugin | ||
| 11 | * | ||
| 12 | * Use the ping program to check connection statistics for a remote host. | ||
| 13 | * | ||
| 14 | * | ||
| 15 | * This program is free software: you can redistribute it and/or modify | ||
| 16 | * it under the terms of the GNU General Public License as published by | ||
| 17 | * the Free Software Foundation, either version 3 of the License, or | ||
| 18 | * (at your option) any later version. | ||
| 19 | * | ||
| 20 | * This program is distributed in the hope that it will be useful, | ||
| 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 23 | * GNU General Public License for more details. | ||
| 24 | * | ||
| 25 | * You should have received a copy of the GNU General Public License | ||
| 26 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 27 | * | ||
| 28 | * Olli = additions from Oliver to specify the used Interface | ||
| 29 | * | ||
| 30 | *****************************************************************************/ | ||
| 31 | |||
| 32 | const char *progname = "check_ping"; | ||
| 33 | const char *copyright = "2000-2007"; | ||
| 34 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 35 | |||
| 36 | #include "common.h" | ||
| 37 | #include "netutils.h" | ||
| 38 | #include "popen.h" | ||
| 39 | #include "utils.h" | ||
| 40 | |||
| 41 | #define WARN_DUPLICATES "DUPLICATES FOUND! " | ||
| 42 | #define UNKNOWN_TRIP_TIME -1.0 /* -1 seconds */ | ||
| 43 | |||
| 44 | enum { | ||
| 45 | UNKNOWN_PACKET_LOSS = 200, /* 200% */ | ||
| 46 | DEFAULT_MAX_PACKETS = 5 /* default no. of ICMP ECHO packets */ | ||
| 47 | }; | ||
| 48 | |||
| 49 | int process_arguments (int, char **); | ||
| 50 | int get_threshold (char *, float *, int *); | ||
| 51 | int validate_arguments (void); | ||
| 52 | int run_ping (const char *cmd, const char *addr); | ||
| 53 | int error_scan (char buf[MAX_INPUT_BUFFER], const char *addr); | ||
| 54 | void print_usage (void); | ||
| 55 | void print_help (void); | ||
| 56 | |||
| 57 | int display_html = FALSE; | ||
| 58 | int wpl = UNKNOWN_PACKET_LOSS; | ||
| 59 | int cpl = UNKNOWN_PACKET_LOSS; | ||
| 60 | float wrta = UNKNOWN_TRIP_TIME; | ||
| 61 | float crta = UNKNOWN_TRIP_TIME; | ||
| 62 | char **addresses = NULL; | ||
| 63 | int n_addresses = 0; | ||
| 64 | int max_addr = 1; | ||
| 65 | int max_packets = -1; | ||
| 66 | int verbose = 0; | ||
| 67 | |||
| 68 | float rta = UNKNOWN_TRIP_TIME; | ||
| 69 | int pl = UNKNOWN_PACKET_LOSS; | ||
| 70 | |||
| 71 | char *warn_text; | ||
| 72 | |||
| 73 | char *interface = "\0"; /*Olli*/ | ||
| 74 | char *r_command = NULL; /*Olli*/ | ||
| 75 | |||
| 76 | int | ||
| 77 | main (int argc, char **argv) | ||
| 78 | { | ||
| 79 | char *cmd = NULL; | ||
| 80 | char *rawcmd = NULL; | ||
| 81 | int result = STATE_UNKNOWN; | ||
| 82 | int this_result = STATE_UNKNOWN; | ||
| 83 | int i; | ||
| 84 | |||
| 85 | setlocale (LC_ALL, ""); | ||
| 86 | setlocale (LC_NUMERIC, "C"); | ||
| 87 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 88 | textdomain (PACKAGE); | ||
| 89 | |||
| 90 | addresses = malloc (sizeof(char*) * max_addr); | ||
| 91 | addresses[0] = NULL; | ||
| 92 | |||
| 93 | /* Parse extra opts if any */ | ||
| 94 | argv=np_extra_opts (&argc, argv, progname); | ||
| 95 | |||
| 96 | if (process_arguments (argc, argv) == ERROR) | ||
| 97 | usage4 (_("Could not parse arguments")); | ||
| 98 | |||
| 99 | /* Set signal handling and alarm */ | ||
| 100 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { | ||
| 101 | usage4 (_("Cannot catch SIGALRM")); | ||
| 102 | } | ||
| 103 | |||
| 104 | /* If ./configure finds ping has timeout values, set plugin alarm slightly | ||
| 105 | * higher so that we can use response from command line ping */ | ||
| 106 | #if defined(PING_PACKETS_FIRST) && defined(PING_HAS_TIMEOUT) | ||
| 107 | alarm (timeout_interval + 1); | ||
| 108 | #else | ||
| 109 | alarm (timeout_interval); | ||
| 110 | #endif | ||
| 111 | |||
| 112 | for (i = 0 ; i < n_addresses ; i++) { | ||
| 113 | |||
| 114 | #ifdef PING6_COMMAND | ||
| 115 | if (address_family != AF_INET && is_inet6_addr(addresses[i])) | ||
| 116 | rawcmd = strdup(PING6_COMMAND); | ||
| 117 | else | ||
| 118 | rawcmd = strdup(PING_COMMAND); | ||
| 119 | #else | ||
| 120 | rawcmd = strdup(PING_COMMAND); | ||
| 121 | #endif | ||
| 122 | |||
| 123 | /* does the host address of number of packets argument come first? */ | ||
| 124 | #ifdef PING_PACKETS_FIRST | ||
| 125 | # ifdef PING_HAS_TIMEOUT | ||
| 126 | asprintf (&cmd, rawcmd, timeout_interval, max_packets, addresses[i]); | ||
| 127 | # else | ||
| 128 | asprintf (&cmd, rawcmd, max_packets, addresses[i]); | ||
| 129 | # endif | ||
| 130 | #else | ||
| 131 | asprintf (&cmd, rawcmd, addresses[i], max_packets); | ||
| 132 | #endif | ||
| 133 | |||
| 134 | if (verbose >= 2) | ||
| 135 | printf ("CMD: %s\n", cmd); | ||
| 136 | |||
| 137 | /* run the command */ | ||
| 138 | |||
| 139 | if ( strlen (interface) != 0) { | ||
| 140 | /*Olli*/ | ||
| 141 | asprintf (&r_command,"%s -I %s", cmd, interface); | ||
| 142 | /*Olli*/ | ||
| 143 | cmd = r_command; | ||
| 144 | /*Olli*/ | ||
| 145 | } | ||
| 146 | /*Olli*/ | ||
| 147 | |||
| 148 | this_result = run_ping (cmd, addresses[i]); | ||
| 149 | |||
| 150 | if (pl == UNKNOWN_PACKET_LOSS || rta < 0.0) { | ||
| 151 | printf ("%s\n", cmd); | ||
| 152 | die (STATE_UNKNOWN, | ||
| 153 | _("CRITICAL - Could not interpret output from ping command\n")); | ||
| 154 | } | ||
| 155 | |||
| 156 | if (pl >= cpl || rta >= crta || rta < 0) | ||
| 157 | this_result = STATE_CRITICAL; | ||
| 158 | else if (pl >= wpl || rta >= wrta) | ||
| 159 | this_result = STATE_WARNING; | ||
| 160 | else if (pl >= 0 && rta >= 0) | ||
| 161 | this_result = max_state (STATE_OK, this_result); | ||
| 162 | |||
| 163 | if (n_addresses > 1 && this_result != STATE_UNKNOWN) | ||
| 164 | die (STATE_OK, "%s is alive\n", addresses[i]); | ||
| 165 | |||
| 166 | if (display_html == TRUE) | ||
| 167 | printf ("<A HREF='%s/traceroute.cgi?%s'>", CGIURL, addresses[i]); | ||
| 168 | if (pl == 100) | ||
| 169 | printf (_("PING %s - %sPacket loss = %d%%"), state_text (this_result), warn_text, | ||
| 170 | pl); | ||
| 171 | else | ||
| 172 | printf (_("PING %s - %sPacket loss = %d%%, RTA = %2.2f ms"), | ||
| 173 | state_text (this_result), warn_text, pl, rta); | ||
| 174 | if (display_html == TRUE) | ||
| 175 | printf ("</A>"); | ||
| 176 | |||
| 177 | /* Print performance data */ | ||
| 178 | printf("|%s", fperfdata ("rta", (double) rta, "ms", | ||
| 179 | wrta>0?TRUE:FALSE, wrta, | ||
| 180 | crta>0?TRUE:FALSE, crta, | ||
| 181 | TRUE, 0, FALSE, 0)); | ||
| 182 | printf(" %s\n", perfdata ("pl", (long) pl, "%", | ||
| 183 | wpl>0?TRUE:FALSE, wpl, | ||
| 184 | cpl>0?TRUE:FALSE, cpl, | ||
| 185 | TRUE, 0, FALSE, 0)); | ||
| 186 | |||
| 187 | if (verbose >= 2) | ||
| 188 | printf ("%f:%d%% %f:%d%%\n", wrta, wpl, crta, cpl); | ||
| 189 | |||
| 190 | result = max_state (result, this_result); | ||
| 191 | free (rawcmd); | ||
| 192 | free (cmd); | ||
| 193 | } | ||
| 194 | |||
| 195 | return result; | ||
| 196 | } | ||
| 197 | |||
| 198 | |||
| 199 | |||
| 200 | /* process command-line arguments */ | ||
| 201 | int | ||
| 202 | process_arguments (int argc, char **argv) | ||
| 203 | { | ||
| 204 | int c = 1; | ||
| 205 | char *ptr; | ||
| 206 | |||
| 207 | int option = 0; | ||
| 208 | static struct option longopts[] = { | ||
| 209 | STD_LONG_OPTS, | ||
| 210 | {"packets", required_argument, 0, 'p'}, | ||
| 211 | {"nohtml", no_argument, 0, 'n'}, | ||
| 212 | {"link", no_argument, 0, 'L'}, | ||
| 213 | {"use-ipv4", no_argument, 0, '4'}, | ||
| 214 | {"use-ipv6", no_argument, 0, '6'}, | ||
| 215 | {"interface", required_argument, 0 ,'I'}, /*Olli*/ | ||
| 216 | {0, 0, 0, 0} | ||
| 217 | }; | ||
| 218 | |||
| 219 | if (argc < 2) | ||
| 220 | return ERROR; | ||
| 221 | |||
| 222 | for (c = 1; c < argc; c++) { | ||
| 223 | if (strcmp ("-to", argv[c]) == 0) | ||
| 224 | strcpy (argv[c], "-t"); | ||
| 225 | if (strcmp ("-nohtml", argv[c]) == 0) | ||
| 226 | strcpy (argv[c], "-n"); | ||
| 227 | } | ||
| 228 | |||
| 229 | while (1) { | ||
| 230 | c = getopt_long (argc, argv, "VvhnL46t:c:w:H:p:I:", longopts, &option); /*Olli*/ | ||
| 231 | |||
| 232 | if (c == -1 || c == EOF) | ||
| 233 | break; | ||
| 234 | |||
| 235 | switch (c) { | ||
| 236 | case '?': /* usage */ | ||
| 237 | usage5 (); | ||
| 238 | case 'h': /* help */ | ||
| 239 | print_help (); | ||
| 240 | exit (STATE_OK); | ||
| 241 | break; | ||
| 242 | case 'V': /* version */ | ||
| 243 | print_revision (progname, NP_VERSION); | ||
| 244 | exit (STATE_OK); | ||
| 245 | break; | ||
| 246 | case 't': /* timeout period */ | ||
| 247 | timeout_interval = atoi (optarg); | ||
| 248 | break; | ||
| 249 | case 'v': /* verbose mode */ | ||
| 250 | verbose++; | ||
| 251 | break; | ||
| 252 | case '4': /* IPv4 only */ | ||
| 253 | address_family = AF_INET; | ||
| 254 | break; | ||
| 255 | case '6': /* IPv6 only */ | ||
| 256 | #ifdef USE_IPV6 | ||
| 257 | address_family = AF_INET6; | ||
| 258 | #else | ||
| 259 | usage (_("IPv6 support not available\n")); | ||
| 260 | #endif | ||
| 261 | break; | ||
| 262 | case 'H': /* hostname */ | ||
| 263 | ptr=optarg; | ||
| 264 | while (1) { | ||
| 265 | n_addresses++; | ||
| 266 | if (n_addresses > max_addr) { | ||
| 267 | max_addr *= 2; | ||
| 268 | addresses = realloc (addresses, sizeof(char*) * max_addr); | ||
| 269 | if (addresses == NULL) | ||
| 270 | die (STATE_UNKNOWN, _("Could not realloc() addresses\n")); | ||
| 271 | } | ||
| 272 | addresses[n_addresses-1] = ptr; | ||
| 273 | if ((ptr = index (ptr, ','))) { | ||
| 274 | strcpy (ptr, ""); | ||
| 275 | ptr += sizeof(char); | ||
| 276 | } else { | ||
| 277 | break; | ||
| 278 | } | ||
| 279 | } | ||
| 280 | break; | ||
| 281 | case 'p': /* number of packets to send */ | ||
| 282 | if (is_intnonneg (optarg)) | ||
| 283 | max_packets = atoi (optarg); | ||
| 284 | else | ||
| 285 | usage2 (_("<max_packets> (%s) must be a non-negative number\n"), optarg); | ||
| 286 | break; | ||
| 287 | case 'n': /* no HTML */ | ||
| 288 | display_html = FALSE; | ||
| 289 | break; | ||
| 290 | case 'L': /* show HTML */ | ||
| 291 | display_html = TRUE; | ||
| 292 | break; | ||
| 293 | case 'c': | ||
| 294 | get_threshold (optarg, &crta, &cpl); | ||
| 295 | break; | ||
| 296 | case 'w': | ||
| 297 | get_threshold (optarg, &wrta, &wpl); | ||
| 298 | break; | ||
| 299 | case 'I': /* Interface used for Ping*/ /*Olli*/ | ||
| 300 | interface = optarg; /*Olli*/ | ||
| 301 | break; /*Olli*/ | ||
| 302 | } | ||
| 303 | } | ||
| 304 | |||
| 305 | c = optind; | ||
| 306 | if (c == argc) | ||
| 307 | return validate_arguments (); | ||
| 308 | |||
| 309 | if (addresses[0] == NULL) { | ||
| 310 | if (is_host (argv[c]) == FALSE) { | ||
| 311 | usage2 (_("Invalid hostname/address"), argv[c]); | ||
| 312 | } else { | ||
| 313 | addresses[0] = argv[c++]; | ||
| 314 | n_addresses++; | ||
| 315 | if (c == argc) | ||
| 316 | return validate_arguments (); | ||
| 317 | } | ||
| 318 | } | ||
| 319 | |||
| 320 | if (wpl == UNKNOWN_PACKET_LOSS) { | ||
| 321 | if (is_intpercent (argv[c]) == FALSE) { | ||
| 322 | printf (_("<wpl> (%s) must be an integer percentage\n"), argv[c]); | ||
| 323 | return ERROR; | ||
| 324 | } else { | ||
| 325 | wpl = atoi (argv[c++]); | ||
| 326 | if (c == argc) | ||
| 327 | return validate_arguments (); | ||
| 328 | } | ||
| 329 | } | ||
| 330 | |||
| 331 | if (cpl == UNKNOWN_PACKET_LOSS) { | ||
| 332 | if (is_intpercent (argv[c]) == FALSE) { | ||
| 333 | printf (_("<cpl> (%s) must be an integer percentage\n"), argv[c]); | ||
| 334 | return ERROR; | ||
| 335 | } else { | ||
| 336 | cpl = atoi (argv[c++]); | ||
| 337 | if (c == argc) | ||
| 338 | return validate_arguments (); | ||
| 339 | } | ||
| 340 | } | ||
| 341 | |||
| 342 | if (wrta < 0.0) { | ||
| 343 | if (is_negative (argv[c])) { | ||
| 344 | printf (_("<wrta> (%s) must be a non-negative number\n"), argv[c]); | ||
| 345 | return ERROR; | ||
| 346 | } else { | ||
| 347 | wrta = atof (argv[c++]); | ||
| 348 | if (c == argc) | ||
| 349 | return validate_arguments (); | ||
| 350 | } | ||
| 351 | } | ||
| 352 | |||
| 353 | if (crta < 0.0) { | ||
| 354 | if (is_negative (argv[c])) { | ||
| 355 | printf (_("<crta> (%s) must be a non-negative number\n"), argv[c]); | ||
| 356 | return ERROR; | ||
| 357 | } else { | ||
| 358 | crta = atof (argv[c++]); | ||
| 359 | if (c == argc) | ||
| 360 | return validate_arguments (); | ||
| 361 | } | ||
| 362 | } | ||
| 363 | |||
| 364 | if (max_packets == -1) { | ||
| 365 | if (is_intnonneg (argv[c])) { | ||
| 366 | max_packets = atoi (argv[c++]); | ||
| 367 | } else { | ||
| 368 | printf (_("<max_packets> (%s) must be a non-negative number\n"), argv[c]); | ||
| 369 | return ERROR; | ||
| 370 | } | ||
| 371 | } | ||
| 372 | |||
| 373 | return validate_arguments (); | ||
| 374 | } | ||
| 375 | |||
| 376 | |||
| 377 | |||
| 378 | int | ||
| 379 | get_threshold (char *arg, float *trta, int *tpl) | ||
| 380 | { | ||
| 381 | if (is_intnonneg (arg) && sscanf (arg, "%f", trta) == 1) | ||
| 382 | return OK; | ||
| 383 | else if (strpbrk (arg, ",:") && strstr (arg, "%") && sscanf (arg, "%f%*[:,]%d%%", trta, tpl) == 2) | ||
| 384 | return OK; | ||
| 385 | else if (strstr (arg, "%") && sscanf (arg, "%d%%", tpl) == 1) | ||
| 386 | return OK; | ||
| 387 | |||
| 388 | usage2 (_("%s: Warning threshold must be integer or percentage!\n\n"), arg); | ||
| 389 | return STATE_UNKNOWN; | ||
| 390 | } | ||
| 391 | |||
| 392 | int | ||
| 393 | validate_arguments () | ||
| 394 | { | ||
| 395 | float max_seconds; | ||
| 396 | int i; | ||
| 397 | |||
| 398 | if (wrta < 0.0) { | ||
| 399 | printf (_("<wrta> was not set\n")); | ||
| 400 | return ERROR; | ||
| 401 | } | ||
| 402 | else if (crta < 0.0) { | ||
| 403 | printf (_("<crta> was not set\n")); | ||
| 404 | return ERROR; | ||
| 405 | } | ||
| 406 | else if (wpl == UNKNOWN_PACKET_LOSS) { | ||
| 407 | printf (_("<wpl> was not set\n")); | ||
| 408 | return ERROR; | ||
| 409 | } | ||
| 410 | else if (cpl == UNKNOWN_PACKET_LOSS) { | ||
| 411 | printf (_("<cpl> was not set\n")); | ||
| 412 | return ERROR; | ||
| 413 | } | ||
| 414 | else if (wrta > crta) { | ||
| 415 | printf (_("<wrta> (%f) cannot be larger than <crta> (%f)\n"), wrta, crta); | ||
| 416 | return ERROR; | ||
| 417 | } | ||
| 418 | else if (wpl > cpl) { | ||
| 419 | printf (_("<wpl> (%d) cannot be larger than <cpl> (%d)\n"), wpl, cpl); | ||
| 420 | return ERROR; | ||
| 421 | } | ||
| 422 | |||
| 423 | if (max_packets == -1) | ||
| 424 | max_packets = DEFAULT_MAX_PACKETS; | ||
| 425 | |||
| 426 | max_seconds = crta / 1000.0 * max_packets + max_packets; | ||
| 427 | if (max_seconds > timeout_interval) | ||
| 428 | timeout_interval = (int)max_seconds; | ||
| 429 | |||
| 430 | for (i=0; i<n_addresses; i++) { | ||
| 431 | if (is_host(addresses[i]) == FALSE) | ||
| 432 | usage2 (_("Invalid hostname/address"), addresses[i]); | ||
| 433 | } | ||
| 434 | |||
| 435 | if (n_addresses == 0) { | ||
| 436 | usage (_("You must specify a server address or host name")); | ||
| 437 | } | ||
| 438 | |||
| 439 | return OK; | ||
| 440 | } | ||
| 441 | |||
| 442 | |||
| 443 | |||
| 444 | int | ||
| 445 | run_ping (const char *cmd, const char *addr) | ||
| 446 | { | ||
| 447 | char buf[MAX_INPUT_BUFFER]; | ||
| 448 | int result = STATE_UNKNOWN; | ||
| 449 | int match; | ||
| 450 | |||
| 451 | if ((child_process = spopen (cmd)) == NULL) | ||
| 452 | die (STATE_UNKNOWN, _("Could not open pipe: %s\n"), cmd); | ||
| 453 | |||
| 454 | child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 455 | if (child_stderr == NULL) | ||
| 456 | printf (_("Cannot open stderr for %s\n"), cmd); | ||
| 457 | |||
| 458 | while (fgets (buf, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 459 | |||
| 460 | if (verbose >= 3) | ||
| 461 | printf("Output: %s", buf); | ||
| 462 | |||
| 463 | result = max_state (result, error_scan (buf, addr)); | ||
| 464 | |||
| 465 | /* get the percent loss statistics */ | ||
| 466 | match = 0; | ||
| 467 | if((sscanf(buf,"%*d packets transmitted, %*d packets received, +%*d errors, %d%% packet loss%n",&pl,&match) && match) || | ||
| 468 | (sscanf(buf,"%*d packets transmitted, %*d packets received, +%*d duplicates, %d%% packet loss%n",&pl,&match) && match) || | ||
| 469 | (sscanf(buf,"%*d packets transmitted, %*d received, +%*d duplicates, %d%% packet loss%n",&pl,&match) && match) || | ||
| 470 | (sscanf(buf,"%*d packets transmitted, %*d packets received, %d%% packet loss%n",&pl,&match) && match) || | ||
| 471 | (sscanf(buf,"%*d packets transmitted, %*d packets received, %d%% loss, time%n",&pl,&match) && match) || | ||
| 472 | (sscanf(buf,"%*d packets transmitted, %*d received, %d%% loss, time%n",&pl,&match) && match) || | ||
| 473 | (sscanf(buf,"%*d packets transmitted, %*d received, %d%% packet loss, time%n",&pl,&match) && match) || | ||
| 474 | (sscanf(buf,"%*d packets transmitted, %*d received, +%*d errors, %d%% packet loss%n",&pl,&match) && match) || | ||
| 475 | (sscanf(buf,"%*d packets transmitted %*d received, +%*d errors, %d%% packet loss%n",&pl,&match) && match) | ||
| 476 | ) | ||
| 477 | continue; | ||
| 478 | |||
| 479 | /* get the round trip average */ | ||
| 480 | else | ||
| 481 | if((sscanf(buf,"round-trip min/avg/max = %*f/%f/%*f%n",&rta,&match) && match) || | ||
| 482 | (sscanf(buf,"round-trip min/avg/max/mdev = %*f/%f/%*f/%*f%n",&rta,&match) && match) || | ||
| 483 | (sscanf(buf,"round-trip min/avg/max/sdev = %*f/%f/%*f/%*f%n",&rta,&match) && match) || | ||
| 484 | (sscanf(buf,"round-trip min/avg/max/stddev = %*f/%f/%*f/%*f%n",&rta,&match) && match) || | ||
| 485 | (sscanf(buf,"round-trip min/avg/max/std-dev = %*f/%f/%*f/%*f%n",&rta,&match) && match) || | ||
| 486 | (sscanf(buf,"round-trip (ms) min/avg/max = %*f/%f/%*f%n",&rta,&match) && match) || | ||
| 487 | (sscanf(buf,"round-trip (ms) min/avg/max/stddev = %*f/%f/%*f/%*f%n",&rta,&match) && match) || | ||
| 488 | (sscanf(buf,"rtt min/avg/max/mdev = %*f/%f/%*f/%*f ms%n",&rta,&match) && match)) | ||
| 489 | continue; | ||
| 490 | } | ||
| 491 | |||
| 492 | /* this is needed because there is no rta if all packets are lost */ | ||
| 493 | if (pl == 100) | ||
| 494 | rta = crta; | ||
| 495 | |||
| 496 | /* check stderr, setting at least WARNING if there is output here */ | ||
| 497 | /* Add warning into warn_text */ | ||
| 498 | while (fgets (buf, MAX_INPUT_BUFFER - 1, child_stderr)) { | ||
| 499 | if (! strstr(buf,"WARNING - no SO_TIMESTAMP support, falling back to SIOCGSTAMP")) { | ||
| 500 | if (verbose >= 3) { | ||
| 501 | printf("Got stderr: %s", buf); | ||
| 502 | } | ||
| 503 | if ((result=error_scan(buf, addr)) == STATE_OK) { | ||
| 504 | result = STATE_WARNING; | ||
| 505 | if (warn_text == NULL) { | ||
| 506 | warn_text = strdup(_("System call sent warnings to stderr ")); | ||
| 507 | } else { | ||
| 508 | asprintf(&warn_text, "%s %s", warn_text, _("System call sent warnings to stderr ")); | ||
| 509 | } | ||
| 510 | } | ||
| 511 | } | ||
| 512 | } | ||
| 513 | |||
| 514 | (void) fclose (child_stderr); | ||
| 515 | |||
| 516 | |||
| 517 | spclose (child_process); | ||
| 518 | |||
| 519 | if (warn_text == NULL) | ||
| 520 | warn_text = strdup(""); | ||
| 521 | |||
| 522 | return result; | ||
| 523 | } | ||
| 524 | |||
| 525 | |||
| 526 | |||
| 527 | int | ||
| 528 | error_scan (char buf[MAX_INPUT_BUFFER], const char *addr) | ||
| 529 | { | ||
| 530 | if (strstr (buf, "Network is unreachable") || | ||
| 531 | strstr (buf, "Destination Net Unreachable") | ||
| 532 | ) | ||
| 533 | die (STATE_CRITICAL, _("CRITICAL - Network Unreachable (%s)\n"), addr); | ||
| 534 | else if (strstr (buf, "Destination Host Unreachable")) | ||
| 535 | die (STATE_CRITICAL, _("CRITICAL - Host Unreachable (%s)\n"), addr); | ||
| 536 | else if (strstr (buf, "Destination Port Unreachable")) | ||
| 537 | die (STATE_CRITICAL, _("CRITICAL - Bogus ICMP: Port Unreachable (%s)\n"), addr); | ||
| 538 | else if (strstr (buf, "Destination Protocol Unreachable")) | ||
| 539 | die (STATE_CRITICAL, _("CRITICAL - Bogus ICMP: Protocol Unreachable (%s)\n"), addr); | ||
| 540 | else if (strstr (buf, "Destination Net Prohibited")) | ||
| 541 | die (STATE_CRITICAL, _("CRITICAL - Network Prohibited (%s)\n"), addr); | ||
| 542 | else if (strstr (buf, "Destination Host Prohibited")) | ||
| 543 | die (STATE_CRITICAL, _("CRITICAL - Host Prohibited (%s)\n"), addr); | ||
| 544 | else if (strstr (buf, "Packet filtered")) | ||
| 545 | die (STATE_CRITICAL, _("CRITICAL - Packet Filtered (%s)\n"), addr); | ||
| 546 | else if (strstr (buf, "unknown host" )) | ||
| 547 | die (STATE_CRITICAL, _("CRITICAL - Host not found (%s)\n"), addr); | ||
| 548 | else if (strstr (buf, "Time to live exceeded")) | ||
| 549 | die (STATE_CRITICAL, _("CRITICAL - Time to live exceeded (%s)\n"), addr); | ||
| 550 | else if (strstr (buf, "Destination unreachable: ")) | ||
| 551 | die (STATE_CRITICAL, _("CRITICAL - Destination Unreachable (%s)\n"), addr); | ||
| 552 | |||
| 553 | if (strstr (buf, "(DUP!)") || strstr (buf, "DUPLICATES FOUND")) { | ||
| 554 | if (warn_text == NULL) | ||
| 555 | warn_text = strdup (_(WARN_DUPLICATES)); | ||
| 556 | else if (! strstr (warn_text, _(WARN_DUPLICATES)) && | ||
| 557 | asprintf (&warn_text, "%s %s", warn_text, _(WARN_DUPLICATES)) == -1) | ||
| 558 | die (STATE_UNKNOWN, _("Unable to realloc warn_text\n")); | ||
| 559 | return (STATE_WARNING); | ||
| 560 | } | ||
| 561 | |||
| 562 | return (STATE_OK); | ||
| 563 | } | ||
| 564 | |||
| 565 | |||
| 566 | |||
| 567 | void | ||
| 568 | print_help (void) | ||
| 569 | { | ||
| 570 | print_revision (progname, NP_VERSION); | ||
| 571 | |||
| 572 | printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n"); | ||
| 573 | printf (COPYRIGHT, copyright, email); | ||
| 574 | |||
| 575 | printf (_("Use ping to check connection statistics for a remote host.")); | ||
| 576 | |||
| 577 | printf ("\n\n"); | ||
| 578 | |||
| 579 | print_usage (); | ||
| 580 | |||
| 581 | printf (UT_HELP_VRSN); | ||
| 582 | printf (UT_EXTRA_OPTS); | ||
| 583 | |||
| 584 | printf (UT_IPv46); | ||
| 585 | |||
| 586 | printf (" %s\n", "-H, --hostname=HOST"); | ||
| 587 | printf (" %s\n", _("host to ping")); | ||
| 588 | printf (" %s\n", "-w, --warning=THRESHOLD"); | ||
| 589 | printf (" %s\n", _("warning threshold pair")); | ||
| 590 | printf (" %s\n", "-c, --critical=THRESHOLD"); | ||
| 591 | printf (" %s\n", _("critical threshold pair")); | ||
| 592 | printf (" %s\n", "-p, --packets=INTEGER"); | ||
| 593 | printf (" %s ", _("number of ICMP ECHO packets to send")); | ||
| 594 | printf (_("(Default: %d)\n"), DEFAULT_MAX_PACKETS); | ||
| 595 | printf (" %s\n", "-I, --interface=INTERFACE"); /*Olli*/ | ||
| 596 | printf (" %s ", _("Specify the interface which is used for pinging (Requires iputils-ping)")); /*Olli*/ | ||
| 597 | printf (" %s\n", "-L, --link"); | ||
| 598 | printf (" %s\n", _("show HTML in the plugin output (obsoleted by urlize)")); | ||
| 599 | |||
| 600 | printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); | ||
| 601 | |||
| 602 | printf ("\n"); | ||
| 603 | printf ("%s\n", _("THRESHOLD is <rta>,<pl>% where <rta> is the round trip average travel")); | ||
| 604 | printf ("%s\n", _("time (ms) which triggers a WARNING or CRITICAL state, and <pl> is the")); | ||
| 605 | printf ("%s\n", _("percentage of packet loss to trigger an alarm state.")); | ||
| 606 | |||
| 607 | printf ("\n"); | ||
| 608 | printf ("%s\n", _("This plugin uses the ping command to probe the specified host for packet loss")); | ||
| 609 | printf ("%s\n", _("(percentage) and round trip average (milliseconds). It can produce HTML output")); | ||
| 610 | printf ("%s\n", _("linking to a traceroute CGI contributed by Ian Cass. The CGI can be found in")); | ||
| 611 | printf ("%s\n", _("the contrib area of the downloads section at http://www.nagios.org/")); | ||
| 612 | |||
| 613 | printf (UT_SUPPORT); | ||
| 614 | } | ||
| 615 | |||
| 616 | void | ||
| 617 | print_usage (void) | ||
| 618 | { | ||
| 619 | printf ("%s\n", _("Usage:")); | ||
| 620 | printf ("%s -H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n", progname); | ||
| 621 | printf (" [-p packets] [-t timeout] [-4|-6] [-I interface] \n"); /*Olli*/ | ||
| 622 | } | ||
diff --git a/web/attachments/456808-bug_check_snmp.JPG b/web/attachments/456808-bug_check_snmp.JPG new file mode 100644 index 0000000..df04f7f --- /dev/null +++ b/web/attachments/456808-bug_check_snmp.JPG | |||
| Binary files differ | |||
diff --git a/web/attachments/456909-nagios-plugins-metadata.patch b/web/attachments/456909-nagios-plugins-metadata.patch new file mode 100644 index 0000000..421a1fa --- /dev/null +++ b/web/attachments/456909-nagios-plugins-metadata.patch | |||
| @@ -0,0 +1,315 @@ | |||
| 1 | commit ba0449fe8534bdcc03d3a15e36c8af711a2a72d2 | ||
| 2 | Author: Dejan Muhamedagic <dejan@suse.de> | ||
| 3 | Date: Thu Nov 22 15:47:27 2012 +0100 | ||
| 4 | |||
| 5 | Support for meta-data (XML) | ||
| 6 | |||
| 7 | Enables nagios plugins to be deployed as resource agents with | ||
| 8 | pacemaker clusters. The meta-data is defined here: | ||
| 9 | |||
| 10 | https://github.com/ClusterLabs/resource-agents/blob/master/heartbeat/ra-api-1.dtd | ||
| 11 | |||
| 12 | This commit does not change behaviour of any plugins. | ||
| 13 | |||
| 14 | diff --git a/plugins/Makefile.am b/plugins/Makefile.am | ||
| 15 | index 0eb0255..0ef8d50 100644 | ||
| 16 | --- a/plugins/Makefile.am | ||
| 17 | +++ b/plugins/Makefile.am | ||
| 18 | @@ -39,12 +39,12 @@ EXTRA_PROGRAMS = check_mysql check_radius check_pgsql check_snmp check_hpjd \ | ||
| 19 | check_nagios check_by_ssh check_dns check_nt check_ide_smart \ | ||
| 20 | check_procs check_mysql_query check_apt check_dbi | ||
| 21 | |||
| 22 | -EXTRA_DIST = t tests utils.c netutils.c sslutils.c popen.c utils.h netutils.h \ | ||
| 23 | - popen.h common.h runcmd.c runcmd.h | ||
| 24 | +EXTRA_DIST = t tests utils.c netutils.c sslutils.c popen.c help.c \ | ||
| 25 | + utils.h netutils.h popen.h common.h runcmd.c runcmd.h help.h | ||
| 26 | |||
| 27 | PLUGINHDRS = common.h | ||
| 28 | |||
| 29 | -BASEOBJS = utils.o ../lib/libnagiosplug.a ../gl/libgnu.a | ||
| 30 | +BASEOBJS = utils.o help.o ../lib/libnagiosplug.a ../gl/libgnu.a | ||
| 31 | NETOBJS = netutils.o $(BASEOBJS) $(EXTRA_NETOBJS) | ||
| 32 | SSLOBJS = sslutils.o | ||
| 33 | NETLIBS = $(NETOBJS) $(SOCKETLIBS) | ||
| 34 | @@ -159,6 +159,8 @@ runcmd.o: runcmd.c runcmd.h $(PLUGINHDRS) | ||
| 35 | |||
| 36 | utils.o: utils.c utils.h $(PLUGINHDRS) | ||
| 37 | |||
| 38 | +help.o: help.c help.h | ||
| 39 | + | ||
| 40 | netutils.o: netutils.c netutils.h $(PLUGINHDRS) | ||
| 41 | sslutils.o: sslutils.c netutils.h $(PLUGINHDRS) | ||
| 42 | |||
| 43 | diff --git a/plugins/help.c b/plugins/help.c | ||
| 44 | new file mode 100644 | ||
| 45 | index 0000000..214707e | ||
| 46 | --- /dev/null | ||
| 47 | +++ b/plugins/help.c | ||
| 48 | @@ -0,0 +1,140 @@ | ||
| 49 | +/* | ||
| 50 | + * help.c: custom help functions to print help text and XML | ||
| 51 | + * meta-data | ||
| 52 | + * | ||
| 53 | + * Copyright (C) 2012 Dejan Muhamedagic <dejan@hello-penguin.com> | ||
| 54 | + * | ||
| 55 | + * | ||
| 56 | + * This library is free software; you can redistribute it and/or | ||
| 57 | + * modify it under the terms of the GNU Lesser General Public | ||
| 58 | + * License as published by the Free Software Foundation; either | ||
| 59 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 60 | + * | ||
| 61 | + * This library is distributed in the hope that it will be useful, | ||
| 62 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 63 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 64 | + * Lesser General Public License for more details. | ||
| 65 | + * | ||
| 66 | + * You should have received a copy of the GNU Lesser General Public | ||
| 67 | + * License along with this library; if not, write to the Free Software | ||
| 68 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 69 | + * | ||
| 70 | + */ | ||
| 71 | + | ||
| 72 | +#include "common.h" | ||
| 73 | +#include "help.h" | ||
| 74 | + | ||
| 75 | +static void meta_long_desc_from_short(const char *, const char *); | ||
| 76 | +static void meta_long_desc(const char *, const char *); | ||
| 77 | +static void meta_short_desc(const char *, const char *); | ||
| 78 | +static void meta_param(const char *, struct parameter_help *); | ||
| 79 | +static void indent(const char *, const char *); | ||
| 80 | + | ||
| 81 | +static void | ||
| 82 | +meta_long_desc_from_short(const char *lang, const char *s) | ||
| 83 | +{ | ||
| 84 | + printf(XML_LONGDESC_BEGIN, lang); | ||
| 85 | + printf("%s\n", _(s)); | ||
| 86 | + printf(XML_LONGDESC_END); | ||
| 87 | +} | ||
| 88 | + | ||
| 89 | +static void | ||
| 90 | +meta_long_desc(const char *lang, const char *s) | ||
| 91 | +{ | ||
| 92 | + printf(XML_LONGDESC_BEGIN, lang); | ||
| 93 | + printf("%s", _(s)); | ||
| 94 | + printf(XML_LONGDESC_END); | ||
| 95 | +} | ||
| 96 | + | ||
| 97 | +static void | ||
| 98 | +meta_short_desc(const char *lang, const char *s) | ||
| 99 | +{ | ||
| 100 | + printf(XML_SHORTDESC_BEGIN, lang); | ||
| 101 | + printf("%s", _(s)); | ||
| 102 | + printf(XML_SHORTDESC_END); | ||
| 103 | +} | ||
| 104 | + | ||
| 105 | +static void | ||
| 106 | +meta_param(const char *lang, struct parameter_help *ph) | ||
| 107 | +{ | ||
| 108 | + printf(XML_PARAMETER_BEGIN, ph->name, ph->unique, ph->required); | ||
| 109 | + if (ph->long_desc) { | ||
| 110 | + meta_long_desc(lang, ph->long_desc); | ||
| 111 | + } else { | ||
| 112 | + meta_long_desc_from_short(lang, ph->short_desc); | ||
| 113 | + } | ||
| 114 | + meta_short_desc(lang, ph->short_desc); | ||
| 115 | + printf(XML_PARAMETER_CONTENT, ph->type, ph->dflt_value); | ||
| 116 | + printf(XML_PARAMETER_END); | ||
| 117 | +} | ||
| 118 | + | ||
| 119 | +void | ||
| 120 | +print_meta_data(struct help_head *hh, struct parameter_help *ph) | ||
| 121 | +{ | ||
| 122 | + struct parameter_help *p; | ||
| 123 | + | ||
| 124 | + printf(XML_START, hh->name); | ||
| 125 | + if (hh->long_desc) { | ||
| 126 | + meta_long_desc(LANG, hh->long_desc); | ||
| 127 | + } else { | ||
| 128 | + meta_long_desc_from_short(LANG, hh->short_desc); | ||
| 129 | + } | ||
| 130 | + meta_short_desc(LANG, hh->short_desc); | ||
| 131 | + printf("\n"); | ||
| 132 | + printf(XML_PARAMETERS_BEGIN); | ||
| 133 | + printf("\n"); | ||
| 134 | + for (p = ph; p->short_desc; p++) { | ||
| 135 | + meta_param(LANG, p); | ||
| 136 | + printf("\n"); | ||
| 137 | + } | ||
| 138 | + printf(XML_PARAMETERS_END); | ||
| 139 | + printf("\n"); | ||
| 140 | + printf(XML_ACTIONS); | ||
| 141 | + printf("\n"); | ||
| 142 | + printf(XML_END); | ||
| 143 | +} | ||
| 144 | + | ||
| 145 | +static void | ||
| 146 | +indent(const char *s, const char *tab) | ||
| 147 | +{ | ||
| 148 | + const char *p, *q; | ||
| 149 | + int len; | ||
| 150 | + | ||
| 151 | + if (!s ) | ||
| 152 | + return; | ||
| 153 | + for (p = s; p < s+strlen(s) && *p; p = q+1) { | ||
| 154 | + q = strchr(p, '\n'); | ||
| 155 | + if( q ) { | ||
| 156 | + printf("%s%.*s", tab, q-p+1, p); | ||
| 157 | + } else { | ||
| 158 | + printf("%s%s\n", tab, p); | ||
| 159 | + } | ||
| 160 | + } | ||
| 161 | +} | ||
| 162 | + | ||
| 163 | +void | ||
| 164 | +print_help_head(struct help_head *hh) | ||
| 165 | +{ | ||
| 166 | + if (hh->long_desc) { | ||
| 167 | + printf(_(hh->long_desc)); | ||
| 168 | + } else { | ||
| 169 | + printf("%s\n", _(hh->short_desc)); | ||
| 170 | + } | ||
| 171 | +} | ||
| 172 | + | ||
| 173 | +void | ||
| 174 | +print_parameters_help(struct parameter_help *ph) | ||
| 175 | +{ | ||
| 176 | + struct parameter_help *p; | ||
| 177 | + | ||
| 178 | + for (p = ph; p->short_desc; p++) { | ||
| 179 | + if (p->short_opt) { | ||
| 180 | + printf(" -%c, --%s=%s\n", (unsigned char)(p->short_opt), | ||
| 181 | + p->name, p->value_desc); | ||
| 182 | + } else { | ||
| 183 | + printf(" --%s=%s\n", p->name, p->value_desc); | ||
| 184 | + } | ||
| 185 | + indent(_(p->long_desc), " "); | ||
| 186 | + printf(UT_METADATA); | ||
| 187 | + } | ||
| 188 | +} | ||
| 189 | diff --git a/plugins/help.h b/plugins/help.h | ||
| 190 | new file mode 100644 | ||
| 191 | index 0000000..4486424 | ||
| 192 | --- /dev/null | ||
| 193 | +++ b/plugins/help.h | ||
| 194 | @@ -0,0 +1,108 @@ | ||
| 195 | +/* | ||
| 196 | + * help.h: custom help functions to print help text and XML | ||
| 197 | + * meta-data | ||
| 198 | + * | ||
| 199 | + * Copyright (C) 2012 Dejan Muhamedagic <dejan@hello-penguin.com> | ||
| 200 | + * | ||
| 201 | + * | ||
| 202 | + * This library is free software; you can redistribute it and/or | ||
| 203 | + * modify it under the terms of the GNU Lesser General Public | ||
| 204 | + * License as published by the Free Software Foundation; either | ||
| 205 | + * version 2.1 of the License, or (at your option) any later version. | ||
| 206 | + * | ||
| 207 | + * This library is distributed in the hope that it will be useful, | ||
| 208 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 209 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 210 | + * Lesser General Public License for more details. | ||
| 211 | + * | ||
| 212 | + * You should have received a copy of the GNU Lesser General Public | ||
| 213 | + * License along with this library; if not, write to the Free Software | ||
| 214 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 215 | + * | ||
| 216 | + */ | ||
| 217 | + | ||
| 218 | +#ifndef NP_HELP_H | ||
| 219 | +#define NP_HELP_H | ||
| 220 | +/* Header file for nagios plugins help.c */ | ||
| 221 | + | ||
| 222 | +/* This file should be included in all plugins */ | ||
| 223 | + | ||
| 224 | +#include <stdio.h> | ||
| 225 | +#include <stdlib.h> | ||
| 226 | +#include <string.h> | ||
| 227 | +#include <getopt.h> | ||
| 228 | + | ||
| 229 | +/* | ||
| 230 | + * The generic constants for XML | ||
| 231 | + */ | ||
| 232 | + | ||
| 233 | +#define XML_START \ | ||
| 234 | + "<?xml version=\"1.0\"?>\n" \ | ||
| 235 | + "<!DOCTYPE resource-agent SYSTEM \"ra-api-1.dtd\">\n" \ | ||
| 236 | + "<resource-agent name=\"%s\">\n" \ | ||
| 237 | + "<version>1.0</version>\n\n" | ||
| 238 | +#define XML_ACTIONS \ | ||
| 239 | + "<actions>\n" \ | ||
| 240 | + "<action name=\"start\" timeout=\"20\" />\n" \ | ||
| 241 | + "<action name=\"stop\" timeout=\"15\" />\n" \ | ||
| 242 | + "<action name=\"status\" timeout=\"20\" />\n" \ | ||
| 243 | + "<action name=\"monitor\" timeout=\"20\" interval=\"60\" />\n" \ | ||
| 244 | + "<action name=\"meta-data\" timeout=\"15\" />\n" \ | ||
| 245 | + "</actions>\n" | ||
| 246 | +#define XML_END \ | ||
| 247 | + "</resource-agent>\n" | ||
| 248 | + | ||
| 249 | +/* <parameters>?</parameters> */ | ||
| 250 | +#define XML_PARAMETERS_BEGIN "<parameters>\n" | ||
| 251 | +#define XML_PARAMETERS_END "</parameters>\n" | ||
| 252 | + | ||
| 253 | +/* <parameter name="ipaddr" required="1" unique="1"> | ||
| 254 | + <content type="string" default="value"/> | ||
| 255 | + ? | ||
| 256 | + </parameter> | ||
| 257 | + */ | ||
| 258 | +#define XML_PARAMETER_BEGIN \ | ||
| 259 | + "<parameter name=\"%s\" unique=\"%d\" required=\"%d\">\n" | ||
| 260 | +#define XML_PARAMETER_CONTENT \ | ||
| 261 | + "<content type=\"%s\" default=\"%s\" />\n" | ||
| 262 | +#define XML_PARAMETER_END "</parameter>\n" | ||
| 263 | + | ||
| 264 | +/* <shortdesc lang="en">?</shortdesc> */ | ||
| 265 | +#define XML_SHORTDESC_BEGIN \ | ||
| 266 | + "<shortdesc lang=\"%s\">" | ||
| 267 | +#define XML_SHORTDESC_END "</shortdesc>\n" | ||
| 268 | + | ||
| 269 | +/* <longdesc lang="en">?</longdesc> */ | ||
| 270 | +#define XML_LONGDESC_BEGIN \ | ||
| 271 | + "<longdesc lang=\"%s\">\n" | ||
| 272 | +#define XML_LONGDESC_END "</longdesc>\n" | ||
| 273 | + | ||
| 274 | +#define LANG "en" | ||
| 275 | + | ||
| 276 | +#define UT_METADATA _("\ | ||
| 277 | + --metadata\n\ | ||
| 278 | + Print resource agent meta-data.\n") | ||
| 279 | + | ||
| 280 | +struct parameter_help { | ||
| 281 | + const char *name; | ||
| 282 | + int short_opt; | ||
| 283 | + const char *short_desc; | ||
| 284 | + int unique; | ||
| 285 | + int required; | ||
| 286 | + const char *type; | ||
| 287 | + const char *dflt_value; | ||
| 288 | + const char *value_desc; | ||
| 289 | + const char *long_desc; | ||
| 290 | +}; | ||
| 291 | + | ||
| 292 | +struct help_head { | ||
| 293 | + const char *name; | ||
| 294 | + const char *short_desc; | ||
| 295 | + const char *long_desc; | ||
| 296 | +}; | ||
| 297 | + | ||
| 298 | +void print_meta_data(struct help_head *, struct parameter_help *); | ||
| 299 | +void print_parameters_help(struct parameter_help *); | ||
| 300 | +void print_help_head(struct help_head *); | ||
| 301 | + | ||
| 302 | +#endif /* NP_HELP_H */ | ||
| 303 | diff --git a/plugins/utils.h b/plugins/utils.h | ||
| 304 | index 822be94..f0d0e50 100644 | ||
| 305 | --- a/plugins/utils.h | ||
| 306 | +++ b/plugins/utils.h | ||
| 307 | @@ -24,6 +24,8 @@ suite of plugins. */ | ||
| 308 | #define np_extra_opts(acptr,av,pr) av | ||
| 309 | #endif | ||
| 310 | |||
| 311 | +#include "help.h" | ||
| 312 | + | ||
| 313 | /* Standardize version information, termination */ | ||
| 314 | |||
| 315 | void support (void); | ||
diff --git a/web/attachments/456910-nagios-plugins-check_http_metadata.patch b/web/attachments/456910-nagios-plugins-check_http_metadata.patch new file mode 100644 index 0000000..2cda3e5 --- /dev/null +++ b/web/attachments/456910-nagios-plugins-check_http_metadata.patch | |||
| @@ -0,0 +1,351 @@ | |||
| 1 | commit 77d700600f51880583484b0e7e56b0c896e0d132 | ||
| 2 | Author: Dejan Muhamedagic <dejan@suse.de> | ||
| 3 | Date: Fri Nov 23 11:45:14 2012 +0100 | ||
| 4 | |||
| 5 | check_http: add support for metadata | ||
| 6 | |||
| 7 | diff --git a/plugins/check_http.c b/plugins/check_http.c | ||
| 8 | index 9231a55..cc9f39f 100644 | ||
| 9 | --- a/plugins/check_http.c | ||
| 10 | +++ b/plugins/check_http.c | ||
| 11 | @@ -135,6 +135,227 @@ char *perfd_size (int page_len); | ||
| 12 | void print_help (void); | ||
| 13 | void print_usage (void); | ||
| 14 | |||
| 15 | +static struct help_head resource_meta = { | ||
| 16 | + "http", | ||
| 17 | + "Test the HTTP service", | ||
| 18 | + "This plugin tests the HTTP service on the specified host. It can test\n" | ||
| 19 | + "normal (http) and secure (https) servers, follow redirects, search for\n" | ||
| 20 | + "strings and regular expressions, check connection times, and report on\n" | ||
| 21 | + "certificate expiration times.\n" | ||
| 22 | +}; | ||
| 23 | + | ||
| 24 | +static struct parameter_help options_help[] = { | ||
| 25 | + /* hostname */ | ||
| 26 | + { | ||
| 27 | + "hostname", 'H', | ||
| 28 | + "Host name", | ||
| 29 | + 0, 1, "string", "", "ADDRESS", | ||
| 30 | + "Host name argument for servers using host headers (virtual host)\n" | ||
| 31 | + "Append a port to include it in the header (eg: example.com:5000)\n" | ||
| 32 | + }, | ||
| 33 | + /* IP-address */ | ||
| 34 | + { | ||
| 35 | + "IP-address", 'I', | ||
| 36 | + "IP address or name", | ||
| 37 | + 0, 0, "string", "", "ADDRESS", | ||
| 38 | + "IP address or name (use numeric address if possible to bypass DNS lookup).\n" | ||
| 39 | + }, | ||
| 40 | + /* port */ | ||
| 41 | + { | ||
| 42 | + "port", 'p', | ||
| 43 | + "Port number (default: 80)", | ||
| 44 | + 0, 0, "integer", "80", "INTEGER", | ||
| 45 | + }, | ||
| 46 | + /* use-ipv4 */ | ||
| 47 | + { | ||
| 48 | + "use-ipv4", '4', | ||
| 49 | + "Use IPv4 connection", | ||
| 50 | + 0, 0, "boolean", "false", "", | ||
| 51 | + }, | ||
| 52 | + /* use-ipv6 */ | ||
| 53 | + { | ||
| 54 | + "use-ipv6", '6', | ||
| 55 | + "Use IPv6 connection", | ||
| 56 | + 0, 0, "boolean", "false", "", | ||
| 57 | + }, | ||
| 58 | +#ifdef HAVE_SSL | ||
| 59 | + /* ssl */ | ||
| 60 | + { | ||
| 61 | + "ssl", 'S', | ||
| 62 | + "Connect via SSL.", | ||
| 63 | + 0, 0, "string", "", "VERSION", | ||
| 64 | + "Connect via SSL. Port defaults to 443. VERSION is optional, and prevents\n" | ||
| 65 | + "auto-negotiation (1 = TLSv1, 2 = SSLv2, 3 = SSLv3).\n" | ||
| 66 | + }, | ||
| 67 | + /* sni */ | ||
| 68 | + { | ||
| 69 | + "sni", 0, | ||
| 70 | + "Enable SSL/TLS hostname extension support (SNI)", | ||
| 71 | + 0, 0, "boolean", "false", "", | ||
| 72 | + }, | ||
| 73 | + /* certificate */ | ||
| 74 | + { | ||
| 75 | + "certificate", 'C', | ||
| 76 | + "Minimum number of days a certificate has to be valid", | ||
| 77 | + 0, 0, "integer", "", "INTEGER", | ||
| 78 | + "Minimum number of days a certificate has to be valid. Port defaults to 443\n" | ||
| 79 | + "(when this option is used the URL is not checked.)\n" | ||
| 80 | + }, | ||
| 81 | +#endif | ||
| 82 | + /* expect */ | ||
| 83 | + { | ||
| 84 | + "expect", 'e', | ||
| 85 | + "list of strings of which at least one must match", | ||
| 86 | + 0, 0, "string", "", "STRING", | ||
| 87 | + "Comma-delimited list of strings, at least one of them is expected in\n" | ||
| 88 | + "the first (status) line of the server response (default: HTTP/1.)\n" | ||
| 89 | + "If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)\n" | ||
| 90 | + }, | ||
| 91 | + /* string */ | ||
| 92 | + { | ||
| 93 | + "string", 's', | ||
| 94 | + "String to expect in the content", | ||
| 95 | + 0, 0, "string", "", "STRING", | ||
| 96 | + }, | ||
| 97 | + /* url */ | ||
| 98 | + { | ||
| 99 | + "url", 'u', | ||
| 100 | + "URL to GET or POST (default: /)", | ||
| 101 | + 0, 0, "string", "/", "PATH", | ||
| 102 | + }, | ||
| 103 | + /* post */ | ||
| 104 | + { | ||
| 105 | + "post", 'P', | ||
| 106 | + "URL encoded http POST data", | ||
| 107 | + 0, 0, "string", "", "STRING", | ||
| 108 | + }, | ||
| 109 | + /* method */ | ||
| 110 | + { | ||
| 111 | + "method", 'j', | ||
| 112 | + "Set HTTP method.", | ||
| 113 | + 0, 0, "string", "", "STRING", | ||
| 114 | + }, | ||
| 115 | + /* no-body */ | ||
| 116 | + { | ||
| 117 | + "no-body", 'N', | ||
| 118 | + "Don't wait for document body", | ||
| 119 | + 0, 0, "boolean", "false", "", | ||
| 120 | + "Don't wait for document body: stop reading after headers.\n" | ||
| 121 | + "(Note that this still does an HTTP GET or POST, not a HEAD.)\n" | ||
| 122 | + }, | ||
| 123 | + /* max-age */ | ||
| 124 | + { | ||
| 125 | + "max-age", 'M', | ||
| 126 | + "maximum age of document", | ||
| 127 | + 0, 0, "string", "", "SECONDS", | ||
| 128 | + "Warn if document is more than SECONDS old. the number can also be of\n" | ||
| 129 | + "the form \"10m\" for minutes, \"10h\" for hours, or \"10d\" for days.\n" | ||
| 130 | + }, | ||
| 131 | + /* content-type */ | ||
| 132 | + { | ||
| 133 | + "content-type", 'T', | ||
| 134 | + "specify Content-Type header media type when POSTing", | ||
| 135 | + 0, 0, "string", "", "STRING", | ||
| 136 | + }, | ||
| 137 | + /* linespan */ | ||
| 138 | + { | ||
| 139 | + "linespan", 'l', | ||
| 140 | + "Allow regex to span newlines (must precede -r or -R)", | ||
| 141 | + 0, 0, "boolean", "false", "", | ||
| 142 | + }, | ||
| 143 | + /* regex */ | ||
| 144 | + { | ||
| 145 | + "regex", 'r', | ||
| 146 | + "Search page for regex STRING", | ||
| 147 | + 0, 0, "boolean", "false", "", | ||
| 148 | + }, | ||
| 149 | + /* eregi */ | ||
| 150 | + { | ||
| 151 | + "eregi", 'R', | ||
| 152 | + "Search page for case-insensitive regex STRING", | ||
| 153 | + 0, 0, "string", "", "STRING", | ||
| 154 | + }, | ||
| 155 | + /* invert-regex */ | ||
| 156 | + { | ||
| 157 | + "invert-regex", 0, | ||
| 158 | + "Return CRITICAL if found, OK if not", | ||
| 159 | + 0, 0, "boolean", "false", "", | ||
| 160 | + }, | ||
| 161 | + /* authorization */ | ||
| 162 | + { | ||
| 163 | + "authorization", 'a', | ||
| 164 | + "Username:password on sites with basic authentication", | ||
| 165 | + 0, 0, "string", "", "AUTH_PAIR", | ||
| 166 | + }, | ||
| 167 | + /* proxy_authorization */ | ||
| 168 | + { | ||
| 169 | + "proxy_authorization", 'b', | ||
| 170 | + "Username:password on proxy-servers with basic authentication", | ||
| 171 | + 0, 0, "string", "", "AUTH_PAIR", | ||
| 172 | + }, | ||
| 173 | + /* useragent */ | ||
| 174 | + { | ||
| 175 | + "useragent", 'A', | ||
| 176 | + "String to be sent in http header as \"User Agent\"", | ||
| 177 | + 0, 0, "string", "", "STRING", | ||
| 178 | + }, | ||
| 179 | + /* header */ | ||
| 180 | + { | ||
| 181 | + "header", 'k', | ||
| 182 | + "other tags to be sent in http header", | ||
| 183 | + 0, 0, "string", "", "STRING", | ||
| 184 | + "Any other tags to be sent in http header. Use multiple times for additional headers\n" | ||
| 185 | + }, | ||
| 186 | + /* link */ | ||
| 187 | + { | ||
| 188 | + "link", 'L', | ||
| 189 | + "Wrap output in HTML link (obsoleted by urlize)", | ||
| 190 | + 0, 0, "boolean", "false", "", | ||
| 191 | + }, | ||
| 192 | + /* onredirect */ | ||
| 193 | + { | ||
| 194 | + "onredirect", 'f', | ||
| 195 | + "How to handle redirected pages", | ||
| 196 | + 0, 0, "string", "", "<ok|warning|critical|follow|sticky|stickyport>", | ||
| 197 | + "How to handle redirected pages. sticky is like follow but stick to the\n" | ||
| 198 | + "specified IP address. stickyport also ensures port stays the same.\n" | ||
| 199 | + }, | ||
| 200 | + /* pagesize */ | ||
| 201 | + { | ||
| 202 | + "pagesize", 'm', | ||
| 203 | + "minimum[:maximum] page size", | ||
| 204 | + 0, 0, "string", "", "INTEGER<:INTEGER>", | ||
| 205 | + "Minimum page size required (bytes) : Maximum page size required (bytes)\n" | ||
| 206 | + }, | ||
| 207 | + /* warning */ | ||
| 208 | + { | ||
| 209 | + "warning", 'w', | ||
| 210 | + "Response time to result in warning status (seconds)", | ||
| 211 | + 0, 0, "string", "", "DOUBLE", | ||
| 212 | + }, | ||
| 213 | + /* critical */ | ||
| 214 | + { | ||
| 215 | + "critical", 'c', | ||
| 216 | + "Response time to result in critical status (seconds)", | ||
| 217 | + 0, 0, "string", "", "DOUBLE", | ||
| 218 | + }, | ||
| 219 | + /* timeout */ | ||
| 220 | + { | ||
| 221 | + "timeout", 't', | ||
| 222 | + "Seconds before connection times out (default: 10)", | ||
| 223 | + 0, 0, "integer", "10", "INTEGER", | ||
| 224 | + }, | ||
| 225 | + /* extra-opts */ | ||
| 226 | + { | ||
| 227 | + "extra-opts", 0, | ||
| 228 | + "ini file with extra options", | ||
| 229 | + 0, 0, "string", "", "string", | ||
| 230 | + "Read options from an ini file. See http://nagiosplugins.org/extra-opts\n" | ||
| 231 | + "for usage and examples.\n" | ||
| 232 | + }, | ||
| 233 | + {} | ||
| 234 | +}; | ||
| 235 | + | ||
| 236 | int | ||
| 237 | main (int argc, char **argv) | ||
| 238 | { | ||
| 239 | @@ -151,6 +372,12 @@ main (int argc, char **argv) | ||
| 240 | NP_VERSION, VERSION); | ||
| 241 | |||
| 242 | /* Parse extra opts if any */ | ||
| 243 | + if (argc==2 && !strcmp(argv[1], "--metadata")) { | ||
| 244 | + /* dump metadata and exit */ | ||
| 245 | + print_meta_data(&resource_meta, options_help); | ||
| 246 | + exit(0); | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | argv=np_extra_opts (&argc, argv, progname); | ||
| 250 | |||
| 251 | if (process_arguments (argc, argv) == ERROR) | ||
| 252 | @@ -1319,10 +1546,7 @@ print_help (void) | ||
| 253 | printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n"); | ||
| 254 | printf (COPYRIGHT, copyright, email); | ||
| 255 | |||
| 256 | - printf ("%s\n", _("This plugin tests the HTTP service on the specified host. It can test")); | ||
| 257 | - printf ("%s\n", _("normal (http) and secure (https) servers, follow redirects, search for")); | ||
| 258 | - printf ("%s\n", _("strings and regular expressions, check connection times, and report on")); | ||
| 259 | - printf ("%s\n", _("certificate expiration times.")); | ||
| 260 | + print_help_head(&resource_meta); | ||
| 261 | |||
| 262 | printf ("\n\n"); | ||
| 263 | |||
| 264 | @@ -1333,80 +1557,7 @@ print_help (void) | ||
| 265 | printf ("\n"); | ||
| 266 | |||
| 267 | printf (UT_HELP_VRSN); | ||
| 268 | - printf (UT_EXTRA_OPTS); | ||
| 269 | - | ||
| 270 | - printf (" %s\n", "-H, --hostname=ADDRESS"); | ||
| 271 | - printf (" %s\n", _("Host name argument for servers using host headers (virtual host)")); | ||
| 272 | - printf (" %s\n", _("Append a port to include it in the header (eg: example.com:5000)")); | ||
| 273 | - printf (" %s\n", "-I, --IP-address=ADDRESS"); | ||
| 274 | - printf (" %s\n", _("IP address or name (use numeric address if possible to bypass DNS lookup).")); | ||
| 275 | - printf (" %s\n", "-p, --port=INTEGER"); | ||
| 276 | - printf (" %s", _("Port number (default: ")); | ||
| 277 | - printf ("%d)\n", HTTP_PORT); | ||
| 278 | - | ||
| 279 | - printf (UT_IPv46); | ||
| 280 | - | ||
| 281 | -#ifdef HAVE_SSL | ||
| 282 | - printf (" %s\n", "-S, --ssl=VERSION"); | ||
| 283 | - printf (" %s\n", _("Connect via SSL. Port defaults to 443. VERSION is optional, and prevents")); | ||
| 284 | - printf (" %s\n", _("auto-negotiation (1 = TLSv1, 2 = SSLv2, 3 = SSLv3).")); | ||
| 285 | - printf (" %s\n", "--sni"); | ||
| 286 | - printf (" %s\n", _("Enable SSL/TLS hostname extension support (SNI)")); | ||
| 287 | - printf (" %s\n", "-C, --certificate=INTEGER[,INTEGER]"); | ||
| 288 | - printf (" %s\n", _("Minimum number of days a certificate has to be valid. Port defaults to 443")); | ||
| 289 | - printf (" %s\n", _("(when this option is used the URL is not checked.)\n")); | ||
| 290 | -#endif | ||
| 291 | - | ||
| 292 | - printf (" %s\n", "-e, --expect=STRING"); | ||
| 293 | - printf (" %s\n", _("Comma-delimited list of strings, at least one of them is expected in")); | ||
| 294 | - printf (" %s", _("the first (status) line of the server response (default: ")); | ||
| 295 | - printf ("%s)\n", HTTP_EXPECT); | ||
| 296 | - printf (" %s\n", _("If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)")); | ||
| 297 | - printf (" %s\n", "-s, --string=STRING"); | ||
| 298 | - printf (" %s\n", _("String to expect in the content")); | ||
| 299 | - printf (" %s\n", "-u, --url=PATH"); | ||
| 300 | - printf (" %s\n", _("URL to GET or POST (default: /)")); | ||
| 301 | - printf (" %s\n", "-P, --post=STRING"); | ||
| 302 | - printf (" %s\n", _("URL encoded http POST data")); | ||
| 303 | - printf (" %s\n", "-j, --method=STRING (for example: HEAD, OPTIONS, TRACE, PUT, DELETE)"); | ||
| 304 | - printf (" %s\n", _("Set HTTP method.")); | ||
| 305 | - printf (" %s\n", "-N, --no-body"); | ||
| 306 | - printf (" %s\n", _("Don't wait for document body: stop reading after headers.")); | ||
| 307 | - printf (" %s\n", _("(Note that this still does an HTTP GET or POST, not a HEAD.)")); | ||
| 308 | - printf (" %s\n", "-M, --max-age=SECONDS"); | ||
| 309 | - printf (" %s\n", _("Warn if document is more than SECONDS old. the number can also be of")); | ||
| 310 | - printf (" %s\n", _("the form \"10m\" for minutes, \"10h\" for hours, or \"10d\" for days.")); | ||
| 311 | - printf (" %s\n", "-T, --content-type=STRING"); | ||
| 312 | - printf (" %s\n", _("specify Content-Type header media type when POSTing\n")); | ||
| 313 | - | ||
| 314 | - printf (" %s\n", "-l, --linespan"); | ||
| 315 | - printf (" %s\n", _("Allow regex to span newlines (must precede -r or -R)")); | ||
| 316 | - printf (" %s\n", "-r, --regex, --ereg=STRING"); | ||
| 317 | - printf (" %s\n", _("Search page for regex STRING")); | ||
| 318 | - printf (" %s\n", "-R, --eregi=STRING"); | ||
| 319 | - printf (" %s\n", _("Search page for case-insensitive regex STRING")); | ||
| 320 | - printf (" %s\n", "--invert-regex"); | ||
| 321 | - printf (" %s\n", _("Return CRITICAL if found, OK if not\n")); | ||
| 322 | - | ||
| 323 | - printf (" %s\n", "-a, --authorization=AUTH_PAIR"); | ||
| 324 | - printf (" %s\n", _("Username:password on sites with basic authentication")); | ||
| 325 | - printf (" %s\n", "-b, --proxy-authorization=AUTH_PAIR"); | ||
| 326 | - printf (" %s\n", _("Username:password on proxy-servers with basic authentication")); | ||
| 327 | - printf (" %s\n", "-A, --useragent=STRING"); | ||
| 328 | - printf (" %s\n", _("String to be sent in http header as \"User Agent\"")); | ||
| 329 | - printf (" %s\n", "-k, --header=STRING"); | ||
| 330 | - printf (" %s\n", _("Any other tags to be sent in http header. Use multiple times for additional headers")); | ||
| 331 | - printf (" %s\n", "-L, --link"); | ||
| 332 | - printf (" %s\n", _("Wrap output in HTML link (obsoleted by urlize)")); | ||
| 333 | - printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow|sticky|stickyport>"); | ||
| 334 | - printf (" %s\n", _("How to handle redirected pages. sticky is like follow but stick to the")); | ||
| 335 | - printf (" %s\n", _("specified IP address. stickyport also ensures port stays the same.")); | ||
| 336 | - printf (" %s\n", "-m, --pagesize=INTEGER<:INTEGER>"); | ||
| 337 | - printf (" %s\n", _("Minimum page size required (bytes) : Maximum page size required (bytes)")); | ||
| 338 | - | ||
| 339 | - printf (UT_WARN_CRIT); | ||
| 340 | - | ||
| 341 | - printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); | ||
| 342 | + print_parameters_help(options_help); | ||
| 343 | |||
| 344 | printf (UT_VERBOSE); | ||
| 345 | |||
| 346 | @@ -1467,4 +1618,5 @@ print_usage (void) | ||
| 347 | printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); | ||
| 348 | printf (" [-A string] [-k string] [-S <version>] [--sni] [-C <warn_age>[,<crit_age>]]\n"); | ||
| 349 | printf (" [-T <content-type>] [-j method]\n"); | ||
| 350 | + printf (" %s --metadata\n", progname); | ||
| 351 | } | ||
diff --git a/web/attachments/46039-check_nwstat.diff b/web/attachments/46039-check_nwstat.diff new file mode 100644 index 0000000..7f02eac --- /dev/null +++ b/web/attachments/46039-check_nwstat.diff | |||
| @@ -0,0 +1,163 @@ | |||
| 1 | *** nagios-plugins-1.3.0/plugins/check_nwstat.c Sat Feb 15 13:48:45 2003 | ||
| 2 | --- nagios-plugins-1.3.0-patched/plugins/check_nwstat.c Wed Mar 26 19:02:28 2003 | ||
| 3 | *************** | ||
| 4 | *** 63,68 **** | ||
| 5 | --- 63,73 ---- | ||
| 6 | VKNP<vol> = KB of not yet purgeable space on volume <vol>\n\ | ||
| 7 | ABENDS = number of abended threads (NW 5.x only)\n\ | ||
| 8 | CSPROCS = number of current service processes (NW 5.x only)\n\ | ||
| 9 | + TSYNC = timesync status \n\ | ||
| 10 | + LRUS = LRU sitting time in seconds\n\ | ||
| 11 | + DCB = dirty cache buffers as a percentage of the total\n\ | ||
| 12 | + TCB = dirty cache buffers as a percentage of the original\n\ | ||
| 13 | + | ||
| 14 | -w, --warning=INTEGER\n\ | ||
| 15 | Threshold which will result in a warning status\n\ | ||
| 16 | -c, --critical=INTEGER\n\ | ||
| 17 | *************** | ||
| 18 | *** 84,90 **** | ||
| 19 | extension for NetWare be loaded on the Novell servers you wish to check.\n\ | ||
| 20 | (available from http://www.engr.wisc.edu/~drews/mrtg/)\n\ | ||
| 21 | - Values for critical thresholds should be lower than warning thresholds\n\ | ||
| 22 | ! when the following variables are checked: VPF, VKF, LTCH, CBUFF, and LRUM.\n" | ||
| 23 | |||
| 24 | #include "config.h" | ||
| 25 | #include "common.h" | ||
| 26 | --- 89,95 ---- | ||
| 27 | extension for NetWare be loaded on the Novell servers you wish to check.\n\ | ||
| 28 | (available from http://www.engr.wisc.edu/~drews/mrtg/)\n\ | ||
| 29 | - Values for critical thresholds should be lower than warning thresholds\n\ | ||
| 30 | ! when the following variables are checked: VPF, VKF, LTCH, CBUFF, DCB, TCB, LRUS and LRUM.\n" | ||
| 31 | |||
| 32 | #include "config.h" | ||
| 33 | #include "common.h" | ||
| 34 | *************** | ||
| 35 | *** 114,119 **** | ||
| 36 | --- 119,128 ---- | ||
| 37 | #define CHECK_VPNP 20 /* check % not yet purgeable space on volume */ | ||
| 38 | #define CHECK_ABENDS 21 /* check abended thread count */ | ||
| 39 | #define CHECK_CSPROCS 22 /* check number of current service processes */ | ||
| 40 | + #define CHECK_TSYNC 23 /* check timesync status 0=no 1=yes in sync to the network */ | ||
| 41 | + #define CHECK_LRUS 24 /* check LRU sitting time in seconds */ | ||
| 42 | + #define CHECK_DCB 25 /* check dirty cache buffers as a percentage of the total */ | ||
| 43 | + #define CHECK_TCB 26 /* check total cache buffers as a percentage of the original */ | ||
| 44 | |||
| 45 | #define PORT 9999 | ||
| 46 | |||
| 47 | *************** | ||
| 48 | *** 140,145 **** | ||
| 49 | --- 149,157 ---- | ||
| 50 | char *temp_buffer=NULL; | ||
| 51 | char *netware_version=NULL; | ||
| 52 | |||
| 53 | + int total_cache_buffers=0; | ||
| 54 | + int dirty_cache_buffers=0; | ||
| 55 | + int time_sync_status=0; | ||
| 56 | int open_files=0; | ||
| 57 | int abended_threads=0; | ||
| 58 | int max_service_processes=0; | ||
| 59 | *************** | ||
| 60 | *** 602,607 **** | ||
| 61 | --- 614,683 ---- | ||
| 62 | |||
| 63 | asprintf(&output_message,"%d current service processes (%d max)",current_service_processes,max_service_processes); | ||
| 64 | |||
| 65 | + /* check # Timesync Status */ | ||
| 66 | + } else if (vars_to_check==CHECK_TSYNC) { | ||
| 67 | + | ||
| 68 | + asprintf(&send_buffer,"S22\r\n"); | ||
| 69 | + result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 70 | + if(result!=STATE_OK) | ||
| 71 | + return result; | ||
| 72 | + | ||
| 73 | + time_sync_status=atoi(recv_buffer); | ||
| 74 | + | ||
| 75 | + if(time_sync_status==0) { | ||
| 76 | + result=STATE_CRITICAL; | ||
| 77 | + asprintf(&output_message,"Critical: Time not in sync with network!"); | ||
| 78 | + } | ||
| 79 | + else { | ||
| 80 | + asprintf(&output_message,"OK! Time in sync with network!"); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + /* check LRU sitting time in secondss */ | ||
| 84 | + } else if (vars_to_check==CHECK_LRUS) { | ||
| 85 | + | ||
| 86 | + send_buffer = strscpy(send_buffer,"S4\r\n"); | ||
| 87 | + result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 88 | + if(result!=STATE_OK) | ||
| 89 | + return result; | ||
| 90 | + lru_time=strtoul(recv_buffer,NULL,10); | ||
| 91 | + | ||
| 92 | + if(check_critical_value==TRUE && lru_time <= critical_value) | ||
| 93 | + result=STATE_CRITICAL; | ||
| 94 | + else if(check_warning_value==TRUE && lru_time <= warning_value) | ||
| 95 | + result=STATE_WARNING; | ||
| 96 | + asprintf(&output_message,"LRU sitting time = %lu seconds",lru_time); | ||
| 97 | + | ||
| 98 | + | ||
| 99 | + /* check % dirty cache buffers as a percentage of the total*/ | ||
| 100 | + } else if (vars_to_check==CHECK_DCB) { | ||
| 101 | + | ||
| 102 | + send_buffer = strscpy(send_buffer,"S6\r\n"); | ||
| 103 | + result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 104 | + if(result!=STATE_OK) | ||
| 105 | + return result; | ||
| 106 | + dirty_cache_buffers=atoi(recv_buffer); | ||
| 107 | + | ||
| 108 | + if(check_critical_value==TRUE && dirty_cache_buffers <= critical_value) | ||
| 109 | + result=STATE_CRITICAL; | ||
| 110 | + else if(check_warning_value==TRUE && dirty_cache_buffers <= warning_value) | ||
| 111 | + result=STATE_WARNING; | ||
| 112 | + asprintf(&output_message,"dirty cache buffers = %d%% of the total",dirty_cache_buffers); | ||
| 113 | + | ||
| 114 | + /* check % total cache buffers as a percentage of the original*/ | ||
| 115 | + } else if (vars_to_check==CHECK_TCB) { | ||
| 116 | + | ||
| 117 | + send_buffer = strscpy(send_buffer,"S7\r\n"); | ||
| 118 | + result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 119 | + if(result!=STATE_OK) | ||
| 120 | + return result; | ||
| 121 | + total_cache_buffers=atoi(recv_buffer); | ||
| 122 | + | ||
| 123 | + if(check_critical_value==TRUE && total_cache_buffers <= critical_value) | ||
| 124 | + result=STATE_CRITICAL; | ||
| 125 | + else if(check_warning_value==TRUE && total_cache_buffers <= warning_value) | ||
| 126 | + result=STATE_WARNING; | ||
| 127 | + asprintf(&output_message,"total cache buffers = %d%% of the original",total_cache_buffers); | ||
| 128 | + | ||
| 129 | } else { | ||
| 130 | |||
| 131 | output_message = strscpy(output_message,"Nothing to check!\n"); | ||
| 132 | *************** | ||
| 133 | *** 706,717 **** | ||
| 134 | --- 782,799 ---- | ||
| 135 | vars_to_check=CHECK_CONNS; | ||
| 136 | else if(!strcmp(optarg,"LTCH")) | ||
| 137 | vars_to_check=CHECK_LTCH; | ||
| 138 | + else if(!strcmp(optarg,"DCB")) | ||
| 139 | + vars_to_check=CHECK_DCB; | ||
| 140 | + else if(!strcmp(optarg,"TCB")) | ||
| 141 | + vars_to_check=CHECK_TCB; | ||
| 142 | else if(!strcmp(optarg,"CBUFF")) | ||
| 143 | vars_to_check=CHECK_CBUFF; | ||
| 144 | else if(!strcmp(optarg,"CDBUFF")) | ||
| 145 | vars_to_check=CHECK_CDBUFF; | ||
| 146 | else if(!strcmp(optarg,"LRUM")) | ||
| 147 | vars_to_check=CHECK_LRUM; | ||
| 148 | + else if(!strcmp(optarg,"LRUS")) | ||
| 149 | + vars_to_check=CHECK_LRUS; | ||
| 150 | else if(strncmp(optarg,"VPF",3)==0){ | ||
| 151 | vars_to_check=CHECK_VPF; | ||
| 152 | volume_name = strscpy(volume_name,optarg+3); | ||
| 153 | *************** | ||
| 154 | *** 769,774 **** | ||
| 155 | --- 851,858 ---- | ||
| 156 | vars_to_check=CHECK_ABENDS; | ||
| 157 | else if(!strcmp(optarg,"CSPROCS")) | ||
| 158 | vars_to_check=CHECK_CSPROCS; | ||
| 159 | + else if(!strcmp(optarg,"TSYNC")) | ||
| 160 | + vars_to_check=CHECK_TSYNC; | ||
| 161 | else | ||
| 162 | return ERROR; | ||
| 163 | break; | ||
diff --git a/web/attachments/462789-nagios_plugin.patch b/web/attachments/462789-nagios_plugin.patch new file mode 100644 index 0000000..3499051 --- /dev/null +++ b/web/attachments/462789-nagios_plugin.patch | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | diff --git a/configure.in b/configure.in | ||
| 2 | --- a/configure.in | ||
| 3 | +++ b/configure.in | ||
| 4 | @@ -1246,12 +1246,20 @@ | ||
| 5 | |||
| 6 | AC_MSG_CHECKING([for number of cpus]) | ||
| 7 | AC_TRY_COMPILE([#include <unistd.h>], | ||
| 8 | - [sysconf(_SC_NPROCESSORS_CONF) > 0;], | ||
| 9 | - AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_CONF,1,[Define if sysconf returns number of cpus]) | ||
| 10 | - AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_CONF)]), | ||
| 11 | + [sysconf(_SC_NPROCESSORS_ONLN) > 0;], | ||
| 12 | + AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_ONLN,1,[Define if sysconf returns number of cpus]) | ||
| 13 | + AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_ONLN)]), | ||
| 14 | AC_MSG_RESULT([cannot calculate]) | ||
| 15 | ) | ||
| 16 | |||
| 17 | +AC_TRY_COMPILE([#include <unistd.h>], | ||
| 18 | + [sysconf(_SC_NPROCESSORS_CONF) > 0;], | ||
| 19 | + AC_DEFINE(HAVE_SYSCONF__SC_NPROCESSORS_CONF,1,[Define if sysconf returns number of cpus]) | ||
| 20 | + AC_MSG_RESULT([sysconf(_SC_NPROCESSORS_CONF)]), | ||
| 21 | + AC_MSG_RESULT([cannot calculate]) | ||
| 22 | + ) | ||
| 23 | + | ||
| 24 | + | ||
| 25 | AC_PATH_PROG(PATH_TO_UPTIME,uptime) | ||
| 26 | AC_ARG_WITH(uptime_command, | ||
| 27 | ACX_HELP_STRING([--with-uptime-command=PATH], | ||
| 28 | diff --git a/plugins/common.h b/plugins/common.h | ||
| 29 | --- a/plugins/common.h | ||
| 30 | +++ b/plugins/common.h | ||
| 31 | @@ -82,10 +82,14 @@ | ||
| 32 | getting that data | ||
| 33 | Will return -1 if cannot get data | ||
| 34 | */ | ||
| 35 | -#ifdef HAVE_SYSCONF__SC_NPROCESSORS_CONF | ||
| 36 | +#ifdef HAVE_SYSCONF__SC_NPROCESSORS_ONLN | ||
| 37 | #define GET_NUMBER_OF_CPUS() sysconf(_SC_NPROCESSORS_ONLN) | ||
| 38 | #else | ||
| 39 | -#define GET_NUMBER_OF_CPUS() -1 | ||
| 40 | +# ifdef HAVE_SYSCONF__SC_NPROCESSORS_CONF | ||
| 41 | +# define GET_NUMBER_OF_CPUS() sysconf(_SC_NPROCESSORS_CONF) | ||
| 42 | +# else | ||
| 43 | +# define GET_NUMBER_OF_CPUS() -1 | ||
| 44 | +# endif | ||
| 45 | #endif | ||
| 46 | |||
| 47 | #ifdef TIME_WITH_SYS_TIME | ||
diff --git a/web/attachments/463009-NegSSLVers.patch b/web/attachments/463009-NegSSLVers.patch new file mode 100644 index 0000000..c19d8ce --- /dev/null +++ b/web/attachments/463009-NegSSLVers.patch | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | --- nagios-plugins-1.4.16/plugins/sslutils.c 2012-06-27 19:32:47.000000000 +0200 | ||
| 2 | +++ nagios-plugins-1.4.16b/plugins/sslutils.c 2013-04-30 12:05:14.000000000 +0200 | ||
| 3 | @@ -46,8 +46,21 @@ | ||
| 4 | |||
| 5 | int np_net_ssl_init_with_hostname_and_version(int sd, char *host_name, int version) { | ||
| 6 | const SSL_METHOD *method = NULL; | ||
| 7 | + long ver_option = 0; | ||
| 8 | |||
| 9 | switch (version) { | ||
| 10 | + case -3: /* Anything *but* SSLv3 */ | ||
| 11 | + method = SSLv23_client_method(); | ||
| 12 | + ver_option = SSL_OP_NO_SSLv3; | ||
| 13 | + break; | ||
| 14 | + case -2: /* Anything *but* SSLv2 */ | ||
| 15 | + method = SSLv23_client_method(); | ||
| 16 | + ver_option = SSL_OP_NO_SSLv2; | ||
| 17 | + break; | ||
| 18 | + case -1: /* Anything *but* TLSv1 */ | ||
| 19 | + method = SSLv23_client_method(); | ||
| 20 | + ver_option = SSL_OP_NO_TLSv1; | ||
| 21 | + break; | ||
| 22 | case 0: /* Deafult to auto negotiation */ | ||
| 23 | method = SSLv23_client_method(); | ||
| 24 | break; | ||
| 25 | @@ -83,6 +96,7 @@ | ||
| 26 | #ifdef SSL_OP_NO_TICKET | ||
| 27 | SSL_CTX_set_options(c, SSL_OP_NO_TICKET); | ||
| 28 | #endif | ||
| 29 | + if (ver_option) SSL_CTX_set_options(c, ver_option); | ||
| 30 | if ((s = SSL_new(c)) != NULL) { | ||
| 31 | #ifdef SSL_set_tlsext_host_name | ||
| 32 | if (host_name != NULL) | ||
| 33 | --- nagios-plugins-1.4.16/plugins/check_http.c 2012-06-27 19:32:47.000000000 +0200 | ||
| 34 | +++ nagios-plugins-1.4.16b/plugins/check_http.c 2013-04-30 12:08:48.000000000 +0200 | ||
| 35 | @@ -312,8 +312,8 @@ | ||
| 36 | ssl_version = 0; | ||
| 37 | else { | ||
| 38 | ssl_version = atoi(optarg); | ||
| 39 | - if (ssl_version < 1 || ssl_version > 3) | ||
| 40 | - usage4 (_("Invalid option - Valid values for SSL Version are 1 (TLSv1), 2 (SSLv2) or 3 (SSLv3)")); | ||
| 41 | + if (ssl_version < -3 || ssl_version > 3) | ||
| 42 | + usage4 (_("Invalid option - Valid values for SSL Version are 1 (TLSv1), 2 (SSLv2), 3 (SSLv3) and their negatives (exclude that version)")); | ||
| 43 | } | ||
| 44 | if (specify_port == FALSE) | ||
| 45 | server_port = HTTPS_PORT; | ||
| 46 | @@ -1348,7 +1348,8 @@ | ||
| 47 | #ifdef HAVE_SSL | ||
| 48 | printf (" %s\n", "-S, --ssl=VERSION"); | ||
| 49 | printf (" %s\n", _("Connect via SSL. Port defaults to 443. VERSION is optional, and prevents")); | ||
| 50 | - printf (" %s\n", _("auto-negotiation (1 = TLSv1, 2 = SSLv2, 3 = SSLv3).")); | ||
| 51 | + printf (" %s\n", _("auto-negotiation (1 = TLSv1, 2 = SSLv2, 3 = SSLv3) for positive values, or")); | ||
| 52 | + printf (" %s\n", _("use of the respective protocol in auto-negotiation when negative.")); | ||
| 53 | printf (" %s\n", "--sni"); | ||
| 54 | printf (" %s\n", _("Enable SSL/TLS hostname extension support (SNI)")); | ||
| 55 | printf (" %s\n", "-C, --certificate=INTEGER"); | ||
diff --git a/web/attachments/463371-nagios-plugins-check_http_ntlm.patch.gz b/web/attachments/463371-nagios-plugins-check_http_ntlm.patch.gz new file mode 100644 index 0000000..e1ca573 --- /dev/null +++ b/web/attachments/463371-nagios-plugins-check_http_ntlm.patch.gz | |||
| Binary files differ | |||
diff --git a/web/attachments/463805-check_http.c.diff b/web/attachments/463805-check_http.c.diff new file mode 100644 index 0000000..a56e1d7 --- /dev/null +++ b/web/attachments/463805-check_http.c.diff | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | --- check_http.c.orig 2012-06-27 19:32:47.000000000 +0200 | ||
| 2 | +++ check_http.c 2013-06-25 21:08:19.000000000 +0200 | ||
| 3 | @@ -304,21 +304,22 @@ | ||
| 4 | /* Fall through to -S option */ | ||
| 5 | #endif | ||
| 6 | case 'S': /* use SSL */ | ||
| 7 | #ifndef HAVE_SSL | ||
| 8 | usage4 (_("Invalid option - SSL is not available")); | ||
| 9 | -#endif | ||
| 10 | +#else | ||
| 11 | use_ssl = TRUE; | ||
| 12 | if (optarg == NULL || c != 'S') | ||
| 13 | ssl_version = 0; | ||
| 14 | else { | ||
| 15 | ssl_version = atoi(optarg); | ||
| 16 | if (ssl_version < 1 || ssl_version > 3) | ||
| 17 | usage4 (_("Invalid option - Valid values for SSL Version are 1 (TLSv1), 2 (SSLv2) or 3 (SSLv3)")); | ||
| 18 | } | ||
| 19 | if (specify_port == FALSE) | ||
| 20 | server_port = HTTPS_PORT; | ||
| 21 | +#endif | ||
| 22 | break; | ||
| 23 | case SNI_OPTION: | ||
| 24 | use_sni = TRUE; | ||
| 25 | break; | ||
| 26 | case 'f': /* onredirect */ | ||
diff --git a/web/attachments/49410-nagios-check_http-header-patch.txt b/web/attachments/49410-nagios-check_http-header-patch.txt new file mode 100644 index 0000000..c2d9556 --- /dev/null +++ b/web/attachments/49410-nagios-check_http-header-patch.txt | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | --- check_http.c 2003-05-02 18:28:50.000000000 -0500 | ||
| 2 | +++ check_http_orig.c 2003-02-22 01:22:02.000000000 -0600 | ||
| 3 | @@ -41,7 +41,7 @@ | ||
| 4 | certificate expiration times.\n" | ||
| 5 | |||
| 6 | #define OPTIONS "\ | ||
| 7 | -(-H <vhost> | -I <IP-address>) [-u <uri>] [-p <port>] [-E header]\n\ | ||
| 8 | +(-H <vhost> | -I <IP-address>) [-u <uri>] [-p <port>]\n\ | ||
| 9 | [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\ | ||
| 10 | [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\ | ||
| 11 | [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\ | ||
| 12 | @@ -61,8 +61,6 @@ | ||
| 13 | URL to GET or POST (default: /)\n\ | ||
| 14 | -p, --port=INTEGER\n\ | ||
| 15 | Port number (default: %d)\n\ | ||
| 16 | - -E, --extra-header=HEADER\n\ | ||
| 17 | - Extra HTTP header (name: value)\n\ | ||
| 18 | -P, --post=STRING\n\ | ||
| 19 | URL encoded http POST data\n\ | ||
| 20 | -w, --warning=INTEGER\n\ | ||
| 21 | @@ -222,7 +220,6 @@ | ||
| 22 | int sd; | ||
| 23 | char *http_method = "GET"; | ||
| 24 | char *http_post_data = ""; | ||
| 25 | -char *http_extra_headers = NULL; | ||
| 26 | char buffer[MAX_INPUT_BUFFER]; | ||
| 27 | |||
| 28 | void print_usage (void); | ||
| 29 | @@ -305,7 +302,6 @@ | ||
| 30 | {"nohtml", no_argument, 0, 'n'}, | ||
| 31 | {"ssl", no_argument, 0, 'S'}, | ||
| 32 | {"verbose", no_argument, 0, 'v'}, | ||
| 33 | - {"extra-header", required_argument, 0, 'E'}, | ||
| 34 | {"post", required_argument, 0, 'P'}, | ||
| 35 | {"IP-address", required_argument, 0, 'I'}, | ||
| 36 | {"string", required_argument, 0, 's'}, | ||
| 37 | @@ -335,7 +331,7 @@ | ||
| 38 | strcpy (argv[c], "-n"); | ||
| 39 | } | ||
| 40 | |||
| 41 | -#define OPTCHARS "Vvht:c:w:H:E:P:I:a:e:p:s:R:r:u:f:C:nlLS" | ||
| 42 | +#define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLS" | ||
| 43 | |||
| 44 | while (1) { | ||
| 45 | #ifdef HAVE_GETOPT_H | ||
| 46 | @@ -434,17 +430,6 @@ | ||
| 47 | strncpy (user_auth, optarg, MAX_INPUT_BUFFER - 1); | ||
| 48 | user_auth[MAX_INPUT_BUFFER - 1] = 0; | ||
| 49 | break; | ||
| 50 | - case 'E': /* extra HTTP header as name: value */ | ||
| 51 | - if (strstr (optarg, ": ") == NULL) | ||
| 52 | - usage2 ("invalid HTTP header syntax: should be of the form 'name: value'", optarg); | ||
| 53 | - if (http_extra_headers == NULL) { | ||
| 54 | - asprintf (&http_extra_headers, "%s\r\n", optarg); | ||
| 55 | - } else { | ||
| 56 | - char *old_headers = http_extra_headers; | ||
| 57 | - asprintf (&http_extra_headers, "%s%s\r\n", old_headers, optarg); | ||
| 58 | - free (old_headers); | ||
| 59 | - } | ||
| 60 | - break; | ||
| 61 | case 'P': /* HTTP POST data in URL encoded format */ | ||
| 62 | asprintf (&http_method, "%s", "POST"); | ||
| 63 | asprintf (&http_post_data, "%s", optarg); | ||
| 64 | @@ -610,11 +595,6 @@ | ||
| 65 | asprintf (&buf, "%sAuthorization: Basic %s\r\n", buf, auth); | ||
| 66 | } | ||
| 67 | |||
| 68 | - /* send extra headers if requested */ | ||
| 69 | - if (http_extra_headers != NULL) { | ||
| 70 | - asprintf (&buf, "%s%s", buf, http_extra_headers); | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | /* either send http POST data */ | ||
| 74 | if (strlen (http_post_data)) { | ||
| 75 | asprintf (&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf); | ||
diff --git a/web/attachments/49900-check_http_patch.txt b/web/attachments/49900-check_http_patch.txt new file mode 100644 index 0000000..84b9205 --- /dev/null +++ b/web/attachments/49900-check_http_patch.txt | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | Index: check_http.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_http.c,v | ||
| 4 | retrieving revision 1.32 | ||
| 5 | diff -c -r1.32 check_http.c | ||
| 6 | *** check_http.c 23 Apr 2003 04:58:38 -0000 1.32 | ||
| 7 | --- check_http.c 8 May 2003 15:55:08 -0000 | ||
| 8 | *************** | ||
| 9 | *** 630,645 **** | ||
| 10 | pagesize += i; | ||
| 11 | } | ||
| 12 | |||
| 13 | ! if (i < 0) { | ||
| 14 | #ifdef HAVE_SSL | ||
| 15 | ! sslerr=SSL_get_error(ssl, i); | ||
| 16 | ! if ( sslerr == SSL_ERROR_SSL ) { | ||
| 17 | ! terminate (STATE_WARNING, "Client Certificate Required\n"); | ||
| 18 | ! } else { | ||
| 19 | terminate (STATE_CRITICAL, "Error in recv()"); | ||
| 20 | } | ||
| 21 | - #else | ||
| 22 | - terminate (STATE_CRITICAL, "Error in recv()"); | ||
| 23 | #endif | ||
| 24 | } | ||
| 25 | |||
| 26 | --- 630,650 ---- | ||
| 27 | pagesize += i; | ||
| 28 | } | ||
| 29 | |||
| 30 | ! if (i < 0 && errno != ECONNRESET) { | ||
| 31 | #ifdef HAVE_SSL | ||
| 32 | ! if (use_ssl) { | ||
| 33 | ! sslerr=SSL_get_error(ssl, i); | ||
| 34 | ! if ( sslerr == SSL_ERROR_SSL ) { | ||
| 35 | ! terminate (STATE_WARNING, "Client Certificate Required\n"); | ||
| 36 | ! } else { | ||
| 37 | ! terminate (STATE_CRITICAL, "Error in recv()"); | ||
| 38 | ! } | ||
| 39 | ! } | ||
| 40 | ! else { | ||
| 41 | ! #endif | ||
| 42 | terminate (STATE_CRITICAL, "Error in recv()"); | ||
| 43 | + #ifdef HAVE_SSL | ||
| 44 | } | ||
| 45 | #endif | ||
| 46 | } | ||
| 47 | |||
diff --git a/web/attachments/49902-Http.java b/web/attachments/49902-Http.java new file mode 100644 index 0000000..5f2c076 --- /dev/null +++ b/web/attachments/49902-Http.java | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | import java.net.*; | ||
| 2 | public class Http { | ||
| 3 | private static final String EOL = "\r\n"; | ||
| 4 | public static void main(String args[]) throws Exception { | ||
| 5 | ServerSocket server = new ServerSocket(8911); | ||
| 6 | while (true) { | ||
| 7 | Socket sock = server.accept(); | ||
| 8 | sock.getOutputStream().write(("HTTP/1.0 " + HttpURLConnection.HTTP_OK + EOL + "Content-type: text/html" + EOL + EOL + "Some example text").getBytes()); | ||
| 9 | sock.close(); | ||
| 10 | } | ||
| 11 | } | ||
| 12 | } \ No newline at end of file | ||
diff --git a/web/attachments/49931-check_disk.patch b/web/attachments/49931-check_disk.patch new file mode 100644 index 0000000..44ea1c4 --- /dev/null +++ b/web/attachments/49931-check_disk.patch | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | --- check_disk.c.orig Mon Mar 24 13:23:39 2003 | ||
| 2 | +++ check_disk.c Mon Mar 24 13:26:47 2003 | ||
| 3 | @@ -55,6 +55,7 @@ | ||
| 4 | char *exclude_device = ""; | ||
| 5 | int verbose = 0; | ||
| 6 | int display_mntp = FALSE; | ||
| 7 | +int local = FALSE; | ||
| 8 | |||
| 9 | |||
| 10 | int | ||
| 11 | @@ -75,7 +76,11 @@ | ||
| 12 | if (process_arguments (argc, argv) != OK) | ||
| 13 | usage ("Could not parse arguments\n"); | ||
| 14 | |||
| 15 | - asprintf (&command_line, "%s %s", DF_COMMAND, path); | ||
| 16 | + if (local) { | ||
| 17 | + asprintf (&command_line, "%s -l %s", DF_COMMAND, path); | ||
| 18 | + } else { | ||
| 19 | + asprintf (&command_line, "%s %s", DF_COMMAND, path); | ||
| 20 | + } | ||
| 21 | |||
| 22 | if (verbose>0) | ||
| 23 | printf ("%s ==> ", command_line); | ||
| 24 | @@ -169,6 +174,7 @@ | ||
| 25 | {"verbose", no_argument, 0, 'v'}, | ||
| 26 | {"version", no_argument, 0, 'V'}, | ||
| 27 | {"help", no_argument, 0, 'h'}, | ||
| 28 | + {"local", no_argument, 0, 'l'}, | ||
| 29 | {"mountpoint", no_argument, 0, 'm'}, | ||
| 30 | {"exclude_device", required_argument, 0, 'x'}, | ||
| 31 | {"quiet", no_argument, 0, 'q'}, | ||
| 32 | @@ -187,9 +193,9 @@ | ||
| 33 | while (1) { | ||
| 34 | #ifdef HAVE_GETOPT_H | ||
| 35 | c = | ||
| 36 | - getopt_long (argc, argv, "+?Vqhvt:c:w:p:x:m", long_options, &option_index); | ||
| 37 | + getopt_long (argc, argv, "+?Vqhvt:c:w:p:x:lm", long_options, &option_index); | ||
| 38 | #else | ||
| 39 | - c = getopt (argc, argv, "+?Vqhvt:c:w:p:x:m"); | ||
| 40 | + c = getopt (argc, argv, "+?Vqhvt:c:w:p:x:lm"); | ||
| 41 | #endif | ||
| 42 | |||
| 43 | if (c == -1 || c == EOF) | ||
| 44 | @@ -247,6 +253,9 @@ | ||
| 45 | break; | ||
| 46 | case 'm': /* display mountpoint */ | ||
| 47 | display_mntp = TRUE; | ||
| 48 | + break; | ||
| 49 | + case 'l': | ||
| 50 | + local = TRUE; | ||
| 51 | break; | ||
| 52 | case 'x': /* exclude path or partition */ | ||
| 53 | exclude_device = optarg; | ||
diff --git a/web/attachments/49981-check_mailq.diff b/web/attachments/49981-check_mailq.diff new file mode 100644 index 0000000..314577e --- /dev/null +++ b/web/attachments/49981-check_mailq.diff | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | 295a296,379 | ||
| 2 | > elsif ( $mailq eq "postfix" ) { | ||
| 3 | > | ||
| 4 | > ## open mailq | ||
| 5 | > if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { | ||
| 6 | > if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { | ||
| 7 | > print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; | ||
| 8 | > exit $ERRORS{'UNKNOWN'}; | ||
| 9 | > } | ||
| 10 | > }elsif( defined $utils::PATH_TO_MAILQ){ | ||
| 11 | > unless (-x $utils::PATH_TO_MAILQ) { | ||
| 12 | > print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($)))\n"; | ||
| 13 | > exit $ERRORS{'UNKNOWN'}; | ||
| 14 | > } | ||
| 15 | > } else { | ||
| 16 | > print "ERROR: \$utils::PATH_TO_MAILQ is not defined\n"; | ||
| 17 | > exit $ERRORS{'UNKNOWN'}; | ||
| 18 | > } | ||
| 19 | > | ||
| 20 | > | ||
| 21 | > @lines = reverse <MAILQ>; | ||
| 22 | > | ||
| 23 | > # close qmail-qstat | ||
| 24 | > close MAILQ; | ||
| 25 | > # declare an error if we also get a non-zero return code from mailq | ||
| 26 | > # unless already set to critical | ||
| 27 | > if ( $? ) { | ||
| 28 | > $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ; | ||
| 29 | > print "STDERR $?: $!\n" if $verbose; | ||
| 30 | > $msg = "$state: (stderr)\n"; | ||
| 31 | > } | ||
| 32 | > | ||
| 33 | > ## shut off the alarm | ||
| 34 | > alarm(0); | ||
| 35 | > | ||
| 36 | > # check queue length | ||
| 37 | > if ($lines[0]=~/Kbytes in (\d+)/) { | ||
| 38 | > $msg_q = $1 ; | ||
| 39 | > }elsif ($lines[0]=~/Mail queue is empty/) { | ||
| 40 | > $msg_q = 0; | ||
| 41 | > }else{ | ||
| 42 | > print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n"; | ||
| 43 | > exit $ERRORS{'UNKNOWN'}; | ||
| 44 | > } | ||
| 45 | > | ||
| 46 | > # check messages not processed | ||
| 47 | > #if ($lines[1]=~/^messages in queue but not yet preprocessed: (\d+)/) { | ||
| 48 | > # my $msg_p = $1; | ||
| 49 | > #}else{ | ||
| 50 | > # print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n"; | ||
| 51 | > # exit $ERRORS{'UNKNOWN'}; | ||
| 52 | > #} | ||
| 53 | > | ||
| 54 | > # check queue length(s) | ||
| 55 | > if ($msg_q == 0){ | ||
| 56 | > $msg = "OK: mailq reports queue is empty"; | ||
| 57 | > $state = $ERRORS{'OK'}; | ||
| 58 | > } else { | ||
| 59 | > print "msg_q = $msg_q warn=$opt_w crit=$opt_c\n" if $verbose; | ||
| 60 | > | ||
| 61 | > # overall queue length | ||
| 62 | > if ($msg_q < $opt_w) { | ||
| 63 | > $msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)"; | ||
| 64 | > $state = $ERRORS{'OK'}; | ||
| 65 | > }elsif ($msg_q >= $opt_w && $msg_q < $opt_c) { | ||
| 66 | > $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)"; | ||
| 67 | > $state = $ERRORS{'WARNING'}; | ||
| 68 | > }else { | ||
| 69 | > $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)"; | ||
| 70 | > $state = $ERRORS{'CRITICAL'}; | ||
| 71 | > } | ||
| 72 | > | ||
| 73 | > # check messages not yet preprocessed (only compare is $opt_W and $opt_C | ||
| 74 | > # are defined) | ||
| 75 | > | ||
| 76 | > #if (defined $opt_W) { | ||
| 77 | > # $msg .= "[Preprocessed = $msg_p]"; | ||
| 78 | > # if ($msg_p >= $opt_W && $msg_p < $opt_C ) { | ||
| 79 | > # $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ; | ||
| 80 | > # }elsif ($msg_p >= $opt_C ) { | ||
| 81 | > # $state = $ERRORS{"CRITICAL"} ; | ||
| 82 | > # } | ||
| 83 | > #} | ||
| 84 | > } | ||
| 85 | > } # end of ($mailq eq "postfixl") | ||
| 86 | 445c529 | ||
| 87 | < if ($opt_M =~ /sendmail/ || $opt_M =~ /qmail/ ) { | ||
| 88 | --- | ||
| 89 | > if ($opt_M =~ /sendmail/ || $opt_M =~ /qmail/ || $opt_M =~ /postfix/ ) { | ||
| 90 | 477c561 | ||
| 91 | < print "-M (--mailserver) = [ sendmail | qmail ] (default = sendmail)\n"; | ||
| 92 | --- | ||
| 93 | > print "-M (--mailserver) = [ sendmail | qmail | postfix ] (default = sendmail)\n"; | ||
diff --git a/web/attachments/50322-check_nwstat.c.patch b/web/attachments/50322-check_nwstat.c.patch new file mode 100644 index 0000000..4c11b08 --- /dev/null +++ b/web/attachments/50322-check_nwstat.c.patch | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | --- check_nwstat.c.old 2003-05-14 11:26:39.000000000 +0100 | ||
| 2 | +++ check_nwstat.c 2003-05-14 11:41:07.000000000 +0100 | ||
| 3 | @@ -24,7 +24,7 @@ | ||
| 4 | *****************************************************************************/ | ||
| 5 | |||
| 6 | const char *progname = "check_nwstat"; | ||
| 7 | -#define REVISION "$Revision: 1.6 $" | ||
| 8 | +#define REVISION "$Revision: 1.7 $" | ||
| 9 | #define COPYRIGHT "Copyright (c) 1999-2001 Ethan Galstad" | ||
| 10 | |||
| 11 | #define SUMMARY "\ | ||
| 12 | @@ -51,6 +51,7 @@ | ||
| 13 | CDBUFF = current number of dirty cache buffers\n\ | ||
| 14 | LRUM = LRU sitting time in minutes\n\ | ||
| 15 | DSDB = check to see if DS Database is open\n\ | ||
| 16 | + DSVER = NDS version\n\ | ||
| 17 | LOGINS = check to see if logins are enabled\n\ | ||
| 18 | UPRB = used packet receive buffers\n\ | ||
| 19 | PUPRB = percent (of max) used packet receive buffers\n\ | ||
| 20 | @@ -67,6 +68,7 @@ | ||
| 21 | LRUS = LRU sitting time in seconds\n\ | ||
| 22 | DCB = dirty cache buffers as a percentage of the total\n\ | ||
| 23 | TCB = dirty cache buffers as a percentage of the original\n\ | ||
| 24 | + UPTIME = server uptime\n\ | ||
| 25 | -w, --warning=INTEGER\n\ | ||
| 26 | Threshold which will result in a warning status\n\ | ||
| 27 | -c, --critical=INTEGER\n\ | ||
| 28 | @@ -123,6 +125,8 @@ | ||
| 29 | #define CHECK_LRUS 24 /* check LRU sitting time in seconds */ | ||
| 30 | #define CHECK_DCB 25 /* check dirty cache buffers as a percentage of the total */ | ||
| 31 | #define CHECK_TCB 26 /* check total cache buffers as a percentage of the original */ | ||
| 32 | +#define CHECK_DSVER 27 /* check NDS version */ | ||
| 33 | +#define CHECK_UPTIME 28 /* check server uptime */ | ||
| 34 | |||
| 35 | #define PORT 9999 | ||
| 36 | |||
| 37 | @@ -664,7 +668,7 @@ | ||
| 38 | asprintf(&output_message,"dirty cache buffers = %d%% of the total",dirty_cache_buffers); | ||
| 39 | |||
| 40 | /* check % total cache buffers as a percentage of the original*/ | ||
| 41 | - } else if (vars_to_check==CHECK_TCB) { | ||
| 42 | + } else if (vars_to_check==CHECK_TCB) { | ||
| 43 | |||
| 44 | send_buffer = strscpy(send_buffer,"S7\r\n"); | ||
| 45 | result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 46 | @@ -678,6 +682,26 @@ | ||
| 47 | result=STATE_WARNING; | ||
| 48 | asprintf(&output_message,"total cache buffers = %d%% of the original",total_cache_buffers); | ||
| 49 | |||
| 50 | + } else if (vars_to_check==CHECK_DSVER) { | ||
| 51 | + asprintf(&send_buffer,"S13\r\n"); | ||
| 52 | + result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 53 | + if(result!=STATE_OK) | ||
| 54 | + return result; | ||
| 55 | + | ||
| 56 | + recv_buffer[strlen(recv_buffer)-1]=0; | ||
| 57 | + | ||
| 58 | + asprintf(&output_message,"NDS Version %s",recv_buffer); | ||
| 59 | + | ||
| 60 | + } else if (vars_to_check==CHECK_UPTIME) { | ||
| 61 | + asprintf(&send_buffer,"UPTIME\r\n"); | ||
| 62 | + result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 63 | + if(result!=STATE_OK) | ||
| 64 | + return result; | ||
| 65 | + | ||
| 66 | + recv_buffer[strlen(recv_buffer)-1]=0; | ||
| 67 | + | ||
| 68 | + asprintf(&output_message,"Up %s",recv_buffer); | ||
| 69 | + | ||
| 70 | } else { | ||
| 71 | |||
| 72 | output_message = strscpy(output_message,"Nothing to check!\n"); | ||
| 73 | @@ -847,6 +871,10 @@ | ||
| 74 | vars_to_check=CHECK_CSPROCS; | ||
| 75 | else if(!strcmp(optarg,"TSYNC")) | ||
| 76 | vars_to_check=CHECK_TSYNC; | ||
| 77 | + else if(!strcmp(optarg,"DSVER")) | ||
| 78 | + vars_to_check=CHECK_DSVER; | ||
| 79 | + else if(!strcmp(optarg,"UPTIME")) | ||
| 80 | + vars_to_check=CHECK_UPTIME; | ||
| 81 | else | ||
| 82 | return ERROR; | ||
| 83 | break; | ||
diff --git a/web/attachments/50702-check_pop3.patch b/web/attachments/50702-check_pop3.patch new file mode 100644 index 0000000..2c897e3 --- /dev/null +++ b/web/attachments/50702-check_pop3.patch | |||
| @@ -0,0 +1,213 @@ | |||
| 1 | *** check_pop3.pl.orig 2002-02-27 22:42:53.000000000 -0800 | ||
| 2 | --- check_pop3.pl 2003-05-19 14:57:06.000000000 -0700 | ||
| 3 | *************** | ||
| 4 | *** 23,32 **** | ||
| 5 | # with perl -wT and 'use strict' | ||
| 6 | # 2000/01/20 RM Corrected POP3 Exit State. | ||
| 7 | # 2000/01/21 RM Fix Exit Codes Again!! | ||
| 8 | # ------------------------------------------------------------------------------ | ||
| 9 | |||
| 10 | # -----------------------------------------------------------------[ Require ]-- | ||
| 11 | ! require 5.004; | ||
| 12 | |||
| 13 | # --------------------------------------------------------------------[ Uses ]-- | ||
| 14 | use Socket; | ||
| 15 | --- 23,34 ---- | ||
| 16 | # with perl -wT and 'use strict' | ||
| 17 | # 2000/01/20 RM Corrected POP3 Exit State. | ||
| 18 | # 2000/01/21 RM Fix Exit Codes Again!! | ||
| 19 | + # 2003/05/17 CS Cleaned up little, simplifed logic flow, better | ||
| 20 | + # checking of return status from server. | ||
| 21 | # ------------------------------------------------------------------------------ | ||
| 22 | |||
| 23 | # -----------------------------------------------------------------[ Require ]-- | ||
| 24 | ! use 5.004; | ||
| 25 | |||
| 26 | # --------------------------------------------------------------------[ Uses ]-- | ||
| 27 | use Socket; | ||
| 28 | *************** | ||
| 29 | *** 37,43 **** | ||
| 30 | $ENV{BASH_ENV} = ""; | ||
| 31 | $|=1; | ||
| 32 | # ------------------------------------------------------------------[ Global ]-- | ||
| 33 | ! my $TIMEOUT = 60; | ||
| 34 | |||
| 35 | # -------------------------------------------------------------------[ usage ]-- | ||
| 36 | sub usage | ||
| 37 | --- 39,46 ---- | ||
| 38 | $ENV{BASH_ENV} = ""; | ||
| 39 | $|=1; | ||
| 40 | # ------------------------------------------------------------------[ Global ]-- | ||
| 41 | ! my $TIMEOUT = 30; | ||
| 42 | ! my $DEBUG = 0; | ||
| 43 | |||
| 44 | # -------------------------------------------------------------------[ usage ]-- | ||
| 45 | sub usage | ||
| 46 | *************** | ||
| 47 | *** 65,78 **** | ||
| 48 | my $that; | ||
| 49 | my ($name, $aliases,$type,$len,$thataddr) = gethostbyname($in_remotehost); | ||
| 50 | |||
| 51 | ! if (!socket(ClientSocket,AF_INET, SOCK_STREAM, $proto)) { die $!; } | ||
| 52 | $sockaddr = 'S n a4 x8'; | ||
| 53 | $this = pack($sockaddr, AF_INET, 0, $thisaddr); | ||
| 54 | $that = pack($sockaddr, AF_INET, $in_remoteport, $thataddr); | ||
| 55 | ! if (!bind(ClientSocket, $this)) { print "Connection Refused"; exit 2; } | ||
| 56 | ! if (!connect(ClientSocket, $that)) { print "Connection Refused"; exit 2; } | ||
| 57 | ! select(ClientSocket); $| = 1; select(STDOUT); | ||
| 58 | ! return \*ClientSocket; | ||
| 59 | } | ||
| 60 | |||
| 61 | # ====================================================================[ MAIN ]== | ||
| 62 | --- 68,88 ---- | ||
| 63 | my $that; | ||
| 64 | my ($name, $aliases,$type,$len,$thataddr) = gethostbyname($in_remotehost); | ||
| 65 | |||
| 66 | ! if (!socket(POPS,AF_INET, SOCK_STREAM, $proto)) { | ||
| 67 | ! err("$!"); | ||
| 68 | ! } | ||
| 69 | $sockaddr = 'S n a4 x8'; | ||
| 70 | $this = pack($sockaddr, AF_INET, 0, $thisaddr); | ||
| 71 | $that = pack($sockaddr, AF_INET, $in_remoteport, $thataddr); | ||
| 72 | ! if (!bind(POPS, $this)) { | ||
| 73 | ! err("$!"); | ||
| 74 | ! } | ||
| 75 | ! if (!connect(POPS, $that)) { | ||
| 76 | ! err("$!"); | ||
| 77 | ! } | ||
| 78 | ! select(POPS); $|=1; | ||
| 79 | ! select(STDOUT); $|=1; | ||
| 80 | ! return \*POPS; | ||
| 81 | } | ||
| 82 | |||
| 83 | # ====================================================================[ MAIN ]== | ||
| 84 | *************** | ||
| 85 | *** 86,92 **** | ||
| 86 | |||
| 87 | # Just in case of problems, let's not hang Nagios | ||
| 88 | $SIG{'ALRM'} = sub { | ||
| 89 | ! print "Something is Taking a Long Time, Increase Your TIMEOUT (Currently Set At $TIMEOUT Seconds)\n"; | ||
| 90 | exit -1; | ||
| 91 | }; | ||
| 92 | |||
| 93 | --- 96,102 ---- | ||
| 94 | |||
| 95 | # Just in case of problems, let's not hang Nagios | ||
| 96 | $SIG{'ALRM'} = sub { | ||
| 97 | ! print "POP3 Error: Timeout after $TIMEOUT seconds\n"; | ||
| 98 | exit -1; | ||
| 99 | }; | ||
| 100 | |||
| 101 | *************** | ||
| 102 | *** 94,144 **** | ||
| 103 | |||
| 104 | chop($hostname = `hostname`); | ||
| 105 | my ($name, $alias, $proto) = getprotobyname('tcp'); | ||
| 106 | ! my $ClientSocket = &bindRemote($remotehost,$remoteport,$hostname); | ||
| 107 | ! | ||
| 108 | ! | ||
| 109 | ! print ClientSocket "user $username\n"; | ||
| 110 | ! | ||
| 111 | ! #Debug Server | ||
| 112 | ! #print "user $username\n"; | ||
| 113 | ! | ||
| 114 | ! #Sleep or 3 secs, incase server is slow. | ||
| 115 | ! sleep 3; | ||
| 116 | |||
| 117 | ! print ClientSocket "pass $password\n"; | ||
| 118 | ! | ||
| 119 | ! #Debug Server | ||
| 120 | ! #print "pass $password\n"; | ||
| 121 | ! | ||
| 122 | ! while (<ClientSocket>) { | ||
| 123 | |||
| 124 | ! print ClientSocket "pass $password\n"; | ||
| 125 | |||
| 126 | ! #Debug Server | ||
| 127 | ! #print $_; | ||
| 128 | |||
| 129 | ! err($_) if (m/\-ERR\s+(.*)\s+.*/); | ||
| 130 | ! message($_) if (m/\+OK Mailbox open,\s+(.*\d)\s+messages.*/); | ||
| 131 | ! } | ||
| 132 | } | ||
| 133 | |||
| 134 | ! sub message | ||
| 135 | { | ||
| 136 | ! my $answer = "UNKNOWN"; | ||
| 137 | ! $answer = "Pop3 OK - Total Messages On Server :- $1"; | ||
| 138 | ! alarm(0); | ||
| 139 | ! print ClientSocket "quit\n"; | ||
| 140 | ! print "$answer"; | ||
| 141 | ! exit 0; | ||
| 142 | } | ||
| 143 | |||
| 144 | sub err | ||
| 145 | { | ||
| 146 | ! my $answer = "UNKNOWN"; | ||
| 147 | ! $answer = "Pop3 Error :- $1"; | ||
| 148 | alarm(0); | ||
| 149 | ! print ClientSocket "quit\n"; | ||
| 150 | ! print "$answer"; | ||
| 151 | exit 2; | ||
| 152 | } | ||
| 153 | |||
| 154 | --- 104,162 ---- | ||
| 155 | |||
| 156 | chop($hostname = `hostname`); | ||
| 157 | my ($name, $alias, $proto) = getprotobyname('tcp'); | ||
| 158 | ! my $POPS = &bindRemote($remotehost,$remoteport,$hostname); | ||
| 159 | |||
| 160 | ! # Wait for server to come ready | ||
| 161 | ! alarm($TIMEOUT); | ||
| 162 | ! $_ = <POPS>; | ||
| 163 | ! if (! /^.OK/) { err($_, *POPS); } | ||
| 164 | ! print STDERR "<< $_" if $DEBUG; | ||
| 165 | |||
| 166 | ! # Send login name | ||
| 167 | ! alarm($TIMEOUT); | ||
| 168 | ! print STDERR ">> user $username\n" if $DEBUG; | ||
| 169 | ! print POPS "user $username\n"; | ||
| 170 | ! $_ = <POPS>; | ||
| 171 | ! if (! /^.OK/) { err($_, *POPS); } | ||
| 172 | ! print STDERR "<< $_" if $DEBUG; | ||
| 173 | |||
| 174 | ! # Send login password | ||
| 175 | ! alarm($TIMEOUT); | ||
| 176 | ! print STDERR ">> pass $password\n" if $DEBUG; | ||
| 177 | ! print POPS "pass $password\n"; | ||
| 178 | ! $_ = <POPS>; | ||
| 179 | ! if (! /^.OK/) { err($_, *POPS); } | ||
| 180 | ! print STDERR "<< $_" if $DEBUG; | ||
| 181 | ! | ||
| 182 | ! # Return the good news | ||
| 183 | ! print "POP3 OK - $_"; | ||
| 184 | |||
| 185 | ! logout(*POPS); | ||
| 186 | } | ||
| 187 | |||
| 188 | ! sub logout | ||
| 189 | { | ||
| 190 | ! my $pops = shift; | ||
| 191 | ! | ||
| 192 | ! print STDERR ">> quit\n" if $DEBUG; | ||
| 193 | ! print $pops "quit\n"; | ||
| 194 | ! $_ = <$$pops>; | ||
| 195 | ! print STDERR "<< $_" if $DEBUG; | ||
| 196 | ! close($pops); | ||
| 197 | ! print STDERR "\nClosed socket\n" if $DEBUG; | ||
| 198 | ! | ||
| 199 | } | ||
| 200 | |||
| 201 | sub err | ||
| 202 | { | ||
| 203 | ! my ($msg, $pops) = @_; | ||
| 204 | ! | ||
| 205 | alarm(0); | ||
| 206 | ! print "POP3 Error: $msg"; | ||
| 207 | ! | ||
| 208 | ! if (defined($pops)) { | ||
| 209 | ! logout($pops); | ||
| 210 | ! } | ||
| 211 | exit 2; | ||
| 212 | } | ||
| 213 | |||
diff --git a/web/attachments/50703-check_disk_smb.patch b/web/attachments/50703-check_disk_smb.patch new file mode 100644 index 0000000..55f4403 --- /dev/null +++ b/web/attachments/50703-check_disk_smb.patch | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | *** check_disk_smb 2003-05-19 15:04:55.000000000 -0700 | ||
| 2 | --- check_disk_smb.orig 2003-05-19 15:04:43.000000000 -0700 | ||
| 3 | *************** | ||
| 4 | *** 205,221 **** | ||
| 5 | $answer = "Result from smbclient not suitable\n"; | ||
| 6 | $state = "UNKNOWN"; | ||
| 7 | foreach (@lines) { | ||
| 8 | ! if (/(Access denied|NT_STATUS_LOGON_FAILURE)/) { | ||
| 9 | $answer = "Access Denied\n"; | ||
| 10 | $state = "CRITICAL"; | ||
| 11 | last; | ||
| 12 | } | ||
| 13 | ! if (/(Unknown host \w*|Connection.*failed)/) { | ||
| 14 | ! $answer = "$1\n"; | ||
| 15 | $state = "CRITICAL"; | ||
| 16 | last; | ||
| 17 | } | ||
| 18 | ! if (/(You specified an invalid share name|NT_STATUS_BAD_NETWORK_NAME)/) { | ||
| 19 | $answer = "Invalid share name \\\\$host\\$share\n"; | ||
| 20 | $state = "CRITICAL"; | ||
| 21 | last; | ||
| 22 | --- 205,222 ---- | ||
| 23 | $answer = "Result from smbclient not suitable\n"; | ||
| 24 | $state = "UNKNOWN"; | ||
| 25 | foreach (@lines) { | ||
| 26 | ! if (/Access denied/) { | ||
| 27 | $answer = "Access Denied\n"; | ||
| 28 | $state = "CRITICAL"; | ||
| 29 | last; | ||
| 30 | } | ||
| 31 | ! if (/(Unknown host \w*)/) { | ||
| 32 | ! $answer = "$1\n";_ | ||
| 33 | ! | ||
| 34 | $state = "CRITICAL"; | ||
| 35 | last; | ||
| 36 | } | ||
| 37 | ! if (/(You specified an invalid share name)/) { | ||
| 38 | $answer = "Invalid share name \\\\$host\\$share\n"; | ||
| 39 | $state = "CRITICAL"; | ||
| 40 | last; | ||
diff --git a/web/attachments/50746-perf.patch b/web/attachments/50746-perf.patch new file mode 100644 index 0000000..72f1aad --- /dev/null +++ b/web/attachments/50746-perf.patch | |||
| @@ -0,0 +1,386 @@ | |||
| 1 | Only in nagios-plugins-1.3.0/plugins: Makefile | ||
| 2 | Only in nagios-plugins-1.3.0/plugins: check_by_ssh | ||
| 3 | Only in nagios-plugins-1.3.0/plugins: check_by_ssh.o | ||
| 4 | Only in nagios-plugins-1.3.0/plugins: check_dig | ||
| 5 | Only in nagios-plugins-1.3.0/plugins: check_dig.o | ||
| 6 | Only in nagios-plugins-1.3.0/plugins: check_disk | ||
| 7 | diff -u nagios-plugins-1.3.0-orig/plugins/check_disk.c nagios-plugins-1.3.0/plugins/check_disk.c | ||
| 8 | --- nagios-plugins-1.3.0-orig/plugins/check_disk.c 2003-02-15 13:48:44.000000000 +0100 | ||
| 9 | +++ nagios-plugins-1.3.0/plugins/check_disk.c 2003-05-20 12:51:58.000000000 +0200 | ||
| 10 | @@ -28,6 +28,8 @@ | ||
| 11 | * initailize usp to -1, eliminate 'found' variable | ||
| 12 | * accept any filename/filesystem | ||
| 13 | * use sscanf, drop while loop | ||
| 14 | + * - Modification by www.datux.nl 2003-01-24 | ||
| 15 | + * added performance data output | ||
| 16 | * | ||
| 17 | *****************************************************************************/ | ||
| 18 | |||
| 19 | @@ -64,6 +66,9 @@ | ||
| 20 | int total_disk = -1; | ||
| 21 | int used_disk = -1; | ||
| 22 | int free_disk = -1; | ||
| 23 | + int perf_total_disk = 0; | ||
| 24 | + int perf_free_disk = 0; | ||
| 25 | + int perf_used_disk = 0; | ||
| 26 | int result = STATE_UNKNOWN; | ||
| 27 | int disk_result = STATE_UNKNOWN; | ||
| 28 | char *command_line = ""; | ||
| 29 | @@ -96,6 +101,7 @@ | ||
| 30 | if (!index (input_buffer, '/')) | ||
| 31 | continue; | ||
| 32 | |||
| 33 | + /* did we get some usefull output from the 'df' process? */ | ||
| 34 | if (sscanf (input_buffer, "%s %d %d %d %d%% %s", file_system, | ||
| 35 | &total_disk, &used_disk, &free_disk, &usp, mntp) == 6 || | ||
| 36 | sscanf (input_buffer, "%s %*s %d %d %d %d%% %s", file_system, | ||
| 37 | @@ -118,6 +124,9 @@ | ||
| 38 | free_disk, 100 - usp, display_mntp ? mntp : file_system); | ||
| 39 | |||
| 40 | result = max_state (result, disk_result); | ||
| 41 | + perf_total_disk+=total_disk; | ||
| 42 | + perf_free_disk+=free_disk; | ||
| 43 | + perf_used_disk+=used_disk; | ||
| 44 | } | ||
| 45 | |||
| 46 | else { | ||
| 47 | @@ -147,8 +156,14 @@ | ||
| 48 | else if (result == STATE_UNKNOWN) | ||
| 49 | printf ("Unable to read output\n%s\n%s\n", command_line, input_buffer); | ||
| 50 | else | ||
| 51 | - printf ("DISK %s%s\n", state_text (result), output); | ||
| 52 | - | ||
| 53 | + printf ("DISK %s%s|total=%d,used=%d,free=%d,used_perc=%f,free_perc=%f\n", | ||
| 54 | + state_text (result), | ||
| 55 | + output, | ||
| 56 | + perf_total_disk, | ||
| 57 | + perf_used_disk, | ||
| 58 | + perf_free_disk, | ||
| 59 | + 100-((float)perf_free_disk*100/(float)perf_total_disk), | ||
| 60 | + ((float)perf_free_disk*100/(float)perf_total_disk)); | ||
| 61 | return result; | ||
| 62 | } | ||
| 63 | |||
| 64 | Only in nagios-plugins-1.3.0/plugins: check_disk.o | ||
| 65 | Only in nagios-plugins-1.3.0/plugins: check_dns | ||
| 66 | Only in nagios-plugins-1.3.0/plugins: check_dns.o | ||
| 67 | Only in nagios-plugins-1.3.0/plugins: check_dummy | ||
| 68 | Only in nagios-plugins-1.3.0/plugins: check_dummy.o | ||
| 69 | Only in nagios-plugins-1.3.0/plugins: check_ftp | ||
| 70 | Only in nagios-plugins-1.3.0/plugins: check_http | ||
| 71 | diff -u nagios-plugins-1.3.0-orig/plugins/check_http.c nagios-plugins-1.3.0/plugins/check_http.c | ||
| 72 | --- nagios-plugins-1.3.0-orig/plugins/check_http.c 2003-02-22 08:22:02.000000000 +0100 | ||
| 73 | +++ nagios-plugins-1.3.0/plugins/check_http.c 2003-05-20 12:51:58.000000000 +0200 | ||
| 74 | @@ -21,6 +21,9 @@ | ||
| 75 | * | ||
| 76 | * $Id: check_http.c,v 1.24 2003/02/21 21:59:17 tonvoon Exp $ | ||
| 77 | * | ||
| 78 | + * Sun Feb 9 17:11:53 CET 2003 Modified by Edwin Eefting (edwin@datux.nl) | ||
| 79 | + * fixed performance data: no spaces please :) | ||
| 80 | + * | ||
| 81 | *****************************************************************************/ | ||
| 82 | |||
| 83 | const char *progname = "check_http"; | ||
| 84 | @@ -795,7 +798,7 @@ | ||
| 85 | else if (onredirect == STATE_CRITICAL) | ||
| 86 | printf ("HTTP CRITICAL"); | ||
| 87 | elapsed_time = delta_time (tv); | ||
| 88 | - asprintf (&msg, ": %s - %7.3f second response time %s%s|time=%7.3f\n", | ||
| 89 | + asprintf (&msg, ": %s - %7.3f second response time %s%s|time=%f\n", | ||
| 90 | status_line, elapsed_time, timestamp, | ||
| 91 | (display_html ? "</A>" : ""), elapsed_time); | ||
| 92 | terminate (onredirect, msg); | ||
| 93 | @@ -807,7 +810,7 @@ | ||
| 94 | |||
| 95 | /* check elapsed time */ | ||
| 96 | elapsed_time = delta_time (tv); | ||
| 97 | - asprintf (&msg, "HTTP problem: %s - %7.3f second response time %s%s|time=%7.3f\n", | ||
| 98 | + asprintf (&msg, "HTTP problem: %s - %7.3f second response time %s%s|time=%f\n", | ||
| 99 | status_line, elapsed_time, timestamp, | ||
| 100 | (display_html ? "</A>" : ""), elapsed_time); | ||
| 101 | if (check_critical_time == TRUE && elapsed_time > critical_time) | ||
| 102 | @@ -835,14 +838,14 @@ | ||
| 103 | if (strlen (regexp)) { | ||
| 104 | errcode = regexec (&preg, page, REGS, pmatch, 0); | ||
| 105 | if (errcode == 0) { | ||
| 106 | - printf ("HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n", | ||
| 107 | + printf ("HTTP ok: %s - %7.3f second response time %s%s|time=%f\n", | ||
| 108 | status_line, elapsed_time, | ||
| 109 | timestamp, (display_html ? "</A>" : ""), elapsed_time); | ||
| 110 | exit (STATE_OK); | ||
| 111 | } | ||
| 112 | else { | ||
| 113 | if (errcode == REG_NOMATCH) { | ||
| 114 | - printf ("HTTP CRITICAL: pattern not found%s|time=%7.3f\n", | ||
| 115 | + printf ("HTTP CRITICAL: pattern not found%s|time=%f\n", | ||
| 116 | (display_html ? "</A>" : ""), elapsed_time); | ||
| 117 | exit (STATE_CRITICAL); | ||
| 118 | } | ||
| 119 | @@ -856,7 +859,7 @@ | ||
| 120 | #endif | ||
| 121 | |||
| 122 | /* We only get here if all tests have been passed */ | ||
| 123 | - asprintf (&msg, "HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n", | ||
| 124 | + asprintf (&msg, "HTTP ok: %s - %7.3f second response time %s%s|time=%f\n", | ||
| 125 | status_line, (float)elapsed_time, | ||
| 126 | timestamp, (display_html ? "</A>" : ""), elapsed_time); | ||
| 127 | terminate (STATE_OK, msg); | ||
| 128 | Only in nagios-plugins-1.3.0/plugins: check_http.c.rej | ||
| 129 | Only in nagios-plugins-1.3.0/plugins: check_http.c~ | ||
| 130 | Only in nagios-plugins-1.3.0/plugins: check_http.o | ||
| 131 | Only in nagios-plugins-1.3.0/plugins: check_imap | ||
| 132 | Only in nagios-plugins-1.3.0/plugins: check_load | ||
| 133 | diff -u nagios-plugins-1.3.0-orig/plugins/check_load.c nagios-plugins-1.3.0/plugins/check_load.c | ||
| 134 | --- nagios-plugins-1.3.0-orig/plugins/check_load.c 2003-02-18 23:16:06.000000000 +0100 | ||
| 135 | +++ nagios-plugins-1.3.0/plugins/check_load.c 2003-05-20 12:51:58.000000000 +0200 | ||
| 136 | @@ -19,6 +19,9 @@ | ||
| 137 | * mods by Ethan Galstad (nagios@nagios.org) | ||
| 138 | * 08/18/1999 - Integrated some code with common plugin utilities | ||
| 139 | * mods by Ethan Galstad (nagios@nagios.org) | ||
| 140 | + * 20/01/2003 - Now returns performance data | ||
| 141 | + * mods by Edwin Eefting (www.DatuX.nl) | ||
| 142 | + * | ||
| 143 | * $Date: 2003/02/18 22:10:55 $ | ||
| 144 | * Note: The load format is the same used by "uptime" and "w" | ||
| 145 | * | ||
| 146 | @@ -139,6 +142,10 @@ | ||
| 147 | } | ||
| 148 | if ((la1 >= wload1) || (la5 >= wload5) || (la15 >= wload15)) { | ||
| 149 | printf ("WARNING - %s\n", status_line); | ||
| 150 | + | ||
| 151 | + /* performance data */ | ||
| 152 | + printf ("|load1=%.2f,load5=%.2f,load15=%.2f", la1, la5, la15); | ||
| 153 | + | ||
| 154 | return STATE_WARNING; | ||
| 155 | } | ||
| 156 | printf ("OK - %s\n", status_line); | ||
| 157 | Only in nagios-plugins-1.3.0/plugins: check_load.o | ||
| 158 | Only in nagios-plugins-1.3.0/plugins: check_mrtg | ||
| 159 | Only in nagios-plugins-1.3.0/plugins: check_mrtg.o | ||
| 160 | Only in nagios-plugins-1.3.0/plugins: check_mrtgtraf | ||
| 161 | Only in nagios-plugins-1.3.0/plugins: check_mrtgtraf.o | ||
| 162 | Only in nagios-plugins-1.3.0/plugins: check_mysql | ||
| 163 | Only in nagios-plugins-1.3.0/plugins: check_mysql.o | ||
| 164 | Only in nagios-plugins-1.3.0/plugins: check_nagios | ||
| 165 | Only in nagios-plugins-1.3.0/plugins: check_nagios.o | ||
| 166 | Only in nagios-plugins-1.3.0/plugins: check_nntp | ||
| 167 | Only in nagios-plugins-1.3.0/plugins: check_nt | ||
| 168 | Only in nagios-plugins-1.3.0/plugins: check_nt.o | ||
| 169 | Only in nagios-plugins-1.3.0/plugins: check_nwstat | ||
| 170 | Only in nagios-plugins-1.3.0/plugins: check_nwstat.o | ||
| 171 | Only in nagios-plugins-1.3.0/plugins: check_overcr | ||
| 172 | Only in nagios-plugins-1.3.0/plugins: check_overcr.o | ||
| 173 | Only in nagios-plugins-1.3.0/plugins: check_ping | ||
| 174 | diff -u nagios-plugins-1.3.0-orig/plugins/check_ping.c nagios-plugins-1.3.0/plugins/check_ping.c | ||
| 175 | --- nagios-plugins-1.3.0-orig/plugins/check_ping.c 2003-02-15 13:48:45.000000000 +0100 | ||
| 176 | +++ nagios-plugins-1.3.0/plugins/check_ping.c 2003-05-20 12:51:58.000000000 +0200 | ||
| 177 | @@ -8,6 +8,10 @@ | ||
| 178 | * | ||
| 179 | * $Id: check_ping.c,v 1.11 2003/01/13 12:15:16 kdebisschop Exp $ | ||
| 180 | * | ||
| 181 | +* updated Mon Jan 20 19:03:57 CET 2003 by Edwin Eefting (DatuX.nl) | ||
| 182 | +* -minor bugfixes | ||
| 183 | +* -now returns performance data | ||
| 184 | +* | ||
| 185 | *****************************************************************************/ | ||
| 186 | |||
| 187 | const char *progname = "check_ping"; | ||
| 188 | @@ -18,7 +22,7 @@ | ||
| 189 | #define SUMMARY "Use ping to check connection statistics for a remote host.\n" | ||
| 190 | |||
| 191 | #define OPTIONS "\ | ||
| 192 | --H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n\ | ||
| 193 | +-H <host_address> -w <wrta>,<wpl>% -c <crta>,<cpl>%\n\ | ||
| 194 | [-p packets] [-t timeout] [-L]\n" | ||
| 195 | |||
| 196 | #define LONGOPTIONS "\ | ||
| 197 | @@ -135,14 +139,19 @@ | ||
| 198 | state_text (result), warn_text, pl, rta); | ||
| 199 | if (display_html == TRUE) | ||
| 200 | printf ("</A>"); | ||
| 201 | - printf ("\n"); | ||
| 202 | + | ||
| 203 | + /* print performance data */ | ||
| 204 | + printf("|loss=%d",pl); | ||
| 205 | + if (pl != 100) | ||
| 206 | + printf(",rta=%f",rta); | ||
| 207 | + printf("\n"); | ||
| 208 | |||
| 209 | if (verbose) | ||
| 210 | printf ("%f:%d%% %f:%d%%\n", wrta, wpl, crta, cpl); | ||
| 211 | |||
| 212 | return result; | ||
| 213 | } | ||
| 214 | - | ||
| 215 | + | ||
| 216 | |||
| 217 | /* process command-line arguments */ | ||
| 218 | int | ||
| 219 | @@ -340,7 +349,7 @@ | ||
| 220 | if (max_packets == -1) | ||
| 221 | max_packets = DEFAULT_MAX_PACKETS; | ||
| 222 | |||
| 223 | - max_seconds = crta / 1000.0 * max_packets + max_packets; | ||
| 224 | + max_seconds = crta / 1000.0 * max_packets + max_packets + 10; | ||
| 225 | if (max_seconds > timeout_interval) | ||
| 226 | timeout_interval = (int)max_seconds; | ||
| 227 | |||
| 228 | Only in nagios-plugins-1.3.0/plugins: check_ping.o | ||
| 229 | Only in nagios-plugins-1.3.0/plugins: check_pop | ||
| 230 | Only in nagios-plugins-1.3.0/plugins: check_procs | ||
| 231 | diff -u nagios-plugins-1.3.0-orig/plugins/check_procs.c nagios-plugins-1.3.0/plugins/check_procs.c | ||
| 232 | --- nagios-plugins-1.3.0-orig/plugins/check_procs.c 2003-02-15 13:48:45.000000000 +0100 | ||
| 233 | +++ nagios-plugins-1.3.0/plugins/check_procs.c 2003-05-20 12:51:58.000000000 +0200 | ||
| 234 | @@ -32,6 +32,9 @@ | ||
| 235 | * along with this program; if not, write to the Free Software | ||
| 236 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 237 | * | ||
| 238 | +* feb-9-2003 modified by Edwin Eefting (www.DatuX.nl) edwin@datux.nl | ||
| 239 | +* returns performance data | ||
| 240 | +* | ||
| 241 | ******************************************************************************/ | ||
| 242 | |||
| 243 | const char *progname = "check_procs"; | ||
| 244 | @@ -197,6 +200,9 @@ | ||
| 245 | return result; | ||
| 246 | } | ||
| 247 | |||
| 248 | + //add performance data to "format string" | ||
| 249 | + asprintf(&fmt,"%s|procs=%d\n",fmt,procs); | ||
| 250 | + | ||
| 251 | if (verbose && (options & STAT)) | ||
| 252 | printf ("%s ", statopts); | ||
| 253 | if (verbose && (options & PROG)) | ||
| 254 | @@ -427,6 +433,7 @@ | ||
| 255 | options |= STAT; | ||
| 256 | } | ||
| 257 | |||
| 258 | + | ||
| 259 | return validate_arguments (); | ||
| 260 | } | ||
| 261 | |||
| 262 | @@ -457,10 +464,10 @@ | ||
| 263 | |||
| 264 | if (options == 0) { | ||
| 265 | options = 1; | ||
| 266 | - asprintf (&fmt, "%%s - %%d processes running\n"); | ||
| 267 | + asprintf (&fmt, "%%s - %%d processes running"); | ||
| 268 | } | ||
| 269 | else { | ||
| 270 | - asprintf (&fmt, "%%s - %%d processes running with %s\n", fmt); | ||
| 271 | + asprintf (&fmt, "%%s - %%d processes running with %s", fmt); | ||
| 272 | } | ||
| 273 | |||
| 274 | return options; | ||
| 275 | Only in nagios-plugins-1.3.0/plugins: check_procs.o | ||
| 276 | Only in nagios-plugins-1.3.0/plugins: check_real | ||
| 277 | Only in nagios-plugins-1.3.0/plugins: check_real.o | ||
| 278 | Only in nagios-plugins-1.3.0/plugins: check_smtp | ||
| 279 | Only in nagios-plugins-1.3.0/plugins: check_smtp.o | ||
| 280 | Only in nagios-plugins-1.3.0/plugins: check_ssh | ||
| 281 | Only in nagios-plugins-1.3.0/plugins: check_ssh.o | ||
| 282 | Only in nagios-plugins-1.3.0/plugins: check_swap | ||
| 283 | diff -u nagios-plugins-1.3.0-orig/plugins/check_swap.c nagios-plugins-1.3.0/plugins/check_swap.c | ||
| 284 | --- nagios-plugins-1.3.0-orig/plugins/check_swap.c 2003-02-18 06:35:52.000000000 +0100 | ||
| 285 | +++ nagios-plugins-1.3.0/plugins/check_swap.c 2003-05-20 14:02:11.000000000 +0200 | ||
| 286 | @@ -23,6 +23,9 @@ | ||
| 287 | * | ||
| 288 | * $Id: check_swap.c,v 1.9 2003/02/18 03:46:15 sghosh Exp $ | ||
| 289 | * | ||
| 290 | + * feb 9 2003 - Modified by Edwin Eefting (www.DatuX.nl) edwin@datux.nl | ||
| 291 | + * Returns performance data | ||
| 292 | + * | ||
| 293 | *****************************************************************************/ | ||
| 294 | |||
| 295 | #include "common.h" | ||
| 296 | @@ -51,7 +54,7 @@ | ||
| 297 | int | ||
| 298 | main (int argc, char **argv) | ||
| 299 | { | ||
| 300 | - int percent_used, percent; | ||
| 301 | + float percent_used, percent; | ||
| 302 | long unsigned int total_swap = 0, used_swap = 0, free_swap = 0; | ||
| 303 | long unsigned int total, used, free; | ||
| 304 | int result = STATE_OK; | ||
| 305 | @@ -93,8 +96,8 @@ | ||
| 306 | result = max_state (STATE_CRITICAL, result); | ||
| 307 | else if (percent_used >= warn_percent || free_swap <= warn_size) | ||
| 308 | result = max_state (STATE_WARNING, result); | ||
| 309 | - asprintf (&status, "%s %2d%% (%lu out of %lu)", status, percent_used, | ||
| 310 | - used_swap, total_swap); | ||
| 311 | + asprintf (&status, "%s %2.0f%% (%lu out of %lu)|user_perc=%f,user=%d,total=%d", status, percent_used, | ||
| 312 | + used_swap, total_swap, percent_used, used_swap, total_swap); | ||
| 313 | fclose (fp); | ||
| 314 | #else | ||
| 315 | #ifdef HAVE_SWAP | ||
| 316 | @@ -146,8 +149,8 @@ | ||
| 317 | result = max_state (STATE_CRITICAL, result); | ||
| 318 | else if (percent_used >= warn_percent || free_swap <= warn_size) | ||
| 319 | result = max_state (STATE_WARNING, result); | ||
| 320 | - asprintf (&status, "%s %2d%% (%lu out of %lu)", | ||
| 321 | - status, percent_used, used_swap, total_swap); | ||
| 322 | + asprintf (&status, "%s %2.0f%% (%lu out of %lu)|used_perc=%f,user=%d,total=%d", | ||
| 323 | + status, percent_used, used_swap, total_swap, percent_used, used_swap, total_swap); | ||
| 324 | |||
| 325 | /* If we get anything on STDERR, at least set warning */ | ||
| 326 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) | ||
| 327 | Only in nagios-plugins-1.3.0/plugins: check_swap.c.rej | ||
| 328 | Only in nagios-plugins-1.3.0/plugins: check_swap.c~ | ||
| 329 | Only in nagios-plugins-1.3.0/plugins: check_swap.o | ||
| 330 | Only in nagios-plugins-1.3.0/plugins: check_tcp | ||
| 331 | Only in nagios-plugins-1.3.0/plugins: check_tcp.o | ||
| 332 | Only in nagios-plugins-1.3.0/plugins: check_time | ||
| 333 | Only in nagios-plugins-1.3.0/plugins: check_time.o | ||
| 334 | Only in nagios-plugins-1.3.0/plugins: check_udp | ||
| 335 | Only in nagios-plugins-1.3.0/plugins: check_udp.o | ||
| 336 | Only in nagios-plugins-1.3.0/plugins: check_ups | ||
| 337 | Only in nagios-plugins-1.3.0/plugins: check_ups.o | ||
| 338 | Only in nagios-plugins-1.3.0/plugins: check_users | ||
| 339 | diff -u nagios-plugins-1.3.0-orig/plugins/check_users.c nagios-plugins-1.3.0/plugins/check_users.c | ||
| 340 | --- nagios-plugins-1.3.0-orig/plugins/check_users.c 2003-02-15 13:48:46.000000000 +0100 | ||
| 341 | +++ nagios-plugins-1.3.0/plugins/check_users.c 2003-05-20 12:51:58.000000000 +0200 | ||
| 342 | @@ -42,6 +42,9 @@ | ||
| 343 | * along with this program; if not, write to the Free Software | ||
| 344 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 345 | * | ||
| 346 | + * feb-9-2003 modified by Edwin Eefting (www.DatuX.nl) edwin@datux.nl | ||
| 347 | + * returns performance data | ||
| 348 | + * | ||
| 349 | *****************************************************************************/ | ||
| 350 | |||
| 351 | #include "common.h" | ||
| 352 | @@ -120,8 +123,8 @@ | ||
| 353 | if (result == STATE_UNKNOWN) | ||
| 354 | printf ("Unable to read output\n"); | ||
| 355 | else | ||
| 356 | - printf ("USERS %s - %d users currently logged in\n", state_text (result), | ||
| 357 | - users); | ||
| 358 | + printf ("USERS %s - %d users currently logged in|users=%d\n", state_text (result), | ||
| 359 | + users,users); | ||
| 360 | |||
| 361 | return result; | ||
| 362 | } | ||
| 363 | Only in nagios-plugins-1.3.0/plugins: check_users.o | ||
| 364 | Only in nagios-plugins-1.3.0/plugins: check_vsz | ||
| 365 | Only in nagios-plugins-1.3.0/plugins: check_vsz.o | ||
| 366 | Only in nagios-plugins-1.3.0/plugins: common.h | ||
| 367 | Only in nagios-plugins-1.3.0/plugins: config.h | ||
| 368 | Only in nagios-plugins-1.3.0/plugins: negate | ||
| 369 | Only in nagios-plugins-1.3.0/plugins: negate.o | ||
| 370 | Only in nagios-plugins-1.3.0/plugins: netutils.h | ||
| 371 | Only in nagios-plugins-1.3.0/plugins: netutils.o | ||
| 372 | Only in nagios-plugins-1.3.0/plugins: perf.patch | ||
| 373 | Only in nagios-plugins-1.3.0/plugins: popen.h | ||
| 374 | Only in nagios-plugins-1.3.0/plugins: popen.o | ||
| 375 | Only in nagios-plugins-1.3.0/plugins: stamp-h1 | ||
| 376 | Only in nagios-plugins-1.3.0/plugins: stamp-h2 | ||
| 377 | Only in nagios-plugins-1.3.0/plugins: stamp-h3 | ||
| 378 | Only in nagios-plugins-1.3.0/plugins: stamp-h4 | ||
| 379 | Only in nagios-plugins-1.3.0/plugins: stamp-h5 | ||
| 380 | Only in nagios-plugins-1.3.0/plugins: stamp-h6 | ||
| 381 | Common subdirectories: nagios-plugins-1.3.0-orig/plugins/t and nagios-plugins-1.3.0/plugins/t | ||
| 382 | Only in nagios-plugins-1.3.0/plugins: urlize | ||
| 383 | Only in nagios-plugins-1.3.0/plugins: urlize.o | ||
| 384 | Only in nagios-plugins-1.3.0/plugins: utils.h | ||
| 385 | Only in nagios-plugins-1.3.0/plugins: utils.o | ||
| 386 | Only in nagios-plugins-1.3.0/plugins: version.h | ||
diff --git a/web/attachments/50795-perf.patch b/web/attachments/50795-perf.patch new file mode 100644 index 0000000..feaa2fc --- /dev/null +++ b/web/attachments/50795-perf.patch | |||
| @@ -0,0 +1,329 @@ | |||
| 1 | Only in nagios-client/nagios-plugins-1.3.0/plugins: Makefile | ||
| 2 | diff -u nagios-plugins-1.3.0-orig/plugins/check_disk.c nagios-client/nagios-plugins-1.3.0/plugins/check_disk.c | ||
| 3 | --- nagios-plugins-1.3.0-orig/plugins/check_disk.c 2003-02-15 13:48:44.000000000 +0100 | ||
| 4 | +++ nagios-client/nagios-plugins-1.3.0/plugins/check_disk.c 2003-05-20 12:51:58.000000000 +0200 | ||
| 5 | @@ -28,6 +28,8 @@ | ||
| 6 | * initailize usp to -1, eliminate 'found' variable | ||
| 7 | * accept any filename/filesystem | ||
| 8 | * use sscanf, drop while loop | ||
| 9 | + * - Modification by www.datux.nl 2003-01-24 | ||
| 10 | + * added performance data output | ||
| 11 | * | ||
| 12 | *****************************************************************************/ | ||
| 13 | |||
| 14 | @@ -64,6 +66,9 @@ | ||
| 15 | int total_disk = -1; | ||
| 16 | int used_disk = -1; | ||
| 17 | int free_disk = -1; | ||
| 18 | + int perf_total_disk = 0; | ||
| 19 | + int perf_free_disk = 0; | ||
| 20 | + int perf_used_disk = 0; | ||
| 21 | int result = STATE_UNKNOWN; | ||
| 22 | int disk_result = STATE_UNKNOWN; | ||
| 23 | char *command_line = ""; | ||
| 24 | @@ -96,6 +101,7 @@ | ||
| 25 | if (!index (input_buffer, '/')) | ||
| 26 | continue; | ||
| 27 | |||
| 28 | + /* did we get some usefull output from the 'df' process? */ | ||
| 29 | if (sscanf (input_buffer, "%s %d %d %d %d%% %s", file_system, | ||
| 30 | &total_disk, &used_disk, &free_disk, &usp, mntp) == 6 || | ||
| 31 | sscanf (input_buffer, "%s %*s %d %d %d %d%% %s", file_system, | ||
| 32 | @@ -118,6 +124,9 @@ | ||
| 33 | free_disk, 100 - usp, display_mntp ? mntp : file_system); | ||
| 34 | |||
| 35 | result = max_state (result, disk_result); | ||
| 36 | + perf_total_disk+=total_disk; | ||
| 37 | + perf_free_disk+=free_disk; | ||
| 38 | + perf_used_disk+=used_disk; | ||
| 39 | } | ||
| 40 | |||
| 41 | else { | ||
| 42 | @@ -147,8 +156,14 @@ | ||
| 43 | else if (result == STATE_UNKNOWN) | ||
| 44 | printf ("Unable to read output\n%s\n%s\n", command_line, input_buffer); | ||
| 45 | else | ||
| 46 | - printf ("DISK %s%s\n", state_text (result), output); | ||
| 47 | - | ||
| 48 | + printf ("DISK %s%s|total=%d,used=%d,free=%d,used_perc=%f,free_perc=%f\n", | ||
| 49 | + state_text (result), | ||
| 50 | + output, | ||
| 51 | + perf_total_disk, | ||
| 52 | + perf_used_disk, | ||
| 53 | + perf_free_disk, | ||
| 54 | + 100-((float)perf_free_disk*100/(float)perf_total_disk), | ||
| 55 | + ((float)perf_free_disk*100/(float)perf_total_disk)); | ||
| 56 | return result; | ||
| 57 | } | ||
| 58 | |||
| 59 | diff -u nagios-plugins-1.3.0-orig/plugins/check_http.c nagios-client/nagios-plugins-1.3.0/plugins/check_http.c | ||
| 60 | --- nagios-plugins-1.3.0-orig/plugins/check_http.c 2003-02-22 08:22:02.000000000 +0100 | ||
| 61 | +++ nagios-client/nagios-plugins-1.3.0/plugins/check_http.c 2003-05-20 12:51:58.000000000 +0200 | ||
| 62 | @@ -21,6 +21,9 @@ | ||
| 63 | * | ||
| 64 | * $Id: perf.patch,v 1.1 2003/05/20 17:45:04 psy Exp $ | ||
| 65 | * | ||
| 66 | + * Sun Feb 9 17:11:53 CET 2003 Modified by Edwin Eefting (edwin@datux.nl) | ||
| 67 | + * fixed performance data: no spaces please :) | ||
| 68 | + * | ||
| 69 | *****************************************************************************/ | ||
| 70 | |||
| 71 | const char *progname = "check_http"; | ||
| 72 | @@ -795,7 +798,7 @@ | ||
| 73 | else if (onredirect == STATE_CRITICAL) | ||
| 74 | printf ("HTTP CRITICAL"); | ||
| 75 | elapsed_time = delta_time (tv); | ||
| 76 | - asprintf (&msg, ": %s - %7.3f second response time %s%s|time=%7.3f\n", | ||
| 77 | + asprintf (&msg, ": %s - %7.3f second response time %s%s|time=%f\n", | ||
| 78 | status_line, elapsed_time, timestamp, | ||
| 79 | (display_html ? "</A>" : ""), elapsed_time); | ||
| 80 | terminate (onredirect, msg); | ||
| 81 | @@ -807,7 +810,7 @@ | ||
| 82 | |||
| 83 | /* check elapsed time */ | ||
| 84 | elapsed_time = delta_time (tv); | ||
| 85 | - asprintf (&msg, "HTTP problem: %s - %7.3f second response time %s%s|time=%7.3f\n", | ||
| 86 | + asprintf (&msg, "HTTP problem: %s - %7.3f second response time %s%s|time=%f\n", | ||
| 87 | status_line, elapsed_time, timestamp, | ||
| 88 | (display_html ? "</A>" : ""), elapsed_time); | ||
| 89 | if (check_critical_time == TRUE && elapsed_time > critical_time) | ||
| 90 | @@ -835,14 +838,14 @@ | ||
| 91 | if (strlen (regexp)) { | ||
| 92 | errcode = regexec (&preg, page, REGS, pmatch, 0); | ||
| 93 | if (errcode == 0) { | ||
| 94 | - printf ("HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n", | ||
| 95 | + printf ("HTTP ok: %s - %7.3f second response time %s%s|time=%f\n", | ||
| 96 | status_line, elapsed_time, | ||
| 97 | timestamp, (display_html ? "</A>" : ""), elapsed_time); | ||
| 98 | exit (STATE_OK); | ||
| 99 | } | ||
| 100 | else { | ||
| 101 | if (errcode == REG_NOMATCH) { | ||
| 102 | - printf ("HTTP CRITICAL: pattern not found%s|time=%7.3f\n", | ||
| 103 | + printf ("HTTP CRITICAL: pattern not found%s|time=%f\n", | ||
| 104 | (display_html ? "</A>" : ""), elapsed_time); | ||
| 105 | exit (STATE_CRITICAL); | ||
| 106 | } | ||
| 107 | @@ -856,7 +859,7 @@ | ||
| 108 | #endif | ||
| 109 | |||
| 110 | /* We only get here if all tests have been passed */ | ||
| 111 | - asprintf (&msg, "HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n", | ||
| 112 | + asprintf (&msg, "HTTP ok: %s - %7.3f second response time %s%s|time=%f\n", | ||
| 113 | status_line, (float)elapsed_time, | ||
| 114 | timestamp, (display_html ? "</A>" : ""), elapsed_time); | ||
| 115 | terminate (STATE_OK, msg); | ||
| 116 | Only in nagios-client/nagios-plugins-1.3.0/plugins: check_http.c.rej | ||
| 117 | Only in nagios-client/nagios-plugins-1.3.0/plugins: check_http.c~ | ||
| 118 | diff -u nagios-plugins-1.3.0-orig/plugins/check_load.c nagios-client/nagios-plugins-1.3.0/plugins/check_load.c | ||
| 119 | --- nagios-plugins-1.3.0-orig/plugins/check_load.c 2003-02-18 23:16:06.000000000 +0100 | ||
| 120 | +++ nagios-client/nagios-plugins-1.3.0/plugins/check_load.c 2003-05-20 18:59:25.000000000 +0200 | ||
| 121 | @@ -19,6 +19,9 @@ | ||
| 122 | * mods by Ethan Galstad (nagios@nagios.org) | ||
| 123 | * 08/18/1999 - Integrated some code with common plugin utilities | ||
| 124 | * mods by Ethan Galstad (nagios@nagios.org) | ||
| 125 | + * 20/01/2003 - Now returns performance data | ||
| 126 | + * mods by Edwin Eefting (www.DatuX.nl) | ||
| 127 | + * | ||
| 128 | * $Date: 2003/05/20 17:45:04 $ | ||
| 129 | * Note: The load format is the same used by "uptime" and "w" | ||
| 130 | * | ||
| 131 | @@ -132,13 +135,15 @@ | ||
| 132 | #endif | ||
| 133 | return STATE_UNKNOWN; | ||
| 134 | } | ||
| 135 | - asprintf(&status_line, "load average: %.2f, %.2f, %.2f", la1, la5, la15); | ||
| 136 | + asprintf(&status_line, "load average: %.2f, %.2f, %.2f|load1=%.2f,load5=%.2f,load15=%.2f", la1, la5, la15, la1, la5, la15); | ||
| 137 | if ((la1 >= cload1) || (la5 >= cload5) || (la15 >= cload15)) { | ||
| 138 | printf("CRITICAL - %s\n", status_line); | ||
| 139 | return STATE_CRITICAL; | ||
| 140 | } | ||
| 141 | if ((la1 >= wload1) || (la5 >= wload5) || (la15 >= wload15)) { | ||
| 142 | printf ("WARNING - %s\n", status_line); | ||
| 143 | + | ||
| 144 | + | ||
| 145 | return STATE_WARNING; | ||
| 146 | } | ||
| 147 | printf ("OK - %s\n", status_line); | ||
| 148 | diff -u nagios-plugins-1.3.0-orig/plugins/check_ping.c nagios-client/nagios-plugins-1.3.0/plugins/check_ping.c | ||
| 149 | --- nagios-plugins-1.3.0-orig/plugins/check_ping.c 2003-02-15 13:48:45.000000000 +0100 | ||
| 150 | +++ nagios-client/nagios-plugins-1.3.0/plugins/check_ping.c 2003-05-20 12:51:58.000000000 +0200 | ||
| 151 | @@ -8,6 +8,10 @@ | ||
| 152 | * | ||
| 153 | * $Id: perf.patch,v 1.1 2003/05/20 17:45:04 psy Exp $ | ||
| 154 | * | ||
| 155 | +* updated Mon Jan 20 19:03:57 CET 2003 by Edwin Eefting (DatuX.nl) | ||
| 156 | +* -minor bugfixes | ||
| 157 | +* -now returns performance data | ||
| 158 | +* | ||
| 159 | *****************************************************************************/ | ||
| 160 | |||
| 161 | const char *progname = "check_ping"; | ||
| 162 | @@ -18,7 +22,7 @@ | ||
| 163 | #define SUMMARY "Use ping to check connection statistics for a remote host.\n" | ||
| 164 | |||
| 165 | #define OPTIONS "\ | ||
| 166 | --H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n\ | ||
| 167 | +-H <host_address> -w <wrta>,<wpl>% -c <crta>,<cpl>%\n\ | ||
| 168 | [-p packets] [-t timeout] [-L]\n" | ||
| 169 | |||
| 170 | #define LONGOPTIONS "\ | ||
| 171 | @@ -135,14 +139,19 @@ | ||
| 172 | state_text (result), warn_text, pl, rta); | ||
| 173 | if (display_html == TRUE) | ||
| 174 | printf ("</A>"); | ||
| 175 | - printf ("\n"); | ||
| 176 | + | ||
| 177 | + /* print performance data */ | ||
| 178 | + printf("|loss=%d",pl); | ||
| 179 | + if (pl != 100) | ||
| 180 | + printf(",rta=%f",rta); | ||
| 181 | + printf("\n"); | ||
| 182 | |||
| 183 | if (verbose) | ||
| 184 | printf ("%f:%d%% %f:%d%%\n", wrta, wpl, crta, cpl); | ||
| 185 | |||
| 186 | return result; | ||
| 187 | } | ||
| 188 | - | ||
| 189 | + | ||
| 190 | |||
| 191 | /* process command-line arguments */ | ||
| 192 | int | ||
| 193 | @@ -340,7 +349,7 @@ | ||
| 194 | if (max_packets == -1) | ||
| 195 | max_packets = DEFAULT_MAX_PACKETS; | ||
| 196 | |||
| 197 | - max_seconds = crta / 1000.0 * max_packets + max_packets; | ||
| 198 | + max_seconds = crta / 1000.0 * max_packets + max_packets + 10; | ||
| 199 | if (max_seconds > timeout_interval) | ||
| 200 | timeout_interval = (int)max_seconds; | ||
| 201 | |||
| 202 | diff -u nagios-plugins-1.3.0-orig/plugins/check_procs.c nagios-client/nagios-plugins-1.3.0/plugins/check_procs.c | ||
| 203 | --- nagios-plugins-1.3.0-orig/plugins/check_procs.c 2003-02-15 13:48:45.000000000 +0100 | ||
| 204 | +++ nagios-client/nagios-plugins-1.3.0/plugins/check_procs.c 2003-05-20 12:51:58.000000000 +0200 | ||
| 205 | @@ -32,6 +32,9 @@ | ||
| 206 | * along with this program; if not, write to the Free Software | ||
| 207 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 208 | * | ||
| 209 | +* feb-9-2003 modified by Edwin Eefting (www.DatuX.nl) edwin@datux.nl | ||
| 210 | +* returns performance data | ||
| 211 | +* | ||
| 212 | ******************************************************************************/ | ||
| 213 | |||
| 214 | const char *progname = "check_procs"; | ||
| 215 | @@ -197,6 +200,9 @@ | ||
| 216 | return result; | ||
| 217 | } | ||
| 218 | |||
| 219 | + //add performance data to "format string" | ||
| 220 | + asprintf(&fmt,"%s|procs=%d\n",fmt,procs); | ||
| 221 | + | ||
| 222 | if (verbose && (options & STAT)) | ||
| 223 | printf ("%s ", statopts); | ||
| 224 | if (verbose && (options & PROG)) | ||
| 225 | @@ -427,6 +433,7 @@ | ||
| 226 | options |= STAT; | ||
| 227 | } | ||
| 228 | |||
| 229 | + | ||
| 230 | return validate_arguments (); | ||
| 231 | } | ||
| 232 | |||
| 233 | @@ -457,10 +464,10 @@ | ||
| 234 | |||
| 235 | if (options == 0) { | ||
| 236 | options = 1; | ||
| 237 | - asprintf (&fmt, "%%s - %%d processes running\n"); | ||
| 238 | + asprintf (&fmt, "%%s - %%d processes running"); | ||
| 239 | } | ||
| 240 | else { | ||
| 241 | - asprintf (&fmt, "%%s - %%d processes running with %s\n", fmt); | ||
| 242 | + asprintf (&fmt, "%%s - %%d processes running with %s", fmt); | ||
| 243 | } | ||
| 244 | |||
| 245 | return options; | ||
| 246 | diff -u nagios-plugins-1.3.0-orig/plugins/check_swap.c nagios-client/nagios-plugins-1.3.0/plugins/check_swap.c | ||
| 247 | --- nagios-plugins-1.3.0-orig/plugins/check_swap.c 2003-02-18 06:35:52.000000000 +0100 | ||
| 248 | +++ nagios-client/nagios-plugins-1.3.0/plugins/check_swap.c 2003-05-20 14:02:11.000000000 +0200 | ||
| 249 | @@ -23,6 +23,9 @@ | ||
| 250 | * | ||
| 251 | * $Id: perf.patch,v 1.1 2003/05/20 17:45:04 psy Exp $ | ||
| 252 | * | ||
| 253 | + * feb 9 2003 - Modified by Edwin Eefting (www.DatuX.nl) edwin@datux.nl | ||
| 254 | + * Returns performance data | ||
| 255 | + * | ||
| 256 | *****************************************************************************/ | ||
| 257 | |||
| 258 | #include "common.h" | ||
| 259 | @@ -51,7 +54,7 @@ | ||
| 260 | int | ||
| 261 | main (int argc, char **argv) | ||
| 262 | { | ||
| 263 | - int percent_used, percent; | ||
| 264 | + float percent_used, percent; | ||
| 265 | long unsigned int total_swap = 0, used_swap = 0, free_swap = 0; | ||
| 266 | long unsigned int total, used, free; | ||
| 267 | int result = STATE_OK; | ||
| 268 | @@ -93,8 +96,8 @@ | ||
| 269 | result = max_state (STATE_CRITICAL, result); | ||
| 270 | else if (percent_used >= warn_percent || free_swap <= warn_size) | ||
| 271 | result = max_state (STATE_WARNING, result); | ||
| 272 | - asprintf (&status, "%s %2d%% (%lu out of %lu)", status, percent_used, | ||
| 273 | - used_swap, total_swap); | ||
| 274 | + asprintf (&status, "%s %2.0f%% (%lu out of %lu)|user_perc=%f,user=%d,total=%d", status, percent_used, | ||
| 275 | + used_swap, total_swap, percent_used, used_swap, total_swap); | ||
| 276 | fclose (fp); | ||
| 277 | #else | ||
| 278 | #ifdef HAVE_SWAP | ||
| 279 | @@ -146,8 +149,8 @@ | ||
| 280 | result = max_state (STATE_CRITICAL, result); | ||
| 281 | else if (percent_used >= warn_percent || free_swap <= warn_size) | ||
| 282 | result = max_state (STATE_WARNING, result); | ||
| 283 | - asprintf (&status, "%s %2d%% (%lu out of %lu)", | ||
| 284 | - status, percent_used, used_swap, total_swap); | ||
| 285 | + asprintf (&status, "%s %2.0f%% (%lu out of %lu)|used_perc=%f,user=%d,total=%d", | ||
| 286 | + status, percent_used, used_swap, total_swap, percent_used, used_swap, total_swap); | ||
| 287 | |||
| 288 | /* If we get anything on STDERR, at least set warning */ | ||
| 289 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) | ||
| 290 | Only in nagios-client/nagios-plugins-1.3.0/plugins: check_swap.c.rej | ||
| 291 | Only in nagios-client/nagios-plugins-1.3.0/plugins: check_swap.c~ | ||
| 292 | diff -u nagios-plugins-1.3.0-orig/plugins/check_users.c nagios-client/nagios-plugins-1.3.0/plugins/check_users.c | ||
| 293 | --- nagios-plugins-1.3.0-orig/plugins/check_users.c 2003-02-15 13:48:46.000000000 +0100 | ||
| 294 | +++ nagios-client/nagios-plugins-1.3.0/plugins/check_users.c 2003-05-20 12:51:58.000000000 +0200 | ||
| 295 | @@ -42,6 +42,9 @@ | ||
| 296 | * along with this program; if not, write to the Free Software | ||
| 297 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 298 | * | ||
| 299 | + * feb-9-2003 modified by Edwin Eefting (www.DatuX.nl) edwin@datux.nl | ||
| 300 | + * returns performance data | ||
| 301 | + * | ||
| 302 | *****************************************************************************/ | ||
| 303 | |||
| 304 | #include "common.h" | ||
| 305 | @@ -120,8 +123,8 @@ | ||
| 306 | if (result == STATE_UNKNOWN) | ||
| 307 | printf ("Unable to read output\n"); | ||
| 308 | else | ||
| 309 | - printf ("USERS %s - %d users currently logged in\n", state_text (result), | ||
| 310 | - users); | ||
| 311 | + printf ("USERS %s - %d users currently logged in|users=%d\n", state_text (result), | ||
| 312 | + users,users); | ||
| 313 | |||
| 314 | return result; | ||
| 315 | } | ||
| 316 | Only in nagios-client/nagios-plugins-1.3.0/plugins: common.h | ||
| 317 | Only in nagios-client/nagios-plugins-1.3.0/plugins: config.h | ||
| 318 | Only in nagios-client/nagios-plugins-1.3.0/plugins: netutils.h | ||
| 319 | Only in nagios-client/nagios-plugins-1.3.0/plugins: perf.patch | ||
| 320 | Only in nagios-client/nagios-plugins-1.3.0/plugins: popen.h | ||
| 321 | Only in nagios-client/nagios-plugins-1.3.0/plugins: stamp-h1 | ||
| 322 | Only in nagios-client/nagios-plugins-1.3.0/plugins: stamp-h2 | ||
| 323 | Only in nagios-client/nagios-plugins-1.3.0/plugins: stamp-h3 | ||
| 324 | Only in nagios-client/nagios-plugins-1.3.0/plugins: stamp-h4 | ||
| 325 | Only in nagios-client/nagios-plugins-1.3.0/plugins: stamp-h5 | ||
| 326 | Only in nagios-client/nagios-plugins-1.3.0/plugins: stamp-h6 | ||
| 327 | Common subdirectories: nagios-plugins-1.3.0-orig/plugins/t and nagios-client/nagios-plugins-1.3.0/plugins/t | ||
| 328 | Only in nagios-client/nagios-plugins-1.3.0/plugins: utils.h | ||
| 329 | Only in nagios-client/nagios-plugins-1.3.0/plugins: version.h | ||
diff --git a/web/attachments/50884-check_nwstat.c.diff b/web/attachments/50884-check_nwstat.c.diff new file mode 100644 index 0000000..8e0b55a --- /dev/null +++ b/web/attachments/50884-check_nwstat.c.diff | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | --- check_nwstat.old 2003-05-21 11:52:20.000000000 +0100 | ||
| 2 | +++ check_nwstat.c 2003-05-21 12:58:12.000000000 +0100 | ||
| 3 | @@ -24,7 +24,7 @@ | ||
| 4 | *****************************************************************************/ | ||
| 5 | |||
| 6 | const char *progname = "check_nwstat"; | ||
| 7 | -#define REVISION "$Revision: 1.7 $" | ||
| 8 | +#define REVISION "$Revision: 1.8 $" | ||
| 9 | #define COPYRIGHT "Copyright (c) 1999-2001 Ethan Galstad" | ||
| 10 | |||
| 11 | #define SUMMARY "\ | ||
| 12 | @@ -69,6 +69,8 @@ | ||
| 13 | DCB = dirty cache buffers as a percentage of the total\n\ | ||
| 14 | TCB = dirty cache buffers as a percentage of the original\n\ | ||
| 15 | UPTIME = server uptime\n\ | ||
| 16 | + NLM:<nlm> = check if NLM is loaded (e.g. \"NLM:TSANDS.NLM\")\n\ | ||
| 17 | + NLMVER:<nlm> = check NLM version\n\ | ||
| 18 | -w, --warning=INTEGER\n\ | ||
| 19 | Threshold which will result in a warning status\n\ | ||
| 20 | -c, --critical=INTEGER\n\ | ||
| 21 | @@ -127,11 +129,14 @@ | ||
| 22 | #define CHECK_TCB 26 /* check total cache buffers as a percentage of the original */ | ||
| 23 | #define CHECK_DSVER 27 /* check NDS version */ | ||
| 24 | #define CHECK_UPTIME 28 /* check server uptime */ | ||
| 25 | +#define CHECK_NLM 29 /* check NLM loaded */ | ||
| 26 | +#define CHECK_NLMVER 30 /* check NLM version */ | ||
| 27 | |||
| 28 | #define PORT 9999 | ||
| 29 | |||
| 30 | char *server_address=NULL; | ||
| 31 | char *volume_name=NULL; | ||
| 32 | +char *nlm_name=NULL; | ||
| 33 | int server_port=PORT; | ||
| 34 | unsigned long warning_value=0L; | ||
| 35 | unsigned long critical_value=0L; | ||
| 36 | @@ -702,6 +707,32 @@ | ||
| 37 | |||
| 38 | asprintf(&output_message,"Up %s",recv_buffer); | ||
| 39 | |||
| 40 | + } else if (vars_to_check==CHECK_NLM) { | ||
| 41 | + asprintf(&send_buffer,"S23:%s\r\n",nlm_name); | ||
| 42 | + result=process_tcp_request(server_address,server_port,send_buff\ | ||
| 43 | +er,recv_buffer,sizeof(recv_buffer)); | ||
| 44 | + if(result!=STATE_OK) | ||
| 45 | + return result; | ||
| 46 | + if(!strcmp(recv_buffer,"1\n")) { | ||
| 47 | + asprintf(&output_message,"Module %s is loaded",nlm_name); | ||
| 48 | + } else { | ||
| 49 | + result=STATE_CRITICAL; | ||
| 50 | + asprintf(&output_message,"Module %s is not loaded",nlm_name); | ||
| 51 | + } | ||
| 52 | + } else if (vars_to_check==CHECK_NLMVER) { | ||
| 53 | + asprintf(&send_buffer,"S24:%s\r\n",nlm_name); | ||
| 54 | + result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 55 | + if(result!=STATE_OK) | ||
| 56 | + return result; | ||
| 57 | + | ||
| 58 | + recv_buffer[strlen(recv_buffer)-1]=0; | ||
| 59 | + if(strcmp(recv_buffer,"-1")) { | ||
| 60 | + asprintf(&output_message,"%s version %s",nlm_name,recv_buffer); | ||
| 61 | + } else { | ||
| 62 | + result=STATE_CRITICAL; | ||
| 63 | + asprintf(&output_message,"Module %s is not loaded",nlm_name); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | } else { | ||
| 67 | |||
| 68 | output_message = strscpy(output_message,"Nothing to check!\n"); | ||
| 69 | @@ -875,6 +906,14 @@ | ||
| 70 | vars_to_check=CHECK_DSVER; | ||
| 71 | else if(!strcmp(optarg,"UPTIME")) | ||
| 72 | vars_to_check=CHECK_UPTIME; | ||
| 73 | + else if(strncmp(optarg,"NLM:",4)==0) { | ||
| 74 | + vars_to_check=CHECK_NLM; | ||
| 75 | + nlm_name=strscpy(nlm_name,optarg+4); | ||
| 76 | + } | ||
| 77 | + else if(strncmp(optarg,"NLMVER:",7)==0) { | ||
| 78 | + vars_to_check=CHECK_NLMVER; | ||
| 79 | + nlm_name=strscpy(nlm_name,optarg+7); | ||
| 80 | + } | ||
| 81 | else | ||
| 82 | return ERROR; | ||
| 83 | break; | ||
diff --git a/web/attachments/50888-check_nwstat.c.diff b/web/attachments/50888-check_nwstat.c.diff new file mode 100644 index 0000000..ec41c30 --- /dev/null +++ b/web/attachments/50888-check_nwstat.c.diff | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | --- check_nwstat.old 2003-05-21 11:52:20.000000000 +0100 | ||
| 2 | +++ check_nwstat.c 2003-05-21 13:18:21.000000000 +0100 | ||
| 3 | @@ -24,7 +24,7 @@ | ||
| 4 | *****************************************************************************/ | ||
| 5 | |||
| 6 | const char *progname = "check_nwstat"; | ||
| 7 | -#define REVISION "$Revision: 1.7 $" | ||
| 8 | +#define REVISION "$Revision: 1.8 $" | ||
| 9 | #define COPYRIGHT "Copyright (c) 1999-2001 Ethan Galstad" | ||
| 10 | |||
| 11 | #define SUMMARY "\ | ||
| 12 | @@ -69,6 +69,7 @@ | ||
| 13 | DCB = dirty cache buffers as a percentage of the total\n\ | ||
| 14 | TCB = dirty cache buffers as a percentage of the original\n\ | ||
| 15 | UPTIME = server uptime\n\ | ||
| 16 | + NLM:<nlm> = check if NLM is loaded and report version (e.g. \"NLM:TSANDS.NLM\")\n\ | ||
| 17 | -w, --warning=INTEGER\n\ | ||
| 18 | Threshold which will result in a warning status\n\ | ||
| 19 | -c, --critical=INTEGER\n\ | ||
| 20 | @@ -127,11 +128,13 @@ | ||
| 21 | #define CHECK_TCB 26 /* check total cache buffers as a percentage of the original */ | ||
| 22 | #define CHECK_DSVER 27 /* check NDS version */ | ||
| 23 | #define CHECK_UPTIME 28 /* check server uptime */ | ||
| 24 | +#define CHECK_NLM 29 /* check NLM loaded */ | ||
| 25 | |||
| 26 | #define PORT 9999 | ||
| 27 | |||
| 28 | char *server_address=NULL; | ||
| 29 | char *volume_name=NULL; | ||
| 30 | +char *nlm_name=NULL; | ||
| 31 | int server_port=PORT; | ||
| 32 | unsigned long warning_value=0L; | ||
| 33 | unsigned long critical_value=0L; | ||
| 34 | @@ -702,6 +705,20 @@ | ||
| 35 | |||
| 36 | asprintf(&output_message,"Up %s",recv_buffer); | ||
| 37 | |||
| 38 | + } else if (vars_to_check==CHECK_NLM) { | ||
| 39 | + asprintf(&send_buffer,"S24:%s\r\n",nlm_name); | ||
| 40 | + result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 41 | + if(result!=STATE_OK) | ||
| 42 | + return result; | ||
| 43 | + | ||
| 44 | + recv_buffer[strlen(recv_buffer)-1]=0; | ||
| 45 | + if(strcmp(recv_buffer,"-1")) { | ||
| 46 | + asprintf(&output_message,"Module %s version %s is loaded",nlm_name,recv_buffer); | ||
| 47 | + } else { | ||
| 48 | + result=STATE_CRITICAL; | ||
| 49 | + asprintf(&output_message,"Module %s is not loaded",nlm_name); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | } else { | ||
| 53 | |||
| 54 | output_message = strscpy(output_message,"Nothing to check!\n"); | ||
| 55 | @@ -875,6 +892,10 @@ | ||
| 56 | vars_to_check=CHECK_DSVER; | ||
| 57 | else if(!strcmp(optarg,"UPTIME")) | ||
| 58 | vars_to_check=CHECK_UPTIME; | ||
| 59 | + else if(strncmp(optarg,"NLM:",4)==0) { | ||
| 60 | + vars_to_check=CHECK_NLM; | ||
| 61 | + nlm_name=strscpy(nlm_name,optarg+4); | ||
| 62 | + } | ||
| 63 | else | ||
| 64 | return ERROR; | ||
| 65 | break; | ||
diff --git a/web/attachments/50922-check_dns.c.patch b/web/attachments/50922-check_dns.c.patch new file mode 100644 index 0000000..e1ea021 --- /dev/null +++ b/web/attachments/50922-check_dns.c.patch | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | *** check_dns.c?rev=1.13 Wed May 21 13:09:44 2003 | ||
| 2 | --- check_dns.c Wed May 21 13:13:13 2003 | ||
| 3 | *************** | ||
| 4 | *** 180,189 **** | ||
| 5 | } | ||
| 6 | |||
| 7 | /* compare to expected address */ | ||
| 8 | ! if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) { | ||
| 9 | ! result = STATE_CRITICAL; | ||
| 10 | ! asprintf(&output, "expected %s but got %s", expected_address, address); | ||
| 11 | } | ||
| 12 | |||
| 13 | elapsed_time = delta_time (tv); | ||
| 14 | |||
| 15 | --- 180,191 ---- | ||
| 16 | } | ||
| 17 | |||
| 18 | /* compare to expected address */ | ||
| 19 | ! if (result == STATE_OK && match_expected_address) { | ||
| 20 | ! if ((address == NULL) || strcmp(address, expected_address)) { | ||
| 21 | ! result = STATE_CRITICAL; | ||
| 22 | ! asprintf(&output, "expected %s but got %s", expected_address, address); | ||
| 23 | } | ||
| 24 | + } | ||
| 25 | |||
| 26 | elapsed_time = delta_time (tv); | ||
| 27 | |||
diff --git a/web/attachments/51758-check_softraid.pl b/web/attachments/51758-check_softraid.pl new file mode 100644 index 0000000..22652a0 --- /dev/null +++ b/web/attachments/51758-check_softraid.pl | |||
| @@ -0,0 +1,176 @@ | |||
| 1 | #!/usr/bin/perl -w | ||
| 2 | # | ||
| 3 | # check_softraid.pl - Nagios plugin to check software RAID status on Linux | ||
| 4 | # | ||
| 5 | # | ||
| 6 | # Copyright (C) 2003 Kenny Root | ||
| 7 | # | ||
| 8 | # This program is free software; you can redistribute it and/or | ||
| 9 | # modify it under the terms of the GNU General Public License | ||
| 10 | # as published by the Free Software Foundation; either version 2 | ||
| 11 | # of the License, or (at your option) any later version. | ||
| 12 | # | ||
| 13 | # This program is distributed in the hope that it will be useful, | ||
| 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | # GNU General Public License for more details. | ||
| 17 | # | ||
| 18 | # You should have received a copy of the GNU General Public License | ||
| 19 | # along with this program; if not, write to the Free Software | ||
| 20 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 21 | # | ||
| 22 | # | ||
| 23 | # Report bugs to: kenny@the-b.org, nagiosplug-help@lists.sf.net | ||
| 24 | # | ||
| 25 | # 30-05-2003 Version 0.2 | ||
| 26 | # | ||
| 27 | # | ||
| 28 | |||
| 29 | use strict; | ||
| 30 | use Getopt::Long; | ||
| 31 | use lib "nagios/plugins"; | ||
| 32 | use utils qw($TIMEOUT %ERRORS &print_revision &support); | ||
| 33 | use vars qw($PROGNAME $MDSTAT $VERSION $opt_h $opt_V $exitstatus $exitstring); | ||
| 34 | Getopt::Long::Configure('bundling'); | ||
| 35 | |||
| 36 | $PROGNAME="check_softraid"; | ||
| 37 | $VERSION="0.2"; | ||
| 38 | $MDSTAT="/proc/mdstat"; | ||
| 39 | |||
| 40 | # Paranoia: clear out our environment variables. | ||
| 41 | $ENV{'PATH'} = ''; | ||
| 42 | $ENV{'BASH_ENV'} = ''; | ||
| 43 | $ENV{'ENV'} = ''; | ||
| 44 | |||
| 45 | # Set the exit status to 0 (OK) until proven otherwise. | ||
| 46 | $exitstatus = $ERRORS{'OK'}; | ||
| 47 | $exitstring = ''; | ||
| 48 | |||
| 49 | # Create a timeout in case we can't read the mdstat file. | ||
| 50 | $SIG{'ALRM'} = sub { | ||
| 51 | print ("ERROR: Cannot read $MDSTAT\n"); | ||
| 52 | exit $ERRORS{'UNKNOWN'}; | ||
| 53 | }; | ||
| 54 | alarm($TIMEOUT); | ||
| 55 | |||
| 56 | GetOptions("V" => \$opt_V, "version" => \$opt_V, | ||
| 57 | "h" => \$opt_h, "help" => \$opt_h); | ||
| 58 | |||
| 59 | # Print out the program version if requested. | ||
| 60 | if ($opt_V) { | ||
| 61 | print_revision($PROGNAME,$VERSION); | ||
| 62 | exit $ERRORS{'OK'}; | ||
| 63 | } | ||
| 64 | |||
| 65 | # Print usage information if requested. | ||
| 66 | if ($opt_h) { | ||
| 67 | print_help(); | ||
| 68 | exit $ERRORS{'OK'}; | ||
| 69 | } | ||
| 70 | |||
| 71 | # Don't be tricked into opening a symlink. | ||
| 72 | if (! -f $MDSTAT) { | ||
| 73 | print "$MDSTAT is not a regular file!\n"; | ||
| 74 | exit $ERRORS{'UNKNOWN'}; | ||
| 75 | } | ||
| 76 | |||
| 77 | open(MDSTAT, "< $MDSTAT"); | ||
| 78 | |||
| 79 | # Initialize the hash that will hold all the information about the status | ||
| 80 | # of each RAID device. | ||
| 81 | my %raid = (); | ||
| 82 | |||
| 83 | while (readline(*MDSTAT)) { | ||
| 84 | chomp; | ||
| 85 | |||
| 86 | # Parse each line in the mdstat. Each RAID device should have three | ||
| 87 | # lines. One for the personality and disk status, the second for | ||
| 88 | # the RAID personality's status. The third line is for things like | ||
| 89 | # resync. | ||
| 90 | # md1 : active raid1 hda2[1] hdb2[2] | ||
| 91 | # 82348723 blocks [2/2] [UU] | ||
| 92 | # | ||
| 93 | if ($_ =~ /^(md[0-9]*) : ([^ ]*) ([^ ]*)( \(read-only\))? ([^\[]*\[.*)/) { | ||
| 94 | my $device = $1; | ||
| 95 | $raid{$device}{status} = $2; | ||
| 96 | $raid{$device}{personality} = $3; | ||
| 97 | my $diskstring = $5; | ||
| 98 | |||
| 99 | # Split the disk status string into each disk, record those | ||
| 100 | # into an array for possible parsing during the RAID status | ||
| 101 | # line. Also record if they're flagged as faulty disks. | ||
| 102 | my @raiddisks = split(/ /, $diskstring); | ||
| 103 | for my $eachdisknum (0 .. $#raiddisks) { | ||
| 104 | |||
| 105 | # Each disk status would like like "hda2[1]" or | ||
| 106 | # "hda2[1](F)" for a faulty disk. | ||
| 107 | if ($raiddisks[$eachdisknum] =~ /([^\[]*)\[([0-9]*)\](\(F\))?$/) { | ||
| 108 | my $diskname = $1; | ||
| 109 | push @{$raid{$device}{disks}}, $diskname; | ||
| 110 | |||
| 111 | # Record if this device is marked as faulted. | ||
| 112 | if (defined $3 and ($3 eq "(F)")) { | ||
| 113 | push @{$raid{$device}{faulted}}, $diskname; | ||
| 114 | } | ||
| 115 | } | ||
| 116 | } | ||
| 117 | |||
| 118 | # If the RAID device is active, the RAID personality should | ||
| 119 | # have a status message as the second line. Let's parse that. | ||
| 120 | if ($raid{$device}{status} eq "active") { | ||
| 121 | my $syncstatusline = <MDSTAT>; | ||
| 122 | chomp $syncstatusline; | ||
| 123 | |||
| 124 | # RAID1 and RAID5 personalities have a status line that | ||
| 125 | # tells you whether you're out of sync or not. Parse | ||
| 126 | # that. | ||
| 127 | if ($syncstatusline =~ / \[([0-9]*)\/([0-9]*)\] \[([^\]]*)\]/) { | ||
| 128 | # Record the number of total disks, number of | ||
| 129 | # disks operational, and compute the current | ||
| 130 | # operational capacity. | ||
| 131 | $raid{$device}{totaldisks} = $1; | ||
| 132 | $raid{$device}{operationaldisks} = $2; | ||
| 133 | $raid{$device}{capacity} = ($2 * 100) / $1; | ||
| 134 | |||
| 135 | # Each operational disk is listed as "U" | ||
| 136 | # while each out-of-sync disk is listed as "_" | ||
| 137 | my $diskstatusstring = $3; | ||
| 138 | my @diskstatuses = split //, $diskstatusstring; | ||
| 139 | foreach my $disknumber (0 .. $#diskstatuses) { | ||
| 140 | if (substr($diskstatusstring, $disknumber, 1) eq "_") { | ||
| 141 | push @{$raid{$device}{desync}}, @{$raid{$device}{disks}}[$disknumber]; | ||
| 142 | } | ||
| 143 | } | ||
| 144 | } | ||
| 145 | } | ||
| 146 | } | ||
| 147 | } | ||
| 148 | close(MDSTAT); | ||
| 149 | |||
| 150 | foreach my $device (sort keys %raid) { | ||
| 151 | if ($raid{$device}{status} eq "active") { | ||
| 152 | if (exists $raid{$device}{faulted}) { | ||
| 153 | $exitstring = $exitstring . "$device has faulted disks " . join(" ", @{$raid{$device}{faulted}}) . ". "; | ||
| 154 | $exitstatus = $ERRORS{'CRITICAL'}; | ||
| 155 | } elsif (exists $raid{$device}{desync}) { | ||
| 156 | $exitstring = $exitstring . "$device has desynced disks " . join(" ", @{$raid{$device}{desync}}) . ". "; | ||
| 157 | $exitstatus = $ERRORS{'WARNING'} if ($exitstatus != $ERRORS{'CRITICAL'}); | ||
| 158 | } | ||
| 159 | } | ||
| 160 | } | ||
| 161 | |||
| 162 | if ($exitstring eq "") { | ||
| 163 | $exitstring = "All RAID disks OK."; | ||
| 164 | } | ||
| 165 | |||
| 166 | print $exitstring . "\n"; | ||
| 167 | exit $exitstatus; | ||
| 168 | |||
| 169 | sub print_help { | ||
| 170 | printf "$PROGNAME plugin for Nagios monitors Linux's software RAID \n"; | ||
| 171 | printf "status for the local machine.\n"; | ||
| 172 | printf "\nUsage:\n"; | ||
| 173 | printf "\t-V (--version)\tPlugin version\n"; | ||
| 174 | printf "\t-h (--help)\tThis usage help.\n\n"; | ||
| 175 | print_revision($PROGNAME, $VERSION); | ||
| 176 | } | ||
diff --git a/web/attachments/51759-nagios-plugins-1.3.0-softraid.patch b/web/attachments/51759-nagios-plugins-1.3.0-softraid.patch new file mode 100644 index 0000000..db16ad5 --- /dev/null +++ b/web/attachments/51759-nagios-plugins-1.3.0-softraid.patch | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | diff -ur nagios-plugins-1.3.0/command.cfg.in nagios-plugins-1.3.0.new/command.cfg.in | ||
| 2 | --- nagios-plugins-1.3.0/command.cfg.in 2003-02-15 06:48:38.000000000 -0600 | ||
| 3 | +++ nagios-plugins-1.3.0.new/command.cfg.in 2003-05-30 15:16:04.000000000 -0500 | ||
| 4 | @@ -90,6 +90,7 @@ | ||
| 5 | command[check_procs]=@libexecdir@/check_procs -w $ARG1$ -c $ARG2$ | ||
| 6 | command[check_procs_zombie]=@libexecdir@/check_procs -w $ARG1$ -c $ARG2$ -s Z | ||
| 7 | command[check_procs_httpd]=@libexecdir@/check_procs -w 5:$ARG1$ -c 1:$ARG2$ -C httpd | ||
| 8 | +command[check_softraid]=@libexecdir@/check_softraid | ||
| 9 | command[check_vsz]=@libexecdir@/check_vsz -w 8096 -c 16182 -C httpd | ||
| 10 | |||
| 11 | # An example of using check_by_ssh as an active service check | ||
| 12 | diff -ur nagios-plugins-1.3.0/nagios-plugins.spec nagios-plugins-1.3.0.new/nagios-plugins.spec | ||
| 13 | --- nagios-plugins-1.3.0/nagios-plugins.spec 2003-03-01 23:01:26.000000000 -0600 | ||
| 14 | +++ nagios-plugins-1.3.0.new/nagios-plugins.spec 2003-05-30 15:14:58.000000000 -0500 | ||
| 15 | @@ -126,6 +126,7 @@ | ||
| 16 | %{_prefix}/lib/nagios/plugins/check_rpc | ||
| 17 | %{_prefix}/lib/nagios/plugins/check_sensors | ||
| 18 | %{_prefix}/lib/nagios/plugins/check_smtp | ||
| 19 | +%{_prefix}/lib/nagios/plugins/check_softraid | ||
| 20 | %{_prefix}/lib/nagios/plugins/check_ssh | ||
| 21 | %{_prefix}/lib/nagios/plugins/check_swap | ||
| 22 | %{_prefix}/lib/nagios/plugins/check_tcp | ||
| 23 | diff -ur nagios-plugins-1.3.0/nagios-plugins.spec.in nagios-plugins-1.3.0.new/nagios-plugins.spec.in | ||
| 24 | --- nagios-plugins-1.3.0/nagios-plugins.spec.in 2003-03-01 22:40:29.000000000 -0600 | ||
| 25 | +++ nagios-plugins-1.3.0.new/nagios-plugins.spec.in 2003-05-30 15:16:23.000000000 -0500 | ||
| 26 | @@ -126,6 +126,7 @@ | ||
| 27 | %{_prefix}/lib/nagios/plugins/check_rpc | ||
| 28 | %{_prefix}/lib/nagios/plugins/check_sensors | ||
| 29 | %{_prefix}/lib/nagios/plugins/check_smtp | ||
| 30 | +%{_prefix}/lib/nagios/plugins/check_softraid | ||
| 31 | %{_prefix}/lib/nagios/plugins/check_ssh | ||
| 32 | %{_prefix}/lib/nagios/plugins/check_swap | ||
| 33 | %{_prefix}/lib/nagios/plugins/check_tcp | ||
| 34 | Only in nagios-plugins-1.3.0.new/plugins-scripts: check_softraid.pl | ||
| 35 | diff -ur nagios-plugins-1.3.0/plugins-scripts/Makefile.am nagios-plugins-1.3.0.new/plugins-scripts/Makefile.am | ||
| 36 | --- nagios-plugins-1.3.0/plugins-scripts/Makefile.am 2003-02-15 06:48:49.000000000 -0600 | ||
| 37 | +++ nagios-plugins-1.3.0.new/plugins-scripts/Makefile.am 2003-05-30 15:14:18.000000000 -0500 | ||
| 38 | @@ -6,11 +6,13 @@ | ||
| 39 | |||
| 40 | libexec_SCRIPTS = check_breeze check_disk_smb check_flexlm check_ircd \ | ||
| 41 | check_log check_ntp check_oracle check_rpc check_sensors check_wave \ | ||
| 42 | - check_ifstatus check_ifoperstatus check_mailq utils.sh utils.pm | ||
| 43 | + check_ifstatus check_ifoperstatus check_mailq check_softraid \ | ||
| 44 | + utils.sh utils.pm | ||
| 45 | |||
| 46 | EXTRA_DIST=check_breeze.pl check_disk_smb.pl check_flexlm.pl check_ircd.pl \ | ||
| 47 | check_log.sh check_ntp.pl check_oracle.sh check_rpc.pl check_sensors.sh \ | ||
| 48 | - check_ifstatus.pl check_ifoperstatus.pl check_wave.pl check_mailq.pl utils.sh.in utils.pm.in t | ||
| 49 | + check_ifstatus.pl check_ifoperstatus.pl check_wave.pl check_mailq.pl check_softraid.pl \ | ||
| 50 | + utils.sh.in utils.pm.in t | ||
| 51 | |||
| 52 | TESTS_ENVIRONMENT=perl -I $(top_builddir) -I $(top_srcdir) | ||
| 53 | |||
| 54 | diff -ur nagios-plugins-1.3.0/plugins-scripts/Makefile.in nagios-plugins-1.3.0.new/plugins-scripts/Makefile.in | ||
| 55 | --- nagios-plugins-1.3.0/plugins-scripts/Makefile.in 2003-03-01 23:01:26.000000000 -0600 | ||
| 56 | +++ nagios-plugins-1.3.0.new/plugins-scripts/Makefile.in 2003-05-30 15:14:04.000000000 -0500 | ||
| 57 | @@ -130,12 +130,14 @@ | ||
| 58 | |||
| 59 | libexec_SCRIPTS = check_breeze check_disk_smb check_flexlm check_ircd \ | ||
| 60 | check_log check_ntp check_oracle check_rpc check_sensors check_wave \ | ||
| 61 | - check_ifstatus check_ifoperstatus check_mailq utils.sh utils.pm | ||
| 62 | + check_ifstatus check_ifoperstatus check_mailq check_softraid \ | ||
| 63 | + utils.sh utils.pm | ||
| 64 | |||
| 65 | |||
| 66 | EXTRA_DIST = check_breeze.pl check_disk_smb.pl check_flexlm.pl check_ircd.pl \ | ||
| 67 | check_log.sh check_ntp.pl check_oracle.sh check_rpc.pl check_sensors.sh \ | ||
| 68 | - check_ifstatus.pl check_ifoperstatus.pl check_wave.pl check_mailq.pl utils.sh.in utils.pm.in t | ||
| 69 | + check_ifstatus.pl check_ifoperstatus.pl check_wave.pl check_mailq.pl check_softraid.pl \ | ||
| 70 | + utils.sh.in utils.pm.in t | ||
| 71 | |||
| 72 | |||
| 73 | TESTS_ENVIRONMENT = perl -I $(top_builddir) -I $(top_srcdir) | ||
| 74 | diff -ur nagios-plugins-1.3.0/REQUIREMENTS nagios-plugins-1.3.0.new/REQUIREMENTS | ||
| 75 | --- nagios-plugins-1.3.0/REQUIREMENTS 2003-02-28 22:45:51.000000000 -0600 | ||
| 76 | +++ nagios-plugins-1.3.0.new/REQUIREMENTS 2003-05-30 15:16:55.000000000 -0500 | ||
| 77 | @@ -53,6 +53,9 @@ | ||
| 78 | - Requires the NET-SNMP package available from | ||
| 79 | http://net-snmp.sourceforge.net | ||
| 80 | |||
| 81 | +check_softraid: | ||
| 82 | + - Requires Linux with MD softraid RAID compiled in. Reads /proc/mdstat | ||
| 83 | + | ||
| 84 | check_ifstatus/check_ifoperstatus | ||
| 85 | - Requires Net::SNMP perl module | ||
| 86 | http://www.perl.com/CPAN/modules/by-authors/id/D/DT/DTOWN/ | ||
diff --git a/web/attachments/51804-check_dns.c.patch.rev2 b/web/attachments/51804-check_dns.c.patch.rev2 new file mode 100644 index 0000000..65334e8 --- /dev/null +++ b/web/attachments/51804-check_dns.c.patch.rev2 | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-5 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378819066" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378819066" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378819066" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378819066" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378819066'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=741296&group_id=29880&atid=397597&file_id=51804" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/52602-nagios.time.diff b/web/attachments/52602-nagios.time.diff new file mode 100644 index 0000000..f6ccc62 --- /dev/null +++ b/web/attachments/52602-nagios.time.diff | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | --- /tmp/nagios-plugins-1.3.0/plugins/check_time.c 2003-02-15 23:48:46.000000000 +1100 | ||
| 2 | +++ nagios-plugins-1.3.0/plugins/check_time.c 2003-06-06 10:43:32.000000000 +1000 | ||
| 3 | @@ -61,7 +61,7 @@ | ||
| 4 | int check_critical_diff = FALSE; | ||
| 5 | int server_port = TIME_PORT; | ||
| 6 | char *server_address = NULL; | ||
| 7 | - | ||
| 8 | +int use_udp = FALSE; | ||
| 9 | |||
| 10 | int process_arguments (int, char **); | ||
| 11 | void print_usage (void); | ||
| 12 | @@ -85,7 +85,13 @@ | ||
| 13 | time (&start_time); | ||
| 14 | |||
| 15 | /* try to connect to the host at the given port number */ | ||
| 16 | - if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) { | ||
| 17 | + if (use_udp) { | ||
| 18 | + result = my_udp_connect (server_address, server_port, &sd); | ||
| 19 | + } else { | ||
| 20 | + result = my_tcp_connect (server_address, server_port, &sd); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + if (result != STATE_OK) { | ||
| 24 | if (check_critical_time == TRUE) | ||
| 25 | result = STATE_CRITICAL; | ||
| 26 | else if (check_warning_time == TRUE) | ||
| 27 | @@ -94,7 +100,21 @@ | ||
| 28 | result = STATE_UNKNOWN; | ||
| 29 | terminate (result, | ||
| 30 | "TIME UNKNOWN - could not connect to server %s, port %d\n", | ||
| 31 | - server_address, server_port); | ||
| 32 | + server_address, server_port); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + if (use_udp) { | ||
| 36 | + if (send (sd, "", 0, 0) < 0) { | ||
| 37 | + if (check_critical_time == TRUE) | ||
| 38 | + result = STATE_CRITICAL; | ||
| 39 | + else if (check_warning_time == TRUE) | ||
| 40 | + result = STATE_WARNING; | ||
| 41 | + else | ||
| 42 | + result = STATE_UNKNOWN; | ||
| 43 | + terminate (result, | ||
| 44 | + "TIME UNKNOWN - could not send UDP request to server %s, port %d\n", | ||
| 45 | + server_address, server_port); | ||
| 46 | + } | ||
| 47 | } | ||
| 48 | |||
| 49 | /* watch for the connection string */ | ||
| 50 | @@ -170,6 +190,7 @@ | ||
| 51 | {"timeout", required_argument, 0, 't'}, | ||
| 52 | {"version", no_argument, 0, 'V'}, | ||
| 53 | {"help", no_argument, 0, 'h'}, | ||
| 54 | + {"udp", no_argument, 0, 'u'}, | ||
| 55 | {0, 0, 0, 0} | ||
| 56 | }; | ||
| 57 | #endif | ||
| 58 | @@ -193,10 +214,10 @@ | ||
| 59 | while (1) { | ||
| 60 | #ifdef HAVE_GETOPT_H | ||
| 61 | c = | ||
| 62 | - getopt_long (argc, argv, "hVH:w:c:W:C:p:t:", long_options, | ||
| 63 | + getopt_long (argc, argv, "hVH:w:c:W:C:p:t:u", long_options, | ||
| 64 | &option_index); | ||
| 65 | #else | ||
| 66 | - c = getopt (argc, argv, "hVH:w:c:W:C:p:t:"); | ||
| 67 | + c = getopt (argc, argv, "hVH:w:c:W:C:p:t:u"); | ||
| 68 | #endif | ||
| 69 | |||
| 70 | if (c == -1 || c == EOF) | ||
| 71 | @@ -275,6 +296,9 @@ | ||
| 72 | usage ("Timeout interval must be a nonnegative integer\n"); | ||
| 73 | socket_timeout = atoi (optarg); | ||
| 74 | break; | ||
| 75 | + case 'u': | ||
| 76 | + /* udp */ | ||
| 77 | + use_udp = TRUE; | ||
| 78 | } | ||
| 79 | } | ||
| 80 | |||
| 81 | @@ -338,6 +362,8 @@ | ||
| 82 | " Seconds before connection times out (default: %d)\n" | ||
| 83 | " -p, --port=INTEGER\n" | ||
| 84 | " Port number (default: %d)\n" | ||
| 85 | + " -u, --udp\n" | ||
| 86 | + " Use UDP to connect, not TCP\n" | ||
| 87 | " -h, --help\n" | ||
| 88 | " Print detailed help screen\n" | ||
| 89 | " -V, --version\n" | ||
diff --git a/web/attachments/52944-patches.txt b/web/attachments/52944-patches.txt new file mode 100644 index 0000000..165ac93 --- /dev/null +++ b/web/attachments/52944-patches.txt | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | --- src/nagios-plugins-1.3.0/configure.in 2003-03-01 20:58:12.000000000 -0800 | ||
| 2 | +++ configure.in 2003-06-11 14:38:45.444708000 -0700 | ||
| 3 | @@ -145,11 +145,13 @@ | ||
| 4 | |||
| 5 | dnl Check for radius libraries | ||
| 6 | _SAVEDLIBS="$LIBS" | ||
| 7 | -AC_CHECK_LIB(radiusclient,rc_read_config) | ||
| 8 | +AC_CHECK_LIB(radiusclient,rc_read_config,,,$SOCKETLIBS) | ||
| 9 | if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then | ||
| 10 | EXTRAS="$EXTRAS check_radius" | ||
| 11 | - RADIUSLIBS="-lradiusclient" | ||
| 12 | + RADIUSLIBS="-lradiusclient $SOCKETLIBS" | ||
| 13 | + RADIUSINCLUDE="-I/usr/local/include" | ||
| 14 | AC_SUBST(RADIUSLIBS) | ||
| 15 | + AC_SUBST(RADIUSINCLUDE) | ||
| 16 | else | ||
| 17 | AC_MSG_WARN([Skipping radius plugin]) | ||
| 18 | AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).]) | ||
| 19 | |||
| 20 | |||
| 21 | |||
| 22 | |||
| 23 | |||
| 24 | |||
| 25 | |||
| 26 | |||
| 27 | |||
| 28 | |||
| 29 | --- src/nagios-plugins-1.3.0/plugins/Makefile.am 2003-02-18 23:15:52.000000000 -0800 | ||
| 30 | +++ Makefile.am 2003-06-11 14:28:22.318808000 -0700 | ||
| 31 | @@ -2,7 +2,7 @@ | ||
| 32 | |||
| 33 | VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plugins/t | ||
| 34 | |||
| 35 | -INCLUDES = -I.. -I$(top_srcdir)/lib @LDAPINCLUDE@ @PGINCLUDE@ @SSLINCLUDE@ | ||
| 36 | +INCLUDES = -I.. -I$(top_srcdir)/lib @LDAPINCLUDE@ @PGINCLUDE@ @SSLINCLUDE@ @RADIUSINCLUDE@ | ||
| 37 | |||
| 38 | libexec_PROGRAMS = check_disk check_dummy check_http check_load \ | ||
| 39 | check_mrtg check_mrtgtraf check_nwstat check_overcr check_ping \ | ||
diff --git a/web/attachments/52959-check_ldap.patch b/web/attachments/52959-check_ldap.patch new file mode 100644 index 0000000..dac7767 --- /dev/null +++ b/web/attachments/52959-check_ldap.patch | |||
| @@ -0,0 +1,121 @@ | |||
| 1 | Index: configure.in | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/configure.in,v | ||
| 4 | retrieving revision 1.81 | ||
| 5 | diff -u -r1.81 configure.in | ||
| 6 | --- configure.in 12 Jun 2003 04:16:34 -0000 1.81 | ||
| 7 | +++ configure.in 12 Jun 2003 23:03:02 -0000 | ||
| 8 | @@ -206,6 +206,7 @@ | ||
| 9 | LDAPINCLUDE="-I/usr/include/ldap" | ||
| 10 | AC_SUBST(LDAPLIBS) | ||
| 11 | AC_SUBST(LDAPINCLUDE) | ||
| 12 | + AC_CHECK_FUNCS(ldap_set_option) | ||
| 13 | EXTRAS="$EXTRAS check_ldap" | ||
| 14 | else | ||
| 15 | AC_MSG_WARN([Skipping LDAP plugin]) | ||
| 16 | Index: plugins/check_ldap.c | ||
| 17 | =================================================================== | ||
| 18 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ldap.c,v | ||
| 19 | retrieving revision 1.6 | ||
| 20 | diff -u -r1.6 check_ldap.c | ||
| 21 | --- plugins/check_ldap.c 12 Mar 2003 02:25:22 -0000 1.6 | ||
| 22 | +++ plugins/check_ldap.c 12 Jun 2003 23:03:02 -0000 | ||
| 23 | @@ -34,6 +34,9 @@ | ||
| 24 | enum { | ||
| 25 | UNDEFINED = -1, | ||
| 26 | DEFAULT_PORT = 389 | ||
| 27 | +#ifdef HAVE_LDAP_SET_OPTION | ||
| 28 | + , DEFAULT_PROTOCOL = 2 | ||
| 29 | +#endif | ||
| 30 | }; | ||
| 31 | |||
| 32 | int process_arguments (int, char **); | ||
| 33 | @@ -48,6 +51,9 @@ | ||
| 34 | char *ld_passwd = NULL; | ||
| 35 | char *ld_binddn = NULL; | ||
| 36 | unsigned int ld_port = DEFAULT_PORT; | ||
| 37 | +#ifdef HAVE_LDAP_SET_OPTION | ||
| 38 | +int ld_protocol = DEFAULT_PROTOCOL; | ||
| 39 | +#endif | ||
| 40 | int warn_time = UNDEFINED; | ||
| 41 | int crit_time = UNDEFINED; | ||
| 42 | |||
| 43 | @@ -80,6 +86,14 @@ | ||
| 44 | return STATE_CRITICAL; | ||
| 45 | } | ||
| 46 | |||
| 47 | +#ifdef HAVE_LDAP_SET_OPTION | ||
| 48 | + /* set ldap options */ | ||
| 49 | + if (ldap_set_option (ld, LDAP_OPT_PROTOCOL_VERSION, &ld_protocol) != | ||
| 50 | + LDAP_OPT_SUCCESS ) { | ||
| 51 | + printf("Could not set protocol version %d\n", ld_protocol); | ||
| 52 | + return STATE_CRITICAL; | ||
| 53 | + } | ||
| 54 | +#endif | ||
| 55 | /* bind to the ldap server */ | ||
| 56 | if (ldap_bind_s (ld, ld_binddn, ld_passwd, LDAP_AUTH_SIMPLE) != | ||
| 57 | LDAP_SUCCESS) { | ||
| 58 | @@ -141,6 +155,10 @@ | ||
| 59 | {"attr", required_argument, 0, 'a'}, | ||
| 60 | {"bind", required_argument, 0, 'D'}, | ||
| 61 | {"pass", required_argument, 0, 'P'}, | ||
| 62 | +#ifdef HAVE_LDAP_SET_OPTION | ||
| 63 | + {"ver2", no_argument, 0, '2'}, | ||
| 64 | + {"ver3", no_argument, 0, '3'}, | ||
| 65 | +#endif | ||
| 66 | {"port", required_argument, 0, 'p'}, | ||
| 67 | {"warn", required_argument, 0, 'w'}, | ||
| 68 | {"crit", required_argument, 0, 'c'}, | ||
| 69 | @@ -156,7 +174,7 @@ | ||
| 70 | } | ||
| 71 | |||
| 72 | while (1) { | ||
| 73 | - c = getopt_long (argc, argv, "hVt:c:w:H:b:p:a:D:P:", longopts, &option_index); | ||
| 74 | + c = getopt_long (argc, argv, "hV23t:c:w:H:b:p:a:D:P:", longopts, &option_index); | ||
| 75 | |||
| 76 | if (c == -1 || c == EOF) | ||
| 77 | break; | ||
| 78 | @@ -197,6 +215,14 @@ | ||
| 79 | case 'c': | ||
| 80 | crit_time = atoi (optarg); | ||
| 81 | break; | ||
| 82 | +#ifdef HAVE_LDAP_SET_OPTION | ||
| 83 | + case '2': | ||
| 84 | + ld_protocol = 2; | ||
| 85 | + break; | ||
| 86 | + case '3': | ||
| 87 | + ld_protocol = 3; | ||
| 88 | + break; | ||
| 89 | +#endif | ||
| 90 | default: | ||
| 91 | usage ("check_ldap: could not parse unknown arguments\n"); | ||
| 92 | break; | ||
| 93 | @@ -244,9 +270,18 @@ | ||
| 94 | "\t-D [--bind] ... ldap bind DN (if required)\n" | ||
| 95 | "\t-P [--pass] ... ldap password (if required)\n" | ||
| 96 | "\t-p [--port] ... ldap port (default: %d)\n" | ||
| 97 | +#ifdef HAVE_LDAP_SET_OPTION | ||
| 98 | + "\t-2 [--ver2] ... use ldap porotocol version 2\n" | ||
| 99 | + "\t-3 [--ver3] ... use ldap porotocol version 3\n" | ||
| 100 | + "\t\t(default protocol version: %d)\n" | ||
| 101 | +#endif | ||
| 102 | "\t-w [--warn] ... time in secs. - if the exceeds <warn> the STATE_WARNING will be returned\n" | ||
| 103 | "\t-c [--crit] ... time in secs. - if the exceeds <crit> the STATE_CRITICAL will be returned\n" | ||
| 104 | - "\n", DEFAULT_PORT); | ||
| 105 | + "\n", DEFAULT_PORT | ||
| 106 | +#ifdef HAVE_LDAP_SET_OPTION | ||
| 107 | + , DEFAULT_PROTOCOL | ||
| 108 | +#endif | ||
| 109 | + ); | ||
| 110 | } | ||
| 111 | |||
| 112 | |||
| 113 | @@ -256,5 +291,8 @@ | ||
| 114 | printf | ||
| 115 | ("Usage: %s -H <host> -b <base_dn> [-p <port>] [-a <attr>] [-D <binddn>]\n" | ||
| 116 | " [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n" | ||
| 117 | +#ifdef HAVE_LDAP_SET_OPTION | ||
| 118 | + " [-2|-3]\n" | ||
| 119 | +#endif | ||
| 120 | "(Note: all times are in seconds.)\n", progname); | ||
| 121 | } | ||
diff --git a/web/attachments/54764-check_procs.c.diff b/web/attachments/54764-check_procs.c.diff new file mode 100644 index 0000000..89171ae --- /dev/null +++ b/web/attachments/54764-check_procs.c.diff | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | Index: check_procs.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_procs.c,v | ||
| 4 | retrieving revision 1.15 | ||
| 5 | diff -u -3 -r1.15 check_procs.c | ||
| 6 | --- check_procs.c 11 Apr 2003 23:47:39 -0000 1.15 | ||
| 7 | +++ check_procs.c 2 Jul 2003 16:04:21 -0000 | ||
| 8 | @@ -204,6 +204,8 @@ | ||
| 9 | /* Zombie processes do not give a procprog command */ | ||
| 10 | if ( cols == 6 && strstr(procstat, zombie) ) { | ||
| 11 | cols = 7; | ||
| 12 | + input_buffer[pos] = '\n'; | ||
| 13 | + input_buffer[pos+1] = 0x0; | ||
| 14 | } | ||
| 15 | if ( cols >= 7 ) { | ||
| 16 | resultsum = 0; | ||
diff --git a/web/attachments/55352-check_mailq.pl.diff b/web/attachments/55352-check_mailq.pl.diff new file mode 100644 index 0000000..0af115b --- /dev/null +++ b/web/attachments/55352-check_mailq.pl.diff | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | --- check_mailq.pl.org 2003-07-09 15:09:26.000000000 +0200 | ||
| 2 | +++ check_mailq.pl 2003-07-09 15:06:47.000000000 +0200 | ||
| 3 | @@ -462,8 +462,43 @@ | ||
| 4 | |||
| 5 | |||
| 6 | } # end of ($mailq eq "qmail") | ||
| 7 | +elsif ( $mailq eq "exim" ) { | ||
| 8 | + ## open mailq | ||
| 9 | + if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { | ||
| 10 | + if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { | ||
| 11 | + print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; | ||
| 12 | + exit $ERRORS{'UNKNOWN'}; | ||
| 13 | + } | ||
| 14 | + }elsif( defined $utils::PATH_TO_MAILQ){ | ||
| 15 | + unless (-x $utils::PATH_TO_MAILQ) { | ||
| 16 | + print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($)))\n"; | ||
| 17 | + exit $ERRORS{'UNKNOWN'}; | ||
| 18 | + } | ||
| 19 | + } else { | ||
| 20 | + print "ERROR: \$utils::PATH_TO_MAILQ is not defined\n"; | ||
| 21 | + exit $ERRORS{'UNKNOWN'}; | ||
| 22 | + } | ||
| 23 | |||
| 24 | - | ||
| 25 | + while (<MAILQ>) { | ||
| 26 | + #22m 1.7K 19aEEr-0007hx-Dy <> *** frozen *** | ||
| 27 | + #root@exlixams.glups.fr | ||
| 28 | + | ||
| 29 | + if (/\s[\w\d]{6}-[\w\d]{6}-[\w\d]{2}\s/) { # message id 19aEEr-0007hx-Dy | ||
| 30 | + $msg_q++ ; | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + close(MAILQ) ; | ||
| 34 | + if ($msg_q < $opt_w) { | ||
| 35 | + $msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)"; | ||
| 36 | + $state = $ERRORS{'OK'}; | ||
| 37 | + }elsif ($msg_q >= $opt_w && $msg_q < $opt_c) { | ||
| 38 | + $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)"; | ||
| 39 | + $state = $ERRORS{'WARNING'}; | ||
| 40 | + }else { | ||
| 41 | + $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)"; | ||
| 42 | + $state = $ERRORS{'CRITICAL'}; | ||
| 43 | + } | ||
| 44 | +} # end of ($mailq eq "exim") | ||
| 45 | |||
| 46 | # Perfdata support | ||
| 47 | print "$msg |mailq=$msg_q\n"; | ||
| 48 | @@ -526,7 +561,7 @@ | ||
| 49 | } | ||
| 50 | |||
| 51 | if (defined $opt_M) { | ||
| 52 | - if ($opt_M =~ /sendmail/ || $opt_M =~ /qmail/ || $opt_M =~ /postfix/ ) { | ||
| 53 | + if ($opt_M =~ /sendmail|qmail|postfix|exim/) { | ||
| 54 | $mailq = $opt_M ; | ||
| 55 | }elsif( $opt_M eq ''){ | ||
| 56 | $mailq = 'sendmail'; | ||
| 57 | @@ -558,7 +593,7 @@ | ||
| 58 | print "-W (--Warning) = Min. number of messages for same domain in queue to generate warning\n"; | ||
| 59 | print "-C (--Critical) = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n"; | ||
| 60 | print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n"; | ||
| 61 | - print "-M (--mailserver) = [ sendmail | qmail | postfix ] (default = sendmail)\n"; | ||
| 62 | + print "-M (--mailserver) = [ sendmail | qmail | postfix | exim ] (default = sendmail)\n"; | ||
| 63 | print "-h (--help)\n"; | ||
| 64 | print "-V (--version)\n"; | ||
| 65 | print "-v (--verbose) = debugging output\n"; | ||
diff --git a/web/attachments/55482-check_smtp.patch b/web/attachments/55482-check_smtp.patch new file mode 100644 index 0000000..4ce0629 --- /dev/null +++ b/web/attachments/55482-check_smtp.patch | |||
| @@ -0,0 +1,287 @@ | |||
| 1 | Index: check_smtp.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /usr/local/cvs/root/nagios-plugins/plugins/check_smtp.c,v | ||
| 4 | retrieving revision 1.1.1.1 | ||
| 5 | retrieving revision 1.2 | ||
| 6 | diff -u -r1.1.1.1 -r1.2 | ||
| 7 | --- check_smtp.c 3 Jul 2003 23:27:44 -0000 1.1.1.1 | ||
| 8 | +++ check_smtp.c 3 Jul 2003 23:35:52 -0000 1.2 | ||
| 9 | @@ -69,12 +69,80 @@ | ||
| 10 | char *server_address = NULL; | ||
| 11 | char *server_expect = NULL; | ||
| 12 | char *from_arg = " "; | ||
| 13 | +char *authtype = NULL; | ||
| 14 | +char *authuser = NULL; | ||
| 15 | +char *authpass = NULL; | ||
| 16 | int warning_time = 0; | ||
| 17 | int check_warning_time = FALSE; | ||
| 18 | int critical_time = 0; | ||
| 19 | int check_critical_time = FALSE; | ||
| 20 | int verbose = FALSE; | ||
| 21 | |||
| 22 | +/* encode64 routine from http://www.experts-exchange.com/Programming/Programming_Languages/C/Q_20245582.html */ | ||
| 23 | + | ||
| 24 | +/* #define OK (0) */ | ||
| 25 | +/* #define FAIL (-1) */ | ||
| 26 | +#define BUFOVER (-2) | ||
| 27 | +#define CHAR64(c) (((c) < 0 || (c) > 127) ? -1 : index_64[(c)]) | ||
| 28 | +static char basis_64[] = | ||
| 29 | +"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????"; | ||
| 30 | +static char index_64[128] = { | ||
| 31 | + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
| 32 | + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
| 33 | + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, | ||
| 34 | + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, | ||
| 35 | + -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | ||
| 36 | + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, | ||
| 37 | + -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, | ||
| 38 | + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1 | ||
| 39 | +}; | ||
| 40 | + | ||
| 41 | +static int | ||
| 42 | +encode64(const char *_in, unsigned inlen, char *_out, unsigned outmax, unsigned *outlen) | ||
| 43 | +{ | ||
| 44 | + | ||
| 45 | + const unsigned char *in = (const unsigned char *) _in; | ||
| 46 | + unsigned char *out = (unsigned char *) _out; | ||
| 47 | + unsigned char oval; | ||
| 48 | + char *blah; | ||
| 49 | + unsigned olen; | ||
| 50 | + | ||
| 51 | + olen = (inlen + 2) / 3 * 4; | ||
| 52 | + if (outlen) | ||
| 53 | + *outlen = olen; | ||
| 54 | + if (outmax < olen) | ||
| 55 | + return BUFOVER; | ||
| 56 | + | ||
| 57 | + blah = (char *) out; | ||
| 58 | + while (inlen >= 3) | ||
| 59 | + { | ||
| 60 | +/* user provided max buffer size; make sure we don't go over it */ | ||
| 61 | + *out++ = basis_64[in[0] >> 2]; | ||
| 62 | + *out++ = basis_64[((in[0] << 4) & 0x30) | (in[1] >> 4)]; | ||
| 63 | + *out++ = basis_64[((in[1] << 2) & 0x3c) | (in[2] >> 6)]; | ||
| 64 | + *out++ = basis_64[in[2] & 0x3f]; | ||
| 65 | + in += 3; | ||
| 66 | + inlen -= 3; | ||
| 67 | + } | ||
| 68 | + if (inlen > 0) | ||
| 69 | + { | ||
| 70 | +/* user provided max buffer size; make sure we don't go over it */ | ||
| 71 | + *out++ = basis_64[in[0] >> 2]; | ||
| 72 | + oval = (in[0] << 4) & 0x30; | ||
| 73 | + if (inlen > 1) | ||
| 74 | + oval |= in[1] >> 4; | ||
| 75 | + *out++ = basis_64[oval]; | ||
| 76 | + *out++ = (inlen < 2) ? '=' : basis_64[(in[1] << 2) & 0x3c]; | ||
| 77 | + *out++ = '='; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + if (olen < outmax) | ||
| 81 | + *out = '\0'; | ||
| 82 | + | ||
| 83 | + return OK; | ||
| 84 | + | ||
| 85 | +} | ||
| 86 | + | ||
| 87 | int | ||
| 88 | main (int argc, char **argv) | ||
| 89 | { | ||
| 90 | @@ -151,14 +219,19 @@ | ||
| 91 | && (end_time - start_time) > warning_time) result = | ||
| 92 | STATE_WARNING; | ||
| 93 | |||
| 94 | - if (verbose == TRUE) | ||
| 95 | - printf ("SMTP %s - %d sec. response time, %s\n", | ||
| 96 | + if (authtype == NULL) { | ||
| 97 | + if (verbose == TRUE) | ||
| 98 | + printf ("SMTP %s - %d sec. response time, %s\n", | ||
| 99 | state_text (result), (int) (end_time - start_time), buffer); | ||
| 100 | - else | ||
| 101 | - printf ("SMTP %s - %d second response time\n", state_text (result), | ||
| 102 | + else | ||
| 103 | + printf ("SMTP %s - %d second response time\n", state_text (result), | ||
| 104 | (int) (end_time - start_time)); | ||
| 105 | + } | ||
| 106 | } | ||
| 107 | } | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + if (result == STATE_OK) { | ||
| 111 | |||
| 112 | /* close the connection */ | ||
| 113 | |||
| 114 | @@ -168,6 +241,112 @@ | ||
| 115 | /* allow for response to helo command to reach us */ | ||
| 116 | recv(sd, buffer, MAX_INPUT_BUFFER-1, 0); | ||
| 117 | |||
| 118 | + if (authtype != NULL) { | ||
| 119 | + if (strcmp (authtype, "LOGIN") == 0) { | ||
| 120 | + if (authuser == NULL) { | ||
| 121 | + result = STATE_CRITICAL; | ||
| 122 | + printf ("SMTP %s - no authuser specified\n", state_text (result)); | ||
| 123 | + } else if (authpass == NULL) { | ||
| 124 | + result = STATE_CRITICAL; | ||
| 125 | + printf ("SMTP %s - no authpass specified\n", state_text (result)); | ||
| 126 | + } else { | ||
| 127 | + char abuf[MAX_INPUT_BUFFER]; | ||
| 128 | + unsigned alen; | ||
| 129 | + int ret; | ||
| 130 | + do { | ||
| 131 | + send(sd, "AUTH LOGIN\r\n", strlen("AUTH LOGIN\r\n"), 0); | ||
| 132 | + if (verbose == TRUE) { | ||
| 133 | + printf ("sent AUTH LOGIN\n"); | ||
| 134 | + } | ||
| 135 | + if ((ret = recv(sd, buffer, MAX_INPUT_BUFFER-1, 0)) == -1) { | ||
| 136 | + result = STATE_WARNING; | ||
| 137 | + printf ("SMTP %s - recv() failed after AUTH LOGIN\n", | ||
| 138 | + state_text (result)); | ||
| 139 | + break; | ||
| 140 | + } | ||
| 141 | + buffer[ret] = 0; | ||
| 142 | + if (verbose == TRUE) { | ||
| 143 | + printf ("received %s\n", buffer); | ||
| 144 | + } | ||
| 145 | + if (strncmp (buffer, "334", 3) != 0) { | ||
| 146 | + result = STATE_CRITICAL; | ||
| 147 | + printf ("SMTP %s - Invalid response received from host after AUTH LOGIN\n", | ||
| 148 | + state_text (result)); | ||
| 149 | + break; | ||
| 150 | + } | ||
| 151 | + if (encode64 (authuser, strlen(authuser), abuf, MAX_INPUT_BUFFER, &alen) != OK) { | ||
| 152 | + result = STATE_WARNING; | ||
| 153 | + printf ("SMTP %s - Failed to base64-encode authuser\n", | ||
| 154 | + state_text (result)); | ||
| 155 | + break; | ||
| 156 | + } | ||
| 157 | + strcat (abuf, "\r\n"); | ||
| 158 | + send(sd, abuf, strlen(abuf), 0); | ||
| 159 | + if (verbose == TRUE) { | ||
| 160 | + printf ("sent %s\n", abuf); | ||
| 161 | + } | ||
| 162 | + if ((ret = recv(sd, buffer, MAX_INPUT_BUFFER-1, 0)) == -1) { | ||
| 163 | + result = STATE_WARNING; | ||
| 164 | + printf ("SMTP %s - recv() failed after sending authuser\n", | ||
| 165 | + state_text (result)); | ||
| 166 | + break; | ||
| 167 | + } | ||
| 168 | + buffer[ret] = 0; | ||
| 169 | + if (verbose == TRUE) { | ||
| 170 | + printf ("received %s\n", buffer); | ||
| 171 | + } | ||
| 172 | + if (strncmp (buffer, "334", 3) != 0) { | ||
| 173 | + result = STATE_CRITICAL; | ||
| 174 | + printf ("SMTP %s - Invalid response received from host after authuser\n", | ||
| 175 | + state_text (result)); | ||
| 176 | + break; | ||
| 177 | + } | ||
| 178 | + if (encode64 (authpass, strlen(authpass), abuf, MAX_INPUT_BUFFER, &alen) != OK) { | ||
| 179 | + result = STATE_WARNING; | ||
| 180 | + printf ("SMTP %s - Failed to base64-encode authpass\n", | ||
| 181 | + state_text (result)); | ||
| 182 | + break; | ||
| 183 | + } | ||
| 184 | + strcat (abuf, "\r\n"); | ||
| 185 | + send(sd, abuf, strlen(abuf), 0); | ||
| 186 | + if (verbose == TRUE) { | ||
| 187 | + printf ("sent %s\n", abuf); | ||
| 188 | + } | ||
| 189 | + if ((ret = recv(sd, buffer, MAX_INPUT_BUFFER-1, 0)) == -1) { | ||
| 190 | + result = STATE_WARNING; | ||
| 191 | + printf ("SMTP %s - recv() failed after sending authpass\n", | ||
| 192 | + state_text (result)); | ||
| 193 | + break; | ||
| 194 | + } | ||
| 195 | + buffer[ret] = 0; | ||
| 196 | + if (verbose == TRUE) { | ||
| 197 | + printf ("received %s\n", buffer); | ||
| 198 | + } | ||
| 199 | + if (strncmp (buffer, "235", 3) != 0) { | ||
| 200 | + result = STATE_CRITICAL; | ||
| 201 | + printf ("SMTP %s - Invalid response received from host after authpass\n", | ||
| 202 | + state_text (result)); | ||
| 203 | + break; | ||
| 204 | + } | ||
| 205 | + break; | ||
| 206 | + } while (0); | ||
| 207 | + if (result == STATE_OK) { | ||
| 208 | + if (verbose == TRUE) | ||
| 209 | + printf ("SMTP %s - %d sec. response time, %s\n", | ||
| 210 | + state_text (result), (int) (end_time - start_time), buffer); | ||
| 211 | + else | ||
| 212 | + printf ("SMTP %s - %d second response time\n", state_text (result), | ||
| 213 | + (int) (end_time - start_time)); | ||
| 214 | + } | ||
| 215 | + } | ||
| 216 | + } else { | ||
| 217 | + result = STATE_CRITICAL; | ||
| 218 | + printf ("SMTP %s - authtype %s is not supported\n", state_text (result), authtype); | ||
| 219 | + } | ||
| 220 | + } | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + if (result == STATE_OK) { | ||
| 224 | #ifdef SMTP_USE_DUMMYCMD | ||
| 225 | send(sd, from_str, strlen(from_str), 0); | ||
| 226 | |||
| 227 | @@ -211,6 +390,9 @@ | ||
| 228 | {"warning", required_argument, 0, 'w'}, | ||
| 229 | {"port", required_argument, 0, 'p'}, | ||
| 230 | {"from", required_argument, 0, 'f'}, | ||
| 231 | + {"authtype", required_argument, 0, 'A'}, | ||
| 232 | + {"authuser", required_argument, 0, 'U'}, | ||
| 233 | + {"authpass", required_argument, 0, 'P'}, | ||
| 234 | {"verbose", no_argument, 0, 'v'}, | ||
| 235 | {"version", no_argument, 0, 'V'}, | ||
| 236 | {"help", no_argument, 0, 'h'}, | ||
| 237 | @@ -233,10 +415,10 @@ | ||
| 238 | while (1) { | ||
| 239 | #ifdef HAVE_GETOPT_H | ||
| 240 | c = | ||
| 241 | - getopt_long (argc, argv, "+hVvt:p:f:e:c:w:H:", long_options, | ||
| 242 | + getopt_long (argc, argv, "+hVvt:p:f:e:c:w:H:A:U:P:", long_options, | ||
| 243 | &option_index); | ||
| 244 | #else | ||
| 245 | - c = getopt (argc, argv, "+?hVvt:p:f:e:c:w:H:"); | ||
| 246 | + c = getopt (argc, argv, "+?hVvt:p:f:e:c:w:H:A:U:P:"); | ||
| 247 | #endif | ||
| 248 | if (c == -1 || c == EOF) | ||
| 249 | break; | ||
| 250 | @@ -261,6 +443,15 @@ | ||
| 251 | case 'f': /* from argument */ | ||
| 252 | from_arg = optarg; | ||
| 253 | break; | ||
| 254 | + case 'A': | ||
| 255 | + authtype = optarg; | ||
| 256 | + break; | ||
| 257 | + case 'U': | ||
| 258 | + authuser = optarg; | ||
| 259 | + break; | ||
| 260 | + case 'P': | ||
| 261 | + authpass = optarg; | ||
| 262 | + break; | ||
| 263 | case 'e': /* server expect string on 220 */ | ||
| 264 | server_expect = optarg; | ||
| 265 | break; | ||
| 266 | @@ -355,6 +546,12 @@ | ||
| 267 | " String to expect in first line of server response (default: %s)\n" | ||
| 268 | " -f, --from=STRING\n" | ||
| 269 | " from address to include in MAIL command (default NULL, Exchange2000 requires one)\n" | ||
| 270 | + " -A, --authtype=STRING\n" | ||
| 271 | + " SMTP AUTH type to check (default NULL, only LOGIN supported)\n" | ||
| 272 | + " -U, --authuser=STRING\n" | ||
| 273 | + " SMTP AUTH username\n" | ||
| 274 | + " -P, --authpass=STRING\n" | ||
| 275 | + " SMTP AUTH password\n" | ||
| 276 | " -w, --warning=INTEGER\n" | ||
| 277 | " Seconds necessary to result in a warning status\n" | ||
| 278 | " -c, --critical=INTEGER\n" | ||
| 279 | @@ -379,7 +576,7 @@ | ||
| 280 | print_usage (void) | ||
| 281 | { | ||
| 282 | printf | ||
| 283 | - ("Usage: %s -H host [-e expect] [-p port] [-f from addr] [-w warn] [-c crit] [-t timeout] [-v]\n" | ||
| 284 | + ("Usage: %s -H host [-e expect] [-p port] [-A authtype -U authuser -P authpass] [-f from addr] [-w warn] [-c crit] [-t timeout] [-v]\n" | ||
| 285 | " %s --help\n" | ||
| 286 | " %s --version\n", progname, progname, progname); | ||
| 287 | } | ||
diff --git a/web/attachments/56028-check_disk.patch b/web/attachments/56028-check_disk.patch new file mode 100644 index 0000000..a29ebea --- /dev/null +++ b/web/attachments/56028-check_disk.patch | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | Index: check_disk.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /usr/local/cvs/root/nagios-plugins/plugins/check_disk.c,v | ||
| 4 | retrieving revision 1.1 | ||
| 5 | diff -u -u -r1.1 check_disk.c | ||
| 6 | --- check_disk.c 3 Jul 2003 23:27:44 -0000 1.1 | ||
| 7 | +++ check_disk.c 17 Jul 2003 02:29:24 -0000 | ||
| 8 | @@ -307,13 +310,18 @@ | ||
| 9 | { | ||
| 10 | int result = STATE_UNKNOWN; | ||
| 11 | /* check the percent used space against thresholds */ | ||
| 12 | - if (usp >= 0 && usp >= (100.0 - c_dfp)) | ||
| 13 | + /* Need to check the percent && the free space against thresholds */ | ||
| 14 | + if (c_dfp >= 0 && c_df >= 0 && usp >= 0 && usp >= (100.0 - c_dfp) && c_df >= 0 && free_disk <= c_df) | ||
| 15 | result = STATE_CRITICAL; | ||
| 16 | - else if (c_df >= 0 && free_disk <= c_df) | ||
| 17 | + else if (c_df < 0 && usp >= 0 && usp >= (100.0 - c_dfp)) | ||
| 18 | result = STATE_CRITICAL; | ||
| 19 | - else if (usp >= 0 && usp >= (100.0 - w_dfp)) | ||
| 20 | + else if (c_dfp < 0 && free_disk <= c_df) | ||
| 21 | + result = STATE_CRITICAL; | ||
| 22 | + else if (w_dfp >= 0 && w_df >= 0 && usp >= 0 && usp >= (100.0 - w_dfp) && w_df >= 0 && free_disk <= w_df) | ||
| 23 | + result = STATE_WARNING; | ||
| 24 | + else if (w_df < 0 && usp >= 0 && usp >= (100.0 - w_dfp)) | ||
| 25 | result = STATE_WARNING; | ||
| 26 | - else if (w_df >= 0 && free_disk <= w_df) | ||
| 27 | + else if (w_dfp < 0 && free_disk <= w_df) | ||
| 28 | result = STATE_WARNING; | ||
| 29 | else if (usp >= 0.0) | ||
| 30 | result = STATE_OK; | ||
| 31 | @@ -328,7 +336,9 @@ | ||
| 32 | ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n" | ||
| 33 | "This plugin will check the percent of used disk space on a mounted\n" | ||
| 34 | "file system and generate an alert if percentage is above one of the\n" | ||
| 35 | - "threshold values.\n\n"); | ||
| 36 | + "threshold values. You can also pass a percent and size thresholds\n" | ||
| 37 | + "separated by a : or , and both values will have to be met before a\n" | ||
| 38 | + "failure occurs\n\n"); | ||
| 39 | print_usage (); | ||
| 40 | printf | ||
| 41 | ("\nOptions:\n" | ||
| 42 | @@ -352,7 +362,10 @@ | ||
| 43 | " Show details for command-line debugging (do not use with nagios server)\n" | ||
| 44 | " -h, --help\n" | ||
| 45 | " Print detailed help screen\n" | ||
| 46 | - " -V, --version\n" " Print version information\n\n"); | ||
| 47 | + " -V, --version\n" " Print version information\n" | ||
| 48 | + "Examples:\n" | ||
| 49 | + "./check_disk -w10%%:100000 -c5%%:50000 -p /\n" | ||
| 50 | + "Will require that the / partition have less than 10%% free space AND less than 100mb free\n\n"); | ||
| 51 | support (); | ||
| 52 | } | ||
| 53 | |||
diff --git a/web/attachments/56241-check_oracle.jjm b/web/attachments/56241-check_oracle.jjm new file mode 100644 index 0000000..3142511 --- /dev/null +++ b/web/attachments/56241-check_oracle.jjm | |||
| @@ -0,0 +1,590 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | # latigid010@yahoo.com | ||
| 4 | # 01/06/2000 | ||
| 5 | # | ||
| 6 | # This Nagios plugin was created to check Oracle status | ||
| 7 | # | ||
| 8 | |||
| 9 | PROGNAME=`basename $0` | ||
| 10 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` | ||
| 11 | REVISION=`echo '$Revision: 1.6 $' | sed -e 's/[^0-9.]//g'` | ||
| 12 | |||
| 13 | . $PROGPATH/utils.sh | ||
| 14 | |||
| 15 | |||
| 16 | function init_var() { | ||
| 17 | RETURN_MSG="" | ||
| 18 | CHECK_CACHE=no | ||
| 19 | CHECK_DB=no | ||
| 20 | CHECK_EXTENTS=no | ||
| 21 | CHECK_LOGIN=no | ||
| 22 | CHECK_NAMES=no | ||
| 23 | CHECK_TS=no | ||
| 24 | CHECK_TNS=no | ||
| 25 | CRIT_LVL=-1 | ||
| 26 | WARN_LVL=-1 | ||
| 27 | ORACLE_SID=${ORACLE_SID} | ||
| 28 | ORA_USER="" | ||
| 29 | ORA_PASS="" | ||
| 30 | ORA_TS="" | ||
| 31 | ORA_HOST="" | ||
| 32 | ORA_NAMES="" | ||
| 33 | |||
| 34 | |||
| 35 | # Hunt down a reasonable ORACLE_HOME | ||
| 36 | if [ -z "$ORACLE_HOME" ] ; then | ||
| 37 | # Adjust to taste | ||
| 38 | for oratab in /var/opt/oracle/oratab /etc/oratab | ||
| 39 | do | ||
| 40 | [ ! -f $oratab ] && continue | ||
| 41 | ORACLE_HOME=`IFS=: | ||
| 42 | while read SID ORACLE_HOME junk; | ||
| 43 | do | ||
| 44 | if [ "$SID" = "$2" -o "$SID" = "*" ] ; then | ||
| 45 | echo $ORACLE_HOME; | ||
| 46 | exit; | ||
| 47 | fi; | ||
| 48 | done < $oratab` | ||
| 49 | [ -n "$ORACLE_HOME" ] && break | ||
| 50 | done | ||
| 51 | fi | ||
| 52 | # Last resort | ||
| 53 | [ -z "$ORACLE_HOME" -a -d $PROGPATH/oracle ] && ORACLE_HOME=$PROGPATH/oracle | ||
| 54 | |||
| 55 | if [ -z "$ORACLE_HOME" -o ! -d "$ORACLE_HOME" ] ; then | ||
| 56 | echo "Cannot determine ORACLE_HOME for sid ${ORACLE_SID}" | ||
| 57 | exit ${STATE_UNKNOWN} | ||
| 58 | fi | ||
| 59 | PATH=$PATH:$ORACLE_HOME/bin | ||
| 60 | LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib | ||
| 61 | export ORACLE_HOME PATH LD_LIBRARY_PATH | ||
| 62 | } | ||
| 63 | |||
| 64 | |||
| 65 | print_usage() { | ||
| 66 | echo "This check_oracle provides a new argument handling scheme." | ||
| 67 | echo " To use the old scheme - add a "--" before any arguments" | ||
| 68 | echo "Old Usage:" | ||
| 69 | echo " $PROGNAME --tns <Oracle Sid or Hostname/IP address>" | ||
| 70 | echo " $PROGNAME --db <ORACLE_SID>" | ||
| 71 | echo " $PROGNAME --login <ORACLE_SID>" | ||
| 72 | echo " $PROGNAME --cache <ORACLE_SID> <USER> <PASS> <CRITICAL> <WARNING>" | ||
| 73 | echo " $PROGNAME --extents <ORACLE_SID> <USER> <PASS> <TABLESPACE> <CRITICAL> <WARNING>" | ||
| 74 | echo " $PROGNAME --tablespace <ORACLE_SID> <USER> <PASS> <TABLESPACE> <CRITICAL> <WARNING>" | ||
| 75 | echo " $PROGNAME --oranames <Hostname>" | ||
| 76 | echo " $PROGNAME --help" | ||
| 77 | echo " $PROGNAME --version" | ||
| 78 | echo "The new argument handling takes shorter args + allows chaining of checks" | ||
| 79 | echo "New Usage:" | ||
| 80 | echo " $PROGNAME [args...]" | ||
| 81 | echo " -c Cache Check -C <ARG> Critical level" | ||
| 82 | echo " -d DB Check -W <ARG> Warning level" | ||
| 83 | echo " -e Extent Check" | ||
| 84 | echo " -l Listener Check -u <ARG> User" | ||
| 85 | echo " -n Oranames check -p <ARG> Password" | ||
| 86 | echo " -t tns names check -s <ARG> oracle SID" | ||
| 87 | echo " -T Tablespace check -H <ARG> Host check" | ||
| 88 | echo " -h Help" | ||
| 89 | } | ||
| 90 | |||
| 91 | print_help() { | ||
| 92 | print_revision $PROGNAME $REVISION | ||
| 93 | echo "" | ||
| 94 | print_usage | ||
| 95 | echo "" | ||
| 96 | echo "Check Oracle status" | ||
| 97 | echo "" | ||
| 98 | echo "--tns SID/IP Address" | ||
| 99 | echo " Check remote TNS server" | ||
| 100 | echo "--db SID" | ||
| 101 | echo " Check local database (search /bin/ps for PMON process) and check" | ||
| 102 | echo " filesystem for sgadefORACLE_SID.dbf" | ||
| 103 | echo "--login SID" | ||
| 104 | echo " Attempt a dummy login and alert if not ORA-01017: invalid username/password" | ||
| 105 | echo "--cache" | ||
| 106 | echo " Check local database for library and buffer cache hit ratios" | ||
| 107 | echo " ---> Requires Oracle user/password and SID specified." | ||
| 108 | echo " ---> Requires select on v_$sysstat and v_$librarycache" | ||
| 109 | echo "--extents" | ||
| 110 | echo " Check to see if there are extents unable to be extended." | ||
| 111 | echo "--tablespace" | ||
| 112 | echo " Check local database for tablespace capacity in ORACLE_SID" | ||
| 113 | echo " ---> Requires Oracle user/password specified." | ||
| 114 | echo " ---> Requires select on dba_data_files and dba_free_space" | ||
| 115 | echo "--oranames Hostname" | ||
| 116 | echo " Check remote Oracle Names server" | ||
| 117 | echo "--help" | ||
| 118 | echo " Print this help screen" | ||
| 119 | echo "--version" | ||
| 120 | echo " Print version and license information" | ||
| 121 | echo "" | ||
| 122 | echo "If the plugin doesn't work, check that the ORACLE_HOME environment" | ||
| 123 | echo "variable is set, that ORACLE_HOME/bin is in your PATH, and the" | ||
| 124 | echo "tnsnames.ora file is locatable and is properly configured." | ||
| 125 | echo "" | ||
| 126 | echo "When checking local database status your ORACLE_SID is case sensitive." | ||
| 127 | echo "" | ||
| 128 | echo "If you want to use a default Oracle home, add in your oratab file:" | ||
| 129 | echo "*:/opt/app/oracle/product/7.3.4:N" | ||
| 130 | echo "" | ||
| 131 | support | ||
| 132 | } | ||
| 133 | |||
| 134 | |||
| 135 | check_cache() { | ||
| 136 | if [ ${CRIT_LVL} -gt ${WARN_LVL} ] ; then | ||
| 137 | RETURN_MSG="UNKNOWN - Warning level is less then Crit" | ||
| 138 | return ${STATE_UNKNOWN} | ||
| 139 | fi | ||
| 140 | result=`sqlplus -s ${ORA_USER}/${ORA_PASS}@${ORACLE_SID} << EOF | ||
| 141 | set pagesize 0 | ||
| 142 | select (1-(pr.value/(dbg.value+cg.value)))*100 | ||
| 143 | from v\\$sysstat pr, v\\$sysstat dbg, v\\$sysstat cg | ||
| 144 | where pr.name='physical reads' | ||
| 145 | and dbg.name='db block gets' | ||
| 146 | and cg.name='consistent gets'; | ||
| 147 | EOF` | ||
| 148 | |||
| 149 | if [ -n "`echo $result | grep ORA-`" ] ; then | ||
| 150 | error=` echo "$result" | grep "ORA-" | head -1` | ||
| 151 | echo "CRITICAL - $error" | ||
| 152 | exit $STATE_CRITICAL | ||
| 153 | fi | ||
| 154 | |||
| 155 | |||
| 156 | buf_hr=`echo $result | awk '{print int($1)}'` | ||
| 157 | result=`sqlplus -s ${ORA_USER}/${ORA_PASS}@${ORACLE_SID} << EOF | ||
| 158 | set pagesize 0 | ||
| 159 | select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 | ||
| 160 | from v\\$librarycache lc; | ||
| 161 | EOF` | ||
| 162 | |||
| 163 | if [ -n "`echo $result | grep ORA-`" ] ; then | ||
| 164 | error=` echo "$result" | grep "ORA-" | head -1` | ||
| 165 | echo "CRITICAL - $error" | ||
| 166 | exit $STATE_CRITICAL | ||
| 167 | fi | ||
| 168 | |||
| 169 | lib_hr=`echo $result | awk '{print int($1)}'` | ||
| 170 | |||
| 171 | if [ $buf_hr -le ${CRIT_LVL} -o $lib_hr -le ${CRIT_LVL} ] ; then | ||
| 172 | export RETURN_MSG="${ORACLE_SID} CRITICAL - Cache Hit Rates: $lib_hr% Lib -- $buf_hr% Buff" | ||
| 173 | exit $STATE_CRITICAL | ||
| 174 | fi | ||
| 175 | if [ $buf_hr -le ${WARN_LVL} -o $lib_hr -le ${WARN_LVL} ] ; then | ||
| 176 | export RETURN_MSG="${ORACLE_SID} WARNING - Cache Hit Rates: $lib_hr% Lib -- $buf_hr% Buff" | ||
| 177 | exit $STATE_WARNING | ||
| 178 | fi | ||
| 179 | export RETURN_MSG="${ORACLE_SID} OK - Cache Hit Rates: $lib_hr% Lib -- $buf_hr% Buff" | ||
| 180 | |||
| 181 | return ${STATE_OK} | ||
| 182 | |||
| 183 | |||
| 184 | } | ||
| 185 | |||
| 186 | check_extents() { | ||
| 187 | if [ ${CRIT_LVL} -lt ${WARN_LVL} ] ; then | ||
| 188 | RETURN_MSG="UNKNOWN - Warning level is higher then Crit" | ||
| 189 | return ${STATE_UNKNOWN} | ||
| 190 | fi | ||
| 191 | result=`sqlplus -s ${ORA_USER}/${ORA_PASS}@${ORACLE_SID} << EOF | ||
| 192 | set pagesize 200 | ||
| 193 | column Sname form a40 heading 'Object Name' | ||
| 194 | column Size form 99,999 heading 'Size' | ||
| 195 | column Next form 99,999 heading 'Next' | ||
| 196 | column Tname form a15 heading 'TsName' | ||
| 197 | |||
| 198 | select a.owner||'.'||a.segment_name "Sname", | ||
| 199 | a.bytes/1024/1024 "Size", | ||
| 200 | a.next_extent/1024/1024 "Next", | ||
| 201 | a.tablespace_name "TName" | ||
| 202 | from sys.dba_segments a | ||
| 203 | where a.tablespace_name not like 'T%MP' -- Exclude TEMP tablespaces | ||
| 204 | and a.tablespace_name like '%${ORA_TS}%' | ||
| 205 | and next_extent * 1 > ( -- Cannot extend 1x, can change to 2x... | ||
| 206 | select max(b.bytes) | ||
| 207 | from dba_free_space b | ||
| 208 | where a.tablespace_name = b.tablespace_name) | ||
| 209 | order by 3 desc; | ||
| 210 | EOF` | ||
| 211 | |||
| 212 | if [ -n "`echo $result | grep ORA-`" ] ; then | ||
| 213 | error=` echo "$result" | grep "ORA-" | head -1` | ||
| 214 | echo "CRITICAL - $error" | ||
| 215 | exit $STATE_CRITICAL | ||
| 216 | fi | ||
| 217 | |||
| 218 | if [ `echo $result | grep -c "no rows selected"` -eq 1 ] | ||
| 219 | then | ||
| 220 | export RETURN_MSG="${ORACLE_SID} : ${ORA_TS} OK - Extents. Extensible" | ||
| 221 | return ${STATE_OK} | ||
| 222 | else | ||
| 223 | nn=`expr \`echo "$result" | wc -l\` - 3` | ||
| 224 | export RETURN_MSG="CRIT: Result: $nn objects can't extend" | ||
| 225 | return $STATE_CRITICAL | ||
| 226 | fi | ||
| 227 | } | ||
| 228 | |||
| 229 | check_tablespace() { | ||
| 230 | if [ ${CRIT_LVL} -lt ${WARN_LVL} ] ; then | ||
| 231 | RETURN_MSG="UNKNOWN - Warning level is more then Crit" | ||
| 232 | return ${STATE_UNKNOWN} | ||
| 233 | fi | ||
| 234 | result=`sqlplus -s ${ORA_USER}/${ORA_PASS}@${ORACLE_SID} << EOF | ||
| 235 | set pagesize 0 | ||
| 236 | select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc | ||
| 237 | from ( | ||
| 238 | select tablespace_name,sum(bytes)/1024/1024 total | ||
| 239 | from dba_data_files group by tablespace_name) A, | ||
| 240 | ( select tablespace_name,sum(bytes)/1024/1024 free | ||
| 241 | from dba_free_space group by tablespace_name) B | ||
| 242 | where a.tablespace_name=b.tablespace_name and a.tablespace_name='${ORA_TS}'; | ||
| 243 | EOF` | ||
| 244 | |||
| 245 | if [ -n "`echo $result | grep ORA-`" ] ; then | ||
| 246 | error=` echo "$result" | grep "ORA-" | head -1` | ||
| 247 | echo "CRITICAL - $error" | ||
| 248 | exit $STATE_CRITICAL | ||
| 249 | fi | ||
| 250 | |||
| 251 | |||
| 252 | ts_free=`echo $result | awk '{print int($1)}'` | ||
| 253 | ts_total=`echo $result | awk '{print int($2)}'` | ||
| 254 | ts_pct=`echo $result | awk '{print int($3)}'` | ||
| 255 | |||
| 256 | ce_ret=${STATE_OK} | ||
| 257 | ce_ret_msg="" | ||
| 258 | if [ ${CHECK_EXTENTS} == "yes" ] | ||
| 259 | then | ||
| 260 | check_extents | ||
| 261 | ce_ret=${?} | ||
| 262 | ce_ret_msg=${RETURN_MSG} | ||
| 263 | fi | ||
| 264 | if [ ${ts_pct} -ge ${CRIT_LVL} ] || [ ${ce_ret} -eq ${STATE_CRITICAL} ] | ||
| 265 | then | ||
| 266 | RETURN_MSG="${ORACLE_SID} : ${ORA_TS} CRITICAL - $ts_pct% used [ $ts_free / $ts_total MB available ] || ${ce_ret_msg}" | ||
| 267 | return ${STATE_CRITICAL} | ||
| 268 | fi | ||
| 269 | if [ ${ts_pct} -ge ${WARN_LVL} ] || [ ${ce_ret} -eq ${STATE_WARNING} ] | ||
| 270 | then | ||
| 271 | RETURN_MSG="${ORACLE_SID} : ${ORA_TS} WARNING - $ts_pct% used [ $ts_free / $ts_total MB available ] || ${ce_ret_msg}" | ||
| 272 | return ${STATE_WARNING} | ||
| 273 | fi | ||
| 274 | if [ $ts_free -eq 0 -a $ts_total -eq 0 -a $ts_pct -eq 0 ] || \ | ||
| 275 | [ ${ce_ret} -eq ${STATE_UNKNOWN} ] | ||
| 276 | then | ||
| 277 | RETURN_MSG="No data returned by Oracle - tablespace ${ORA_TS} not found? || ${ce_ret_msg}" | ||
| 278 | return ${STATE_UNKNOWN} | ||
| 279 | fi | ||
| 280 | RETURN_MSG="${ORACLE_SID} : ${ORA_TS} OK - $ts_pct% used [ $ts_free / $ts_total MB available ] || ${ce_ret_msg}" | ||
| 281 | return ${STATE_OK} | ||
| 282 | } | ||
| 283 | |||
| 284 | check_tns() { | ||
| 285 | tnstarg="" | ||
| 286 | if [ -n "${ORA_HOST}" -a "${ORA_HOST}" != "" ] | ||
| 287 | then | ||
| 288 | tnstarg=${ORA_HOST} | ||
| 289 | elif [ -n "${ORACLE_SID}" ] #-a "${ORACLE_SID}" != "" ] | ||
| 290 | then | ||
| 291 | tnstarg=${ORACLE_SID} | ||
| 292 | RETURN_MSG="set tnstarg = $tnstarg (ORACLE_SID = ${ORACLE_SID})" | ||
| 293 | else | ||
| 294 | RETURN_MSG="Could not determine destination" | ||
| 295 | return $STATE_WARNING | ||
| 296 | fi | ||
| 297 | |||
| 298 | tnschk=` tnsping ${tnstarg}` | ||
| 299 | tnschk2=` echo $tnschk | grep -c OK` | ||
| 300 | if [ ${tnschk2} -eq 1 ] ; then | ||
| 301 | tnschk3=` echo $tnschk | sed -e 's/.*(//' -e 's/).*//'` | ||
| 302 | export RETURN_MSG="OK - reply time ${tnschk3} from ${tnstarg}" | ||
| 303 | return ${STATE_OK} | ||
| 304 | else | ||
| 305 | export RETURN_MSG="No TNS Listener on ${tnstarg}" | ||
| 306 | return $STATE_CRITICAL | ||
| 307 | fi | ||
| 308 | } | ||
| 309 | |||
| 310 | |||
| 311 | check_oranames() { | ||
| 312 | namesctl status ${ORA_NAMES} | awk ' | ||
| 313 | /Server has been running for:/ { | ||
| 314 | msg = "OK: Up" | ||
| 315 | for (i = 6; i <= NF; i++) { | ||
| 316 | msg = msg " " $i | ||
| 317 | } | ||
| 318 | status = '${STATE_OK}' | ||
| 319 | } | ||
| 320 | /error/ { | ||
| 321 | msg = "CRITICAL: " $0 | ||
| 322 | status = '$STATE_CRITICAL' | ||
| 323 | } | ||
| 324 | END { | ||
| 325 | print msg | ||
| 326 | RETURN status | ||
| 327 | }' | ||
| 328 | } | ||
| 329 | |||
| 330 | check_db() { | ||
| 331 | pmonchk=`ps -ef | grep -v grep | grep ${ORACLE_SID} | grep -c pmon` | ||
| 332 | if [ ${pmonchk} -ge 1 ] ; then | ||
| 333 | export RETURN_MSG="${ORACLE_SID} OK - ${pmonchk} PMON process(es) running" | ||
| 334 | return ${STATE_OK} | ||
| 335 | else | ||
| 336 | export RETURN_MSG="${2} Database is DOWN" | ||
| 337 | return $STATE_CRITICAL | ||
| 338 | fi | ||
| 339 | } | ||
| 340 | |||
| 341 | check_login() { | ||
| 342 | loginchk=`sqlplus dummy/user@${ORACLE_SID} < /dev/null` | ||
| 343 | loginchk2=` echo ${loginchk} | grep -c ORA-01017` | ||
| 344 | if [ ${loginchk2} -eq 1 ] ; then | ||
| 345 | export RETURN_MSG="OK - dummy login connected" | ||
| 346 | return ${STATE_OK} | ||
| 347 | else | ||
| 348 | loginchk3=` echo "${loginchk}" | grep "ORA-" | head -1` | ||
| 349 | export RETURN_MSG="CRITICAL - ${loginchk3}" | ||
| 350 | return $STATE_CRITICAL | ||
| 351 | fi | ||
| 352 | } | ||
| 353 | #begin our "main" | ||
| 354 | # | ||
| 355 | |||
| 356 | init_var | ||
| 357 | |||
| 358 | |||
| 359 | while getopts ":cC:dehH:ln:p:s:tT:u:W:" arg ; do | ||
| 360 | case ${arg} in | ||
| 361 | |||
| 362 | c ) #echo "Cache Received" | ||
| 363 | CHECK_CACHE=yes | ||
| 364 | ;; | ||
| 365 | C ) #echo "Critical lvl = ${OPTARG}" | ||
| 366 | CRIT_LVL=${OPTARG} | ||
| 367 | ;; | ||
| 368 | d ) #echo "DB Received" | ||
| 369 | CHECK_DB=yes | ||
| 370 | ;; | ||
| 371 | e ) #echo "Extents Received" | ||
| 372 | CHECK_EXTENTS=yes | ||
| 373 | ;; | ||
| 374 | H ) #echo "Host Received = ${OPTARG}" | ||
| 375 | ORA_HOST=${OPTARG} | ||
| 376 | ;; | ||
| 377 | h ) #echo "Help Received" | ||
| 378 | print_help | ||
| 379 | exit ${STATE_UNKNOWN} | ||
| 380 | ;; | ||
| 381 | l ) #echo "Login Received" | ||
| 382 | CHECK_LOGIN=yes | ||
| 383 | ;; | ||
| 384 | n ) #echo "oranames Received = $OPTARG}" | ||
| 385 | CHECK_NAMES=yes | ||
| 386 | ORA_NAMES=${OPTARG} | ||
| 387 | ;; | ||
| 388 | p ) #echo "Passwd Received = ${OPTARG}" | ||
| 389 | ORA_PASS=${OPTARG} | ||
| 390 | ;; | ||
| 391 | s ) #echo "SID Received = ${OPTARG}" | ||
| 392 | ORACLE_SID=${OPTARG} | ||
| 393 | ;; | ||
| 394 | t ) #echo "tnsnames Received" | ||
| 395 | CHECK_TNS=yes | ||
| 396 | ;; | ||
| 397 | T ) #echo "Tablespace Received = ${OPTARG}" | ||
| 398 | ORA_TS=${OPTARG} | ||
| 399 | CHECK_TS=yes | ||
| 400 | ;; | ||
| 401 | u ) #echo "User Received = ${OPTARG}" | ||
| 402 | ORA_USER=${OPTARG} | ||
| 403 | ;; | ||
| 404 | W ) #echo "Warning lvl = ${OPTARG}" | ||
| 405 | WARN_LVL=${OPTARG} | ||
| 406 | ;; | ||
| 407 | \?) print_usage | ||
| 408 | exit ${STATE_UNKNOWN} | ||
| 409 | ;; | ||
| 410 | esac | ||
| 411 | done | ||
| 412 | |||
| 413 | |||
| 414 | shift $(($OPTIND - 1)) | ||
| 415 | |||
| 416 | if [ "$1" == "--help" ] | ||
| 417 | then | ||
| 418 | print_help | ||
| 419 | fi | ||
| 420 | |||
| 421 | # "This is where new options can be used - working on compat first | ||
| 422 | # "step through following:" | ||
| 423 | if [ -z $1 ] | ||
| 424 | then | ||
| 425 | |||
| 426 | if [ -n ${ORACLE_SID} ] && [ "${ORACLE_SID}" != "" ] | ||
| 427 | then | ||
| 428 | if [ -n ${ORA_PASS} -a "${ORA_PASS}" != "" ] || \ | ||
| 429 | [ -n ${ORA_USER} -a "${ORA_USER}" != "" ] || \ | ||
| 430 | [ -n ${CRIT_LVL} >= 0 ] || [ ${WARN_LVL} >= 0 ] | ||
| 431 | then | ||
| 432 | if [ ${CHECK_CACHE} == "yes" ] && [ ${CHECK_TS} == "no" ] | ||
| 433 | then | ||
| 434 | check_cache | ||
| 435 | ret=${?} | ||
| 436 | echo ${RETURN_MSG} | ||
| 437 | exit ${ret} | ||
| 438 | fi | ||
| 439 | if [ ${CHECK_EXTENTS} == "yes" ] && [ ${CHECK_TS} == "no" ] | ||
| 440 | then | ||
| 441 | echo "call check_Extents" | ||
| 442 | check_extents | ||
| 443 | ret=${?} | ||
| 444 | echo ${RETURN_MSG} | ||
| 445 | exit ${RET} | ||
| 446 | fi | ||
| 447 | else | ||
| 448 | echo "error - not proper args" | ||
| 449 | fi | ||
| 450 | if [ -n ${ORA_TS} ] && [ "${ORA_TS}" != "" ] | ||
| 451 | then | ||
| 452 | if [ ${CHECK_TS} == "yes" ] && [ ${CHECK_CACHE} == "no" ] | ||
| 453 | then | ||
| 454 | check_tablespace | ||
| 455 | ret=${?} | ||
| 456 | echo ${RETURN_MSG} | ||
| 457 | exit ${ret} | ||
| 458 | fi | ||
| 459 | if [ ${CHECK_TS} == "yes" ] && [ ${CHECK_CACHE} == "yes" ] | ||
| 460 | then | ||
| 461 | RETURN_MSG="INVALID: Currently Cache and tablespace checks don't mesh" | ||
| 462 | echo ${RETURN_MSG} | ||
| 463 | exit ${STATE_UNKNOWN} | ||
| 464 | fi | ||
| 465 | fi | ||
| 466 | if [ ${CHECK_LOGIN} == "yes" ] | ||
| 467 | then | ||
| 468 | check_login | ||
| 469 | ret=${?} | ||
| 470 | echo ${RETURN_MSG} | ||
| 471 | exit ${ret} | ||
| 472 | fi | ||
| 473 | if [ ${CHECK_DB} == "yes" ] | ||
| 474 | then | ||
| 475 | check_db | ||
| 476 | ret=${?} | ||
| 477 | echo ${RETURN_MSG} | ||
| 478 | exit ${ret} | ||
| 479 | fi | ||
| 480 | fi | ||
| 481 | else | ||
| 482 | echo "Using old Invocation Methods: \"$*\"" | ||
| 483 | fi | ||
| 484 | |||
| 485 | case "$1" in | ||
| 486 | 1) | ||
| 487 | cmd='--tns' | ||
| 488 | ;; | ||
| 489 | 2) | ||
| 490 | cmd='--db' | ||
| 491 | ;; | ||
| 492 | *) | ||
| 493 | cmd="$1" | ||
| 494 | ;; | ||
| 495 | esac | ||
| 496 | |||
| 497 | # Information options | ||
| 498 | case "$cmd" in | ||
| 499 | --help) | ||
| 500 | print_help | ||
| 501 | exit ${STATE_OK} | ||
| 502 | ;; | ||
| 503 | -h) | ||
| 504 | print_help | ||
| 505 | exit ${STATE_OK} | ||
| 506 | ;; | ||
| 507 | --db) | ||
| 508 | CHECK_DB=yes | ||
| 509 | ORACLE_SID=$2 | ||
| 510 | check_db | ||
| 511 | ret=${?} | ||
| 512 | echo ${RETURN_MSG} | ||
| 513 | exit $ret | ||
| 514 | ;; | ||
| 515 | --cache) | ||
| 516 | CHECK_CACHE=yes | ||
| 517 | ORACLE_SID=$2 | ||
| 518 | ORA_USER=$3 | ||
| 519 | ORA_PASS=$4 | ||
| 520 | CRIT_LVL=$5 | ||
| 521 | WARN_LVL=$6 | ||
| 522 | check_cache | ||
| 523 | ret=${?} | ||
| 524 | echo ${RETURN_MSG} | ||
| 525 | exit $ret | ||
| 526 | ;; | ||
| 527 | --extents) | ||
| 528 | CHECK_EXTENTS=yes | ||
| 529 | ORACLE_SID=$2 | ||
| 530 | ORA_USER=$3 | ||
| 531 | ORA_PASS=$4 | ||
| 532 | CRIT_LVL=$5 | ||
| 533 | WARN_LVL=$6 | ||
| 534 | check_extents | ||
| 535 | ret=${?} | ||
| 536 | echo ${RETURN_MSG} | ||
| 537 | exit $ret | ||
| 538 | ;; | ||
| 539 | --login) | ||
| 540 | CHECK_LOGIN=yes | ||
| 541 | ORACLE_SID=$2 | ||
| 542 | check_login | ||
| 543 | ret=${?} | ||
| 544 | echo ${RETURN_MSG} | ||
| 545 | exit $ret | ||
| 546 | ;; | ||
| 547 | --oranames) | ||
| 548 | CHECK_NAMES=yes | ||
| 549 | ORA_NAMES=$2 | ||
| 550 | check_oranames | ||
| 551 | exit ${?} | ||
| 552 | ;; | ||
| 553 | --tablespace) | ||
| 554 | CHECK_TS=yes | ||
| 555 | ORACLE_SID=$2 | ||
| 556 | ORA_USER=$3 | ||
| 557 | ORA_PASS=$4 | ||
| 558 | ORA_TS=$5 | ||
| 559 | CRIT_LVL=$6 | ||
| 560 | WARN_LVL=$7 | ||
| 561 | check_tablespace | ||
| 562 | ret=${?} | ||
| 563 | echo ${RETURN_MSG} | ||
| 564 | exit $ret | ||
| 565 | ;; | ||
| 566 | --tns) | ||
| 567 | CHECK_TNS=yes | ||
| 568 | export ORACLE_SID=$2 | ||
| 569 | echo "--tns ${ORACLE_SID} " | ||
| 570 | check_tns | ||
| 571 | ret=${?} | ||
| 572 | echo ${RETURN_MSG} | ||
| 573 | exit $ret | ||
| 574 | ;; | ||
| 575 | --version) | ||
| 576 | print_revision $PLUGIN $REVISION | ||
| 577 | exit ${STATE_OK} | ||
| 578 | ;; | ||
| 579 | -V) | ||
| 580 | print_revision $PLUGIN $REVISION | ||
| 581 | exit ${STATE_OK} | ||
| 582 | ;; | ||
| 583 | *) | ||
| 584 | print_usage | ||
| 585 | exit ${STATE_UNKNOWN} | ||
| 586 | ;; | ||
| 587 | esac | ||
| 588 | |||
| 589 | |||
| 590 | exit ${STATE_UNKNOWN} | ||
diff --git a/web/attachments/56819-ping.diff b/web/attachments/56819-ping.diff new file mode 100644 index 0000000..8a849a1 --- /dev/null +++ b/web/attachments/56819-ping.diff | |||
| @@ -0,0 +1,120 @@ | |||
| 1 | *** check_ping.c.orig Mon Jan 13 20:15:16 2003 | ||
| 2 | --- check_ping.c Wed Jul 23 14:38:19 2003 | ||
| 3 | *************** | ||
| 4 | *** 19,25 **** | ||
| 5 | |||
| 6 | #define OPTIONS "\ | ||
| 7 | -H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n\ | ||
| 8 | ! [-p packets] [-t timeout] [-L]\n" | ||
| 9 | |||
| 10 | #define LONGOPTIONS "\ | ||
| 11 | -H, --hostname=HOST\n\ | ||
| 12 | --- 19,26 ---- | ||
| 13 | |||
| 14 | #define OPTIONS "\ | ||
| 15 | -H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n\ | ||
| 16 | ! [-p packets] [-t timeout] [-6] [-L]\n" | ||
| 17 | ! | ||
| 18 | |||
| 19 | #define LONGOPTIONS "\ | ||
| 20 | -H, --hostname=HOST\n\ | ||
| 21 | *************** | ||
| 22 | *** 32,37 **** | ||
| 23 | --- 33,40 ---- | ||
| 24 | number of ICMP ECHO packets to send (Default: %d)\n\ | ||
| 25 | -t, --timeout=INTEGER\n\ | ||
| 26 | optional specified timeout in second (Default: %d)\n\ | ||
| 27 | + -6, --use-ping6\n\ | ||
| 28 | + use ping6 for ICMPv6 instead of ping for IPv4\n\ | ||
| 29 | -L, --link\n\ | ||
| 30 | show HTML in the plugin output (obsoleted by urlize)\n\ | ||
| 31 | THRESHOLD is <rta>,<pl>%% where <rta> is the round trip average travel\n\ | ||
| 32 | *************** | ||
| 33 | *** 70,81 **** | ||
| 34 | --- 73,87 ---- | ||
| 35 | char *server_address = NULL; | ||
| 36 | int max_packets = -1; | ||
| 37 | int verbose = FALSE; | ||
| 38 | + int ipv6 = FALSE; | ||
| 39 | |||
| 40 | float rta = UNKNOWN_TRIP_TIME; | ||
| 41 | int pl = UNKNOWN_PACKET_LOSS; | ||
| 42 | |||
| 43 | char *warn_text = NULL; | ||
| 44 | |||
| 45 | + #define PING6_COMMAND "/sbin/ping6 -n -c %d %s" | ||
| 46 | + | ||
| 47 | int | ||
| 48 | main (int argc, char **argv) | ||
| 49 | { | ||
| 50 | *************** | ||
| 51 | *** 86,98 **** | ||
| 52 | usage ("Could not parse arguments"); | ||
| 53 | exit; | ||
| 54 | |||
| 55 | /* does the host address of number of packets argument come first? */ | ||
| 56 | #ifdef PING_PACKETS_FIRST | ||
| 57 | asprintf (&command_line, PING_COMMAND, max_packets, server_address); | ||
| 58 | #else | ||
| 59 | asprintf (&command_line, PING_COMMAND, server_address, max_packets); | ||
| 60 | #endif | ||
| 61 | ! | ||
| 62 | /* Set signal handling and alarm */ | ||
| 63 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { | ||
| 64 | printf ("Cannot catch SIGALRM"); | ||
| 65 | --- 92,108 ---- | ||
| 66 | usage ("Could not parse arguments"); | ||
| 67 | exit; | ||
| 68 | |||
| 69 | + #ifdef PING6_COMMAND | ||
| 70 | + asprintf (&command_line, ipv6 ? PING6_COMMAND : PING_COMMAND, max_packets, server_address); | ||
| 71 | + #else | ||
| 72 | + | ||
| 73 | /* does the host address of number of packets argument come first? */ | ||
| 74 | #ifdef PING_PACKETS_FIRST | ||
| 75 | asprintf (&command_line, PING_COMMAND, max_packets, server_address); | ||
| 76 | #else | ||
| 77 | asprintf (&command_line, PING_COMMAND, server_address, max_packets); | ||
| 78 | #endif | ||
| 79 | ! #endif | ||
| 80 | /* Set signal handling and alarm */ | ||
| 81 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { | ||
| 82 | printf ("Cannot catch SIGALRM"); | ||
| 83 | *************** | ||
| 84 | *** 157,167 **** | ||
| 85 | {"packets", required_argument, 0, 'p'}, | ||
| 86 | {"nohtml", no_argument, 0, 'n'}, | ||
| 87 | {"link", no_argument, 0, 'L'}, | ||
| 88 | {0, 0, 0, 0} | ||
| 89 | }; | ||
| 90 | #endif | ||
| 91 | |||
| 92 | ! #define OPTCHARS "Vvht:c:w:H:p:nL" | ||
| 93 | |||
| 94 | if (argc < 2) | ||
| 95 | return ERROR; | ||
| 96 | --- 167,178 ---- | ||
| 97 | {"packets", required_argument, 0, 'p'}, | ||
| 98 | {"nohtml", no_argument, 0, 'n'}, | ||
| 99 | {"link", no_argument, 0, 'L'}, | ||
| 100 | + {"use-ping6", no_argument, 0, '6'}, | ||
| 101 | {0, 0, 0, 0} | ||
| 102 | }; | ||
| 103 | #endif | ||
| 104 | |||
| 105 | ! #define OPTCHARS "Vvht:c:w:H:p:n6L" | ||
| 106 | |||
| 107 | if (argc < 2) | ||
| 108 | return ERROR; | ||
| 109 | *************** | ||
| 110 | *** 213,218 **** | ||
| 111 | --- 224,232 ---- | ||
| 112 | break; | ||
| 113 | case 'L': /* show HTML */ | ||
| 114 | display_html = TRUE; | ||
| 115 | + break; | ||
| 116 | + case '6': | ||
| 117 | + ipv6 = TRUE; | ||
| 118 | break; | ||
| 119 | case 'c': | ||
| 120 | get_threshold (optarg, &crta, &cpl); | ||
diff --git a/web/attachments/57050-check_http.cookies_patch b/web/attachments/57050-check_http.cookies_patch new file mode 100644 index 0000000..d75778c --- /dev/null +++ b/web/attachments/57050-check_http.cookies_patch | |||
| @@ -0,0 +1,159 @@ | |||
| 1 | --- nagios-plugins-1.3.1/plugins/check_http.c 2003-06-30 04:56:08.000000000 -0700 | ||
| 2 | +++ nagios-plugins-1.3.1.DS/plugins/check_http.c 2003-07-27 15:26:14.792132000 -0700 | ||
| 3 | @@ -44,7 +44,7 @@ | ||
| 4 | (-H <vhost> | -I <IP-address>) [-u <uri>] [-p <port>]\n\ | ||
| 5 | [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\ | ||
| 6 | [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\ | ||
| 7 | - [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\ | ||
| 8 | + [-s string] [-l] [-k] [-r <regex> | -R <case-insensitive regex>]\n\ | ||
| 9 | [-P string]" | ||
| 10 | |||
| 11 | #define LONGOPTIONS "\ | ||
| 12 | @@ -75,6 +75,8 @@ | ||
| 13 | Wrap output in HTML link (obsoleted by urlize)\n\ | ||
| 14 | -f, --onredirect=<ok|warning|critical|follow>\n\ | ||
| 15 | How to handle redirected pages\n%s%s\ | ||
| 16 | + -k, --keepalive\n\ | ||
| 17 | + Use Keep-Alive header in every request request\n\ | ||
| 18 | -v, --verbose\n\ | ||
| 19 | Show details for command-line debugging (do not use with nagios server)\n\ | ||
| 20 | -h, --help\n\ | ||
| 21 | @@ -186,6 +188,10 @@ | ||
| 22 | #define URI_HOST "%[-.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]" | ||
| 23 | #define URI_PORT ":%[0123456789]" | ||
| 24 | #define URI_PATH "%[-_.!~*'();/?:@&=+$,%#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]" | ||
| 25 | +#define HDR_SETCOOKIE "%*[Ss]%*[Ee]%*[Tt]%*[-]%*[Cc]%*[Oo]%*[Kk]%*[Ii]%*[Ee]: " | ||
| 26 | +#define COOKIE_BODY "%[/a-zA-Z0-9._-=@,: ]" | ||
| 27 | +#define COOKIE_PATH ";%[/a-zA-Z0-9._-=@,: ]" | ||
| 28 | +#define COOKIE_DATE ";%[/a-zA-Z0-9._-=@,: ]" | ||
| 29 | enum { | ||
| 30 | MAX_IPV4_HOSTLENGTH = 255, | ||
| 31 | HTTP_PORT = 80, | ||
| 32 | @@ -206,6 +212,7 @@ | ||
| 33 | char *server_url = ""; | ||
| 34 | int server_url_length; | ||
| 35 | int server_expect_yn = 0; | ||
| 36 | +char *cookies=NULL; | ||
| 37 | char server_expect[MAX_INPUT_BUFFER] = HTTP_EXPECT; | ||
| 38 | char string_expect[MAX_INPUT_BUFFER] = ""; | ||
| 39 | double warning_time = 0; | ||
| 40 | @@ -216,6 +223,7 @@ | ||
| 41 | int display_html = FALSE; | ||
| 42 | int onredirect = STATE_OK; | ||
| 43 | int use_ssl = FALSE; | ||
| 44 | +int keepalive = FALSE; | ||
| 45 | int verbose = FALSE; | ||
| 46 | int sd; | ||
| 47 | char *http_method = "GET"; | ||
| 48 | @@ -309,6 +317,7 @@ | ||
| 49 | {"ereg", required_argument, 0, 'r'}, | ||
| 50 | {"eregi", required_argument, 0, 'R'}, | ||
| 51 | {"linespan", no_argument, 0, 'l'}, | ||
| 52 | + {"keepalive", no_argument, 0, 'k'}, | ||
| 53 | {"onredirect", required_argument, 0, 'f'}, | ||
| 54 | {"certificate", required_argument, 0, 'C'}, | ||
| 55 | {0, 0, 0, 0} | ||
| 56 | @@ -331,7 +340,7 @@ | ||
| 57 | strcpy (argv[c], "-n"); | ||
| 58 | } | ||
| 59 | |||
| 60 | -#define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLS" | ||
| 61 | +#define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlkLS" | ||
| 62 | |||
| 63 | while (1) { | ||
| 64 | #ifdef HAVE_GETOPT_H | ||
| 65 | @@ -466,6 +475,9 @@ | ||
| 66 | } | ||
| 67 | break; | ||
| 68 | #endif | ||
| 69 | + case 'k': /* Keep-Alive */ | ||
| 70 | + keepalive = TRUE; | ||
| 71 | + break; | ||
| 72 | case 'v': /* verbose */ | ||
| 73 | verbose = TRUE; | ||
| 74 | break; | ||
| 75 | @@ -550,6 +562,12 @@ | ||
| 76 | char *x = NULL; | ||
| 77 | char *orig_url = NULL; | ||
| 78 | double elapsed_time; | ||
| 79 | + char *cpos = ""; | ||
| 80 | + char cookie_body[255]; | ||
| 81 | + char cookie_path[255]; | ||
| 82 | + char cookie_date[255]; | ||
| 83 | + struct tm tm; | ||
| 84 | + char date[255],rest[128]; | ||
| 85 | #ifdef HAVE_SSL | ||
| 86 | int sslerr; | ||
| 87 | #endif | ||
| 88 | @@ -589,6 +607,16 @@ | ||
| 89 | asprintf (&buf, "%sUser-Agent: check_http/%s (nagios-plugins %s)\r\n", | ||
| 90 | buf, clean_revstring (REVISION), PACKAGE_VERSION); | ||
| 91 | |||
| 92 | + /* send Collected Cookies */ | ||
| 93 | + if(cookies) | ||
| 94 | + { | ||
| 95 | + asprintf (&buf, "%s%s\r\n", buf,cookies); | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + /* send "Connection: Keep-Alive" if need */ | ||
| 99 | + if(keepalive) | ||
| 100 | + asprintf (&buf, "%sConnection: Keep-Alive\r\n", buf); | ||
| 101 | + | ||
| 102 | /* optionally send the authentication info */ | ||
| 103 | if (strcmp (user_auth, "")) { | ||
| 104 | auth = base64 (user_auth, strlen (user_auth)); | ||
| 105 | @@ -615,6 +643,9 @@ | ||
| 106 | } | ||
| 107 | else { | ||
| 108 | #endif | ||
| 109 | + if (verbose) | ||
| 110 | + printf ("**** REQUEST ****\n%s\n", buf); | ||
| 111 | + | ||
| 112 | send (sd, buf, strlen (buf), 0); | ||
| 113 | #ifdef HAVE_SSL | ||
| 114 | } | ||
| 115 | @@ -737,6 +768,44 @@ | ||
| 116 | if (onredirect == STATE_DEPENDENT) { | ||
| 117 | |||
| 118 | asprintf (&orig_url, "%s", server_url); | ||
| 119 | + cpos = header; | ||
| 120 | + cookies=NULL; | ||
| 121 | + while (*cpos) { | ||
| 122 | + cookie_date[0]='\0'; | ||
| 123 | + if (sscanf(cpos, HDR_SETCOOKIE COOKIE_BODY COOKIE_PATH COOKIE_DATE, cookie_body, cookie_path, cookie_date)) { | ||
| 124 | + if(verbose) | ||
| 125 | + printf("Cookie parameters: body=%s path=%s date=%s\n", cookie_body, cookie_path, cookie_date); | ||
| 126 | + | ||
| 127 | + if(strlen(cookie_date)>1) | ||
| 128 | + { | ||
| 129 | + sscanf(cookie_date, "%*[Ee]%*[Xx]%*[Pp]%*[Ii]%*[Rr]%*[Ee]%*[Ss]=%*s %s %s %*s", date, rest); | ||
| 130 | + strcat(date, " "); | ||
| 131 | + strcat(date, rest); | ||
| 132 | + strptime(date,"%d-%b-%Y %T",&tm); | ||
| 133 | + | ||
| 134 | + if(verbose) | ||
| 135 | + printf("Cookie Date %d-%d-%d Time %d:%d:%d\n", tm.tm_mday, tm.tm_mon, tm.tm_year, tm.tm_hour, tm.tm_min, tm.tm_sec); | ||
| 136 | + if(mktime(&tm) < time(0)) | ||
| 137 | + { | ||
| 138 | + if(verbose) | ||
| 139 | + printf("Ignoring cookie since expired\n"); | ||
| 140 | + | ||
| 141 | + cpos += (size_t) strcspn (cpos, "\r\n"); | ||
| 142 | + cpos += (size_t) strspn (cpos, "\r\n"); | ||
| 143 | + continue; | ||
| 144 | + } | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + if(cookies) | ||
| 148 | + asprintf (&cookies, "%s;%s", cookies, cookie_body); | ||
| 149 | + else | ||
| 150 | + asprintf (&cookies, "Cookie: %s", cookie_body); | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + cpos += (size_t) strcspn (cpos, "\r\n"); | ||
| 154 | + cpos += (size_t) strspn (cpos, "\r\n"); | ||
| 155 | + } /* end while (cpos) */ | ||
| 156 | + | ||
| 157 | pos = header; | ||
| 158 | while (pos) { | ||
| 159 | server_address = realloc (server_address, MAX_IPV4_HOSTLENGTH + 1); | ||
diff --git a/web/attachments/57482-check_smtp.patch b/web/attachments/57482-check_smtp.patch new file mode 100644 index 0000000..2c81f99 --- /dev/null +++ b/web/attachments/57482-check_smtp.patch | |||
| @@ -0,0 +1,272 @@ | |||
| 1 | --- check_smtp-cvs.c 2003-07-31 19:02:23.000000000 -0500 | ||
| 2 | +++ check_smtp.c 2003-07-31 19:02:07.000000000 -0500 | ||
| 3 | @@ -33,6 +33,7 @@ | ||
| 4 | |||
| 5 | const char *option_summary = "\ | ||
| 6 | -H host [-p port] [-e expect] [-C command] [-f from addr]\n\ | ||
| 7 | + [-A authtype -U authuser -P authpass]\n\ | ||
| 8 | [-w warn] [-c crit] [-t timeout] [-n] [-v] [-4|-6]"; | ||
| 9 | |||
| 10 | const char *options = "\ | ||
| 11 | @@ -53,6 +54,12 @@ | ||
| 12 | -f, --from=STRING\n\ | ||
| 13 | FROM-address to include in MAIL command, required by Exchange 2000\n\ | ||
| 14 | (default: '%s')\n\ | ||
| 15 | + -A, --authtype=STRING\n\ | ||
| 16 | + SMTP AUTH type to check (default none, only LOGIN supported)\n\ | ||
| 17 | + -U, --authuser=STRING\n\ | ||
| 18 | + SMTP AUTH username\n\ | ||
| 19 | + -P, --authpass=STRING\n\ | ||
| 20 | + SMTP AUTH password\n\ | ||
| 21 | -w, --warning=INTEGER\n\ | ||
| 22 | Seconds necessary to result in a warning status\n\ | ||
| 23 | -c, --critical=INTEGER\n\ | ||
| 24 | @@ -89,12 +96,80 @@ | ||
| 25 | int smtp_use_dummycmd = 1; | ||
| 26 | char *mail_command = "MAIL "; | ||
| 27 | char *from_arg = " "; | ||
| 28 | +char *authtype = NULL; | ||
| 29 | +char *authuser = NULL; | ||
| 30 | +char *authpass = NULL; | ||
| 31 | int warning_time = 0; | ||
| 32 | int check_warning_time = FALSE; | ||
| 33 | int critical_time = 0; | ||
| 34 | int check_critical_time = FALSE; | ||
| 35 | int verbose = 0; | ||
| 36 | |||
| 37 | +/* encode64 routine from http://www.experts-exchange.com/Programming/Programming_Languages/C/Q_20245582.html */ | ||
| 38 | + | ||
| 39 | +/* #define OK (0) */ | ||
| 40 | +/* #define FAIL (-1) */ | ||
| 41 | +#define BUFOVER (-2) | ||
| 42 | +#define CHAR64(c) (((c) < 0 || (c) > 127) ? -1 : index_64[(c)]) | ||
| 43 | +static char basis_64[] = | ||
| 44 | +"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????"; | ||
| 45 | +static char index_64[128] = { | ||
| 46 | + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
| 47 | + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
| 48 | + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, | ||
| 49 | + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, | ||
| 50 | + -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | ||
| 51 | + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, | ||
| 52 | + -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, | ||
| 53 | + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1 | ||
| 54 | +}; | ||
| 55 | + | ||
| 56 | +static int | ||
| 57 | +encode64(const char *_in, unsigned inlen, char *_out, unsigned outmax, unsigned *outlen) | ||
| 58 | +{ | ||
| 59 | + | ||
| 60 | + const unsigned char *in = (const unsigned char *) _in; | ||
| 61 | + unsigned char *out = (unsigned char *) _out; | ||
| 62 | + unsigned char oval; | ||
| 63 | + char *blah; | ||
| 64 | + unsigned olen; | ||
| 65 | + | ||
| 66 | + olen = (inlen + 2) / 3 * 4; | ||
| 67 | + if (outlen) | ||
| 68 | + *outlen = olen; | ||
| 69 | + if (outmax < olen) | ||
| 70 | + return BUFOVER; | ||
| 71 | + | ||
| 72 | + blah = (char *) out; | ||
| 73 | + while (inlen >= 3) | ||
| 74 | + { | ||
| 75 | +/* user provided max buffer size; make sure we don't go over it */ | ||
| 76 | + *out++ = basis_64[in[0] >> 2]; | ||
| 77 | + *out++ = basis_64[((in[0] << 4) & 0x30) | (in[1] >> 4)]; | ||
| 78 | + *out++ = basis_64[((in[1] << 2) & 0x3c) | (in[2] >> 6)]; | ||
| 79 | + *out++ = basis_64[in[2] & 0x3f]; | ||
| 80 | + in += 3; | ||
| 81 | + inlen -= 3; | ||
| 82 | + } | ||
| 83 | + if (inlen > 0) | ||
| 84 | + { | ||
| 85 | +/* user provided max buffer size; make sure we don't go over it */ | ||
| 86 | + *out++ = basis_64[in[0] >> 2]; | ||
| 87 | + oval = (in[0] << 4) & 0x30; | ||
| 88 | + if (inlen > 1) | ||
| 89 | + oval |= in[1] >> 4; | ||
| 90 | + *out++ = basis_64[oval]; | ||
| 91 | + *out++ = (inlen < 2) ? '=' : basis_64[(in[1] << 2) & 0x3c]; | ||
| 92 | + *out++ = '='; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + if (olen < outmax) | ||
| 96 | + *out = '\0'; | ||
| 97 | + | ||
| 98 | + return OK; | ||
| 99 | + | ||
| 100 | +} | ||
| 101 | + | ||
| 102 | int | ||
| 103 | main (int argc, char **argv) | ||
| 104 | { | ||
| 105 | @@ -104,6 +179,7 @@ | ||
| 106 | char buffer[MAX_INPUT_BUFFER] = ""; | ||
| 107 | char *from_str = NULL; | ||
| 108 | char *helocmd = NULL; | ||
| 109 | + char *error_msg = NULL; | ||
| 110 | struct timeval tv; | ||
| 111 | |||
| 112 | if (process_arguments (argc, argv) != OK) | ||
| 113 | @@ -163,7 +239,97 @@ | ||
| 114 | |||
| 115 | /* allow for response to helo command to reach us */ | ||
| 116 | recv(sd, buffer, MAX_INPUT_BUFFER-1, 0); | ||
| 117 | - | ||
| 118 | + | ||
| 119 | + if (authtype != NULL) { | ||
| 120 | + if (strcmp (authtype, "LOGIN") == 0) { | ||
| 121 | + char abuf[MAX_INPUT_BUFFER]; | ||
| 122 | + unsigned alen; | ||
| 123 | + int ret; | ||
| 124 | + do { | ||
| 125 | + if (authuser == NULL) { | ||
| 126 | + result = STATE_CRITICAL; | ||
| 127 | + error_msg = "no authuser specified"; | ||
| 128 | + break; | ||
| 129 | + } | ||
| 130 | + if (authpass == NULL) { | ||
| 131 | + result = STATE_CRITICAL; | ||
| 132 | + error_msg = "no authpass specified"; | ||
| 133 | + break; | ||
| 134 | + } | ||
| 135 | + send(sd, "AUTH LOGIN\r\n", strlen("AUTH LOGIN\r\n"), 0); | ||
| 136 | + if (verbose == TRUE) { | ||
| 137 | + printf ("sent AUTH LOGIN\n"); | ||
| 138 | + } | ||
| 139 | + if ((ret = recv(sd, buffer, MAX_INPUT_BUFFER-1, 0)) == -1) { | ||
| 140 | + result = STATE_CRITICAL; | ||
| 141 | + error_msg = "recv() failed after AUTH LOGIN"; | ||
| 142 | + break; | ||
| 143 | + } | ||
| 144 | + buffer[ret] = 0; | ||
| 145 | + if (verbose == TRUE) { | ||
| 146 | + printf ("received %s\n", buffer); | ||
| 147 | + } | ||
| 148 | + if (strncmp (buffer, "334", 3) != 0) { | ||
| 149 | + result = STATE_CRITICAL; | ||
| 150 | + error_msg = "invalid response received after AUTH LOGIN"; | ||
| 151 | + break; | ||
| 152 | + } | ||
| 153 | + if (encode64 (authuser, strlen(authuser), abuf, MAX_INPUT_BUFFER, &alen) != OK) { | ||
| 154 | + result = STATE_CRITICAL; | ||
| 155 | + error_msg = "failed to base64-encode authuser"; | ||
| 156 | + break; | ||
| 157 | + } | ||
| 158 | + strcat (abuf, "\r\n"); | ||
| 159 | + send(sd, abuf, strlen(abuf), 0); | ||
| 160 | + if (verbose == TRUE) { | ||
| 161 | + printf ("sent %s\n", abuf); | ||
| 162 | + } | ||
| 163 | + if ((ret = recv(sd, buffer, MAX_INPUT_BUFFER-1, 0)) == -1) { | ||
| 164 | + result = STATE_CRITICAL; | ||
| 165 | + error_msg = "recv() failed after sending authuser"; | ||
| 166 | + break; | ||
| 167 | + } | ||
| 168 | + buffer[ret] = 0; | ||
| 169 | + if (verbose == TRUE) { | ||
| 170 | + printf ("received %s\n", buffer); | ||
| 171 | + } | ||
| 172 | + if (strncmp (buffer, "334", 3) != 0) { | ||
| 173 | + result = STATE_CRITICAL; | ||
| 174 | + error_msg = "invalid response received after authuser"; | ||
| 175 | + break; | ||
| 176 | + } | ||
| 177 | + if (encode64 (authpass, strlen(authpass), abuf, MAX_INPUT_BUFFER, &alen) != OK) { | ||
| 178 | + result = STATE_CRITICAL; | ||
| 179 | + error_msg = "failed to base64-encode authpass"; | ||
| 180 | + break; | ||
| 181 | + } | ||
| 182 | + strcat (abuf, "\r\n"); | ||
| 183 | + send(sd, abuf, strlen(abuf), 0); | ||
| 184 | + if (verbose == TRUE) { | ||
| 185 | + printf ("sent %s\n", abuf); | ||
| 186 | + } | ||
| 187 | + if ((ret = recv(sd, buffer, MAX_INPUT_BUFFER-1, 0)) == -1) { | ||
| 188 | + result = STATE_CRITICAL; | ||
| 189 | + error_msg = "recv() failed after sending authpass"; | ||
| 190 | + break; | ||
| 191 | + } | ||
| 192 | + buffer[ret] = 0; | ||
| 193 | + if (verbose == TRUE) { | ||
| 194 | + printf ("received %s\n", buffer); | ||
| 195 | + } | ||
| 196 | + if (strncmp (buffer, "235", 3) != 0) { | ||
| 197 | + result = STATE_CRITICAL; | ||
| 198 | + error_msg = "invalid response received after authpass"; | ||
| 199 | + break; | ||
| 200 | + } | ||
| 201 | + break; | ||
| 202 | + } while (0); | ||
| 203 | + } else { | ||
| 204 | + result = STATE_CRITICAL; | ||
| 205 | + error_msg = "only authtype LOGIN is supported"; | ||
| 206 | + } | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | /* sendmail will syslog a "NOQUEUE" error if session does not attempt | ||
| 210 | * to do something useful. This can be prevented by giving a command | ||
| 211 | * even if syntax is illegal (MAIL requires a FROM:<...> argument) | ||
| 212 | @@ -204,11 +370,21 @@ | ||
| 213 | result = STATE_WARNING; | ||
| 214 | |||
| 215 | if (verbose) | ||
| 216 | - printf ("SMTP %s - %.3f sec. response time, %s|time=%.3f\n", | ||
| 217 | - state_text (result), elapsed_time, buffer, elapsed_time); | ||
| 218 | + if (error_msg == NULL) { | ||
| 219 | + printf ("SMTP %s - %.3f sec. response time, %s|time=%.3f\n", | ||
| 220 | + state_text (result), elapsed_time, buffer, elapsed_time); | ||
| 221 | + } else { | ||
| 222 | + printf ("SMTP %s - %s, %.3f sec. response time, %s|time=%.3f\n", | ||
| 223 | + state_text (result), error_msg, elapsed_time, buffer, elapsed_time); | ||
| 224 | + } | ||
| 225 | else | ||
| 226 | - printf ("SMTP %s - %.3f second response time|time=%.3f\n", | ||
| 227 | - state_text (result), elapsed_time, elapsed_time); | ||
| 228 | + if (error_msg == NULL) { | ||
| 229 | + printf ("SMTP %s - %.3f second response time|time=%.3f\n", | ||
| 230 | + state_text (result), elapsed_time, elapsed_time); | ||
| 231 | + } else { | ||
| 232 | + printf ("SMTP %s - %s, %.3f second response time|time=%.3f\n", | ||
| 233 | + state_text (result), error_msg, elapsed_time, elapsed_time); | ||
| 234 | + } | ||
| 235 | |||
| 236 | return result; | ||
| 237 | } | ||
| 238 | @@ -233,6 +409,9 @@ | ||
| 239 | {"timeout", required_argument, 0, 't'}, | ||
| 240 | {"port", required_argument, 0, 'p'}, | ||
| 241 | {"from", required_argument, 0, 'f'}, | ||
| 242 | + {"authtype", required_argument, 0, 'A'}, | ||
| 243 | + {"authuser", required_argument, 0, 'U'}, | ||
| 244 | + {"authpass", required_argument, 0, 'P'}, | ||
| 245 | {"command", required_argument, 0, 'C'}, | ||
| 246 | {"nocommand", required_argument, 0, 'n'}, | ||
| 247 | {"verbose", no_argument, 0, 'v'}, | ||
| 248 | @@ -256,7 +435,7 @@ | ||
| 249 | } | ||
| 250 | |||
| 251 | while (1) { | ||
| 252 | - c = getopt_long (argc, argv, "+hVv46t:p:f:e:c:w:H:C:", | ||
| 253 | + c = getopt_long (argc, argv, "+hVv46t:p:f:e:c:w:H:C:A:U:P:", | ||
| 254 | long_options, &option_index); | ||
| 255 | |||
| 256 | if (c == -1 || c == EOF) | ||
| 257 | @@ -282,6 +461,15 @@ | ||
| 258 | case 'f': /* from argument */ | ||
| 259 | from_arg = optarg; | ||
| 260 | break; | ||
| 261 | + case 'A': | ||
| 262 | + authtype = optarg; | ||
| 263 | + break; | ||
| 264 | + case 'U': | ||
| 265 | + authuser = optarg; | ||
| 266 | + break; | ||
| 267 | + case 'P': | ||
| 268 | + authpass = optarg; | ||
| 269 | + break; | ||
| 270 | case 'e': /* server expect string on 220 */ | ||
| 271 | server_expect = optarg; | ||
| 272 | break; | ||
diff --git a/web/attachments/57488-check_disk_smb.patch b/web/attachments/57488-check_disk_smb.patch new file mode 100644 index 0000000..7883520 --- /dev/null +++ b/web/attachments/57488-check_disk_smb.patch | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | --- ../check_disk_smb.pl 2003-07-02 10:57:29.000000000 -0500 | ||
| 2 | +++ check_disk_smb.pl 2003-07-31 20:06:13.000000000 -0500 | ||
| 3 | @@ -23,7 +23,7 @@ | ||
| 4 | use POSIX; | ||
| 5 | use strict; | ||
| 6 | use Getopt::Long; | ||
| 7 | -use vars qw($opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $verbose); | ||
| 8 | +use vars qw($opt_P $opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $verbose); | ||
| 9 | use vars qw($PROGNAME); | ||
| 10 | use lib utils.pm ; | ||
| 11 | use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); | ||
| 12 | @@ -40,6 +40,7 @@ | ||
| 13 | Getopt::Long::Configure('bundling'); | ||
| 14 | GetOptions | ||
| 15 | ("v" => \$verbose, "verbose" => \$verbose, | ||
| 16 | + "P=s" => \$opt_P, "Port=s" => \$opt_P, | ||
| 17 | "V" => \$opt_V, "version" => \$opt_V, | ||
| 18 | "h" => \$opt_h, "help" => \$opt_h, | ||
| 19 | "w=s" => \$opt_w, "warning=s" => \$opt_w, | ||
| 20 | @@ -58,7 +59,7 @@ | ||
| 21 | if ($opt_h) {print_help(); exit $ERRORS{'OK'};} | ||
| 22 | |||
| 23 | my $smbclient= "$utils::PATH_TO_SMBCLIENT " ; | ||
| 24 | -my $smbclientoptions=""; | ||
| 25 | +my $smbclientoptions = $opt_P ? " -p $opt_P " : " "; | ||
| 26 | |||
| 27 | |||
| 28 | # Options checking | ||
| 29 | @@ -230,7 +231,7 @@ | ||
| 30 | |||
| 31 | sub print_usage () { | ||
| 32 | print "Usage: $PROGNAME -H <host> -s <share> -u <user> -p <password> | ||
| 33 | - -w <warn> -c <crit> [-W <workgroup>]\n"; | ||
| 34 | + -w <warn> -c <crit> [-W <workgroup>] [-P <port>]\n"; | ||
| 35 | } | ||
| 36 | |||
| 37 | sub print_help () { | ||
| 38 | @@ -257,6 +258,8 @@ | ||
| 39 | |||
| 40 | -c, --critical=INTEGER or INTEGER[kMG] | ||
| 41 | Percent of used space at which a critical will be generated (Defaults: 95%) | ||
| 42 | +-P, --Port=Integer | ||
| 43 | + Port to be used to connect to. Some windows boxes use 139, others 445. (Default: none) | ||
| 44 | |||
| 45 | If thresholds are followed by either a k, M, or G then check to see if that | ||
| 46 | much disk space is available (kilobytes, Megabytes, Gigabytes) | ||
diff --git a/web/attachments/60404-check_nt.patch b/web/attachments/60404-check_nt.patch new file mode 100644 index 0000000..4e52b76 --- /dev/null +++ b/web/attachments/60404-check_nt.patch | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | --- check_nt.c Wed Apr 23 05:51:16 2003 | ||
| 2 | +++ /usr/src/nagios-plugins-1.3.1/plugins/check_nt.c Tue Sep 2 12:31:02 2003 | ||
| 3 | @@ -108,13 +108,23 @@ | ||
| 4 | alarm(socket_timeout); | ||
| 5 | |||
| 6 | if (vars_to_check==CHECK_CLIENTVERSION) { | ||
| 7 | - | ||
| 8 | + /* Amendment, we now optionally check the version and make critical if it's not the correct version */ | ||
| 9 | asprintf(&send_buffer,strcat(req_password,"&1")); | ||
| 10 | - result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 11 | - if(result!=STATE_OK) | ||
| 12 | - return result; | ||
| 13 | - asprintf(&output_message,recv_buffer); | ||
| 14 | - return_code=STATE_OK; | ||
| 15 | + return_code=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
| 16 | + if(return_code!=STATE_OK) | ||
| 17 | + return return_code; | ||
| 18 | + /* If they have supplied a parameter we need to check it */ | ||
| 19 | + if (check_value_list==TRUE) { | ||
| 20 | + if(strcmp(recv_buffer, value_list)!=0) | ||
| 21 | + { | ||
| 22 | + asprintf(&output_message,"Wrong client version: Running: %s Required: %s",recv_buffer,value_list); | ||
| 23 | + return_code=STATE_WARNING; | ||
| 24 | + } | ||
| 25 | + } | ||
| 26 | + if(return_code==STATE_OK) | ||
| 27 | + { | ||
| 28 | + asprintf(&output_message,recv_buffer); | ||
| 29 | + }; | ||
| 30 | } | ||
| 31 | else if(vars_to_check==CHECK_CPULOAD){ | ||
| 32 | |||
diff --git a/web/attachments/61644-check_apc_ups.pl.diff b/web/attachments/61644-check_apc_ups.pl.diff new file mode 100644 index 0000000..3ea9a1c --- /dev/null +++ b/web/attachments/61644-check_apc_ups.pl.diff | |||
| @@ -0,0 +1,141 @@ | |||
| 1 | 298a | ||
| 2 | # 802 END INS | ||
| 3 | # 802 BEG DEL | ||
| 4 | # $val = `/usr/bin/snmpget $host public $oid 2> /dev/null`; | ||
| 5 | # my @test = split(/ /,$val,3); | ||
| 6 | # | ||
| 7 | # return undef unless (defined ($test[2])); | ||
| 8 | # | ||
| 9 | # if ($test[2] =~ /\(\d+\)/) { # Later versions of UCD SNMP | ||
| 10 | # ($val) = ($test[2] =~ /\((\d+)\)/); | ||
| 11 | # } elsif ($test[2] =~ /: \d+/) { | ||
| 12 | # ($val) = ($test[2] =~ /: (\d+)/); | ||
| 13 | # } else { | ||
| 14 | # $val = $test[2]; | ||
| 15 | # } | ||
| 16 | # 802 END DEL | ||
| 17 | . | ||
| 18 | 297c | ||
| 19 | $val = undef; | ||
| 20 | . | ||
| 21 | 286,295c | ||
| 22 | # 802 BEGIN INS | ||
| 23 | my $community="public"; | ||
| 24 | my $port="161"; | ||
| 25 | my ($session, $error) = Net::SNMP->session( | ||
| 26 | -hostname => $host, | ||
| 27 | -community => $community, | ||
| 28 | -timeout => 2, | ||
| 29 | -port => $port, | ||
| 30 | -translate => undef | ||
| 31 | ); | ||
| 32 | if (defined($session)) { | ||
| 33 | my $response=$session->get_request($oid); | ||
| 34 | if (defined($response)) { | ||
| 35 | $val=$response->{$oid}; | ||
| 36 | } else { | ||
| 37 | $val = undef; | ||
| 38 | } | ||
| 39 | $session->close; | ||
| 40 | . | ||
| 41 | 277c | ||
| 42 | Output load pct above which a WARNING status will result (default: 50) | ||
| 43 | . | ||
| 44 | 275c | ||
| 45 | Output load pct above which a CRITICAL status will result (default: 85) | ||
| 46 | . | ||
| 47 | 242c | ||
| 48 | print "unknown\]\n"; | ||
| 49 | . | ||
| 50 | 239c | ||
| 51 | print "$diagnosticsResultsVals[$data][0]\]\n"; | ||
| 52 | . | ||
| 53 | 237c | ||
| 54 | print "\[Diag result: "; | ||
| 55 | . | ||
| 56 | 232c | ||
| 57 | print "unknown\]"; | ||
| 58 | . | ||
| 59 | 223c | ||
| 60 | print "$data\]"; | ||
| 61 | . | ||
| 62 | 221c | ||
| 63 | print "\[Output load (%): "; | ||
| 64 | . | ||
| 65 | 216c | ||
| 66 | print "unknown\]"; | ||
| 67 | . | ||
| 68 | 213c | ||
| 69 | print "$battReplVals[$data][0]\]"; | ||
| 70 | . | ||
| 71 | 211c | ||
| 72 | print "\[Battery repl: "; | ||
| 73 | . | ||
| 74 | 206c | ||
| 75 | print "unknown\] "; | ||
| 76 | . | ||
| 77 | 197c | ||
| 78 | print "$data\]"; | ||
| 79 | . | ||
| 80 | 195c | ||
| 81 | print "\[Battery temp(C): "; | ||
| 82 | . | ||
| 83 | 190c | ||
| 84 | print "unknown\]"; | ||
| 85 | . | ||
| 86 | 186c | ||
| 87 | print "$battStatVals[$data][0]\]"; | ||
| 88 | . | ||
| 89 | 184c | ||
| 90 | print "$battStatVals[$data][0] ($failcause)\]"; | ||
| 91 | . | ||
| 92 | 178c | ||
| 93 | print "\[Battery status: "; | ||
| 94 | . | ||
| 95 | 173c | ||
| 96 | print "unknown\]"; | ||
| 97 | . | ||
| 98 | 164c | ||
| 99 | printf "%d:%02d:%05.2f\]", $hrs, $mins, $secs; | ||
| 100 | . | ||
| 101 | 159c | ||
| 102 | print "\[Rem time: "; | ||
| 103 | . | ||
| 104 | 154c | ||
| 105 | print "unknown\]"; | ||
| 106 | . | ||
| 107 | 151c | ||
| 108 | print "$outputStatVals[$data][0]\]"; | ||
| 109 | . | ||
| 110 | 149c | ||
| 111 | print "\[Output status: "; | ||
| 112 | . | ||
| 113 | 143c | ||
| 114 | my $exitval = $ERRORS{'OK'}; | ||
| 115 | . | ||
| 116 | 27a | ||
| 117 | # 801 ADD ONE | ||
| 118 | { $^W=0; ($PROGNAME=$0) =~ s!^.*/!!; } | ||
| 119 | |||
| 120 | . | ||
| 121 | 14,16c | ||
| 122 | # 802 ADD ONE | ||
| 123 | use Net::SNMP; | ||
| 124 | use vars qw($opt_V $opt_h $opt_H $opt_T $opt_t $opt_R | ||
| 125 | $opt_r $opt_L $opt_l $PROGNAME); | ||
| 126 | #use lib utils.pm; | ||
| 127 | # 801 CHANGE ONE | ||
| 128 | use lib '/usr/local/nagios/libexec'; | ||
| 129 | . | ||
| 130 | 11c | ||
| 131 | # | ||
| 132 | # DMH Custom | ||
| 133 | # 801 07-07-2003 Fix use lib statement | ||
| 134 | # Fix PROGNAME Assignment | ||
| 135 | # 802 07-07-2003 Use Net::SNMP to get the info instead of calling | ||
| 136 | # an external program. | ||
| 137 | # 803 09-11-2003 Replaced the output delimiter | with [] as | ||
| 138 | # Nagios was truncating the output and only | ||
| 139 | # displaying the first check's data. | ||
| 140 | # | ||
| 141 | . | ||
diff --git a/web/attachments/62197-check_rrd.pl b/web/attachments/62197-check_rrd.pl new file mode 100644 index 0000000..578277c --- /dev/null +++ b/web/attachments/62197-check_rrd.pl | |||
| @@ -0,0 +1,157 @@ | |||
| 1 | #!/usr/bin/perl -w | ||
| 2 | #-wT | ||
| 3 | # | ||
| 4 | # check_rrd plugin for nagios (or rather check_rrd but using the current rrd rather than cricket libraries) | ||
| 5 | # | ||
| 6 | # usage: | ||
| 7 | # check_rrd rrdfile perlexp_warn perlexp_crit perlexp_default [ds] | ||
| 8 | # | ||
| 9 | # Checks data from an RRD file. | ||
| 10 | # | ||
| 11 | # Based off the check_rrd_data.pl and the example code in the rrdtool dist. | ||
| 12 | # | ||
| 13 | # The Perl expressions are expressions to be evaluated in the following cases: | ||
| 14 | # | ||
| 15 | # - perlexp_crit. The first one, to check if there is a critical situation. If | ||
| 16 | # it returns other than "", it will be a critical message. | ||
| 17 | # - perlexp_warn. The second one to be evaluated. If returns other than "", a | ||
| 18 | # warning will be issued to Nagios. | ||
| 19 | # - perlexp_default. If both of the above return "", it will be evaluated, and | ||
| 20 | # wathever returns this expression will be returned by the script. NOTE that | ||
| 21 | # this is different from the other two cases, to allow the user issue a | ||
| 22 | # warning or critical failure even if the other two don't return it. | ||
| 23 | # | ||
| 24 | # initial version: 28 Nov 2000 by Esteban Manchado Velzquez | ||
| 25 | # current status: 1.0 | ||
| 26 | # | ||
| 27 | # History | ||
| 28 | # 19-Sep-2003 1.0 steveh@brendata.co.uk | ||
| 29 | # Amended to utilise the RRDs supplied with rrdtool rather than the cricket code | ||
| 30 | # | ||
| 31 | # Required RRDs from rrdtool distribution be installed (install perl shared when building rrdtool). | ||
| 32 | # | ||
| 33 | # Copyright Notice: GPL | ||
| 34 | # | ||
| 35 | |||
| 36 | use strict; | ||
| 37 | use lib '/usr/local/nagios/libexec/' ; | ||
| 38 | use utils qw(%ERRORS &print_revision); | ||
| 39 | use RRDs; | ||
| 40 | use Getopt::Long; | ||
| 41 | &Getopt::Long::config('auto_abbrev'); | ||
| 42 | |||
| 43 | my $PROGNAME="check_rrd.pl"; | ||
| 44 | |||
| 45 | sub usage { | ||
| 46 | print_revision($PROGNAME,'$Revision: 1.0 $ '); | ||
| 47 | print "Nagios Plugin - Check rrd datafile\n"; | ||
| 48 | print "=" x 75,"\nERROR: Missing or wrong arguments!\n","=" x 75,"\n"; | ||
| 49 | print "check_rrd.pl --file=<file.rrd> --warning=<perl_exp_warn> --critical=<perl_exp_crit> --default=<perl_exp_default> [--dataset=<ds>] [--cf=<cf>] [--expire=<minutes>]\n\n"; | ||
| 50 | print "<perl_exp_*> is an expression that gets evaluated with \$_ at the current\n"; | ||
| 51 | print "value of the data source. If it returns something other than \"\", there\n"; | ||
| 52 | print "will be a warning or a critical failure. Else, the expression\n"; | ||
| 53 | print "<perl_exp_default> will be evaluated\n"; | ||
| 54 | print "<ds> is the number of the dataset that you wish to use\n"; | ||
| 55 | print "<cf> is one of MIN, MAX, AVERAGE or LAST\n"; | ||
| 56 | print "<minutes> the maximum time since last rrd update, otherwise WARNING. (5 mins assumed if not specified)\n"; | ||
| 57 | exit $ERRORS{'UNKNOWN'}; # Unknown | ||
| 58 | } | ||
| 59 | |||
| 60 | my $rrdfile; # RRD file to open | ||
| 61 | my $cf; #Function to apply | ||
| 62 | my $ds; # Dataset to use | ||
| 63 | my @data; # Special data reserved for the expressions, to pass data | ||
| 64 | # Perl expressions to evaluate | ||
| 65 | my $perl_exp_warn; | ||
| 66 | my $perl_exp_crit; | ||
| 67 | my $perl_exp_default; | ||
| 68 | my $expire; | ||
| 69 | my $debug; | ||
| 70 | |||
| 71 | # Evaluate Command Line Parameters | ||
| 72 | my $status = GetOptions( | ||
| 73 | "file=s",\$rrdfile, | ||
| 74 | "critical=s",\$perl_exp_crit, | ||
| 75 | "warning=s",\$perl_exp_warn, | ||
| 76 | "default=s",\$perl_exp_default, | ||
| 77 | "dataset=i",\$ds, | ||
| 78 | "expire=i",\$expire, | ||
| 79 | "cf=s",\$cf, | ||
| 80 | "debug",\$debug | ||
| 81 | ); | ||
| 82 | |||
| 83 | $ds =~ s/\$$//g if ($ds); # Sometimes Nagios gives 1$ as the last parameter | ||
| 84 | $cf =~ s/\$$//g if($cf); # Sometimes Nagios gives 1$ as the last parameter | ||
| 85 | $rrdfile =~ s/\$$//g if($rrdfile); # Sometimes Nagios gives 1$ as the last parameter | ||
| 86 | |||
| 87 | $perl_exp_crit =~ s/\$$//g if($perl_exp_crit); # Sometimes Nagios gives 1$ as the last parameter | ||
| 88 | $perl_exp_warn =~ s/\$$//g if($perl_exp_warn); # Sometimes Nagios gives 1$ as the last parameter | ||
| 89 | $perl_exp_default =~ s/\$$//g if($perl_exp_default); # Sometimes Nagios gives 1$ as the last parameter | ||
| 90 | |||
| 91 | usage() if ($status == 0 || ! ($rrdfile && $perl_exp_warn && $perl_exp_crit)); # && $perl_exp_default)); | ||
| 92 | |||
| 93 | |||
| 94 | print $perl_exp_crit,"\n" if($debug); | ||
| 95 | print $perl_exp_warn,"\n" if($debug); | ||
| 96 | print $perl_exp_default,"\n" if($debug); | ||
| 97 | # Defaults | ||
| 98 | $ds=0 if(!($ds)); | ||
| 99 | $cf="MAX" if(!($cf)); | ||
| 100 | $expire=5*60 if(!($expire)); | ||
| 101 | |||
| 102 | if (! $rrdfile) { | ||
| 103 | print "Can't open data file for $rrdfile\n"; # Aaaargh! | ||
| 104 | return $ERRORS{'UNKNOWN'}; # Unknown | ||
| 105 | } | ||
| 106 | |||
| 107 | if($expire!=0) | ||
| 108 | { | ||
| 109 | my ($last) = RRDs::last($rrdfile); | ||
| 110 | printf("Now: %d Last: %d\n",time(),$last) if ($debug); | ||
| 111 | my $now=time(); | ||
| 112 | if($now - $last > $expire*60) | ||
| 113 | { | ||
| 114 | printf("RRD data has not been updated within expiry interval. %d minutes since last update\n",($now-$last)/60); | ||
| 115 | exit $ERRORS{'WARNING'}; | ||
| 116 | } | ||
| 117 | |||
| 118 | } | ||
| 119 | my ($start,$step,$names,$data) = RRDs::fetch ($rrdfile,$cf); | ||
| 120 | my $ERR=RRDs::error; | ||
| 121 | if($ERR) { | ||
| 122 | print "ERROR while fetching $rrdfile: $ERR\n"; # Ooops..... | ||
| 123 | exit $ERRORS{'UNKNOWN'}; # Unknown | ||
| 124 | } | ||
| 125 | |||
| 126 | my $line = @$data[$#data -1]; | ||
| 127 | my $value = @$line[$ds]; | ||
| 128 | |||
| 129 | my $result; # Result of the expressions (will be printed) | ||
| 130 | |||
| 131 | # First check for critical errors | ||
| 132 | $perl_exp_crit =~ /(.*)/; | ||
| 133 | $perl_exp_crit = $1; | ||
| 134 | print $perl_exp_crit,"\n" if($debug); | ||
| 135 | $result = eval $perl_exp_crit; | ||
| 136 | if ($result) { | ||
| 137 | print $result; | ||
| 138 | print $perl_exp_crit,"\n" if($debug); | ||
| 139 | exit 2; # Critical | ||
| 140 | } | ||
| 141 | |||
| 142 | # Check for warnings | ||
| 143 | $perl_exp_warn =~ /(.*)/; | ||
| 144 | $perl_exp_warn = $1; | ||
| 145 | print $perl_exp_warn,"\n" if($debug); | ||
| 146 | $result = eval $perl_exp_warn; | ||
| 147 | if ($result) { | ||
| 148 | print $result; | ||
| 149 | print $perl_exp_warn,"\n" if($debug); | ||
| 150 | exit 1; # Warning | ||
| 151 | } | ||
| 152 | |||
| 153 | $perl_exp_default =~ /(.*)/; | ||
| 154 | $perl_exp_default = $1; | ||
| 155 | print $perl_exp_default,"\n" if($debug); | ||
| 156 | eval $perl_exp_default; # Normally returns 0 (OK) | ||
| 157 | |||
diff --git a/web/attachments/63089-check_ups.c_diff.gz b/web/attachments/63089-check_ups.c_diff.gz new file mode 100644 index 0000000..699ac60 --- /dev/null +++ b/web/attachments/63089-check_ups.c_diff.gz | |||
| Binary files differ | |||
diff --git a/web/attachments/63596-nagplug-bug.tgz b/web/attachments/63596-nagplug-bug.tgz new file mode 100644 index 0000000..481f784 --- /dev/null +++ b/web/attachments/63596-nagplug-bug.tgz | |||
| Binary files differ | |||
diff --git a/web/attachments/63638-check_ntp.patchfile b/web/attachments/63638-check_ntp.patchfile new file mode 100644 index 0000000..619b43c --- /dev/null +++ b/web/attachments/63638-check_ntp.patchfile | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | *** check_ntp.orig 2003-08-15 08:59:00.000000000 -0400 | ||
| 2 | --- check_ntp 2003-10-06 21:21:20.000000000 -0400 | ||
| 3 | ## fixes error parsing ntpq output if 'poll' includes an "m", and | ||
| 4 | ## corrected spelling of "CAndidate" | ||
| 5 | *************** | ||
| 6 | *** 258,268 **** | ||
| 7 | # number of candidates on <host> for sys.peer | ||
| 8 | if (/^(\*|\+|\#|o])/) { | ||
| 9 | ++$candidates; | ||
| 10 | ! print "Candiate count= $candidates\n" if ($verbose); | ||
| 11 | } | ||
| 12 | |||
| 13 | # match sys.peer or pps.peer | ||
| 14 | ! if (/^(\*|o)([-0-9.\s]+)\s+([-0-9A-Za-z.]+)\s+([-0-9.]+)\s+([lumb]+)\s+([-0-9m.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/) { | ||
| 15 | $syspeer = $2; | ||
| 16 | $stratum = $4; | ||
| 17 | $jitter = $11; | ||
| 18 | --- 258,268 ---- | ||
| 19 | # number of candidates on <host> for sys.peer | ||
| 20 | if (/^(\*|\+|\#|o])/) { | ||
| 21 | ++$candidates; | ||
| 22 | ! print "Candidate count= $candidates\n" if ($verbose); | ||
| 23 | } | ||
| 24 | |||
| 25 | # match sys.peer or pps.peer | ||
| 26 | ! if (/^(\*|o)([-0-9.\s]+)\s+([-0-9A-Za-z.]+)\s+([-0-9.]+)\s+([lumb]+)\s+([-0-9m.]+)\s+([-0-9m.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/) { | ||
| 27 | $syspeer = $2; | ||
| 28 | $stratum = $4; | ||
| 29 | $jitter = $11; | ||
diff --git a/web/attachments/63906-check_linux_raid.patch b/web/attachments/63906-check_linux_raid.patch new file mode 100644 index 0000000..81fa040 --- /dev/null +++ b/web/attachments/63906-check_linux_raid.patch | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | Index: check_linux_raid.pl | ||
| 2 | =================================================================== | ||
| 3 | --- check_linux_raid.pl (revision 145) | ||
| 4 | +++ check_linux_raid.pl (working copy) | ||
| 5 | @@ -26,6 +26,12 @@ | ||
| 6 | |||
| 7 | my %ERRORS=('DEPENDENT'=>4,'UNKNOWN'=>3,'OK'=>0,'WARNING'=>1,'CRITICAL'=>2); | ||
| 8 | |||
| 9 | +# die with an error if we're not on Linux | ||
| 10 | +if ($^O ne 'linux') { | ||
| 11 | + print "This plugin only applicable on Linux.\n"; | ||
| 12 | + exit $ERRORS{'UNKNOWN'}; | ||
| 13 | +} | ||
| 14 | + | ||
| 15 | open (MDSTAT, "</proc/mdstat") or die "Failed to open /proc/mdstat"; | ||
| 16 | my $found = 0; | ||
| 17 | my $status = ""; | ||
| 18 | @@ -41,7 +47,7 @@ | ||
| 19 | ($finish) = /finish=(.*?min)/; | ||
| 20 | } | ||
| 21 | } else { | ||
| 22 | - if (/$ARGV[0]/) { | ||
| 23 | + if (/^$ARGV[0]\s*:/) { | ||
| 24 | $found = 1; | ||
| 25 | if (/active/) { | ||
| 26 | $active = 1; | ||
diff --git a/web/attachments/66045-check_ping.c.diff b/web/attachments/66045-check_ping.c.diff new file mode 100644 index 0000000..2fc372f --- /dev/null +++ b/web/attachments/66045-check_ping.c.diff | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | 395,398d394 | ||
| 2 | < (input_buffer, "%*d packets transmitted %*d received, +%*d errors, %d%% packet loss", | ||
| 3 | < &pl) == 1 | ||
| 4 | < /* RedHat 9 as reported by Luiz Felipe E */ | ||
| 5 | < || sscanf | ||
diff --git a/web/attachments/66456-nagios-plugins-1.3.1-check-apc-ups.patch b/web/attachments/66456-nagios-plugins-1.3.1-check-apc-ups.patch new file mode 100644 index 0000000..ec5f72b --- /dev/null +++ b/web/attachments/66456-nagios-plugins-1.3.1-check-apc-ups.patch | |||
| @@ -0,0 +1,220 @@ | |||
| 1 | diff -ruN nagios-plugins-1.3.1/contrib/check_apc_ups.pl nagios-plugins-1.3.1-new/contrib/check_apc_ups.pl | ||
| 2 | --- nagios-plugins-1.3.1/contrib/check_apc_ups.pl 2002-08-14 20:02:31.000000000 +0100 | ||
| 3 | +++ nagios-plugins-1.3.1-new/contrib/check_apc_ups.pl 2003-07-14 18:39:57.000000000 +0100 | ||
| 4 | @@ -9,11 +9,19 @@ | ||
| 5 | # remaining: hh:mm:ss" if all is well, and a list of specific problems | ||
| 6 | # if something is broken. | ||
| 7 | |||
| 8 | +BEGIN { | ||
| 9 | + if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) { | ||
| 10 | + $runtimedir = $1; | ||
| 11 | + $PROGNAME = $2; | ||
| 12 | + } | ||
| 13 | +} | ||
| 14 | + | ||
| 15 | +require 5.004; | ||
| 16 | +use POSIX; | ||
| 17 | use strict; | ||
| 18 | use Getopt::Long; | ||
| 19 | -use vars qw($opt_V $opt_h $opt_H $opt_T $opt_t $opt_R $opt_r | ||
| 20 | - $opt_L $opt_l $PROGNAME); | ||
| 21 | -use lib utils.pm; | ||
| 22 | +use vars qw($opt_V $opt_h $opt_H $opt_T $opt_t $opt_R $opt_r $opt_L $opt_l $community $PROGNAME); | ||
| 23 | +use lib $main::runtimedir; | ||
| 24 | use utils qw(%ERRORS &print_revision &support &usage); | ||
| 25 | |||
| 26 | sub print_help (); | ||
| 27 | @@ -24,18 +32,24 @@ | ||
| 28 | $ENV{'PATH'}=''; | ||
| 29 | $ENV{'BASH_ENV'}=''; | ||
| 30 | $ENV{'ENV'}=''; | ||
| 31 | +$ENV{'CDPATH'}=''; | ||
| 32 | |||
| 33 | -Getopt::Long::Configure('bundling'); | ||
| 34 | +my $verbose = 0; | ||
| 35 | +$community="public"; | ||
| 36 | + | ||
| 37 | +Getopt::Long::Configure('no_ignore_case'); | ||
| 38 | GetOptions | ||
| 39 | - ("V" => \$opt_V, "version" => \$opt_V, | ||
| 40 | - "h" => \$opt_h, "help" => \$opt_h, | ||
| 41 | - "T=s" => \$opt_T, "temp-critical" => \$opt_T, | ||
| 42 | - "t=s" => \$opt_t, "temp-warning" => \$opt_t, | ||
| 43 | - "R=s" => \$opt_R, "runtime-critical" => \$opt_R, | ||
| 44 | - "r=s" => \$opt_r, "runtime-warning" => \$opt_r, | ||
| 45 | - "L=s" => \$opt_L, "load-critical" => \$opt_L, | ||
| 46 | - "l=s" => \$opt_l, "load-warning" => \$opt_l, | ||
| 47 | - "H=s" => \$opt_H, "hostname=s" => \$opt_H); | ||
| 48 | + ("V|version" => \$opt_V, | ||
| 49 | + "h|help" => \$opt_h, | ||
| 50 | + "T|temp-critical:i" => \$opt_T, | ||
| 51 | + "t|temp-warning:i" => \$opt_t, | ||
| 52 | + "R|runtime-critical:i" => \$opt_R, | ||
| 53 | + "r|runtime-warning:i" => \$opt_r, | ||
| 54 | + "L|load-critical:i" => \$opt_L, | ||
| 55 | + "l|load-warning:i" => \$opt_l, | ||
| 56 | + "H|hostname=s" => \$opt_H, | ||
| 57 | + "C|community=s" => \$community, | ||
| 58 | + "v|verbose:+" => \$verbose); | ||
| 59 | |||
| 60 | if ($opt_V) { | ||
| 61 | print_revision($PROGNAME,'$Revision: 1.2 $'); | ||
| 62 | @@ -51,7 +65,7 @@ | ||
| 63 | # Defaults | ||
| 64 | |||
| 65 | $opt_R *= 60 * 100 if (defined $opt_R); # Convert minutes to secs/100 | ||
| 66 | -$opt_r *= 60 * 100 if (defined $opt_R); | ||
| 67 | +$opt_r *= 60 * 100 if (defined $opt_r); | ||
| 68 | |||
| 69 | my $tempcrit = $opt_T || 60; | ||
| 70 | my $tempwarn = $opt_t || 40; | ||
| 71 | @@ -140,7 +154,8 @@ | ||
| 72 | [ "testInProgress", $ERRORS{'OK'} ], # 4 | ||
| 73 | ); | ||
| 74 | |||
| 75 | -my $exitval = $ERRORS{'UNKNOWN'}; | ||
| 76 | +my $sep = ", "; | ||
| 77 | +my $exitval = $ERRORS{'OK'}; | ||
| 78 | my $data; | ||
| 79 | my $onbattery = 3; | ||
| 80 | |||
| 81 | @@ -148,10 +163,10 @@ | ||
| 82 | |||
| 83 | print "Output status: "; | ||
| 84 | if (defined ($data) && defined ($outputStatVals[$data][0])) { | ||
| 85 | - print "$outputStatVals[$data][0] | "; | ||
| 86 | + print "$outputStatVals[$data][0]$sep"; | ||
| 87 | escalate_exitval($outputStatVals[$data][1]); | ||
| 88 | } else { | ||
| 89 | - print "unknown | "; | ||
| 90 | + print "unknown$sep"; | ||
| 91 | } | ||
| 92 | |||
| 93 | $data = get_snmp_int_val( $upsAdvBatteryRunTimeRemaining ); | ||
| 94 | @@ -161,7 +176,7 @@ | ||
| 95 | my $hrs = int($data / (60 * 60 * 100)); # Data is hundredths of a second | ||
| 96 | my $mins = int($data / (60 * 100)) % 60; | ||
| 97 | my $secs = ($data % 100) / 100; | ||
| 98 | - printf "%d:%02d:%05.2f | ", $hrs, $mins, $secs; | ||
| 99 | + printf "%d:%02d:%05.2f$sep", $hrs, $mins, $secs; | ||
| 100 | if ($data <= $runtimecrit) { | ||
| 101 | escalate_exitval($ERRORS{'CRITICAL'}); | ||
| 102 | } elsif ($data <= $runtimewarn) { | ||
| 103 | @@ -170,7 +185,7 @@ | ||
| 104 | escalate_exitval($ERRORS{'OK'}); | ||
| 105 | } | ||
| 106 | } else { | ||
| 107 | - print "unknown | "; | ||
| 108 | + print "unknown$sep"; | ||
| 109 | } | ||
| 110 | |||
| 111 | $data = get_snmp_int_val( $upsBasicBatteryStatus ); | ||
| 112 | @@ -181,20 +196,20 @@ | ||
| 113 | my $fc = get_snmp_int_val( $upsAdvInputLineFailCause ); | ||
| 114 | if ($data == $onbattery) { | ||
| 115 | if (defined ($failCauseVals[$fc])) { $failcause = $failCauseVals[$fc]; } | ||
| 116 | - print "$battStatVals[$data][0] ($failcause) | "; | ||
| 117 | + print "$battStatVals[$data][0] ($failcause)$sep"; | ||
| 118 | } else { | ||
| 119 | - print "$battStatVals[$data][0] | "; | ||
| 120 | + print "$battStatVals[$data][0]$sep"; | ||
| 121 | } | ||
| 122 | escalate_exitval($battStatVals[$data][1]); | ||
| 123 | } else { | ||
| 124 | - print "unknown | "; | ||
| 125 | + print "unknown$sep"; | ||
| 126 | } | ||
| 127 | |||
| 128 | $data = get_snmp_int_val( $upsAdvBatteryTemperature ); | ||
| 129 | |||
| 130 | print "Battery temp(C): "; | ||
| 131 | if (defined ($data)) { | ||
| 132 | - print "$data | "; | ||
| 133 | + print "$data$sep"; | ||
| 134 | if ($data >= $tempcrit) { | ||
| 135 | escalate_exitval($ERRORS{'CRITICAL'}); | ||
| 136 | } elsif ($data >= $tempwarn) { | ||
| 137 | @@ -203,24 +218,24 @@ | ||
| 138 | escalate_exitval($ERRORS{'OK'}); | ||
| 139 | } | ||
| 140 | } else { | ||
| 141 | - print "unknown | "; | ||
| 142 | + print "unknown$sep"; | ||
| 143 | } | ||
| 144 | |||
| 145 | $data = get_snmp_int_val( $upsAdvBatteryReplaceIndicator ); | ||
| 146 | |||
| 147 | print "Battery repl: "; | ||
| 148 | if (defined ($data) && defined ($battReplVals[$data][0])) { | ||
| 149 | - print "$battReplVals[$data][0] | "; | ||
| 150 | + print "$battReplVals[$data][0]$sep"; | ||
| 151 | escalate_exitval($battReplVals[$data][1]); | ||
| 152 | } else { | ||
| 153 | - print "unknown | "; | ||
| 154 | + print "unknown$sep"; | ||
| 155 | } | ||
| 156 | |||
| 157 | $data = get_snmp_int_val( $upsAdvOutputLoad ); | ||
| 158 | |||
| 159 | print "Output load (%): "; | ||
| 160 | if (defined ($data)) { | ||
| 161 | - print "$data | "; | ||
| 162 | + print "$data$sep"; | ||
| 163 | if ($data >= $loadcrit) { | ||
| 164 | escalate_exitval($ERRORS{'CRITICAL'}); | ||
| 165 | } elsif ($data >= $loadwarn) { | ||
| 166 | @@ -229,19 +244,25 @@ | ||
| 167 | escalate_exitval($ERRORS{'OK'}); | ||
| 168 | } | ||
| 169 | } else { | ||
| 170 | - print "unknown | "; | ||
| 171 | + print "unknown$sep"; | ||
| 172 | } | ||
| 173 | |||
| 174 | $data = get_snmp_int_val( $upsAdvTestDiagnosticsResults ); | ||
| 175 | |||
| 176 | print "Diag result: "; | ||
| 177 | if (defined ($data) && defined ($diagnosticsResultsVals[$data][0])) { | ||
| 178 | - print "$diagnosticsResultsVals[$data][0]\n"; | ||
| 179 | + print "$diagnosticsResultsVals[$data][0]$sep"; | ||
| 180 | escalate_exitval($diagnosticsResultsVals[$data][1]); | ||
| 181 | } else { | ||
| 182 | - print "unknown\n"; | ||
| 183 | + print "unknown$sep"; | ||
| 184 | } | ||
| 185 | |||
| 186 | +foreach my $key (keys %ERRORS) { | ||
| 187 | + if ($ERRORS{$key} == $exitval) { | ||
| 188 | + print "Status $key\n"; | ||
| 189 | + last; | ||
| 190 | + } | ||
| 191 | +} | ||
| 192 | |||
| 193 | exit $exitval; | ||
| 194 | |||
| 195 | @@ -263,6 +284,8 @@ | ||
| 196 | print " | ||
| 197 | -H, --hostname=HOST | ||
| 198 | Name or IP address of host to check | ||
| 199 | +-C, --community=string | ||
| 200 | + Community string to use to query UPS (default: public) | ||
| 201 | -T --temp-critical | ||
| 202 | Battery degrees C above which a CRITICAL status will result (default: 60) | ||
| 203 | -t --temp-warning | ||
| 204 | @@ -284,7 +307,7 @@ | ||
| 205 | my $val=0; | ||
| 206 | my $oid = shift(@_); | ||
| 207 | |||
| 208 | - $val = `/usr/bin/snmpget $host public $oid 2> /dev/null`; | ||
| 209 | + $val = `/usr/bin/snmpget -v 1 -c $community $host $oid 2> /dev/null`; | ||
| 210 | my @test = split(/ /,$val,3); | ||
| 211 | |||
| 212 | return undef unless (defined ($test[2])); | ||
| 213 | @@ -297,6 +320,7 @@ | ||
| 214 | $val = $test[2]; | ||
| 215 | } | ||
| 216 | |||
| 217 | + chomp($val); | ||
| 218 | return $val; | ||
| 219 | } | ||
| 220 | |||
diff --git a/web/attachments/66458-nagios-plugins-1.3.1-check-breeze.patch b/web/attachments/66458-nagios-plugins-1.3.1-check-breeze.patch new file mode 100644 index 0000000..49d7beb --- /dev/null +++ b/web/attachments/66458-nagios-plugins-1.3.1-check-breeze.patch | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | diff -ruN nagios-plugins-1.3.1/plugins-scripts/check_breeze.pl nagios-plugins-1.3.1-new/plugins-scripts/check_breeze.pl | ||
| 2 | --- nagios-plugins-1.3.1/plugins-scripts/check_breeze.pl 2002-10-28 13:05:06.000000000 +0000 | ||
| 3 | +++ nagios-plugins-1.3.1-new/plugins-scripts/check_breeze.pl 2003-07-14 18:39:57.000000000 +0100 | ||
| 4 | @@ -47,7 +47,7 @@ | ||
| 5 | ($opt_C) || ($opt_C = "public") ; | ||
| 6 | |||
| 7 | my $sig=0; | ||
| 8 | -$sig = `/usr/bin/snmpget $host $opt_C .1.3.6.1.4.1.710.3.2.3.1.3.0`; | ||
| 9 | +$sig = `/usr/bin/snmpget -v 1 -OQ -c $opt_C $host .1.3.6.1.4.1.710.3.2.3.1.3.0`; | ||
| 10 | my @test=split(/ /,$sig); | ||
| 11 | $sig=$test[2]; | ||
| 12 | $sig=int($sig); | ||
diff --git a/web/attachments/66459-nagios-plugins-1.3.1-check-dns.patch b/web/attachments/66459-nagios-plugins-1.3.1-check-dns.patch new file mode 100644 index 0000000..0f3d631 --- /dev/null +++ b/web/attachments/66459-nagios-plugins-1.3.1-check-dns.patch | |||
| @@ -0,0 +1,646 @@ | |||
| 1 | diff -ruN nagios-plugins-1.3.1/plugins/check_dns.c nagios-plugins-1.3.1-new/plugins/check_dns.c | ||
| 2 | --- nagios-plugins-1.3.1/plugins/check_dns.c 2003-05-31 15:39:33.000000000 +0100 | ||
| 3 | +++ nagios-plugins-1.3.1-new/plugins/check_dns.c 2003-07-14 19:59:16.000000000 +0100 | ||
| 4 | @@ -11,6 +11,7 @@ | ||
| 5 | * Notes: | ||
| 6 | * - Safe popen added by Karl DeBisschop 9-11-99 | ||
| 7 | * - expected-address parameter added by Alex Chaffee - 7 Oct 2002 | ||
| 8 | + * - extended to use RESOLVER, HOST or NSLOOKUP by Howard Wilkinson - 24 March 2003 | ||
| 9 | * | ||
| 10 | * Command line: (see print_usage) | ||
| 11 | * | ||
| 12 | @@ -46,6 +47,28 @@ | ||
| 13 | |||
| 14 | #include "common.h" | ||
| 15 | #include "popen.h" | ||
| 16 | + | ||
| 17 | +#ifdef USE_NSLOOKUP | ||
| 18 | +# if !defined(NSLOOKUP_COMMAND) | ||
| 19 | +# error "Need NSLOOKUP to use this option" | ||
| 20 | +# endif | ||
| 21 | +#endif | ||
| 22 | +#ifdef USE_HOST | ||
| 23 | +# if !defined(HOST_COMMAND) | ||
| 24 | +# error "Need HOST to use this option" | ||
| 25 | +# endif | ||
| 26 | +#endif | ||
| 27 | +#if defined(USE_NSLOOKUP) | ||
| 28 | +# undef USE_HOST | ||
| 29 | +# undef USE_RESOLVER | ||
| 30 | +#elif defined(USE_HOST) | ||
| 31 | +# undef USE_RESOLVER | ||
| 32 | +#elif !defined(USE_RESOLVER) | ||
| 33 | +# define USE_NSLOOKUP | ||
| 34 | +#endif | ||
| 35 | +#ifdef USE_RESOLVER | ||
| 36 | +#include "netutils.h" | ||
| 37 | +#endif | ||
| 38 | #include "utils.h" | ||
| 39 | |||
| 40 | const char *progname = "check_dns"; | ||
| 41 | @@ -58,7 +81,9 @@ | ||
| 42 | void print_help (void); | ||
| 43 | int error_scan (char *); | ||
| 44 | |||
| 45 | -#define ADDRESS_LENGTH 256 | ||
| 46 | +#define ADDRESS_LENGTH 10240 | ||
| 47 | +#define RRTYPE_LENGTH 32 | ||
| 48 | +char record_type[RRTYPE_LENGTH] = "A"; | ||
| 49 | char query_address[ADDRESS_LENGTH] = ""; | ||
| 50 | char dns_server[ADDRESS_LENGTH] = ""; | ||
| 51 | char ptr_server[ADDRESS_LENGTH] = ""; | ||
| 52 | @@ -69,144 +94,293 @@ | ||
| 53 | int | ||
| 54 | main (int argc, char **argv) | ||
| 55 | { | ||
| 56 | - char *command_line = NULL; | ||
| 57 | - char input_buffer[MAX_INPUT_BUFFER]; | ||
| 58 | - char *output = NULL; | ||
| 59 | - char *address = NULL; | ||
| 60 | - char *temp_buffer = NULL; | ||
| 61 | - int result = STATE_UNKNOWN; | ||
| 62 | - | ||
| 63 | - /* Set signal handling and alarm */ | ||
| 64 | - if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { | ||
| 65 | - printf ("Cannot catch SIGALRM"); | ||
| 66 | - return STATE_UNKNOWN; | ||
| 67 | + char *command_line = NULL; | ||
| 68 | + char input_buffer[MAX_INPUT_BUFFER]; | ||
| 69 | + char *output = NULL; | ||
| 70 | + char *address = NULL; | ||
| 71 | + char *temp_buffer = NULL; | ||
| 72 | + int result = STATE_UNKNOWN; | ||
| 73 | + int linecnt = 0; | ||
| 74 | + | ||
| 75 | + /* Set signal handling and alarm */ | ||
| 76 | + if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { | ||
| 77 | + printf ("Cannot catch SIGALRM"); | ||
| 78 | + return STATE_UNKNOWN; | ||
| 79 | + } | ||
| 80 | + if (process_arguments (argc, argv) != OK) { | ||
| 81 | + print_usage (); | ||
| 82 | + return STATE_UNKNOWN; | ||
| 83 | + } | ||
| 84 | + /* get the command to run */ | ||
| 85 | +#ifdef USE_RESOLVER | ||
| 86 | +#error "THIS CODE DOES NOT WORK" | ||
| 87 | + { | ||
| 88 | + int i; | ||
| 89 | + struct hostent *response; | ||
| 90 | + res_init(); | ||
| 91 | + if (strlen(dns_server)) { | ||
| 92 | + if ((response=gethostbyname(dns_server)) == NULL) { | ||
| 93 | + printf ("DNS problem = server %s can not be resolved %s\n", | ||
| 94 | + dns_server, strerror(h_errno)); | ||
| 95 | + return STATE_CRITICAL; | ||
| 96 | + } else { | ||
| 97 | + _res.nscount = response->h_length; | ||
| 98 | + for (i = 0; i < response->h_length && i < MAXNS; i++) { | ||
| 99 | + if (response->h_addr_list[i] == NULL) { | ||
| 100 | + break; | ||
| 101 | + } | ||
| 102 | + _res.nsaddr_list[i].sin_family = AF_INET; | ||
| 103 | + _res.nsaddr_list[i].sin_port = NS_DEFAULTPORT; | ||
| 104 | + _res.nsaddr_list[i].sin_addr.s_addr = ((struct in_addr *)response->h_addr_list[i])->s_addr; | ||
| 105 | } | ||
| 106 | - | ||
| 107 | - if (process_arguments (argc, argv) != OK) { | ||
| 108 | - print_usage (); | ||
| 109 | - return STATE_UNKNOWN; | ||
| 110 | + } | ||
| 111 | + _res.options &= ~(RES_RECURSE|RES_DEFNAMES); | ||
| 112 | + } | ||
| 113 | + if ((response=gethostbyname(query_address)) == NULL) { | ||
| 114 | + asprintf (&output, "lookup failed with %s", strerror(h_errno)); | ||
| 115 | + result = STATE_CRITICAL; | ||
| 116 | + } else { | ||
| 117 | + int len=0; | ||
| 118 | + struct in_addr in; | ||
| 119 | + for (i = 0; i < response->h_length; i++) { | ||
| 120 | + if (response->h_addr_list[i] == NULL) { | ||
| 121 | + break; | ||
| 122 | } | ||
| 123 | - | ||
| 124 | - /* get the command to run */ | ||
| 125 | - asprintf (&command_line, "%s %s %s", NSLOOKUP_COMMAND, query_address, dns_server); | ||
| 126 | - | ||
| 127 | - alarm (timeout_interval); | ||
| 128 | - time (&start_time); | ||
| 129 | - | ||
| 130 | - if (verbose) | ||
| 131 | - printf ("%s\n", command_line); | ||
| 132 | - /* run the command */ | ||
| 133 | - child_process = spopen (command_line); | ||
| 134 | - if (child_process == NULL) { | ||
| 135 | - printf ("Could not open pipe: %s\n", command_line); | ||
| 136 | - return STATE_UNKNOWN; | ||
| 137 | + memcpy(&in, ((struct in_addr *)response->h_addr_list[i]), sizeof(in)); | ||
| 138 | + len+=strlen(inet_ntoa(in))+1; | ||
| 139 | + } | ||
| 140 | + address =(char *)malloc(len); | ||
| 141 | + address[0]='\0'; | ||
| 142 | + for (i = 0; i < response->h_length; i++) { | ||
| 143 | + if (response->h_addr_list[i] == NULL) { | ||
| 144 | + break; | ||
| 145 | } | ||
| 146 | - | ||
| 147 | - child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 148 | - if (child_stderr == NULL) | ||
| 149 | - printf ("Could not open stderr for %s\n", command_line); | ||
| 150 | - | ||
| 151 | - /* scan stdout */ | ||
| 152 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 153 | - | ||
| 154 | - if (verbose) | ||
| 155 | - printf ("%s\n", input_buffer); | ||
| 156 | - | ||
| 157 | - if (strstr (input_buffer, ".in-addr.arpa")) { | ||
| 158 | - if ((temp_buffer = strstr (input_buffer, "name = "))) | ||
| 159 | - address = strscpy (address, temp_buffer + 7); | ||
| 160 | - else { | ||
| 161 | - output = strscpy (output, "Unknown error (plugin)"); | ||
| 162 | - result = STATE_WARNING; | ||
| 163 | - } | ||
| 164 | - } | ||
| 165 | - | ||
| 166 | - /* the server is responding, we just got the host name... */ | ||
| 167 | - if (strstr (input_buffer, "Name:")) { | ||
| 168 | - | ||
| 169 | - /* get the host address */ | ||
| 170 | - if (!fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) | ||
| 171 | - break; | ||
| 172 | - | ||
| 173 | - if (verbose) | ||
| 174 | - printf ("%s\n", input_buffer); | ||
| 175 | - | ||
| 176 | - if ((temp_buffer = index (input_buffer, ':'))) { | ||
| 177 | - temp_buffer++; | ||
| 178 | - /* Strip leading spaces */ | ||
| 179 | - for (; *temp_buffer != '\0' && *temp_buffer == ' '; temp_buffer++) | ||
| 180 | - /* NOOP */; | ||
| 181 | - address = strdup (temp_buffer); | ||
| 182 | - strip (address); | ||
| 183 | - if (address==NULL || strlen(address)==0) | ||
| 184 | - terminate (STATE_CRITICAL, | ||
| 185 | - "DNS CRITICAL - '%s' returned empty host name string\n", | ||
| 186 | - NSLOOKUP_COMMAND); | ||
| 187 | - result = STATE_OK; | ||
| 188 | - } | ||
| 189 | - else { | ||
| 190 | - output = strdup ("Unknown error (plugin)"); | ||
| 191 | - result = STATE_WARNING; | ||
| 192 | - } | ||
| 193 | - | ||
| 194 | - break; | ||
| 195 | - } | ||
| 196 | - | ||
| 197 | - result = error_scan (input_buffer); | ||
| 198 | - if (result != STATE_OK) { | ||
| 199 | - output = strscpy (output, 1 + index (input_buffer, ':')); | ||
| 200 | - break; | ||
| 201 | - } | ||
| 202 | - | ||
| 203 | + memcpy(&in, ((struct in_addr*)response->h_addr_list[i]), sizeof(in)); | ||
| 204 | + strcat(address, inet_ntoa(in)); | ||
| 205 | + strcat(address, ","); | ||
| 206 | + } | ||
| 207 | + address[strlen(address)-1]='\0'; | ||
| 208 | + result = STATE_OK; | ||
| 209 | + } | ||
| 210 | + } | ||
| 211 | +#endif | ||
| 212 | +#ifdef USE_NSLOOKUP | ||
| 213 | + asprintf (&command_line, "%s -timeout=%d -query=%s %s %s", | ||
| 214 | + NSLOOKUP_COMMAND, timeout_interval-1, | ||
| 215 | + record_type, query_address, dns_server); | ||
| 216 | +#endif | ||
| 217 | +#ifdef USE_HOST | ||
| 218 | +#error "HOST IS NOT IMPLEMENTED YET" | ||
| 219 | + asprintf (&command_line, "%s -W %d -t %s %s %s", | ||
| 220 | + HOST_COMMAND, timeout_interval-1, | ||
| 221 | + record_type, query_address, dns_server); | ||
| 222 | +#endif | ||
| 223 | + alarm (timeout_interval); | ||
| 224 | + time (&start_time); | ||
| 225 | + if (verbose) | ||
| 226 | + printf ("%s\n", command_line); | ||
| 227 | + /* run the command */ | ||
| 228 | + child_process = spopen (command_line); | ||
| 229 | + if (child_process == NULL) { | ||
| 230 | + printf ("Could not open pipe: %s\n", command_line); | ||
| 231 | + return STATE_UNKNOWN; | ||
| 232 | + } | ||
| 233 | + child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | ||
| 234 | + if (child_stderr == NULL) | ||
| 235 | + printf ("Could not open stderr for %s\n", command_line); | ||
| 236 | +#ifdef USE_NSLOOKUP | ||
| 237 | + /* scan stdout */ | ||
| 238 | + while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 239 | + if (verbose) | ||
| 240 | + printf ("%s\n", input_buffer); | ||
| 241 | + if (linecnt == 0) { | ||
| 242 | + /* First line should be server name */ | ||
| 243 | + if (strstr (input_buffer, "Server:") != input_buffer) { | ||
| 244 | + output = strscpy (output, "NSLOOKUP error (plugin) - no Server line found"); | ||
| 245 | + result = STATE_WARNING; | ||
| 246 | + } | ||
| 247 | + linecnt++; | ||
| 248 | + } else if (linecnt == 1) { | ||
| 249 | + /* Next line is server address */ | ||
| 250 | + if (strstr (input_buffer, "Address:") != input_buffer) { | ||
| 251 | + output = (output == NULL) | ||
| 252 | + ?strscpy (output, "NSLOOKUP error (plugin) - no Address line found") | ||
| 253 | + :strscat (output, ", no Address line found"); | ||
| 254 | + result = STATE_WARNING; | ||
| 255 | + } | ||
| 256 | + linecnt++; | ||
| 257 | + } else { | ||
| 258 | + linecnt++; | ||
| 259 | + strip(input_buffer); | ||
| 260 | + if (strstr (input_buffer, ".in-addr.arpa")) { | ||
| 261 | + if ((temp_buffer = strstr (input_buffer, "name = "))) | ||
| 262 | + address = strscpy (address, temp_buffer + 7); | ||
| 263 | + else { | ||
| 264 | + output = strscpy (output, "Unknown error (plugin)"); | ||
| 265 | + result = STATE_WARNING; | ||
| 266 | } | ||
| 267 | - | ||
| 268 | - /* scan stderr */ | ||
| 269 | - while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { | ||
| 270 | - if (error_scan (input_buffer) != STATE_OK) { | ||
| 271 | - result = max_state (result, error_scan (input_buffer)); | ||
| 272 | - output = strscpy (output, 1 + index (input_buffer, ':')); | ||
| 273 | - } | ||
| 274 | + continue; | ||
| 275 | + } else if ((temp_buffer = strstr (input_buffer, "canonical name ="))) { | ||
| 276 | + address = strscat (address, temp_buffer + strlen("cannonical name =")); | ||
| 277 | + continue; | ||
| 278 | + } else if ((temp_buffer = strstr (input_buffer, "hinfo ="))) { | ||
| 279 | + address = strscat (address, temp_buffer + strlen("hinfo =")); | ||
| 280 | + continue; | ||
| 281 | + } else if ((temp_buffer = strstr (input_buffer, "mail exchanger ="))) { | ||
| 282 | + address = strscat (address, temp_buffer + strlen("mail exchanger =")); | ||
| 283 | + continue; | ||
| 284 | + } else if ((temp_buffer = strstr (input_buffer, "nameserver ="))) { | ||
| 285 | + address = strscat (address, temp_buffer + strlen("nameserver =")); | ||
| 286 | + continue; | ||
| 287 | + } else if ((temp_buffer = strstr (input_buffer, "text ="))) { | ||
| 288 | + address = strscat (address, temp_buffer + strlen("text =")); | ||
| 289 | + continue; | ||
| 290 | + } else if (strcasecmp(record_type, "SOA") == 0) { | ||
| 291 | + if (strncasecmp(input_buffer, query_address, strlen(query_address)) == 0) { | ||
| 292 | + /* Read in SOA */ | ||
| 293 | + while(fgets(input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 294 | + if (verbose) | ||
| 295 | + printf ("%s\n", input_buffer); | ||
| 296 | + strip(input_buffer); | ||
| 297 | + address = strscat(address, input_buffer+1); | ||
| 298 | + if (strstr(input_buffer, "minimum =")) | ||
| 299 | + break; | ||
| 300 | + } | ||
| 301 | + continue; | ||
| 302 | } | ||
| 303 | - | ||
| 304 | - /* close stderr */ | ||
| 305 | - (void) fclose (child_stderr); | ||
| 306 | - | ||
| 307 | - /* close stdout */ | ||
| 308 | - if (spclose (child_process)) { | ||
| 309 | - result = max_state (result, STATE_WARNING); | ||
| 310 | - if (!strcmp (output, "")) | ||
| 311 | - output = strscpy (output, "nslookup returned error status"); | ||
| 312 | + } else if (strstr (input_buffer, "Name:")) { | ||
| 313 | + /* the server is responding, we just got the host name... */ | ||
| 314 | + /* get the host address */ | ||
| 315 | + if (!fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) | ||
| 316 | + break; | ||
| 317 | + strip (input_buffer); | ||
| 318 | + if (verbose) | ||
| 319 | + printf ("%s\n", input_buffer); | ||
| 320 | + if ((temp_buffer = index (input_buffer, ':'))) { | ||
| 321 | + address = strscpy (address, temp_buffer + 2); | ||
| 322 | + strip (address); | ||
| 323 | + result = STATE_OK; | ||
| 324 | + } else { | ||
| 325 | + output = strscpy (output, "Unknown error (plugin)"); | ||
| 326 | + result = STATE_WARNING; | ||
| 327 | } | ||
| 328 | - | ||
| 329 | - /* If we got here, we should have an address string, | ||
| 330 | - and we can segfault if we do not */ | ||
| 331 | + continue; | ||
| 332 | + } | ||
| 333 | + } | ||
| 334 | + result = error_scan (input_buffer); | ||
| 335 | + if (result != STATE_OK) { | ||
| 336 | + output = strscpy (output, 1 + index (input_buffer, ':')); | ||
| 337 | + break; | ||
| 338 | + } | ||
| 339 | + } | ||
| 340 | + /* scan stderr */ | ||
| 341 | + while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { | ||
| 342 | + if (error_scan (input_buffer) != STATE_OK) { | ||
| 343 | + result = max_state (result, error_scan (input_buffer)); | ||
| 344 | + output = strscpy (output, 1 + index (input_buffer, ':')); | ||
| 345 | + } | ||
| 346 | + } | ||
| 347 | + /* close stderr */ | ||
| 348 | + (void) fclose (child_stderr); | ||
| 349 | + /* close stdout */ | ||
| 350 | + if (spclose (child_process)) { | ||
| 351 | + result = max_state (result, STATE_WARNING); | ||
| 352 | + if (!strcmp (output, "")) | ||
| 353 | + output = strscpy (output, "nslookup returned error status"); | ||
| 354 | + } | ||
| 355 | +#endif | ||
| 356 | +#ifdef USE_HOST | ||
| 357 | +#error "HOST IS NOT IMPLEMENTED YET" | ||
| 358 | + /* scan stdout */ | ||
| 359 | + while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 360 | + if (verbose) | ||
| 361 | + printf ("%s\n", input_buffer); | ||
| 362 | + if (strstr (input_buffer, ".in-addr.arpa")) { | ||
| 363 | + if ((temp_buffer = strstr (input_buffer, "name = "))) | ||
| 364 | + address = strscpy (address, temp_buffer + 7); | ||
| 365 | + else { | ||
| 366 | + output = strscpy (output, "Unknown error (plugin)"); | ||
| 367 | + result = STATE_WARNING; | ||
| 368 | + } | ||
| 369 | + } | ||
| 370 | + /* the server is responding, we just got the host name... */ | ||
| 371 | + if (strstr (input_buffer, "Name:")) { | ||
| 372 | + /* get the host address */ | ||
| 373 | + if (!fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) | ||
| 374 | + break; | ||
| 375 | + if (verbose) | ||
| 376 | + printf ("%s\n", input_buffer); | ||
| 377 | + if ((temp_buffer = index (input_buffer, ':'))) { | ||
| 378 | + temp_buffer++; | ||
| 379 | + /* Strip leading spaces */ | ||
| 380 | + for (; *temp_buffer != '\0' && *temp_buffer == ' '; temp_buffer++) | ||
| 381 | + /* NOOP */; | ||
| 382 | + address = strdup (temp_buffer); | ||
| 383 | + strip (address); | ||
| 384 | if (address==NULL || strlen(address)==0) | ||
| 385 | - terminate (STATE_CRITICAL, | ||
| 386 | - "DNS CRITICAL - '%s' output parsing exited with no address\n", | ||
| 387 | - NSLOOKUP_COMMAND); | ||
| 388 | - | ||
| 389 | - /* compare to expected address */ | ||
| 390 | - if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) { | ||
| 391 | - result = STATE_CRITICAL; | ||
| 392 | - asprintf(&output, "expected %s but got %s", expected_address, address); | ||
| 393 | - } | ||
| 394 | - | ||
| 395 | - (void) time (&end_time); | ||
| 396 | - | ||
| 397 | - if (result == STATE_OK) | ||
| 398 | - printf ("DNS ok - %d seconds response time, Address(es) is/are %s\n", | ||
| 399 | - (int) (end_time - start_time), address); | ||
| 400 | - else if (result == STATE_WARNING) | ||
| 401 | - printf ("DNS WARNING - %s\n", | ||
| 402 | - !strcmp (output, "") ? " Probably a non-existent host/domain" : output); | ||
| 403 | - else if (result == STATE_CRITICAL) | ||
| 404 | - printf ("DNS CRITICAL - %s\n", | ||
| 405 | - !strcmp (output, "") ? " Probably a non-existent host/domain" : output); | ||
| 406 | - else | ||
| 407 | - printf ("DNS problem - %s\n", | ||
| 408 | - !strcmp (output, "") ? " Probably a non-existent host/domain" : output); | ||
| 409 | - | ||
| 410 | - return result; | ||
| 411 | + terminate (STATE_CRITICAL, | ||
| 412 | + "DNS CRITICAL - '%s' returned empty host name string\n", | ||
| 413 | + NSLOOKUP_COMMAND); | ||
| 414 | + result = STATE_OK; | ||
| 415 | + } | ||
| 416 | + else { | ||
| 417 | + output = strdup ("Unknown error (plugin)"); | ||
| 418 | + result = STATE_WARNING; | ||
| 419 | + } | ||
| 420 | + break; | ||
| 421 | + } | ||
| 422 | + result = error_scan (input_buffer); | ||
| 423 | + if (result != STATE_OK) { | ||
| 424 | + output = strscpy (output, 1 + index (input_buffer, ':')); | ||
| 425 | + break; | ||
| 426 | + } | ||
| 427 | + } | ||
| 428 | + /* scan stderr */ | ||
| 429 | + while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { | ||
| 430 | + if (error_scan (input_buffer) != STATE_OK) { | ||
| 431 | + result = max (result, error_scan (input_buffer)); | ||
| 432 | + output = strscpy (output, 1 + index (input_buffer, ':')); | ||
| 433 | + } | ||
| 434 | + } | ||
| 435 | + /* close stderr */ | ||
| 436 | + (void) fclose (child_stderr); | ||
| 437 | + /* close stdout */ | ||
| 438 | + if (spclose (child_process)) { | ||
| 439 | + result = max_state (result, STATE_WARNING); /* was "max" check for problems */ | ||
| 440 | + if (!strcmp (output, "")) | ||
| 441 | + output = strscpy (output, "nslookup returned error status"); | ||
| 442 | + } | ||
| 443 | +#endif | ||
| 444 | + (void) time (&end_time); | ||
| 445 | + if (address) { | ||
| 446 | + while (isspace(address[0])) { | ||
| 447 | + address=&address[1]; | ||
| 448 | + } | ||
| 449 | + } | ||
| 450 | + /* If we got here, we should have an address string, | ||
| 451 | + and we can segfault if we do not */ | ||
| 452 | + if (address==NULL || strlen(address)==0) | ||
| 453 | + terminate (STATE_CRITICAL, | ||
| 454 | + "DNS CRITICAL - '%s' output parsing exited with no address\n", | ||
| 455 | + NSLOOKUP_COMMAND); | ||
| 456 | + /* compare to expected address */ | ||
| 457 | + if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) { | ||
| 458 | + result = STATE_CRITICAL; | ||
| 459 | + asprintf(&output, "expected %s but got %s", expected_address, address); | ||
| 460 | + } | ||
| 461 | + if (result == STATE_OK) | ||
| 462 | + printf ("DNS ok - %d seconds response time, Address(es) is/are %s\n", | ||
| 463 | + (int) (end_time - start_time), address); | ||
| 464 | + else if (result == STATE_WARNING) | ||
| 465 | + printf ("DNS WARNING - %s\n", | ||
| 466 | + !strcmp (output, "") ? " Probably a non-existent host/domain" : output); | ||
| 467 | + else if (result == STATE_CRITICAL) | ||
| 468 | + printf ("DNS CRITICAL - %s\n", | ||
| 469 | + !strcmp (output, "") ? " Probably a non-existent host/domain" : output); | ||
| 470 | + else | ||
| 471 | + printf ("DNS problem - %s\n", | ||
| 472 | + !strcmp (output, "") ? " Probably a non-existent host/domain" : output); | ||
| 473 | + return result; | ||
| 474 | } | ||
| 475 | |||
| 476 | int | ||
| 477 | @@ -262,6 +436,13 @@ | ||
| 478 | else if (strstr (input_buffer, "Format error")) | ||
| 479 | return STATE_WARNING; | ||
| 480 | |||
| 481 | + else if (strstr (input_buffer, "No answer")) | ||
| 482 | + return STATE_WARNING; | ||
| 483 | + | ||
| 484 | + /* Server is not authoritative for this question */ | ||
| 485 | + else if (strstr (input_buffer, "Non-authoritative answer")) | ||
| 486 | + return STATE_OK; | ||
| 487 | + | ||
| 488 | else | ||
| 489 | return STATE_OK; | ||
| 490 | |||
| 491 | @@ -283,7 +464,8 @@ | ||
| 492 | {"hostname", required_argument, 0, 'H'}, | ||
| 493 | {"server", required_argument, 0, 's'}, | ||
| 494 | {"reverse-server", required_argument, 0, 'r'}, | ||
| 495 | - {"expected-address", required_argument, 0, 'a'}, | ||
| 496 | + {"expected-answer", required_argument, 0, 'a'}, | ||
| 497 | + {"resource-record", required_argument, 0, 'T'}, | ||
| 498 | {0, 0, 0, 0} | ||
| 499 | }; | ||
| 500 | #endif | ||
| 501 | @@ -297,9 +479,9 @@ | ||
| 502 | |||
| 503 | while (1) { | ||
| 504 | #ifdef HAVE_GETOPT_H | ||
| 505 | - c = getopt_long (argc, argv, "hVvt:H:s:r:a:", long_opts, &opt_index); | ||
| 506 | + c = getopt_long (argc, argv, "+?hVvt:H:s:r:a:T:", long_opts, &opt_index); | ||
| 507 | #else | ||
| 508 | - c = getopt (argc, argv, "hVvt:H:s:r:a:"); | ||
| 509 | + c = getopt (argc, argv, "+?hVvt:H:s:r:a:T:"); | ||
| 510 | #endif | ||
| 511 | |||
| 512 | if (c == -1 || c == EOF) | ||
| 513 | @@ -352,17 +534,17 @@ | ||
| 514 | terminate (STATE_UNKNOWN, "Input buffer overflow\n"); | ||
| 515 | strcpy (ptr_server, optarg); | ||
| 516 | break; | ||
| 517 | - case 'a': /* expected address */ | ||
| 518 | - if (is_dotted_quad (optarg) == FALSE) { | ||
| 519 | - printf ("Invalid expected address\n\n"); | ||
| 520 | - print_usage (); | ||
| 521 | - exit (STATE_UNKNOWN); | ||
| 522 | - } | ||
| 523 | + case 'a': /* expected answer */ | ||
| 524 | if (strlen (optarg) >= ADDRESS_LENGTH) | ||
| 525 | terminate (STATE_UNKNOWN, "Input buffer overflow\n"); | ||
| 526 | strcpy (expected_address, optarg); | ||
| 527 | match_expected_address = TRUE; | ||
| 528 | break; | ||
| 529 | + case 'T': /* Resource record type */ | ||
| 530 | + if (strlen (optarg) >= RRTYPE_LENGTH) | ||
| 531 | + terminate (STATE_UNKNOWN, "INput buffer overflow\n"); | ||
| 532 | + strcpy (record_type, optarg); | ||
| 533 | + break; | ||
| 534 | } | ||
| 535 | } | ||
| 536 | |||
| 537 | @@ -402,8 +584,10 @@ | ||
| 538 | void | ||
| 539 | print_usage (void) | ||
| 540 | { | ||
| 541 | - printf ("Usage: %s -H host [-s server] [-a expected-address] [-t timeout]\n" " %s --help\n" | ||
| 542 | - " %s --version\n", progname, progname, progname); | ||
| 543 | + printf ("Usage: %s -H host [-s server] [-r reverse-server] [-t timeout] [-T querytype] [-a answer]\n" | ||
| 544 | + " %s --help\n" | ||
| 545 | + " %s --version\n", | ||
| 546 | + progname, progname, progname); | ||
| 547 | } | ||
| 548 | |||
| 549 | void | ||
| 550 | @@ -418,16 +602,28 @@ | ||
| 551 | " The name or address you want to query\n" | ||
| 552 | "-s, --server=HOST\n" | ||
| 553 | " Optional DNS server you want to use for the lookup\n" | ||
| 554 | - "-a, --expected-address=IP-ADDRESS\n" | ||
| 555 | - " Optional IP address you expect the DNS server to return\n" | ||
| 556 | + "-r, --reverse-server=HOST\n" | ||
| 557 | + " Optional DNS server to do PTR lookup - NOT IMPLEMENTED\n" | ||
| 558 | "-t, --timeout=INTEGER\n" | ||
| 559 | " Seconds before connection times out (default: %d)\n" | ||
| 560 | + "-T, --resource-record=QUERYTYPE\n" | ||
| 561 | + " Type of query to issue - default is A - [A,CNAME,HINFO,MINFO,MX,NS,PTR,SOA,TXT,UINFO,WKS,ANY]\n" | ||
| 562 | + "-a, --expected-answer=STRING\n" | ||
| 563 | + " String to match from server as answer - be very careful how you specify this\n" | ||
| 564 | "-h, --help\n" | ||
| 565 | " Print detailed help\n" | ||
| 566 | "-V, --version\n" | ||
| 567 | " Print version numbers and license information\n" | ||
| 568 | "\n" | ||
| 569 | +#ifdef USE_NSLOOKUP | ||
| 570 | "This plugin uses the nslookup program to obtain the IP address\n" | ||
| 571 | +#endif | ||
| 572 | +#ifdef USE_HOST | ||
| 573 | + "This plugin uses the host program to obtain the IP address\n" | ||
| 574 | +#endif | ||
| 575 | +#ifdef USE_RESOLVER | ||
| 576 | + "This plugin uses the resolver library to obtain the IP address\n" | ||
| 577 | +#endif | ||
| 578 | "for the given host/domain query. A optional DNS server to use may\n" | ||
| 579 | "be specified. If no DNS server is specified, the default server(s)\n" | ||
| 580 | "specified in /etc/resolv.conf will be used.\n", DEFAULT_SOCKET_TIMEOUT); | ||
| 581 | diff -ruN nagios-plugins-1.3.1/plugins/check_tcp.c nagios-plugins-1.3.1-new/plugins/check_tcp.c | ||
| 582 | --- nagios-plugins-1.3.1/plugins/check_tcp.c 2003-06-10 05:56:47.000000000 +0100 | ||
| 583 | +++ nagios-plugins-1.3.1-new/plugins/check_tcp.c 2003-07-14 18:39:57.000000000 +0100 | ||
| 584 | @@ -67,7 +67,7 @@ | ||
| 585 | void print_usage (void); | ||
| 586 | void print_help (void); | ||
| 587 | int my_recv (void); | ||
| 588 | - | ||
| 589 | +int check_expect(char *); | ||
| 590 | char *progname = "check_tcp"; | ||
| 591 | char *SERVICE = NULL; | ||
| 592 | char *SEND = NULL; | ||
| 593 | @@ -259,6 +259,7 @@ | ||
| 594 | while ((i = my_recv ()) > 0) { | ||
| 595 | buffer[i] = '\0'; | ||
| 596 | asprintf (&status, "%s%s", status, buffer); | ||
| 597 | + if (server_expect_count > 0 && check_expect(status)) break; | ||
| 598 | if (buffer[i-2] == '\r' && buffer[i-1] == '\n') | ||
| 599 | break; | ||
| 600 | if (maxbytes>0 && strlen(status)>=maxbytes) | ||
| 601 | @@ -274,16 +275,11 @@ | ||
| 602 | if (status && verbose) | ||
| 603 | printf ("%s\n", status); | ||
| 604 | |||
| 605 | + /* - does not do anything!! | ||
| 606 | if (server_expect_count > 0) { | ||
| 607 | - for (i = 0;; i++) { | ||
| 608 | - if (verbose) | ||
| 609 | - printf ("%d %d\n", i, server_expect_count); | ||
| 610 | - if (i >= server_expect_count) | ||
| 611 | - terminate (STATE_WARNING, "Invalid response from host\n"); | ||
| 612 | - if (strstr (status, server_expect[i])) | ||
| 613 | - break; | ||
| 614 | - } | ||
| 615 | + check_expect(status); | ||
| 616 | } | ||
| 617 | + */ | ||
| 618 | } | ||
| 619 | |||
| 620 | if (server_quit != NULL) | ||
| 621 | @@ -608,10 +604,24 @@ | ||
| 622 | } | ||
| 623 | else { | ||
| 624 | #endif | ||
| 625 | - i = read (sd, buffer, MAXBUF - 1); | ||
| 626 | + i = recv (sd, buffer, MAXBUF - 1, 0); | ||
| 627 | #ifdef HAVE_SSL | ||
| 628 | } | ||
| 629 | #endif | ||
| 630 | |||
| 631 | return i; | ||
| 632 | } | ||
| 633 | + | ||
| 634 | +int check_expect(char * status) { | ||
| 635 | + int i; | ||
| 636 | + | ||
| 637 | + for (i = 0;; i++) { | ||
| 638 | + if (verbose) | ||
| 639 | + printf ("%d %d\n", i, server_expect_count); | ||
| 640 | + if (i >= server_expect_count) | ||
| 641 | + terminate (STATE_WARNING, "Invalid response from host\n"); | ||
| 642 | + if (strstr (status, server_expect[i])) | ||
| 643 | + return TRUE; | ||
| 644 | + } | ||
| 645 | + return FALSE; | ||
| 646 | +} | ||
diff --git a/web/attachments/66460-nagios-plugins-1.3.1-check-ldap.patch b/web/attachments/66460-nagios-plugins-1.3.1-check-ldap.patch new file mode 100644 index 0000000..31bf7d1 --- /dev/null +++ b/web/attachments/66460-nagios-plugins-1.3.1-check-ldap.patch | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | --- ./plugins/check_ldap.c~ 2003-01-29 06:16:15.000000000 +0000 | ||
| 2 | +++ ./plugins/check_ldap.c 2003-10-22 11:10:44.000000000 +0100 | ||
| 3 | @@ -45,8 +45,6 @@ | ||
| 4 | char *ld_attr = ld_defattr; | ||
| 5 | char *ld_host = ""; | ||
| 6 | char *ld_base = ""; | ||
| 7 | -char *ld_passwd = NULL; | ||
| 8 | -char *ld_binddn = NULL; | ||
| 9 | unsigned int ld_port = DEFAULT_PORT; | ||
| 10 | int warn_time = UNDEFINED; | ||
| 11 | int crit_time = UNDEFINED; | ||
| 12 | @@ -74,20 +72,12 @@ | ||
| 13 | time (&time0); | ||
| 14 | |||
| 15 | /* initialize ldap */ | ||
| 16 | - if (!(ld = ldap_open (ld_host, ld_port))) { | ||
| 17 | + if (!(ld = ldap_init (ld_host, ld_port))) { | ||
| 18 | /*ldap_perror(ld, "ldap_open"); */ | ||
| 19 | printf ("Could not connect to the server at port %i\n", ld_port); | ||
| 20 | return STATE_CRITICAL; | ||
| 21 | } | ||
| 22 | |||
| 23 | - /* bind to the ldap server */ | ||
| 24 | - if (ldap_bind_s (ld, ld_binddn, ld_passwd, LDAP_AUTH_SIMPLE) != | ||
| 25 | - LDAP_SUCCESS) { | ||
| 26 | - /*ldap_perror(ld, "ldap_bind"); */ | ||
| 27 | - printf ("Could not bind to the ldap-server\n"); | ||
| 28 | - return STATE_CRITICAL; | ||
| 29 | - } | ||
| 30 | - | ||
| 31 | /* do a search of all objectclasses in the base dn */ | ||
| 32 | if (ldap_search_s (ld, ld_base, LDAP_SCOPE_BASE, ld_attr, NULL, 0, &result) | ||
| 33 | != LDAP_SUCCESS) { | ||
| 34 | @@ -140,8 +130,6 @@ | ||
| 35 | {"host", required_argument, 0, 'H'}, | ||
| 36 | {"base", required_argument, 0, 'b'}, | ||
| 37 | {"attr", required_argument, 0, 'a'}, | ||
| 38 | - {"bind", required_argument, 0, 'D'}, | ||
| 39 | - {"pass", required_argument, 0, 'P'}, | ||
| 40 | {"port", required_argument, 0, 'p'}, | ||
| 41 | {"warn", required_argument, 0, 'w'}, | ||
| 42 | {"crit", required_argument, 0, 'c'}, | ||
| 43 | @@ -159,9 +147,9 @@ | ||
| 44 | |||
| 45 | while (1) { | ||
| 46 | #ifdef HAVE_GETOPT_H | ||
| 47 | - c = getopt_long (argc, argv, "hVt:c:w:H:b:p:a:D:P:", longopts, &option_index); | ||
| 48 | + c = getopt_long (argc, argv, "hVt:c:w:H:b:p:a:", longopts, &option_index); | ||
| 49 | #else | ||
| 50 | - c = getopt (argc, argv, "+?hVt:c:w:H:b:p:a:D:P:"); | ||
| 51 | + c = getopt (argc, argv, "+?hVt:c:w:H:b:p:a:"); | ||
| 52 | #endif | ||
| 53 | |||
| 54 | if (c == -1 || c == EOF) | ||
| 55 | @@ -191,12 +179,6 @@ | ||
| 56 | case 'a': | ||
| 57 | ld_attr = optarg; | ||
| 58 | break; | ||
| 59 | - case 'D': | ||
| 60 | - ld_binddn = optarg; | ||
| 61 | - break; | ||
| 62 | - case 'P': | ||
| 63 | - ld_passwd = optarg; | ||
| 64 | - break; | ||
| 65 | case 'w': | ||
| 66 | warn_time = atoi (optarg); | ||
| 67 | break; | ||
diff --git a/web/attachments/66461-nagios-plugins-1.3.1-check-ntp.patch b/web/attachments/66461-nagios-plugins-1.3.1-check-ntp.patch new file mode 100644 index 0000000..32101d8 --- /dev/null +++ b/web/attachments/66461-nagios-plugins-1.3.1-check-ntp.patch | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | diff -ruN nagios-plugins-1.3.1/plugins-scripts/check_ntp.pl nagios-plugins-1.3.1-new/plugins-scripts/check_ntp.pl | ||
| 2 | --- nagios-plugins-1.3.1/plugins-scripts/check_ntp.pl 2003-05-19 11:16:05.000000000 +0100 | ||
| 3 | +++ nagios-plugins-1.3.1-new/plugins-scripts/check_ntp.pl 2003-07-14 19:46:20.000000000 +0100 | ||
| 4 | @@ -57,12 +57,19 @@ | ||
| 5 | # | ||
| 6 | # Patch for for regex for stratum1 refid. | ||
| 7 | |||
| 8 | +BEGIN { | ||
| 9 | + if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) { | ||
| 10 | + $runtimedir = $1; | ||
| 11 | + $PROGNAME = $2; | ||
| 12 | + } | ||
| 13 | +} | ||
| 14 | + | ||
| 15 | require 5.004; | ||
| 16 | use POSIX; | ||
| 17 | use strict; | ||
| 18 | use Getopt::Long; | ||
| 19 | use vars qw($opt_V $opt_h $opt_H $opt_w $opt_c $opt_j $opt_k $verbose $PROGNAME $def_jitter); | ||
| 20 | -use lib utils.pm; | ||
| 21 | +use lib $main::runtimedir; | ||
| 22 | use utils qw($TIMEOUT %ERRORS &print_revision &support); | ||
| 23 | |||
| 24 | $PROGNAME="check_ntp"; | ||
| 25 | @@ -262,7 +269,7 @@ | ||
| 26 | } | ||
| 27 | |||
| 28 | # match sys.peer or pps.peer | ||
| 29 | - if (/^(\*|o)([-0-9.\s]+)\s+([-0-9A-Za-z.]+)\s+([-0-9.]+)\s+([lumb]+)\s+([-0-9m.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/) { | ||
| 30 | + if (/^(\*|o)([-0-9.\s]+)\s+([-0-9A-Za-z.]+)\s+([-0-9.]+)\s+([lumb]+)\s+([-0-9m.]+)\s+([-0-9.m]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/) { | ||
| 31 | $syspeer = $2; | ||
| 32 | $stratum = $4; | ||
| 33 | $jitter = $11; | ||
diff --git a/web/attachments/66462-nagios-plugins-1.3.1-check-wave.patch b/web/attachments/66462-nagios-plugins-1.3.1-check-wave.patch new file mode 100644 index 0000000..98c7393 --- /dev/null +++ b/web/attachments/66462-nagios-plugins-1.3.1-check-wave.patch | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | diff -ruN nagios-plugins-1.3.1/plugins-scripts/check_wave.pl nagios-plugins-1.3.1-new/plugins-scripts/check_wave.pl | ||
| 2 | --- nagios-plugins-1.3.1/plugins-scripts/check_wave.pl 2002-10-28 13:05:08.000000000 +0000 | ||
| 3 | +++ nagios-plugins-1.3.1-new/plugins-scripts/check_wave.pl 2003-07-14 18:39:57.000000000 +0100 | ||
| 4 | @@ -50,21 +50,21 @@ | ||
| 5 | ($opt_w) || ($opt_w = shift) || ($opt_w = 60); | ||
| 6 | my $warning = $1 if ($opt_w =~ /([0-9]+)/); | ||
| 7 | |||
| 8 | -$low1 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.8.1`; | ||
| 9 | +$low1 = `snmpget -v 1 -OQ -c public $host .1.3.6.1.4.1.74.2.21.1.2.1.8.1`; | ||
| 10 | @test = split(/ /,$low1); | ||
| 11 | $low1 = $test[2]; | ||
| 12 | |||
| 13 | -$med1 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.9.1`; | ||
| 14 | +$med1 = `snmpget -v 1 -OQ -c public $host .1.3.6.1.4.1.74.2.21.1.2.1.9.1`; | ||
| 15 | @test = split(/ /,$med1); | ||
| 16 | $med1 = $test[2]; | ||
| 17 | |||
| 18 | -$high1 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.10.1`; | ||
| 19 | +$high1 = `snmpget -v 1 -OQ -c public $host .1.3.6.1.4.1.74.2.21.1.2.1.10.1`; | ||
| 20 | @test = split(/ /,$high1); | ||
| 21 | $high1 = $test[2]; | ||
| 22 | |||
| 23 | sleep(2); | ||
| 24 | |||
| 25 | -$snr = `snmpget $host public .1.3.6.1.4.1.762.2.5.2.1.17.1`; | ||
| 26 | +$snr = `snmpget -v 1 -OQ -c public $host .1.3.6.1.4.1.762.2.5.2.1.17.1`; | ||
| 27 | @test = split(/ /,$snr); | ||
| 28 | $snr = $test[2]; | ||
| 29 | $snr = int($snr*25); | ||
diff --git a/web/attachments/67988-autoconf.dif b/web/attachments/67988-autoconf.dif new file mode 100644 index 0000000..53972e6 --- /dev/null +++ b/web/attachments/67988-autoconf.dif | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | diff -Naur nagios-plugins-1.3.1/configure.in nagios-plugins-1.3.1_autoconf_change/configure.in | ||
| 2 | --- nagios-plugins-1.3.1/configure.in 2003-07-11 08:12:23.000000000 +0200 | ||
| 3 | +++ nagios-plugins-1.3.1_autoconf_change/configure.in 2003-11-19 10:57:36.000000000 +0100 | ||
| 4 | @@ -176,9 +176,19 @@ | ||
| 5 | _SAVEDLIBS="$LIBS" | ||
| 6 | _SAVEDCPPFLAGS="$CPPFLAGS" | ||
| 7 | AC_ARG_WITH(mysql,--with-mysql=<dir> sets path to mysql installation (assumes lib/mysql and include subdirs),[MYSQL=$withval]) | ||
| 8 | -if test -n "$MYSQL"; then | ||
| 9 | - MYSQLLIBDIR=$MYSQL/lib/mysql | ||
| 10 | - CPPFLAGS="-I$MYSQL/include" | ||
| 11 | +AC_ARG_WITH(mysqllibdir,--with-mysqllibdir=<dir> sets the path to the mysql libraries,[MYSQLLIBDIR=$withval]) | ||
| 12 | +if test -n "$MYSQL" -o -n "$MYSQLLIBDIR" ; then | ||
| 13 | + | ||
| 14 | + dnl set default library if not supplied | ||
| 15 | + if test -z "$MYSQLLIBDIR" ; then | ||
| 16 | + MYSQLLIBDIR=$MYSQL/lib/mysql | ||
| 17 | + fi | ||
| 18 | + | ||
| 19 | + dnl set default include | ||
| 20 | + if test -n "$MYSQL" ; then | ||
| 21 | + CPPFLAGS="-I$MYSQL/include" | ||
| 22 | + fi | ||
| 23 | + | ||
| 24 | AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L$MYSQLLIBDIR ",,-L$MYSQLLIBDIR -lz) | ||
| 25 | AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient") | ||
| 26 | elif test -f /usr/lib/libmysqlclient.so; then | ||
diff --git a/web/attachments/67989-multiplier.dif b/web/attachments/67989-multiplier.dif new file mode 100644 index 0000000..99c510c --- /dev/null +++ b/web/attachments/67989-multiplier.dif | |||
| @@ -0,0 +1,164 @@ | |||
| 1 | diff -Naur nagios-plugins-1.3.0-beta2/plugins/check_mrtgtraf.c nagios-plugins-1.3.0-beta2_swl/plugins/check_mrtgtraf.c | ||
| 2 | --- nagios-plugins-1.3.0-beta2/plugins/check_mrtgtraf.c 2002-11-15 02:04:51.000000000 +0100 | ||
| 3 | +++ nagios-plugins-1.3.0-beta2_swl/plugins/check_mrtgtraf.c 2003-02-26 14:56:54.000000000 +0100 | ||
| 4 | @@ -56,6 +56,7 @@ | ||
| 5 | |||
| 6 | int process_arguments (int, char **); | ||
| 7 | int validate_arguments (void); | ||
| 8 | +unsigned long adjust_threshold(unsigned long val, char **c); | ||
| 9 | void print_help (void); | ||
| 10 | void print_usage (void); | ||
| 11 | |||
| 12 | @@ -144,9 +145,9 @@ | ||
| 13 | if (expire_minutes > 0 | ||
| 14 | && (current_time - timestamp) > | ||
| 15 | (expire_minutes * 60)) terminate (STATE_WARNING, | ||
| 16 | - "MRTG data has expired (%d minutes old)\n", | ||
| 17 | - (int) ((current_time - timestamp) / | ||
| 18 | - 60)); | ||
| 19 | + "MRTG data has expired (%d minutes old)\n", | ||
| 20 | + (int) ((current_time - timestamp) / | ||
| 21 | + 60)); | ||
| 22 | |||
| 23 | /* else check the incoming/outgoing rates */ | ||
| 24 | if (use_average == TRUE) { | ||
| 25 | @@ -160,37 +161,37 @@ | ||
| 26 | |||
| 27 | /* report incoming traffic in Bytes/sec */ | ||
| 28 | if (incoming_rate < 1024) { | ||
| 29 | - strcpy (incoming_speed_rating, "B/s"); | ||
| 30 | + strcpy (incoming_speed_rating, "b/s"); | ||
| 31 | adjusted_incoming_rate = (double) incoming_rate; | ||
| 32 | } | ||
| 33 | |||
| 34 | /* report incoming traffic in KBytes/sec */ | ||
| 35 | else if (incoming_rate < (1024 * 1024)) { | ||
| 36 | - strcpy (incoming_speed_rating, "KB/s"); | ||
| 37 | + strcpy (incoming_speed_rating, "Kb/s"); | ||
| 38 | adjusted_incoming_rate = (double) (incoming_rate / 1024.0); | ||
| 39 | } | ||
| 40 | |||
| 41 | /* report incoming traffic in MBytes/sec */ | ||
| 42 | else { | ||
| 43 | - strcpy (incoming_speed_rating, "MB/s"); | ||
| 44 | + strcpy (incoming_speed_rating, "Mb/s"); | ||
| 45 | adjusted_incoming_rate = (double) (incoming_rate / 1024.0 / 1024.0); | ||
| 46 | } | ||
| 47 | |||
| 48 | /* report outgoing traffic in Bytes/sec */ | ||
| 49 | if (outgoing_rate < 1024) { | ||
| 50 | - strcpy (outgoing_speed_rating, "B/s"); | ||
| 51 | + strcpy (outgoing_speed_rating, "b/s"); | ||
| 52 | adjusted_outgoing_rate = (double) outgoing_rate; | ||
| 53 | } | ||
| 54 | |||
| 55 | /* report outgoing traffic in KBytes/sec */ | ||
| 56 | else if (outgoing_rate < (1024 * 1024)) { | ||
| 57 | - strcpy (outgoing_speed_rating, "KB/s"); | ||
| 58 | + strcpy (outgoing_speed_rating, "Kb/s"); | ||
| 59 | adjusted_outgoing_rate = (double) (outgoing_rate / 1024.0); | ||
| 60 | } | ||
| 61 | |||
| 62 | /* report outgoing traffic in MBytes/sec */ | ||
| 63 | else { | ||
| 64 | - strcpy (outgoing_speed_rating, "MB/s"); | ||
| 65 | + strcpy (outgoing_speed_rating, "Mb/s"); | ||
| 66 | adjusted_outgoing_rate = (double) (outgoing_rate / 1024.0 / 1024.0); | ||
| 67 | } | ||
| 68 | |||
| 69 | @@ -231,6 +232,7 @@ | ||
| 70 | process_arguments (int argc, char **argv) | ||
| 71 | { | ||
| 72 | int c; | ||
| 73 | + char* modpos; | ||
| 74 | |||
| 75 | #ifdef HAVE_GETOPT_H | ||
| 76 | int option_index = 0; | ||
| 77 | @@ -283,13 +285,27 @@ | ||
| 78 | else | ||
| 79 | use_average = TRUE; | ||
| 80 | break; | ||
| 81 | - case 'c': /* warning threshold */ | ||
| 82 | - sscanf (optarg, "%lu,%lu", &incoming_critical_threshold, | ||
| 83 | - &outgoing_critical_threshold); | ||
| 84 | + case 'c': /* critical threshold */ | ||
| 85 | + incoming_critical_threshold = strtoul (optarg, &modpos, 10); | ||
| 86 | + if(*modpos != ',') | ||
| 87 | + incoming_critical_threshold = adjust_threshold(incoming_critical_threshold,&modpos); | ||
| 88 | + | ||
| 89 | + modpos++; | ||
| 90 | + | ||
| 91 | + outgoing_critical_threshold = strtoul (modpos, &modpos, 10); | ||
| 92 | + outgoing_critical_threshold = adjust_threshold(outgoing_critical_threshold,&modpos); | ||
| 93 | + | ||
| 94 | break; | ||
| 95 | - case 'w': /* critical threshold */ | ||
| 96 | - sscanf (optarg, "%lu,%lu", &incoming_warning_threshold, | ||
| 97 | - &outgoing_warning_threshold); | ||
| 98 | + case 'w': /* warning threshold */ | ||
| 99 | + incoming_warning_threshold = strtoul (optarg, &modpos, 10); | ||
| 100 | + if(*modpos != ',') | ||
| 101 | + incoming_warning_threshold = adjust_threshold(incoming_warning_threshold,&modpos); | ||
| 102 | + | ||
| 103 | + modpos++; | ||
| 104 | + | ||
| 105 | + outgoing_warning_threshold = strtoul (modpos, &modpos, 10); | ||
| 106 | + outgoing_warning_threshold = adjust_threshold(outgoing_warning_threshold,&modpos); | ||
| 107 | + | ||
| 108 | break; | ||
| 109 | case 'V': /* version */ | ||
| 110 | print_revision (PROGNAME, "$Revision: 1.2 $"); | ||
| 111 | @@ -321,25 +337,48 @@ | ||
| 112 | } | ||
| 113 | |||
| 114 | if (argc > c && incoming_warning_threshold == 0) { | ||
| 115 | - incoming_warning_threshold = strtoul (argv[c++], NULL, 10); | ||
| 116 | + incoming_warning_threshold = strtoul (argv[c++], &modpos, 10); | ||
| 117 | + incoming_warning_threshold = adjust_threshold(incoming_warning_threshold,&modpos); | ||
| 118 | } | ||
| 119 | |||
| 120 | if (argc > c && incoming_critical_threshold == 0) { | ||
| 121 | - incoming_critical_threshold = strtoul (argv[c++], NULL, 10); | ||
| 122 | + incoming_critical_threshold = strtoul (argv[c++], &modpos, 10); | ||
| 123 | + incoming_critical_threshold = adjust_threshold(incoming_critical_threshold,&modpos); | ||
| 124 | } | ||
| 125 | |||
| 126 | if (argc > c && outgoing_warning_threshold == 0) { | ||
| 127 | - outgoing_warning_threshold = strtoul (argv[c++], NULL, 10); | ||
| 128 | + outgoing_warning_threshold = strtoul (argv[c++], &modpos, 10); | ||
| 129 | + outgoing_warning_threshold = adjust_threshold(outgoing_warning_threshold,&modpos); | ||
| 130 | } | ||
| 131 | |||
| 132 | if (argc > c && outgoing_critical_threshold == 0) { | ||
| 133 | - outgoing_critical_threshold = strtoul (argv[c++], NULL, 10); | ||
| 134 | + outgoing_critical_threshold = strtoul (argv[c++], &modpos, 10); | ||
| 135 | + outgoing_critical_threshold = adjust_threshold(outgoing_critical_threshold,&modpos); | ||
| 136 | } | ||
| 137 | |||
| 138 | return validate_arguments (); | ||
| 139 | } | ||
| 140 | |||
| 141 | - | ||
| 142 | +unsigned long adjust_threshold(unsigned long val, char **pos) | ||
| 143 | +{ | ||
| 144 | + switch(**pos) | ||
| 145 | + { | ||
| 146 | + case 'K': | ||
| 147 | + case 'k': | ||
| 148 | + (*pos)++; | ||
| 149 | + return (val*1024L); | ||
| 150 | + case 'M': | ||
| 151 | + case 'm': | ||
| 152 | + (*pos)++; | ||
| 153 | + return val*1024L*1024L; | ||
| 154 | + case 'G': | ||
| 155 | + case 'm': | ||
| 156 | + (*pos)++; | ||
| 157 | + return val*1024L*1024L*1024L; | ||
| 158 | + default: | ||
| 159 | + return val; | ||
| 160 | + } | ||
| 161 | +} | ||
| 162 | |||
| 163 | |||
| 164 | |||
diff --git a/web/attachments/68846-check_ldap.c.diff b/web/attachments/68846-check_ldap.c.diff new file mode 100644 index 0000000..3d47577 --- /dev/null +++ b/web/attachments/68846-check_ldap.c.diff | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | --- check_ldap.c.orig 2003-01-28 22:16:15.000000000 -0800 | ||
| 2 | +++ check_ldap.c 2003-11-27 01:31:26.810335706 -0800 | ||
| 3 | @@ -50,6 +50,7 @@ | ||
| 4 | unsigned int ld_port = DEFAULT_PORT; | ||
| 5 | int warn_time = UNDEFINED; | ||
| 6 | int crit_time = UNDEFINED; | ||
| 7 | +int protocol_version = 2; | ||
| 8 | |||
| 9 | int | ||
| 10 | main (int argc, char *argv[]) | ||
| 11 | @@ -58,7 +59,7 @@ | ||
| 12 | LDAP *ld; | ||
| 13 | LDAPMessage *result; | ||
| 14 | |||
| 15 | - int t_diff; | ||
| 16 | + int t_diff,rc; | ||
| 17 | time_t time0, time1; | ||
| 18 | |||
| 19 | if (process_arguments (argc, argv) == ERROR) | ||
| 20 | @@ -79,6 +80,8 @@ | ||
| 21 | printf ("Could not connect to the server at port %i\n", ld_port); | ||
| 22 | return STATE_CRITICAL; | ||
| 23 | } | ||
| 24 | + rc = protocol_version; | ||
| 25 | + ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &rc); | ||
| 26 | |||
| 27 | /* bind to the ldap server */ | ||
| 28 | if (ldap_bind_s (ld, ld_binddn, ld_passwd, LDAP_AUTH_SIMPLE) != | ||
| 29 | @@ -145,6 +148,7 @@ | ||
| 30 | {"port", required_argument, 0, 'p'}, | ||
| 31 | {"warn", required_argument, 0, 'w'}, | ||
| 32 | {"crit", required_argument, 0, 'c'}, | ||
| 33 | + {"protocol", required_argument, 0, 'R'}, | ||
| 34 | {0, 0, 0, 0} | ||
| 35 | }; | ||
| 36 | #endif | ||
| 37 | @@ -159,9 +163,9 @@ | ||
| 38 | |||
| 39 | while (1) { | ||
| 40 | #ifdef HAVE_GETOPT_H | ||
| 41 | - c = getopt_long (argc, argv, "hVt:c:w:H:b:p:a:D:P:", longopts, &option_index); | ||
| 42 | + c = getopt_long (argc, argv, "hVt:c:w:H:b:p:a:D:P:R:", longopts, &option_index); | ||
| 43 | #else | ||
| 44 | - c = getopt (argc, argv, "+?hVt:c:w:H:b:p:a:D:P:"); | ||
| 45 | + c = getopt (argc, argv, "+?hVt:c:w:H:b:p:a:D:P:R:"); | ||
| 46 | #endif | ||
| 47 | |||
| 48 | if (c == -1 || c == EOF) | ||
| 49 | @@ -203,6 +207,9 @@ | ||
| 50 | case 'c': | ||
| 51 | crit_time = atoi (optarg); | ||
| 52 | break; | ||
| 53 | + case 'R': | ||
| 54 | + protocol_version = atoi (optarg); | ||
| 55 | + break; | ||
| 56 | default: | ||
| 57 | usage ("check_ldap: could not parse arguments\n"); | ||
| 58 | break; | ||
| 59 | @@ -250,6 +257,7 @@ | ||
| 60 | "\t-D [--bind] ... ldap bind DN (if required)\n" | ||
| 61 | "\t-P [--pass] ... ldap password (if required)\n" | ||
| 62 | "\t-p [--port] ... ldap port (default: %d)\n" | ||
| 63 | + "\t-R [--protocol] ... ldap protocol version (default: 2)\n" | ||
| 64 | "\t-w [--warn] ... time in secs. - if the exceeds <warn> the STATE_WARNING will be returned\n" | ||
| 65 | "\t-c [--crit] ... time in secs. - if the exceeds <crit> the STATE_CRITICAL will be returned\n" | ||
| 66 | "\n", DEFAULT_PORT); | ||
| 67 | @@ -261,6 +269,7 @@ | ||
| 68 | { | ||
| 69 | printf | ||
| 70 | ("Usage: %s -H <host> -b <base_dn> [-p <port>] [-a <attr>] [-D <binddn>]\n" | ||
| 71 | - " [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n" | ||
| 72 | + " [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout] " | ||
| 73 | + "[-R <protocol number>]\n" | ||
| 74 | "(Note: all times are in seconds.)\n", progname); | ||
| 75 | } | ||
diff --git a/web/attachments/69716-check_http.c.diff b/web/attachments/69716-check_http.c.diff new file mode 100644 index 0000000..503f10c --- /dev/null +++ b/web/attachments/69716-check_http.c.diff | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | Index: check_http.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_http.c,v | ||
| 4 | retrieving revision 1.54 | ||
| 5 | diff -u -r1.54 check_http.c | ||
| 6 | --- check_http.c 15 Sep 2003 05:03:47 -0000 1.54 | ||
| 7 | +++ check_http.c 4 Dec 2003 16:00:24 -0000 | ||
| 8 | @@ -837,11 +837,13 @@ | ||
| 9 | /* URI_PATH */ | ||
| 10 | else if (sscanf (pos, HD5, url) == 1) { | ||
| 11 | /* relative url */ | ||
| 12 | + | ||
| 13 | if ((url[0] != '/')) { | ||
| 14 | - if ((x = strrchr(url, '/'))) | ||
| 15 | + if ((x = strrchr(server_url, '/'))) | ||
| 16 | *x = '\0'; | ||
| 17 | - asprintf (&server_url, "%s/%s", server_url, url); | ||
| 18 | + asprintf (&url, "%s/%s", server_url, url); | ||
| 19 | } | ||
| 20 | + | ||
| 21 | i = server_port; | ||
| 22 | strcpy (type, server_type); | ||
| 23 | strcpy (addr, host_name); | ||
| 24 | |||
diff --git a/web/attachments/71990-check_swap.diff b/web/attachments/71990-check_swap.diff new file mode 100644 index 0000000..f443476 --- /dev/null +++ b/web/attachments/71990-check_swap.diff | |||
| @@ -0,0 +1 @@ | |||
| *** ../nagios-plugins-1.4.0alpha1/plugins/check_swap.c Wed Nov 12 05:37:19 2003 --- plugins/check_swap.c Thu Jan 1 19:28:34 2004 *************** *** 82,87 **** --- 82,95 ---- #ifdef HAVE_PROC_MEMINFO fp = fopen (PROC_MEMINFO, "r"); while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, fp)) { + unsigned long tmp; + if(sscanf(input_buffer, "%s %lu", str, &tmp)==2) { + if(!strncmp(str,"SwapTotal",strlen("SwapTotal"))) + total_swap+=(tmp>>10); + else if(!strncmp(str,"SwapFree",strlen("SwapFree"))) + free_swap+=(tmp>>10); + } + /* if (sscanf (input_buffer, " %s %lu %lu %lu", str, &dsktotal, &dskused, &dskfree) == 4 && strstr (str, "Swap")) { dsktotal = dsktotal / 1048576; *************** *** 97,104 **** --- 105,114 ---- asprintf (&status, "%s [%lu (%d%%)]", status, dskfree, 100 - percent); } } + */ } fclose(fp); + used_swap=total_swap-free_swap; #else # ifdef HAVE_SWAP asprintf(&swap_command, "%s", SWAP_COMMAND); *************** *** 240,246 **** check_swap (int usp, long unsigned int free_swap) { int result = STATE_UNKNOWN; - free_swap = free_swap * 1024; /* Convert back to bytes as warn and crit specified in bytes */ if (usp >= 0 && crit_percent != 0 && usp >= (100.0 - crit_percent)) result = STATE_CRITICAL; else if (crit_size > 0 && free_swap <= crit_size) --- 251,256 ---- *************** *** 399,411 **** printf (_("\n\ -w, --warning=INTEGER\n\ ! Exit with WARNING status if less than INTEGER bytes of swap space are free\n\ -w, --warning=PERCENT%%\n\ ! Exit with WARNING status if less than PERCENT of swap space has been used\n\ -c, --critical=INTEGER\n\ ! Exit with CRITICAL status if less than INTEGER bytes of swap space are free\n\ -c, --critical=PERCENT%%\n\ ! Exit with CRITCAL status if less than PERCENT of swap space has been used\n\ -a, --allswaps\n\ Conduct comparisons for all swap partitions, one by one\n")); --- 410,422 ---- printf (_("\n\ -w, --warning=INTEGER\n\ ! Exit with WARNING status if less than INTEGER mega bytes of swap space are free\n\ -w, --warning=PERCENT%%\n\ ! Exit with WARNING status if less than PERCENT of swap space are free\n\ -c, --critical=INTEGER\n\ ! Exit with CRITICAL status if less than INTEGER mega bytes of swap space are free\n\ -c, --critical=PERCENT%%\n\ ! Exit with CRITCAL status if less than PERCENT of swap space are free\n\ -a, --allswaps\n\ Conduct comparisons for all swap partitions, one by one\n")); *************** *** 426,433 **** print_usage (void) { printf (_("Usage:\n\ ! %s [-a] -w <used_percentage>%% -c <used_percentage>%%\n\ ! %s [-a] -w <bytes_free> -c <bytes_free>\n\ %s (-h | --help) for detailed help\n\ %s (-V | --version) for version information\n"), progname, progname, progname, progname); --- 437,444 ---- print_usage (void) { printf (_("Usage:\n\ ! %s [-a] -w <free_percentage>%% -c <free_percentage>%%\n\ ! %s [-a] -w <mega_bytes_free> -c <mega_bytes_free>\n\ %s (-h | --help) for detailed help\n\ %s (-V | --version) for version information\n"), progname, progname, progname, progname); \ No newline at end of file | |||
diff --git a/web/attachments/74206-check_mailq.diffs b/web/attachments/74206-check_mailq.diffs new file mode 100644 index 0000000..67fa086 --- /dev/null +++ b/web/attachments/74206-check_mailq.diffs | |||
| @@ -0,0 +1,178 @@ | |||
| 1 | --- plugins-scripts/utils.pm.in.orig 2004-01-13 12:45:04.000000000 -0500 | ||
| 2 | +++ plugins-scripts/utils.pm.in 2004-01-13 12:45:39.000000000 -0500 | ||
| 3 | @@ -43,6 +43,7 @@ | ||
| 4 | $PATH_TO_SMBCLIENT = "@PATH_TO_SMBCLIENT@" ; | ||
| 5 | $PATH_TO_MAILQ = "@PATH_TO_MAILQ@"; | ||
| 6 | $PATH_TO_QMAIL_QSTAT = "@PATH_TO_QMAIL_QSTAT@"; | ||
| 7 | +$PATH_TO_SENDMAIL_CF = "@PATH_TO_SENDMAIL_CF@"; | ||
| 8 | |||
| 9 | ## common variables | ||
| 10 | $TIMEOUT = 15; | ||
| 11 | --- plugins-scripts/check_mailq.pl.orig 2004-01-13 12:45:47.000000000 -0500 | ||
| 12 | +++ plugins-scripts/check_mailq.pl 2004-01-20 14:53:05.000000000 -0500 | ||
| 13 | @@ -28,15 +28,16 @@ | ||
| 14 | use strict; | ||
| 15 | use Getopt::Long; | ||
| 16 | use vars qw($opt_V $opt_h $opt_v $verbose $PROGNAME $opt_w $opt_c $opt_t | ||
| 17 | - $opt_M $mailq $status $state $msg $msg_q $msg_p $opt_W $opt_C $mailq @lines | ||
| 18 | - %srcdomains %dstdomains); | ||
| 19 | + $opt_M $mailq $status $state $msg $msg_q $msg_p $opt_W $opt_C $opt_f | ||
| 20 | + $mailq @lines %srcdomains %dstdomains); | ||
| 21 | use lib utils.pm; | ||
| 22 | use utils qw(%ERRORS &print_revision &support &usage ); | ||
| 23 | - | ||
| 24 | +use File::Glob ':glob'; | ||
| 25 | |||
| 26 | sub print_help (); | ||
| 27 | sub print_usage (); | ||
| 28 | sub process_arguments (); | ||
| 29 | +sub get_queue_directories (;$); | ||
| 30 | |||
| 31 | $ENV{'PATH'}=''; | ||
| 32 | $ENV{'BASH_ENV'}=''; | ||
| 33 | @@ -47,7 +48,7 @@ | ||
| 34 | $msg_p = 0 ; | ||
| 35 | $state = $ERRORS{'UNKNOWN'}; | ||
| 36 | |||
| 37 | -Getopt::Long::Configure('bundling'); | ||
| 38 | +Getopt::Long::Configure('bundling','no_ignore_case'); | ||
| 39 | $status = process_arguments(); | ||
| 40 | if ($status){ | ||
| 41 | print "ERROR: processing arguments\n"; | ||
| 42 | @@ -64,6 +65,22 @@ | ||
| 43 | |||
| 44 | if ($mailq eq "sendmail") { | ||
| 45 | |||
| 46 | +## get configuration file, and from that, the queue directories | ||
| 47 | + my @queuedirs=(); | ||
| 48 | + my $configfile=""; | ||
| 49 | + if ( defined($opt_f) && -r $opt_f ) { | ||
| 50 | + $configfile="-C$opt_f"; | ||
| 51 | + @queuedirs=get_queue_directories($opt_f); | ||
| 52 | + }else { | ||
| 53 | + @queuedirs=get_queue_directories(); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + if (!defined($queuedirs[0])) { | ||
| 57 | + print "UNKNOWN: check_mailq: no queue directories | msq_q = 0\n"; | ||
| 58 | + exit $ERRORS{"UNKNOWN"}; | ||
| 59 | + } | ||
| 60 | + my $qpattern=join("|",@queuedirs); | ||
| 61 | + | ||
| 62 | ## open mailq | ||
| 63 | if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { | ||
| 64 | if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { | ||
| 65 | @@ -163,21 +180,16 @@ | ||
| 66 | |||
| 67 | # Finally look at the overall queue length | ||
| 68 | # | ||
| 69 | - if (/mqueue/) { | ||
| 70 | + # the pattern helps us get one or more queue directories, and adds up | ||
| 71 | + # all the requests | ||
| 72 | + if (/\b$qpattern\b/) { | ||
| 73 | print "$utils::PATH_TO_MAILQ = $_ "if $verbose ; | ||
| 74 | - if (/ \((\d+) request/) { | ||
| 75 | - # | ||
| 76 | - # single queue: first line | ||
| 77 | - # multi queue: one for each queue. overwrite on multi queue below | ||
| 78 | - $msg_q = $1 ; | ||
| 79 | + if (/empty/) { | ||
| 80 | + }elsif (/\((\d+)\s*requests\)/i) { | ||
| 81 | + $msg_q+=$1; | ||
| 82 | + print "size = $1, msg_q = $msg_q warn=$opt_w crit=$opt_c\n" if $verbose; | ||
| 83 | } | ||
| 84 | - } elsif (/^\s+Total\sRequests:\s(\d+)$/) { | ||
| 85 | - print "$utils::PATH_TO_MAILQ = $_ \n" if $verbose ; | ||
| 86 | - # | ||
| 87 | - # multi queue: last line | ||
| 88 | - $msg_q = $1 ; | ||
| 89 | } | ||
| 90 | - | ||
| 91 | } | ||
| 92 | |||
| 93 | |||
| 94 | @@ -519,7 +531,8 @@ | ||
| 95 | "c=i" => \$opt_c, "critical=i" => \$opt_c, # critical if above this number | ||
| 96 | "W=i" => \$opt_W, "Warning=i" => \$opt_W, # warning if above this number | ||
| 97 | "C=i" => \$opt_C, "Critical=i" => \$opt_C, # critical if above this number | ||
| 98 | - "t=i" => \$opt_t, "timeout=i" => \$opt_t | ||
| 99 | + "t=i" => \$opt_t, "timeout=i" => \$opt_t, | ||
| 100 | + "f=s" => \$opt_f, "configfile" => \$opt_f | ||
| 101 | ); | ||
| 102 | |||
| 103 | if ($opt_V) { | ||
| 104 | @@ -572,12 +585,19 @@ | ||
| 105 | }else{ | ||
| 106 | $mailq = 'sendmail' ; | ||
| 107 | } | ||
| 108 | + | ||
| 109 | + if (defined $opt_f) { | ||
| 110 | + if (! -r $opt_f) { | ||
| 111 | + print "Can't read config file (-f): $opt_f!W\n"; | ||
| 112 | + exit $ERRORS{'UNKNOWN'}; | ||
| 113 | + } | ||
| 114 | + } | ||
| 115 | |||
| 116 | return $ERRORS{'OK'}; | ||
| 117 | } | ||
| 118 | |||
| 119 | sub print_usage () { | ||
| 120 | - print "Usage: $PROGNAME -w <warn> -c <crit> [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-v verbose]\n"; | ||
| 121 | + print "Usage: $PROGNAME -w <warn> -c <crit> [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-v verbose] [-f configfile]\n"; | ||
| 122 | } | ||
| 123 | |||
| 124 | sub print_help () { | ||
| 125 | @@ -594,6 +614,7 @@ | ||
| 126 | print "-C (--Critical) = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n"; | ||
| 127 | print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n"; | ||
| 128 | print "-M (--mailserver) = [ sendmail | qmail | postfix | exim ] (default = sendmail)\n"; | ||
| 129 | + print "-f (--configfile) = configuration file for sendmail (default = $utils::PATH_TO_SENDMAIL_CF)\n"; | ||
| 130 | print "-h (--help)\n"; | ||
| 131 | print "-V (--version)\n"; | ||
| 132 | print "-v (--verbose) = debugging output\n"; | ||
| 133 | @@ -608,3 +629,45 @@ | ||
| 134 | print "\n\n"; | ||
| 135 | support(); | ||
| 136 | } | ||
| 137 | + | ||
| 138 | +sub get_queue_directories (;$) | ||
| 139 | +{ | ||
| 140 | + my $cfin=shift; | ||
| 141 | + my @cfs=(); | ||
| 142 | + my @qdirs=(); | ||
| 143 | + | ||
| 144 | + if ($cfin) { | ||
| 145 | + @cfs=($cfin); | ||
| 146 | + }else { | ||
| 147 | + if (-r $utils::PATH_TO_SENDMAIL_CF) { | ||
| 148 | + @cfs=($utils::PATH_TO_SENDMAIL_CF); | ||
| 149 | + }else { | ||
| 150 | + @cfs=qw(/etc/mail/sendmail.cf); | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + my @cffiles=grep { -r $_} @cfs; | ||
| 155 | + if (scalar(@cffiles)==0) { | ||
| 156 | + warn "unable to find a sendmail configuration file"; | ||
| 157 | + return (undef); | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + my $qdir; | ||
| 161 | + foreach my $cf (@cffiles) { | ||
| 162 | + if (open(CF,$cf)) { | ||
| 163 | + while(<CF>) { | ||
| 164 | + chomp; | ||
| 165 | + next unless (/^O\s*QueueDirectory=(.*)$/ && ($qdir=$1)); | ||
| 166 | + push(@qdirs,bsd_glob($qdir)); | ||
| 167 | + last; | ||
| 168 | + } | ||
| 169 | + } | ||
| 170 | + close(CF); | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + if (@qdirs==0) { | ||
| 174 | + warn "no QueueDirectory variable found in sendmail configuration file"; | ||
| 175 | + return (undef); | ||
| 176 | + }; | ||
| 177 | + return @qdirs; | ||
| 178 | +} | ||
diff --git a/web/attachments/75985-nagios_check_ping.patch b/web/attachments/75985-nagios_check_ping.patch new file mode 100644 index 0000000..6fd59cf --- /dev/null +++ b/web/attachments/75985-nagios_check_ping.patch | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | Index: check_ping.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ping.c,v | ||
| 4 | retrieving revision 1.25 | ||
| 5 | diff -u -r1.25 check_ping.c | ||
| 6 | --- check_ping.c 12 Sep 2003 11:38:32 -0000 1.25 | ||
| 7 | +++ check_ping.c 7 Feb 2004 01:42:33 -0000 | ||
| 8 | @@ -74,7 +74,8 @@ | ||
| 9 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 10 | textdomain (PACKAGE); | ||
| 11 | |||
| 12 | - addresses = malloc ((size_t)max_addr); | ||
| 13 | + addresses = malloc (sizeof(char*) * max_addr); | ||
| 14 | + addresses[0] = NULL; | ||
| 15 | |||
| 16 | if (process_arguments (argc, argv) == ERROR) | ||
| 17 | usage (_("Could not parse arguments")); | ||
| 18 | @@ -228,7 +229,7 @@ | ||
| 19 | n_addresses++; | ||
| 20 | if (n_addresses > max_addr) { | ||
| 21 | max_addr *= 2; | ||
| 22 | - addresses = realloc (addresses, (size_t)max_addr); | ||
| 23 | + addresses = realloc (addresses, sizeof(char*) * max_addr); | ||
| 24 | if (addresses == NULL) | ||
| 25 | die (STATE_UNKNOWN, _("Could not realloc() addresses\n")); | ||
| 26 | } | ||
| 27 | @@ -272,6 +273,7 @@ | ||
| 28 | return ERROR; | ||
| 29 | } else { | ||
| 30 | addresses[0] = argv[c++]; | ||
| 31 | + n_addresses++; | ||
| 32 | if (c == argc) | ||
| 33 | return validate_arguments (); | ||
| 34 | } | ||
diff --git a/web/attachments/75986-nagios_check_ping.patch b/web/attachments/75986-nagios_check_ping.patch new file mode 100644 index 0000000..6fd59cf --- /dev/null +++ b/web/attachments/75986-nagios_check_ping.patch | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | Index: check_ping.c | ||
| 2 | =================================================================== | ||
| 3 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ping.c,v | ||
| 4 | retrieving revision 1.25 | ||
| 5 | diff -u -r1.25 check_ping.c | ||
| 6 | --- check_ping.c 12 Sep 2003 11:38:32 -0000 1.25 | ||
| 7 | +++ check_ping.c 7 Feb 2004 01:42:33 -0000 | ||
| 8 | @@ -74,7 +74,8 @@ | ||
| 9 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 10 | textdomain (PACKAGE); | ||
| 11 | |||
| 12 | - addresses = malloc ((size_t)max_addr); | ||
| 13 | + addresses = malloc (sizeof(char*) * max_addr); | ||
| 14 | + addresses[0] = NULL; | ||
| 15 | |||
| 16 | if (process_arguments (argc, argv) == ERROR) | ||
| 17 | usage (_("Could not parse arguments")); | ||
| 18 | @@ -228,7 +229,7 @@ | ||
| 19 | n_addresses++; | ||
| 20 | if (n_addresses > max_addr) { | ||
| 21 | max_addr *= 2; | ||
| 22 | - addresses = realloc (addresses, (size_t)max_addr); | ||
| 23 | + addresses = realloc (addresses, sizeof(char*) * max_addr); | ||
| 24 | if (addresses == NULL) | ||
| 25 | die (STATE_UNKNOWN, _("Could not realloc() addresses\n")); | ||
| 26 | } | ||
| 27 | @@ -272,6 +273,7 @@ | ||
| 28 | return ERROR; | ||
| 29 | } else { | ||
| 30 | addresses[0] = argv[c++]; | ||
| 31 | + n_addresses++; | ||
| 32 | if (c == argc) | ||
| 33 | return validate_arguments (); | ||
| 34 | } | ||
diff --git a/web/attachments/76452-check_mem.diff b/web/attachments/76452-check_mem.diff new file mode 100644 index 0000000..01d0d97 --- /dev/null +++ b/web/attachments/76452-check_mem.diff | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | --- check_mem.pl 2002-02-28 00:42:54.000000000 -0600 | ||
| 2 | +++ /home/jason/check_mem.pl 2004-02-12 06:20:21.000000000 -0600 | ||
| 3 | @@ -27,7 +27,8 @@ | ||
| 4 | $crit_level $warn_level | ||
| 5 | %exit_codes @memlist | ||
| 6 | $percent $fmt_pct | ||
| 7 | - $verb_err $command_line); | ||
| 8 | + $verb_err $command_line | ||
| 9 | + $vmstat_version); | ||
| 10 | |||
| 11 | # Predefined exit codes for Nagios | ||
| 12 | %exit_codes = ('UNKNOWN' ,-1, | ||
| 13 | @@ -39,7 +40,14 @@ | ||
| 14 | $verb_err = 0; | ||
| 15 | |||
| 16 | # This the unix command string that brings Perl the data | ||
| 17 | -$command_line = `vmstat | tail -1 | awk '{print \$4,\$5}'`; | ||
| 18 | +my $vmstat_version = `vmstat -V`; | ||
| 19 | +if( $vmstat_version =~ /2\.\d\.\d$/ ){ | ||
| 20 | + $command_line = `vmstat | tail -1 | awk '{print \$4,\$5}'`; | ||
| 21 | +}elsif( $vmstat_version =~ /3\.\d\.\d$/ ){ | ||
| 22 | + $command_line = `vmstat | tail -1 | awk '{print \$3,\$4}'`; | ||
| 23 | +}else{ | ||
| 24 | + $command_line = `vmstat | tail -1 | awk '{print \$4,\$5}'`; | ||
| 25 | +} | ||
| 26 | |||
| 27 | chomp $command_line; | ||
| 28 | @memlist = split(/ /, $command_line); | ||
| 29 | @@ -89,6 +97,7 @@ | ||
| 30 | if ($opt_f) | ||
| 31 | { | ||
| 32 | $percent = $free_memory / $total_memory * 100; | ||
| 33 | + warn "$percent\n"; | ||
| 34 | $fmt_pct = sprintf "%.1f", $percent; | ||
| 35 | if ($percent <= $crit_level) | ||
| 36 | { | ||
diff --git a/web/attachments/76454-check_pop3.diff b/web/attachments/76454-check_pop3.diff new file mode 100644 index 0000000..3e50a14 --- /dev/null +++ b/web/attachments/76454-check_pop3.diff | |||
| @@ -0,0 +1,110 @@ | |||
| 1 | --- check_pop3.pl 2004-01-05 16:43:27.000000000 -0600 | ||
| 2 | +++ /home/jason/sf/nagiosplug/contrib/check_pop3.pl 2002-02-28 00:42:53.000000000 -0600 | ||
| 3 | @@ -23,29 +23,6 @@ | ||
| 4 | # with perl -wT and 'use strict' | ||
| 5 | # 2000/01/20 RM Corrected POP3 Exit State. | ||
| 6 | # 2000/01/21 RM Fix Exit Codes Again!! | ||
| 7 | -# 2003/12/30 CZ Proper CRLF in communication w/server | ||
| 8 | -# Fixed infinite loop | ||
| 9 | -# Error checking on welcome banner, USER, PASS commands | ||
| 10 | -# Better error condition handling | ||
| 11 | -# This could probably be much much smaller using Net::POP3, | ||
| 12 | -# but I haven't looked into its error conditions yet, and I | ||
| 13 | -# don't think you can specify remote port. | ||
| 14 | - | ||
| 15 | -=cut | ||
| 16 | - | ||
| 17 | -use Net::POP3; | ||
| 18 | - | ||
| 19 | -my $pop = new Net::POP3("$ARGV[0]", Timeout => 60); | ||
| 20 | -my $ret = $pop->login("$ARGV[1]","$ARGV[2]"); | ||
| 21 | -$pop->quit(); | ||
| 22 | - | ||
| 23 | -do { print "some error msg\n"; exit 2; } unless defined $ret; | ||
| 24 | - | ||
| 25 | -print "POP3 OK - ".int($ret)." messages\n"; | ||
| 26 | -exit 0; | ||
| 27 | - | ||
| 28 | -=cut | ||
| 29 | - | ||
| 30 | # ------------------------------------------------------------------------------ | ||
| 31 | |||
| 32 | # -----------------------------------------------------------------[ Require ]-- | ||
| 33 | @@ -120,56 +97,47 @@ | ||
| 34 | my $ClientSocket = &bindRemote($remotehost,$remoteport,$hostname); | ||
| 35 | |||
| 36 | |||
| 37 | - err("no welcome banner\n") unless $_ = <ClientSocket>; | ||
| 38 | - err("bad welcome banner: " . $_) unless $_ =~ /^\+OK/; | ||
| 39 | +print ClientSocket "user $username\n"; | ||
| 40 | |||
| 41 | - print ClientSocket "USER $username\r\n"; | ||
| 42 | +#Debug Server | ||
| 43 | +#print "user $username\n"; | ||
| 44 | |||
| 45 | - #Debug Server | ||
| 46 | - #print "user $username\n"; | ||
| 47 | +#Sleep or 3 secs, incase server is slow. | ||
| 48 | +sleep 3; | ||
| 49 | |||
| 50 | - err("no response to USER command\n") unless $_ = <ClientSocket>; | ||
| 51 | - err("bad response to USER: " . $_) unless $_ =~ /^\+OK/; | ||
| 52 | +print ClientSocket "pass $password\n"; | ||
| 53 | |||
| 54 | - print ClientSocket "PASS $password\r\n"; | ||
| 55 | +#Debug Server | ||
| 56 | +#print "pass $password\n"; | ||
| 57 | |||
| 58 | - #Debug Server | ||
| 59 | - #print "pass $password\n"; | ||
| 60 | +while (<ClientSocket>) { | ||
| 61 | |||
| 62 | - err("no response to PASS command\n") unless $_ = <ClientSocket>; | ||
| 63 | - err("bad response to PASS: " . $_) unless $_ =~ /^\+OK/; | ||
| 64 | +print ClientSocket "pass $password\n"; | ||
| 65 | |||
| 66 | - print ClientSocket "LIST\r\n"; | ||
| 67 | +#Debug Server | ||
| 68 | +#print $_; | ||
| 69 | |||
| 70 | - my $bad = 1; | ||
| 71 | - my $msgs = 0; | ||
| 72 | - while (<ClientSocket>) { | ||
| 73 | - #Debug Server | ||
| 74 | - #print $_; | ||
| 75 | - | ||
| 76 | - err(($1||' UNKNOWN')."\n") if (m/\-ERR(.*)/); | ||
| 77 | - $bad = 0 if /^\+OK/; | ||
| 78 | - $msgs = $1 if /^(\d+)\s+/; | ||
| 79 | - last if /^\./; | ||
| 80 | - } | ||
| 81 | - &message("$msgs\n") unless $bad; | ||
| 82 | - err("missing +OK to LIST command\n"); | ||
| 83 | +err($_) if (m/\-ERR\s+(.*)\s+.*/); | ||
| 84 | +message($_) if (m/\+OK Mailbox open,\s+(.*\d)\s+messages.*/); | ||
| 85 | +} | ||
| 86 | } | ||
| 87 | |||
| 88 | sub message | ||
| 89 | { | ||
| 90 | - my $answer = "POP3 OK - Total Messages On Server: ".shift(); | ||
| 91 | + my $answer = "UNKNOWN"; | ||
| 92 | + $answer = "Pop3 OK - Total Messages On Server :- $1"; | ||
| 93 | alarm(0); | ||
| 94 | - print ClientSocket "QUIT\r\n"; | ||
| 95 | + print ClientSocket "quit\n"; | ||
| 96 | print "$answer"; | ||
| 97 | exit 0; | ||
| 98 | } | ||
| 99 | |||
| 100 | sub err | ||
| 101 | { | ||
| 102 | - my $answer = "POP3 Error:".shift(); | ||
| 103 | + my $answer = "UNKNOWN"; | ||
| 104 | + $answer = "Pop3 Error :- $1"; | ||
| 105 | alarm(0); | ||
| 106 | - print ClientSocket "QUIT\r\n"; | ||
| 107 | + print ClientSocket "quit\n"; | ||
| 108 | print "$answer"; | ||
| 109 | exit 2; | ||
| 110 | } | ||
diff --git a/web/attachments/78851-check_disk-typo.patch b/web/attachments/78851-check_disk-typo.patch new file mode 100644 index 0000000..cf8cfcd --- /dev/null +++ b/web/attachments/78851-check_disk-typo.patch | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | --- check_disk.c.orig Wed Mar 3 11:19:38 2004 | ||
| 2 | +++ check_disk.c Wed Mar 3 11:19:49 2004 | ||
| 3 | @@ -373,7 +373,7 @@ | ||
| 4 | mult = 1024 * 1024; | ||
| 5 | if (units) | ||
| 6 | free(units); | ||
| 7 | - units = strdup ("kB"); | ||
| 8 | + units = strdup ("MB"); | ||
| 9 | break; | ||
| 10 | case 'l': | ||
| 11 | show_local_fs = 1; | ||
diff --git a/web/attachments/79492-check_ping.c.diff b/web/attachments/79492-check_ping.c.diff new file mode 100644 index 0000000..8a201cf --- /dev/null +++ b/web/attachments/79492-check_ping.c.diff | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | --- check_ping.c.orig 2003-01-13 06:15:16.000000000 -0600 | ||
| 2 | +++ check_ping.c 2004-03-09 13:56:46.000000000 -0600 | ||
| 3 | @@ -391,6 +391,11 @@ | ||
| 4 | &pl) == 1 | ||
| 5 | || sscanf | ||
| 6 | (input_buffer, "%*d packets transmitted, %*d packets received, %d%% loss, time", &pl) == 1 | ||
| 7 | + || sscanf | ||
| 8 | + (input_buffer, "%*d packets transmitted, %*d received, +%*d errors, %d%% packet loss, time", &pl) == 1 | ||
| 9 | + /* RHES 3.0 as reported by Todd A. Green | ||
| 10 | + Note: This must come before the Suse line below | ||
| 11 | + */ | ||
| 12 | || sscanf | ||
| 13 | (input_buffer, "%*d packets transmitted, %*d received, %d%% loss, time", &pl) == 1 | ||
| 14 | /* Suse 8.0 as reported by Richard * Brodie */ | ||
diff --git a/web/attachments/80952-check_disk.patch b/web/attachments/80952-check_disk.patch new file mode 100644 index 0000000..be3e5ba --- /dev/null +++ b/web/attachments/80952-check_disk.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-5 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378819578" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378819578" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378819578" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378819578" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378819578'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=921082&group_id=29880&atid=397599&file_id=80952" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/80961-check_disk.patch.macosx b/web/attachments/80961-check_disk.patch.macosx new file mode 100644 index 0000000..adc34ec --- /dev/null +++ b/web/attachments/80961-check_disk.patch.macosx | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | <!doctype html> | ||
| 2 | <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"><![endif]--> | ||
| 3 | <!--[if IE 7 ]> <html lang="en" class="no-js ie7"><![endif]--> | ||
| 4 | <!--[if IE 8 ]> <html lang="en" class="no-js ie8"><![endif]--> | ||
| 5 | <!--[if IE 9 ]> <html lang="en" class="no-js ie9"><![endif]--> | ||
| 6 | <!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]--> | ||
| 7 | <head> | ||
| 8 | |||
| 9 | <meta charset="utf-8"> | ||
| 10 | <!--SourceForge.net: Find and Build Open Source Software--> | ||
| 11 | <!--Copyright (c) 1999-2013 SourceForge, Inc. All rights reserved.--> | ||
| 12 | <!-- Create Server: sfs-web-5 --> | ||
| 13 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
| 14 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 15 | <meta name="description" content="SourceForge.net. Fast, secure and free downloads from the largest Open Source applications and software directory." /> | ||
| 16 | <meta name="keywords" content="Open Source, Development, Community, Source Code, Downloads, Software" /> | ||
| 17 | <title>SourceForge.net: ERROR</title> <link href='//fonts.googleapis.com/css?family=Ubuntu:regular,bold' rel='stylesheet' type='text/css'> | ||
| 18 | <style type="text/css"> | ||
| 19 | @font-face { | ||
| 20 | font-family: "Pictos"; | ||
| 21 | src: url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.eot'); | ||
| 22 | src: local("☺"), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.woff') format('woff'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.ttf') format('truetype'), url('http://static.sourceforge.net/include/fonts/sftheme/pictos-web.svg') format('svg'); | ||
| 23 | } | ||
| 24 | #site-header .logo span { | ||
| 25 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/logo.png"); | ||
| 26 | } | ||
| 27 | #site-footer .wrapper { | ||
| 28 | background-image: url("http://static.sourceforge.net/images/neotheme/sftheme/sf-footer-logo.png") !important; | ||
| 29 | } | ||
| 30 | </style> | ||
| 31 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/style.php?secure=0&1378819577" media="all" /> | ||
| 32 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/global.php?secure=0&1378819577" media="all" /> | ||
| 33 | |||
| 34 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/neotheme/sfx.css?1378819577" media="all" /> | ||
| 35 | <link rel="stylesheet" type="text/css" href="http://static.sourceforge.net/css/develop/droppy.php?secure=0&1378819577" media="all" /> | ||
| 36 | <!-- --> | ||
| 37 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/modernizr.custom.90514.js"></script> | ||
| 38 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery-1.3.2.min.js"></script> | ||
| 39 | <script type="text/javascript"> | ||
| 40 | |||
| 41 | jQuery.noConflict(); | ||
| 42 | |||
| 43 | </script> | ||
| 44 | |||
| 45 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.cookie.js"></script> | ||
| 46 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.droppy.js"></script> | ||
| 47 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sylvester.js"></script> | ||
| 48 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/pb.transformie.js"></script> | ||
| 49 | <script type='text/javascript'> | ||
| 50 | jQuery(function(){ | ||
| 51 | jQuery('.b-hornav > li:last-child').addClass('last'); | ||
| 52 | jQuery('.b-hornav > li').each(function() { | ||
| 53 | jQuery('li[class!=disabled]', this).eq(0).addClass('first'); | ||
| 54 | }); | ||
| 55 | jQuery('.b-hornav').droppy({speed:0, delay:0}); | ||
| 56 | }); | ||
| 57 | </script> | ||
| 58 | |||
| 59 | <script type="text/javascript"> | ||
| 60 | var sf_proj_home = 'http://sourceforge.net/projects/nagiosplug'; | ||
| 61 | var _visitor = ""; | ||
| 62 | var jsonly = document.createElement('link'); | ||
| 63 | jsonly.setAttribute('rel', 'stylesheet'); | ||
| 64 | jsonly.setAttribute('type', 'text/css'); | ||
| 65 | jsonly.setAttribute('href', 'http://static.sourceforge.net/css/phoneix/jsonly.css?secure=0&1378819577'); | ||
| 66 | document.getElementsByTagName('head')[0].appendChild(jsonly); | ||
| 67 | </script> | ||
| 68 | <!-- DoubleClick Random Number --> | ||
| 69 | <script type="text/javascript">var dfp_ord=Math.random()*10000000000000000; var dfp_tile = 1; var dfp_ptile = 1;</script> | ||
| 70 | <!-- End DoubleClick Random Number --> | ||
| 71 | <!-- After META tags --> | ||
| 72 | |||
| 73 | <script type="text/javascript" src="http://static.sourceforge.net/sfx.js"></script> | ||
| 74 | |||
| 75 | <script type="text/javascript"> | ||
| 76 | var _gaq = _gaq || []; | ||
| 77 | _gaq.push(['t1._setAccount', 'UA-32013-6']); | ||
| 78 | _gaq.push(['t1._trackPageview']); | ||
| 79 | _gaq.push(['t2._setAccount', 'UA-36130941-1']); | ||
| 80 | _gaq.push(['t2._trackPageview']); | ||
| 81 | (function() { | ||
| 82 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 83 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 84 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); | ||
| 85 | })(); | ||
| 86 | </script> | ||
| 87 | <script type="text/javascript" src="http://static.sourceforge.net/include/jquery/jquery.notify.js"></script> | ||
| 88 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/header.js"></script> | ||
| 89 | </head> | ||
| 90 | |||
| 91 | <body id="c2" class="short-head"> | ||
| 92 | |||
| 93 | <!--[if IE 7]><div id="ie7only"><![endif]--> | ||
| 94 | <!--[if IE 6]><div id="ie6only"><![endif]--> | ||
| 95 | <!--[if IE]><div id="ieonly"><![endif]--> | ||
| 96 | |||
| 97 | <div class="pg_error"> | ||
| 98 | <header id="site-header"> | ||
| 99 | <div class="wrapper"> | ||
| 100 | <a href="/" class="logo"> | ||
| 101 | <span>SourceForge</span> | ||
| 102 | </a> | ||
| 103 | <form method="get" action="/directory/"> | ||
| 104 | <input type="text" id="words" name="q" placeholder="Search"> | ||
| 105 | </form> | ||
| 106 | <nav id="nav-site"> | ||
| 107 | <a href="/directory/" title="Browse our software.">Browse</a> | ||
| 108 | <a href="/directory/enterprise" title="Browse our Enterprise software.">Enterprise</a> | ||
| 109 | <a href="/blog/" title="Read the latest news from the SF HQ.">Blog</a> | ||
| 110 | <a href="/support" title="Contact us for help and feedback.">Help</a> | ||
| 111 | <a href="/jobs?source=header" title="Search 80k+ tech jobs." class="featured-link">Jobs</a> | ||
| 112 | </nav> | ||
| 113 | <nav id="nav-account"> | ||
| 114 | <div class="logged_out"> | ||
| 115 | <a href="https://sourceforge.net/account/login.php">Log In</a> | ||
| 116 | <span>or</span> | ||
| 117 | <a href="https://sourceforge.net/user/registration">Join</a> | ||
| 118 | </div> | ||
| 119 | </nav> | ||
| 120 | </div> | ||
| 121 | </header> | ||
| 122 | <header id="site-sec-header"> | ||
| 123 | <div class="wrapper"> | ||
| 124 | <nav id="nav-hubs"> | ||
| 125 | <h4>Solution Centers</h4> | ||
| 126 | <a href="http://ibmsmartercommerce.sourceforge.net/">Smarter Commerce</a> | ||
| 127 | <a href="http://goparallel.sourceforge.net/">Go Parallel</a> | ||
| 128 | <a href="http://html5center.sourceforge.net/">HTML5</a> | ||
| 129 | <a href="http://ibmsmarteritservices.sourceforge.net/">Smarter IT</a> | ||
| 130 | </nav> | ||
| 131 | <nav id="nav-collateral"> | ||
| 132 | <a href="http://library.slashdotmedia.com/?source=sfnet_header">Resources</a> | ||
| 133 | <a href="https://sourceforge.net/user/registration/">Newsletters</a> | ||
| 134 | </nav> | ||
| 135 | </div> | ||
| 136 | </header> | ||
| 137 | <div id="page-body"> | ||
| 138 | <div id="bd" class="inner-bd"> | ||
| 139 | <div id="doc4" class="yui-t6"> | ||
| 140 | <div id="breadcrumbs"> | ||
| 141 | <a href="/">Home</a> | ||
| 142 | / <a href="/tracker/download.php?aid=921082&group_id=29880&atid=397599&file_id=80961" class="selected">Error</a> | ||
| 143 | </div> | ||
| 144 | <!-- begin content --> | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | <h1 class="titlebar">There was an error processing your request ...</h1> | ||
| 149 | |||
| 150 | <br /> | ||
| 151 | |||
| 152 | <h4 class="error">ERROR | ||
| 153 | <br /> | ||
| 154 | <small> | ||
| 155 | ArtifactFile: Invalid ArtifactFile ID | ||
| 156 | |||
| 157 | </small> | ||
| 158 | </h4> | ||
| 159 | |||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | |||
| 164 | <footer id="site-footer"> | ||
| 165 | <div class="wrapper"> | ||
| 166 | <nav> | ||
| 167 | <h5>SourceForge</h5> | ||
| 168 | <a href="/about">About</a> | ||
| 169 | <a href="/blog/category/sitestatus/">Site Status</a> | ||
| 170 | <a href="http://twitter.com/sfnet_ops">@sfnet_ops</a> | ||
| 171 | </nav> | ||
| 172 | <nav> | ||
| 173 | <h5>Find and Develop Software</h5> | ||
| 174 | <a href="/create/">Create a Project</a> | ||
| 175 | <a href="/directory/">Software Directory</a> | ||
| 176 | <a href="/top">Top Downloaded Projects</a> | ||
| 177 | </nav> | ||
| 178 | <nav> | ||
| 179 | <h5>Community</h5> | ||
| 180 | <a href="/blog/">Blog</a> | ||
| 181 | <a href="http://twitter.com/sourceforge">@sourceforge</a> | ||
| 182 | <a href="/jobs?source=footer">Job Board</a> | ||
| 183 | <a href="http://library.slashdotmedia.com/?source=sfnet_footer">Resources</a> | ||
| 184 | </nav> | ||
| 185 | <nav> | ||
| 186 | <h5>Help</h5> | ||
| 187 | <a href="http://p.sf.net/sourceforge/docs">Site Documentation</a> | ||
| 188 | <a href="/support">Support Request</a> | ||
| 189 | <a href="http://p.sf.net/sourceforge/irc">Real-Time Support</a> | ||
| 190 | </nav> | ||
| 191 | </div> | ||
| 192 | </footer> | ||
| 193 | <footer id="site-copyright-footer"> | ||
| 194 | <div class="wrapper"> | ||
| 195 | <div id="copyright"> | ||
| 196 | Copyright © 2013 SourceForge. All Rights Reserved.<br /> | ||
| 197 | SourceForge is a <a href="http://www.diceholdingsinc.com/phoenix.zhtml?c=211152&p=irol-landing">Dice Holdings, Inc.</a> company. | ||
| 198 | </div> | ||
| 199 | <nav> | ||
| 200 | <a href="http://slashdotmedia.com/terms-of-use">Terms</a> | ||
| 201 | <a href="http://slashdotmedia.com/privacy-statement/">Privacy</a> | ||
| 202 | <a href="http://slashdotmedia.com/opt-out-choices">Cookies/Opt Out</a> | ||
| 203 | <a href="http://slashdotmedia.com">Advertise</a> | ||
| 204 | <a href="http://sourceforge.jp/">SourceForge.JP</a> | ||
| 205 | </nav> | ||
| 206 | </div> | ||
| 207 | </footer> | ||
| 208 | <!--[if lt IE 7 ]> | ||
| 209 | <script type="text/javascript" src="http://static.sourceforge.net/include/js/sftheme/dd_belatedpng.js"></script> | ||
| 210 | <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
| 211 | <![endif]--> | ||
| 212 | <!--[if IE]></div><![endif]--> | ||
| 213 | <!--[if IE 6]></div><![endif]--> | ||
| 214 | <!--[if IE 7]></div><![endif]--> | ||
| 215 | |||
| 216 | |||
| 217 | <!-- Begin comScore Tag --> | ||
| 218 | <script> | ||
| 219 | document.write(unescape("%3Cscript src='" + (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js' %3E%3C/script%3E")); | ||
| 220 | </script> | ||
| 221 | <script> | ||
| 222 | COMSCORE.beacon({ | ||
| 223 | c1:2, | ||
| 224 | c2:6035546, | ||
| 225 | c3:"", | ||
| 226 | c4:"", | ||
| 227 | c5:"", | ||
| 228 | c6:"", | ||
| 229 | c15:"" | ||
| 230 | }); | ||
| 231 | </script> | ||
| 232 | <noscript> | ||
| 233 | <img src="http://b.scorecardresearch.com/p?c1=2&c2=6035546&c3=&c4=&c5=&c6=&c15=&cj=1" /> | ||
| 234 | </noscript> | ||
| 235 | <!-- End comScore Tag --> | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | </div> | ||
| 242 | </body> | ||
| 243 | </html> | ||
diff --git a/web/attachments/80964-check_disk.patch.linux b/web/attachments/80964-check_disk.patch.linux new file mode 100644 index 0000000..f66ea33 --- /dev/null +++ b/web/attachments/80964-check_disk.patch.linux | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | --- check_disk.c 2004-03-22 16:54:43.000000000 +0000 | ||
| 2 | +++ ./nagios-plugins-1.3.1/plugins/check_disk.c 2003-07-11 07:03:47.000000000 +0100 | ||
| 3 | @@ -94,9 +94,8 @@ | ||
| 4 | |||
| 5 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 6 | |||
| 7 | - if (index (input_buffer, '/') != input_buffer) { | ||
| 8 | - continue; | ||
| 9 | - } | ||
| 10 | + if (!index (input_buffer, '/')) | ||
| 11 | + continue; | ||
| 12 | |||
| 13 | /* Fixes AIX /proc fs which lists - for size values */ | ||
| 14 | if (strstr (input_buffer, "/proc ") == input_buffer) | ||
diff --git a/web/attachments/80965-check_disk.patch.macosx b/web/attachments/80965-check_disk.patch.macosx new file mode 100644 index 0000000..11965fd --- /dev/null +++ b/web/attachments/80965-check_disk.patch.macosx | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | --- check_disk.c Fri Jul 11 07:03:47 2003 | ||
| 2 | +++ /tmp/check_disk.c Mon Mar 22 16:57:34 2004 | ||
| 3 | @@ -94,8 +94,9 @@ | ||
| 4 | |||
| 5 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
| 6 | |||
| 7 | - if (!index (input_buffer, '/')) | ||
| 8 | - continue; | ||
| 9 | + if (index (input_buffer, '/') != input_buffer) { | ||
| 10 | + continue; | ||
| 11 | + } | ||
| 12 | |||
| 13 | /* Fixes AIX /proc fs which lists - for size values */ | ||
| 14 | if (strstr (input_buffer, "/proc ") == input_buffer) | ||
| 15 | |||
diff --git a/web/attachments/81737-nagios-plugins--check-disk-smb--compare_levels_after_kMG_decoding b/web/attachments/81737-nagios-plugins--check-disk-smb--compare_levels_after_kMG_decoding new file mode 100644 index 0000000..1611f41 --- /dev/null +++ b/web/attachments/81737-nagios-plugins--check-disk-smb--compare_levels_after_kMG_decoding | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | --- ./check_disk_smb.compare_levels_after_kMG_decoding 2004-03-29 13:30:31.000000000 +0100 | ||
| 2 | +++ ./check_disk_smb 2004-03-29 13:38:37.000000000 +0100 | ||
| 3 | @@ -92,16 +92,6 @@ | ||
| 4 | usage("Both warning and critical should be same type- warning: $opt_w critical: $opt_c \n"); | ||
| 5 | } | ||
| 6 | |||
| 7 | -# verify warning is less than critical | ||
| 8 | -if ( $opt_w =~ /[kMG]/) { | ||
| 9 | - unless ( $warn > $crit) { | ||
| 10 | - usage("Disk size: warning ($opt_w) should be greater than critical ($opt_c) \n"); | ||
| 11 | - } | ||
| 12 | -}else{ | ||
| 13 | - unless ( $warn < $crit) { | ||
| 14 | - usage("Percentage: warning ($opt_w) should be less than critical ($opt_c) \n"); | ||
| 15 | - } | ||
| 16 | -} | ||
| 17 | |||
| 18 | my $workgroup = $1 if (defined($opt_W) && $opt_W =~ /(.*)/); | ||
| 19 | |||
| 20 | @@ -177,6 +167,18 @@ | ||
| 21 | $crit = $1 * 1048576; | ||
| 22 | } | ||
| 23 | |||
| 24 | + # try to verify warning is less than critical | ||
| 25 | + # should this require that warn_type and $crit_type are the same ? | ||
| 26 | + if ( $warn_type eq "K" and $crit_type eq "K" ) { | ||
| 27 | + unless ( $warn > $crit) { | ||
| 28 | + usage("Disk size: warning ($opt_w) should be greater than critical ($opt_c) \n"); | ||
| 29 | + } | ||
| 30 | + } elsif ( $warn_type eq "P" and $crit_type eq "P" ) { | ||
| 31 | + unless ( $warn < $crit) { | ||
| 32 | + usage("Percentage: warning ($opt_w) should be less than critical ($opt_c) \n"); | ||
| 33 | + } | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | if (int($avail / 1024) > 0) { | ||
| 37 | $avail = int($avail / 1024); | ||
| 38 | if (int($avail /1024) > 0) { | ||
diff --git a/web/attachments/81913-diff.README.TXT-1.4.0alpha1 b/web/attachments/81913-diff.README.TXT-1.4.0alpha1 new file mode 100644 index 0000000..749a1ed --- /dev/null +++ b/web/attachments/81913-diff.README.TXT-1.4.0alpha1 | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | --- contrib/README.TXT.orig Tue Mar 30 12:19:51 2004 | ||
| 2 | +++ contrib/README.TXT Tue Mar 30 12:26:30 2004 | ||
| 3 | @@ -56,12 +56,14 @@ | ||
| 4 | supplied with the radiusclient code work as a RADIUS plugin | ||
| 5 | for Nagios (Nick Shore) | ||
| 6 | |||
| 7 | -fetchlog-0.94.tar.gz - C program: The fetchlog utility displays the last new messages of a | ||
| 8 | - logfile. It is similar like tail(1) but offers some extra functionality | ||
| 9 | - for output formatting. fetchlog can be used standalone or as a Nagios | ||
| 10 | - plugin to monitor local logfiles or together with Net-SNMP to monitor | ||
| 11 | - remote logfiles. The README shows how to setup fetchlog for Nagios. | ||
| 12 | - (Alexander Haderer) | ||
| 13 | +fetchlog-1.0.tar.gz - C program: The fetchlog utility displays the last new messages of a | ||
| 14 | + logfile. It uses a bookmark to remember which messages have already | ||
| 15 | + been fetched. It is similar like tail(1) but offers some extra | ||
| 16 | + functionality like pattern matching with regular expressions or output | ||
| 17 | + formatting. fetchlog can be used standalone or as a Nagios plugin to | ||
| 18 | + monitor logfiles. See READMEs included for setup instructions. | ||
| 19 | + See http://fetchlog.sourceforge.net/ for current version. | ||
| 20 | + (Alexander Haderer) | ||
| 21 | |||
| 22 | check_cit.tgz -Perl plugins to monitor Citrix server | ||
| 23 | |||
diff --git a/web/attachments/83489-check_smtp.patch b/web/attachments/83489-check_smtp.patch new file mode 100644 index 0000000..cf3fd67 --- /dev/null +++ b/web/attachments/83489-check_smtp.patch | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | --- plugins/check_smtp.c.orig Mon Apr 12 20:21:34 2004 | ||
| 2 | +++ plugins/check_smtp.c Mon Apr 12 22:29:17 2004 | ||
| 3 | @@ -219,15 +219,16 @@ | ||
| 4 | microsec = deltime (tv); | ||
| 5 | elapsed_time = (double)microsec / 1.0e6; | ||
| 6 | |||
| 7 | - if (check_critical_time && elapsed_time > (double) critical_time) | ||
| 8 | - result = STATE_CRITICAL; | ||
| 9 | - else if (check_warning_time && elapsed_time > (double) warning_time) | ||
| 10 | - result = STATE_WARNING; | ||
| 11 | + if (result == STATE_OK) | ||
| 12 | + if (check_critical_time && elapsed_time > (double) critical_time) | ||
| 13 | + result = STATE_CRITICAL; | ||
| 14 | + else if (check_warning_time && elapsed_time > (double) warning_time) | ||
| 15 | + result = STATE_WARNING; | ||
| 16 | |||
| 17 | printf (_("SMTP %s - %.3f sec. response time%s%s|%s\n"), | ||
| 18 | state_text (result), elapsed_time, | ||
| 19 | verbose?", ":"", verbose?buffer:"", | ||
| 20 | - perfdata ("time", microsec, "us", | ||
| 21 | + fperfdata ("time", elapsed_time, "s", | ||
| 22 | (int)check_warning_time, warning_time, | ||
| 23 | (int)check_critical_time, critical_time, | ||
| 24 | TRUE, 0, FALSE, 0)); | ||
diff --git a/web/attachments/85410-check_dig.c.patch b/web/attachments/85410-check_dig.c.patch new file mode 100644 index 0000000..b4fedc2 --- /dev/null +++ b/web/attachments/85410-check_dig.c.patch | |||
| @@ -0,0 +1,151 @@ | |||
| 1 | --- check_dig.c.orig Thu Apr 15 12:38:19 2004 | ||
| 2 | +++ check_dig.c Fri Apr 16 16:20:03 2004 | ||
| 3 | @@ -37,6 +37,8 @@ | ||
| 4 | }; | ||
| 5 | |||
| 6 | char *query_address = NULL; | ||
| 7 | +char *record_type = "A"; | ||
| 8 | +char *expected_address = NULL; | ||
| 9 | char *dns_server = NULL; | ||
| 10 | int verbose = FALSE; | ||
| 11 | int server_port = DEFAULT_PORT; | ||
| 12 | @@ -68,14 +70,20 @@ | ||
| 13 | usage (_("Could not parse arguments\n")); | ||
| 14 | |||
| 15 | /* get the command to run */ | ||
| 16 | - asprintf (&command_line, "%s @%s -p %d %s", | ||
| 17 | - PATH_TO_DIG, dns_server, server_port, query_address); | ||
| 18 | + asprintf (&command_line, "%s @%s -p %d %s -t %s", | ||
| 19 | + PATH_TO_DIG, dns_server, server_port, query_address, record_type); | ||
| 20 | |||
| 21 | alarm (timeout_interval); | ||
| 22 | gettimeofday (&tv, NULL); | ||
| 23 | |||
| 24 | - if (verbose) | ||
| 25 | + if (verbose) { | ||
| 26 | printf ("%s\n", command_line); | ||
| 27 | + if(expected_address != NULL) { | ||
| 28 | + printf ("Looking for: '%s'\n", expected_address); | ||
| 29 | + } else { | ||
| 30 | + printf ("Looking for: '%s'\n", query_address); | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | |||
| 34 | /* run the command */ | ||
| 35 | child_process = spopen (command_line); | ||
| 36 | @@ -93,28 +101,39 @@ | ||
| 37 | /* the server is responding, we just got the host name... */ | ||
| 38 | if (strstr (input_buffer, ";; ANSWER SECTION:")) { | ||
| 39 | |||
| 40 | - /* get the host address */ | ||
| 41 | - if (!fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) | ||
| 42 | - break; | ||
| 43 | - | ||
| 44 | - if (strpbrk (input_buffer, "\r\n")) | ||
| 45 | - input_buffer[strcspn (input_buffer, "\r\n")] = '\0'; | ||
| 46 | - | ||
| 47 | - if (strstr (input_buffer, query_address) == input_buffer) { | ||
| 48 | - output = strdup(input_buffer); | ||
| 49 | - result = STATE_OK; | ||
| 50 | - } | ||
| 51 | - else { | ||
| 52 | - asprintf (&output, _("Server not found in ANSWER SECTION")); | ||
| 53 | - result = STATE_WARNING; | ||
| 54 | - } | ||
| 55 | + /* loop through the whole 'ANSWER SECTION' */ | ||
| 56 | + do { | ||
| 57 | + /* get the host address */ | ||
| 58 | + if (!fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) | ||
| 59 | + break; | ||
| 60 | + | ||
| 61 | + if (strpbrk (input_buffer, "\r\n")) | ||
| 62 | + input_buffer[strcspn (input_buffer, "\r\n")] = '\0'; | ||
| 63 | + | ||
| 64 | + if (verbose && !strstr (input_buffer, ";; ")) | ||
| 65 | + printf ("%s\n", input_buffer); | ||
| 66 | + | ||
| 67 | + if (expected_address==NULL && strstr (input_buffer, query_address) != NULL) { | ||
| 68 | + output = strdup(input_buffer); | ||
| 69 | + result = STATE_OK; | ||
| 70 | + } | ||
| 71 | + else if (expected_address != NULL && strstr (input_buffer, expected_address) != NULL) { | ||
| 72 | + output = strdup(input_buffer); | ||
| 73 | + result = STATE_OK; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + } while (!strstr (input_buffer, ";; ")); | ||
| 77 | + | ||
| 78 | + if (result == STATE_UNKNOWN) { | ||
| 79 | + asprintf (&output, _("Server not found in ANSWER SECTION")); | ||
| 80 | + result = STATE_WARNING; | ||
| 81 | + } | ||
| 82 | |||
| 83 | - continue; | ||
| 84 | } | ||
| 85 | |||
| 86 | } | ||
| 87 | |||
| 88 | - if (result != STATE_OK) { | ||
| 89 | + if (result == STATE_UNKNOWN) { | ||
| 90 | asprintf (&output, _("No ANSWER SECTION found")); | ||
| 91 | } | ||
| 92 | |||
| 93 | @@ -181,6 +200,8 @@ | ||
| 94 | {"verbose", no_argument, 0, 'v'}, | ||
| 95 | {"version", no_argument, 0, 'V'}, | ||
| 96 | {"help", no_argument, 0, 'h'}, | ||
| 97 | + {"record_type", required_argument, 0, 'T'}, | ||
| 98 | + {"expected_address", required_argument, 0, 'a'}, | ||
| 99 | {0, 0, 0, 0} | ||
| 100 | }; | ||
| 101 | |||
| 102 | @@ -188,7 +209,7 @@ | ||
| 103 | return ERROR; | ||
| 104 | |||
| 105 | while (1) { | ||
| 106 | - c = getopt_long (argc, argv, "hVvt:l:H:w:c:", longopts, &option); | ||
| 107 | + c = getopt_long (argc, argv, "hVvt:l:H:w:c:T:a:", longopts, &option); | ||
| 108 | |||
| 109 | if (c == -1 || c == EOF) | ||
| 110 | break; | ||
| 111 | @@ -248,6 +269,12 @@ | ||
| 112 | case 'v': /* verbose */ | ||
| 113 | verbose = TRUE; | ||
| 114 | break; | ||
| 115 | + case 'T': | ||
| 116 | + record_type = optarg; | ||
| 117 | + break; | ||
| 118 | + case 'a': | ||
| 119 | + expected_address = optarg; | ||
| 120 | + break; | ||
| 121 | } | ||
| 122 | } | ||
| 123 | |||
| 124 | @@ -309,6 +336,15 @@ | ||
| 125 | -l, --lookup=STRING\n\ | ||
| 126 | machine name to lookup\n")); | ||
| 127 | |||
| 128 | + printf (_("\ | ||
| 129 | + -T, --record_type=STRING\n\ | ||
| 130 | + record type to lookup (default: A)\n")); | ||
| 131 | + | ||
| 132 | + printf (_("\ | ||
| 133 | + -a, --expected_address=STRING\n\ | ||
| 134 | + an address expected to be in the asnwer section.\n\ | ||
| 135 | + if not set, uses whatever was in -l\n")); | ||
| 136 | + | ||
| 137 | printf (_(UT_WARN_CRIT)); | ||
| 138 | |||
| 139 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
| 140 | @@ -325,8 +361,9 @@ | ||
| 141 | print_usage (void) | ||
| 142 | { | ||
| 143 | printf (_("\ | ||
| 144 | -Usage: %s -H host -l lookup [-p <server port>] [-w <warning interval>]\n\ | ||
| 145 | - [-c <critical interval>] [-t <timeout>] [-v]\n"), | ||
| 146 | +Usage: %s -H host -l lookup [-p <server port>] [-T <query type>]\n\ | ||
| 147 | + [-w <warning interval>] [-c <critical interval>] [-t <timeout>]\n\ | ||
| 148 | + [-a <expected answer address>] [-v]\n"), | ||
| 149 | progname); | ||
| 150 | printf (" %s (-h|--help)\n", progname); | ||
| 151 | printf (" %s (-V|--version)\n", progname); | ||
diff --git a/web/attachments/86257-patch-check_tcp-quiet b/web/attachments/86257-patch-check_tcp-quiet new file mode 100644 index 0000000..b085f62 --- /dev/null +++ b/web/attachments/86257-patch-check_tcp-quiet | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | *** check_tcp.c.original Thu May 6 09:25:56 2004 | ||
| 2 | --- check_tcp.c Thu May 6 09:31:52 2004 | ||
| 3 | *************** | ||
| 4 | *** 84,89 **** | ||
| 5 | --- 84,90 ---- | ||
| 6 | int check_warning_time = FALSE; | ||
| 7 | double critical_time = 0; | ||
| 8 | int check_critical_time = FALSE; | ||
| 9 | + int hide_output = FALSE; | ||
| 10 | double elapsed_time = 0; | ||
| 11 | long microsec; | ||
| 12 | int verbose = FALSE; | ||
| 13 | *************** | ||
| 14 | *** 329,335 **** | ||
| 15 | (was_refused) ? " (refused)" : "", | ||
| 16 | elapsed_time, server_port); | ||
| 17 | |||
| 18 | ! if (status && strlen(status) > 0) | ||
| 19 | printf (" [%s]", status); | ||
| 20 | |||
| 21 | printf (" |%s\n", perfdata ("time", microsec, "us", | ||
| 22 | --- 330,336 ---- | ||
| 23 | (was_refused) ? " (refused)" : "", | ||
| 24 | elapsed_time, server_port); | ||
| 25 | |||
| 26 | ! if (hide_output == FALSE && status && strlen(status) > 0) | ||
| 27 | printf (" [%s]", status); | ||
| 28 | |||
| 29 | printf (" |%s\n", perfdata ("time", microsec, "us", | ||
| 30 | *************** | ||
| 31 | *** 364,369 **** | ||
| 32 | --- 365,371 ---- | ||
| 33 | {"expect", required_argument, 0, 'e'}, | ||
| 34 | {"maxbytes", required_argument, 0, 'm'}, | ||
| 35 | {"quit", required_argument, 0, 'q'}, | ||
| 36 | + {"jail", required_argument, 0, 'j'}, | ||
| 37 | {"delay", required_argument, 0, 'd'}, | ||
| 38 | {"refuse", required_argument, 0, 'r'}, | ||
| 39 | {"use-ipv4", no_argument, 0, '4'}, | ||
| 40 | *************** | ||
| 41 | *** 395,401 **** | ||
| 42 | } | ||
| 43 | |||
| 44 | while (1) { | ||
| 45 | ! c = getopt_long (argc, argv, "+hVv46H:s:e:q:m:c:w:t:p:C:W:d:Sr:", | ||
| 46 | longopts, &option); | ||
| 47 | |||
| 48 | if (c == -1 || c == EOF || c == 1) | ||
| 49 | --- 397,403 ---- | ||
| 50 | } | ||
| 51 | |||
| 52 | while (1) { | ||
| 53 | ! c = getopt_long (argc, argv, "+hVv46H:s:e:q:m:c:w:t:p:C:W:d:Sr:j", | ||
| 54 | longopts, &option); | ||
| 55 | |||
| 56 | if (c == -1 || c == EOF || c == 1) | ||
| 57 | *************** | ||
| 58 | *** 437,442 **** | ||
| 59 | --- 439,447 ---- | ||
| 60 | critical_time = strtod (optarg, NULL); | ||
| 61 | check_critical_time = TRUE; | ||
| 62 | break; | ||
| 63 | + case 'j': /* hide output */ | ||
| 64 | + hide_output = TRUE; | ||
| 65 | + break; | ||
| 66 | case 'w': /* warning */ | ||
| 67 | if (!is_intnonneg (optarg)) | ||
| 68 | usage (_("Warning threshold must be a nonnegative integer\n")); | ||
| 69 | *************** | ||
| 70 | *** 622,627 **** | ||
| 71 | --- 627,634 ---- | ||
| 72 | printf (_("\ | ||
| 73 | -r, --refuse=ok|warn|crit\n\ | ||
| 74 | Accept tcp refusals with states ok, warn, crit (default: crit)\n\ | ||
| 75 | + -j, --jail\n\ | ||
| 76 | + Hide output from TCP socket\n\ | ||
| 77 | -m, --maxbytes=INTEGER\n\ | ||
| 78 | Close connection once more than this number of bytes are received\n\ | ||
| 79 | -d, --delay=INTEGER\n\ | ||
| 80 | *************** | ||
| 81 | *** 646,652 **** | ||
| 82 | Usage: %s -H host -p port [-w <warning time>] [-c <critical time>]\n\ | ||
| 83 | [-s <send string>] [-e <expect string>] [-q <quit string>]\n\ | ||
| 84 | [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\ | ||
| 85 | ! [-r <refuse state>] [-v] [-4|-6]\n"), progname); | ||
| 86 | printf (" %s (-h|--help)\n", progname); | ||
| 87 | printf (" %s (-V|--version)\n", progname); | ||
| 88 | } | ||
| 89 | --- 653,659 ---- | ||
| 90 | Usage: %s -H host -p port [-w <warning time>] [-c <critical time>]\n\ | ||
| 91 | [-s <send string>] [-e <expect string>] [-q <quit string>]\n\ | ||
| 92 | [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\ | ||
| 93 | ! [-r <refuse state>] [-v] [-4|-6] [-j]\n"), progname); | ||
| 94 | printf (" %s (-h|--help)\n", progname); | ||
| 95 | printf (" %s (-V|--version)\n", progname); | ||
| 96 | } | ||
diff --git a/web/attachments/86330-check_http.patch b/web/attachments/86330-check_http.patch new file mode 100644 index 0000000..df817d1 --- /dev/null +++ b/web/attachments/86330-check_http.patch | |||
| @@ -0,0 +1,353 @@ | |||
| 1 | --- /tmp/check_http.c 2004-04-13 20:09:38.000000000 -0700 | ||
| 2 | +++ check_http.c 2004-04-13 20:25:40.000000000 -0700 | ||
| 3 | @@ -21,6 +21,8 @@ | ||
| 4 | * | ||
| 5 | * $Id: check_http.c,v 1.24.2.4 2003/06/21 05:31:23 kdebisschop Exp $ | ||
| 6 | * | ||
| 7 | + * 13-Apr-2004 -- jwz -- added "--no-body" and "--max-age" options | ||
| 8 | + * | ||
| 9 | *****************************************************************************/ | ||
| 10 | |||
| 11 | const char *progname = "check_http"; | ||
| 12 | @@ -45,7 +47,7 @@ | ||
| 13 | [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\ | ||
| 14 | [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\ | ||
| 15 | [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\ | ||
| 16 | - [-P string]" | ||
| 17 | + [-P string] [-N] [-M <age>]" | ||
| 18 | |||
| 19 | #define LONGOPTIONS "\ | ||
| 20 | -H, --hostname=ADDRESS\n\ | ||
| 21 | @@ -63,6 +65,13 @@ | ||
| 22 | Port number (default: %d)\n\ | ||
| 23 | -P, --post=STRING\n\ | ||
| 24 | URL encoded http POST data\n\ | ||
| 25 | + -N, --no-body\n\ | ||
| 26 | + Don't wait for document body: stop reading after headers.\n\ | ||
| 27 | + (Note that this still does an HTTP GET or POST, not a HEAD.)\n\ | ||
| 28 | + -M, --max-age=SECONDS\n\ | ||
| 29 | + Warn if the document is more than SECONDS old. The number can\n\ | ||
| 30 | + also be of the form \"10m\" for minutes, \"10h\" for hours, or\n\ | ||
| 31 | + \"10d\" for days.\n\ | ||
| 32 | -w, --warning=INTEGER\n\ | ||
| 33 | Response time to result in warning status (seconds)\n\ | ||
| 34 | -c, --critical=INTEGER\n\ | ||
| 35 | @@ -159,6 +168,10 @@ | ||
| 36 | int check_certificate (X509 **); | ||
| 37 | #endif | ||
| 38 | |||
| 39 | +/* jwz */ | ||
| 40 | +int no_body = FALSE; | ||
| 41 | +int maximum_age = -1; | ||
| 42 | + | ||
| 43 | #ifdef HAVE_REGEX_H | ||
| 44 | enum { | ||
| 45 | REGS = 2, | ||
| 46 | @@ -311,6 +324,10 @@ | ||
| 47 | {"linespan", no_argument, 0, 'l'}, | ||
| 48 | {"onredirect", required_argument, 0, 'f'}, | ||
| 49 | {"certificate", required_argument, 0, 'C'}, | ||
| 50 | + | ||
| 51 | + /* jwz */ | ||
| 52 | + {"no-body", no_argument, 0, 'N'}, | ||
| 53 | + {"max-age", required_argument, 0, 'M'}, | ||
| 54 | {0, 0, 0, 0} | ||
| 55 | }; | ||
| 56 | #endif | ||
| 57 | @@ -331,7 +348,8 @@ | ||
| 58 | strcpy (argv[c], "-n"); | ||
| 59 | } | ||
| 60 | |||
| 61 | -#define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLS" | ||
| 62 | +/*#define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLS"*/ | ||
| 63 | +#define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:M:nlLSN" /* jwz */ | ||
| 64 | |||
| 65 | while (1) { | ||
| 66 | #ifdef HAVE_GETOPT_H | ||
| 67 | @@ -469,6 +487,27 @@ | ||
| 68 | case 'v': /* verbose */ | ||
| 69 | verbose = TRUE; | ||
| 70 | break; | ||
| 71 | + case 'N': /* no-body (jwz) */ | ||
| 72 | + no_body = TRUE; | ||
| 73 | + break; | ||
| 74 | + case 'M': /* max-age (jwz) */ | ||
| 75 | + { | ||
| 76 | + int L = strlen(optarg); | ||
| 77 | + if (L && optarg[L-1] == 'm') | ||
| 78 | + maximum_age = atoi (optarg) * 60; | ||
| 79 | + else if (L && optarg[L-1] == 'h') | ||
| 80 | + maximum_age = atoi (optarg) * 60 * 60; | ||
| 81 | + else if (L && optarg[L-1] == 'd') | ||
| 82 | + maximum_age = atoi (optarg) * 60 * 60 * 24; | ||
| 83 | + else if (L && (optarg[L-1] == 's' || | ||
| 84 | + isdigit (optarg[L-1]))) | ||
| 85 | + maximum_age = atoi (optarg); | ||
| 86 | + else { | ||
| 87 | + fprintf (stderr, "unparsable max-age: %s\n", optarg); | ||
| 88 | + exit (1); | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + break; | ||
| 92 | } | ||
| 93 | } | ||
| 94 | |||
| 95 | @@ -534,6 +573,223 @@ | ||
| 96 | |||
| 97 | |||
| 98 | |||
| 99 | +/* Returns 1 if we're done processing the document body; 0 to keep going. | ||
| 100 | + (jwz) | ||
| 101 | + */ | ||
| 102 | +static int | ||
| 103 | +document_headers_done (char *full_page) | ||
| 104 | +{ | ||
| 105 | + const char *body, *s; | ||
| 106 | + const char *end; | ||
| 107 | + | ||
| 108 | + for (body = full_page; *body; body++) { | ||
| 109 | + if (!strncmp (body, "\n\n", 2) || | ||
| 110 | + !strncmp (body, "\n\r\n", 3)) | ||
| 111 | + break; | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + if (!*body) | ||
| 115 | + return 0; /* haven't read end of headers yet */ | ||
| 116 | + | ||
| 117 | + full_page[body - full_page] = 0; | ||
| 118 | + return 1; | ||
| 119 | +} | ||
| 120 | + | ||
| 121 | + | ||
| 122 | +/* jwz */ | ||
| 123 | +static time_t | ||
| 124 | +parse_time_string (const char *string) | ||
| 125 | +{ | ||
| 126 | + struct tm tm; | ||
| 127 | + time_t t; | ||
| 128 | + memset (&tm, 0, sizeof(tm)); | ||
| 129 | + | ||
| 130 | + /* Like this: Tue, 25 Dec 2001 02:59:03 GMT */ | ||
| 131 | + | ||
| 132 | + if (isupper (string[0]) && /* Tue */ | ||
| 133 | + islower (string[1]) && | ||
| 134 | + islower (string[2]) && | ||
| 135 | + ',' == string[3] && | ||
| 136 | + ' ' == string[4] && | ||
| 137 | + (isdigit(string[5]) || string[5] == ' ') && /* 25 */ | ||
| 138 | + isdigit (string[6]) && | ||
| 139 | + ' ' == string[7] && | ||
| 140 | + isupper (string[8]) && /* Dec */ | ||
| 141 | + islower (string[9]) && | ||
| 142 | + islower (string[10]) && | ||
| 143 | + ' ' == string[11] && | ||
| 144 | + isdigit (string[12]) && /* 2001 */ | ||
| 145 | + isdigit (string[13]) && | ||
| 146 | + isdigit (string[14]) && | ||
| 147 | + isdigit (string[15]) && | ||
| 148 | + ' ' == string[16] && | ||
| 149 | + isdigit (string[17]) && /* 02: */ | ||
| 150 | + isdigit (string[18]) && | ||
| 151 | + ':' == string[19] && | ||
| 152 | + isdigit (string[20]) && /* 59: */ | ||
| 153 | + isdigit (string[21]) && | ||
| 154 | + ':' == string[22] && | ||
| 155 | + isdigit (string[23]) && /* 03 */ | ||
| 156 | + isdigit (string[24]) && | ||
| 157 | + ' ' == string[25] && | ||
| 158 | + 'G' == string[26] && /* GMT */ | ||
| 159 | + 'M' == string[27] && /* GMT */ | ||
| 160 | + 'T' == string[28]) { | ||
| 161 | + | ||
| 162 | + tm.tm_sec = 10 * (string[23]-'0') + (string[24]-'0'); | ||
| 163 | + tm.tm_min = 10 * (string[20]-'0') + (string[21]-'0'); | ||
| 164 | + tm.tm_hour = 10 * (string[17]-'0') + (string[18]-'0'); | ||
| 165 | + tm.tm_mday = 10 * (string[5] == ' ' ? 0 : string[5]-'0') + (string[6]-'0'); | ||
| 166 | + tm.tm_mon = (!strncmp (string+8, "Jan", 3) ? 0 : | ||
| 167 | + !strncmp (string+8, "Feb", 3) ? 1 : | ||
| 168 | + !strncmp (string+8, "Mar", 3) ? 2 : | ||
| 169 | + !strncmp (string+8, "Apr", 3) ? 3 : | ||
| 170 | + !strncmp (string+8, "May", 3) ? 4 : | ||
| 171 | + !strncmp (string+8, "Jun", 3) ? 5 : | ||
| 172 | + !strncmp (string+8, "Jul", 3) ? 6 : | ||
| 173 | + !strncmp (string+8, "Aug", 3) ? 7 : | ||
| 174 | + !strncmp (string+8, "Sep", 3) ? 8 : | ||
| 175 | + !strncmp (string+8, "Oct", 3) ? 9 : | ||
| 176 | + !strncmp (string+8, "Nov", 3) ? 10 : | ||
| 177 | + !strncmp (string+8, "Dec", 3) ? 11 : | ||
| 178 | + -1); | ||
| 179 | + tm.tm_year = ((1000 * (string[12]-'0') + | ||
| 180 | + 100 * (string[13]-'0') + | ||
| 181 | + 10 * (string[14]-'0') + | ||
| 182 | + (string[15]-'0')) | ||
| 183 | + - 1900); | ||
| 184 | + | ||
| 185 | + tm.tm_isdst = 0; /* GMT is never in DST, right? */ | ||
| 186 | + | ||
| 187 | + if (tm.tm_mon < 0 || | ||
| 188 | + tm.tm_mday < 1 || | ||
| 189 | + tm.tm_mday > 31) | ||
| 190 | + return 0; | ||
| 191 | + | ||
| 192 | + /* #### This is actually wrong: we need to subtract the local timezone | ||
| 193 | + offset from GMT from this value. But, that's ok in this usage, | ||
| 194 | + because we only comparing these two GMT dates against each other, | ||
| 195 | + so it doesn't matter what time zone we parse them in. | ||
| 196 | + */ | ||
| 197 | + | ||
| 198 | + t = mktime (&tm); | ||
| 199 | + if (t == (time_t) -1) t = 0; | ||
| 200 | + | ||
| 201 | + if (verbose) { | ||
| 202 | + const char *s = string; | ||
| 203 | + while (*s && *s != '\r' && *s != '\n') | ||
| 204 | + fputc (*s++, stdout); | ||
| 205 | + printf (" ==> %lu\n", (unsigned long) t); | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + return t; | ||
| 209 | + | ||
| 210 | + } else { | ||
| 211 | + return 0; | ||
| 212 | + } | ||
| 213 | +} | ||
| 214 | + | ||
| 215 | + | ||
| 216 | +/* jwz */ | ||
| 217 | +static void | ||
| 218 | +check_document_dates (const char *headers) | ||
| 219 | +{ | ||
| 220 | + const char *s; | ||
| 221 | + char *server_date = 0; | ||
| 222 | + char *document_date = 0; | ||
| 223 | + | ||
| 224 | + s = headers; | ||
| 225 | + while (*s) { | ||
| 226 | + const char *field = s; | ||
| 227 | + const char *value = 0; | ||
| 228 | + | ||
| 229 | + /* Find the end of the header field */ | ||
| 230 | + while (*s && !isspace(*s) && *s != ':') | ||
| 231 | + s++; | ||
| 232 | + | ||
| 233 | + /* Remember the header value, if any. */ | ||
| 234 | + if (*s == ':') | ||
| 235 | + value = ++s; | ||
| 236 | + | ||
| 237 | + /* Skip to the end of the header, including continuation lines. */ | ||
| 238 | + while (*s && | ||
| 239 | + !(*s == '\n' && (s[1] != ' ' && s[1] != '\t'))) | ||
| 240 | + s++; | ||
| 241 | + s++; | ||
| 242 | + | ||
| 243 | + /* Process this header. */ | ||
| 244 | + if (value && value > field+2) { | ||
| 245 | + char *ff = (char *) malloc (value-field); | ||
| 246 | + char *ss = ff; | ||
| 247 | + while (field < value-1) | ||
| 248 | + *ss++ = tolower(*field++); | ||
| 249 | + *ss++ = 0; | ||
| 250 | + | ||
| 251 | + if (!strcmp (ff, "date") || | ||
| 252 | + !strcmp (ff, "last-modified")) { | ||
| 253 | + const char *e; | ||
| 254 | + while (*value && isspace (*value)) | ||
| 255 | + value++; | ||
| 256 | + for (e = value; *e && *e != '\r' && *e != '\n'; e++) | ||
| 257 | + ; | ||
| 258 | + ss = (char *) malloc (e - value + 1); | ||
| 259 | + strncpy (ss, value, e - value); | ||
| 260 | + ss[e - value] = 0; | ||
| 261 | + if (!strcmp (ff, "date")) { | ||
| 262 | + if (server_date) free (server_date); | ||
| 263 | + server_date = ss; | ||
| 264 | + } else { | ||
| 265 | + if (document_date) free (document_date); | ||
| 266 | + document_date = ss; | ||
| 267 | + } | ||
| 268 | + } | ||
| 269 | + free (ff); | ||
| 270 | + } | ||
| 271 | + } | ||
| 272 | + | ||
| 273 | + /* Done parsing the body. Now check the dates we (hopefully) parsed. | ||
| 274 | + */ | ||
| 275 | + if (!server_date || !*server_date) { | ||
| 276 | + terminate (STATE_UNKNOWN, "server date unknown\n"); | ||
| 277 | + } else if (!document_date || !*document_date) { | ||
| 278 | + terminate (STATE_CRITICAL, "document modification date unknown\n"); | ||
| 279 | + } else { | ||
| 280 | + time_t sd = parse_time_string (server_date); | ||
| 281 | + time_t dd = parse_time_string (document_date); | ||
| 282 | + char buf [255]; | ||
| 283 | + | ||
| 284 | + if (sd <= 0) { | ||
| 285 | + sprintf (buf, "server date \"%100s\" unparsable", server_date); | ||
| 286 | + terminate (STATE_CRITICAL, buf); | ||
| 287 | + | ||
| 288 | + } else if (dd <= 0) { | ||
| 289 | + sprintf (buf, "document date \"%100s\" unparsable", document_date); | ||
| 290 | + terminate (STATE_CRITICAL, buf); | ||
| 291 | + | ||
| 292 | + } else if (dd > sd + 30) { | ||
| 293 | + char buf[200]; | ||
| 294 | + sprintf (buf, "document is %d seconds in the future\n", dd - sd); | ||
| 295 | + terminate (STATE_CRITICAL, buf); | ||
| 296 | + | ||
| 297 | + } else if (dd < sd - maximum_age) { | ||
| 298 | + char buf[200]; | ||
| 299 | + int n = (sd - dd); | ||
| 300 | + if (n > (60 * 60 * 24 * 2)) | ||
| 301 | + sprintf (buf, "last modified %.1f days ago\n", | ||
| 302 | + ((float) n) / (60 * 60 * 24)); | ||
| 303 | + else | ||
| 304 | + sprintf (buf, "last modified %d:%02d:%02d ago\n", | ||
| 305 | + n / (60 * 60), (n / 60) % 60, n % 60); | ||
| 306 | + terminate (STATE_CRITICAL, buf); | ||
| 307 | + } | ||
| 308 | + | ||
| 309 | + free (server_date); | ||
| 310 | + free (document_date); | ||
| 311 | + } | ||
| 312 | +} | ||
| 313 | + | ||
| 314 | + | ||
| 315 | + | ||
| 316 | int | ||
| 317 | check_http (void) | ||
| 318 | { | ||
| 319 | @@ -625,6 +881,12 @@ | ||
| 320 | buffer[i] = '\0'; | ||
| 321 | asprintf (&full_page, "%s%s", full_page, buffer); | ||
| 322 | pagesize += i; | ||
| 323 | + | ||
| 324 | + /* jwz */ | ||
| 325 | + if (no_body && document_headers_done (full_page)) { | ||
| 326 | + i = 0; | ||
| 327 | + break; | ||
| 328 | + } | ||
| 329 | } | ||
| 330 | |||
| 331 | if (i < 0 && errno != ECONNRESET) { | ||
| 332 | @@ -685,7 +947,8 @@ | ||
| 333 | page += (size_t) strspn (page, "\r\n"); | ||
| 334 | header[pos - header] = 0; | ||
| 335 | if (verbose) | ||
| 336 | - printf ("**** HEADER ****\n%s\n**** CONTENT ****\n%s\n", header, page); | ||
| 337 | + printf ("**** HEADER ****\n%s\n**** CONTENT ****\n%s\n", header, | ||
| 338 | + (no_body ? " [[ skipped ]]" : page)); /* jwz */ | ||
| 339 | |||
| 340 | /* make sure the status line matches the response we are looking for */ | ||
| 341 | if (!strstr (status_line, server_expect)) { | ||
| 342 | @@ -810,6 +1073,11 @@ | ||
| 343 | } /* end else (server_expect_yn) */ | ||
| 344 | |||
| 345 | |||
| 346 | + /* jwz */ | ||
| 347 | + if (maximum_age >= 0) { | ||
| 348 | + check_document_dates (header); | ||
| 349 | + } | ||
| 350 | + | ||
| 351 | /* check elapsed time */ | ||
| 352 | elapsed_time = delta_time (tv); | ||
| 353 | asprintf (&msg, "HTTP problem: %s - %7.3f second response time %s%s|time=%7.3f\n", | ||
diff --git a/web/attachments/88809-nagios-plugins-1.4.0alpha1.my_connect.patch b/web/attachments/88809-nagios-plugins-1.4.0alpha1.my_connect.patch new file mode 100644 index 0000000..f3b16a6 --- /dev/null +++ b/web/attachments/88809-nagios-plugins-1.4.0alpha1.my_connect.patch | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | diff -Naur nagios-plugins-1.4.0alpha1.orig/plugins/netutils.c nagios-plugins-1.4.0alpha1/plugins/netutils.c | ||
| 2 | --- nagios-plugins-1.4.0alpha1.orig/plugins/netutils.c 2003-08-09 23:31:02.000000000 -0700 | ||
| 3 | +++ nagios-plugins-1.4.0alpha1/plugins/netutils.c 2004-05-28 15:45:24.000000000 -0700 | ||
| 4 | @@ -97,7 +97,7 @@ | ||
| 5 | fd_set readfds; | ||
| 6 | int recv_length = 0; | ||
| 7 | |||
| 8 | - result = my_connect (server_address, server_port, &sd, IPPROTO_TCP); | ||
| 9 | + result = _my_connect (server_address, server_port, &sd, IPPROTO_TCP); | ||
| 10 | if (result != STATE_OK) | ||
| 11 | return STATE_CRITICAL; | ||
| 12 | |||
| 13 | @@ -175,7 +175,7 @@ | ||
| 14 | |||
| 15 | result = STATE_OK; | ||
| 16 | |||
| 17 | - result = my_connect (server_address, server_port, &sd, proto); | ||
| 18 | + result = _my_connect (server_address, server_port, &sd, proto); | ||
| 19 | if (result != STATE_OK) | ||
| 20 | return STATE_CRITICAL; | ||
| 21 | |||
| 22 | @@ -227,7 +227,7 @@ | ||
| 23 | { | ||
| 24 | int result; | ||
| 25 | |||
| 26 | - result = my_connect (host_name, port, sd, IPPROTO_TCP); | ||
| 27 | + result = _my_connect (host_name, port, sd, IPPROTO_TCP); | ||
| 28 | |||
| 29 | return result; | ||
| 30 | } | ||
| 31 | @@ -239,7 +239,7 @@ | ||
| 32 | { | ||
| 33 | int result; | ||
| 34 | |||
| 35 | - result = my_connect (host_name, port, sd, IPPROTO_UDP); | ||
| 36 | + result = _my_connect (host_name, port, sd, IPPROTO_UDP); | ||
| 37 | |||
| 38 | return result; | ||
| 39 | } | ||
| 40 | @@ -247,7 +247,7 @@ | ||
| 41 | |||
| 42 | /* opens a tcp or udp connection to a remote host */ | ||
| 43 | int | ||
| 44 | -my_connect (const char *host_name, int port, int *sd, int proto) | ||
| 45 | +_my_connect (const char *host_name, int port, int *sd, int proto) | ||
| 46 | { | ||
| 47 | struct addrinfo hints; | ||
| 48 | struct addrinfo *res; | ||
| 49 | diff -Naur nagios-plugins-1.4.0alpha1.orig/plugins/netutils.h nagios-plugins-1.4.0alpha1/plugins/netutils.h | ||
| 50 | --- nagios-plugins-1.4.0alpha1.orig/plugins/netutils.h 2003-08-08 16:05:17.000000000 -0700 | ||
| 51 | +++ nagios-plugins-1.4.0alpha1/plugins/netutils.h 2004-05-28 15:45:28.000000000 -0700 | ||
| 52 | @@ -47,7 +47,7 @@ | ||
| 53 | |||
| 54 | int my_tcp_connect (const char *address, int port, int *sd); | ||
| 55 | int my_udp_connect (const char *address, int port, int *sd); | ||
| 56 | -int my_connect (const char *address, int port, int *sd, int proto); | ||
| 57 | +int _my_connect (const char *address, int port, int *sd, int proto); | ||
| 58 | |||
| 59 | int is_host (const char *); | ||
| 60 | int is_addr (const char *); | ||
diff --git a/web/attachments/92167-03_hostwithnumbers.patch b/web/attachments/92167-03_hostwithnumbers.patch new file mode 100644 index 0000000..f3060bf --- /dev/null +++ b/web/attachments/92167-03_hostwithnumbers.patch | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | diff -urNad /home/ultrotter/docs/projects/deb/nagios/nagios-plugins-1.3.1.0/plugins/utils.c nagios-plugins-1.3.1.0/plugins/utils.c | ||
| 2 | --- /home/ultrotter/docs/projects/deb/nagios/nagios-plugins-1.3.1.0/plugins/utils.c 2003-04-23 06:57:08.000000000 +0200 | ||
| 3 | +++ nagios-plugins-1.3.1.0/plugins/utils.c 2004-06-15 15:35:02.000000000 +0200 | ||
| 4 | @@ -229,7 +229,7 @@ | ||
| 5 | /* '..' and '.-' are not legal either */ | ||
| 6 | while ((s1 = index (s1, '.'))) { | ||
| 7 | s1++; | ||
| 8 | - if (strspn (s1, "0123456789-.") == 1) { | ||
| 9 | + if (strspn (s1, "-.") == 1) { | ||
| 10 | return FALSE; | ||
| 11 | } | ||
| 12 | } | ||
diff --git a/web/attachments/92703-check_disk.patch b/web/attachments/92703-check_disk.patch new file mode 100644 index 0000000..920b56e --- /dev/null +++ b/web/attachments/92703-check_disk.patch | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | --- check_disk.c.orig 2004-07-02 09:50:32.000000000 -0600 | ||
| 2 | +++ check_disk.c 2004-07-02 15:02:59.000000000 -0600 | ||
| 3 | @@ -191,7 +191,7 @@ | ||
| 4 | psize = fsp.fsu_blocks*fsp.fsu_blocksize/mult; | ||
| 5 | asprintf (&perf, "%s %s", perf, | ||
| 6 | perfdata ((!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
| 7 | - fsp.fsu_bavail*fsp.fsu_blocksize/mult, units, | ||
| 8 | + psize-(fsp.fsu_bavail*fsp.fsu_blocksize/mult), units, | ||
| 9 | TRUE, min ((uintmax_t)psize-(uintmax_t)w_df, (uintmax_t)((1.0-w_dfp/100.0)*psize)), | ||
| 10 | TRUE, min ((uintmax_t)psize-(uintmax_t)c_df, (uintmax_t)((1.0-c_dfp/100.0)*psize)), | ||
| 11 | TRUE, 0, | ||
diff --git a/web/attachments/94817-check_disk-patch b/web/attachments/94817-check_disk-patch new file mode 100644 index 0000000..e583220 --- /dev/null +++ b/web/attachments/94817-check_disk-patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | --- ../tmp/nagios-plugins-1.4.0alpha1/plugins/check_disk.c Thu Jul 22 16:59:52 2004 | ||
| 2 | +++ plugins/check_disk.c Thu Jul 22 16:56:15 2004 | ||
| 3 | @@ -21,6 +21,10 @@ | ||
| 4 | const char *copyright = "1999-2003"; | ||
| 5 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 6 | |||
| 7 | +/* | ||
| 8 | + * Additional inode code by Jorgen Lundman <lundman@lundman.net> | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | #include "common.h" | ||
| 12 | #if HAVE_INTTYPES_H | ||
| 13 | # include <inttypes.h> | ||
| 14 | @@ -65,6 +69,8 @@ | ||
| 15 | uintmax_t c_df; | ||
| 16 | double w_dfp; | ||
| 17 | double c_dfp; | ||
| 18 | + double w_idfp; | ||
| 19 | + double c_idfp; | ||
| 20 | struct name_list *name_next; | ||
| 21 | }; | ||
| 22 | |||
| 23 | @@ -110,8 +116,8 @@ | ||
| 24 | |||
| 25 | int process_arguments (int, char **); | ||
| 26 | void print_path (const char *mypath); | ||
| 27 | -int validate_arguments (uintmax_t, uintmax_t, double, double, char *); | ||
| 28 | -int check_disk (double usp, uintmax_t free_disk); | ||
| 29 | +int validate_arguments (uintmax_t, uintmax_t, double, double, double, double, char *); | ||
| 30 | +int check_disk (double usp, uintmax_t free_disk, double uisp); | ||
| 31 | int walk_name_list (struct name_list *list, const char *name); | ||
| 32 | void print_help (void); | ||
| 33 | void print_usage (void); | ||
| 34 | @@ -120,6 +126,8 @@ | ||
| 35 | uintmax_t c_df = 0; | ||
| 36 | double w_dfp = -1.0; | ||
| 37 | double c_dfp = -1.0; | ||
| 38 | +double w_idfp = -1.0; | ||
| 39 | +double c_idfp = -1.0; | ||
| 40 | char *path; | ||
| 41 | char *exclude_device; | ||
| 42 | char *units; | ||
| 43 | @@ -136,7 +144,7 @@ | ||
| 44 | int | ||
| 45 | main (int argc, char **argv) | ||
| 46 | { | ||
| 47 | - double usp = -1.0; | ||
| 48 | + double usp = -1.0, uisp = -1.0; | ||
| 49 | int result = STATE_UNKNOWN; | ||
| 50 | int disk_result = STATE_UNKNOWN; | ||
| 51 | char file_system[MAX_INPUT_BUFFER]; | ||
| 52 | @@ -144,7 +152,7 @@ | ||
| 53 | char *details; | ||
| 54 | char *perf; | ||
| 55 | uintmax_t psize; | ||
| 56 | - float free_space, free_space_pct, total_space; | ||
| 57 | + float free_space, free_space_pct, total_space, inode_space_pct; | ||
| 58 | |||
| 59 | struct mount_entry *me; | ||
| 60 | struct fs_usage fsp; | ||
| 61 | @@ -181,20 +189,26 @@ | ||
| 62 | (walk_name_list (dp_exclude_list, me->me_devname) || | ||
| 63 | walk_name_list (dp_exclude_list, me->me_mountdir))) | ||
| 64 | continue; | ||
| 65 | - else | ||
| 66 | + else | ||
| 67 | get_fs_usage (me->me_mountdir, me->me_devname, &fsp); | ||
| 68 | |||
| 69 | if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) { | ||
| 70 | usp = (double)(fsp.fsu_blocks - fsp.fsu_bavail) * 100 / fsp.fsu_blocks; | ||
| 71 | - disk_result = check_disk (usp, fsp.fsu_bavail); | ||
| 72 | + uisp = (double)(fsp.fsu_files - fsp.fsu_ffree) * 100 / fsp.fsu_files; | ||
| 73 | + disk_result = check_disk (usp, fsp.fsu_bavail, uisp); | ||
| 74 | result = max_state (disk_result, result); | ||
| 75 | psize = fsp.fsu_blocks*fsp.fsu_blocksize/mult; | ||
| 76 | + | ||
| 77 | + /* Moved this computation up here so we can add it | ||
| 78 | + * to perf */ | ||
| 79 | + inode_space_pct = (float)fsp.fsu_ffree*100/fsp.fsu_files; | ||
| 80 | + | ||
| 81 | asprintf (&perf, "%s %s", perf, | ||
| 82 | perfdata ((!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
| 83 | fsp.fsu_bavail*fsp.fsu_blocksize/mult, units, | ||
| 84 | TRUE, min ((uintmax_t)psize-(uintmax_t)w_df, (uintmax_t)((1.0-w_dfp/100.0)*psize)), | ||
| 85 | TRUE, min ((uintmax_t)psize-(uintmax_t)c_df, (uintmax_t)((1.0-c_dfp/100.0)*psize)), | ||
| 86 | - TRUE, 0, | ||
| 87 | + TRUE, inode_space_pct, | ||
| 88 | TRUE, psize)); | ||
| 89 | if (disk_result==STATE_OK && erronly && !verbose) | ||
| 90 | continue; | ||
| 91 | @@ -203,17 +217,20 @@ | ||
| 92 | free_space_pct = (float)fsp.fsu_bavail*100/fsp.fsu_blocks; | ||
| 93 | total_space = (float)fsp.fsu_blocks*fsp.fsu_blocksize/mult; | ||
| 94 | if (disk_result!=STATE_OK || verbose>=0) | ||
| 95 | - asprintf (&output, ("%s %s %.0f %s (%.0f%%);"), | ||
| 96 | + asprintf (&output, ("%s %s %.0f %s (%.0f%% inode=%.0f%%);"), | ||
| 97 | output, | ||
| 98 | (!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
| 99 | free_space, | ||
| 100 | units, | ||
| 101 | - free_space_pct); | ||
| 102 | + free_space_pct, | ||
| 103 | + inode_space_pct); | ||
| 104 | + | ||
| 105 | asprintf (&details, _("%s\n\ | ||
| 106 | -%.0f of %.0f %s (%.0f%%) free on %s (type %s mounted on %s) warn:%lu crit:%lu warn%%:%.0f%% crit%%:%.0f%%"), | ||
| 107 | - details, free_space, total_space, units, free_space_pct, | ||
| 108 | +%.0f of %.0f %s (%.0f%% inode=%.0f%%) free on %s (type %s mounted on %s) warn:%lu crit:%lu warn%%:%.0f%% crit%%:%.0f%%"), | ||
| 109 | + details, free_space, total_space, units, free_space_pct, inode_space_pct, | ||
| 110 | me->me_devname, me->me_type, me->me_mountdir, | ||
| 111 | (unsigned long)w_df, (unsigned long)c_df, w_dfp, c_dfp); | ||
| 112 | + | ||
| 113 | } | ||
| 114 | |||
| 115 | } | ||
| 116 | @@ -259,6 +276,9 @@ | ||
| 117 | {"timeout", required_argument, 0, 't'}, | ||
| 118 | {"warning", required_argument, 0, 'w'}, | ||
| 119 | {"critical", required_argument, 0, 'c'}, | ||
| 120 | + {"iwarning", required_argument, 0, 'W'}, | ||
| 121 | + /* Dang, -C is taken. We might want to reshuffle this. */ | ||
| 122 | + {"icritical", required_argument, 0, 'K'}, | ||
| 123 | {"local", required_argument, 0, 'l'}, | ||
| 124 | {"kilobytes", required_argument, 0, 'k'}, | ||
| 125 | {"megabytes", required_argument, 0, 'm'}, | ||
| 126 | @@ -291,7 +311,7 @@ | ||
| 127 | strcpy (argv[c], "-t"); | ||
| 128 | |||
| 129 | while (1) { | ||
| 130 | - c = getopt_long (argc, argv, "+?VqhveCt:c:w:u:p:x:X:mklM", longopts, &option); | ||
| 131 | + c = getopt_long (argc, argv, "+?VqhveCt:c:w:K:W:u:p:x:X:mklM", longopts, &option); | ||
| 132 | |||
| 133 | if (c == -1 || c == EOF) | ||
| 134 | break; | ||
| 135 | @@ -339,6 +359,24 @@ | ||
| 136 | else { | ||
| 137 | usage (_("Critical threshold must be integer or percentage!\n")); | ||
| 138 | } | ||
| 139 | + | ||
| 140 | + | ||
| 141 | + case 'W': /* warning inode threshold */ | ||
| 142 | + if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &w_idfp) == 1) { | ||
| 143 | + break; | ||
| 144 | + } | ||
| 145 | + else { | ||
| 146 | + usage (_("Warning inode threshold must be percentage!\n")); | ||
| 147 | + } | ||
| 148 | + case 'K': /* kritical inode threshold */ | ||
| 149 | + if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &c_idfp) == 1) { | ||
| 150 | + break; | ||
| 151 | + } | ||
| 152 | + else { | ||
| 153 | + usage (_("Critical inode threshold must be percentage!\n")); | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + | ||
| 157 | case 'u': | ||
| 158 | if (units) | ||
| 159 | free(units); | ||
| 160 | @@ -459,6 +497,8 @@ | ||
| 161 | temp_list->c_df, | ||
| 162 | temp_list->w_dfp, | ||
| 163 | temp_list->c_dfp, | ||
| 164 | + temp_list->w_idfp, | ||
| 165 | + temp_list->c_idfp, | ||
| 166 | temp_list->name) == ERROR) | ||
| 167 | result = ERROR; | ||
| 168 | temp_list = temp_list->name_next; | ||
| 169 | @@ -465,7 +505,7 @@ | ||
| 170 | } | ||
| 171 | return result; | ||
| 172 | } else { | ||
| 173 | - return validate_arguments (w_df, c_df, w_dfp, c_dfp, NULL); | ||
| 174 | + return validate_arguments (w_df, c_df, w_dfp, c_dfp, w_idfp, c_idfp, NULL); | ||
| 175 | } | ||
| 176 | } | ||
| 177 | |||
| 178 | @@ -482,7 +522,7 @@ | ||
| 179 | } | ||
| 180 | |||
| 181 | int | ||
| 182 | -validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, char *mypath) | ||
| 183 | +validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, double iwp, double icp, char *mypath) | ||
| 184 | { | ||
| 185 | if (w == 0 && c == 0 && wp < 0.0 && cp < 0.0) { | ||
| 186 | printf (_("INPUT ERROR: No thresholds specified")); | ||
| 187 | @@ -497,6 +537,14 @@ | ||
| 188 | print_path (mypath); | ||
| 189 | return ERROR; | ||
| 190 | } | ||
| 191 | + else if ((iwp >= 0.0 || icp >= 0.0) && | ||
| 192 | + (iwp < 0.0 || icp < 0.0 || iwp > 100.0 || icp > 100.0 || icp > iwp)) { | ||
| 193 | + printf (_("\ | ||
| 194 | +INPUT ERROR: C_IDFP (%f) should be less than W_IDFP (%.1f) and both should be between zero and 100 percent, inclusive"), | ||
| 195 | + icp, iwp); | ||
| 196 | + print_path (mypath); | ||
| 197 | + return ERROR; | ||
| 198 | + } | ||
| 199 | else if ((w > 0 || c > 0) && (w == 0 || c == 0 || c > w)) { | ||
| 200 | printf (_("\ | ||
| 201 | INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greater than zero"), | ||
| 202 | @@ -516,16 +564,20 @@ | ||
| 203 | |||
| 204 | |||
| 205 | int | ||
| 206 | -check_disk (double usp, uintmax_t free_disk) | ||
| 207 | +check_disk (double usp, uintmax_t free_disk, double uisp) | ||
| 208 | { | ||
| 209 | int result = STATE_UNKNOWN; | ||
| 210 | /* check the percent used space against thresholds */ | ||
| 211 | if (usp >= 0.0 && c_dfp >=0.0 && usp >= (100.0 - c_dfp)) | ||
| 212 | result = STATE_CRITICAL; | ||
| 213 | + else if (uisp >= 0.0 && c_idfp >=0.0 && uisp >= (100.0 - c_idfp)) | ||
| 214 | + result = STATE_CRITICAL; | ||
| 215 | else if (c_df > 0 && free_disk <= c_df) | ||
| 216 | result = STATE_CRITICAL; | ||
| 217 | else if (usp >= 0.0 && w_dfp >=0.0 && usp >= (100.0 - w_dfp)) | ||
| 218 | result = STATE_WARNING; | ||
| 219 | + else if (uisp >= 0.0 && w_idfp >=0.0 && uisp >= (100.0 - w_idfp)) | ||
| 220 | + result = STATE_WARNING; | ||
| 221 | else if (w_df > 0 && free_disk <= w_df) | ||
| 222 | result = STATE_WARNING; | ||
| 223 | else if (usp >= 0.0) | ||
| 224 | @@ -579,6 +631,10 @@ | ||
| 225 | Exit with WARNING status if less than INTEGER kilobytes of disk are free\n\ | ||
| 226 | -w, --warning=PERCENT%%\n\ | ||
| 227 | Exit with WARNING status if less than PERCENT of disk space is free\n\ | ||
| 228 | + -W, --iwarning=PERCENT%%\n\ | ||
| 229 | + Exit with WARNING status if less than PERCENT of inode space is free\n\ | ||
| 230 | + -K, --icritical=PERCENT%%\n\ | ||
| 231 | + Exit with CRITICAL status if less than PERCENT of inode space is free\n\ | ||
| 232 | -c, --critical=INTEGER\n\ | ||
| 233 | Exit with CRITICAL status if less than INTEGER kilobytes of disk are free\n\ | ||
| 234 | -c, --critical=PERCENT%%\n\ | ||
| 235 | @@ -628,7 +684,7 @@ | ||
| 236 | print_usage (void) | ||
| 237 | { | ||
| 238 | printf (_("\ | ||
| 239 | -Usage: %s -w limit -c limit [-p path | -x device] [-t timeout] [-m] [-e]\n\ | ||
| 240 | +Usage: %s -w limit -c limit [-p path | -x device] [-t timeout] [-m] [-e] [-W limit] [-K limit]\n\ | ||
| 241 | [-v] [-q]\n\ | ||
| 242 | %s (-h|--help)\n\ | ||
| 243 | %s (-V|--version)\n"), | ||
diff --git a/web/attachments/94931-check_disk-patch b/web/attachments/94931-check_disk-patch new file mode 100644 index 0000000..4920cc1 --- /dev/null +++ b/web/attachments/94931-check_disk-patch | |||
| @@ -0,0 +1,273 @@ | |||
| 1 | --- check_disk.c-dist Thu Jul 22 15:46:18 2004 | ||
| 2 | +++ check_disk.c Fri Jul 23 12:38:12 2004 | ||
| 3 | @@ -21,6 +21,10 @@ | ||
| 4 | const char *copyright = "1999-2003"; | ||
| 5 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 6 | |||
| 7 | +/* | ||
| 8 | + * Additional inode code by Jorgen Lundman <lundman@lundman.net> | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | #include "common.h" | ||
| 12 | #if HAVE_INTTYPES_H | ||
| 13 | # include <inttypes.h> | ||
| 14 | @@ -65,6 +69,8 @@ | ||
| 15 | uintmax_t c_df; | ||
| 16 | double w_dfp; | ||
| 17 | double c_dfp; | ||
| 18 | + double w_idfp; | ||
| 19 | + double c_idfp; | ||
| 20 | struct name_list *name_next; | ||
| 21 | }; | ||
| 22 | |||
| 23 | @@ -110,8 +116,8 @@ | ||
| 24 | |||
| 25 | int process_arguments (int, char **); | ||
| 26 | void print_path (const char *mypath); | ||
| 27 | -int validate_arguments (uintmax_t, uintmax_t, double, double, char *); | ||
| 28 | -int check_disk (double usp, uintmax_t free_disk); | ||
| 29 | +int validate_arguments (uintmax_t, uintmax_t, double, double, double, double, char *); | ||
| 30 | +int check_disk (double usp, uintmax_t free_disk, double uisp); | ||
| 31 | int walk_name_list (struct name_list *list, const char *name); | ||
| 32 | void print_help (void); | ||
| 33 | void print_usage (void); | ||
| 34 | @@ -120,6 +126,8 @@ | ||
| 35 | uintmax_t c_df = 0; | ||
| 36 | double w_dfp = -1.0; | ||
| 37 | double c_dfp = -1.0; | ||
| 38 | +double w_idfp = -1.0; | ||
| 39 | +double c_idfp = -1.0; | ||
| 40 | char *path; | ||
| 41 | char *exclude_device; | ||
| 42 | char *units; | ||
| 43 | @@ -136,7 +144,7 @@ | ||
| 44 | int | ||
| 45 | main (int argc, char **argv) | ||
| 46 | { | ||
| 47 | - double usp = -1.0; | ||
| 48 | + double usp = -1.0, uisp = -1.0; | ||
| 49 | int result = STATE_UNKNOWN; | ||
| 50 | int disk_result = STATE_UNKNOWN; | ||
| 51 | char file_system[MAX_INPUT_BUFFER]; | ||
| 52 | @@ -144,7 +152,7 @@ | ||
| 53 | char *details; | ||
| 54 | char *perf; | ||
| 55 | uintmax_t psize; | ||
| 56 | - float free_space, free_space_pct, total_space; | ||
| 57 | + float free_space, free_space_pct, total_space, inode_space_pct; | ||
| 58 | |||
| 59 | struct mount_entry *me; | ||
| 60 | struct fs_usage fsp; | ||
| 61 | @@ -181,20 +189,26 @@ | ||
| 62 | (walk_name_list (dp_exclude_list, me->me_devname) || | ||
| 63 | walk_name_list (dp_exclude_list, me->me_mountdir))) | ||
| 64 | continue; | ||
| 65 | - else | ||
| 66 | + else | ||
| 67 | get_fs_usage (me->me_mountdir, me->me_devname, &fsp); | ||
| 68 | |||
| 69 | if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) { | ||
| 70 | usp = (double)(fsp.fsu_blocks - fsp.fsu_bavail) * 100 / fsp.fsu_blocks; | ||
| 71 | - disk_result = check_disk (usp, fsp.fsu_bavail); | ||
| 72 | + uisp = (double)(fsp.fsu_files - fsp.fsu_ffree) * 100 / fsp.fsu_files; | ||
| 73 | + disk_result = check_disk (usp, fsp.fsu_bavail, uisp); | ||
| 74 | result = max_state (disk_result, result); | ||
| 75 | psize = fsp.fsu_blocks*fsp.fsu_blocksize/mult; | ||
| 76 | + | ||
| 77 | + /* Moved this computation up here so we can add it | ||
| 78 | + * to perf */ | ||
| 79 | + inode_space_pct = (float)fsp.fsu_ffree*100/fsp.fsu_files; | ||
| 80 | + | ||
| 81 | asprintf (&perf, "%s %s", perf, | ||
| 82 | perfdata ((!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
| 83 | fsp.fsu_bavail*fsp.fsu_blocksize/mult, units, | ||
| 84 | TRUE, min ((uintmax_t)psize-(uintmax_t)w_df, (uintmax_t)((1.0-w_dfp/100.0)*psize)), | ||
| 85 | TRUE, min ((uintmax_t)psize-(uintmax_t)c_df, (uintmax_t)((1.0-c_dfp/100.0)*psize)), | ||
| 86 | - TRUE, 0, | ||
| 87 | + TRUE, inode_space_pct, | ||
| 88 | TRUE, psize)); | ||
| 89 | if (disk_result==STATE_OK && erronly && !verbose) | ||
| 90 | continue; | ||
| 91 | @@ -203,17 +217,20 @@ | ||
| 92 | free_space_pct = (float)fsp.fsu_bavail*100/fsp.fsu_blocks; | ||
| 93 | total_space = (float)fsp.fsu_blocks*fsp.fsu_blocksize/mult; | ||
| 94 | if (disk_result!=STATE_OK || verbose>=0) | ||
| 95 | - asprintf (&output, ("%s %s %.0f %s (%.0f%%);"), | ||
| 96 | + asprintf (&output, ("%s %s %.0f %s (%.0f%% inode=%.0f%%);"), | ||
| 97 | output, | ||
| 98 | (!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | ||
| 99 | free_space, | ||
| 100 | units, | ||
| 101 | - free_space_pct); | ||
| 102 | + free_space_pct, | ||
| 103 | + inode_space_pct); | ||
| 104 | + | ||
| 105 | asprintf (&details, _("%s\n\ | ||
| 106 | -%.0f of %.0f %s (%.0f%%) free on %s (type %s mounted on %s) warn:%lu crit:%lu warn%%:%.0f%% crit%%:%.0f%%"), | ||
| 107 | - details, free_space, total_space, units, free_space_pct, | ||
| 108 | +%.0f of %.0f %s (%.0f%% inode=%.0f%%) free on %s (type %s mounted on %s) warn:%lu crit:%lu warn%%:%.0f%% crit%%:%.0f%%"), | ||
| 109 | + details, free_space, total_space, units, free_space_pct, inode_space_pct, | ||
| 110 | me->me_devname, me->me_type, me->me_mountdir, | ||
| 111 | (unsigned long)w_df, (unsigned long)c_df, w_dfp, c_dfp); | ||
| 112 | + | ||
| 113 | } | ||
| 114 | |||
| 115 | } | ||
| 116 | @@ -259,6 +276,9 @@ | ||
| 117 | {"timeout", required_argument, 0, 't'}, | ||
| 118 | {"warning", required_argument, 0, 'w'}, | ||
| 119 | {"critical", required_argument, 0, 'c'}, | ||
| 120 | + {"iwarning", required_argument, 0, 'W'}, | ||
| 121 | + /* Dang, -C is taken. We might want to reshuffle this. */ | ||
| 122 | + {"icritical", required_argument, 0, 'K'}, | ||
| 123 | {"local", required_argument, 0, 'l'}, | ||
| 124 | {"kilobytes", required_argument, 0, 'k'}, | ||
| 125 | {"megabytes", required_argument, 0, 'm'}, | ||
| 126 | @@ -291,7 +311,7 @@ | ||
| 127 | strcpy (argv[c], "-t"); | ||
| 128 | |||
| 129 | while (1) { | ||
| 130 | - c = getopt_long (argc, argv, "+?VqhveCt:c:w:u:p:x:X:mklM", longopts, &option); | ||
| 131 | + c = getopt_long (argc, argv, "+?VqhveCt:c:w:K:W:u:p:x:X:mklM", longopts, &option); | ||
| 132 | |||
| 133 | if (c == -1 || c == EOF) | ||
| 134 | break; | ||
| 135 | @@ -339,6 +359,24 @@ | ||
| 136 | else { | ||
| 137 | usage (_("Critical threshold must be integer or percentage!\n")); | ||
| 138 | } | ||
| 139 | + | ||
| 140 | + | ||
| 141 | + case 'W': /* warning inode threshold */ | ||
| 142 | + if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &w_idfp) == 1) { | ||
| 143 | + break; | ||
| 144 | + } | ||
| 145 | + else { | ||
| 146 | + usage (_("Warning inode threshold must be percentage!\n")); | ||
| 147 | + } | ||
| 148 | + case 'K': /* kritical inode threshold */ | ||
| 149 | + if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &c_idfp) == 1) { | ||
| 150 | + break; | ||
| 151 | + } | ||
| 152 | + else { | ||
| 153 | + usage (_("Critical inode threshold must be percentage!\n")); | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + | ||
| 157 | case 'u': | ||
| 158 | if (units) | ||
| 159 | free(units); | ||
| 160 | @@ -393,6 +431,14 @@ | ||
| 161 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 162 | se->name = optarg; | ||
| 163 | se->name_next = NULL; | ||
| 164 | + /* If you don't clear the w_fd etc values here, they | ||
| 165 | + * get processed when you walk the list and assigned | ||
| 166 | + * to the global w_df! | ||
| 167 | + */ | ||
| 168 | + se->w_df = 0; | ||
| 169 | + se->c_df = 0; | ||
| 170 | + se->w_dfp = 0; | ||
| 171 | + se->c_dfp = 0; | ||
| 172 | *dptail = se; | ||
| 173 | dptail = &se->name_next; | ||
| 174 | break; | ||
| 175 | @@ -400,6 +446,14 @@ | ||
| 176 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
| 177 | se->name = optarg; | ||
| 178 | se->name_next = NULL; | ||
| 179 | + /* If you don't clear the w_fd etc values here, they | ||
| 180 | + * get processed when you walk the list and assigned | ||
| 181 | + * to the global w_df! | ||
| 182 | + */ | ||
| 183 | + se->w_df = 0; | ||
| 184 | + se->c_df = 0; | ||
| 185 | + se->w_dfp = 0; | ||
| 186 | + se->c_dfp = 0; | ||
| 187 | *fstail = se; | ||
| 188 | fstail = &se->name_next; | ||
| 189 | break; | ||
| 190 | @@ -459,6 +513,8 @@ | ||
| 191 | temp_list->c_df, | ||
| 192 | temp_list->w_dfp, | ||
| 193 | temp_list->c_dfp, | ||
| 194 | + temp_list->w_idfp, | ||
| 195 | + temp_list->c_idfp, | ||
| 196 | temp_list->name) == ERROR) | ||
| 197 | result = ERROR; | ||
| 198 | temp_list = temp_list->name_next; | ||
| 199 | @@ -465,7 +521,7 @@ | ||
| 200 | } | ||
| 201 | return result; | ||
| 202 | } else { | ||
| 203 | - return validate_arguments (w_df, c_df, w_dfp, c_dfp, NULL); | ||
| 204 | + return validate_arguments (w_df, c_df, w_dfp, c_dfp, w_idfp, c_idfp, NULL); | ||
| 205 | } | ||
| 206 | } | ||
| 207 | |||
| 208 | @@ -482,7 +538,7 @@ | ||
| 209 | } | ||
| 210 | |||
| 211 | int | ||
| 212 | -validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, char *mypath) | ||
| 213 | +validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, double iwp, double icp, char *mypath) | ||
| 214 | { | ||
| 215 | if (w == 0 && c == 0 && wp < 0.0 && cp < 0.0) { | ||
| 216 | printf (_("INPUT ERROR: No thresholds specified")); | ||
| 217 | @@ -497,6 +553,14 @@ | ||
| 218 | print_path (mypath); | ||
| 219 | return ERROR; | ||
| 220 | } | ||
| 221 | + else if ((iwp >= 0.0 || icp >= 0.0) && | ||
| 222 | + (iwp < 0.0 || icp < 0.0 || iwp > 100.0 || icp > 100.0 || icp > iwp)) { | ||
| 223 | + printf (_("\ | ||
| 224 | +INPUT ERROR: C_IDFP (%f) should be less than W_IDFP (%.1f) and both should be between zero and 100 percent, inclusive"), | ||
| 225 | + icp, iwp); | ||
| 226 | + print_path (mypath); | ||
| 227 | + return ERROR; | ||
| 228 | + } | ||
| 229 | else if ((w > 0 || c > 0) && (w == 0 || c == 0 || c > w)) { | ||
| 230 | printf (_("\ | ||
| 231 | INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greater than zero"), | ||
| 232 | @@ -516,16 +580,20 @@ | ||
| 233 | |||
| 234 | |||
| 235 | int | ||
| 236 | -check_disk (double usp, uintmax_t free_disk) | ||
| 237 | +check_disk (double usp, uintmax_t free_disk, double uisp) | ||
| 238 | { | ||
| 239 | int result = STATE_UNKNOWN; | ||
| 240 | /* check the percent used space against thresholds */ | ||
| 241 | if (usp >= 0.0 && c_dfp >=0.0 && usp >= (100.0 - c_dfp)) | ||
| 242 | result = STATE_CRITICAL; | ||
| 243 | + else if (uisp >= 0.0 && c_idfp >=0.0 && uisp >= (100.0 - c_idfp)) | ||
| 244 | + result = STATE_CRITICAL; | ||
| 245 | else if (c_df > 0 && free_disk <= c_df) | ||
| 246 | result = STATE_CRITICAL; | ||
| 247 | else if (usp >= 0.0 && w_dfp >=0.0 && usp >= (100.0 - w_dfp)) | ||
| 248 | result = STATE_WARNING; | ||
| 249 | + else if (uisp >= 0.0 && w_idfp >=0.0 && uisp >= (100.0 - w_idfp)) | ||
| 250 | + result = STATE_WARNING; | ||
| 251 | else if (w_df > 0 && free_disk <= w_df) | ||
| 252 | result = STATE_WARNING; | ||
| 253 | else if (usp >= 0.0) | ||
| 254 | @@ -579,6 +647,10 @@ | ||
| 255 | Exit with WARNING status if less than INTEGER kilobytes of disk are free\n\ | ||
| 256 | -w, --warning=PERCENT%%\n\ | ||
| 257 | Exit with WARNING status if less than PERCENT of disk space is free\n\ | ||
| 258 | + -W, --iwarning=PERCENT%%\n\ | ||
| 259 | + Exit with WARNING status if less than PERCENT of inode space is free\n\ | ||
| 260 | + -K, --icritical=PERCENT%%\n\ | ||
| 261 | + Exit with CRITICAL status if less than PERCENT of inode space is free\n\ | ||
| 262 | -c, --critical=INTEGER\n\ | ||
| 263 | Exit with CRITICAL status if less than INTEGER kilobytes of disk are free\n\ | ||
| 264 | -c, --critical=PERCENT%%\n\ | ||
| 265 | @@ -628,7 +700,7 @@ | ||
| 266 | print_usage (void) | ||
| 267 | { | ||
| 268 | printf (_("\ | ||
| 269 | -Usage: %s -w limit -c limit [-p path | -x device] [-t timeout] [-m] [-e]\n\ | ||
| 270 | +Usage: %s -w limit -c limit [-p path | -x device] [-t timeout] [-m] [-e] [-W limit] [-K limit]\n\ | ||
| 271 | [-v] [-q]\n\ | ||
| 272 | %s (-h|--help)\n\ | ||
| 273 | %s (-V|--version)\n"), | ||
diff --git a/web/attachments/95011-check_nmap.patch b/web/attachments/95011-check_nmap.patch new file mode 100644 index 0000000..3e41add --- /dev/null +++ b/web/attachments/95011-check_nmap.patch | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | --- ./contrib/check_nmap.py 2002-02-28 01:42:54.000000000 -0500 | ||
| 2 | +++ ./contrib/check_nmap.py 2004-07-23 16:03:17.000000000 -0400 | ||
| 3 | @@ -8,7 +8,7 @@ | ||
| 4 | # License: GPL | ||
| 5 | # Copyright (c) 2000 Jacob Lundqvist (jaclu@galdrion.com) | ||
| 6 | # | ||
| 7 | -_version_ = '1.20' | ||
| 8 | +_version_ = '1.21' | ||
| 9 | # | ||
| 10 | # | ||
| 11 | # Description: | ||
| 12 | @@ -25,6 +25,7 @@ | ||
| 13 | # | ||
| 14 | # History | ||
| 15 | # ------- | ||
| 16 | +# 1.21 2004-07-23 rippeld@hillsboroughcounty.org Updated parsing of nmap output to correctly identify closed ports | ||
| 17 | # 1.20 2000-07-15 jaclu Updated params to correctly comply to plugin-standard | ||
| 18 | # moved support classes to utils.py | ||
| 19 | # 1.16 2000-07-14 jaclu made options and return codes more compatible with | ||
| 20 | @@ -276,7 +277,8 @@ | ||
| 21 | if string.find(s,'/')<1: | ||
| 22 | continue | ||
| 23 | p=string.split(s,'/')[0] | ||
| 24 | - self.active_ports.append(int(p)) | ||
| 25 | + if string.find(l,'open')>1: | ||
| 26 | + self.active_ports.append(int(p)) | ||
| 27 | except: | ||
| 28 | # failure due to strange output... | ||
| 29 | pass | ||
diff --git a/web/attachments/95707-nagios.patch b/web/attachments/95707-nagios.patch new file mode 100644 index 0000000..445b6e4 --- /dev/null +++ b/web/attachments/95707-nagios.patch | |||
| @@ -0,0 +1,203 @@ | |||
| 1 | Only in nagios-plugins-1.4.0alpha1-rm: autom4te-2.53.cache | ||
| 2 | Only in nagios-plugins-1.4.0alpha1-rm: autom4te.cache | ||
| 3 | diff -r -u nagios-plugins-1.4.0alpha1/configure nagios-plugins-1.4.0alpha1-rm/configure | ||
| 4 | --- nagios-plugins-1.4.0alpha1/configure 2003-11-30 18:55:45.000000000 -0800 | ||
| 5 | +++ nagios-plugins-1.4.0alpha1-rm/configure 2004-07-14 21:40:45.000000000 -0700 | ||
| 6 | @@ -15537,13 +15537,13 @@ | ||
| 7 | echo "$as_me:$LINENO: result: $ac_cv_ps_command" >&5 | ||
| 8 | echo "${ECHO_T}$ac_cv_ps_command" >&6 | ||
| 9 | |||
| 10 | -elif ps -weo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \ | ||
| 11 | - egrep -i "^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+" >/dev/null | ||
| 12 | +elif ps -weo 'stat comm vsz rss user uid ppid etime args' 2>/dev/null | \ | ||
| 13 | + egrep -i "^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+" >/dev/null | ||
| 14 | then | ||
| 15 | - ac_cv_ps_varlist="procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos" | ||
| 16 | - ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid vsz rss pcpu comm args'" | ||
| 17 | - ac_cv_ps_format="%s %d %d %d %d %f %s %n" | ||
| 18 | - ac_cv_ps_cols=8 | ||
| 19 | + ac_cv_ps_varlist="procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos" | ||
| 20 | + ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid vsz rss pcpu etime comm args'" | ||
| 21 | + ac_cv_ps_format="%s %d %d %d %d %f %s %s %n" | ||
| 22 | + ac_cv_ps_cols=9 | ||
| 23 | echo "$as_me:$LINENO: result: $ac_cv_ps_command" >&5 | ||
| 24 | echo "${ECHO_T}$ac_cv_ps_command" >&6 | ||
| 25 | |||
| 26 | diff -r -u nagios-plugins-1.4.0alpha1/configure.in nagios-plugins-1.4.0alpha1-rm/configure.in | ||
| 27 | --- nagios-plugins-1.4.0alpha1/configure.in 2003-11-30 18:55:32.000000000 -0800 | ||
| 28 | +++ nagios-plugins-1.4.0alpha1-rm/configure.in 2004-07-14 06:23:16.000000000 -0700 | ||
| 29 | @@ -644,13 +644,13 @@ | ||
| 30 | AC_MSG_RESULT([$ac_cv_ps_command]) | ||
| 31 | |||
| 32 | dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND | ||
| 33 | -elif ps -weo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \ | ||
| 34 | - egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null | ||
| 35 | +elif ps -weo 'stat comm vsz rss user uid ppid etime args' 2>/dev/null | \ | ||
| 36 | + egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[ELAPSD]+ +[RGSCOMDNA]+"] >/dev/null | ||
| 37 | then | ||
| 38 | - ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]" | ||
| 39 | - ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid vsz rss pcpu comm args'" | ||
| 40 | - ac_cv_ps_format="%s %d %d %d %d %f %s %n" | ||
| 41 | - ac_cv_ps_cols=8 | ||
| 42 | + ac_cv_ps_varlist="[procstat,&procuid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos]" | ||
| 43 | + ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid vsz rss pcpu etime comm args'" | ||
| 44 | + ac_cv_ps_format="%s %d %d %d %d %f %s %s %n" | ||
| 45 | + ac_cv_ps_cols=9 | ||
| 46 | AC_MSG_RESULT([$ac_cv_ps_command]) | ||
| 47 | |||
| 48 | dnl FreeBSD | ||
| 49 | Only in nagios-plugins-1.4.0alpha1/pkg/solaris: pkginfo | ||
| 50 | diff -r -u nagios-plugins-1.4.0alpha1/plugins/check_nagios.c nagios-plugins-1.4.0alpha1-rm/plugins/check_nagios.c | ||
| 51 | --- nagios-plugins-1.4.0alpha1/plugins/check_nagios.c 2003-08-21 23:22:38.000000000 -0700 | ||
| 52 | +++ nagios-plugins-1.4.0alpha1-rm/plugins/check_nagios.c 2004-07-14 06:27:19.000000000 -0700 | ||
| 53 | @@ -52,6 +52,7 @@ | ||
| 54 | int procrss = 0; | ||
| 55 | float procpcpu = 0; | ||
| 56 | char procstat[8]; | ||
| 57 | + char procetime[MAX_INPUT_BUFFER]; | ||
| 58 | char procprog[MAX_INPUT_BUFFER]; | ||
| 59 | char *procargs; | ||
| 60 | int pos, cols; | ||
| 61 | diff -r -u nagios-plugins-1.4.0alpha1/plugins/check_procs.c nagios-plugins-1.4.0alpha1-rm/plugins/check_procs.c | ||
| 62 | --- nagios-plugins-1.4.0alpha1/plugins/check_procs.c 2003-11-30 18:46:01.000000000 -0800 | ||
| 63 | +++ nagios-plugins-1.4.0alpha1-rm/plugins/check_procs.c 2004-07-14 21:36:09.000000000 -0700 | ||
| 64 | @@ -47,14 +47,15 @@ | ||
| 65 | #define VSZ 64 | ||
| 66 | #define RSS 128 | ||
| 67 | #define PCPU 256 | ||
| 68 | - | ||
| 69 | +#define ELAPSED 512 | ||
| 70 | /* Different metrics */ | ||
| 71 | char *metric_name; | ||
| 72 | enum metric { | ||
| 73 | METRIC_PROCS, | ||
| 74 | METRIC_VSZ, | ||
| 75 | METRIC_RSS, | ||
| 76 | - METRIC_CPU | ||
| 77 | + METRIC_CPU, | ||
| 78 | + METRIC_ELAPSED | ||
| 79 | }; | ||
| 80 | enum metric metric = METRIC_PROCS; | ||
| 81 | |||
| 82 | @@ -85,8 +86,10 @@ | ||
| 83 | int procppid = 0; | ||
| 84 | int procvsz = 0; | ||
| 85 | int procrss = 0; | ||
| 86 | + int procseconds = 0; | ||
| 87 | float procpcpu = 0; | ||
| 88 | char procstat[8]; | ||
| 89 | + char procetime[MAX_INPUT_BUFFER]; | ||
| 90 | char procprog[MAX_INPUT_BUFFER]; | ||
| 91 | char *procargs; | ||
| 92 | char *temp_string; | ||
| 93 | @@ -156,10 +159,14 @@ | ||
| 94 | temp_string = strtok (NULL, "/"); | ||
| 95 | } | ||
| 96 | |||
| 97 | + /* we need to convert the elapsed time to seconds */ | ||
| 98 | + procseconds = convert_to_seconds(procetime); | ||
| 99 | + | ||
| 100 | if (verbose >= 3) | ||
| 101 | - printf ("%d %d %d %d %d %.2f %s %s %s\n", | ||
| 102 | + printf ("%d %d %d %d %d %.2f %s %s %s %s\n", | ||
| 103 | procs, procuid, procvsz, procrss, | ||
| 104 | - procppid, procpcpu, procstat, procprog, procargs); | ||
| 105 | + procppid, procpcpu, procstat, | ||
| 106 | + procetime, procprog, procargs); | ||
| 107 | |||
| 108 | /* Ignore self */ | ||
| 109 | if (strcmp (procprog, progname) == 0) { | ||
| 110 | @@ -198,6 +205,8 @@ | ||
| 111 | /* TODO? float thresholds for --metric=CPU */ | ||
| 112 | else if (metric == METRIC_CPU) | ||
| 113 | i = check_thresholds ((int)procpcpu); | ||
| 114 | + else if (metric == METRIC_ELAPSED) | ||
| 115 | + i = check_thresholds (procseconds); | ||
| 116 | |||
| 117 | if (metric != METRIC_PROCS) { | ||
| 118 | if (i == STATE_WARNING) { | ||
| 119 | @@ -297,6 +306,7 @@ | ||
| 120 | {"vsz", required_argument, 0, 'z'}, | ||
| 121 | {"rss", required_argument, 0, 'r'}, | ||
| 122 | {"pcpu", required_argument, 0, 'P'}, | ||
| 123 | + {"elapsed", required_argument, 0, 'e'}, | ||
| 124 | {"argument-array", required_argument, 0, 'a'}, | ||
| 125 | {"help", no_argument, 0, 'h'}, | ||
| 126 | {"version", no_argument, 0, 'V'}, | ||
| 127 | @@ -448,7 +458,12 @@ | ||
| 128 | metric = METRIC_CPU; | ||
| 129 | break; | ||
| 130 | } | ||
| 131 | - printf (_("%s: metric must be one of PROCS, VSZ, RSS, CPU!\n\n"), | ||
| 132 | + else if ( strcmp(optarg, "ELAPSED") == 0) { | ||
| 133 | + metric = METRIC_ELAPSED; | ||
| 134 | + break; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + printf (_("%s: metric must be one of PROCS, VSZ, RSS, CPU, ELAPSED!\n\n"), | ||
| 138 | progname); | ||
| 139 | print_usage (); | ||
| 140 | exit (STATE_UNKNOWN); | ||
| 141 | @@ -646,6 +661,62 @@ | ||
| 142 | printf (_(UT_SUPPORT)); | ||
| 143 | } | ||
| 144 | |||
| 145 | +/* convert the elapsed time to seconds */ | ||
| 146 | +int convert_to_seconds(char *etime) { | ||
| 147 | + | ||
| 148 | + char *ptr; | ||
| 149 | + int total; | ||
| 150 | + | ||
| 151 | + int hyphcnt; | ||
| 152 | + int coloncnt; | ||
| 153 | + int days; | ||
| 154 | + int hours; | ||
| 155 | + int minutes; | ||
| 156 | + int seconds; | ||
| 157 | + | ||
| 158 | + hyphcnt = 0; | ||
| 159 | + coloncnt = 0; | ||
| 160 | + days = 0; | ||
| 161 | + hours = 0; | ||
| 162 | + minutes = 0; | ||
| 163 | + seconds = 0; | ||
| 164 | + | ||
| 165 | + for (ptr = etime; *ptr != '\0'; ptr++) { | ||
| 166 | + | ||
| 167 | + if (*ptr == '-') { | ||
| 168 | + hyphcnt++; | ||
| 169 | + continue; | ||
| 170 | + } | ||
| 171 | + if (*ptr == ':') { | ||
| 172 | + coloncnt++; | ||
| 173 | + continue; | ||
| 174 | + } | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + if (hyphcnt > 0) { | ||
| 178 | + sscanf(etime, "%d-%d:%d:%d", | ||
| 179 | + &days, &hours, &minutes, &seconds); | ||
| 180 | + } else { | ||
| 181 | + if (coloncnt == 2) { | ||
| 182 | + sscanf(etime, "%d:%d:%d", | ||
| 183 | + &hours, &minutes, &seconds); | ||
| 184 | + } else if (coloncnt == 1) { | ||
| 185 | + sscanf(etime, "%d:%d", | ||
| 186 | + &minutes, &seconds); | ||
| 187 | + } | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + total = (days * 86400) + | ||
| 191 | + (hours * 3600) + | ||
| 192 | + (minutes * 60) + | ||
| 193 | + seconds; | ||
| 194 | + | ||
| 195 | + if (verbose >= 3) { | ||
| 196 | + printf("seconds: %d\n", total); | ||
| 197 | + } | ||
| 198 | + return total; | ||
| 199 | +} | ||
| 200 | + | ||
| 201 | void | ||
| 202 | print_usage (void) | ||
| 203 | { | ||
diff --git a/web/attachments/97188-check_mysql.check_slave.patch b/web/attachments/97188-check_mysql.check_slave.patch new file mode 100644 index 0000000..6607fdc --- /dev/null +++ b/web/attachments/97188-check_mysql.check_slave.patch | |||
| @@ -0,0 +1,138 @@ | |||
| 1 | diff -Naur nagios-plugins-1.4.0alpha1.orig/plugins/check_mysql.c nagios-plugins-1.4.0alpha1/plugins/check_mysql.c | ||
| 2 | --- nagios-plugins-1.4.0alpha1.orig/plugins/check_mysql.c 2003-08-21 23:22:38.000000000 -0700 | ||
| 3 | +++ nagios-plugins-1.4.0alpha1/plugins/check_mysql.c 2004-07-30 11:15:56.000000000 -0700 | ||
| 4 | @@ -19,6 +19,8 @@ | ||
| 5 | const char *copyright = "1999-2002"; | ||
| 6 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 7 | |||
| 8 | +#define SLAVERESULTSIZE 40 | ||
| 9 | + | ||
| 10 | #include "common.h" | ||
| 11 | #include "utils.h" | ||
| 12 | #include "netutils.h" | ||
| 13 | @@ -30,6 +32,7 @@ | ||
| 14 | char *db_pass = NULL; | ||
| 15 | char *db = NULL; | ||
| 16 | unsigned int db_port = MYSQL_PORT; | ||
| 17 | +int check_slave = 0; | ||
| 18 | |||
| 19 | int process_arguments (int, char **); | ||
| 20 | int validate_arguments (void); | ||
| 21 | @@ -41,7 +44,10 @@ | ||
| 22 | { | ||
| 23 | |||
| 24 | MYSQL mysql; | ||
| 25 | + MYSQL_RES *res; | ||
| 26 | + MYSQL_ROW row; | ||
| 27 | char *result = NULL; | ||
| 28 | + char slaveresult[SLAVERESULTSIZE]; | ||
| 29 | |||
| 30 | setlocale (LC_ALL, ""); | ||
| 31 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
| 32 | @@ -82,11 +88,58 @@ | ||
| 33 | die (STATE_CRITICAL, "%s\n", mysql_error (&mysql)); | ||
| 34 | } | ||
| 35 | |||
| 36 | + if(check_slave) { | ||
| 37 | + /* check the slave status */ | ||
| 38 | + if (mysql_query (&mysql, "show slave status") != 0) { | ||
| 39 | + mysql_close (&mysql); | ||
| 40 | + die (STATE_CRITICAL, "slave query error: %s\n", mysql_error (&mysql)); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + /* store the result */ | ||
| 44 | + if ( (res = mysql_store_result (&mysql)) == NULL) { | ||
| 45 | + mysql_close (&mysql); | ||
| 46 | + die (STATE_CRITICAL, "slave store_result error: %s\n", mysql_error (&mysql)); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + /* fetch the first row */ | ||
| 50 | + if ( (row = mysql_fetch_row (res)) == NULL) { | ||
| 51 | + mysql_free_result (res); | ||
| 52 | + mysql_close (&mysql); | ||
| 53 | + die (STATE_CRITICAL, "slave fetch row error: %s\n", mysql_error (&mysql)); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + if (mysql_field_count (&mysql) == 12) { | ||
| 57 | + /* mysql 3.23.x */ | ||
| 58 | + snprintf (slaveresult, SLAVERESULTSIZE, "Slave running: %s", row[6]); | ||
| 59 | + if (strcmp (row[6], "Yes") != 0) { | ||
| 60 | + mysql_free_result (res); | ||
| 61 | + mysql_close (&mysql); | ||
| 62 | + die (STATE_CRITICAL, "%s\n", slaveresult); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + } else { | ||
| 66 | + /* mysql 4.x.x */ | ||
| 67 | + snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s", row[9], row[10]); | ||
| 68 | + if (strcmp (row[9], "Yes") != 0 || strcmp (row[10], "Yes") != 0) { | ||
| 69 | + mysql_free_result (res); | ||
| 70 | + mysql_close (&mysql); | ||
| 71 | + die (STATE_CRITICAL, "%s\n", slaveresult); | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + /* free the result */ | ||
| 76 | + mysql_free_result (res); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | /* close the connection */ | ||
| 80 | mysql_close (&mysql); | ||
| 81 | |||
| 82 | /* print out the result of stats */ | ||
| 83 | - printf ("%s\n", result); | ||
| 84 | + if (check_slave) { | ||
| 85 | + printf ("%s %s\n", result, slaveresult); | ||
| 86 | + } else { | ||
| 87 | + printf ("%s\n", result); | ||
| 88 | + } | ||
| 89 | |||
| 90 | return STATE_OK; | ||
| 91 | } | ||
| 92 | @@ -108,6 +161,7 @@ | ||
| 93 | {"username", required_argument, 0, 'u'}, | ||
| 94 | {"password", required_argument, 0, 'p'}, | ||
| 95 | {"port", required_argument, 0, 'P'}, | ||
| 96 | + {"check-slave", no_argument, 0, 'S'}, | ||
| 97 | {"verbose", no_argument, 0, 'v'}, | ||
| 98 | {"version", no_argument, 0, 'V'}, | ||
| 99 | {"help", no_argument, 0, 'h'}, | ||
| 100 | @@ -118,7 +172,7 @@ | ||
| 101 | return ERROR; | ||
| 102 | |||
| 103 | while (1) { | ||
| 104 | - c = getopt_long (argc, argv, "hVP:p:u:d:H:", longopts, &option); | ||
| 105 | + c = getopt_long (argc, argv, "hVSP:p:u:d:H:", longopts, &option); | ||
| 106 | |||
| 107 | if (c == -1 || c == EOF) | ||
| 108 | break; | ||
| 109 | @@ -144,6 +198,9 @@ | ||
| 110 | case 'P': /* critical time threshold */ | ||
| 111 | db_port = atoi (optarg); | ||
| 112 | break; | ||
| 113 | + case 'S': | ||
| 114 | + check_slave = 1; /* check-slave */ | ||
| 115 | + break; | ||
| 116 | case 'V': /* version */ | ||
| 117 | print_revision (progname, revision); | ||
| 118 | exit (STATE_OK); | ||
| 119 | @@ -234,7 +291,9 @@ | ||
| 120 | -p, --password=STRING\n\ | ||
| 121 | Use the indicated password to authenticate the connection\n\ | ||
| 122 | ==> IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!! <==\n\ | ||
| 123 | - Your clear-text password will be visible as a process table entry\n")); | ||
| 124 | + Your clear-text password will be visible as a process table entry\n\ | ||
| 125 | + -S, --check-slave\n\ | ||
| 126 | + Check if the slave thread is running properly.\n")); | ||
| 127 | |||
| 128 | printf (_("\n\ | ||
| 129 | There are no required arguments. By default, the local database with\n\ | ||
| 130 | @@ -250,7 +309,7 @@ | ||
| 131 | print_usage (void) | ||
| 132 | { | ||
| 133 | printf (_("\ | ||
| 134 | -Usage: %s [-d database] [-H host] [-P port] [-u user] [-p password]\n"), | ||
| 135 | +Usage: %s [-d database] [-H host] [-P port] [-u user] [-p password] [-S]\n"), | ||
| 136 | progname); | ||
| 137 | printf (_(UT_HLP_VRS), progname, progname); | ||
| 138 | } | ||
diff --git a/web/attachments/98403-check_ifoperstatus-admin.diff b/web/attachments/98403-check_ifoperstatus-admin.diff new file mode 100644 index 0000000..8127684 --- /dev/null +++ b/web/attachments/98403-check_ifoperstatus-admin.diff | |||
| @@ -0,0 +1,85 @@ | |||
| 1 | *** nagios-plugins-1.3.1/plugins-scripts/check_ifoperstatus.pl Wed Feb 12 05:32:20 2003 | ||
| 2 | --- check_ifoperstatus.pl Thu Aug 19 15:34:22 2004 | ||
| 3 | *************** | ||
| 4 | *** 78,83 **** | ||
| 5 | --- 78,84 ---- | ||
| 6 | my $key; | ||
| 7 | my $lastc; | ||
| 8 | my $dormantWarn; | ||
| 9 | + my $adminWarn; | ||
| 10 | my $name; | ||
| 11 | |||
| 12 | |||
| 13 | *************** | ||
| 14 | *** 104,110 **** | ||
| 15 | "H=s" => \$hostname, "hostname=s" => \$hostname, | ||
| 16 | "I" => \$ifXTable, "ifmib" => \$ifXTable, | ||
| 17 | "n=s" => \$ifName, "name=s" => \$ifName, | ||
| 18 | ! "w=s" => \$dormantWarn, "warn=s" => \$dormantWarn ); | ||
| 19 | |||
| 20 | |||
| 21 | |||
| 22 | --- 105,112 ---- | ||
| 23 | "H=s" => \$hostname, "hostname=s" => \$hostname, | ||
| 24 | "I" => \$ifXTable, "ifmib" => \$ifXTable, | ||
| 25 | "n=s" => \$ifName, "name=s" => \$ifName, | ||
| 26 | ! "w=s" => \$dormantWarn, "warn=s" => \$dormantWarn, | ||
| 27 | ! "a=s" => \$adminWarn, "admin-down=s" => \$adminWarn ); | ||
| 28 | |||
| 29 | |||
| 30 | |||
| 31 | *************** | ||
| 32 | *** 235,243 **** | ||
| 33 | ## if AdminStatus is down - some one made a consious effort to change config | ||
| 34 | ## | ||
| 35 | if ( not ($response->{$snmpIfAdminStatus} == 1) ) { | ||
| 36 | ! $state = 'WARNING'; | ||
| 37 | ! $answer = "Interface $name (index $snmpkey) is administratively down."; | ||
| 38 | ! | ||
| 39 | } | ||
| 40 | ## Check operational status | ||
| 41 | elsif ( $response->{$snmpIfOperStatus} == 2 ) { | ||
| 42 | --- 237,252 ---- | ||
| 43 | ## if AdminStatus is down - some one made a consious effort to change config | ||
| 44 | ## | ||
| 45 | if ( not ($response->{$snmpIfAdminStatus} == 1) ) { | ||
| 46 | ! $answer = "Interface $name (index $snmpkey) is administratively down."; | ||
| 47 | ! if ( not defined $adminWarn or $adminWarn eq "w" ) { | ||
| 48 | ! $state = 'WARNING'; | ||
| 49 | ! } elsif ( $adminWarn eq "i" ) { | ||
| 50 | ! $state = 'OK'; | ||
| 51 | ! } elsif ( $adminWarn eq "c" ) { | ||
| 52 | ! $state = 'CRITICAL'; | ||
| 53 | ! } else { # If wrong value for -a, say warning | ||
| 54 | ! $state = 'WARNING'; | ||
| 55 | ! } | ||
| 56 | } | ||
| 57 | ## Check operational status | ||
| 58 | elsif ( $response->{$snmpIfOperStatus} == 2 ) { | ||
| 59 | *************** | ||
| 60 | *** 246,252 **** | ||
| 61 | } elsif ( $response->{$snmpIfOperStatus} == 5 ) { | ||
| 62 | if (defined $dormantWarn ) { | ||
| 63 | if ($dormantWarn eq "w") { | ||
| 64 | ! $state = 'WARNNG'; | ||
| 65 | $answer = "Interface $name (index $snmpkey) is dormant."; | ||
| 66 | }elsif($dormantWarn eq "c") { | ||
| 67 | $state = 'CRITICAL'; | ||
| 68 | --- 255,261 ---- | ||
| 69 | } elsif ( $response->{$snmpIfOperStatus} == 5 ) { | ||
| 70 | if (defined $dormantWarn ) { | ||
| 71 | if ($dormantWarn eq "w") { | ||
| 72 | ! $state = 'WARNING'; | ||
| 73 | $answer = "Interface $name (index $snmpkey) is dormant."; | ||
| 74 | }elsif($dormantWarn eq "c") { | ||
| 75 | $state = 'CRITICAL'; | ||
| 76 | *************** | ||
| 77 | *** 343,348 **** | ||
| 78 | --- 352,358 ---- | ||
| 79 | printf " -n (--name) the value should match the returned ifName\n"; | ||
| 80 | printf " (Implies the use of -I)\n"; | ||
| 81 | printf " -w (--warn =i|w|c) ignore|warn|crit if the interface is dormant (default critical)\n"; | ||
| 82 | + printf " -a (--admin-down =i|w|c) same for administratively down interfaces (default warning)\n"; | ||
| 83 | printf " -V (--version) Plugin version\n"; | ||
| 84 | printf " -h (--help) usage help \n\n"; | ||
| 85 | printf " -k or -d must be specified\n\n"; | ||
diff --git a/web/content/development.md b/web/content/development.md new file mode 100644 index 0000000..1b71c24 --- /dev/null +++ b/web/content/development.md | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | title: Development | ||
| 2 | parent: Home | ||
| 3 | menu-position: 5 | ||
| 4 | --- | ||
| 5 | |||
| 6 | # Development | ||
| 7 | |||
| 8 | ## Software Repositories | ||
| 9 | |||
| 10 | The [Nagios Plugins Development Team][team] takes care of three projects: | ||
| 11 | |||
| 12 | * Nagios Plugins — the core bundle of standard plugins. | ||
| 13 | * Nagios::Plugin — a module used by plugins written in Perl. | ||
| 14 | * NagiosMIB — SNMP MIB files for traps sent from [Nagios][nagios]. | ||
| 15 | |||
| 16 | These projects are maintained in separate repositories on [GitHub][github]: | ||
| 17 | |||
| 18 | * <https://github.com/nagios-plugins/repositories> | ||
| 19 | |||
| 20 | Contributions are always welcome! If you'd like to provide patches, please | ||
| 21 | [fork][fork] the desired repository and submit a [pull request][pull]. In | ||
| 22 | case you're not familiar with Git, you might want to look into [Scott | ||
| 23 | Chacon][scott]'s [Pro Git][book] book available on the [Git web site][git] | ||
| 24 | first. | ||
| 25 | |||
| 26 | ## Development Guidelines | ||
| 27 | |||
| 28 | Apart from the actual code, the [team][team] also maintains the official | ||
| 29 | [Nagios Plugin Development Guidelines][guidelines]. If you plan on | ||
| 30 | contributing to the standard plugins package, or writing your own checks, you | ||
| 31 | should read them! | ||
| 32 | |||
| 33 | [team]: team.html "Nagios Plugins Development Team" | ||
| 34 | [nagios]: http://www.nagios.org/ "Nagios" | ||
| 35 | [github]: https://github.com/ "GitHub" | ||
| 36 | [fork]: https://help.github.com/articles/fork-a-repo "Fork Documentation" | ||
| 37 | [pull]: https://help.github.com/articles/using-pull-requests "Pull Request Documentation" | ||
| 38 | [scott]: http://scottchacon.com/ "Scott Chacon" | ||
| 39 | [book]: http://git-scm.com/book "Pro Git" | ||
| 40 | [git]: http://git-scm.com/ "Git" | ||
| 41 | [guidelines]: doc/guidelines.html "Nagios Plugin Development Guidelines" | ||
| 42 | |||
| 43 | <!--% # vim:set filetype=markdown textwidth=78 joinspaces: # %--> | ||
diff --git a/web/content/doc/faq/index.md b/web/content/doc/faq/index.md new file mode 100644 index 0000000..18584f2 --- /dev/null +++ b/web/content/doc/faq/index.md | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | title: FAQ | ||
| 2 | parent: Documentation | ||
| 3 | --- | ||
| 4 | |||
| 5 | # FAQ | ||
| 6 | |||
| 7 | The list of Frequently Asked Questions (FAQ) will come back soon. | ||
| 8 | |||
| 9 | <!--% # vim:set filetype=markdown textwidth=78 joinspaces: # %--> | ||
diff --git a/web/content/doc/index.md b/web/content/doc/index.md new file mode 100644 index 0000000..7b2d098 --- /dev/null +++ b/web/content/doc/index.md | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | title: Documentation | ||
| 2 | parent: Home | ||
| 3 | menu-position: 3 | ||
| 4 | --- | ||
| 5 | |||
| 6 | # Documentation | ||
| 7 | |||
| 8 | The Nagios Plugins documentation is split up into three parts: | ||
| 9 | |||
| 10 | 1. **[Manual Pages][man]** | ||
| 11 | This part provides documentation for each individual plugin. | ||
| 12 | |||
| 13 | 2. **[FAQ][faq]** | ||
| 14 | The FAQ section offers additional information on the Nagios Plugins | ||
| 15 | package as a whole. | ||
| 16 | |||
| 17 | 3. **[Presentation][video]** | ||
| 18 | A video that shows how to write your own check using the | ||
| 19 | [Nagios::Plugin][module] Perl module. | ||
| 20 | |||
| 21 | [man]: doc/man/index.html "Manual Pages" | ||
| 22 | [faq]: doc/faq/index.html "Frequently Asked Questions" | ||
| 23 | [video]: doc/presentation.html "Nagios::Plugin Presentation" | ||
| 24 | [module]: http://search.cpan.org/dist/Nagios-Plugin/ "Nagios::Plugin" | ||
| 25 | |||
| 26 | <!--% # vim:set filetype=markdown textwidth=78 joinspaces: # %--> | ||
diff --git a/web/content/doc/man/index.md b/web/content/doc/man/index.md new file mode 100644 index 0000000..d3c60c8 --- /dev/null +++ b/web/content/doc/man/index.md | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | title: Manpages | ||
| 2 | parent: Documentation | ||
| 3 | --- | ||
| 4 | |||
| 5 | # Manual Pages | ||
| 6 | |||
| 7 | There are two levels of documentation for each plugin: | ||
| 8 | |||
| 9 | 1. **`check_dummy --usage`** | ||
| 10 | Basic usage, with the most common command line options. | ||
| 11 | |||
| 12 | 2. **`check_dummy --help`** | ||
| 13 | More text, listing all the options available for a plugin. This text is | ||
| 14 | usually translated. | ||
| 15 | |||
| 16 | You can also access the most recent `--help` output for each plugin online: | ||
| 17 | |||
| 18 | <!--% list_kids() %--> | ||
| 19 | |||
| 20 | <!--% # vim:set filetype=markdown textwidth=78 joinspaces: # %--> | ||
diff --git a/web/content/doc/news.txt b/web/content/doc/news.txt new file mode 120000 index 0000000..f5208d5 --- /dev/null +++ b/web/content/doc/news.txt | |||
| @@ -0,0 +1 @@ | |||
| /home/plugins/exported/nagios-plugins/NEWS \ No newline at end of file | |||
diff --git a/web/content/doc/presentation.md b/web/content/doc/presentation.md new file mode 100644 index 0000000..458b101 --- /dev/null +++ b/web/content/doc/presentation.md | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | title: Presentation | ||
| 2 | parent: Documentation | ||
| 3 | --- | ||
| 4 | |||
| 5 | # Presentation | ||
| 6 | |||
| 7 | Former Nagios Plugins team lead Ton Voon gave a 15-minutes lightning talk | ||
| 8 | about the Nagios Plugins at [FOSDEM][fosdem]. He made a screencast of [the | ||
| 9 | presentation][talk] in Quicktime format (35 MB): | ||
| 10 | |||
| 11 | * [fosdem.mov][screencast] | ||
| 12 | |||
| 13 | The `check_weather` script demonstrated in the screencast is also available | ||
| 14 | for download, with additional comments: | ||
| 15 | |||
| 16 | * [check_weather.pl][script] | ||
| 17 | |||
| 18 | Both files are also [available via FTP][mirror]. | ||
| 19 | |||
| 20 | [fosdem]: https://fosdem.org/ "FOSDEM" | ||
| 21 | [talk]: https://archive.fosdem.org/2007/schedule/events/lt_nagios_plugins.html "Ton's Talk" | ||
| 22 | [screencast]: https://www.nagios-plugins.org/download/presentation/fosdem.mov "Screencast" | ||
| 23 | [script]: https://www.nagios-plugins.org/download/presentation/check_weather.pl "check_weather" | ||
| 24 | [mirror]: ftp://ftp.fu-berlin.de/unix/network/nagios-plugins/presentation/ "FTP Mirror" | ||
| 25 | |||
| 26 | <!--% # vim:set filetype=markdown textwidth=78 joinspaces: # %--> | ||
diff --git a/web/content/download.md b/web/content/download.md new file mode 100644 index 0000000..6f8a0fc --- /dev/null +++ b/web/content/download.md | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | title: Download | ||
| 2 | parent: Home | ||
| 3 | menu-position: 2 | ||
| 4 | --- | ||
| 5 | |||
| 6 | # Download | ||
| 7 | |||
| 8 | ## Nagios Plugins | ||
| 9 | |||
| 10 | ### Stable Release | ||
| 11 | |||
| 12 | The current stable Nagios Plugins release is <!--{plugins_release}-->. You | ||
| 13 | can grab the source tarball from here: | ||
| 14 | |||
| 15 | * [nagios-plugins-<!--{plugins_release}-->.tar.gz][tar1] ([sum][sum1]) | ||
| 16 | |||
| 17 | See the [release history][news] for a summary of changes between versions. | ||
| 18 | Old releases can be found in the [download area][download]. There's also an | ||
| 19 | [FTP mirror][mirror] available. | ||
| 20 | |||
| 21 | ### Development Snapshot | ||
| 22 | |||
| 23 | The current development shapshot is available here: | ||
| 24 | |||
| 25 | * [nagios-plugins-master.tar.gz][tar2] ([sum][sum2]) | ||
| 26 | |||
| 27 | It is rebuilt from the `master` branch of the [Nagios Plugins | ||
| 28 | repository][repository] whenever that branch changes. Snapshots built from | ||
| 29 | other development branches are also available in the [snapshot | ||
| 30 | directory][snapshot] of the [download area][download]. | ||
| 31 | |||
| 32 | ## Nagios::Plugin | ||
| 33 | |||
| 34 | The Nagios::Plugin module is available from [CPAN][cpan]: | ||
| 35 | |||
| 36 | * <http://search.cpan.org/dist/Nagios-Plugin/> | ||
| 37 | |||
| 38 | ## NagiosMIB | ||
| 39 | |||
| 40 | The current NagiosMIB tarball is available from here: | ||
| 41 | |||
| 42 | * [nagiosmib-<!--{mib_release}-->.tar.gz][tar3] ([sum][sum3]) | ||
| 43 | |||
| 44 | Old versions can be found in the [download area][download]. | ||
| 45 | |||
| 46 | [mirror]: ftp://ftp.fu-berlin.de/unix/network/nagios-plugins/ "FTP Mirror" | ||
| 47 | [repository]: https://github.com/nagios-plugins/nagios-plugins "Nagios Plugins Git Repository" | ||
| 48 | [news]: doc/news.txt "NEWS" | ||
| 49 | [download]: download/ "Download Area" | ||
| 50 | [snapshot]: download/snapshot/ "Snapshot Directory" | ||
| 51 | [cpan]: http://www.cpan.org/ "CPAN" | ||
| 52 | [tar1]: download/nagios-plugins-{{plugins_release}}.tar.gz "Current Release Tarball" | ||
| 53 | [sum1]: download/nagios-plugins-{{plugins_release}}.tar.gz.sha1 "SHA-1 Sum" | ||
| 54 | [tar2]: download/snapshot/nagios-plugins-master.tar.gz "Current Snapshot Tarball" | ||
| 55 | [sum2]: download/snapshot/nagios-plugins-master.tar.gz.sha1 "SHA-1 Sum" | ||
| 56 | [tar3]: download/nagiosmib-{{mib_release}}.tar.gz "Current NagiosMIB Tarball" | ||
| 57 | [sum3]: download/nagiosmib-{{mib_release}}.tar.gz.sha1 "SHA-1 Sum" | ||
| 58 | |||
| 59 | <!--% # vim:set filetype=markdown textwidth=78 joinspaces: # %--> | ||
diff --git a/web/content/impressum.md b/web/content/impressum.md new file mode 100644 index 0000000..8f5ff04 --- /dev/null +++ b/web/content/impressum.md | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | title: Impressum | ||
| 2 | parent: Home | ||
| 3 | --- | ||
| 4 | |||
| 5 | # Impressum | ||
| 6 | |||
| 7 | *The following information (“Impressum”) is [required][law] under German law.* | ||
| 8 | |||
| 9 | Responsible for the content of this site: | ||
| 10 | |||
| 11 | Holger Weiß | ||
| 12 | Gutsmuthsstr. 19 | ||
| 13 | 12163 Berlin | ||
| 14 | Germany | ||
| 15 | |||
| 16 | **Phone:** | ||
| 17 | +49 30 61286685 | ||
| 18 | |||
| 19 | **Email:** | ||
| 20 | holger@zedat.fu-berlin.de | ||
| 21 | |||
| 22 | **Jabber:** | ||
| 23 | holger@jabber.fu-berlin.de | ||
| 24 | |||
| 25 | [law]: http://www.gesetze-im-internet.de/tmg/__5.html | ||
| 26 | |||
| 27 | <!--% # vim:set filetype=markdown textwidth=78 joinspaces: # %--> | ||
diff --git a/web/content/index.md b/web/content/index.md new file mode 100644 index 0000000..cf4af8f --- /dev/null +++ b/web/content/index.md | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | title: Home | ||
| 2 | menu-position: 1 | ||
| 3 | --- | ||
| 4 | |||
| 5 | # The Nagios Plugins Project | ||
| 6 | |||
| 7 | We, the [Nagios Plugins Development Team][team], maintain a bundle of more | ||
| 8 | than fifty standard plugins for [Nagios][nagios], [Icinga][icinga], | ||
| 9 | [Shinken][shinken], and other monitoring applications that use the | ||
| 10 | straightforward plugin interface [originally invented][history] by the [Nagios | ||
| 11 | folks][folks]. Each plugin is a stand-alone command line tool that provides a | ||
| 12 | specific type of check. Typically, your monitoring software runs these | ||
| 13 | plugins to determine the current status of hosts and services on your network. | ||
| 14 | |||
| 15 | Some of the provided plugins let you check local system metrics (such as [load | ||
| 16 | averages][load], [processes][procs], or [disk space usage][disk]), others use | ||
| 17 | various network protocols (such as [ICMP][icmp], [SNMP][snmp], or | ||
| 18 | [HTTP][http]) to perform remote checks. This allows for checking a large | ||
| 19 | number of common host and service types. For more specific needs, thousands | ||
| 20 | of community-contributed plugins can be found on sites such as [Nagios | ||
| 21 | Exchange][nagex] or [Monitoring Exchange][monex]. | ||
| 22 | |||
| 23 | In addition to the core plugins bundle, we maintain a [Perl module][module] | ||
| 24 | that makes it [easy][presentation] to write your own plugin. We also take | ||
| 25 | care of an SNMP MIB used for traps sent from Nagios, and of the [Nagios Plugin | ||
| 26 | Development Guidelines][guidelines]. | ||
| 27 | |||
| 28 | You can get the latest releases from the [download page][download]. | ||
| 29 | |||
| 30 | [team]: team.html "Nagios Plugins Development Team" | ||
| 31 | [nagios]: http://www.nagios.org/ "Nagios" | ||
| 32 | [icinga]: https://www.icinga.org/ "Icinga" | ||
| 33 | [shinken]: http://www.shinken-monitoring.org/ "Shinken" | ||
| 34 | [history]: http://www.nagios.org/about/history "Nagios (Plugins) History" | ||
| 35 | [folks]: http://www.nagios.org/about/team "Nagios Team" | ||
| 36 | [load]: man/check_load.html "check_load" | ||
| 37 | [procs]: man/check_procs.html "check_procs" | ||
| 38 | [disk]: man/check_disk.html "check_disk" | ||
| 39 | [icmp]: man/check_icmp.html "check_icmp" | ||
| 40 | [snmp]: man/check_snmp.html "check_snmp" | ||
| 41 | [http]: man/check_http.html "check_http" | ||
| 42 | [nagex]: http://exchange.nagios.org/directory/Plugins "Plugins on Nagios Exchange" | ||
| 43 | [monex]: https://www.monitoringexchange.org/inventory/Check-Plugins "Plugins on Monitoring Exchange" | ||
| 44 | [module]: http://search.cpan.org/dist/Nagios-Plugin/ "Nagios::Plugin Module" | ||
| 45 | [guidelines]: doc/guidelines.html "Monitoring Plugin Development Guidelines" | ||
| 46 | [presentation]: doc/presentation.html "Nagios::Plugin Presentation" | ||
| 47 | [download]: download.html "Download" | ||
| 48 | |||
| 49 | <!--% # vim:set filetype=markdown textwidth=78 joinspaces: # %--> | ||
diff --git a/web/content/media/favicon.ico b/web/content/media/favicon.ico new file mode 100644 index 0000000..76ae569 --- /dev/null +++ b/web/content/media/favicon.ico | |||
| Binary files differ | |||
diff --git a/web/content/media/github.png b/web/content/media/github.png new file mode 100644 index 0000000..1e19c21 --- /dev/null +++ b/web/content/media/github.png | |||
| Binary files differ | |||
diff --git a/web/content/media/plugins.css b/web/content/media/plugins.css new file mode 100644 index 0000000..7910aad --- /dev/null +++ b/web/content/media/plugins.css | |||
| @@ -0,0 +1,128 @@ | |||
| 1 | /* | ||
| 2 | * Nagios Plugins style sheet. | ||
| 3 | * | ||
| 4 | * Color scheme: | ||
| 5 | * | ||
| 6 | * - See <http://colorschemedesigner.com/#3y21T--rOw0w0>. | ||
| 7 | * - Additionally, we use the CSS color "dimgray" (#696969) for stuff like the | ||
| 8 | * breadcrumb navigation and the footer. | ||
| 9 | */ | ||
| 10 | |||
| 11 | @import url("https://fonts.googleapis.com/css?family=Bitter"); | ||
| 12 | @import url("https://fonts.googleapis.com/css?family=Source+Sans+Pro"); | ||
| 13 | @import url("https://fonts.googleapis.com/css?family=Source+Code+Pro"); | ||
| 14 | |||
| 15 | body { | ||
| 16 | max-width: 45em; | ||
| 17 | margin: 1em auto; | ||
| 18 | font-family: "Source Sans Pro", sans-serif; | ||
| 19 | color: #000; | ||
| 20 | text-rendering: optimizeLegibility; | ||
| 21 | -webkit-hyphens: auto; | ||
| 22 | -moz-hyphens: auto; | ||
| 23 | -ms-hyphens: auto; | ||
| 24 | -o-hyphens: auto; | ||
| 25 | hyphens: auto; | ||
| 26 | } | ||
| 27 | |||
| 28 | h1, h2, h3, h4, h5, h6 { | ||
| 29 | font-family: "Bitter", serif; | ||
| 30 | color: #004e8f; | ||
| 31 | } | ||
| 32 | |||
| 33 | code, kbd { | ||
| 34 | font-family: "Source Code Pro", monospace; | ||
| 35 | } | ||
| 36 | |||
| 37 | pre { | ||
| 38 | font-family: "Source Code Pro", monospace; | ||
| 39 | font-size: small; | ||
| 40 | } | ||
| 41 | |||
| 42 | div#breadcrumb { | ||
| 43 | padding: 1em 1em 0.2em; | ||
| 44 | } | ||
| 45 | |||
| 46 | div#content { | ||
| 47 | padding: 0.2em 1em 1em; | ||
| 48 | } | ||
| 49 | |||
| 50 | div#footer { | ||
| 51 | padding: 1em; | ||
| 52 | } | ||
| 53 | |||
| 54 | div#menu { | ||
| 55 | padding: 0.6em 0 0.6em 0; | ||
| 56 | background-color: #1b476b; | ||
| 57 | font-weight: bold; | ||
| 58 | } | ||
| 59 | |||
| 60 | div#menu span { | ||
| 61 | padding: 0.6em; | ||
| 62 | } | ||
| 63 | |||
| 64 | div#menu span.current { | ||
| 65 | color: #fff; | ||
| 66 | background-color: #5a95c7; | ||
| 67 | } | ||
| 68 | |||
| 69 | div#menu a { | ||
| 70 | color: #fff; | ||
| 71 | text-decoration: none; | ||
| 72 | -webkit-transition-property: color; | ||
| 73 | -moz-transition-property: color; | ||
| 74 | -ms-transition-property: color; | ||
| 75 | -o-transition-property: color; | ||
| 76 | transition-property: color; | ||
| 77 | -webkit-transition-duration: 0.3s; | ||
| 78 | -moz-transition-duration: 0.3s; | ||
| 79 | -ms-transition-duration: 0.3s; | ||
| 80 | -o-transition-duration: 0.3s; | ||
| 81 | transition-duration: 0.3s; | ||
| 82 | } | ||
| 83 | |||
| 84 | div#menu a:hover { | ||
| 85 | color: #eeb76b; | ||
| 86 | } | ||
| 87 | |||
| 88 | table /* Nginx Fancy Index. */ { | ||
| 89 | font-family: "Source Code Pro", monospace; | ||
| 90 | font-size: small; | ||
| 91 | } | ||
| 92 | |||
| 93 | div#content a, | ||
| 94 | table a { | ||
| 95 | color: #3283c7; | ||
| 96 | text-decoration: none; | ||
| 97 | border-bottom: 1px dotted #3283c7; | ||
| 98 | } | ||
| 99 | |||
| 100 | div#content a:hover, | ||
| 101 | table a:hover { | ||
| 102 | color: #3283c7; /* Overwrite Fancy Index CSS. */ | ||
| 103 | border-bottom: 1px solid #3283c7; | ||
| 104 | } | ||
| 105 | |||
| 106 | div#breadcrumb { | ||
| 107 | color: #696969; | ||
| 108 | font-size: small; | ||
| 109 | } | ||
| 110 | |||
| 111 | div#footer { | ||
| 112 | color: #696969; | ||
| 113 | text-align: center; | ||
| 114 | font-size: small; | ||
| 115 | line-height: 150%; | ||
| 116 | } | ||
| 117 | |||
| 118 | div#breadcrumb a, | ||
| 119 | div#footer a { | ||
| 120 | color: #696969; | ||
| 121 | text-decoration: none; | ||
| 122 | border-bottom: 1px dotted #696969; | ||
| 123 | } | ||
| 124 | |||
| 125 | div#breadcrumb a:hover, | ||
| 126 | div#footer a:hover { | ||
| 127 | border-bottom: 1px solid #696969; | ||
| 128 | } | ||
diff --git a/web/content/support.md b/web/content/support.md new file mode 100644 index 0000000..0859f28 --- /dev/null +++ b/web/content/support.md | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | title: Support | ||
| 2 | parent: Home | ||
| 3 | menu-position: 4 | ||
| 4 | --- | ||
| 5 | |||
| 6 | # Support | ||
| 7 | |||
| 8 | ## Bug Tracker | ||
| 9 | |||
| 10 | If you believe you found a bug, you might want to [check][search] whether it | ||
| 11 | has been reported to our [issue tracker][tracker] already. Please also try | ||
| 12 | the [current snapshot][snapshot], as the bug may be fixed in the latest code. | ||
| 13 | Otherwise, please submit a [new issue][new] and include all information that | ||
| 14 | might be relevant! | ||
| 15 | |||
| 16 | ## Mailing Lists | ||
| 17 | |||
| 18 | <!--% | ||
| 19 | # There are four mailing lists for the Nagios Plugins: | ||
| 20 | # | ||
| 21 | # * General discussion and support: **<help@nagios-plugins.org>** | ||
| 22 | # [Subscribe][help-sub] | [Archive][help-arch] | [Gmane][help-gmane] | ||
| 23 | # | ||
| 24 | # * Development-related issues: **<devel@nagios-plugins.org>** | ||
| 25 | # [Subscribe][devel-sub] | [Archive][devel-arch] | [Gmane][devel-gmane] | ||
| 26 | # | ||
| 27 | # * Git commits (read-only): **<commits@nagios-plugins.org>** | ||
| 28 | # [Subscribe][commits-sub] | [Archive][commits-arch] | [Gmane][commits-gmane] | ||
| 29 | # | ||
| 30 | # * Announcements (read-only): **<announce@nagios-plugins.org>** | ||
| 31 | # [Subscribe][announce-sub] | [Archive][announce-arch] | [Gmane][announce-gmane] | ||
| 32 | # | ||
| 33 | # Announcements are also sent to the [help][help-sub] and [devel][devel-sub] | ||
| 34 | # mailing lists, so the [announce][announce-sub] list is generally only useful | ||
| 35 | # if you'd like to be notified of new releases without following any | ||
| 36 | # discussions. | ||
| 37 | %--> | ||
| 38 | |||
| 39 | <!--% # OLD LISTS # %--> | ||
| 40 | There are three mailing lists for the Nagios Plugins: | ||
| 41 | |||
| 42 | * General discussion and support: **<nagiosplug-help@lists.sourceforge.net>** | ||
| 43 | [Subscribe][help-sub] | [Archive][help-arch] | [Gmane][help-gmane] | ||
| 44 | |||
| 45 | * Development-related issues: **<nagiosplug-devel@lists.sourceforge.net>** | ||
| 46 | [Subscribe][devel-sub] | [Archive][devel-arch] | [Gmane][devel-gmane] | ||
| 47 | |||
| 48 | * Git commits (read-only): **<nagiosplug-checkins@lists.sourceforge.net>** | ||
| 49 | [Subscribe][commits-sub] | [Archive][commits-arch] | [Gmane][commits-gmane] | ||
| 50 | <!--% # OLD LISTS # %--> | ||
| 51 | |||
| 52 | Be aware that these mailing lists are read by volunteers, so responses may | ||
| 53 | take time, if at all. | ||
| 54 | |||
| 55 | ## IRC | ||
| 56 | |||
| 57 | Plugin issues are usually discussed in the `#Nagios` or `#Icinga` channels on | ||
| 58 | [freenode][freenode]. Some of the developers also hang around in | ||
| 59 | `#Nagios-Devel`. | ||
| 60 | |||
| 61 | [snapshot]: download/snapshot/nagios-plugins-master.tar.gz "Current Snapshot Tarball" | ||
| 62 | [search]: https://github.com/nagios-plugins/nagios-plugins/search?type=Issues "Issue Tracker Search" | ||
| 63 | [tracker]: https://github.com/nagios-plugins/nagios-plugins/issues "Issue Tracker" | ||
| 64 | [new]: https://github.com/nagios-plugins/nagios-plugins/issues/new "New Issue" | ||
| 65 | [freenode]: http://freenode.net/ "Freenode Network" | ||
| 66 | [help-sub]: https://lists.sourceforge.net/lists/listinfo/nagiosplug-help | ||
| 67 | [help-arch]: https://sourceforge.net/p/nagiosplug/mailman/nagiosplug-help | ||
| 68 | [help-gmane]: http://dir.gmane.org/gmane.network.nagios.plugins | ||
| 69 | [devel-sub]: https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel | ||
| 70 | [devel-arch]: https://sourceforge.net/p/nagiosplug/mailman/nagiosplug-devel | ||
| 71 | [devel-gmane]: http://dir.gmane.org/gmane.network.nagios.plugins.devel | ||
| 72 | [commits-sub]: https://lists.sourceforge.net/lists/listinfo/nagiosplug-checkins | ||
| 73 | [commits-arch]: https://sourceforge.net/p/nagiosplug/mailman/nagiosplug-checkins | ||
| 74 | [commits-gmane]: http://dir.gmane.org/gmane.network.nagios.plugins.cvs | ||
| 75 | [announce-sub]: /fixme | ||
| 76 | [announce-arch]: /fixme | ||
| 77 | [announce-gmane]: /fixme | ||
| 78 | |||
| 79 | <!--% # vim:set filetype=markdown textwidth=78 joinspaces: # %--> | ||
diff --git a/web/content/team.md b/web/content/team.md new file mode 100644 index 0000000..bf70bb2 --- /dev/null +++ b/web/content/team.md | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | title: Team | ||
| 2 | parent: Home | ||
| 3 | --- | ||
| 4 | |||
| 5 | # Nagios Plugins Development Team | ||
| 6 | |||
| 7 | The Nagios Plugins are maintained by the following group of developers: | ||
| 8 | |||
| 9 | * Holger Weiß *(Patch Review, Development, Team Lead)* | ||
| 10 | * Matthias Eble *(Patch Review, Development)* | ||
| 11 | * Sven Nierlein *(Patch Review, Development)* | ||
| 12 | * Thomas Guyot-Sionnest *(Patch Review, Development)* | ||
| 13 | * Ton Voon *(Patch Review, Development)* | ||
| 14 | |||
| 15 | Previous team members: | ||
| 16 | |||
| 17 | * Benoit Mortier | ||
| 18 | * Ethan Galstad | ||
| 19 | * Gavin Carr | ||
| 20 | * Harper Mann | ||
| 21 | * Jeremy Bouse | ||
| 22 | * Karl DeBisschop | ||
| 23 | * Matthew Kent | ||
| 24 | * Michael Wirtgen | ||
| 25 | * Nathan Vonnahme | ||
| 26 | * Peter Bray | ||
| 27 | * Sean Finney | ||
| 28 | * Stanley Hopcroft | ||
| 29 | * Subhendu Ghosh | ||
| 30 | |||
| 31 | <!--% # vim:set filetype=markdown textwidth=78 joinspaces: # %--> | ||
diff --git a/web/macros.py b/web/macros.py new file mode 100644 index 0000000..a4566fe --- /dev/null +++ b/web/macros.py | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | import time | ||
| 2 | |||
| 3 | plugins_release = '1.4.16' | ||
| 4 | mib_release = '1.0.1' | ||
| 5 | page = { | ||
| 6 | "description": "Standard plugins for Nagios and compatible monitoring solutions.", | ||
| 7 | "keywords": "Nagios, Icinga, Shinken, Monitoring, Official, Plugins, Open, Source, Free, Software" | ||
| 8 | } | ||
| 9 | |||
| 10 | def menu(): | ||
| 11 | menu_pages = [p for p in pages if 'menu-position' in p] | ||
| 12 | menu_pages.sort(key=lambda p: int(p['menu-position'])) | ||
| 13 | for p in menu_pages: | ||
| 14 | if p.title == page.title: | ||
| 15 | print('<span class="current">%s</span>' % hx(p.title)) | ||
| 16 | else: | ||
| 17 | print('<span><a href="%s">%s</a></span>' % (p.url, hx(p.title))) | ||
| 18 | |||
| 19 | def breadcrumb(): | ||
| 20 | parents = {p.title: (p.url, p.get('parent')) for p in pages} | ||
| 21 | title = page.title | ||
| 22 | output = hx(title) | ||
| 23 | while parents[title][1] is not None: | ||
| 24 | title = parents[title][1] | ||
| 25 | url = parents[title][0] | ||
| 26 | output = '<a href="%s">%s</a> > %s' % (url, hx(title), output) | ||
| 27 | if output == hx(page.title): # Hide breadcrumb if the page has no parent. | ||
| 28 | output = ' ' | ||
| 29 | return output | ||
| 30 | |||
| 31 | def list_kids(): | ||
| 32 | kids = [(p.url, p.title) for p in pages if p.get('parent') == page.title] | ||
| 33 | for kid in sorted(kids): | ||
| 34 | print('* [%s](%s)' % (kid[1], kid[0])) | ||
| 35 | |||
| 36 | def copyright_years(since=None): | ||
| 37 | this_year = time.gmtime().tm_year | ||
| 38 | if since is not None and int(since) != this_year: | ||
| 39 | return str(since) + '–' + str(this_year) | ||
| 40 | else: | ||
| 41 | return str(this_year) | ||
| 42 | |||
| 43 | # vim:set expandtab softtabstop=4 shiftwidth=4 textwidth=80: | ||
diff --git a/web/page.html b/web/page.html new file mode 100644 index 0000000..c0de871 --- /dev/null +++ b/web/page.html | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | <?xml version="1.0" encoding="{{ __encoding__ }}"?> | ||
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" | ||
| 3 | "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | ||
| 4 | |||
| 5 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
| 6 | |||
| 7 | <head> | ||
| 8 | <title>Nagios Plugins - {{ hx(page.title) }}</title> | ||
| 9 | <meta http-equiv="Content-Type" content="text/html; charset={{ __encoding__ }}" /> | ||
| 10 | <meta name="description" content="{{ hx(page.description) }}" /> | ||
| 11 | <meta name="keywords" content="{{ hx(page.keywords) }}" /> | ||
| 12 | <link href="media/plugins.css" rel="stylesheet" type="text/css" /> | ||
| 13 | <link href="media/favicon.ico" rel="shortcut icon" type="image/x-icon" /> | ||
| 14 | </head> | ||
| 15 | |||
| 16 | <body> | ||
| 17 | <div> | ||
| 18 | <a href="https://github.com/nagios-plugins"><img | ||
| 19 | style="position: absolute; top: 0; right: 0; border: 0;" | ||
| 20 | src="media/github.png" alt="Fork me on GitHub"/></a> | ||
| 21 | </div> | ||
| 22 | <div id="menu">{% menu() %}</div> | ||
| 23 | <div id="breadcrumb">{{ breadcrumb() }}</div> | ||
| 24 | <div id="content">{{ __content__ }}</div> | ||
| 25 | <div id="footer"> | ||
| 26 | Copyright © {{ copyright_years(since=2013) }} | ||
| 27 | <a href="team.html">Nagios Plugins Development Team</a> | | ||
| 28 | <a href="impressum.html">Impressum</a><br /> | ||
| 29 | Nagios is a registered trademark of | ||
| 30 | <a href="http://www.nagios.com/about/company">Nagios Enterprises, LLC</a>. | ||
| 31 | </div> | ||
| 32 | </body> | ||
| 33 | |||
| 34 | </html> | ||
