From eea495848f5b066e44f519704ffb78944f3822c9 Mon Sep 17 00:00:00 2001 From: eimamagi Date: Wed, 22 Apr 2020 12:26:41 +0200 Subject: [PATCH 01/12] ARGO-2409 Add generic PORT, SSL and PATH attributes ARGO-2401 Set GOCDB URL attribute --- src/modules/NCG/SiteInfo/GOCDB.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/modules/NCG/SiteInfo/GOCDB.pm b/src/modules/NCG/SiteInfo/GOCDB.pm index b8d2ecf..91b2b4e 100644 --- a/src/modules/NCG/SiteInfo/GOCDB.pm +++ b/src/modules/NCG/SiteInfo/GOCDB.pm @@ -21,6 +21,7 @@ use NCG::SiteInfo; use strict; use LWP::UserAgent; use XML::DOM; +use URI::URL; use vars qw(@ISA); @ISA=("NCG::SiteInfo"); @@ -204,6 +205,15 @@ sub getData { if ($child) { my $value = $child->getNodeValue(); if ($value) { + eval { + $url = url($value); + }; + unless ($@) { + $self->{SITEDB}->hostAttribute($hostname, 'PORT', $url->port) if ($url->port); + $self->{SITEDB}->hostAttribute($hostname, 'PATH', $url->path) if ($url->path); + $self->{SITEDB}->hostAttribute($hostname, 'SSL', 0) if ($url->scheme && $url->scheme eq 'https'); + } + $self->{SITEDB}->hostAttribute($hostname, 'URL', $value); $self->{SITEDB}->hostAttribute($hostname, $serviceType."_URL", $value); } } From 7d670588da7bd4aa657467791f968cd4b94928cf Mon Sep 17 00:00:00 2001 From: eimamagi Date: Wed, 22 Apr 2020 12:51:35 +0200 Subject: [PATCH 02/12] ARGO-2409 Add generic PORT, SSL and PATH attributes --- src/modules/NCG/SiteInfo/GOCDB.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/NCG/SiteInfo/GOCDB.pm b/src/modules/NCG/SiteInfo/GOCDB.pm index 91b2b4e..dc2a5fa 100644 --- a/src/modules/NCG/SiteInfo/GOCDB.pm +++ b/src/modules/NCG/SiteInfo/GOCDB.pm @@ -205,13 +205,14 @@ sub getData { if ($child) { my $value = $child->getNodeValue(); if ($value) { + my $url; eval { $url = url($value); }; unless ($@) { - $self->{SITEDB}->hostAttribute($hostname, 'PORT', $url->port) if ($url->port); - $self->{SITEDB}->hostAttribute($hostname, 'PATH', $url->path) if ($url->path); - $self->{SITEDB}->hostAttribute($hostname, 'SSL', 0) if ($url->scheme && $url->scheme eq 'https'); + eval { $self->{SITEDB}->hostAttribute($hostname, 'PORT', $url->port) if ($url->port); }; + eval { $self->{SITEDB}->hostAttribute($hostname, 'PATH', $url->path) if ($url->path); }; + eval { $self->{SITEDB}->hostAttribute($hostname, 'SSL', 0) if ($url->scheme && $url->scheme eq 'https'); }; } $self->{SITEDB}->hostAttribute($hostname, 'URL', $value); $self->{SITEDB}->hostAttribute($hostname, $serviceType."_URL", $value); From 5a6e9f6d0d32e327d4823e932d0e9f27aef2ee6d Mon Sep 17 00:00:00 2001 From: eimamagi Date: Wed, 22 Apr 2020 14:24:56 +0200 Subject: [PATCH 03/12] ARGO-2410 Remove UNICORE specific code --- argo-ncg.spec | 14 ++-- config/ncg.conf | 3 - config/unicore/UNICORE_Job.u | 13 ---- config/unicore/log4j-ucc-debug.properties | 7 -- config/unicore/log4j-ucc.properties | 7 -- config/unicore/log4j-uvosclc-debug.properties | 7 -- config/unicore/log4j-uvosclc.properties | 7 -- src/argo-java-keystore.sh | 40 ++++++++++++ ...-truststore.sh => argo-java-truststore.sh} | 0 src/argo-unicore-keystore.sh | 56 ---------------- src/modules/NCG/LocalMetricsAttrs/Active.pm | 64 +------------------ 11 files changed, 45 insertions(+), 173 deletions(-) delete mode 100644 config/unicore/UNICORE_Job.u delete mode 100644 config/unicore/log4j-ucc-debug.properties delete mode 100644 config/unicore/log4j-ucc.properties delete mode 100644 config/unicore/log4j-uvosclc-debug.properties delete mode 100644 config/unicore/log4j-uvosclc.properties create mode 100644 src/argo-java-keystore.sh rename src/{argo-unicore-truststore.sh => argo-java-truststore.sh} (100%) delete mode 100644 src/argo-unicore-keystore.sh diff --git a/argo-ncg.spec b/argo-ncg.spec index 4e53be5..e8b49d3 100644 --- a/argo-ncg.spec +++ b/argo-ncg.spec @@ -37,8 +37,8 @@ install --directory $RPM_BUILD_ROOT%{_sbindir} install --directory $RPM_BUILD_ROOT/usr/libexec/%{name} install --mode=755 ncg.pl $RPM_BUILD_ROOT%{_sbindir} install --mode=755 ncg.reload.sh $RPM_BUILD_ROOT%{_sbindir} -install --mode=755 argo-unicore-keystore.sh $RPM_BUILD_ROOT/usr/libexec/%{name} -install --mode=755 argo-unicore-truststore.sh $RPM_BUILD_ROOT/usr/libexec/%{name} +install --mode=755 argo-java-keystore.sh $RPM_BUILD_ROOT/usr/libexec/%{name} +install --mode=755 argo-java-truststore.sh $RPM_BUILD_ROOT/usr/libexec/%{name} # # Config @@ -52,7 +52,6 @@ install check_logfiles_ncg.conf $RPM_BUILD_ROOT%{configdir} install --directory $RPM_BUILD_ROOT/etc/nagios/argo-ncg.d install --directory $RPM_BUILD_ROOT/etc/nagios/globus -cp -r unicore $RPM_BUILD_ROOT/etc/nagios # # modules # @@ -76,16 +75,11 @@ rm -rf $RPM_BUILD_ROOT %config(noreplace) %{configdir}/ncg.localdb.example %config(noreplace) %{configdir}/ncg-localdb.d %config(noreplace) /etc/nagios/argo-ncg.d -%config(noreplace) /etc/nagios/unicore/log4j-ucc.properties -%config(noreplace) /etc/nagios/unicore/log4j-ucc-debug.properties -%config(noreplace) /etc/nagios/unicore/log4j-uvosclc.properties -%config(noreplace) /etc/nagios/unicore/log4j-uvosclc-debug.properties -/etc/nagios/unicore/UNICORE_Job.u %{configdir}/check_logfiles_ncg.conf %{_sbindir}/ncg.pl %{_sbindir}/ncg.reload.sh -/usr/libexec/%{name}/argo-unicore-keystore.sh -/usr/libexec/%{name}/argo-unicore-truststore.sh +/usr/libexec/%{name}/argo-java-keystore.sh +/usr/libexec/%{name}/argo-java-truststore.sh %{perllib}/NCG.pm %{perllib}/NCG/ diff --git a/config/ncg.conf b/config/ncg.conf index 7653c89..a0e6087 100644 --- a/config/ncg.conf +++ b/config/ncg.conf @@ -20,7 +20,6 @@ VO = dteam # Some optional config # # NAGIOS_SERVER = nagios.fqdn -# ENABLE_UNICORE_PROBES=1 # MYPROXY_SERVER = myproxy.fqdn # Configuration of individual NCG modules. @@ -50,7 +49,6 @@ VO = dteam GOCDB_ROOT_URL=https://goc.egi.eu/gocdbpi - ENABLE_UNICORE_PROBES=$ENABLE_UNICORE_PROBES ROC=NGI_HR @@ -89,7 +87,6 @@ VO = dteam GOCDB_ROOT_URL=https://goc.egi.eu/gocdbpi - ENABLE_UNICORE_PROBES=$ENABLE_UNICORE_PROBES BDII_HOST=bdii.fqdn INCLUDE_PROXY_CHECKS = 1 INCLUDE_MSG_CHECKS_SEND = 0 diff --git a/config/unicore/UNICORE_Job.u b/config/unicore/UNICORE_Job.u deleted file mode 100644 index 06850d4..0000000 --- a/config/unicore/UNICORE_Job.u +++ /dev/null @@ -1,13 +0,0 @@ -{ - Executable: "date", - - Name: "Simple UNICORE Job", - - Description: "Simple script that tests stardard UNICORE installation (everything except Workflow services)", - - Resources: { - CPUs: 1, - Memory: 300M, - Runtime: 120 - }, -} diff --git a/config/unicore/log4j-ucc-debug.properties b/config/unicore/log4j-ucc-debug.properties deleted file mode 100644 index 2beafa9..0000000 --- a/config/unicore/log4j-ucc-debug.properties +++ /dev/null @@ -1,7 +0,0 @@ -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=DEBUG, A1 - -log4j.appender.A1=org.apache.log4j.FileAppender -log4j.appender.A1.File=ucc.log -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c{1} %x - %m%n diff --git a/config/unicore/log4j-ucc.properties b/config/unicore/log4j-ucc.properties deleted file mode 100644 index f3f43e4..0000000 --- a/config/unicore/log4j-ucc.properties +++ /dev/null @@ -1,7 +0,0 @@ -# Set root logger level to INFO and its only appender to A1. -log4j.rootLogger=INFO, A1 - -log4j.appender.A1=org.apache.log4j.FileAppender -log4j.appender.A1.File=ucc.log -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c{1} %x - %m%n diff --git a/config/unicore/log4j-uvosclc-debug.properties b/config/unicore/log4j-uvosclc-debug.properties deleted file mode 100644 index a57d25d..0000000 --- a/config/unicore/log4j-uvosclc-debug.properties +++ /dev/null @@ -1,7 +0,0 @@ -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=DEBUG, A1 - -log4j.appender.A1=org.apache.log4j.FileAppender -log4j.appender.A1.File=uvosclc.log -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n diff --git a/config/unicore/log4j-uvosclc.properties b/config/unicore/log4j-uvosclc.properties deleted file mode 100644 index 6b5400d..0000000 --- a/config/unicore/log4j-uvosclc.properties +++ /dev/null @@ -1,7 +0,0 @@ -# Set root logger level to INFO and its only appender to A1. -log4j.rootLogger=INFO, A1 - -log4j.appender.A1=org.apache.log4j.FileAppender -log4j.appender.A1.File=uvosclc.log -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n diff --git a/src/argo-java-keystore.sh b/src/argo-java-keystore.sh new file mode 100644 index 0000000..bd64743 --- /dev/null +++ b/src/argo-java-keystore.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +ROBOT_CERT=/etc/nagios/globus/robocert.pem +ROBOT_KEY=/etc/nagios/globus/robokey.pem +KEYSTORE_DIR=/etc/nagios/globus +NCG_CONFIG_FILE=/etc/argo-ncg/ncg-localdb.d/java-keystore.conf + +if [ ! -f $ROBOT_CERT ]; then + echo "Please install robot certificate to $ROBOT_CERT" + exit -1 +fi +if [ ! -f $ROBOT_KEY ]; then + echo "Please install robot key to $ROBOT_KEY" + exit -1 +fi + +# if parameter is passed, reuse password +if [ "$#" -eq 0 ]; then + KEYSTORE_PASS=`head /dev/urandom | tr -dc A-Za-z0-9 | head -c20` +else + KEYSTORE_OLD_PASS=`grep "^GLOBAL_ATTRIBUTE\!KEYSTORE_PASSWORD\!" $NCG_CONFIG_FILE 2>/dev/null` + if [ $? -ne 0 ]; then + echo "Cannot find old password in $NCG_CONFIG_FILE" + exit -1 + else + KEYSTORE_PASS=${KEYSTORE_OLD_PASS#'GLOBAL_ATTRIBUTE!KEYSTORE_PASSWORD!'} + fi +fi + +# Generate keystore +rm -f $KEYSTORE_DIR/keystore.jks.tmp $KEYSTORE_DIR/tmp.p12 +openssl pkcs12 -export -in $ROBOT_CERT -inkey $ROBOT_KEY -name mon_agent -out $KEYSTORE_DIR/tmp.p12 -passout pass:$KEYSTORE_PASS +keytool -importkeystore -srckeystore $KEYSTORE_DIR/tmp.p12 -srcstoretype PKCS12 -deststoretype jks -deststorepass $KEYSTORE_PASS -destkeystore $KEYSTORE_DIR/keystore.jks.tmp -srcstorepass $KEYSTORE_PASS -destalias mon_agent -srcalias mon_agent +rm -f $KEYSTORE_DIR/tmp.p12 +chown nagios:nagios $KEYSTORE_DIR/keystore.jks.tmp +chmod 400 $KEYSTORE_DIR/keystore.jks.tmp +mv -f $KEYSTORE_DIR/keystore.jks.tmp $KEYSTORE_DIR/keystore.jks + +# Pass keypass to NCG +echo "GLOBAL_ATTRIBUTE!KEYSTORE_PASSWORD!$KEYSTORE_PASS" > $NCG_CONFIG_FILE diff --git a/src/argo-unicore-truststore.sh b/src/argo-java-truststore.sh similarity index 100% rename from src/argo-unicore-truststore.sh rename to src/argo-java-truststore.sh diff --git a/src/argo-unicore-keystore.sh b/src/argo-unicore-keystore.sh deleted file mode 100644 index c7b27fa..0000000 --- a/src/argo-unicore-keystore.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh - -ROBOT_CERT=/etc/nagios/globus/robocert.pem -ROBOT_KEY=/etc/nagios/globus/robokey.pem - -if [ ! -f $ROBOT_CERT ]; then - echo "Please install robot certificate to $ROBOT_CERT" - exit -1 -fi -if [ ! -f $ROBOT_KEY ]; then - echo "Please install robot key to $ROBOT_KEY" - exit -1 -fi - -# if parameter is passed, reuse password -if [ "$#" -eq 0 ]; then - UNICORE_KEYSTORE_PASS=`head /dev/urandom | tr -dc A-Za-z0-9 | head -c20` -else - UNICORE_OLD_PASS=`grep "^credential.password=" /etc/nagios/unicore/ucc.config 2>/dev/null` - if [ $? -ne 0 ]; then - echo "Cannot find credential.password in /etc/nagios/unicore/ucc.config" - exit -1 - else - UNICORE_KEYSTORE_PASS=${UNICORE_OLD_PASS#'credential.password='} - fi -fi - -# Generate keystore -rm -f /etc/nagios/unicore/keystore.jks.tmp /etc/nagios/unicore/tmp.p12 -openssl pkcs12 -export -in $ROBOT_CERT -inkey $ROBOT_KEY -name mon_agent -out /etc/nagios/unicore/tmp.p12 -passout pass:$UNICORE_KEYSTORE_PASS -keytool -importkeystore -srckeystore /etc/nagios/unicore/tmp.p12 -srcstoretype PKCS12 -deststoretype jks -deststorepass $UNICORE_KEYSTORE_PASS -destkeystore /etc/nagios/unicore/keystore.jks.tmp -srcstorepass $UNICORE_KEYSTORE_PASS -destalias mon_agent -srcalias mon_agent -rm -f /etc/nagios/unicore/tmp.p12 -chown nagios:nagios /etc/nagios/unicore/keystore.jks.tmp -chmod 400 /etc/nagios/unicore/keystore.jks.tmp -mv -f /etc/nagios/unicore/keystore.jks.tmp /etc/nagios/unicore/keystore.jks - -# Pass keypass to NCG -echo "GLOBAL_ATTRIBUTE!KEYSTORE_PASSWORD!$UNICORE_KEYSTORE_PASS" > /etc/argo-ncg/ncg-localdb.d/java-keystore.conf - -# Generate UNICORE config -cat << EOF > /etc/nagios/unicore/ucc.config -credential.path=/etc/nagios/unicore/keystore.jks -credential.password=$UNICORE_KEYSTORE_PASS -credential.keyAlias=mon_agent -truststore.type=keystore -truststore.keystorePath=/etc/nagios/globus/truststore.ts -truststore.keystorePassword=password -output=. -EOF -chmod 400 /etc/nagios/unicore/ucc.config -chown nagios:nagios /etc/nagios/unicore/* - -# Generate UNICORE log directory -mkdir -p /var/log/unicore -chmod 750 /var/log/unicore -chown nagios:nagios /var/log/unicore diff --git a/src/modules/NCG/LocalMetricsAttrs/Active.pm b/src/modules/NCG/LocalMetricsAttrs/Active.pm index f9ef1e2..147b172 100644 --- a/src/modules/NCG/LocalMetricsAttrs/Active.pm +++ b/src/modules/NCG/LocalMetricsAttrs/Active.pm @@ -67,25 +67,11 @@ sub getData { $self->_analyzeBDII($hostname, $sitename); $self->_analyzeMDS($hostname, $sitename); - $self->_analyzeTargetSystemFactory($hostname); - $self->_analyzeSAM($hostname, $sitename); $self->_removeProxyChecks($hostname) unless ($self->{INCLUDE_PROXY_CHECKS}); $self->_analyzeURLs($hostname, $sitename); } - - unless ($self->{ENABLE_UNICORE_PROBES}) { - $self->{SITEDB}->removeMetric(undef, undef, 'emi.unicore.Gateway'); - $self->{SITEDB}->removeMetric(undef, undef, 'emi.unicore.Registry'); - $self->{SITEDB}->removeMetric(undef, undef, 'emi.unicore.ServiceOrchestrator'); - $self->{SITEDB}->removeMetric(undef, undef, 'emi.unicore.UVOS'); - $self->{SITEDB}->removeMetric(undef, undef, 'emi.unicore.TargetSystemFactory'); - $self->{SITEDB}->removeMetric(undef, undef, 'emi.unicore.GlobalStorage'); - $self->{SITEDB}->removeMetric(undef, undef, 'emi.unicore.GlobalStorage-FreeSpace'); - $self->{SITEDB}->removeMetric(undef, undef, 'emi.unicore.WorkflowService'); - } - } 1; @@ -215,19 +201,6 @@ sub _analyzeSAM { } } -sub _analyzeTargetSystemFactory { - my $self = shift; - my $hostname = shift; - my $url; - - if ($self->{SITEDB}->hasService($hostname, "unicore6.TargetSystemFactory")) { - if ($url = $self->{SITEDB}->hostAttribute($hostname, "unicore6.TargetSystemFactory_URL")) { - my @addr = split(/\//, $url); - $self->{SITEDB}->hostAttribute($hostname, "TSF_SITE_NAME", $addr[3]) if ($addr[3]); - } - } -} - sub _analyzeBDII { my $self = shift; my $hostname = shift; @@ -341,14 +314,6 @@ sub _analyzeURLs { } } - my @unicoreServices = ("unicore6.Gateway", "unicore6.ServiceOrchestrator", "unicore6.StorageManagement", "unicore6.TargetSystemFactory", "unicore6.UVOSAssertionQueryService", "unicore6.WorkflowFactory", "unicore6.StorageFactory"); - foreach my $unicoreService (@unicoreServices) { - if ($attr = $self->{SITEDB}->hostAttribute($hostname, "${unicoreService}_URL")) { - $attr =~ s#^(.*)/[A-Za-z]+(\?res=[a-z_]+)?$#$1/Registry?res=default_registry#; - $self->{SITEDB}->hostAttribute($hostname, "LOCAL_${unicoreService}_REGISTRY_URL", $attr); - } - } - if ($self->{SITEDB}->hasService($hostname, "egi.SAM")) { $self->{SITEDB}->hostAttribute($hostname, "MYEGI_HOST_URL", 'http://'.$self->{SITEDB}->hostName($hostname).'/'); } @@ -458,26 +423,6 @@ sub _setStaticHostAttrs { my $hostname = shift; $self->{SITEDB}->hostAttribute($hostname, "HOST_NAME", $self->{SITEDB}->hostName($hostname)); - - if ($self->{ENABLE_UNICORE_PROBES}) { - my $unicoreLog = "/var/log/unicore/$hostname"; - $self->{SITEDB}->hostAttribute($hostname, "UNICORE_LOGS_DIR", $unicoreLog); - unless ( -d $unicoreLog ) { - unless (mkdir $unicoreLog) { - $self->error("Cannot create UNICORE_LOGS_DIR: $unicoreLog."); - return; - } - my ($login,$pass,$uid,$gid); - unless ( ($login,$pass,$uid,$gid) = getpwnam("nagios") ) { - $self->error("User nagios does not exist."); - return; - } - unless ( chown $uid, $gid, $unicoreLog ) { - $self->error("Failed changing the ownership of UNICORE_LOGS_DIR $unicoreLog to user nagios."); - return; - } - } - } } sub _setStaticAttrs { @@ -495,16 +440,9 @@ sub _setStaticAttrs { $self->{SITEDB}->globalAttribute("SITENAME", $self->{SITENAME}); $self->{SITEDB}->globalAttribute("GOCDB_ROOT_URL", $self->{GOCDB_ROOT_URL}); $self->{SITEDB}->globalAttribute("PROXY_LIFETIME", $self->{PROXY_LIFETIME}); - - # UNICORE attributes - $self->{SITEDB}->globalAttribute("UVOS_CLIENT_PATH", '/usr/bin/uvos-clc'); - $self->{SITEDB}->globalAttribute("UCC_PATH", '/usr/bin/ucc'); $self->{SITEDB}->globalAttribute("JAVA_PATH", 'java'); - $self->{SITEDB}->globalAttribute("UCC_CONFIG", '/etc/nagios/unicore/ucc.config'); - $self->{SITEDB}->globalAttribute("UNICORE_JOB_FILE", '/etc/nagios/unicore/UNICORE_Job.u'); - $self->{SITEDB}->globalAttribute("TOP_BDII", $self->{BDII_HOST}); - $self->{SITEDB}->globalAttribute("KEYSTORE", '/etc/nagios/unicore/keystore.jks'); + $self->{SITEDB}->globalAttribute("KEYSTORE", '/etc/nagios/globus/keystore.jks'); $self->{SITEDB}->globalAttribute("TRUSTSTORE", '/etc/nagios/globus/truststore.ts'); } From a88c415072ae0f596d99f1ed435707ccb972bf79 Mon Sep 17 00:00:00 2001 From: eimamagi Date: Thu, 23 Apr 2020 10:35:20 +0200 Subject: [PATCH 04/12] ARGO-2344 Remove file parameters & attributes --- src/modules/NCG/ConfigGen/Nagios.pm | 23 -------- src/modules/NCG/LocalMetrics.pm | 6 -- src/modules/NCG/SiteDB.pm | 87 ----------------------------- 3 files changed, 116 deletions(-) diff --git a/src/modules/NCG/ConfigGen/Nagios.pm b/src/modules/NCG/ConfigGen/Nagios.pm index 88e2338..890e95a 100644 --- a/src/modules/NCG/ConfigGen/Nagios.pm +++ b/src/modules/NCG/ConfigGen/Nagios.pm @@ -1075,33 +1075,10 @@ sub _getMetricOptionString { my $nrpe = shift; my $attributes = $self->{SITEDB}->metricAttributes($host, $metric); my $parameters = $self->{SITEDB}->metricParameters($host, $metric); - my $fileAttributes = $self->{SITEDB}->metricFileAttributes($host, $metric); - my $fileParameters = $self->{SITEDB}->metricFileParameters($host, $metric); my $options = ""; my $fileName = ""; my $finalFileName = ""; - # file attrs/params exist, need to create the file - if ($fileAttributes && %$fileAttributes || $fileParameters && %$fileParameters) { - my $CONFIG; - $fileName = $self->{OUTPUT_DIR} . "/" . $host . "_" . $metric . ".config"; - $finalFileName = $self->{FINAL_OUTPUT_DIR} . "/" . $host . "_" . $metric . ".config"; - if (!open ($CONFIG, ">" . $fileName)) { - $self->error("Cannot open configuration file ".$fileName."!"); - return; - } - foreach my $attr (keys %$fileAttributes) { - my $value = $self->_getAttributeValue($host, $attr, $vo, $voFqan); - next unless($value); - - print $CONFIG $fileAttributes->{$attr} . '="' . $value . "\"\n"; - } - foreach my $param (keys %$fileParameters) { - print $CONFIG $param . '="' . $fileParameters->{$param} . "\"\n"; - } - close $CONFIG; - } - if (exists $attributes->{METRIC_CONFIG_FILE}) { $options .= $attributes->{METRIC_CONFIG_FILE} . ' ' . $finalFileName . ' '; } diff --git a/src/modules/NCG/LocalMetrics.pm b/src/modules/NCG/LocalMetrics.pm index de6f55b..d9104a9 100644 --- a/src/modules/NCG/LocalMetrics.pm +++ b/src/modules/NCG/LocalMetrics.pm @@ -37,16 +37,12 @@ sub _addLocalMetric : method { my $depRef = {}; my $attrRef = {}; my $paramRef = {}; - my $attrFileRef = {}; - my $paramFileRef = {}; my $flagsRef = {}; my $parent; $confRef = {%{$metricRef->{config}}} if (exists $metricRef->{config}); $attrRef = {%{$metricRef->{attribute}}} if (exists $metricRef->{attribute}); $paramRef = {%{$metricRef->{parameter}}} if (exists $metricRef->{parameter}); - $attrFileRef = {%{$metricRef->{file_attribute}}} if (exists $metricRef->{file_attribute}); - $paramFileRef = {%{$metricRef->{file_parameter}}} if (exists $metricRef->{file_parameter}); $depRef = {%{$metricRef->{dependency}}} if (exists $metricRef->{dependency}); $flagsRef = {%{$metricRef->{flags}}} if (exists $metricRef->{flags}); $parent = $metricRef->{parent} if (exists $metricRef->{parent}); @@ -58,8 +54,6 @@ sub _addLocalMetric : method { $confRef, $attrRef, $paramRef, - $attrFileRef, - $paramFileRef, $depRef, $flagsRef, $parent, diff --git a/src/modules/NCG/SiteDB.pm b/src/modules/NCG/SiteDB.pm index 16cd764..903d050 100644 --- a/src/modules/NCG/SiteDB.pm +++ b/src/modules/NCG/SiteDB.pm @@ -219,8 +219,6 @@ sub addLocalMetric my $config = shift; my $attributes = shift; my $parameters = shift; - my $fileAttributes = shift; - my $fileParameters = shift; my $dependencies = shift; my $flags = shift; my $parent = shift; @@ -257,8 +255,6 @@ sub addLocalMetric $self->{HOSTS}->{$host}->{METRICS}->{$metric}->{CONFIG} = $config; $self->{HOSTS}->{$host}->{METRICS}->{$metric}->{ATTRIBUTES} = $attributes; $self->{HOSTS}->{$host}->{METRICS}->{$metric}->{PARAMETERS} = $parameters; - $self->{HOSTS}->{$host}->{METRICS}->{$metric}->{FILE_ATTRIBUTES} = $fileAttributes; - $self->{HOSTS}->{$host}->{METRICS}->{$metric}->{FILE_PARAMETERS} = $fileParameters; } $self->{METRIC_COUNT}++; @@ -1032,44 +1028,6 @@ sub metricAttribute } } -sub metricFileAttributes -{ - my $self = shift; - - $self->debugSub(@_); - - my $host = shift || return; - my $metric = shift || return; - my $value = shift; - - $self->_metricField ($host, $metric, "FILE_ATTRIBUTES", $value); -} - -sub metricFileAttribute -{ - my $self = shift; - - $self->debugSub(@_); - - my $host = shift; - my $metric = shift || return; - my $attr = shift || return; - my $value = shift; - - if (!$host) { - foreach my $hostname (keys %{$self->{HOSTS}}) { - if (exists $self->{HOSTS}->{$hostname}->{METRICS}->{$metric}) { - $self->_metricHashField ($hostname, $metric, "FILE_ATTRIBUTES", $attr, $value); - } - } - if (exists $self->{METRICS}->{$metric}) { - $self->{METRICS}->{$metric}->{FILE_ATTRIBUTES}->{$attr} = $value; - } - } else { - $self->_metricHashField ($host, $metric, "FILE_ATTRIBUTES", $attr, $value); - } -} - sub metricParameters { my $self = shift; @@ -1108,44 +1066,6 @@ sub metricParameter } } -sub metricFileParameters -{ - my $self = shift; - - $self->debugSub(@_); - - my $host = shift || return; - my $metric = shift || return; - my $value = shift; - - $self->_metricField ($host, $metric, "FILE_PARAMETERS", $value); -} - -sub metricFileParameter -{ - my $self = shift; - - $self->debugSub(@_); - - my $host = shift; - my $metric = shift || return; - my $param = shift || return; - my $value = shift; - - if (!$host) { - foreach my $hostname (keys %{$self->{HOSTS}}) { - if (exists $self->{HOSTS}->{$hostname}->{METRICS}->{$metric}) { - $self->_metricHashField ($hostname, $metric, "FILE_PARAMETERS", $param, $value); - } - } - if (exists $self->{METRICS}->{$metric}) { - $self->{METRICS}->{$metric}->{FILE_PARAMETERS}->{$param} = $value; - } - } else { - $self->_metricHashField ($host, $metric, "FILE_PARAMETERS", $param, $value); - } -} - sub metricDependencies { my $self = shift; @@ -1976,10 +1896,6 @@ Structure of HOSTS is following: value=parametername - PARAMETERS: parameters hash (local only) parametername=[value] - - FILE_ATTRIBUTES: attributes hash (local only) - value=parametername - - FILE_PARAMETERS: parameters hash (local only) - parametername=[value] - DEPENDENCIES: array of metrics which metric depends on (local only) - PASSIVE: metric is part of a complex check, e.g. SAM tests (local only) - PARENT: name of the metric which is executing complex check (local only) @@ -2044,7 +1960,6 @@ Result is 1 if operation is successful, 0 otherwise. $res = $ncg->addLocalMetric( $host, $metric, $probe, $config, $attributes, $parameters, - $fileAttributes, $fileParameters, $dependencies, $flags, $parent, $docUrl); Adds new local metric to host. If host doesn't exist, method returns error. @@ -2056,8 +1971,6 @@ Parameters are: - $config: configuration paramteres hash (name=>value) - $attributes: attributes hash (name=>value) - $parameters: parameters hash (name=>value) - - $fileAttributes: attributes hash to be stored to file (name=>value) - - $fileParameters: parameters hash to be stored to file (name=>value) - $dependencies: dependencies hash (parentMetric=>value); value is 1 for host internal dependencies and 0 for external (e.g. GridProxy-Valid) From 3f45655a10246c6a3fcab2a3bfcad3794c5860d1 Mon Sep 17 00:00:00 2001 From: eimamagi Date: Sun, 3 May 2020 22:34:28 +0200 Subject: [PATCH 05/12] ARGO-2407 Change OBSESS flag logic --- src/modules/NCG/ConfigGen/Nagios.pm | 6 +++++- src/modules/NCG/SiteDB.pm | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modules/NCG/ConfigGen/Nagios.pm b/src/modules/NCG/ConfigGen/Nagios.pm index 890e95a..204e2ff 100644 --- a/src/modules/NCG/ConfigGen/Nagios.pm +++ b/src/modules/NCG/ConfigGen/Nagios.pm @@ -1695,11 +1695,15 @@ sub _genServices { my $passive = $self->{SITEDB}->metricFlag($host, $metric, "PASSIVE"); my $isNrpe = $self->{NRPE_UI} && $self->{SITEDB}->metricFlag($host, $metric, "NRPE"); my $serviceType = join (',', $self->{SITEDB}->metricServices($host, $metric)); - my $obsess = $self->{SITEDB}->metricFlag($host, $metric, "OBSESS") || 0; + my $obsess = 1; my $contactgroupLocal = $contactgroup; my $roc = $self->{SITEDB}->siteROC || $self->{ROC}; my $metricVo = $self->{SITEDB}->metricFlag($host, $metric, "VO"); + if ($self->{SITEDB}->metricFlag($host, $metric, "NOPUBLISH")) { + $obsess = 0; + } + my $custom = {}; $custom->{"_site_name"} = $sitename; $custom->{"_metric_name"} = $metric; diff --git a/src/modules/NCG/SiteDB.pm b/src/modules/NCG/SiteDB.pm index 903d050..ebaac0b 100644 --- a/src/modules/NCG/SiteDB.pm +++ b/src/modules/NCG/SiteDB.pm @@ -1982,7 +1982,7 @@ Parameters are: - PNP: generate action_url pointing to PNP data - SUDO: command is executed via sudo - NOHOSTNAME: command is not passed -H parameter - - OBSESS: metric results should be published via obsess command + - NOPUBLISH: metric results should NOT be published via obsess command - NRPE_SERVICE: metric should be executed via NRPE on service node - REQUIREMENT: metric should be generated if req. metric is present on some site From 5642bcb47c5c63ea7aca0567c1099b77140f4d75 Mon Sep 17 00:00:00 2001 From: eimamagi Date: Mon, 4 May 2020 11:20:52 +0200 Subject: [PATCH 06/12] ARGO-2425 Set default VO to ops --- src/modules/NCG/ConfigGen/Nagios.pm | 8 ++++---- src/ncg.pl | 15 ++++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/modules/NCG/ConfigGen/Nagios.pm b/src/modules/NCG/ConfigGen/Nagios.pm index 204e2ff..6d89fd9 100644 --- a/src/modules/NCG/ConfigGen/Nagios.pm +++ b/src/modules/NCG/ConfigGen/Nagios.pm @@ -36,7 +36,7 @@ my $DEFAULT_PROXY_FILE = '/etc/nagios/globus/userproxy.pem'; my $DEFAULT_MYPROXY_NAME = 'NagiosRetrieve'; my $DEFAULT_MYPROXY_USER = 'nagios'; my $DEFAULT_NAGIOS_USER = 'nagios'; -my $DEFAULT_VO = 'dteam'; +my $DEFAULT_VO = 'ops'; my $DEFAULT_NOTIFICATION_HEADER = 'ARGO-MON'; my $DEFAULT_AMS_METRIC_QUEUES = '/var/spool/argo-nagios-ams-publisher/metrics/ /var/spool/argo-nagios-ams-publisher/metricsdevel/'; @@ -46,7 +46,7 @@ my $PNP_ACTION_URL = '/nagios/html/pnp4nagios/index.php?host=$HOSTNAME$&srv=$SER my $DEFAULT_CHECK_PING = 1; my $DEFAULT_ENABLE_FLAP_DETECTION = 0; -my $DEFAULT_VO_HOST_FILTER = 1; +my $DEFAULT_VO_HOST_FILTER = 0; my $CONFIGURATION_TEMPLATES = { @@ -2396,7 +2396,7 @@ reference that can contain following elements: VO - which VO credentials should be used for local probes. It is possible to define multiple VOs with comma separated list: VO = vo1,vo2,vo3,... - (default: dteam) + (default: ops) VO__DEFAULT_VO_FQAN - if defined NCG will generate all checks for listed FQANs on profiles which are not tied to FQANs. In case of @@ -2407,7 +2407,7 @@ reference that can contain following elements: VO_HOST_FILTER - if defined NCG will generate configuration only for hosts that support defined VOs. - (default: 1) + (default: 0) Constructor checks if all templates are present and if output directory is writeable. diff --git a/src/ncg.pl b/src/ncg.pl index bcf296a..4154d6d 100644 --- a/src/ncg.pl +++ b/src/ncg.pl @@ -254,7 +254,6 @@ sub getConfig { # set default values $conf{NAGIOS_SERVER} = hostname() unless ($conf{NAGIOS_SERVER}); - $conf{VO} = 'dteam' unless ($conf{VO}); $conf{NAGIOS_ADMIN} = 'root@localhost' unless ($conf{NAGIOS_ADMIN}); $conf{PROBES_TYPE} = 'all' unless ($conf{PROBES_TYPE}); @@ -374,12 +373,14 @@ sub createNagiosSite { $siteDB->addHost($confLocal->{NRPE_UI}); $siteDB->addService($confLocal->{NRPE_UI}, 'NRPE'); } - $confLocal->{VO} =~ s/^\s+//; - $confLocal->{VO} =~ s/\s+$//; - foreach my $vo ( split (/\s*,\s*/, $confLocal->{VO}) ) { - $siteDB->addVO($confLocal->{NAGIOS_SERVER}, 'NAGIOS', $vo); - $siteDB->addVO($confLocal->{MYPROXY_SERVER}, 'MyProxy', $vo) if ($confLocal->{MYPROXY_SERVER}); - } + if (exists $confLocal->{VO}) { + $confLocal->{VO} =~ s/^\s+//; + $confLocal->{VO} =~ s/\s+$//; + foreach my $vo ( split (/\s*,\s*/, $confLocal->{VO}) ) { + $siteDB->addVO($confLocal->{NAGIOS_SERVER}, 'NAGIOS', $vo); + $siteDB->addVO($confLocal->{MYPROXY_SERVER}, 'MyProxy', $vo) if ($confLocal->{MYPROXY_SERVER}); + } + } # SiteContact mimic $siteDB->addContact($confLocal->{NAGIOS_ADMIN}); From 2efa2b6229e108fa24c565783322053c4586919d Mon Sep 17 00:00:00 2001 From: eimamagi Date: Mon, 4 May 2020 15:27:18 +0200 Subject: [PATCH 07/12] ARGO-2423 Use standard OS CA bundle --- src/modules/NCG/SiteContacts/GOCDB.pm | 3 +-- src/modules/NCG/SiteInfo/EOSC.pm | 3 +-- src/modules/NCG/SiteInfo/GOCDB.pm | 8 ++------ src/modules/NCG/SiteSet/EOSC.pm | 6 +----- src/modules/NCG/SiteSet/GOCDB.pm | 2 +- 5 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/modules/NCG/SiteContacts/GOCDB.pm b/src/modules/NCG/SiteContacts/GOCDB.pm index 54b8959..dcf6cec 100644 --- a/src/modules/NCG/SiteContacts/GOCDB.pm +++ b/src/modules/NCG/SiteContacts/GOCDB.pm @@ -123,9 +123,8 @@ sub getData { $ENV{HTTPS_KEY_FILE} = $self->{X509_KEY}; $ENV{HTTPS_CERT_FILE} = $self->{X509_CERT}; - $ENV{HTTPS_CA_DIR} = '/etc/grid-security/certificates'; - my $ua = LWP::UserAgent->new(timeout=>$self->{TIMEOUT}, env_proxy => 1, ssl_opts => { SSL_key_file => $self->{X509_KEY}, SSL_cert_file => $self->{X509_CERT}, SSL_ca_path => '/etc/grid-security/certificates' }); + my $ua = LWP::UserAgent->new(timeout=>$self->{TIMEOUT}, env_proxy => 1, ssl_opts => { SSL_key_file => $self->{X509_KEY}, SSL_cert_file => $self->{X509_CERT}, }); $ua->agent('NCG::SiteContacts::GOCDB'); my $url = $self->{GOCDB_ROOT_URL} . $self->{GOCDB_GET_METHOD}; diff --git a/src/modules/NCG/SiteInfo/EOSC.pm b/src/modules/NCG/SiteInfo/EOSC.pm index 1815bbd..53cb6d7 100644 --- a/src/modules/NCG/SiteInfo/EOSC.pm +++ b/src/modules/NCG/SiteInfo/EOSC.pm @@ -85,9 +85,8 @@ sub getData } else { $ENV{HTTPS_KEY_FILE} = $self->{X509_KEY}; $ENV{HTTPS_CERT_FILE} = $self->{X509_CERT}; - $ENV{HTTPS_CA_DIR} = '/etc/grid-security/certificates'; - my $ua = LWP::UserAgent->new(timeout=>$self->{TIMEOUT}, env_proxy => 1, ssl_opts => { SSL_key_file => $self->{X509_KEY}, SSL_cert_file => $self->{X509_CERT}, SSL_ca_path => '/etc/grid-security/certificates' }); + my $ua = LWP::UserAgent->new(timeout=>$self->{TIMEOUT}, env_proxy => 1, ssl_opts => { SSL_key_file => $self->{X509_KEY}, SSL_cert_file => $self->{X509_CERT} }); $ua->agent("NCG::SiteInfo::EOSC"); my $req = HTTP::Request->new(GET => $self->{URL}); my $res = $self->safeHTTPSCall($ua,$req); diff --git a/src/modules/NCG/SiteInfo/GOCDB.pm b/src/modules/NCG/SiteInfo/GOCDB.pm index dc2a5fa..698c956 100644 --- a/src/modules/NCG/SiteInfo/GOCDB.pm +++ b/src/modules/NCG/SiteInfo/GOCDB.pm @@ -42,11 +42,6 @@ sub new { $self->{NODE_MONITORED} = 'Y'; } - if ($self->{SCOPE} && $self->{SCOPE} !~ /Local/) { - $self->error("Incorrect SCOPE value, acceptable values are: Local."); - return; - } - if (! exists $self->{URL_TYPE}) { $self->{URL_TYPE} = 'ROOT'; } @@ -78,7 +73,7 @@ sub getData { $content = <$fileHndl>; close $fileHndl; } else { - my $ua = LWP::UserAgent->new(timeout=>$self->{TIMEOUT}, env_proxy=>1, ssl_opts => { SSL_ca_path => '/etc/grid-security/certificates' }); + my $ua = LWP::UserAgent->new(timeout=>$self->{TIMEOUT}, env_proxy=>1); $ua->agent("NCG::SiteInfo::GOCDB"); my $url; @@ -93,6 +88,7 @@ sub getData { } else { $url = $self->{GOCDB_ROOT_URL}; } + my $req = HTTP::Request->new(GET => $url); if ( $self->{USERNAME} && $self->{PASSWORD} ) { diff --git a/src/modules/NCG/SiteSet/EOSC.pm b/src/modules/NCG/SiteSet/EOSC.pm index 92aa9ce..a420eac 100644 --- a/src/modules/NCG/SiteSet/EOSC.pm +++ b/src/modules/NCG/SiteSet/EOSC.pm @@ -81,11 +81,7 @@ sub getData $content = <$fileHndl>; close $fileHndl; } else { - $ENV{HTTPS_KEY_FILE} = $self->{X509_KEY}; - $ENV{HTTPS_CERT_FILE} = $self->{X509_CERT}; - $ENV{HTTPS_CA_DIR} = '/etc/grid-security/certificates'; - - my $ua = LWP::UserAgent->new(timeout=>$self->{TIMEOUT}, env_proxy => 1, ssl_opts => { SSL_key_file => $self->{X509_KEY}, SSL_cert_file => $self->{X509_CERT}, SSL_ca_path => '/etc/grid-security/certificates' }); + my $ua = LWP::UserAgent->new(timeout=>$self->{TIMEOUT}, env_proxy => 1, ssl_opts => { SSL_key_file => $self->{X509_KEY}, SSL_cert_file => $self->{X509_CERT} }); $ua->agent("NCG::SiteSet::EOSC"); my $req = HTTP::Request->new(GET => $self->{URL}); my $res = $self->safeHTTPSCall($ua,$req); diff --git a/src/modules/NCG/SiteSet/GOCDB.pm b/src/modules/NCG/SiteSet/GOCDB.pm index 5abe8cc..1f0070a 100644 --- a/src/modules/NCG/SiteSet/GOCDB.pm +++ b/src/modules/NCG/SiteSet/GOCDB.pm @@ -84,7 +84,7 @@ sub getData $content = <$fileHndl>; close $fileHndl; } else { - my $ua = LWP::UserAgent->new(timeout=>$self->{TIMEOUT}, env_proxy=>1, ssl_opts => { SSL_ca_path => '/etc/grid-security/certificates' }); + my $ua = LWP::UserAgent->new(timeout=>$self->{TIMEOUT}, env_proxy=>1); $ua->agent("NCG::SiteSet::GOCDB"); my $url; From bf3159fb7a2fb187196c239445b3a7115bce6e59 Mon Sep 17 00:00:00 2001 From: eimamagi Date: Mon, 4 May 2020 16:43:37 +0200 Subject: [PATCH 08/12] ARGO-2422 Move common parameters to separate config file --- argo-ncg.spec | 2 ++ config/ncg-vars.conf | 35 ++++++++++++++++++ config/ncg.conf | 84 ++++++++++++-------------------------------- 3 files changed, 59 insertions(+), 62 deletions(-) create mode 100644 config/ncg-vars.conf diff --git a/argo-ncg.spec b/argo-ncg.spec index e8b49d3..e69dc37 100644 --- a/argo-ncg.spec +++ b/argo-ncg.spec @@ -46,6 +46,7 @@ install --mode=755 argo-java-truststore.sh $RPM_BUILD_ROOT/usr/libexec/%{name} install --directory $RPM_BUILD_ROOT%{configdir}/ncg.conf.d/ install --directory $RPM_BUILD_ROOT%{configdir}/ncg-localdb.d/ install ncg.conf $RPM_BUILD_ROOT%{configdir} +install ncg-vars.conf $RPM_BUILD_ROOT%{configdir} install ncg.localdb $RPM_BUILD_ROOT%{configdir} install ncg.localdb.example $RPM_BUILD_ROOT%{configdir} install check_logfiles_ncg.conf $RPM_BUILD_ROOT%{configdir} @@ -71,6 +72,7 @@ rm -rf $RPM_BUILD_ROOT %defattr(-,root,root,-) %config(noreplace) %{configdir}/ncg.conf.d %config(noreplace) %{configdir}/ncg.conf +%config(noreplace) %{configdir}/ncg-vars.conf %config(noreplace) %{configdir}/ncg.localdb %config(noreplace) %{configdir}/ncg.localdb.example %config(noreplace) %{configdir}/ncg-localdb.d diff --git a/config/ncg-vars.conf b/config/ncg-vars.conf new file mode 100644 index 0000000..34f3390 --- /dev/null +++ b/config/ncg-vars.conf @@ -0,0 +1,35 @@ +# Set ARGO Monitoring Engine hostname +# (default: hostname) +# NAGIOS_SERVER = + +# Set following option if you wish to receive +# email alerts for Nagios internal checks +# (default: root@localhost) +# NAGIOS_ADMIN = root@localhost + +# ARGO WEB-API root URL +# (default: https://api.argo.grnet.gr) +# WEBAPI_ROOT_URL = https://api.argo.grnet.gr + +# ARGO WEB-API token must be provided +# in order to fetch metric profiles +# (default: ) +# WEBAPI_TOKEN = MY_WEBAPI_TOKEN + +# List of metric profiles used for configuring +# ARGO Monitoring Engine +# (default: ) +# PROFILES = MON + +# ARGO POEM URL +# (default: https://poem.egi.eu) +# POEM_ROOT_URL = https://poem.egi.eu + +# ARGO POEM token must be provided in order +# to fetch metric definitions +# (default: ) +# POEM_TOKEN = MY_POEM_TOKEN + +# GOCDB API root URL +# (default: https://gocdb.egi.eu/gocdbpi) +# GOCDB_ROOT_URL = https://gocdb.egi.eu/gocdbpi diff --git a/config/ncg.conf b/config/ncg.conf index a0e6087..a4050ae 100644 --- a/config/ncg.conf +++ b/config/ncg.conf @@ -3,62 +3,26 @@ # For further details see: # http://search.cpan.org/dist/Config-General/ -# Global variables which can be used in module -# configuration (e.g. LDAP_ADDRESS=$BDII). -# Variables in curly brackets are environment -# variables. - -# Set following option if you wish to receive -# email alerts for Nagios internal checks -# default root@localhost -# NAGIOS_ADMIN=admins@email.com - -# list of VOs for which you wish to run checks -VO = dteam - -# -# Some optional config -# -# NAGIOS_SERVER = nagios.fqdn -# MYPROXY_SERVER = myproxy.fqdn +# include standard variables +include ncg-vars.conf # Configuration of individual NCG modules. # First level block represents abstract module. - - - - # Second level block defines specific module - # parameters passed at invocation. - - - NAGIOS_ROLE = ngi - INCLUDE_EMPTY_HOSTS = 0 - ENABLE_NOTIFICATIONS = 0 - SEND_TO_DASHBOARD = 0 - CHECK_HOSTS = 0 - TENANT = ARGO-TEST - ROBOT_CERT=/etc/nagios/globus/robocert.pem - ROBOT_KEY=/etc/nagios/globus/robokey.pem - USE_ROBOT_CERT=1 - SEND_TO_MSG = 0 - - - - -# NCG modules for gathering site information - GOCDB_ROOT_URL=https://goc.egi.eu/gocdbpi - ROC=NGI_HR + GOCDB_ROOT_URL=$GOCDB_ROOT_URL + SCOPE=$GOCDB_SCOPE - DB_FILE=/etc/argo-ncg/ncg.localdb - DB_DIRECTORY=/etc/argo-ncg/ncg-localdb.d + DB_FILE=/etc/argo-ncg/ncg.localdb + DB_DIRECTORY=/etc/argo-ncg/ncg-localdb.d + - GOCDB_ROOT_URL=https://goc.egi.eu/gocdbpi + GOCDB_ROOT_URL=$GOCDB_ROOT_URL + SCOPE=$GOCDB_SCOPE DB_FILE=/etc/argo-ncg/ncg.localdb @@ -66,40 +30,36 @@ VO = dteam -# NCG modules for gathering metrics & attributes - WEBAPI_ROOT_URL = https://api.devel.argo.grnet.gr - PROFILES = ARGO_TEST,ARGO_MON,MW_MONITOR,OPS_MONITOR - TOKEN = TOKEN_STRING + WEBAPI_ROOT_URL = $WEBAPI_ROOT_URL + PROFILES = $PROFILES + TOKEN = $WEBAPI_TOKEN DB_FILE=/etc/argo-ncg/ncg.localdb DB_DIRECTORY=/etc/argo-ncg/ncg-localdb.d + - POEM_ROOT_URL = http://egi.poem.devel.argo.grnet.gr - TOKEN = POEM_TOKEN_STRING + POEM_ROOT_URL = $POEM_ROOT_URL + TOKEN = $POEM_TOKEN + - - GOCDB_ROOT_URL=https://goc.egi.eu/gocdbpi - BDII_HOST=bdii.fqdn - INCLUDE_PROXY_CHECKS = 1 - INCLUDE_MSG_CHECKS_SEND = 0 - - - LDAP_ADDRESS=bdii.fqdn - BDII_LEVEL=top - + DB_FILE=/etc/argo-ncg/ncg.localdb DB_DIRECTORY=/etc/argo-ncg/ncg-localdb.d -# Include any custom configuration. + + + + +# include custom configurations include ncg.conf.d/*.conf From 8a05fd4e44fb5342190cd41fca1d3689c14b2837 Mon Sep 17 00:00:00 2001 From: eimamagi Date: Mon, 4 May 2020 23:37:14 +0200 Subject: [PATCH 09/12] ARGO-2422 Move common parameters to separate config file --- config/ncg-vars.conf | 4 ++-- src/modules/NCG/MetricConfig/POEM.pm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/ncg-vars.conf b/config/ncg-vars.conf index 34f3390..ecdd976 100644 --- a/config/ncg-vars.conf +++ b/config/ncg-vars.conf @@ -22,8 +22,8 @@ # PROFILES = MON # ARGO POEM URL -# (default: https://poem.egi.eu) -# POEM_ROOT_URL = https://poem.egi.eu +# (default: https://training.poem.devel.argo.grnet.gr) +# POEM_ROOT_URL = https://training.poem.devel.argo.grnet.gr # ARGO POEM token must be provided in order # to fetch metric definitions diff --git a/src/modules/NCG/MetricConfig/POEM.pm b/src/modules/NCG/MetricConfig/POEM.pm index d99345d..f699a17 100644 --- a/src/modules/NCG/MetricConfig/POEM.pm +++ b/src/modules/NCG/MetricConfig/POEM.pm @@ -26,7 +26,7 @@ use LWP::UserAgent; @ISA=("NCG::MetricConfig"); -my $DEFAULT_POEM_ROOT_URL = "http://poem.egi.eu"; +my $DEFAULT_POEM_ROOT_URL = "https://training.poem.devel.argo.grnet.gr"; my $DEFAULT_POEM_ROOT_URL_SUFFIX = "/api/v2/metrics"; sub new { @@ -153,7 +153,7 @@ reference that can contain following elements: (default: ) POEM_ROOT_URL - POEM JSON API root URL - (default: http://localhost/poem_sync) + (default: https://training.poem.devel.argo.grnet.gr) METRIC_CONFIG - metric configuration structure fetched from NCG::MetricConfig module From 08c47761d54a146a7527df75f5a93fd5f250ce95 Mon Sep 17 00:00:00 2001 From: Kostas Evangelou Date: Thu, 7 May 2020 16:45:27 +0300 Subject: [PATCH 10/12] Add cleanws in each stage --- Jenkinsfile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 93b427e..58957da 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,6 +26,11 @@ pipeline { } archiveArtifacts artifacts: '**/*.rpm', fingerprint: true } + post { + always { + cleanWs() + } + } } stage ('Centos 6') { agent { @@ -42,6 +47,11 @@ pipeline { } archiveArtifacts artifacts: '**/*.rpm', fingerprint: true } + post { + always { + cleanWs() + } + } } } post { From 0c4bd43817b85d4a411d93990b5cca87f78bc9cb Mon Sep 17 00:00:00 2001 From: kevangel79 <58726215+kevangel79@users.noreply.github.com> Date: Thu, 7 May 2020 17:22:23 +0300 Subject: [PATCH 11/12] Update Jenkinsfile --- Jenkinsfile | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 58957da..ee5e2ee 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -58,5 +58,19 @@ pipeline { always { cleanWs() } + success { + script{ + if ( env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'devel' ) { + slackSend( message: ":rocket: New version for <$BUILD_URL|$PROJECT_DIR>:$BRANCH_NAME Job: $JOB_NAME !") + } + } + } + failure { + script{ + if ( env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'devel' ) { + slackSend( message: ":rain_cloud: Build Failed for <$BUILD_URL|$PROJECT_DIR>:$BRANCH_NAME Job: $JOB_NAME") + } + } + } } -} \ No newline at end of file +} From 06d701dc3995fae1dc237272053a8ef4f39397d5 Mon Sep 17 00:00:00 2001 From: eimamagi Date: Fri, 8 May 2020 13:00:59 +0200 Subject: [PATCH 12/12] Version bump. --- argo-ncg.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/argo-ncg.spec b/argo-ncg.spec index e69dc37..235a711 100644 --- a/argo-ncg.spec +++ b/argo-ncg.spec @@ -5,7 +5,7 @@ Summary: ARGO Nagios config generator Name: argo-ncg -Version: 0.4.10 +Version: 0.4.11 Release: 1%{?dist} License: ASL 2.0 Group: Network/Monitoring @@ -95,6 +95,8 @@ if [ -f /etc/init.d/ncg ] ; then fi %changelog +* Fri May 8 2020 Emir Imamagic - 0.4.10-1 - Version bump * Thu Mar 26 2020 Emir Imamagic - 0.4.9-1