Moving old files
This commit is contained in:
parent
de44cc180a
commit
3b84373fe9
60
plugins/Old/telegraf_gateways.php
Executable file
60
plugins/Old/telegraf_gateways.php
Executable file
@ -0,0 +1,60 @@
|
|||||||
|
#!/usr/local/bin/php-cgi -f
|
||||||
|
<?php
|
||||||
|
require_once("config.inc");
|
||||||
|
require_once("gwlb.inc");
|
||||||
|
|
||||||
|
$host = gethostname();
|
||||||
|
$source = "pfconfig";
|
||||||
|
|
||||||
|
$a_gateways = return_gateways_array();
|
||||||
|
$gateways_status = return_gateways_status(true);
|
||||||
|
|
||||||
|
foreach ($a_gateways as $i => $gateway) {
|
||||||
|
|
||||||
|
$name = $gateways_status[$i]["name"];
|
||||||
|
$monitor = $gateways_status[$i]["monitorip"];
|
||||||
|
$source = $gateways_status[$i]["srcip"];
|
||||||
|
$delay = $gateways_status[$i]["delay"];
|
||||||
|
$stddev = $gateways_status[$i]["stddev"];
|
||||||
|
$loss = $gateways_status[$i]["loss"];
|
||||||
|
$status = $gateways_status[$i]["status"];
|
||||||
|
$substatus = $gateways_status[$i]["substatus"];
|
||||||
|
|
||||||
|
$interface = $gateway["interface"];
|
||||||
|
$friendlyname = $gateway["friendlyiface"]; # This is not the friendly interface name so I'm not using it
|
||||||
|
$friendlyifdescr = $gateway["friendlyifdescr"];
|
||||||
|
$gwdescr = $gateway["descr"];
|
||||||
|
$defaultgw = $gateway['isdefaultgw'];
|
||||||
|
|
||||||
|
if (isset($gateway['isdefaultgw'])) {
|
||||||
|
$defaultgw = "1";
|
||||||
|
} else {
|
||||||
|
$defaultgw = "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($gateways_status[$i]) {
|
||||||
|
if (isset($gateway['monitor_disable'])) {
|
||||||
|
$monitor = "Unmonitored";
|
||||||
|
$delay = "Pending";
|
||||||
|
$stdev = "Pending";
|
||||||
|
$loss = "Pending";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("gateways,host=%s,interface=%s monitor=\"%s\",source=\"%s\",defaultgw=%s,gwdescr=\"%s\",delay=%s,stddev=%s,loss=%s,status=\"%s\",substatus=\"%s\"\n",
|
||||||
|
$host,
|
||||||
|
$interface,
|
||||||
|
# $friendlyifdescr,
|
||||||
|
#$name,
|
||||||
|
$monitor,
|
||||||
|
$source,
|
||||||
|
$defaultgw,
|
||||||
|
$gwdescr,
|
||||||
|
floatval($delay),
|
||||||
|
floatval($stddev),
|
||||||
|
floatval($loss),
|
||||||
|
$status,
|
||||||
|
$substatus
|
||||||
|
);
|
||||||
|
};
|
||||||
|
?>
|
66
plugins/Old/telegraf_pfinterface.php
Executable file
66
plugins/Old/telegraf_pfinterface.php
Executable file
@ -0,0 +1,66 @@
|
|||||||
|
#!/usr/local/bin/php-cgi -f
|
||||||
|
<?php
|
||||||
|
require_once("config.inc");
|
||||||
|
require_once("gwlb.inc");
|
||||||
|
require_once("interfaces.inc");
|
||||||
|
|
||||||
|
$host = gethostname();
|
||||||
|
$source = "pfconfig";
|
||||||
|
|
||||||
|
$iflist = get_configured_interface_with_descr(true);
|
||||||
|
foreach ($iflist as $ifname => $friendly) {
|
||||||
|
$ifinfo = get_interface_info($ifname);
|
||||||
|
$ifstatus = $ifinfo['status'];
|
||||||
|
$ifconf = $config['interfaces'][$ifname];
|
||||||
|
$ip4addr = get_interface_ip($ifname);
|
||||||
|
$ip4subnet = get_interface_subnet($ifname);
|
||||||
|
$ip6addr = get_interface_ipv6($ifname);
|
||||||
|
$ip6subnet = get_interface_subnetv6($ifname);
|
||||||
|
$realif = get_real_interface($ifname);
|
||||||
|
$mac = get_interface_mac($realif);
|
||||||
|
|
||||||
|
if (!isset($ip4addr)){
|
||||||
|
$ip4addr = "Unassigned";
|
||||||
|
}
|
||||||
|
if (!isset($ip4subnet)){
|
||||||
|
$ip4subnet = "Unassigned";
|
||||||
|
}
|
||||||
|
if (!isset($ip6addr)){
|
||||||
|
$ip6addr = "Unassigned";
|
||||||
|
}
|
||||||
|
if (!isset($ip6subnet)){
|
||||||
|
$ip6subnet = "Unassigned";
|
||||||
|
}
|
||||||
|
if (!isset($mac)){
|
||||||
|
$mac = "Unavailable";
|
||||||
|
}
|
||||||
|
if (strtolower($ifstatus) == "up"){
|
||||||
|
$ifstatus = 1;
|
||||||
|
}
|
||||||
|
if (strtolower($ifstatus) == "active"){
|
||||||
|
$ifstatus = 1;
|
||||||
|
}
|
||||||
|
if (strtolower($ifstatus) == "no carrier"){
|
||||||
|
$ifstatus = 0;
|
||||||
|
}
|
||||||
|
if (strtolower($ifstatus) == "down"){
|
||||||
|
$ifstatus = 0;
|
||||||
|
}
|
||||||
|
if (!isset($ifstatus)){
|
||||||
|
$ifstatus = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("interface,host=%s,name=%s,ip4_address=%s,ip4_subnet=%s,ip6_address=%s,ip6_subnet=%s,mac_address=%s,friendlyname=%s,source=%s status=%s\n",
|
||||||
|
$host,
|
||||||
|
$realif,
|
||||||
|
$ip4addr,
|
||||||
|
$ip4subnet,
|
||||||
|
$ip6addr,
|
||||||
|
$ip6subnet,
|
||||||
|
$mac,
|
||||||
|
$friendly,
|
||||||
|
$source,
|
||||||
|
$ifstatus
|
||||||
|
);
|
||||||
|
}
|
||||||
|
?>
|
Loading…
x
Reference in New Issue
Block a user