- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 06-08-2022 12:03 PM
SG AWS Version 1.4
Feature | Linux | Windows |
Serial Number | dmidecode -t system | grep Serial | wmic bios get serialnumber |
Process Information | ps awwxo pid,ppid,command | cmd /a /c 'wmic process get ProcessId, ParentProcessId, Name, ExecutablePath, Description, CommandLine /format:rawxml |
TCP | netstat -anpt | netstat -anop TCP |
Here is the content of the custom SSM document. These scripts will not take any input parameters and will execute the listed OS commands. These scripts need to be deployed in all of the account regions where you need to get the EC2 system information.
SG-AWS-RunShellScript-Setup.yml |
AWSTemplateFormatVersion: 2010-09-09 Resources: SSMDocument: Type: 'AWS::SSM::Document' Properties: Content: schemaVersion: '2.2' description: 'Service Graph AWS - aws:runShellScript' mainSteps: - action: 'aws:runShellScript' name: runShellScript inputs: timeoutSeconds: '3600' runCommand: - dmidecode -t system | grep Serial - 'echo ''####SG-AWS####''' - 'ps awwxo pid,ppid,command' - 'echo ''####SG-AWS####''' - netstat -anpt DocumentType: Command Name: SG-AWS-RunShellScript VersionName: '1.0' |
SG-AWS-RunPowerShellScript-Setup.yml |
AWSTemplateFormatVersion: 2010-09-09 Resources: SSMDocument: Type: 'AWS::SSM::Document' Properties: Content: schemaVersion: '2.2' description: 'Service Graph AWS - aws:runPowerShellScript' mainSteps: - action: 'aws:runPowerShellScript' name: runPowerShellScript inputs: timeoutSeconds: '3600' runCommand: - 'echo ''####-WINDOWS-####''' - wmic bios get serialnumber - 'echo ''####SG-AWS####''' - netstat -anop TCP - 'echo ''####SG-AWS####''' - cmd /a /c 'wmic process get ProcessId, ParentProcessId, Name, ExecutablePath, Description, CommandLine /format:rawxml' DocumentType: Command Name: SG-AWS-RunPowerShellScript VersionName: '1.0' |
SG AWS Version 1.5
(Release date: July 28, 2022)
SG-AWS-RunShellScript-Setup.yml |
AWSTemplateFormatVersion: 2010-09-09 Resources: SSMDocument: Type: 'AWS::SSM::Document' Properties: Content: schemaVersion: '2.2' description: 'Service Graph AWS - aws:runShellScript' mainSteps: - action: 'aws:runShellScript' name: runShellScript inputs: timeoutSeconds: '3600' runCommand: - "echo '####SG-AWS-06-02-2022####'" - "dmidecode system | grep -E '(Manufacturer|Product Name|Serial Number)'| sed 's/^/#DMI#/'" - "ps awwxo pid,ppid,command | sed 's/^/#PS#/'" - "netstat -anpt | sed 's/^/#NETSTAT#/'" - "grep -E '(model name|vendor_id|cpu MHz|cpu cores)' /proc/cpuinfo | sed 's/^/#CPU#/'" - "awk '/MemTotal/ {print $2}' /proc/meminfo | sed 's/^/#RAM-KB#/'" - "lsblk -dn | grep -v '^loop' | sed 's/^/#DISK#/'" DocumentType: Command Name: SG-AWS-RunShellScript VersionName: '1.0' |
SG-AWS-RunPowerShellScript-Setup.yml |
AWSTemplateFormatVersion: 2010-09-09
Resources:
SSMDocument:
Type: 'AWS::SSM::Document'
Properties:
Content:
schemaVersion: '2.2'
description: 'Service Graph AWS - aws:runPowerShellScript'
mainSteps:
- action: 'aws:runPowerShellScript'
name: runPowerShellScript
inputs:
timeoutSeconds: '3600'
runCommand:
- 'echo ''####SG-AWS-06-02-2022####'''
- 'echo ''####-WINDOWS-####'''
- wmic bios get serialnumber | foreach {"###SERIAL###"+ $_}
- netstat -anop TCP | foreach {"###TCP###"+ $_}
- cmd /a /c 'wmic computersystem get model,name,systemtype,manufacturer,DNSHostName,domain,TotalPhysicalMemory,NumberOfProcessors /format:list' | foreach {"###CS###"+ $_}
- cmd /a /c 'wmic cpu get Manufacturer,MaxClockSpeed,DeviceID,Name,Caption /format:list' | foreach {"###CPU###"+ $_}
- cmd /a /c 'wmic process get ProcessId, ParentProcessId, Name, ExecutablePath, Description, CommandLine /format:rawxml' | foreach {"###PS###"+ $_}
- (Get-Disk | measure-object -Property size -Sum).Sum / 1GB | foreach {\"###DISK###\"+ $_}
- (Get-WmiObject Win32_PhysicalMemory | measure-object Capacity -sum).sum/1gb | foreach {\"###RAM-GB###\"+ $_}
DocumentType: Command
Name: SG-AWS-RunPowerShellScript
VersionName: '1.0'
|
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Can you please include the latest yml version files for these two scripts as attachments to this post?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi,
I have changed the "SG-AWS-RunShellScript-Setup.yml" and deploy it on AWS, but still the old format is returned when I run the data source - SG-AWS-SSM-SendCommand.
@Murali Reddy1 > Do I need to do something else after I do a change in the run shell script in order to extract additional attributes for servers?
Thanks,
Adina