#ifndef _Z_TYPES_H #define _Z_TYPES_H /* 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. * * Please visit http://zentific.com for news and updates * * 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. */ #include "zlist.h" typedef struct netstats { /* Received */ unsigned long long rbytes; unsigned long long rpackets; unsigned long long rerrs; unsigned long long rdrop; unsigned long long rfifo; unsigned long long frame; unsigned long long rcompressed; unsigned long long multicast; /* Transmitted */ unsigned long long tbytes; unsigned long long tpackets; unsigned long long terrs; unsigned long long tdrop; unsigned long long tfifo; unsigned long long colls; unsigned long long carrier; unsigned long long tcompressed; } netstats; /* note: sectors here are standard 512 byte unix sectors * and have nothing at all to do with device or filesystem * specific sector sizes * * -----VARIABLE--------UNIT------------DESCRIPTION-------------------------- * XXX_ios requests number of read I/Os processed * XXX_merges requests number of read I/Os merged w/ in-queue I/O * XXX_sectors sectors number of sectors read * XXX_ticks milliseconds total wait time for read requests * * see kernel Documentation/block/stat.txt */ typedef struct diskstats { /* Read */ unsigned long long read_ios; unsigned long long read_merges; unsigned long long read_sectors; unsigned long long read_ticks; /* Written */ unsigned long long write_ios; unsigned long long write_merges; unsigned long long write_sectors; unsigned long long write_ticks; /* Other */ unsigned long long in_flight; /* num i/o requests being processed now */ unsigned long long io_ticks; /* total time block dev has been active */ unsigned long long time_in_queue; /* total wait time for all requests */ } diskstats; /* NOTE: killed off the vif struct because * vifs can be satisfactorily represented using * a common iface structure */ typedef struct iface { int id; char *name; int promisc; int bridge; int up; char *bridgeif; char *script; char *mac; char *type; char *ip; char *netmask; char *gateway; char *broadcast; netstats *stats; } iface; /* TODO determine whether this structure can be * deprecated. * Does not seem to be a possibility, because * it would require ability to separate stats of * mapped devices (or files via blktap, etc) to * block device, which may not be possible. */ typedef struct vbd { int block_size; int start_sector; int disk_id; int size_sector; int num_sectors; char *internal_dev; char *external_dev; char *mode; char *device_type; char *vbd_type; char *mapped_dev; char *partition_type; unsigned int dev; //minimum data expected unsigned long long oo_req; unsigned long long rd_req; unsigned long long wr_req; //not defined by all kernels unsigned long long rd_sect; unsigned long long wr_sect; unsigned long long rd_bytes; unsigned long long wr_bytes; } vbd; typedef struct disk { char *path; diskstats *stats; } disk; typedef struct vcpu { //from struct xen_domctl_getvcpuinfo uint32_t vcpu; uint8_t online; // currently online (not hotplugged)? uint8_t blocked; // blocked waiting for an event? uint8_t running; // currently scheduled on its CPU? uint64_t cpu_time; // total cpu time consumed (ns) uint32_t cpu; // current mapping double cpu_pct; } vcpu; typedef struct guest { char *uuid; char *puuid; char *name; char *ostype; char *vmtype; char *vnc_port; char *vnc_passwd; char *kernel; char *ramdisk; char *cmdline; char *on_reboot; char *on_crash; char *on_poweroff; char *state; int uptime; //new int shutdown_reason; zlist *vcpus; unsigned int domid; unsigned int numvcpus; unsigned long long mem; unsigned long long maxmem; double cpu_pct; unsigned long long cputime; unsigned long long txbw; unsigned long long rxbw; int numnets; int numvbds; zlist *vbds; zlist *vifs; } guest; typedef struct host { long num_cpus; long cpu_mhz; int cores_per_socket; int threads_per_core; int sockets_per_node; int page_size; int num_cpu_nodes; long tot_phys_mem; long free_phys_mem; double cpu_pct; char *hwuuid; /* not host, but host os */ float iowait; float loads[3]; /* one, five, fifteen minute load averages */ long uptime; /* uptime in s */ int procs; /* num processes */ unsigned long long ctxt;/* context switches/s */ unsigned long long intr;/* interrupts/s */ unsigned long long mem_free; unsigned long long mem_total; unsigned long long mem_shared; unsigned long long mem_buffered; unsigned long long swap_free; unsigned long long swap_total; /* char hostname[HOST_NAME_MAX+1]; char address[15+1]; //FIXME is this appropriate xxx.xxx.xxx.xxx char domainname[HOST_NAME_MAX+1]; */ char *hostname; char *address; char *domainname; char *kernel_ver; char *os_ver; char *arch; char *default_vnc_passwd; char *xen_ver; int hvm; char *capabilities; //new int num_domains; } host; typedef struct config { int DEBUG; int XML_DEBUG; int REGISTERED; int DELAY; int SEND_DATA; int USE_SSL; int PORT; /* char XMLRPC_PATH[PATH_MAX+1]; char BACKEND_HOST[HOST_NAME_MAX+1]; char CONFIG_FILE[PATH_MAX+1]; char PID_FILE[PATH_MAX+1]; char LOG_FILE[PATH_MAX+1]; char LOG_TYPE[128]; */ char *XMLRPC_PATH; char *BACKEND_HOST; char *CONFIG_FILE; char *PID_FILE; char *LOG_FILE; char *LOG_TYPE; char *LOG_PREFIX; char *session_id; char *username; char *password; char *client_cert; char *NODE_UUID; } config; #endif