Error in New CCM - illegal char in variable def
Error in New CCM - illegal char in variable def
Here's the variable I've been using for a while:
"MessageCount DIRECT=OS:server.domain.local\\private$\\tn39 1000 5000"
As soon as I open the host object I'm getting an error in the new CCM that there is an illegal character in the variable definition and it's removing it, causing all the checks that reference the variable to go critical. This does not happen when I open the host object in the legacy CCM. I just upgraded to 2.1 but it could have been happening before, we don't touch these often.
Nagios XI Installation Profile
Download Profile
System:
Nagios XI Version : 2012R2.1
servername 2.6.32-220.13.1.el6.i686 i686
CentOS release 6.2 (Final)
Gnome Installed
Apache Information
PHP Version: 5.3.3
Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0
Server Name: nagios-savvis
Server Address: ip address
Server Port: 80
Date/Time
PHP Timezone: America/New_York
PHP Time: Fri, 31 May 2013 14:14:31 -0400
System Time: Fri, 31 May 2013 14:14:31 -0400
Nagios XI Data
nagios (pid 31517) is running...
NPCD running (pid 1953).
ndo2db (pid 22653) is running...
CPU Load 15: 2.68
Total Hosts: 870
Total Services: 12746
Function 'get_base_uri' returns: http://nagios-savvis/nagiosxi/
Function 'get_base_url' returns: http://nagios-savvis/nagiosxi/
Function 'get_backend_url(internal_call=false)' returns: http://nagios-savvis/nagiosxi/includes/ ... rofile.php
Function 'get_backend_url(internal_call=true)' returns: http://localhost/nagiosxi/backend/
Ping Test localhost
Running:
/bin/ping -c 3 localhost 2>&1
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.016 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.019 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.020 ms
--- localhost ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.016/0.018/0.020/0.004 ms
Test wget To locahost
WGET From URL: http://localhost/nagiosql/index.php
Running:
/usr/bin/wget http://localhost/nagiosql/index.php
--2013-05-31 14:14:33-- http://localhost/nagiosql/index.php
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5259 (5.1K) [text/html]
Saving to: `/tmp/nagiosql_index.tmp'
0K ..... 100% 360M=0s
2013-05-31 14:14:33 (360 MB/s) - `/tmp/nagiosql_index.tmp' saved [5259/5259]
"MessageCount DIRECT=OS:server.domain.local\\private$\\tn39 1000 5000"
As soon as I open the host object I'm getting an error in the new CCM that there is an illegal character in the variable definition and it's removing it, causing all the checks that reference the variable to go critical. This does not happen when I open the host object in the legacy CCM. I just upgraded to 2.1 but it could have been happening before, we don't touch these often.
Nagios XI Installation Profile
Download Profile
System:
Nagios XI Version : 2012R2.1
servername 2.6.32-220.13.1.el6.i686 i686
CentOS release 6.2 (Final)
Gnome Installed
Apache Information
PHP Version: 5.3.3
Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0
Server Name: nagios-savvis
Server Address: ip address
Server Port: 80
Date/Time
PHP Timezone: America/New_York
PHP Time: Fri, 31 May 2013 14:14:31 -0400
System Time: Fri, 31 May 2013 14:14:31 -0400
Nagios XI Data
nagios (pid 31517) is running...
NPCD running (pid 1953).
ndo2db (pid 22653) is running...
CPU Load 15: 2.68
Total Hosts: 870
Total Services: 12746
Function 'get_base_uri' returns: http://nagios-savvis/nagiosxi/
Function 'get_base_url' returns: http://nagios-savvis/nagiosxi/
Function 'get_backend_url(internal_call=false)' returns: http://nagios-savvis/nagiosxi/includes/ ... rofile.php
Function 'get_backend_url(internal_call=true)' returns: http://localhost/nagiosxi/backend/
Ping Test localhost
Running:
/bin/ping -c 3 localhost 2>&1
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.016 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.019 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.020 ms
--- localhost ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.016/0.018/0.020/0.004 ms
Test wget To locahost
WGET From URL: http://localhost/nagiosql/index.php
Running:
/usr/bin/wget http://localhost/nagiosql/index.php
--2013-05-31 14:14:33-- http://localhost/nagiosql/index.php
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5259 (5.1K) [text/html]
Saving to: `/tmp/nagiosql_index.tmp'
0K ..... 100% 360M=0s
2013-05-31 14:14:33 (360 MB/s) - `/tmp/nagiosql_index.tmp' saved [5259/5259]
Re: Error in New CCM - illegal char in variable def
Did some testing and it's the Dollar Sign ($). The $ isn't listed as an illegal character and is quite necessary to monitor MSMQ.
Re: Error in New CCM - illegal char in variable def
Is this a free var? Could you post a copy of the host config?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Error in New CCM - illegal char in variable def
Yes the free variable:
Here's the config for one of the servers:
###############################################################################
#
# Host configuration file
#
# Created by: Nagios QL Version 3.0.3
# Date: 2013-05-31 15:50:02
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################
define host {
host_name ATL02PRDAPP151
use aw-host
alias Customer CN46 Application Server
address 10.2.15.46
parents ATL02-253-CSW01
hostgroups AW STD CN,AW STD CN 6.1 SP1,AW STD Tunnel Checks,Hosted - AW PROD Standard Server
check_command check-host-alive!!!!!!!!
max_check_attempts 2
notification_interval 240
notification_period 24x7
notification_options d,u,r,
_cndomain cn46.url.com
_tn "MessageCount DIRECT=OS:atl02prdapp164.domain.local\\private$\\T1 1000 5000"
register 1
}
The _tn is the issue. Specifically the $.
###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################
Here's the config for one of the servers:
###############################################################################
#
# Host configuration file
#
# Created by: Nagios QL Version 3.0.3
# Date: 2013-05-31 15:50:02
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################
define host {
host_name ATL02PRDAPP151
use aw-host
alias Customer CN46 Application Server
address 10.2.15.46
parents ATL02-253-CSW01
hostgroups AW STD CN,AW STD CN 6.1 SP1,AW STD Tunnel Checks,Hosted - AW PROD Standard Server
check_command check-host-alive!!!!!!!!
max_check_attempts 2
notification_interval 240
notification_period 24x7
notification_options d,u,r,
_cndomain cn46.url.com
_tn "MessageCount DIRECT=OS:atl02prdapp164.domain.local\\private$\\T1 1000 5000"
register 1
}
The _tn is the issue. Specifically the $.
###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Error in New CCM - illegal char in variable def
I can confirm this behavior. I have tried escaping and quoting it in various ways with no luck. I'll talk with our developers on Monday to take a look, if I can't find out before then.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Error in New CCM - illegal char in variable def
For a quick resolution while we check this out. Remove the $ from the regular expression on line 395 like the following example. This will only effect variables within config definitions.
Code: Select all
/usr/local/nagiosxi/html/includes/components/ccm/javascript/form_js.js
From:
if(varDef.match(/[`~&|$'"<>]/)) {
To:
if(varDef.match(/[`~&|'"<>]/)) {Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Error in New CCM - illegal char in variable def
Just to clarify what is happening here.... By default the $ is actually an illegal character as defined by nagios.cfg. As such, we chose to validate against all standard settings in core with the new ccm. It would appear that you are correct that the old ccm does not have this same practice. It would also appear that this character was removed from your illegal macros, and just needed to also get removed from the JS validation. Once both steps are done it should work fine for you. I will note however, that an upgrade most likely will replace the standard filtering on free variables again and will need to be removed.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: Error in New CCM - illegal char in variable def
I didn't see a $ in the nagios.cfg illegal character list. I need to be able to use it.
I edited the javascript and will let you know how it works.
I edited the javascript and will let you know how it works.
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Error in New CCM - illegal char in variable def
Here is the list of default illegal characters due to how and where else they are used in Nagios:
Let us know how your edit goes.
Code: Select all
illegal_object_name_chars=`~!$%^&*|'"<>?,()=Let us know how your edit goes.
Re: Error in New CCM - illegal char in variable def
That worked. I had to remove both the dollar ($) and the double quote (") for it to work.