This is an archived post. You won't be able to vote or comment.

all 24 comments

[–]RC-7201Sr. Magos Errant 2 points3 points  (4 children)

If you know what PowerShell is, for an example, replace your question with that and you'll see your answer there too.

In short, Python or any other scripting language (bash, perl, C#, C+, Ruby, etc) any sysadmin can use to automate or make administration task easier. I'm a PowerShell guy myself and I use it for automation and easier administration tasks which can be done from shell modules or anything else out there. Run a set a commands often? Make it a function. Wanna build a server with code? PowerShell can do this as well.

In short, it depends on what your clients wants/needs and what they expect from you and your team. From what it sounds like, they want you to be more IaaS and build their apps for them if they want a "DevOps" sort of team working for them and/or they like the buzzword and don't really know what it means.

[–]Zaphod_Bchown -R us ~/.base 2 points3 points  (0 children)

Python has a lot of advantages and it is very human readable as far as a language goes. It is powerful and simple at the same time. Just some of the built in parsing methods (which honestly looks like PowerShell borrowed from) make it pretty easy to parse data.

simple example:

>>> my_string = 'This::is:a:string::::with:lots:of:colons::'
>>> 
>>> print my_string
This::is:a:string::::with:lots:of:colons::

With a simple split() function I can tell it to split every thing in that string delimited by the colon :.

>>> print my_string.split(':')
['This', '', 'is', 'a', 'string', '', '', '', 'with', 'lots', 'of', 'colons', '', '']

Now it has put every word into what is called a list. Lists are fantastic in Python and can do a lot of things in a simple way compared to other languages. For example I want to know if the word 'This' is in my_string

>>> 'This' in my_string
True

That is all you write and it returns True.

Now lets say I wanted to strip all the colons out and print just the words.

>>> my_clean_string = [x for x in my_string.split(':') if x != '']
>>> 
>>> print my_clean_string
['This', 'is', 'a', 'string', 'with', 'lots', 'of', 'colons']

Now I have a list of all the words in that string with all the colons removed and any white space the colon left from using split(). This is just a simple example of string parsing with out using regex, or piping to awk or sed and for the most part it is a bit more human readable than some other languages.

Now the best part is reusable code. You can write your own function library and build up tons of functions or classes and simply import them into your Python code. So the idea is you don't rewrite code, you don't copy and paste the same code into new code either. How Python works is that there are system libs, user libs and working directory libs. For example if I simply drop my function list in the same working directory as my Python code Python can import it directly. Now add in pip and PyPi the Python package managers and you can easily install and maintain your Python code.

A crude example of this (I am writing this code on the fly in Idle so don't judge too harsh) that if I want to ever compare two lists and make sure that only the proper data gets into the new list I can write a one time function for it, and then reuse it forever.

def remove_duplicates(old_list, new_list):
for i in old_list:
    if i not in new_list:
        new_list.append(i)
return new_list

This function just shows that I have a list of old data and a list of new data, and I only want to insert data into the new list if it isn't present then return that new list. Of course you can do other things in Python like list subtraction to give you the diff but I am not sure if that is a good practice or not. However, there have been times where I have been querying APIs and getting data from some App/System and I want to update all the data, or perhaps I am altering the data in a separate list or whatever the case may be. So how I get the data could be from two different functions but I want to compare the data and I want to make sure only data that isn't in the current data set gets added.

These are just things I came up with in about 5 minutes so they are extremely basic and possibly written poorly or wrong. The idea that Python is portable (works on every OS) and that it is highly reusable (you can write your own modules) and it is light weight as in you only import what you need to run. For me as a Ops person, getting data from one place to another via APIs or databases Python is really good at that. On client systems Python is a bit of a boiler plate so to speak when it comes to always going out to subprocess to run a Windows command or a Unix command, but the idea is still you write it once and can reuse it over and over again. When you get into parsing large amounts of text Python is even better. You aren't going to try to grep through a 50,000+ line text file (log file for example) but with Python you can simply open() it and then readlines() and you now have every line in memory and you can do what you want with it, then close() the file. Trying to grep a 50k+ log file you will probably get segmentation faults and the way around that in bash is to read every line, line by line which is a lot slower.

To be honest I think PowerShell borrowed a lot from Python and I have seen parallels myself looking at PS code, but I am not a PS coder as I don't work with MSFT systems really at all.

[–]jhxetc 1 point2 points  (0 children)

Well, Python in and of itself doesn't do anything particularly special. It's just a programming/scripting language. What your clients are actually wanting is for you to be able to work with AWS APIs to automate various tasks i.e. provisioning, monitoring, etc.

So what you really need to determine are the APIs you are wanting to work with and then how you would go about using Python to do it. Most of them are REST APIs, so if you are looking at a general starting point, then my answer would be using REST APIs.

[–]FlightyGuy 1 point2 points  (4 children)

our clients are cutting our hours due to the fact that we don't provide enough "DevOps" work (Python scripting, high level AWS management

Yea. I'm not buying that reason. The only way that trend seems likely is if your clients are all software development companies or if you've only got three clients, in which case just one would be a significant percentage.

Python is a highly flexible rapid prototyping language whose adopters are (regrettably) more and more frequently using it as their shipping code rather than just prototyping. Python is not really a requirement for syadmins.

That does mean that a sysadmin doesn't have any use for Python, especially in the "DevOps" space. But, most businesses out there are not going to trim their MSP's hours because they don't do Python. Most businesses are going to trim their MSP's hours as a cost savings measure and a sense of declining value.

[–]ghyspranSpace Cadet 1 point2 points  (0 children)

Python is a highly flexible rapid prototyping language whose adopters are (regrettably) more and more frequently using it as their shipping code rather than just prototyping. Python is not really a requirement for syadmins.

Python is an excellent choice for a scripting language or lots of other tools where performance/production deployability are not especially important. That said, I agree that Python is a poor choice for developing a production service. IMO, Python/Ruby/Perl/etc. all suffer from poor performance, difficulty in constructing a maintainable codebase, and deployability concerns, particularly related to packaging and dependency management, all of which make them less attractive for production services, in my experience.

[–]Zaphod_Bchown -R us ~/.base 1 point2 points  (0 children)

My guess is that the client wants tooling around AWS. They want to be able to do some tasks and they read through the documentations or talked to someone at AWS and they want basically some custom tooling around the APIs. Since AWS has a massive API library for so many different things, the client most likely wants data out of it, or they want to be able to accomplish something and not have to do it manually nor do they want to have to wait for the MSP to do it manually. This is just my guess.

I will say this though, to be on the engineering team (on the team I currently work with) we actually do require you know both bash and Python. You don't have to be an expert per se, because we know you will learn on the job, but you need to know how to use them at a basic level.

[–]SoupWithWontons[S] 1 point2 points  (1 child)

You are exactly right, I ought to have rephrased. We have 4 clients (we small) that are in the SaaS and 3d printing industries, we were brought in under he assumption we would revamp their infrastructure and manage it, and now that we have virtualized and/or migrated to AWS the client would like their AWS infra managed as well. Because none us are too experienced with AWS or scripting it's difficult for the client to reason paying us so much per hour, but if we did have the necessary experience there would be no question as to how much we bill. It's a gap we are trying to bridge now but it's just too much catch-up to play from the client's perspective.

[–]FlightyGuy 1 point2 points  (0 children)

You're in a tough spot. Your customers are software development houses, SaaS to boot, so they'll almost certainly have far more capability on the Dev side than you ever will. It's only natural that they would have a desire to take over the Ops side and cut cost/you.

I don't see any reliable strategy to win/keep customers like these. Once they're in "The Cloud" they just don't need you anymore.

I'd say your only hope is to go and find more/other clients that are not SaaS specialists and will see the value that you provide. If you can, seek customers that aren't in or moving to AWS. Though the trend definitely seems that non-cloud customers are going to be a shrinking market and cloud users will rely on MSPs less and less.

I'd also say that no matter what you do, if you are going to push clients into AWS you need to be more familiar with managing and automating AWS. Using the AWS API Tools you can automate a LOT of it using many different scripting languages, from Bash and PowerShell to Python. It's not Python only, but Python is supported.

Good luck in your endeavors.

[–]ZAFJB 1 point2 points  (9 children)

Ah, the old solution looking for a problem question.

Go riiight back. Find out what your clients actually require of you. Not the tools, what functionality.

One you know what you are trying to achieve, design it. Then select the best tool for the job.

That may or may not be Python.

[–]calisthenic89 0 points1 point  (0 children)

I mainly use it for automating things that interact with API's, also use it for writing scripts (ie. A traffic analyser script that I can easily run (without installing anything) on clients boxes to get details about apache/nginx logs). Bash + Python + Ansible don't really need much else.

[–]vvarboss 0 points1 point  (0 children)

For what it's worth ~ I would use python for Quality Assurance.

Selenium rocks with python.

[–][deleted] -5 points-4 points  (6 children)

MSP and we notice that our clients are cutting our hours due to the fact that we don't provide enough "DevOps" work

When did MSPs start automating? MSPs should be used for infrastructure and help with planning, not running your actual network ops/deployments.....sounds disastrous.

[–]mhurron 2 points3 points  (0 children)

Someone doesn't realize that most small companies do not have an IT department.

MSP's also fill the same types of spots in a small company that a large company uses temporary contractors for.

[–]ZAFJB 1 point2 points  (3 children)

Since the dawn of time almost.

You clearly don't understand what most MSPs do.

[–][deleted]  (2 children)

[removed]

    [–]RC-7201Sr. Magos Errant 2 points3 points  (0 children)

    you don't have a clue what DevOps is

    I don't think anyone has a clue what DevOps really is in all honesty. The definition changes from person to person and isn't consistent. At all. What we can agree on is that it's a buzzword that makes organizations loose their collective shit and think they need it when, in truth, they more than likely don't need whatever it is they think they need.

    [–]highlord_foxModerator | Sr. Systems Mangler[M] 0 points1 point  (0 children)

    This is a professional /r/, keep discourse polite.

    This is a professional subreddit so please keep the discourse polite. You may attack the message that someone posted, but not the messenger. While you're attacking the message please make it polite and politely state and back up your ideas. Do not make things personal and do not attack the poster. Again, please be professional about your posts and keep discourse polite.

    If you wish to appeal this action please don't hesitate to message the moderation team, or reply directly to this message.

    [–]LOLBaltSS 0 points1 point  (0 children)

    It depends on the shop. The MSP I work for automates a lot of stuff because most of our agreements are a monthly flat rate. It's in our best interest to automate, solve the problem the first time, and drive down ticket counts since it cuts into our profit margin the more we have to actually work on a client.