Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save komeda-shinji/b6e7dd38218f957dc5bf984099a11211 to your computer and use it in GitHub Desktop.
Save komeda-shinji/b6e7dd38218f957dc5bf984099a11211 to your computer and use it in GitHub Desktop.
LibreNMS YAMAHA 対応 (html/images/os/yamaha.png にロゴファイルを置くと良い)
<?php
if ($device['os'] == "yamaha")
{
$percent = snmp_get($device, ".1.3.6.1.4.1.1182.2.1.4.0", "-OvQ");
if (is_numeric($percent))
{
$total = snmp_get($device, ".1.3.6.1.4.1.1182.2.1.2.0", "-OvQ");
discover_mempool($valid['mempool'], $device, 0, $mib, "Memory Utilization", "1", $total, $total*$percent/100.0);
}
}
<?php
if (!$os)
{
if (strstr($sysObjectId, ".1.3.6.1.4.1.1182")) { $os = "yamaha"; }
}
?>
<?php
if ($device['os'] == "yamaha")
{
echo("Yamaha : ");
$descr = "Processor";
$usage = snmp_get($device, "yrhCpuUtil5min.0", "-OQUvs", "YAMAHA-RT-HARDWARE", mib_dirs('yamaha'));
$yrh_cpu_type = snmp_get($device, "yrhCpuType.0", "-OQUvs", "YAMAHA-RT-HARDWARE", mib_dirs('yamaha'));
if (is_numeric($usage))
{
discover_processor($valid['processor'], $device, ".1.3.6.1.4.1.1182.2.1.7.0", "0", $yrh_cpu_type, $descr, "1", $usage, NULL, NULL);
}
}
unset ($processors_array);
?>
<?php
#YAMAHA-RT-HARDWARE::yrhMemoryUtil.0 (%)
#YAMAHA-RT-HARDWARE::yrhMemorySize.0
#.1.3.6.1.4.1.1182.2.1.4.0
#.1.3.6.1.4.1.1182.2.1.2.0
$mempool['total'] = snmp_get($device, ".1.3.6.1.4.1.1182.2.1.2.0", "-OvQ");
$mempool['perc'] = snmp_get($device, ".1.3.6.1.4.1.1182.2.1.4.0", "-OvQ");
$mempool['used'] = $mempool['total'] / 100 * $mempool['perc'];
$mempool['free'] = $mempool['total'] - $mempool['used'];
?>
<?php
$hardware = $poll_device['sysDescr'];
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment