Skip to content

Commit

Permalink
Merge pull request #2409 from pqarmitage/updates
Browse files Browse the repository at this point in the history
IPVS SNMP fixes, improvements and enhancements
  • Loading branch information
pqarmitage authored Apr 28, 2024
2 parents 9ee268d + 5a85dec commit 722a9b0
Show file tree
Hide file tree
Showing 19 changed files with 1,048 additions and 769 deletions.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1507,6 +1507,7 @@ dnl ----[ Checks for libraries ]----
NETLINK_VER=0
IPVS_USE_NL=No
if test .$enable_lvs != .no -a .${enable_libnl} != .no; then
dnl -- IPVS netlink support since linux 2.6.28 - 24/12/08
$PKG_CONFIG --exists libnl-3.0
if test $? -eq 0; then
add_pkg_config([libnl-3.0], [NL3], [remove-requires])
Expand Down
122 changes: 117 additions & 5 deletions doc/KEEPALIVED-MIB.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ IMPORTS
FROM SNMPv2-TC;

keepalived MODULE-IDENTITY
LAST-UPDATED "202403180001Z"
LAST-UPDATED "202404050001Z"
ORGANIZATION "Keepalived"
CONTACT-INFO "http://www.keepalived.org"
DESCRIPTION
"This MIB describes objects used by keepalived, both
for VRRP and health checker."
REVISION "202404050001Z"
DESCRIPTION "add missing 64 bit counters for 64 bit stats"
REVISION "202403180001Z"
DESCRIPTION "add separate path and argv[0] for scripts"
REVISION "202212090001Z"
Expand Down Expand Up @@ -3426,7 +3428,12 @@ VirtualServerEntry ::= SEQUENCE {
virtualServerTunnelCsum INTEGER,
virtualServerName DisplayString,
virtualServerQuorumUpPath DisplayString,
virtualServerQuorumDownPath DisplayString
virtualServerQuorumDownPath DisplayString,
virtualServerRateCps64 Counter64,
virtualServerRateInPPS64 Counter64,
virtualServerRateOutPPS64 Counter64,
virtualServerRateInBPS64 Counter64,
virtualServerRateOutBPS64 Counter64
}

virtualServerIndex OBJECT-TYPE
Expand Down Expand Up @@ -4084,6 +4091,51 @@ virtualServerQuorumDownPath OBJECT-TYPE
"Path to command to execute when the quorum is not met."
::= { virtualServerEntry 73 }

virtualServerRateCps64 OBJECT-TYPE
SYNTAX Counter64
UNITS "connections/s"
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Current connection rate for this virtual server."
::= { virtualServerEntry 74 }

virtualServerRateInPPS64 OBJECT-TYPE
SYNTAX Counter64
UNITS "packets/s"
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Current in packet rate for this virtual server."
::= { virtualServerEntry 75 }

virtualServerRateOutPPS64 OBJECT-TYPE
SYNTAX Counter64
UNITS "packets/s"
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Current out packet rate for this virtual server."
::= { virtualServerEntry 76 }

virtualServerRateInBPS64 OBJECT-TYPE
SYNTAX Counter64
UNITS "bytes/s"
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Current incoming rate for this virtual server."
::= { virtualServerEntry 77 }

virtualServerRateOutBPS64 OBJECT-TYPE
SYNTAX Counter64
UNITS "bytes/s"
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Current outgoing rate for this virtual server."
::= { virtualServerEntry 78 }


-- real servers

Expand Down Expand Up @@ -4161,7 +4213,12 @@ RealServerEntry ::= SEQUENCE {
realServerTunnelCsum INTEGER,
realServerName DisplayString,
realServerNotifyUpPath DisplayString,
realServerNotifyDownPath DisplayString
realServerNotifyDownPath DisplayString,
realServerRateCps64 Counter64,
realServerRateInPPS64 Counter64,
realServerRateOutPPS64 Counter64,
realServerRateInBPS64 Counter64,
realServerRateOutBPS64 Counter64
}

realServerIndex OBJECT-TYPE
Expand Down Expand Up @@ -4666,6 +4723,51 @@ realServerNotifyDownPath OBJECT-TYPE
"Path to command to execute when this server becomes dead."
::= { realServerEntry 57 }

realServerRateCps64 OBJECT-TYPE
SYNTAX Counter64
UNITS "connections/s"
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Current connection rate for this real server."
::= { realServerEntry 58 }

realServerRateInPPS64 OBJECT-TYPE
SYNTAX Counter64
UNITS "packets/s"
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Current in packet rate for this real server."
::= { realServerEntry 59 }

realServerRateOutPPS64 OBJECT-TYPE
SYNTAX Counter64
UNITS "packets/s"
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Current out packet rate for this real server."
::= { realServerEntry 60 }

realServerRateInBPS64 OBJECT-TYPE
SYNTAX Counter64
UNITS "bytes/s"
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Current incoming rate for this real server."
::= { realServerEntry 61 }

realServerRateOutBPS64 OBJECT-TYPE
SYNTAX Counter64
UNITS "bytes/s"
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Current outgoing rate for this real server."
::= { realServerEntry 62 }

lvsSyncDaemon OBJECT IDENTIFIER ::= { check 6 }

lvsSyncDaemonEnabled OBJECT-TYPE
Expand Down Expand Up @@ -5299,7 +5401,12 @@ virtualServerGroup OBJECT-GROUP
virtualServerTunnelCsum,
virtualServerName,
virtualServerQuorumUpPath,
virtualServerQuorumDownPath
virtualServerQuorumDownPath,
virtualServerRateCps64,
virtualServerRateInPPS64,
virtualServerRateOutPPS64,
virtualServerRateInBPS64,
virtualServerRateOutBPS64
}
STATUS current
DESCRIPTION
Expand Down Expand Up @@ -5363,7 +5470,12 @@ realServerGroup OBJECT-GROUP
realServerTunnelCsum,
realServerName,
realServerNotifyUpPath,
realServerNotifyDownPath
realServerNotifyDownPath,
realServerRateCps64,
realServerRateInPPS64,
realServerRateOutPPS64,
realServerRateInBPS64,
realServerRateOutBPS64
}
STATUS current
DESCRIPTION
Expand Down
12 changes: 12 additions & 0 deletions doc/man/man5/keepalived.conf.5.in
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,18 @@ possibly following any cleanup actions needed.
# enable SNMP traps
\fBenable_traps\fR

# When SNMP requests are made, the checker process only updates the
# virtual and real server stats from the kernel if the last time the
# stats for that virtual server were read was more than this configured
# interval. The default interval is 5 seconds, and the valid range is
# 1 milli-second to 30 seconds.
\fBsnmp_vs_stats_update_interval\fR <TIMER>

# Like snmp_vs_stats_update_interval but for real servers. Stats for
# real servers are only read if there is an SNMP request for real server
# stats.
\fBsnmp_rs_stats_update_interval\fR <TIMER>

# If Keepalived has been build with DBus support, the following
# keywords are available.
# --
Expand Down
17 changes: 2 additions & 15 deletions keepalived/check/check_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,21 +469,6 @@ dump_tracking_rs(FILE *fp, const void *data)
conf_write(fp, " %s -> %s, weight %d%s", FMT_VS(checker->vs), FMT_RS(checker->rs, checker->vs), top->weight, top->weight_multiplier == -1 ? " reverse" : "");
}

static const char *
format_decimal(unsigned long val, int dp)
{
static char buf[22]; /* Sufficient for 2^64 as decimal plus decimal point */
unsigned dp_factor = 1;
int i;

for (i = 0; i < dp; i++)
dp_factor *= 10;

snprintf(buf, sizeof(buf), "%lu.%*.*lu", val / dp_factor, dp, dp, val % dp_factor);

return buf;
}

static void
dump_notify_vs_rs_script(FILE *fp, const notify_script_t *script, const char *type, const char *state)
{
Expand Down Expand Up @@ -1176,7 +1161,9 @@ validate_check_config(void)
if (rs_iseq(rs, rs1)) {
report_config_error(CONFIG_GENERAL_ERROR, "VS %s: real server %s is duplicated - removing second rs", FMT_VS(vs), FMT_RS(rs, vs));
free_rs(rs);
#ifdef _WITH_SNMP_CHECKER_
vs->rs_cnt--;
#endif
rs_removed = true;
break;
}
Expand Down
2 changes: 2 additions & 0 deletions keepalived/check/check_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,9 @@ rs_end_handler(void)
}

list_add_tail(&current_rs->e_list, &current_vs->rs);
#ifdef _WITH_SNMP_CHECKER_
current_vs->rs_cnt++;
#endif
}

static void
Expand Down
Loading

0 comments on commit 722a9b0

Please sign in to comment.