Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

get values from HTTP Post via nagios

Posted on 2011-10-13
4
Medium Priority
?
321 Views
Last Modified: 2012-05-12
I currently have a web service that posts 3 values to a page. I'd like to consume those values into Opsview (Nagios) and set thresholds of they go too high.

I was looking at Opsviews FAQ page and found this.

******************************************************
It is possible to generate graphs for specific performance data by appending an argument to the URL.

For graph based on check_http plugin, we get four pieces of data:

Response time (time)
Page size (size)
Warning threshold (time_warn)
Writical threshold (time_crit)
Standard URL will be similar to:

/cgi-bin/show.cgi?fixedscale=1&service=HTTP&host=www.opsview.org
Appending '&db=,time' will generate graph based on 'time' value, eg:

/cgi-bin/show.cgi?fixedscale=1&service=HTTP&host=www.opsview.org&db=,time
Parameters can be combined so to display response time and critical threshold on same graph simply append '&db=,time,time_crit'
******************************************************


Here is the URL that i have. I'd like to get data for the values: dialing, connected and uncalled

/outbound/webservice/outboundInfo.php?login=admin&pin=********&statuses=dialing,connected,uncalled

Nagios doesn't know what to do if i run the check
check_http -H $HOSTADDRESS$ -u /outbound/webservice/outboundInfo.php?login=admin&pin=********&statuses=dialing,connected,uncalled -c 5

Open in new window

0
Comment
Question by:c3very
  • 3
4 Comments
 
LVL 41

Expert Comment

by:noci
ID: 36971562
an & is also a shell command.
It means start the previous command in a sub shell & don't wait for it.

so you get check_http ....
login=...
pin=...
statuses=...


Try: (with the extra ' chars..)
check_http -H $HOSTADDRESS$ -u '/outbound/webservice/outboundInfo.php?login=admin&pin=********&statuses=dialing,connected,uncalled' -c 5
0
 
LVL 2

Author Comment

by:c3very
ID: 36979706
The extra characters definitely helped.

I'm running the command in Putty as the nagios user and it actually comes back with a response now.


nagios@opsview-appliance:/usr/local/nagios/libexec$ ./check_http -H $HOSTADDRESS$ -u '/outbound/webservice/outboundInfo.php?login=admin&pin=********&statuses=dialing,connected,uncalled&test' -c 5
HTTP OK: HTTP/1.1 200 OK - 396 bytes in 0.008 second response time |time=0.008276s;;5.000000;0.000000 size=396B;;;0

Open in new window


Here is the post page and what it looks like:
<outboundinfo status="info" total="127">
<login>admin</login>
<pin>********</pin>
<dialing total="37"/>
<connected total="90"/>
<uncalled total="0"/>
</outboundinfo>

Open in new window


Hopefully the check can be modified to read these values.  If the post page needs to be modified to overcome any limitation of nagios it could probably be done.
0
 
LVL 41

Expert Comment

by:noci
ID: 36982569
check_http  is very limited. If you need a post use -P,
You can verify using a regex (-r) if the result is what you expected...

See:
http://www.nagios-wiki.de/nagios/plugins/check_http

0
 
LVL 41

Accepted Solution

by:
noci earned 2000 total points
ID: 36982586
If you want more control then you may need to checkout curl (http://curl.haxx.se) as the tool of choice.
and script around it.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
In this article, the configuration steps in Zabbix to monitor devices via SNMP will be discussed with some real examples on Cisco Router/Switch, Catalyst Switch, NAS Synology device.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Suggested Courses
Course of the Month21 days, 1 hour left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question