Hello Matthew,
2008/5/12 <user-b87cda6b45e4@xymon.invalid>:
Hi Again,
I didn't get a response to a post made to this mailing list about monitoring
Services with names that were multiple words separated by a whitespace character
http://www.hobbitmon.com/hobbiton/2008/05/msg00001.htm so I did some searching
through the hobbit source code to find out where my problem lay and managed to
identify the problem and resolve it.
The problem seemed to be in the way that the data containing the list of
Services and their status is formatted by the BBWin client when sent to the
Hobbit Server. It uses whitespaces to format the Service information into
columns so that it can be viewed in a nice way rather then scattered all over
the screen. To handle these whitespaces and determine which columns actually
contain useful data, the nextcolumn function inside lib/misc.c is used to
determine the location of these whitespaces within the string so that the
getcolumn function can be used to retrieve the ServiceName, StartupType and
Status for each service. This works brilliantly for services that are one word
or use an underscore character to separate the words, however fails when the
ServiceName contains a whitespace. In case I didn't explain this very well, an
example of what was being returned is:
If the service name is Alerter
namestr = getcolumn(p, namecol) which returns Alerter
startupstr = getcolumn(p, startupcol) which returns Disabled
statestr = getcolum(p, statecol) which returns Stopped
If the service name is multi word such as "VMware NAS Service"
namestr = getcolumn(p, namecol) which returns VMware
startupstr = getcolumn(p, startupcol) which returns NAS
statestr = getcolum(p, statecol) which returns Service
I am not a C programmer and the first time I actually looked at source code
written in C was to diagnose this problem. However I have managed to resolve the
problem by writing my own function within the bbwin.c source which checks the
string returned by getcoumn(p, startupcol) and if it doesnt contain either
StartupType, automatic, manual or disabled, then to keep looping until one of
these strings are located. Due to the fact that I am not a C programmer, and
that we rely heavily on Hobbit for our system monitoring, I am posting this to
the mailing list so that I can get comment from Henrik or someone else who does
have knowledge in C programming on the changes I have made and tell me if they
can identify any flaws in it which may jeopardize the Hobbit application. I have
tested the changes in our test environment containing a couple of monitored
clients and it works great! However I am hesitant to patch our production
environment until I can get some reassurance that the Hobbit Monitoring wont
crash a week or two later because of my poor coding. For easier reading, I have
pasted a copy of the difference file between my modified version of the bbwin.c
and the bbwin.patch release version below.
My apologizes for the delay of the answer. You are right. The problem
comes from the spaces in the column name.
The easiest thing to do is to change the code in BBWin. I will report
the name column with no space so you can match it.
I will replace spaces in the service name with underscores for BBWin
0.12. Check for the next release of BBWin and let me know if you still
have issues.
Regards,
--
Etienne GRIGNON