(self)
Collector Passenger stats
Collector Passenger stats
Collector Passenger stats
def collect(self):
        """
        Collector Passenger stats
        """
        if not os.access(self.config["bin"], os.X_OK):
            self.log.error("Path %s does not exist or is not executable",
                           self.config["bin"])
            return {}

        dict_stats = self.get_passenger_memory_stats()
        if len(dict_stats.keys()) == 0:
            return {}

        queue_stats = self.get_passenger_queue_stats()
        if len(queue_stats.keys()) == 0:
            return {}

        overall_cpu = self.get_passenger_cpu_usage(dict_stats)
        if overall_cpu >= 0:
            self.publish("phusion_passenger_cpu", overall_cpu)

        self.publish("total_passenger_procs", len(
            dict_stats["passenger_procs"]))
        self.publish("total_nginx_procs", len(dict_stats["nginx_procs"]))
        self.publish("total_apache_procs", len(dict_stats["apache_procs"]))
        self.publish("total_apache_memory", dict_stats["apache_mem_total"])
        self.publish("total_nginx_memory", dict_stats["nginx_mem_total"])
        self.publish("total_passenger_memory",
                     dict_stats["passenger_mem_total"])
        self.publish("top_level_queue_size", queue_stats[
                     "top_level_queue_size"])
        self.publish("passenger_queue_size", queue_stats[
                     "passenger_queue_size"])
def collect ( self ) : if not os . access ( self . config [ "bin" ] , os . X_OK ) : self . log . error ( "Path %s does not exist or is not executable" , self . config [ "bin" ] ) return { } dict_stats = self . get_passenger_memory_stats ( ) if len ( dict_stats . keys ( ) ) == 0 : return { } queue_stats = self . get_passenger_queue_stats ( ) if len ( queue_stats . keys ( ) ) == 0 : return { } overall_cpu = self . get_passenger_cpu_usage ( dict_stats ) if overall_cpu >= 0 : self . publish ( "phusion_passenger_cpu" , overall_cpu ) self . publish ( "total_passenger_procs" , len ( dict_stats [ "passenger_procs" ] ) ) self . publish ( "total_nginx_procs" , len ( dict_stats [ "nginx_procs" ] ) ) self . publish ( "total_apache_procs" , len ( dict_stats [ "apache_procs" ] ) ) self . publish ( "total_apache_memory" , dict_stats [ "apache_mem_total" ] ) self . publish ( "total_nginx_memory" , dict_stats [ "nginx_mem_total" ] ) self . publish ( "total_passenger_memory" , dict_stats [ "passenger_mem_total" ] ) self . publish ( "top_level_queue_size" , queue_stats [ "top_level_queue_size" ] ) self . publish ( "passenger_queue_size" , queue_stats [ "passenger_queue_size" ] )