Changeset View
Changeset View
Standalone View
Standalone View
site-modules/profile/manifests/export_archive_counters.pp
# stats_export master class | # stats_export master class | ||||
class profile::export_archive_counters { | class profile::export_archive_counters { | ||||
$export_path = lookup('stats_export::export_path') | $export_path = lookup('stats_export::export_path') | ||||
$export_file = lookup('stats_export::export_file') | $export_file = lookup('stats_export::export_file') | ||||
$packages = ['python3-click'] | $packages = ['python3-click', 'python3-requests'] | ||||
package {$packages: | package {$packages: | ||||
ensure => present, | ensure => present, | ||||
} | } | ||||
file {'/usr/local/bin/export-archive_counters.py': | $script_name = 'export_archive_counters.py' | ||||
$script_path = "/usr/local/bin/${script_name}" | |||||
file {$script_path: | |||||
ensure => present, | ensure => present, | ||||
owner => 'root', | owner => 'root', | ||||
group => 'root', | group => 'root', | ||||
mode => '0755', | mode => '0755', | ||||
source => 'puppet:///modules/profile/stats_exporter/export-archive_counters.py', | source => "puppet:///modules/profile/stats_exporter/${script_name}", | ||||
require => Package[$packages], | require => Package[$packages], | ||||
} | } | ||||
file {'/usr/local/share/swh-data/history-counters.munin.json': | $history_data_name = 'history-counters.munin.json' | ||||
$history_data_path = "/usr/local/share/swh-data/${history_data_name}" | |||||
vlorentz: Is this the right place for a data file? (although it's immutable) | |||||
ardumontAuthorUnsubmitted Done Inline Actionsi did not think this through, i kept the original value. ardumont: i did not think this through, i kept the original value.
What you say makes sense but i don't… | |||||
file {$history_data_path: | |||||
ensure => present, | ensure => present, | ||||
owner => 'root', | owner => 'root', | ||||
group => 'root', | group => 'root', | ||||
mode => '0644', | mode => '0644', | ||||
source => 'puppet:///modules/profile/stats_exporter/history-counters.munin.json', | source => "puppet:///modules/profile/stats_exporter/${history_data_name}", | ||||
} | } | ||||
$server = "pergamon.internal.softwareheritage.org" | |||||
$port = 9090 | |||||
$command_get_data = "${script_path} --server ${server} --port ${port} --history-data-file ${history_data_path}" | |||||
cron {'stats_export': | cron {'stats_export': | ||||
ensure => present, | ensure => present, | ||||
user => 'www-data', | user => 'www-data', | ||||
command => "/usr/local/bin/export-archive_counters.py > ${export_file}.tmp && /bin/mv ${export_file}.tmp ${export_file}", | command => "${command_get_data} > ${export_file}.tmp && /bin/mv ${export_file}.tmp ${export_file}", | ||||
hour => fqdn_rand(24, 'stats_export_hour'), | hour => fqdn_rand(24, 'stats_export_hour'), | ||||
minute => fqdn_rand(60, 'stats_export_minute'), | minute => fqdn_rand(60, 'stats_export_minute'), | ||||
month => '*', | month => '*', | ||||
monthday => '*', | monthday => '*', | ||||
weekday => '*', | weekday => '*', | ||||
require => [ | require => [ | ||||
File['/usr/local/bin/export-archive_counters.py'], | File[$script_path], | ||||
File['/usr/local/share/swh-data/history-counters.munin.json'], | File[$history_data_path], | ||||
], | ], | ||||
} | } | ||||
} | } |
Is this the right place for a data file? (although it's immutable)