Compare commits
56 Commits
ea7e79203b
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43fc9c480f | ||
|
|
b3cf618c11 | ||
| a73a61d814 | |||
|
|
ea189002e9 | ||
|
|
1af8969a1e | ||
| 334ab846e6 | |||
|
|
1a473ef93f | ||
|
|
0ac6f85be3 | ||
| 9d1da425aa | |||
|
|
ec53b08630 | ||
|
|
7ad897a119 | ||
| d64ff7141b | |||
|
|
0e199418ed | ||
|
|
8120a82d4b | ||
| 6d9a7e196d | |||
| b97d75b882 | |||
|
|
4be2f33cca | ||
|
|
cd547aec44 | ||
| be2a45c7f8 | |||
|
|
298e2f0e43 | ||
|
|
24f4cf3e97 | ||
| dc86fb5ce8 | |||
|
|
bff128d55d | ||
|
|
39ab1b1626 | ||
| 6138fdfcaa | |||
|
|
8c3393b790 | ||
|
|
a5b1106a97 | ||
| 3e9e52b144 | |||
|
|
fc2f9adfe1 | ||
|
|
d5f6a5ceeb | ||
| 097956676e | |||
|
|
561462758d | ||
|
|
09f8a1b1bd | ||
| 16597c16d5 | |||
| ceabad8b19 | |||
|
|
47dc39eb4b | ||
|
|
62060737ac | ||
| 211341c62c | |||
|
|
f1a36da305 | ||
|
|
f40ee39597 | ||
| f49683ea7f | |||
|
|
9d9e86e2e8 | ||
|
|
c7860cae1e | ||
| 2f9039715e | |||
| 7a6ec8a322 | |||
|
|
c6f1a67cd5 | ||
|
|
156f5a7c46 | ||
| 2a5ef06f36 | |||
|
|
76fc3908df | ||
|
|
d78d1f135d | ||
| 766f4935ef | |||
|
|
d3f2356903 | ||
|
|
99c69fba78 | ||
| bbc11e96e3 | |||
| 28879cbf65 | |||
|
|
2a707a4bab |
127
Jenkinsfile
vendored
127
Jenkinsfile
vendored
@@ -1,127 +0,0 @@
|
||||
pipeline {
|
||||
agent {
|
||||
label 'puppet'
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
deleteDir() /* clean up our workspace */
|
||||
}
|
||||
success {
|
||||
updateGitlabCommitStatus state: 'success'
|
||||
}
|
||||
failure {
|
||||
updateGitlabCommitStatus state: 'failed'
|
||||
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'support@confdroid.com', sendToIndividuals: true])
|
||||
}
|
||||
}
|
||||
|
||||
options {
|
||||
gitLabConnection('gitlab.confdroid.com')
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
stage('pull master') {
|
||||
steps {
|
||||
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
||||
sh '''
|
||||
git config user.name "Jenkins Server"
|
||||
git config user.email jenkins@confdroid.com
|
||||
# Ensure we're on the development branch (triggered by push)
|
||||
git checkout development
|
||||
# Create jenkins branch from development
|
||||
git checkout -b jenkins-build-$BUILD_NUMBER
|
||||
# Optionally merge master into jenkins to ensure compatibility
|
||||
git merge origin/master --no-ff || { echo "Merge conflict detected"; exit 1; }
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('puppet parser') {
|
||||
steps {
|
||||
sh '''for file in $(find . -iname \'*.pp\'); do
|
||||
/opt/puppetlabs/bin/puppet parser validate --color false --render-as s --modulepath=modules $file || exit 1;
|
||||
done;'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('check templates') {
|
||||
steps{
|
||||
sh '''for file in $(find . -iname \'*.erb\');
|
||||
do erb -P -x -T "-" $file | ruby -c || exit 1;
|
||||
done;'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('puppet-lint') {
|
||||
steps {
|
||||
sh '''/usr/local/bin/puppet-lint . \\
|
||||
--no-variable_scope-check \\
|
||||
|| { echo "Puppet lint failed"; exit 1; }
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('SonarScan') {
|
||||
steps {
|
||||
withCredentials([string(credentialsId: 'sonar-token', variable: 'SONAR_TOKEN')]) {
|
||||
sh '''
|
||||
/opt/sonar-scanner/bin/sonar-scanner \
|
||||
-Dsonar.projectKey=confdroid_ntp \
|
||||
-Dsonar.sources=. \
|
||||
-Dsonar.host.url=https://sonarqube.confdroid.com \
|
||||
-Dsonar.token=$SONAR_TOKEN
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('create Puppet documentation') {
|
||||
steps {
|
||||
sh '/opt/puppetlabs/bin/puppet strings'
|
||||
}
|
||||
}
|
||||
|
||||
stage('update repo') {
|
||||
steps {
|
||||
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
||||
sh '''
|
||||
git config user.name "Jenkins Server"
|
||||
git config user.email jenkins@confdroid.com
|
||||
git rm -r --cached .vscode || echo "No .vscode to remove from git"
|
||||
git add -A && git commit -am "Recommit for updates in build $BUILD_NUMBER" || echo "No changes to commit"
|
||||
git push origin HEAD:master
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Mirror to Gitea') {
|
||||
steps {
|
||||
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
||||
withCredentials([usernamePassword(
|
||||
credentialsId: 'Jenkins-gitea',
|
||||
usernameVariable: 'GITEA_USER',
|
||||
passwordVariable: 'GITEA_TOKEN')]) {
|
||||
script {
|
||||
// Checkout from GitLab (already done implicitly)
|
||||
sh '''
|
||||
git checkout master
|
||||
git pull origin master
|
||||
git branch -D development
|
||||
git branch -D jenkins-build-$BUILD_NUMBER
|
||||
git rm -f Jenkinsfile
|
||||
git rm -r --cached .vscode || echo "No .vscode to remove from git"
|
||||
git commit --amend --no-edit --allow-empty
|
||||
git remote add master https://sourcecode.confdroid.com/confdroid/confdroid_ntp.git
|
||||
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
|
||||
push master --mirror
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,9 +32,9 @@ Time management in Linux is important. The underlying protocol is ntp, the servi
|
||||
|
||||
This module differentiates between client- and server configuration. If the `FQDN` of the puppet client matches the value of `cy_server_fqdn`, it assumes this to be an ntp time server, else it will be a client.
|
||||
|
||||
If you have no local time server(s), leave the default for `cy_server_fqdn`.
|
||||
If you have no local time server(s), leave `cy_use_lan_server` at `false` (default), else set it to `true`. This affects only client configurations.
|
||||
|
||||
The value for `cy_server_fqdn` is a string rather array, assuming either a single time server or a round-robin DNS entry for this, returning several values for the time server (not configured by this module).
|
||||
The value for `cy_server_fqdn` is a string rather array, assuming either a single time server or a round-robin DNS CNAME entry returning several values for the time server (not configured by this module).
|
||||
|
||||
INSTALLATION
|
||||
|
||||
|
||||
@@ -98,6 +98,11 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<span class='object_link'><a href="puppet_classes/confdroid_ntp_3A_3Amonitoring_3A_3Aloki.html" title="puppet_classes::confdroid_ntp::monitoring::loki (puppet_class)">confdroid_ntp::monitoring::loki</a></span>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<span class='object_link'><a href="puppet_classes/confdroid_ntp_3A_3Amonitoring_3A_3Atarget.html" title="puppet_classes::confdroid_ntp::monitoring::target (puppet_class)">confdroid_ntp::monitoring::target</a></span>
|
||||
|
||||
|
||||
@@ -103,6 +103,12 @@
|
||||
|
||||
<h2 id="label-Features">Features</h2>
|
||||
|
||||
<p>This module differentiates between client- and server configuration. If the <code>FQDN</code> of the puppet client matches the value of <code>cy_server_fqdn</code>, it assumes this to be an ntp time server, else it will be a client.</p>
|
||||
|
||||
<p>If you have no local time server(s), leave <code>cy_use_lan_server</code> at <code>false</code> (default), else set it to <code>true</code>. This affects only client configurations.</p>
|
||||
|
||||
<p>The value for <code>cy_server_fqdn</code> is a string rather array, assuming either a single time server or a round-robin DNS CNAME entry returning several values for the time server (not configured by this module).</p>
|
||||
|
||||
<p>INSTALLATION</p>
|
||||
<ul><li>
|
||||
<p>installs chrony binaries</p>
|
||||
@@ -110,7 +116,9 @@
|
||||
|
||||
<p>CONFIGURATION</p>
|
||||
<ul><li>
|
||||
<p>manage directories and files including templates</p>
|
||||
<p>manage directories including selinux contexts</p>
|
||||
</li><li>
|
||||
<p>and files and their templates including selinux contexts</p>
|
||||
</li><li>
|
||||
<p>manage service</p>
|
||||
</li><li>
|
||||
|
||||
@@ -103,6 +103,12 @@
|
||||
|
||||
<h2 id="label-Features">Features</h2>
|
||||
|
||||
<p>This module differentiates between client- and server configuration. If the <code>FQDN</code> of the puppet client matches the value of <code>cy_server_fqdn</code>, it assumes this to be an ntp time server, else it will be a client.</p>
|
||||
|
||||
<p>If you have no local time server(s), leave <code>cy_use_lan_server</code> at <code>false</code> (default), else set it to <code>true</code>. This affects only client configurations.</p>
|
||||
|
||||
<p>The value for <code>cy_server_fqdn</code> is a string rather array, assuming either a single time server or a round-robin DNS CNAME entry returning several values for the time server (not configured by this module).</p>
|
||||
|
||||
<p>INSTALLATION</p>
|
||||
<ul><li>
|
||||
<p>installs chrony binaries</p>
|
||||
@@ -110,7 +116,9 @@
|
||||
|
||||
<p>CONFIGURATION</p>
|
||||
<ul><li>
|
||||
<p>manage directories and files including templates</p>
|
||||
<p>manage directories including selinux contexts</p>
|
||||
</li><li>
|
||||
<p>and files and their templates including selinux contexts</p>
|
||||
</li><li>
|
||||
<p>manage service</p>
|
||||
</li><li>
|
||||
|
||||
@@ -78,14 +78,21 @@
|
||||
</li>
|
||||
|
||||
|
||||
<li id="object_puppet_classes::confdroid_ntp::monitoring::target" class="odd">
|
||||
<li id="object_puppet_classes::confdroid_ntp::monitoring::loki" class="odd">
|
||||
<div class="item">
|
||||
<span class='object_link'><a href="puppet_classes/confdroid_ntp_3A_3Amonitoring_3A_3Aloki.html" title="puppet_classes::confdroid_ntp::monitoring::loki (puppet_class)">confdroid_ntp::monitoring::loki</a></span>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li id="object_puppet_classes::confdroid_ntp::monitoring::target" class="even">
|
||||
<div class="item">
|
||||
<span class='object_link'><a href="puppet_classes/confdroid_ntp_3A_3Amonitoring_3A_3Atarget.html" title="puppet_classes::confdroid_ntp::monitoring::target (puppet_class)">confdroid_ntp::monitoring::target</a></span>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li id="object_puppet_classes::confdroid_ntp::params" class="even">
|
||||
<li id="object_puppet_classes::confdroid_ntp::params" class="odd">
|
||||
<div class="item">
|
||||
<span class='object_link'><a href="puppet_classes/confdroid_ntp_3A_3Aparams.html" title="puppet_classes::confdroid_ntp::params (puppet_class)">confdroid_ntp::params</a></span>
|
||||
</div>
|
||||
|
||||
@@ -109,7 +109,11 @@
|
||||
11
|
||||
12
|
||||
13
|
||||
14</pre>
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre class="code"><span class="info file"># File 'manifests/main/config.pp', line 6</span>
|
||||
@@ -119,9 +123,13 @@ class confdroid_ntp::main::config (
|
||||
) inherits confdroid_ntp::params {
|
||||
include confdroid_ntp::main::service
|
||||
|
||||
# if $ay_manage_nagios == true {
|
||||
# include confdroid_ntp::monitoring::target
|
||||
# }
|
||||
if $cy_manage_nagios == true {
|
||||
include confdroid_ntp::monitoring::target
|
||||
}
|
||||
|
||||
if $cy_manage_loki == true {
|
||||
include confdroid_ntp::monitoring::loki
|
||||
}
|
||||
}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -109,7 +109,51 @@
|
||||
11
|
||||
12
|
||||
13
|
||||
14</pre>
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27
|
||||
28
|
||||
29
|
||||
30
|
||||
31
|
||||
32
|
||||
33
|
||||
34
|
||||
35
|
||||
36
|
||||
37
|
||||
38
|
||||
39
|
||||
40
|
||||
41
|
||||
42
|
||||
43
|
||||
44
|
||||
45
|
||||
46
|
||||
47
|
||||
48
|
||||
49
|
||||
50
|
||||
51
|
||||
52
|
||||
53
|
||||
54
|
||||
55
|
||||
56
|
||||
57
|
||||
58</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre class="code"><span class="info file"># File 'manifests/main/dirs.pp', line 6</span>
|
||||
@@ -120,8 +164,52 @@ class confdroid_ntp::main::dirs (
|
||||
require confdroid_ntp::main::install
|
||||
|
||||
# /var/log/chrony
|
||||
file { '/var/log/chrony':
|
||||
ensure => directory,
|
||||
owner => 'chrony',
|
||||
group => 'chrony',
|
||||
mode => '0750',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => chronyd_var_log_t,
|
||||
seluser => system_u,
|
||||
}
|
||||
|
||||
# /var/lib/chrony
|
||||
file { '/var/lib/chrony':
|
||||
ensure => directory,
|
||||
owner => 'chrony',
|
||||
group => 'chrony',
|
||||
mode => '0750',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => chronyd_var_lib_t,
|
||||
seluser => system_u,
|
||||
}
|
||||
|
||||
# /run/chrony
|
||||
file { '/run/chrony':
|
||||
ensure => directory,
|
||||
owner => 'chrony',
|
||||
group => 'chrony',
|
||||
mode => '0750',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => chronyd_var_run_t,
|
||||
seluser => system_u,
|
||||
}
|
||||
|
||||
# /run/chrony-dhcp
|
||||
file { '/run/chrony-dhcp':
|
||||
ensure => directory,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0755',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => chronyd_var_run_t,
|
||||
seluser => system_u,
|
||||
}
|
||||
}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -123,7 +123,28 @@
|
||||
25
|
||||
26
|
||||
27
|
||||
28</pre>
|
||||
28
|
||||
29
|
||||
30
|
||||
31
|
||||
32
|
||||
33
|
||||
34
|
||||
35
|
||||
36
|
||||
37
|
||||
38
|
||||
39
|
||||
40
|
||||
41
|
||||
42
|
||||
43
|
||||
44
|
||||
45
|
||||
46
|
||||
47
|
||||
48
|
||||
49</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre class="code"><span class="info file"># File 'manifests/main/files.pp', line 6</span>
|
||||
@@ -148,8 +169,29 @@ class confdroid_ntp::main::files (
|
||||
}
|
||||
|
||||
# drift file /var/lib/chrony/drift
|
||||
file { $cy_drift_file:
|
||||
ensure => file,
|
||||
owner => 'chrony',
|
||||
group => 'chrony',
|
||||
mode => '0644',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => chronyd_var_lib_t,
|
||||
seluser => system_u,
|
||||
}
|
||||
|
||||
# log rotation
|
||||
file { $cy_logrotate_file:
|
||||
ensure => file,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => etc_t,
|
||||
seluser => system_u,
|
||||
content => template($cy_logrotate_erb),
|
||||
}
|
||||
}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
138
doc/puppet_classes/confdroid_ntp_3A_3Amonitoring_3A_3Aloki.html
Normal file
138
doc/puppet_classes/confdroid_ntp_3A_3Amonitoring_3A_3Aloki.html
Normal file
@@ -0,0 +1,138 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>
|
||||
Puppet Class: confdroid_ntp::monitoring::loki
|
||||
|
||||
— Documentation by YARD 0.9.36
|
||||
|
||||
</title>
|
||||
|
||||
<link rel="stylesheet" href="../css/style.css" type="text/css" />
|
||||
|
||||
<link rel="stylesheet" href="../css/common.css" type="text/css" />
|
||||
|
||||
<script type="text/javascript">
|
||||
pathId = "puppet_classes::confdroid_ntp::monitoring::loki";
|
||||
relpath = '../';
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="nav_wrap">
|
||||
<iframe id="nav" src="../puppet_class_list.html?1"></iframe>
|
||||
<div id="resizer"></div>
|
||||
</div>
|
||||
|
||||
<div id="main" tabindex="-1">
|
||||
<div id="header">
|
||||
<div id="menu">
|
||||
|
||||
<a href="../_index.html">Index (c)</a> »
|
||||
<span class='title'><span class='object_link'>Puppet Classes</span></span>
|
||||
»
|
||||
<span class="title">confdroid_ntp::monitoring::loki</span>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="search">
|
||||
|
||||
<a class="full_list_link" id="puppet_class_list_link"
|
||||
href="../puppet_class_list.html">
|
||||
|
||||
<svg width="24" height="24">
|
||||
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
||||
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
||||
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
||||
</svg>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
<div id="content"><h1>Puppet Class: confdroid_ntp::monitoring::loki</h1>
|
||||
<div class="box_info">
|
||||
|
||||
<dl>
|
||||
<dt>Inherits:</dt>
|
||||
<dd><span class='object_link'><a href="confdroid_ntp_3A_3Aparams.html" title="puppet_classes::confdroid_ntp::params (puppet_class)">confdroid_ntp::params</a></span></dd>
|
||||
</dl>
|
||||
|
||||
|
||||
<dl>
|
||||
<dt>Defined in:</dt>
|
||||
<dd>
|
||||
manifests/monitoring/loki.pp
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<h2>Summary</h2>
|
||||
Class manages loki monitoring for the confdroid_ntp services
|
||||
|
||||
<h2>Overview</h2>
|
||||
<div class="docstring">
|
||||
<div class="discussion">
|
||||
|
||||
<p>confdroid_ntp::monitoring::loki.pp Module name: confdroid_ntp Author: 12ww1160 (12ww1160@confdroid.com)</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="tags">
|
||||
|
||||
|
||||
|
||||
</div><div class="method_details_list">
|
||||
<table class="source_code">
|
||||
<tr>
|
||||
<td>
|
||||
<pre class="lines">
|
||||
|
||||
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre class="code"><span class="info file"># File 'manifests/monitoring/loki.pp', line 6</span>
|
||||
|
||||
class confdroid_ntp::monitoring::loki (
|
||||
|
||||
) inherits confdroid_ntp::params {
|
||||
if $cy_manage_loki == true {
|
||||
confdroid_alloy::monitoring::log_targets { "confdroid_ntp_${fqdn}":
|
||||
targets => ['/var/log/chrony'],
|
||||
}
|
||||
}
|
||||
}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
Generated by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>.
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -104,7 +104,21 @@
|
||||
6
|
||||
7
|
||||
8
|
||||
9</pre>
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre class="code"><span class="info file"># File 'manifests/monitoring/target.pp', line 6</span>
|
||||
@@ -112,6 +126,20 @@
|
||||
class confdroid_ntp::monitoring::target (
|
||||
|
||||
) inherits confdroid_ntp::params {
|
||||
if $cy_manage_nagios == true {
|
||||
@@nagios_service { "check_chronyd_${fqdn}":
|
||||
check_command => "check_nrpe!check_chronyd!${cy_procs_allowed}!chronyd",
|
||||
use => 'generic-service',
|
||||
host_name => $fqdn,
|
||||
notification_period => '24x7',
|
||||
service_description => "${fqdn}_check_chronyd",
|
||||
target => $cy_target_service,
|
||||
owner => 'nagios',
|
||||
group => 'nagios',
|
||||
mode => '0640',
|
||||
contacts => $cy_target_contacts,
|
||||
}
|
||||
}
|
||||
}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -77,6 +77,8 @@
|
||||
|
||||
<span class='object_link'><a href="confdroid_ntp_3A_3Amain_3A_3Aservice.html" title="puppet_classes::confdroid_ntp::main::service (puppet_class)">confdroid_ntp::main::service</a></span><br/>
|
||||
|
||||
<span class='object_link'><a href="confdroid_ntp_3A_3Amonitoring_3A_3Aloki.html" title="puppet_classes::confdroid_ntp::monitoring::loki (puppet_class)">confdroid_ntp::monitoring::loki</a></span><br/>
|
||||
|
||||
<span class='object_link'><a href="confdroid_ntp_3A_3Amonitoring_3A_3Atarget.html" title="puppet_classes::confdroid_ntp::monitoring::target (puppet_class)">confdroid_ntp::monitoring::target</a></span><br/>
|
||||
|
||||
</dd>
|
||||
@@ -152,7 +154,7 @@
|
||||
<span class='type'>(<tt>String</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>'ntp.example.com'</tt>)</em>
|
||||
<em class="default">(defaults to: <tt>'ntp.example.local'</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
@@ -176,6 +178,204 @@
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>List of NTP servers to point to as time source</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>cy_min_sources</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>String</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>'3'</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>Minimum number of selectable sources required to adjust the system clock. Primarily used for servers.</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>cy_client_allow</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>String</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>'192.168.1.0/24'</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>CIDR notation for allowed client networks</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>cy_leapsec_mode</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>String</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>'slew'</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>Leap second handling mode. Valid values are ‘slew’ or ‘step’.</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>cy_leapsectz</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>String</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>'right/UTC'</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>Leap second timezone file to use.</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>cy_loginfo</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>String</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>'measurements statistics tracking'</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>Log information to record. Valid values are ‘measurements’, ‘statistics’, and ‘tracking’.</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>cy_use_lan_server</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>Boolean</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>false</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>Whether to use a local LAN server or external pool.</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>cy_manage_nagios</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>Boolean</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>false</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>Whether to manage Nagios monitoring for the module.</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>cy_procs_allowed</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>String</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>'1:'</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>Number of allowed processes for the Nagios check.</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>cy_target_service</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>String</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>'/etc/nagios/conf.d/chronyd_service.cfg'</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>Path to the Nagios service configuration file.</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>cy_target_contacts</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>Array</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>['nagiosadmin']</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>List of Nagios contacts for notifications. must exist in Nagios contacts configuration!</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>cy_manage_loki</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>Boolean</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>false</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>Whether to manage Loki logging for the module.</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
@@ -191,21 +391,6 @@
|
||||
<pre class="lines">
|
||||
|
||||
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27
|
||||
28
|
||||
29
|
||||
30
|
||||
@@ -219,10 +404,43 @@
|
||||
38
|
||||
39
|
||||
40
|
||||
41</pre>
|
||||
41
|
||||
42
|
||||
43
|
||||
44
|
||||
45
|
||||
46
|
||||
47
|
||||
48
|
||||
49
|
||||
50
|
||||
51
|
||||
52
|
||||
53
|
||||
54
|
||||
55
|
||||
56
|
||||
57
|
||||
58
|
||||
59
|
||||
60
|
||||
61
|
||||
62
|
||||
63
|
||||
64
|
||||
65
|
||||
66
|
||||
67
|
||||
68
|
||||
69
|
||||
70
|
||||
71
|
||||
72
|
||||
73
|
||||
74</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 13</span>
|
||||
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 28</span>
|
||||
|
||||
class confdroid_ntp::params (
|
||||
|
||||
@@ -231,8 +449,23 @@ class confdroid_ntp::params (
|
||||
String $cy_pkg_ensure = 'present',
|
||||
|
||||
# configuration
|
||||
String $cy_server_fqdn = 'ntp.example.com',
|
||||
Boolean $cy_use_lan_server = false,
|
||||
String $cy_server_fqdn = 'ntp.example.local',
|
||||
Array $cy_conf_servers = ['0.pool.ntp.org', '1.pool.ntp.org', '2.pool.ntp.org', '3.pool.ntp.org'],
|
||||
String $cy_min_sources = '3',
|
||||
String $cy_client_allow = '192.168.1.0/24',
|
||||
String $cy_leapsec_mode = 'slew',
|
||||
String $cy_leapsectz = 'right/UTC',
|
||||
String $cy_loginfo = 'measurements statistics tracking',
|
||||
|
||||
# monitoring
|
||||
Boolean $cy_manage_nagios = false,
|
||||
String $cy_procs_allowed = '1:',
|
||||
String $cy_target_service = '/etc/nagios/conf.d/chronyd_service.cfg',
|
||||
Array $cy_target_contacts = ['nagiosadmin'],
|
||||
|
||||
# loki
|
||||
Boolean $cy_manage_loki = false,
|
||||
|
||||
) {
|
||||
# facts
|
||||
@@ -246,6 +479,9 @@ class confdroid_ntp::params (
|
||||
# files
|
||||
$cy_conf_file = '/etc/chrony.conf'
|
||||
$cy_conf_erb = 'confdroid_ntp/chrony.conf.erb'
|
||||
$cy_drift_file = '/var/lib/chrony/drift'
|
||||
$cy_logrotate_file = '/etc/logrotate.d/chrony'
|
||||
$cy_logrotate_erb = 'confdroid_ntp/logrotate.chrony.erb'
|
||||
|
||||
# service
|
||||
$cy_service = 'chronyd'
|
||||
|
||||
@@ -8,7 +8,11 @@ class confdroid_ntp::main::config (
|
||||
) inherits confdroid_ntp::params {
|
||||
include confdroid_ntp::main::service
|
||||
|
||||
# if $ay_manage_nagios == true {
|
||||
# include confdroid_ntp::monitoring::target
|
||||
# }
|
||||
if $cy_manage_nagios == true {
|
||||
include confdroid_ntp::monitoring::target
|
||||
}
|
||||
|
||||
if $cy_manage_loki == true {
|
||||
include confdroid_ntp::monitoring::loki
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,50 @@ class confdroid_ntp::main::dirs (
|
||||
require confdroid_ntp::main::install
|
||||
|
||||
# /var/log/chrony
|
||||
file { '/var/log/chrony':
|
||||
ensure => directory,
|
||||
owner => 'chrony',
|
||||
group => 'chrony',
|
||||
mode => '0750',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => chronyd_var_log_t,
|
||||
seluser => system_u,
|
||||
}
|
||||
|
||||
# /var/lib/chrony
|
||||
file { '/var/lib/chrony':
|
||||
ensure => directory,
|
||||
owner => 'chrony',
|
||||
group => 'chrony',
|
||||
mode => '0750',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => chronyd_var_lib_t,
|
||||
seluser => system_u,
|
||||
}
|
||||
|
||||
# /run/chrony
|
||||
file { '/run/chrony':
|
||||
ensure => directory,
|
||||
owner => 'chrony',
|
||||
group => 'chrony',
|
||||
mode => '0750',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => chronyd_var_run_t,
|
||||
seluser => system_u,
|
||||
}
|
||||
|
||||
# /run/chrony-dhcp
|
||||
file { '/run/chrony-dhcp':
|
||||
ensure => directory,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0755',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => chronyd_var_run_t,
|
||||
seluser => system_u,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,27 @@ class confdroid_ntp::main::files (
|
||||
}
|
||||
|
||||
# drift file /var/lib/chrony/drift
|
||||
file { $cy_drift_file:
|
||||
ensure => file,
|
||||
owner => 'chrony',
|
||||
group => 'chrony',
|
||||
mode => '0644',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => chronyd_var_lib_t,
|
||||
seluser => system_u,
|
||||
}
|
||||
|
||||
# log rotation
|
||||
file { $cy_logrotate_file:
|
||||
ensure => file,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => etc_t,
|
||||
seluser => system_u,
|
||||
content => template($cy_logrotate_erb),
|
||||
}
|
||||
}
|
||||
|
||||
14
manifests/monitoring/loki.pp
Normal file
14
manifests/monitoring/loki.pp
Normal file
@@ -0,0 +1,14 @@
|
||||
#### confdroid_ntp::monitoring::loki.pp
|
||||
# Module name: confdroid_ntp
|
||||
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||
# @summary Class manages loki monitoring for the confdroid_ntp services
|
||||
###############################################################################
|
||||
class confdroid_ntp::monitoring::loki (
|
||||
|
||||
) inherits confdroid_ntp::params {
|
||||
if $cy_manage_loki == true {
|
||||
confdroid_alloy::monitoring::log_targets { "confdroid_ntp_${fqdn}":
|
||||
targets => ['/var/log/chrony'],
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,4 +6,18 @@
|
||||
class confdroid_ntp::monitoring::target (
|
||||
|
||||
) inherits confdroid_ntp::params {
|
||||
if $cy_manage_nagios == true {
|
||||
@@nagios_service { "check_chronyd_${fqdn}":
|
||||
check_command => "check_nrpe!check_chronyd!${cy_procs_allowed}!chronyd",
|
||||
use => 'generic-service',
|
||||
host_name => $fqdn,
|
||||
notification_period => '24x7',
|
||||
service_description => "${fqdn}_check_chronyd",
|
||||
target => $cy_target_service,
|
||||
owner => 'nagios',
|
||||
group => 'nagios',
|
||||
mode => '0640',
|
||||
contacts => $cy_target_contacts,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,13 @@
|
||||
# @param [String] cy_leapsectz Leap second timezone file to use.
|
||||
# @param [String] cy_loginfo Log information to record. Valid values are
|
||||
# 'measurements', 'statistics', and 'tracking'.
|
||||
# @param [Boolean] cy_use_lan_server Whether to use a local LAN server or external pool.
|
||||
# @param [Boolean] cy_manage_nagios Whether to manage Nagios monitoring for the module.
|
||||
# @param [String] cy_procs_allowed Number of allowed processes for the Nagios check.
|
||||
# @param [String] cy_target_service Path to the Nagios service configuration file.
|
||||
# @param [Array] cy_target_contacts List of Nagios contacts for notifications.
|
||||
# must exist in Nagios contacts configuration!
|
||||
# @param [Boolean] cy_manage_loki Whether to manage Loki logging for the module.
|
||||
###############################################################################
|
||||
class confdroid_ntp::params (
|
||||
|
||||
@@ -25,6 +32,7 @@ class confdroid_ntp::params (
|
||||
String $cy_pkg_ensure = 'present',
|
||||
|
||||
# configuration
|
||||
Boolean $cy_use_lan_server = false,
|
||||
String $cy_server_fqdn = 'ntp.example.local',
|
||||
Array $cy_conf_servers = ['0.pool.ntp.org', '1.pool.ntp.org', '2.pool.ntp.org', '3.pool.ntp.org'],
|
||||
String $cy_min_sources = '3',
|
||||
@@ -33,6 +41,15 @@ class confdroid_ntp::params (
|
||||
String $cy_leapsectz = 'right/UTC',
|
||||
String $cy_loginfo = 'measurements statistics tracking',
|
||||
|
||||
# monitoring
|
||||
Boolean $cy_manage_nagios = false,
|
||||
String $cy_procs_allowed = '1:',
|
||||
String $cy_target_service = '/etc/nagios/conf.d/chronyd_service.cfg',
|
||||
Array $cy_target_contacts = ['nagiosadmin'],
|
||||
|
||||
# loki
|
||||
Boolean $cy_manage_loki = false,
|
||||
|
||||
) {
|
||||
# facts
|
||||
$fqdn = $facts['networking']['fqdn']
|
||||
@@ -45,6 +62,9 @@ class confdroid_ntp::params (
|
||||
# files
|
||||
$cy_conf_file = '/etc/chrony.conf'
|
||||
$cy_conf_erb = 'confdroid_ntp/chrony.conf.erb'
|
||||
$cy_drift_file = '/var/lib/chrony/drift'
|
||||
$cy_logrotate_file = '/etc/logrotate.d/chrony'
|
||||
$cy_logrotate_erb = 'confdroid_ntp/logrotate.chrony.erb'
|
||||
|
||||
# service
|
||||
$cy_service = 'chronyd'
|
||||
|
||||
@@ -57,13 +57,18 @@ logdir /var/log/chrony
|
||||
|
||||
# Select which information is logged.
|
||||
log <%= @cy_loginfo %>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
<% if @fqdn != @cy_server_fqdn -%>
|
||||
# This is a time client configuration file
|
||||
<% if @cy_use_lan_server -%>
|
||||
server <%= @cy_server_fqdn %> iburst
|
||||
<% else -%>
|
||||
# Use public servers from the pool.ntp.org project.
|
||||
<% @cy_conf_servers.each do |this_server| -%>
|
||||
server <%= this_server %> iburst
|
||||
<% end end -%>
|
||||
|
||||
# Use NTP servers from DHCP.
|
||||
sourcedir /run/chrony-dhcp
|
||||
@@ -79,7 +84,7 @@ makestep 1.0 3
|
||||
rtcsync
|
||||
|
||||
# Enable hardware timestamping on all interfaces that support it.
|
||||
hwtimestamp *
|
||||
# hwtimestamp *
|
||||
|
||||
# Increase the minimum number of selectable sources required to adjust
|
||||
# the system clock. Primarily for servers.
|
||||
@@ -111,5 +116,4 @@ logdir /var/log/chrony
|
||||
|
||||
# Select which information is logged.
|
||||
log <%= @cy_loginfo %>
|
||||
|
||||
<% end %>
|
||||
|
||||
9
templates/logrotate.chrony.erb
Normal file
9
templates/logrotate.chrony.erb
Normal file
@@ -0,0 +1,9 @@
|
||||
# file created by Puppet, manual changes will be overwritten
|
||||
/var/log/chrony/*.log {
|
||||
missingok
|
||||
nocreate
|
||||
sharedscripts
|
||||
postrotate
|
||||
/usr/bin/chronyc cyclelogs > /dev/null 2>&1 || true
|
||||
endscript
|
||||
}
|
||||
Reference in New Issue
Block a user