Scopira
20080306
|
#include <uptimeservice.h>
Public Member Functions | |
uptime_service (scopira::agent::task_context &ctx) | |
constructor | |
~uptime_service () | |
destructor | |
void | update_uptime (void) |
int | get_num_agents (void) |
returns the number of agents being monitored | |
const std::string & | get_value (int agentnum, const std::string &key) |
This is a service pack for accessing the uptime service. Each agent has uptime task service, which, when queried can return many statistics and other information about that agent, it's host machine and it's tasks.
These uptime server tasks are created one-per-agent when this class is created and destroyed. Therefore, this is not a light operation.
A "service pack" is a C++ API object that easies access to a service task. It handles all the protocol communication with that service.
const std::string& scopira::agent::uptime_service::get_value | ( | int | agentnum, |
const std::string & | key | ||
) |
Get the value for the given key from the given agentid. agentid should be [0..get_num_agents).
This will return BAD_AGENT or BAD_KEY for various errors.
Key, for now, can be: keylist hostname age agentuuid load numcpu tasks ostype
Referenced by get_num_agents().
void scopira::agent::uptime_service::update_uptime | ( | void | ) |
All the values for get_value are cached internally. Call this will update the cached values from the agents. This is called initially by the uptime_service constructor, too.