Page 1 of 2

How to install plugins

Posted: Tue May 28, 2013 3:36 am
by alexmati
Hello guys.

I 'm new to nagios and ubuntu.

I have install ubuntu on a VM and NagiosĀ® Coreā„¢ Version 3.4.4.

I have add four hosts and mail notifications and everything works fine.

What i want is to monitor sql and mysql databases.
I have see in order to work something like this, i must install plugins.
http://exchange.nagios.org/directory/Pl ... ases/MySQL
http://exchange.nagios.org/directory/Pl ... /SQLServer

I have search how to install plugins and i don't understand how.

Have someone a step by step guide how to install and configure plugins?

Or the patience to help me 8-)

Thank you.

Re: How to install plugins

Posted: Tue May 28, 2013 11:55 am
by slansing
All you will need to do is add your plugins to the plugins directory created by installing the nagios plugins package. This will ensure Nagios can reach, read, and execute the plugins if need be. Once they have been added to that directory you will need to define a command definition, then simply add that command definition to your host/service configs when creating them and they will use whatever you have defined there, please see the following for help defining commands:

http://nagios.sourceforge.net/docs/3_0/ ... ml#command

Re: How to install plugins

Posted: Mon Jun 03, 2013 9:27 am
by alexmati
Hi,

I have download from below the checkMySQLProcesslist.sh and add it to /usr/local/nagios/libexec/
https://github.com/tart/CheckMySQLProcesslist

Also i have add the following commands to commands file and host file.

Code: Select all

[b]##### commands #####[/b]

# 'checkMySQLProcesslist' command definition
define command{
	command_name	checkMySQLProcesslist
	command_line	/usr/local/nagios/libexec/checkMySQLProcesslist.sh -u root -p Cas******* -s 60 -w 20 -c 50	
	}

Code: Select all

[b]##### Host_file #####[/b]

define service{
	use			generic-service
	host_name		**********DEV01
	service_description	checkMySQLProcesslist
	check_command		checkMySQLProcesslist
	}
Finally i get the error that i attached (mysql)


With the same procedure i have install also the following plugin and i get also an error (disk.jpg).
http://exchange.nagios.org/directory/Pl ... MP/details



Am i doing something wrong?

Thank you

Re: How to install plugins

Posted: Mon Jun 03, 2013 10:48 am
by gshergill
Hi alexmati,

Code: Select all

[b]##### commands #####[/b]

# 'checkMySQLProcesslist' command definition
define command{
   command_name   checkMySQLProcesslist
   command_line   /usr/local/nagios/libexec/checkMySQLProcesslist.sh -u root -p Cas******* -s 60 -w 20 -c 50   
   }
The first thing to try would be to run the command from the command line.

In your case, you would cd into the plugins directory and run;

Code: Select all

./checkMySQLProcesslist.sh -u root -p Cas******* -s 60 -w 20 -c 50   
Does it produce the correct output?

Thank you.

Kind Regards,

Gary Shergill

Re: How to install plugins

Posted: Tue Jun 04, 2013 9:56 am
by slansing
Thanks for the help Gshergill.

Re: How to install plugins

Posted: Fri Jun 07, 2013 4:08 am
by alexmati
Here is the results:

Code: Select all

:/usr/local/nagios/libexec# ./checkMySQLProcesslist.sh -u root -p Cas***** -s 60 -w 20 -c 50

./checkMySQLProcesslist.sh: line 4: syntax error near unexpected token `newline'
./checkMySQLProcesslist.sh: line 4: `<!DOCTYPE html>'
I am sure that is something very easy but i don't know what.
I don't have the experience :oops:

Re: How to install plugins

Posted: Fri Jun 07, 2013 4:30 am
by gshergill
Hi alexmati,

Did you just copy and paste the code from the link below into a file called "checkMySQLProcesslist.sh"?
https://github.com/tart/CheckMySQLProce ... esslist.sh

Can you post your plugin here please? (can just use cat)

Kind Regards,

Gary Shergill

Re: How to install plugins

Posted: Fri Jun 07, 2013 5:09 am
by alexmati
Hi gshergill,

I have download the checkMySQLProcesslist.sh file from this link https://github.com/tart/CheckMySQLProcesslist and copy to the libexec folder.
I have also give access rights to execute the file.

Thank you

Re: How to install plugins

Posted: Fri Jun 07, 2013 7:39 am
by gshergill
Hi alexmati,

I don't know if it's just the file you sent is in an odd format, but the script isn't at all downloaded correctly.

I would recommend you copy the old one under a new name, and go the to link I sent in the last post and just copy and paste the code from there into a new file;

Code: Select all

mv checkMySQLProcesslist.sh checkMySQLProcesslist-old.sh
vi checkMySQLProcesslist.sh
<paste in the new code, save and exit>
chmod a+x checkMySQLProcesslist.sh
chown nagios:nagios checkMySQLProcesslist.sh
Should look similar to that depending on your distro.

Alternatively, use the one I've attached.

Kind Regards,

Gary Shergill

Re: How to install plugins

Posted: Fri Jun 07, 2013 8:57 am
by alexmati
Hi gshergill,

I have copy and paste the code and i have an error:

Code: Select all

./checkMySQLProcesslist.sh: line 45: mysql: command not found
UNKNOWN no processlist
The same results with the file that you send me.

Thank you