-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DELTA-2641 Implement xdmod-ondemand-export for ACCESS metrics
- Loading branch information
Showing
3 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This is a configuration file used by xdmod_ondemand_export.py. | ||
# | ||
# Set the value of "url" in the [destination] section to specify where the logs | ||
# will be POSTed. | ||
# | ||
# Set the values in the [logs] section to tell the script where to find logs | ||
# and how to parse them. | ||
|
||
[destination] | ||
url = https://data.ccr.xdmod.org/ondemand/logs | ||
|
||
[logs] | ||
dir = /etc/httpd/logs | ||
filename_pattern = *access*.log* | ||
format = %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# @summary Configure the xdmod export script | ||
# | ||
# @param enable_xdmod_export | ||
# Whether to set up the script on the server. Defaults to false | ||
# | ||
# @param token | ||
# Token used to authenticate with the log server | ||
# | ||
class profile_ondemand::xdmod_export ( | ||
Boolean $enable_xdmod_export = false, | ||
String $token, | ||
) { | ||
|
||
if $enable_xdmod_export { | ||
user { 'xdmod-ondemand-export': | ||
shell => '/bin/false', | ||
managehome => true, | ||
password => '!DISABLED', | ||
} | ||
|
||
exec { '/usr/bin/python3 -m venv /home/xdmod-ondemand-export/venv': | ||
user => 'xdmod-ondemand-export', | ||
creates => '/home/xdmod-ondemand-export/venv', | ||
require => Package['httpd'], | ||
} | ||
-> exec { 'python3 -m pip install xdmod-ondemand-export': | ||
path => '/home/xdmod-ondemand-export/venv/bin:/usr/bin:/usr/sbin:/bin', | ||
user => 'xdmod-ondemand-export', | ||
creates => '/home/xdmod-ondemand-export/venv/bin/xdmod-ondemand-export', | ||
} | ||
-> exec { 'setfacl -m u:xdmod-ondemand-export:r-x /etc/httpd/logs': | ||
path => '/usr/bin:/usr/sbin:/bin', | ||
unless => 'getfacl /etc/httpd/logs/ | grep xdmod-ondemand-export', | ||
} | ||
-> exec { 'setfacl -m u:xdmod-ondemand-export:r-- /etc/httpd/logs/*': | ||
path => '/usr/bin:/usr/sbin:/bin', | ||
unless => 'getfacl /etc/httpd/logs/* | grep xdmod-ondemand-export', | ||
} | ||
-> exec { 'setfacl -dm u:xdmod-ondemand-export:r-- /etc/httpd/logs': | ||
path => '/usr/bin:/usr/sbin:/bin', | ||
unless => 'getfacl -d /etc/httpd/logs/ | grep xdmod-ondemand-export', | ||
} | ||
|
||
file { '/home/xdmod-ondemand-export/conf.ini': | ||
ensure => 'file', | ||
require => User['xdmod-ondemand-export'], | ||
owner => 'xdmod-ondemand-export', | ||
group => 'xdmod-ondemand-export', | ||
mode => '0400', | ||
content => file('profile_ondemand/xdmod_export_conf.ini'), | ||
} | ||
|
||
file { '/home/xdmod-ondemand-export/.token': | ||
ensure => 'file', | ||
require => User['xdmod-ondemand-export'], | ||
owner => 'xdmod-ondemand-export', | ||
group => 'xdmod-ondemand-export', | ||
mode => '0400', | ||
content => $token, | ||
} | ||
|
||
file { '/home/xdmod-ondemand-export/last-run.json': | ||
ensure => 'present', | ||
require => User['xdmod-ondemand-export'], | ||
owner => 'xdmod-ondemand-export', | ||
group => 'xdmod-ondemand-export', | ||
mode => '0600', | ||
} | ||
|
||
cron { 'xdmod-ondemand-export': | ||
command => "su -c '/home/xdmod-ondemand-export/venv/bin/xdmod-ondemand-export' -s /bin/bash xdmod-ondemand-export", | ||
hour => fqdn_rand(24), | ||
minute => fqdn_rand(60), | ||
} | ||
|
||
} | ||
} |