Page 1 of 1

Creating a new check for nagios

Posted: Mon Aug 12, 2013 2:48 pm
by rdhall01
I am having an issue with finding an exisitng plugin to check the contents of a file and display the status information, as well as graph the results.
For instance we have a site

url
http://xxxxx.com/adminportal/utilities/ ... ?host=FQDN
results
Uers: xxx

I tried using the check_curl.php check, it will display the data back except it will not show the status information and will not graph the perf data.

command I use
./check_curl.php -U http://XXXXX.com/adminportal/utilities/ ... ?host=FQDN -O

results (data is correct)
Users: 77 |time=0.15 size=30|
time and size do get graphed out correctly

I need to be able to graph the user data as well as be able to alert with a warn and crit based on thresholds.

I'm looking for any help /input on a resolution

I also tired using and old wrapper from nagios 1.x that just display the outpuit twice and no luck

Re: Creating a new check for nagios

Posted: Mon Aug 12, 2013 3:06 pm
by slansing
Can you send us a copy of the check_curl plugin you are using? Also, you should be able to output the plugins usage, and from there, find the arguments you must pass to pull specific data out of the check, try running check_curl with a "-h" after it to show it's usage.

Re: Creating a new check for nagios

Posted: Mon Aug 12, 2013 3:34 pm
by rdhall01
Sorry it would not accept the /php ext and I just realized that so I added the .txt to it
Attached is the plugin as well as the help

Syntax:
-U URL (s)
-A Agent (s)(default: Mozilla/5.0 ... )
-a authentication (s)(example: '[user]:[password]')
-G Grep page on STRING (s)(can be set multiple times)
-L Show page (-)
-F Follow redirects (-)
-I Ignore SSL certificate errors (-)
-X Exclude performance data (default: include)
-Tc Ccritical page return time (i)
-Tw Warning page return time (i)
-Sbc Critical page size below SIZE (i)
-Soc Critical page size over SIZE (i)
-Sbw Warning page size below SIZE (i)
-Sow Warning page size over SIZE (i)
-S Find string between ARG1 and ARG2, return first match (s s) (example: value=" " )
-T Timeout (i)(default: 10sec)
-O Output Driven Check - Page Should respond with "Status: OK" or otherwise


Example:
check_curl.php -U http://test.example.net

Re: Creating a new check for nagios

Posted: Mon Aug 12, 2013 4:41 pm
by abrist
rdhall01 wrote:Users: 77 |time=0.15 size=30|
Does this check actually return a second pipe at the end of the perfdata? If so, this may be an issue.

Re: Creating a new check for nagios

Posted: Tue Aug 13, 2013 9:41 am
by rdhall01
No it doesn't add a second pipe | that only happens if I use an old wrapper script we have used in the past. Just tried as a test No information is displayed in the status information

without wrapper results

Users: 69 |time=0.182 size=30
with wrapper

Users: 70 |time=0.177 size=30|
Users: 70 |time=0.177 size=30

Re: Creating a new check for nagios

Posted: Tue Aug 13, 2013 10:28 am
by abrist
The only perfdata you are outputting is the "time" value. Don't you want to graph the "users" value?

Re: Creating a new check for nagios

Posted: Tue Aug 13, 2013 10:29 am
by sreinhardt
Only data passed after the pipe is included in performance data. You should modify the output of the plugin to include users after that. The result should look something like:

Users: 70 |time=0.177 size=30 users=70

This way you have a value for the thresholds, pre-pipe, and one for perfdata, post pipe. You may need to remove the rrd file in the perfdata folder to get it to add the additional value.