mirror of
https://gitlab.com/JKANetwork/CheckServer.git
synced 2026-02-28 07:53:46 +01:00
Start again
This commit is contained in:
226
lib/OSS_SNMP-master/examples/asterisk.php
Normal file
226
lib/OSS_SNMP-master/examples/asterisk.php
Normal file
@@ -0,0 +1,226 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script for OSS_SNMP Asterisk MIBs
|
||||
//
|
||||
// It needs to be called with a hostname / IP address and a community string
|
||||
|
||||
if( count( $argv ) != 3 )
|
||||
{
|
||||
echo <<< HELPTEXT
|
||||
|
||||
OSS_SNMP - A PHP SNMP library for people who hate SNMP MIBs and OIDs!
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
See: https://github.com/opensolutions/OSS_SNMP/
|
||||
|
||||
This is an example script to show how to use OSS_SNMP. It requires two arguments:
|
||||
|
||||
- the IP address of hostname of a SNMP capable host (with Asterisk SNMP enabled)
|
||||
- the SNMP v2 community string for that host
|
||||
|
||||
For example:
|
||||
|
||||
{$argv[0]} 192.168.10.20 public
|
||||
|
||||
|
||||
HELPTEXT;
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $argv[1], $argv[2] );
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
echo "Asterisk version running on {$argv[1]}: " . $host->useAsterisk()->version() . "\n";
|
||||
echo "Asterisk SVN tag running on {$argv[1]}: " . $host->useAsterisk()->tag() . "\n";
|
||||
|
||||
|
||||
echo "Asterisk on {$argv[1]} up for: " . ( $host->useAsterisk()->uptime() / 100 / 60 / 60 ) . " hours\n";
|
||||
echo "Asterisk on {$argv[1]} reloaded: " . ( $host->useAsterisk()->reloadTime() / 100 / 60 / 60 ) . " hours ago\n";
|
||||
echo "Asterisk PID: " . $host->useAsterisk()->pid() . "\n";
|
||||
echo "Asterisk control socket: " . $host->useAsterisk()->controlSocket() . "\n";
|
||||
echo "Calls active: " . $host->useAsterisk()->callsActive() . "\n";
|
||||
echo "Calls processed: " . $host->useAsterisk()->callsProcessed() . "\n";
|
||||
echo "Modules compiled in: " . $host->useAsterisk()->modules() . "\n";
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
echo "Indications defined: " . $host->useAsterisk_Indications()->number() . "\n";
|
||||
echo "Default indications zone: " . $host->useAsterisk_Indications()->defaultZone() . "\n";
|
||||
|
||||
echo "Indication country codes:\n\n";
|
||||
print_r( $host->useAsterisk_Indications()->countryCodes() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Indication descriptions:\n\n";
|
||||
print_r( $host->useAsterisk_Indications()->descriptions() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Channels active: " . $host->useAsterisk_Channels()->active() . "\n";
|
||||
echo "Channels supported: " . $host->useAsterisk_Channels()->supported() . "\n";
|
||||
|
||||
|
||||
echo "Channel type names:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->names() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Channel type descriptions:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->descriptions() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Channel type device state capability:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->deviceStates() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Channel type progress indication capability:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->progressIndications() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Channel type transfer capability:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->transfers() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Active calls on supported channel types:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->activeCalls() );
|
||||
echo "\n\n";
|
||||
|
||||
|
||||
echo "Supported channel details:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->details() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Channels bridged: " . $host->useAsterisk_Channels()->bridged() . "\n";
|
||||
|
||||
/**
|
||||
|
||||
|
||||
echo "\n\n\nchanName\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanName() );
|
||||
echo "\n\n\nchanLanguage\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanLanguage() );
|
||||
echo "\n\n\nchanType\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanType() );
|
||||
echo "\n\n\nchanMusicClass\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMusicClass() );
|
||||
echo "\n\n\nchanBridge\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanBridge() );
|
||||
echo "\n\n\nchanMasq\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMasq() );
|
||||
echo "\n\n\nchanMasqr\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMasqr() );
|
||||
echo "\n\n\nchanWhenHangup\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanWhenHangup() );
|
||||
echo "\n\n\nchanApp\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanApp() );
|
||||
echo "\n\n\nchanData\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanData() );
|
||||
echo "\n\n\nchanContext\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanContext() );
|
||||
echo "\n\n\nchanMacroContext\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMacroContext() );
|
||||
echo "\n\n\nchanMacroExten\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMacroExten() );
|
||||
echo "\n\n\nchanMacroPri\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMacroPri() );
|
||||
echo "\n\n\nchanExten\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanExten() );
|
||||
echo "\n\n\nchanPri\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanPri() );
|
||||
echo "\n\n\nchanAccountCode\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanAccountCode() );
|
||||
echo "\n\n\nchanForwardTo\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanForwardTo() );
|
||||
echo "\n\n\nchanUniqueId\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanUniqueId() );
|
||||
echo "\n\n\nchanCallGroup\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCallGroup() );
|
||||
echo "\n\n\nchanPickupGroup\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanPickupGroup() );
|
||||
echo "\n\n\nchanState\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanState(1) );
|
||||
echo "\n\n\nchanMuted\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMuted() );
|
||||
echo "\n\n\nchanRings\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanRings() );
|
||||
echo "\n\n\nchanCidDNID\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidDNID() );
|
||||
echo "\n\n\nchanCidNum\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidNum() );
|
||||
echo "\n\n\nchanCidName\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidName() );
|
||||
echo "\n\n\nchanCidANI\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidANI() );
|
||||
echo "\n\n\nchanCidRDNIS\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidRDNIS() );
|
||||
echo "\n\n\nchanCidPresentation\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidPresentation() );
|
||||
echo "\n\n\nchanCidANI2\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidANI2() );
|
||||
echo "\n\n\nchanCidTON\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidTON() );
|
||||
echo "\n\n\nchanCidTNS\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidTNS() );
|
||||
echo "\n\n\nchanAMAFlags\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanAMAFlags(1) );
|
||||
echo "\n\n\nchanADSI\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanADSI(1) );
|
||||
echo "\n\n\nchanToneZone\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanToneZone() );
|
||||
echo "\n\n\nchanHangupCause\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanHangupCause(1) );
|
||||
echo "\n\n\nchanVariables\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanVariables() );
|
||||
echo "\n\n\nchanFlags\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanFlags() );
|
||||
echo "\n\n\nchanTransferCap\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanTransferCap(1) );
|
||||
|
||||
*/
|
||||
|
||||
echo "\n\n\nChannel Details\n";
|
||||
print_r( $host->useAsterisk_Channels()->channelDetails( true, false ) );
|
||||
|
||||
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
exit( 0 );
|
||||
|
||||
88
lib/OSS_SNMP-master/examples/bgp.php
Normal file
88
lib/OSS_SNMP-master/examples/bgp.php
Normal file
@@ -0,0 +1,88 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script for OSS_SNMP Asterisk MIBs
|
||||
//
|
||||
// It needs to be called with a hostname / IP address and a community string
|
||||
|
||||
if( count( $argv ) != 3 )
|
||||
{
|
||||
echo <<< HELPTEXT
|
||||
|
||||
OSS_SNMP - A PHP SNMP library for people who hate SNMP MIBs and OIDs!
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
See: https://github.com/opensolutions/OSS_SNMP/
|
||||
|
||||
This is an example script to show how to use OSS_SNMP. It requires two arguments:
|
||||
|
||||
- the IP address of hostname of a SNMP capable host (with Asterisk SNMP enabled)
|
||||
- the SNMP v2 community string for that host
|
||||
|
||||
For example:
|
||||
|
||||
{$argv[0]} 192.168.10.20 public
|
||||
|
||||
|
||||
HELPTEXT;
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $argv[1], $argv[2] );
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
echo "BGP version running on {$argv[1]}: " . $host->useBGP()->version() . "\n";
|
||||
|
||||
echo "BGP - local ASN: " . $host->useBGP()->localASN() . "\n";
|
||||
|
||||
echo "BGP - identifier: " . $host->useBGP()->identifier() . "\n";
|
||||
|
||||
#echo "BGP - peers: \n\n";
|
||||
|
||||
#print_r( $host->useBGP()->peerDetails(1) );
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
|
||||
|
||||
exit( 0 );
|
||||
|
||||
|
||||
95
lib/OSS_SNMP-master/examples/extreme.php
Normal file
95
lib/OSS_SNMP-master/examples/extreme.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2014, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script for OSS_SNMP Extreme system MIBs
|
||||
//
|
||||
// It needs to be called with a hostname / IP address and a community string
|
||||
|
||||
if( count( $argv ) != 3 )
|
||||
{
|
||||
echo <<< HELPTEXT
|
||||
|
||||
OSS_SNMP - A PHP SNMP library for people who hate SNMP MIBs and OIDs!
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
See: https://github.com/opensolutions/OSS_SNMP/
|
||||
|
||||
This is an example script to show how to use OSS_SNMP. It requires two arguments:
|
||||
|
||||
- the IP address of hostname of a SNMP capable host (with Asterisk SNMP enabled)
|
||||
- the SNMP v2 community string for that host
|
||||
|
||||
For example:
|
||||
|
||||
{$argv[0]} 192.168.10.20 public
|
||||
|
||||
|
||||
HELPTEXT;
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $argv[1], $argv[2] );
|
||||
|
||||
echo "\nSystem information for {$argv[1]}:\n\n";
|
||||
|
||||
print_r( $host->useSystem()->getAll() );
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
echo "\n\nPlatform details for {$argv[1]}:\n"
|
||||
. "\nVendor: " . $host->getPlatform()->getVendor()
|
||||
. "\nModel: " . $host->getPlatform()->getModel()
|
||||
. "\nOS: " . $host->getPlatform()->getOs()
|
||||
. "\nOS Version: " . $host->getPlatform()->getOsVersion();
|
||||
echo "\n\n";
|
||||
|
||||
|
||||
echo "Temperature alarm: " . ( $host->useExtreme_System_Common()->overTemperatureAlarm() ? 'YES' : 'NO' ) . "\n";
|
||||
echo "Temperature : " . $host->useExtreme_System_Common()->currentTemperature() . "C\n";
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
print_r( $host->useExtreme_SwMonitor_Memory()->percentUsage() );
|
||||
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
|
||||
|
||||
exit( 0 );
|
||||
134
lib/OSS_SNMP-master/examples/interfaces.php
Normal file
134
lib/OSS_SNMP-master/examples/interfaces.php
Normal file
@@ -0,0 +1,134 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script for OSS_SNMP
|
||||
//
|
||||
// It needs to be called with a hostname / IP address and a community string
|
||||
|
||||
if( count( $argv ) != 3 && count( $argv ) != 4 )
|
||||
{
|
||||
echo <<< HELPTEXT
|
||||
|
||||
OSS_SNMP - A PHP SNMP library for people who hate SNMP MIBs and OIDs!
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
See: https://github.com/opensolutions/OSS_SNMP/
|
||||
|
||||
This is an example script to show how to use OSS_SNMP. It requires two or three arguments:
|
||||
|
||||
- the IP address of hostname of a SNMP capable host
|
||||
- the SNMP v2 community string for that host
|
||||
- the index of the interface to show details for
|
||||
|
||||
If the third argument is missing, it will print interface indexes and names.
|
||||
|
||||
For example:
|
||||
|
||||
{$argv[0]} 192.168.10.20 public
|
||||
|
||||
|
||||
HELPTEXT;
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $argv[1], $argv[2] );
|
||||
|
||||
if( count( $argv ) == 3 )
|
||||
{
|
||||
echo "\nNumber of interfaces on {$argv[1]}: " . $host->useIface()->numberofInterfaces() . "\n\n";
|
||||
|
||||
echo "ID: Name - Descrition - Type - Admin/Operational State\n\n";
|
||||
|
||||
foreach( $host->useIface()->names() as $id => $name )
|
||||
{
|
||||
echo "{$id}: {$name} - {$host->useIface()->descriptions()[$id]} - {$host->useIface()->types(1)[$id]}"
|
||||
. " - {$host->useIface()->adminStates(1)[$id]}/{$host->useIface()->operationStates(1)[$id]}\n";
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
$names = $host->useIface()->names();
|
||||
$id = $argv[3];
|
||||
|
||||
if( !isset( $names[ $id ] ) )
|
||||
{
|
||||
echo "Unknown interface index!\n";
|
||||
exit( 2 );
|
||||
}
|
||||
|
||||
$hdr = "\nInterface information for {$names[$id]} ({$host->useIface()->descriptions()[$id]})";
|
||||
|
||||
echo $hdr . "\n". str_repeat( '=', strlen( $hdr ) ) . "\n\n";
|
||||
|
||||
echo <<<INTINFO
|
||||
Alias: {$host->useIface()->aliases()[$id]}
|
||||
Type: {$host->useIface()->types(1)[$id]}
|
||||
|
||||
Admin / Operational State: {$host->useIface()->adminStates(1)[$id]}/{$host->useIface()->operationStates(1)[$id]}
|
||||
|
||||
MTU: {$host->useIface()->mtus()[$id]}
|
||||
Speeds: {$host->useIface()->speeds()[$id]}
|
||||
Physical Address: {$host->useIface()->physAddresses()[$id]}
|
||||
Last Change: {$host->useIface()->lastChanges()[$id]}
|
||||
|
||||
INTINFO;
|
||||
|
||||
try
|
||||
{
|
||||
echo <<<INTINFO
|
||||
In/Out Octets: {$host->useIface()->inOctets()[$id]} / {$host->useIface()->outOctets()[$id]}
|
||||
In/Out Unicast: {$host->useIface()->inUnicastPackets()[$id]} / {$host->useIface()->outUnicastPackets()[$id]}
|
||||
In/Out Non Unicats: {$host->useIface()->inNonUnicastPackets()[$id]} / {$host->useIface()->outNonUnicastPackets()[$id]}
|
||||
In/Out Discards: {$host->useIface()->inDiscards()[$id]} / {$host->useIface()->outDiscards()[$id]}
|
||||
In/Out Errors: {$host->useIface()->inErrors()[$id]} / {$host->useIface()->outErrors()[$id]}
|
||||
|
||||
In Unknown Protocols: {$host->useIface()->inUnknownProtocols()[$id]}
|
||||
Out Queue Length: {$host->useIface()->outQueueLength()[$id]}
|
||||
|
||||
INTINFO;
|
||||
}
|
||||
catch( \OSS_SNMP\Exception $e )
|
||||
{
|
||||
echo "\nCould not poll interface statistics for this interface.\n";
|
||||
}
|
||||
|
||||
exit( 0 );
|
||||
97
lib/OSS_SNMP-master/examples/mau.php
Normal file
97
lib/OSS_SNMP-master/examples/mau.php
Normal file
@@ -0,0 +1,97 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2015, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script for OSS_SNMP
|
||||
//
|
||||
// It needs to be called with a hostname / IP address and a community string
|
||||
|
||||
if( count( $argv ) != 3 && count( $argv ) != 4 )
|
||||
{
|
||||
echo <<< HELPTEXT
|
||||
|
||||
OSS_SNMP - A PHP SNMP library for people who hate SNMP MIBs and OIDs!
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
See: https://github.com/opensolutions/OSS_SNMP/
|
||||
|
||||
This is an example script to show how to use OSS_SNMP. It requires two or three arguments:
|
||||
|
||||
- the IP address of hostname of a SNMP capable host
|
||||
- the SNMP v2 community string for that host
|
||||
|
||||
For example:
|
||||
|
||||
{$argv[0]} 192.168.10.20 public
|
||||
|
||||
|
||||
HELPTEXT;
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $argv[1], $argv[2] );
|
||||
|
||||
if( count( $argv ) == 3 )
|
||||
{
|
||||
echo "\nNumber of interfaces on {$argv[1]}: " . $host->useIface()->numberofInterfaces() . "\n\n";
|
||||
|
||||
echo "ID: Name - Index - Type - State - Media Available - Jack Type - State Exits - Jabber State - Autoneg\n\n";
|
||||
|
||||
foreach( $host->useIface()->names() as $id => $name )
|
||||
{
|
||||
if( $id >1100 ) continue;
|
||||
|
||||
echo "{$id}: {$name} - {$host->useMAU()->index()[$id]}"
|
||||
. " - {$host->useMAU()->types( true )[$id]}"
|
||||
. " - {$host->useMAU()->states( true )[$id]}"
|
||||
. " - {$host->useMAU()->mediaAvailable( true )[$id]}"
|
||||
. " - {$host->useMAU()->jackTypes( true )[$id]}"
|
||||
. " - {$host->useMAU()->mediaAvailableStateExits()[$id]}"
|
||||
. " - {$host->useMAU()->jabberStates( true )[$id]}"
|
||||
. " - " . ( $host->useMAU()->autonegSupported()[$id] ? 'Y' : 'N' )
|
||||
. " - " . ( $host->useMAU()->autonegAdminState()[$id] ? 'Y' : 'N' )
|
||||
. "\n";
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
|
||||
exit( 0 );
|
||||
206
lib/OSS_SNMP-master/examples/mst-port-roles.php
Normal file
206
lib/OSS_SNMP-master/examples/mst-port-roles.php
Normal file
@@ -0,0 +1,206 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script (in practical use by the author) which demonstrates
|
||||
// OSS_SNMP's MST querying capabilities. See the following link for more details
|
||||
// and a screenshot:
|
||||
//
|
||||
//
|
||||
|
||||
// SNMP community of the devices. Assumes all devices have the same community.
|
||||
// Script can easiy be augmented to put this detail in the $ports array below.
|
||||
$community = 'public';
|
||||
|
||||
// Array or arrays of switches and ports to collect MST information from.
|
||||
//
|
||||
// Format of each individual port array is:
|
||||
//
|
||||
// [
|
||||
// 'host' => 'hostname or IP address of device',
|
||||
// 'port' => ifName of the port to query
|
||||
// 'linkedTo' => index of another port array to which this port connects.
|
||||
// Set to null to ignore. Displayed the connected to in the
|
||||
// output which can be useful.
|
||||
// ]
|
||||
//
|
||||
$ports = [
|
||||
0 => [ 'host' => 'sw01', 'port' => 'Gi1/1/1', 'linkedTo' => 10 ],
|
||||
10 => [ 'host' => 'sw01.example.com', 'port' => 'Gi0/11', 'linkedTo' => 0 ],
|
||||
20 => [ 'host' => '192.0.2.67', 'port' => 'Gi1/0/6', 'linkedTo' => null ],
|
||||
// ...
|
||||
];
|
||||
|
||||
// Path to your OSS_SNMP installation.
|
||||
// https://github.com/opensolutions/OSS_SNMP
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
|
||||
///////////
|
||||
// No need to change anything else from here.
|
||||
///////////
|
||||
|
||||
|
||||
// array of OSS_SNMP host objects
|
||||
$hosts = [];
|
||||
|
||||
// array of MST instances on each host (indexed by hostname / IP from $ports array)
|
||||
$hosts_msts = [];
|
||||
|
||||
// array of MST port roles per MST instance for each host (indexed by hostname / IP from $ports array)
|
||||
$hosts_msts_portroles = [];
|
||||
|
||||
// maps ifName to ifIndex as we allow ports to be specified by ifName for ease of use
|
||||
$portNameToIndex = [];
|
||||
|
||||
|
||||
// iterate over each port array (from $ports) and:
|
||||
// - instantiate the OSS_SNMP object for the device (once per device)
|
||||
// - populate the $hosts_msts array with device MST instance information
|
||||
// - populate the port ifName to ifIndex array
|
||||
// - get the port roles for all MST instances on the device
|
||||
//
|
||||
foreach( $ports as $id => $conf )
|
||||
{
|
||||
if( !isset( $hosts[ $conf['host'] ] ) )
|
||||
{
|
||||
$hosts[ $conf['host'] ] = new \OSS_SNMP\SNMP( $conf['host'], $community );
|
||||
$hosts_msts[ $conf['host'] ] = $hosts[ $conf['host'] ]->useCisco_SMST()->instances( '' );
|
||||
$portNameToIndex[ $conf['host'] ] = array_flip( $hosts[ $conf['host'] ]->useIface()->names() );
|
||||
|
||||
foreach( $hosts_msts[ $conf['host'] ] as $id => $instance )
|
||||
$hosts_msts_portroles[ $conf['host'] ][$instance] = $hosts[ $conf['host'] ]->useCisco_MST()->portRoles( $instance, true );
|
||||
}
|
||||
}
|
||||
|
||||
// For our tabular output, we need to know what the maximum instance number is:
|
||||
$maxMstInstance = 0;
|
||||
foreach( $hosts_msts as $msts )
|
||||
if( max( $msts ) > $maxMstInstance )
|
||||
$maxMstInstance = max( $msts );
|
||||
|
||||
// Format and print our table header:
|
||||
$title = "Device - Port :\tStatus Speed ";
|
||||
for( $i = 0; $i <= $maxMstInstance; $i++ )
|
||||
$title .= sprintf( "MST%-9d", $i );
|
||||
|
||||
$title .= ' Connected to ';
|
||||
|
||||
echo "{$title}\n";
|
||||
echo str_repeat( '=', strlen( $title ) ) . "\n";
|
||||
|
||||
// Bash colouring.
|
||||
// Ref: http://www.if-not-true-then-false.com/2010/php-class-for-coloring-php-command-line-cli-scripts-output-php-output-colorizing-using-bash-shell-colors/
|
||||
function bashColour( $text, $fgColour ) {
|
||||
$colours = [
|
||||
'green' => '0;32',
|
||||
'red' => '0;31'
|
||||
];
|
||||
|
||||
return "\033[{$colours[$fgColour]}m{$text}\033[0m";
|
||||
}
|
||||
|
||||
// closure to print coloured port state of a specified column width
|
||||
$colourisedPortState = function( $state, $width ) {
|
||||
$td = $state;
|
||||
while( strlen( $td ) < $width )
|
||||
$td .= ' ';
|
||||
|
||||
if( $state == 'up' )
|
||||
return bashColour( $td, 'green' );
|
||||
else
|
||||
return bashColour( $td, 'red' );
|
||||
};
|
||||
|
||||
// closure to print colours MST port roles of a specified column width
|
||||
$colourisedMSTPortRole = function( $role, $width ) {
|
||||
$td = $role;
|
||||
while( strlen( $td ) < $width )
|
||||
$td .= ' ';
|
||||
|
||||
switch( $role )
|
||||
{
|
||||
case 'designated':
|
||||
return bashColour( $td, 'green' );
|
||||
|
||||
case 'root':
|
||||
return bashColour( $td, 'green' );
|
||||
|
||||
case 'alternate':
|
||||
return bashColour( $td, 'red' );
|
||||
}
|
||||
|
||||
return $td;
|
||||
};
|
||||
|
||||
// iterate over all the ports we are insterested in and print its row:
|
||||
foreach( $ports as $id => $conf )
|
||||
{
|
||||
$ifIndex = $portNameToIndex[ $conf['host'] ][ $conf['port'] ];
|
||||
|
||||
// print hostname/IP, port, port state, and port speed
|
||||
echo sprintf( "%-16s - %-8s:\t%s %-5s ", $conf['host'], $conf['port'],
|
||||
$colourisedPortState( $hosts[ $conf['host'] ]->useIface()->operationStates( true )[ $ifIndex ], 6 ),
|
||||
$hosts[ $conf['host'] ]->useIface()->speeds()[$ifIndex] / 1000 / 1000
|
||||
);
|
||||
|
||||
// print MST port role
|
||||
for( $i = 0; $i <= max( $hosts_msts[ $conf['host'] ] ); $i++ )
|
||||
{
|
||||
if( !isset( $hosts_msts[ $conf['host'] ][ $i ] ) )
|
||||
echo '- mst n/a - ';
|
||||
else if( !isset( $hosts_msts_portroles[ $conf['host'] ][ $i ][ $ifIndex ] ) )
|
||||
echo '- port n/a- ';
|
||||
else
|
||||
echo $colourisedMSTPortRole( $hosts_msts_portroles[ $conf['host'] ][ $i ][ $ifIndex ], 12 );
|
||||
}
|
||||
|
||||
while( $i <= $maxMstInstance )
|
||||
{
|
||||
echo '- mst n/a - ';
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo ' ';
|
||||
|
||||
if( $conf['linkedTo'] !== null )
|
||||
echo $ports[ $conf['linkedTo'] ]['host'] . ':' . $ports[ $conf['linkedTo'] ]['port'];
|
||||
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
|
||||
exit( 0 );
|
||||
|
||||
79
lib/OSS_SNMP-master/examples/platform.php
Normal file
79
lib/OSS_SNMP-master/examples/platform.php
Normal file
@@ -0,0 +1,79 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script for OSS_SNMP
|
||||
//
|
||||
// It needs to be called with a hostname / IP address and a community string
|
||||
|
||||
if( count( $argv ) != 3 )
|
||||
{
|
||||
echo <<< HELPTEXT
|
||||
|
||||
OSS_SNMP - A PHP SNMP library for people who hate SNMP MIBs and OIDs!
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
See: https://github.com/opensolutions/OSS_SNMP/
|
||||
|
||||
This is an example script to show how to use OSS_SNMP. It requires two arguments:
|
||||
|
||||
- the IP address of hostname of a SNMP capable host
|
||||
- the SNMP v2 community string for that host
|
||||
|
||||
For example:
|
||||
|
||||
{$argv[0]} 192.168.10.20 public
|
||||
|
||||
|
||||
HELPTEXT;
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $argv[1], $argv[2] );
|
||||
|
||||
echo "\n\nPlatform details for {$argv[1]}:\n"
|
||||
. "\nVendor: " . $host->getPlatform()->getVendor()
|
||||
. "\nModel: " . $host->getPlatform()->getModel()
|
||||
. "\nOS: " . $host->getPlatform()->getOs()
|
||||
. "\nOS Version: " . $host->getPlatform()->getOsVersion();
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
exit( 0 );
|
||||
|
||||
27
lib/OSS_SNMP-master/examples/snmptest.php
Normal file
27
lib/OSS_SNMP-master/examples/snmptest.php
Normal file
@@ -0,0 +1,27 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
$ip = '127.0.0.1';
|
||||
$community = 'public';
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $ip, $community );
|
||||
|
||||
echo "\nSystem information for {$ip}:\n\n";
|
||||
|
||||
print_r( $host->useSystem()->getAll() );
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
|
||||
echo "\nNumber of interfaces on {$ip}: " . $host->useIface()->numberofInterfaces() . "\n\n";
|
||||
|
||||
echo "ID: Name - Descrition - Type - Admin/Operational State\n\n";
|
||||
|
||||
foreach( $host->useIface()->names() as $id => $name )
|
||||
{
|
||||
echo "{$id}: {$name} - {$host->useIface()->descriptions()[$id]} - {$host->useIface()->types(1)[$id]}"
|
||||
. " - {$host->useIface()->adminStates(1)[$id]}/{$host->useIface()->operationStates(1)[$id]}\n";
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
15
lib/OSS_SNMP-master/examples/system-info.php
Normal file
15
lib/OSS_SNMP-master/examples/system-info.php
Normal file
@@ -0,0 +1,15 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
$ip = '127.0.0.1';
|
||||
$community = 'public';
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $ip, $community );
|
||||
|
||||
echo "\nSystem information for {$ip}:\n\n";
|
||||
|
||||
print_r( $host->useSystem()->getAll() );
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
exit( 0 );
|
||||
Reference in New Issue
Block a user