]>
Commit | Line | Data |
---|---|---|
7f553a10 | 1 | #!/bin/sh |
7f553a10 | 2 | # enable for debugging: |
616d7122 ER |
3 | #set -x |
4 | #exec 2>>/tmp/nagios-cacti.log | |
7f553a10 ER |
5 | |
6 | url="$1" | |
7 | type="$2" | |
8 | user="$3" | |
9 | password="$4" | |
10 | ||
11 | # Remove trailing slash if needed | |
12 | url="${url%/}" | |
13 | ||
ec00db12 ER |
14 | if [ -z "$url" ]; then |
15 | echo >&2 "Usage: $0 URL TYPE [USER PASSWORD]" | |
16 | exit 1 | |
17 | fi | |
18 | ||
7f553a10 ER |
19 | # pass user and password conditionally. |
20 | # this way we can even have passwords in them. | |
21 | # retry only once with timeout of 30s | |
ad3b4efe | 22 | exec wget -t 1 -T 30 --no-check-certificate -q -O- ${user:+--user="$user" --password="$password"} "$url/mrtgstats.cgi?type=$type" |