Skip to content

Instantly share code, notes, and snippets.

View collin-sanford's full-sized avatar

Collin Sanford collin-sanford

View GitHub Profile
@collin-sanford
collin-sanford / winlogs.ps1
Created December 23, 2024 14:35
Windows Logs via PS
# Configure win32_event_log
echo "init_config:
instances:
- type:
- Information
- Critical
- Error
- Warning
- Audit Failure
- Audit Success
@collin-sanford
collin-sanford / datadog_install.sh
Last active September 3, 2024 14:52
Datadog Install for Linux
#!/bin/bash
# Prompt for the Datadog API key
read -p "Enter your Datadog API key: " DD_API_KEY
# Validate the API key is not empty
if [[ -z "$DD_API_KEY" ]]; then
echo "Error: Please enter a valid Datadog API key."
exit 1
fi
@collin-sanford
collin-sanford / datadog.yaml
Created February 26, 2024 19:40
Default Agent Config
########################################
## Datadog Configuration ##
########################################
api_key: <your_api_key>
site: datadoghq.com
########################################
## Tag collection Configuration ##
########################################
# ec2 instances will inherit AWS Tags
@collin-sanford
collin-sanford / dd-agent-logs-process.ps1
Last active November 20, 2024 20:27
Powershell Install Datadog Agent
# Download and install the Datadog agent
Set-ExecutionPolicy Bypass -Scope Process -Force;
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
$env:DD_API_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$env:DD_SITE = 'datadoghq.com';
$env:DD_REMOTE_UPDATES = 'true';
#$env:DD_AGENT_MAJOR_VERSION = '7';
#$env:DD_AGENT_MINOR_VERSION = '59.0';
iex ((New-Object System.Net.WebClient).DownloadString('https://s3.amazonaws.com/dd-agent-mstesting/Install-Datadog.ps1'));
@collin-sanford
collin-sanford / ndm-autodiscovery.yaml
Last active February 2, 2024 16:03
NDM Autodiscovery
listeners:
- name: snmp
snmp_listener:
workers: 2
discovery_interval: 3600
discovery_allowed_failures: 3
loader: core
min_collection_interval: 15
use_device_id_as_hostname: true
configs:
1) Install the Datadog Agent with the single line install (replace the API key with your API key)
2) Configure the Datadog Agent Configuration file at: /etc/datadog/datadog-agent.yaml (replace the API key with your API key)
# api key - https://app.datadoghq.com/organization-settings/api-keys
api_key: <api_key>
# datadog site
site: datadoghq.com
# logs
@collin-sanford
collin-sanford / windows_agent_events_.ps1
Last active November 8, 2023 17:43
Powershell script to setup the Datadog Agent with Windows event logs, processes, and agent config in the Datadog UI.
# Download agent
(Invoke-WebRequest https://s3.amazonaws.com/ddagent-windows-stable/datadog-agent-7-latest.amd64.msi -OutFile c:\datadog-agent-7-latest.amd64.msi)
# Start the Datadog agent
# (Start-Process -Wait msiexec -ArgumentList '/qn /i c:\datadog-agent-7-latest.amd64.msi APIKEY=xxx HOSTNAME="my_hostname" TAGS="mytag1,mytag2"')
(Start-Process -Wait msiexec -ArgumentList '/qn /i c:\datadog-agent-7-latest.amd64.msi APIKEY="api_key"')
# Enable logs, live process, and agent configuration through the datadog UI
(Add-Content C:\ProgramData\Datadog\datadog.yaml "logs_enabled: true`nlogs_config:`n use_compression: true`n compression_level: 6`n batch_wait: 5`n open_files_limit: 500")
(Add-Content C:\ProgramData\Datadog\datadog.yaml "`nprocess_config:`n process_collection:`n enabled: `"true`"")
@collin-sanford
collin-sanford / win32_event_log.d
Created September 27, 2023 17:19
Windows Event Log configuration
# https://docs.datadoghq.com/integrations/win32_event_log/?tab=logs#overview
init_config:
logs:
- type: windows_event
channel_path: "Application"
source: windows.events
service: Application_Event
- type: windows_event
@collin-sanford
collin-sanford / datadog.yaml
Created September 27, 2023 17:17
Simple Datadog Agent configuration file that enables logs, processes and agent configuration view in the DD UI
# api key - https://app.datadoghq.com/organization-settings/api-keys
api_key: <api_key>
# datadog site - https://docs.datadoghq.com/getting_started/site/
site: datadoghq.com
# logs - needed for windows events - https://docs.datadoghq.com/integrations/win32_event_log
logs_enabled: true
logs_config:
use_compression: true
@collin-sanford
collin-sanford / Datadog PowerShell + win32_event_log setup
Last active November 29, 2023 20:44 — forked from jaycdave88/Datadog PowerShell + win32_event_log setup
PowerShell script to install latest Datadog Windows agent. Enable logs, live process, and configure win32_event_logs
# Download agent
(Invoke-WebRequest https://s3.amazonaws.com/ddagent-windows-stable/datadog-agent-7-latest.amd64.msi -OutFile c:\datadog-agent-7-latest.amd64.msi)
# Download .NET Tracer v2.42x64 .msi
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(Invoke-WebRequest https://github.com/DataDog/dd-trace-dotnet/releases/download/v2.42.0/datadog-dotnet-apm-2.42.0-x64.msi -OutFile c:\datadog-dotnet-apm-2.42.0-x64.msi)
# Start the Datadog agent
(Start-Process -Wait msiexec -ArgumentList '/qn /i c:\datadog-agent-7-latest.amd64.msi APIKEY=xxx HOSTNAME="my_hostname" TAGS="mytag1,mytag2"')