summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9b8de8e)
raw | patch | inline | side by side (parent: 9b8de8e)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 3 Aug 2014 20:34:14 +0000 (22:34 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 3 Aug 2014 20:34:14 +0000 (22:34 +0200) |
To make that work, let the mock_plugin store some metrics as well.
t/integration/mock_plugin.c | patch | blob | history | |
t/integration/simple_query.sh | patch | blob | history |
index 8dcb410af3492a0da588c6ba56f5cc7c3b5ddfaf..8c161943617f58db39f195df1b87b7589941bc3b 100644 (file)
"localhost",
};
+static struct {
+ const char *hostname;
+ const char *metric;
+} metrics[] = {
+ { "some.host.name", "foo/bar/qux" },
+ { "some.host.name", "foo/bar/baz" },
+ { "some.host.name", "foo2/bar/qux" },
+ { "some.host.name", "foo2/bar/baz" },
+ { "other.host.name", "foo/bar/qux" },
+ { "other.host.name", "foo/bar/baz" },
+ { "other.host.name", "foo2/bar/qux" },
+ { "other.host.name", "foo2/bar/baz" },
+};
+
static struct {
const char *hostname;
const char *service;
exit(1);
}
}
+ for (i = 0; i < SDB_STATIC_ARRAY_LEN(metrics); ++i) {
+ if ((check = sdb_store_metric(metrics[i].hostname,
+ metrics[i].metric, sdb_gettime()))) {
+ sdb_log(SDB_LOG_ERR, "mock::plugin: Failed to store metric: "
+ "status %d", check);
+ exit(1);
+ }
+ }
for (i = 0; i < SDB_STATIC_ARRAY_LEN(services); ++i) {
if ((check = sdb_store_service(services[i].hostname,
services[i].service, sdb_gettime()))) {
index f191d650babfa663d1d78eb47104d1614406ec4a..4398b2b9da935be695ed80871cffc7db4690c976 100755 (executable)
&& exit 1
echo "$output" | grep -F 'not found'
+output="$( run_sysdb -H "$SOCKET_FILE" \
+ -c "LOOKUP hosts MATCHING metric = 'foo/bar/qux'" )"
+echo "$output" \
+ | grep -F '"some.host.name"' \
+ | grep -F '"other.host.name"'
+echo "$output" | grep -F 'localhost' && exit 1
+echo "$output" | grep -F 'host1.example.com' && exit 1
+echo "$output" | grep -F 'host2.example.com' && exit 1
+
+output="$( run_sysdb -H "$SOCKET_FILE" \
+ -c "LOOKUP hosts MATCHING service = 'mock service'" )"
+echo "$output" \
+ | grep -F '"some.host.name"' \
+ | grep -F '"host1.example.com"' \
+ | grep -F '"host2.example.com"'
+echo "$output" | grep -F 'localhost' && exit 1
+echo "$output" | grep -F 'other.host.name' && exit 1
+
output="$( run_sysdb -H "$SOCKET_FILE" \
-c "LOOKUP hosts MATCHING attribute.architecture = 'x42'" )"
echo "$output" \