/* 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. */ //some duplication here, will be cleaned struct xenstat_handle { int xc_handle; struct xs_handle *xshandle; /* xenstore handle */ int page_size; FILE *procnetdev; DIR *sysfsvbd; char xen_version[VERSION_SIZE]; /* xen version running on this node */ }; struct xenstat_domain { unsigned int id; char *name; unsigned int state; unsigned long long cpu_ns; /* CPU time in nanoseconds */ unsigned int num_vcpus; /* No. vcpus configured for domain */ xenstat_vcpu *vcpus; /* Array of length num_vcpus */ unsigned long long cur_mem; /* Current memory reservation */ unsigned long long max_mem; /* Total memory allowed */ unsigned int ssid; /* security id ??? used for ACM stuff? */ unsigned int num_networks; xenstat_network *networks; /* Array of length num_networks */ unsigned int num_vbds; //void *vbds; xenstat_vbd *vbds; }; struct xenstat_network { unsigned int id; /* Received */ unsigned long long rbytes; unsigned long long rpackets; unsigned long long rerrs; unsigned long long rdrop; /* Transmitted */ unsigned long long tbytes; unsigned long long tpackets; unsigned long long terrs; unsigned long long tdrop; }; //NOTE: back_type is not present in the vanilla xenstat // distributed with 3.0.4, but works without issue struct xenstat_vbd { unsigned int back_type; unsigned int dev; unsigned long long oo_reqs; unsigned long long rd_reqs; unsigned long long wr_reqs; }; typedef struct host { long num_cpus; long cpu_mhz; int cores_per_socket; int threads_per_core; int sockets_per_node; int num_cpu_nodes; long tot_mem; long free_mem; double cpu_pct; char *hwuuid; 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 *kernel_ver; char *os_ver; char *arch; char *default_vnc_passwd; const char *xen_ver; } host; typedef struct vbd { char *internal_dev; char *external_dev; char *mode; char *type; int size_sector; int num_sectors; unsigned int dev; unsigned long long oo_reqs; unsigned long long rd_reqs; unsigned long long wr_reqs; char *mapped_dev; int block_size; int start_sector; char *partition_type; } vbd; typedef struct vif { char *vifname; char *bridge; char *script; char *mac; char *type; unsigned long long rbytes; unsigned long long rpackets; unsigned long long rerrs; unsigned long long rdrop; unsigned long long tbytes; unsigned long long tpackets; unsigned long long terrs; unsigned long long tdrop; } vif; 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; unsigned int domid; unsigned int vcpus; unsigned long long mem; unsigned long long maxmem; double cpu_pct; unsigned long long cputime; unsigned long long txbw; unsigned long long rxbw; unsigned int numnets; unsigned int numvbds; vbd *vbds; vif *vifs; } guest;