forked from librenms/librenms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Socket Statistic Application cleanup and application page graph fixes.
- Loading branch information
1 parent
4d31494
commit f846c91
Showing
19 changed files
with
146 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
require 'includes/ss-shared.inc.php'; | ||
|
||
$allowed_afs = $app->data['allowed_afs'] ?? []; | ||
$rrdArray = []; | ||
|
||
// This section draws the individual graphs in the device application page | ||
// displaying the SPECIFIED address-family's socket type's states. | ||
if (isset($vars['netid'])) { | ||
$netid = $vars['netid']; | ||
$af_netid = $addr_family . '_' . $netid; | ||
|
||
// Map the socket type to its available statuses. | ||
if (array_key_exists($netid, $ss_socket_states_mapper)) { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper[$netid]; | ||
} else { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper['default']; | ||
} | ||
|
||
// Create the rrdArray and map the address family's socket type | ||
// to its "clean" socket state name and description. | ||
foreach ($local_ss_socket_states_mapper as $socket_state => $socket_state_clean_name) { | ||
$rrdArray[$af_netid][$socket_state_clean_name] = [ | ||
'descr' => $socket_state_clean_name, | ||
]; | ||
} | ||
} | ||
|
||
// This section draws the graph for the application-specific pages | ||
// displaying ALL of the address-family's sockets types' states. | ||
if (! isset($vars['netid']) && in_array($addr_family, $allowed_afs)) { | ||
$allowed_sockets = $app->data['allowed_sockets'] ?? []; | ||
|
||
foreach ($ss_netid_mapper[$addr_family] as $netid) { | ||
// Don't display data for filtered sockets. | ||
if (! in_array($netid, $allowed_sockets)) { | ||
continue; | ||
} | ||
$af_netid = $addr_family . '_' . $netid; | ||
|
||
// Map the socket type to its available statuses. | ||
if (array_key_exists($netid, $ss_socket_states_mapper)) { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper[$netid]; | ||
} else { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper['default']; | ||
} | ||
|
||
// Create the rrdArray and map the address family's socket type | ||
// to its "clean" socket state name and description. | ||
foreach ($local_ss_socket_states_mapper as $socket_state => $socket_state_clean_name) { | ||
$rrdArray[$af_netid][$socket_state_clean_name] = [ | ||
'descr' => $af_netid . '_' . $socket_state_clean_name, | ||
]; | ||
} | ||
} | ||
} | ||
|
||
require 'ss-common.inc.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
require 'includes/ss-shared.inc.php'; | ||
|
||
$rrdArray = []; | ||
|
||
// Map the socket type to its available statuses. | ||
if (array_key_exists($netid, $ss_socket_states_mapper)) { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper[$netid]; | ||
} else { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper['default']; | ||
} | ||
|
||
// Create the rrdArray and map the address family's socket type | ||
// to its "clean" socket state name and description. | ||
foreach ($local_ss_socket_states_mapper as $socket_state => $socket_state_clean_name) { | ||
$rrdArray[$netid][$socket_state_clean_name] = ['descr' => $socket_state_clean_name]; | ||
} | ||
|
||
require 'ss-common.inc.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,5 @@ | ||
<?php | ||
|
||
require_once 'includes/ss-shared.inc.php'; | ||
$netid = 'dccp'; | ||
|
||
$socket_type = 'dccp'; | ||
$rrdArray = []; | ||
|
||
if (array_key_exists($socket_type, $ss_socket_states_mapper)) { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper[$socket_type]; | ||
} else { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper['default']; | ||
} | ||
|
||
foreach ($local_ss_socket_states_mapper as $socket_state => $socket_state_clean_name) { | ||
$rrdArray[$socket_type][$socket_state_clean_name] = ['descr' => $socket_state_clean_name]; | ||
} | ||
|
||
require 'ss-common.inc.php'; | ||
require 'ss-netid-common.inc.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,5 @@ | ||
<?php | ||
|
||
require_once 'includes/ss-shared.inc.php'; | ||
|
||
$addr_family = 'inet'; | ||
$rrdArray = []; | ||
|
||
$netid = $vars['netid']; | ||
|
||
$socket_type = $addr_family . '_' . $netid; | ||
|
||
if (array_key_exists($netid, $ss_socket_states_mapper)) { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper[$netid]; | ||
} else { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper['default']; | ||
} | ||
|
||
foreach ($local_ss_socket_states_mapper as $socket_state => $socket_state_clean_name) { | ||
$rrdArray[$socket_type][$socket_state_clean_name] = [ | ||
'descr' => $socket_state_clean_name, | ||
]; | ||
} | ||
|
||
require 'ss-common.inc.php'; | ||
require 'ss-af-common.inc.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,5 @@ | ||
<?php | ||
|
||
require_once 'includes/ss-shared.inc.php'; | ||
|
||
$addr_family = 'inet6'; | ||
$rrdArray = []; | ||
|
||
$netid = $vars['netid']; | ||
|
||
$socket_type = $addr_family . '_' . $netid; | ||
|
||
if (array_key_exists($netid, $ss_socket_states_mapper)) { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper[$netid]; | ||
} else { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper['default']; | ||
} | ||
|
||
foreach ($local_ss_socket_states_mapper as $socket_state => $socket_state_clean_name) { | ||
$rrdArray[$socket_type][$socket_state_clean_name] = [ | ||
'descr' => $socket_state_clean_name, | ||
]; | ||
} | ||
|
||
require 'ss-common.inc.php'; | ||
require 'ss-af-common.inc.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,5 @@ | ||
<?php | ||
|
||
require_once 'includes/ss-shared.inc.php'; | ||
|
||
$addr_family = 'link'; | ||
$rrdArray = []; | ||
|
||
$netid = $vars['netid']; | ||
|
||
$socket_type = $addr_family . '_' . $netid; | ||
|
||
if (array_key_exists($netid, $ss_socket_states_mapper)) { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper[$netid]; | ||
} else { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper['default']; | ||
} | ||
|
||
foreach ($local_ss_socket_states_mapper as $socket_state => $socket_state_clean_name) { | ||
$rrdArray[$socket_type][$socket_state_clean_name] = [ | ||
'descr' => $socket_state_clean_name, | ||
]; | ||
} | ||
|
||
require 'ss-common.inc.php'; | ||
require 'ss-af-common.inc.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,5 @@ | ||
<?php | ||
|
||
require_once 'includes/ss-shared.inc.php'; | ||
$netid = 'mptcp'; | ||
|
||
$socket_type = 'mptcp'; | ||
$rrdArray = []; | ||
|
||
if (array_key_exists($socket_type, $ss_socket_states_mapper)) { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper[$socket_type]; | ||
} else { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper['default']; | ||
} | ||
|
||
foreach ($local_ss_socket_states_mapper as $socket_state => $socket_state_clean_name) { | ||
$rrdArray[$socket_type][$socket_state_clean_name] = ['descr' => $socket_state_clean_name]; | ||
} | ||
|
||
require 'ss-common.inc.php'; | ||
require 'ss-netid-common.inc.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,5 @@ | ||
<?php | ||
|
||
require_once 'includes/ss-shared.inc.php'; | ||
$netid = 'netlink'; | ||
|
||
$addr_family = 'netlink'; | ||
$rrdArray = []; | ||
|
||
if (array_key_exists($addr_family, $ss_socket_states_mapper)) { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper[$addr_family]; | ||
} else { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper['default']; | ||
} | ||
|
||
foreach ($local_ss_socket_states_mapper as $socket_state => $socket_state_clean_name) { | ||
$rrdArray[$addr_family][$socket_state_clean_name] = ['descr' => $socket_state_clean_name]; | ||
} | ||
|
||
require 'ss-common.inc.php'; | ||
require 'ss-netid-common.inc.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,5 @@ | ||
<?php | ||
|
||
require_once 'includes/ss-shared.inc.php'; | ||
$netid = 'raw'; | ||
|
||
$socket_type = 'raw'; | ||
$rrdArray = []; | ||
|
||
if (array_key_exists($socket_type, $ss_socket_states_mapper)) { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper[$socket_type]; | ||
} else { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper['default']; | ||
} | ||
|
||
foreach ($local_ss_socket_states_mapper as $socket_state => $socket_state_clean_name) { | ||
$rrdArray[$socket_type][$socket_state_clean_name] = ['descr' => $socket_state_clean_name]; | ||
} | ||
|
||
require 'ss-common.inc.php'; | ||
require 'ss-netid-common.inc.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,5 @@ | ||
<?php | ||
|
||
require_once 'includes/ss-shared.inc.php'; | ||
$netid = 'sctp'; | ||
|
||
$socket_type = 'sctp'; | ||
$rrdArray = []; | ||
|
||
if (array_key_exists($socket_type, $ss_socket_states_mapper)) { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper[$socket_type]; | ||
} else { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper['default']; | ||
} | ||
|
||
foreach ($local_ss_socket_states_mapper as $socket_state => $socket_state_clean_name) { | ||
$rrdArray[$socket_type][$socket_state_clean_name] = ['descr' => $socket_state_clean_name]; | ||
} | ||
|
||
require 'ss-common.inc.php'; | ||
require 'ss-netid-common.inc.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,5 @@ | ||
<?php | ||
|
||
require_once 'includes/ss-shared.inc.php'; | ||
$netid = 'tcp'; | ||
|
||
$socket_type = 'tcp'; | ||
$rrdArray = []; | ||
|
||
if (array_key_exists($socket_type, $ss_socket_states_mapper)) { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper[$socket_type]; | ||
} else { | ||
$local_ss_socket_states_mapper = $ss_socket_states_mapper['default']; | ||
} | ||
|
||
foreach ($local_ss_socket_states_mapper as $socket_state => $socket_state_clean_name) { | ||
$rrdArray[$socket_type][$socket_state_clean_name] = ['descr' => $socket_state_clean_name]; | ||
} | ||
|
||
require 'ss-common.inc.php'; | ||
require 'ss-netid-common.inc.php'; |
Oops, something went wrong.