share library_books

Sematext Agent Chef Recipe

The following is an example Chef Recipe for installing Sematext Agent.

# Author: Charles Sullivan (
# Based on:
if node.spm[:token]  # Will only run if a SPM token is present.
  apt_repository "sematext" do
    action :add
    uri ""
    distribution node['lsb']['codename']
    components ["main"]
    key ""
    notifies :run, "execute[apt-get update]", :immediately

  package "sematext-agent"

  service "spm-monitor" do
    action :nothing

  bash "setup-sematext" do
    user "root"
    cwd "/tmp"
    code "bash /opt/spm/bin/setup-sematext --monitoring-token #{node.spm[:token]} --app-type elasticsearch --agent-type standalone"
    creates "/opt/spm/spm-monitor/conf/spm-monitor-config-#{node.spm[:token]}"
    notifies :restart, "service[spm-monitor]"



  • line 10: assumes Debian-based distribution. For other distributions replace "apt-get" with distribution-specific equivalent (e.q. yum on RedHat-based distros)
  • line 22: change "elasticsearch" to appropriate type based on the type seen for your Sematext Monitoring app on
  • line 22: change "standalone" to "javaagent" if you want an embedded/in-process agent and not a standalone process agent
  • line 24: this is relevant only for "standalone" agent