Ad Widget

Collapse

Remote command: Unterminated quoted string

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bashman
    Senior Member
    • Dec 2009
    • 432

    #1

    Remote command: Unterminated quoted string

    I have a remote command that executes a query on zabbix server host:

    Code:
    {HOSTNAME}: mysql -uzabbix --password="password" --execute 'use zabbix;update hosts_profiles,hosts set hosts_profiles.hardware="{ITEM.LASTVALUE}" where (select hosts_profiles.hostid from hosts where hosts.ip="{IPADDRESS}" and hosts.hostid=hosts_profiles.hostid)'
    But it doesn't work, and I can see in zabbix agent log:

    Code:
    sh: Syntax error: Unterminated quoted string
    But, this remote command works:

    Code:
    {HOSTNAME}: mysql -uzabbix --password="password" --execute 'use zabbix;update hosts_profiles,hosts set hosts_profiles.os="{ITEM.LASTVALUE}" where (select hosts_profiles.hostid from hosts where hosts.ip="{IPADDRESS}" and hosts.hostid=hosts_profiles.hostid)'
    The differences are the {ITEM.LASTVALUE}, the first case is:
    Code:
    NÂș process: 1 Model process: Mem: 885 MB HDD(/dev/sda:): 500.1 GB HDD(/dev/sdb:): 500.1 GB ISDN: 00:08.0 Network controller: Cologne Chip Designs GmbH ISDN network controller [HFC-PCI] (rev 02)
    and the second case:

    Code:
    Linux Debian 5.0.3 ( i686)
    I think the string in the first case is too long, but if I execute the command locally, it works fine.

    I need confirmation. Has anybody had this same problem?.
    978 Hosts / 16.901 Items / 8.703 Triggers / 44 usr / 90,59 nvps / v1.8.15
  • bashman
    Senior Member
    • Dec 2009
    • 432

    #2
    The problem is the {ITEM.LAST} has a "/n" in the last item string.

    Getting this "/n", the problem was solved.
    978 Hosts / 16.901 Items / 8.703 Triggers / 44 usr / 90,59 nvps / v1.8.15

    Comment


    • beretests
      beretests commented
      Editing a comment
      How did you get the "/n"? I'm facing a similar issue with zabbix_sender?
  • beretests
    Junior Member
    • Feb 2024
    • 1

    #3
    Nvm, figured it out. I needing to escape special characters from my output in perl using quotemeta. Thanks!

    Comment

    Working...