ricoberger/script_exporter

Windows Powershell or CMD script example

YulianSalo opened this issue · 5 comments

@ricoberger I would be grateful if you could provide some examples for Windows scripts (powershell/cmd)

@ricoberger I would like to get some examples for Windows scripts too if it is possible. It would help me a lot! Thank you in advance.

Hi @YulianSalo and @m-marinka, since the script_exporter is just running the given script / command via exec.Command I think sth. like shown here should work for for powershell.

Unfortunately I do not have a Windows system right now to test it.

@adjosan or @skpenpen were playing around with running the exporter on windows. Maybe they can help out with a proper example.

tls:
  enabled: false
  crt: server.crt
  key: server.key

basicAuth:
  enabled: false
  username: username
  password: password

bearerAuth:
  enabled: false
  signingKey: my_secret_key

scripts:

  - name: hello
    script: powershell -executionpolicy bypass -file C:/Prometheus/script_exporter/scripts/helloworld.ps1

  - name: hyperv
    script: powershell -executionpolicy bypass -file C:/Prometheus/script_exporter/scripts/hyperv.ps1

  - name: scheduled_tasks
    script: powershell -executionpolicy bypass -file C:/Prometheus/script_exporter/scripts/scheduled_tasks.ps1

  - name: certificats
    script: powershell -executionpolicy bypass -file C:/Prometheus/script_exporter/scripts/cert.ps1

  - name: synchronisation_ntp
    script: powershell -executionpolicy bypass -file C:/Prometheus/script_exporter/scripts/synchronisation_ntp.ps1 -ntpserver <ntpserver>

Thanks for sharing @skpenpen.

Does this help you @YulianSalo and @m-marinka?

Since the issue seems to be resolved, I would close it for now. If you need further help please let me know or if someone ones to add an example for PowerShell / CMD feel free to create a PR.