Skip to content

Commit

Permalink
Added exporters interfaces page (#8663)
Browse files Browse the repository at this point in the history
* Fixed telemetry response format, no impact on base ntopng, different endpoint

* Fixed error

* Added toboolean instead of string compare

* Added ASN name in ASN timeseries page

* Added exportes interfaces page
  • Loading branch information
DGabri authored Aug 26, 2024
1 parent a9450e2 commit 57ecae1
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 0 deletions.
2 changes: 2 additions & 0 deletions http_src/vue/ntop_vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import { default as PageAsStats } from "./page-as-stats.vue"
import { default as PageProbes } from "./page-probes.vue"
import { default as PageExporters } from "./page-exporters.vue"
import { default as PageExportersDetails } from "./page-exporters-details.vue"
import { default as PageExportersInterfaces } from "./page-exporters-interfaces.vue"

/* Config pages */
import { default as PageSNMPConfig } from "./page-snmp-config.vue"
Expand Down Expand Up @@ -188,6 +189,7 @@ let ntopVue = {
PageExportersConfig: PageExportersConfig,
PageFlowDeviceInterfaceDetails: PageFlowDeviceInterfaceDetails,
PageHistoricalFlow: PageHistoricalFlow,
PageExportersInterfaces: PageExportersInterfaces,
//PageSankeyTest: PageSankeyTest,

// components
Expand Down
88 changes: 88 additions & 0 deletions http_src/vue/page-exporters-interfaces.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<template>

<div class="m-2 mb-3">
<TableWithConfig ref="table_exporters_details" :table_id="table_id" :csrf="csrf" :f_map_columns="map_table_def_columns"
:f_sort_rows="columns_sorting" :get_extra_params_obj="get_extra_params_obj">
</TableWithConfig>

</div>
</template>


<script setup>
import { ref } from "vue";
import { default as sortingFunctions } from "../utilities/sorting-utils.js";
import { default as TableWithConfig } from "./table-with-config.vue";
import formatterUtils from "../utilities/formatter-utils";
import { ntopng_url_manager } from "../services/context/ntopng_globals_services.js";
const props = defineProps({
context: Object
});
const table_id = ref('exporters_interfaces');
const table_exporters_details = ref(null);
const csrf = props.context.csrf;
const exporter_notes_url = `${http_prefix}/lua/pro/rest/v2/get/exporters/exporter_notes.lua?`
const flowdevice_interface_url = `${http_prefix}/lua/pro/enterprise/flowdevice_interface_details.lua?`
const exporter_ip_url = `${http_prefix}/lua/pro/enterprise/exporter_details.lua?` // ip=192.168.2.73&exporter_uuid=&probe_uuid=
const nprobe_ip_url = `${http_prefix}/lua/pro/enterprise/exporters.lua?probe_uuid=`
const get_extra_params_obj = () => {
let extra_params = ntopng_url_manager.get_url_object();
return extra_params;
};
const map_table_def_columns = (columns) => {
let map_columns = {
"nprobe_ip": (value, row) => {
return value
},
"exporter_ip": (value, row) => {
return value
},
"in_bytes": (value, row) => {
if (!value)
return '';
return formatterUtils.getFormatter("bytes")(value);
},
"out_bytes": (value, row) => {
if (!value)
return '';
return formatterUtils.getFormatter("bytes")(value);
},
"interface_id": (value, row) => {
return value
}
};
columns.forEach((c) => {
c.render_func = map_columns[c.data_field];
});
return columns;
};
function columns_sorting(col, r0, r1) {
if (col != null) {
if (col.id == "nprobe_ip") {
return sortingFunctions.sortByIP(r0.nprobe_ip, r1.nprobe_ip, col.sort);
} else if (col.id == "exporter_ip") {
return sortingFunctions.sortByName(r0.exporter_ip, r1.exporter_ip, col.sort);
} else if (col.id == "interface_id") {
return sortingFunctions.sortByNumber(r0.interface_id, r1.interface_id, col.sort);
} else if (col.id == "in_bytes") {
return sortingFunctions.sortByNumber(r0.in_bytes, r1.in_bytes, col.sort);
} else if (col.id == "out_bytes") {
return sortingFunctions.sortByNumber(r0.out_bytes, r1.out_bytes, col.sort);
}
}
}
</script>
2 changes: 2 additions & 0 deletions scripts/locales/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3243,6 +3243,7 @@ local lang = {
["web_mining_detected"] = "The website is known for mining cryptocurrencies on client devices",
},
["flow_devices"] = {
["exporters_interfaces"] = "Exporters Interfaces",
["active_sflow"] = "Active sFlow Exporters",
["all_device_ports"] = "All %{device} Ports",
["all_exporters"] = "All NetFlow/IPFIX Exporter Devices",
Expand Down Expand Up @@ -3281,6 +3282,7 @@ local lang = {
["note_zmq_fields3"] = "sFlow probes are determined using sFlow field deviceIP received via ZMQ (topic 'counter')",
["note_zmq_fields4"] = "sFlow probes interfaces are determined using field ifIndex received via ZMQ (topic 'counter')",
["nprobe_instances"] = "nProbe Instances",
["nprobe_ip"] = "nProbe IP",
["nprobe_interface"] = "IfName (nProbe)",
["nprobe_version"] = "Version (nProbe)",
["ntopng_interface"] = "IfName (ntopng)",
Expand Down

0 comments on commit 57ecae1

Please sign in to comment.