48 Commits
1.0.0 ... 1.1.0

Author SHA1 Message Date
aa83361a8e OP#672 update Readme with new feature 2026-09-07 14:40:59 +02:00
c2149834d3 OP#672 update Readme with new feature 2026-09-07 14:39:23 +02:00
5db2481d76 OP#672 edit target to include correct variables 2026-09-07 13:52:13 +02:00
eefd846f7c OP#672 add fqdnn variable 2026-09-07 13:46:59 +02:00
63e1012ff3 OP#672 add nagios monitoring target 2026-09-07 13:41:01 +02:00
8317e78bef OP#672 add nagios monitoring target 2026-09-07 13:10:13 +02:00
f883424e26 fix template 2026-09-06 15:52:06 +02:00
eab95a5b54 OP#662 add flags for queue_config 2026-09-01 11:34:57 +02:00
96211f2eb5 OP#662 add flags to params 2026-09-01 11:06:14 +02:00
4217cb39d1 OP#662 add flags to harden the alloy for better tracking 2026-09-01 10:58:43 +02:00
7972cfd5ad OP#630 clean up comments 2026-08-01 14:37:20 +02:00
45ce68ea3d OP#630 edit alloy scraping 2026-08-01 14:31:07 +02:00
Jenkins Server
02ac780491 Recommit for updates in build 3 2026-07-22 12:45:53 +02:00
Jenkins Server
425fd79204 Merge remote-tracking branch 'origin/master' into jenkins-build-3 2026-07-22 12:44:50 +02:00
f3923c6330 OP#647 update Readme 2026-07-22 12:44:26 +02:00
Jenkins Server
b55920b478 Recommit for updates in build 2 2026-07-21 13:38:10 +02:00
Jenkins Server
2f6fea62b3 Merge remote-tracking branch 'origin/master' into jenkins-build-2 2026-07-21 13:37:18 +02:00
a59c9727e0 OP#647 update Readme 2026-07-21 13:36:58 +02:00
Jenkins Server
b12f4bd203 Recommit for updates in build 1 2026-07-21 13:27:22 +02:00
Jenkins Server
413c5c3679 Merge remote-tracking branch 'origin/master' into jenkins-build-1 2026-07-21 13:26:18 +02:00
a1d70fb4ab OP#647 initial commit after fork 2026-07-21 13:25:48 +02:00
Jenkins
5953ff411a Merge branch 'jenkins-build-15' into 'master'
Auto-merge for build 15

See merge request puppet/alloy_cd!10
2026-02-22 14:12:14 +00:00
Jenkins Server
f0a398de6a Merge remote-tracking branch 'origin/master' into jenkins-build-15 2026-02-22 15:11:19 +01:00
Jenkins
e229e5ed45 Merge branch 'jenkins-build-12' into 'master'
Auto-merge for build 12

See merge request puppet/alloy_cd!7
2025-07-18 11:22:05 +00:00
Jenkins Server
cd249e15fc Merge remote-tracking branch 'origin/master' into jenkins-build-12 2025-07-18 13:19:31 +02:00
Arne Teuke
fd638a276f update loki log level to info 2025-07-18 13:19:07 +02:00
Jenkins
834cf30fdd Merge branch 'jenkins-build-11' into 'master'
Auto-merge for build 11

See merge request puppet/alloy_cd!6
2025-06-13 15:18:55 +00:00
Jenkins Server
a1efbd6715 Merge remote-tracking branch 'origin/master' into jenkins-build-11 2025-06-13 17:16:27 +02:00
Arne Teuke
3bd4b55669 final setup 2025-06-13 17:16:08 +02:00
Jenkins
34736f529f Merge branch 'jenkins-build-10' into 'master'
Auto-merge for build 10

See merge request puppet/alloy_cd!5
2025-06-13 15:09:47 +00:00
Jenkins Server
46c93d1561 Merge remote-tracking branch 'origin/master' into jenkins-build-10 2025-06-13 17:01:57 +02:00
Arne Teuke
31fa60bd53 add option to include node exporter 2025-06-13 17:01:34 +02:00
Jenkins
2df266dac9 Merge branch 'jenkins-build-9' into 'master'
Auto-merge for build 9

See merge request puppet/alloy_cd!4
2025-06-13 14:45:53 +00:00
Jenkins Server
f5ebc7ba33 Merge remote-tracking branch 'origin/master' into jenkins-build-9 2025-06-13 16:45:03 +02:00
Arne Teuke
e4746d356a add option to include node exporter 2025-06-13 16:42:52 +02:00
Jenkins
888ad62fe1 Merge branch 'jenkins-build-7' into 'master'
Auto-merge for build 7

See merge request puppet/alloy_cd!3
2025-06-13 14:30:31 +00:00
Jenkins Server
017ef494b6 Merge remote-tracking branch 'origin/master' into jenkins-build-7 2025-06-13 16:29:15 +02:00
Arne Teuke
38f597d115 add option to include node exporter 2025-06-13 16:28:56 +02:00
Jenkins
a44a82ab57 Merge branch 'jenkins-build-6' into 'master'
Auto-merge for build 6

See merge request puppet/alloy_cd!2
2025-06-13 14:06:44 +00:00
Jenkins Server
7973d1ec96 Recommit for updates in build 6 2025-06-13 16:06:24 +02:00
Jenkins Server
e77d14928b Merge remote-tracking branch 'origin/master' into jenkins-build-6 2025-06-13 16:05:37 +02:00
Arne Teuke
7a1749a738 add option to include node exporter 2025-06-13 16:05:16 +02:00
Jenkins
7200fcb282 Merge branch 'jenkins-build-5' into 'master'
Auto-merge for build 5

See merge request puppet/alloy_cd!1
2025-06-05 14:37:01 +00:00
Jenkins Server
5d0f3cb5f4 Merge remote-tracking branch 'origin/master' into jenkins-build-5 2025-06-05 16:35:33 +02:00
Arne Teuke
2781df9d27 add new MR approach 2025-06-05 16:35:13 +02:00
Jenkins Server
4e9793519d Recommit for updates in build 4 2025-05-22 17:07:21 +02:00
Jenkins Server
183e479c75 Merge remote-tracking branch 'origin/master' into jenkins-build-4 2025-05-22 17:06:45 +02:00
Jenkins Server
88b5407e15 recommit for updates in build 3 2025-05-06 13:32:30 +02:00
14 changed files with 229 additions and 107 deletions

2
.gitignore vendored
View File

@@ -2,3 +2,5 @@
Gemfile.lock
FileList
.scannerwork
.vscode
.puppet-lint.rc

10
.vscode/settings.json vendored
View File

@@ -1,10 +0,0 @@
{
"cSpell.words": [
"endscript",
"maillog",
"missingok",
"postrotate",
"sharedscripts",
"syslogs"
]
}

29
Jenkinsfile vendored
View File

@@ -69,7 +69,7 @@ pipeline {
withCredentials([string(credentialsId: 'sonar-token', variable: 'SONAR_TOKEN')]) {
sh '''
/opt/sonar-scanner/bin/sonar-scanner \
-Dsonar.projectKey=alloy_cd \
-Dsonar.projectKey=confdroid_alloy \
-Dsonar.sources=. \
-Dsonar.host.url=https://sonarqube.confdroid.com \
-Dsonar.token=$SONAR_TOKEN
@@ -90,11 +90,38 @@ pipeline {
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_alloy.git
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
push master --mirror
'''
}
}
}
}
}
}
}

View File

@@ -1,14 +1,32 @@
# Readme
[![Build Status](https://jenkins.confdroid.com/buildStatus/icon?job=alloy_cd)](https://jenkins.confdroid.com/job/alloy_cd/)
[![Build Status](https://jenkins.confdroid.com/buildStatus/icon?job=confdroid_alloy&style=plastic)](https://jenkins.confdroid.com/job/confdroid_alloy/)
[![Security Hotspots](https://sonarqube.confdroid.com/api/project_badges/measure?project=confdroid_alloy&metric=security_hotspots&token=sqb_05c3bd9116b3d2585b1f06dd7b6d0d5a6433fe8b)](https://sonarqube.confdroid.com/dashboard?id=confdroid_alloy)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/grizzlycoda/puppet_collection)
[[_TOC_]]
- [Readme](#readme)
- [Synopsis](#synopsis)
- [WARNING](#warning)
- [Features](#features)
- [Repo Documentation](#repo-documentation)
- [Dependencies](#dependencies)
- [Deployment](#deployment)
- [SELINUX](#selinux)
- [Known Problems](#known-problems)
- [Support](#support)
- [Tests](#tests)
- [Contact Us](#contact-us)
- [Disclaimer](#disclaimer)
## Synopsis
Grafana Alloy is a log management agent built by Grafana labs to scrape and forward logs to Loki, a log management system also built by Grafana labs. Then you can use Grafana itself to visualize those logs and built an alerting system.
Grafana Alloy is a log management agent built by Grafana labs to scrape and forward logs to Loki, a log management system also built by Grafana labs.
`alloy_cd` is a Puppet module to automate installation and configuration of alloy.
It also can scrape and forward metrics to Prometheus.
Then you can use Grafana itself to visualize those logs and metrics and built an alerting system.
`confdroid_alloy` is a Puppet module to automate installation and configuration of alloy.
## WARNING
@@ -18,13 +36,15 @@ Grafana Alloy is a log management agent built by Grafana labs to scrape and forw
INSTALLATION
* installs alloy binaries
- installs alloy binaries
CONFIGURATION
* manage directories and files including templates
* manages the main alloy jenkins for loki and prometheus
* manage service
- manage directories and files including templates
- manages the main alloy pipeline for loki and prometheus
- manages log rotation for rsyslog to allow adm membership
- manage service
- optional: include nagios target for the alloy service (set `ay_manage_nagios`to `true`)
## Repo Documentation
@@ -34,19 +54,21 @@ See the full Puppet documentation including parameters in `docs/index.html`
All dependencies must be included in the catalogue.
- [confdroid_nagios](https://sourcecode.confdroid.com/confdroid/confdroid_nagios) if nagios monitoring is desired
## Deployment
* native Puppet deployment
- native Puppet deployment
via site.pp or nodes.pp
```bash
node 'example.example.net' {
include cd_kubernetes
include confdroid_alloy
}
```
* through Foreman:
- through Foreman:
In order to apply parameters through Foreman, the params.pp must be added to the host or host group in question.
@@ -60,19 +82,22 @@ All files and directories are configured with correct selinux context. If selinu
## Support
* OS: Rocky 9
* Puppet 6,8
- OS: Rocky 9
- Puppet 8
## Tests
* Puppet Lint
* Puppet Parser
* ERB Template Parser
* Sonar Quality Gate
- Puppet Lint
- excluded tests:
- `--no-variable_scope-check`: not applicable as we are inheriting parameters from params class. the lint check does not distinguish between facts and inherited parameters.
- Puppet Parser
- ERB Template Parser
- Sonar Quality Gate
## Contact Us
[contact Us](https://confdroid.com/contact/)
- [contact Us](https://confdroid.com/contact/)
- [Feedback Portal](https://feedback.confdroid.com)
## Disclaimer

View File

@@ -1,8 +1,8 @@
## alloy_cd::init.pp
# Module name: alloy_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class initializes the alloy_cd module.
## confdroid_alloy::init.pp
# Module name: confdroid_alloy
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary Class initializes the confdroid_alloy module.
##############################################################################
class alloy_cd {
include alloy_cd::params
class confdroid_alloy {
include confdroid_alloy::params
}

View File

@@ -1,10 +1,14 @@
#### alloy_cd::main::config.pp
# Module name: alloy_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class manages module logic for the alloy_cd module
#### confdroid_alloy::main::config.pp
# Module name: confdroid_alloy
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary Class manages module logic for the confdroid_alloy module
###############################################################################
class alloy_cd::main::config (
class confdroid_alloy::main::config (
) inherits alloy_cd::params {
include alloy_cd::main::service
) inherits confdroid_alloy::params {
include confdroid_alloy::main::service
if $ay_manage_nagios == true {
include confdroid_alloy::monitoring::target
}
}

View File

@@ -1,12 +1,12 @@
## alloy_cd::main::dirs.pp
# Module name: alloy_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class manages required directories for the alloy_cd module
## confdroid_alloy::main::dirs.pp
# Module name: confdroid_alloy
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary Class manages required directories for the confdroid_alloy module
###############################################################################
class alloy_cd::main::dirs (
class confdroid_alloy::main::dirs (
) inherits alloy_cd::params {
require alloy_cd::main::install
) inherits confdroid_alloy::params {
require confdroid_alloy::main::install
# main config dir
file { $ay_main_dir:

View File

@@ -1,15 +1,15 @@
## alloy_cd::main::files.pp
# Module name: alloy_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class manages required config files for the alloy_cd module
## confdroid_alloy::main::files.pp
# Module name: confdroid_alloy
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary Class manages required config files for the confdroid_alloy module
###############################################################################
class alloy_cd::main::files (
class confdroid_alloy::main::files (
) inherits alloy_cd::params {
require alloy_cd::main::dirs
) inherits confdroid_alloy::params {
require confdroid_alloy::main::dirs
# Ensure log_targets is always an array
$log_targets_array = Array($alloy_cd::params::ay_log_targets, true)
$log_targets_array = Array($confdroid_alloy::params::ay_log_targets, true)
file { $ay_main_file:
ensure => file,
@@ -20,7 +20,7 @@ class alloy_cd::main::files (
selrole => object_r,
seltype => etc_t,
seluser => system_u,
content => template('alloy_cd/config.alloy.erb'),
content => template('confdroid_alloy/config.alloy.erb'),
notify => Service[$ay_service],
}
@@ -34,7 +34,7 @@ class alloy_cd::main::files (
selrole => object_r,
seltype => etc_t,
seluser => system_u,
content => template('alloy_cd/logrotate.rsyslog.erb'),
content => template('confdroid_alloy/logrotate.rsyslog.erb'),
}
# manage log file group permissions

View File

@@ -1,14 +1,14 @@
## alloy_cd::main::install.pp
# Module name: alloy_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class installs packages for the alloy_cd module
## confdroid_alloy::main::install.pp
# Module name: confdroid_alloy
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary Class installs packages for the confdroid_alloy module
###############################################################################
class alloy_cd::main::install (
class confdroid_alloy::main::install (
) inherits alloy_cd::params {
require alloy_cd::main::yumrepo
) inherits confdroid_alloy::params {
require confdroid_alloy::main::yumrepo
package { $reqpackages:
ensure => $pkg_ensure,
package { $ay_reqpackages:
ensure => $ay_pkg_ensure,
}
}

View File

@@ -1,12 +1,12 @@
## alloy_cd::main::service.pp
# Module name: alloy_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
## confdroid_alloy::main::service.pp
# Module name: confdroid_alloy
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary Class manages the alloy service
###############################################################################
class alloy_cd::main::service (
class confdroid_alloy::main::service (
) inherits alloy_cd::params {
require alloy_cd::main::files
) inherits confdroid_alloy::params {
require confdroid_alloy::main::files
service { $ay_service:
ensure => running,

View File

@@ -1,12 +1,11 @@
## alloy_cd::main::yumrepo.pp
# Module name: alloy_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary class install yum repos for the alloy_cd module
## confdroid_alloy::main::yumrepo.pp
# Module name: confdroid_alloy
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary class install yum repos for the confdroid_alloy module
##############################################################################
class alloy_cd::main::yumrepo (
) inherits alloy_cd::params {
class confdroid_alloy::main::yumrepo (
) inherits confdroid_alloy::params {
# test
yumrepo { 'grafana':
ensure => 'present',

View File

@@ -0,0 +1,23 @@
## confdroid_alloy::monitoring::target.pp
# Module name: confdroid_alloy
# Author: 12ww1160 (12ww1160@puppetsoft.com)
# @summary class manages exports for nagios monitoring
##############################################################################
class confdroid_alloy::monitoring::target (
) inherits confdroid_alloy::params {
if $ay_manage_nagios == true {
@@nagios_service { "check_alloy_${fqdn}":
check_command => "check_nrpe!check_alloy!${ay_procs_allowed}!alloy",
use => 'generic-service',
host_name => $fqdn,
notification_period => '24x7',
service_description => "${fqdn}_check_alloy",
target => $ay_target_service,
owner => 'nagios',
group => 'nagios',
mode => '0640',
contacts => $ay_target_contacts,
}
}
}

View File

@@ -1,8 +1,8 @@
## alloy_cd::params.pp
# Module name: alloy_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @param [String] reqpackages which packages to install
# @param [String] pkg_ensure 'latest' or 'present'
## confdroid_alloy::params.pp
# Module name: confdroid_alloy
# Author: 12ww1160 (12ww1160@confdroid.com)
# @param [String] ay_reqpackages which packages to install
# @param [String] ay_pkg_ensure 'latest' or 'present'
# @param [String] ay_loki_url the url where alloy will send logs to.
# @param [String] ay_loki_username the username to logon to loki
# @param [String] ay_loki_userpass the password to logon to loki
@@ -10,12 +10,23 @@
# @param [Boolean] ay_manage_prom whether to manage metric forwarding
# @param [String] ay_prom_url the url where alloy will send metrics
# @param [Array] ay_log_targets the logging targets
# @summary Class contains all parameters for the alloy_cd module.
# @param [Boolean] ay_prom_honor_timestamps whether to honor
# timestamps in prometheus metrics
# @param [Boolean] ay_prom_track_timestamps_staleness whether to track timestamps
# staleness in prometheus metrics
# @param [String] ay_prom_max_shards the maximum number of shards to use for prometheus metrics
# @param [String] ay_prom_max_samples_per_send the maximum number of samples to send
# @param [String] ay_prom_batch_send_deadline the maximum time to wait before sending
# @param [Boolean] ay_manage_nagios whether to manage nagios service exports
# @param [String] ay_target_service the target file for nagios service exports
# @param [Array] ay_target_contacts the contacts for nagios service exports
# @param [String] ay_procs_allowed the allowed number of processes for nagios service exports
# @summary Class contains all parameters for the confdroid_alloy module.
##############################################################################
class alloy_cd::params (
class confdroid_alloy::params (
String $reqpackages = 'alloy',
String $pkg_ensure = 'latest',
String $ay_reqpackages = 'alloy',
String $ay_pkg_ensure = 'latest',
# loki
Boolean $ay_manage_loki = true,
@@ -27,8 +38,22 @@ class alloy_cd::params (
# prometheus
Boolean $ay_manage_prom = true,
String $ay_prom_url = 'https://prometheus.example.net/api/v1/write',
Boolean $ay_prom_honor_timestamps = true,
Boolean $ay_prom_track_timestamps_staleness = true,
String $ay_prom_max_shards = '10',
String $ay_prom_max_samples_per_send = '2000',
String $ay_prom_batch_send_deadline = '5s',
# nagios
Boolean $ay_manage_nagios = false,
String $ay_target_service = '/etc/nagios/conf.d/alloy_service.cfg',
Array $ay_target_contacts = ['nagiosadmin'],
String $ay_procs_allowed = '1:1'
) {
# defaults
$fqdn = $facts['networking']['fqdn']
# service
$ay_service = 'alloy'
@@ -39,5 +64,5 @@ class alloy_cd::params (
$ay_main_file = "${ay_main_dir}/config.alloy"
# includes must be last
include alloy_cd::main::config
include confdroid_alloy::main::config
}

View File

@@ -1,7 +1,7 @@
<% if @ay_manage_loki == true -%>
logging{
level = "debug"
level = "info"
format = "logfmt"
write_to = [loki.process.alloy.receiver]
}
@@ -53,25 +53,52 @@ loki.write "loki" {
}
<% end -%>
<% if @ay_manage_prom == true -%>
// Metrics collection
prometheus.exporter.unix "system_metrics" {
include_exporter_metrics = true
disable_collectors = ["mdadm"]
// 1. Exporter (or keep your existing node_exporter binary)
prometheus.exporter.unix "node" {
// optional: disable unused collectors
// disable_collectors = ["ipvs", "btrfs", ...]
}
prometheus.scrape "scrape_system" {
targets = prometheus.exporter.unix.system_metrics.targets
// 2. Relabel the targets so instance = real hostname
discovery.relabel "node_exporter" {
targets = prometheus.exporter.unix.node.targets
rule {
target_label = "instance"
replacement = constants.hostname
}
rule {
target_label = "job"
replacement = "integrations/node_exporter"
}
}
// 3. Scrape the properly labeled targets
prometheus.scrape "node_exporter" {
targets = discovery.relabel.node_exporter.output
forward_to = [prometheus.remote_write.prometheus.receiver]
scrape_interval = "15s"
honor_timestamps = <%= @ay_prom_honor_timestamps %>
track_timestamps_staleness = <%= @ay_prom_track_timestamps_staleness %>
}
prometheus.remote_write "prometheus" {
external_labels = {
// makes every series from this Alloy unmistakably unique
alloy_instance = constants.hostname,
}
endpoint {
url = "<%= @ay_prom_url %>"
basic_auth {
username = "<%= @ay_loki_username %>"
password = "<%= @ay_loki_userpass %>"
}
queue_config {
max_shards = <%= @ay_prom_max_shards %>
max_samples_per_send = <%= @ay_prom_max_samples_per_send %>
batch_send_deadline = "<%= @ay_prom_batch_send_deadline %>"
}
}
}
<% end %>