Page 1 of 2
Check_smb_status.sh Plugin
Posted: Wed Jul 13, 2016 9:35 am
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
Re: Check_smb_status.sh Plugin
Posted: Wed Jul 13, 2016 11:23 am
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
Re: Check_smb_status.sh Plugin
Posted: Wed Jul 13, 2016 11:24 am
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.
Re: Check_smb_status.sh Plugin
Posted: Wed Jul 13, 2016 2:01 pm
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
}
Re: Check_smb_status.sh Plugin
Posted: Wed Jul 13, 2016 2:17 pm
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
Re: Check_smb_status.sh Plugin
Posted: Wed Jul 13, 2016 2:21 pm
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
Re: Check_smb_status.sh Plugin
Posted: Tue Jul 26, 2016 8:17 am
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
Re: Check_smb_status.sh Plugin
Posted: Tue Jul 26, 2016 9:03 am
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.
Re: Check_smb_status.sh Plugin
Posted: Wed Aug 03, 2016 3:46 pm
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
Re: Check_smb_status.sh Plugin
Posted: Wed Aug 03, 2016 4:02 pm
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.