source: hybrid/branches/releng-9/nanobsd/files/usr/local/libexec/nagios/check_inet

Last change on this file was 14358, checked in by rick, 6 years ago

Fix documentation files no longer installed

  • Property svn:executable set to *
File size: 855 bytes
Line 
1#!/bin/sh
2
3PATH=$PATH:/bin:/usr/bin
4export PATH
5
6# HTTP proxy to use
7HTTP_PROXY=http://proxy.wleiden.net:3128
8
9# Test page to query
10PROXY_TEST=http://proxy-test.wirelessleiden.nl/
11
12# Make variable global, so fetch can use it
13export HTTP_PROXY
14
15# Query the webpage
16SPEEDOUT=`fetch -o /dev/null ${PROXY_TEST} 2>&1`
17
18# What is the Exit code of fetch?
19SPEEDEXIT=$?
20
21# The speed by which the webpages was retrieved"
22SPEED=`echo ${SPEEDOUT} | awk '{ print $4 " " $5 }'`
23
24# What was the format of speed (Bps)
25TYPE=`echo ${SPEEDOUT} | awk '{ print $5 }'`
26
27# Dit the fetcommand exit happy, and was the format as we expected
28if [ ${SPEEDEXIT} -eq 0 -a "$TYPE" = "Bps" ]; then
29
30 # Let's celebrate, it was successfull
31 echo "INET OK: $SPEED"
32 exit 0
33else
34
35 # Oh no, time to get drunk, retrieval was unsuccessfull
36 echo "INET CRITICAL: $SPEEDOUT\n"
37 exit 2
38
39fi
40
Note: See TracBrowser for help on using the repository browser.