├── OSS_SNMP
├── doc
├── img
│ ├── favicon.ico
│ ├── icons
│ │ ├── ok.png
│ │ ├── file.gif
│ │ ├── class.png
│ │ ├── favicon.ico
│ │ ├── folder.gif
│ │ ├── method.png
│ │ ├── search.gif
│ │ ├── constant.png
│ │ ├── file-php.png
│ │ ├── function.png
│ │ ├── interface.png
│ │ ├── property.png
│ │ ├── variable.png
│ │ ├── arrow_down.png
│ │ ├── arrow_right.png
│ │ ├── icon-th-big.png
│ │ ├── view_source.png
│ │ ├── visibility_public.png
│ │ ├── visibility_private.png
│ │ ├── icon-folder-open-big.png
│ │ ├── visibility_protected.png
│ │ └── icon_template.svg
│ ├── loader.gif
│ ├── iviewer
│ │ ├── grab.cur
│ │ ├── hand.cur
│ │ ├── iviewer.zoom_in.png
│ │ ├── iviewer.zoom_fit.png
│ │ ├── iviewer.zoom_fit2.gif
│ │ ├── iviewer.zoom_in2.gif
│ │ ├── iviewer.zoom_out.png
│ │ ├── iviewer.zoom_out2.gif
│ │ ├── iviewer.zoom_zero.png
│ │ ├── iviewer.rotate_left.png
│ │ ├── iviewer.rotate_right.png
│ │ └── iviewer.zoom_zero2.gif
│ ├── apple-touch-icon.png
│ ├── glyphicons-halflings.png
│ ├── apple-touch-icon-72x72.png
│ ├── apple-touch-icon-114x114.png
│ └── glyphicons-halflings-white.png
├── js
│ ├── prettify
│ │ ├── lang-go.js
│ │ ├── lang-lua.js
│ │ ├── lang-ml.js
│ │ ├── lang-sql.js
│ │ ├── lang-tex.js
│ │ ├── lang-vb.js
│ │ ├── lang-apollo.js
│ │ ├── lang-scala.js
│ │ ├── lang-vhdl.js
│ │ ├── lang-wiki.js
│ │ ├── lang-proto.js
│ │ ├── lang-yaml.js
│ │ ├── lang-hs.js
│ │ ├── lang-lisp.js
│ │ ├── lang-css.js
│ │ ├── lang-n.js
│ │ └── lang-clj.js
│ ├── menu.js
│ ├── jquery.mousewheel.min.js
│ ├── sidebar.js
│ └── jquery.cookie.js
├── css
│ ├── prettify.css
│ └── jquery.iviewer.css
├── graph_class.html
├── deprecated.html
├── index.html
└── classes
│ └── OSS_SNMP.Exception.html
├── bin
└── phpdoc.sh
├── .gitignore
├── src
└── OSS_SNMP
│ ├── MIBS
│ ├── Huawei.php
│ ├── SNMP.php
│ ├── MRV.php
│ ├── Cisco.php
│ ├── Foundry.php
│ ├── Host.php
│ ├── Extreme.php
│ ├── Extreme
│ │ ├── System.php
│ │ ├── SwMonitor.php
│ │ ├── Port.php
│ │ ├── Chassis.php
│ │ └── SwMonitor
│ │ │ ├── Cpu.php
│ │ │ └── Memory.php
│ ├── HP
│ │ └── ProCurve
│ │ │ └── Chassis.php
│ ├── MRV
│ │ └── System.php
│ ├── Ip.php
│ ├── RFC1213.php
│ ├── Huawei
│ │ └── System.php
│ ├── Cisco
│ │ └── PAGP.php
│ ├── SNMP
│ │ └── Engine.php
│ ├── Asterisk
│ │ └── Indications.php
│ ├── Bridge.php
│ └── Juniper.php
│ ├── Platforms
│ ├── vendor_ignitenet.php
│ ├── vendor_h3c.php
│ ├── dummy.php
│ ├── vendor_hitachi_cable.php
│ ├── vendor_mrv.php
│ ├── vendor_quanta.php
│ ├── vendor_netgear.php
│ ├── vendor_fiberstore.php
│ ├── vendor_arista.php
│ ├── vendor_allied-telesis.php
│ ├── vendor_hp_procurve.php
│ ├── vendor_cumulus.php
│ ├── vendor_juniper.php
│ ├── vendor_linux.php
│ ├── vendor_dell_force10.php
│ ├── vendor_huawei.php
│ └── vendor_alcatel-lucent.php
│ ├── Exception.php
│ ├── Cache.php
│ ├── Timer.php
│ ├── MIB.php
│ └── Cache
│ └── Basic.php
├── tests
└── Tests
│ └── OSS_SNMP
│ └── Platforms
│ ├── Platform.php
│ ├── AlliedTelesisTest.php
│ ├── IgniteNetTest.php
│ ├── FiberStoreTest.php
│ ├── AristaTest.php
│ ├── JuniperTest.php
│ ├── DellTest.php
│ ├── BrocadeTest.php
│ └── ExtremeTest.php
├── index.html
├── composer.json
├── phpunit.xml
├── etc
└── phpdoc.tpl.xml
├── LICENSE
├── examples
├── system-info.php
├── platform.php
├── bgp.php
├── extreme.php
└── mau.php
└── README.md
/OSS_SNMP:
--------------------------------------------------------------------------------
1 | src/OSS_SNMP
--------------------------------------------------------------------------------
/doc/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/favicon.ico
--------------------------------------------------------------------------------
/doc/img/icons/ok.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/ok.png
--------------------------------------------------------------------------------
/doc/img/loader.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/loader.gif
--------------------------------------------------------------------------------
/doc/img/icons/file.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/file.gif
--------------------------------------------------------------------------------
/doc/img/icons/class.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/class.png
--------------------------------------------------------------------------------
/doc/img/icons/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/favicon.ico
--------------------------------------------------------------------------------
/doc/img/icons/folder.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/folder.gif
--------------------------------------------------------------------------------
/doc/img/icons/method.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/method.png
--------------------------------------------------------------------------------
/doc/img/icons/search.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/search.gif
--------------------------------------------------------------------------------
/doc/img/iviewer/grab.cur:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/iviewer/grab.cur
--------------------------------------------------------------------------------
/doc/img/iviewer/hand.cur:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/iviewer/hand.cur
--------------------------------------------------------------------------------
/doc/img/icons/constant.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/constant.png
--------------------------------------------------------------------------------
/doc/img/icons/file-php.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/file-php.png
--------------------------------------------------------------------------------
/doc/img/icons/function.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/function.png
--------------------------------------------------------------------------------
/doc/img/icons/interface.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/interface.png
--------------------------------------------------------------------------------
/doc/img/icons/property.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/property.png
--------------------------------------------------------------------------------
/doc/img/icons/variable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/variable.png
--------------------------------------------------------------------------------
/doc/js/prettify/lang-go.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/js/prettify/lang-go.js
--------------------------------------------------------------------------------
/doc/js/prettify/lang-lua.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/js/prettify/lang-lua.js
--------------------------------------------------------------------------------
/doc/js/prettify/lang-ml.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/js/prettify/lang-ml.js
--------------------------------------------------------------------------------
/doc/js/prettify/lang-sql.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/js/prettify/lang-sql.js
--------------------------------------------------------------------------------
/doc/js/prettify/lang-tex.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/js/prettify/lang-tex.js
--------------------------------------------------------------------------------
/doc/js/prettify/lang-vb.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/js/prettify/lang-vb.js
--------------------------------------------------------------------------------
/doc/img/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/apple-touch-icon.png
--------------------------------------------------------------------------------
/doc/img/icons/arrow_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/arrow_down.png
--------------------------------------------------------------------------------
/doc/img/icons/arrow_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/arrow_right.png
--------------------------------------------------------------------------------
/doc/img/icons/icon-th-big.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/icon-th-big.png
--------------------------------------------------------------------------------
/doc/img/icons/view_source.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/view_source.png
--------------------------------------------------------------------------------
/doc/js/prettify/lang-apollo.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/js/prettify/lang-apollo.js
--------------------------------------------------------------------------------
/doc/js/prettify/lang-scala.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/js/prettify/lang-scala.js
--------------------------------------------------------------------------------
/doc/js/prettify/lang-vhdl.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/js/prettify/lang-vhdl.js
--------------------------------------------------------------------------------
/doc/js/prettify/lang-wiki.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/js/prettify/lang-wiki.js
--------------------------------------------------------------------------------
/doc/img/glyphicons-halflings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/glyphicons-halflings.png
--------------------------------------------------------------------------------
/doc/img/apple-touch-icon-72x72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/apple-touch-icon-72x72.png
--------------------------------------------------------------------------------
/doc/img/icons/visibility_public.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/visibility_public.png
--------------------------------------------------------------------------------
/doc/img/iviewer/iviewer.zoom_in.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/iviewer/iviewer.zoom_in.png
--------------------------------------------------------------------------------
/doc/img/apple-touch-icon-114x114.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/apple-touch-icon-114x114.png
--------------------------------------------------------------------------------
/doc/img/icons/visibility_private.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/visibility_private.png
--------------------------------------------------------------------------------
/doc/img/iviewer/iviewer.zoom_fit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/iviewer/iviewer.zoom_fit.png
--------------------------------------------------------------------------------
/doc/img/iviewer/iviewer.zoom_fit2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/iviewer/iviewer.zoom_fit2.gif
--------------------------------------------------------------------------------
/doc/img/iviewer/iviewer.zoom_in2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/iviewer/iviewer.zoom_in2.gif
--------------------------------------------------------------------------------
/doc/img/iviewer/iviewer.zoom_out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/iviewer/iviewer.zoom_out.png
--------------------------------------------------------------------------------
/doc/img/iviewer/iviewer.zoom_out2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/iviewer/iviewer.zoom_out2.gif
--------------------------------------------------------------------------------
/doc/img/iviewer/iviewer.zoom_zero.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/iviewer/iviewer.zoom_zero.png
--------------------------------------------------------------------------------
/doc/img/glyphicons-halflings-white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/glyphicons-halflings-white.png
--------------------------------------------------------------------------------
/doc/img/icons/icon-folder-open-big.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/icon-folder-open-big.png
--------------------------------------------------------------------------------
/doc/img/icons/visibility_protected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/icons/visibility_protected.png
--------------------------------------------------------------------------------
/doc/img/iviewer/iviewer.rotate_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/iviewer/iviewer.rotate_left.png
--------------------------------------------------------------------------------
/doc/img/iviewer/iviewer.rotate_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/iviewer/iviewer.rotate_right.png
--------------------------------------------------------------------------------
/doc/img/iviewer/iviewer.zoom_zero2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensolutions/OSS_SNMP/HEAD/doc/img/iviewer/iviewer.zoom_zero2.gif
--------------------------------------------------------------------------------
/bin/phpdoc.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | ROOT=`dirname $0`/..
4 |
5 | phpdoc -c $ROOT/etc/phpdoc.tpl.xml -d $ROOT/OSS_SNMP -t $ROOT/doc/ $*
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .buildpath
2 | .idea/
3 | .project
4 | .settings/
5 | *~
6 | *.DS_Store
7 | doc/phpdoc-cache-*
8 | *~
9 | vendor/
10 | .phpunit.result.cache
11 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/Huawei.php:
--------------------------------------------------------------------------------
1 | setVendor( 'IgniteNet' );
9 | $this->setModel( "FNS-SFP-24" );
10 | $this->setOs( null );
11 | $this->setOsVersion( null );
12 | $this->setOsDate( null );
13 | }
14 |
--------------------------------------------------------------------------------
/doc/js/prettify/lang-yaml.js:
--------------------------------------------------------------------------------
1 | var a=null;
2 | PR.registerLangHandler(PR.createSimpleLexer([["pun",/^[:>?|]+/,a,":|>?"],["dec",/^%(?:YAML|TAG)[^\n\r#]+/,a,"%"],["typ",/^&\S+/,a,"&"],["typ",/^!\S*/,a,"!"],["str",/^"(?:[^"\\]|\\.)*(?:"|$)/,a,'"'],["str",/^'(?:[^']|'')*(?:'|$)/,a,"'"],["com",/^#[^\n\r]*/,a,"#"],["pln",/^\s+/,a," \t\r\n"]],[["dec",/^(?:---|\.\.\.)(?:[\n\r]|$)/],["pun",/^-/],["kwd",/^\w+:[\n\r ]/],["pln",/^\w+/]]),["yaml","yml"]);
3 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Open Solutions' OSS_SNMP Project
4 |
5 |
6 |
7 |
8 | Open Solutions' OSS_SNMP Project
9 |
10 | This is just a holding page, please see:
11 |
12 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "opensolutions/oss-snmp",
3 | "description": "A PHP SNMP library for people who hate SNMP, MIBs and OIDs!",
4 | "keywords": ["oss", "opensolutions", "snmp", "oss_snmp", "oss-snmp"],
5 | "license": "BSD-3-Clause",
6 | "require": {
7 | "php": ">=5.4.0"
8 | },
9 | "require-dev": {
10 | "phpunit/phpunit": "9.*"
11 | },
12 | "autoload": {
13 | "psr-0": {
14 | "OSS_SNMP": "src/",
15 | "Tests": "tests/"
16 | }
17 | },
18 | "minimum-stability": "dev"
19 | }
20 |
--------------------------------------------------------------------------------
/doc/js/prettify/lang-hs.js:
--------------------------------------------------------------------------------
1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t-\r ]+/,null,"\t\n\r "],["str",/^"(?:[^\n\f\r"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["str",/^'(?:[^\n\f\r'\\]|\\[^&])'?/,null,"'"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,null,"0123456789"]],[["com",/^(?:--+[^\n\f\r]*|{-(?:[^-]|-+[^}-])*-})/],["kwd",/^(?:case|class|data|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|module|newtype|of|then|type|where|_)(?=[^\d'A-Za-z]|$)/,
2 | null],["pln",/^(?:[A-Z][\w']*\.)*[A-Za-z][\w']*/],["pun",/^[^\d\t-\r "'A-Za-z]+/]]),["hs"]);
3 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 | ./tests
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/doc/css/prettify.css:
--------------------------------------------------------------------------------
1 | .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
--------------------------------------------------------------------------------
/tests/Tests/OSS_SNMP/Platforms/AlliedTelesisTest.php:
--------------------------------------------------------------------------------
1 | assertEquals( $p->getVendor(), 'Allied Telesis' );
19 | $this->assertEquals( $p->getModel(), 'Unknown' );
20 | $this->assertEquals( $p->getOs(), 'AW+' );
21 | $this->assertEquals( $p->getOsVersion(), '5.4.7-2.5' );
22 |
23 | $this->assertNull( $p->getOsDate() );
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/doc/js/prettify/lang-lisp.js:
--------------------------------------------------------------------------------
1 | var a=null;
2 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,a,"("],["clo",/^\)+/,a,")"],["com",/^;[^\n\r]*/,a,";"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \xa0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/,a],
3 | ["lit",/^[+-]?(?:[#0]x[\da-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[de][+-]?\d+)?)/i],["lit",/^'(?:-*(?:\w|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?)?/],["pln",/^-*(?:[_a-z]|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?/i],["pun",/^[^\w\t\n\r "'-);\\\xa0]+/]]),["cl","el","lisp","scm"]);
4 |
--------------------------------------------------------------------------------
/doc/js/menu.js:
--------------------------------------------------------------------------------
1 | var timeout = 500;
2 | var closetimer = 0;
3 | var ddmenuitem = 0;
4 |
5 | function menu_open() {
6 | menu_canceltimer();
7 | menu_close();
8 | ddmenuitem = $(this).find('ul').css('visibility', 'visible');
9 | }
10 |
11 | function menu_close() {
12 | if (ddmenuitem) ddmenuitem.css('visibility', 'hidden');
13 | }
14 |
15 | function menu_timer() {
16 | closetimer = window.setTimeout(menu_close, timeout);
17 | }
18 |
19 | function menu_canceltimer() {
20 | if (closetimer) {
21 | window.clearTimeout(closetimer);
22 | closetimer = null;
23 | }
24 | }
25 |
26 | $(document).ready(function() {
27 | $('#file-nav > li').bind('mouseover', menu_open);
28 | $('#file-nav > li').bind('mouseout', menu_timer);
29 | });
30 |
31 | document.onclick = menu_close;
--------------------------------------------------------------------------------
/tests/Tests/OSS_SNMP/Platforms/IgniteNetTest.php:
--------------------------------------------------------------------------------
1 | assertEquals( $p->getVendor(), 'IgniteNet' );
23 | $this->assertNull( $p->getOs() );
24 | $this->assertNull( $p->getOsVersion() );
25 | $this->assertNull( $p->getOsDate() );
26 | $this->assertEquals( $p->getModel(), 'FNS-SFP-24' );
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/doc/js/prettify/lang-css.js:
--------------------------------------------------------------------------------
1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n"]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com",
2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]);
3 |
--------------------------------------------------------------------------------
/tests/Tests/OSS_SNMP/Platforms/FiberStoreTest.php:
--------------------------------------------------------------------------------
1 | assertEquals( 'FiberStore', $p->getVendor() );
25 | $this->assertEquals( 'FSOS', $p->getOs() );
26 | $this->assertEquals( '7.2.2', $p->getOsVersion() );
27 | $this->assertNull( $p->getOsDate() );
28 | $this->assertEquals( 'S5850 48S6Q', $p->getModel() );
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/etc/phpdoc.tpl.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | OSS_SNMP
5 |
6 | - TODO
7 | - FIXME
8 |
9 |
10 | php
11 | php3
12 | phtml
13 |
14 |
15 |
16 |
17 | on
18 | on
19 | OSS_SNMP
20 |
21 |
22 | output
23 |
24 |
25 | warn
26 |
27 | {APP_ROOT}/data/log/{DATE}.log
28 | {APP_ROOT}/data/log/{DATE}.errors.log
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/doc/js/prettify/lang-n.js:
--------------------------------------------------------------------------------
1 | var a=null;
2 | PR.registerLangHandler(PR.createSimpleLexer([["str",/^(?:'(?:[^\n\r'\\]|\\.)*'|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,a,'"'],["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,a,"#"],["pln",/^\s+/,a," \r\n\t\xa0"]],[["str",/^@"(?:[^"]|"")*(?:"|$)/,a],["str",/^<#[^#>]*(?:#>|$)/,a],["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,a],["com",/^\/\/[^\n\r]*/,a],["com",/^\/\*[\S\s]*?(?:\*\/|$)/,
3 | a],["kwd",/^(?:abstract|and|as|base|catch|class|def|delegate|enum|event|extern|false|finally|fun|implements|interface|internal|is|macro|match|matches|module|mutable|namespace|new|null|out|override|params|partial|private|protected|public|ref|sealed|static|struct|syntax|this|throw|true|try|type|typeof|using|variant|virtual|volatile|when|where|with|assert|assert2|async|break|checked|continue|do|else|ensures|for|foreach|if|late|lock|new|nolate|otherwise|regexp|repeat|requires|return|surroundwith|unchecked|unless|using|while|yield)\b/,
4 | a],["typ",/^(?:array|bool|byte|char|decimal|double|float|int|list|long|object|sbyte|short|string|ulong|uint|ufloat|ulong|ushort|void)\b/,a],["lit",/^@[$_a-z][\w$@]*/i,a],["typ",/^@[A-Z]+[a-z][\w$@]*/,a],["pln",/^'?[$_a-z][\w$@]*/i,a],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,a,"0123456789"],["pun",/^.[^\s\w"-$'./@`]*/,a]]),["n","nemerle"]);
5 |
--------------------------------------------------------------------------------
/tests/Tests/OSS_SNMP/Platforms/AristaTest.php:
--------------------------------------------------------------------------------
1 | assertEquals( 'Arista', $p->getVendor() );
23 | $this->assertEquals( 'DCS-7504', $p->getModel() );
24 | $this->assertEquals( 'EOS', $p->getOs() );
25 | $this->assertEquals( '4.14.2F', $p->getOsVersion() );
26 | $this->assertNull( $p->getOsDate() );
27 | }
28 |
29 | const ARISTA_B = 'Arista Networks EOS version 4.17.3F running on an Arista Networks DCS-7050SX-96-SSD';
30 |
31 | public function testAristaB() {
32 |
33 | $p = new TestOSSPlatform( self::ARISTA_B );
34 |
35 | $this->assertEquals( 'Arista', $p->getVendor() );
36 | $this->assertEquals( 'DCS-7050SX-96-SSD', $p->getModel() );
37 | $this->assertEquals( 'EOS', $p->getOs() );
38 | $this->assertEquals( '4.17.3F', $p->getOsVersion() );
39 | $this->assertNull( $p->getOsDate() );
40 | }
41 |
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/doc/js/jquery.mousewheel.min.js:
--------------------------------------------------------------------------------
1 | /*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
2 | * Licensed under the MIT License (LICENSE.txt).
3 | *
4 | * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
5 | * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
6 | * Thanks to: Seamus Leahy for adding deltaX and deltaY
7 | *
8 | * Version: 3.0.6
9 | *
10 | * Requires: 1.2.2+
11 | */
12 | (function(d){function e(a){var b=a||window.event,c=[].slice.call(arguments,1),f=0,e=0,g=0,a=d.event.fix(b);a.type="mousewheel";b.wheelDelta&&(f=b.wheelDelta/120);b.detail&&(f=-b.detail/3);g=f;b.axis!==void 0&&b.axis===b.HORIZONTAL_AXIS&&(g=0,e=-1*f);b.wheelDeltaY!==void 0&&(g=b.wheelDeltaY/120);b.wheelDeltaX!==void 0&&(e=-1*b.wheelDeltaX/120);c.unshift(a,f,e,g);return(d.event.dispatch||d.event.handle).apply(this,c)}var c=["DOMMouseScroll","mousewheel"];if(d.event.fixHooks)for(var h=c.length;h;)d.event.fixHooks[c[--h]]=
13 | d.event.mouseHooks;d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=c.length;a;)this.addEventListener(c[--a],e,false);else this.onmousewheel=e},teardown:function(){if(this.removeEventListener)for(var a=c.length;a;)this.removeEventListener(c[--a],e,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);
--------------------------------------------------------------------------------
/doc/js/sidebar.js:
--------------------------------------------------------------------------------
1 | jQuery.expr[':'].Contains = function(a, i, m) {
2 | return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
3 | };
4 |
5 | $(function() {
6 | $("#sidebar-nav").accordion({
7 | autoHeight: false,
8 | navigation: true,
9 | collapsible: true
10 | }).accordion("activate", false)
11 | .find('a.link').unbind('click').click(
12 | function(ev) {
13 | ev.cancelBubble = true; // IE
14 | if (ev.stopPropagation) {
15 | ev.stopPropagation(); // the rest
16 | }
17 |
18 | return true;
19 | }).prev().prev().remove();
20 |
21 | $("#sidebar-nav>h3").click(function() {
22 | if ($(this).attr('initialized') == 'true') return;
23 |
24 | $(this).next().find(".sidebar-nav-tree").treeview({
25 | collapsed: true,
26 | persist: "cookie"
27 | });
28 | $(this).attr('initialized', true);
29 | });
30 | });
31 |
32 | function tree_search(input) {
33 | treeview = $(input).parent().parent().next();
34 |
35 | // Expand all items
36 | treeview.find('.expandable-hitarea').click();
37 |
38 | // make all items visible again
39 | treeview.find('li:hidden').show();
40 |
41 | // hide all items that do not match the given search criteria
42 | if ($(input).val()) {
43 | treeview.find('li').not(':has(a:Contains(' + $(input).val() + '))').hide();
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/doc/js/prettify/lang-clj.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2011 Google Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | var a=null;
17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^[([{]+/,a,"([{"],["clo",/^[)\]}]+/,a,")]}"],["com",/^;[^\n\r]*/,a,";"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \xa0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:def|if|do|let|quote|var|fn|loop|recur|throw|try|monitor-enter|monitor-exit|defmacro|defn|defn-|macroexpand|macroexpand-1|for|doseq|dosync|dotimes|and|or|when|not|assert|doto|proxy|defstruct|first|rest|cons|defprotocol|deftype|defrecord|reify|defmulti|defmethod|meta|with-meta|ns|in-ns|create-ns|import|intern|refer|alias|namespace|resolve|ref|deref|refset|new|set!|memfn|to-array|into-array|aset|gen-class|reduce|map|filter|find|nil?|empty?|hash-map|hash-set|vec|vector|seq|flatten|reverse|assoc|dissoc|list|list?|disj|get|union|difference|intersection|extend|extend-type|extend-protocol|prn)\b/,a],
18 | ["typ",/^:[\dA-Za-z-]+/]]),["clj"]);
19 |
--------------------------------------------------------------------------------
/tests/Tests/OSS_SNMP/Platforms/JuniperTest.php:
--------------------------------------------------------------------------------
1 | assertEquals( 'Juniper Networks', $p->getVendor() );
23 | $this->assertEquals( 'ex4500-40f', $p->getModel() );
24 | $this->assertEquals( 'JUNOS', $p->getOs() );
25 | $this->assertEquals( '12.3R3.4', $p->getOsVersion() );
26 | $this->assertEquals( '2013-06-14 01:37:19', $p->getOsDate()->format('Y-m-d H:i:s') );
27 | }
28 |
29 | // https://github.com/opensolutions/OSS_SNMP/issues/62
30 | const JUNIPER_B = 'Juniper Networks EX3400 Ethernet Switch , Junos OS Release 15.1X53-D5x EX series';
31 |
32 | public function testJuniperB() {
33 |
34 | $p = new TestOSSPlatform( self::JUNIPER_B );
35 |
36 | $this->assertEquals( 'Juniper Networks', $p->getVendor() );
37 | $this->assertEquals( 'EX3400', $p->getModel() );
38 | $this->assertEquals( 'JUNOS', $p->getOs() );
39 | $this->assertEquals( '15.1X53-D5x', $p->getOsVersion() );
40 | $this->assertNull( $p->getOsDate() );
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
2 | All rights reserved.
3 |
4 | Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
5 | http://www.opensolutions.ie/
6 |
7 | This file is part of the OSS_SNMP package.
8 |
9 | Redistribution and use in source and binary forms, with or without
10 | modification, are permitted provided that the following conditions are met:
11 |
12 | * Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 | * Redistributions in binary form must reproduce the above copyright
15 | notice, this list of conditions and the following disclaimer in the
16 | documentation and/or other materials provided with the distribution.
17 | * Neither the name of Open Source Solutions Limited nor the
18 | names of its contributors may be used to endorse or promote products
19 | derived from this software without specific prior written permission.
20 |
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
25 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 |
--------------------------------------------------------------------------------
/tests/Tests/OSS_SNMP/Platforms/DellTest.php:
--------------------------------------------------------------------------------
1 | assertEquals( $p->getVendor(), 'Dell Force10' );
23 | $this->assertEquals( $p->getModel(), 'S4810' );
24 | $this->assertEquals( $p->getOs(), 'FTOS 1.0' );
25 | $this->assertEquals( $p->getOsVersion(), '8.3.12.1' );
26 |
27 | $dt = new \DateTime( "2012/11/18 11:05:15 +0000" );
28 | $dt->setTimezone( new \DateTimeZone( 'UTC' ) );
29 | $this->assertEquals( $dt, $p->getOsDate() );
30 | }
31 |
32 | const DELL_B = 'Dell Networking OS Operating System Version: 2.0 Application Software Version: 9.6(0.0) Series: S4810 Copyright (c) 1999-2014 by Dell Inc. All Rights Reserved. Build Time: Sun Sep 28 10:02:15 2014';
33 |
34 | public function testB() {
35 |
36 | $p = new TestOSSPlatform( self::DELL_B, '' );
37 |
38 | $this->assertEquals( $p->getVendor(), 'Dell Networking' );
39 | $this->assertEquals( $p->getModel(), 'S4810' );
40 | $this->assertEquals( $p->getOs(), 'FTOS 2.0' );
41 | $this->assertEquals( $p->getOsVersion(), '9.6(0.0)' );
42 |
43 | $dt = new \DateTime( "2014/09/28 10:02:15 +0000" );
44 | $dt->setTimezone( new \DateTimeZone( 'UTC' ) );
45 | $this->assertEquals( $dt, $p->getOsDate() );
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/Platforms/vendor_h3c.php:
--------------------------------------------------------------------------------
1 | setVendor( 'H3C' );
14 | try {
15 | $this->setModel( $this->getSNMPHost()->useEntity()->physicalName()[1] );
16 | } catch( \OSS_SNMP\Exception $e ) {
17 | $this->setModel( 'Unknown' );
18 | }
19 | $this->setOs( 'Comware' );
20 | $this->setOsVersion( $matches[2] );
21 | $this->setOsDate( null );
22 | }
23 | else if( substr( $sysDescr, 0, 10 ) == 'H3C Switch' )
24 | {
25 | $sysDescr = trim( preg_replace( '/\s+/', ' ', $sysDescr ) );
26 | preg_match( '/H3C Switch (.+) Software Version (.+)Copyright/',
27 | $sysDescr, $matches );
28 |
29 | $this->setVendor( 'H3C' );
30 | $this->setModel( $matches[1] );
31 | $this->setOs( null );
32 | $this->setOsVersion( $matches[2] );
33 | $this->setOsDate( null );
34 | }
35 | else if( substr( $sysDescr, 0, 29 ) == 'H3C Comware Platform Software' )
36 | {
37 | $sysDescr = trim( preg_replace( '/\s+/', ' ', $sysDescr ) );
38 | preg_match( '/H3C Comware Platform Software, Software Version (.+) H3C (.+)Copyright/',
39 | $sysDescr, $matches );
40 |
41 | $this->setVendor( 'H3C' );
42 | $this->setModel( $matches[2] );
43 | $this->setOs( 'Comware' );
44 | $this->setOsVersion( $matches[1] );
45 | $this->setOsDate( null );
46 | }
47 |
--------------------------------------------------------------------------------
/doc/css/jquery.iviewer.css:
--------------------------------------------------------------------------------
1 | .iviewer_common {
2 | position:absolute;
3 | bottom:10px;
4 | border: 1px solid #000;
5 | height: 28px;
6 | z-index: 5000;
7 | }
8 |
9 | .iviewer_cursor {
10 | cursor: url(../img/iviewer/hand.cur) 6 8, pointer;
11 | }
12 |
13 | .iviewer_drag_cursor {
14 | cursor: url(../img/iviewer/grab.cur) 6 8, pointer;
15 | }
16 |
17 | .iviewer_button {
18 | width: 28px;
19 | cursor: pointer;
20 | background-position: center center;
21 | background-repeat: no-repeat;
22 | }
23 |
24 | .iviewer_zoom_in {
25 | left: 20px;
26 | background: url(../img/iviewer/iviewer.zoom_in.png);
27 | }
28 |
29 | .iviewer_zoom_out {
30 | left: 55px;
31 | background: url(../img/iviewer/iviewer.zoom_out.png);
32 | }
33 |
34 | .iviewer_zoom_zero {
35 | left: 90px;
36 | background: url(../img/iviewer/iviewer.zoom_zero.png);
37 | }
38 |
39 | .iviewer_zoom_fit {
40 | left: 125px;
41 | background: url(../img/iviewer/iviewer.zoom_fit.png);
42 | }
43 |
44 | .iviewer_zoom_status {
45 | left: 160px;
46 | font: 1em/28px Sans;
47 | color: #000;
48 | background-color: #fff;
49 | text-align: center;
50 | width: 60px;
51 | }
52 |
53 | .iviewer_rotate_left {
54 | left: 227px;
55 | background: #fff url(../img/iviewer/iviewer.rotate_left.png) center center no-repeat;
56 | }
57 |
58 | .iviewer_rotate_right {
59 | left: 262px;
60 | background: #fff url(../img/iviewer/iviewer.rotate_right.png) center center no-repeat;
61 | }
62 |
63 | .viewer
64 | {
65 | width: 100%;
66 | height: 500px;
67 | position: relative;
68 | background: transparent url('../img/loader.gif') no-repeat center center;
69 | }
70 |
71 | .viewer img
72 | {
73 | max-width: none;
74 | }
75 |
76 | .wrapper
77 | {
78 | overflow: hidden;
79 | }
80 |
81 | .iviewer_common
82 | {
83 | border: 0;
84 | bottom: auto;
85 | top: 10px;
86 | }
87 |
88 | .iviewer_zoom_status
89 | {
90 | border: 1px solid black;
91 | }
92 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/Exception.php:
--------------------------------------------------------------------------------
1 | setVendor( 'Brocade' );
37 | $this->setModel( 'FESX648' );
38 | $this->setOs( 'Dummy' );
39 | $this->setOsVersion( '1.2.3' );
40 | $this->setOsDate( date('Y-m-d H:i:s' ) );
41 | $this->setSerialNumber( 'ABC987654321' );
42 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/SNMP.php:
--------------------------------------------------------------------------------
1 |
43 | */
44 | class SNMP extends \OSS_SNMP\MIB
45 | {
46 | }
47 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/MRV.php:
--------------------------------------------------------------------------------
1 |
43 | */
44 | class MRV extends \OSS_SNMP\MIB
45 | {
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/Cisco.php:
--------------------------------------------------------------------------------
1 |
43 | */
44 | class Cisco extends \OSS_SNMP\MIB
45 | {
46 |
47 |
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/Foundry.php:
--------------------------------------------------------------------------------
1 |
43 | */
44 | class Foundry extends \OSS_SNMP\MIB
45 | {
46 | }
47 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/Host.php:
--------------------------------------------------------------------------------
1 |
43 | */
44 | class Host extends \OSS_SNMP\MIB
45 | {
46 |
47 |
48 | }
49 |
50 |
51 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/Extreme.php:
--------------------------------------------------------------------------------
1 |
43 | */
44 | class Extreme extends \OSS_SNMP\MIB
45 | {
46 |
47 |
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/Extreme/System.php:
--------------------------------------------------------------------------------
1 |
45 | */
46 | class System extends \OSS_SNMP\MIBS\Extreme
47 | {
48 | }
49 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/Extreme/SwMonitor.php:
--------------------------------------------------------------------------------
1 |
45 | */
46 | class SwMonitor extends \OSS_SNMP\MIBS\Extreme
47 | {
48 | }
49 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/Extreme/Port.php:
--------------------------------------------------------------------------------
1 |
44 | */
45 | class Port extends \OSS_SNMP\MIBS\Extreme
46 | {
47 | const OID_PORT_CONG_DROP_PKTS = '.1.3.6.1.4.1.1916.1.4.14.1.1';
48 |
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/Platforms/vendor_hitachi_cable.php:
--------------------------------------------------------------------------------
1 | setVendor( $matches[1] );
39 | $this->setModel( $matches[2] );
40 | $this->setOs( 'hitachi os' );
41 | $this->setOsVersion( $matches[3] );
42 |
43 | if( preg_match( '/Build date: (\d\d\d\d-\d\d-\d\d) (\d\d:\d\d:\d\d) ([A-Za-z]+)/', $sysDescr, $d ) )
44 | {
45 | $this->setOsDate( new \DateTime( "{$d[1]} {$d[2]} +00:00") );
46 | $this->getOsDate()->setTimezone( new \DateTimeZone( $d[3] ) );
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/Platforms/vendor_mrv.php:
--------------------------------------------------------------------------------
1 | setVendor( 'MRV' );
46 | $this->setModel( $this->getSNMPHost()->useMRV_System()->model() );
47 | $this->setOs( $this->getSNMPHost()->useMRV_System()->osImage() );
48 | $this->setOsVersion( $matches[1] );
49 | $this->setOsDate( null );
50 | }
51 |
52 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/Platforms/vendor_quanta.php:
--------------------------------------------------------------------------------
1 | setVendor( 'Quanta' );
41 | $this->setModel( "Quanta" );
42 | $this->setOs( 'VxWorks' );
43 | $this->setOsVersion( null );
44 | $this->setOsDate( null );
45 |
46 | try {
47 | $this->setSerialNumber( $this->getSNMPHost()->get( '.1.3.6.1.2.1.47.1.1.1.1.11.1' ) );
48 | } catch( Exception $e ) {
49 | $this->setSerialNumber( '(error)' );
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/tests/Tests/OSS_SNMP/Platforms/BrocadeTest.php:
--------------------------------------------------------------------------------
1 | assertEquals( $p->getVendor(), 'Brocade' );
23 | $this->assertEquals( $p->getModel(), 'FESX624+2XG' );
24 | $this->assertEquals( $p->getOs(), 'IronWare' );
25 | $this->assertEquals( $p->getOsVersion(), '07.3.00cT3e1' );
26 |
27 | $dt = new \DateTime( "2012/04/25 17:01:00 +0000" );
28 | $dt->setTimezone( new \DateTimeZone( 'UTC' ) );
29 | $this->assertEquals( $dt, $p->getOsDate() );
30 | }
31 |
32 | const BROCADE_B = 'Foundry Networks, Inc. FES12GCF, IronWare Version 04.1.01eTc1 Compiled on Mar 06 2011 at 17:05:36 labeled as FES04101e';
33 |
34 | public function testB() {
35 |
36 | $p = new TestOSSPlatform( self::BROCADE_B, '' );
37 |
38 | $this->assertEquals( 'Foundry Networks', $p->getVendor() );
39 | $this->assertEquals( 'FES12GCF', $p->getModel() );
40 | $this->assertEquals( 'IronWare', $p->getOs() );
41 | $this->assertEquals( '04.1.01eTc1', $p->getOsVersion() );
42 |
43 | $dt = new \DateTime( "2011/03/06 17:05:36 +0000" );
44 | $dt->setTimezone( new \DateTimeZone( 'UTC' ) );
45 | $this->assertEquals( $dt, $p->getOsDate() );
46 | }
47 |
48 | const BROCADE_C = 'Foundry Networks, Inc. BigIron RX, IronWare Version V2.7.2aT143 Compiled on Sep 29 2009 at 17:15:24 labeled as V2.7.02a';
49 |
50 | public function testC() {
51 |
52 | $p = new TestOSSPlatform( self::BROCADE_C, '' );
53 |
54 | $this->assertEquals( $p->getVendor(), 'Foundry Networks' );
55 | $this->assertEquals( $p->getModel(), 'BigIron RX' );
56 | $this->assertEquals( $p->getOs(), 'IronWare' );
57 | $this->assertEquals( $p->getOsVersion(), 'V2.7.2aT143' );
58 |
59 | $dt = new \DateTime( "2009/09/29 17:15:24 +0000" );
60 | $dt->setTimezone( new \DateTimeZone( 'UTC' ) );
61 | $this->assertEquals( $dt, $p->getOsDate() );
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/Platforms/vendor_netgear.php:
--------------------------------------------------------------------------------
1 | setVendor( 'Netgear' );
50 | $this->setModel( $sysDescr );
51 | $this->setOs( 'Netgear' );
52 | $this->setOsVersion( $this->getSNMPHost()->get( '.1.3.6.1.4.1.4526.17.2.4.0' ) );
53 | $this->setOsDate( null );
54 | }
55 |
56 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/Platforms/vendor_fiberstore.php:
--------------------------------------------------------------------------------
1 | setVendor( 'FiberStore' );
46 | $this->setOs( 'FSOS' );
47 |
48 | preg_match( '/FSOS\s+software,\s+[\w]+\s+software\s+\(([\w\s]+)\),\s+Version\s+([\w.]+).*/',
49 | $sysDescr, $matches );
50 |
51 | $this->setModel( $matches[1] );
52 | $this->setOsVersion( $matches[2] );
53 | $this->setOsDate( null );
54 | }
55 |
56 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/Platforms/vendor_arista.php:
--------------------------------------------------------------------------------
1 | setVendor( 'Arista' );
48 | $this->setModel( isset( $matches[2] ) ? $matches[2] : 'Unknown' );
49 | $this->setOs( 'EOS' );
50 | $this->setOsVersion( isset( $matches[1] ) ? $matches[1] : 'Unknown' );
51 | $this->setOsDate( null );
52 | }
53 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/Cache.php:
--------------------------------------------------------------------------------
1 |
47 | */
48 | abstract class Cache
49 | {
50 |
51 | abstract protected function save( $varName, $varValue );
52 | abstract protected function load( $varName );
53 | abstract protected function clear( $varName );
54 | abstract protected function clearAll();
55 |
56 | }
57 |
58 |
59 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/HP/ProCurve/Chassis.php:
--------------------------------------------------------------------------------
1 |
43 | */
44 | class Chassis extends \OSS_SNMP\MIBS\Foundry
45 | {
46 |
47 | const OID_SERIAL_NUMBER = '.1.3.6.1.4.1.11.2.36.1.1.2.9.0';
48 |
49 |
50 | /**
51 | * Get the device's serial number
52 | *
53 | * @return string The chassis serial number
54 | */
55 | public function serialNumber()
56 | {
57 | return $this->getSNMP()->get( self::OID_SERIAL_NUMBER );
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/Platforms/vendor_allied-telesis.php:
--------------------------------------------------------------------------------
1 | setVendor( 'Allied Telesis' );
45 | $this->setOs( 'AW+' );
46 |
47 | preg_match( '/Allied Telesis router\/switch, AW\+ v([0-9\-\.]+)/',
48 | $sysDescr, $matches );
49 |
50 | if( $sysObjectId && $sysObjectId == '.1.3.6.1.4.1.207.1.14.118' ) {
51 | $this->setModel('AT-28GTX');
52 | } else {
53 | $this->setModel('Unknown');
54 | }
55 |
56 | $this->setOsVersion( isset( $matches[1] ) ? $matches[1] : 'Unknown' );
57 | $this->setOsDate( null );
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/Extreme/Chassis.php:
--------------------------------------------------------------------------------
1 |
43 | */
44 | class Chassis extends \OSS_SNMP\MIBS\Extreme
45 | {
46 |
47 | const OID_SYSTEM_ID = '.1.3.6.1.4.1.1916.1.1.1.16.0';
48 |
49 |
50 | /**
51 | * Get the device's system id
52 | *
53 | * @return string The system ID (includes the serial number)
54 | */
55 | public function systemID()
56 | {
57 | return $this->getSNMP()->get( self::OID_SYSTEM_ID );
58 | }
59 |
60 |
61 | }
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/Timer.php:
--------------------------------------------------------------------------------
1 |
43 | */
44 | class Timer
45 | {
46 | /** @type double The start time */
47 | static private $_start = null;
48 |
49 | /** @var double The elapsed time */
50 | static private $_time = null;
51 |
52 | static public function start()
53 | {
54 | self::$_start = microtime( true );
55 | }
56 |
57 | static public function end()
58 | {
59 | self::$_time = microtime( true ) - self::$_start;
60 | }
61 |
62 | static public function time()
63 | {
64 | return self::$_time;
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIB.php:
--------------------------------------------------------------------------------
1 |
43 | */
44 | class MIB
45 | {
46 | /**
47 | * Instance for the SNMP object
48 | */
49 | private $_snmp = null;
50 |
51 |
52 | /**
53 | * Set the SNMP instance
54 | *
55 | * @param \OSS_SNMP\SNMP $snmp the SNMP instance
56 | * @return \OSS_SNMP\MIB An instance of this class for fluent interfaces
57 | */
58 | public function setSNMP( $snmp )
59 | {
60 | $this->_snmp = $snmp;
61 | }
62 |
63 | /**
64 | * Get the SNMP instance
65 | *
66 | * @return \OSS_SNMP\SNMP Instance of the SNMP object
67 | */
68 | public function getSNMP()
69 | {
70 | return $this->_snmp;
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/Extreme/SwMonitor/Cpu.php:
--------------------------------------------------------------------------------
1 |
45 | */
46 | class Cpu extends \OSS_SNMP\MIBS\Extreme\SwMonitor
47 | {
48 |
49 | const OID_TOTAL_UTILIZATION = '.1.3.6.1.4.1.1916.1.32.1.2.0';
50 |
51 | /**
52 | * Total CPU utlization (percentage) as of last sampling.
53 | *
54 | * @return int Total CPU utlization (percentage) as of last sampling.
55 | */
56 | public function totalUtilization()
57 | {
58 | return $this->getSNMP()->get( self::OID_TOTAL_UTILIZATION );
59 | }
60 |
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/Platforms/vendor_hp_procurve.php:
--------------------------------------------------------------------------------
1 | setVendor( 'Hewlett-Packard' );
47 | $this->setModel( "Procurve Switch {$matches[2]} ({$matches[1]})" );
48 | $this->setOs( 'ProCurve' );
49 | $this->setOsVersion( $matches[3] );
50 | $this->setOsDate( null );
51 | //$this->getOsDate()->setTimezone( new \DateTimeZone( 'UTC' ) );
52 | }
53 |
54 | try {
55 | $this->setSerialNumber( $this->getSNMPHost()->useHP_ProCurve_Chassis()->serialNumber() );
56 | } catch( Exception $e ) {
57 | $this->setSerialNumber( '(error)' );
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/Platforms/vendor_cumulus.php:
--------------------------------------------------------------------------------
1 | setVendor( 'Cumulus Networks' );
39 | $this->setOs( 'Cumulus Linux' );
40 | $this->setOsDate( null );
41 |
42 | // 'Cumulus Linux 3.4.0 (Linux Kernel 4.1.33-1+cl3u9)'
43 | // 'Cumulus-Linux 4.2.0 (Linux Kernel 4.19.94-1+cl4u5)'
44 | // 'Cumulus-linux 5.10.1 (Linux Kernel 6.1.90-4+cl5.10.1u5)'
45 | preg_match( '/Cumulus.[lL]inux\s+([\d\.]+)\s+/', $sysDescr, $matches );
46 | $this->setOsVersion( $matches[1] );
47 |
48 | // 'Edgecore x86_64-accton_as5812_54x-r0 5812-54X-O-AC-F Chassis'
49 | // 'Mellanox x86_64-mlnx_x86-r0 MSN2100 Chassis'
50 | preg_match( '/^(\S+)\s+.*\s+(\S+)\s+Chassis/',
51 | $this->getSNMPHost()->get( '.1.3.6.1.2.1.47.1.1.1.1.2.1' ), $matches );
52 |
53 | $this->setModel( $matches[1]." ".$matches[2] );
54 |
55 | $this->setSerialNumber( $this->getSNMPHost()->get( '.1.3.6.1.2.1.47.1.1.1.1.11.1' ) );
56 | }
57 |
--------------------------------------------------------------------------------
/examples/system-info.php:
--------------------------------------------------------------------------------
1 | #! /usr/bin/php
2 | useSystem()->getAll() );
73 |
74 | echo "\n\n";
75 |
76 | exit( 0 );
77 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/MRV/System.php:
--------------------------------------------------------------------------------
1 |
48 | */
49 | class System extends \OSS_SNMP\MIB
50 | {
51 |
52 | const OID_MRV_OS_IMAGE = '.1.3.6.1.4.1.33.100.1.1.1.0';
53 | const OID_MRV_MODEL = '.1.3.6.1.4.1.33.100.1.1.12.0';
54 |
55 | /**
56 | * Returns the operating system image name
57 | *
58 | * @return string The operating system image name
59 | */
60 | public function osImage()
61 | {
62 | return $this->getSNMP()->get( self::OID_MRV_OS_IMAGE );
63 | }
64 |
65 | /**
66 | * Returns the hardware model
67 | *
68 | * @return string The hardware model
69 | */
70 | public function model()
71 | {
72 | return $this->getSNMP()->get( self::OID_MRV_MODEL );
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/Platforms/vendor_juniper.php:
--------------------------------------------------------------------------------
1 | setVendor($matches[1]);
39 | $this->setModel($matches[2]);
40 | $this->setOs($matches[3]);
41 | $this->setOsVersion($matches[4]);
42 |
43 | if (preg_match('/Build date: (\d\d\d\d-\d\d-\d\d) (\d\d:\d\d:\d\d) ([A-Za-z]+)/', $sysDescr, $d)) {
44 | $this->setOsDate(new \DateTime("{$d[1]} {$d[2]} +00:00"));
45 | $tz = in_array($d[3], \DateTimeZone::listIdentifiers()) ? $d[3] : 'UTC';
46 | $this->getOsDate()->setTimezone(new \DateTimeZone($tz));
47 | }
48 |
49 | }
50 |
51 | // 'Juniper Networks EX3400 Ethernet Switch , Junos OS Release 15.1X53-D5x EX series'
52 | else if( preg_match( '/(Juniper Networks) (\w+) Ethernet Switch .* Release ([\w\-.]+) EX series/', $sysDescr, $matches ) ) {
53 | $this->setVendor($matches[1]);
54 | $this->setModel($matches[2]);
55 | $this->setOs('JUNOS');
56 | $this->setOsVersion($matches[3]);
57 | $this->setOsDate(null);
58 | }
59 |
60 | }
61 |
62 |
--------------------------------------------------------------------------------
/examples/platform.php:
--------------------------------------------------------------------------------
1 | #! /usr/bin/php
2 | getPlatform()->getVendor()
72 | . "\nModel: " . $host->getPlatform()->getModel()
73 | . "\nOS: " . $host->getPlatform()->getOs()
74 | . "\nOS Version: " . $host->getPlatform()->getOsVersion();
75 |
76 | echo "\n\n";
77 |
78 | exit( 0 );
79 |
80 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/Ip.php:
--------------------------------------------------------------------------------
1 |
43 | */
44 | class Ip extends \OSS_SNMP\MIB
45 | {
46 | const OID_IP_NET_TO_MEDIA_PHY_ADDRESS = '.1.3.6.1.2.1.4.22.1.2';
47 | const OID_IP_ADDRESS = '.1.3.6.1.2.1.4.20.1.1';
48 |
49 | /** Returns an associative array of IpAddresses of device
50 | *
51 | * e.g. [10.0.0.1] => 10.0.0.1
52 | *
53 | * @return array Associative of IP ADDRESS (value) to ip address (key)
54 | */
55 | public function ipAddressList() {
56 | return $this->getSNMP()->subOidWalk(self::OID_IP_ADDRESS, 11, -1 );
57 | }
58 |
59 | /**
60 | * IP Addresses listen by this device and mac associated to the ip
61 | * also the interface index (if) where listen. Usually interface could
62 | * by virtual interface (VLAN)
63 | * @return array [ 'if.ip' => 'mac' ]
64 | */
65 | public function ipMacIf() {
66 | return $this->getSNMP()->subOidWalk(self::OID_IP_NET_TO_MEDIA_PHY_ADDRESS, 11, -1 );
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/examples/bgp.php:
--------------------------------------------------------------------------------
1 | #! /usr/bin/php
2 | useBGP()->version() . "\n";
73 |
74 | echo "BGP - local ASN: " . $host->useBGP()->localASN() . "\n";
75 |
76 | echo "BGP - identifier: " . $host->useBGP()->identifier() . "\n";
77 |
78 | #echo "BGP - peers: \n\n";
79 |
80 | #print_r( $host->useBGP()->peerDetails(1) );
81 |
82 | echo "\n\n";
83 |
84 |
85 |
86 | exit( 0 );
87 |
88 |
89 |
--------------------------------------------------------------------------------
/doc/img/icons/icon_template.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
94 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/RFC1213.php:
--------------------------------------------------------------------------------
1 |
43 | */
44 | class RFC1213 extends \OSS_SNMP\MIB
45 | {
46 | const OID_RFC1213_PHYSADDRESS = '.1.3.6.1.2.1.3.1.1.2';
47 |
48 | /**
49 | *
50 | * NOTE- must use "community@vlan" as community
51 | *
52 | * @param $ifindex
53 | * @return associative array for macaddress in this device
54 | * [
55 | * "ifindex.instance.ip" => macaddress
56 | * ]
57 | * (instance usually "1", ifindex the vlan_ifindex if vlan )
58 | * ex.
59 | * [
60 | * "53.1.10.0.1.5" => "0008E4F1F322",
61 | * ]
62 | * if $ifindex only search for this ifindex, if $ifindex and $ip search for both
63 | */
64 | public function physAddress($ifindex = null, $ip = null) {
65 |
66 | $oid = self::OID_RFC1213_PHYSADDRESS;
67 |
68 | if ($ifindex) {
69 | $oid .= "." . $ifindex;
70 | if ($ip) {
71 | $oid .= ".1." . $ip;
72 | }
73 | }
74 | return $this->getSNMP()->subOidWalk($oid, 11, -1);
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/Huawei/System.php:
--------------------------------------------------------------------------------
1 | getSNMP()->get( self::OID_SYSTEM_SOFTWARE_VERSION );
42 | } catch ( \OSS_SNMP\Exception $e ) {
43 | return $this->getSNMP()->get( self::OID_COMPATIBLE_VERSION );
44 | }
45 | }
46 |
47 | /**
48 | * Returns the system activated patch
49 | *
50 | * @return string The system activated patch
51 | */
52 | public function activatedPatch()
53 | {
54 | try {
55 | return $this->getSNMP()->get( self::OID_SYSTEM_ACTIVE_PATCH_VERSION );
56 | } catch( \OSS_SNMP\Exception $e ) {
57 | return null;
58 | }
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/Platforms/vendor_linux.php:
--------------------------------------------------------------------------------
1 | setVendor( 'Cumulus Networks' );
50 | $this->setModel( 'Generic' );
51 | $this->setOs( 'Linux' );
52 | $this->setOsVersion( $matches[2] );
53 | $this->setOsDate( new \DateTime( "{$matches[7]}/{$matches[6]}/{$matches[10]}:{$matches[8]} +0000" ) );
54 | $this->getOsDate()->setTimezone( new \DateTimeZone( $matches[9] ));
55 | }
56 | else if( preg_match( '/Linux ([^ ]+) ([^ ]+)-([^ ]+) #[^ ]+-([^ ]+) SMP ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) (.*)/',
57 | $sysDescr, $matches ) )
58 | {
59 | $this->setVendor( $matches[4] );
60 | $this->setModel( 'Generic' );
61 | $this->setOs( 'Linux' );
62 | $this->setOsVersion( $matches[2] );
63 | $this->setOsDate( new \DateTime( "{$matches[7]}/{$matches[6]}/{$matches[10]}:{$matches[8]} +0000" ) );
64 | $this->getOsDate()->setTimezone( new \DateTimeZone( $matches[9] ));
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/Cisco/PAGP.php:
--------------------------------------------------------------------------------
1 |
43 | */
44 | class PAGP extends \OSS_SNMP\MIBS\Cisco
45 | {
46 |
47 | const OID_PAGP_GROUPIFINDEX = '1.3.6.1.4.1.9.9.98.1.1.1.1.8';
48 |
49 | /**
50 | *
51 | * @return associative array with the physic interface index (key) and the agregation port ifindex (value)
52 | * if key == value OR value == 0 not agregation
53 | */
54 | public function groupIfIndex() {
55 | return $this->getSNMP()->subOidWalk( self::OID_PAGP_GROUPIFINDEX, 15 );
56 | }
57 |
58 | /**
59 | * Gets an associate array of PAGP ports with the [id] => name of it's constituent ports
60 | *
61 | * E.g.:
62 | * [5048] => Array
63 | * (
64 | * [10111] => GigabitEthernet1/0/11
65 | * [10112] => GigabitEthernet1/0/12
66 | * )
67 | *
68 | * @return array Associate array of LAG ports with the [id] => name of it's constituent ports
69 | */
70 | public function getPAGPPorts()
71 | {
72 | $ports = array();
73 |
74 | foreach( $this->groupIfIndex() as $portId => $aggPortId )
75 | if( $aggPortId != 0 && $portId != $aggPortId)
76 | $ports[ $aggPortId ][$portId] = $this->getSNMP()->useIface()->names()[$portId];
77 |
78 | return $ports;
79 | }
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/SNMP/Engine.php:
--------------------------------------------------------------------------------
1 |
43 | */
44 | class Engine extends \OSS_SNMP\MIB
45 | {
46 | const OID_BOOTS = '.1.3.6.1.6.3.10.2.1.2.0';
47 | const OID_TIME = '.1.3.6.1.6.3.10.2.1.3.0';
48 |
49 | /**
50 | * Get the SNMP engine boots
51 | *
52 | *
53 | * > "The number of times that the SNMP engine has (re-)initialized itself since snmpEngineID was last configured."
54 | *
55 | * @see http://tools.cisco.com/Support/SNMP/do/BrowseOID.do?local=en&translate=Translate&objectInput=1.3.6.1.6.3.10.2.1.2#oidContent
56 | *
57 | * @return int The SNMP engine boots
58 | */
59 | public function boots()
60 | {
61 | return $this->getSNMP()->get( self::OID_BOOTS );
62 | }
63 |
64 | /**
65 | * Get the SNMP engine time
66 | *
67 | *
68 | * > "The number of seconds since the value of the snmpEngineBoots object last changed.
69 | * > When incrementing this objects value would cause it to exceed its maximum, snmpEngineBoots
70 | * > is incremented as if a re-initialization had occurred, and this objects value consequently
71 | * > reverts to zero."
72 | *
73 | * @see http://tools.cisco.com/Support/SNMP/do/BrowseOID.do?local=en&translate=Translate&objectInput=1.3.6.1.6.3.10.2.1.2#oidContent
74 | *
75 | * @return int The SNMP engine time
76 | */
77 | public function time()
78 | {
79 | return $this->getSNMP()->get( self::OID_TIME );
80 | }
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/Platforms/vendor_dell_force10.php:
--------------------------------------------------------------------------------
1 | setVendor( "Dell {$matches[1]}" );
50 | $this->setModel( $matches[4] );
51 | $this->setOs( "FTOS {$matches[2]}" );
52 | $this->setOsVersion( $matches[3] );
53 | $this->setOsDate( new \DateTime( "{$matches[7]}/{$matches[6]}/{$matches[12]}:{$matches[8]} +0000" ) );
54 | $this->getOsDate()->setTimezone( new \DateTimeZone( 'UTC' ) );
55 | }
56 |
57 | try {
58 | $this->setSerialNumber( $this->getSNMPHost()->get( '.1.3.6.1.2.1.47.1.1.1.1.11.2' ) );
59 | } catch( Exception $e ) {
60 | $this->setSerialNumber( '(error)' );
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/examples/extreme.php:
--------------------------------------------------------------------------------
1 | useSystem()->getAll() );
72 |
73 | echo "\n\n";
74 |
75 | echo "\n\nPlatform details for {$argv[1]}:\n"
76 | . "\nVendor: " . $host->getPlatform()->getVendor()
77 | . "\nModel: " . $host->getPlatform()->getModel()
78 | . "\nOS: " . $host->getPlatform()->getOs()
79 | . "\nOS Version: " . $host->getPlatform()->getOsVersion();
80 | echo "\n\n";
81 |
82 |
83 | echo "Temperature alarm: " . ( $host->useExtreme_System_Common()->overTemperatureAlarm() ? 'YES' : 'NO' ) . "\n";
84 | echo "Temperature : " . $host->useExtreme_System_Common()->currentTemperature() . "C\n";
85 |
86 | echo "\n\n";
87 |
88 | print_r( $host->useExtreme_SwMonitor_Memory()->percentUsage() );
89 |
90 |
91 | echo "\n\n";
92 |
93 |
94 |
95 | exit( 0 );
96 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/Platforms/vendor_huawei.php:
--------------------------------------------------------------------------------
1 | setVendor( 'Huawei' );
17 |
18 | switch( $sysObjectId )
19 | {
20 | case '.1.3.6.1.4.1.2011.2.123':
21 | $this->setModel( "MA5603T" );
22 | break;
23 | case '.1.3.6.1.4.1.2011.2.169':
24 | $this->setModel( "MA5616" );
25 | break;
26 | case '.1.3.6.1.4.1.2011.2.80.8':
27 | $this->setModel( "MA5600T" );
28 | break;
29 | case '.1.3.6.1.4.1.2011.2.6.6.1':
30 | $this->setModel( "MA5300V1" );
31 | break;
32 | case '.1.3.6.1.4.1.2011.2.239.32':
33 | $this->setModel( "CE6870-48S6CQ-EI" );
34 | break;
35 | case '.1.3.6.1.4.1.2011.2.239.51':
36 | $this->setModel( "CE8861EI" );
37 | break;
38 | case '.1.3.6.1.4.1.2011.2.239.66':
39 | $this->setModel( "CE6881-48S6CQ" );
40 | break;
41 | case '.1.3.6.1.4.1.2011.2.239.50':
42 | $this->setModel("CE8850-64CQ-EI" );
43 | break;
44 | case '.1.3.6.1.4.1.2011.2.223.2':
45 | $this->setModel( "S7706" );
46 | break;
47 | case '.1.3.6.1.4.1.2011.2.220.35':
48 | $this->setModel( "ATN 910C-D" );
49 | break;
50 | default:
51 | $this->setModel( null );
52 | }
53 |
54 | $this->setOs( null );
55 | if( stripos( $sysDescr, 'Huawei Versatile Routing Platform Software' ) !== false ) {
56 | $this->setOs( 'Huawei Versatile Routing Platform Software' );
57 | }
58 |
59 | // lose uptime
60 | if( $pos = strpos( $sysDescr, 'uptime is') ) {
61 | $sysDescr = substr( $sysDescr, 0, $pos );
62 | }
63 |
64 | $sysDescr = trim( $sysDescr );
65 |
66 | $matches = [];
67 | preg_match( '/^Huawei\s+.*[Vv]ersion\s+([\w.\d]+)\s+.*\s+([\w\-]+)$/is', $sysDescr, $matches );
68 |
69 | if( isset( $matches[1] ) ) {
70 | $this->setOsVersion( $matches[1] );
71 | } else if( $this instanceof \OSS_SNMP\TestPlatform ) {
72 | $this->setOsVersion('PHPUnit');
73 | } else {
74 | $this->setOsVersion($this->getSNMPHost()->useHuawei_System()->softwareVersion());
75 | }
76 |
77 | if( !$this->getModel() && isset( $matches[2] ) ) {
78 | $this->setModel($matches[2]);
79 | }
80 |
81 | $this->setOsDate( null );
82 |
83 | }
84 |
85 | // 'S6720-30C-EI-24S-AC Huawei Versatile Routing Platform Software VRP (R) software,Version 5.160 (S6720 V200R009C00SPC500) Copyright (C) 2007 Huawei Technologies Co., Ltd.'
86 | // https://github.com/opensolutions/OSS_SNMP/issues/41
87 | //
88 | // 'S6720-54C-EI-48S-AC Huawei Versatile Routing Platform Software VRP (R) software,Version 5.170 (S6720 V200R010C00SPC600) Copyright (C) 2007 Huawei Technologies Co., Ltd.'
89 | // https://github.com/opensolutions/OSS_SNMP/issues/59
90 | else if( preg_match('/^(S\d+\-[A-Z0-9\-]+)\s+Huawei Versatile Routing Platform Software\s+VRP \(R\) software,Version ([0-9\.]+) \((S[0-9]+) [A-Z0-9]+\)\s+Copyright \(C\) 2007 Huawei Technologies.*$/',
91 | $sysDescr, $matches ) ) {
92 |
93 | $this->setVendor( 'Huawei' );
94 | $this->setModel( $matches[1] );
95 | $this->setOs( 'Huawei Versatile Routing Platform Software VRP' );
96 | $this->setOsVersion( $matches[2] );
97 | $this->setOsDate( null );
98 | }
99 |
--------------------------------------------------------------------------------
/examples/mau.php:
--------------------------------------------------------------------------------
1 | #! /usr/bin/php
2 | useIface()->numberofInterfaces() . "\n\n";
73 |
74 | echo "ID: Name - Index - Type - State - Media Available - Jack Type - State Exits - Jabber State - Autoneg\n\n";
75 |
76 | foreach( $host->useIface()->names() as $id => $name )
77 | {
78 | if( $id >1100 ) continue;
79 |
80 | echo "{$id}: {$name} - {$host->useMAU()->index()[$id]}"
81 | . " - {$host->useMAU()->types( true )[$id]}"
82 | . " - {$host->useMAU()->states( true )[$id]}"
83 | . " - {$host->useMAU()->mediaAvailable( true )[$id]}"
84 | . " - {$host->useMAU()->jackTypes( true )[$id]}"
85 | . " - {$host->useMAU()->mediaAvailableStateExits()[$id]}"
86 | . " - {$host->useMAU()->jabberStates( true )[$id]}"
87 | . " - " . ( $host->useMAU()->autonegSupported()[$id] ? 'Y' : 'N' )
88 | . " - " . ( $host->useMAU()->autonegAdminState()[$id] ? 'Y' : 'N' )
89 | . "\n";
90 | }
91 |
92 | echo "\n";
93 | exit( 0 );
94 | }
95 |
96 |
97 | exit( 0 );
98 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/Platforms/vendor_alcatel-lucent.php:
--------------------------------------------------------------------------------
1 | setVendor( 'Alcatel-Lucent' );
47 | $this->setOs( 'AOS' );
48 |
49 | if( substr( $sysDescr, 0, 18 ) == 'Alcatel-Lucent OS9' ) {
50 | preg_match( '/Alcatel-Lucent (OS.+CFM) ([0-9A-Za-z\(\)\.]+) GA,\s([a-zA-Z]+)\s(\d+),\s(\d+)\./',
51 | $sysDescr, $matches );
52 |
53 | $this->setModel( explode("/", $matches[1])[0] );
54 |
55 | $this->setOsVersion( $matches[2] );
56 | $this->setOsDate( new \DateTime( "{$matches[5]}-{$matches[3]}-{$matches[4]}" ) );
57 | $this->getOsDate()->setTimezone( new \DateTimeZone( 'UTC' ) );
58 | } else if ( substr( $sysDescr, 0, 18 ) == 'Alcatel-Lucent OS6' ) {
59 | preg_match( '/Alcatel-Lucent (OS.+) ([0-9A-Za-z\(\)\.]+) GA,\s([a-zA-Z]+)\s(\d+),\s(\d+)\./',
60 | $sysDescr, $matches );
61 |
62 | $this->setModel( $matches[1] );
63 |
64 | $this->setOsVersion( $matches[2] );
65 | $this->setOsDate( new \DateTime( "{$matches[5]}-{$matches[3]}-{$matches[4]}" ) );
66 | $this->getOsDate()->setTimezone( new \DateTimeZone( 'UTC' ) );
67 | } else {
68 | $model = $this->getSNMPHost()->get( '.1.3.6.1.2.1.47.1.1.1.1.13.1' );
69 |
70 | if ( !empty ( $model ) ) {
71 | $this->setModel( $model );
72 |
73 | preg_match( '/Alcatel-Lucent ([0-9A-Za-z\(\)\.]+) GA,\s([a-zA-Z]+)\s(\d+),\s(\d+)\./',
74 | $sysDescr, $matches );
75 |
76 | $this->setOsVersion( $matches[1] );
77 | $this->setOsDate( new \DateTime( "{$matches[4]}-{$matches[2]}-{$matches[3]}" ) );
78 | $this->getOsDate()->setTimezone( new \DateTimeZone( 'UTC' ) );
79 | } else {
80 | $this->setModel( 'Unknown' );
81 | $this->setOsVersion( 'Unknown' );
82 | $this->setOsDate( null );
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/Cache/Basic.php:
--------------------------------------------------------------------------------
1 |
43 | */
44 | class Basic extends \OSS_SNMP\Cache
45 | {
46 |
47 | /**
48 | * An array to store results - a temporary cache
49 | * @var array An array to store results - a temporary cache
50 | */
51 | protected $_cache;
52 |
53 |
54 | /**
55 | * Cache constructor.
56 | *
57 | * For basic cache, takes no parameters.
58 | *
59 | * @return \OSS_SNMP\Cache\Basic An instance of the cache ($this) for fluent interfaces
60 | */
61 | public function __construct()
62 | {
63 | $_cache = array();
64 |
65 | return $this;
66 | }
67 |
68 |
69 |
70 | /**
71 | * Load a named value from the cache (or null if not present)
72 | *
73 | * @param string $var The name of the value to load
74 | * @return mixed|null The value from the cache or null
75 | */
76 | public function load( $var )
77 | {
78 | if( isset( $this->_cache[ $var ] ) )
79 | return $this->_cache[ $var ];
80 |
81 | return null;
82 | }
83 |
84 |
85 | /**
86 | * Save a named value to the cache
87 | *
88 | * @param string $var The name of the value to save
89 | * @param mixed $val The value to save
90 | * @return mixed The value (as passed)
91 | */
92 | public function save( $var, $val )
93 | {
94 | return $this->_cache[ $var ] = $val;
95 | }
96 |
97 | /**
98 | * Clear a named value from the cache
99 | *
100 | * @param string $var The name of the value to clear
101 | */
102 | public function clear( $var )
103 | {
104 | if( isset( $this->_cache[ $var ] ) )
105 | unset( $this->_cache[ $var ] );
106 | }
107 |
108 |
109 | /**
110 | * Clear all values from the cache
111 | *
112 | */
113 | public function clearAll()
114 | {
115 | $this->_cache = array();
116 | }
117 |
118 | }
119 |
120 |
--------------------------------------------------------------------------------
/doc/js/jquery.cookie.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Cookie plugin
3 | *
4 | * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
5 | * Dual licensed under the MIT and GPL licenses:
6 | * http://www.opensource.org/licenses/mit-license.php
7 | * http://www.gnu.org/licenses/gpl.html
8 | *
9 | */
10 |
11 | /**
12 | * Create a cookie with the given name and value and other optional parameters.
13 | *
14 | * @example $.cookie('the_cookie', 'the_value');
15 | * @desc Set the value of a cookie.
16 | * @example $.cookie('the_cookie', 'the_value', {expires: 7, path: '/', domain: 'jquery.com', secure: true});
17 | * @desc Create a cookie with all available options.
18 | * @example $.cookie('the_cookie', 'the_value');
19 | * @desc Create a session cookie.
20 | * @example $.cookie('the_cookie', null);
21 | * @desc Delete a cookie by passing null as value.
22 | *
23 | * @param String name The name of the cookie.
24 | * @param String value The value of the cookie.
25 | * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
26 | * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
27 | * If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
28 | * If set to null or omitted, the cookie will be a session cookie and will not be retained
29 | * when the the browser exits.
30 | * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
31 | * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
32 | * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
33 | * require a secure protocol (like HTTPS).
34 | * @type undefined
35 | *
36 | * @name $.cookie
37 | * @cat Plugins/Cookie
38 | * @author Klaus Hartl/klaus.hartl@stilbuero.de
39 | */
40 |
41 | /**
42 | * Get the value of a cookie with the given name.
43 | *
44 | * @example $.cookie('the_cookie');
45 | * @desc Get the value of a cookie.
46 | *
47 | * @param String name The name of the cookie.
48 | * @return The value of the cookie.
49 | * @type String
50 | *
51 | * @name $.cookie
52 | * @cat Plugins/Cookie
53 | * @author Klaus Hartl/klaus.hartl@stilbuero.de
54 | */
55 | jQuery.cookie = function(name, value, options)
56 | {
57 | if (typeof value != 'undefined')
58 | { // name and value given, set cookie
59 | options = options || {};
60 | if (value === null)
61 | {
62 | value = '';
63 | options.expires = -1;
64 | }
65 | var expires = '';
66 | if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString))
67 | {
68 | var date;
69 | if (typeof options.expires == 'number')
70 | {
71 | date = new Date();
72 | date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
73 | }
74 | else
75 | {
76 | date = options.expires;
77 | }
78 | expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
79 | }
80 | var path = options.path ? '; path=' + options.path : '';
81 | var domain = options.domain ? '; domain=' + options.domain : '';
82 | var secure = options.secure ? '; secure' : '';
83 | document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
84 | }
85 | else
86 | { // only name given, get cookie
87 | var cookieValue = null;
88 | if (document.cookie && document.cookie != '')
89 | {
90 | var cookies = document.cookie.split(';');
91 | for (var i = 0; i < cookies.length; i++)
92 | {
93 | var cookie = jQuery.trim(cookies[i]);
94 | // Does this cookie string begin with the name we want?
95 | if (cookie.substring(0, name.length + 1) == (name + '='))
96 | {
97 | cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
98 | break;
99 | }
100 | }
101 | }
102 | return cookieValue;
103 | }
104 | };
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | OSS_SNMP
2 | ========
3 |
4 | A PHP SNMP Library for People Who HATE SNMP, MIBs and OIDs!
5 | ------------------------------------------------------------
6 |
7 | I ([Barry O'Donovan](http://www.barryodonovan.com/)) hate SNMP! But I have
8 | to use it on a daily basis with my company, [Open
9 | Solutions](http://www.opensolutions.ie/) and our customers.
10 |
11 | Don't get me wrong, it's an essential tool in the trade of network engineering
12 | but it's also a serious PITA. Finding MIBs, OIBs, making them work, translating
13 | them, cross-vendor translations, etc, blah, blah. And then, when you do find what
14 | you need, you'll have forgotten it months later when you need it again.
15 |
16 | Anyway, while trying to create some automatic L2 topology graphing tools
17 | (via Cisco/Foundry Discovery Protocol for example) and also some per VLAN
18 | RSTP tools to show port states, I started writing this library which has turned
19 | out to be very useful. It is presented here in the hope that the wider network
20 | engineering community will find it useful and also contribute back *MIBs*.
21 |
22 |
23 | Documentation
24 | -------------
25 |
26 | Please see [the wiki](https://github.com/opensolutions/OSS_SNMP/wiki).
27 |
28 | Example Usage
29 | -------------
30 |
31 | First, we need to instantiate an SNMP object with a hostname / IP address and
32 | a community string:
33 |
34 | $ciscosw = new \OSS_SNMP\SNMP( $ip, $community );
35 |
36 | Assuming the above is a standard Cisco switch, let's say I want to get an
37 | associate array of VLAN names indexed by the VLAN ids:
38 |
39 | print_r( $ciscosw->useCisco_VTP()->vlanNames() );
40 |
41 | This yields something like the following:
42 |
43 | Array
44 | (
45 | [1] => default
46 | [2] => mgmt
47 | [100] => cust-widgets
48 | [1002] => fddi-default
49 | ...
50 | )
51 |
52 | It really is that easy. As another example, if you wanted to get the system contact:
53 |
54 | echo $ciscosw->useSystem()->contact();
55 |
56 |
57 | License
58 | -------
59 |
60 | This software library is released under the *New BSD License* (also known as the
61 | *Modified BSD License*). See the `LICENSE` file or the header of all other files
62 | for the full text.
63 |
64 |
65 | MIBS - The Bad News... with some Good News
66 | ------------------------------------------
67 |
68 | The, what I'm calling, *MIBs* are defined in `OSS_SNMP/MIBS` and these define the
69 | functionality as per the examples above.
70 |
71 | There's only a handful of MIBs currently defined - essentially what I've needed so
72 | far for other projects.
73 |
74 | But it's **really easy** to add your own. And **please** send me a pull request for those.
75 |
76 | For the MIBs I've written, `Iface` (`MIBS/Iface.php`) is fully complete as an example
77 | to help future contributors. But there's some *really* useful
78 | functionality in the others. For example the Cisco/CDP MIB can discover your entire L2 network
79 | topology recursively. Another project we've released, [NOCtools](https://github.com/opensolutions/NOCtools/wiki),
80 | give concreate examples of this with GraphViz.
81 |
82 | Supports SNMP v1, v2c and v3. It's read only as, at time of writing, I have no current requirement to set SNMP values via PHP.
83 |
84 |
85 | Requirements
86 | ------------
87 |
88 | PHP 5.4 is a requirement. The reason for 5.4 (besides the fact it's long been regarded as stable),
89 | is that we can now dereference an array directly from a function call:
90 |
91 | $name = $ciscosw->useCisco_VTP()->vlanNames()[ $vlanid ];
92 |
93 | rather than the old way:
94 |
95 | $vlanNames = $ciscosw->useCisco_VTP()->vlanNames();
96 | $name = $vlanNames[ $vlanid ];
97 |
98 | And as most of the defined MIBs *walk* a given tree, almost all defined functions return an array.
99 |
100 | The only other requirement is the php5-snmp library.
101 |
102 |
103 | Code / phpDoc Documentation
104 | ---------------------------
105 |
106 | Documentation can be generated from the root directory by executing:
107 |
108 | ./bin/phpdoc.sh --force
109 |
110 | and it will be found under the `doc/` directory. There is
111 | [an online version available here](http://opensolutions.github.com/OSS_SNMP/doc/).
112 |
113 |
--------------------------------------------------------------------------------
/doc/graph_class.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | OSS_SNMP
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
45 |
46 |
50 |
51 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/Asterisk/Indications.php:
--------------------------------------------------------------------------------
1 |
44 | */
45 | class Indications extends \OSS_SNMP\MIB
46 | {
47 |
48 | const OID_ASTERISK_INDICATIONS_COUNT = '.1.3.6.1.4.1.22736.1.4.1.0';
49 |
50 | const OID_ASTERISK_DEFAULT_INDICATION = '.1.3.6.1.4.1.22736.1.4.2.0';
51 |
52 | const OID_ASTERISK_INDICATIONS_COUNTRY = '.1.3.6.1.4.1.22736.1.4.3.1.2';
53 | const OID_ASTERISK_INDICATIONS_DESCRIPTION = '.1.3.6.1.4.1.22736.1.4.3.1.4';
54 |
55 | /**
56 | * Returns the number of indications defined in Asterisk
57 | *
58 | * > Number of indications currently defined in Asterisk.
59 | *
60 | * @return int The number of indications defined in Asterisk
61 | */
62 | public function number()
63 | {
64 | return $this->getSNMP()->get( self::OID_ASTERISK_INDICATIONS_COUNT );
65 | }
66 |
67 |
68 | /**
69 | * Returns the default indication zone to use.
70 | *
71 | * > Default indication zone to use.
72 | *
73 | * @return string The default indication zone to use
74 | */
75 | public function defaultZone()
76 | {
77 | return $this->getSNMP()->get( self::OID_ASTERISK_DEFAULT_INDICATION );
78 | }
79 |
80 | /**
81 | * Returns an array of ISO country codes for the defined indications zones (indexed by SNMP table entry)
82 | *
83 | * > Country for which the indication zone is valid,
84 | * > typically this is the ISO 2-letter code of the country.
85 | *
86 | * @return array An array of ISO country codes for the defined indications zones (indexed by SNMP table entry)
87 | */
88 | public function countryCodes()
89 | {
90 | return $this->getSNMP()->walk1d( self::OID_ASTERISK_INDICATIONS_COUNTRY );
91 | }
92 |
93 | /**
94 | * Returns an array of indications zone descriptions (indexed by SNMP table entry)
95 | *
96 | * > Description of the indication zone, usually the full
97 | * > name of the country it is valid for.
98 | *
99 | * @return array An array of indications zone descriptions
100 | */
101 | public function descriptions()
102 | {
103 | return $this->getSNMP()->walk1d( self::OID_ASTERISK_INDICATIONS_DESCRIPTION );
104 | }
105 |
106 |
107 |
108 |
109 | }
110 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/Bridge.php:
--------------------------------------------------------------------------------
1 |
43 | */
44 | class Bridge extends \OSS_SNMP\MIB {
45 |
46 | const OID_BRIDGE_BASE_PORT_IF_INDEX = '.1.3.6.1.2.1.17.1.4.1.2';
47 | const OID_BRIDGE_MAC_ADDRESS = '.1.3.6.1.2.1.17.4.3.1.1';
48 | const OID_BRIDGE_MAC_ADDRESS_BASE_PORT = '.1.3.6.1.2.1.17.4.3.1.2';
49 |
50 | /**
51 | * Returns an associate array of STP port IDs (key) to interface IDs (value)
52 | *
53 | * e.g. [22] => 10122
54 | *
55 | * @param $baseport int base port to ask for
56 | * @return array Associate array of STP port IDs (key) to interface IDs (value) or only for $baseport if supplied
57 | */
58 | public function basePortIfIndexes($baseport = null)
59 | {
60 | $oid = self::OID_BRIDGE_BASE_PORT_IF_INDEX;
61 | if ($baseport) {
62 | $oid .= "." . $baseport;
63 | }
64 | return $this->getSNMP()->subOidWalk($oid, 12);
65 | }
66 |
67 | /**
68 | * Returns array Associative MAC ADDRESSES (value) to unique index (key)
69 | * NOTE: unique index (key) is the decimal macaddress
70 | * (ex. 0.0.136.54.152.12 is 00:00:88:36:98:0C
71 | *
72 | * e.g. [0.0.136.54.152.12] => 00008836980C
73 | *
74 | * @return array Associative MAC ADDRESSES (value) to unique index (key)
75 | */
76 | public function macAddressList() {
77 | return $this->getSNMP()->subOidWalk(self::OID_BRIDGE_MAC_ADDRESS, 12, -1);
78 | }
79 |
80 | /**
81 | * Returns array Associative of BasePort (value) to unique index (key)
82 | * for mac address listed in self::macAddressList()
83 | * Use basePortIfIndexes to obtain interface
84 | * NOTE: unique index (key) is the decimal macaddress
85 | * (ex. 0.0.136.54.152.12 is 00:00:88:36:98:0C
86 | *
87 | * e.g. [0.0.136.54.152.12] => 2
88 | *
89 | *
90 | * @param $decimalmac string macaddress in decimal format (see NOTE) to search for
91 | * @return array Associative of BasePort (value) to unique index (key)
92 | * for mac address listed in self::macAddressList() or only for $decimalmac if supplied
93 | */
94 | public function macAddressBasePort($decimalmac = null) {
95 | $oid = self::OID_BRIDGE_MAC_ADDRESS_BASE_PORT;
96 | if ($decimalmac) {
97 | $oid .= "." . $decimalmac;
98 | }
99 | return $this->getSNMP()->subOidWalk($oid, 12, -1);
100 | }
101 |
102 | }
103 |
--------------------------------------------------------------------------------
/doc/deprecated.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | OSS_SNMP
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
45 |
46 |
50 |
51 |
55 |
56 |
57 | -
58 | \
59 |
60 | - Deprecated elements
61 |
62 |
63 |
64 | MIBS/Cisco/MST.php2
65 |
66 |
67 |
68 | | Type |
69 | Line |
70 | Description |
71 |
72 |
73 | | deprecated |
74 | 64 |
75 | Use \OSS_SNMP\MIBS\Cisco\SMST::maxInstanceID() |
76 |
77 |
78 | | deprecated |
79 | 85 |
80 | Use \OSS_SNMP\MIBS\Cisco\SMST::regionRevision() |
81 |
82 |
83 |
84 |
85 |
86 |
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/tests/Tests/OSS_SNMP/Platforms/ExtremeTest.php:
--------------------------------------------------------------------------------
1 | assertEquals( 'Extreme Networks', $p->getVendor() );
23 | $this->assertEquals( 'X460-48t', $p->getModel() );
24 | $this->assertEquals( 'ExtremeXOS', $p->getOs() );
25 | $this->assertEquals( '15.2.2.7 v1522b7-patch1-1', $p->getOsVersion() );
26 | $this->assertEquals( '2012-11-20 17:14:11', $p->getOsDate()->setTimeZone( new \DateTimeZone('UTC') )->format('Y-m-d H:i:s') );
27 | }
28 |
29 | const EXTREME_B = 'ExtremeXOS (X460-48x) version 15.2.2.7 v1522b7-patch1-6 by release-manager on Thu Jan 31 11:11:52 EST 2013';
30 |
31 | public function testExtremeB() {
32 |
33 | $p = new TestOSSPlatform( self::EXTREME_B );
34 |
35 | $this->assertEquals( 'Extreme Networks', $p->getVendor() );
36 | $this->assertEquals( 'X460-48x', $p->getModel() );
37 | $this->assertEquals( 'ExtremeXOS', $p->getOs() );
38 | $this->assertEquals( '15.2.2.7 v1522b7-patch1-6', $p->getOsVersion() );
39 | $this->assertEquals( '2013-01-31 11:11:52', $p->getOsDate()->setTimeZone( new \DateTimeZone('UTC') )->format('Y-m-d H:i:s') );
40 | }
41 |
42 | const EXTREME_C = 'ExtremeXOS (X670V-48x) version 15.2.2.7 v1522b7-patch1-6 by release-manager on Thu Jan 31 11:11:52 EST 2013';
43 |
44 | public function testExtremeC() {
45 |
46 | $p = new TestOSSPlatform( self::EXTREME_C );
47 |
48 | $this->assertEquals( 'Extreme Networks', $p->getVendor() );
49 | $this->assertEquals( 'X670V-48x', $p->getModel() );
50 | $this->assertEquals( 'ExtremeXOS', $p->getOs() );
51 | $this->assertEquals( '15.2.2.7 v1522b7-patch1-6', $p->getOsVersion() );
52 | $this->assertEquals( '2013-01-31 11:11:52', $p->getOsDate()->setTimeZone( new \DateTimeZone('UTC') )->format('Y-m-d H:i:s') );
53 | }
54 |
55 | const EXTREME_D = 'ExtremeXOS version 12.5.3.9 v1253b9 by release-manager on Tue Apr 26 20:36:04 PDT 2011';
56 |
57 | public function testExtremeD() {
58 |
59 | $p = new TestOSSPlatform( self::EXTREME_D );
60 |
61 | $this->assertEquals( 'Extreme Networks', $p->getVendor() );
62 | $this->assertEquals( 'PHPunit', $p->getModel() );
63 | $this->assertEquals( 'ExtremeXOS', $p->getOs() );
64 | $this->assertEquals( '12.5.3.9 v1253b9', $p->getOsVersion() );
65 | $this->assertEquals( '2011-04-26 20:36:04', $p->getOsDate()->setTimeZone( new \DateTimeZone('UTC') )->format('Y-m-d H:i:s') );
66 | }
67 |
68 | // https://github.com/opensolutions/OSS_SNMP/issues/61
69 | const EXTREME_E = 'Extreme BR-SLX9850-4 Router, SLX Operating System Version 18r.1.00a.';
70 |
71 | public function testExtremeE() {
72 |
73 | $p = new TestOSSPlatform( self::EXTREME_E );
74 |
75 | $this->assertEquals( 'Extreme Networks', $p->getVendor() );
76 | $this->assertEquals( 'BR-SLX9850-4', $p->getModel() );
77 | $this->assertEquals( 'SLX', $p->getOs() );
78 | $this->assertEquals( '18r.1.00a', $p->getOsVersion() );
79 | $this->assertNull( $p->getOsDate() );
80 | }
81 |
82 | const EXTREME_F = 'ExtremeXOS (X670G2-48x-4q) version 31.7.2.28 31.7.2.28-patch1-75 by release-manager on Mon Jan 15 08:57:00 EST 2024';
83 |
84 | public function testExtremeF() {
85 |
86 | $p = new TestOSSPlatform( self::EXTREME_F );
87 |
88 | $this->assertEquals( 'Extreme Networks', $p->getVendor() );
89 | $this->assertEquals( 'X670G2-48x-4q', $p->getModel() );
90 | $this->assertEquals( 'ExtremeXOS', $p->getOs() );
91 | $this->assertEquals( '31.7.2.28 31.7.2.28-patch1-75', $p->getOsVersion() );
92 | $this->assertNotNull( $p->getOsDate() );
93 | }
94 |
95 | const EXTREME_G = 'ExtremeXOS (X670G2-48x-4q) version 31.7.3.37 31.7.3.37 by release-manager on Fri 23 Feb 2024 08:17:22 AM UTC';
96 |
97 | public function testExtremeG() {
98 |
99 | $p = new TestOSSPlatform( self::EXTREME_G );
100 |
101 | $this->assertEquals( 'Extreme Networks', $p->getVendor() );
102 | $this->assertEquals( 'X670G2-48x-4q', $p->getModel() );
103 | $this->assertEquals( 'ExtremeXOS', $p->getOs() );
104 | $this->assertEquals( '31.7.3.37 31.7.3.37', $p->getOsVersion() );
105 | $this->assertNotNull( $p->getOsDate() );
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/doc/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | OSS_SNMP
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
45 |
46 |
50 |
51 |
OSS_SNMP
52 | Documentation
53 |
54 |
82 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/Extreme/SwMonitor/Memory.php:
--------------------------------------------------------------------------------
1 |
45 | */
46 | class Memory extends \OSS_SNMP\MIBS\Extreme\SwMonitor
47 | {
48 |
49 | const OID_SYSTEM_SLOT_ID = '.1.3.6.1.4.1.1916.1.32.2.2.1.1';
50 | const OID_SYSTEM_TOTAL = '.1.3.6.1.4.1.1916.1.32.2.2.1.2';
51 | const OID_SYSTEM_FREE = '.1.3.6.1.4.1.1916.1.32.2.2.1.3';
52 | const OID_SYSTEM_USAGE = '.1.3.6.1.4.1.1916.1.32.2.2.1.4';
53 | const OID_USER_USAGE = '.1.3.6.1.4.1.1916.1.32.2.2.1.5';
54 |
55 |
56 | /**
57 | * Slot Id of the memory monitored.
58 | *
59 | * @return array Slot Id of the memory monitored.
60 | */
61 | public function slotIds()
62 | {
63 | return $this->getSNMP()->walk1d( self::OID_SYSTEM_SLOT_ID );
64 | }
65 |
66 | /**
67 | * Total amount of DRAM in Kbytes in the system.
68 | *
69 | * @return array Total amount of DRAM in Kbytes in the system. Indexed by slot ID.
70 | */
71 | public function systemTotal()
72 | {
73 | return $this->getSNMP()->walk1d( self::OID_SYSTEM_TOTAL );
74 | }
75 |
76 | /**
77 | * Total amount of free memory in Kbytes in the system.
78 | *
79 | * @return array Total amount of free memory in Kbytes in the system. Indexed by slot ID.
80 | */
81 | public function systemFree()
82 | {
83 | return $this->getSNMP()->walk1d( self::OID_SYSTEM_FREE );
84 | }
85 |
86 | /**
87 | * Total amount of memory used by system services in Kbytes in the system.
88 | *
89 | * @return array Total amount of memory used by system services in Kbytes in the system. Indexed by slot ID.
90 | */
91 | public function systemUsage()
92 | {
93 | return $this->getSNMP()->walk1d( self::OID_SYSTEM_USAGE );
94 | }
95 |
96 | /**
97 | * Total amount of memory used by applications in Kbytes in the system.
98 | *
99 | * @return array Total amount of memory used by applications in Kbytes in the system.
100 | */
101 | public function userUsage()
102 | {
103 | return $this->getSNMP()->walk1d( self::OID_USER_USAGE );
104 | }
105 |
106 |
107 | /**
108 | * Percentage of memory used per slot
109 | *
110 | * @return array Integer percentage of memory used
111 | */
112 | public function percentUsage()
113 | {
114 | $total = $this->systemTotal();
115 | $free = $this->systemFree();
116 |
117 | $usage = [];
118 |
119 | foreach( $total as $slotId => $amount ) {
120 | $usage[ $slotId ] = intval( ceil( ( ( $amount - $free[ $slotId ] ) * 100 ) / $amount ) );
121 | }
122 |
123 | return $usage;
124 | }
125 |
126 | }
127 |
--------------------------------------------------------------------------------
/src/OSS_SNMP/MIBS/Juniper.php:
--------------------------------------------------------------------------------
1 |
43 | */
44 | class Juniper extends \OSS_SNMP\MIB
45 | {
46 |
47 | /**
48 | * Since Junos 11.3 release, a new set of MIBs were introduced to track the Routing Engine's CPU Load
49 | * Averages for 1, 5, and 15 minute timespans. The relevant MIBs are listed under the jnxOperatingEntry tree:
50 | */
51 | const OID_JNX_OPERATING_ENTRY_1MIN_LOAD_AVG = '.1.3.6.1.4.1.2636.3.1.13.1.20.9.1.0.0';
52 | const OID_JNX_OPERATING_ENTRY_5MIN_LOAD_AVG = '.1.3.6.1.4.1.2636.3.1.13.1.21.9.1.0.0';
53 | const OID_JNX_OPERATING_ENTRY_15MIN_LOAD_AVG = '.1.3.6.1.4.1.2636.3.1.13.1.22.9.1.0.0';
54 |
55 | /**
56 | * Use the following OID to get the system booted time:
57 | * Name jnxBoxInstalled
58 | */
59 | const OID_BOOT_TIME = '.1.3.6.1.4.1.2636.3.1.5.0';
60 |
61 |
62 | /**
63 | * PSU name
64 | */
65 | const OID_PSU1_NAME = '.1.3.6.1.4.1.2636.3.58.1.2.4.1.2.2.1.0.0';
66 | const OID_PSU2_NAME = '.1.3.6.1.4.1.2636.3.58.1.2.4.1.2.2.2.0.0';
67 |
68 | /**
69 | * PSU state
70 | */
71 | const OID_PSU1_STATE = '.1.3.6.1.4.1.2636.3.58.1.2.4.1.8.2.1.0.0';
72 | const OID_PSU2_STATE = '.1.3.6.1.4.1.2636.3.58.1.2.4.1.8.2.2.0.0';
73 |
74 |
75 | /**
76 | * Get the device's 1min load average
77 | *
78 | * @return int The device's 1min load average
79 | */
80 | public function loadAverage1min()
81 | {
82 | return $this->getSNMP()->get( self::OID_JNX_OPERATING_ENTRY_1MIN_LOAD_AVG );
83 | }
84 |
85 | /**
86 | * Get the device's 5min load average
87 | *
88 | * @return int The device's 5min load average
89 | */
90 | public function loadAverage5min()
91 | {
92 | return $this->getSNMP()->get( self::OID_JNX_OPERATING_ENTRY_5MIN_LOAD_AVG );
93 | }
94 |
95 | /**
96 | * Get the device's 15min load average
97 | *
98 | * @return int The device's 15min load average
99 | */
100 | public function loadAverage15min()
101 | {
102 | return $this->getSNMP()->get( self::OID_JNX_OPERATING_ENTRY_15MIN_LOAD_AVG );
103 | }
104 |
105 |
106 | /**
107 | * @return int Boot time as timeticks since booted
108 | */
109 | public function bootTime()
110 | {
111 | return $this->getSNMP()->get( self::OID_BOOT_TIME );
112 | }
113 |
114 |
115 | public function psu1Name()
116 | {
117 | return $this->getSNMP()->get( self::OID_PSU1_NAME );
118 | }
119 |
120 | public function psu2Name()
121 | {
122 | return $this->getSNMP()->get( self::OID_PSU2_NAME );
123 | }
124 |
125 | public function psu1State()
126 | {
127 | return $this->getSNMP()->get( self::OID_PSU1_STATE );
128 | }
129 |
130 | public function psu2State()
131 | {
132 | return $this->getSNMP()->get( self::OID_PSU2_STATE );
133 | }
134 |
135 |
136 | }
137 |
--------------------------------------------------------------------------------
/doc/classes/OSS_SNMP.Exception.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | OSS_SNMP » \OSS_SNMP\Exception
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
45 |
46 |
50 |
51 |
62 |
63 |
72 |
73 |
OSS_SNMP\Exception class
74 |
75 |
76 |
77 |
78 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------