Blog Archives

peimg.exe missing? here is how to fix it :)

Facts.

peimg is not being used anymore in the WAIK for windows 7. Instead you need to use the dism command. because the help is hidden pretty well, here is the Help you prob. are looking for 🙂

To get all the available options on the “offline” wim image provided by dism you need to run the following.


# Mount the image as usual (use the WAIK command line from the start menu

imagex /mountrw C:\path\to\image.wim {1/2}* C:\path\to\mount-dir\

*There can be multiple images in a wim image, for boot.wim these are 1 = Microsoft Windows PE, 2= Microsoft Windows Setup. The 1 or 2 in the given command selects the required image.

#To get all the dism options type the following;
dism /image:C:\path\to\mount-dir /?

Keep in mind that sub options have new help menus. For example, adding additional drivers has new help instructions that are accasible by calling;

dism /image:c:\path\to\mounted\image /add-driver /?

All the base options provided by dism

Image Version: 6.1.7600.16385

The following commands may be used to service the image:

UNATTEND SERVICING COMMANDS:
/Apply-Unattend - Applies an unattend file to an image.

DRIVER SERVICING COMMANDS:
/Remove-Driver - Removes driver packages from an offline image.
/Add-Driver - Adds driver packages to an offline image.
/Get-DriverInfo - Displays information about a specific driver
in an offline image or a running operating system.
/Get-Drivers - Displays information about all drivers in
an offline image or a running operating system.

WINDOWS PE COMMANDS:
/Apply-Profiles - Applies profiles to the Windows PE image.
/Disable-Profiling - Disables profiling.
/Enable-Profiling - Enables profiling.
/Get-PESettings - Displays Windows PE image information.
/Get-Profiling - Gets the enabled/disabled state of the Windows PE
profiler.
/Get-ScratchSpace - Gets the configured amount of Windows PE system
volume scratch space.
/Get-TargetPath - Gets the target path of the Windows PE image.
/Set-ScratchSpace - Sets the scratch space of the Windows PE image.
/Set-TargetPath - Sets the target path of the Windows PE image.

INTERNATIONAL SERVICING COMMANDS:
/Set-LayeredDriver - Sets keyboard layered driver.
/Set-UILang - Sets the default system UI language that is used
in the mounted offline image.
/Set-UILangFallback - Sets the fallback default language for the system
UI in the mounted offline image.
/Set-UserLocale - Sets the user locale in the mounted offline image.
/Set-SysLocale - Sets the language for non-Unicode programs (also
called system locale) and font settings in the
mounted offline image.
/Set-InputLocale - Sets the input locales and keyboard layouts to
use in the mounted offline image.
/Set-TimeZone - Sets the default time zone in the mounted offline
image.
/Set-AllIntl - Sets all international settings in the mounted
offline image.
/Set-SKUIntlDefaults - Sets all international settings to the default
values for the specified SKU language in the
mounted offline image.
/Gen-LangIni - Generates a new lang.ini file.
/Set-SetupUILang - Defines the default language that will be used
by setup.
/Get-Intl - Displays information about the international
settings and languages.

PACKAGE SERVICING COMMANDS:
/Add-Package - Adds packages to the image.
/Remove-Package - Removes packages from the image.
/Enable-Feature - Enables a specific feature in the image.
/Disable-Feature - Disables a specific feature in the image.
/Get-Packages - Displays information about all packages in
the image.
/Get-PackageInfo - Displays information about a specific package.
/Get-Features - Displays information about all features in
a package.
/Get-FeatureInfo - Displays information about a specific feature.
/Cleanup-Image - Performs cleanup and recovery operations on the
image.

For more information about these servicing commands and their arguments,
specify a command immediately before /?.

Examples:
DISM.exe /Image:C:\test\offline /Apply-Unattend /?
DISM.exe /Image:C:\test\offline /Get-Features /?
DISM.exe /Online /Get-Drivers /?
Advertisements

Adding Statical Routes.

SUSE

#Replace the eth0 in ifroute-# with the actual interface in your box.
vim /etc/sysconfig/network/ifroute-eth0

#Add the following rule with this structure
#[Dest IP Addr] [GW IP Addr] [Subnet Mask] [Device]
10.0.0.2 100.0.0.1 255.255.255.255 eth0

#Save the file

RHEL/ OEL

#Replace the eth0 in route-# whti the actual interface in your box.
vim /etc/sysconfig/network-scripts/route-eth0

#Add the route information like so;
ADDRESS0=10.0.0.2
NETMASK0=255.255.255.255
GATEWAY0=100.0.0.1

ADDRESS1=ip.ip.ip.ip
NETMASK1=msk.msk.msk.msk
GETWAY1=gw.gw.gw.gw

#Save the file

WINDOWS

route -p add 10.0.0.2 mask 255.255.255.255 100.0.0.1 metric 1

# Stored in
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes

OEL5.3

Adding perfmon counters using nrpe and centreon

In this little tutorial a detailed description on how to succesfully monitor and add various windows counters using the check_nrpe command and the NSClient++ agent for windows using the Centreon configuration and Monitoring GUI for Nagios. Yup, its all open source, and free for usage…
Read the rest of this entry

Centreon add audioble alert to tacktical overview.


make sure you backup de original files when you dont know or understand the scripts used below.

browse to your centreon install location web dir default;

~>cd /usr/local/centreon/www/

browse to the tacticalOverview dir.

~>cd /include/home/tackticalOverview

Open the file tacticalOverview.php

~>vi /tacticalOverview.php

Add the following code in the bottom of the file.

                        /*
                        * Audiable allert on Warning, Critical, Unknown states.
                        * Values are recalculated because we dont accept NULL as an answer
                        */
                        if(!isset($_SESSION['amis_alert'])){
                                $_SESSION['amis_alert'] = false;
                        }
                        foreach($SvcStat as $key => $val){
                                if(($key == 1) || ($key == 2) || ($key == 3)){
                                        $sum = $val - $svcAck[$key];
                                        if($sum >= 1){

                                                /*This section will open a pop-up that contains the audio alert */
                                                if(!$_SESSION['amis_alert']){
                                                        print('<script>window.open(\'./include/home/tacticalOverview/alert.ihtml\', \'alert\',\'width=180,height=20,scrollbars=no,toolbar=no,location=no\');</script>');
                                                        $_SESSION['amis_alert'] = true;
                                                        break;
                                                }
                                                break;
                                        }else{
                                                /* This section will close the popup when the alert is solved / acked */
                                                print('<script>window.open(\'./include/home/tacticalOverview/closeme.ihtml\', \'alert\',\'width=180,height=20,scrollbars=no,toolbar=no,location=no\');</script>');
                                                $_SESSION['amis_alert'] = false;
                                        }

                                }
                        }

If you want this tidy add additional template entries. I was to lazy for that 😉

Save the file and add the alert.ihtml

~>vim ./alert.ihtml

Add the following code

<html>
<head></head>
<body>
<div>
<object type="application/x-shockwave-flash" data="../../../mp3player.swf" height="20" width="180"><param name="FlashVars" value="mp3=../../../error.mp3&autoplay=1&loop=1&showslider=0"/></object></div>
</body>
</html>

Save the file and add the closeme.ihtml

~>vim closeme.ihtml

Add the following code

<html>
<head></head>
<body>
<script>window.close();</script>
</body>
</html>

Go back to the www dir

~>cd /usr/local/centreon/www

download the a nice error.mp3 (yeah you need to rename it 😉

wget http://www.freeinfosociety.com/media/sounds/142.mp3
~>cp ./142.mp3 ./error.mp3

Download the flash player (yeah i renamed this one too 🙂

~>wget http://flash-mp3-player.net/medias/player_mp3_maxi.swf
cp ./player_mp3_maxi.swf ./mp3player.swf

This should be all

Please do make a backup of the original files. Also when you find this script is not working for you, then please let me know, and why. Then maybe i can come up with an alternative solution. 

altering check_disk_smb nagios v3 to add performance data.

Open a linux console (putty?)
type the following command;
vim /usr/local/nagios/libexec/check_disk_smb

In the file scroll down to rule “187” it should be located right below ”

my ($mountpt) = "<a>\\\\$host\\$share</a>;"

Add the following bulk of text by using “Shift + I” to enter the insert mode.

Then you need to make sure the data is output on the prompt as soon as nagios executes this command. The returned string is created a bit lower in the file. Search for the following.

if ((($warn_type eq "P") &amp;&amp; (100 - $capper) &lt; $warn) || (($warn_type eq "K") &amp;&amp; ($avail_bytes &gt; $warn))) {
                $answer = "Disk ok - $avail ($capper%) free on $mountpt \n";
        } elsif ((($crit_type eq "P") &amp;&amp; (100 - $capper) &lt; $crit) || (($crit_type eq "K") &amp;&amp; ($avail_bytes &gt; $crit))) {
                $state = "WARNING";
                $answer = "WARNING: Only $avail ($capper%) free on $mountpt\n";
        } else {
                $state = "CRITICAL";
                $answer = "CRITICAL: Only $avail ($capper%) free on $mountpt\n";
        }

Replace it with something like this…

if ((($warn_type eq "P") &amp;&amp; (100 - $capper) &lt; $warn) || (($warn_type eq "K") &amp;&amp; ($avail_bytes &gt; $warn))) {
                $answer = "Disk ok - $avail ($capper%) free on $mountpt | total=$total; used=$used; free=$avail;\n";
        } elsif ((($crit_type eq "P") &amp;&amp; (100 - $capper) &lt; $crit) || (($crit_type eq "K") &amp;&amp; ($avail_bytes &gt; $crit))) {
                $state = "WARNING";
                $answer = "WARNING: Only $avail ($capper%) free on $mountpt | total=$total; used=$used; free=$avail;\n";
        } else {
                $state = "CRITICAL";
                $answer = "CRITICAL: Only $avail ($capper%) free on $mountpt | total=$total; used=$used; free=$avail;\n";
        }

effectivly we added this as performance output for nagios or any other iterp. like centreon…
| total=$total; used=$used; free=$avail;

Have fun!

 

my ($total) = ($1*$2)/1024;
 my ($used) = int($total-$avail);
        if (int($total / 1024) &gt; 0){
                $total = int($total / 1024);
                if (int($total /1024) &gt; 0){
                        $total = (int(($total / 1024)*100))/100;
                        $total = $total . "G";
                }else{
                        $total = $total . "M";
                }
        }else{
                $total = $total . "K";
        }
        if (int($used / 1024) &gt; 0){
                $used = int($used / 1024);
                if (int($used /1024) &gt; 0){
                        $used = (int(($used / 1024)*100))/100;
                        $used = $used . "G";
                }else{
                        $used = $used . "M";
                }
        }else{
                $used = $used . "K";
        }