Ad Widget

Collapse

OpenVPN / VPN monitoring by Zabbix Agent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cberni
    Junior Member
    • Apr 2013
    • 19

    #1

    OpenVPN / VPN monitoring by Zabbix Agent

    Hi,
    I have a server (s1) with Zabbix Server installed. This server is monitoring other server by Zabbix Agent (s2). And the s2 has a tunnel (VPN) with another server (s3).

    s1: zabbix server installed
    s2: only zabbix agent installed
    s3: computer with s2 VPN tunnel

    The s2 and s3 has OpenVPN installed. How is the best way and how could I monitor if the tunnel s2-s3 is up?

    eg:
    s2 VPN IP: 10.11.12.1
    s3 VPN IP: 10.11.12.5

    How could I monitor in s1 (zabbix server) if the s2 is pinging to 10.11.12.5 ok?
  • cberni
    Junior Member
    • Apr 2013
    • 19

    #2
    anybody?!?!

    Comment

    • neogan
      Senior Member
      Zabbix Certified Trainer
      Zabbix Certified SpecialistZabbix Certified Professional
      • Sep 2011
      • 118

      #3
      What you want to check in s3?
      Is it available or pinging from s3 is s1?

      Comment

      • cberni
        Junior Member
        • Apr 2013
        • 19

        #4
        I want to check if the VPN network is up by pinging.
        The VPN network is only installed in s2 and s3.

        s2 has zabbix agent and s3 nothing.

        the test would be ping from s2 using the vpn ip.

        I would like to now how can I create a UserParameter appropriately. And the how could I create a Item and a Thread in zabbix server (s3).

        Comment

        • Colttt
          Senior Member
          Zabbix Certified Specialist
          • Mar 2009
          • 878

          #5
          taek a look at this: https://www.zabbix.com/documentation...userparameters

          you can creat a user parameter like:
          UserParameter=vpn.ping,ping -c3 VPN_IP && echo 0 || echo 1

          restart the agent, now add an item for this host called vpn.ping..
          Debian-User

          Sorry for my bad english

          Comment

          • cberni
            Junior Member
            • Apr 2013
            • 19

            #6
            ok.

            and how could I create a ITEM and how could I create a THREAD for this UserParameter? (step by step)

            Comment

            • Heilig
              Senior Member
              Zabbix Certified Trainer
              Zabbix Certified SpecialistZabbix Certified Professional
              • Mar 2013
              • 366

              #7
              You have already given a link to the detailed information how to do it, but I'll repeat:
              1) Extending Zabbix agents
              2) Creating an item
              3) Configuring a trigger
              If you want to learn how to operate with zabbix, you need to see them.
              It's all a lot easier than it seems.
              If questions remain, ask and we will try to help you.

              Comment

              • cberni
                Junior Member
                • Apr 2013
                • 19

                #8
                ok. I did it but didn't work yet.
                I'll explain what I did so you can help me see what is wrong.

                1.
                In the s2: vi /usr/local/etc/zabbix_agentd.conf
                The end of the file: UserParameter=CheckVPN,fping 10.11.12.6 | grep alive | wc -l

                returns 1 is alive
                returns 0 is unreachable

                2. s1
                Created the item as image bellow:


                3. s1
                Created the thread as image bellow:


                With this, the thread is showing OK status. But if the test "returns 0 is unreachable" in s2 nothing changes to s1 zabbix. Is like the thread is not activated and don't set is like Average.

                Any idea?

                Comment

                • Heilig
                  Senior Member
                  Zabbix Certified Trainer
                  Zabbix Certified SpecialistZabbix Certified Professional
                  • Mar 2013
                  • 366

                  #9
                  Check "Monitoring -> Latest data -> Graph -> Values" for the item "Test VPN". Actual values ​​are displayed? Can you see "0" value in a history?
                  Item "Test VPN" you created on host s2, I am right?

                  Also, please correct your trigger, I propose:
                  Name: VPN is DOWN
                  Expression: {...}=0

                  Comment

                  • cberni
                    Junior Member
                    • Apr 2013
                    • 19

                    #10
                    I can't see 0 value in the history. Only 1 value.

                    No, the zabbix-server is installed on host s1 and the host s2 is installed only zabbix-agent.
                    UserParameter is created in host s2 and the item "Test VPN" is created in host s1.

                    Right now the VPN is down and if I type the command line "fping 10.11.12.6 | grep alive | wc -l" in s2 terminal returns 0. BUT the 0 values don't arrives in s1 zabbix.

                    I correct the trigger as you propose. But as before, never gets the value 0 from UserParameter.

                    Comment

                    • cberni
                      Junior Member
                      • Apr 2013
                      • 19

                      #11
                      First I was using Item Type as "Zabbix agent (active)" and the last values of "Test VPN" was set as "no data".

                      Now I change the Item Type to "Zabbix agent" and the last values changed to 0 (VPN is DOWN). So, I turned on the VPN but the value didn't change to 1.

                      A print: http://postimg.org/image/ij43el4hl/

                      If I type "fping 10.11.12.6 | grep alive | wc -l" in host s2 terminal I get the value 1. But the item value in s1 zabbix server item remains 0.

                      Any idea?

                      Comment

                      • cberni
                        Junior Member
                        • Apr 2013
                        • 19

                        #12
                        The big picture:

                        in s2 host terminal:
                        fping 10.11.12.6 | grep alive | wc -l
                        return: "1"

                        in s1 host terminal:
                        zabbix_get -s s2.host -p 10050 -k "CheckVPN"
                        return: "0" (always)

                        Comment

                        • cberni
                          Junior Member
                          • Apr 2013
                          • 19

                          #13
                          solved.

                          the problem was the fping permission to zabbix user. I was testing ping with root user but zabbix uses zabbix user.

                          the solution:
                          chmod u+s /usr/sbin/fping

                          UserParameter=CheckVPN,/usr/sbin/fping 10.11.12.6 | grep alive | wc -l
                          or
                          UserParameter=CheckVPN,fping 10.11.12.6 | grep -c alive


                          ref: https://www.zabbix.com/forum/showthread.php?t=16867

                          Comment

                          Working...