Skip to content

Commit

Permalink
Merge pull request #84 from ARGOeu/devel
Browse files Browse the repository at this point in the history
preparing to release 0.4.5-1
  • Loading branch information
kkoumantaros authored Nov 16, 2018
2 parents 0eb56ea + 3dfe8e6 commit f967819
Show file tree
Hide file tree
Showing 10 changed files with 488 additions and 104 deletions.
6 changes: 1 addition & 5 deletions argo-ncg.spec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Summary: ARGO Nagios config generator
Name: argo-ncg
Version: 0.4.4
Version: 0.4.5
Release: 1%{?dist}
License: ASL 2.0
Group: Network/Monitoring
Expand Down Expand Up @@ -67,9 +67,6 @@ install --mode=644 modules/NCG.pm $RPM_BUILD_ROOT%{perllib}
#
install --directory $RPM_BUILD_ROOT%{templatedir}
cp -r templates/* $RPM_BUILD_ROOT%{templatedir}
#
# config dirqueue
install --directory $RPM_BUILD_ROOT/var/run/argo-ncg

%clean
rm -rf $RPM_BUILD_ROOT
Expand Down Expand Up @@ -99,7 +96,6 @@ rm -rf $RPM_BUILD_ROOT
%{perllib}/NCG.pm
%{perllib}/NCG/
%{templatedir}/
%dir %attr(0770,nagios,nagios) /var/run/argo-ncg
%config(noreplace) %attr(0770,nagios,nagios) /etc/nagios/globus

%pre
Expand Down
2 changes: 1 addition & 1 deletion config/ncg-metric-config.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1785,7 +1785,7 @@
"X509_USER_PROXY" : "--user-proxy"
},
"config" : {
"interval" : 720,
"interval" : 20,
"maxCheckAttempts" : 2,
"path" : "$USER1$",
"retryInterval" : 60,
Expand Down
27 changes: 27 additions & 0 deletions config/ncg-metric-config.d/cert.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"eu.egi.CertValidity" : {
"attribute" : {
"NAGIOS_HOST_CERT" : "-C",
"NAGIOS_HOST_KEY" : "-K"
},
"parameter" : {
"-w" : "30 -c 0",
"-N" : "",
"--altnames" : "",
"--rootcert-dir" : "/etc/grid-security/certificates",
"--rootcert-file" : "/etc/pki/tls/certs/ca-bundle.crt"
},
"config" : {
"interval" : 240,
"maxCheckAttempts" : 2,
"path" : "$USER1$",
"retryInterval" : 30,
"timeout" : 60
},
"docurl" : "https://wiki.egi.eu/wiki/ROC_SAM_Tests#eu.egi.CertValidity",
"flags" : {
"OBSESS" : 1
},
"probe" : "check_ssl_cert"
}
}
30 changes: 30 additions & 0 deletions config/ncg-metric-config.d/cloudmon.conf
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,36 @@
},
"probe" : "novaprobe.py"
},
"eu.egi.cloud.OpenStack-VM-VOMS-OIDC" : {
"attribute" : {
"X509_USER_PROXY" : "--cert",
"OS_KEYSTONE_URL" : "--endpoint",
"OS_RESOURCE" : "--flavor",
"OS_IMAGE" : "--image",
"OIDC_ACCESS_TOKEN" : "--access-token"
},
"docurl" : "https://wiki.egi.eu/wiki/Cloud_SAM_tests",
"parameter" : {
"--capath" : "/etc/grid-security/certificates/"
},
"dependency" : {
"hr.srce.GridProxy-Valid" : 0,
"org.nagios.Keystone-TCP": 1
},
"flags" : {
"OBSESS" : 1,
"NOHOSTNAME" : 1,
"VO" : 1
},
"config" : {
"maxCheckAttempts" : 2,
"timeout" : 300,
"path" : "/usr/libexec/argo-monitoring/probes/fedcloud",
"interval" : 60,
"retryInterval" : 15
},
"probe" : "novaprobe.py"
},
"eu.egi.Keystone-IGTF" : {
"flags" : {
"OBSESS" : 1,
Expand Down
74 changes: 74 additions & 0 deletions config/ncg-metric-config.d/fts.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"eu.egi.FTS3-CertValidity" : {
"attribute" : {
"FTS_PORT" : "-p",
"NAGIOS_HOST_CERT" : "-C",
"NAGIOS_HOST_KEY" : "-K"
},
"parameter" : {
"-w" : "30 -c 0",
"-N" : "",
"--altnames" : "",
"--rootcert-dir" : "/etc/grid-security/certificates"
},
"config" : {
"interval" : 240,
"maxCheckAttempts" : 2,
"path" : "$USER1$",
"retryInterval" : 30,
"timeout" : 60
},
"docurl" : "https://wiki.egi.eu/wiki/ROC_SAM_Tests#eu.egi.FTS3-CertValidity",
"flags" : {
"OBSESS" : 1
},
"probe" : "check_ssl_cert"
},
"eu.egi.FTS3-IGTF" : {
"flags" : {
"OBSESS" : 1
},
"attribute" : {
"NAGIOS_HOST_CERT" : "--cert",
"NAGIOS_HOST_KEY" : "--key",
"FTS_PORT" : "-p"
},
"docurl" : "https://wiki.egi.eu/wiki/ROC_SAM_Tests#eu.egi.FTS3-IGTF",
"config" : {
"maxCheckAttempts" : 3,
"timeout" : 120,
"path" : "/usr/libexec/argo-monitoring/probes/igtf",
"interval" : 720,
"retryInterval" : 10
},
"parameter" : {
"--release-url" : "/var/lib/gridprobes-cadist/var/ca-policy-egi-core.release,http://repository.egi.eu/sw/production/cas/1/current/meta/ca-policy-egi-core.release",
"--igtf-list-url" : "/var/lib/gridprobes-cadist/var/ca-policy-egi-core.subjectdn,http://repository.egi.eu/sw/production/cas/1/current/meta/ca-policy-egi-core.subjectdn",
"--obsolete-list-url" : "/var/lib/gridprobes-cadist/var/ca-policy-egi-core.obsoleted-subjectdn,http://repository.egi.eu/sw/production/cas/1/current/meta/ca-policy-egi-core.obsoleted-subjectdn"
},
"probe" : "check_igtf_ca"
},
"eu.egi.HTTPS-IGTF" : {
"flags" : {
"OBSESS" : 1
},
"attribute" : {
"NAGIOS_HOST_CERT" : "--cert",
"NAGIOS_HOST_KEY" : "--key"
},
"docurl" : "https://wiki.egi.eu/wiki/ROC_SAM_Tests#eu.egi.CREAM-IGTF",
"config" : {
"maxCheckAttempts" : 3,
"timeout" : 120,
"path" : "/usr/libexec/argo-monitoring/probes/igtf",
"interval" : 720,
"retryInterval" : 10
},
"parameter" : {
"--release-url" : "/var/lib/gridprobes-cadist/var/ca-policy-egi-core.release,http://repository.egi.eu/sw/production/cas/1/current/meta/ca-policy-egi-core.release",
"--igtf-list-url" : "/var/lib/gridprobes-cadist/var/ca-policy-egi-core.subjectdn,http://repository.egi.eu/sw/production/cas/1/current/meta/ca-policy-egi-core.subjectdn",
"--obsolete-list-url" : "/var/lib/gridprobes-cadist/var/ca-policy-egi-core.obsoleted-subjectdn,http://repository.egi.eu/sw/production/cas/1/current/meta/ca-policy-egi-core.obsoleted-subjectdn"
},
"probe" : "check_igtf_ca"
}
}
4 changes: 2 additions & 2 deletions src/modules/NCG/LocalMetrics/POEM.pm
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ sub getData {
my $customMetricRef = {%{$metricRef}};

# hacks
if ($service eq 'CREAM-CE' && exists $metricRef->{parent} && $metricRef->{parent} eq 'emi.ce.CREAMCE-JobState') {
if ($service eq 'CREAM-CE' && exists $metricRef->{parent} && $metricRef->{parent} && $metricRef->{parent} eq 'emi.ce.CREAMCE-JobState') {
$customMetricRef->{parent} = 'emi.cream.CREAMCE-JobState';
}

Expand All @@ -146,7 +146,7 @@ sub getData {
$self->{SITEDB}->addVoFqan($vo, $customMetricRef->{vofqan}) unless ($voFqan eq '_ALL_');
$self->_addLocalMetric($customMetricRef, $host, $metric, $service);

if (exists $customMetricRef->{parent}) {
if (exists $customMetricRef->{parent} && $customMetricRef->{parent}) {
my $parent = $customMetricRef->{parent};
if (exists $self->{METRIC_CONFIG}->{$parent}) {
my $customParentMetricRef = {%{$self->{METRIC_CONFIG}->{$parent}}};
Expand Down
99 changes: 9 additions & 90 deletions src/modules/NCG/MetricConfig.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,116 +17,35 @@

package NCG::MetricConfig;

use JSON;
use strict;
use warnings;
use NCG;
use vars qw(@ISA);

@ISA=("NCG");

my $DEFAULT_METRIC_CONFIG_FILE = "/etc/ncg-metric-config.conf";
my $DEFAULT_METRIC_CONFIG_DIR = "/etc/ncg-metric-config.d/";

sub new : method {
my ($proto, $data) = @_;
my $class = ref($proto) || $proto;
my $self = $class->SUPER::new($data);

$self->{METRIC_CONFIG_FILE} = $DEFAULT_METRIC_CONFIG_FILE
unless ( defined $self->{METRIC_CONFIG_FILE} );
$self->{METRIC_CONFIG_DIR} = $DEFAULT_METRIC_CONFIG_DIR
unless ( defined $self->{METRIC_CONFIG_DIR} );

if (! -f $self->{METRIC_CONFIG_FILE})
{
$self->error("Can't find static file!");
undef $self;
return 0;
}

if (! -d $self->{METRIC_CONFIG_DIR})
{
$self->error("Can't find static directory!");
undef $self;
return 0;
}
my $filelist = [];
$self->_addRecurseDirs($filelist, $self->{METRIC_CONFIG_DIR});
foreach my $file (@$filelist) {
$self->{DB_FILES}->{$file} = 1 if ($file =~ /\.conf$/);
}

$self;
}

sub _loadMetrics {
my $self = shift;
my $file = shift;
my $result;
my $fileHndl;
my $jsonRef;

unless (open ($fileHndl, $file)) {
$self->error("Cannot open metric config file $file!");
return;
}
$result = join ("", <$fileHndl>);
eval {
$jsonRef = from_json($result);
};
if ($@) {
$self->error("Error parsing JSON response in file $file: ".$@);
return;
}
foreach my $metric (keys %{$jsonRef}) {
if (exists $self->{METRIC_CONFIG}->{$metric}) {
foreach my $attr (keys %{$jsonRef->{$metric}}) {
if ( ref $jsonRef->{$metric}->{$attr} eq "HASH" ) {
foreach my $attr2 (keys %{$jsonRef->{$metric}->{$attr}}) {
$self->{METRIC_CONFIG}->{$metric}->{$attr}->{$attr2} = $jsonRef->{$metric}->{$attr}->{$attr2};
}
} else {
$self->{METRIC_CONFIG}->{$metric}->{$attr} = $jsonRef->{$metric}->{$attr};
}
}
} else {
$self->{METRIC_CONFIG}->{$metric} = {%{$jsonRef->{$metric}}}
}
}
unless (close ($fileHndl)) {
$self->error("Cannot close metric config file $file!");
}
}


sub getData {
my $self = shift;
my $fileHndl;
$self->{METRIC_CONFIG} = {};

$self->_loadMetrics($self->{METRIC_CONFIG_FILE});

foreach my $file (keys %{$self->{DB_FILES}}) {
$self->_loadMetrics($file);
}
}

=head1 NAME
NCG::LocalMetrics
NCG::MetricConfig
=head1 DESCRIPTION
The NCG::LocalMetrics module is abstract class for extracting
information about local metrics which are available for each host.
Each module extending NCG::LocalMetrics must implement method
getMetrics.
The NCG::MetricConfig module is abstract class for extracting
metric configuration.
Each module extending NCG::MetricConfig must implement method
getData.
=head1 SYNOPSIS
use NCG::LocalMetrics;
$ncg = NCG::LocalMetrics->new( $attr );
use NCG::MetricConfig;
$ncg = NCG::MetricConfig->new( $attr );
$ncg->getData();
=cut
Expand All @@ -139,13 +58,13 @@ getMetrics.
$dbh = NCG::LocalMetrics->new( $attr );
Creates new NCG::LocalMetrics instance.
Creates new NCG::MetricConfig instance.
=item C<getData>
$ncg->getData ();
Abstract method for gathering metric information.
Abstract method for gathering metric configuration.
=back
Expand Down
Loading

0 comments on commit f967819

Please sign in to comment.