/* zentific-poll: statistics collection daemon for Zentific * Copyright (C) 2007, 2008 * Steven Maresca, Justin Demaris, * and Zentific LLC * * All rights reserved. * Use is subject to license terms. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ //---------------INCLUDES------------------- #ifndef ZENTIFIC_POLL_H #define ZENTIFIC_POLL_H //system lib includes #include #include #include #include #include #include #include #include #include #include #include #include #include /* for AF_INET */ #include #include //logging #include //new_str #include //system information #include // uname, kernel, etc #include // load, uptime, etc //no longer needed //#include // for MAJOR and MINOR dev numbers //xen includes #include #include #include "libxenstat/src/xenstat.h" //block device investigation #include "blockdata.h" //regular expression matching in is_uuid #include //xend pass #include "xendpw.h" //daemonizing #include "daemon.h" //https xmlrpc #include "ssl_send.h" //zentific types #include "zentific-defines.h" #include "zentific-types.h" //----------FUNCTION DEFINITIONS------------ void initialize(int argc, char **argv); void config_reload(int signum); void cleanup_exit(int signum); static void version(void); static void usage(char*); int parse_config(void); void display_config(void); //xenstore functions char *get_uuid(unsigned int domain_id); char *get_vm_type(char *uuid); char *get_os_type(char *uuid); char *get_state(xenstat_domain *domain); char *get_vnc_port(unsigned int domain_id); char *get_vnc_passwd(unsigned int domain_id); char *get_ramdisk(char *uuid); char *get_kernel(char *uuid); char *get_kernel_cmdline(char *uuid); char *get_crash_action(char *uuid); char *get_poweroff_action(char *uuid); char *get_reboot_action(char *uuid); int get_uptime(char *uuid); double get_cpu_pct(xenstat_domain *domain); int get_vbd_stats(xenstat_vbd *vbds, int numvbds, int domid, vbd *disks); int get_vif_stats(xenstat_network *nets, int numnets, int domid, vif *vifs, unsigned long long *rxbw, unsigned long long *txbw, char *vmtype); int register_node(void); void update_stats(void); int update_node(void); //display debugging void display_node(void); void display_guest(guest *aguest); //node stats functions unsigned long long get_intr (); unsigned long long get_ctxt (); float get_iowait (); //utility functions char *strlwr(char *s); char *new_str(const char *fmt, ...); int get_hw_uuid(char *out); int log_msg(char *msg); //xml-rpc functions int xmlrpc_check_response(char *response, char *checkmsg, int checkmsglen); int xmlrpc_call(char *method, char *params[], int len, char *resp); char *xmlrpc_struct_member(char *name, char *value); char *xmlrpc_value(char *value); char *xmlrpc_param(char *value); char *xmlrpc_params(char *value); char *xmlrpc_struct(char *value); char *xmlrpc_method_call(char *value, char *params); char *xmlrpc_string(char *value); char *xmlrpc_int(int value); char *xmlrpc_double(unsigned long long value); char *xmlrpc_array(char *value); char *xmlrpc_str_int(char *value); int match_regex(const char* str, const char* regex); int is_uuid(char *uuid); char *str_append(char *dest, char *source); #endif