Ad Widget

Collapse

Distinguish physical and virtual servers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • garychanyw
    Junior Member
    • Feb 2018
    • 7

    #1

    Distinguish physical and virtual servers

    Hi,

    I have physical and virtual servers in my environment and they have different antivirus application (running as Windows services). May I know how to auto discover them as physical or virtual then assign to different template?
  • tcilmo
    Senior Member
    • Nov 2016
    • 122

    #2
    Originally posted by garychanyw
    Hi,

    I have physical and virtual servers in my environment and they have different antivirus application (running as Windows services). May I know how to auto discover them as physical or virtual then assign to different template?
    Sounds like you want to configure an auto-registration action. There are three ways to do this.
    1. Host metadata - Specify unique metadata in the agent config for host types.
    2. Host name - Host names will require a string to differentiate between types.
    3. proxy - Use proxy's, VM's on proxy A and physicals on proxy B.



    What ever way you choose, you can then have a template auto applied.
    Last edited by tcilmo; 17-02-2018, 00:01.

    Comment

    • LenR
      Senior Member
      • Sep 2009
      • 1005

      #3
      Look at item system.hw.chassis[], vmware has a prefix, I think hyperv does also.

      We install facter on Linux and use it to get the serial number via userparameter, but I don't remember why we chose that method, it's almost 10 years old.

      Comment

      • bbrendon
        Senior Member
        • Sep 2005
        • 870

        #4
        You're probably better off going for something that doesn't require the agent to run as root.

        sudo dmidecode -s baseboard-manufacturer
        sudo dmidecode -s system-product-name

        or cat files in /sys/devices/virtual/dmi/id
        Unofficial Zabbix Expert
        Blog, Corporate Site

        Comment

        • LenR
          Senior Member
          • Sep 2009
          • 1005

          #5
          I guess that's why we use facter, and we were probably on 1.8.

          Comment

          • garychanyw
            Junior Member
            • Feb 2018
            • 7

            #6
            Hi Tcilmo,

            1) how to do? I have HostMetadataItem=system.uname in my conf file
            2) Same naming standard for physical and virtual servers, so cannot distinguish.
            3) Not preferred...

            Thanks

            Comment

            • garychanyw
              Junior Member
              • Feb 2018
              • 7

              #7
              Hi BBrendon,

              Can you explain more in detail?

              Gary

              Comment

              • LenR
                Senior Member
                • Sep 2009
                • 1005

                #8
                On Linux, we install facter (https://puppet.com/blog/facter-part-1-facter-101) on all systems, then:

                UserParameter=local.facter[*],sudo /usr/bin/facter $1

                sudoers.d: %zabbix ALL=NOPASSWD: /usr/bin/facter

                Item keys local.facter[virtual], local.facter[serialnumber]

                facter virtual will return virtual or physical, serialnumber on vm's will have a prefix.

                On windows: item for serial number w/ key
                wmi.get["root\cimv2","SELECT serialnumber FROM Win32_BIOS"]

                Sample trigger logic:
                {Template Windows VMWare and OpenManage Services:wmi.get["root\cimv2","SELECT serialnumber FROM Win32_BIOS"].str(VMware)}=1 and {Template Windows VMWare and OpenManage Services:service_state[VMTools].last()}>0

                Comment

                • garychanyw
                  Junior Member
                  • Feb 2018
                  • 7

                  #9
                  system.hw.chassis key is not supported in Windows
                  Last edited by garychanyw; 21-02-2018, 10:47.

                  Comment

                  • LenR
                    Senior Member
                    • Sep 2009
                    • 1005

                    #10
                    system.hw.chassis needs root authority to work in Linux. I didn't notice that when I mentioned it above, I've never used it. I wouldn't want my entire zabbix agent to run as root, sudo access to specific commands like I have above grant only the root access needed.

                    Comment

                    • garychanyw
                      Junior Member
                      • Feb 2018
                      • 7

                      #11
                      can we check the existence of a file?
                      e.g. for virtual server, VMWare tool is installed so there some VMWare tool files exist; And there is no such files in physical server

                      Comment

                      • LenR
                        Senior Member
                        • Sep 2009
                        • 1005

                        #12
                        Yes, but we had the chicken/egg problem. We used the method above using factor to make sure our VM's had vmware tools running. At that time, we were doing a lot of P2V migrations.

                        You can also check for the tools service or processes.

                        Comment

                        • garychanyw
                          Junior Member
                          • Feb 2018
                          • 7

                          #13
                          Hi LenR,

                          Sorry I am new to Zabbix, can you advise how to check for file, tools service and process?

                          Comment

                          Working...