Revision 14d30d82 src/host/HostPool.cc

View differences:

src/host/HostPool.cc
29 29
/* -------------------------------------------------------------------------- */
30 30
/* -------------------------------------------------------------------------- */
31 31

  
32
int HostPool::_host_monitoring_history;
33

  
34
/* -------------------------------------------------------------------------- */
35
/* -------------------------------------------------------------------------- */
36

  
32 37
HostPool::HostPool(SqlDB*                    db,
33 38
                   vector<const Attribute *> hook_mads,
34 39
                   const string&             hook_location,
35 40
                   const string&             remotes_location,
36
                   int                       host_monitoring_history)   // TODO
41
                   int                       host_monitoring_history)
37 42
                        : PoolSQL(db, Host::table, true)
38 43
{
39 44
    // ------------------ Initialize Hooks for the pool ----------------------
......
143 148

  
144 149
        add_hook(hook);
145 150
    }
151

  
152
    _host_monitoring_history = host_monitoring_history;
146 153
}
147 154

  
148 155
/* -------------------------------------------------------------------------- */
......
290 297

  
291 298
    return rc;
292 299
}
300

  
301
/* -------------------------------------------------------------------------- */
302
/* -------------------------------------------------------------------------- */
303

  
304
int HostPool::dump_monitoring(
305
        ostringstream& oss,
306
        const string&  where)
307
{
308
    ostringstream cmd;
309

  
310
    cmd << "SELECT " << Host::monit_table << ".body FROM " << Host::monit_table
311
        << " INNER JOIN " << Host::table
312
        << " WHERE hid = oid";
313

  
314
    if ( !where.empty() )
315
    {
316
        cmd << " AND " << where;
317
    }
318

  
319
    cmd << " ORDER BY hid, " << Host::monit_table << ".last_mon_time;";
320

  
321
    return PoolSQL::dump(oss, "MONITORING_DATA", cmd);
322
}

Also available in: Unified diff