| Line | |
|---|
| 1 | #!/bin/sh
|
|---|
| 2 | # Richard van Mansom, richardvm@wirelessleiden.nl, March 2010
|
|---|
| 3 |
|
|---|
| 4 | # Minimum number of non local routes.
|
|---|
| 5 | VALID=1
|
|---|
| 6 |
|
|---|
| 7 | # 1. Show routing table
|
|---|
| 8 | # 2. Only show routes which includes subnets
|
|---|
| 9 | # 3. Discard anything with a semicolon (MAC addresses and IPv6 addresses)
|
|---|
| 10 | # 4. Discard anything which include the word 'link' (local routes).
|
|---|
| 11 | # 5. Use word count (get number of lines)
|
|---|
| 12 | COUNT=`netstat -rn | grep -E '[0-9]/[0-9]' | grep -v ':' | grep -v 'link' | wc -l'`
|
|---|
| 13 |
|
|---|
| 14 | # No have a look if the number of routes has passed the minimium threshold.
|
|---|
| 15 | if [ ${COUNT} -gt ${VALID} ]; then
|
|---|
| 16 |
|
|---|
| 17 | # Display me if I have passed the threshold
|
|---|
| 18 | echo "ROUTING OK: Got non local routes"
|
|---|
| 19 | else
|
|---|
| 20 |
|
|---|
| 21 | # Display me if I didn't pased the threshold
|
|---|
| 22 | echo "ROUTING CRITICAL: I don't have any non local routes"
|
|---|
| 23 | fi
|
|---|
| 24 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.