Plug-In Tutorials

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
A.Cormack
Posts: 103
Joined: Fri Nov 23, 2012 6:32 pm

Re: Plug-In Tutorials

Post by A.Cormack »

Code: Select all

./check_apacherequests -h
The output from he command wasnt the most helpful. Just says that -c is critical, -w warning etc.

All I want the check to do is produce a certain a warning/critical alarm when the server reaches a certain ammount of requests. So I'm guessing my $ARG1$ would be ( values are for example purpose)

Code: Select all

-w 1, -c 2 
and then my command

Code: Select all

$USER1$/check_apacherequests -H $HOSTADDRESS$ -a $ARG1$
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Plug-In Tutorials

Post by abrist »

Looks good. Though this plugin is an example of a poorly documented one, but at least it is easy to configure.
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.
A.Cormack
Posts: 103
Joined: Fri Nov 23, 2012 6:32 pm

Re: Plug-In Tutorials

Post by A.Cormack »

abrist wrote:Looks good. Though this plugin is an example of a poorly documented one, but at least it is easy to configure.
Yeah I think that's the problem I had, there was no guide so with it being my first time I was a bit clueless.

So I did what I said above and went to apply the configuration but I got an error saying it could not be completed. Below is the snapshot information.

Code: Select all

Nagios Core 3.4.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 05-11-2012
License: GPL

Website: http://www.nagios.org
Reading configuration data...
   Read main config file okay...
Processing object config directory '/usr/local/nagios/etc/static'...
Processing object config file '/usr/local/nagios/etc/static/xiobjects.cfg'...
Processing object config file '/usr/local/nagios/etc/static/xitemplates.cfg'...
Processing object config file '/usr/local/nagios/etc/static/xitest.cfg'...
Processing object config file '/usr/local/nagios/etc/contacttemplates.cfg'...
Processing object config file '/usr/local/nagios/etc/contactgroups.cfg'...
Processing object config file '/usr/local/nagios/etc/contacts.cfg'...
Processing object config file '/usr/local/nagios/etc/timeperiods.cfg'...
Processing object config file '/usr/local/nagios/etc/commands.cfg'...
Processing object config file '/usr/local/nagios/etc/hostgroups.cfg'...
Processing object config file '/usr/local/nagios/etc/servicegroups.cfg'...
Processing object config file '/usr/local/nagios/etc/hosttemplates.cfg'...
Processing object config file '/usr/local/nagios/etc/servicetemplates.cfg'...
Processing object config file '/usr/local/nagios/etc/servicedependencies.cfg'...
Processing object config file '/usr/local/nagios/etc/serviceescalations.cfg'...
Processing object config file '/usr/local/nagios/etc/hostdependencies.cfg'...
Processing object config file '/usr/local/nagios/etc/hostescalations.cfg'...
Processing object config file '/usr/local/nagios/etc/hostextinfo.cfg'...
Processing object config file '/usr/local/nagios/etc/serviceextinfo.cfg'...
Processing object config directory '/usr/local/nagios/etc/hosts'...
Processing object config file '/usr/local/nagios/etc/hosts/VS2.cfg'...
Processing object config file '/usr/local/nagios/etc/hosts/VS3.cfg'...
Processing object config file '/usr/local/nagios/etc/hosts/Switch.cfg'...
Processing object config file '/usr/local/nagios/etc/hosts/VS1.cfg'...
Processing object config file '/usr/local/nagios/etc/hosts/localhost.cfg'...
Processing object config directory '/usr/local/nagios/etc/services'...
Processing object config file '/usr/local/nagios/etc/services/VS2.cfg'...
Processing object config file '/usr/local/nagios/etc/services/VS3.cfg'...
Processing object config file '/usr/local/nagios/etc/services/Switch.cfg'...
Processing object config file '/usr/local/nagios/etc/services/check_apacherequests.cfg'...
Processing object config file '/usr/local/nagios/etc/services/VS1.cfg'...
Processing object config file '/usr/local/nagios/etc/services/localhost.cfg'...
Error: Invalid max_attempts, check_interval, retry_interval, or notification_interval value for service 'Apache Requests' on host 'VS1'
Error: Could not register service (config file '/usr/local/nagios/etc/services/check_apacherequests.cfg', starting on line 14)
   Error processing object config files!


***> One or more problems was encountered while processing the config files...

     Check your configuration file(s) to ensure that they contain valid
     directives and data defintions.  If you are upgrading from a previous
     version of Nagios, you should be aware that some variables/definitions
     may have been removed or modified in this version.  Make sure to read
     the HTML documentation regarding the config files, as well as the
     'Whats New' section to find out what has changed.
No doubt its related too

Code: Select all

Error: Invalid max_attempts, check_interval, retry_interval, or notification_interval value for service 'Apache Requests' on host 'VS1'
Error: Could not register service (config file '/usr/local/nagios/etc/services/check_apacherequests.cfg', starting on line 14)
   Error processing object config files!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Plug-In Tutorials

Post by lmiltchev »

Go to the Core Config Manager->Services->Apache Requests->Modify

Under the "Check Settings" tab, enter the correct values for:

Code: Select all

Check interval
Retry interval
Max check attempts
Under the "Alert Settings" tab, enter the correct value for:

Code: Select all

Notification interval
Save and Apply Configuration.

BTW, did you test your check from the command line first, to make sure it works?
Be sure to check out our Knowledgebase for helpful articles and solutions!
A.Cormack
Posts: 103
Joined: Fri Nov 23, 2012 6:32 pm

Re: Plug-In Tutorials

Post by A.Cormack »

lmiltchev wrote:
Under the "Check Settings" tab, enter the correct values

BTW, did you test your check from the command line first, to make sure it works?
That's worked a treat :) Configuration now saved. Thank You.
lmiltchev wrote: BTW, did you test your check from the command line first, to make sure it works?
I didn't, I forgot... sorry. Now im paying the price for it as it says (null) under status information, so I guess i need to change $ARG1$ as the command is incorrect?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Plug-In Tutorials

Post by slansing »

It may be reporting incorrectly formatted data. This is why I personally check all the plugins I use from the command line before configuring, this will also let you filter out problems with how you have them defined "might be the issue here." I suggest you test it from the command line and let us know what the output is. As it may provide more info than Nagios XI does when it comes to debugging.. :)
A.Cormack
Posts: 103
Joined: Fri Nov 23, 2012 6:32 pm

Re: Plug-In Tutorials

Post by A.Cormack »

Sorry for the slowness with giving you information :) Still learning and taking notes as I go through it lol :)

Code: Select all

[root@localhost libexec]# ./check_apacherequests.pl -w 2 -c 3
sh: /usr/bin/lynx: No such file or directory
Argument "" isn't numeric in numeric ge (>=) at ./check_apacherequests.pl line 76.
OK -  current apache requests | 'apache requests'=;2;3
[root@localhost libexec]#
I just read it properly.... its because I havent got lynx

Code: Select all

[root@localhost libexec]# sudo apt-get install lynx
>>> /etc/sudoers: Alias `NAGIOSXI' already defined near line 110 <<<
sudo: parse error in /etc/sudoers near line 110
sudo: no valid sudoers sources found, quitting
You have new mail in /var/spool/mail/root
[root@localhost libexec]# apt-get install lynx
-bash: apt-get: command not found
[root@localhost libexec]#
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Plug-In Tutorials

Post by lmiltchev »

Install lynx first:

Code: Select all

yum install lynx -y
Then go to the CCM->Services->Apache Requests->Modify

and enter in the $ARG1$ field your warning and critical flags, for example:

Code: Select all

-w 50 -c 500
Save and Apply Configuration.
Be sure to check out our Knowledgebase for helpful articles and solutions!
A.Cormack
Posts: 103
Joined: Fri Nov 23, 2012 6:32 pm

Re: Plug-In Tutorials

Post by A.Cormack »

lmiltchev wrote:Install lynx first:

Code: Select all

yum install lynx -y
Then go to the CCM->Services->Apache Requests->Modify

and enter in the $ARG1$ field your warning and critical flags, for example:

Code: Select all

-w 50 -c 500
Save and Apply Configuration.
yeah sorrym rookie mistake... i tried to edit my post before anyone read it.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Plug-In Tutorials

Post by slansing »

You will need to install it as root as Andy suggested on the last page "just to keep in mind."
Locked