Skip to content

Instantly share code, notes, and snippets.

@kpettijohn
Created October 30, 2016 22:09
Show Gist options
  • Save kpettijohn/e816a86b10495ee6cf7070872e11c1e6 to your computer and use it in GitHub Desktop.
Save kpettijohn/e816a86b10495ee6cf7070872e11c1e6 to your computer and use it in GitHub Desktop.
Consul agent, Prometheus node exporter, and Jenkins on CentOS 7.2
#!/bin/bash
# Install
# - Consul agent
# - Prometheus node_exporter
# - Jenkins
curl -O -L -s https://github.com/prometheus/node_exporter/releases/download/v0.13.0-rc.1/node_exporter-0.13.0-rc.1.linux-amd64.tar.gz
curl -O -L -s https://releases.hashicorp.com/consul/0.7.0/consul_0.7.0_linux_amd64.zip
unzip consul_0.7.0_linux_amd64.zip
mv consul /usr/bin/consul
tar xf node_exporter-0.13.0-rc.1.linux-amd64.tar.gz
mv node_exporter-0.13.0-rc.1.linux-amd64/node_exporter /usr/local/bin/node_exporter
mkdir -p /var/node_exporter/textfile
mkdir -p /etc/consul /etc/consul.d /var/consol/data
# Cleanup
rm -rf node_exporter-0.13.0-rc.1.linux-amd64.tar.gz node_exporter-0.13.0-rc.1.linux-amd64/ consul_0.7.0_linux_amd64.zip
# Install Jenkins
yum install java-1.8.0-openjdk.x86_64
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
yum install jenkins
systemctl enable jenkins
systemctl start jenkins
[Unit]
Description=Consul agent - client
After=syslog.target network.target
[Service]
Type=simple
ExecStart=/usr/bin/consul agent -config-dir /etc/consul -config-dir /etc/consul.d -join 10.0.0.10 -join 10.0.0.11 -join 10.0.0.12
[Install]
WantedBy=multi-user.target
{
"datacenter": "hbc",
"data_dir": "/var/consul/data",
"encrypt": "my_secret_key",
"log_level": "info",
"enable_syslog": true
}
{
"service": {
"name": "jenkins",
"tags": ["master"],
"address": "127.0.0.1",
"port": 8080,
"enableTagOverride": false,
"checks": [
{
"http": "http://localhost:8080/login",
"interval": "10s"
}
]
}
}
[Unit]
Description=Prometheus node_exporter - Exporter for machine metrics
After=syslog.target network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/node_exporter --collector.textfile.directory /var/node_exporter/textfile --collectors.enabled systemd,textfile,conntrack,diskstats,entropy,filefd,filesystem,loadavg,meminfo,netdev,netstat,stat,time,vmstat
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment