#!/usr/bin/env python # # This is a quick and dirty version of a script what needs to be done for a final version # # TODO: Create a library like the ones available for perl, call Config.pm and Metric.pm # # import subprocess PROCESSNAME="node" METRICTYPE="IntAverage" COMMAND="netstat -ant |fgrep ESTABLISHED | awk '{print $4}'| cut -d\":\" -f2" MonitoredPorts=[7001, 7002, 7003, 7004, 8001, 8002, 8003, 8004, 8005, 8007, 8008, 9000] ############### DO NOT EDIT BELLOW THIS LINE ##################### stack = [] return_code = subprocess.Popen(COMMAND,stdout=subprocess.PIPE, shell=True) for x in return_code.stdout.readlines(): stack.append(x.strip("\n")) for port in MonitoredPorts: print ""