def run(self): """ All the real work happens herein; we can be called in one of three situations, determined by environment variables. First couple are during the agent Install process, where the domain.h and namespace files need to be created. The third case is the real mccoy, where an agent is actually being started by pmcd/dbpmda and makes use of libpcp_pmda to talk PCP protocol. """ if ('PCP_PYTHON_DOMAIN' in os.environ): self.domain_write() elif ('PCP_PYTHON_PMNS' in os.environ): self.pmns_write(os.environ['PCP_PYTHON_PMNS']) else: self.pmns_refresh() cpmda.pmid_oneline_refresh(self._metric_oneline) cpmda.pmid_longtext_refresh(self._metric_helptext) cpmda.indom_oneline_refresh(self._indom_oneline) cpmda.indom_longtext_refresh(self._indom_helptext) numindoms = len(self._indomtable) ibuf = create_string_buffer(numindoms * sizeof(pmdaIndom)) indoms = cast(ibuf, POINTER(pmdaIndom)) for i in xrange(numindoms): indoms[i] = self._indomtable[i] nummetrics = len(self._metrictable) mbuf = create_string_buffer(nummetrics * sizeof(pmdaMetric)) metrics = cast(mbuf, POINTER(pmdaMetric)) for i in xrange(nummetrics): metrics[i] = self._metrictable[i] cpmda.pmda_dispatch(ibuf.raw, numindoms, mbuf.raw, nummetrics)
def run(self): """ All the real work happens herein; we can be called in one of three situations, determined by environment variables. First couple are during the agent Install process, where the domain.h and namespace files need to be created. The third case is the real mccoy, where an agent is actually being started by pmcd/dbpmda and makes use of libpcp_pmda to talk PCP protocol. """ if ('PCP_PYTHON_DOMAIN' in os.environ): self.domain_write() elif ('PCP_PYTHON_PMNS' in os.environ): self.pmns_write(os.environ['PCP_PYTHON_PMNS']) else: self.pmns_refresh() cpmda.pmid_oneline_refresh(self._metric_oneline) cpmda.pmid_longtext_refresh(self._metric_helptext) cpmda.indom_oneline_refresh(self._indom_oneline) cpmda.indom_longtext_refresh(self._indom_helptext) numindoms = len(self._indomtable) ibuf = create_string_buffer(numindoms * sizeof(pmdaIndom)) indoms = cast(ibuf, POINTER(pmdaIndom)) for i in xrange(numindoms): indoms[i] = self._indomtable[i] nummetrics = len(self._metrictable) mbuf = create_string_buffer(nummetrics * sizeof(pmdaMetric)) metrics = cast(mbuf, POINTER(pmdaMetric)) for i in xrange(nummetrics): metrics[i] = self._metrictable[i] cpmda.pmda_dispatch(ibuf.raw, numindoms, mbuf.raw, nummetrics)
def run(self): """ All the real work happens herein; we can be called in one of three situations, determined by environment variables. First couple are during the agent Install process, where the domain.h and namespace files need to be created. The third case is the real mccoy, where an agent is actually being started by pmcd/dbpmda and makes use of libpcp_pmda to talk PCP protocol. """ if ('PCP_PYTHON_DOMAIN' in os.environ): self.domain_write() elif ('PCP_PYTHON_PMNS' in os.environ): self.pmns_write(os.environ['PCP_PYTHON_PMNS']) else: self.pmns_refresh() cpmda.pmid_oneline_refresh(self._metric_oneline) cpmda.pmid_longtext_refresh(self._metric_helptext) cpmda.indom_oneline_refresh(self._indom_oneline) cpmda.indom_longtext_refresh(self._indom_helptext) cpmda.pmda_dispatch(self._indomtable, self._metrictable)
def run(self): """ All the real work happens herein; we can be called in one of three situations, determined by environment variables. First couple are during the agent Install process, where the domain.h and namespace files need to be created. The third case is the real mccoy, where an agent is actually being started by pmcd/dbpmda and makes use of libpcp_pmda to talk PCP protocol. """ if ('PCP_PYTHON_DOMAIN' in os.environ): self.domain_write() elif ('PCP_PYTHON_PMNS' in os.environ): self.pmns_write(os.environ['PCP_PYTHON_PMNS']) else: self.pmns_refresh() cpmda.pmid_oneline_refresh(self._metric_oneline) cpmda.pmid_longtext_refresh(self._metric_helptext) cpmda.indom_oneline_refresh(self._indom_oneline) cpmda.indom_longtext_refresh(self._indom_helptext) cpmda.pmda_dispatch(self._indomtable, self._metrictable)