Creating a new check for nagios

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
rdhall01
Posts: 87
Joined: Wed Nov 09, 2011 9:53 am

Creating a new check for nagios

Post 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
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Creating a new check for nagios

Post 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.
rdhall01
Posts: 87
Joined: Wed Nov 09, 2011 9:53 am

Re: Creating a new check for nagios

Post 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
You do not have the required permissions to view the files attached to this post.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Creating a new check for nagios

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
rdhall01
Posts: 87
Joined: Wed Nov 09, 2011 9:53 am

Re: Creating a new check for nagios

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Creating a new check for nagios

Post by abrist »

The only perfdata you are outputting is the "time" value. Don't you want to graph the "users" value?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Creating a new check for nagios

Post 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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked