1 | 1 | simandl | package HotSaNICmod::OSdep; |
2 | | | |
3 | | | use RRDs; |
4 | | | |
5 | | | sub version { |
6 | | | ($VERSION = '$Revision: 1.9 $') =~ s/.*(\d+\.\d+).*/$1/; |
7 | | | return "$^O.pm $VERSION"; |
8 | | | } |
9 | | | |
10 | | | sub sample { |
11 | | | my %args=@_; |
12 | | | |
13 | | | foreach $entry (@{$args{SENSOR}}) { |
14 | | | my (undef,undef,$item,$dbname,undef,undef,undef,$num,$scale,$add)=HotSaNICmod::common::get_names($entry); |
15 | | | ($file)=split /\s+/,$item; |
16 | | | if (-e $file) { |
17 | | | open(DEVFILE,"$item") || HotSaNIClog::error("Unable to open $item."); |
18 | | | my $line=<DEVFILE>; |
19 | | | chomp $line; |
20 | | | close DEVFILE; |
21 | | | my @array=split /\s+/,$line; |
22 | | | my $value=$array[$num-1]*$scale+$add; |
23 | | | |
24 | | | HotSaNICmod::do_rrd($dbname,"50000",time,$value); |
25 | | | } |
26 | | | } |
27 | | | } |
28 | | | |
29 | | | 1; |
30 | | | |