xymon

Check-in [7cec579f0f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Linux client: Report full SuSE version info. Report UDP data from netstat. Generate 'raid' status from mdstat data. git-svn-id: http://svn.code.sf.net/p/xymon/code/branches/4.3.18@7453 44351d6e-118b-4698-b696-ce33095ecaa4
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | origin/4.3.18
Files: files | file ages | folders
SHA3-256: 7cec579f0f8b59e88963782837f06309d89c4f9356a40ac4d3e8f5680584798a
User & Date: storner@users.sf.net 2014-03-17 11:15:14
Context
2014-03-17
11:22
xymond: Fix sender check of maintenance commands when sender is listed as 0.0.0.0 in hosts.cfg git-svn-id: http://svn.code.sf.net/p/xymon/code/branches/4.3.18@7455 44351d6e-118b-4698-b696-ce33095ecaa4 check-in: 58882c7849 user: storner@users.sf.net tags: trunk, origin/4.3.18
11:15
Linux client: Report full SuSE version info. Report UDP data from netstat. Generate 'raid' status from mdstat data. git-svn-id: http://svn.code.sf.net/p/xymon/code/branches/4.3.18@7453 44351d6e-118b-4698-b696-ce33095ecaa4 check-in: 7cec579f0f user: storner@users.sf.net tags: trunk, origin/4.3.18
11:12
info status: Display full (multiline) OS version git-svn-id: http://svn.code.sf.net/p/xymon/code/branches/4.3.18@7451 44351d6e-118b-4698-b696-ce33095ecaa4 check-in: 469bc37c0f user: storner@users.sf.net tags: trunk, origin/4.3.18
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to client/xymonclient-linux.sh.

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
..
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
	cat /etc/redhat-release
elif [ -f /etc/gentoo-release ]; then
	cat /etc/gentoo-release
elif [ -f /etc/debian_version ]; then
	echo -n "Debian "
	cat /etc/debian_version
elif [ -f /etc/S?SE-release ]; then
	egrep -i "^suse|^opensuse" /etc/S?SE-release
elif [ -f /etc/slackware-version ]; then
	cat /etc/slackware-version
elif [ -f /etc/mandrake-release ]; then
	cat /etc/mandrake-release
elif [ -f /etc/fedora-release ]; then
	cat /etc/fedora-release
elif [ -f /etc/arch-release ]; then
................................................................................
/sbin/ifconfig 2>/dev/null
echo "[route]"
netstat -rn
echo "[netstat]"
netstat -s
echo "[ports]"
# Bug in RedHat's netstat spews annoying error messages. 
netstat -ant 2>/dev/null
echo "[ifstat]"
/sbin/ifconfig 2>/dev/null
# Report mdstat data if it exists
if test -r /proc/mdstat; then echo "[mdstat]"; cat /proc/mdstat; fi
echo "[ps]"
ps -Aww -o pid,ppid,user,start,state,pri,pcpu,time:12,pmem,rsz:10,vsz:10,cmd








|







 







|







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
..
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
	cat /etc/redhat-release
elif [ -f /etc/gentoo-release ]; then
	cat /etc/gentoo-release
elif [ -f /etc/debian_version ]; then
	echo -n "Debian "
	cat /etc/debian_version
elif [ -f /etc/S?SE-release ]; then
	cat /etc/S?SE-release
elif [ -f /etc/slackware-version ]; then
	cat /etc/slackware-version
elif [ -f /etc/mandrake-release ]; then
	cat /etc/mandrake-release
elif [ -f /etc/fedora-release ]; then
	cat /etc/fedora-release
elif [ -f /etc/arch-release ]; then
................................................................................
/sbin/ifconfig 2>/dev/null
echo "[route]"
netstat -rn
echo "[netstat]"
netstat -s
echo "[ports]"
# Bug in RedHat's netstat spews annoying error messages. 
netstat -antu 2>/dev/null
echo "[ifstat]"
/sbin/ifconfig 2>/dev/null
# Report mdstat data if it exists
if test -r /proc/mdstat; then echo "[mdstat]"; cat /proc/mdstat; fi
echo "[ps]"
ps -Aww -o pid,ppid,user,start,state,pri,pcpu,time:12,pmem,rsz:10,vsz:10,cmd

Changes to xymond/client/linux.c.

104
105
106
107
108
109
110

111
112
113
114
115
116
117
...
119
120
121
122
123
124
125

126
127
128
129
130
131
132
...
133
134
135
136
137
138
139




140
141
142
143
144
145
146
...
167
168
169
170
171
172
173

174
175
176
177
178
179
180
181
182
183
184
185
186
187

188
189
190
191
192
193
194
		char *statcopy, *bol, *eol;
		int color = COL_GREEN;
		char *mdname = NULL, *mdstatus = NULL;
		int mddevices, mdactive, recovering;
		strbuffer_t *alerttext = newstrbuffer(0);
		char msgline[1024];
		char *summary = NULL;


		statcopy = (char *)malloc(strlen(mdstatstr) + 10);
		sprintf(statcopy, "%s\nmd999\n", mdstatstr);

		bol = statcopy;
		while (bol) {
			eol = strchr(bol, '\n'); if (eol) *eol = '\0';
................................................................................
			if ((strncmp(bol, "md", 2) == 0) && (isdigit(*(bol+2)))) {
				char *tok;

				if (mdname && (mddevices >= 0) && (mdactive >= 0)) {
					int onecolor = COL_GREEN;

					/* Got a full md device status, flush it before we start on the next one */

					if (mddevices != mdactive) {
						if (!recovering) {
							onecolor = COL_RED;
							snprintf(msgline, sizeof(msgline), "&red %s : Disk failure in array : %d devices of %d active\n", mdname, mdactive, mddevices);
							addtobuffer(alerttext, msgline);
							summary = "failure";
						}
................................................................................
						else {
							onecolor = COL_YELLOW;
							snprintf(msgline, sizeof(msgline), "&yellow %s status %s : %d devices of %d active\n", mdname, mdstatus, mdactive, mddevices);
							addtobuffer(alerttext, msgline);
							if (!summary) summary = "recovering";
						}
					}





					if (onecolor > color) {
						color = onecolor;
					}
				}

				/* First line, holds the name of the array and the active/inactive status */
................................................................................
				recovering = 1;
			}

			bol = (eol ? eol+1 : NULL);
		}



		init_status(color);
		sprintf(msgline, "status %s.raid %s %s - RAID %s\n\n",
				commafy(hostname), colorname(color), 
				(timestr ? timestr : "<No timestamp data>"),
				(summary ? summary : "OK"));
		addtostatus(msgline);
		if (STRBUFLEN(alerttext) > 0) {
			addtostrstatus(alerttext);
			addtostatus("\n\n");
		}
		addtostatus("============================ /proc/mdstat ===========================\n\n");
		addtostatus(mdstatstr);
		finish_status();


		xfree(statcopy);
		freestrbuffer(alerttext);
	}

	splitmsg_done();
}








>







 







>







 







>
>
>
>







 







>
|
|



|
|
|
|
|
|
|
|
|
>







104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
...
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
...
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
...
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
		char *statcopy, *bol, *eol;
		int color = COL_GREEN;
		char *mdname = NULL, *mdstatus = NULL;
		int mddevices, mdactive, recovering;
		strbuffer_t *alerttext = newstrbuffer(0);
		char msgline[1024];
		char *summary = NULL;
		int arraycount = 0;

		statcopy = (char *)malloc(strlen(mdstatstr) + 10);
		sprintf(statcopy, "%s\nmd999\n", mdstatstr);

		bol = statcopy;
		while (bol) {
			eol = strchr(bol, '\n'); if (eol) *eol = '\0';
................................................................................
			if ((strncmp(bol, "md", 2) == 0) && (isdigit(*(bol+2)))) {
				char *tok;

				if (mdname && (mddevices >= 0) && (mdactive >= 0)) {
					int onecolor = COL_GREEN;

					/* Got a full md device status, flush it before we start on the next one */
					arraycount++;
					if (mddevices != mdactive) {
						if (!recovering) {
							onecolor = COL_RED;
							snprintf(msgline, sizeof(msgline), "&red %s : Disk failure in array : %d devices of %d active\n", mdname, mdactive, mddevices);
							addtobuffer(alerttext, msgline);
							summary = "failure";
						}
................................................................................
						else {
							onecolor = COL_YELLOW;
							snprintf(msgline, sizeof(msgline), "&yellow %s status %s : %d devices of %d active\n", mdname, mdstatus, mdactive, mddevices);
							addtobuffer(alerttext, msgline);
							if (!summary) summary = "recovering";
						}
					}
					else {
						snprintf(msgline, sizeof(msgline), "&green %s : %d devices of %d active\n", mdname, mdactive, mddevices);
						addtobuffer(alerttext, msgline);
					}

					if (onecolor > color) {
						color = onecolor;
					}
				}

				/* First line, holds the name of the array and the active/inactive status */
................................................................................
				recovering = 1;
			}

			bol = (eol ? eol+1 : NULL);
		}


		if (arraycount > 0) {
			init_status(color);
			sprintf(msgline, "status %s.raid %s %s - RAID %s\n\n",
				commafy(hostname), colorname(color), 
				(timestr ? timestr : "<No timestamp data>"),
				(summary ? summary : "OK"));
			addtostatus(msgline);
			if (STRBUFLEN(alerttext) > 0) {
				addtostrstatus(alerttext);
				addtostatus("\n\n");
			}
			addtostatus("============================ /proc/mdstat ===========================\n\n");
			addtostatus(mdstatstr);
			finish_status();
		}
	
		xfree(statcopy);
		freestrbuffer(alerttext);
	}

	splitmsg_done();
}