Skip to content

Commit

Permalink
Add $sysObjectID to the available options when determining platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
barryo committed Jul 8, 2014
1 parent 7d2532d commit c4bc88b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 14 deletions.
26 changes: 24 additions & 2 deletions OSS_SNMP/MIBS/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
class System extends \OSS_SNMP\MIB
{
const OID_SYSTEM_DESCRIPTION = '.1.3.6.1.2.1.1.1.0';
const OID_SYSTEM_OBJECT_ID = '.1.3.6.1.2.1.1.2.0';
const OID_SYSTEM_UPTIME = '.1.3.6.1.2.1.1.3.0';
const OID_SYSTEM_CONTACT = '.1.3.6.1.2.1.1.4.0';
const OID_SYSTEM_NAME = '.1.3.6.1.2.1.1.5.0';
Expand All @@ -60,6 +61,29 @@ public function description()
return $this->getSNMP()->get( self::OID_SYSTEM_DESCRIPTION );
}

/**
* Returns the system object ID
*
* "The vendor's authoritative identification of the
* network management subsystem contained in the
* entity. This value is allocated within the SMI
* enterprises subtree (1.3.6.1.4.1) and provides an
* easy and unambiguous means for determining `what
* kind of box' is being managed. For example, if
* vendor `Flintstones, Inc.' was assigned the
* subtree 1.3.6.1.4.1.4242, it could assign the
* identifier 1.3.6.1.4.1.4242.1.1 to its `Fred
* Router'."
*
* @return string The system object ID
*/
public function systemObjectID()
{
return $this->getSNMP()->get( self::OID_SYSTEM_OBJECT_ID );
}



/**
* Returns the system uptime of the device
*
Expand Down Expand Up @@ -162,5 +186,3 @@ public function getAll()
return $system;
}
}


28 changes: 16 additions & 12 deletions OSS_SNMP/Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Platform
* @var string The platform model
*/
protected $_model = 'Unknown';

/**
* The platform operating system
*
Expand Down Expand Up @@ -92,8 +92,8 @@ class Platform
* @var string The \OSS_SNMP\SNMP object
*/
protected $_snmpHost;


/**
* The constructor.
*
Expand All @@ -103,25 +103,31 @@ class Platform
public function __construct( $snmpHost )
{
$this->setSNMPHost( $snmpHost );

$this->parse();

return $this;
}



public function parse()
{
// query the platform for it's description and parse it for details

$sysDescr = $this->getSNMPHost()->useSystem()->description();

$sysDescr = $this->getSNMPHost()->useSystem()->description();

try {
$sysObjectId = $this->getSNMPHost()->useSystem()->systemObjectID();
} catch( Exception $e ){
$sysObjectId = null;
}

// there's possibly a better way to do this...?
foreach( glob( __DIR__ . '/Platforms/vendor_*.php' ) as $f )
include( $f );
}

/**
* Set the SNMPT Host
*
Expand Down Expand Up @@ -212,7 +218,7 @@ public function setOsDate( $s )
*/
public function setSerialNumber( $s )
{
$this->_serial = $s;
$this->_serial = $s;
return $this;
}

Expand Down Expand Up @@ -277,5 +283,3 @@ public function getSerialNumber()
}

}


0 comments on commit c4bc88b

Please sign in to comment.