In Manage Your Service Data with GitHub, Jenkins & Seiso we learned how to manage service data using version control, and how to pull it into Seiso where it can be integrated with data from other sources. We noted that while it's possible to manage machine data in source control, it's not the only option. Especially with cloud-based infrastructure, we generally want to source machine data in a fashion that's more dynamic than what version control would typically support.

In this guide we import dynamic machine data from Chef server into Seiso, integrating it with the more static service data that we manage in version control. This integrated view allows you to support a range of deployment and operational use cases. We'll do this with a Jenkins job that performs the sync as a batch operation on a regular period.

Figure 1. Use Jenkins to set up a scheduled job to sync Chef nodes to Seiso.

1 Set up your version-controlled service data (optional)

While you can import machine data into Seiso just fine without already having the service data in place, there's no integration without the service data. So consider starting off with the Manage Your Service Data with GitHub, Jenkins & Seiso guide.

2 Do a manual import using the Seiso Chef Importer

Before setting up the Jenkins job, it's a good idea to do a manual import first, just to get the configuration right. Follow the instructions for using seiso-import-chef.

3 Set up the Jenkins sync job

We just set up a job to run the following script on a timer. The script basically does what we just did in step 2 above. Modify it as necessary for your own use.

#!/bin/bash -l

set -e

source /etc/profile.d/
rvm use 1.9.3-p547

echo "Installing importer"
gem install --no-rdoc --no-ri seiso-import_chef

echo "Configuring importer"
mkdir -p $HOME/.seiso-importers

cat > $HOME/.seiso-importers/seiso.yml <<-EOF
port: 443
use_ssl: true
ignore_cert: true
username: seiso-batch
password: $api_password

cat > $HOME/.seiso-importers/chef.yml <<-EOF
client_name: jenkins
signing_key: jenkins.pem


set +e

4 Import your nodes

In Seiso, nodes have a machine property, so to link your nodes and machines you'll need to (re)import your nodes. After your jobs have imported your machines, you can import your nodes easily enough with something like this

$ cd /path/to/repos
$ seiso-import-master */nodes/*.json


If all goes well, you can go into Seiso and see your Seiso nodes linked up to your Chef-provided machines.

Figure 2. Your Chef-managed machines now show up in Seiso, linked to the nodes that run on them.

Questions & Comments