Posts

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]

Poll Mailbox Trigger In Jenkins

 By this jenkins poll mailbox plugin will read inbox and trigger the needed flow. plugin name     =      Poll Mailbox Trigger configuration for plugin in jenkins job :- ================================================= username=bot@xyz.com # Connection configuration storeName=imap # Search configuration folder=INBOX/OCP subjectContains=[Alerting] Nodes that NOT on "Ready" receivedXMinutesAgo=5 # JavaMail configuration mail.debug=true mail.debug.auth=true mail.imaps.host=<above_host> mail.imap.port=143 mail.imaps.ssl.trust=* ================================================= then in execute shell section use this plugin`s variable..i.e :- #!/bin/bash +x echo $pmt_content  > /self-heal/Node_Ready/log.html /usr/bin/html2text /self-heal/Node_Ready/log.html > /self-heal/Node_Ready/log.txt cat /self-heal/Node_Ready/log.txt | grep -i ocpd|cut -d"/" -f1 cat /self-heal/Node_Ready/log.txt | grep -i ocpd|cut -d"/" -f1 > /self-heal/Node_Ready/servers...

VC Sanity Via PowerCli

Use below powercli code to perform VC sanity :- =======================================================  Connect-VIServer -server <VC-NAME> -User "USER-NAME" -Password "PASSWORD" $x = "ClusterA,ClusterB,ClusterC,Cluster1,Cluster2,Cluster3"; $xs = $x.split(",") $ce = "Cluster1,Cluster2,Cluster3"; $ces = $ce.split(",") $ias = "ClusterA,ClusterB,ClusterC"; $iaas = $ias.split(",") $ds = foreach ($i in $xs){ get-cluster $i|Get-Datastore|where-object {$_ -notlike "*local*"}|where-object {$_ -notlike "*datastore*"}|select -ExpandProperty name} $ntpserver = "ntp1,ntp2,ntp3,ntp4" $ntpresult = foreach ($i in $xs){ get-cluster $i|Get-VMHost  | Where-Object {$_.Connectionstate -eq "Connected"} | Select-Object Name,Parent,@{N="NTPServer";E={($_ |Get-VMHostNtpServer) -join ","}}, @{N="ServiceRunning";E={(Get-VmHostService -VMHost $_ | Where-Objec...

Create Static HTML Page With CGI To Execute Shell Script

 Once we install httpd package on linux server , please set httpd.conf file as below :- ========================================================================= ServerTokens OS ServerRoot "/etc/httpd" PidFile run/httpd.pid Timeout 60 KeepAlive Off MaxKeepAliveRequests 100 KeepAliveTimeout 15 <IfModule prefork.c> StartServers       8 MinSpareServers    5 MaxSpareServers   20 ServerLimit      256 MaxClients       256 MaxRequestsPerChild  4000 </IfModule> <IfModule worker.c> StartServers         4 MaxClients         300 MinSpareThreads     25 MaxSpareThreads     75 ThreadsPerChild     25 MaxRequestsPerChild  0 </IfModule> Listen 80 LoadModule auth_basic_module modules/mod_auth_basic.so LoadModule auth_digest_module modules/mod_auth_digest.so LoadModule authn_file_module modules/mod_a...

Powercli : One-liners

Over the last few months I started learning Powercli and wrote different PowerCLI One-liners while working. I will add more in the list later on by updating this post. -           Get all VM names with powerstat in a cluster and export result to a csv :- Get-Cluster mycluster| Get-VM | select Name, PowerState |Export-CSV 'C:\Users\aj\Desktop\test.csv' -           Get a list of all VMs in a cluster and the datastore in which the VMs resides Get-Cluster | Get-VM | select name, @{N="Datastore";E={Get-Datastore -VM $_}} | sort name -           Get poweron VM names :- Get-VM | select name,powerstate | ?{$_.powerstat -match "PowerON"} -           Get vmware tools status :- Get-vm |% { get-view $_.id } | select Name, @{ Name=”Tools Status”; Expression={$_.guest.toolsstatus}}, @{ Name=”Tools Runnin...

Powercli : Connecting and disconnecting servers

Image
After installation of powercli on desktop now its time to start using it , for that you have to connect to a vCenter server or ESXi server. Connecting to a server If you are not  connected  to a vCenter or an ESXi server, you will get an error message if you try to run a PowerCLI cmdlet. Let's try to retrieve a list of all of your datacenters using the following command: PowerCLI C:\> Get-Datacenter The output of the preceding command is as follows: Get-Datacenter : 03/27/2017 12:37:36 PM Get-Datacenter Youare not currently connected to any servers. Please connect firstusing a Connect cmdlet. At line:1 char:1 + Get-Datacenter + ~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (:) [Get-Datacenter], ViServerConnectionException + FullyQualifiedErrorId :Core_BaseCmdlet_NotConnectedError,VMware.VimAutomation.ViCore.Cmdlets.Com You see that this gives  an error message. You first have to connect to a vCenter Server or...

Introduction to PowerCLI

Image
Have you ever had to create 100 virtual machines in a really short period of time, change a setting on all of your hosts, or make an advanced report for your boss to show how full the hard disks of your virtual machines are? If you have, you know that performing these tasks using the vSphere client will take a lot of time. This is where automation can make your job easier.  VMware vSphere PowerCLI  is a powerful  tool that can perform these tasks and much more. And the best thing is that it is free! VMware vSphere PowerCLI is a  command-line interface  distributed as a Microsoft Windows PowerShell snap-in. You can use PowerCLI to automate your vSphere hosts, virtual machines, virtual networks, storage, clusters, vCenter Servers, and more. Downloading and installing PowerCLI Before you can install PowerCLI, you have to download the PowerCLI installer from the VMware website. You will need a My VMware account to do this. Downloading PowerCLI ...