Check_smb_status.sh Plugin

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Berto
Posts: 162
Joined: Tue Jul 01, 2014 6:12 pm

Check_smb_status.sh Plugin

Post by Berto »

Hello,

Yesterday I downloaded the check_smb_status.sh plugin from here https://exchange.nagios.org/directory/P ... sh/details and it does exactly what I was looking for. I would like to display the results of that plugin in the Nagios XI web interface and that's where my issue is. I followed this doc https://assets.nagios.com/downloads/nag ... ios-XI.pdf and when setting up the service and using the 'Test Check Command' button I see the command and the output is blanked. In the 'Service Status' page under 'Status Information' I see (Return code of 255 is out of bounds). If I run ./check_smb_status.sh locally on the host it displays fine, and if I run from the command line on the nagios server ssh <hostname> /opt/nagios/libexec/check_smb_status.sh I get the proper results also.
My command is ssh <hostname> /opt/nagios/libexec/check_smb_status.sh as it seems the plugin doesn't recognize using the -h $HOSTADDRESS$ macro, so I'm a bit confused on what to do now.

Am I going about this the wrong way? Is the command I created not the proper method to get the info back to display on the web interface?

Thanks,

--Berto
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Check_smb_status.sh Plugin

Post by ssax »

Please go to Configure > Core Config Manger > Commands and click the blue floppy disk icon next to the command and paste the full definition of that specific command.

Then go to Configure > Core Config Manger > Services and do the same for the service that you set up.


Thank you
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Check_smb_status.sh Plugin

Post by lmiltchev »

Can you show us the command and service definition that you are using?

CCM->Commands->View Config (the diskette icon)
CCM->Services-><your service>->View Config (the diskette icon)

I set up two "test" services, and both are working fine. Here's my configs:

Code: Select all

define service {
	host_name			CentOS6-SSH
	service_description		Check SMB Status
	use				generic-service
	check_command			check_xi_by_ssh!-C "/usr/local/nagios/libexec/check_smb_status.sh"
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	notifications_enabled		1
	contacts			nagiosadmin
	_xiwizard			sshproxy
	register			1
	}

define command {
       command_name                  		check_xi_by_ssh
       command_line                  		$USER1$/check_by_ssh -H $HOSTADDRESS$ $ARG1$ $ARG2$
}

define service {
	host_name			CentOS6-SSH
	service_description		Check SMB Status 2
	use				generic-service
	check_command			ssh!/usr/local/nagios/libexec/check_smb_status.sh!!!!!!!
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	notifications_enabled		1
	contacts			nagiosadmin
	_xiwizard			sshproxy
	register			1
	}

define command {
       command_name                  		ssh
       command_line                  		ssh nagios@$HOSTADDRESS$ $ARG1$
}
I don't have samba configured on the remote machine, but the plugin returns a valid output:
example01.PNG
example02.PNG
Hope this helps.
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Berto
Posts: 162
Joined: Tue Jul 01, 2014 6:12 pm

Re: Check_smb_status.sh Plugin

Post by Berto »

Hello,

Here is the requested information:

define command {
command_name check_smb_status.sh
command_line ssh nagios@$HOSTADDRESS$ $ARG1$
}

define service {
host_name susvr0215.gcsd.harris.com
service_description Samba Procs
check_command check_smb_status.sh!/opt/nagios/libexec/check_smb_status.sh!!!!!!!
max_check_attempts 5
check_interval 10
retry_interval 1
check_period unixopenoncall_notification_times
notification_period unixopenoncall_notification_times
notifications_enabled 0
register 1
}
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Check_smb_status.sh Plugin

Post by tgriep »

You may want to use the check_by_ssh plugin which would work for what you are doing.
Take a look at this document for instructions.
https://assets.nagios.com/downloads/nag ... ng_SSH.pdf
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Check_smb_status.sh Plugin

Post by lmiltchev »

Can you run the following commands and show the output?

on the client (remote machine)

Code: Select all

su nagios
/opt/nagios/libexec/check_smb_status.sh
on the nagios server

Code: Select all

su nagios
ssh nagios@<client ip> /opt/nagios/libexec/check_smb_status.sh
Be sure to check out our Knowledgebase for helpful articles and solutions!
Berto
Posts: 162
Joined: Tue Jul 01, 2014 6:12 pm

Re: Check_smb_status.sh Plugin

Post by Berto »

Hello,

Sorry was on vacation for a while and just got back to working on this. I believe half of my problem is the way the local nagios account is on the server, which I'm working on now. But to verify that the command would work, I added my username as I know that would work, and I still get a empty output when using the Test Command. If I do it from the nagios server to the host from command line it does display back;

[lnsvr0370]:(584/0)-$ ssh abeltr01@susvr0215 /opt/nagios/libexec/check_smb_status.sh
Total Users/Process: 110 Total Machines: 108 Total Files: 715

--Berto
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Check_smb_status.sh Plugin

Post by lmiltchev »

You have to be able to run the plugin as nagios user. Please run the commands from my previous post, and show the output.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Berto
Posts: 162
Joined: Tue Jul 01, 2014 6:12 pm

Re: Check_smb_status.sh Plugin

Post by Berto »

I finally got this working, but I do have one question before closing out this thread. Can all plugins be graphed in Nagios? I would like to have a performance graph for this Samba service if possible and when I click on the performance graph tab, it comes up with the "No performance were found for this service." It's been 24 hours so I know there's data, just wondering if it's possible to create a graph with this plugin.

--Berto
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Check_smb_status.sh Plugin

Post by lmiltchev »

Not all of the plugins return perfdata, but this one should. Click on the service, go to the "Advanced" tab, and show us a screenshot of the page.

Also, check if the RRD and XML files were created in "/usr/local/nagios/share/perfdata/<hostname>/" directory for the problem service. If you have a RRD & XML files, you can delete them (only delete files named after the "smb" service!), and wait until they get recreated. It may take up to 20-30 min before perfgraphs start showing up.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked