• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Can I find out the status of the CARP interface (BACKUP / MASTER) through a command?

Scheduled Pinned Locked Moved HA/CARP/VIPs
3 Posts 2 Posters 1.1k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C
    cesarmsj
    last edited by Feb 24, 2021, 12:47 AM

    I would like to monitor the status of the CARP interface through the Zabbix Agent, I found the idea of ​​inserting UserParameter = pfsense.carp.state, sysctl net.inet.carp.demotion; but I didn't like it because it will only return a value other than 0 if there was a failure with the CARP interface, and that's not what I want, as you can see from the title of this post.

    1 Reply Last reply Reply Quote 0
    • J
      jimp Rebel Alliance Developer Netgate
      last edited by Feb 24, 2021, 3:16 PM

      The status of the individual VHIDs is visible in the ifconfig output -- you can use various shell utilities to parse/cut that down to a specific status depending on your needs.

      For example:

      ifconfig -a | grep 'carp:'
      	carp: MASTER vhid 11 advbase 1 advskew 0
      	carp: MASTER vhid 15 advbase 1 advskew 0
      	carp: MASTER vhid 14 advbase 1 advskew 0
      	carp: MASTER vhid 19 advbase 1 advskew 0
      	carp: MASTER vhid 16 advbase 1 advskew 0
      	carp: MASTER vhid 13 advbase 1 advskew 0
      	carp: MASTER vhid 17 advbase 1 advskew 0
      

      Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

      Need help fast? Netgate Global Support!

      Do not Chat/PM for help!

      C 1 Reply Last reply Feb 24, 2021, 4:52 PM Reply Quote 1
      • C
        cesarmsj @jimp
        last edited by Feb 24, 2021, 4:52 PM

        @jimp said in Can I find out the status of the CARP interface (BACKUP / MASTER) through a command?:

        ifconfig -a | grep 'carp:'

        This solution looks perfect, I only made one adjustment to get only the MASTER / BACKUP:

        UserParameter = pfsense.carp.state, ifconfig -a | grep 'carp:' | cut -d '' -f2 | sed -n 1p

        Sed is for taking only one CARP interface, it is very rare for one interface to be BACKUP while the others are MASTER, and vice versa.

        PS: I don't know if I should close this post as resolved or how to do it if I should.

        1 Reply Last reply Reply Quote 0
        3 out of 3
        • First post
          3/3
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
          This community forum collects and processes your personal information.
          consent.not_received