Posts

Testing

Automation benefits Automated processing of Excel files uploaded via web portal Python script runs automatically on server without manual intervention Generates output.html containing processed data and graphs Eliminates dependency on local Python environment and manual script execution Consistent and repeatable output generation Reduces human error in data processing Before (Manual) User had to manually run Python script (process_excel.py) on their local machine or server Required Python environment setup, pandas, matplotlib etc. installed locally Manual file handling, script execution, and output management Time-consuming and error-prone process Dependency on individual’s machine and Python knowledge After (Automation) User simply uploads Excel file via web portal (http://ap-vrahealth0001d.oneadr.net) Script runs automatically on Linux server Generates output.html with processed data and graphs User can instantly view or download the result No need to install Python or run script man...

esxcli random

 esxcli network vswitch standard policy failover set  --active-uplinks=vmnic0,vmnic1 -v vSwitch0 esxcli network vswitch standard portgroup add --portgroup-name=Prod-789  --vswitch-name=vSwitch0 esxcli network vswitch standard portgroup add --portgroup-name=Prod-787  --vswitch-name=vSwitch0 esxcli network vswitch standard portgroup set --portgroup-name=Prod-789 --vlan-id=789 esxcli network vswitch standard portgroup set --portgroup-name=Prod-787 --vlan-id=787 esxcli network vswitch standard portgroup add --portgroup-name=VMotion1 --vswitch-name=vSwitch0 esxcli network vswitch standard portgroup set --portgroup-name=VMotion1 --vlan-id=722 esxcli network ip interface add --interface-name=vmk1 --portgroup-name=VMotion1 esxcli network ip interface ipv4 set --interface-name=vmk1 --ipv4=10.232.x.x --netmask=255.255.254.0 --type=static vim-cmd hostsvc/vmotion/vnic_set vmk1 esxcli network ip dns search add --domain=corp.test.com esxcli network ip dns server add --server=10.19...

govc random

 #!/bin/sh export GOVC_URL='<VC URL>' export GOVC_USERNAME='<USERNAME>' export GOVC_PASSWORD='<PASSWORD>' export GOVC_INSECURE=1 export GOVC_DATACENTER=<DATACENTER> export no_proxy=IPs & DOMAIN date=`echo "'"$(date +%F)"'"` ################# Scan for ESXi / HW Data ####################################### for cluster in `govc ls /OpenShift/host/ | grep -v OLD | grep -v Maint|awk -F '/' '{print $4}'` do         for host in `govc ls /OpenShift/host/$cluster | grep -v Resources |awk -F '/' '{print $5}'`         do                 vendor=`echo "'"$(govc host.info /OpenShift/host/$cluster/$host | grep Manufacturer: |awk '{print $2}')"'"`                 memory=`expr  $(govc host.info /OpenShift/host/$cluster/$host | grep Memory:|awk -F 'MB' '{print $1}'|awk '{print $2}') / 1024`                 cpu...

Random One Liners

 /usr/sbin/rear -v mkbackup nfs://nas_name/linux_bkp/images  in  /etc/rear/local.conf blockdev --rereadpt /dev/sdb pvresize /dev/sdb free && sync && echo 3 > /proc/sys/vm/drop_caches && free echo 1 > /proc/sys/vm/drop_caches  echo 2 > /proc/sys/vm/drop_caches echo 3 > /proc/sys/vm/drop_caches date --set="$(ssh user@server date)" echo "body" | mailx -s "subject" test@hello.com for i in /var/spool/postfix/*;do echo $i; find $i |wc -l; done find /var/Secured_History -size  0 -print0 |xargs -0 rm zoneadm list -cv find / \( -fstype ext2 -o -fstype ext3 -o -fstype ext4 -o -fstype btrfs \) -exec setfattr -x security.selinux {} \; arp -a|grep SP timeout 1 bash -c 'cat < /dev/null > /dev/tcp/test_server/37410' append fastboot to kernel line to skip fsck ss -ln src :22 alternatives --display java find / -size +1000 -xdev -exec du -sh {} \;|sort -nk1 from jump to remote server = ssh test_server date -s @`( date -u...

F5 Health to postgrsql

 #!/bin/sh for cluster in `cat f5inventory` do clusterid=`echo $cluster |awk -F [/:-]  '{print $4}'` url=`echo https://$clusterid-master.test.com:8443/healthz` output=`curl -k  $url` if [ $output == ok ] then         stat=`echo "'"200"'"`         link=`echo "'"$url"'"`         PGPASSWORD=postgres psql -U postgres -d ocpinfra -h test_server -p 5432  -c "UPDATE f5 SET Status = $stat WHERE F5_URL=$link;" else         stat=`echo "'"400"'"`         link=`echo "'"$url"'"`         PGPASSWORD=postgres psql -U postgres -d ocpinfra -h test_server -p 5432  -c "UPDATE f5 SET Status = $stat WHERE F5_URL=$link;" fi done

Jenkins Job Cleanup

 def jobName = "Test Removal Job" def job = Jenkins.instance.getItem(jobName) job.getBuilds().each { it.delete() } job.nextBuildNumber = 1 job.save()

Grafana Setup

 [root@server grafana]# rpm -qa |grep -i grafana grafana-7.0.6-1.x86_64 [root@server grafana]# cat /etc/grafana/grafana.ini [paths] [server] [database] [remote_cache] [dataproxy] [analytics] [security] allow_embedding = true [snapshots] [dashboards] [users] [auth] [auth.anonymous] enabled = true org_name = Main Org. org_role = Viewer [auth.saml] # Enterprise only [auth.grafana_com] [auth.proxy] [auth.basic] [auth.ldap] enabled = false [smtp] enabled = true host = relay_host:25 user = testuser@gmail.com from_address = testuser@gmail.com from_name = Hello_World [emails] [log] filters = ldap:debug [log.console] [log.file] [log.syslog] [alerting] [explore] [metrics] [metrics.graphite] [tracing.jaeger] [grafana_com] [external_image_storage] [external_image_storage.s3] [external_image_storage.webdav] [external_image_storage.gcs] [external_image_storage.azure_blob] [external_image_storage.local] [rendering] [enterprise] [panels] disable_sanitize_html = true [plugins]