jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [modules/] [ntp/] [platform/] [default.pm] - Rev 28 Go to most recent revision

Compare with Previous - Blame - Download


package HotSaNICmod::OSdep;

use lib "../../lib";

my $MODNAME;

sub version {
  ($VERSION = '$Revision: 1.6 $') =~ s/.*(\d+\.\d+).*/$1/;
  return "default.pm $VERSION";
  }

sub sample {
  my %args=@_;
  $MODNAME=$args{MODNAME};

  foreach $entry (@{$args{HOST}}) {
    my ($host,undef,undef,$dbname,undef,undef,undef)=HotSaNICmod::common::get_names($entry,"");
    my $command="$args{NTPCOMMAND} -c sysinfo $host";
    open FILE,"$command|" || HotSaNIClog::error("unable to run '$command': $!");
    while (<FILE>) {
      chomp;
      (my $var,$value)=split /:\s+/;
      $value=~s/[a-zA-Z ]*//g;
      $str=$value if $var eq "stratum";
      $dst=$value if $var eq "root distance";
      $dps=$value if $var eq "root dispersion";
      $frq=$value if $var eq "frequency";
      $stb=$value if $var eq "stability";
      }
    close FILE;

    HotSaNICmod::do_rrd($dbname,"U",time,$dps,$dst,$frq,$stb,$str);
    }
  }

1;



Powered by WebSVN 2.2.1