2015-06-18 19:37:42 +02:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
# -*- perl -*-
|
|
|
|
# vim: ft=perl
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
2018-08-02 02:03:42 +02:00
|
|
|
snmp__syno_hddtemp - Munin plugin to monitor the temperature of
|
2015-06-18 19:37:42 +02:00
|
|
|
harddisks in an Synology NAS.
|
|
|
|
|
|
|
|
=head1 APPLICABLE SYSTEMS
|
|
|
|
|
|
|
|
Any Synology NAS device which provides the synoDisk MIB.
|
|
|
|
|
|
|
|
=head1 CONFIGURATION
|
|
|
|
|
|
|
|
As a rule SNMP plugins need site specific configuration. The default
|
|
|
|
configuration (shown here) will only work on insecure sites/devices.
|
|
|
|
|
|
|
|
[snmp_*]
|
|
|
|
env.version 2
|
|
|
|
env.community public
|
|
|
|
|
|
|
|
In general SNMP is not very secure at all unless you use SNMP version
|
|
|
|
3 which supports authentication and privacy (encryption). But in any
|
|
|
|
case the community string for your devices should not be "public".
|
|
|
|
|
|
|
|
Please see 'perldoc Munin::Plugin::SNMP' for further configuration
|
|
|
|
information.
|
|
|
|
|
|
|
|
=head1 INTERPRETATION
|
|
|
|
|
|
|
|
The temperature of each disk installed in °C.
|
|
|
|
|
|
|
|
=head1 MIB INFORMATION
|
|
|
|
|
2018-08-02 02:03:42 +02:00
|
|
|
This plugin requires support for the synoDisk. It reports
|
2015-06-18 19:37:42 +02:00
|
|
|
the temperature of the installed disks.
|
|
|
|
|
|
|
|
=head1 MAGIC MARKERS
|
|
|
|
|
|
|
|
#%# family=snmpauto
|
|
|
|
#%# capabilities=snmpconf
|
|
|
|
|
|
|
|
=head1 VERSION
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
|
|
|
|
=head1 BUGS
|
|
|
|
|
|
|
|
None known.
|
|
|
|
|
|
|
|
=head1 AUTHOR
|
|
|
|
|
|
|
|
Copyright (C) 2015 Thomas Arthofer
|
|
|
|
|
|
|
|
This plugin was derived from snmp__netstat by Lars Strand with updates
|
|
|
|
by Matthew Boyle.
|
|
|
|
|
|
|
|
=head1 LICENSE
|
|
|
|
|
|
|
|
GPLv2.
|
|
|
|
|
|
|
|
=cut
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use Munin::Plugin::SNMP;
|
|
|
|
|
|
|
|
my $oid_drives = '1.3.6.1.4.1.6574.2.1.1';
|
|
|
|
|
|
|
|
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf') {
|
|
|
|
print "require ${oid_drives}. [0-9]\n";
|
|
|
|
exit 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
my ($session, $error) = Munin::Plugin::SNMP->session();
|
|
|
|
|
|
|
|
my $table = $session->get_hash(
|
|
|
|
-baseoid => $oid_drives, # IF-MIB
|
|
|
|
-cols => {
|
|
|
|
2 => 'name',
|
|
|
|
3 => 'type',
|
|
|
|
6 => 'temp',
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
if (defined $ARGV[0] and $ARGV[0] eq 'config') {
|
|
|
|
my ($host) = Munin::Plugin::SNMP->config_session();
|
|
|
|
|
|
|
|
print "host_name $host\n" unless $host eq 'localhost';
|
|
|
|
print "graph_title HDD temperature\n";
|
|
|
|
print "graph_category sensors\n";
|
|
|
|
print "graph_vlabel Degrees Celsius\n";
|
|
|
|
print "graph_info This graph shows the temperature of all HDDs in the Diskstation.\n";
|
|
|
|
|
|
|
|
foreach my $key ( sort keys %$table )
|
|
|
|
{
|
|
|
|
print "temp$key.label $table->{$key}->{'name'}\n";
|
|
|
|
print "temp$key.info Temperature of $table->{$key}->{'name'} ($table->{$key}->{'type'})\n";
|
|
|
|
}
|
|
|
|
exit 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
my $names = $session->get_entries(-columns => [ $oid_drives ]);
|
|
|
|
|
|
|
|
foreach my $key ( sort keys %$table )
|
|
|
|
{
|
|
|
|
print "temp$key.value $table->{$key}->{'temp'}\n";
|
|
|
|
}
|