XI Error: Command name of command line is NULL

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Episodio1
Posts: 6
Joined: Mon Aug 24, 2015 3:41 am

XI Error: Command name of command line is NULL

Post by Episodio1 »

Hi!

I have added a few individual services and hosts with Wizard and the work OK. But when I try to use "Windows SNMP" wizard, no matter what config I use there is an error when "checking configuration".
If I check "Test Check Command" in each invididual SNMP they works OK.

Config data:

Code: Select all

Read main config file okay...
Error: Command name of command line is NULL
Error: Could not register command (config file [b]'/usr/local/nagios/etc/commands.cfg', starting on line 291[/b])
Error processing object config files!

***> One or more problems was encountered while processing the config files...
Line 291 of commands.cfg starts in:

Code: Select all

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

291: define command {
       command_name                             check_xi_deface
       command_line                             $USER1$/check_http -H $HOSTADDRESS$ -r '$ARG1$' -u '$ARG2$' $ARG3$
}

define command {
       command_name                             check_xi_domain_v2
       command_line                             $USER1$/check_domain.php -d $ARG1$ $ARG2$ $ARG3$
}

define command {
       command_name                             check_xi_host_http
       command_line                             $USER1$/check_http -H $HOSTADDRESS$ $ARG1$
}
System profile:

Code: Select all

System:
Nagios XI Version : 2014R2.7
localhost.localdomain 2.6.32-573.3.1.el6.x86_64 x86_64
CentOS release 6.7 (Final)
Gnome is not installed
Apache Information

PHP Version: 5.3.3
Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.46 Safari/537.36
Server Name: 172.26.xxx.xxx
Server Address: 172.26.xxx.xxx
Server Port: 80
Date/Time

PHP Timezone: Atlantic/Canary 
PHP Time: Mon, 24 Aug 2015 10:06:48 +0100
System Time: Mon, 24 Aug 2015 10:06:48 +0100
Nagios XI Data

License ends in: 

Days left in Trial: 51

nagios (pid 29605) is running...
NPCD running (pid 1356).
ndo2db (pid 1435) is running...
CPU Load 15: 0.09 
Total Hosts: 29 
Total Services: 37 
Function 'get_base_uri' returns: http://172.26.xxx.xxx/nagiosxi/
Function 'get_base_url' returns: http://172.26.xxx.xxx/nagiosxi/
Function 'get_backend_url(internal_call=false)' returns: http://172.26.xxx.xxx/nagiosxi/includes/components/profile/profile.php
Function 'get_backend_url(internal_call=true)' returns: http://localhost/nagiosxi/backend/
* If I run: ./reconfigure_nagios.sh same error shows up.

* I removed "sudo" from /usr/local/nagiosxi/scripts/restart_nagios_with_export.sh in line: sudo $BASEDIR/manage_services.sh restart nagios

* I have installed Centos 6.7 basic Server and Nagios manual installation with no problems at all.
You do not have the required permissions to view the files attached to this post.
Episodio1
Posts: 6
Joined: Mon Aug 24, 2015 3:41 am

Re: XI Error: Command name of command line is NULL

Post by Episodio1 »

I have even restored a previous backup config (which was OK), but same error happens.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: XI Error: Command name of command line is NULL

Post by tgriep »

Let's try and reset the permissions on the files to see if that resolves it. Run this in a shell as root.

Code: Select all

/usr/local/nagiosxi/scripts/reset_config_perms
If that doesn't fix it, run this tail command, Apply the Configuration and post the output of the tail command.

Code: Select all

tail -f /usr/local/nagiosxi/var/cmdsubsys.log
Be sure to check out our Knowledgebase for helpful articles and solutions!
Episodio1
Posts: 6
Joined: Mon Aug 24, 2015 3:41 am

Re: XI Error: Command name of command line is NULL

Post by Episodio1 »

Before I run 'reset_config_perms' I was getting GREEN both items in "Config File Permissions Check"

After I ran script and tried again the Wizard now I've got new error when I apply Windows SNMP to host 172.26.50.3

Code: Select all

Reading configuration data...
   Read main config file okay...
Error: Could not find any host matching '172.26.50.3' (config file '/usr/local/nagios/etc/services/172.26.50.3.cfg', starting on line 80)
Error: Failed to expand host list '172.26.50.3' for service 'TeamViewer 10' (/usr/local/nagios/etc/services/172.26.50.3.cfg:80)
   Error processing object config files!
172.26.50.3.cfg ends in line 38. There is no 80.

More from the log...

Code: Select all

RET: 1
/usr/local/nagiosxi/nom/checkpoints/nagioscore/errors /usr/local/nagiosxi/scripts
tar: Removing leading `/' from member names
/usr/local/nagiosxi/scripts
LATEST NOM SNAPSHOT: /usr/local/nagiosxi/nom/checkpoints/nagioscore/1440407222.tar.gz
/ /usr/local/nagiosxi/scripts
RESTORING NOM SNAPSHOT : /usr/local/nagiosxi/nom/checkpoints/nagioscore/1440407222.tar.gz
tar: usr/local/nagios/etc/hosts: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc/hosts: Cannot change mode to rwsrwsr-x: Operation not permitted
tar: usr/local/nagios/etc/static: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc/static: Cannot change mode to rwsrwsr-x: Operation not permitted
tar: usr/local/nagios/etc/services: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc/services: Cannot change mode to rwsrwsr-x: Operation not permitted
tar: usr/local/nagios/etc/pnp/check_commands: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc/pnp/check_commands: Cannot change mode to rwxrwsr-x: Operation not permitted
tar: usr/local/nagios/etc/pnp/pages: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc/pnp/pages: Cannot change mode to rwxrwsr-x: Operation not permitted
tar: usr/local/nagios/etc/pnp: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc/pnp: Cannot change mode to rwxrwsr-x: Operation not permitted
tar: usr/local/nagios/etc/import: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc/import: Cannot change mode to rwsrwsr-x: Operation not permitted
tar: usr/local/nagios/etc: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc: Cannot change mode to rwsrwsr-x: Operation not permitted
tar: Exiting with failure status due to previous errors
/usr/local/nagiosxi/scripts
RESETTING PERMS
SETUID ROOT OK
OUTPUT=SETUID ROOT OK
RETURNCODE=1

PROCESSED 1 COMMANDS

File: 172.26.50.3.cfg:

Code: Select all

###############################################################################
#
# Service configuration file
#
# Created by: Nagios Core Config Manager 2.3.3
# Date:       2015-08-17 16:55:23
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################

define service {
        host_name                       172.26.50.3
        service_description             Ping
        use                             xiwizard_windowsserver_ping_service
        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           0
        _xiwizard                       windowssnmp
        register                        1
        }

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: XI Error: Command name of command line is NULL

Post by tgriep »

Can you run the following and post the output here?

Code: Select all

ls -l /usr/local/nagios/etc
Be sure to check out our Knowledgebase for helpful articles and solutions!
Episodio1
Posts: 6
Joined: Mon Aug 24, 2015 3:41 am

Re: XI Error: Command name of command line is NULL

Post by Episodio1 »

I send you screenshot (easyviewing with colors) :)
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: XI Error: Command name of command line is NULL

Post by tgriep »

In your previous post, you said
I removed "sudo" from /usr/local/nagiosxi/scripts/restart_nagios_with_export.sh in line: sudo $BASEDIR/manage_services.sh restart nagios
Try putting that back, that could be causing the issue.

Can you upload the following file?
/etc/sudoers

Can you run the following and post the output?

Code: Select all

chage -l nagios
grep nag /etc/passwd
grep nag /etc/group
Be sure to check out our Knowledgebase for helpful articles and solutions!
Episodio1
Posts: 6
Joined: Mon Aug 24, 2015 3:41 am

Re: XI Error: Command name of command line is NULL

Post by Episodio1 »

Most important lines from sudoers:

Code: Select all

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
myuser ALL=(ALL)      ALL

## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d
User_Alias      NAGIOSXI=nagios
User_Alias              NAGIOSXIWEB=apache
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios start
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios stop
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios restart
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios reload
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios status
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios checkconfig
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db start
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db stop
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db restart
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db reload
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db status
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd start
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd stop
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd restart
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd reload
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd status
NAGIOSXI ALL = NOPASSWD:/usr/bin/nmap *
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/upgrade_to_latest.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/change_timezone.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_services.sh *
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/messages
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/httpd/error_log
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/mysqld.log
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/nmap *
NAGIOSXIWEB ALL = NOPASSWD:/etc/init.d/snmptt restart
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/repair_databases.sh
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_services.sh *

Code: Select all

[root@localhost etc]# chage -l nagios
  Last password change                                    : Aug 14, 2015
  Password expires                                        : never
  Password inactive                                       : never
  Account expires                                         : never
  Minimum number of days between password change          : 0
  Maximum number of days between password change          : 99999
  Number of days of warning before password expires       : 7

[root@localhost etc]# grep nag /etc/passwd
   nagios:x:501:100::/home/nagios:/bin/bash

[root@localhost etc]# grep nag /etc/group
   nagios:x:501:nagios,apache
   nagcmd:x:502:nagios,apache

[root@localhost etc]#
I put "sudo" again in that file and same error happens.

I restored a previous snapshot backup and same error happens.

BUT I tried to restore first bakcup in history and it worked.
I added the "Windows SNMP" with a few services and they worked.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: XI Error: Command name of command line is NULL

Post by ssax »

So are you saying you're no longer experiencing the issue?
Episodio1
Posts: 6
Joined: Mon Aug 24, 2015 3:41 am

Re: XI Error: Command name of command line is NULL

Post by Episodio1 »

Yes.

All is OK now.
Locked