Skip to content

Instantly share code, notes, and snippets.

@jnikolak
Last active October 17, 2017 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnikolak/7a2d9d7a6b4679526264871707f89209 to your computer and use it in GitHub Desktop.
Save jnikolak/7a2d9d7a6b4679526264871707f89209 to your computer and use it in GitHub Desktop.
easynetworkperformance
# This needs the package puppet which can be installed with:
#Rhel 7 = rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm;yum install -y puppet
#rhel 6 = requires 4 repositories
#rhel-6-server-rpms -> subscription-manager repos --enable rhel-6-server-rpms
#puppetlabs-products -> rpm -ivh rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
#puppetlabs-deps -> enable the repository;Change 0 to 1
#rhel-6-server-optional-rpms -> subscription-manager repos --enable rhel-6-server-optional-rpms
# Once these repos are available, yum install puppet
# About netperf: This script will apply recommended Tunings on Your Server.
# To run do: #puppet apply netperf.pp
class rhel6 {
exec { 'max_cstate':
unless => [ 'egrep 0 /sys/module/intel_idle/parameters/max_cstate', 'egrep cstate /boot/grub/grub.conf' ],
command => "/bin/sed -i '/kernel/ s/$/ processor.max_cstate=1 intel_idle.max_cstate=0/' /boot/grub/grub.conf",
path => [ '/bin', '/bin/sed' ],
}
}
# unless condition checks 1) if value 0 and 2) if customer already has cstate in grub
class rhel7 {
exec { 'max_cstate':
unless => [ 'egrep 0 /sys/module/intel_idle/parameters/max_cstate', 'grubby --info /boot/vmlinuz-$(facter kernelrelease) | grep cstate' ],
command => "grubby --args='processor.max_cstate=1 intel_idle.max_cstate=0' --update-kernel /boot/vmlinuz-$(facter kernelrelease)",
path => [ '/bin', '/bin/sed', '/usr/sbin' ],
}
}
$pkg_list = [ 'tuned', 'irqbalance' ]
package { $pkg_list:
ensure => 'present',
}
service {'irqbalance':
enable => 'true',
require => Package['irqbalance'],
}
service {'tuned':
ensure => 'running',
enable => 'true',
hasstatus => 'true',
require => Package['tuned'],
}
exec { "tuned-adm profile throughput-performance":
require => Service['tuned'],
path => [ '/sbin', '/bin', '/usr/sbin' ],
}
if $::osfamily == 'redhat' {
if $::operatingsystemrelease =~ /^[6].*/ {
class { 'rhel6' :}
}
if ( $::operatingsystemrelease =~ /^7.*/) {
class { 'rhel7' :}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment