Need to write script for ESXi for fetching hardware info - python

One of my project requirement, I need to write script to fetch hardware info of esxi server remotely.
If some has explored python module pywbem for esxi or some other module.

Not in python, I got similar in powershell [answered in vmtn communities]
https://www.vmspot.com/collecting-esxi-host-hardware-information-with-powershell/
In this blog, mention script helps

Related

Which tools I could use for launching an instance in openstack with python script

Basically, I need to write a python script which takes arguments with argparser and launches instance of VM in openstack, optionally creates a disk tool and mounts it to VM.
I've tried to search for similiar scripts and found this , generally this should work out, but it is quite old and when I looked for PythonSDK documentation on openstack website and found many different clients and python api for that clients, which I should use?
Each OpenStack service has its own python client library, such as python-novaclient, python-cinderclient, python-glanceclient. They also provide user guides, e.g. How to use cinderclient, have a look and you will find out the answer.
Generally, I prefer trying command-line in terminal first, like cinder create --display-name corey-volume 10 or nova boot --image xxx --block-device source=volume,id=xxx corey-vm, to verify the command exists and the idea works, then change it to python code. If I don't know how to use it or get unexpected errors in the script, I will go to Github to check its source code, it really helps, especially in debugging.

Script that can automatically download new data from the server to my local backup

I have an application running on linux server and I need to create a local backup of it's data.
However, new data is being added to the application after every hour and I want to sync my local backup data with server's data.
I want to write a script (shell or python) that can automatically download new added data from the linux server to my local machine backup. But I am newbie to the linux envoirnment and don't know how to write shell script to achieve this.
What is the better way of achieving this ? And what would be the script to do so ?
rsync -r fits in your use case and it's a single line command.
rsync -r source destination
or the options you need according to your specific case.
So, you don't need a python script for that, but you can still write it and let it use the command above.
Moreover, if you want the Python script to do it in an automatic way, you may check the event scheduler module.
This depends on where and how your data is stored on the Linux server, but you could write a network application which pushes the data to a client and the client saves the data on the local machine. You can use sockets for that.
If the data is available via aan http server and you know how to write RESTful APIs, you could use that as well and make a task run on your local machine every hour which calls the REST API and handles its (JSON) data. Keep in mind that you need to secure the API if the server is running online and not in the same LAN.
You could also write a small application which downloads the files every hour from the server over FTP (if you want to backup files stored on the system). You will need to know the exact path of the file(s) to do this though.
All solutions above are meant for Python programming. Using a shell script is possible, but a little more complicated. I would use Python for this kind of tasks, as you have a lot of network related libraries available (ftp, socket, http clients, simple http servers, WSGI libraries, etc.)

Log in to Windows from a Python service?

I'm theory crafting a Python service which will manipulate domain joined machines into running tests as part of a suite. Details of requirements
We must be logged in as a domain user, and we must not have the automatic login enabled
We need to reboot machines a few times, so it's a requirement for this to be sustainable
I'm wondering if it's possible to, from a Python service, somehow convince Windows to log us in? Presumably a Python service runs in Session0, as does Microsoft's Hardware Certification Kit? If that's capable of doing it, Python should also be (so far as I can see).
Any suggestions most welcome, I've got a suspicion there's a cheeky Windows API call that does this, but can't seem to find it anywhere.
So I've found a way to do it from a Windows service (written in C++) and presumably the ctypes library will permit me to use it.
Simple as using LogonUser from Win32API so far as I can see. Yet to actually set up and test it but it does seem to be exactly what I need. The difficulty being that session0 can only be accessed once logged in or via some remote debugging, so getting something like this working is no easy feat.

How to pull information of virtual guests of a KVM host using Python?

I tried with libvirt. Unfortunately libvrt does not support KVM completely, and I have been constantly getting error messages and warnings stating, that it does not support the platform. Is there an alternate package or method that someone can suggest
Virtualbricks, CLI : http://www.virtualbricks.eu/
KVM-Admin, CLI : http://www.linux-kvm.org/page/Kvmtools
Ganeti, CLI : http://docs.ganeti.org/ganeti/current/html/
These three software are what you looking for : Python made and not based on libvirt.
I still using libvirt without any problem, so I maybe can help you with that.
the following script written by russel bartini may be helpful to you. this is a python script for managing, backup and restoring the VM running on KVM.
Here is the link :virt-back.py

Django without shell access

Is it possible to run django without shell access? My hoster supports the following for 5€/month:
python (I assume via mod_python)
mysql
There is no shell nor cronjob support, which costs additional 10€/month, so I'm trying to avoid it.
I know that Google Apps also work without shell access, but I assume that is possible because of their special configuration.
It's possible but not desirable. Having shell access makes it possible to centralise things properly using symlinks.
Get a better host would be my first suggestion. WebFaction is the most recommended shared host for using with Django.
If that's out of your price range, there are plenty of hosts that give you a proper system account (vs just a ftp account) and have mod_python or mod_wsgi (preferred now).
Google Apps works without shell because their system looks for a dispatcher script that you have to write to an exact specification.
It is possible.
Usually you will develop your application locally (where shell access is nice to have) and publish your work to your server. All you need for this is FTP access and some way to import a database dump from your development database (often hosters provide an installation of phpMyAdmin for this).
python (I assume via mod_python)
From my experience, you are most certainly wrong with that assumption. Many low-cost providers claim to support python but in fact provide only an outdated version that can be used with CGI scripts. This setup will have a pretty low performance for Django apps.

Categories