Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Nitish Kumar laymanstake

🎯
Focusing
View GitHub Profile
@laymanstake
laymanstake / PowerShellGUI.ps1
Last active November 26, 2022 15:20
Collection of PS functions for UI Elements
View PowerShellGUI.ps1
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Windows.Forms.DataVisualization
function New-SplashFromImage{
[CmdletBinding()]
Param(
[Parameter(ValueFromPipeline = $true,mandatory=$true)][String]$imageFilePath
)
Add-Type -AssemblyName System.Windows.Forms
@laymanstake
laymanstake / PrometheusGrafanaSetup.sh
Last active October 30, 2022 16:41
Bash script, which can download almost all the latest packages for Prometheus, Grafana and node Exporter and then proceed to configure them
View PrometheusGrafanaSetup.sh
#!/bin/bash
# Author : Nitish Kumar
# Download and Install Prometheus, Grafana and Node Exporter
# version 1.0 | 24/10/2022 Initial version
# version 1.1 | 25/10/2022 Removed sudo from inside the script, added remove-services function
PROMETHEUS_VERSION=$(curl -s https://raw.githubusercontent.com/prometheus/prometheus/master/VERSION)
NODE_VERSION=$(curl -s https://raw.githubusercontent.com/prometheus/node_exporter/master/VERSION)
@laymanstake
laymanstake / EmailAlert.ps1
Last active October 26, 2022 04:14
PowerShell Script, for sending Email alerts
View EmailAlert.ps1
# Author : Nitish Kumar
# Email Alert Function
# version 1.0 | 19/10/2022
# Function to send email
function EmailAlert () {
[CmdletBinding()]
param(
[parameter(mandatory=$true)]$RecipientAddressTo,
[parameter(mandatory=$true)]$SenderAddress,
@laymanstake
laymanstake / PrometheusGrafanaSetup.ps1
Last active October 24, 2022 16:40
PowerShell script, which can download almost all the latest packages (except nssm, which is not github hosted) and then proceed to configure them on the same machine. Functions to download and create services are created in a way that select set of package can be downloaded or installed as putting everything on the same server may not be good idea.
View PrometheusGrafanaSetup.ps1
#Requires -RunAsAdministrator
#Requires -Version 3.0
#Requires -Modules BitsTransfer
# Author : Nitish Kumar
# Download and Install Prometheus, Grafana and Windows Exporter
# version 1.0 | 19/10/2022 Initial version
# version 1.1 | 21/10/2022 Cleaned up the script to supress error messages, added override switch
# version 1.2 | 21/10/2022 Added a crude way to update Prometheus configuration for adding nodes at mass scale
# version 1.3 | 22/10/2022 Added remove services option. Sorted nssm output encoding issue to find install path
# version 1.4 | 23/10/2022 Ready for mass deployment, sample code parts added