You can monitor Windows shell or PowerShell commands with the shell monitor. You can write the output of a scheduled shell or PowerShell command to a file or directly upload the output.
Here is an example of writing directly to Dataset without persisting to disk.
monitors: [
{
module: "scalyr_agent.builtin_monitors.shell_monitor",
id: "cmd",
command: "powershell -command \"" +
"Get-Process"
+ "\""
log_all_lines: "True"
max_characters: "10000"
sample_interval: 60
},
Here is an example of writing to a file and then using the Dataset agent to pick up the file.
logs: [
//Picks up file
{ path: "C:\\Program Files (x86)\\Scalyr\\log\\process-metrics-full.log", attributes: {parser: "monitorLog"} }
]
monitors: [
//powershell monitor outputs to file
{
module: "scalyr_agent.builtin_monitors.shell_monitor",
id: "cmd",
command: "powershell -command \"" +
"Get-Process | Out-File -FilePath '%programfiles(x86)%\\Scalyr\\log\\process-metrics-full.log' -Append -Encoding ASCII" + "\""
sample_interval: 60
}
]
Comments
0 comments
Please sign in to leave a comment.