mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md.
This commit is contained in:
		@@ -1451,6 +1451,13 @@ $config['os'][$os]['icon']             = 'mge';
 | 
			
		||||
$config['os'][$os]['over'][0]['graph'] = 'device_current';
 | 
			
		||||
$config['os'][$os]['over'][0]['text']  = 'Current';
 | 
			
		||||
 | 
			
		||||
$os = 'sinetica';
 | 
			
		||||
$config['os'][$os]['text']             = 'Sinetica UPS';
 | 
			
		||||
$config['os'][$os]['group']            = 'ups';
 | 
			
		||||
$config['os'][$os]['type']             = 'power';
 | 
			
		||||
$config['os'][$os]['over'][0]['graph'] = 'device_current';
 | 
			
		||||
$config['os'][$os]['over'][0]['text']  = 'Current';
 | 
			
		||||
 | 
			
		||||
$os = 'mgepdu';
 | 
			
		||||
$config['os'][$os]['text'] = 'MGE PDU';
 | 
			
		||||
$config['os'][$os]['type'] = 'power';
 | 
			
		||||
@@ -2288,6 +2295,15 @@ $config['graph_types']['device']['ubnt_airfiber_RFTotPktsRx']['section'] = 'wire
 | 
			
		||||
$config['graph_types']['device']['ubnt_airfiber_RFTotPktsRx']['order'] = '7';
 | 
			
		||||
$config['graph_types']['device']['ubnt_airfiber_RFTotPktsRx']['descr'] = 'RF Total Packets Rx';
 | 
			
		||||
 | 
			
		||||
// Unifi Support
 | 
			
		||||
$config['graph_types']['device']['ubnt_unifi_RadioCu_0']['section'] = 'wireless';
 | 
			
		||||
$config['graph_types']['device']['ubnt_unifi_RadioCu_0']['order'] = '0';
 | 
			
		||||
$config['graph_types']['device']['ubnt_unifi_RadioCu_0']['descr'] = 'Radio0 Capacity Used';
 | 
			
		||||
 | 
			
		||||
$config['graph_types']['device']['ubnt_unifi_RadioCu_1']['section'] = 'wireless';
 | 
			
		||||
$config['graph_types']['device']['ubnt_unifi_RadioCu_1']['order'] = '1';
 | 
			
		||||
$config['graph_types']['device']['ubnt_unifi_RadioCu_1']['descr'] = 'Radio1 Capacity Used';
 | 
			
		||||
 | 
			
		||||
// Siklu support
 | 
			
		||||
$config['graph_types']['device']['siklu_rfAverageRssi']['section'] = 'wireless';
 | 
			
		||||
$config['graph_types']['device']['siklu_rfAverageRssi']['order'] = '0';
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,7 @@ if ($config['enable_libvirt'] == '1' && $device['os'] == 'linux') {
 | 
			
		||||
        if ($ssh_ok || !strstr($method, 'ssh')) {
 | 
			
		||||
            // Fetch virtual machine list
 | 
			
		||||
            unset($domlist);
 | 
			
		||||
            exec($config['virsh'].' -c '.$uri.' list', $domlist);
 | 
			
		||||
            exec($config['virsh'].' -rc '.$uri.' list', $domlist);
 | 
			
		||||
 | 
			
		||||
            foreach ($domlist as $dom) {
 | 
			
		||||
                list($dom_id,) = explode(' ', trim($dom), 2);
 | 
			
		||||
@@ -39,8 +39,9 @@ if ($config['enable_libvirt'] == '1' && $device['os'] == 'linux') {
 | 
			
		||||
                if (is_numeric($dom_id)) {
 | 
			
		||||
                    // Fetch the Virtual Machine information.
 | 
			
		||||
                    unset($vm_info_array);
 | 
			
		||||
                    exec($config['virsh'].' -c '.$uri.' dumpxml '.$dom_id, $vm_info_array);
 | 
			
		||||
                    exec($config['virsh'].' -rc '.$uri.' dumpxml '.$dom_id, $vm_info_array);
 | 
			
		||||
 | 
			
		||||
                    // Example xml:
 | 
			
		||||
                    // <domain type='kvm' id='3'>
 | 
			
		||||
                    // <name>moo.example.com</name>
 | 
			
		||||
                    // <uuid>48cf6378-6fd5-4610-0611-63dd4b31cfd6</uuid>
 | 
			
		||||
@@ -54,6 +55,8 @@ if ($config['enable_libvirt'] == '1' && $device['os'] == 'linux') {
 | 
			
		||||
                    // <features>
 | 
			
		||||
                    // <acpi/>
 | 
			
		||||
                    // (...)
 | 
			
		||||
                    // See spec at https://libvirt.org/formatdomain.html
 | 
			
		||||
 | 
			
		||||
                    // Convert array to string
 | 
			
		||||
                    unset($vm_info_xml);
 | 
			
		||||
                    foreach ($vm_info_array as $line) {
 | 
			
		||||
@@ -66,10 +69,49 @@ if ($config['enable_libvirt'] == '1' && $device['os'] == 'linux') {
 | 
			
		||||
                    $vmwVmDisplayName = $xml->name;
 | 
			
		||||
                    $vmwVmGuestOS     = '';
 | 
			
		||||
                    // libvirt does not supply this
 | 
			
		||||
                    $vmwVmMemSize = ($xml->currentMemory / 1024);
 | 
			
		||||
                    exec($config['virsh'].' -c '.$uri.' domstate '.$dom_id, $vm_state);
 | 
			
		||||
                    exec($config['virsh'].' -rc '.$uri.' domstate '.$dom_id, $vm_state);
 | 
			
		||||
                    $vmwVmState = ucfirst($vm_state[0]);
 | 
			
		||||
                    $vmwVmCpus  = $xml->vcpu;
 | 
			
		||||
 | 
			
		||||
                    $vmwVmCpus  = $xml->vcpu['current'];
 | 
			
		||||
                    if (!isset($vmwVmCpus)) {
 | 
			
		||||
                        $vmwVmCpus  = $xml->vcpu;
 | 
			
		||||
                    }
 | 
			
		||||
                    $vmwVmMemSize = $xml->memory;
 | 
			
		||||
                    // Convert memory size to MiB
 | 
			
		||||
                    switch ($vmwVmMemSize['unit']) {
 | 
			
		||||
                        case 'T':
 | 
			
		||||
                        case 'TiB':
 | 
			
		||||
                            $vmwVmMemSize = $vmwVmMemSize * 1048576;
 | 
			
		||||
                            break;
 | 
			
		||||
                        case 'TB':
 | 
			
		||||
                            $vmwVmMemSize = $vmwVmMemSize * 1000000;
 | 
			
		||||
                            break;
 | 
			
		||||
                        case 'G':
 | 
			
		||||
                        case 'GiB':
 | 
			
		||||
                            $vmwVmMemSize = $vmwVmMemSize * 1024;
 | 
			
		||||
                            break;
 | 
			
		||||
                        case 'GB':
 | 
			
		||||
                            $vmwVmMemSize = $vmwVmMemSize * 1000;
 | 
			
		||||
                            break;
 | 
			
		||||
                        case 'M':
 | 
			
		||||
                        case 'MiB':
 | 
			
		||||
                            $vmwVmMemSize = $vmwVmMemSize;
 | 
			
		||||
                            break;
 | 
			
		||||
                        case 'MB':
 | 
			
		||||
                            $vmwVmMemSize = $vmwVmMemSize * 1000000 / 1048576;
 | 
			
		||||
                            break;
 | 
			
		||||
                        case 'KB':
 | 
			
		||||
                            $vmwVmMemSize = $vmwVmMemSize / 1000;
 | 
			
		||||
                            break;
 | 
			
		||||
                        case 'b':
 | 
			
		||||
                        case 'bytes':
 | 
			
		||||
                            $vmwVmMemSize = $vmwVmMemSize / 1048576;
 | 
			
		||||
                            break;
 | 
			
		||||
                        default:
 | 
			
		||||
                            // KiB or k or no value
 | 
			
		||||
                            $vmwVmMemSize = $vmwVmMemSize / 1024;
 | 
			
		||||
                            break;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    // Check whether the Virtual Machine is already known for this host.
 | 
			
		||||
                    $result = dbFetchRow("SELECT * FROM `vminfo` WHERE `device_id` = ? AND `vmwVmVMID` = ? AND `vm_type` = 'libvirt'", array($device['device_id'], $dom_id));
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										28
									
								
								includes/discovery/os/sinetica.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								includes/discovery/os/sinetica.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
<?php
 | 
			
		||||
/**
 | 
			
		||||
 * sinetica.inc.php
 | 
			
		||||
 *
 | 
			
		||||
 * LibreNMS os discovery module for Sinetica
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 * @package    LibreNMS
 | 
			
		||||
 * @link       http://librenms.org
 | 
			
		||||
 * @copyright  2016 Neil Lathwood
 | 
			
		||||
 * @author     Neil Lathwood <neil@lathwood.co.uk>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
if (starts_with($sysDescr, 'Sinetica UPSController.')) {
 | 
			
		||||
    $os = 'sinetica';
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										55
									
								
								includes/discovery/sensors/charge/sinetica.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								includes/discovery/sensors/charge/sinetica.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,55 @@
 | 
			
		||||
<?php
 | 
			
		||||
/**
 | 
			
		||||
 * sinecta.php
 | 
			
		||||
 *
 | 
			
		||||
 * -Description-
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 * @package    LibreNMS
 | 
			
		||||
 * @link       http://librenms.org
 | 
			
		||||
 * @copyright  2016 Tony Murray
 | 
			
		||||
 * @author     Tony Murray <murraytony@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
if ($device['os'] == 'sinetica') {
 | 
			
		||||
    $charge_oid = '.1.3.6.1.4.1.13891.101.2.4.0';
 | 
			
		||||
    $charge = snmp_get($device, $charge_oid, '-Osqnv');
 | 
			
		||||
 | 
			
		||||
    if (!empty($charge)) {
 | 
			
		||||
        $type = 'sinetica';
 | 
			
		||||
        $index = 0;
 | 
			
		||||
        $limit = 100;
 | 
			
		||||
        $lowlimit = 0;
 | 
			
		||||
        $lowwarnlimit = 10;
 | 
			
		||||
        $descr = 'Battery Charge';
 | 
			
		||||
 | 
			
		||||
        discover_sensor(
 | 
			
		||||
            $valid['sensor'],
 | 
			
		||||
            'charge',
 | 
			
		||||
            $device,
 | 
			
		||||
            $charge_oid,
 | 
			
		||||
            $index,
 | 
			
		||||
            $type,
 | 
			
		||||
            $descr,
 | 
			
		||||
            1,
 | 
			
		||||
            1,
 | 
			
		||||
            $lowlimit,
 | 
			
		||||
            $lowwarnlimit,
 | 
			
		||||
            null,
 | 
			
		||||
            $limit,
 | 
			
		||||
            $charge
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										76
									
								
								includes/discovery/sensors/current/sinetica.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										76
									
								
								includes/discovery/sensors/current/sinetica.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,76 @@
 | 
			
		||||
<?php
 | 
			
		||||
/**
 | 
			
		||||
 * sinetica.inc.php
 | 
			
		||||
 *
 | 
			
		||||
 * -Description-
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 * @package    LibreNMS
 | 
			
		||||
 * @link       http://librenms.org
 | 
			
		||||
 * @copyright  2016 Tony Murray
 | 
			
		||||
 * @author     Tony Murray <murraytony@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if ($device['os'] == 'sinetica') {
 | 
			
		||||
    $battery_oid = '.1.3.6.1.4.1.13891.101.2.6.0';
 | 
			
		||||
    $battery_current = snmp_get($device, $battery_oid, '-Oqv');
 | 
			
		||||
 | 
			
		||||
    if (!empty($battery_current) || $battery_current == 0) {
 | 
			
		||||
        $divisor          = 10;
 | 
			
		||||
        $current          = $battery_current / $divisor;
 | 
			
		||||
        $descr            = 'Battery';
 | 
			
		||||
        $type             = 'sinetica';
 | 
			
		||||
        $index            = '2.6.0';
 | 
			
		||||
 | 
			
		||||
        discover_sensor($valid['sensor'], 'current', $device, $battery_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $oids = snmpwalk_cache_oid_num($device, '.1.3.6.1.4.1.13891.101.4.4.1.3', array());
 | 
			
		||||
 | 
			
		||||
    foreach ($oids as $oid => $data) {
 | 
			
		||||
        $current_id = substr($oid, strrpos($oid, '.') + 1);
 | 
			
		||||
 | 
			
		||||
        $current_oid = ".$oid";
 | 
			
		||||
        $descr   = 'Output';
 | 
			
		||||
        if (count($oids) > 1) {
 | 
			
		||||
            $descr .= " Phase $current_id";
 | 
			
		||||
        }
 | 
			
		||||
        $divisor = 100;
 | 
			
		||||
        $current = current($data) / $divisor;
 | 
			
		||||
        $type    = 'sinetica';
 | 
			
		||||
        $index   = '4.4.1.3.'.$current_id;
 | 
			
		||||
 | 
			
		||||
        discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $oids = snmpwalk_cache_oid_num($device, '.1.3.6.1.4.1.13891.101.3.3.1.4', array());
 | 
			
		||||
 | 
			
		||||
    foreach ($oids as $oid => $data) {
 | 
			
		||||
        $current_id = substr($oid, strrpos($oid, '.') + 1);
 | 
			
		||||
 | 
			
		||||
        $current_oid = ".$oid";
 | 
			
		||||
        $descr   = 'Input';
 | 
			
		||||
        if (count($oids) > 1) {
 | 
			
		||||
            $descr .= " Phase $current_id";
 | 
			
		||||
        }
 | 
			
		||||
        $divisor = 10;
 | 
			
		||||
        $current = current($data) / $divisor;
 | 
			
		||||
        $type    = 'sinetica';
 | 
			
		||||
        $index   = '3.3.1.3.'.$current_id;
 | 
			
		||||
 | 
			
		||||
        discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
 | 
			
		||||
    }
 | 
			
		||||
}//end if
 | 
			
		||||
							
								
								
									
										71
									
								
								includes/discovery/sensors/frequencies/sinetica.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								includes/discovery/sensors/frequencies/sinetica.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,71 @@
 | 
			
		||||
<?php
 | 
			
		||||
/**
 | 
			
		||||
 * sinetica.inc.php
 | 
			
		||||
 *
 | 
			
		||||
 * -Description-
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 * @package    LibreNMS
 | 
			
		||||
 * @link       http://librenms.org
 | 
			
		||||
 * @copyright  2016 Tony Murray
 | 
			
		||||
 * @author     Tony Murray <murraytony@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if ($device['os'] == 'sinetica') {
 | 
			
		||||
    $output_oid = '.1.3.6.1.4.1.13891.101.4.2.0';
 | 
			
		||||
    $output_current = snmp_get($device, $output_oid, '-Oqv');
 | 
			
		||||
 | 
			
		||||
    if (!empty($output_current) || $output_current == 0) {
 | 
			
		||||
        $divisor          = 10;
 | 
			
		||||
        $current          = $output_current / $divisor;
 | 
			
		||||
        $descr            = 'Output';
 | 
			
		||||
        $type             = 'sinetica';
 | 
			
		||||
        $index            = '4.2.0';
 | 
			
		||||
 | 
			
		||||
        discover_sensor($valid['sensor'], 'frequency', $device, $output_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $bypass_oid = '.1.3.6.1.4.1.13891.101.5.1.0';
 | 
			
		||||
    $bypass_current = snmp_get($device, $bypass_oid, '-Oqv');
 | 
			
		||||
 | 
			
		||||
    if (!empty($bypass_current) || $bypass_current == 0) {
 | 
			
		||||
        $divisor          = 10;
 | 
			
		||||
        $current          = $bypass_current / $divisor;
 | 
			
		||||
        $descr            = 'Bypass';
 | 
			
		||||
        $type             = 'sinetica';
 | 
			
		||||
        $index            = '5.1.0';
 | 
			
		||||
 | 
			
		||||
        discover_sensor($valid['sensor'], 'frequency', $device, $bypass_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $oids = snmpwalk_cache_oid_num($device, '.1.3.6.1.4.1.13891.101.3.3.1.2', array());
 | 
			
		||||
 | 
			
		||||
    foreach ($oids as $oid => $data) {
 | 
			
		||||
        $current_id = substr($oid, strrpos($oid, '.') + 1);
 | 
			
		||||
 | 
			
		||||
        $current_oid = ".$oid";
 | 
			
		||||
        $descr   = 'Input';
 | 
			
		||||
        if (count($oids) > 1) {
 | 
			
		||||
            $descr .= " Phase $current_id";
 | 
			
		||||
        }
 | 
			
		||||
        $divisor = 10;
 | 
			
		||||
        $current = current($data) / $divisor;
 | 
			
		||||
        $type    = 'sinetica';
 | 
			
		||||
        $index   = '3.3.1.2.'.$current_id;
 | 
			
		||||
 | 
			
		||||
        discover_sensor($valid['sensor'], 'frequency', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
 | 
			
		||||
    }
 | 
			
		||||
}//end if
 | 
			
		||||
							
								
								
									
										44
									
								
								includes/discovery/sensors/load/sinetica.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								includes/discovery/sensors/load/sinetica.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
			
		||||
<?php
 | 
			
		||||
/**
 | 
			
		||||
 * sinetica.inc.php
 | 
			
		||||
 *
 | 
			
		||||
 * -Description-
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 * @package    LibreNMS
 | 
			
		||||
 * @link       http://librenms.org
 | 
			
		||||
 * @copyright  2016 Tony Murray
 | 
			
		||||
 * @author     Tony Murray <murraytony@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if ($device['os'] == 'sinetica') {
 | 
			
		||||
    $oids = snmpwalk_cache_oid_num($device, '.1.3.6.1.4.1.13891.101.4.4.1.5', array());
 | 
			
		||||
 | 
			
		||||
    foreach ($oids as $oid => $data) {
 | 
			
		||||
        $current_id = substr($oid, strrpos($oid, '.') + 1);
 | 
			
		||||
 | 
			
		||||
        $current_oid = ".$oid";
 | 
			
		||||
        $descr = 'Output';
 | 
			
		||||
        if (count($oids) > 1) {
 | 
			
		||||
            $descr .= " $current_id";
 | 
			
		||||
        }
 | 
			
		||||
        $current = current($data);
 | 
			
		||||
        $type = 'sinetica';
 | 
			
		||||
        $index = '4.4.1.5.' . $current_id;
 | 
			
		||||
 | 
			
		||||
        discover_sensor($valid['sensor'], 'load', $device, $current_oid, $index, $type, $descr, 1, 1, null, null, null, null, $current);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										44
									
								
								includes/discovery/sensors/power/sinetica.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								includes/discovery/sensors/power/sinetica.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
			
		||||
<?php
 | 
			
		||||
/**
 | 
			
		||||
 * sinetica.inc.php
 | 
			
		||||
 *
 | 
			
		||||
 * -Description-
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 * @package    LibreNMS
 | 
			
		||||
 * @link       http://librenms.org
 | 
			
		||||
 * @copyright  2016 Tony Murray
 | 
			
		||||
 * @author     Tony Murray <murraytony@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
if ($device['os'] == 'sinetica') {
 | 
			
		||||
    $oids = snmpwalk_cache_oid_num($device, '.1.3.6.1.4.1.13891.101.4.4.1.4', array());
 | 
			
		||||
 | 
			
		||||
    foreach ($oids as $oid => $data) {
 | 
			
		||||
        $current_id = substr($oid, strrpos($oid, '.') + 1);
 | 
			
		||||
 | 
			
		||||
        $current_oid = ".$oid";
 | 
			
		||||
        $descr = 'Output';
 | 
			
		||||
        if (count($oids) > 1) {
 | 
			
		||||
            $descr .= " Phase $current_id";
 | 
			
		||||
        }
 | 
			
		||||
        $divisor = 10;
 | 
			
		||||
        $current = current($data) / $divisor;
 | 
			
		||||
        $type = 'sinetica';
 | 
			
		||||
        $index = '4.4.1.4.' . $current_id;
 | 
			
		||||
 | 
			
		||||
        discover_sensor($valid['sensor'], 'power', $device, $current_oid, $index, $type, $descr, $divisor, 1, null, null, null, null, $current);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										38
									
								
								includes/discovery/sensors/runtime/sinetica.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								includes/discovery/sensors/runtime/sinetica.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
<?php
 | 
			
		||||
/**
 | 
			
		||||
 * sinetica.inc.php
 | 
			
		||||
 *
 | 
			
		||||
 * -Description-
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 * @package    LibreNMS
 | 
			
		||||
 * @link       http://librenms.org
 | 
			
		||||
 * @copyright  2016 Tony Murray
 | 
			
		||||
 * @author     Tony Murray <murraytony@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
if ($device['os'] == 'sinetica') {
 | 
			
		||||
    $runtime_oid = '.1.3.6.1.4.1.13891.101.2.3.0';
 | 
			
		||||
    $runtime = snmp_get($device, $runtime_oid, '-Osqvt');
 | 
			
		||||
 | 
			
		||||
    if (!empty($runtime)) {
 | 
			
		||||
        $type               = 'sinetcia';
 | 
			
		||||
        $index              = '2.3.0';
 | 
			
		||||
        $descr              = 'Runtime';
 | 
			
		||||
        $low_limit          = 5;
 | 
			
		||||
        $low_limit_warn     = 10;
 | 
			
		||||
        discover_sensor($valid['sensor'], 'runtime', $device, $runtime_oid, $index, $type, $descr, 1, 1, $low_limit, $low_limit_warn, null, null, $runtime);
 | 
			
		||||
    }
 | 
			
		||||
}//end if
 | 
			
		||||
							
								
								
									
										73
									
								
								includes/discovery/sensors/voltages/sinetica.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								includes/discovery/sensors/voltages/sinetica.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,73 @@
 | 
			
		||||
<?php
 | 
			
		||||
/**
 | 
			
		||||
 * sinetica.inc.php
 | 
			
		||||
 *
 | 
			
		||||
 * -Description-
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 * @package    LibreNMS
 | 
			
		||||
 * @link       http://librenms.org
 | 
			
		||||
 * @copyright  2016 Tony Murray
 | 
			
		||||
 * @author     Tony Murray <murraytony@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
if ($device['os'] == 'sinetica') {
 | 
			
		||||
    $battery_oid = '.1.3.6.1.4.1.13891.101.2.5.0';
 | 
			
		||||
    $battery_current = snmp_get($device, $battery_oid, '-Oqv');
 | 
			
		||||
 | 
			
		||||
    if (!empty($battery_current) || $battery_current == 0) {
 | 
			
		||||
        $divisor          = 10;
 | 
			
		||||
        $current          = $battery_current / $divisor;
 | 
			
		||||
        $descr            = 'Battery';
 | 
			
		||||
        $type             = 'sinetica';
 | 
			
		||||
        $index            = '2.5.0';
 | 
			
		||||
 | 
			
		||||
        discover_sensor($valid['sensor'], 'voltage', $device, $battery_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $oids = snmpwalk_cache_oid_num($device, '.1.3.6.1.4.1.13891.101.3.3.1.3', array());
 | 
			
		||||
 | 
			
		||||
    foreach ($oids as $oid => $data) {
 | 
			
		||||
        $current_id = substr($oid, strrpos($oid, '.') + 1);
 | 
			
		||||
 | 
			
		||||
        $current_oid = ".$oid";
 | 
			
		||||
        $descr   = 'Output';
 | 
			
		||||
        if (count($oids) > 1) {
 | 
			
		||||
            $descr .= " Phase $current_id";
 | 
			
		||||
        }
 | 
			
		||||
        $current = current($data);
 | 
			
		||||
        $type    = 'sinetica';
 | 
			
		||||
        $index   = '3.3.1.3.'.$current_id;
 | 
			
		||||
 | 
			
		||||
        discover_sensor($valid['sensor'], 'voltage', $device, $current_oid, $index, $type, $descr, 1, 1, null, null, null, null, $current);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $oids = snmpwalk_cache_oid_num($device, '.1.3.6.1.4.1.13891.101.4.4.1.2', array());
 | 
			
		||||
 | 
			
		||||
    foreach ($oids as $oid => $data) {
 | 
			
		||||
        $current_id = substr($oid, strrpos($oid, '.') + 1);
 | 
			
		||||
 | 
			
		||||
        $current_oid = ".$oid";
 | 
			
		||||
        $descr   = 'Input';
 | 
			
		||||
        if (count($oids) > 1) {
 | 
			
		||||
            $descr .= " Phase $current_id";
 | 
			
		||||
        }
 | 
			
		||||
        $current = current($data);
 | 
			
		||||
        $type    = 'sinetica';
 | 
			
		||||
        $index   = '4.4.1.2.'.$current_id;
 | 
			
		||||
 | 
			
		||||
        discover_sensor($valid['sensor'], 'voltage', $device, $current_oid, $index, $type, $descr, 1, '1', null, null, null, null, $current);
 | 
			
		||||
    }
 | 
			
		||||
}//end if
 | 
			
		||||
							
								
								
									
										69
									
								
								includes/polling/mib/ubnt-unifi-mib.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								includes/polling/mib/ubnt-unifi-mib.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,69 @@
 | 
			
		||||
<?php
 | 
			
		||||
// Polling of UniFi MIB AP for Ubiquiti Unifi Radios
 | 
			
		||||
// based on Airfiber MIB work of Mark Gibbons
 | 
			
		||||
 | 
			
		||||
// UBNT-UniFi-MIB
 | 
			
		||||
echo ' UBNT-UniFi-MIB ';
 | 
			
		||||
 | 
			
		||||
// $mib_oids     (oidindex,dsname,dsdescription,dstype)
 | 
			
		||||
$mib_oids = array(
 | 
			
		||||
    'unifiRadioCuTotal.0'                 => array(
 | 
			
		||||
        '',
 | 
			
		||||
        'Radio0CuTotal',
 | 
			
		||||
        'Radio0 Channel Utilized',
 | 
			
		||||
        'GAUGE',
 | 
			
		||||
    ),
 | 
			
		||||
    'unifiRadioCuTotal.1'                 => array(
 | 
			
		||||
        '',
 | 
			
		||||
        'Radio1CuTotal',
 | 
			
		||||
        'Radio1 Channel Utilized',
 | 
			
		||||
        'GAUGE',
 | 
			
		||||
    ),
 | 
			
		||||
    'unifiRadioCuSelfRx.0'                 => array(
 | 
			
		||||
        '',
 | 
			
		||||
        'Radio0CuSelfRx',
 | 
			
		||||
        'Radio0 Channel Utilized Rx',
 | 
			
		||||
        'GAUGE',
 | 
			
		||||
    ),
 | 
			
		||||
    'unifiRadioCuSelfRx.1'                 => array(
 | 
			
		||||
        '',
 | 
			
		||||
        'Radio1CuSelfRx',
 | 
			
		||||
        'Radio1 Channel Utilized Rx',
 | 
			
		||||
        'GAUGE',
 | 
			
		||||
    ),
 | 
			
		||||
    'unifiRadioCuSelfTx.0'                 => array(
 | 
			
		||||
        '',
 | 
			
		||||
        'Radio0CuSelfTx',
 | 
			
		||||
        'Radio0 Channel Utilized Tx',
 | 
			
		||||
        'GAUGE',
 | 
			
		||||
    ),
 | 
			
		||||
    'unifiRadioCuSelfTx.1'                 => array(
 | 
			
		||||
        '',
 | 
			
		||||
        'Radio1CuSelfTx',
 | 
			
		||||
        'Radio1 Channel Utilized Tx',
 | 
			
		||||
        'GAUGE',
 | 
			
		||||
    ),
 | 
			
		||||
    'unifiRadioOtherBss.0'                 => array(
 | 
			
		||||
        '',
 | 
			
		||||
        'Radio0OtherBss',
 | 
			
		||||
        'Radio0 Channel Utilized by Others',
 | 
			
		||||
        'GAUGE',
 | 
			
		||||
    ),
 | 
			
		||||
    'unifiRadioOtherBss.1'                 => array(
 | 
			
		||||
        '',
 | 
			
		||||
        'Radio1OtherBss',
 | 
			
		||||
        'Radio1 Channel Utilized by Others',
 | 
			
		||||
        'GAUGE',
 | 
			
		||||
    ),
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
$mib_graphs = array(
 | 
			
		||||
    'ubnt_unifi_RadioCu_0',
 | 
			
		||||
    'ubnt_unifi_RadioCu_1',
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
unset($graph, $oids, $oid);
 | 
			
		||||
 | 
			
		||||
poll_mib_def($device, 'UBNT-UniFi-MIB:UBNT', 'ubiquiti', $mib_oids, $mib_graphs, $graphs);
 | 
			
		||||
// EOF
 | 
			
		||||
							
								
								
									
										31
									
								
								includes/polling/os/sinetica.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								includes/polling/os/sinetica.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
			
		||||
<?php
 | 
			
		||||
/**
 | 
			
		||||
 * sinetica.inc.php
 | 
			
		||||
 *
 | 
			
		||||
 * LibreNMS os polling module for Sinetica
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 * @package    LibreNMS
 | 
			
		||||
 * @link       http://librenms.org
 | 
			
		||||
 * @copyright  2016 Neil Lathwood
 | 
			
		||||
 * @author     Neil Lathwood <neil@lathwood.co.uk>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
// Sinetica UPSController. Versions: App. 6.04.03,   OS 6.3,   Btldr 1.06.09,   H/w ZBBNC2 Rev 1.01.06
 | 
			
		||||
 | 
			
		||||
list($os_temp, $os_ver, $btldr, $hardware_temp) = explode(',   ', $poll_device['sysDescr']);
 | 
			
		||||
 | 
			
		||||
list($ignore, $version) = explode('App. ', $os_temp);
 | 
			
		||||
$hardware = preg_replace('/H\/w /', '', $hardware_temp);
 | 
			
		||||
@@ -77,6 +77,7 @@ if ($device['type'] == 'network' || $device['type'] == 'firewall' || $device['ty
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        echo (($wificlients1 + 0).' clients on Radio0, '.($wificlients2 + 0)." clients on Radio1\n");
 | 
			
		||||
        include 'includes/polling/mib/ubnt-unifi-mib.inc.php';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (isset($wificlients1) && $wificlients1 != '') {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user