Amazon Autoscaling trigger not working, how do I debug it? - python

I'm trying to use autoscaling to create new EC2 instances whenever average CPU load on existing instances goes high. Here's the situation:
I'm setting up autoscaling using this boto script (with keys and image names removed). http://balti.ukcod.org.uk/~francis/tmp/start_scaling_ptdaemon.nokeys.py
I've got min_size set to 2, and the AutoScalingGroup correctly creates an initial 2 instances, which both work fine. I'm pretty sure this means the LaunchConfiguration is right.
When load goes up to nearly 100% on both those two instances, nothing happens.
Some questions / thoughts:
Is there any way of debugging this? I can't find any API calls that give me detals of what Autoscaling is doing, or thinks it is doing. Are there any tools that give feedback either on what it is doing, or on whether it has set things up correctly?
It would be awesome if Autoscaling appeared in the AWS Console.
I'm using EU west availability zone. Is there any reason that should cause trouble with Autoscaling?
Is there any documentation of the "dimensions" parameter when creating a trigger? I have no idea what it means, and have just copied its fields from an example. I can't find any documentation about it that doesn't self-referentially say it is a "dimension", without explaining what that means or what the possible values are.
Thanks for any help!

I'm sure you've already found these and it would be good to use AWS tool first before the Python tool to get the idea.:)
http://ec2-downloads.s3.amazonaws.com/AutoScaling-2009-05-15.zip
http://docs.amazonwebservices.com/AutoScaling/latest/DeveloperGuide/
Cheers,
Rodney

Also, take a look at something like http://alestic.com/2011/11/ec2-schedule-instance for a simple example of how to use the tools with a demo script provided.

Related

How to check for available space in Elasticsearch with Python

I am completely new to Python but I need make a script that will check the Elasticsearch disk space on AWS and return a warning if it is below a certain threshold. I imagine I would have to create a client instance of Elasticsearch, create a dictionary for the search query to search for space available? But I'm honestly not sure. I'm really hoping someone can provide a starter code syntax to kind of push me in the right direction.
You use CloudWatch metrics for that, e.g.:
FreeStorageSpace
ClusterUsedSpace

Pyattck | Use a File or Variable to Query Att&ck FW

This may end up being super silly but I'm using the Pyattck API to interact with the Mitre framework. It seems simple enough and what I need is very simple.
I have a list of Mitre Enterprise Technique IDs (maybe 40 or so) and I need to turn them into Tactic IDs and Tactic Names. The below code is a demonstration of doing that with the data that's already there and I get the results I want, for the most part, but I want to know how do I do this with my file or a variable (or even hardcoding the list)??
I've looked all through the documentation and there is nothing there or on the internet explaining how to do this. I take it as being a simple thing that my inexperience in coding is causing me to fail miserably on. I appreciate the help.
from pyattck import Attck
attack = Attck()
for technique in tactic.techniques:
print(technique.id)
print(technique.name)
for tactic in technique.tactics:
print(tactic.id)
print(tactic.name)
You can change the configurations. Please look at
https://github.com/swimlane/pyattck
in configuration section. You can give your file path and read the file from the path and then do your stuff.

How can I retrieve Proxmox node notes?

I am using proxmoxer to manipulate machines on ProxMox (create, delete etc).
Every time I am creating a machine, I provide a description which is being written in ProxMox UI in section "Notes".
I am wondering how can I retrieve that information?
Best would be if it can be done with ProxMox, but if there is not a way to do it with that Python module, I will also be satisfied to do it with plain ProxMox API call.
The description parameter is only a message to show in proxmox UI, and it's not related to any function
You could use https://github.com/baseblack/Proxmoxia to get started, I asked this very same question on the forum as I need to generate some reports from a legacy system with dozens of VMs (and descriptions).
Let me know if you still need this, perhaps we can collaborate on it.

How to get default component through jira-python

I have been trying to programatically retrieve the default component set for a JIRA project with little success.
Currently, I have tried
jira.createmeta('PROJ_NAME')
and
jira.project('PROJ_NAME')
Trying to understand the API output is troubling. I believe it might not be possible but I atleast want to confirm this before making this final assumption.
Is there an easy way to retrieve what component was set as the default in the jira-python api?
For reference:
https://jira-python.readthedocs.org/en/latest/
As far as I know - and I am pretty sure about that, it is not possible to define a default component for a project.
Maybe there are workarounds with post transition functions but this is not an out-of-the-box feature.
Hence it`s not possible to get this information through any API!

Documentation for python base classes?

This has got to be a silly question... but googling didn't actually help. Extra kudos for pycharm enabled answers. :)
I need a simple little UDP echo server (spare me the twisted advertisements please, this is a throw away thing, I just need to use it to peek at what a little embedded gadget is broadcasting). So I find section 21.21 of the Python 3 reference manual. It's a simple example that does exactly what I want.
But the same document also mentions a DatagramRequestHandler class. But there's no further explanation on how that differs from its parent class, or what it provides. I had really hoped that when I imported said class, that pycharm would somehow display a helpful popup for it, but I'm unable to discover such a thing.
Do I assume correctly, that I should just go find the source in my (macosx) install and look directly at that? is there a pattern for how people do that? My actual question here, is actually less about DatagramRequestHandler, and more about the general pattern, because this obviously will happen else where in the base docs.
(context: my traditional experience is with Smalltalk image based environments, where you can always just jump from class to class to class, and navigate quickly from application code all the way to the bowels, as a sort of exploratory way of learning and discovery)
There is an option to navigate to the declaration of the name under your cursor, Navigate->Declaration (shortcut CTRL+b in my keymap).
If you have such a question there are three things to do:
google it (eg. python DatagramRequestHandler)
use the help function in a interactive python session. eg.
import socketserver; help(socketserver.DatagramRequestHandler)
look into the code
Most of the time the first option is enough (this time I found only something in german). The result from the second option is in this "example" not so interesting or useful. So you have to use try third option.

Categories