1 | 1 | simandl | package HotSaNICmod::OSdep; |
2 | | | |
3 | | | use lib "../../lib"; |
4 | | | |
5 | | | my $MODNAME; |
6 | | | |
7 | | | sub version { |
8 | | | ($VERSION = '$Revision: 1.6 $') =~ s/.*(\d+\.\d+).*/$1/; |
9 | | | return "default.pm $VERSION"; |
10 | | | } |
11 | | | |
12 | | | sub sample { |
13 | | | my %args=@_; |
14 | | | $MODNAME=$args{MODNAME}; |
15 | | | |
16 | | | foreach $entry (@{$args{HOST}}) { |
17 | | | my ($host,undef,undef,$dbname,undef,undef,undef)=HotSaNICmod::common::get_names($entry,""); |
18 | | | my $command="$args{NTPCOMMAND} -c sysinfo $host"; |
19 | | | open FILE,"$command|" || HotSaNIClog::error("unable to run '$command': $!"); |
20 | | | while (<FILE>) { |
21 | | | chomp; |
22 | | | (my $var,$value)=split /:\s+/; |
23 | | | $value=~s/[a-zA-Z ]*//g; |
24 | | | $str=$value if $var eq "stratum"; |
25 | | | $dst=$value if $var eq "root distance"; |
26 | | | $dps=$value if $var eq "root dispersion"; |
27 | | | $frq=$value if $var eq "frequency"; |
28 | | | $stb=$value if $var eq "stability"; |
29 | | | } |
30 | | | close FILE; |
31 | | | |
32 | | | HotSaNICmod::do_rrd($dbname,"U",time,$dps,$dst,$frq,$stb,$str); |
33 | | | } |
34 | | | } |
35 | | | |
36 | | | 1; |
37 | | | |
38 | | | |