Example #1
0
char *get_machine_hardware_name()
{
    switch (get_ostype()) {
        case APPLE_UNKNOWN: return "Unknown";
        case APPLE_II:      return "Apple ][";
        case APPLE_IIPLUS:  return "Apple ][+";
        case APPLE_IIIEM:   return "Apple /// (emulation)";
        case APPLE_IIE:     return "Apple //e";
        case APPLE_IIEENH:  return "Apple //e (enhanced)";
        case APPLE_IIECARD: return "Apple //e Option Card";
        case APPLE_IIC:     return "Apple //c";
        case APPLE_IIC35:   return "Apple //c (3.5 ROM)";
        case APPLE_IICEXP:  return "Apple //c (Mem. Exp.)";
        case APPLE_IICREV:  return "Apple //c (Rev. Mem. Exp.)";
        case APPLE_IICPLUS: return "Apple //c Plus";
        case APPLE_IIGS:    return "Apple IIgs";
        case APPLE_IIGS1:   return "Apple IIgs (ROM 1)";
        case APPLE_IIGS3:   return "Apple IIgs (ROM 3)";
        default:            return "Unknown";
    }
}
Example #2
0
int main(void)
{
    unsigned int t, v;
    unsigned char palntsc;
    unsigned char *rev;
    unsigned char minor;
    unsigned char c;

    t = get_ostype();    /* get computer type */
    v = get_tv();        /* get tv system */

    palntsc = (v == AT_PAL);

    minor = (t & AT_OS_TYPE_MINOR) >> 5;
    switch(t & AT_OS_TYPE_MAIN) {
        case AT_OS_UNKNOWN:
        default:
            printf("unknown system type !!\n");
            break;
        case AT_OS_400800:
            if (minor == 1) rev = "A";
            else rev = "B";
            printf("it's a 400/800, %s, Rev. %s\n",palntsc ? "PAL" : "NTSC",rev);
            break;
        case AT_OS_1200XL:
            if (minor == 1) rev = "10";
            else rev = "11";
            printf("it's a 1200XL, %s, Rev. %s\n",palntsc ? "PAL" : "NTSC",rev);
            break;
        case AT_OS_XLXE:
            printf("is'a a XL/XE, %s, Rev. %d\n",palntsc ? "PAL" : "NTSC",minor);
            break;
    }
    printf("hit <RETURN> to continure...\n");
    c = getchar();
}
Example #3
0
int main(int argc, char **argv)
{
        int c;
        char *domain = NULL;
        char *uri = "xen";
        char *file = NULL;
        bool xml = false;
        bool cap = false;
        struct domain *dominfo = NULL;
        struct capabilities *capsinfo = NULL;
        struct cap_domain_info *capgdinfo = NULL;
        int ret;

        static struct option lopts[] = {
                {"domain", 1, 0, 'd'},
                {"uri",    1, 0, 'u'},
                {"xml",    0, 0, 'x'},
                {"file",   1, 0, 'f'},
                {"cap",    0, 0, 'c'},
                {"help",   0, 0, 'h'},
                {0,        0, 0, 0}};

        while (1) {
                int optidx = 0;

                c = getopt_long(argc, argv, "d:u:f:xch", lopts, &optidx);
                if (c == -1)
                        break;

                switch (c) {
                case 'd':
                        domain = optarg;
                        break;

                case 'u':
                        uri = optarg;
                        break;

                case 'f':
                        file = optarg;
                        break;

                case 'x':
                        xml = true;
                        break;

                case 'c':
                        cap = true;
                        break;

                case '?':
                case 'h':
                        usage();
                        return c == '?';
                };
        }

        if (file != NULL)
                ret = dominfo_from_file(file, &dominfo);
        else if (domain != NULL)
                ret = dominfo_from_dom(uri, domain, &dominfo);
        else {
                printf("Need a data source (--domain or --file)\n");
                return 1;
        }

        if (ret == 0) {
                printf("Unable to get dominfo\n");
                return 2;
        }

        if (xml)
                print_domxml(dominfo, stdout);
        else {
                print_dominfo(dominfo, stdout);
                print_devices(dominfo, stdout);
        }

        if (cap && file == NULL) {
                ret = capinfo_for_dom(uri, dominfo, &capsinfo);
                if (ret == 0) {
                        printf("Unable to get capsinfo\n");
                        return 3;
                } else {
                        print_capabilities(capsinfo, stdout);
                        const char *os_type = get_ostype(dominfo);
                        const char *dom_type = get_domaintype(dominfo);
                        const char *def_arch = get_default_arch(capsinfo, os_type);

                        fprintf(stdout, "-- KVM is used: %s\n\n", (use_kvm(capsinfo)?"true":"false"));
                        fprintf(stdout, "-- For all following default OS type=%s\n", os_type);
                        fprintf(stdout, "-- Default Arch : %s\n", def_arch);

                        fprintf(stdout,
                                "-- Default Machine for arch=NULL : %s\n",
                                get_default_machine(capsinfo, os_type, NULL, NULL));
                        fprintf(stdout,
                                "-- Default Machine for arch=%s and domain type=NULL : %s\n",
                                def_arch,
                                get_default_machine(capsinfo, os_type, def_arch, NULL));
                        fprintf(stdout,
                                "-- Default Machine for arch=%s and domain type=%s : %s\n",
                                def_arch, dom_type,
                                get_default_machine(capsinfo, os_type, def_arch, dom_type));
                        fprintf(stdout,
                                "-- Default Machine for arch=NULL and domain type=%s : %s\n",
                                dom_type,
                                get_default_machine(capsinfo, os_type, NULL, dom_type));

                        fprintf(stdout,
                                "-- Default Emulator for arch=NULL : %s\n",
                                get_default_emulator(capsinfo, os_type, NULL, NULL));
                        fprintf(stdout,
                                "-- Default Emulator for arch=%s and domain type=NULL : %s\n",
                                def_arch,
                                get_default_emulator(capsinfo, os_type, def_arch, NULL));
                        fprintf(stdout,
                                "-- Default Emulator for arch=%s and domain type=%s : %s\n",
                                def_arch, dom_type,
                                get_default_emulator(capsinfo, os_type, def_arch, dom_type));
                        fprintf(stdout,
                                "-- Default Emulator for arch=NULL and domain type=%s : %s\n",
                                dom_type,
                                get_default_emulator(capsinfo, os_type, NULL, dom_type));

                        fprintf(stdout, "\n-- Default Domain Search for: \n"
                                "guest type=hvm - guest arch=* - guest domain type=kvm\n");
                        capgdinfo = findDomainInfo(capsinfo, "hvm", NULL, "kvm");
                        print_cap_domain_info(capgdinfo, stdout);

                        fprintf(stdout, "-- Default Domain Search for: \n"
                                "guest type=* - guest arch=* - guest domain type=*\n");
                        capgdinfo = findDomainInfo(capsinfo, NULL, NULL, NULL);
                        print_cap_domain_info(capgdinfo, stdout);

                        cleanup_capabilities(&capsinfo);
                }
        } else if (cap) {
                printf("Need a data source (--domain) to get default capabilities\n");
                return 4;
        }

        cleanup_dominfo(&dominfo);

        return 0;
}
Example #4
0
int do_ifstat_rrd(char *hostname, char *testname, char *classname, char *pagepaths, char *msg, time_t tstamp)
{
	static int pcres_compiled = 0;
	static pcre **ifstat_linux_pcres = NULL;
	static pcre **ifstat_freebsd_pcres = NULL;
	static pcre **ifstat_openbsd_pcres = NULL;
	static pcre **ifstat_netbsd_pcres = NULL;
	static pcre **ifstat_darwin_pcres = NULL;
	static pcre **ifstat_solaris_pcres = NULL;
	static pcre **ifstat_aix_pcres = NULL;
	static pcre **ifstat_hpux_pcres = NULL;
	static pcre **ifstat_sco_sv_pcres = NULL;
	static pcre **ifstat_bbwin_pcres = NULL;

	enum ostype_t ostype;
	char *datapart = msg;
	char *outp;
	char *bol, *eoln, *ifname, *rxstr, *txstr, *dummy;
	int dmatch;

	if (pcres_compiled == 0) {
		pcres_compiled = 1;
		ifstat_linux_pcres = compile_exprs("LINUX", ifstat_linux_exprs, 
						 (sizeof(ifstat_linux_exprs) / sizeof(ifstat_linux_exprs[0])));
		ifstat_freebsd_pcres = compile_exprs("FREEBSD", ifstat_freebsd_exprs, 
						 (sizeof(ifstat_freebsd_exprs) / sizeof(ifstat_freebsd_exprs[0])));
		ifstat_openbsd_pcres = compile_exprs("OPENBSD", ifstat_openbsd_exprs, 
						 (sizeof(ifstat_openbsd_exprs) / sizeof(ifstat_openbsd_exprs[0])));
		ifstat_netbsd_pcres = compile_exprs("NETBSD", ifstat_netbsd_exprs, 
						 (sizeof(ifstat_netbsd_exprs) / sizeof(ifstat_netbsd_exprs[0])));
		ifstat_darwin_pcres = compile_exprs("DARWIN", ifstat_darwin_exprs, 
						 (sizeof(ifstat_darwin_exprs) / sizeof(ifstat_darwin_exprs[0])));
		ifstat_solaris_pcres = compile_exprs("SOLARIS", ifstat_solaris_exprs, 
						 (sizeof(ifstat_solaris_exprs) / sizeof(ifstat_solaris_exprs[0])));
		ifstat_aix_pcres = compile_exprs("AIX", ifstat_aix_exprs, 
						 (sizeof(ifstat_aix_exprs) / sizeof(ifstat_aix_exprs[0])));
		ifstat_hpux_pcres = compile_exprs("HPUX", ifstat_hpux_exprs, 
						 (sizeof(ifstat_hpux_exprs) / sizeof(ifstat_hpux_exprs[0])));
		ifstat_sco_sv_pcres = compile_exprs("SCO_SV", ifstat_sco_sv_exprs, 
						 (sizeof(ifstat_sco_sv_exprs) / sizeof(ifstat_sco_sv_exprs[0])));
		ifstat_bbwin_pcres = compile_exprs("BBWIN", ifstat_bbwin_exprs, 
						 (sizeof(ifstat_bbwin_exprs) / sizeof(ifstat_bbwin_exprs[0])));
	}


	if (ifstat_tpl == NULL) ifstat_tpl = setup_template(ifstat_params);

	if ((strncmp(msg, "status", 6) == 0) || (strncmp(msg, "data", 4) == 0)) {
		/* Skip the first line of full status- and data-messages. */
		datapart = strchr(msg, '\n');
		if (datapart) datapart++; else datapart = msg;
	}

	ostype = get_ostype(datapart);
	datapart = strchr(datapart, '\n');
	if (datapart) {
		datapart++; 
	}
	else {
		errprintf("Too few lines in ifstat report from %s\n", hostname);
		return -1;
	}

	/* Setup the update string */
	outp = rrdvalues + sprintf(rrdvalues, "%d", (int)tstamp);

	dmatch = 0;
	ifname = rxstr = txstr = dummy = NULL;

	bol = datapart;
	while (bol) {
		eoln = strchr(bol, '\n'); if (eoln) *eoln = '\0';

		switch (ostype) {
		  case OS_LINUX22:
		  case OS_LINUX:
		  case OS_RHEL3:
		  case OS_ZVM:
		  case OS_ZVSE:
		  case OS_ZOS:
			if (pickdata(bol, ifstat_linux_pcres[0], 1, &ifname)) {
				/*
				 * Linux' netif aliases mess up things. 
				 * Clear everything when we see an interface name.
				 * But we dont want to track the "lo" interface.
				 */
				if (strcmp(ifname, "lo") == 0) {
					xfree(ifname); ifname = NULL;
				}
				else {
					dmatch = 1;
					if (rxstr) { xfree(rxstr); rxstr = NULL; }
					if (txstr) { xfree(txstr); txstr = NULL; }
				}
			}
			else if (pickdata(bol, ifstat_linux_pcres[1], 1, &rxstr, &txstr)) dmatch |= 6;
			break;

		  case OS_FREEBSD:
			if (pickdata(bol, ifstat_freebsd_pcres[0], 0, &ifname, &rxstr, &txstr)) dmatch = 7;
			break;

		  case OS_OPENBSD:
			if (pickdata(bol, ifstat_openbsd_pcres[0], 0, &ifname, &rxstr, &txstr)) dmatch = 7;
			break;

		  case OS_NETBSD:
			if (pickdata(bol, ifstat_netbsd_pcres[0], 0, &ifname, &rxstr, &txstr)) dmatch = 7;
			break;

		  case OS_SOLARIS: 
			if (pickdata(bol, ifstat_solaris_pcres[0], 0, &ifname, &txstr)) dmatch |= 1;
			else if (pickdata(bol, ifstat_solaris_pcres[1], 0, &dummy, &rxstr)) dmatch |= 6;

			if (ifname && dummy && (strcmp(ifname, dummy) != 0)) {
				/* They must match, drop the data */
				errprintf("Host %s has weird ifstat data - device name mismatch %s:%s\n", hostname, ifname, dummy);
				xfree(ifname); xfree(txstr); xfree(rxstr); xfree(dummy);
				dmatch = 0;
			}
			break;

		  case OS_AIX: 
			if (pickdata(bol, ifstat_aix_pcres[0], 1, &ifname)) {
				/* Interface names comes first, so any rx/tx data is discarded */
				dmatch |= 1;
				if (rxstr) { xfree(rxstr); rxstr = NULL; }
				if (txstr) { xfree(txstr); txstr = NULL; }
			}
			else if (pickdata(bol, ifstat_aix_pcres[1], 1, &txstr, &rxstr)) dmatch |= 6;
			break;

		  case OS_HPUX: 
			if (pickdata(bol, ifstat_hpux_pcres[0], 1, &ifname)) {
				/* Interface names comes first, so any rx/tx data is discarded */
				dmatch |= 1;
				if (rxstr) { xfree(rxstr); rxstr = NULL; }
				if (txstr) { xfree(txstr); txstr = NULL; }
			}
			else if (pickdata(bol, ifstat_hpux_pcres[1], 1, &rxstr)) dmatch |= 2;
			else if (pickdata(bol, ifstat_hpux_pcres[2], 1, &txstr)) dmatch |= 4;
			break;

		  case OS_DARWIN:
			if (pickdata(bol, ifstat_darwin_pcres[0], 0, &ifname, &rxstr, &txstr)) dmatch = 7;
			break;
			
 		  case OS_SCO_SV:
		        if (pickdata(bol, ifstat_sco_sv_pcres[0], 0, &ifname, &rxstr, &txstr)) dmatch = 7;
			break;
			
		  case OS_WIN32_BBWIN:
			if (pickdata(bol, ifstat_bbwin_pcres[0], 0, &ifname, &rxstr, &txstr)) dmatch = 7;
			break;

		  default:
			break;
		}

		if ((dmatch == 7) && ifname && rxstr && txstr) {
			setupfn2("%s.%s.rrd", "ifstat", ifname);
			sprintf(rrdvalues, "%d:%s:%s", (int)tstamp, txstr, rxstr);
			create_and_update_rrd(hostname, testname, classname, pagepaths, ifstat_params, ifstat_tpl);
			xfree(ifname); xfree(rxstr); xfree(txstr);
			if (dummy) xfree(dummy);
			ifname = rxstr = txstr = dummy = NULL;
			dmatch = 0;
		}

		if (eoln) {
			*eoln = '\n';
			bol = eoln+1;
			if (*bol == '\0') bol = NULL;
		}
		else {
			bol = NULL;
		}
	}

	if (ifname) xfree(ifname);
	if (rxstr) xfree(rxstr);
	if (txstr) xfree(txstr);
	if (dummy) xfree(dummy);

	return 0;
}
Example #5
0
int do_vmstat_rrd(char *hostname, char *testname, char *classname, char *pagepaths, char *msg, time_t tstamp)
{
	enum ostype_t ostype;
	vmstat_layout_t *layout = NULL;
	char *datapart = msg;
	int values[MAX_VMSTAT_VALUES];
	int defcount, defidx, datacount, result;
	char *p;
	char **creparams;

	if ((strncmp(msg, "status", 6) == 0) || (strncmp(msg, "data", 4) == 0)) {
		/* Full message, including "status" or "data" line - so skip the first line. */
		datapart = strchr(msg, '\n');
		if (datapart) {
			datapart++; 
		}
		else {
			errprintf("Too few lines (only 1) in vmstat report from %s\n", hostname);
			return -1;
		}
	}

	ostype = get_ostype(datapart);
	datapart = strchr(datapart, '\n');
	if (datapart) {
		datapart++; 
	}
	else {
		errprintf("Too few lines (only 1 or 2) in vmstat report from %s\n", hostname);
		return -1;
	}

	/* Pick up the values in the datapart line. Stop at newline. */
	p = strchr(datapart, '\n'); if (p) *p = '\0';
	p = strtok(datapart, " "); datacount = 0;
	while (p && (datacount < MAX_VMSTAT_VALUES)) {
		values[datacount++] = atoi(p);
		p = strtok(NULL, " ");
	}

	/* Must do this now, to check on the layout of any existing file */
	setupfn("%s.rrd", "vmstat");

	switch (ostype) {
	  case OS_SOLARIS: 
		layout = vmstat_solaris_layout; break;
	  case OS_OSF:
		layout = vmstat_osf_layout; break;

	  case OS_AIX: 
		/* Special, because there are two layouts for AIX */
		{
			char **dsnames = NULL;
			int dscount, i;

			dscount = rrddatasets(hostname, &dsnames);
			layout = ((dscount == 17) ? vmstat_aix_layout : vmstat_aix_power5_layout);

			if ((dscount > 0) && dsnames) {
				/* Free the dsnames list */
				for (i=0; (i<dscount); i++) xfree(dsnames[i]);
				xfree(dsnames);
			}
		}
		break;

	  case OS_IRIX:
		layout = vmstat_irix_layout; break;
	  case OS_HPUX: 
		layout = vmstat_hpux_layout; break;
	  case OS_FREEBSD:
		layout = vmstat_freebsd_layout; break;
	  case OS_NETBSD:
		layout = vmstat_netbsd_layout; break;
	  case OS_OPENBSD:
		layout = vmstat_openbsd_layout; break;
	  case OS_LINUX22:
		layout = vmstat_linux22_layout; break;
	  case OS_LINUX:
	  case OS_ZVM:
	  case OS_ZVSE:
	  case OS_ZOS:
		layout = vmstat_linux_layout; break;
	  case OS_RHEL3:
		layout = vmstat_rhel3_layout; break;
          case OS_SCO_SV:
                layout = vmstat_sco_sv_layout; break;
	  case OS_UNKNOWN:
		errprintf("Host '%s' reports vmstat for an unknown OS\n", hostname);
		return -1;
	  default:
		errprintf("Cannot handle vmstat from host '%s' \n", hostname);
		return -1;
	}

	if (layout == NULL) {
		return -1;
	}

	/* How many values are defined in the dataset ? */
	for (defcount = 0; (layout[defcount].name); defcount++) ;

	/* Setup the create-parameters */
	creparams = (char **)malloc((defcount+1)*sizeof(char *));
	for (defidx=0; (defidx < defcount); defidx++) {
		creparams[defidx] = (char *)malloc(strlen(layout[defidx].name) + strlen("DS::GAUGE:600:0:U") + 1);
		sprintf(creparams[defidx], "DS:%s:GAUGE:600:0:U", layout[defidx].name);
	}
	creparams[defcount] = NULL;

	/* Setup the update string, picking out values according to the layout */
	p = rrdvalues + snprintf(rrdvalues, sizeof(rrdvalues), "%d", (int)tstamp);
	for (defidx=0; (defidx < defcount); defidx++) {
		int dataidx = layout[defidx].index;

		if ((dataidx >= datacount) || (dataidx == -1)) {
			p += snprintf(p, sizeof(rrdvalues)-(p-rrdvalues), ":U");
		}
		else {
			p += snprintf(p, sizeof(rrdvalues)-(p-rrdvalues), ":%d", values[layout[defidx].index]);
		}
	}

	result = create_and_update_rrd(hostname, testname, classname, pagepaths, creparams, NULL);

	for (defidx=0; (defidx < defcount); defidx++) xfree(creparams[defidx]);
	xfree(creparams);

	return result;
}
Example #6
0
int do_ifstat_rrd(char *hostname, char *testname, char *classname, char *pagepaths, char *msg, time_t tstamp)
{
	static int pcres_compiled = 0;
	static pcre **ifstat_linux_pcres = NULL;
	static pcre **ifstat_freebsd_pcres = NULL;
	static pcre **ifstat_freebsdV8_pcres = NULL;
	static pcre **ifstat_openbsd_pcres = NULL;
	static pcre **ifstat_netbsd_pcres = NULL;
	static pcre **ifstat_darwin_pcres = NULL;
	static pcre **ifstat_solaris_pcres = NULL;
	static pcre **ifstat_aix_pcres = NULL;
	static pcre **ifstat_hpux_pcres = NULL;
	static pcre **ifstat_sco_sv_pcres = NULL;
	static pcre **ifstat_bbwin_pcres = NULL;

	enum ostype_t ostype;
	char *datapart = msg;
	char *bol, *eoln, *ifname, *rxstr, *txstr, *dummy;
	int dmatch;

	void *xmh;
	pcre *ifname_filter_pcre = NULL;

	xmh = hostinfo(hostname);
	if (xmh) {
		char *ifname_filter_expr = xmh_item(xmh, XMH_INTERFACES);
		if (ifname_filter_expr && *ifname_filter_expr) 
			ifname_filter_pcre = compileregex(ifname_filter_expr);
	}

	if (pcres_compiled == 0) {
		pcres_compiled = 1;
		ifstat_linux_pcres = compile_exprs("LINUX", ifstat_linux_exprs, 
						 (sizeof(ifstat_linux_exprs) / sizeof(ifstat_linux_exprs[0])));
		ifstat_freebsd_pcres = compile_exprs("FREEBSD", ifstat_freebsd_exprs, 
						 (sizeof(ifstat_freebsd_exprs) / sizeof(ifstat_freebsd_exprs[0])));
		ifstat_freebsdV8_pcres = compile_exprs("FREEBSD", ifstat_freebsdV8_exprs, 
						 (sizeof(ifstat_freebsdV8_exprs) / sizeof(ifstat_freebsdV8_exprs[0])));
		ifstat_openbsd_pcres = compile_exprs("OPENBSD", ifstat_openbsd_exprs, 
						 (sizeof(ifstat_openbsd_exprs) / sizeof(ifstat_openbsd_exprs[0])));
		ifstat_netbsd_pcres = compile_exprs("NETBSD", ifstat_netbsd_exprs, 
						 (sizeof(ifstat_netbsd_exprs) / sizeof(ifstat_netbsd_exprs[0])));
		ifstat_darwin_pcres = compile_exprs("DARWIN", ifstat_darwin_exprs, 
						 (sizeof(ifstat_darwin_exprs) / sizeof(ifstat_darwin_exprs[0])));
		ifstat_solaris_pcres = compile_exprs("SOLARIS", ifstat_solaris_exprs, 
						 (sizeof(ifstat_solaris_exprs) / sizeof(ifstat_solaris_exprs[0])));
		ifstat_aix_pcres = compile_exprs("AIX", ifstat_aix_exprs, 
						 (sizeof(ifstat_aix_exprs) / sizeof(ifstat_aix_exprs[0])));
		ifstat_hpux_pcres = compile_exprs("HPUX", ifstat_hpux_exprs, 
						 (sizeof(ifstat_hpux_exprs) / sizeof(ifstat_hpux_exprs[0])));
		ifstat_sco_sv_pcres = compile_exprs("SCO_SV", ifstat_sco_sv_exprs, 
						 (sizeof(ifstat_sco_sv_exprs) / sizeof(ifstat_sco_sv_exprs[0])));
		ifstat_bbwin_pcres = compile_exprs("BBWIN", ifstat_bbwin_exprs, 
						 (sizeof(ifstat_bbwin_exprs) / sizeof(ifstat_bbwin_exprs[0])));
	}


	if (ifstat_tpl == NULL) ifstat_tpl = setup_template(ifstat_params);

	if ((strncmp(msg, "status", 6) == 0) || (strncmp(msg, "data", 4) == 0)) {
		/* Skip the first line of full status- and data-messages. */
		datapart = strchr(msg, '\n');
		if (datapart) datapart++; else datapart = msg;
	}

	ostype = get_ostype(datapart);
	datapart = strchr(datapart, '\n');
	if (datapart) {
		datapart++; 
	}
	else {
		errprintf("Too few lines in ifstat report from %s\n", hostname);
		return -1;
	}

	dmatch = 0;
	ifname = rxstr = txstr = dummy = NULL;

	bol = datapart;
	while (bol) {
		eoln = strchr(bol, '\n'); if (eoln) *eoln = '\0';

		switch (ostype) {
		  case OS_LINUX22:
		  case OS_LINUX:
		  case OS_RHEL3:
		  case OS_ZVM:
		  case OS_ZVSE:
		  case OS_ZOS:
			if (pickdata(bol, ifstat_linux_pcres[0], 1, &ifname)) {
				/*
				 * Linux' netif aliases mess up things. 
				 * Clear everything when we see an interface name.
				 * But we dont want to track the "lo" interface.
				 */

				/* Strip off the last character if it is a colon (:) */
				if (ifname[strlen(ifname)-1] == ':') ifname[strlen(ifname)-1] = '\0';

				if (strcmp(ifname, "lo") == 0) {
					xfree(ifname); ifname = NULL;
				}
				else {
					dmatch = 1;
					if (rxstr) { xfree(rxstr); rxstr = NULL; }
					if (txstr) { xfree(txstr); txstr = NULL; }
				}
			}
			else if (pickdata(bol, ifstat_linux_pcres[1], 1, &rxstr, &txstr)) dmatch |= 6;
			else if (pickdata(bol, ifstat_linux_pcres[2], 1, &rxstr)) dmatch |= 2;
			else if (pickdata(bol, ifstat_linux_pcres[3], 1, &txstr)) dmatch |= 4;
			break;

		  case OS_FREEBSD:
			/*
			 * FreeBSD 8 added an "Idrop" counter in the middle of the data.
			 * See if we match this expression, and if not then fall back to
			 * the old regex without that field.
			 */
			if (pickdata(bol, ifstat_freebsdV8_pcres[0], 0, &ifname, &rxstr, &txstr)) dmatch = 7;
			else if (pickdata(bol, ifstat_freebsd_pcres[0], 0, &ifname, &rxstr, &txstr)) dmatch = 7;
			break;

		  case OS_OPENBSD:
			if (pickdata(bol, ifstat_openbsd_pcres[0], 0, &ifname, &rxstr, &txstr)) dmatch = 7;
			break;

		  case OS_NETBSD:
			if (pickdata(bol, ifstat_netbsd_pcres[0], 0, &ifname, &rxstr, &txstr)) dmatch = 7;
			break;

		  case OS_SOLARIS: 
			if (pickdata(bol, ifstat_solaris_pcres[0], 0, &ifname, &txstr)) dmatch |= 1;
			else if (pickdata(bol, ifstat_solaris_pcres[1], 0, &dummy, &rxstr)) dmatch |= 6;

			if (ifname && dummy && (strcmp(ifname, dummy) != 0)) {
				/* They must match, drop the data */
				errprintf("Host %s has weird ifstat data - device name mismatch %s:%s\n", hostname, ifname, dummy);
				xfree(ifname); xfree(txstr); xfree(rxstr); xfree(dummy);
				dmatch = 0;
			}

			/* Ignore "mac" and "wrsmd" entries - these are for sub-devices for multiple nic's aggregated into one */
			/* See http://www.xymon.com/archive/2009/06/msg00204.html for more info */
			if (ifname && ((strcmp(ifname, "mac") == 0) || (strcmp(ifname, "wrsmd") == 0)) ) {
				xfree(ifname); xfree(txstr);
				dmatch = 0;
			}
			if (dummy && ((strcmp(dummy, "mac") == 0) || (strcmp(dummy, "wrsmd") == 0)) ) {
				xfree(dummy); xfree(rxstr);
				dmatch = 0;
			}
			break;

		  case OS_AIX: 
			if (pickdata(bol, ifstat_aix_pcres[0], 1, &ifname)) {
				/* Interface names comes first, so any rx/tx data is discarded */
				dmatch |= 1;
				if (rxstr) { xfree(rxstr); rxstr = NULL; }
				if (txstr) { xfree(txstr); txstr = NULL; }
			}
			else if (pickdata(bol, ifstat_aix_pcres[1], 1, &txstr, &rxstr)) dmatch |= 6;
			break;

		  case OS_HPUX: 
			if (pickdata(bol, ifstat_hpux_pcres[0], 1, &ifname)) {
				/* Interface names comes first, so any rx/tx data is discarded */
				dmatch |= 1;
				if (rxstr) { xfree(rxstr); rxstr = NULL; }
				if (txstr) { xfree(txstr); txstr = NULL; }
			}
			else if (pickdata(bol, ifstat_hpux_pcres[1], 1, &rxstr)) dmatch |= 2;
			else if (pickdata(bol, ifstat_hpux_pcres[2], 1, &txstr)) dmatch |= 4;
			break;

		  case OS_DARWIN:
			if (pickdata(bol, ifstat_darwin_pcres[0], 0, &ifname, &rxstr, &txstr)) dmatch = 7;
			break;
			
 		  case OS_SCO_SV:
		        if (pickdata(bol, ifstat_sco_sv_pcres[0], 0, &ifname, &rxstr, &txstr)) dmatch = 7;
			break;
			
		  case OS_WIN32_BBWIN:
			if (pickdata(bol, ifstat_bbwin_pcres[0], 0, &ifname, &rxstr, &txstr)) dmatch = 7;
			break;

		  default:
			break;
		}

		if ((dmatch == 7) && ifname && rxstr && txstr) {
			if (!ifname_filter_pcre || matchregex(ifname, ifname_filter_pcre)) {
				setupfn2("%s.%s.rrd", "ifstat", ifname);
				snprintf(rrdvalues, sizeof(rrdvalues), "%d:%s:%s", (int)tstamp, txstr, rxstr);
				create_and_update_rrd(hostname, testname, classname, pagepaths, ifstat_params, ifstat_tpl);
			}

			xfree(ifname); xfree(rxstr); xfree(txstr);
			if (dummy) xfree(dummy);
			ifname = rxstr = txstr = dummy = NULL;
			dmatch = 0;
		}

		if (eoln) {
			*eoln = '\n';
			bol = eoln+1;
			if (*bol == '\0') bol = NULL;
		}
		else {
			bol = NULL;
		}
	}

	if (ifname_filter_pcre) freeregex(ifname_filter_pcre);

	if (ifname) xfree(ifname);
	if (rxstr) xfree(rxstr);
	if (txstr) xfree(txstr);
	if (dummy) xfree(dummy);

	return 0;
}