Ignore:
Timestamp:
Apr 13, 2012, 6:54:31 PM (13 years ago)
Author:
rick
Message:

Logging configs and check fixes:

  • Network Status file.
  • SNMPD syslog logging.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/releng-9.0/nanobsd/files/usr/local/sbin/check-inet-alive

    r10469 r10481  
    99# XXX: Do we need to manage state, like DHCP here?
    1010# XXX: Check if page output is actually the output expected and not some weird captive portal somewhere.
     11# XXX: For effiently reasons this should be combined with the nagios check_inet check
    1112#
    1213# Rick van der Zwet <info@rickvanderzwet.nl>
    1314#
    14 
    15 # Check if we need to check inet at all
    16 . /etc/rc.subr
    17 load_rc_config "lvrouted"
    18 : ${lvouted_enable="NO"}
    19 : ${service_ileiden="NO"}
    20 : ${service_proxy="NO"}
    21 (( checkyesno service_ileiden || checkyesno service_proxy ) && checkyesno lvouted_enable ) || exit 0
    22 
    23 
    2415
    2516TAG=`basename $0`
     
    2718service lvrouted onestatus > /dev/null && LVROUTED_STATUS="running" || LVROUTED_STATUS="stopped"
    2819
     20check_http() {
     21 fetch -o /dev/null -q $* 2>/dev/null
     22}
     23
    2924# Main I-net check
    30 fetch -o /dev/null -q http://proxy-test.wirelessleiden.nl && INET_STATUS=up
     25check_http http://proxy-test.wirelessleiden.nl && INET_STATUS=up
    3126
    3227if [ $INET_STATUS = "down" ]; then
    3328  # Failback internet check
    34   fetch -o /dev/null http://ams-ix.net && INET_STATUS=up
     29  check_http http://ams-ix.net && INET_STATUS=up
    3530fi
    3631
     
    4035  service lvrouted stop | logger -t "$TAG"
    4136fi
     37
     38# Retrieve proxy status
     39export HTTP_PROXY=${HTTP_PROXY-:http://proxy.wleiden.net:3128}
     40PROXY_STATUS=down
     41check_http http://proxy-test.wirelessleiden.nl && PROXY_STATUS=down
     42
     43if [ $INET_STATUS = "down" ]; then
     44  # Failback internet check
     45  check_http http://ams-ix.net && PROXY_STATUS=up
     46fi
     47
     48echo -e "internet=$INET_STATUS\nproxy=$PROXY_STATUS" > /tmp/network.status
Note: See TracChangeset for help on using the changeset viewer.