PowerShellExporter icon indicating copy to clipboard operation
PowerShellExporter copied to clipboard

Multiple PS Exporter processes

Open barebu opened this issue 5 years ago • 4 comments

Hi. Thank you for this wonderful product. Tell me please how I can run multiple PS Exporter processes in parallel on the same server at the same time? I tried to create multiple copies of services on different urls and ports. But failed

barebu avatar Jul 28 '19 18:07 barebu

What exactly did you try and how it failed?

Currently out-of-the-box you cannot modify the service name, as such, you cannot really install several copies of it.

You could however, copy the binaries to different directories and manually install the services using sc.exe.

rgl avatar Jul 29 '19 05:07 rgl

I did the following.

  • Created a copy of the directory with PSE
  • Created a new service with a new name and URL When I try to start service, I get errors in the logs. Here is a fragment
2019-07-29 16:20:44.722 +03:00 [INF] Configuration Result:
[Success] Name PowerShellExporter
[Success] DisplayName PowerShell Exporter
[Success] Description Exports the results of PowerShell cmdlets as Prometheus Gauge Metrics
[Success] ServiceName PowerShellExporter
2019-07-29 16:20:44.800 +03:00 [INF] Topshelf v4.1.0.172, .NET Framework v4.0.30319.42000
2019-07-29 16:20:44.800 +03:00 [INF] PowerShellExporter v0.0.3.0
2019-07-29 16:20:44.815 +03:00 [INF] Configuration url: "http://localhost:9362/metrics"
2019-07-29 16:20:44.815 +03:00 [INF] Configuration metrics: .\metrics.yml
2019-07-29 16:20:49.280 +03:00 [INF] PowerShell v5.1.14409.1018
2019-07-29 16:20:50.231 +03:00 [ERR] The PowerShellExporter service is running and must be stopped before running via the console

barebu avatar Jul 29 '19 13:07 barebu

This uses TopShelf, as such, you can modify the service name and other settings as described at http://docs.topshelf-project.com/en/latest/overview/commandline.html or by running PowerShellExporter help. I've mention this command at https://github.com/rgl/PowerShellExporter/commit/43396c05d56c9d832aff45cf250b0380efb1718c.

rgl avatar Jul 29 '19 21:07 rgl

Really tried to create a service this way. And it worked! Thank you very much. I wanted to clarify another point. Maybe you need to adjust the line for creating the service, or is this option completely correct?

.\PowerShellExporter install -servicename:PowerShellExporter2 -displayname:PowerShellExporter2 -instance:002 -url:http://localhost:9362/metrics

barebu avatar Aug 01 '19 17:08 barebu