Rev 1130 | Blame | Compare with Previous | Last modification | View Log | RSS feed
#!/usr/bin/env php
<?php
/*
* OIDplus 2.0
* Copyright 2019 - 2021 Daniel Marschall, ViaThinkSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
use ViaThinkSoft\OIDplus\OIDplus;
require_once __DIR__ . '/../includes/oidplus.inc.php';
OIDplus::init(true);
const ALL_OID_LIST = '/home/oidplus/all_oids.txt'; // contains all OIDs (non-public file)
const DESIRED_ROOT = '1.3.6.1.4.1.37476';
# ---
exec("cat ".escapeshellarg(ALL_OID_LIST)." | sort | grep '^".DESIRED_ROOT."'", $out, $ec);
foreach ($out as $oid) {
$oid = trim($oid);
if ($oid == '') continue;
if (strpos($oid, '1.3.6.1.4.1.37476.30.9.') !== 0) check_oid($oid);
}
/**
* @param string $oid
* @return void
*/
function check_oid(string $oid) {
$res = OIDplus::db()->query("select * from ###objects where id = ?", array("oid:$oid"));
$ok = $res->num_rows() > 0;
if (!$ok) {
echo "Missing at OIDplus: $oid\n";
}
}
echo "OK\n";