Exemple #1
0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

# Only required for more convenient local development.

import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__))+'/lib')


from cloudagents import CloudAgent

ca = CloudAgent()

ca.required_config = {
	"name": "S3 to Swift Sync",
	"version": "0.2.0",
	"author": "Jeff Kramer",
	"url": "http://www.hpcloud.com/",
	"help": """This script copies files from S3 to Swift which don't exist in Swift.""",
	"config":
		[{
			"name": "s3bucket",
			"regexp": "^.{1,100}$",
			"title": "S3 Bucket",
			"description": "Bucket in s3 to copy from.",
			"type": "string",
			"required": True
Exemple #2
0
#    You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__))+'/lib')

from cloudagents import CloudAgent

ca = CloudAgent()

ca.required_config = {
	"name": "Web Page Change Check",
	"version": "0.1.0",
	"author": "Jeff Kramer",
	"url": "http://www.hpcloud.com/",
	"help": """This script notifies a user if a web page content changes.""",
	"config":
		[{
			"name": "url",
			"regexp": "^.+$",
			"title": "URL",
			"description": "HTTP or HTTPS URL to check.",
			"type": "string",
			"required": True
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

# Only required for more convenient local development.

import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__))+'/lib')


from cloudagents import CloudAgent
import keystoneclient.v2_0
import novaclient.v1_1
import time

ca = CloudAgent()

ca.required_config = {
	"name": "Rolling Server Backup",
	"version": "0.1.0",
	"author": "Jeff Kramer",
	"url": "http://www.hpcloud.com/",
	"help": """This script cycles backups for a selected server.""",
	"config":
		[{
			"name": "name",
			"regexp": "^.{1,50}$",
			"title": "Server Name",
			"description": "Name of the server to backup.",
			"type": "string",
			"required": True,
Exemple #4
0
#      http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

# Only required for more convenient local development.

import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/lib')

from cloudagents import CloudAgent

ca = CloudAgent()

ca.required_config = {
    "name":
    "S3 to Swift Sync",
    "version":
    "0.2.0",
    "author":
    "Jeff Kramer",
    "url":
    "http://www.hpcloud.com/",
    "help":
    """This script copies files from S3 to Swift which don't exist in Swift.""",
    "config": [{
        "name": "s3bucket",
        "regexp": "^.{1,100}$",
Exemple #5
0
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__))+'/lib')

from cloudagents import CloudAgent
from time import sleep

ca = CloudAgent()

ca.required_config = {
	"name": "Wringer",
	"version": "0.1.0",
	"author": "Jeff Kramer",
	"url": "http://www.hpcloud.com/",
	"help": """This script does integration testing.""",
	"config":
		[{
			"name": "count",
			"regexp": "^\d+$",
			"title": "Count",
			"description": "Number to count down from.",
			"type": "string",
			"required": True
Exemple #6
0
#    See the License for the specific language governing permissions and
#    limitations under the License.

# Only required for more convenient local development.

import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/lib')

from cloudagents import CloudAgent
from keystoneclient.v2_0 import client
import swiftclient
from time import mktime
import datetime
import parsedatetime.parsedatetime as pdt

ca = CloudAgent()

ca.required_config = {
    "name":
    "Email File",
    "version":
    "0.1.0",
    "author":
    "Jeff Kramer",
    "url":
    "http://www.hpcloud.com/",
    "help":
    """This script sends an alert to a user including a file from a swift container.""",
    "config": [
        {
            "name": "region",
Exemple #7
0
# Only required for more convenient local development.

import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__))+'/lib')


from cloudagents import CloudAgent
from keystoneclient.v2_0 import client
import novaclient
import swiftclient
from time import mktime
import datetime
import parsedatetime.parsedatetime as pdt

ca = CloudAgent()

ca.required_config = {
	"name": "File Existence Checker",
	"version": "0.2.0",
	"author": "Jeff Kramer",
	"url": "http://www.hpcloud.com/",
	"help": """This script checks to see if a file exists inside of a swift container.  It also has functions to allow for searching for files named on relative dates, daily backups for instance.""",
	"config":
		[{
			"name": "region",
			"regexp": "^.{1,50}$",
			"title": "Region",
			"description": "Short name for the object storage endpoint region to search.  IE: region-a.geo-1",
			"type": "string",
			"required": True,
Exemple #8
0
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/lib')

from cloudagents import CloudAgent
from keystoneclient.v2_0 import client
import novaclient
import swiftclient
from time import mktime
import datetime
import urllib2
import Image
import StringIO
import re
from collections import defaultdict
import ExifTags

ca = CloudAgent()

ca.required_config = {
    "name":
    "Image Gallery",
    "version":
    "0.1.0",
    "author":
    "Jeff Kramer",
    "url":
    "http://www.hpcloud.com/",
    "help":
    """This script looks for jpg/png files in a container, thumbnails them into another public container and creates html contact sheets for each directory.""",
    "config": [
        {
            "name": "region",
Exemple #9
0
import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__))+'/lib')


from cloudagents import CloudAgent
from keystoneclient.v2_0 import client
import swiftclient
import novaclient.v1_1
import json
import urllib2
from collections import defaultdict
import StringIO
import csv

ca = CloudAgent()

ca.required_config = {
	"name": "Usage Change",
	"version": "0.1.0",
	"author": "Jeff Kramer",
	"url": "http://www.hpcloud.com/",
	"help": """This script audits what resources you're using across the cloud, and sends you a notification with details and changes.""",
	"config":
		[
		]
	}

def agent():
	
	ca.log("Starting!")
Exemple #10
0
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

# Only required for more convenient local development.

import sys, os

sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/lib')

from cloudagents import CloudAgent
import urllib2
import json

ca = CloudAgent()

ca.required_config = {
    "name":
    "Relay",
    "version":
    "0.1.0",
    "author":
    "Jeff Kramer",
    "url":
    "http://www.hpcloud.com/",
    "help":
    """This agent schedules another single run task some time in the future with the same name, interval, etc.  It's a demo for agents interacting directly with the agents service.""",
    "config": [{
        "name": "interval",
        "regexp": "^\d+$",
Exemple #11
0
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

# Only required for more convenient local development.

import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__))+'/lib')

from cloudagents import CloudAgent
import urllib2
import json

ca = CloudAgent()

ca.required_config = {
	"name": "Relay",
	"version": "0.1.0",
	"author": "Jeff Kramer",
	"url": "http://www.hpcloud.com/",
	"help": """This agent schedules another single run task some time in the future with the same name, interval, etc.  It's a demo for agents interacting directly with the agents service.""",
	"config":
		[{
			"name": "interval",
			"regexp": "^\d+$",
			"title": "Interval",
			"description": "Time between agent executions.",
			"type": "string",
			"required": True
Exemple #12
0
import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__))+'/lib')


from cloudagents import CloudAgent
import time
from datetime import datetime
from twython import Twython
from twython import TwythonError
from keystoneclient.v2_0 import client
import swiftclient
from operator import itemgetter
import json

ca = CloudAgent()

ca.required_config = {
	"name": "Twitter Backup",
	"version": "0.2.0",
	"author": "Jeff Kramer",
	"url": "http://www.hpcloud.com/",
	"help": """This script grabs tweets from twitter and saves them into object storage.""",
	"config":
		[{
			"name": "screen_name",
			"regexp": "^.{1,50}$",
			"title": "Screen Name",
			"description": "Twitter screen name to backup.",
			"type": "string",
			"required": True
Exemple #13
0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

# Only required for more convenient local development.

import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__))+'/lib')

from cloudagents import CloudAgent
from time import sleep

ca = CloudAgent()

ca.required_config = {
	"name": "Count Up",
	"version": "0.1.0",
	"author": "Jeff Kramer",
	"url": "http://www.hpcloud.com/",
	"help": """This script counts up from 0 by the count number given, storing the end number in a datastore.  If the datastore contains a number, it starts there instead of 0.""",
	"config":
		[{
			"name": "count",
			"regexp": "^\d+$",
			"title": "Count",
			"description": "Number to count up.",
			"type": "string",
			"required": True
Exemple #14
0
import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__))+'/lib')


from cloudagents import CloudAgent
import keystoneclient.v2_0
import novaclient.v1_1
from ssh import SSHClient, AutoAddPolicy, RSAKey
import random
import time
import StringIO
import urllib2
import re

ca = CloudAgent()

ca.required_config = {
	"name": "Apache Install",
	"version": "0.2.0",
	"credentials": True,
	"author": "Jeff Kramer",
	"url": "http://www.hpcloud.com/",
	"help": """This script creates a new VM and installs Apache 2 on it.""",
	"config":
		[{
			"name": "name",
			"regexp": "^.{1,50}$",
			"title": "Server Name",
			"description": "Name for the new server.",
			"type": "string",
Exemple #15
0

from cloudagents import CloudAgent
from keystoneclient.v2_0 import client
import novaclient
import swiftclient
from time import mktime
import datetime
import urllib2
import Image
import StringIO
import re
from collections import defaultdict
import ExifTags

ca = CloudAgent()

ca.required_config = {
	"name": "Image Gallery",
	"version": "0.1.0",
	"author": "Jeff Kramer",
	"url": "http://www.hpcloud.com/",
	"help": """This script looks for jpg/png files in a container, thumbnails them into another public container and creates html contact sheets for each directory.""",
	"config":
		[{
			"name": "region",
			"regexp": "^.{1,50}$",
			"title": "Region",
			"description": "Short name for the source object storage endpoint region.",
			"type": "string",
			"required": True,
Exemple #16
0
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

# Only required for more convenient local development.

import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/lib')

from cloudagents import CloudAgent
import keystoneclient.v2_0
import novaclient.v1_1
import time

ca = CloudAgent()

ca.required_config = {
    "name":
    "Rolling Server Backup",
    "version":
    "0.1.0",
    "author":
    "Jeff Kramer",
    "url":
    "http://www.hpcloud.com/",
    "help":
    """This script cycles backups for a selected server.""",
    "config": [{
        "name": "name",
        "regexp": "^.{1,50}$",
Exemple #17
0
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

# Only required for more convenient local development.

import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/lib')

from cloudagents import CloudAgent
import keystoneclient.v2_0
import novaclient.v1_1
import time

ca = CloudAgent()

ca.required_config = {
    "name":
    "Server Resize",
    "version":
    "0.1.0",
    "author":
    "Jeff Kramer",
    "url":
    "http://www.hpcloud.com/",
    "help":
    """This script resizes a server by snapshotting it, creating a new larger server with the snapshot, and moving the floating IP.""",
    "config": [{
        "name": "name",
        "regexp": "^.{1,50}$",
Exemple #18
0
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

# Only required for more convenient local development.

import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__))+'/lib')


from cloudagents import CloudAgent
import keystoneclient.v2_0
import novaclient.v1_1
import time

ca = CloudAgent()

ca.required_config = {
	"name": "Server Resize",
	"version": "0.1.0",
	"author": "Jeff Kramer",
	"url": "http://www.hpcloud.com/",
	"help": """This script resizes a server by snapshotting it, creating a new larger server with the snapshot, and moving the floating IP.""",
	"config":
		[{
			"name": "name",
			"regexp": "^.{1,50}$",
			"title": "Server Name",
			"description": "Name of the server to resize.",
			"type": "string",
			"required": True,
Exemple #19
0
#    See the License for the specific language governing permissions and
#    limitations under the License.

# Only required for more convenient local development.

import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__))+'/lib')

from cloudagents import CloudAgent
from keystoneclient.v2_0 import client
import swiftclient
from time import mktime
import datetime
import parsedatetime.parsedatetime as pdt

ca = CloudAgent()

ca.required_config = {
	"name": "Email File",
	"version": "0.1.0",
	"author": "Jeff Kramer",
	"url": "http://www.hpcloud.com/",
	"help": """This script sends an alert to a user including a file from a swift container.""",
	"config":
		[{
			"name": "region",
			"regexp": "^.{1,50}$",
			"title": "Region",
			"description": "Short name for the object storage endpoint region to search.  IE: region-a.geo-1",
			"type": "string",
			"required": True,
Exemple #20
0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

# Only required for more convenient local development.

import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__))+'/lib')

from cloudagents import CloudAgent
from time import sleep

ca = CloudAgent()

ca.required_config = {
	"name": "Countdown Timer",
	"version": "0.1.0",
	"author": "Jeff Kramer",
	"url": "http://www.hpcloud.com/",
	"help": """This script counts down from count to 0, returning a message per second.""",
	"config":
		[{
			"name": "count",
			"regexp": "^\d+$",
			"title": "Count",
			"description": "Number to count down from.",
			"type": "string",
			"required": True
Exemple #21
0
#    limitations under the License.

# Only required for more convenient local development.

import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/lib')

from cloudagents import CloudAgent
from keystoneclient.v2_0 import client
import novaclient
import swiftclient
from time import mktime
import datetime
import parsedatetime.parsedatetime as pdt

ca = CloudAgent()

ca.required_config = {
    "name":
    "File Existence Checker",
    "version":
    "0.2.0",
    "author":
    "Jeff Kramer",
    "url":
    "http://www.hpcloud.com/",
    "help":
    """This script checks to see if a file exists inside of a swift container.  It also has functions to allow for searching for files named on relative dates, daily backups for instance.""",
    "config": [
        {
            "name": "region",
Exemple #22
0
# Only required for more convenient local development.

import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/lib')

from cloudagents import CloudAgent
import keystoneclient.v2_0
import novaclient.v1_1
from ssh import SSHClient, AutoAddPolicy, RSAKey
import random
import time
import StringIO
import urllib2
import re

ca = CloudAgent()

ca.required_config = {
    "name":
    "Apache Install",
    "version":
    "0.2.0",
    "credentials":
    True,
    "author":
    "Jeff Kramer",
    "url":
    "http://www.hpcloud.com/",
    "help":
    """This script creates a new VM and installs Apache 2 on it.""",
    "config": [{