~ubuntu-branches/debian/sid/xymon/sid

« back to all changes in this revision

Viewing changes to xymond/client/openbsd.c

  • Committer: Package Import Robot
  • Author(s): Axel Beckert, Christoph Berg, Axel Beckert
  • Date: 2014-05-20 22:56:11 UTC
  • mfrom: (2.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20140520225611-zvwepcgu1cwc21v1
Tags: 4.3.17-2
* Upload to unstable again.

[ Christoph Berg ]
*  Always write /var/run/xymon/xymonclient-include.cfg on clients

[ Axel Beckert ]
* Add build-dependency on libc-ares-dev to avoid using embedded code
  copy at xymonnet/c-ares-1.7.3.tar.gz
* Fix includes for graph definitions (xymongraph.d → graphs.d)
  + Add a Breaks for hobbit-plugins << 20140519~
* Remove reference to /etc/apache2/ from xymon-client.NEWS
* Fix remaining issues of the Apache 2.2 → 2.4 transition
  (modifies mostly debian/rules, xymon.postinst and xymon.maintscript)
  + Fix conffile paths in README.Debian and xymon.maintscript
  + Use dh_apache2 and apache2-maintscript-helper
  + Add build-dependency on dh-apache2.
  + Add lintian override for missing-build-dependency-for-dh_-command
    (see #748688)
  + Enable Apache's mod_rewrite + CGI support automatically in postinst
  + Add patch to switch default configuration to Apache 2.4 style
    authorization.
  + Closes: #669776
* Let xymon depend on perl until after the Jessie release to make sure
  prename is there for the data migration from hobbit to xymon.
* Add lintian override for apache2-reverse-dependency-calls-invoke-rc.d
  -- it finds the fallback for apache2-maintscript-helper unavailability

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*----------------------------------------------------------------------------*/
 
2
/* Xymon message daemon.                                                      */
 
3
/*                                                                            */
 
4
/* Client backend module for OpenBSD                                          */
 
5
/*                                                                            */
 
6
/* Copyright (C) 2005-2011 Henrik Storner <henrik@hswn.dk>                    */
 
7
/*                                                                            */
 
8
/* This program is released under the GNU General Public License (GPL),       */
 
9
/* version 2. See the file "COPYING" for details.                             */
 
10
/*                                                                            */
 
11
/*----------------------------------------------------------------------------*/
 
12
 
 
13
static char openbsd_rcsid[] = "$Id: openbsd.c 7149 2012-08-01 16:16:57Z storner $";
 
14
 
 
15
void handle_openbsd_client(char *hostname, char *clienttype, enum ostype_t os,
 
16
                           void *hinfo, char *sender, time_t timestamp, 
 
17
                           char *clientdata)
 
18
{
 
19
        char *timestr;
 
20
        char *uptimestr;
 
21
        char *clockstr;
 
22
        char *msgcachestr;
 
23
        char *whostr;
 
24
        char *psstr;
 
25
        char *topstr;
 
26
        char *dfstr;
 
27
        char *inodestr;
 
28
        char *meminfostr;
 
29
        char *msgsstr;
 
30
        char *netstatstr;
 
31
        char *ifstatstr;
 
32
        char *portsstr;
 
33
        char *vmstatstr;
 
34
 
 
35
        char *p;
 
36
        char fromline[1024];
 
37
 
 
38
        sprintf(fromline, "\nStatus message received from %s\n", sender);
 
39
 
 
40
        splitmsg(clientdata);
 
41
 
 
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");
 
57
 
 
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);
 
64
 
 
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);
 
68
 
 
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);
 
72
 
 
73
        if (meminfostr) {
 
74
                unsigned long memphystotal, memphysfree, memphysused;
 
75
                unsigned long memswaptotal, memswapfree, memswapused;
 
76
                int found = 0;
 
77
 
 
78
                memphystotal = memphysfree = memphysused = 0;
 
79
                memswaptotal = memswapfree = memswapused = 0;
 
80
 
 
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;
 
87
 
 
88
                if (found == 4) {
 
89
                        unix_memory_report(hostname, clienttype, os, hinfo, fromline, timestr,
 
90
                                   memphystotal, memphysused, -1, memswaptotal, memswapused);
 
91
                }
 
92
        }
 
93
 
 
94
        splitmsg_done();
 
95
}
 
96