16 #include <sys/types.h> 25 #include <sys/resource.h> 61 }
else if (op->
params != NULL) {
67 g_hash_table_iter_init(&iter, op->
params);
69 while (g_hash_table_iter_next(&iter, (gpointer *) & key,
70 (gpointer *) & value)) {
91 g_hash_table_destroy(op->
params);
108 switch (exit_status) {
126 nagios_metadata_name(
const char *plugin)
134 GList *plugin_list = NULL;
140 for (GList *gIter = plugin_list; gIter != NULL; gIter = gIter->next) {
142 const char *plugin = gIter->data;
143 char *metadata = nagios_metadata_name(plugin);
145 if (stat(metadata, &
st) == 0) {
150 g_list_free_full(plugin_list, free);
166 if (stat(buf, &
st) == 0) {
178 FILE *file_strm = NULL;
179 int start = 0, length = 0, read_len = 0;
180 char *metadata_file = nagios_metadata_name(
type);
182 file_strm = fopen(metadata_file,
"r");
183 if (file_strm == NULL) {
184 crm_err(
"Metadata file %s does not exist", metadata_file);
190 start = ftell(file_strm);
191 fseek(file_strm, 0L, SEEK_END);
192 length = ftell(file_strm);
193 fseek(file_strm, 0L, start);
199 crm_info(
"%s was not valid", metadata_file);
205 crm_trace(
"Reading %d bytes from file", length);
207 read_len = fread(*output, 1, length, file_strm);
208 if (read_len != length) {
209 crm_err(
"Calculated and read bytes differ: %d vs. %d",
ocf_exitcode
Exit status codes for resource agents.
guint interval_ms
Action interval for recurring resource actions, otherwise 0.
int services__nagios_prepare(svc_action_t *op)
#define PCMK_ACTION_MONITOR
int services__get_nagios_metadata(const char *type, char **output)
GList * services_os_get_directory_list(const char *root, gboolean files, gboolean executable)
enum crm_ais_msg_types type
Wrappers for and extensions to glib mainloop.
svc_action_private_t * opaque
This field should be treated as internal to Pacemaker.
#define crm_trace(fmt, args...)
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
Object for executing external actions.
char * agent
Resource agent name for resource actions, otherwise NULL.
gboolean services__nagios_agent_exists(const char *name)
Wrappers for and extensions to libxml2.
char * pcmk__full_path(const char *filename, const char *dirname)
Duplicate a file path, inserting a prefix if not absolute.
#define PCMK_XA_CRM_FEATURE_SET
Service active but more likely to fail soon.
char * action
Name of action being executed for resource actions, otherwise NULL.
pcmk__action_result_t result
#define NAGIOS_PLUGIN_DIR
#define crm_err(fmt, args...)
GList * services__list_nagios_agents(void)
#define pcmk__assert_alloc(nmemb, size)
#define crm_info(fmt, args...)
#define NAGIOS_METADATA_DIR
enum ocf_exitcode services__nagios2ocf(int exit_status)