Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions rightscript-templates/rcav/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
v1.0.0
------
- Initial Puppet Development
75 changes: 75 additions & 0 deletions rightscript-templates/rcav/Puppet_Client_Install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#! /usr/bin/sudo /bin/bash
# ---
# RightScript Name: Puppet Client Install
# Description: Installs the Puppet Client and prepares system to access the Puppet Server
# Inputs:
# PUPPET_SERVER:
# Category: PUPPET
# Description: The Puppet Server URL
# Input Type: single
# Required: true
# Advanced: false
# PUPPET_ROLE:
# Category: PUPPET
# Description: The Puppet Server URL
# Input Type: single
# Required: true
# Advanced: false
# Attachments: []
# ...
# Puppet
set -e
exec 1> >(logger -s -t puppet_install) 2>&1
HOME=/home/rightscale
# Boot-optimized images (pre-cached AMIs) seem to boot up with LANG=US-ASCII
# which causes Puppet to throw all kinds of errors.
#
# https://tickets.puppetlabs.com/browse/PUP-1386
export LANG=en_US.UTF-8

#Set curl opts
curl=$(which curl)
curl_opts="--silent --fail --retry 3 --retry-delay 10 --connect-timeout 10 --speed-limit 10240"
if [[ -z "$curl" ]]; then
echo "Missing curl. Exiting!" && exit 1
fi

if [ ! -e /usr/local/bin/rsc ]; then
echo "rsc not found, RL10 is a requirement for the chef10 scripts"
exit 1
fi

instance_data=$(rsc --rl10 cm15 index_instance_session /api/sessions/instance)
export instance_uuid=$(echo $instance_data | rsc --x1 '.monitoring_id' json)
export instance_id=$(echo $instance_data | rsc --x1 '.resource_uid' json)
monitoring_server=$(echo $instance_data | rsc --x1 '.monitoring_server' json)
export region=$(rsc --rl10 --x1 '.name' cm15 show `rsc --rl10 --x1 'object:has(.rel:val("cloud")).href' cm15 index_instance_session /api/sessions/instance`| awk '{print $2}')
export instance_href=$(rsc --rl10 --x1 'object:has(.rel:val("self")).href' cm15 index_instance_session /api/sessions/instance)
create_tag() {
self_href=$(rsc --rl10 --x1 'object:has(.rel:val("self")).href' cm15 index_instance_session sessions/instance)
rsc --rl10 cm15 multi_add /api/tags/multi_add resource_hrefs[]=$self_href tags[]=$1
}
#requires observer
# export image_name=$(rsc --rl10 --x1 '.name' cm15 show `rsc --rl10 --x1 'object:has(.rel:val("cloud")).href' cm15 index_instance_session /api/sessions/instance`| awk '{print $1}')
export daemonsplay='true'
export splaylimit='30'
export image_name=$(curl --silent --show-error --retry 3 http://169.254.169.254/latest/meta-data/ami-id)
shard=$(echo $monitoring_server | sed -e 's/tss/us-/')
if [ ! -e /usr/local/bin/puppet ]; then
$curl $curl_opts -k https://$PUPPET_SERVER:8140/packages/current/install.bash | sudo bash -s agent:certname=$instance_id \
agent:splay=$daemonsplay \
extension_requests:pp_instance_id=$instance_id \
extension_requests:pp_region=$region \
extension_requests:pp_image_name=$image_name extension_requests:pp_role=$PUPPET_ROLE
fi
puppet_agent=$(which puppet)
$curl $curl_opts -L https://github.com/puppetlabs/puppet-agent-bootstrap/archive/0.2.1.tar.gz -o /tmp/puppet-agent-bootstrap-0.2.1.tar.gz
$puppet_agent module install /tmp/puppet-agent-bootstrap-0.2.1.tar.gz --ignore-dependencies
$puppet_agent agent --enable
$puppet_agent agent --onetime --no-daemonize --no-usecacheonfailure --no-splay
$puppet_agent resource service puppet ensure=running enable=true

create_tag puppet:pp_instance_id=$instance_id
create_tag puppet:pp_region=$region
create_tag puppet:pp_role=$PUPPET_ROLE
create_tag agent:certname=$instance_id
6 changes: 6 additions & 0 deletions rightscript-templates/rcav/collectd-nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
LoadPlugin nginx
<Plugin "nginx">
URL "http://localhost/nginx_status"
User "admin"
Password "*********"
</Plugin>
5 changes: 5 additions & 0 deletions rightscript-templates/rcav/collectd-processes.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LoadPlugin "processes"
<Plugin "processes">
ProcessMatch "rainbows" "rainbows"
ProcessMatch "nginx" "nginx"
</Plugin>
3 changes: 3 additions & 0 deletions rightscript-templates/rcav/modify-nginx-for-status.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# create htpasswd user
# modify nginx for status
# setup nginx.conf
1 change: 1 addition & 0 deletions rightscript-templates/rcav/modify-rainbows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#script to modify rainbows config and restart vscale
142 changes: 142 additions & 0 deletions rightscript-templates/rcav/server_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
Name: RightLink 10 Linux Puppet Client
Description: "Puppet Client ServerTemplate for RightLink10. RightLink10 is a new agent
to connect servers to the RightScale platform that is very lightweight and simple
to install.\n_It is not a plug-in upgrade from the older RightLink v6 series._\nSee
[http://docs.rightscale.com/rl/about.html](http://docs.rightscale.com/rl/about.html)
for details.\n\nThis base ST runs a script to update the packaging system and enable
automatic security updates, and a collectd install script to enable RightScale monitoring.
\n\nThe base ST can run on most any Linux distro that supports cloud-init. It is
recommended to use the standard distro images in various clouds.\n\n__Requirements__\n\n*
Puppet Server or Hosted Puppet\n\n__Tested Linux distros:__\n\n* Ubuntu 14.04 x86_64\n\n__Documenation__\n\n*
[Overview](http://docs.rightscale.com/st/rl10/Puppet-client/overview.html)\n\n\n__Tested
compute clouds:__\n\n* AWS\n"
Inputs:
COLLECTD_SERVER: env:RS_TSS
RS_INSTANCE_UUID: env:RS_INSTANCE_UUID
MONITORING_METHOD: text:rightlink
RightScripts:
Boot:
- Name: RL10 Linux Wait For EIP
Revision: 5
Publisher: RightScale
- Name: RL10 Linux Setup Hostname
Revision: 8
Publisher: RightScale
- Name: RL10 Linux Enable Managed Login
Revision: 12
Publisher: RightScale
- Name: RL10 Linux Setup Alerts
Revision: 2
Publisher: RightScale
- Name: RL10 Linux Setup Automatic Upgrade
Revision: 4
Publisher: RightScale
- Name: RL10 Linux Enable Monitoring
Revision: 8
Publisher: RightScale
- Puppet_Client_Install.sh
Decommission:
- Name: RL10 Linux Shutdown Reason
Revision: 5
Publisher: RightScale
Operational:
- Name: RL10 Linux Setup Automatic Upgrade
Revision: 4
Publisher: RightScale
- Name: RL10 Linux Upgrade
Revision: 8
Publisher: RightScale

MultiCloudImages:
- Name: Ubuntu_12.04_x64
Revision: 66
Publisher: RightScale
- Name: Ubuntu_12.04_x64_KVM
Revision: 31
Publisher: RightScale
- Name: Ubuntu_14.04_x64_KVM
Revision: 31
Publisher: RightScale
- Name: Ubuntu_16.04_x64_KVM
Revision: 3
Publisher: RightScale
- Name: CentOS_6.x_x64
Revision: 25
Publisher: RightScale
- Name: CentOS_6.x_x64_KVM
Revision: 30
Publisher: RightScale
- Name: CentOS_7.x_x64
Revision: 33
Publisher: RightScale
- Name: CentOS_7.x_x64_KVM
Revision: 30
Publisher: RightScale
- Name: CoreOS_stable_x64_KVM
Revision: 21
Publisher: RightScale
- Name: RHEL_6.x_x64_KVM
Revision: 9
Publisher: RightScale
- Name: RHEL_7.x_x64_KVM
Revision: 9
Publisher: RightScale
- Name: RHEL_6.x_x64
Revision: 13
Publisher: RightScale
- Name: RHEL_7.x_x64
Revision: 11
Publisher: RightScale
- Name: Ubuntu_14.04_x64
Revision: 70
Publisher: RightScale
- Name: Ubuntu_16.04_x64
Revision: 5
Publisher: RightScale
Alerts:
- Name: rs instance terminated
Description: Raise an alert if the instance has been terminated abnormally, i.e.
not through the RightScale interface or by an elasticity daemon resizing server
arrays.
Clause: If RS/server.state == terminated for 1 minutes Then escalate critical
- Name: rs instance stranded
Description: Raise an alert if the instance enters the stranded state.
Clause: If RS/server-failure.state == stranded for 1 minutes Then escalate warning
- Name: rs instance not responding
Description: Raise an alert if the instance fails to send monitoring information
for 5 minutes.
Clause: If cpu-0/cpu-idle.value == NaN for 5 minutes Then escalate critical
- Name: rs cpu busy
Description: Raise an alert if the idle time is too low.
Clause: If cpu-0/cpu-idle.value < 15 for 3 minutes Then escalate warning
- Name: rs cpu overloaded
Description: Raise an alert when the cpu idle time is too low.
Clause: If cpu-0/cpu-idle.value < 3 for 5 minutes Then escalate critical
- Name: rs cpu I/O wait
Description: Raise an alert if disk io is too high.
Clause: If cpu-0/cpu-wait.value > 40 for 15 minutes Then escalate warning
- Name: rs low space in root partition
Description: Raise an alert if the available space in the root partition is too low. This alert may be modified on
an instance to match the metric name df/df-root.free instead if the instance is running collectd 4. See the RL10
Linux Setup Alerts RightScript (rll/setup-alerts.sh) for more details.
Clause: If df-root/df_complex-free.value < 1073741824 for 5 minutes Then escalate critical
- Name: rs high network tx activity
Description: Raise an alert if the amount of network data transmitted is too high. This alert may be modified or
cloned on an instance to match the actual network interfaces that are present. See the RL10 Linux Setup Alerts
RightScript (rll/setup-alerts.sh) for more details.
Clause: If interface-eth0/if_octets.tx > 10000000 for 10 minutes Then escalate critical
- Name: rs high network rx activity
Description: Raise an alert if the amount of network data received is too high. This alert may be modified or cloned
on an instance to match the actual network interfaces that are present. See the RL10 Linux Setup Alerts
RightScript (rll/setup-alerts.sh) for more details.
Clause: If interface-eth0/if_octets.rx > 50000000 for 30 minutes Then escalate critical
- Name: rs low swap space
Description: Raise alert if the free swap space is too low. This alert may be removed from an instance if swap is
not enabled. See the RL10 Linux Setup Alerts RightScript (rll/setup-alerts.sh) for more details.
Clause: If swap/swap-free.value < 104857600 for 5 minutes Then escalate critical
- Name: rs memory low
Description: Raise an alert if free memory is too low.
Clause: If memory/memory-free.value < 1000000 for 1 minutes Then escalate critical
- Name: rs out of memory
Description: Raise an alert when the server is out of free memory.
Clause: If memory/memory-free.value == 0 for 1 minutes Then escalate critical