Skip to content

Commit

Permalink
fix --alert condition checks for 95th percentile to block using estim…
Browse files Browse the repository at this point in the history
…ates
  • Loading branch information
vergoh committed Dec 16, 2023
1 parent 5f09d33 commit 2a97b07
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/dbshow.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,6 @@ void showhours(const interfaceinfo *interface)
timeused_debug(__func__, 0);
}

// TODO: alert needs new function due to different format
// TODO: image? output below doesn't have much graphics potential, line in 5 minute graph could be one alternative
// TODO: tests
void show95thpercentile(const interfaceinfo *interface)
Expand Down
1 change: 1 addition & 0 deletions src/percentile.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "dbsql.h"
#include "percentile.h"

// TODO: tests
int getpercentiledata(percentiledata *pdata, const char *iface)
{
uint32_t entry = 0, entrylimit;
Expand Down
8 changes: 7 additions & 1 deletion src/vnstat_func.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ int parsealertargs(PARAMS *p, char **argv)
currentarg++;

if (p->alerttype == AT_Percentile && (p->alertoutput == 2 || p->alertexit == 2)) {
printf("Error: Estimate conditions cannot be used in combination with selected alert type.\n");
printf("Error: Estimate output and exit conditions cannot be used in combination with selected alert type.\n");
showalerthelp();
return 0;
}
Expand Down Expand Up @@ -721,6 +721,12 @@ int parsealertargs(PARAMS *p, char **argv)
return 0;
}

if (p->alerttype == AT_Percentile && (p->alertcondition == AC_RX_Estimate || p->alertcondition == AC_TX_Estimate || p->alertcondition == AC_Total_Estimate)) {
printf("Error: Estimate conditions cannot be used in combination with selected alert type.\n");
showalerthelp();
return 0;
}

// limit
if (!isnumeric(argv[currentarg])) {
printf("Error: Limit parameter for %s must be a greater than zero integer without decimals.\n", argv[0]);
Expand Down

0 comments on commit 2a97b07

Please sign in to comment.