On Fri, 22 May 2020 at 09:08, Ashwin kumar <[email protected]> wrote:
> Hi everyone, > > > I am new to Prometheus and I am writing a Custom Collector to get CPU and > Memory values of two firewalls. > > I'd suggest looking at https://github.com/prometheus/snmp_exporter which is meant for getting metrics from network devices. Brian > I can expand them to as many devices as I want. > > Now I am opening a http server in port 8000 and getting these. So now my > metrics are available in http://localhost:8000 > > > My script would look something like this > > > ================================================== > > > class CustomCollector(object): > > def collect(): > > devices =[] > > for device in devices: > > #collect CPU and yield# > > #collect Memory and yield# > > if name == 'main': > > start_http_server(8000) > > REGISTRY.register(CustomCollector()) > > while True: > > time.sleep(1) > > =================================================== > > > I have one Custom Collector function to return both memory and CPU for the > devices which I have stored in a list. > > Now when I add about 30 devices the response would become untidy and > difficult to interpret. > > I want to have CPU values and Memory values in separate endpoints namely > http://localhost:8000/CPU > > http://localhost:8000/Memory > > So is there a way to do this? > > I have two questions > > 1) Can we write multiple Custom Collector functions in the same script and > somehow modify their endpoints with the port remaining same? > > 2) Can we write multiple Custom Collector functions in the same script > exposing them on different ports? (Not sure if this efficient though) > > Any other ideas apart from these would also help.. > > -- > You received this message because you are subscribed to the Google Groups > "Prometheus Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/prometheus-users/5f6ef0c8-8442-405d-afbe-bdaa28c8733e%40googlegroups.com > <https://groups.google.com/d/msgid/prometheus-users/5f6ef0c8-8442-405d-afbe-bdaa28c8733e%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Brian Brazil www.robustperception.io -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CAHJKeLqaMTtTbXEy%2BDZRdNhnRTNBvVvKRVF05nLxkxdKArHs2A%40mail.gmail.com.

