[PATCH 1/5] src/lib/host: Cleanups in host_private.h
by russell@russellbryant.net
1) Localize the cpuinfo_t and host_init_t structs. These structs
are only used in host.c so localize them to the C file.
Also, remove the explicit initialization to 0. This is the
default for global data. In fact, unless optimizations are made
on your behalf, there is a benefit to _not_ initializing global
data explicitly in that it doesn't have to be stored in an
initialized data segment of the application, resulting in a
slightly smaller binary.
2) Add ifdef include guard.
3) Remove unused functions from the header (due to the conversion
to use sigar is what it looks like).
4) Add some doxygen style docs at the top of the file that indicates
what it's for.
5) Remove extern keyword. It's implied and unnecessary.
Signed-off-by: Russell Bryant <russell(a)russellbryant.net>
---
src/lib/host.c | 16 ++++++++++++++--
src/lib/host_private.h | 40 ++++++++++++++++------------------------
2 files changed, 30 insertions(+), 26 deletions(-)
diff --git a/src/lib/host.c b/src/lib/host.c
index cd40db2..6970aaf 100644
--- a/src/lib/host.c
+++ b/src/lib/host.c
@@ -41,8 +41,20 @@
MH_TRACE_INIT_DATA(mh_host);
-host_init_t host_init = { NULL, FALSE };
-cpuinfo_t cpuinfo = { NULL, 0, 0 };
+typedef struct host_init_s {
+ sigar_t *sigar;
+ gboolean sigar_init;
+} host_init_t;
+
+static host_init_t host_init;
+
+typedef struct cpuinfo_s {
+ char *model;
+ unsigned int cpus;
+ unsigned int cores;
+} cpuinfo_t;
+
+static cpuinfo_t cpuinfo;
static void
init(void)
diff --git a/src/lib/host_private.h b/src/lib/host_private.h
index 14d1543..95d8a2f 100644
--- a/src/lib/host_private.h
+++ b/src/lib/host_private.h
@@ -15,34 +15,26 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-#include <glib.h>
-
-typedef struct cpuinfo_s
-{
- char *model;
- unsigned int cpus;
- unsigned int cores;
-} cpuinfo_t;
-extern cpuinfo_t cpuinfo;
+/**
+ * \file
+ * \brief Platform specific function prototypes.
+ *
+ * The functions in this header must be implemented by the platform
+ * specific host data code.
+ * - host_linux.c
+ * - host_windows.c
+ */
-typedef struct host_init_s
-{
- sigar_t *sigar;
- gboolean sigar_init;
-} host_init_t;
+#ifndef __MH_HOST_PRIVATE_H__
+#define __MH_HOST_PRIVATE_H__
-extern host_init_t host_init;
+#include <glib.h>
-extern const char *host_os_get_operating_system(void);
-extern const char *host_os_get_architecture(void);
-extern const char *host_os_get_cpu_flags(void);
+const char *host_os_get_cpu_flags(void);
-extern unsigned int host_os_get_memory(void);
-extern unsigned int host_os_get_platform(void);
+void host_os_reboot(void);
-extern void host_os_reboot(void);
-extern void host_os_shutdown(void);
+void host_os_shutdown(void);
-extern void host_os_get_cpu_details(void);
+#endif /* __MH_HOST_PRIVATE_H__ */
--
1.7.4
13 years
[PATCH] Rename product to mimic package class name
by Adam Stokes
From: Adam Stokes <astokes(a)fedoraproject.org>
- Apparently qmf-tool is unable to query our data objects by product name alone and requires the proper class name. Most users will probably run something like
"list agents"
"set default <agent number>"
"query <product/agent name>"
If that product name does not match the class name then you will receive an empty query. So for sanity's sake whatever we name the classes in the schema we keep the product name the same.
---
src/net/matahari-net.cpp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/net/matahari-net.cpp b/src/net/matahari-net.cpp
index 5ba6d80..1cd02b7 100644
--- a/src/net/matahari-net.cpp
+++ b/src/net/matahari-net.cpp
@@ -55,7 +55,7 @@ int
main(int argc, char **argv)
{
NetAgent agent;
- int rc = agent.init(argc, argv, "net");
+ int rc = agent.init(argc, argv, "Network");
if (rc == 0) {
agent.run();
}
--
1.7.4
13 years
[PATCH] utilities.h: Make DIMOF() a bit more C++ safe.
by russell@russellbryant.net
Change sizeof(a[0]) to sizeof(0[a]) in the DIM() macro. This makes the
macro a bit more safe to have around in a C++ code base. In most cases,
you get the exact same result. The benefit is that this will blow up if
someone ever accidentally tries to use this on a C++ class that has
overridden the [] operator.
In passing, remove a duplicate definition of DIMOF().
Signed-off-by: Russell Bryant <russell(a)russellbryant.net>
---
src/include/matahari/utilities.h | 2 +-
src/lib/services_windows.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/include/matahari/utilities.h b/src/include/matahari/utilities.h
index e49db6a..cd209b4 100644
--- a/src/include/matahari/utilities.h
+++ b/src/include/matahari/utilities.h
@@ -26,7 +26,7 @@ extern const char *matahari_hostname(void);
extern void mh_abort(const char *file, const char *function, int line,
const char *assert_condition, int do_core, int do_fork);
-#define DIMOF(a) ((int) (sizeof(a)/sizeof(a[0])) )
+#define DIMOF(a) ((int) (sizeof(a) / sizeof(0[a])))
#ifndef __GNUC__
# define __builtin_expect(expr, result) (expr)
diff --git a/src/lib/services_windows.c b/src/lib/services_windows.c
index 733e66f..ae1e2be 100644
--- a/src/lib/services_windows.c
+++ b/src/lib/services_windows.c
@@ -22,10 +22,10 @@
#include "matahari/logging.h"
#include "matahari/mainloop.h"
#include "matahari/services.h"
+#include "matahari/utilities.h"
#include "services_private.h"
/* Some code adapted from http://msdn.microsoft.com/en-us/library/ms682499(v=vs.85).aspx */
-#define DIMOF(a) ((int) (sizeof(a)/sizeof(a[0])) )
static wchar_t *char2wide(const char *str)
{
--
1.7.4.4
13 years
Fwd: Forw: matahari: comparing Sigar and PCP for data gathering
by Andrew Beekhof
And forwarding the reply (with permission)
---------- Forwarded message ----------
From: Frank Ch. Eigler <fche(a)redhat.com>
Date: Wed, Apr 6, 2011 at 3:55 PM
Subject: Re: [Matahari] Forw: matahari: comparing Sigar and PCP for
data gathering
To: Andrew Beekhof <andrew(a)beekhof.net>
Hi, Andrew -
> First up, thankyou for the very detailed analysis.
> The challenge, from my perspective, is not so much "does PCP check the
> same boxes as Sigar" but more "Is there something compelling in PCP
> that makes the migration work worthwhile".
>
> To date, I'd have to say no.
Fair enough. My point was not to establish necessity for PCP, but its
(approximate) sufficiency. Once we get PCP into RHEL, and its
benefits become easier to see, then I suspect the issue will
eventually become how - not whether - to transition.
> [...] On that topic, how does PCP represent/name network interfaces
> on Windows?
>From pcp src/pmdas/windows/instance.c:
/*
* Examples:
* \\WINNT\Network Interface(MS TCP Loopback interface)\Bytes Total/sec
*/
case NETIF_INDOM:
it seems like they parse out the parenthesized part, s/ /_/g it, then use that.
- FChE
13 years, 1 month
[PATCH] Host agent connection test
by Adam Stokes
---
src/CMakeLists.txt | 2 ++
src/tests/host-agent.t.in | 21 +++++++++++++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)
create mode 100644 src/tests/host-agent.t.in
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b95bbc6..e2dbd5d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -186,4 +186,6 @@ install(TARGETS mcommon mhost msrv DESTINATION lib${LIB_SUFFIX})
install(FILES ${SCHEMAS} DESTINATION share/matahari)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/matahari.h DESTINATION include)
+# tests
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/tests/host-agent.t.in ${CMAKE_CURRENT_BINARY_DIR}/tests/host-agent.t)
diff --git a/src/tests/host-agent.t.in b/src/tests/host-agent.t.in
new file mode 100644
index 0000000..f671c04
--- /dev/null
+++ b/src/tests/host-agent.t.in
@@ -0,0 +1,21 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use Test::Simple tests => 1; # Increment as tests are added
+
+=head1
+Matahari host agent test suite
+=cut
+
+my $binary = "matahari-hostd";
+my $broker_host = @MATAHARI_BROKER@;
+my $broker_port = @MATAHARI_PORT@;
+
+my $cmd = "$binary -b $broker_host -p $broker_port";
+`$cmd`;
+
+my @args = ("pidof", $binary);
+ok( $? eq 0, "$binary is running");
+
+`pkill $binary`;
--
1.7.3.3
13 years, 1 month
Re: [Matahari] [PATCH] ConsoleAgent and ConsoleEvent - Support for receiving consoleevents so that we may monitor certain triggers and respond appropriately. For example, we have a configuration agent and the broker needs to know whether or not the s
by russell@russellbryant.net
That's quite a subject line. :-)
Regarding the naming, is "console" in this context the same thing as
console in QMF terminology? If not, I could see that being confusing.
On Mon, Apr 11, 2011 at 10:16 AM, <astokes(a)fedoraproject.org> wrote:
> +int main(int argc, char** argv)
> +{
> + ConsoleAgent *agent = new ConsoleAgent();;
> + int rc = agent->init(argc, argv, "console");
> + if(rc == 0) {
> + agent->run();
> + }
> + return rc;
How about exit(rc); instead?
> +}
> +
> +int
> +ConsoleAgent::setup(qmf::AgentSession session)
> +{
> + _instance = qmf::Data(_package.data_Console);
> + _instance.setProperty("uuid", host_get_uuid());
> + _instance.setProperty("hostname", host_get_hostname());
> + _instance.setProperty("status", "Waiting for console event");
> + session.addData(_instance);
> +
> + qmf::ConsoleSession _console_session;
> + _console_session = qmf::ConsoleSession(_amqp_connection);
I would recommend cutting this down to one line:
qmf::ConsoleSession _console_session(_amqp_connection);
That way, you only construct a single qmf::ConsoleSession. The
original code does more:
1) Construct a qmf::ConsoleSession using the default constructor.
2) Construct a second qmf::ConsoleSession using a constructor that
takes _amqp_connection as an argument.
3) Invoke the assignment operator on the first console session.
4) Run the destructor on the 2nd console session that only existed temporarily.
> + _console_session.open();
> + qmf::Agent agent;
> + while (true) {
> + if(_console_session.getAgentCount() > 0) {
> + agent = _console_session.getAgent(0);
> + qmf::ConsoleEvent result(agent.query("{class:Console, package:'org.matahariproject', where:[eq, hostname, [quote, supa.kooba]]}"));
> + if(result.getType() == qmf::CONSOLE_QUERY_RESPONSE) {
> + _instance.setProperty("status", "Received console event");
> + break;
> + }
> + }
> + qpid::sys::sleep(1);
> + }
> +
> + return 0;
> +}
> +
> +gboolean
> +ConsoleAgent::invoke(qmf::AgentSession session, qmf::AgentEvent event, gpointer user_data)
> +{
> + if(event.getType() == qmf::AGENT_METHOD) {
> + //const std::string& methodName(event.getMethodName());
> + }
> +}
> diff --git a/src/schema.xml b/src/schema.xml
> index ea82e4f..75c008b 100644
> --- a/src/schema.xml
> +++ b/src/schema.xml
> @@ -244,4 +244,9 @@
> </method-->
> </class>
>
> + <class name="Console">
> + <property name="uuid" type="sstr" access="RO" desc="Host UUID" />
> + <property name="hostname" type="sstr" access="RO" desc="Hostname" index="y"/>
> + <property name="status" type="sstr" access="RW" desc="Status of Instance" />
> + </class>
> </schema>
> --
> 1.7.4
>
> _______________________________________________
> Matahari mailing list
> Matahari(a)lists.fedorahosted.org
> https://fedorahosted.org/mailman/listinfo/matahari
>
13 years, 1 month
[PATCH] ConsoleAgent Additions
by Adam Stokes
From: Adam Stokes <astokes(a)fedoraproject.org>
- Added support for querying the console agent based on "uuid"
- used qmf::Data for caching any properties sent during the console event
- Next on the list is only making sure we care about systems that have not been configured rather than unconditionally updating agent properties on each run
---
src/console/matahari-console.cpp | 22 ++++++++++++++++++----
src/schema.xml | 1 +
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/console/matahari-console.cpp b/src/console/matahari-console.cpp
index 16f1618..7e7d348 100644
--- a/src/console/matahari-console.cpp
+++ b/src/console/matahari-console.cpp
@@ -64,14 +64,21 @@ ConsoleAgent::setup(qmf::AgentSession session)
qmf::ConsoleSession _console_session;
_console_session = qmf::ConsoleSession(_amqp_connection);
_console_session.open();
+ _console_session.setAgentFilter("[and, [eq, _vendor, [quote, 'matahariproject.org']], [eq, _product, [quote, 'console']]]");
+
qmf::Agent agent;
+ qmf::Data cached_config;
+
while (true) {
if(_console_session.getAgentCount() > 0) {
agent = _console_session.getAgent(0);
- qmf::ConsoleEvent result(agent.query("{class:Console, package:'org.matahariproject', where:[eq, hostname, [quote, supa.kooba]]}"));
+ qmf::ConsoleEvent result(agent.query("{class:Console, package:'org.matahariproject', where:[eq, uuid, [quote," + _instance.getProperty("uuid").asString() +"]]}"));
if(result.getType() == qmf::CONSOLE_QUERY_RESPONSE) {
- _instance.setProperty("status", "Received console event");
- break;
+ if(result.getDataCount() == 1) {
+ cached_config = result.getData(0);
+ _instance.setProperty("status", "Read console event for " + _instance.getProperty("hostname").asString());
+ break;
+ }
}
}
qpid::sys::sleep(1);
@@ -84,6 +91,13 @@ gboolean
ConsoleAgent::invoke(qmf::AgentSession session, qmf::AgentEvent event, gpointer user_data)
{
if(event.getType() == qmf::AGENT_METHOD) {
- //const std::string& methodName(event.getMethodName());
+ const std::string& methodName(event.getMethodName());
+ if(methodName == "update") {
+ _instance.setProperty("status", "update method sent");
+ }
+ goto bail;
}
+ session.methodSuccess(event);
+bail:
+ return TRUE;
}
diff --git a/src/schema.xml b/src/schema.xml
index 75c008b..3c8de7b 100644
--- a/src/schema.xml
+++ b/src/schema.xml
@@ -5,6 +5,7 @@
<!-- Common -->
<arg name="timestamp" type="absTime" />
<arg name="sequence" type="uint32" />
+ <arg name="uuid" type="sstr" />
<!-- Services API -->
<arg name="name" type="sstr" />
--
1.7.4
13 years, 1 month
[PATCH] ConsoleAgent and ConsoleEvent - Support for receiving consoleevents so that we may monitor certain triggers and respond appropriately. For example, we have a configuration agent and the broker needs to know whether or not the system hosting the agent is configured for use. - ConsoleAgent necessary for performing any duties based on method calls from an associated config agent. (we may want to just rename consoleagent to configagent unless there is a strong demand for a generic consoleagen
by Adam Stokes
From: Adam Stokes <astokes(a)fedoraproject.org>
---
src/CMakeLists.txt | 8 +++-
src/console/matahari-console.cpp | 89 ++++++++++++++++++++++++++++++++++++++
src/schema.xml | 5 ++
3 files changed, 101 insertions(+), 1 deletions(-)
create mode 100644 src/console/matahari-console.cpp
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ccef9da..6dd2bbb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -21,6 +21,7 @@ set(MCOMMON_VERSION 0.0.1)
set(MHOST_VERSION 0.0.1)
set(MSRV_VERSION 0.0.1)
set(MNET_VERSION 0.0.1)
+set(MCONSOLE_VERSION 0.0.1)
option(WITH-QMF "Build the QMF daemon" ON)
option(WITH-DBUS "Build the DBus daemon" ON)
@@ -37,8 +38,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_P
set(M_HOST "matahari-hostd")
set(M_NET "matahari-netd")
set(M_SRV "matahari-serviced")
+set(M_CONSOLE "matahari-consoled")
-set(DAEMONS ${M_HOST} ${M_NET} ${M_SRV})
+set(DAEMONS ${M_HOST} ${M_NET} ${M_SRV} ${M_CONSOLE})
file(GLOB SCHEMAS "${CMAKE_CURRENT_SOURCE_DIR}/*.xml")
@@ -54,6 +56,7 @@ set(SCHEMA_SOURCES
${CMAKE_CURRENT_BINARY_DIR}/qmf/org/matahariproject/Network.cpp
${CMAKE_CURRENT_BINARY_DIR}/qmf/org/matahariproject/Services.cpp
${CMAKE_CURRENT_BINARY_DIR}/qmf/org/matahariproject/Resources.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/qmf/org/matahariproject/Console.cpp
${CMAKE_CURRENT_BINARY_DIR}/qmf/org/matahariproject/EventHeartbeat.cpp
${CMAKE_CURRENT_BINARY_DIR}/qmf/org/matahariproject/EventService_op.cpp
${CMAKE_CURRENT_BINARY_DIR}/qmf/org/matahariproject/EventResource_op.cpp
@@ -93,6 +96,9 @@ target_link_libraries(${M_NET} mnet)
add_executable(${M_SRV} service/matahari-srv.cpp ${SCHEMA_SOURCES} ${COMMON_SOURCES})
target_link_libraries(${M_SRV} msrv)
+add_executable(${M_CONSOLE} console/matahari-console.cpp ${SCHEMA_SOURCES} ${COMMON_SOURCES})
+target_link_libraries(${M_CONSOLE} mhost)
+
foreach(daemon ${DAEMONS})
target_link_libraries(${daemon} mcommon)
if(WIN32)
diff --git a/src/console/matahari-console.cpp b/src/console/matahari-console.cpp
new file mode 100644
index 0000000..16f1618
--- /dev/null
+++ b/src/console/matahari-console.cpp
@@ -0,0 +1,89 @@
+/* matahari-console.cpp - Copyright (c) 2011 Red Hat, Inc.
+ * Written by Adam Stokes <astokes(a)fedoraproject.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef WIN32
+#include "config.h"
+#endif
+
+#include "matahari/mh_agent.h"
+#include <qmf/Data.h>
+#include <qmf/ConsoleEvent.h>
+#include <qmf/ConsoleSession.h>
+#include "qmf/org/matahariproject/Console.h"
+#include <qpid/sys/Time.h>
+
+#include <sstream>
+using namespace std;
+
+extern "C" {
+#include <sigar.h>
+#include "matahari/host.h"
+}
+
+class ConsoleAgent : public MatahariAgent
+{
+public:
+ int setup(qmf::AgentSession session);
+ gboolean invoke(qmf::AgentSession session, qmf::AgentEvent event, gpointer user_data);
+};
+
+int main(int argc, char** argv)
+{
+ ConsoleAgent *agent = new ConsoleAgent();;
+ int rc = agent->init(argc, argv, "console");
+ if(rc == 0) {
+ agent->run();
+ }
+ return rc;
+}
+
+int
+ConsoleAgent::setup(qmf::AgentSession session)
+{
+ _instance = qmf::Data(_package.data_Console);
+ _instance.setProperty("uuid", host_get_uuid());
+ _instance.setProperty("hostname", host_get_hostname());
+ _instance.setProperty("status", "Waiting for console event");
+ session.addData(_instance);
+
+ qmf::ConsoleSession _console_session;
+ _console_session = qmf::ConsoleSession(_amqp_connection);
+ _console_session.open();
+ qmf::Agent agent;
+ while (true) {
+ if(_console_session.getAgentCount() > 0) {
+ agent = _console_session.getAgent(0);
+ qmf::ConsoleEvent result(agent.query("{class:Console, package:'org.matahariproject', where:[eq, hostname, [quote, supa.kooba]]}"));
+ if(result.getType() == qmf::CONSOLE_QUERY_RESPONSE) {
+ _instance.setProperty("status", "Received console event");
+ break;
+ }
+ }
+ qpid::sys::sleep(1);
+ }
+
+ return 0;
+}
+
+gboolean
+ConsoleAgent::invoke(qmf::AgentSession session, qmf::AgentEvent event, gpointer user_data)
+{
+ if(event.getType() == qmf::AGENT_METHOD) {
+ //const std::string& methodName(event.getMethodName());
+ }
+}
diff --git a/src/schema.xml b/src/schema.xml
index ea82e4f..75c008b 100644
--- a/src/schema.xml
+++ b/src/schema.xml
@@ -244,4 +244,9 @@
</method-->
</class>
+ <class name="Console">
+ <property name="uuid" type="sstr" access="RO" desc="Host UUID" />
+ <property name="hostname" type="sstr" access="RO" desc="Hostname" index="y"/>
+ <property name="status" type="sstr" access="RW" desc="Status of Instance" />
+ </class>
</schema>
--
1.7.4
13 years, 1 month
Some notes on initial integration of Aeolus and Matahari
by Perry Myers
cross-posting to Aeolus and Matahari upstream projects...
We discussed sort of a pilot project for integration of Matahari into
Aeolus usage. The driver for this is that we need a way for folks
upstream to be able to deploy a single node Aeolus environment managing
1 or more Fedora hosts using kvm/libvirt (or VMware)
The problem is that we don't have a way in this environment to
bootstrap, specifically for Aeolus to get the ip address of the guests
as they are booting on the libvirt/kvm/VMware hosts.
I thought that this would be a good simple first use case for running
Matahari in Aeolus managed guests. So here's what I propose:
* Aeolus uses Image Factory to build images... When those images are
either Fedora, RHEL or Windows IF will include Matahari and puppet in
the core images
* Aeolus will inject basic bootstrapping info for Matahari like broker
ip address and broker auth info (this ignores the more complex post
boot config process Carl has for the time being, this process is
quick and dirty just to get stuff working and then we can expand to
use Carl's process as a second step)
* This injection could happen in a few ways:
- During image build
- During image deployment (using guestfish to inject a config file)
- Other? Could rely on DNS SRV records w/ no broker auth (again this
is meant for developer environments, not production usage)
* When an instance is booted, matahari comes up uses the injected config
and connects to the broker and a "hey I'm a new guest on the bus"
event should be sent out which includes the ip address of the guest
* Simple QMF console written that runs as part of the Conductor
infrastructure that monitors the bus for new 'I'm here' events and
when it sees one it grabs the ip address and stores it in the database
* It then calls a processConfig method (on which Agent?) which gives a
puppet file to a guest agent to process via a call to puppet tool.
Return from that method should be success or failure (with logging
info probably) This means puppet needs to be baked into the image as
well along with matahari.
TODOs:
Matahari Team:
* Write host agent event for 'i'm here configure me, here's my ip
address'
* Write method (which agent?) for processConfig(puppet-conf)
Aeolus Team:
* Need to write a simple QMF Console app that is part of the Conductor
that registers for 'new guest' events and when it sees these reports
that to Conductor and calls the processConfig method with the right
puppet script
* Run a broker alongside the Conductor and other Aeolus core
infrastructure. The ip address of the host running this is what
needs to be pushed into images for bootstrapping
The end goal here should be making it EASY for someone to grab Aeolus
and set it up quickly to manage local resources (i.e. we don't want to
_require_ people playing with Aeolus to need an EC2 account)
Andrew/Adam: Random question, what links all of the top level objects on
a single host together? Is there a common/shared UUID exposed by each
Agent? If a guest comes up and the Host agent appears, I can query that
Host object for UUID. But how do I know which Network Agent is the one
on the same guest as the Host Agent with the UUID that I just got?
Perry
13 years, 1 month
Forw: matahari: comparing Sigar and PCP for data gathering
by Frank Ch. Eigler
Hi -
RH folks asked us to analyze how PCP could fit in with matahari
(https://fedorahosted.org/matahari/), seeing that matahari already had
a sort-of-similar tool underneath it, Sigar. I undertook to compare
Sigar (1.6.5, rawhide, http://support.hyperic.com/display/SIGAR/Home)
to PCP (3.5.0, f15+, http://oss.sgi.com/projects/pcp), in context of
contemplating switching in matahari from the former to the latter.
Sigar provides a variety of functions, each of which returns the local
system's performance/system-information data in structs. PCP provides
a broader API, where similar data may individually be extracted by
supplied "metric name" from local or remote hosts. So, one needs to
match the Sigar API names and types they return to the PCP metrics.
Compare /usr/include/sigar.h to $(pminfo -L). See also $(pminfo -L -d
-F the.metric.name).
------------------------------------------------------------------------
According to "git grep sigar_" over the matahari code base, these are
the identifiers of interest:
sigar_proc_stat_t / sigar_proc_stat_get
sigar_loadavg_t / sigar_loadavg_get
sigar_sys_info_t
sigar_mem_t / sigar_mem_get
sigar_swap_t / sigar_swap_get
sigar_cpu_info[_list]_t / sigar_cpu_info_list_get/destroy
sigar_net_info_t / sigar_net_info_get
sigar_net_interface_list_t / sigar_net_interface_list_get/destroy
sigar_net_interface_config_t / sigar_net_interface_config_get/destroy
sigar_net_address_to_string
sigar_proc_kill
Handling each one in turn, listing the Sigar struct fields and the
corresponding PCP metric names:
------------------------------------------------------------------------
sigar_proc_stat_t
typedef struct {
sigar_uint64_t total; proc.runq.unknown + proc.runq.kernel + others
sigar_uint64_t sleeping; proc.runq.sleeping
sigar_uint64_t running; proc.runq.runnable
sigar_uint64_t zombie; proc.runq.defunct
sigar_uint64_t stopped; proc.runq.stopped
sigar_uint64_t idle; proc.runq.blocked
sigar_uint64_t threads; ? (not used by matahari)
} sigar_proc_stat_t;
This is used in matahari src/lib/host.c:host_get_processes() to send
qpid process_statistics. The fields generally correspond to the PCP
"proc.runq.*" metrics as listed above. No apparent Windows support on
Sigar/PCP.
Source Sigar:src/sigar.c PCP:src/pmdas/linux/proc_runq.c
------------------------------------------------------------------------
sigar_loadavg_t / sigar_loadavg_get
typedef struct {
double loadavg[3]; kernel.all.load [1,5,15]
} sigar_loadavg_t;
Basic stuff. Not available on windows on Sigar/PCP.
Source Sigar:src/os/linux/linux_sigar.c PCP:src/pmdas/linux/proc_loadavg.c
------------------------------------------------------------------------
sigar_sys_info_t
typedef struct {
char name[SIGAR_SYS_INFO_LEN];
char version[SIGAR_SYS_INFO_LEN];
char arch[SIGAR_SYS_INFO_LEN]; kernel.uname.machine
char machine[SIGAR_SYS_INFO_LEN]; kernel.uname.machine
char description[SIGAR_SYS_INFO_LEN];
char patch_level[SIGAR_SYS_INFO_LEN];
char vendor[SIGAR_SYS_INFO_LEN];
char vendor_version[SIGAR_SYS_INFO_LEN];
char vendor_name[SIGAR_SYS_INFO_LEN]; kernel.uname.sysname
char vendor_code_name[SIGAR_SYS_INFO_LEN]; kernel.uname.release
} sigar_sys_info_t;
This is used in matahari src/lib/host.c:host_get_architecture() and
host_get_operating_system(), to fetch only a few fields. PCP's
kernel.uname.distro ("Fedora release 13 (Goddard)") and pmda.uname
("Linux very.elastic.org 2.6.34.8-68.fc13.x86_64 #1 SMP Thu Feb 17
15:03:58 UTC 2011 x86_64") may be useful too.
Sigar:src/sigar.c, src/os/linux/linux_sigar.c, PCP:src/pmdas/linux/pmda.c
src/os/win32/win32_sigar.c src/pmdas/windows/pmda.c
------------------------------------------------------------------------
sigar_mem_t / sigar_mem_get
typedef struct {
sigar_uint64_t
ram,
total, mem.physmem, hinv.physmem
used,
free, mem.freemem
actual_used,
actual_free;
double used_percent;
double free_percent;
} sigar_mem_t;
Used by matahari for host_get_memory/host_get_mem_free to fetch only a
few fields. PCP also exposes a bunch of mem.util.* values from
/proc/meminfo on linux.
Sigar:src/os/linux/linux_sigar.c PCP:src/pmdas/linux/pmda.c
src/pmdas/windows/pmda.c
------------------------------------------------------------------------
sigar_swap_t / sigar_swap_get
typedef struct {
sigar_uint64_t
total, mem.util.swapTotal, swap.length
used, swap.used
free, mem.util.swapFree, swap.free
page_in, swap.in
page_out; swap.out
} sigar_swap_t;
Used by matahari for host_get_swap/host_get_swap_free to fetch only
a few fields. PCP also exposes a bunch of swap.*, swapdev.* values on
linux.
Sigar:src/os/linux/linux_sigar.c PCP:src/pmdas/linux/pmda.c
src/pmdas/windows/pmda.c
------------------------------------------------------------------------
sigar_cpu_info[_list]_t / sigar_cpu_info_list_get/destroy
typedef struct {
char vendor[128]; hinv.cpu.vendor
char model[128]; hinv.cpu.model
int mhz;
int mhz_max;
int mhz_min;
sigar_uint64_t cache_size;
int total_sockets;
int total_cores; n/a
int cores_per_socket;
} sigar_cpu_info_t;
typedef struct {
unsigned long number; hinv.ncpu
unsigned long size;
sigar_cpu_info_t *data;
} sigar_cpu_info_list_t;
Used by matahari in src/lib/hast.c:host_get_cpu_details to grab a few
fields. The number-of-cores query could be hard-coded into matahari
for now; PCP should be extended to provide the same info. OTOH the
Sigar measure is heuristic (just runs on a single cpu, not on each of
them), so it's already not reliable. See also PCP hinv.cpu.*.
Sigar:src/os/linux/linux_sigar.c PCP:src/pmdas/linux/pmda.c
src/sigar_util.c
------------------------------------------------------------------------
sigar_net_info_t / sigar_net_info_get
typedef struct {
char default_gateway[SIGAR_INET6_ADDRSTRLEN];
char default_gateway_interface[16];
char host_name[SIGAR_MAXHOSTNAMELEN]; n/a
char domain_name[SIGAR_MAXDOMAINNAMELEN];
char primary_dns[SIGAR_INET6_ADDRSTRLEN];
char secondary_dns[SIGAR_INET6_ADDRSTRLEN];
} sigar_net_info_t;
Used in matahari src/lib/utilities.c:matahari_hostname() to fetch just
the host_name field. PCP does not appear to pass back such an
uncooked gethostname() value, but matahari could call gethostname()
directly.
Sigar:src/sigar.c(sigar_net_info_get)
------------------------------------------------------------------------
sigar_net_interface_list_t / sigar_net_interface_list_get/destroy
sigar_net_interface_config_t / sigar_net_interface_config_get/destroy
typedef struct {
char name[16]; instance names from network.interface.*
char type[64];
char description[256];
sigar_net_address_t hwaddr; n/a; should be network.interface.hwaddr
sigar_net_address_t address; network.interface.inet_addr
sigar_net_address_t destination;
sigar_net_address_t broadcast;
sigar_net_address_t netmask;
sigar_net_address_t address6;
int prefix6_length;
int scope6;
sigar_uint64_t
flags,
mtu, network.interface.mtu
metric;
int tx_queue_len;
} sigar_net_interface_config_t;
typedef struct {
unsigned long number;
unsigned long size;
char **data;
} sigar_net_interface_list_t;
Used by matahari in src/lib/network.c to gather all the interfaces and
used in several places. PCP does not appear to provide as much
per-interface ioctl(SIOCG*) data currently, nor IPv6. This represents
a missing PCP feature that may take a few weeks to bring up to par.
Sigar:src/os/linux/linux_sigar.c PCP:src/pmdas/linux/proc_net_dev.c
src/sigar.c src/pmdas/windows/pmda.c
------------------------------------------------------------------------
sigar_net_address_to_string
This function is approximately supplanted by the PCP
network.interface.inet_addr metric, which gives strings back:
% pminfo -L -d -F network.interface.inet_addr
network.interface.inet_addr
Data Type: string InDom: 60.17 0xf000011
Semantics: instant Units: none
inst [0 or "lo"] value "127.0.0.1"
inst [1 or "eth0"] value "192.168.1.1"
------------------------------------------------------------------------
sigar_proc_kill
This oddball kill(2) abstracter function could be pulled into
matahari. The windows port consists of a dozen lines of code in
Sigar:src/sigar_signal.c
------------------------------------------------------------------------
I believe this represents a mapping between the Sigar stuff used by
matahari, and what's available from equivalent local PCP sources. The
PCP API, being a little more generic, is a little more wordy than
Sigar, but not too much so. The only nontrivial amount of work here
appears to be the network-interface metadata, which is rather richer
in Sigar than in PCP.
The design of PCP makes it straightforward to extend it with data
sources like this via out-of-tree PMDAs, so no change of the PCP core
code is required to add the missing data. OTOH the PCP people are
friendly to contributions, so merging such things into the master tree
would probably not be a big deal.
Thanks for reading through all this. Any questions?
- FChE
13 years, 1 month