Skip to content

Commit

Permalink
added missing file
Browse files Browse the repository at this point in the history
the previous git commit -a didn't add new files
  • Loading branch information
Robert Frank committed Nov 10, 2014
1 parent 1e0267b commit 411bb4c
Show file tree
Hide file tree
Showing 20 changed files with 371 additions and 0 deletions.
4 changes: 4 additions & 0 deletions manifests/bwctl.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class perfsonar::bwctl {
include 'perfsonar::bwctl::install'
include 'perfsonar::bwctl::service'
}
7 changes: 7 additions & 0 deletions manifests/bwctl/install.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class perfsonar::bwctl::install(
$ensure = $::perfsonar::params::bwctl_install_ensure,
) inherits perfsonar::params {
package { $::perfsonar::params::bwctl_packages:
ensure => $ensure,
}
}
11 changes: 11 additions & 0 deletions manifests/bwctl/service.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class perfsonar::bwctl::service(
$ensure = $::perfsonar::params::bwctl_ensure,
$enable = $::perfsonar::params::bwctl_enable,
) inherits perfsonar::params {
service { 'bwctld':
ensure => $ensure,
enable => $enable,
hasstatus => false,
hasrestart => true,
}
}
53 changes: 53 additions & 0 deletions manifests/esmond.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
class perfsonar::esmond (
$use_db_module = true,
$dbname = $::perfsonar::params::esmond_dbname,
$dbuser = $::perfsonar::params::esmond_dbuser,
$dbpassword = $::perfsonar::params::esmond_dbpass,
) inherits perfsonar::params {
if $use_db_module {
class { 'postgresql::server': }
postgresql::server::db { $dbname:
user => $dbuser,
password => postgresql_password($dbuser, $dbpassword),
grant => 'ALL',
before => Exec['run esmond configuration script'],
}
# update auth to allow esmond access to the DB
postgresql::server::pg_hba_rule { 'allow local password auth':
description => 'allow local authentication using a password',
type => 'local',
database => 'all',
user => 'all',
auth_method => 'md5',
# need local md5 auth for esmond user, but the second default pg_hba rule
# is a generic ident auth for local connections, therefore we need to place
# this rule before the second default rule
order => '002',
before => Exec['run esmond configuration script'],
}
}

file { '/opt/esmond/esmond.conf':
ensure => 'file',
owner => 'root',
group => 'root',
mode => '0644',
content => template("${module_name}/esmond.conf.erb"),
require => Package['esmond'],
}
# the remaining content of this script should be moved here if possible
file { '/usr/local/sbin/puppet_perfsonar_configure_esmond':
ensure => 'file',
owner => 'root',
group => 'root',
mode => '0750',
content => template("${module_name}/configure_esmond.erb"),
require => File['/opt/esmond/esmond.conf'],
}
exec { 'run esmond configuration script':
command => '/usr/local/sbin/puppet_perfsonar_configure_esmond',
logoutput => 'on_failure',
creates => '/var/lib/esmond/.configured.puppet',
require => File['/usr/local/sbin/puppet_perfsonar_configure_esmond'],
}
}
11 changes: 11 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class perfsonar {
include 'perfsonar::install'
include 'perfsonar::config'
include 'perfsonar::service'
include 'perfsonar::apache'
include 'perfsonar::esmond'
include 'perfsonar::regular_testing'
include 'perfsonar::mesh_config'
include 'perfsonar::owamp'
include 'perfsonar::bwctl'
}
4 changes: 4 additions & 0 deletions manifests/mesh_config.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class perfsonar::mesh_config {
include 'perfsonar::mesh_config::install'
include 'perfsonar::mesh_config::config'
}
32 changes: 32 additions & 0 deletions manifests/mesh_config/config.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
class perfsonar::mesh_config::config(
$agentconfig = $::perfsonar::params::mesh_config_agent,
) inherits perfsonar::params {
$agent_options = merge($perfsonar::params::agentconfig, $agentconfig)
file { '/opt/perfsonar_ps/mesh_config/etc/agent_configuration.conf':
ensure => 'present',
owner => 'perfsonar',
group => 'perfsonar',
mode => '0644',
content => template("${module_name}/agent_configuration.conf.erb"),
require => Package['perl-perfSONAR_PS-MeshConfig-Agent']
}
# needs notty in sudoers
exec { 'generate mesh configuration':
command => '/usr/bin/sudo -u perfsonar /opt/perfsonar_ps/mesh_config/bin/generate_configuration',
logoutput => 'on_failure',
subscribe => File['/opt/perfsonar_ps/mesh_config/etc/agent_configuration.conf'],
require => [
Exec['run regular testing configuration script'],
File['/etc/sudoers.d/perfsonar'],
],
refreshonly => true,
notify => Service['regular_testing'],
}
file { '/etc/sudoers.d/perfsonar':
ensure => 'file',
owner => 'root',
group => 'root',
mode => '0440',
content => "Defaults!/opt/perfsonar_ps/mesh_config/bin/generate_configuration !requiretty\n",
}
}
7 changes: 7 additions & 0 deletions manifests/mesh_config/install.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class perfsonar::mesh_config::install(
$ensure = $::perfsonar::params::mesh_config_install_ensure,
) inherits perfsonar::params {
package { $::perfsonar::params::mesh_config_packages:
ensure => $ensure,
}
}
4 changes: 4 additions & 0 deletions manifests/owamp.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class perfsonar::owamp {
include 'perfsonar::owamp::install'
include 'perfsonar::owamp::service'
}
7 changes: 7 additions & 0 deletions manifests/owamp/install.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class perfsonar::owamp::install(
$ensure = $::perfsonar::params::owamp_install_ensure,
) inherits perfsonar::params {
package { $::perfsonar::params::owamp_packages:
ensure => $ensure,
}
}
11 changes: 11 additions & 0 deletions manifests/owamp/service.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class perfsonar::owamp::service(
$ensure = $::perfsonar::params::owamp_ensure,
$enable = $::perfsonar::params::owamp_enable,
) inherits perfsonar::params {
service { 'owampd':
ensure => $ensure,
enable => $enable,
hasstatus => false,
hasrestart => true,
}
}
5 changes: 5 additions & 0 deletions manifests/regular_testing.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class perfsonar::regular_testing {
include 'perfsonar::regular_testing::install'
include 'perfsonar::regular_testing::config'
include 'perfsonar::regular_testing::service'
}
35 changes: 35 additions & 0 deletions manifests/regular_testing/config.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# loglevel is a puppet metaparameter, so have to use something else (loglvl)
class perfsonar::regular_testing::config(
$snotify = $::perfsonar::params::regular_testing_snotify,
$loglvl = $::perfsonar::params::regular_testing_loglvl,
$logger = $::perfsonar::params::regular_testing_logger,
$logfile = $::perfsonar::params::regular_testing_logfile,
) inherits perfsonar::params {
file { '/usr/local/sbin/puppet_perfsonar_configure_regular_testing':
ensure => 'file',
owner => 'root',
group => 'root',
mode => '0750',
content => template("${module_name}/configure_regular_testing.erb"),
require => Package['perl-perfSONAR_PS-RegularTesting']
}
exec { 'run regular testing configuration script':
command => '/usr/local/sbin/puppet_perfsonar_configure_regular_testing',
logoutput => 'on_failure',
creates => '/var/lib/perfsonar/regular_testing/.configured.puppet',
require => File['/usr/local/sbin/puppet_perfsonar_configure_regular_testing'],
}
$tn = $snotify ? {
false => undef,
default => Service['regular_testing'],
}
file { '/opt/perfsonar_ps/regular_testing/etc/regular_testing-logger.conf':
ensure => 'file',
owner => 'perfsonar',
group => 'perfsonar',
mode => '0644',
content => template("${module_name}/regular_testing-logger.conf.erb"),
require => Exec['run regular testing configuration script'],
notify => $tn,
}
}
7 changes: 7 additions & 0 deletions manifests/regular_testing/install.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class perfsonar::regular_testing::install(
$ensure = $::perfsonar::params::regular_testing_install_ensure,
) inherits perfsonar::params {
package { $::perfsonar::params::regular_testing_packages:
ensure => $ensure,
}
}
13 changes: 13 additions & 0 deletions manifests/regular_testing/service.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class perfsonar::regular_testing::service(
$ensure = $::perfsonar::params::regular_testing_ensure,
$enable = $::perfsonar::params::regular_testing_enable,
) inherits perfsonar::params {
service { 'regular_testing':
ensure => $ensure,
enable => $enable,
hasstatus => false,
hasrestart => true,
pattern => 'perfSONAR_PS Regular Testing',
require => Exec['run regular testing configuration script'],
}
}
42 changes: 42 additions & 0 deletions templates/configure_esmond.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

<% if not @use_db_module then -%>
#init postgres
if [ -z "$(ls -A /var/lib/pgsql/data)" ]; then
/sbin/service postgresql initdb
/sbin/service postgresql start
echo "Waiting for postgresql to complete startup"
sleep 20
sudo -u postgres psql -c "CREATE USER <%= @dbuser %> WITH PASSWORD '<%= @dbpassword %>'"
sudo -u postgres psql -c "CREATE DATABASE <%= @dbname %>"
sudo -u postgres psql -c "GRANT ALL ON DATABASE <%= @dbname %> to <%= @dbuser %>"
cp -f /opt/perfsonar_ps/toolkit/etc/default_service_configs/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf
/sbin/service postgresql restart
# sed -i "s/sql_db_name = .*/sql_db_name = esmond/g" /opt/esmond/esmond.conf
# sed -i "s/sql_db_user = .*/sql_db_user = esmond/g" /opt/esmond/esmond.conf
# sed -i "s/sql_db_password = .*/sql_db_password = 7hc4m1/g" /opt/esmond/esmond.conf
fi

<% end -%>
#disable JMX in cassandra so will start even if /etc/sysconfig/network HOSTNAME does not resolve
sed -i '/^JVM_OPTS="\$JVM_OPTS -Dcom.sun.management.jmx/ s/^/#/' /etc/cassandra/conf/cassandra-env.sh

#set esmond env variables
export ESMOND_ROOT=/opt/esmond
export ESMOND_CONF=$ESMOND_ROOT/esmond.conf
export DJANGO_SETTINGS_MODULE=esmond.settings

#initialize python
cd /opt/esmond
source /opt/rh/python27/enable
/opt/rh/python27/root/usr/bin/virtualenv --prompt="(esmond)" .
. bin/activate

#build esmond tables
python esmond/manage.py syncdb --noinput

#create api key
KEY=`python esmond/manage.py add_ps_metadata_post_user perfsonar | grep "Key:" | cut -f2 -d " "`
python esmond/manage.py add_timeseries_post_user perfsonar

touch /var/lib/esmond/.configured.puppet
38 changes: 38 additions & 0 deletions templates/configure_regular_testing.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

#set esmond env variables
export ESMOND_ROOT=/opt/esmond
export ESMOND_CONF=$ESMOND_ROOT/esmond.conf
export DJANGO_SETTINGS_MODULE=esmond.settings

#initialize python
cd /opt/esmond
source /opt/rh/python27/enable
/opt/rh/python27/root/usr/bin/virtualenv --prompt="(esmond)" .
. bin/activate

#build esmond tables
python esmond/manage.py syncdb --noinput

#create api key
KEY=`python esmond/manage.py add_ps_metadata_post_user perfsonar | grep "Key:" | cut -f2 -d " "`
python esmond/manage.py add_timeseries_post_user perfsonar

#put api key in regular_testing
if [ -n "$KEY" ]; then
grep -q 'esmond/latency' /opt/perfsonar_ps/regular_testing/etc/regular_testing.conf
if [ $? != 0 ]; then
mv /opt/perfsonar_ps/regular_testing/etc/regular_testing.conf /opt/perfsonar_ps/regular_testing/etc/regular_testing.conf.install.back
cp -f /opt/perfsonar_ps/toolkit/etc/default_service_configs/regular_testing.conf /opt/perfsonar_ps/regular_testing/etc/regular_testing.conf
fi

grep -q ESMOND_API_KEY /opt/perfsonar_ps/regular_testing/etc/regular_testing.conf
if [ $? == 0 ]; then
sed -i "s/ESMOND_API_KEY/$KEY/g" /opt/perfsonar_ps/regular_testing/etc/regular_testing.conf
fi
fi

if [ -f /opt/perfsonar_ps/PingER/etc/pinger-landmarks.xml -o /opt/perfsonar_ps/perfsonarbuoy_ma/etc/owmesh.conf ]; then
/opt/perfsonar_ps/toolkit/scripts/upgrade/upgrade_regular_tests
fi
touch /var/lib/perfsonar/regular_testing/.configured.puppet
14 changes: 14 additions & 0 deletions templates/enabled_services.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
snmpma_enabled=enabled
ndt_enabled=<%= @ndt_enabled ? 'enabled' : 'disabled' %>
owamp_enabled=<%= @owamp_enabled ? 'enabled' : 'disabled' %>
npad_enabled=<%= @npad_enabled ? 'enabled' : 'disabled' %>
pinger_enabled=enabled
psb_enabled=enabled
https_enabled=enabled
bwctl_enabled=<%= @bwctl_enabled ? 'enabled' : 'disabled' %>
ssh_enabled=system
hls_enabled=enabled
traceroute_ma=enabled
traceroute_scheduler=enabled
regular_testing_enabled=enabled
yum_cron_enabled=enabled
44 changes: 44 additions & 0 deletions templates/esmond.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[main]
sql_db_engine = django.db.backends.postgresql_psycopg2
sql_db_name = <%= @dbname %>
sql_db_user = <%= @dbuser %>
sql_db_password = <%= @dbpassword %>
tsdb_root = %(ESMOND_ROOT)s/tsdb-data
tsdb_chunk_prefixes = %(ESMOND_ROOT)s/tsdb-data
api_anon_limit = 30
api_throttle_at =
api_throttle_timeframe =
api_throttle_expiration =
cassandra_servers = localhost:9160
cassandra_user =
cassandra_pass =
db_profile_on_testing = no
profile_persister = no
mib_dirs = %(ESMOND_ROOT)s/mibs
mibs =
syslog_facility = local7
syslog_priority = debug
traceback_dir = %(ESMOND_ROOT)s/crashlog
pid_dir = %(ESMOND_ROOT)s/var/
espersistd_uri = 127.0.0.1:11211
espoll_persist_uri = MemcachedPersistHandler:127.0.0.1:11211
htpasswd_file = %(ESMOND_ROOT)s/htpasswd
[persist_map]
FastPollHC = cassandra
FastPoll = cassandra
JnxFirewall = cassandra
JnxCOS = cassandra
Errors = cassandra
ALUFastPollHC = cassandra
ALUErrors = cassandra
ALUIfRefPoll = aluifref
SentryPoll = cassandra
ALUSAPRefPoll = alusapref
ALUSAPPoll = cassandra
IfRefPoll = ifref
[persist_queues]
cassandra = CassandraPollPersister:9
ifref = IfRefPollPersister:1
infifref = InfIfRefPollPersister:1
aluifref = ALUIfRefPollPersister:1
alusapref = ALUSAPRefPersister:1
22 changes: 22 additions & 0 deletions templates/regular_testing-logger.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
log4perl.logger.perfSONAR_PS=<%= @loglvl %>, A1

# uncomment to display log messages on the screen
#log4perl.appender.A1=Log::Dispatch::Screen

# uncomment to log via syslog
#log4perl.appender.A1=Log::Dispatch::Syslog
#log4perl.appender.A1.facility=local5

# comment to prevent logging to a file
#log4perl.appender.A1=Log::Dispatch::FileRotate
log4perl.appender.A1=<%= @logger %>

# alter location of the log file below
#log4perl.appender.A1.filename=/var/log/perfsonar/regular_testing.log
log4perl.appender.A1.filename=<%= @logfile %>
log4perl.appender.A1.max=7
log4perl.appender.A1.DatePattern=yyyy-MM-dd
log4perl.appender.A1.mode=append
log4perl.appender.A1.permissions=sub{ 0644; }
log4perl.appender.A1.layout=Log::Log4perl::Layout::PatternLayout
log4perl.appender.A1.layout.ConversionPattern=%d (%P) %p> %F{1}:%L %M - %m%n

0 comments on commit 411bb4c

Please sign in to comment.