Skip to content

Instantly share code, notes, and snippets.

@discreet
Last active August 29, 2015 14:01
Show Gist options
  • Save discreet/bd9f06a1e7f85fdd9fb7 to your computer and use it in GitHub Desktop.
Save discreet/bd9f06a1e7f85fdd9fb7 to your computer and use it in GitHub Desktop.
Splunk Universal Forwarder Version
#This fact will pull the Splunk Universal Forwarder version and then normalize it so you can use versioncmp in Puppet to update your Splunk Universal Forwarders.
#Splunk Universal Forwarder Version
Facter.add("SplunkUF_Version") do
confine :osfamily => "RedHat"
setcode do
SplunkUF_Version = Facter::Util::Resolution.exec("/opt/splunkforwarder/bin/splunk --version | awk {'print $4'}")
if SplunkUF_Version.length < 5
while SplunkUF_Version.length < 5 do
SplunkUF_Version.insert(-1, '.0')
end
end
SplunkUF_Version
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment