pythonopentsdbscollector

How to run External collector from Scollector?


I am trying to run external sample.py script in /path-to-scollector/collectors/0 folder from scollector.

scollector.toml:

Host = "localhost:0"
ColDir="//path-to-scollector//collectors//"
BatchSize=500
DisableSelf=true

command to run scollector:

scollector-windows-amd64.exe -conf scollector.toml -p

But I am not getting the sample.py metrics in the output. It is expected to run continuosly and print output to cnosole. Also when I am running:

 scollector-windows-amd64.exe -conf scollector.toml -l

my external collector is not listed.


Solution

  • For running scollector on linux machine the above solution works well. But with windows its a bit tricky. Since scollector running on windows can only identify batch files. So we need to do a little extra work for windows.

    create external collector :- It can be written in any language python,java etc. It contains the main code to get the data and print to console.

    Example my_external_collector.py

    create a wrapper batch script :- wrapper_external_collector.bat.

    Trigger my_external_collector.py inside wrapper_external_collector.bat.

    python path_to_external/my_external_collector.py
    

    You can pass arguments to the script also.Only disadvantage is we need to maintain two scripts.