This file is indexed.

/usr/share/munin/plugins/irqstats is in munin-node 1.4.6-3ubuntu3.

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
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#!/usr/bin/perl -w
# -*- cperl -*-

=head1 NAME

irqstats - Munin plugin to monitor individual interrupts on a Linux machine

=head1 APPLICABLE SYSTEMS

Any Linux system

=head1 CONFIGURATION

None needed

=head1 USAGE

Link this plugin to /etc/munin/plugins/ and restart the munin-node.

=head1 INTERPRETATION

The plugin simply shows the number of interrupts on each interrupt
line.  The lines are identified by the attached equipment rather than
the IRQ numbers.

High interrupt rates may coincide with high loads on disk, network or
other I/O, this is normal.

=head1 MAGIC MARKERS

  #%# family=auto
  #%# capabilities=autoconf

=head1 VERSION

  $Id: irqstats.in 1966 2009-04-01 12:24:27Z kjellm $

=head1 BUGS

None known

=head1 AUTHOR

Unknown

=head1 LICENSE

GPLv2

=cut

use Munin::Plugin;
use strict;

if (defined $ARGV[0] && $ARGV[0] eq 'autoconf') {
    if(-r '/proc/interrupts') {
	print "yes\n";
	exit(0);
    } else {
	print "no\n";
	exit(1);
    }
}

my $sun;
$sun = 1 if (`uname -m` =~ /sparc/);

my $in;
my @cpus;
my $cpus;

if ($sun) {
    @cpus = grep (/^cpu\d+/, `cat /proc/stat`);
    $cpus = scalar @cpus;
} else {
    open $in, '<', '/proc/interrupts'
      or die "Can't open /proc/interrupts: $!\n";
    @cpus = split(' ', <$in>);
    $cpus = scalar @cpus;
}

my $cpu;

if ($0 =~ /(?:.*\/)?irqstats_(.+)/) {
    $cpu = $1;
    if ($cpu > $#cpus) {
	die "Requested CPU $cpu out of bounds (0..$#cpus)\n";
    }
}
my @irqs;


sub sum (@) {
    my $sum = 0;
    $sum += $_ || 0 for @_;	# Avoid complaints about empty strings
    return $sum;
}

while (my $line = <$in>) {
    my ($irq, $label, $type);
    my @data;
    if ($sun) {
	@data = split (' ', $line, $cpus + 2);
    } else {
	@data = split(' ', $line, $cpus + 3);
    }
    chomp @data;
    $irq = shift @data;
    next unless defined($irq) and length $irq;
    chop $irq;
    if ($irq =~ /^\d+$/) {
	# For numbered interrupts the format is set
	$label = pop @data;
	$type = pop @data;
    } else {
	# For named interrupts it's more confusing, slice and dice
	# to divorce data from commentary
	$label = join(" ",@data[$cpus..$#data]);
	@data = @data[0..$cpus-1];
    }

    # Skip non-per-cpu values for per-cpu stats
    # This will ignore ERR: and MIS: lines on multi cpu systems
    # (checked on 2.6.22, 2.6.24)
    # next if defined($cpu) and $cpus > @data;

    push @irqs, {
		 irq => $irq,
		 label => $label,
		 count => defined($cpu) ? $data[$cpu] : sum(@data)
		};
}
close $in;

if (defined $ARGV[0] && $ARGV[0] eq 'config') {
    print 'graph_title Individual interrupts',
      defined($cpu) ? " on CPU $cpu\n" : "\n";
    print <<EOM;
graph_args --base 1000 -l 0;
graph_vlabel interrupts / \${graph_period}
graph_category system
EOM
    print join(' ', 'graph_order', map {"i" . $_->{irq}} @irqs), "\n";
    for my $irq (@irqs) {
	my $f = ($irq->{label} || $irq->{irq});
	$f = $irq->{irq} if (length ($f) > 47);
	print "i", $irq->{irq}, '.label ', $f, "\n";
	print "i", $irq->{irq}, '.info Interrupt ', $irq->{irq}, ', for device(s): ', $irq->{label}, "\n"
	  if $irq->{label};
	print "i", $irq->{irq}, ".type DERIVE\n";
	print "i", $irq->{irq}, ".min 0\n";
	print_thresholds("i$irq->{irq}");
    }
} else {
    print "i", $_->{irq}, '.value ', $_->{count}, "\n" for @irqs;
}

__END__