This file is indexed.

/usr/share/munin/plugins/hddtemp2 is in munin-plugins-extra 2.0.25-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/perl
# -*- perl -*-
#
# Plugin to monitor hard drive temperatures.
#
# This plugin is an alternative to the hddtemp_smartctl, which is the 
# preferred one.
#
# Requirements:
# 	- S.M.A.R.T. to be turned on for your hard drives
# 	- hddtemp program installed and in path
#
# Parameters supported:
#
# 	config
# 	autoconf
#
# Configurable variables
#
# 	hddtemp		- Override default program
# 	ignore		- Disks will not be touched
#                         "/dev/sdX /dev/sdY /dev/hdZ"
#
# Revision 0.1  2004/02/24 Andrew Radke
#
# Magic markers:
#%# family=contrib
#%# capabilities=autoconf

use strict;

$ENV{'LANG'} = "C"; # Hardcode lang so the hddtemp program to ease parsing of hddtemp-output.
$ENV{'LC_ALL'} = "C"; # Hardcode lang so the hddtemp program to ease parsing of hddtemp-output.
my $HDDTEMP = $ENV{'hddtemp'} || 'hddtemp';
my %config = (
	regex => qr/^\/dev\/([^:]+):\s*([^:]+):\s*([\d.]+) C/m,
	title => "Temperatures (Hard Disks)",
	vlabel => 'Degrees Celsius',
	warning => 50,
	critical => 60,
	graph_args => '--base 1000'
);

my @disks = (glob("/dev/hd?"), glob("/dev/sd?"));
if (exists $ENV{ignore}) {
  $ENV{ignore} =~ s/["']//g;
  my %ignore = map {$_ => 1} split(' ', $ENV{ignore});
  @disks = grep {! exists $ignore{$_} } @disks;
}

$HDDTEMP .= ' -q '.join(' ', @disks).' 2>/dev/null';

if ( defined $ARGV[0] and $ARGV[0] eq 'autoconf' ) {
  # Now see if "hddtemp" can run
  my $text = `$HDDTEMP`;
  if ($?) {
    if ($? == -1) {
      print "no (program $HDDTEMP not found)\n";
    } else {
      print "no (program $HDDTEMP died)\n";
    }
    exit 0;
  }

  unless ($text =~ / C/) {
    print "no (no temperature readings)\n";
    exit 0;
  }

  print "yes\n";
  exit 0;
}

if ( defined $ARGV[0] and $ARGV[0] eq 'config' ) {
  print "graph_title $config{title}\n";
  print "graph_vlabel $config{vlabel}\n";
  print "graph_args --base 1000\n";
  print "graph_category sensors\n";
  my $text = `$HDDTEMP`;
  while ($text =~ /$config{regex}/g) {
    my ($dev, $type, $temp) = ($1, $2, $3);
    $type =~ s/ {2,}/ /g;
    $type =~ s/ +$//g;
    print "hdd$dev.label $dev ($type)\n";
    print "hdd$dev.warning $config{warning}\n";
    print "hdd$dev.critical $config{critical}\n";
  }
  exit 0;
}

my $text = `$HDDTEMP`;
while ($text =~ /$config{regex}/g) {
  print "hdd$1.value $3\n";
}

# vim:syntax=perl