summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2023-06-01 18:55:43 +0200
committerToni Uhlig <matzeton@googlemail.com>2023-06-12 19:05:33 +0200
commitc8ec505b9cebc444bea414ec27c34510ef167bad (patch)
treea38f9ba4edb56021d3d366e801b36dc5a4120151 /examples
parent2b1db0a556c31f15e2fcff0c127781fb91c0b402 (diff)
bump libnDPI to 8ea0eaa0d0c4a3be05f67ef7fa1d22c2579cf7d1
* added build fix for Gitlab CI * added friendly C11 check * set required libnDPI versionto 4.7 (ArchLinux ndpi-git sets version to 4.7, which is not released yet) * reduced sklearn-random-forest memory consumption by adjusting min. sample leaf Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/c-collectd/c-collectd.c19
-rwxr-xr-xexamples/c-collectd/rrdgraph.sh17
-rwxr-xr-xexamples/py-machine-learning/sklearn-random-forest.py2
3 files changed, 35 insertions, 3 deletions
diff --git a/examples/c-collectd/c-collectd.c b/examples/c-collectd/c-collectd.c
index 1d470d4ef..624672ef3 100644
--- a/examples/c-collectd/c-collectd.c
+++ b/examples/c-collectd/c-collectd.c
@@ -114,6 +114,11 @@ static struct
uint64_t flow_category_mining_count;
uint64_t flow_category_malware_count;
uint64_t flow_category_advertisment_count;
+ uint64_t flow_category_banned_site_count;
+ uint64_t flow_category_site_unavail_count;
+ uint64_t flow_category_allowed_site_count;
+ uint64_t flow_category_antimalware_count;
+ uint64_t flow_category_crypto_currency_count;
uint64_t flow_category_unknown_count;
uint64_t flow_l3_ip4_count;
@@ -193,6 +198,11 @@ static struct json_stat_map const categories_map[] = {
{"Mining", &collectd_statistics.flow_category_mining_count},
{"Malware", &collectd_statistics.flow_category_malware_count},
{"Advertisement", &collectd_statistics.flow_category_advertisment_count},
+ {"Banned_Site", &collectd_statistics.flow_category_banned_site_count},
+ {"Site_Unavailable", &collectd_statistics.flow_category_site_unavail_count},
+ {"Allowed_Site", &collectd_statistics.flow_category_allowed_site_count},
+ {"Antimalware", &collectd_statistics.flow_category_antimalware_count},
+ {"Crypto_Currency", &collectd_statistics.flow_category_crypto_currency_count},
{NULL, &collectd_statistics.flow_category_unknown_count}};
#ifdef ENABLE_MEMORY_PROFILING
@@ -431,7 +441,9 @@ static void print_collectd_exec_output(void)
COLLECTD_PUTVAL_N_FORMAT() COLLECTD_PUTVAL_N_FORMAT() COLLECTD_PUTVAL_N_FORMAT()
COLLECTD_PUTVAL_N_FORMAT() COLLECTD_PUTVAL_N_FORMAT() COLLECTD_PUTVAL_N_FORMAT()
COLLECTD_PUTVAL_N_FORMAT() COLLECTD_PUTVAL_N_FORMAT()
- COLLECTD_PUTVAL_N_FORMAT(),
+ COLLECTD_PUTVAL_N_FORMAT() COLLECTD_PUTVAL_N_FORMAT()
+ COLLECTD_PUTVAL_N_FORMAT() COLLECTD_PUTVAL_N_FORMAT()
+ COLLECTD_PUTVAL_N_FORMAT() COLLECTD_PUTVAL_N_FORMAT(),
COLLECTD_PUTVAL_N(flow_category_media_count),
COLLECTD_PUTVAL_N(flow_category_vpn_count),
@@ -460,6 +472,11 @@ static void print_collectd_exec_output(void)
COLLECTD_PUTVAL_N(flow_category_mining_count),
COLLECTD_PUTVAL_N(flow_category_malware_count),
COLLECTD_PUTVAL_N(flow_category_advertisment_count),
+ COLLECTD_PUTVAL_N(flow_category_banned_site_count),
+ COLLECTD_PUTVAL_N(flow_category_site_unavail_count),
+ COLLECTD_PUTVAL_N(flow_category_allowed_site_count),
+ COLLECTD_PUTVAL_N(flow_category_antimalware_count),
+ COLLECTD_PUTVAL_N(flow_category_crypto_currency_count),
COLLECTD_PUTVAL_N(flow_category_unknown_count));
printf(COLLECTD_PUTVAL_N_FORMAT() COLLECTD_PUTVAL_N_FORMAT() COLLECTD_PUTVAL_N_FORMAT() COLLECTD_PUTVAL_N_FORMAT()
diff --git a/examples/c-collectd/rrdgraph.sh b/examples/c-collectd/rrdgraph.sh
index 6b0a445b5..022ea5ebc 100755
--- a/examples/c-collectd/rrdgraph.sh
+++ b/examples/c-collectd/rrdgraph.sh
@@ -200,6 +200,11 @@ rrdtool_graph Flow-Categories 'Amount(SUM)' "${OUTDIR}/categories" \
DEF:cat_voip=${RRDDIR}/gauge-flow_category_voip_count.rrd:value:AVERAGE \
DEF:cat_vpn=${RRDDIR}/gauge-flow_category_vpn_count.rrd:value:AVERAGE \
DEF:cat_web=${RRDDIR}/gauge-flow_category_web_count.rrd:value:AVERAGE \
+ DEF:cat_banned=${RRDDIR}/gauge-flow_category_web_count.rrd:value:AVERAGE \
+ DEF:cat_unavail=${RRDDIR}/gauge-flow_category_web_count.rrd:value:AVERAGE \
+ DEF:cat_allowed=${RRDDIR}/gauge-flow_category_web_count.rrd:value:AVERAGE \
+ DEF:cat_antimal=${RRDDIR}/gauge-flow_category_web_count.rrd:value:AVERAGE \
+ DEF:cat_crypto=${RRDDIR}/gauge-flow_category_web_count.rrd:value:AVERAGE \
$(rrdtool_graph_colorize_missing_data cat_ads) \
AREA:cat_ads#f1c232:"Advertisment..........." \
$(rrdtool_graph_print_cur_min_max_avg cat_ads) \
@@ -256,7 +261,17 @@ rrdtool_graph Flow-Categories 'Amount(SUM)' "${OUTDIR}/categories" \
STACK:cat_vpn#378035:"Virtual-Private-Network" \
$(rrdtool_graph_print_cur_min_max_avg cat_vpn) \
STACK:cat_web#00fffb:"Web...................." \
- $(rrdtool_graph_print_cur_min_max_avg cat_web)
+ $(rrdtool_graph_print_cur_min_max_avg cat_web) \
+ STACK:cat_banned#ff1010:"Banned Sites..........." \
+ $(rrdtool_graph_print_cur_min_max_avg cat_banned) \
+ STACK:cat_unavail#ff1010:"Sites Unavailable......" \
+ $(rrdtool_graph_print_cur_min_max_avg cat_unavail) \
+ STACK:cat_allowed#ff1010:"Allowed Sites.........." \
+ $(rrdtool_graph_print_cur_min_max_avg cat_allowed) \
+ STACK:cat_antimal#ff1010:"Antimalware............" \
+ $(rrdtool_graph_print_cur_min_max_avg cat_antimal) \
+ STACK:cat_crypto#afaf00:"Crypto Currency........" \
+ $(rrdtool_graph_print_cur_min_max_avg cat_crypto)
rrdtool_graph JSON 'Lines' "${OUTDIR}/json_lines" \
DEF:json_lines=${RRDDIR}/gauge-json_lines.rrd:value:AVERAGE \
$(rrdtool_graph_colorize_missing_data json_lines) \
diff --git a/examples/py-machine-learning/sklearn-random-forest.py b/examples/py-machine-learning/sklearn-random-forest.py
index 275376ba2..9716f2b83 100755
--- a/examples/py-machine-learning/sklearn-random-forest.py
+++ b/examples/py-machine-learning/sklearn-random-forest.py
@@ -206,7 +206,7 @@ if __name__ == '__main__':
help='Number of sklearn processes during training.')
argparser.add_argument('--sklearn-estimators', action='store', type=int, default=1000,
help='Number of trees in the forest.')
- argparser.add_argument('--sklearn-min-samples-leaf', action='store', type=int, default=5,
+ argparser.add_argument('--sklearn-min-samples-leaf', action='store', type=int, default=0.0001,
help='The minimum number of samples required to be at a leaf node.')
argparser.add_argument('--sklearn-class-weight', default='balanced', const='balanced', nargs='?',
choices=['balanced', 'balanced_subsample'],