This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ConvertTo-SplunkString | |
{ | |
[cmdletbinding()] | |
param( | |
[Parameter(ValueFromPipeline=$true)] | |
[Object]$InputObject, | |
[Parameter()] | |
[System.Collections.Hashtable]$Properties | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Use this script to assign Splunk for VMware vCenter permisisons to a specified Active Directory account | |
.DESCRIPTION | |
Use this script as a companion to performing the installation steps for Splunk for VMware. It is | |
necessary to first create a service account in Active Directory to which the required permissions | |
are then assigned. This script will assign the permissions to all visible datacenters. To assign | |
permissions across multiple vCenter servers, login to them first by using the Connect-ViServer | |
cmdlet with the AllLinked parameter (assuming that you are using the Linked mode feature of vCenter | |
Server.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param ( | |
[Parameter(Mandatory=$true, ValueFromPipeline=$true)] | |
$Recipient | |
) | |
Begin { | |
# Edit these as needed | |
$MailParam = @{ | |
From = "[email protected]" | |
Subject = "Your vExpert Eval Keys" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using any version of PowerShell | |
$parameters = New-Object System.Collections.Specialized.NameValueCollection | |
$parameters.Add("token", "APP_TOKEN") | |
$parameters.Add("user", "USER_KEY") | |
$parameters.Add("message", "hello world") | |
$client = New-Object System.Net.WebClient | |
$client.UploadValues("https://api.pushover.net/1/messages.json", $parameters) | |
# Using PowerShell v3 only with new Invoke-RestMethod cmdlet | |
$uri = 'https://api.pushover.net/1/messages.json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this gets even easier in v3 with the Invoke-RestMethod cmdlet | |
$uri = 'https://api.github.com/users/halr9000/gists' | |
Invoke-RestMethod -Uri $uri |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Version 3 | |
# Import Splunk C# SDK types into module scope | |
Add-Type -Path "$PSScriptRoot\SplunkSDK.dll" | |
<# | |
.Synopsis | |
Connects to a Splunk server | |
.DESCRIPTION | |
This function connects to a Splunk server via the REST API and creates a service object called $SPLUNK_SERVICE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conversion of http://docs.splunk.com/Documentation/Splunk/latest/RESTAPI/RESTsearch#search.2Fjobs.2Fexport | |
# example using curl, to PowerShell with Invoke-RestMethod cmdlet | |
# | |
# $ curl -k -u admin:changeme https://localhost:8089/services/search/jobs/export | |
# --data-urlencode search="search index=_internal | stats count by sourcetype" | |
# -d output_mode=json -d earliest="rt-5m" -d latest="rt" | |
$cred = Get-Credential | |
# This will allow for self-signed SSL certs to work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, time, os, csv | |
import httplib, urllib, hashlib, base64, hmac, urlparse, md5 | |
import xml.dom.minidom, xml.sax.saxutils | |
import logging | |
import tarfile, gzip | |
ENDPOINT_HOST_PORT = "s3.amazonaws.com" | |
# set up logging suitable for splunkd consumption | |
logging.root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import warnings | |
__author__ = 'JBennett' | |
# A class wrapper for calls to Cisco UCS Managers | |
#! /Library/Frameworks/Python.framework/Versions/2.7/bin/python | |
######################################## | |
## Library functions | |
######################################## | |
from datetime import datetime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Start-Splunk { | |
try { | |
Get-Service splunk* | Start-Service -ErrorAction Stop | |
} | |
catch [Microsoft.PowerShell.Commands.ServiceCommandException] { | |
Write-Verbose "Command must be run in an elevated session, invoking new session." | |
Start-Process -Verb Runas -FilePath powershell.exe { Get-Service splunk* | Start-Service -Verbose -ErrorAction Stop; Start-Sleep 5 } | |
} | |
} |
OlderNewer