Send Nomad job alerts to SLACK: 10MB
287
https://github.com/multipathmaster/nomadsm
#QUICK OVERVIEW: DEPLOYMENT RECENTLY RAN AGAINST CONSUL 1.0.0 and NOMAD 0.7.0 - WORKS - YES the deployment assumes you are running hashi-ui or some other clone/fork. docker-entrypoint.sh is the entrypoint. It calls upon dead_man_switch.sh. dead_man_switch.sh starts the nmd_evnt_mntr.sh instances, as well a providing other options. nmd_evnt_mntr.sh is a collection of event monitors that call upon slack_alert.sh once a condition is met. slack_alert.sh is the alerting mechanism.
STEPS FOR SOLO DEPLOYMENT:
docker build . OR docker pull multipathmaster/nomadsmdocker tag "ID FROM ABOVE" "NEW NAME" IGNORE IF DOCKER PULLdocker run -it -e NOMAD_JOB_IPHN='http://NOMAD_SERVER_IP:4646/v1/jobs' -e NOMAD_SRV_JOB_PATH='http://NOMAD_SERVER_IP:3000/nomad/REGION/jobs' -e S_CHAN='CHAN_NAME_WO_#' -e S_USRNM='BOT_NAME' -e S_HOOK='https://hooks.slack.com/services/YOUR/TOKEN/HERE' -e S_PROXY='http://YOUR.PROXY.HERE:PORT/' "NEW IMAGE NAME" OR multipathmaster/nomadsm NOTE: THE PROXY IS OPTIONAL ONLY IF YOU NEED ITdocker ps #FIND CONTAINERdocker exec -it "CONTAINER" bashSTEPS FOR DEPLOYING ON THE HASHICORP STACK: (CONSUL/NOMAD):
docker build . OR docker pull multipathmaster/nomadsmdocker tag "ID FROM ABOVE" "NEW NAME"job "nomadsm" {
region = "YOUR_REGION"
datacenters = ["YOUR_DC"]
type = "service"
constraint {
attribute = "${attr.kernel.name}"
value = "linux"
}
update {
stagger = "15s"
max_parallel = 1
}
group "nomadsm" {
count = 1
constraint {
operator = "distinct_hosts"
value = "true"
}
restart {
attempts = 10
interval = "5m"
delay = "25s"
mode = "delay"
}
ephemeral_disk {
size = 128
}
task "nomadsm" {
driver = "docker"
config {
image = "multipathmaster/nomadsm:latest"
network_mode = "host"
port_map = {
}
#volumes = [ "" ]
}
env {
NOMAD_JOB_IPHN="http://NOMAD_SERVER_IP:4646/v1/jobs"
NOMAD_SRV_JOB_PATH="http://NOMAD_SERVER_IP:3000/nomad/REGION/jobs"
S_CHAN="SLACK_CHANNEL_WO_#"
S_USRNM="BOT_NAME"
S_HOOK="https://hooks.slack.com/services/YOUR/TOKEN/HERE"
S_PROXY="http://YOUR.PROXY.HERE:PORT/" #OPTIONAL ONLY IF YOU NEED THIS
}
resources {
cpu = 32
memory = 64
network {
mbits = 10
}
}
service {
name = "nomadsm"
tags = ["nomadsm"]
#port = "nomadsm"
#check {
# name = "alive"
# type = "tcp"
# interval = "15s"
# timeout = "3s"
#}
}
}
}
}
nomad plan nomadsm.nomadnomad run nomadsm.nomadContent type
Image
Digest
Size
4.2 MB
Last updated
about 9 years ago
docker pull multipathmaster/nomadsm