Service Graph Connector for AWS - SSM Documents
Import
·
Jun 08, 2022
·
article
SG AWS Version 1.4
| Feature | Linux | Windows |
|---|---|---|
| Serial Number | dmidecode -t system \ | grep Serial |
| 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-09Resources: 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 \ |
| SG-AWS-RunPowerShellScript-Setup.yml |
|---|
| AWSTemplateFormatVersion: 2010-09-09Resources: 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 |
| SG-AWS-RunPowerShellScript-Setup.yml | ||||||||
|---|---|---|---|---|---|---|---|---|
| AWSTemplateFormatVersion: 2010-09-09 Type: 'AWS::SSM::Document' description: 'Service Graph AWS - aws:runPowerShellScript' - action: 'aws:runPowerShellScript' name: runPowerShellScript - '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 |
View original source
https://www.servicenow.com/community/cmdb-articles/service-graph-connector-for-aws-ssm-documents/ta-p/2300486
