How to install plugins

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
alexmati
Posts: 10
Joined: Thu May 16, 2013 1:19 am

How to install plugins

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

Re: How to install plugins

Post 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
alexmati
Posts: 10
Joined: Thu May 16, 2013 1:19 am

Re: How to install plugins

Post 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
Attachments
mysql.png
mysql.png (7.44 KiB) Viewed 2744 times
disk.png
disk.png (7.84 KiB) Viewed 2744 times
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: How to install plugins

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

Re: How to install plugins

Post by slansing »

Thanks for the help Gshergill.
alexmati
Posts: 10
Joined: Thu May 16, 2013 1:19 am

Re: How to install plugins

Post 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:
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: How to install plugins

Post 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
alexmati
Posts: 10
Joined: Thu May 16, 2013 1:19 am

Re: How to install plugins

Post 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
Attachments
checkMySQLProcesslist.sh
(86.27 KiB) Downloaded 134 times
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: How to install plugins

Post 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
Attachments
checkMYSQLProcesslist.sh
(10.92 KiB) Downloaded 401 times
alexmati
Posts: 10
Joined: Thu May 16, 2013 1:19 am

Re: How to install plugins

Post 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
Locked