~ubuntu-branches/ubuntu/trusty/nagios-plugins-contrib/trusty-proposed

« back to all changes in this revision

Viewing changes to check_hpasm/check_hpasm-4.6.3/plugins-scripts/HP/Proliant/Component/CpuSubsystem/CLI.pm

  • Committer: Package Import Robot
  • Author(s): Bernd Zeimetz, Bernd Zeimetz, Jan Wagner, Evgeni Golov
  • Date: 2013-06-14 20:53:49 UTC
  • Revision ID: package-import@ubuntu.com-20130614205349-34xiy38pm1hzpjoi
Tags: 7.20130614
[ Bernd Zeimetz ]
* [036816ff] Merge pull request #15 from evgeni/master
  check_packages should find security updates on the official security mirror too
* [658a2e93] Add check_checksums nagios plugin.
* [9d5d2056] Updating check_raid.
* [e3ec1293] Updating check_ssl_cert to 1.14.6
* [779543ef] Updating check_hpasm to 4.6.3.2
* [0c838ee9] Updating check_multipath to 0.1.9
* [bec11251] Updating check_whois to 1.13
* [8e0a65d0] Refreshing patches.
* [c0b88cdb] Auto update of debian/copyright
* [59648a17] Fix src link for check_hpasm
* [8c242d0f] Support pre-Wheezy versions of coretutils in check_checksums.
* [7d3d2a06] Update release date in changelog (gah!).
* [768e463b] Merge pull request #16 from evgeni/master
  check_libs: ignore /var/lib/postgresql/ and /var/log/
* [2b9aace5] Bumping standards-Verison, no changes needed.

[ Jan Wagner ]
* [3bb873e4] disable epn for check_rbl

[ Evgeni Golov ]
* [2a7ab4b8] check_libs: ignore /var/spool/

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package HP::Proliant::Component::CpuSubsystem::CLI;
2
 
our @ISA = qw(HP::Proliant::Component::CpuSubsystem);
3
 
 
4
 
use strict;
5
 
use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 };
6
 
 
7
 
sub new {
8
 
  my $class = shift;
9
 
  my %params = @_;
10
 
  my $self = {
11
 
    runtime => $params{runtime},
12
 
    rawdata => $params{rawdata},
13
 
    cpus => [],
14
 
    blacklisted => 0,
15
 
    info => undef,
16
 
    extendedinfo => undef,
17
 
  };
18
 
  bless $self, $class;
19
 
  $self->init(%params);
20
 
  return $self;
21
 
}
22
 
 
23
 
sub init {
24
 
  my $self = shift;
25
 
  my %params = @_;
26
 
  my %tmpcpu = (
27
 
    runtime => $params{runtime},
28
 
  );
29
 
  my $inblock = 0;
30
 
  foreach (grep(/^server/, split(/\n/, $self->{rawdata}))) {
31
 
    if (/Processor:\s+(\d+)/) {
32
 
      $tmpcpu{cpqSeCpuUnitIndex} = $1;
33
 
      $inblock = 1;
34
 
    } elsif (/Name\s*:\s+(.+?)\s*$/) {
35
 
      $tmpcpu{cpqSeCpuName} = $1;
36
 
    } elsif (/Status\s*:\s+(.+?)\s*$/) {
37
 
      $tmpcpu{cpqSeCpuStatus} = lc $1;
38
 
    } elsif (/Socket\s*:\s+(.+?)\s*$/) {
39
 
      $tmpcpu{cpqSeCpuSlot} = $1;
40
 
    } elsif (/^server\s*$/) {
41
 
      if ($inblock) {
42
 
        $inblock = 0;
43
 
        push(@{$self->{cpus}},
44
 
            HP::Proliant::Component::CpuSubsystem::Cpu->new(%tmpcpu));
45
 
        %tmpcpu = (
46
 
          runtime => $params{runtime},
47
 
        );
48
 
      }
49
 
    }
50
 
  }
51
 
  if ($inblock) {
52
 
    push(@{$self->{cpus}},
53
 
        HP::Proliant::Component::CpuSubsystem::Cpu->new(%tmpcpu));
54
 
  }
55
 
}
56
 
 
57
 
1;