I am trying to configure Nagios to use "check_by_ssh" plugin, to monitor if the service "mpg123" is running on a remote Linux computer.

  • I have Configured passwordless login between Nagios server & client
  • Defined the command to check if the process is running.


define command {
        command_name    check_music
        command_line    $USER1$/check_by_ssh -H $HOSTADDRESS$ -C "pgrep mpg123 > /dev/null && echo YES || echo NO"
  • Created the host definition file


define host{
        use                     linux-server
        host_name               client002
        alias                   Client002

define service{
        use                    generic-service
        host_name              client002
        service_description    Music
        check_command          check_music
  • Configured Nagios to know where to look for these files



My problem is that under Services in Nagios, I get a message saying:

Remote command execution failed: Could not create directory '/home/nagios/.ssh'. 
  • For which user did you configure the passwordless SSH? From the output it seems the user nagios is trying to connect via SSH. Normally you have service user that can be specified with -loption to the check_by_ssh plugin. Additionally the service user needs approriate access rights on the client. – Thomas Feb 3 '18 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.