Skip to content

Commit

Permalink
Merge pull request #186 from Robomikel/pre-release/stabilizing
Browse files Browse the repository at this point in the history
updated - added ntop
  • Loading branch information
Robomikel authored Oct 6, 2024
2 parents c113d9d + 203b697 commit f779a41
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 2 deletions.
Binary file added Ntop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ Install miscreated server ```./ssm install misserver```
- ```./ssm ssm update``` - Downloads and overwrites ssm github files
- ```./ssm details <serverFolder>``` - outputs host and server details.
- ```./ssm stats ``` - Graphical output of host CPU and Memory details.
- ```./ssm install-ntop ``` - htop-like system-monitor with Vi-emulation for Windows. command ```./ntop``` or ```ntop``` [Wiki](https://github.com/Robomikel/Steam-Server-Manager/wiki/Installing-SSM-to-PATH)
- ```ssm start-pode``` - will download Pode. start pode and Discord bot. Use ctl-C to stop [Wiki](https://github.com/Robomikel/Steam-Server-Manager/wiki/DiscordJS-Bot-and-Pode-API-for-SSM)

# Configure
Expand Down Expand Up @@ -256,6 +257,8 @@ Install miscreated server ```./ssm install misserver```
![monitor Command](https://github.com/Robomikel/Steam-Server-Manager/blob/master/Discord-Alert.png)
# Restore
![monitor Command](https://github.com/Robomikel/Steam-Server-Manager/blob/master/RestoreMenu.jpg)
# Ntop
![Ntop](https://github.com/Robomikel/Steam-Server-Manager/blob/master/Ntop.png)
- - - -
When creating a Schedule task to run Monitor script in background.
- If using a user windows account. May need to add user to the "log on as batch job" to run the task in background under that account
Expand Down Expand Up @@ -322,3 +325,5 @@ https://github.com/ampreeT/SourceCoop
https://github.com/compujuckel/AssettoServer
# TShock
https://github.com/Pryaxis/TShock
# NTop
https://github.com/gsass1/NTop
3 changes: 2 additions & 1 deletion functions/core_commands.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Function Select-Steamer {
'discord' { Read-Param; Get-FolderNames; Get-createdvaribles; Get-CheckForVars; New-DiscordAlert; Test-VariablesNull; Get-ClearVariables; Break }
'details' { Read-Param; Get-FolderNames; Get-createdvaribles ; Get-CheckForVars; Test-PSversion; Get-details; Test-VariablesNull; Get-ClearVariables; Break }
'install-VcRedist' { Install-VisualCPlusPlus; Get-ClearVariables; Break }
'install-Ntop' { Get-NTop; Get-ClearVariables; Break }
'update-mods' { Read-Param; Get-FolderNames; Get-createdvaribles; Get-UpdateMods; Get-ClearVariables; Break }
'start-pode' { get-pode; Add-discordjs; start-pode; Break }
'stats' { Measure-stats; Break }
Expand All @@ -73,7 +74,7 @@ Function Get-SSMMenu {
Write-log "Function: $($MyInvocation.Mycommand)"
Write-Host ".:.:.:.:.:.:.:. SSM Command Menu .:.:.:.:.:.:.:.
Choose Command: " -F Cyan
$command = Menu @('install A-D', 'install E-M', 'install N-Z','install 0-9', 'start', 'stop', 'update', 'restart', 'monitor', 'backup', 'restore', 'validate', 'install-monitor', 'install-mod', 'install-ws', 'install-backup', 'force-update', 'install-Restart', 'query', 'mcrcon', 'discord', 'details', 'exit', 'stats', 'update-mods')
$command = Menu @('install A-D', 'install E-M', 'install N-Z','install 0-9', 'start', 'stop', 'update', 'restart', 'monitor', 'backup', 'restore', 'validate', 'install-monitor', 'install-mod', 'install-ws', 'install-backup', 'force-update', 'install-Restart', 'query', 'mcrcon', 'discord', 'details', 'exit', 'stats','install-Ntop', 'update-mods')
clear-Host
Set-Console >$null 2>&1
If ($command -ne "install A-D" -and $command -ne "install E-M" -and $command -ne "install N-Z"-and $command -ne "install 0-9") {
Expand Down
84 changes: 84 additions & 0 deletions functions/core_functions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1595,3 +1595,87 @@ Function Get-ProcPortBind {
# Get-NetFirewallRule -Action Allow -Direction Inbound | Get-NetFirewallPortFilter | Where { $_.LocalPort -Like '27015' } | select *
# Get-NetFirewallPortFilter | Where { $_.LocalPort -Like '27015' } | Get-NetFirewallRule -Action Allow -Direction Inbound
}
Function Get-NTop {
Write-log "Function: $($MyInvocation.Mycommand)"
If ($NTopowner -and $NTopsetuprepo ) {
#(New-Object Net.WebClient).DownloadFile("$metamodurl", "$currentdir\metamod.zip")
#[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
#Invoke-WebRequest -Uri $NTopurl -OutFile $NTopoutput
Get-GithubRestAPIntop $NTopowner $NTopsetuprepo
Write-log "info: Downloading NTop from github"
$start_time = Get-Date
clear-hostline 1
Get-Infomessage "downloading" 'NTop'
try {
Invoke-WebRequest -Uri $githubrepoziplink -OutFile $currentdir\$githubrepoexename
If ($?) {
clear-hostline 1
Get-Infomessage "downloaded" 'NTop'
Write-log "info: NTop succeeded "
}
}
catch {
Write-log "Warning: $($_.Exception.Message)"
Write-Warning 'Downloading NTop Failed'
Write-log "Failed: Downloading NTop"
New-TryagainNew
}
clear-hostline 1
Get-Infomessage "downloadtime"
clear-hostline 1
# Get-Infomessage "Extracting" 'NTop'
# Expand-Archive $currentdir\$githubrepozipname $currentdir\$githubrepofolder -Force
# Copy-Item "$currentdir\*" -Destination $systemdir -Recurse -Force
# Remove-Item "$currentdir\$githubrepofolder" -Recurse -Force
# If (!$?) {
# Write-Warning 'Extracting NTop Failed'
# Write-log "Failed: Extracting NTop "
# New-TryagainNew
# }
# ElseIf ($?) {
# clear-hostline 1
# Get-Infomessage "Extracted" 'NTop'
# Write-log "info: Extracting NTop succeeded "
# }
}
Else {
Write-log "Failed: install-NTop $NTopurl $githubrepozipname"
Write-Warning 'fn_install-NTop Failed'
Exit
}
}
Function Get-GithubRestAPIntop {
param ($owner, $repo)
Write-log "Function: $($MyInvocation.Mycommand)"
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
$githubrepo = iwr "https://api.github.com/repos/$owner/$repo/releases" -Method Get -Headers @{'Accept' = 'application/vnd.github.v3+json' }
If (!$?) {
Write-log "Failed: Get-GithubRestAPI: Repo Request "
return
}
If ($githubrepo) {
$githubrepoJSON = $githubrepo.Content | ConvertFrom-Json
}
Else {
Write-log "Failed: Get-GithubRestAPI: Repo convert from json "
return
}
if ($githubrepoJSON.assets.browser_download_url -like "*exe*" ) {
$global:githubrepoziplink = ($githubrepoJSON.assets.browser_download_url | select-string -SimpleMatch "exe" | Select-String -NotMatch "Linux", "OSX" | select -Index 0).Line
}
# if ( $githubrepoJSON | select zipball_url) {
# $global:githubrepoziplink = ($githubrepoJSON | select zipball_url | select -Index 0).zipball_url
# }
Else {
Write-log "Failed: Get-GithubRestAPI: No download link found"
return
}
if ($githubrepoJSON.assets.name) {
$global:githubrepoexename = ($githubrepoJSON.assets.name | select-string -SimpleMatch "exe" | Select-String -NotMatch "Linux", "OSX" | select -Index 0).Line
}
Else {
Write-log "Failed: Get-GithubRestAPI: No download file found"
return
}
}

6 changes: 5 additions & 1 deletion ssm.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
#
param(
[ValidateSet('install', 'update', 'force-update', 'validate', 'start', 'stop', 'restart', 'monitor', 'backup', 'restore', 'install-monitor', 'install-mod', 'install-ws', 'install-restart', 'install-backup', 'query', 'mcrcon', 'discord', 'details', 'install-vcredist', 'stats', 'menu', 'exit', 'ssm', 'update-mods','start-pode')]
[ValidateSet('install', 'update', 'force-update', 'validate', 'start', 'stop', 'restart', 'monitor', 'backup', 'restore', 'install-monitor', 'install-mod', 'install-ws', 'install-restart', 'install-backup', 'query', 'mcrcon', 'discord', 'details', 'install-vcredist','install-Ntop', 'stats', 'menu', 'exit', 'ssm', 'update-mods','start-pode')]
[Parameter(ParameterSetName = "steamer", Position = 0)]
[string]$command,
[Parameter(ParameterSetName = "steamer", Position = 1)]
Expand Down Expand Up @@ -117,6 +117,10 @@ $TShockowner = 'Pryaxis'
$TShocksetuprepo = 'TShock'
$TShockdirectory = "$currentdir\TShock"

# NTop
$NTopowner = 'gsass1'
$NTopsetuprepo = 'NTop'

$RANDOMPASSWORD = -join ((65..90) + (97..122) + (48..57) | Get-Random -Count 14 | ForEach-Object { [char]$_ })

$SMILEY_WHITE = ([char]9786)
Expand Down

0 comments on commit f779a41

Please sign in to comment.