Debugging issues with bb-histlog.sh on 4.3.0
I've some "random" failures on bb-histlog.sh, viewing items in the bb2 event log. Some work as expected, but some when clicked appear to do nothing. Hitting the URL for that (say http://den2sch17/hobbit-cgi/bb-histlog.sh?HOST=den1ws063&SERVICE=nfs&TIMEBUF...) with curl shows a zero-length reply. Checking the Apache error log shows "Premature end of script headers: bb-histlog.sh, referer: http://den2sch17/hobbit/bb2.html". I have found no core files left behind.
How is the best way to debug this problem, with no core files? Is there a good method to run this (or I suppose more specifically, hobbitsvc.cgi) under the debugger and feed it the request so I can tell why it is silently failing?
Thanks in advance for any suggestions. -Alan
I am experiencing same problem but it is on a 4.2.0 server. If you like, we can work together to debug this issue. This bug is listed on my hobbit deployment todo list .
tj
From: "Alan Sparks" <asparks at doublesparks.net> Sent: Monday, June 22, 2009 8:10 PM To: <hobbit at hswn.dk> Subject: [hobbit] Debugging issues with bb-histlog.sh on 4.3.0
I've some "random" failures on bb-histlog.sh, viewing items in the bb2 event log. Some work as expected, but some when clicked appear to do nothing. Hitting the URL for that (say http://den2sch17/hobbit-cgi/bb-histlog.sh?HOST=den1ws063&SERVICE=nfs&TIMEBUF...) with curl shows a zero-length reply. Checking the Apache error log shows "Premature end of script headers: bb-histlog.sh, referer: http://den2sch17/hobbit/bb2.html". I have found no core files left behind.
How is the best way to debug this problem, with no core files? Is there a good method to run this (or I suppose more specifically, hobbitsvc.cgi) under the debugger and feed it the request so I can tell why it is silently failing?
Thanks in advance for any suggestions. -Alan
To unsubscribe from the hobbit list, send an e-mail to hobbit-unsubscribe at hswn.dk
T.J. Yang wrote:
I am experiencing same problem but it is on a 4.2.0 server. If you like, we can work together to debug this issue. This bug is listed on my hobbit deployment todo list .
From: "Alan Sparks" <asparks at doublesparks.net>
I've some "random" failures on bb-histlog.sh, viewing items in the bb2 event log. Some work as expected, but some when clicked appear to do nothing. Hitting the URL for that (say http://den2sch17/hobbit-cgi/bb-histlog.sh?HOST=den1ws063&SERVICE=nfs&TIMEBUF...)
with curl shows a zero-length reply. Checking the Apache error log shows "Premature end of script headers: bb-histlog.sh, referer: http://den2sch17/hobbit/bb2.html". I have found no core files left behind.
Well, I have mixed luck running under GDB... looking at the code, saw it was trying to get the CGI info from the environment so set some environment variables to fake up enough CGI environment to get it to run. But mostly wound up getting segfaults in expand_env on the HTMLCONTENTTYPE stuff.
But I stumbled upon something that fixed my problem -- but not sure why. I edited the cgi-bin/bb-histlog.sh file, and added "cd /tmp" before the meat of the script. For some reason, I now seem to have no issues. -Alan
On Wed, Jun 24, 2009 at 7:24 PM, Alan Sparks <asparks at doublesparks.net>wrote:
T.J. Yang wrote:
I am experiencing same problem but it is on a 4.2.0 server. If you like, we can work together to debug this issue. This bug is listed on my hobbit deployment todo list .
From: "Alan Sparks" <asparks at doublesparks.net>
I've some "random" failures on bb-histlog.sh, viewing items in the bb2 event log. Some work as expected, but some when clicked appear to do nothing. Hitting the URL for that (say
http://den2sch17/hobbit-cgi/bb-histlog.sh?HOST=den1ws063&SERVICE=nfs&TIMEBUF... )
with curl shows a zero-length reply. Checking the Apache error log shows "Premature end of script headers: bb-histlog.sh, referer: http://den2sch17/hobbit/bb2.html". I have found no core files left behind.
Well, I have mixed luck running under GDB... looking at the code, saw it was trying to get the CGI info from the environment so set some environment variables to fake up enough CGI environment to get it to run. But mostly wound up getting segfaults in expand_env on the HTMLCONTENTTYPE stuff.
But I stumbled upon something that fixed my problem -- but not sure why. I edited the cgi-bin/bb-histlog.sh file, and added "cd /tmp" before the meat of the script. For some reason, I now seem to have no issues.
Perhaps that ought to be "cd $BBTMP" instead?? Keep all Xymon stuff in one place.
Ralph Mitchell
Ralph Mitchell wrote:
On Wed, Jun 24, 2009 at 7:24 PM, Alan Sparks <asparks at doublesparks.net <mailto:asparks at doublesparks.net>> wrote:
T.J. Yang wrote: > I am experiencing same problem but it is on a 4.2.0 server. > If you like, we can work together to debug this issue. > This bug is listed on my hobbit deployment todo list . > > -------------------------------------------------- > From: "Alan Sparks" <asparks at doublesparks.net <mailto:asparks at doublesparks.net>> >> I've some "random" failures on bb-histlog.sh, viewing items in the bb2 >> event log. Some work as expected, but some when clicked appear to do >> nothing. Hitting the URL for that (say >> http://den2sch17/hobbit-cgi/bb-histlog.sh?HOST=den1ws063&SERVICE=nfs&TIMEBUF=Mon_Jun_22_18:46:39_2009 <http://den2sch17/hobbit-cgi/bb-histlog.sh?HOST=den1ws063&SERVICE=nfs&TIMEBUF=Mon_Jun_22_18:46:39_2009>) >> >> with curl shows a zero-length reply. Checking the Apache error log >> shows "Premature end of script headers: bb-histlog.sh, referer: >> http://den2sch17/hobbit/bb2.html". I have found no core files left >> behind. >> Well, I have mixed luck running under GDB... looking at the code, saw it was trying to get the CGI info from the environment so set some environment variables to fake up enough CGI environment to get it to run. But mostly wound up getting segfaults in expand_env on the HTMLCONTENTTYPE stuff. But I stumbled upon something that fixed my problem -- but not sure why. I edited the cgi-bin/bb-histlog.sh file, and added "cd /tmp" before the meat of the script. For some reason, I now seem to have no issues.Perhaps that ought to be "cd $BBTMP" instead?? Keep all Xymon stuff in one place.
Ralph Mitchell
BBTMP is not defined when this script runs... -Alan
Date: Wed, 24 Jun 2009 18:42:17 -0600 From: asparks at doublesparks.net To: hobbit at hswn.dk Subject: Re: [hobbit] Debugging issues with bb-histlog.sh on 4.3.0
Ralph Mitchell wrote:
On Wed, Jun 24, 2009 at 7:24 PM, Alan Sparks
wrote:
T.J. Yang wrote:
I am experiencing same problem but it is on a 4.2.0 server. If you like, we can work together to debug this issue. This bug is listed on my hobbit deployment todo list .
From: "Alan Sparks"
I've some "random" failures on bb-histlog.sh, viewing items in the bb2 event log. Some work as expected, but some when clicked appear to do nothing. Hitting the URL for that (say
http://den2sch17/hobbit-cgi/bb-histlog.sh?HOST=den1ws063&SERVICE=nfs&TIMEBUF... )
with curl shows a zero-length reply. Checking the Apache error log shows "Premature end of script headers: bb-histlog.sh, referer: http://den2sch17/hobbit/bb2.html". I have found no core files left behind.
Well, I have mixed luck running under GDB... looking at the code, saw it was trying to get the CGI info from the environment so set some environment variables to fake up enough CGI environment to get it to run. But mostly wound up getting segfaults in expand_env on the HTMLCONTENTTYPE stuff.
But I stumbled upon something that fixed my problem -- but not sure why. I edited the cgi-bin/bb-histlog.sh file, and added "cd /tmp" before the meat of the script. For some reason, I now seem to have no issues.
Perhaps that ought to be "cd $BBTMP" instead?? Keep all Xymon stuff in one place.
Ralph Mitchell
BBTMP is not defined when this script runs...
Following is my debugging of my hobbit server implementation(using slightly different paths). bb-hostsvc.sh has two lines of code.
- ". /etc/opt/hobbitserver42/hobbitcgi.cfg"
- "exec /opt/hobbitserver42/bin/hobbitsvc.cgi $CGI_SVC_OPTS"
$CGI_SVC_OPTS variable got declared in hobbitcgi.cfg as following
CGI_SVC_OPTS="--env=/etc/opt/hobbitserver42/hobbitserver.cfg --no-svcid --history=top" and in hobbitserver.cfg, BBTMP is declared also.
So I don't see why declaring BBTMP can help. but I did go ahead and re-declared BBTMP variable in bb-histlog.sh. The premature error message still showing in apache error_log file. And I do see a core file under cig-bin and file command shows it is from hobbitsvc.cgi command.
core: ELF 32-bit MSB core file SPARC Version 1, from 'hobbitsvc.cgi'
I am using Sun's compiler without -g option, thus recompiling with -g is needed to proceed with dbx command.
tj
-Alan
To unsubscribe from the hobbit list, send an e-mail to hobbit-unsubscribe at hswn.dk
Microsoft brings you a new way to search the web. Try Bing™ now http://www.bing.com?form=MFEHPG&publ=WLHMTAG&crea=TEXT_MFEHPG_Core_tagline_t...
On Wed, Jun 24, 2009 at 10:55 PM, T.J. Yang <tj_yang at hotmail.com> wrote:
Date: Wed, 24 Jun 2009 18:42:17 -0600 From: asparks at doublesparks.net To: hobbit at hswn.dk Subject: Re: [hobbit] Debugging issues with bb-histlog.sh on 4.3.0
Ralph Mitchell wrote:
On Wed, Jun 24, 2009 at 7:24 PM, Alan Sparks
wrote:
T.J. Yang wrote:
I am experiencing same problem but it is on a 4.2.0 server. If you like, we can work together to debug this issue. This bug is listed on my hobbit deployment todo list .
From: "Alan Sparks"
I've some "random" failures on bb-histlog.sh, viewing items in the bb2 event log. Some work as expected, but some when clicked appear to do nothing. Hitting the URL for that (say
http://den2sch17/hobbit-cgi/bb-histlog.sh?HOST=den1ws063&SERVICE=nfs&TIMEBUF...
)
with curl shows a zero-length reply. Checking the Apache error log shows "Premature end of script headers: bb-histlog.sh, referer: http://den2sch17/hobbit/bb2.html". I have found no core files left behind.
Well, I have mixed luck running under GDB... looking at the code, saw it was trying to get the CGI info from the environment so set some environment variables to fake up enough CGI environment to get it to run. But mostly wound up getting segfaults in expand_env on the HTMLCONTENTTYPE stuff.
But I stumbled upon something that fixed my problem -- but not sure why. I edited the cgi-bin/bb-histlog.sh file, and added "cd /tmp" before the meat of the script. For some reason, I now seem to have no issues.
Perhaps that ought to be "cd $BBTMP" instead?? Keep all Xymon stuff in one place.
Ralph Mitchell
BBTMP is not defined when this script runs...
Following is my debugging of my hobbit server implementation(using slightly different paths). bb-hostsvc.sh has two lines of code.
- ". /etc/opt/hobbitserver42/hobbitcgi.cfg"
- "exec /opt/hobbitserver42/bin/hobbitsvc.cgi $CGI_SVC_OPTS"
$CGI_SVC_OPTS variable got declared in hobbitcgi.cfg as following
CGI_SVC_OPTS="--env=/etc/opt/hobbitserver42/hobbitserver.cfg --no-svcid --history=top" and in hobbitserver.cfg, BBTMP is declared also.
So I don't see why declaring BBTMP can help. but I did go ahead and re-declared BBTMP variable in bb-histlog.sh. The premature error message still showing in apache error_log file. And I do see a core file under cig-bin and file command shows it is from hobbitsvc.cgi command.
But did you cd to $BBTMP as well as redefining it?? The only reason I mentioned it was that Alan reported that "cd /tmp" made it work. I just thought it would be better to cd into a place the Xymon owns.
Ralph Mitchell
Date: Wed, 24 Jun 2009 23:16:39 -0500 From: ralphmitchell at gmail.com To: hobbit at hswn.dk Subject: Re: [hobbit] Debugging issues with bb-histlog.sh on 4.3.0
On Wed, Jun 24, 2009 at 10:55 PM, T.J. Yang> wrote:
Date: Wed, 24 Jun 2009 18:42:17 -0600
From: asparks at doublesparks.net
To: hobbit at hswn.dk
Subject: Re: [hobbit] Debugging issues with bb-histlog.sh on 4.3.0
Ralph Mitchell wrote:
On Wed, Jun 24, 2009 at 7:24 PM, Alan Sparks
wrote:
T.J. Yang wrote:
I am experiencing same problem but it is on a 4.2.0 server.
If you like, we can work together to debug this issue.
This bug is listed on my hobbit deployment todo list .
From: "Alan Sparks"
I've some "random" failures on bb-histlog.sh, viewing items in
the bb2
event log. Some work as expected, but some when clicked appear
to do
nothing. Hitting the URL for that (say
http://den2sch17/hobbit-cgi/bb-histlog.sh?HOST=den1ws063&SERVICE=nfs&TIMEBUF...
)
with curl shows a zero-length reply. Checking the Apache error log
shows "Premature end of script headers: bb-histlog.sh, referer:
http://den2sch17/hobbit/bb2.html". I have found no core files left
behind.
Well, I have mixed luck running under GDB... looking at the code,
saw it
was trying to get the CGI info from the environment so set some
environment variables to fake up enough CGI environment to get it to
run. But mostly wound up getting segfaults in expand_env on the
HTMLCONTENTTYPE stuff.
But I stumbled upon something that fixed my problem -- but not sure
why. I edited the cgi-bin/bb-histlog.sh file, and added
"cd /tmp" before the meat of the script. For some reason, I now
seem to
have no issues.
Perhaps that ought to be "cd $BBTMP" instead?? Keep all Xymon stuff
in one place.
Ralph Mitchell
BBTMP is not defined when this script runs...
Following is my debugging of my hobbit server implementation(using slightly different paths).
bb-hostsvc.sh has two lines of code.
". /etc/opt/hobbitserver42/hobbitcgi.cfg"
"exec /opt/hobbitserver42/bin/hobbitsvc.cgi $CGI_SVC_OPTS"
$CGI_SVC_OPTS variable got declared in hobbitcgi.cfg as following
CGI_SVC_OPTS="--env=/etc/opt/hobbitserver42/hobbitserver.cfg --no-svcid --history=top"
and in hobbitserver.cfg, BBTMP is declared also.
So I don't see why declaring BBTMP can help. but I did go ahead and re-declared BBTMP variable in bb-histlog.sh. The premature error message still showing in apache error_log file.
And I do see a core file under cig-bin and file command shows it is from hobbitsvc.cgi command.
But did you cd to $BBTMP as well as redefining it?? The only reason I mentioned it was that Alan reported that "cd /tmp" made it work. I just thought it would be better to cd into a place the Xymon owns.
- following change still generate Premature errors.
BBTMP=/var/opt/hobbitserver42/tmp cd ${BBTMP} . /etc/opt/hobbitserver42/hobbitcgi.cfg exec /opt/hobbitserver42/bin/hobbitsvc.cgi $CGI_SVC_OPTS 2. Tracing the src code now http://hobbitmon.svn.sourceforge.net/viewvc/hobbitmon/branches/4.2.0/web/Mak... HOBBITSVCOBJS = hobbitsvc.o hobbitsvc-info.o hobbitsvc-trends.o hobbitsvc.cgi is from hobbitsvc.c hobbitsvc-info.c hobbitsvc-trends.c.
tj
Ralph Mitchell
Hotmail® has ever-growing storage! Don’t worry about storage limits. http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutoria...
T.J. Yang wrote:
But did you cd to $BBTMP as well as redefining it?? The only reason I mentioned it was that Alan reported that "cd /tmp" made it work. I just thought it would be better to cd into a place the Xymon owns.
- following change still generate Premature errors.
BBTMP=/var/opt/hobbitserver42/tmp cd ${BBTMP} . /etc/opt/hobbitserver42/hobbitcgi.cfg exec /opt/hobbitserver42/bin/hobbitsvc.cgi $CGI_SVC_OPTS 2. Tracing the src code now http://hobbitmon.svn.sourceforge.net/viewvc/hobbitmon/branches/4.2.0/web/Mak... HOBBITSVCOBJS = hobbitsvc.o hobbitsvc-info.o hobbitsvc-trends.o hobbitsvc.cgi is from hobbitsvc.c hobbitsvc-info.c hobbitsvc-trends.c.
tj
Ralph Mitchell
Well, guess you're mileage varied... Using BBTMP without setting it wasn't an option, since it'd expand to blank. Do know it helped me, with no good reason why. Unfortunately, as of today, I'm no longer in a position to continue debugging it. -Alan
Greetings,
I have successfully configured the "post" http monitor to login to a website using a form. However, I don't think this monitor has the ability to "log out" like Sitescope for example and thus the end application server ends up with a lot of idle logins and eventually exhausts the connection limit. Is there any process to have hobbit do an additional check/post on the "log off" button after the initial login and content check (if successful)?
Thanks, Tom
Typically the way a log out is started is by clicking a link. Could you not just wget or curl the URL?
Josh Luthman Office: 937-552-2340 Direct: 937-552-2343 1100 Wayne St Suite 1337 Troy, OH 45373
"When you have eliminated the impossible, that which remains, however improbable, must be the truth." --- Sir Arthur Conan Doyle
On Thu, Jun 25, 2009 at 1:05 PM, Tom Moore <Tom.Moore at sas.com> wrote:
Greetings,
I have successfully configured the "post" http monitor to login to a website using a form. However, I don't think this monitor has the ability to "log out" like Sitescope for example and thus the end application server ends up with a lot of idle logins and eventually exhausts the connection limit. Is there any process to have hobbit do an additional check/post on the "log off" button after the initial login and content check (if successful)?
Thanks, Tom
To unsubscribe from the hobbit list, send an e-mail to hobbit-unsubscribe at hswn.dk
I could, but I love the simpleness of this in my bb-hosts, rather than having to write external scripts
post;https://site.blah.com;switch=Log+In&user=user&password=password;logged
From: Josh Luthman [mailto:josh at imaginenetworksllc.com] Sent: Thursday, June 25, 2009 1:20 PM To: hobbit at hswn.dk Subject: Re: [hobbit] Question regarding logins and content checks
Typically the way a log out is started is by clicking a link. Could you not just wget or curl the URL?
Josh Luthman Office: 937-552-2340 Direct: 937-552-2343 1100 Wayne St Suite 1337 Troy, OH 45373
"When you have eliminated the impossible, that which remains, however improbable, must be the truth." --- Sir Arthur Conan Doyle
On Thu, Jun 25, 2009 at 1:05 PM, Tom Moore <Tom.Moore at sas.com<mailto:Tom.Moore at sas.com>> wrote: Greetings,
I have successfully configured the "post" http monitor to login to a website using a form. However, I don't think this monitor has the ability to "log out" like Sitescope for example and thus the end application server ends up with a lot of idle logins and eventually exhausts the connection limit. Is there any process to have hobbit do an additional check/post on the "log off" button after the initial login and content check (if successful)?
Thanks, Tom
To unsubscribe from the hobbit list, send an e-mail to hobbit-unsubscribe at hswn.dk<mailto:hobbit-unsubscribe at hswn.dk>
When was this post added to bb-hosts? I wasn't aware you could do this. This is good news for many people here!
Josh Luthman Office: 937-552-2340 Direct: 937-552-2343 1100 Wayne St Suite 1337 Troy, OH 45373
"When you have eliminated the impossible, that which remains, however improbable, must be the truth." --- Sir Arthur Conan Doyle
On Thu, Jun 25, 2009 at 1:33 PM, Tom Moore <Tom.Moore at sas.com> wrote:
I could, but I love the simpleness of this in my bb-hosts, rather than having to write external scripts
post;https://site.blah.com ;switch=Log+In&user=user&password=password;logged
*From:* Josh Luthman [mailto:josh at imaginenetworksllc.com] *Sent:* Thursday, June 25, 2009 1:20 PM *To:* hobbit at hswn.dk *Subject:* Re: [hobbit] Question regarding logins and content checks
Typically the way a log out is started is by clicking a link. Could you not just wget or curl the URL?
Josh Luthman Office: 937-552-2340 Direct: 937-552-2343 1100 Wayne St Suite 1337 Troy, OH 45373
"When you have eliminated the impossible, that which remains, however improbable, must be the truth." --- Sir Arthur Conan Doyle
On Thu, Jun 25, 2009 at 1:05 PM, Tom Moore <Tom.Moore at sas.com> wrote:
Greetings,
I have successfully configured the "post" http monitor to login to a website using a form. However, I don't think this monitor has the ability to "log out" like Sitescope for example and thus the end application server ends up with a lot of idle logins and eventually exhausts the connection limit. Is there any process to have hobbit do an additional check/post on the "log off" button after the initial login and content check (if successful)?
Thanks, Tom
To unsubscribe from the hobbit list, send an e-mail to hobbit-unsubscribe at hswn.dk
I think 4.2 has post, but I don't know when it first appeared. I never used it because the servers I was hitting often had weird redirects that were best handled by a script. Ralph Mitchell
On Thu, Jun 25, 2009 at 12:40 PM, Josh Luthman <josh at imaginenetworksllc.com>wrote:
When was this post added to bb-hosts? I wasn't aware you could do this. This is good news for many people here!
Josh Luthman Office: 937-552-2340 Direct: 937-552-2343 1100 Wayne St Suite 1337 Troy, OH 45373
"When you have eliminated the impossible, that which remains, however improbable, must be the truth." --- Sir Arthur Conan Doyle
On Thu, Jun 25, 2009 at 1:33 PM, Tom Moore <Tom.Moore at sas.com> wrote:
I could, but I love the simpleness of this in my bb-hosts, rather than having to write external scripts
post;https://site.blah.com ;switch=Log+In&user=user&password=password;logged
*From:* Josh Luthman [mailto:josh at imaginenetworksllc.com] *Sent:* Thursday, June 25, 2009 1:20 PM *To:* hobbit at hswn.dk *Subject:* Re: [hobbit] Question regarding logins and content checks
Typically the way a log out is started is by clicking a link. Could you not just wget or curl the URL?
Josh Luthman Office: 937-552-2340 Direct: 937-552-2343 1100 Wayne St Suite 1337 Troy, OH 45373
"When you have eliminated the impossible, that which remains, however improbable, must be the truth." --- Sir Arthur Conan Doyle
On Thu, Jun 25, 2009 at 1:05 PM, Tom Moore <Tom.Moore at sas.com> wrote:
Greetings,
I have successfully configured the "post" http monitor to login to a website using a form. However, I don't think this monitor has the ability to "log out" like Sitescope for example and thus the end application server ends up with a lot of idle logins and eventually exhausts the connection limit. Is there any process to have hobbit do an additional check/post on the "log off" button after the initial login and content check (if successful)?
Thanks, Tom
To unsubscribe from the hobbit list, send an e-mail to hobbit-unsubscribe at hswn.dk
I've added a quick and dirty monitor that might be of some use to someone here: http://xymonton.trantor.org/doku.php/monitors:winupd
At the moment its very basic in that it only checks for pending reboots required as a result of windows updates applied to a windows client. This has been useful here on site as sometimes updates are applied to production servers but downtime is not alllowed.. This monitor serves as a reminder to reboot to finish applying the updates
If you think you can enhance the script please do. My vb is poor..
Padraig Lennon
Here is a vbscript I use to test for needed updates. I did not put any checks in for the existence of bbwin. I run my script from a Windows task and so I don't use the file system object to write the file-I just redirect stdout to a file in my bbwin's tmp directory. Feel free to modify as you see fit.
Ray
'code begins here 'Change these to match your environment Const AlarmRedLevel = 10 Const AlarmYellowLevel = 5 Const AlarmRed = "red" Const AlarmYellow = "yellow" Const AlarmGreen = "green"
Dim oSearcher, oResults, oUpdates, oShell Set oSearcher = CreateObject("Microsoft.Update.Searcher") Set oResults = oSearcher.Search("Type='Software'") Set oUpdates = oResults.Updates Set oShell = WScript.CreateObject("WScript.Shell")
Dim strOut, IsInstalled, strKBs, strURL, IsEven, iUpdates, iUpdatesNeeded, strClass, strAlarm, strSvrName iUpdates = oUpdates.Count strSvrName = LCase(oShell.ExpandEnvironmentStrings("%COMPUTERNAME%"))
iUpdatesNeeded = 0 For i = 0 to iUpdates - 1 IsInstalled = oUpdates.Item(i).IsInstalled If (IsInstalled = False) Then iUpdatesNeeded = iUpdatesNeeded + 1 End If Next
If (iUpdatesNeeded > AlarmRedLevel) Then strAlarm = AlarmRed & " " & Date & " " & LCase(Time) & " " & strSvrName & VbCrLf Else If (iUpdatesNeeded > AlarmYellowLevel) Then strAlarm = AlarmYellow & " " & Date & " " & LCase(Time) & " " & strSvrName & VbCrLf Else strAlarm = AlarmGreen & " " & Date & " " & LCase(Time) & " " & strSvrName & VbCrLf End If End If
WScript.Echo strAlarm & VbCrLf
strOut = "<style type=""text/css"">" & VbCrLf & _ "table.updates { border-width: 3px; border-spacing: 0px; border-style: solid; border-color: black; border-collapse: separate; background-color: white; }" & VbCrLf & _ "table.updates th { background-color: white; }" & VbCrLf & _ "table.updates td.even { border-width: 1px; padding: 3px; border-style: solid; border-color: gray; background-color: #FCF6CF; }" & VbCrLf & _ "table.updates td.odd { border-width: 1px; padding: 3px; border-style: solid; border-color: gray; background-color: #FEFEF2; }" & VbCrLf & _ "</style>" & VbCrLf & _ "<h2>" & UCase(strSvrName) & " Needs [" & CStr(iUpdatesNeeded) & "] Windows Updates</h2>" & VbCrLf & _ "<table class='updates'>" & _ "<th>Title</th>" & _ "<th>Severity</th>" & _ "<th>Description</th>" & _ "<th>Size(bytes)</th>" & _ "<th>Deadline</th>" & _ "<th>URL</th>" & _ "<th>KBs</th>" & _ "</tr>" & VbCrLf IsEven = True For i = 0 to iUpdates - 1 IsInstalled = oUpdates.Item(i).IsInstalled If (IsInstalled = False) Then strKBs = "" strURL = oUpdates.Item(i).SupportURL If (IsEven = True) Then strClass = "class='even'" IsEven = False Else strClass = "class='odd'" IsEven = True End If strOut = strOut + "<tr><td " & strClass & ">" & oUpdates.Item(i).Title & "</td>" & _ "<td " & strClass & ">" & oUpdates.Item(i).MsrcSeverity & "</td>" & _ "<td " & strClass & ">" & oUpdates.Item(i).Description & "</td>" & _ "<td " & strClass & ">" & oUpdates.Item(i).MaxDownloadSize & "</td>" & _ "<td " & strClass & "> " & oUpdates.Item(i).Deadline & "</td>" & _ "<td " & strClass & "><A href='" & strURL & "' target='_blank'>" & strURL & "</a></td>" For Each strArticle in oUpdates.Item(i).KBArticleIDs If (Len(strKBs) > 0) Then strKBs = strKBs & ", " & strArticle Else strKBs = strArticle End If Next 'each KB strOut = strOut & "<td " & strClass & ">" & strKBs & "</td>" strOut = strOut & "</tr>" & VbCrLf End If 'Installed? Next 'each update strOut = strOut & "</table>" & VbCrLf
WScript.Echo strOut
'Release our resources Set oShell = Nothing Set oUpdates = Nothing Set oResults = Nothing Set oSearcher = Nothing
From: Lennon, Padraig [mailto:Padraig.Lennon at pioneerinvestments.com] Sent: Friday, June 26, 2009 3:52 AM To: hobbit at hswn.dk Subject: [hobbit] Windows update check monitor added to the Shire
I've added a quick and dirty monitor that might be of some use to someone here: http://xymonton.trantor.org/doku.php/monitors:winupd
At the moment its very basic in that it only checks for pending reboots required as a result of windows updates applied to a windows client. This has been useful here on site as sometimes updates are applied to production servers but downtime is not alllowed.. This monitor serves as a reminder to reboot to finish applying the updates
If you think you can enhance the script please do. My vb is poor..
Padraig Lennon
CONFIDENTIALITY NOTICE: This email and any attachments are for the exclusive and confidential use of the intended recipient. If you are not the intended recipient, please do not read, distribute or take action in reliance upon this message. If you have received this in error, please notify us immediately by return email and promptly delete this message and its attachments from your computer system. We do not waive attorney-client or work product privilege by the transmission of this message.
This is *not* fully regression tested (it works for me); but, here is the code using a disconnected record set for sorting. Also, IE8 does not format the table the same way Firefox 3 does, and I gave up trying to make it do it. So, you will likely want to adjust the styles to fit your needs.
Ray
'Change these to match your environment Const AlarmRedLevel = 10 Const AlarmYellowLevel = 5 Const AlarmRed = "red" Const AlarmYellow = "yellow" Const AlarmGreen = "green" Const adVarChar = 200 Const adInteger = 3 Const MaxCharacters = 255 Const adFldIsNullable = 32
Dim oSearcher, oResults, oUpdates, oShell, oRS Set oSearcher = CreateObject("Microsoft.Update.Searcher") Set oResults = oSearcher.Search("Type='Software'") Set oUpdates = oResults.Updates Set oShell = WScript.CreateObject("WScript.Shell") Set oRS = CreateObject("ADOR.Recordset")
oRS.Fields.Append "title", adVarChar, MaxCharacters oRS.Fields.Append "severity", adVarChar, MaxCharacters, adFldIsNullable 'I do not know how large the actual description field is; it will bomb during updates if the description is not large enough oRS.Fields.Append "description", adVarChar, MaxCharacters + MaxCharacters oRS.Fields.Append "size", adInteger oRS.Fields.Append "deadline", adVarChar, MaxCharacters, adFldIsNullable oRS.Fields.Append "url", adVarChar, MaxCharacters oRS.Fields.Append "kbs", adVarChar, MaxCharacters
Dim strOut, IsInstalled, strKBs, strURL, IsEven, iUpdates, iUpdatesNeeded, strClass, strAlarm, strSvrName, strSeverity iUpdates = oUpdates.Count strSvrName = LCase(oShell.ExpandEnvironmentStrings("%COMPUTERNAME%"))
iUpdatesNeeded = 0 oRS.Open For i = 0 to iUpdates - 1 IsInstalled = oUpdates.Item(i).IsInstalled If (IsInstalled = False) Then strKBs = "" iUpdatesNeeded = iUpdatesNeeded + 1 oRS.AddNew oRS("title") = oUpdates.Item(i).Title strSeverity = oUpdates.Item(i).MsrcSeverity If (IsNull(strSeverity) = True) Then strSeverity = "9 - none" Else If (IsEmpty(strSeverity) = True) Then strSeverity = "9 - none" Else Select Case UCase(strSeverity) Case "CRITICAL" strSeverity = "1-Critical" Case "IMPORTANT" strSeverity = "2-Important" Case "MODERATE" strSeverity = "3-Moderate" Case "LOW" strSeverity = "4-Low" Case Else strSeverity = "9-" & strSeverity End Select End If 'severity empty End If 'severity null oRS("severity") = strSeverity oRS("description") = oUpdates.Item(i).Description oRS("size") = oUpdates.Item(i).MaxDownloadSize oRS("deadline") = oUpdates.Item(i).Deadline oRS("url") = oUpdates.Item(i).SupportURL For Each strArticle in oUpdates.Item(i).KBArticleIDs If (Len(strKBs) > 0) Then strKBs = strKBs & ", " & strArticle Else strKBs = strArticle End If Next 'each kb oRS("kbs") = strKBs oRS.Update End If Next oRS.Sort = "severity ASC, title ASC" oRS.MoveFirst
If (iUpdatesNeeded > AlarmRedLevel) Then strAlarm = AlarmRed & " " & Date & " " & LCase(Time) & " " & strSvrName & VbCrLf Else If (iUpdatesNeeded > AlarmYellowLevel) Then strAlarm = AlarmYellow & " " & Date & " " & LCase(Time) & " " & strSvrName & VbCrLf Else strAlarm = AlarmGreen & " " & Date & " " & LCase(Time) & " " & strSvrName & VbCrLf End If End If
WScript.Echo strAlarm & VbCrLf
strOut = "<style type=""text/css"">" & VbCrLf & _ "table.updates { width: 990; border-width: 3px; border-spacing: 0px; border-style: solid; border-color: black; border-collapse: separate; background-color: white; color: black; }" & VbCrLf & _ "table.updates th { background-color: white; }" & VbCrLf & _ "table.updates td.even { border-width: 1px; padding: 3px; border-style: solid; border-color: gray; background-color: #FCF6CF; color: black; }" & VbCrLf & _ "table.updates td.odd { border-width: 1px; padding: 3px; border-style: solid; border-color: gray; background-color: #FEFEF2; color: black; }" & VbCrLf & _ "A:link { text-decoration: none; color: blue; }" & VbCrLf & _ "A:visited { text-decoration: none; color: purple; }" & VbCrLf & _ "A:hover { text-decoration: underline; font-weight: bold; color: red; }" & VbCrLf & _ "</style>" & VbCrLf & _ "<h2>" & UCase(strSvrName) & " Needs [" & CStr(iUpdatesNeeded) & "] Windows Updates</h2>" & VbCrLf & _ "<table class='updates'>" & _ "<th>Title</th>" & _ "<th>Severity</th>" & _ "<th>Description</th>" & _ "<th>Size(bytes)</th>" & _ "<th>Deadline</th>" & _ "<th>URL</th>" & _ "<th>KBs</th>" & _ "</tr>" & VbCrLf IsEven = True Do Until oRS.EOF strKBs = "" strURL = oRS.Fields.Item("url") If (IsEven = True) Then strClass = "class='even'" IsEven = False Else strClass = "class='odd'" IsEven = True End If strOut = strOut + "<tr><td style='width: 25%' " & strClass & ">" & oRS.Fields.Item("title") & "</td>" & _ "<td style='width: 5%' " & strClass & "> " & oRS.Fields.Item("severity") & "</td>" & _ "<td style='width: 45%' " & strClass & ">" & oRS.Fields.Item("description") & "</td>" & _ "<td style='width: 5%' " & strClass & ">" & CStr(oRS.Fields.Item("size")) & "</td>" & _ "<td style='width: 5%' " & strClass & "> " & oRS.Fields.Item("deadline") & "</td>" & _ "<td style='width: 10%' " & strClass & "><A href='" & strURL & "' target='_blank'>" & strURL & "</a></td>" & _ "<td style='width: 5%' " & strClass & ">" & oRS.Fields.Item("kbs") & "</td>" strOut = strOut & "</tr>" & VbCrLf oRS.MoveNext Loop 'each record
strOut = strOut & "</table>" & VbCrLf
WScript.Echo strOut
'Release our resources oRS.Close Set oShell = Nothing Set oUpdates = Nothing Set oResults = Nothing Set oSearcher = Nothing
CONFIDENTIALITY NOTICE: This email and any attachments are for the exclusive and confidential use of the intended recipient. If you are not the intended recipient, please do not read, distribute or take action in reliance upon this message. If you have received this in error, please notify us immediately by return email and promptly delete this message and its attachments from your computer system. We do not waive attorney-client or work product privilege by the transmission of this message.
Well, I found an error... (grin). I needed to check for a recordset with no records in it-no Windows updates needed! Sorry for the inconvenience. Here's the updated code...
Ray
'Change these to match your environment Const AlarmRedLevel = 10 Const AlarmYellowLevel = 5 Const AlarmRed = "green" Const AlarmYellow = "green" Const AlarmGreen = "green" Const adVarChar = 200 Const adInteger = 3 Const MaxCharacters = 255 Const adFldIsNullable = 32
Dim oSearcher, oResults, oUpdates, oShell, oRS Set oSearcher = CreateObject("Microsoft.Update.Searcher") Set oResults = oSearcher.Search("Type='Software'") Set oUpdates = oResults.Updates Set oShell = WScript.CreateObject("WScript.Shell") Set oRS = CreateObject("ADOR.Recordset")
oRS.Fields.Append "title", adVarChar, MaxCharacters oRS.Fields.Append "severity", adVarChar, MaxCharacters, adFldIsNullable oRS.Fields.Append "description", adVarChar, MaxCharacters + MaxCharacters oRS.Fields.Append "size", adInteger oRS.Fields.Append "deadline", adVarChar, MaxCharacters, adFldIsNullable oRS.Fields.Append "url", adVarChar, MaxCharacters oRS.Fields.Append "kbs", adVarChar, MaxCharacters
Dim strOut, IsInstalled, strKBs, strURL, IsEven, iUpdates, iUpdatesNeeded, strClass, strAlarm, strSvrName, strSeverity iUpdates = oUpdates.Count strSvrName = LCase(oShell.ExpandEnvironmentStrings("%COMPUTERNAME%"))
iUpdatesNeeded = 0 oRS.Open For i = 0 to iUpdates - 1 IsInstalled = oUpdates.Item(i).IsInstalled If (IsInstalled = False) Then strKBs = "" iUpdatesNeeded = iUpdatesNeeded + 1 oRS.AddNew oRS("title") = oUpdates.Item(i).Title strSeverity = oUpdates.Item(i).MsrcSeverity If (IsNull(strSeverity) = True) Then strSeverity = "9 - none" Else If (IsEmpty(strSeverity) = True) Then strSeverity = "9 - none" Else Select Case UCase(strSeverity) Case "CRITICAL" strSeverity = "1-Critical" Case "IMPORTANT" strSeverity = "2-Important" Case "MODERATE" strSeverity = "3-Moderate" Case "LOW" strSeverity = "4-Low" Case Else strSeverity = "9-" & strSeverity End Select End If 'severity empty End If 'severity null oRS("severity") = strSeverity oRS("description") = oUpdates.Item(i).Description oRS("size") = oUpdates.Item(i).MaxDownloadSize oRS("deadline") = oUpdates.Item(i).Deadline oRS("url") = oUpdates.Item(i).SupportURL For Each strArticle in oUpdates.Item(i).KBArticleIDs If (Len(strKBs) > 0) Then strKBs = strKBs & ", " & strArticle Else strKBs = strArticle End If Next 'each kb oRS("kbs") = strKBs oRS.Update End If Next
If (iUpdatesNeeded > AlarmRedLevel) Then strAlarm = AlarmRed & " " & Date & " " & LCase(Time) & " " & strSvrName & VbCrLf Else If (iUpdatesNeeded > AlarmYellowLevel) Then strAlarm = AlarmYellow & " " & Date & " " & LCase(Time) & " " & strSvrName & VbCrLf Else strAlarm = AlarmGreen & " " & Date & " " & LCase(Time) & " " & strSvrName & VbCrLf End If End If
WScript.Echo strAlarm & VbCrLf
If (iUpdatesNeeded > 0) Then oRS.Sort = "severity ASC, title ASC" oRS.MoveFirst
strOut = "<style type=""text/css"">" & VbCrLf & _
"table.updates { width: 994; border-width: 3px; border-spacing: 0px; border-style: solid; border-color: black; border-collapse: separate; background-color: white; color: black; }" & VbCrLf & _
"table.updates th { background-color: white; }" & VbCrLf & _
"table.updates td.even { border-width: 1px; padding: 3px; border-style: solid; border-color: gray; background-color: #FCF6CF; color: black; }" & VbCrLf & _
"table.updates td.odd { border-width: 1px; padding: 3px; border-style: solid; border-color: gray; background-color: #FEFEF2; color: black; }" & VbCrLf & _
"A:link { text-decoration: none; color: blue; }" & VbCrLf & _
"A:visited { text-decoration: none; color: purple; }" & VbCrLf & _
"A:hover { text-decoration: underline; font-weight: bold; color: red; }" & VbCrLf & _
"</style>" & VbCrLf & _
"<h2>" & UCase(strSvrName) & " Needs [" & CStr(iUpdatesNeeded) & "] Windows Updates</h2>" & VbCrLf & _
"<table class='updates'>" & _
"<th>Title</th>" & _
"<th>Severity</th>" & _
"<th>Description</th>" & _
"<th>Size(bytes)</th>" & _
"<th>Deadline</th>" & _
"<th>URL</th>" & _
"<th>KBs</th>" & _
"</tr>" & VbCrLf
IsEven = True
Do Until oRS.EOF
strKBs = ""
strURL = oRS.Fields.Item("url")
If (IsEven = True) Then
strClass = "class='even'"
IsEven = False
Else
strClass = "class='odd'"
IsEven = True
End If
strOut = strOut + "<tr><td style='width: 25%' " & strClass & ">" & oRS.Fields.Item("title") & "</td>" & _
"<td style='width: 5%' " & strClass & "> " & oRS.Fields.Item("severity") & "</td>" & _
"<td style='width: 45%' " & strClass & ">" & oRS.Fields.Item("description") & "</td>" & _
"<td style='width: 5%' " & strClass & ">" & CStr(oRS.Fields.Item("size")) & "</td>" & _
"<td style='width: 5%' " & strClass & "> " & oRS.Fields.Item("deadline") & "</td>" & _
"<td style='width: 10%' " & strClass & "><A href='" & strURL & "' target='_blank'>" & strURL & "</a></td>" & _
"<td style='width: 5%' " & strClass & ">" & oRS.Fields.Item("kbs") & "</td>"
strOut = strOut & "</tr>" & VbCrLf
oRS.MoveNext
Loop 'each record
strOut = strOut & "</table>" & VbCrLf
Else strOut = "<div style='font-style: bold; color: yellow;'>No updates required</div>" End If 'iUpdatesNeeded > 0
WScript.Echo strOut
'Release our resources oRS.Close Set oShell = Nothing Set oUpdates = Nothing Set oResults = Nothing Set oSearcher = Nothing
CONFIDENTIALITY NOTICE: This email and any attachments are for the exclusive and confidential use of the intended recipient. If you are not the intended recipient, please do not read, distribute or take action in reliance upon this message. If you have received this in error, please notify us immediately by return email and promptly delete this message and its attachments from your computer system. We do not waive attorney-client or work product privilege by the transmission of this message.
If you're using the bb-hosts "post", I think you'd have to do a second post, or possibly a "cont" check on the logout url. I don't know if cookies would be transferred from one check to the next, which might be a problem. I think you'd also get another column in the output. I almost always used external scripts to do a substantial number of web site checks, so I would simply insert an extra step to do the logout. I generally reported yellow if the logout failed...
Ralph Mitchell
On Thu, Jun 25, 2009 at 12:05 PM, Tom Moore <Tom.Moore at sas.com> wrote:
Greetings,
I have successfully configured the "post" http monitor to login to a website using a form. However, I don't think this monitor has the ability to "log out" like Sitescope for example and thus the end application server ends up with a lot of idle logins and eventually exhausts the connection limit. Is there any process to have hobbit do an additional check/post on the "log off" button after the initial login and content check (if successful)?
Thanks, Tom
To unsubscribe from the hobbit list, send an e-mail to hobbit-unsubscribe at hswn.dk
participants (7)
-
asparks@doublesparks.net
-
josh@imaginenetworksllc.com
-
Padraig.Lennon@pioneerinvestments.com
-
ralphmitchell@gmail.com
-
storerr@nibco.com
-
tj_yang@hotmail.com
-
Tom.Moore@sas.com