icinga2/dyntest/dyntest.cpp

27 lines
734 B
C++
Raw Normal View History

2012-05-31 10:16:32 +02:00
#include <i2-dyn.h>
#include <i2-jsonrpc.h>
2012-05-30 10:43:58 +02:00
using namespace icinga;
int main(int argc, char **argv)
{
ConfigContext ctx;
ctx.Compile();
set<DConfigObject::Ptr> objects = ctx.GetResult();
for (auto it = objects.begin(); it != objects.end(); it++) {
DConfigObject::Ptr obj = *it;
cout << "Object, name: " << obj->GetName() << ", type: " << obj->GetType() << endl;
cout << "\t" << obj->GetParents().size() << " parents" << endl;
cout << "\t" << obj->GetExpressionList()->GetLength() << " top-level exprs" << endl;
Dictionary::Ptr props = obj->CalculateProperties();
cout << "\t" << props->GetLength() << " top-level properties" << endl;
MessagePart mp(props);
cout << mp.ToJsonString() << endl;
}
2012-05-30 10:43:58 +02:00
return 0;
}