Prometheus

Overview

This is a flavour containing the prometheus time series database.

It also contains node_exporter and grafana.

The flavour includes a local consul agent instance to be available that it can connect to (see configuration below). You can e.g. use the consul pot flavour on this site to run consul.

Installation

  • Create a ZFS dataset on the parent system beforehand:
    zfs create -o mountpoint=/mnt/prometheusdata zroot/prometheusdata
  • Create your local jail from the image or the flavour files or import prebuilt
  • Clone the created jail
  • Mount in the ZFS dataset you created:
    pot mount-in -p <jailname> -m /mnt -d /mnt/prometheusdata
  • Optionally export the ports after creating the jail:
    pot export-ports -p <jailname> -e 9090:9090 -e 9100:9100 -e 3000:3000
  • Adjust to your environment:
        -E IP=<IP address of this system> -E CONSULSERVERS='<correctly formatted list of quoted IP addresses>' \
        [-E GOSSIPKEY=<32 byte Base64 key from consul keygen>]```
    
    

The CONSULSERVERS parameter defines the consul server instances, and must be set as CONSULSERVERS='"10.0.0.2"' or CONSULSERVERS='"10.0.0.2", "10.0.0.3", "10.0.0.4"' or CONSULSERVERS='"10.0.0.2", "10.0.0.3", "10.0.0.4", "10.0.0.5", "10.0.0.6"'

The GOSSIPKEY parameter is the gossip encryption key for consul agent. We’re using a default key if you do not set the parameter, do not use the default key for production encryption, instead provide your own.

Usage

To access prometheus open the following in a browser:

  • http(s)://:9090
  • http(s)://:9090/targets/

To access this node’s own metrics, visit:

  • http(s)://:9100/metrics

or run fetch -o - 'https://127.0.0.1:9100/metrics'

To see the targets being captured via consul, visit

  • http://:9090/targets

To access Grafana open the following in a browser:

  • http(s)://:3000

Note: Grafana should start automatically, and starts up with service grafana start instead of /usr/local/etc/rc.d/grafana start which wasn’t working.

Persistent Storage

Persistent storage will be in the ZFS dataset zroot/prometheusdata, available inside the image at /mnt

If you stop the image, the data will still exist, and a new image can be started up and still use it.

If you need to change the directory parameters for the ZFS dataset, adjust the mount-in command accordingly for the source directory as mounted by the parent OS.

Do not adjust the image destination mount point at /mnt because Prometheus & Grafana are configured to use this directory for data.

Getting Started

How To Use The Ready-Made Image

FreeBSD 13.0:
pot import -p prometheus-amd64-13_0 -t 0.9.6 -U https://potluck.honeyguide.net/prometheus

FreeBSD 12.2:
pot import -p prometheus-amd64-12_2 -t 0.9.6 -U https://potluck.honeyguide.net/prometheus

If you don’t want to use the default pot bridged network configuration but instead need an individual network setup (e.g. assign a host IP address), after importing it you can simply clone the jail like that (em0 is the host network adapter in this example):
pot clone -P prometheus-amd64-13_0 -p my-cloned-jail -N alias -i "em0|10.10.10.10"

Note: Some images might require specific network configuration, double check the Overview-chapter at the top.

Alternatively: Create a Jail With This Flavour Yourself

1. Create Flavour Files

Save all files and directories from https://github.com/hny-gd/potluck/tree/master/prometheus to /usr/local/etc/pot/flavours/

2. Create Jail From Flavour

Run
pot create -b <FreeBSD Version> -p <jailname> -t single -N public-bridge -f fbsd-update

with your FreeBSD version (e.g. 12.1) and the name your jail should get.

Note: Some images might require specific network configuration, double check the Overview-chapter at the top.

Version History

0.9.6

  • Version bump for build process

0.9.5

  • Persistent storage added at /mnt

0.9.4

  • Changed method of Grafana startup to fix non-starting instance

0.9.3

  • Updates for grafana default datasource and dashboard, removing specific targets adjustment in favour of consul

0.9.2

  • Correcting consul published service name to use “node-exporter”

0.9.1

  • Updating to use consul for announcing node_exporter as a service

0.9

  • First test build of Prometheus with node_exporter and Grafana7

These images were built on Thu May 27 06:52:07 UTC 2021

Manual Image Download Links

prometheus-amd64-13_0_0.9.6.xz ( 308.152 MB )
prometheus-amd64-13_0_0.9.6.xz.skein ( 0.250977 KB )

prometheus-amd64-12_2_0.9.6.xz ( 397.453 MB )
prometheus-amd64-12_2_0.9.6.xz.skein ( 0.250977 KB )

Jenkins Pot Creation Logs

prometheus-amd64-13_0_0.9.6:


prometheus/prometheus:
copy-in -s /usr/local/etc/pot/flavours/prometheus.d/prometheus.yml -d /root
copy-in -s /usr/local/etc/pot/flavours/prometheus.d/datasource.yml -d /root
copy-in -s /usr/local/etc/pot/flavours/prometheus.d/dashboard.yml -d /root
copy-in -s /usr/local/etc/pot/flavours/prometheus.d/grafana.conf -d /root
set-attribute -A start-at-boot -V YES
prometheus/prometheus.sh:
#!/bin/sh

# Based on POTLUCK TEMPLATE v3.0
# Altered by Michael Gmelin
#
# EDIT THE FOLLOWING FOR NEW FLAVOUR:
# 1. RUNS_IN_NOMAD - true or false
# 2. If RUNS_IN_NOMAD is false, can delete the <flavour>+4 file, else
#    make sure pot create command doesn't include it
# 3. Create a matching <flavour> file with this <flavour>.sh file that
#    contains the copy-in commands for the config files from <flavour>.d/
#    Remember that the package directories don't exist yet, so likely copy
#    to /root
# 4. Adjust package installation between BEGIN & END PACKAGE SETUP
# 5. Adjust jail configuration script generation between BEGIN & END COOK
#    Configure the config files that have been copied in where necessary

# Set this to true if this jail flavour is to be created as a nomad (i.e. blocking) jail.
# You can then query it in the cook script generation below and the script is installed
# appropriately at the end of this script
RUNS_IN_NOMAD=false

# set the cook log path/filename
COOKLOG=/var/log/cook.log

# check if cooklog exists, create it if not
if [ ! -e $COOKLOG ]
then
    echo "Creating $COOKLOG" | tee -a $COOKLOG
else
    echo "WARNING $COOKLOG already exists"  | tee -a $COOKLOG
fi
date >> $COOKLOG

# -------------------- COMMON ---------------

STEPCOUNT=0
step() {
  STEPCOUNT=$(expr "$STEPCOUNT" + 1)
  STEP="$@"
  echo "Step $STEPCOUNT: $STEP" | tee -a $COOKLOG
}

exit_ok() {
  trap - EXIT
  exit 0
}

FAILED=" failed"
exit_error() {
  STEP="$@"
  FAILED=""
  exit 1
}

set -e
trap 'echo ERROR: $STEP$FAILED | (>&2 tee -a $COOKLOG)' EXIT

# -------------- BEGIN PACKAGE SETUP -------------

step "Bootstrap package repo"
mkdir -p /usr/local/etc/pkg/repos
echo 'FreeBSD: { url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly" }' \
  >/usr/local/etc/pkg/repos/FreeBSD.conf
ASSUME_ALWAYS_YES=yes pkg bootstrap

step "Touch /etc/rc.conf"
touch /etc/rc.conf

# this is important, otherwise running /etc/rc from cook will
# overwrite the IP address set in tinirc
step "Remove ifconfig_epair0b from config"
sysrc -cq ifconfig_epair0b && sysrc -x ifconfig_epair0b || true

step "Disable sendmail"
service sendmail onedisable

step "Create /usr/local/etc/rc.d"
mkdir -p /usr/local/etc/rc.d

# we need consul for consul agent
step "Install package consul"
pkg install -y consul

step "Install package prometheus"
pkg install -y prometheus

step "Install package node_exporter"
pkg install -y node_exporter

step "Install package grafana7"
pkg install -y grafana7

step "Install package sudo"
pkg install -y sudo

step "Clean package installation"
pkg clean -y

# -------------- END PACKAGE SETUP -------------

#
# Create configurations
#

#
# Now generate the run command script "cook"
# It configures the system on the first run by creating the config file(s)
# On subsequent runs, it only starts sleeps (if nomad-jail) or simply exits
#

# clear any old cook runtime file
step "Remove pre-existing cook script (if any)"
rm -f /usr/local/bin/cook

# this runs when image boots
# ----------------- BEGIN COOK ------------------

step "Create cook script"
echo "#!/bin/sh
RUNS_IN_NOMAD=$RUNS_IN_NOMAD
# declare this again for the pot image, might work carrying variable through like
# with above
COOKLOG=/var/log/cook.log
# No need to change this, just ensures configuration is done only once
if [ -e /usr/local/etc/pot-is-seasoned ]
then
    # If this pot flavour is blocking (i.e. it should not return),
    # we block indefinitely
    if [ \"\$RUNS_IN_NOMAD\" = \"true\" ]
    then
        /bin/sh /etc/rc
        tail -f /dev/null
    fi
    exit 0
fi

# ADJUST THIS: STOP SERVICES AS NEEDED BEFORE CONFIGURATION
/usr/local/etc/rc.d/consul stop || true
/usr/local/etc/rc.d/prometheus stop || true
/usr/local/etc/rc.d/grafana stop || true


# No need to adjust this:
# If this pot flavour is not blocking, we need to read the environment first from /tmp/environment.sh
# where pot is storing it in this case
if [ -e /tmp/environment.sh ]
then
    . /tmp/environment.sh
fi

#
# ADJUST THIS BY CHECKING FOR ALL VARIABLES YOUR FLAVOUR NEEDS:
#

# Check config variables are set
#
if [ -z \${DATACENTER+x} ]; then
    echo 'DATACENTER is unset - see documentation how to configure this flavour'
    exit 1
fi
if [ -z \${NODENAME+x} ];
then
    echo 'NODENAME is unset - see documentation how to configure this flavour'
    exit 1
fi
if [ -z \${CONSULSERVERS+x} ]; then
    echo 'CONSULSERVERS is unset - see documentation how to configure this flavour'
    exit 1
fi
if [ -z \${IP+x} ]; then
    echo 'IP is unset - see documentation how to configure this flavour'
    exit 1
fi
# GOSSIPKEY is a 32 byte, Base64 encoded key generated with consul keygen for the consul flavour.
# Re-used for nomad, which is usually 16 byte key but supports 32 byte, Base64 encoded keys
# We'll re-use the one from the consul flavour
if [ -z \${GOSSIPKEY+x} ];
then
    echo 'GOSSIPKEY is unset - see documentation how to configure this flavour, defaulting to preset encrypt key. Do not use this in production!'
    GOSSIPKEY='\"BY+vavBUSEmNzmxxS3k3bmVFn1giS4uEudc774nBhIw=\"'
fi

# ADJUST THIS BELOW: NOW ALL THE CONFIGURATION FILES NEED TO BE CREATED:
# Don't forget to double(!)-escape quotes and dollar signs in the config files

## start consul

# make consul configuration directory and set permissions
mkdir -p /usr/local/etc/consul.d
chmod 750 /usr/local/etc/consul.d

# Create the consul agent config file with imported variables
echo \"{
 \\\"advertise_addr\\\": \\\"\$IP\\\",
 \\\"datacenter\\\": \\\"\$DATACENTER\\\",
 \\\"node_name\\\": \\\"\$NODENAME\\\",
 \\\"data_dir\\\":  \\\"/var/db/consul\\\",
 \\\"dns_config\\\": {
  \\\"a_record_limit\\\": 3,
  \\\"enable_truncate\\\": true
 },
 \\\"log_file\\\": \\\"/var/log/consul/\\\",
 \\\"log_level\\\": \\\"WARN\\\",
 \\\"encrypt\\\": \$GOSSIPKEY,
 \\\"start_join\\\": [ \$CONSULSERVERS ],
 \\\"service\\\": {
  \\\"address\\\": \\\"\$IP\\\",
  \\\"name\\\": \\\"node-exporter\\\",
  \\\"tags\\\": [\\\"_app=prometheus\\\", \\\"_service=node-exporter\\\", \\\"_hostname=\$NODENAME\\\", \\\"_datacenter=\$DATACENTER\\\"],
  \\\"port\\\": 9100
 }
}\" > /usr/local/etc/consul.d/agent.json

# set owner and perms on agent.json
chown consul:wheel /usr/local/etc/consul.d/agent.json
chmod 640 /usr/local/etc/consul.d/agent.json

# enable consul
sysrc consul_enable=\"YES\"

# set load parameter for consul config
sysrc consul_args=\"-config-file=/usr/local/etc/consul.d/agent.json\"
#sysrc consul_datadir=\"/var/db/consul\"

# Workaround for bug in rc.d/consul script:
sysrc consul_group=\"wheel\"

# setup consul logs, might be redundant if not specified in agent.json above
mkdir -p /var/log/consul
touch /var/log/consul/consul.log
chown -R consul:wheel /var/log/consul

# add the consul user to the wheel group, this seems to be required for
# consul to start on this instance. May need to figure out why.
# I'm not entirely sure this is the correct way to do it
/usr/sbin/pw usermod consul -G wheel

## end consul

## start prometheus config

# copy the file to /usr/local/etc/prometheus.yml
if [ -f /root/prometheus.yml ]; then
    cp -f /root/prometheus.yml /usr/local/etc/prometheus.yml
else
    echo \"ERROR - NO PROMETHEUS FILE FOUND\"
fi

# if /mnt/prometheus does not exist, create it and set permissions
if [ ! -d /mnt/prometheus ]; then
    mkdir -p /mnt/prometheus
    chown -R prometheus:prometheus /mnt/prometheus
fi

# enable prometheus service
sysrc prometheus_enable=\"YES\"
sysrc prometheus_data_dir=\"/mnt/prometheus\"
sysrc prometheus_syslog_output_enable=\"YES\"

## end prometheus config

## start node_exporter config

# enable node_exporter service
sysrc node_exporter_enable=\"YES\"

## end node_exporter config

## start grafana config

# we're mounting in a blank-or-filled ZFS dataset from root system at
# zroot/prometheusdata to /mnt

# if /mnt/grafana is empty, copy in /var/db/grafana

if [ ! -d /mnt/grafana ]; then
    # if empty we need to copy in the directory structure from install
    cp -a /var/db/grafana /mnt

    # make sure permissions are good for /mnt/grafana
    chown -R grafana:grafana /mnt/grafana

    # copy in the datasource.yml file to /mnt/grafana/provisioning/datasources
    if [ -f /root/datasource.yml ]; then
        cp -f /root/datasource.yml /mnt/grafana/provisioning/datasources/prometheus.yml
        chown grafana:grafana /mnt/grafana/provisioning/datasources/prometheus.yml
    else
        echo \"ERROR - NO DATASOURCE CONFIG FILE FOUND\"
    fi

    # copy in the dashboard.yml file to /mnt/grafana/provisioning/dashboards
    if [ -f /root/dashboard.yml ]; then
        cp -f /root/dashboard.yml /mnt/grafana/provisioning/dashboards/default.yml
        chown grafana:grafana /mnt/grafana/provisioning/dashboards/default.yml
    else
        echo \"ERROR - NO DASHBOARD DEFAULT CONFIG FILE FOUND\"
    fi
    # include the relevant .json for actual dashboard when available
else
    # if /mnt/grafana exists then don't copy in /var/db/grafana
    #
    # make sure permissions are good for /mnt/grafana
    chown -R grafana:grafana /mnt/grafana

    # copy in the datasource.yml file to /mnt/grafana/provisioning/datasources
    if [ -f /root/datasource.yml ]; then
        cp -f /root/datasource.yml /mnt/grafana/provisioning/datasources/prometheus.yml
        chown grafana:grafana /mnt/grafana/provisioning/datasources/prometheus.yml
    else
        echo \"ERROR - NO DATASOURCE CONFIG FILE FOUND\"
    fi

    # copy in the dashboard.yml file to /mnt/grafana/provisioning/dashboards
    if [ -f /root/dashboard.yml ]; then
        cp -f /root/dashboard.yml /mnt/grafana/provisioning/dashboards/default.yml
        chown grafana:grafana /mnt/grafana/provisioning/dashboards/default.yml
    else
        echo \"ERROR - NO DASHBOARD DEFAULT CONFIG FILE FOUND\"
    fi
    # include the relevant .json for actual dashboard when available below here
    #
    # insert here
fi

# local edits for grafana.conf here
# the mount path for some options is set to /mnt/grafana/...
if [ -f /root/grafana.conf ]; then
    cp -f /root/grafana.conf /usr/local/etc/grafana.conf
fi

# enable grafana service
sysrc grafana_enable=\"YES\"
sysrc grafana_config=\"/usr/local/etc/grafana.conf\"
sysrc grafana_user=\"grafana\"
sysrc grafana_group=\"grafana\"
sysrc grafana_syslog_output_enable=\"YES\"

## end grafana config

#
# ADJUST THIS: START THE SERVICES AGAIN AFTER CONFIGURATION

# start consul agent
/usr/local/etc/rc.d/consul start

# start node_exporter
/usr/local/etc/rc.d/node_exporter start

# start prometheus
/usr/local/etc/rc.d/prometheus start

# start grafana
service grafana start

#
# Do not touch this:
touch /usr/local/etc/pot-is-seasoned

# If this pot flavour is blocking (i.e. it should not return), there is no /tmp/environment.sh
# created by pot and we now after configuration block indefinitely
if [ \"\$RUNS_IN_NOMAD\" = \"true\" ]
then
    /bin/sh /etc/rc
    tail -f /dev/null
fi
" > /usr/local/bin/cook

# ----------------- END COOK ------------------


# ---------- NO NEED TO EDIT BELOW ------------

step "Make cook script executable"
if [ -e /usr/local/bin/cook ]
then
    echo "setting executable bit on /usr/local/bin/cook" | tee -a $COOKLOG
    chmod u+x /usr/local/bin/cook
else
    exit_error "there is no /usr/local/bin/cook to make executable"
fi

#
# There are two ways of running a pot jail: "Normal", non-blocking mode and
# "Nomad", i.e. blocking mode (the pot start command does not return until
# the jail is stopped).
# For the normal mode, we create a /usr/local/etc/rc.d script that starts
# the "cook" script generated above each time, for the "Nomad" mode, the cook
# script is started by pot (configuration through flavour file), therefore
# we do not need to do anything here.
#

# Create rc.d script for "normal" mode:
step "Create rc.d script to start cook"
echo "creating rc.d script to start cook" | tee -a $COOKLOG

echo "#!/bin/sh
#
# PROVIDE: cook
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
. /etc/rc.subr
name=\"cook\"
rcvar=\"cook_enable\"
load_rc_config \$name
: \${cook_enable:=\"NO\"}
: \${cook_env:=\"\"}
command=\"/usr/local/bin/cook\"
command_args=\"\"
run_rc_command \"\$1\"
" > /usr/local/etc/rc.d/cook

step "Make rc.d script to start cook executable"
if [ -e /usr/local/etc/rc.d/cook ]
then
  echo "Setting executable bit on cook rc file" | tee -a $COOKLOG
  chmod u+x /usr/local/etc/rc.d/cook
else
  exit_error "/usr/local/etc/rc.d/cook does not exist"
fi

if [ "$RUNS_IN_NOMAD" != "true" ]
then
  step "Enable cook service"
  # This is a non-nomad (non-blocking) jail, so we need to make sure the script
  # gets started when the jail is started:
  # Otherwise, /usr/local/bin/cook will be set as start script by the pot flavour
  echo "enabling cook" | tee -a $COOKLOG
  service cook enable
fi

# -------------------- DONE ---------------
exit_ok

prometheus/prometheus+1:
prometheus/prometheus+1.sh:

prometheus/prometheus+2:
prometheus/prometheus+2.sh:

prometheus/prometheus+3:
prometheus/prometheus+3.sh:

prometheus/prometheus+4:
prometheus/prometheus+4.sh:
Password:===>  Creating a new pot
===>  pot name : prometheus-amd64-13_0
===>  type : single
===>  base : 13.0
===>  pot_base :
===>  level : 0
===>  network-type : public-bridge
===>  network-stack: ipv4
===>  ip : 10.192.0.3
===>  bridge :
===>  dns : inherit
===>  flavours : fbsd-update prometheus prometheus+1 prometheus+2 prometheus+3 prometheus+4
===>  Fetching FreeBSD 13.0
===>  Extract the tarball
=====>  Flavour: fbsd-update
=====>  Starting prometheus-amd64-13_0 pot for the initial bootstrap
=====>  mount /mnt/data/pot/jails/prometheus-amd64-13_0/m/tmp
defaultrouter: NO -> 10.192.0.1
===>  Starting the pot prometheus-amd64-13_0
ELF ldconfig path: /lib /usr/lib /usr/lib/compat
32-bit compatibility ldconfig path: /usr/lib32
Starting Network: lo0 epair0b.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
	inet6 ::1 prefixlen 128
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
	inet 127.0.0.1 netmask 0xff000000
	groups: lo
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
epair0b: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=8<VLAN_MTU>
	ether 02:fc:fd:af:38:0b
	inet 10.192.0.3 netmask 0xffc00000 broadcast 10.255.255.255
	groups: epair
	media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>)
	status: active
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
add host 127.0.0.1: gateway lo0 fib 0: route already in table
add net default: gateway 10.192.0.1
add host ::1: gateway lo0 fib 0: route already in table
add net fe80::: gateway ::1
add net ff02::: gateway ::1
add net ::ffff:0.0.0.0: gateway ::1
add net ::0.0.0.0: gateway ::1
Updating /var/run/os-release done.
Creating and/or trimming log files.
Clearing /tmp (X related).
Updating motd:.
Starting syslogd.
Starting sendmail_submit.
Starting sendmail_msp_queue.
Starting cron.

Thu May 27 06:39:51 UTC 2021
/usr/local/etc/pot/flavours/fbsd-update.sh -> /mnt/data/pot/jails/prometheus-amd64-13_0/m/tmp/fbsd-update.sh
=====>  Executing fbsd-update script on prometheus-amd64-13_0
src component not installed, skipped
Looking up update.FreeBSD.org mirrors... 2 mirrors found.
Fetching public key from update2.freebsd.org... done.
Fetching metadata signature for 13.0-RELEASE from update2.freebsd.org... done.
Fetching metadata index... done.
Fetching 2 metadata files... done.
Inspecting system... done.
Preparing to download files... done.
Fetching 5 patches... done.
Applying patches... done.
The following files will be updated as part of updating to
13.0-RELEASE-p1:
/bin/freebsd-version
/usr/bin/bc
/usr/bin/dc
/usr/lib/libradius.a
/usr/lib/libradius.so.4
/usr/lib/libradius_p.a
Installing updates...Scanning //usr/share/certs/blacklisted for certificates...
Scanning //usr/share/certs/trusted for certificates...
 done.
=====>  Stop the pot prometheus-amd64-13_0
=====>  Remove epair0[a|b] network interfaces
=====>  unmount /mnt/data/pot/jails/prometheus-amd64-13_0/m/tmp
=====>  unmount /mnt/data/pot/jails/prometheus-amd64-13_0/m/dev
=====>  Flavour: prometheus
=====>  Executing prometheus pot commands on prometheus-amd64-13_0
=====>  mount /mnt/data/pot/jails/prometheus-amd64-13_0/m/tmp
/usr/local/etc/pot/flavours/prometheus.d/prometheus.yml -> /mnt/data/pot/jails/prometheus-amd64-13_0/m/root/prometheus.yml
=====>  Source /usr/local/etc/pot/flavours/prometheus.d/prometheus.yml copied in the pot prometheus-amd64-13_0
=====>  unmount /mnt/data/pot/jails/prometheus-amd64-13_0/m/tmp
=====>  /mnt/data/pot/jails/prometheus-amd64-13_0/m/dev is already unmounted
=====>  mount /mnt/data/pot/jails/prometheus-amd64-13_0/m/tmp
/usr/local/etc/pot/flavours/prometheus.d/datasource.yml -> /mnt/data/pot/jails/prometheus-amd64-13_0/m/root/datasource.yml
=====>  Source /usr/local/etc/pot/flavours/prometheus.d/datasource.yml copied in the pot prometheus-amd64-13_0
=====>  unmount /mnt/data/pot/jails/prometheus-amd64-13_0/m/tmp
=====>  /mnt/data/pot/jails/prometheus-amd64-13_0/m/dev is already unmounted
=====>  mount /mnt/data/pot/jails/prometheus-amd64-13_0/m/tmp
/usr/local/etc/pot/flavours/prometheus.d/dashboard.yml -> /mnt/data/pot/jails/prometheus-amd64-13_0/m/root/dashboard.yml
=====>  Source /usr/local/etc/pot/flavours/prometheus.d/dashboard.yml copied in the pot prometheus-amd64-13_0
=====>  unmount /mnt/data/pot/jails/prometheus-amd64-13_0/m/tmp
=====>  /mnt/data/pot/jails/prometheus-amd64-13_0/m/dev is already unmounted
=====>  mount /mnt/data/pot/jails/prometheus-amd64-13_0/m/tmp
/usr/local/etc/pot/flavours/prometheus.d/grafana.conf -> /mnt/data/pot/jails/prometheus-amd64-13_0/m/root/grafana.conf
=====>  Source /usr/local/etc/pot/flavours/prometheus.d/grafana.conf copied in the pot prometheus-amd64-13_0
=====>  unmount /mnt/data/pot/jails/prometheus-amd64-13_0/m/tmp
=====>  /mnt/data/pot/jails/prometheus-amd64-13_0/m/dev is already unmounted
=====>  Starting prometheus-amd64-13_0 pot for the initial bootstrap
=====>  mount /mnt/data/pot/jails/prometheus-amd64-13_0/m/tmp
defaultrouter: 10.192.0.1 -> 10.192.0.1
===>  Starting the pot prometheus-amd64-13_0
ELF ldconfig path: /lib /usr/lib /usr/lib/compat
32-bit compatibility ldconfig path: /usr/lib32
Starting Network: lo0 epair0b.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
	inet6 ::1 prefixlen 128
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
	inet 127.0.0.1 netmask 0xff000000
	groups: lo
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
epair0b: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=8<VLAN_MTU>
	ether 02:1d:bc:66:0c:0b
	inet 10.192.0.3 netmask 0xffc00000 broadcast 10.255.255.255
	groups: epair
	media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>)
	status: active
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
add host 127.0.0.1: gateway lo0 fib 0: route already in table
add net default: gateway 10.192.0.1
add host ::1: gateway lo0 fib 0: route already in table
add net fe80::: gateway ::1
add net ff02::: gateway ::1
add net ::ffff:0.0.0.0: gateway ::1
add net ::0.0.0.0: gateway ::1
Updating /var/run/os-release done.
Creating and/or trimming log files.
Clearing /tmp (X related).
Updating motd:.
Starting syslogd.
Starting sendmail_submit.
Starting sendmail_msp_queue.
Starting cron.

Thu May 27 06:40:08 UTC 2021
/usr/local/etc/pot/flavours/prometheus.sh -> /mnt/data/pot/jails/prometheus-amd64-13_0/m/tmp/prometheus.sh
=====>  Executing prometheus script on prometheus-amd64-13_0
Creating /var/log/cook.log
Step 1: Bootstrap package repo
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] Installing pkg-1.16.3...
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] Extracting pkg-1.16.3: .......... done
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:13:amd64/quarterly, please wait...
Step 2: Touch /etc/rc.conf
Step 3: Remove ifconfig_epair0b from config
Step 4: Disable sendmail
sendmail disabled in /etc/rc.conf
sendmail_submit disabled in /etc/rc.conf
sendmail_msp_queue disabled in /etc/rc.conf
Step 5: Create /usr/local/etc/rc.d
Step 6: Install package consul
Updating FreeBSD repository catalogue...
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] Fetching meta.conf: . done
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] Fetching packagesite.txz: .......... done
Processing entries: .......... done
FreeBSD repository update completed. 30371 packages processed.
All repositories are up to date.
Updating database digests format: . done
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	consul: 1.9.4

Number of packages to be installed: 1

The process will require 78 MiB more space.
27 MiB to be downloaded.
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [1/1] Fetching consul-1.9.4.txz: .......... done
Checking integrity... done (0 conflicting)
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [1/1] Installing consul-1.9.4...
===> Creating groups.
Creating group 'consul' with gid '469'.
===> Creating users
Creating user 'consul' with uid '469'.
===> Creating homedir(s)
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [1/1] Extracting consul-1.9.4: ..... done
Step 7: Install package prometheus
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	prometheus: 2.25.2

Number of packages to be installed: 1

The process will require 119 MiB more space.
24 MiB to be downloaded.
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [1/1] Fetching prometheus-2.25.2.txz: .......... done
Checking integrity... done (0 conflicting)
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [1/1] Installing prometheus-2.25.2...
===> Creating groups.
Creating group 'prometheus' with gid '478'.
===> Creating users
Creating user 'prometheus' with uid '478'.
===> Creating homedir(s)
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [1/1] Extracting prometheus-2.25.2: .......... done
Step 8: Install package node_exporter
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	node_exporter: 1.1.2

Number of packages to be installed: 1

The process will require 11 MiB more space.
3 MiB to be downloaded.
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [1/1] Fetching node_exporter-1.1.2.txz: .......... done
Checking integrity... done (0 conflicting)
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [1/1] Installing node_exporter-1.1.2...
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [1/1] Extracting node_exporter-1.1.2: .......... done
=====
Message from node_exporter-1.1.2:

--
If upgrading from a version of node_exporter <0.15.0 you'll need to update any
custom command line flags that you may have set as it now requires a
double-dash (--flag) instead of a single dash (-flag).
The collector flags in 0.15.0 have now been replaced with individual boolean
flags and the -collector.procfs` and -collector.sysfs` flags have been renamed
to --path.procfs and --path.sysfs respectively.
Step 9: Install package grafana7
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	ca_root_nss: 3.63
	grafana7: 7.5.1_1

Number of packages to be installed: 2

The process will require 170 MiB more space.
35 MiB to be downloaded.
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [1/2] Fetching grafana7-7.5.1_1.txz: .......... done
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [2/2] Fetching ca_root_nss-3.63.txz: .......... done
Checking integrity... done (0 conflicting)
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [1/2] Installing ca_root_nss-3.63...
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [1/2] Extracting ca_root_nss-3.63: ........ done
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [2/2] Installing grafana7-7.5.1_1...
===> Creating groups.
Creating group 'grafana' with gid '904'.
===> Creating users
Creating user 'grafana' with uid '904'.
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [2/2] Extracting grafana7-7.5.1_1: .......... done
=====
Message from ca_root_nss-3.63:

--
FreeBSD does not, and can not warrant that the certification authorities
whose certificates are included in this package have in any way been
audited for trustworthiness or RFC 3647 compliance.

Assessment and verification of trust is the complete responsibility of the
system administrator.


This package installs symlinks to support root certificates discovery by
default for software that uses OpenSSL.

This enables SSL Certificate Verification by client software without manual
intervention.

If you prefer to do this manually, replace the following symlinks with
either an empty file or your site-local certificate bundle.

  * /etc/ssl/cert.pem
  * /usr/local/etc/ssl/cert.pem
  * /usr/local/openssl/cert.pem
Step 10: Install package sudo
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 3 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	gettext-runtime: 0.21
	indexinfo: 0.3.1
	sudo: 1.9.6p1

Number of packages to be installed: 3

The process will require 7 MiB more space.
1 MiB to be downloaded.
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [1/3] Fetching sudo-1.9.6p1.txz: .......... done
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [2/3] Fetching gettext-runtime-0.21.txz: .......... done
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [3/3] Fetching indexinfo-0.3.1.txz: . done
Checking integrity... done (0 conflicting)
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [1/3] Installing indexinfo-0.3.1...
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [1/3] Extracting indexinfo-0.3.1: .... done
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [2/3] Installing gettext-runtime-0.21...
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [2/3] Extracting gettext-runtime-0.21: .......... done
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [3/3] Installing sudo-1.9.6p1...
[prometheus-amd64-13_0.vsf00001.cpt.za.honeyguide.net] [3/3] Extracting sudo-1.9.6p1: .......... done
Step 11: Clean package installation
The following package files will be deleted:
	/var/cache/pkg/prometheus-2.25.2.txz
	/var/cache/pkg/ca_root_nss-3.63~8f6ab941c2.txz
	/var/cache/pkg/consul-1.9.4~95d640becc.txz
	/var/cache/pkg/ca_root_nss-3.63.txz
	/var/cache/pkg/gettext-runtime-0.21~4f88146680.txz
	/var/cache/pkg/gettext-runtime-0.21.txz
	/var/cache/pkg/node_exporter-1.1.2.txz
	/var/cache/pkg/grafana7-7.5.1_1.txz
	/var/cache/pkg/grafana7-7.5.1_1~06c9a33dee.txz
	/var/cache/pkg/indexinfo-0.3.1.txz
	/var/cache/pkg/consul-1.9.4.txz
	/var/cache/pkg/node_exporter-1.1.2~f0726150af.txz
	/var/cache/pkg/sudo-1.9.6p1~eb37b91581.txz
	/var/cache/pkg/sudo-1.9.6p1.txz
	/var/cache/pkg/prometheus-2.25.2~5d98782ecc.txz
	/var/cache/pkg/indexinfo-0.3.1~75a19b3acb.txz
The cleanup will free 90 MiB
Deleting files: .......... done
All done
Step 12: Remove pre-existing cook script (if any)
Step 13: Create cook script
Step 14: Make cook script executable
setting executable bit on /usr/local/bin/cook
Step 15: Create rc.d script to start cook
creating rc.d script to start cook
Step 16: Make rc.d script to start cook executable
Setting executable bit on cook rc file
Step 17: Enable cook service
enabling cook
cook enabled in /etc/rc.conf
=====>  Stop the pot prometheus-amd64-13_0
=====>  Remove epair0[a|b] network interfaces
=====>  unmount /mnt/data/pot/jails/prometheus-amd64-13_0/m/tmp
=====>  unmount /mnt/data/pot/jails/prometheus-amd64-13_0/m/dev
=====>  Flavour: prometheus+1
=====>  Executing prometheus+1 pot commands on prometheus-amd64-13_0
=====>  No shell script available for the flavour prometheus+1
=====>  Flavour: prometheus+2
=====>  Executing prometheus+2 pot commands on prometheus-amd64-13_0
=====>  No shell script available for the flavour prometheus+2
=====>  Flavour: prometheus+3
=====>  Executing prometheus+3 pot commands on prometheus-amd64-13_0
=====>  No shell script available for the flavour prometheus+3
=====>  Flavour: prometheus+4
=====>  Executing prometheus+4 pot commands on prometheus-amd64-13_0
=====>  No shell script available for the flavour prometheus+4

prometheus-amd64-12_2_0.9.6:


prometheus/prometheus:
copy-in -s /usr/local/etc/pot/flavours/prometheus.d/prometheus.yml -d /root
copy-in -s /usr/local/etc/pot/flavours/prometheus.d/datasource.yml -d /root
copy-in -s /usr/local/etc/pot/flavours/prometheus.d/dashboard.yml -d /root
copy-in -s /usr/local/etc/pot/flavours/prometheus.d/grafana.conf -d /root
set-attribute -A start-at-boot -V YES
prometheus/prometheus.sh:
#!/bin/sh

# Based on POTLUCK TEMPLATE v3.0
# Altered by Michael Gmelin
#
# EDIT THE FOLLOWING FOR NEW FLAVOUR:
# 1. RUNS_IN_NOMAD - true or false
# 2. If RUNS_IN_NOMAD is false, can delete the <flavour>+4 file, else
#    make sure pot create command doesn't include it
# 3. Create a matching <flavour> file with this <flavour>.sh file that
#    contains the copy-in commands for the config files from <flavour>.d/
#    Remember that the package directories don't exist yet, so likely copy
#    to /root
# 4. Adjust package installation between BEGIN & END PACKAGE SETUP
# 5. Adjust jail configuration script generation between BEGIN & END COOK
#    Configure the config files that have been copied in where necessary

# Set this to true if this jail flavour is to be created as a nomad (i.e. blocking) jail.
# You can then query it in the cook script generation below and the script is installed
# appropriately at the end of this script
RUNS_IN_NOMAD=false

# set the cook log path/filename
COOKLOG=/var/log/cook.log

# check if cooklog exists, create it if not
if [ ! -e $COOKLOG ]
then
    echo "Creating $COOKLOG" | tee -a $COOKLOG
else
    echo "WARNING $COOKLOG already exists"  | tee -a $COOKLOG
fi
date >> $COOKLOG

# -------------------- COMMON ---------------

STEPCOUNT=0
step() {
  STEPCOUNT=$(expr "$STEPCOUNT" + 1)
  STEP="$@"
  echo "Step $STEPCOUNT: $STEP" | tee -a $COOKLOG
}

exit_ok() {
  trap - EXIT
  exit 0
}

FAILED=" failed"
exit_error() {
  STEP="$@"
  FAILED=""
  exit 1
}

set -e
trap 'echo ERROR: $STEP$FAILED | (>&2 tee -a $COOKLOG)' EXIT

# -------------- BEGIN PACKAGE SETUP -------------

step "Bootstrap package repo"
mkdir -p /usr/local/etc/pkg/repos
echo 'FreeBSD: { url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly" }' \
  >/usr/local/etc/pkg/repos/FreeBSD.conf
ASSUME_ALWAYS_YES=yes pkg bootstrap

step "Touch /etc/rc.conf"
touch /etc/rc.conf

# this is important, otherwise running /etc/rc from cook will
# overwrite the IP address set in tinirc
step "Remove ifconfig_epair0b from config"
sysrc -cq ifconfig_epair0b && sysrc -x ifconfig_epair0b || true

step "Disable sendmail"
service sendmail onedisable

step "Create /usr/local/etc/rc.d"
mkdir -p /usr/local/etc/rc.d

# we need consul for consul agent
step "Install package consul"
pkg install -y consul

step "Install package prometheus"
pkg install -y prometheus

step "Install package node_exporter"
pkg install -y node_exporter

step "Install package grafana7"
pkg install -y grafana7

step "Install package sudo"
pkg install -y sudo

step "Clean package installation"
pkg clean -y

# -------------- END PACKAGE SETUP -------------

#
# Create configurations
#

#
# Now generate the run command script "cook"
# It configures the system on the first run by creating the config file(s)
# On subsequent runs, it only starts sleeps (if nomad-jail) or simply exits
#

# clear any old cook runtime file
step "Remove pre-existing cook script (if any)"
rm -f /usr/local/bin/cook

# this runs when image boots
# ----------------- BEGIN COOK ------------------

step "Create cook script"
echo "#!/bin/sh
RUNS_IN_NOMAD=$RUNS_IN_NOMAD
# declare this again for the pot image, might work carrying variable through like
# with above
COOKLOG=/var/log/cook.log
# No need to change this, just ensures configuration is done only once
if [ -e /usr/local/etc/pot-is-seasoned ]
then
    # If this pot flavour is blocking (i.e. it should not return),
    # we block indefinitely
    if [ \"\$RUNS_IN_NOMAD\" = \"true\" ]
    then
        /bin/sh /etc/rc
        tail -f /dev/null
    fi
    exit 0
fi

# ADJUST THIS: STOP SERVICES AS NEEDED BEFORE CONFIGURATION
/usr/local/etc/rc.d/consul stop || true
/usr/local/etc/rc.d/prometheus stop || true
/usr/local/etc/rc.d/grafana stop || true


# No need to adjust this:
# If this pot flavour is not blocking, we need to read the environment first from /tmp/environment.sh
# where pot is storing it in this case
if [ -e /tmp/environment.sh ]
then
    . /tmp/environment.sh
fi

#
# ADJUST THIS BY CHECKING FOR ALL VARIABLES YOUR FLAVOUR NEEDS:
#

# Check config variables are set
#
if [ -z \${DATACENTER+x} ]; then
    echo 'DATACENTER is unset - see documentation how to configure this flavour'
    exit 1
fi
if [ -z \${NODENAME+x} ];
then
    echo 'NODENAME is unset - see documentation how to configure this flavour'
    exit 1
fi
if [ -z \${CONSULSERVERS+x} ]; then
    echo 'CONSULSERVERS is unset - see documentation how to configure this flavour'
    exit 1
fi
if [ -z \${IP+x} ]; then
    echo 'IP is unset - see documentation how to configure this flavour'
    exit 1
fi
# GOSSIPKEY is a 32 byte, Base64 encoded key generated with consul keygen for the consul flavour.
# Re-used for nomad, which is usually 16 byte key but supports 32 byte, Base64 encoded keys
# We'll re-use the one from the consul flavour
if [ -z \${GOSSIPKEY+x} ];
then
    echo 'GOSSIPKEY is unset - see documentation how to configure this flavour, defaulting to preset encrypt key. Do not use this in production!'
    GOSSIPKEY='\"BY+vavBUSEmNzmxxS3k3bmVFn1giS4uEudc774nBhIw=\"'
fi

# ADJUST THIS BELOW: NOW ALL THE CONFIGURATION FILES NEED TO BE CREATED:
# Don't forget to double(!)-escape quotes and dollar signs in the config files

## start consul

# make consul configuration directory and set permissions
mkdir -p /usr/local/etc/consul.d
chmod 750 /usr/local/etc/consul.d

# Create the consul agent config file with imported variables
echo \"{
 \\\"advertise_addr\\\": \\\"\$IP\\\",
 \\\"datacenter\\\": \\\"\$DATACENTER\\\",
 \\\"node_name\\\": \\\"\$NODENAME\\\",
 \\\"data_dir\\\":  \\\"/var/db/consul\\\",
 \\\"dns_config\\\": {
  \\\"a_record_limit\\\": 3,
  \\\"enable_truncate\\\": true
 },
 \\\"log_file\\\": \\\"/var/log/consul/\\\",
 \\\"log_level\\\": \\\"WARN\\\",
 \\\"encrypt\\\": \$GOSSIPKEY,
 \\\"start_join\\\": [ \$CONSULSERVERS ],
 \\\"service\\\": {
  \\\"address\\\": \\\"\$IP\\\",
  \\\"name\\\": \\\"node-exporter\\\",
  \\\"tags\\\": [\\\"_app=prometheus\\\", \\\"_service=node-exporter\\\", \\\"_hostname=\$NODENAME\\\", \\\"_datacenter=\$DATACENTER\\\"],
  \\\"port\\\": 9100
 }
}\" > /usr/local/etc/consul.d/agent.json

# set owner and perms on agent.json
chown consul:wheel /usr/local/etc/consul.d/agent.json
chmod 640 /usr/local/etc/consul.d/agent.json

# enable consul
sysrc consul_enable=\"YES\"

# set load parameter for consul config
sysrc consul_args=\"-config-file=/usr/local/etc/consul.d/agent.json\"
#sysrc consul_datadir=\"/var/db/consul\"

# Workaround for bug in rc.d/consul script:
sysrc consul_group=\"wheel\"

# setup consul logs, might be redundant if not specified in agent.json above
mkdir -p /var/log/consul
touch /var/log/consul/consul.log
chown -R consul:wheel /var/log/consul

# add the consul user to the wheel group, this seems to be required for
# consul to start on this instance. May need to figure out why.
# I'm not entirely sure this is the correct way to do it
/usr/sbin/pw usermod consul -G wheel

## end consul

## start prometheus config

# copy the file to /usr/local/etc/prometheus.yml
if [ -f /root/prometheus.yml ]; then
    cp -f /root/prometheus.yml /usr/local/etc/prometheus.yml
else
    echo \"ERROR - NO PROMETHEUS FILE FOUND\"
fi

# if /mnt/prometheus does not exist, create it and set permissions
if [ ! -d /mnt/prometheus ]; then
    mkdir -p /mnt/prometheus
    chown -R prometheus:prometheus /mnt/prometheus
fi

# enable prometheus service
sysrc prometheus_enable=\"YES\"
sysrc prometheus_data_dir=\"/mnt/prometheus\"
sysrc prometheus_syslog_output_enable=\"YES\"

## end prometheus config

## start node_exporter config

# enable node_exporter service
sysrc node_exporter_enable=\"YES\"

## end node_exporter config

## start grafana config

# we're mounting in a blank-or-filled ZFS dataset from root system at
# zroot/prometheusdata to /mnt

# if /mnt/grafana is empty, copy in /var/db/grafana

if [ ! -d /mnt/grafana ]; then
    # if empty we need to copy in the directory structure from install
    cp -a /var/db/grafana /mnt

    # make sure permissions are good for /mnt/grafana
    chown -R grafana:grafana /mnt/grafana

    # copy in the datasource.yml file to /mnt/grafana/provisioning/datasources
    if [ -f /root/datasource.yml ]; then
        cp -f /root/datasource.yml /mnt/grafana/provisioning/datasources/prometheus.yml
        chown grafana:grafana /mnt/grafana/provisioning/datasources/prometheus.yml
    else
        echo \"ERROR - NO DATASOURCE CONFIG FILE FOUND\"
    fi

    # copy in the dashboard.yml file to /mnt/grafana/provisioning/dashboards
    if [ -f /root/dashboard.yml ]; then
        cp -f /root/dashboard.yml /mnt/grafana/provisioning/dashboards/default.yml
        chown grafana:grafana /mnt/grafana/provisioning/dashboards/default.yml
    else
        echo \"ERROR - NO DASHBOARD DEFAULT CONFIG FILE FOUND\"
    fi
    # include the relevant .json for actual dashboard when available
else
    # if /mnt/grafana exists then don't copy in /var/db/grafana
    #
    # make sure permissions are good for /mnt/grafana
    chown -R grafana:grafana /mnt/grafana

    # copy in the datasource.yml file to /mnt/grafana/provisioning/datasources
    if [ -f /root/datasource.yml ]; then
        cp -f /root/datasource.yml /mnt/grafana/provisioning/datasources/prometheus.yml
        chown grafana:grafana /mnt/grafana/provisioning/datasources/prometheus.yml
    else
        echo \"ERROR - NO DATASOURCE CONFIG FILE FOUND\"
    fi

    # copy in the dashboard.yml file to /mnt/grafana/provisioning/dashboards
    if [ -f /root/dashboard.yml ]; then
        cp -f /root/dashboard.yml /mnt/grafana/provisioning/dashboards/default.yml
        chown grafana:grafana /mnt/grafana/provisioning/dashboards/default.yml
    else
        echo \"ERROR - NO DASHBOARD DEFAULT CONFIG FILE FOUND\"
    fi
    # include the relevant .json for actual dashboard when available below here
    #
    # insert here
fi

# local edits for grafana.conf here
# the mount path for some options is set to /mnt/grafana/...
if [ -f /root/grafana.conf ]; then
    cp -f /root/grafana.conf /usr/local/etc/grafana.conf
fi

# enable grafana service
sysrc grafana_enable=\"YES\"
sysrc grafana_config=\"/usr/local/etc/grafana.conf\"
sysrc grafana_user=\"grafana\"
sysrc grafana_group=\"grafana\"
sysrc grafana_syslog_output_enable=\"YES\"

## end grafana config

#
# ADJUST THIS: START THE SERVICES AGAIN AFTER CONFIGURATION

# start consul agent
/usr/local/etc/rc.d/consul start

# start node_exporter
/usr/local/etc/rc.d/node_exporter start

# start prometheus
/usr/local/etc/rc.d/prometheus start

# start grafana
service grafana start

#
# Do not touch this:
touch /usr/local/etc/pot-is-seasoned

# If this pot flavour is blocking (i.e. it should not return), there is no /tmp/environment.sh
# created by pot and we now after configuration block indefinitely
if [ \"\$RUNS_IN_NOMAD\" = \"true\" ]
then
    /bin/sh /etc/rc
    tail -f /dev/null
fi
" > /usr/local/bin/cook

# ----------------- END COOK ------------------


# ---------- NO NEED TO EDIT BELOW ------------

step "Make cook script executable"
if [ -e /usr/local/bin/cook ]
then
    echo "setting executable bit on /usr/local/bin/cook" | tee -a $COOKLOG
    chmod u+x /usr/local/bin/cook
else
    exit_error "there is no /usr/local/bin/cook to make executable"
fi

#
# There are two ways of running a pot jail: "Normal", non-blocking mode and
# "Nomad", i.e. blocking mode (the pot start command does not return until
# the jail is stopped).
# For the normal mode, we create a /usr/local/etc/rc.d script that starts
# the "cook" script generated above each time, for the "Nomad" mode, the cook
# script is started by pot (configuration through flavour file), therefore
# we do not need to do anything here.
#

# Create rc.d script for "normal" mode:
step "Create rc.d script to start cook"
echo "creating rc.d script to start cook" | tee -a $COOKLOG

echo "#!/bin/sh
#
# PROVIDE: cook
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
. /etc/rc.subr
name=\"cook\"
rcvar=\"cook_enable\"
load_rc_config \$name
: \${cook_enable:=\"NO\"}
: \${cook_env:=\"\"}
command=\"/usr/local/bin/cook\"
command_args=\"\"
run_rc_command \"\$1\"
" > /usr/local/etc/rc.d/cook

step "Make rc.d script to start cook executable"
if [ -e /usr/local/etc/rc.d/cook ]
then
  echo "Setting executable bit on cook rc file" | tee -a $COOKLOG
  chmod u+x /usr/local/etc/rc.d/cook
else
  exit_error "/usr/local/etc/rc.d/cook does not exist"
fi

if [ "$RUNS_IN_NOMAD" != "true" ]
then
  step "Enable cook service"
  # This is a non-nomad (non-blocking) jail, so we need to make sure the script
  # gets started when the jail is started:
  # Otherwise, /usr/local/bin/cook will be set as start script by the pot flavour
  echo "enabling cook" | tee -a $COOKLOG
  service cook enable
fi

# -------------------- DONE ---------------
exit_ok

prometheus/prometheus+1:
prometheus/prometheus+1.sh:

prometheus/prometheus+2:
prometheus/prometheus+2.sh:

prometheus/prometheus+3:
prometheus/prometheus+3.sh:

prometheus/prometheus+4:
prometheus/prometheus+4.sh:
Password:===>  Creating a new pot
===>  pot name : prometheus-amd64-12_2
===>  type : single
===>  base : 12.2
===>  pot_base :
===>  level : 0
===>  network-type : public-bridge
===>  network-stack: ipv4
===>  ip : 10.192.0.4
===>  bridge :
===>  dns : inherit
===>  flavours : fbsd-update prometheus prometheus+1 prometheus+2 prometheus+3 prometheus+4
===>  Fetching FreeBSD 12.2
===>  Extract the tarball
=====>  Flavour: fbsd-update
=====>  Starting prometheus-amd64-12_2 pot for the initial bootstrap
=====>  mount /mnt/data/pot/jails/prometheus-amd64-12_2/m/tmp
defaultrouter: NO -> 10.192.0.1
===>  Starting the pot prometheus-amd64-12_2
ELF ldconfig path: /lib /usr/lib /usr/lib/compat
32-bit compatibility ldconfig path: /usr/lib32
Starting Network: lo0 epair0b.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
	inet6 ::1 prefixlen 128
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
	inet 127.0.0.1 netmask 0xff000000
	groups: lo
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
epair0b: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=8<VLAN_MTU>
	ether 02:1e:67:e8:44:0b
	inet 10.192.0.4 netmask 0xffc00000 broadcast 10.255.255.255
	groups: epair
	media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>)
	status: active
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
add host 127.0.0.1: gateway lo0 fib 0: route already in table
add net default: gateway 10.192.0.1
add host ::1: gateway lo0 fib 0: route already in table
add net fe80::: gateway ::1
add net ff02::: gateway ::1
add net ::ffff:0.0.0.0: gateway ::1
add net ::0.0.0.0: gateway ::1
Generating host.conf.
Creating and/or trimming log files.
Starting syslogd.
Clearing /tmp (X related).
Updating motd:.
Updating /var/run/os-release done.
Starting sendmail_submit.
Starting sendmail_msp_queue.
Starting cron.

Thu May 27 06:45:23 UTC 2021
/usr/local/etc/pot/flavours/fbsd-update.sh -> /mnt/data/pot/jails/prometheus-amd64-12_2/m/tmp/fbsd-update.sh
=====>  Executing fbsd-update script on prometheus-amd64-12_2
src component not installed, skipped
Looking up update.FreeBSD.org mirrors... 2 mirrors found.
Fetching public key from update1.freebsd.org... done.
Fetching metadata signature for 12.2-RELEASE from update1.freebsd.org... done.
Fetching metadata index... done.
Fetching 2 metadata files... done.
Inspecting system... done.
Preparing to download files... done.
Fetching 75 patches.....10....20....30....40....50....60....70.. done.
Applying patches... done.
Fetching 1 files...  done.
The following files will be removed as part of updating to
12.2-RELEASE-p7:
/etc/ssl/certs/2c543cd1.0
/etc/ssl/certs/2e4eed3c.0
/etc/ssl/certs/480720ec.0
/etc/ssl/certs/7d0b38bd.0
/etc/ssl/certs/8867006a.0
/etc/ssl/certs/ad088e1d.0
/etc/ssl/certs/b204d74a.0
/etc/ssl/certs/ba89ed3b.0
/etc/ssl/certs/c089bbbd.0
/etc/ssl/certs/e2799e36.0
/usr/share/certs/trusted/GeoTrust_Global_CA.pem
/usr/share/certs/trusted/GeoTrust_Primary_Certification_Authority.pem
/usr/share/certs/trusted/GeoTrust_Primary_Certification_Authority_-_G3.pem
/usr/share/certs/trusted/GeoTrust_Universal_CA.pem
/usr/share/certs/trusted/GeoTrust_Universal_CA_2.pem
/usr/share/certs/trusted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem
/usr/share/certs/trusted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem
/usr/share/certs/trusted/thawte_Primary_Root_CA.pem
/usr/share/certs/trusted/thawte_Primary_Root_CA_-_G2.pem
/usr/share/certs/trusted/thawte_Primary_Root_CA_-_G3.pem
The following files will be added as part of updating to
12.2-RELEASE-p7:
/etc/ssl/blacklisted/2c543cd1.0
/etc/ssl/blacklisted/2e4eed3c.0
/etc/ssl/blacklisted/480720ec.0
/etc/ssl/blacklisted/7d0b38bd.0
/etc/ssl/blacklisted/8867006a.0
/etc/ssl/blacklisted/ad088e1d.0
/etc/ssl/blacklisted/b204d74a.0
/etc/ssl/blacklisted/ba89ed3b.0
/etc/ssl/blacklisted/c089bbbd.0
/etc/ssl/blacklisted/e2799e36.0
/etc/ssl/certs/3fb36b73.0
/usr/share/certs/blacklisted/GeoTrust_Global_CA.pem
/usr/share/certs/blacklisted/GeoTrust_Primary_Certification_Authority.pem
/usr/share/certs/blacklisted/GeoTrust_Primary_Certification_Authority_-_G3.pem
/usr/share/certs/blacklisted/GeoTrust_Universal_CA.pem
/usr/share/certs/blacklisted/GeoTrust_Universal_CA_2.pem
/usr/share/certs/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem
/usr/share/certs/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem
/usr/share/certs/blacklisted/thawte_Primary_Root_CA.pem
/usr/share/certs/blacklisted/thawte_Primary_Root_CA_-_G2.pem
/usr/share/certs/blacklisted/thawte_Primary_Root_CA_-_G3.pem
/usr/share/certs/trusted/NAVER_Global_Root_Certification_Authority.pem
The following files will be updated as part of updating to
12.2-RELEASE-p7:
/bin/freebsd-version
/lib/libcrypto.so.111
/lib/libzfs.so.3
/lib/libzfs_core.so.2
/lib/libzpool.so.2
/rescue/[
/rescue/bectl
/rescue/bsdlabel
/rescue/bunzip2
/rescue/bzcat
/rescue/bzip2
/rescue/camcontrol
/rescue/cat
/rescue/ccdconfig
/rescue/chflags
/rescue/chgrp
/rescue/chio
/rescue/chmod
/rescue/chown
/rescue/chroot
/rescue/clri
/rescue/cp
/rescue/csh
/rescue/date
/rescue/dd
/rescue/devfs
/rescue/df
/rescue/dhclient
/rescue/disklabel
/rescue/dmesg
/rescue/dump
/rescue/dumpfs
/rescue/dumpon
/rescue/echo
/rescue/ed
/rescue/ex
/rescue/expr
/rescue/fastboot
/rescue/fasthalt
/rescue/fdisk
/rescue/fsck
/rescue/fsck_4.2bsd
/rescue/fsck_ffs
/rescue/fsck_msdosfs
/rescue/fsck_ufs
/rescue/fsdb
/rescue/fsirand
/rescue/gbde
/rescue/geom
/rescue/getfacl
/rescue/glabel
/rescue/gpart
/rescue/groups
/rescue/gunzip
/rescue/gzcat
/rescue/gzip
/rescue/halt
/rescue/head
/rescue/hostname
/rescue/id
/rescue/ifconfig
/rescue/init
/rescue/ipf
/rescue/iscsictl
/rescue/iscsid
/rescue/kenv
/rescue/kill
/rescue/kldconfig
/rescue/kldload
/rescue/kldstat
/rescue/kldunload
/rescue/ldconfig
/rescue/less
/rescue/link
/rescue/ln
/rescue/ls
/rescue/lzcat
/rescue/lzma
/rescue/md5
/rescue/mdconfig
/rescue/mdmfs
/rescue/mkdir
/rescue/mknod
/rescue/more
/rescue/mount
/rescue/mount_cd9660
/rescue/mount_msdosfs
/rescue/mount_nfs
/rescue/mount_nullfs
/rescue/mount_udf
/rescue/mount_unionfs
/rescue/mt
/rescue/mv
/rescue/nc
/rescue/newfs
/rescue/newfs_msdos
/rescue/nos-tun
/rescue/pgrep
/rescue/ping
/rescue/ping6
/rescue/pkill
/rescue/poweroff
/rescue/ps
/rescue/pwd
/rescue/rcorder
/rescue/rdump
/rescue/realpath
/rescue/reboot
/rescue/red
/rescue/rescue
/rescue/restore
/rescue/rm
/rescue/rmdir
/rescue/route
/rescue/routed
/rescue/rrestore
/rescue/rtquery
/rescue/rtsol
/rescue/savecore
/rescue/sed
/rescue/setfacl
/rescue/sh
/rescue/shutdown
/rescue/sleep
/rescue/spppcontrol
/rescue/stty
/rescue/swapon
/rescue/sync
/rescue/sysctl
/rescue/tail
/rescue/tar
/rescue/tcsh
/rescue/tee
/rescue/test
/rescue/tunefs
/rescue/umount
/rescue/unlink
/rescue/unlzma
/rescue/unxz
/rescue/unzstd
/rescue/vi
/rescue/whoami
/rescue/xz
/rescue/xzcat
/rescue/zcat
/rescue/zdb
/rescue/zfs
/rescue/zpool
/rescue/zstd
/rescue/zstdcat
/rescue/zstdmt
/sbin/ipfw
/sbin/rtsol
/sbin/zpool
/usr/bin/lldb
/usr/bin/zinject
/usr/bin/ztest
/usr/include/net/if_var.h
/usr/include/openssl/asn1err.h
/usr/include/sys/filedesc.h
/usr/include/sys/jail.h
/usr/lib/libcrypto.a
/usr/lib/libcrypto_p.a
/usr/lib/libpam.a
/usr/lib/libradius.a
/usr/lib/libradius.so.4
/usr/lib/libradius_p.a
/usr/lib/libssl.a
/usr/lib/libssl.so.111
/usr/lib/libssl_p.a
/usr/lib/libzfs.a
/usr/lib/libzfs_core.a
/usr/lib/libzfs_core_p.a
/usr/lib/libzfs_p.a
/usr/lib/libzpool.a
/usr/lib/pam_login_access.so.6
/usr/sbin/freebsd-update
/usr/sbin/rtsold
/usr/sbin/zdb
/usr/sbin/zfsd
/usr/sbin/zhack
/usr/share/man/man2/jail.2.gz
/usr/share/man/man2/jail_attach.2.gz
/usr/share/man/man2/jail_get.2.gz
/usr/share/man/man2/jail_remove.2.gz
/usr/share/man/man2/jail_set.2.gz
/usr/share/zoneinfo/Africa/Accra
/usr/share/zoneinfo/Africa/Addis_Ababa
/usr/share/zoneinfo/Africa/Algiers
/usr/share/zoneinfo/Africa/Asmara
/usr/share/zoneinfo/Africa/Asmera
/usr/share/zoneinfo/Africa/Bangui
/usr/share/zoneinfo/Africa/Brazzaville
/usr/share/zoneinfo/Africa/Casablanca
/usr/share/zoneinfo/Africa/Dar_es_Salaam
/usr/share/zoneinfo/Africa/Djibouti
/usr/share/zoneinfo/Africa/Douala
/usr/share/zoneinfo/Africa/El_Aaiun
/usr/share/zoneinfo/Africa/Juba
/usr/share/zoneinfo/Africa/Kampala
/usr/share/zoneinfo/Africa/Kinshasa
/usr/share/zoneinfo/Africa/Lagos
/usr/share/zoneinfo/Africa/Libreville
/usr/share/zoneinfo/Africa/Luanda
/usr/share/zoneinfo/Africa/Malabo
/usr/share/zoneinfo/Africa/Mogadishu
/usr/share/zoneinfo/Africa/Nairobi
/usr/share/zoneinfo/Africa/Niamey
/usr/share/zoneinfo/Africa/Porto-Novo
/usr/share/zoneinfo/America/Belize
/usr/share/zoneinfo/America/Dawson
/usr/share/zoneinfo/America/Grand_Turk
/usr/share/zoneinfo/America/Nassau
/usr/share/zoneinfo/America/Whitehorse
/usr/share/zoneinfo/Antarctica/Casey
/usr/share/zoneinfo/Antarctica/Macquarie
/usr/share/zoneinfo/Asia/Gaza
/usr/share/zoneinfo/Asia/Hebron
/usr/share/zoneinfo/Asia/Jerusalem
/usr/share/zoneinfo/Asia/Tel_Aviv
/usr/share/zoneinfo/Atlantic/Bermuda
/usr/share/zoneinfo/Australia/ACT
/usr/share/zoneinfo/Australia/Adelaide
/usr/share/zoneinfo/Australia/Brisbane
/usr/share/zoneinfo/Australia/Broken_Hill
/usr/share/zoneinfo/Australia/Canberra
/usr/share/zoneinfo/Australia/Currie
/usr/share/zoneinfo/Australia/Darwin
/usr/share/zoneinfo/Australia/Eucla
/usr/share/zoneinfo/Australia/Hobart
/usr/share/zoneinfo/Australia/Lindeman
/usr/share/zoneinfo/Australia/Melbourne
/usr/share/zoneinfo/Australia/NSW
/usr/share/zoneinfo/Australia/North
/usr/share/zoneinfo/Australia/Perth
/usr/share/zoneinfo/Australia/Queensland
/usr/share/zoneinfo/Australia/South
/usr/share/zoneinfo/Australia/Sydney
/usr/share/zoneinfo/Australia/Tasmania
/usr/share/zoneinfo/Australia/Victoria
/usr/share/zoneinfo/Australia/West
/usr/share/zoneinfo/Australia/Yancowinna
/usr/share/zoneinfo/Canada/Yukon
/usr/share/zoneinfo/Europe/Budapest
/usr/share/zoneinfo/Europe/Monaco
/usr/share/zoneinfo/Europe/Paris
/usr/share/zoneinfo/Europe/Volgograd
/usr/share/zoneinfo/Indian/Antananarivo
/usr/share/zoneinfo/Indian/Comoro
/usr/share/zoneinfo/Indian/Mahe
/usr/share/zoneinfo/Indian/Mayotte
/usr/share/zoneinfo/Israel
/usr/share/zoneinfo/Pacific/Efate
/usr/share/zoneinfo/Pacific/Fiji
/usr/share/zoneinfo/zone.tab
/usr/share/zoneinfo/zone1970.tab
Installing updates...Scanning //usr/share/certs/blacklisted for certificates...
Scanning //usr/share/certs/trusted for certificates...
 done.
=====>  Stop the pot prometheus-amd64-12_2
=====>  Remove epair0[a|b] network interfaces
=====>  unmount /mnt/data/pot/jails/prometheus-amd64-12_2/m/tmp
=====>  unmount /mnt/data/pot/jails/prometheus-amd64-12_2/m/dev
=====>  Flavour: prometheus
=====>  Executing prometheus pot commands on prometheus-amd64-12_2
=====>  mount /mnt/data/pot/jails/prometheus-amd64-12_2/m/tmp
/usr/local/etc/pot/flavours/prometheus.d/prometheus.yml -> /mnt/data/pot/jails/prometheus-amd64-12_2/m/root/prometheus.yml
=====>  Source /usr/local/etc/pot/flavours/prometheus.d/prometheus.yml copied in the pot prometheus-amd64-12_2
=====>  unmount /mnt/data/pot/jails/prometheus-amd64-12_2/m/tmp
=====>  /mnt/data/pot/jails/prometheus-amd64-12_2/m/dev is already unmounted
=====>  mount /mnt/data/pot/jails/prometheus-amd64-12_2/m/tmp
/usr/local/etc/pot/flavours/prometheus.d/datasource.yml -> /mnt/data/pot/jails/prometheus-amd64-12_2/m/root/datasource.yml
=====>  Source /usr/local/etc/pot/flavours/prometheus.d/datasource.yml copied in the pot prometheus-amd64-12_2
=====>  unmount /mnt/data/pot/jails/prometheus-amd64-12_2/m/tmp
=====>  /mnt/data/pot/jails/prometheus-amd64-12_2/m/dev is already unmounted
=====>  mount /mnt/data/pot/jails/prometheus-amd64-12_2/m/tmp
/usr/local/etc/pot/flavours/prometheus.d/dashboard.yml -> /mnt/data/pot/jails/prometheus-amd64-12_2/m/root/dashboard.yml
=====>  Source /usr/local/etc/pot/flavours/prometheus.d/dashboard.yml copied in the pot prometheus-amd64-12_2
=====>  unmount /mnt/data/pot/jails/prometheus-amd64-12_2/m/tmp
=====>  /mnt/data/pot/jails/prometheus-amd64-12_2/m/dev is already unmounted
=====>  mount /mnt/data/pot/jails/prometheus-amd64-12_2/m/tmp
/usr/local/etc/pot/flavours/prometheus.d/grafana.conf -> /mnt/data/pot/jails/prometheus-amd64-12_2/m/root/grafana.conf
=====>  Source /usr/local/etc/pot/flavours/prometheus.d/grafana.conf copied in the pot prometheus-amd64-12_2
=====>  unmount /mnt/data/pot/jails/prometheus-amd64-12_2/m/tmp
=====>  /mnt/data/pot/jails/prometheus-amd64-12_2/m/dev is already unmounted
=====>  Starting prometheus-amd64-12_2 pot for the initial bootstrap
=====>  mount /mnt/data/pot/jails/prometheus-amd64-12_2/m/tmp
defaultrouter: 10.192.0.1 -> 10.192.0.1
===>  Starting the pot prometheus-amd64-12_2
ELF ldconfig path: /lib /usr/lib /usr/lib/compat
32-bit compatibility ldconfig path: /usr/lib32
Starting Network: lo0 epair0b.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
	inet6 ::1 prefixlen 128
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
	inet 127.0.0.1 netmask 0xff000000
	groups: lo
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
epair0b: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=8<VLAN_MTU>
	ether 02:6c:5b:6e:f7:0b
	inet 10.192.0.4 netmask 0xffc00000 broadcast 10.255.255.255
	groups: epair
	media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>)
	status: active
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
add host 127.0.0.1: gateway lo0 fib 0: route already in table
add net default: gateway 10.192.0.1
add host ::1: gateway lo0 fib 0: route already in table
add net fe80::: gateway ::1
add net ff02::: gateway ::1
add net ::ffff:0.0.0.0: gateway ::1
add net ::0.0.0.0: gateway ::1
Creating and/or trimming log files.
Starting syslogd.
Clearing /tmp (X related).
Updating motd:.
Updating /var/run/os-release done.
Starting sendmail_submit.
Starting sendmail_msp_queue.
Starting cron.

Thu May 27 06:46:53 UTC 2021
/usr/local/etc/pot/flavours/prometheus.sh -> /mnt/data/pot/jails/prometheus-amd64-12_2/m/tmp/prometheus.sh
=====>  Executing prometheus script on prometheus-amd64-12_2
Creating /var/log/cook.log
Step 1: Bootstrap package repo
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] Installing pkg-1.16.3...
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] Extracting pkg-1.16.3: .......... done
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:12:amd64/quarterly, please wait...
Step 2: Touch /etc/rc.conf
Step 3: Remove ifconfig_epair0b from config
Step 4: Disable sendmail
sendmail disabled in /etc/rc.conf
sendmail_submit disabled in /etc/rc.conf
sendmail_msp_queue disabled in /etc/rc.conf
Step 5: Create /usr/local/etc/rc.d
Step 6: Install package consul
Updating FreeBSD repository catalogue...
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] Fetching meta.conf: . done
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] Fetching packagesite.txz: .......... done
Processing entries: .......... done
FreeBSD repository update completed. 30511 packages processed.
All repositories are up to date.
Updating database digests format: . done
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	consul: 1.9.4

Number of packages to be installed: 1

The process will require 78 MiB more space.
27 MiB to be downloaded.
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [1/1] Fetching consul-1.9.4.txz: .......... done
Checking integrity... done (0 conflicting)
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [1/1] Installing consul-1.9.4...
===> Creating groups.
Creating group 'consul' with gid '469'.
===> Creating users
Creating user 'consul' with uid '469'.
===> Creating homedir(s)
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [1/1] Extracting consul-1.9.4: ..... done
Step 7: Install package prometheus
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	prometheus: 2.25.2

Number of packages to be installed: 1

The process will require 119 MiB more space.
24 MiB to be downloaded.
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [1/1] Fetching prometheus-2.25.2.txz: .......... done
Checking integrity... done (0 conflicting)
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [1/1] Installing prometheus-2.25.2...
===> Creating groups.
Creating group 'prometheus' with gid '478'.
===> Creating users
Creating user 'prometheus' with uid '478'.
===> Creating homedir(s)
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [1/1] Extracting prometheus-2.25.2: .......... done
Step 8: Install package node_exporter
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	node_exporter: 1.1.2

Number of packages to be installed: 1

The process will require 11 MiB more space.
3 MiB to be downloaded.
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [1/1] Fetching node_exporter-1.1.2.txz: .......... done
Checking integrity... done (0 conflicting)
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [1/1] Installing node_exporter-1.1.2...
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [1/1] Extracting node_exporter-1.1.2: .......... done
=====
Message from node_exporter-1.1.2:

--
If upgrading from a version of node_exporter <0.15.0 you'll need to update any
custom command line flags that you may have set as it now requires a
double-dash (--flag) instead of a single dash (-flag).
The collector flags in 0.15.0 have now been replaced with individual boolean
flags and the -collector.procfs` and -collector.sysfs` flags have been renamed
to --path.procfs and --path.sysfs respectively.
Step 9: Install package grafana7
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	ca_root_nss: 3.63
	grafana7: 7.5.1_1

Number of packages to be installed: 2

The process will require 170 MiB more space.
35 MiB to be downloaded.
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [1/2] Fetching grafana7-7.5.1_1.txz: .......... done
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [2/2] Fetching ca_root_nss-3.63.txz: .......... done
Checking integrity... done (0 conflicting)
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [1/2] Installing ca_root_nss-3.63...
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [1/2] Extracting ca_root_nss-3.63: ........ done
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [2/2] Installing grafana7-7.5.1_1...
===> Creating groups.
Creating group 'grafana' with gid '904'.
===> Creating users
Creating user 'grafana' with uid '904'.
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [2/2] Extracting grafana7-7.5.1_1: .......... done
=====
Message from ca_root_nss-3.63:

--
FreeBSD does not, and can not warrant that the certification authorities
whose certificates are included in this package have in any way been
audited for trustworthiness or RFC 3647 compliance.

Assessment and verification of trust is the complete responsibility of the
system administrator.


This package installs symlinks to support root certificates discovery by
default for software that uses OpenSSL.

This enables SSL Certificate Verification by client software without manual
intervention.

If you prefer to do this manually, replace the following symlinks with
either an empty file or your site-local certificate bundle.

  * /etc/ssl/cert.pem
  * /usr/local/etc/ssl/cert.pem
  * /usr/local/openssl/cert.pem
Step 10: Install package sudo
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 3 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	gettext-runtime: 0.21
	indexinfo: 0.3.1
	sudo: 1.9.6p1

Number of packages to be installed: 3

The process will require 7 MiB more space.
1 MiB to be downloaded.
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [1/3] Fetching sudo-1.9.6p1.txz: .......... done
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [2/3] Fetching gettext-runtime-0.21.txz: .......... done
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [3/3] Fetching indexinfo-0.3.1.txz: . done
Checking integrity... done (0 conflicting)
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [1/3] Installing indexinfo-0.3.1...
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [1/3] Extracting indexinfo-0.3.1: .... done
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [2/3] Installing gettext-runtime-0.21...
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [2/3] Extracting gettext-runtime-0.21: .......... done
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [3/3] Installing sudo-1.9.6p1...
[prometheus-amd64-12_2.vsf00001.cpt.za.honeyguide.net] [3/3] Extracting sudo-1.9.6p1: .......... done
Step 11: Clean package installation
The following package files will be deleted:
	/var/cache/pkg/node_exporter-1.1.2.txz
	/var/cache/pkg/prometheus-2.25.2~8ac8a46e6f.txz
	/var/cache/pkg/grafana7-7.5.1_1~9e8b35d9d9.txz
	/var/cache/pkg/ca_root_nss-3.63~9e0391af4c.txz
	/var/cache/pkg/indexinfo-0.3.1.txz
	/var/cache/pkg/node_exporter-1.1.2~9a6778e31d.txz
	/var/cache/pkg/gettext-runtime-0.21~7f53ebc469.txz
	/var/cache/pkg/consul-1.9.4~6fa61d85b5.txz
	/var/cache/pkg/ca_root_nss-3.63.txz
	/var/cache/pkg/consul-1.9.4.txz
	/var/cache/pkg/prometheus-2.25.2.txz
	/var/cache/pkg/sudo-1.9.6p1.txz
	/var/cache/pkg/indexinfo-0.3.1~bd05368104.txz
	/var/cache/pkg/sudo-1.9.6p1~723a9c61d7.txz
	/var/cache/pkg/gettext-runtime-0.21.txz
	/var/cache/pkg/grafana7-7.5.1_1.txz
The cleanup will free 90 MiB
Deleting files: .......... done
All done
Step 12: Remove pre-existing cook script (if any)
Step 13: Create cook script
Step 14: Make cook script executable
setting executable bit on /usr/local/bin/cook
Step 15: Create rc.d script to start cook
creating rc.d script to start cook
Step 16: Make rc.d script to start cook executable
Setting executable bit on cook rc file
Step 17: Enable cook service
enabling cook
cook enabled in /etc/rc.conf
=====>  Stop the pot prometheus-amd64-12_2
=====>  Remove epair0[a|b] network interfaces
=====>  unmount /mnt/data/pot/jails/prometheus-amd64-12_2/m/tmp
=====>  unmount /mnt/data/pot/jails/prometheus-amd64-12_2/m/dev
=====>  Flavour: prometheus+1
=====>  Executing prometheus+1 pot commands on prometheus-amd64-12_2
=====>  No shell script available for the flavour prometheus+1
=====>  Flavour: prometheus+2
=====>  Executing prometheus+2 pot commands on prometheus-amd64-12_2
=====>  No shell script available for the flavour prometheus+2
=====>  Flavour: prometheus+3
=====>  Executing prometheus+3 pot commands on prometheus-amd64-12_2
=====>  No shell script available for the flavour prometheus+3
=====>  Flavour: prometheus+4
=====>  Executing prometheus+4 pot commands on prometheus-amd64-12_2
=====>  No shell script available for the flavour prometheus+4

This site © Honeyguide Group (Pty) Ltd, all the hosted software their respective license owners 2020 - 2021 - Disclaimer