LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 10-29-2012, 11:01 AM   #1
slokie
LQ Newbie
 
Registered: Oct 2012
Location: Arizona
Distribution: CentOS 5.9
Posts: 7

Rep: Reputation: Disabled
BHOD - Nagios Plugin returns null


Hello, I'm lost and need some help, I stumbled upon the site, hope you can help

Running a check command for our my account app
Code:
define service{
use generic-service
host_name myaccount
service_description MyAccount Login Time - Medium Account
check_command check_myaccount! ccc@yyy.none password 10 13
}
Code:
define command{
command_name check_myaccount
command_line /usr/lib64/nagios/plugins/check_myaccount $ARG1$
}
Code:
#!/usr/bin/env ruby

require 'rubygems'
require 'mechanize'
require 'pp'
require 'benchmark'

agent = Mechanize.new
agent.read_timeout = 600

username = ARGV[0]
password = ARGV[1]
warning = ARGV[2].to_i
critical = ARGV[3].to_i

if ARGV.length < 4
  puts "Please add needed arguments:"
  puts "  ./check_myaccount <login> <password> <warning seconds> <critical seconds>"
  exit(3)
end

time = Benchmark.realtime do
  start_page = agent.get('https://myaccount.xyz.com/online/')
  login_form = start_page.form('loginForm')
  login_form['loginForm:username'] = ARGV[0]
  login_form['loginForm:password'] = ARGV[1]
  myaccount_page = agent.submit(login_form, login_form.buttons.first)
end

time = time.round(2)

if time < warning
  puts "TIME OK - #{time} | time=#{time}"
  exit(0)
elsif time >= warning && time < critical
  puts "TIME WARNING - #{time} | time=#{time}"
  exit(1)
elsif time >= critical
  puts "TIME CRITICAL - #{time} | time=#{time}"
  exit(2)
else
  puts "TIME UNKNOWN - #{time} | time=#{time}"
  exit(3)
end
[root@monitoring01 plugins]# su nagios
sh-3.2$ /usr/lib64/nagios/plugins/check_myaccount ccc@yyy.none password 15 20
TIME OK - 2.43 | time=2.43

but nagios returns
(null)

Please help

Last edited by slokie; 10-30-2012 at 08:26 PM.
 
Old 10-31-2012, 07:44 AM   #2
Habitual
Senior Member
 
Registered: Jan 2011
Distribution: Undecided
Posts: 3,480
Blog Entries: 6

Rep: Reputation: Disabled
What OS is nagios installed on?
How did nagios get installed?
Package Manager, or source code using
Code:
./configure && make && make install
How did nagios plugins get installed and what version is it?

You provided a ruby script that seems to wrap up the nagios check_ command but you aren't telling us where, or how you use it.

Please let us know...
 
Old 10-31-2012, 12:45 PM   #3
slokie
LQ Newbie
 
Registered: Oct 2012
Location: Arizona
Distribution: CentOS 5.9
Posts: 7

Original Poster
Rep: Reputation: Disabled
This was installed on a CentOS 5.8 we had an original build of 3.0 but was upgraded via yum when this started.

As for the nagios versions installed:
Code:
nagios-plugins-1.4.16-1.el5.rf
nagios-plugins-nrpe-2.12-16.el5
nagios-devel-3.2.3-3.el5.rf
nagios-nrpe-2.12-1.el5.rf
nagios-plugins-setuid-1.4.16-1.el5.rf
nagios-3.2.3-3.el5.rf
to run:

Code:
/usr/lib64/nagios/plugins/check_myaccount <user> <password> <time warning> <time critcal>
 
Old 11-12-2012, 05:29 PM   #4
slokie
LQ Newbie
 
Registered: Oct 2012
Location: Arizona
Distribution: CentOS 5.9
Posts: 7

Original Poster
Rep: Reputation: Disabled
Checking other local plugins - appears to not be parsing local arguments - I've had debug on checking on another similar issue and noticed the following

these are both Ruby derived nagios plugins.

Code:
[1352762845.038683] [2320.2] [pid=31182] Expanded Command Output: /usr/lib64/nagios/plugins/check_imem_temp -area $ARG1$ -warn $ARG2$ -critical $ARG3$
[1352762845.049649] [2320.2] [pid=31182] Raw Command Input: /usr/lib64/nagios/plugins/check_imem_temp -area $ARG1$ -warn $ARG2$ -critical $ARG3$
am I missing something simple here?

Last edited by slokie; 11-12-2012 at 05:35 PM.
 
  


Reply

Tags
nagios, ruby


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nagios - interprets perl plugin output as (null) sburnay Linux - Software 15 06-12-2012 08:00 AM
why skb_dst() returns NULL Maximus_JR Programming 0 05-21-2012 05:28 AM
Nagios Check_nrpe returns no output in Nagios but works in terminal dave0821 Linux - Software 1 04-18-2012 06:26 PM
setlocale() returns NULL mic Programming 2 11-08-2005 03:49 AM
Kmalloc returns null iannou Linux - General 0 06-28-2003 10:36 AM


All times are GMT -5. The time now is 10:25 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration