feature: Added wireless sensors to about and stats.librenms.org (#8676)

This commit is contained in:
Tony Murray 2018-05-08 15:42:52 -05:00 committed by Neil Lathwood
parent 350b3a1ef8
commit 9279c845f6
2 changed files with 66 additions and 60 deletions

View File

@ -47,29 +47,30 @@ along with this program. If not, see <a href="http://www.gnu.org/licenses/">htt
<h3>Statistics</h3>
<?php
$stat_devices = dbFetchCell('SELECT COUNT(device_id) FROM `devices`');
$stat_ports = dbFetchCell('SELECT COUNT(port_id) FROM `ports`');
$stat_syslog = dbFetchCell('SELECT COUNT(seq) FROM `syslog`');
$stat_events = dbFetchCell('SELECT COUNT(event_id) FROM `eventlog`');
$stat_apps = dbFetchCell('SELECT COUNT(app_id) FROM `applications`');
$stat_services = dbFetchCell('SELECT COUNT(service_id) FROM `services`');
$stat_storage = dbFetchCell('SELECT COUNT(storage_id) FROM `storage`');
$stat_diskio = dbFetchCell('SELECT COUNT(diskio_id) FROM `ucd_diskio`');
$stat_processors = dbFetchCell('SELECT COUNT(processor_id) FROM `processors`');
$stat_memory = dbFetchCell('SELECT COUNT(mempool_id) FROM `mempools`');
$stat_sensors = dbFetchCell('SELECT COUNT(sensor_id) FROM `sensors`');
$stat_toner = dbFetchCell('SELECT COUNT(toner_id) FROM `toner`');
$stat_hrdev = dbFetchCell('SELECT COUNT(hrDevice_id) FROM `hrDevice`');
$stat_entphys = dbFetchCell('SELECT COUNT(entPhysical_id) FROM `entPhysical`');
$stat_devices = dbFetchCell('SELECT COUNT(*) FROM `devices`');
$stat_ports = dbFetchCell('SELECT COUNT(*) FROM `ports`');
$stat_syslog = dbFetchCell('SELECT COUNT(*) FROM `syslog`');
$stat_events = dbFetchCell('SELECT COUNT(*) FROM `eventlog`');
$stat_apps = dbFetchCell('SELECT COUNT(*) FROM `applications`');
$stat_services = dbFetchCell('SELECT COUNT(*) FROM `services`');
$stat_storage = dbFetchCell('SELECT COUNT(*) FROM `storage`');
$stat_diskio = dbFetchCell('SELECT COUNT(*) FROM `ucd_diskio`');
$stat_processors = dbFetchCell('SELECT COUNT(*) FROM `processors`');
$stat_memory = dbFetchCell('SELECT COUNT(*) FROM `mempools`');
$stat_sensors = dbFetchCell('SELECT COUNT(*) FROM `sensors`');
$stat_wireless = dbFetchCell('SELECT COUNT(*) FROM `wireless_sensors`');
$stat_toner = dbFetchCell('SELECT COUNT(*) FROM `toner`');
$stat_hrdev = dbFetchCell('SELECT COUNT(*) FROM `hrDevice`');
$stat_entphys = dbFetchCell('SELECT COUNT(*) FROM `entPhysical`');
$stat_ipv4_addy = dbFetchCell('SELECT COUNT(ipv4_address_id) FROM `ipv4_addresses`');
$stat_ipv4_nets = dbFetchCell('SELECT COUNT(ipv4_network_id) FROM `ipv4_networks`');
$stat_ipv6_addy = dbFetchCell('SELECT COUNT(ipv6_address_id) FROM `ipv6_addresses`');
$stat_ipv6_nets = dbFetchCell('SELECT COUNT(ipv6_network_id) FROM `ipv6_networks`');
$stat_ipv4_addy = dbFetchCell('SELECT COUNT(*) FROM `ipv4_addresses`');
$stat_ipv4_nets = dbFetchCell('SELECT COUNT(*) FROM `ipv4_networks`');
$stat_ipv6_addy = dbFetchCell('SELECT COUNT(*) FROM `ipv6_addresses`');
$stat_ipv6_nets = dbFetchCell('SELECT COUNT(*) FROM `ipv6_networks`');
$stat_pw = dbFetchCell('SELECT COUNT(pseudowire_id) FROM `pseudowires`');
$stat_vrf = dbFetchCell('SELECT COUNT(vrf_id) FROM `vrfs`');
$stat_vlans = dbFetchCell('SELECT COUNT(vlan_id) FROM `vlans`');
$stat_pw = dbFetchCell('SELECT COUNT(*) FROM `pseudowires`');
$stat_vrf = dbFetchCell('SELECT COUNT(*) FROM `vrfs`');
$stat_vlans = dbFetchCell('SELECT COUNT(*) FROM `vlans`');
$callback_status = dbFetchCell("SELECT `value` FROM `callback` WHERE `name` = 'enabled'");
if ($callback_status == 1) {
@ -138,7 +139,11 @@ echo "
</tr>
<tr>
<td><i class='fa fa-fw fa-dashboard fa-lg icon-theme' aria-hidden='true'></i> <b>Sensors</b></td><td class='text-right'>$stat_sensors</td>
<td><i class='fa fa-fw fa-wifi fa-lg icon-theme' aria-hidden='true'></i> <b>Wireless Sensors</b></td><td class='text-right'>$stat_wireless</td>
</tr>
<tr>
<td><i class='fa fa-fw fa-print fa-lg icon-theme' aria-hidden='true'></i> <b>Toner</b></td><td class='text-right'>$stat_toner</td>
<td></td>
</tr>
</table>
</div>

View File

@ -22,45 +22,46 @@ if ($enabled == 1) {
$version = version_info();
$queries = array(
'alert_rules' => 'SELECT COUNT(`severity`) AS `total`,`severity` FROM `alert_rules` WHERE `disabled`=0 GROUP BY `severity`',
'alert_templates' => 'SELECT COUNT(`id`) AS `total` FROM `alert_templates`',
'api_tokens' => 'SELECT COUNT(`id`) AS `total` FROM `api_tokens` WHERE `disabled`=0',
'applications' => 'SELECT COUNT(`app_type`) AS `total`,`app_type` FROM `applications` GROUP BY `app_type`',
'bgppeer_state' => 'SELECT COUNT(`bgpPeerState`) AS `total`,`bgpPeerState` FROM `bgpPeers` GROUP BY `bgpPeerState`',
'bgppeer_status' => 'SELECT COUNT(`bgpPeerAdminStatus`) AS `total`,`bgpPeerAdminStatus` FROM `bgpPeers` GROUP BY `bgpPeerAdminStatus`',
'bills' => 'SELECT COUNT(`bill_type`) AS `total`,`bill_type` FROM `bills` GROUP BY `bill_type`',
'cef' => 'SELECT COUNT(`device_id`) AS `total` FROM `cef_switching`',
'cisco_asa' => 'SELECT COUNT(`oid`) AS `total`,`oid` FROM `ciscoASA` WHERE `disabled` = 0 GROUP BY `oid`',
'mempool' => 'SELECT COUNT(`mempool_descr`) AS `total`,`mempool_descr` FROM `mempools` GROUP BY `mempool_descr`',
'dbschema' => 'SELECT COUNT(`version`) AS `total`, `version` FROM `dbSchema`',
'snmp_version' => 'SELECT COUNT(`snmpver`) AS `total`,`snmpver` FROM `devices` GROUP BY `snmpver`',
'os' => 'SELECT COUNT(`os`) AS `total`,`os` FROM `devices` GROUP BY `os`',
'type' => 'SELECT COUNT(`type`) AS `total`,`type` FROM `devices` GROUP BY `type`',
'hardware' => 'SELECT COUNT(`device_id`) AS `total`, `hardware` FROM `devices` GROUP BY `hardware`',
'ipsec' => 'SELECT COUNT(`device_id`) AS `total` FROM `ipsec_tunnels`',
'ipv4_addresses' => 'SELECT COUNT(`ipv4_address_id`) AS `total` FROM `ipv4_addresses`',
'ipv4_macaddress' => 'SELECT COUNT(`port_id`) AS `total` FROM ipv4_mac',
'ipv4_networks' => 'SELECT COUNT(`ipv4_network_id`) AS `total` FROM ipv4_networks',
'ipv6_addresses' => 'SELECT COUNT(`ipv6_address_id`) AS `total` FROM `ipv6_addresses`',
'ipv6_networks' => 'SELECT COUNT(`ipv6_network_id`) AS `total` FROM `ipv6_networks`',
'xdp' => 'SELECT COUNT(`id`) AS `total`,`protocol` FROM `links` GROUP BY `protocol`',
'ospf' => 'SELECT COUNT(`device_id`) AS `total`,`ospfVersionNumber` FROM `ospf_instances` GROUP BY `ospfVersionNumber`',
'ospf_links' => 'SELECT COUNT(`device_id`) AS `total`,`ospfIfType` FROM `ospf_ports` GROUP BY `ospfIfType`',
'arch' => 'SELECT COUNT(`pkg_id`) AS `total`,`arch` FROM `packages` GROUP BY `arch`',
'pollers' => 'SELECT COUNT(`id`) AS `total` FROM `pollers`',
'port_type' => 'SELECT COUNT(`port_id`) AS `total`,`ifType` FROM `ports` GROUP BY `ifType`',
'port_ifspeed' => 'SELECT COUNT(`ifSpeed`) AS `total`,ROUND(`ifSpeed`/1000/1000) FROM `ports` GROUP BY `ifSpeed`',
'port_vlans' => 'SELECT COUNT(`device_id`) AS `total`,`state` FROM `ports_vlans` GROUP BY `state`',
'processes' => 'SELECT COUNT(`device_id`) AS `total` FROM `processes`',
'processors' => 'SELECT COUNT(`processor_id`) AS `total`,`processor_type` FROM `processors` GROUP BY `processor_type`',
'pseudowires' => 'SELECT COUNT(`pseudowire_id`) AS `total` FROM `pseudowires`',
'sensors' => 'SELECT COUNT(`sensor_id`) AS `total`,`sensor_class` FROM `sensors` GROUP BY `sensor_class`',
'storage' => 'SELECT COUNT(`storage_id`) AS `total`,`storage_type` FROM `storage` GROUP BY `storage_type`',
'toner' => 'SELECT COUNT(`toner_id`) AS `total`,`toner_type` FROM `toner` GROUP BY `toner_type`',
'vlans' => 'SELECT COUNT(`vlan_id`) AS `total`,`vlan_type` FROM `vlans` GROUP BY `vlan_type`',
'vminfo' => 'SELECT COUNT(`id`) AS `total`,`vm_type` FROM `vminfo` GROUP BY `vm_type`',
'vmware' => 'SELECT COUNT(`id`) AS `total` FROM `vminfo`',
'vrfs' => 'SELECT COUNT(`vrf_id`) AS `total` FROM `vrfs`',
'alert_rules' => 'SELECT COUNT(*) AS `total`,`severity` FROM `alert_rules` WHERE `disabled`=0 GROUP BY `severity`',
'alert_templates' => 'SELECT COUNT(*) AS `total` FROM `alert_templates`',
'api_tokens' => 'SELECT COUNT(*) AS `total` FROM `api_tokens` WHERE `disabled`=0',
'applications' => 'SELECT COUNT(*) AS `total`,`app_type` FROM `applications` GROUP BY `app_type`',
'bgppeer_state' => 'SELECT COUNT(*) AS `total`,`bgpPeerState` FROM `bgpPeers` GROUP BY `bgpPeerState`',
'bgppeer_status' => 'SELECT COUNT(*) AS `total`,`bgpPeerAdminStatus` FROM `bgpPeers` GROUP BY `bgpPeerAdminStatus`',
'bills' => 'SELECT COUNT(*) AS `total`,`bill_type` FROM `bills` GROUP BY `bill_type`',
'cef' => 'SELECT COUNT(*) AS `total` FROM `cef_switching`',
'cisco_asa' => 'SELECT COUNT(*) AS `total`,`oid` FROM `ciscoASA` WHERE `disabled` = 0 GROUP BY `oid`',
'mempool' => 'SELECT COUNT(*) AS `total`,`mempool_descr` FROM `mempools` GROUP BY `mempool_descr`',
'dbschema' => 'SELECT COUNT(*) AS `total`, `version` FROM `dbSchema`',
'snmp_version' => 'SELECT COUNT(*) AS `total`,`snmpver` FROM `devices` GROUP BY `snmpver`',
'os' => 'SELECT COUNT(*) AS `total`,`os` FROM `devices` GROUP BY `os`',
'type' => 'SELECT COUNT(*) AS `total`,`type` FROM `devices` GROUP BY `type`',
'hardware' => 'SELECT COUNT(*) AS `total`, `hardware` FROM `devices` GROUP BY `hardware`',
'ipsec' => 'SELECT COUNT(*) AS `total` FROM `ipsec_tunnels`',
'ipv4_addresses' => 'SELECT COUNT(*) AS `total` FROM `ipv4_addresses`',
'ipv4_macaddress' => 'SELECT COUNT(*) AS `total` FROM ipv4_mac',
'ipv4_networks' => 'SELECT COUNT(*) AS `total` FROM ipv4_networks',
'ipv6_addresses' => 'SELECT COUNT(*) AS `total` FROM `ipv6_addresses`',
'ipv6_networks' => 'SELECT COUNT(*) AS `total` FROM `ipv6_networks`',
'xdp' => 'SELECT COUNT(*) AS `total`,`protocol` FROM `links` GROUP BY `protocol`',
'ospf' => 'SELECT COUNT(*) AS `total`,`ospfVersionNumber` FROM `ospf_instances` GROUP BY `ospfVersionNumber`',
'ospf_links' => 'SELECT COUNT(*) AS `total`,`ospfIfType` FROM `ospf_ports` GROUP BY `ospfIfType`',
'arch' => 'SELECT COUNT(*) AS `total`,`arch` FROM `packages` GROUP BY `arch`',
'pollers' => 'SELECT COUNT(*) AS `total` FROM `pollers`',
'port_type' => 'SELECT COUNT(*) AS `total`,`ifType` FROM `ports` GROUP BY `ifType`',
'port_ifspeed' => 'SELECT COUNT(*) AS `total`,ROUND(`ifSpeed`/1000/1000) FROM `ports` GROUP BY `ifSpeed`',
'port_vlans' => 'SELECT COUNT(*) AS `total`,`state` FROM `ports_vlans` GROUP BY `state`',
'processes' => 'SELECT COUNT(*) AS `total` FROM `processes`',
'processors' => 'SELECT COUNT(*) AS `total`,`processor_type` FROM `processors` GROUP BY `processor_type`',
'pseudowires' => 'SELECT COUNT(*) AS `total` FROM `pseudowires`',
'sensors' => 'SELECT COUNT(*) AS `total`,`sensor_class` FROM `sensors` GROUP BY `sensor_class`',
'wireless' => 'SELECT COUNT(*) AS `total`,`sensor_class` FROM `wireless_sensors` GROUP BY `sensor_class`',
'storage' => 'SELECT COUNT(*) AS `total`,`storage_type` FROM `storage` GROUP BY `storage_type`',
'toner' => 'SELECT COUNT(*) AS `total`,`toner_type` FROM `toner` GROUP BY `toner_type`',
'vlans' => 'SELECT COUNT(*) AS `total`,`vlan_type` FROM `vlans` GROUP BY `vlan_type`',
'vminfo' => 'SELECT COUNT(*) AS `total`,`vm_type` FROM `vminfo` GROUP BY `vm_type`',
'vmware' => 'SELECT COUNT(*) AS `total` FROM `vminfo`',
'vrfs' => 'SELECT COUNT(*) AS `total` FROM `vrfs`',
'mysql_version' => 'SELECT 1 AS `total`, @@version AS `version`',
);