Ad Widget

Collapse

about [system. run] question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • liujun0253
    Junior Member
    • Oct 2021
    • 9

    #1

    about [system. run] question

    I am trying to use [system. run] method to monitor the output of the "net use | find/C "OK" "command, but the output of this direct run and the result of running [system. run] have been inconsistent. I feel that [system. run] does not provide the execution result, but the status result of the script running. Does anyone know there is a problem there? thank you.


    c:\Program Files\Zabbix Agent>zabbix_get -s 127.0.0.1 -k system.run["net use | find /C "OK""]
    0

    c:\Program Files\Zabbix Agent>net use | find /C "OK"
    1​
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4808

    #2
    if you run "net use" from your command prompt, it is executed in YOUR environment and with your permissions. So it returns network shares for you.
    Zabbix agent does not have to have same network resources available, as it runs as "local system" account...​

    Comment

    • liujun0253
      Junior Member
      • Oct 2021
      • 9

      #3
      Thank you. I want to use the output of the "net use" command to determine if all SMB connections are normal, but it seems there is no good way now and I am stuck

      Comment

      • Hamardaban
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • May 2019
        • 2713

        #4
        You can execute a script that will check smb share (according to the windows schedule on behalf of the user) and write the result to a file. And with a zabbix, read this file and process the contents.

        Comment

        • liujun0253
          Junior Member
          • Oct 2021
          • 9

          #5
          Good suggestion, I'll try it today, thank you

          Comment

          • Dwayne
            Junior Member
            • Feb 2025
            • 9

            #6
            of course you could setup there servers system account to have read access to the smb shares and poll the path regularly. less moving parts.

            Comment

            Working...