Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / sensors / mbmon @ 97cf6d32

Historique | Voir | Annoter | Télécharger (1,01 ko)

1
#!/usr/bin/perl -w
2
# -*- perl -*-
3

    
4
#
5
# Author: Slaven Rezic
6
#
7
# Copyright (C) 2011 Slaven Rezic. All rights reserved.
8
# This program is free software; you can redistribute it and/or
9
# modify it under the same terms as Perl itself.
10
#
11
# Mail: slaven@rezic.de
12
# WWW:  http://www.rezic.de/eserte/
13
#
14

    
15
use strict;
16

    
17
my $mbmon = "/usr/local/bin/mbmon";
18

    
19
if ($ARGV[0] eq 'autoconf') {
20
    if (-x $mbmon) {
21
	print "yes\n";
22
	exit 0;
23
    } else {
24
	print "no\n";
25
	exit 1;
26
    }
27
} elsif ($ARGV[0] eq 'config') {
28
    print <<EOF;
29
graph_title CPU temperature
30
graph_order temp0 temp1 temp2
31
graph_args --base 1000 -l 0
32
graph_category sensors
33
graph_vlabel temp in ?C
34
temp0.label Temperature0
35
temp1.label Temperature1
36
temp2.label Temperature2
37
EOF
38

    
39
## more info from mbmon
40
# fan0 
41
# fan1 
42
# fan2 
43
# vc0  
44
# vc1  
45
# v33  
46
# v50p 
47
# V12P 
48
# V12N 
49
# V50N 
50

    
51
} else {
52
    my(@res) = `$mbmon -r -c 1`;
53
    chomp @res;
54
    for my $line (@res) {
55
	my($k,$v) = split /\s*:\s*/, $line, 2;
56
	$k = lc $k;
57
	if ($k =~ m{^temp[012]$}) {
58
	    print "$k.value $v\n";
59
	}
60
    }
61
}