Page 1 of 2

Monitoring website content through VPN connection

Posted: Thu May 26, 2016 11:06 am
by awbornman
Hello Team,

How can I monitor a website's text content through a VPN connection?

An idea I have been trying so far is:

[root@2605 libexec]# ./check_vpn_master_test_1 -t pptp -H xxx.xx.10.46 -u <username> -p <password> -- require-mppe; ./check_http_content -U http://10.103.37.210/specialcalls.php -m "Communication Warning" -t 5
OK: VPN to 'xxx.xx.10.46' up and running on 'ppp0', 'http://10.103.37.210/specialcalls.php' reachable|time=0.053s;size=5138B
ERROR: CANNOT RETRIEVE URL: 500 Can't connect to 10.103.37.210:80 (timeout)

Is anyone aware of a plugin that utilizes a VPN connection before checking a website? The issue I am having is that the VPN check disconnects before checking the site contents-

Thank you!

Re: Monitoring website content through VPN connection

Posted: Thu May 26, 2016 12:18 pm
by hsmith
Can you set a higher timeout in the plugin?

Re: Monitoring website content through VPN connection

Posted: Thu May 26, 2016 12:29 pm
by awbornman
I set the timeout to 300 seconds- I should start by asking if the ';' maintains the same check or just starts a new check?

[root@2605 libexec]# ./check_vpn_master_test_1 -t pptp -H xxx.xx.10.46 -u <username> -p <password> -- require-mppe; ./check_http_content -U http://10.103.37.210/specialcalls.php -m "Communication Warning" -t 300
OK: VPN to 'xxx.xx.10.46' up and running on 'ppp0', 'http://10.103.37.210/specialcalls.php' reachable|time=0.043s;size=5143B
ERROR: CANNOT RETRIEVE URL: 500 Can't connect to 10.103.37.210:80 (Connection timed out)

Re: Monitoring website content through VPN connection

Posted: Thu May 26, 2016 12:33 pm
by awbornman
I tried this with another check - is this correct? The check comes back good but never reports the string:

define service{
use generic-service
host_name W Des Moines IA VPN
service_description W Des Moines xxxx Status Check TEST TEST TEST
check_command check_vpn_WD_IA_TOC!pptp!<username>!<password>!require-mppe!; ./check_http -H 10.103.13.242 -f follow -u "/service/status/inspire" -s "FAIL"
}

returns:

OK: VPN to 'xxx.xx.10.46' up and INSPIRE is running on 'ppp0', 'http://10.103.33.242' INSPIRE Status reachable

Re: Monitoring website content through VPN connection

Posted: Thu May 26, 2016 1:55 pm
by awbornman
Or how can I use the website defacement wizard through a vpn connection?

Re: Monitoring website content through VPN connection

Posted: Thu May 26, 2016 4:10 pm
by rkennedy
Are you using check_http or check_http_content? Just trying to understand the differences here. The default check_http plugin will be able to match strings with the -s parameter.

Re: Monitoring website content through VPN connection

Posted: Thu May 26, 2016 4:22 pm
by awbornman
I have tried both, I need a way to check strings once connected to a vpn-

The website defacement plugin would be beyond perfect if I could connect to the vpn first.

Is there a way to combine checks? For example run my check_vpn and any http string check at the same time?


Thank you!

Re: Monitoring website content through VPN connection

Posted: Thu May 26, 2016 4:50 pm
by rkennedy
You could create a wrapper script, that connects to the VPN first, and then executes the check_http plugin statically in it. Then, assign this wrapper script as a command, and assign it to the service.

Re: Monitoring website content through VPN connection

Posted: Fri May 27, 2016 7:55 am
by awbornman
Thank you!

Would you happen to have an example that I could see?

Re: Monitoring website content through VPN connection

Posted: Mon May 30, 2016 7:42 am
by rkennedy
Something like -

Code: Select all

!#/bin/bash
openvpn --config vpn.ovpn --auth-usuer-pass file.txt
/usr/local/nagios/libexec/check_http <your parameters>
This would run through the openvpn command first, and then execute the check_http after doing so.