MSPSS: is there life after the helpdesk?

sharing solutions to uncommon IT problems

Archive for the ‘Windows Server’ Category

Custom Made NT Service – VB.NET

with one comment


Hello,
I’ve developed a small Custom Made NT Service that will allow you to start, monitor, restart and troubleshoot all sort of files that need to be up at all times.
This NT Service can monitor an unlimited number of processes, in my case I use it to monitor 2 Etherpad Lite and 1 qwebirc.

If you like it, you may also try to improve it (I wrote it in a few hours) and post it back here.

I had to PDF it because WordPress doesn’t allow to post a zip file SVCMonitor.vb app.config.

HTH,
Roberto.

Advertisements

Written by zantoro

January 24, 2013 at 10:54 pm

Etherpad Lite on windows – not as easy as it sounds

with 5 comments


Etherpad is a great real-time collaboration tool… and it’s free. The problem is that, like most cool open source, linux originated tools, is not that easy to implement for admins with a strong MS Windows background.

What’s difficult to understand for a windows guy is that this tool doesn’t get installed through a wizard that does everything for you but you actually have to put some thinking in it… so, after you’ve unzipped the sources in a folder you can start the actual configuration.

The first part is fairly straight forward: open the settings.json and change the config to fit your needs.

If you are planning to use this server on PROD, it is recommended to:

install nodejs (remember to add the NodeJS path to the “path” environment variable)
install mysql (even on the same server) and configure the connection in the settings.json

After the installation, when accessing the /admin section you might be presented with this error: “your json is bad and you should feel bad”…

Capture

The message is cute but it doesn’t tell us much so, if you want to fix it, you should use a JS debug console (Chrome’s version is great). The JS console won’t tell you much as the error is managed and no actual JS error is fired up but if you start debugging the code with few break points you might find out a lot more.
In my case the error was due to a bad formatting of the settings file (which is compiled in json) and in particular I had inserted a common windows path, c:\program files\app\, forgetting that in Linux originated apps, Windows paths should always have double slashes (e.g.: c:\\program files\\app\\).

Last but not least, I had to face the problem of making my etherpad app Production ready for a windows environment. I had 2 major issues:

1. Which port? I’m planning to host multiple services on the same server but using these lightweight web servers only one of them can use port 80… So I’ve decided to configure IIS8 with “Reverse Proxy” this way I could host as many services as I wanted on the same port. This blog has a great “how to”

2. Set up Etherpad as Windows NT Service: I needed a way to make sure the service was always up (even after a restart) and an easy way to allow our monitoring via WMI.
I wrote a little Wrapper Service in vb.net which not only starts and monitor the responsiveness of the service but automatically restarts it if it ever goes down. In addition to that, the processes are started in the session of the service (therefore you don’t need to leave a session open) and use the process “currentdirectory” that you can specify in the web.config file.
With this wrapper service you can actually keep multiple processes under control (and not necessarily of the same type, for example with the same service I maintain 2 etherpad and 1 qwebirc).
Obviously when a process crashes you can find all sort of info in the log file.

HTH,
Roberto.

Written by zantoro

January 24, 2013 at 10:32 pm

Posted in IIS, Windows Server

DNS A record change – World Wide replication

leave a comment »


Hello,

this is just a brief post where I would like to share my findings about DNS changes and World Wide replication.

Up till now I was always told that a World Wide replication of a public DNS modification (e.g. A record) would take up to 72h. It seemed strange to me so I did some research and it turns out this if far from true.

World Wide replication time is entirely dependent on the record (not the zone) Time to Live which contrary to popular beliefs, IS a reliable setting.

For Windows users, in order to see the record’s TTL, you’ll have to click View -> Advanced in the DNS console.

The default setting on windows DNS is 1h which means a World Wide replication of a record change could take up to 70 or 80 minutes.

My suggestion is to set the record’s TTL to 5 minutes 24h before doing the DNS update and change it back to 1h right after you updated the record.

HTH,

Roberto.

Written by zantoro

December 23, 2012 at 10:38 pm

Windows 2008 R2, Vmware and Driver Locked memory

with 4 comments


Hello,
we have had serious performance issues on a server for some time now.
This server is heavily used and we always assumed the problems we were having were simply due to the coexistence of 3 memory and CPU hungry applications on the same box (SQL Server, IIS and Coldfusion).
We tried everything to tweak resources so that one process would not overcome the others.
Nothing seemed to work.
One thing that always bugged us was that the physical memory would go rapidly exhausted although we had increased the memory progressively to 16Gb.
What’s even more strange is that the sum of the memory of each process was far from the “Physical Memory in use” we saw in Task Manager (or process explorer).
I also tried to limit memory usage for both Coldfusion and SQL Server to 5Gb each with no success.
Then I found this application from sysinternals (M. Russinovich rocks): RAMMap
This app gives you a detailed overview of the memory allocation and strangely I had 10Gb allocated to “Driver Locked”.
Google is my friend and I found out that this is usually due to a misconfiguration of VMware.
Apparently in VMware there are two config for each resource:
1. The Hardware configuration: the actual configuration of the VM where you define the physical resources allocated (in my case I had 16Gb for RAM).
2. The resource allocations: here you can play with the VMWare resources to limit the resources configured in point 1.
I found out that in the resource allocations tab we had limited memory to 4096Mb which means that for as much as we added memory to the VM, the available memory for that machine would be always the same and the rest would be “locked” in the vmware tools driver.
I opened that tab (you’ll find it in the VM settings) and selected unlimited and now task manager shows 13Gb of available memory.

I hope this helps,
Roberto.

Written by zantoro

September 15, 2012 at 2:04 pm

Windows 2008 R2: Change File Attribute (Temporary, Offline)

leave a comment »


Hello,
in Windows 2008 R2 (or Windows 7), you may see an icon like this one:

In my case this icon meant that the file had two attributes set: Temporary and Offline (never heard of them before). In the details page of the file properties they appear as TO.

It took me a while to find a quick, reliable solution which would fix these attributes in all files and subfolders.

Download this command line tool: http://smithii.com/attr/
and run this command:

attr.exe -t- -o- -R –dry-run *.* (this returns a list of the files that have offline and temporary attributes set)
Once you made sure you got the right list of files, remove the –dry-run to actually change the attributes.
attr.exe -t- -o- -R *.*

Hope this helps.
Roberto.

Written by zantoro

August 7, 2012 at 2:09 pm

Posted in Windows Server