]> git.pld-linux.org Git - packages/cacti-template-nagiostats.git/blob - check_nagios.sh
- show usage for mistaken execution
[packages/cacti-template-nagiostats.git] / check_nagios.sh
1 #!/bin/sh
2 # enable for debugging:
3 #set -x
4 #exec 2>>/tmp/nagios-cacti.log
5
6 url="$1"
7 type="$2"
8 user="$3"
9 password="$4"
10
11 # Remove trailing slash if needed
12 url="${url%/}"
13
14 if [ -z "$url" ]; then
15         echo >&2 "Usage: $0 URL TYPE [USER PASSWORD]"
16         exit 1
17 fi
18
19 # pass user and password conditionally.
20 # this way we can even have passwords in them.
21 # retry only once with timeout of 30s
22 exec wget -t 1 -T 30 --no-check-certificate -q -O- ${user:+--user="$user" --password="$password"} "$url/mrtgstats.cgi?type=$type"
This page took 0.042261 seconds and 3 git commands to generate.