beostat_get_time

Name

beostat_get_time -- get the time of the last update for node

Synopsis

#include <sys/beostat.h>

int beostat_get_time (int node, struct node_time *node_time);

Arguments

node

The node to query

node_time

A pointer to a struct node_time, which is defined as:

struct node_time {
  time_t time;
};

Description

beostat_get_time will get the time of the last update to the Beostat system by a given node. The Beostat system works by sending node status information periodically from each node in the cluster. This function provides the time of the last update from a given node. It is useful when timely information is required and old information should be disregarded. The time is measured in seconds since the standard UNIX Epoch (00:00:00 UTC, January 1, 1970). Use functions like ctime() to convert to a human readable string.

Example:

time_t time;
beostat_get_time (3, &time);
printf ("The time of the last update for node 3 is %s\n", ctime(&time));

Return Value

Return 0 on success. If an error occurs it will return -1.

Errors

This function relies on the Beostat subsystem, which consists of the proc filesystem on the remote node, the sendstatsdaemon on the remote node, the recvstats daemon on the master node, and two shared memory files in the directory /var/shm. If any part of the system breaks down, this function could fail.