Ad Widget

Collapse

Regular expression to get the Server IP address

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mellis
    Senior Member
    • Oct 2017
    • 145

    #1

    Regular expression to get the Server IP address

    Good Morning

    I have a system with 46 proxies all running 4.4. to make this work we had to use several different Server addresses to get all the proxies to connect. Our server and most of the proxies sit in a private network. We used several NAT addresses to route the traffic. We are now looking to do an upgrade and not all of the proxies have access to the internet so we will be creating an image that can be setup on the systems that do not have internet access.

    We will need to then edit the proxy config.

    I will need the Server ip from these that are working so the proxy reconnects. So i setup an item to get the proxy conf. I want to setup a depend item that has preprocessing to only return the address.

    I do not understand regular expression,,, after 40 years,,, but i am also getting an error in Zabbix with the most simple Regular expression.

    The sample of the return from the master item:
    ::::::::::::::
    /etc/zabbix/zabbix_proxy.conf
    ::::::::::::::
    # This is a configuration file for Zabbix proxy daemon
    # To get more information about Zabbix, visit http://www.zabbix.com

    ############ GENERAL PARAMETERS #################

    ### Option: ProxyMode
    # Proxy operating mode.
    # 0 - proxy in the active mode
    # 1 - proxy in the passive mode
    #
    # Mandatory: no
    # Default:
    # ProxyMode=0

    ### Option: Server
    # If ProxyMode is set to active mode:
    # IP address or DNS name of Zabbix server to get configuration data from and send data to.
    # If ProxyMode is set to passive mode:
    # List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of Zabbix server.
    # Incoming connections will be accepted only from the addresses listed here.
    # If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally
    # and '::/0' will allow any IPv4 or IPv6 address.
    # '0.0.0.0/0' can be used to allow any IPv4 address.
    # Example: Server=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com
    #
    # Mandatory: yes
    # Default:
    # Server=

    ## we need to edit this value to point to the master zabbix server

    Server=xxx.xxx.xxx.xxx

    ### Option: ServerPort
    # Port of Zabbix trapper on Zabbix server.
    # For a proxy in the passive mode this parameter will be ignored.
    #
    # Mandatory: no
    # Range: 1024-32767
    # Default:
    # ServerPort=10051

    ### Option: Hostname
    # Unique, case sensitive Proxy name. Make sure the Proxy name is known to the server!
    # Value is acquired from HostnameItem if undefined.
    #
    # Mandatory: no
    # Default:
    # Hostname=

    I simply put Server= as Parameter 1 and \1 as Parameter 2.

    When i test this i get the error:
    cannot perform regular expression "Server=" match for value of type "string": pattern does not match

    Anyone have an idea?

  • mellis
    Senior Member
    • Oct 2017
    • 145

    #2
    I got this to work with "Server=\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b\n" "\0"

    Comment

    Working...