Page 1 of 1

Illegal $ in service description

Posted: Wed Sep 13, 2017 12:22 pm
by cbbs70a
All;
I am using Nagios 4.3.4 and came across a problem where I have an illegal dollar sign in my service_description like so:

define service {
use databases-table-check-passive
host_name ubuntu.voipbiz.org
service_description MySQL Table Check - sys.x$host_summary
contact_groups voipbiz.org-admins
servicegroups databases
event_handler mysql_repair_table!$SERVICESTATE$SERVICESTATETYPE$SERVICEATTEMPT$!DBTABLE
}

I thought that I could simply escape the dollar sign by prepending a \$ or a \\$ to the original $ but that doesn't appear to be the case. What am I missing?
Thanks;
Frank

Re: Illegal $ in service description

Posted: Wed Sep 13, 2017 1:41 pm
by scottwilkerson
For each $ what you actually need is

Code: Select all

\$$
so something like this would be correct if your command was what you were looking for.

Code: Select all

define service {
use databases-table-check-passive
host_name ubuntu.voipbiz.org
service_description MySQL Table Check - sys.x\$$host_summary
contact_groups voipbiz.org-admins
servicegroups databases
event_handler mysql_repair_table!\$$SERVICESTATE\$$SERVICESTATETYPE\$$SERVICEATTEMPT\$$!DBTABLE
}
However if you are actually trying to pass these macros you were already missing the ending $ on several macros, so I am guessing you need something close to this

Code: Select all

define service {
use databases-table-check-passive
host_name ubuntu.voipbiz.org
service_description MySQL Table Check - sys.x\$$host_summary
contact_groups voipbiz.org-admins
servicegroups databases
event_handler mysql_repair_table!\$$SERVICESTATE\$$\$$SERVICESTATETYPE\$$\$$SERVICEATTEMPT\$$!DBTABLE
}

Re: Illegal $ in service description

Posted: Fri Sep 15, 2017 10:55 am
by cbbs70a
Thanks for the quick response. Now, the line that you posted for the service_description was what I thought also, but that didn't solve it.

service_description MySQL Table Check - sys.x\$$host_summary


and the event_handler line worked fine. I'm pretty much stomped on this one.
Thanks Again;
Frank

Re: Illegal $ in service description

Posted: Fri Sep 15, 2017 2:17 pm
by tgriep
Try escaping the dollar like the example below and see if that works for you.
service_description MySQL Table Check - sys.x$"$"host_summary