Ad Widget

Collapse

Item Show ip address

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sby
    Member
    • Jan 2017
    • 59

    #1

    Item Show ip address

    Hi,

    I am new with items and triggers.
    I always use zabbix default now i want to receive more info from servers.

    How can i create a item that i receive the ip's from the servers in zabbix.
    I try to understand how it works i use zabbix with zabbix agents.

    I hope someone want to help me with the right info.
  • allexpetrov
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2017
    • 361

    #2
    Ok, so first of all you need to read some good stuff about low-level discovery and how this awesome thing works (https://www.zabbix.com/documentation...evel_discovery ) , but in this case I would suggest to you use it with {#IFNAME} filter. In my case, for example, I would like to use filter with regexp:
    Code:
    ^enp0s([0-9]|[0-9][0-9])$
    , but it is up to you. This is for Linux on VirtualBox. I just wanted to get rid of loopback NIC
    Second is to create an Item prototype with key like
    Code:
    get.ip.nic[{#IFNAME}]
    And last, but not least - you need to configure your agent to work with UserParametrs (https://www.zabbix.com/documentation...userparameters) and enable UnsafeUserParameters. Then create a UserParameter in config file
    Code:
    UserParameter=get.ip.nic[*],/sbin/ifconfig $1  | egrep 'inet\W' | awk '{print $$2}'
    , restart agent and voila!

    Comment

    • sby
      Member
      • Jan 2017
      • 59

      #3
      Alex,

      Thank you.
      Where can i put this rule in zabbix ??

      See print screen.

      Comment

      • allexpetrov
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • May 2017
        • 361

        #4
        First thing, I suggest you to make such discoveries and items on Template level. In the future it will be easier to maintain.

        Second, if you just have opened the manual which I've pasted in previous message, then you would see what you should put in the Discovery Rule (https://www.zabbix.com/documentation...ork_interfaces). There is a real-life scenario based on vfs.fs.discovery , but you shoudl use net.if.discovery to get the values. For example, just try to perform
        Code:
        zabbix_get -s <host> -k net.if.discovery
        and you will understand which values you will receive.

        Third, you will be forced to create item prototype which will be based on the command I've provided in previous message.

        Forth, if you still in trouble with configuring zabbix - you can ask for a help from professionals https://www.zabbix.com/services

        And the last thing, if you are trying to be anonymous - make sure you are censored everything, otherwise it looks a little bit funny \

        Regards,
        Alex!

        Comment

        • sby
          Member
          • Jan 2017
          • 59

          #5
          Hi Alex,

          I have now this:
          [root@localhost ~]# zabbix_get -s ssc.domein -k net.if.discovery
          {"data":[{"{#IFNAME}":"lo"},{"{#IFNAME}":"eth0"}]}

          is #IFNAME then macro eth0

          Comment

          • sby
            Member
            • Jan 2017
            • 59

            #6
            Alex,

            In the log from the zabbix server i see the follow.

            became not supported: Received value [addr:192.168.1.100] is not suitable for value type [Numeric (unsigned)] and data type [Decimal]

            What is wrong in zabbix.

            Comment

            • allexpetrov
              Senior Member
              Zabbix Certified Trainer
              Zabbix Certified SpecialistZabbix Certified Professional
              • May 2017
              • 361

              #7
              [Numeric (unsigned)] and data type [Decimal] because you are receiving strings , not the numeric values. Use Character type

              Regards,
              Alex!

              Comment

              • sby
                Member
                • Jan 2017
                • 59

                #8
                I think it now works where can i see the results.

                Comment

                • sby
                  Member
                  • Jan 2017
                  • 59

                  #9
                  Yes this is working now.
                  Thank you Alex

                  Comment

                  • sby
                    Member
                    • Jan 2017
                    • 59

                    #10
                    Hi Can i also read more ip's from the server.

                    Comment

                    • allexpetrov
                      Senior Member
                      Zabbix Certified Trainer
                      Zabbix Certified SpecialistZabbix Certified Professional
                      • May 2017
                      • 361

                      #11
                      Could you please read the manual for Low-Level Discovery? Please don't be soo lazy...

                      Regards,
                      Alex!

                      Comment

                      Working...