summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFahad Khan <fahadnaeemkhan@gmail.com>2023-09-28 06:09:16 +0000
committerOle Tr�an <otroan@employees.org>2023-10-03 08:01:35 +0000
commit5299164022593ce7f8b3109d57b398e8687039ff (patch)
tree5f4152a91bcb3cca0bcd11c6196bb939646bd57f
parentc1b038001e1f18effb3c9ff5daa9e9cac1cd66e8 (diff)
stats: added optional CLI arg "port" to specify non-default port
There are cases where default port for prometheus exporter is not available e.g. when multiple vpp are running on single node. Type: improvement Change-Id: I39701486f9dfaf4dc9f08aab56e88126687b507a Signed-off-by: Fahad Khan <fahadnaeemkhan@gmail.com>
-rw-r--r--src/vpp/app/vpp_prometheus_export.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/vpp/app/vpp_prometheus_export.c b/src/vpp/app/vpp_prometheus_export.c
index 69baeb02fc7..35117c9f32f 100644
--- a/src/vpp/app/vpp_prometheus_export.c
+++ b/src/vpp/app/vpp_prometheus_export.c
@@ -242,6 +242,9 @@ main (int argc, char **argv)
{
unformat_input_t _argv, *a = &_argv;
u8 *stat_segment_name, *pattern = 0, **patterns = 0;
+ u16 port = SERVER_PORT;
+ char *usage =
+ "%s: usage [socket-name <name>] [port <0 - 65535>] <patterns> ...\n";
int rv;
/* Allocating 256MB heap */
@@ -255,23 +258,22 @@ main (int argc, char **argv)
{
if (unformat (a, "socket-name %s", &stat_segment_name))
;
+ else if (unformat (a, "port %d", &port))
+ ;
else if (unformat (a, "%s", &pattern))
{
vec_add1 (patterns, pattern);
}
else
{
- fformat (stderr,
- "%s: usage [socket-name <name>] <patterns> ...\n",
- argv[0]);
+ fformat (stderr, usage, argv[0]);
exit (1);
}
}
if (vec_len (patterns) == 0)
{
- fformat (stderr,
- "%s: usage [socket-name <name>] <patterns> ...\n", argv[0]);
+ fformat (stderr, usage, argv[0]);
exit (1);
}
@@ -283,7 +285,7 @@ main (int argc, char **argv)
exit (1);
}
- int fd = start_listen (SERVER_PORT);
+ int fd = start_listen (port);
if (fd < 0)
{
exit (1);