1
/*----------------------------------------------------------------------------*/
2
/* Xymon message daemon. */
4
/* Client backend module for OpenBSD */
6
/* Copyright (C) 2005-2011 Henrik Storner <henrik@hswn.dk> */
8
/* This program is released under the GNU General Public License (GPL), */
9
/* version 2. See the file "COPYING" for details. */
11
/*----------------------------------------------------------------------------*/
13
static char openbsd_rcsid[] = "$Id: openbsd.c 7149 2012-08-01 16:16:57Z storner $";
15
void handle_openbsd_client(char *hostname, char *clienttype, enum ostype_t os,
16
void *hinfo, char *sender, time_t timestamp,
38
sprintf(fromline, "\nStatus message received from %s\n", sender);
42
timestr = getdata("date");
43
uptimestr = getdata("uptime");
44
clockstr = getdata("clock");
45
msgcachestr = getdata("msgcache");
46
whostr = getdata("who");
47
psstr = getdata("ps");
48
topstr = getdata("top");
49
dfstr = getdata("df");
50
inodestr = getdata("inode");
51
meminfostr = getdata("meminfo");
52
msgsstr = getdata("msgs");
53
netstatstr = getdata("netstat");
54
ifstatstr = getdata("ifstat");
55
portsstr = getdata("ports");
56
vmstatstr = getdata("vmstat");
58
unix_cpu_report(hostname, clienttype, os, hinfo, fromline, timestr, uptimestr, clockstr, msgcachestr,
59
whostr, 0, psstr, 0, topstr);
60
unix_disk_report(hostname, clienttype, os, hinfo, fromline, timestr, "Avail", "Capacity", "Mounted", dfstr);
61
unix_inode_report(hostname, clienttype, os, hinfo, fromline, timestr, "ifree", "%iused", "Mounted", inodestr);
62
unix_procs_report(hostname, clienttype, os, hinfo, fromline, timestr, "COMMAND", NULL, psstr);
63
unix_ports_report(hostname, clienttype, os, hinfo, fromline, timestr, 3, 4, 5, portsstr);
65
msgs_report(hostname, clienttype, os, hinfo, fromline, timestr, msgsstr);
66
file_report(hostname, clienttype, os, hinfo, fromline, timestr);
67
linecount_report(hostname, clienttype, os, hinfo, fromline, timestr);
69
unix_netstat_report(hostname, clienttype, os, hinfo, fromline, timestr, netstatstr);
70
unix_ifstat_report(hostname, clienttype, os, hinfo, fromline, timestr, ifstatstr);
71
unix_vmstat_report(hostname, clienttype, os, hinfo, fromline, timestr, vmstatstr);
74
unsigned long memphystotal, memphysfree, memphysused;
75
unsigned long memswaptotal, memswapfree, memswapused;
78
memphystotal = memphysfree = memphysused = 0;
79
memswaptotal = memswapfree = memswapused = 0;
81
p = strstr(meminfostr, "Total:"); if (p) { memphystotal = atol(p+6); found++; }
82
p = strstr(meminfostr, "Free:"); if (p) { memphysfree = atol(p+5); found++; }
83
memphysused = memphystotal - memphysfree;
84
p = strstr(meminfostr, "Swaptotal:"); if (p) { memswaptotal = atol(p+10); found++; }
85
p = strstr(meminfostr, "Swapused:"); if (p) { memswapused = atol(p+9); found++; }
86
memswapfree = memswaptotal - memswapused;
89
unix_memory_report(hostname, clienttype, os, hinfo, fromline, timestr,
90
memphystotal, memphysused, -1, memswaptotal, memswapused);