Costin Stefan

Welcome to my blog. You will find useful random stuff, mostly IT infra-related.

How to automate testing webapps

For today’s post I will walk you through the process of setting up a web-app testing environment automatically using ansible. I will split this into 2 parts. First part will focus on creating the automation needed to deploy the containers on proxmox. Second part is about creating the tester tool solution. Assumption: you already have a proxmox server in place. your ansible controller has passwordless ssh access enabled to the proxmox server....

June 4, 2024 · 4 min · 647 words · costin

How to get display monitor serial number from PowerShell

This is a quick one, I had to get the SN of my external screens recently and I thought I should share the powershell command I used for this task. This works only on your local machine, for AD nodes there are other options out there on the internet. Get-WmiObject WmiMonitorID -Namespace root\wmi |Select-Object @{l="Manufacturer";e={[System.Text.Encoding]::ASCII.GetString($_.ManufacturerName)}},@{l="Model";e={[System.Text.Encoding]::ASCII.GetString($_.UserFriendlyName)}},@{l="SerialNumber";e={[System.Text.Encoding]::ASCII.GetString($_.SerialNumberID)}} This should return something like this: PS C:\Users\costin> Get-WmiObject WmiMonitorID -Namespace root\wmi |Select-Object @{l="Manufacturer";e={[System.Text.Encoding]::ASCII.GetString($_.ManufacturerName)}},@{l="Model";e={[System.Text.Encoding]::ASCII.GetString($_.UserFriendlyName)}},@{l="SerialNumber";e={[System.Text.Encoding]::ASCII.GetString($_.SerialNumberID)}} Manufacturer Model SerialNumber ------------ ----- ------------ HPN HP E243i 6CM90XXXX HPN HP E223 3CQXXXXX

April 24, 2024 · 1 min · 83 words · costin

PostgreSQL performance test script

In case you want to run a quick performance test (in simple terms of access to DB) on a PostgreSQL server, this can be done quickly through a python module called psycopg2. This is the python script I’ve used: #!/usr/bin/python3 import psycopg2 from psycopg2 import Error import time def create_connection(): """ create a database connection to a PostgreSQL database """ try: conn = psycopg2.connect( database="postgres", user="postgres", password="postgres", host="", port="5432" ) print('Successfully Connected to PostgreSQL') return conn except Error as e: print(e) def check_table_exists(conn): """ check if a table exists in the PostgreSQL database """ cur = conn....

April 24, 2024 · 2 min · 366 words · costin

How to fix "Could not connect to one or more vCenter Server"

Recently I had to fix a vCenter Server that was stopped working. The webpage displayed the following error, and the automated backup jobs stopped working. Could not connect to one or more vCenter Server systems: https://$VCENTER_FQDN:443/sdk The version is rather old and end of life (6.7), so VMware support was out of the question. Which means I had to do it all by myself. Great… After checking the logs for obvious errors, I’ve noticed that most services were stopped....

September 28, 2023 · 6 min · 1088 words · costin

How to move artefacts in a Jfrog repository

This one will be a quick one. Recently I had to move several hundred artefacts from a Jfrog repo folder up one level. Easy peasy, right? But the problem was that manual work from GUI would take forever and my work time is limited so I had to find a different way. For this I’ve used an API call because I didn’t have access to jfrog cli tool. But the API call works for one file, not for a bulk move....

September 28, 2023 · 2 min · 237 words · costin