Upgrade

There has been a link at the top of the admin page of this site for a little while. I run it on WordPress and it is telling me there is an upgrade available. Usually this means I pull down the tar ball, unpack it and usually overwrite some file I really wanted to keep. By the time I get to the last site that I manage it usually goes much smoother but about an hour of my life is gone. So tonight I see that it had a button that said upgrade automatically. After doing a quick upgrade, I clicked the button. Moments later, it says it is completed and check the site and everything is cool.

This is nice!

UPDATE
Apparently this is the only site that will upgrade automatically. It failed on all the others. {sigh}

Comments (1)

PHP

I have never really done much with PHP. I do very little coding and when I do it has always been a Microsoft centric language. For whatever reason, it can’t be boredom I have too much to be doing, this weekend I started fiddling around with PHP. I am actually working through a PHP tutorial so I actually learn the correct ways to use the language instead of just mashing things together like I have done in the past.

Not sure if it is the procedure or the documentation that I am using but it seems to be a very easy language with incredible power available to use. At this point I have only worked through operators, arrays and loops but I have been impressed with the little bit that I have done with it. I am curious once I get to the point of pulling data from a MySQL database and that should be fun.

I have no idea what I am going to do with this knowledge, we use ASP and ASP.net at work.

Comments (1)

Oracle Buys Sun

Ok so about a year ago I was fretting over the idea that MySQL was now owned buy Sun and I actually said, “…Worse of all is if Oracle had purchased them, we would never see another MySQL product again same with IBM.” Uhm yeah, well the news comes out today that Oracle is buying Sun and there by owns MySQL now too.

Interesting.

Comments

Central Sysloging with CentOS 5.3

These instruction are for setting up rsyslog and phpLogCon on CentOS 5.3. It is assumed you have a working Apache and MySQL setup. Configuration of these two packages are outside the realm of this document.

On the Linux server I wanted to host the rsyslog database I ran yum install -y rsyslog-mysql on my CentOS 5.3 machine. Once installed went to the path of cd /usr/share/doc/rsyslog-mysql-2.0.6/. In this location you will see a file called createDB.sql which is the scheme needed to make using phpLogCon easy to use. To create this database type mysql -u MySQLusername -p < createDB.sql You will be prompted for a password for the account you entered and then the database will be created.

Edit the /etc/rsyslog.conf file to add in the mysql connection information at the top of the config file. I am using FROMHOST instead of HOSTNAME as I wasn't getting any hostnames with the former.
$ModLoad ommysql.so
$template dbFormat,”insert into SystemEvents (Message, Facility, FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (’%msg%’, %syslogfacility%, ‘%FROMHOST%’, %syslogpriority%, ‘%timereported:::date-mysql%’, ‘%timegenerated:::date-mysql%’, %iut%, ‘%syslogtag%’)”,sql

*.* :o mmysql:192.168.1.100,Syslog,MySQLusername,MySQLpassword;dbFormat

Stop the normal syslog daemon
service syslog stop

And set it to never come on
chkconfig syslog off

Set rsyslog to start at boot
chkconfig rsyslog on

And then start the service
service rsyslog start

You should now have messages showing in your MySQL database. If you do not check the /var/log/messages to see if there is an error in your rsyslog.conf file.

Once you are sure you are getting messages in your database you can use the phpLogCon application to have a nice web interface over the top of the database. Download from http://www.phplogcon.org/, I am using version 2.6.2 for this tutorial. Once downloaded unpack it and move the src directory to the web server path mv src /var/www/html/phplogcon Out of the contrib directory copy both the configure.sh and secure.sh to /var/www/html/phplogcon. Change to the web directory cd /var/www/html/phplogcon and then run the configure script by typing ./configure.sh Open a web browser and enter the path to this site http://servername/phplogcon to start the configuration of the site. Click NEXT until you get to Step 7 and make sure the source type is MySQL, the Database Name is Syslog and the table name is SystemEvents and then enter your MySQL username and password. You now have a function phpLogCon page.

On the Linux clients make sure you install the rsyslog-mysql module the same way you did on the server by typing yum install -y rsyslog-mysql

Edit the /etc/rsyslog.conf file to add in the mysql connection information at the top of the config file.
$ModLoad ommysql.so
$template dbFormat,"insert into SystemEvents (Message, Facility, FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values ('%msg%', %syslogfacility%, '%FROMHOST%', %syslogpriority%, '%timereported:::date-mysql%', '%timegenerated:::date-mysql%', %iut%, '%syslogtag%')",sql

*.* :o mmysql:192.168.1.100,Syslog,MySQLusername,MySQLpassword;dbFormat

Stop the normal syslog daemon
service syslog stop

And set it to never come on
chkconfig syslog off

Set rsyslog to start at boot
chkconfig rsyslog on

And then start the service
service rsyslog start

Refresh your phpLogCon web page and you will now see two entries from the Linux client, one is a kernel message the other is a syslog message.

Anything that has a syslog capability can now point to the rsyslog server, such as HP JetDirect cards and Cisco network gear. All the messages are available in one location and you can filter and search for issues on your network.

Comments (3)

Command Line On Remote Windows Machine

Ever need to run a command line utility on a remote Windows machine?

Make sure you have PSTools installed on the workstation you are working from.
From your command line type:

psexec \\nameOfRemote cmd.exe

You will now have a command line interface on the remote workstation.

Comments

named As A Forwarding And Reverse Name Server In Your Active Directory Network

In our Active Directory domain we do not allow the clients to resolve outside domain names. This is because we have a very restrictive web browsing policy and people are only allowed access out if a manager says they can, and even at that point it goes through a proxy server that blocks 99% of the internet. The added benefit is that this really curbs any virus or spyware issues. Even though we don’t let user workstations out of the network, there are other vlans that definitely need out. At the time we were very limited on the number of Windows servers we could purchase and place so we went with Linux to provide this name server for these vlans. Below is the config and how resolve both internal and external names and I will describe what each section involves.

Line 6-14 list the subnets that are allowed access to this name server. If you are not in this subnet and you request a name resolution from this server, you will be denied.
Line 18-21 lists the name servers for outside (internet) name resolution. These are the OpenDNS ip addresses.
Line 25-33 tells named that for the domain ‘domain.com’ resolve those names to the internal Active Directory DNS servers.
Line 35-55 lists the zones for reverse name resolution. These zone names must match the reverse name in your AD DNS servers.

options {
        directory "/var/named";
        dump-file "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        version "not currently available";
        allow-query {
                127.0.0.1;
                10.1.4.0/24;
                10.1.6.0/24;
                10.1.7.0/24;
                10.1.15.0/24;
                10.2.4.0/24;
                10.2.7.0/24;
        };
        allow-transfer {
                none;
        };
        forwarders {
                208.67.220.220;
                208.67.222.222;
        };
        forward only;
};

zone "domain.com" IN {
        type forward;
        forwarders {
                10.1.100.100;
                10.1.101.101;
                10.2.100.100;
                10.2.101.101;
        };
};

zone "1.10.in-addr.arpa" {
    type slave;
    file "slaves/1.10.in-addr.arpa";
    masters {
                10.1.100.100;
                10.1.101.101;
                10.2.100.100;
                10.2.101.101;
    };
};

zone "2.10.in-addr.arpa" {
    type slave;
    file "slaves/2.10.in-addr.arpa";
    masters {
                10.1.100.100;
                10.1.101.101;
                10.2.100.100;
                10.2.101.101;
    };
};

include "/etc/rndc.key";

Comments

Work Order Due Next Business Day

Our maintenance department uses a CMMS package called MP2 for all maintenance work orders. The software is based on a MSSQL back end which has allowed us to create many additional reports and web interfaces to help the maintenance staff handle the work orders. Some of the work orders are scheduled PMs and they have a due date. Part of their review is making sure they have the work orders closed on time so to help them out I created a SQL Server Reporting Services report that will email them a list of work orders that are due the next business day.

First I have to get a listing of all the work orders that are due the next business day and then if it is Friday, get all the work orders that are due up through Monday. Below is the TSQL to get that info:

select
	wo.wonum,
	woeqlist.location,
	equip.description,
	wo.taskdesc,
	wo.wotype,
	wo.atfirstname + ' ' + wo.atlastname as fullname,
	wo.schedfinishdate
from
	wo left join woeqlist on wo.wonum = woeqlist.wonum
		join equip on woeqlist.eqnum = equip.eqnum
where
	schedfinishdate
		between
			cast(convert(char, getdate(), 101) as datetime) + 1 and
			case
				when (select datename(dw, getdate())) = 'Friday' then cast(convert(char, getdate(), 101)as datetime) + 3
				else cast(convert(char, getdate(), 101) as datetime) + 1
			end
	and status != 'C'
order by wonum

This will return the work order number, which plant location the equipment’s name, what the title of the work order is, type of work order, who is assigned to the work order and the date it is due as a extreme reminder which day they need to complete this job.

Throw that in a Reporting Services report and we are almost ready. I don’t want to send an email unless there is actually a work order that is due for the following day. For this I create a Data Driven Subscription in the Reporting Services web page for this report.

To do this go to the report you want to send out in the Reporting Services web page and click on the Subscriptions tab. Select the New Data Driven Subscription. Give this subscription a description and select the Shared Data Sources option and click Next. Pick your shared data source and click Next. Now we will make a slightly modified query to get back an email address if any records are available.

select
	email = 'MaintenanceDept@domain.com'
from
	wo
where
	schedfinishdate
		between
			cast(convert(char, getdate(), 101) as datetime) + 1 and
			case
				when (select datename(dw, getdate())) = 'Friday' then cast(convert(char, getdate(), 101)as datetime) + 3
				else cast(convert(char, getdate(), 101) as datetime) + 1
			end
	and status != 'C'
group by email

This will return us just one record of MaintenanceDept@domain.com if there are any number of work orders due for the next business day.

On the next page in the TO: field select the database field email to include the needed email address. Set any other properties on this page and click Next. Set the days and hours that you want the report to run and you are done.

Now an email will go out only when there are work orders that are due tomorrow and if no work orders are do, no one gets an email.

In a later post, I will show a super cool user defined function that you can use to take into account holidays and other office closed events.

Comments

MythTV PVR-350 Goes Blank On Live TV

There are plenty of other productive things I could have done tonight around the house but instead I setup a new MythTV box. In the past I have install Fedora and then piece by piece installed and configured the MythTV suite so tonight I decided to try out MythDora 5 which is a distribution that gives you everything. The install went really good and then when I went to watch live TV and got nothing but a blank screen. Crap.

Watching the /var/log/mythtv/mythbackend.log I get the following log:

2008-11-19 23:16:32.817 TVRec(1): Changing from None to WatchingLiveTV
2008-11-19 23:16:32.821 TVRec(1): HW Tuner: 1->1
2008-11-19 23:16:33.972 NVR(/dev/video0): Unknown video codec. Please go into the TV Settings, Recording Profiles and setup the four ‘Software Encoders’ profiles. Assuming RTjpeg for now.
2008-11-19 23:16:33.976 NVR(/dev/video0) Error: Unknown audio codec
2008-11-19 23:16:33.993 AutoExpire: CalcParams(): Max required Free Space: 2.0 GB w/freq: 15 min
2008-11-19 23:16:33.991 NVR(/dev/video0): Won’t work with the streaming interface, falling back
VIDIOCGMBUF:: Invalid argument
2008-11-19 23:17:14.017 TVRec(1): Changing from WatchingLiveTV to None
2008-11-19 23:17:14.023 Finished recording Seinfeld “The Stakeout”: channel 1002
2008-11-19 23:18:54.847 Expiring 0 MBytes for 1002 @ Wed Nov 19 23:00:00 2008 => Seinfeld “The Stakeout”

Seems kind of odd since it is talking about a Software Encoder and I have a PVR-350 which is a hardware MPEG card. It appears the problem comes from being too trusting that the software would properly set itself up correctly. On the tuner page it said it auto probed the card and I went with it. Since the auto probe was wrong it set the card as a V4L card when I should have selected a hardware encoder card. As soon as I did that Live TV worked the way you would expect it to.

If you can’t trust a computer who can you trust?! ;-)

Comments (1)

Re-Push Office 2007

I had pushed out Office 2007 using a GPO start up script with a custom .msp file to tweak the install the way we wanted it. The problem is that when it was originally installed we had Exchange 2003 server and now we have moved to Exchange 2007 with completely different server names. Since we had put in the server names in the .msp file, Outlook will now only look for those no existent Exchange 2003 servers. It’s default function is to query AD and find the Exchange 2007 server that hosts that user’s mailbox. So to fix this problem I have to uninstall the current install of Office 2007 and re-push it so we have a consistent install from all old installs and all future fresh installs.

So here is what I have done. Created a new .bat file for a new Office 2007 install GPO. Below is the script for checking for version/uninstall/install of Office.

@ECHO OFF
setlocal

REM *********************************************************************
REM Environment customization begins here. Modify variables below.
REM *********************************************************************

REM Get ProductName from the Office product’s core Setup.xml file.
set ProductName=ProPlus

REM Set DeployServer to a network-accessible location containing the Office source files.
set DeployServer=\\domain.com\dfs\AdminInstall\Microsoft\off2007

REM Set AdminFile to the custom MSP file
set AdminFile=\\domain.com\dfs\AdminInstall\Microsoft\off2007\Updates

REM Set LogLocation to a central directory to collect log files.
set LogLocation=\\domain.com\dfs\AdminInstall\Microsoft\off2007\Office12Logs

REM *********************************************************************
REM Deployment code begins here. Do not modify anything below this line.
REM *********************************************************************

IF NOT “%ProgramFiles(x86)%”==”" SET WOW6432NODE=WOW6432NODE\

reg query HKEY_LOCAL_MACHINE\SOFTWARE\%WOW6432NODE%Microsoft\Windows\CurrentVersion\Uninstall\%ProductName%
if %errorlevel%==1 (goto DeployOffice) else (goto CheckReinstall)

REM If 1 returned, the product was not found. Run setup here.
:D eployOffice
echo %date% %time% > c:\Office2007.txt
echo Installation of Office 2007 has begun. >> c:\Office2007.txt
start /wait %DeployServer%\setup.exe /adminfile %AdminFile%

REM echo %date% %time% Setup ended with error code %errorlevel%. >> %LogLocation%\%computername%.txt

REM if office is installed check to see if it has already been uninstalled.
:CheckReinstall
if exist c:\Office2007.txt goto End

echo %date% %time% > c:\Office2007.txt
echo Uninstall of Office 2007 has begun!
start /wait %DeployServer%\setup.exe /uninstall ProPlus /config \\domain.com\dfs\AdminInstall\Microsoft\off2007\ProPlus.WW\SilentUninstall.xml
echo %date% %time% Uninstall ended with error code %errorlevel%. >> c:\Office2007.txt

REM If 0 or other was returned, the product was found or another error occurred. Do nothing.
:End

Endlocal

The way this script works is as follows:
Check to see if the registry has entries for Office, if nothing in the registry create a file c:\Office2007.txt and start the install. This takes care of all new and future installs of Office.

If there is a registry entry, check to see if the file c:\Office2007.txt exists. If not, this means it is an old broken install and it is then uninstalled. At the end of uninstall the machine automatically reboots.

When the machine starts again, there is nothing in the registry so the new installation starts.

All future reboots will see that both a registry entry and the c:\Office2007.txt exists and it will dump out of the script.

I setup a temp OU and moved a department at a time into the new OU. This is done so that the entire company is not reinstalling Office at the exact same time, causing a slow down and possibly raising a large number of support calls to the IS Department.

Comments

Outlook Printing

Microsoft has screwed up the printing in Outlook 2007. You cannot select to print just the current page or pages 2-4. No they gave the wonderfully useless options of printing either the even pages or the odd pages. Who that that was a good idea?

So the fix they have in is knowledge base article 924141. Their fix are as follows: copy your email and paste it into Word then print from there; or open your HTML emails in IE and print them from there; or print it as a PDF and then print the PDF.

idiots

How did these morons figure out how to become the largest software company in the world?!

Comments (1)

« Previous entries Next Page » Next Page »