Skip to content

pcolby/pcp-pmda-cpp

Repository files navigation

PMDA++ PMDA++

Build Status Coverage Status Coverity Scan Build Status Github Release Boost License

PMDA++ is a header-only library that allows developers to write Performance Metrics Domain Agents (PMDAs) for Performance Co-Pilot (PCP) in C++.

What is PCP?

Performance Co-Pilot (PCP) is an open source infrastructure for monitoring, visualizing, recording, responding to, and controlling the status, activity, and performance of networks, computers, applications, and servers. -- Wikipedia

What is a PMDA?

PCP makes use of add-ons called Performance Metrics Domain Agents (PMDAs) to fetch performance metrics for specific domains, such as database servers, hardware, custom applications, etc.

For more information, see the Performance Co-Pilot Programmer's Guide.

What is PMDA++?

PCP includes support for writing PMDAs in C, Perl and Python. PMDA++ is a header-only library that allows developers to write PMDAs in C++. It is a light C++ wrapper around PCP's C APIs.

Here is a complete, albeit very basic, PMDA written using PMDA++ that simply returns the current time:

#include <pcp-cpp/atom.hpp>
#include <pcp-cpp/pmda.hpp>
#include <pcp-cpp/units.hpp>

class trivial : public pcp::pmda {

public:

    virtual std::string get_pmda_name() const
    {
        return "trivial";
    }

    virtual int get_default_pmda_domain_number() const
    {
        return 250;
    }

protected:

    virtual pcp::metrics_description get_supported_metrics()
    {
        // trivial.time aka TRIVIAL:0:0.
        return pcp::metrics_description()(0)
            (0, "time",pcp::type<uint32_t>(), PM_SEM_COUNTER,
             pcp::units(0,1,0, 0,PM_TIME_SEC,0));
    }

    virtual fetch_value_result fetch_value(const metric_id &metric)
    {
        return pcp::atom(metric.type,time(NULL));
    }

};

int main(int argc, char *argv[])
{
    return pcp::pmda::run_daemon<trivial>(argc, argv);
}

Compare that to PCP's official trivial.c example.

API Documentation

See the doxygen-generated API documentation. Some additional information is available on the wiki.

Benchmarks

Some basic benchmarks are availble on the wiki.

simple numfetch

Requirements

PMDA++ requires little more than a modern C++ compiler and the PCP client libraries.

Additionaly, PMDA++ can make use of Boost libraries (though not required) to provide some enhanced functionaliy.

See the requirements wiki page for more details.

Contributing

There are lots of way you can contribute, including (but not limited to):

  • reviewing the code itself (its only 1K ~ 2K lines), looking for issues such as bugs, portability issues, and the like.
  • reviewing the API, suggesting improvments such as more intuitive naming and future-proofing.
  • identifying violations of the project's desired conventions.
  • writing your own PMDA using PMDA++ to test it in real world applications.
  • improving the wiki documentation.

Issues / suggestions can be reported via GitHub's issue tracker. Pull requests are very welcome.

The PMDA++ Google Group is used for general discussion, questions, comments, suggestions, announcements etc. Email pcp-pmda-cpp+subscribe@googlegroups.com to subscribe.

License

PMDA++ code is available under the OSI-approved Boost Software License.

PMDA++ relies on PCP libraries (libpcp and libpcp_pmda), which are available under LGPL v2.1.