Check FTP Publishing with serverspec - Infrastructure Testing

Serverspec tests the actual state of your server infrastructure by executing command locally (CMD), via SSH, via WinRM, via Docker API and so on.

There is no agent technology required on your servers and can use any configuration management tools, Puppet, Ansible, CFEngine, Itamae, Saltstack and so on.

Create a file CheckFTP.rb with the following contents

require 'spec_helper'
describe 'FTP Publishing' do
  describe service('FTP Publishing') do
    it { should be_installed }
    it { should be_enabled }
    it { should be_running }
    it { should have_start_mode('Automatic') }
  end
  describe port(21) do
    it { should be_listening.with('tcp') }
  end
end

Run the serverspec file
ruby -S rspec CheckFTP.rb.rb

Expected Output
FTP Publishing
  Service "FTP Publishing"
    should be installed
    should be enabled
    should be running
    should have start mode "Automatic"
  Port "21"
    should be listening with tcp

Finished in 6.75 seconds (files took 1.16 seconds to load)
5 examples, 0 failures

Comments

Popular posts from this blog

Basic Send Message to MQ with Java and IBM MQ JMS

Basic Receive Message to MQ with Java and IBM MQ JMS

Creating a simple Alert / Success Message with ASP.NET/VB using Bootstrap