Ad Widget

Collapse

Problem with system.run

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rutkowsky
    Junior Member
    • Aug 2012
    • 9

    #1

    Problem with system.run

    Hello there

    I have a problem with system.run command. I'm trying to copy some files from network shares. From local folder works fine.

    Type: Zabbix Agent


    Key: system.run[cmd.exe /c copy \\[ip address]\[folder name]\[filename] [Local folder] /Y,nowait]

    I don't know what I'm doing wrong. Thanks for all replys in advance.
  • Zaniwoop
    Senior Member
    • Jan 2010
    • 232

    #2
    I suspect it's the backslash "\"... it is being interpreted as a prefix to a special character.

    Comment

    • rutkowsky
      Junior Member
      • Aug 2012
      • 9

      #3
      Originally posted by Zaniwoop
      I suspect it's the backslash "\"... it is being interpreted as a prefix to a special character.
      Yes it's true. I've changed to "cmd.exe /C \"copy \" ... but I found in log file (Debug Level 4) "Access is denied". Zabbix Agent is logged on as Local System Account with full control to local folder. Should I log on as Administrator?
      Last edited by rutkowsky; 25-10-2013, 16:20.

      Comment

      • steveboyson
        Senior Member
        • Jul 2013
        • 582

        #4
        Code:
        UserParameter=copy[*],do_copy.cmd $1 $2 $3 $4 $5 $6 $7 $8
        and do_copy.cmd is:
        Code:
        @echo off
        rem copy \\[ip address]\[folder name]\[filename] [Local folder] /Y,nowait]
        copy \\%1\%2\%3 %4 /Y,nowait

        Comment

        • ArtemK
          Senior Member
          • May 2013
          • 232

          #5
          AFAIK, SYSTEM account doesn't have any access to any network share, but I'm not 100% sure.

          Comment

          • steveboyson
            Senior Member
            • Jul 2013
            • 582

            #6
            ArtemK, that is completely right. For accessing network shares a regular user account is to be used. That means zabbix_agentd.exe needs to run under this user account.

            Comment

            • ArtemK
              Senior Member
              • May 2013
              • 232

              #7
              yep

              Another way is to add command
              Code:
              net use \\ip\IPC$ /user:%user@domain% %pass%
              to steveboyson's script, but there is problem with clear-text password

              Comment

              • rutkowsky
                Junior Member
                • Aug 2012
                • 9

                #8
                I've run Zabbix Agent under Administrator Account and it works. Thank you all for your help.

                Comment

                Working...