Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Friday, May 30, 2014

How to Setup Nagios 3.4.4 Network Monitoring On Ubuntu Server 12.04/12.10

This guide will shown you how to installing latest version of nagios 3.4.4 on Ubuntu Server 12.04/12.10. Nagios is free and open source tool with GPL License allowing to control and monitor the items and services on a network. When it detects a problem it sends alert messages, either by mail or by other techniques.
Step 1. Before installing Nagios 3.4.4 on Ubuntu Server 12.04/12.10, make sure your Ubuntu Server is up to date. Enter the following commands one by one, and install any available updates:
sudo apt-get update
sudo apt-get upgrade -y
Step 2.  Install Apache 2, PHP5, GCC ( development libraries and compilation), GD ( development libraries) on other package
sudo apt-get install build-essential apache2 php5-gd wget libgd2-xpm libgd2-xpm-dev libapache2-mod-php5 libssl-dev
Step 3. Create users and groups for Nagios:
sudo mkdir -p /etc/nagios /var/nagios
sudo groupadd --system --gid 9000 nagios
sudo groupadd --system --gid 9001 nagcmd
sudo adduser --system --gid 9000 --home /usr/local/nagios nagios
sudo usermod --groups nagcmd nagios
sudo usermod --append --groups nagcmd www-data
sudo chown nagios:nagios /usr/local/nagios /etc/nagios /var/nagios
Step 4. Download the source code of both compressed Nagios and the Nagios plugins (visit http://www.nagios.org/download/ for links to the latest versions). At time of writing, the latest versions of Nagios 3.4.4 and the Nagios plugins 1.4.16
cd /usr/local/src/
wget http://sourceforge.net/projects/nagios/files/nagios-3.x/nagios-3.4.4/nagios-3.4.4.tar.gz
wget http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.16/nagios-plugins-1.4.16.tar.gz
Step 5. Extract, Compile and Install source of nagios 3.4.4
sudo tar -xzvf /usr/local/src/nagios-3.4.4.tar.gz
cd /usr/local/src/nagios
sudo ./configure --sysconfdir=/etc/nagios --localstatedir=/var/nagios --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-command-group=nagcmd --with-openssl=/usr/bin/openssl --enable-perl-modules --with-mail=/usr/bin/sendemail
sudo make all
sudo make install
sudo make install-init
sudo make install-config
sudo make install-commandmode
Step 6. Edit file /etc/objects/contacts.cfg to change the email address that is associated with nagiosadmin contact with the email address where you want to be alerted.
sudo nano /etc/objects/contacts.cfg
Example:
define contact{
               contact_name   nagiosadmin ;
               use            generic-contact ;
               alias          Ubuntu Precise ;
               email          admin@ubuntuprecise.net ;
}
Step 7. Edit file /etc/nagios/objects/commands.cfg to change both sendemail references to match the correct sendemail syntax:
sudo nano /etc/nagios/objects/commands.cfg
define command{
 command_name notify-host-by-email
 command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/sendemail -s srv-mail:25 -f "admin <admin@ubuntuprecise.net>" -t $CONTACTEMAIL$ -u "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **"
}
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/sendemail -s srv-mail:25 -f "admin <admin@ubuntuprecise.net>" -t $CONTACTEMAIL$ -u "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **"
}
Step 7. Now we need to configure Nagios to access it via web interface.
  • Install the web configuration file in the Apache conf.d directory:
cd /usr/local/src/nagios
sudo make install-webconf
  • Create password for Account nagiosadmin to enter the Nagios web interface. Remember the password you assign to this account – you will need it later. then restart apache2 daemon
sudo htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
sudo /etc/init.d/apache2 reload
  • Edit file /etc/apache2/apache2.conf and add the following line:
sudo nano /etc/apache2/apache2.conf
DirectoryIndex index.html index.php index.cgi
Step 8. Check your Nagios 3.4.4 configuration file for errors by typing following command. Look for errors in red
sudo /usr/local/nagios/bin/nagios -v /etc/nagios/nagios.cfg
Step 9. Extract, Compile and install Nagios Plugins 1.4.16
cd /usr/local/src
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz
sudo tar -zxvf /usr/local/src/nagios-plugins-1.4.16.tar.gz
cd /usr/local/src/nagios-plugins-1.4.16
sudo ./configure --sysconfdir=/etc/nagios --localstatedir=/var/nagios --with-nagios-user=nagios --with-nagios-group=nagios
sudo make
sudo make install
Step 10. Set Nagios is started whenever the system boots up, then restart nagios daemon
sudo /usr/sbin/update-rc.d -f nagios defaults 99
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
sudo /etc/init.d/nagios restart
If all goes well, we should now be able to enter a Web browser to access Nagios administrator panel. Open a web browser and enter:
http://domain/nagios/
We ask for the username (nagiosadmin) with the password you have chosen in step 7.  If all went well you should see the home page of Nagios Administrator Panel
Link Reference:

Monday, February 24, 2014

A USB Scope For Linux Users

Pico Technology has reportedly restored the numbers of Linux users, by offering a software that will run under their preferred OS. The USB oscilloscopes are famous but its demand supply is majority wise restricted to Windows platforms.

PicoScope, Windows, Debian 7.0,  PicoScope 6, USB, oscilloscope, Pico Technology, Linux ,  wheezy, Ubuntu
The PicoScope 6 will now convert a Linux PC into an oscilloscope, FFT spectrum analyser and measuring device. The On-device buffering, which uses deep memory on some devices, enables the display to be updated frequently and smoothly, even for long time-bases.

It is to be noted that the most important features from PicoScope, for Windows, are include in PicoScope 6, like the scope, spectrum and persistence modes, interactive zoom, simple, delayed and advanced triggers, automatic measurements, and signal generator control.

The oscilloscope software is available for the Debian 7.0, which is code named as wheezy, Ubuntu 12.xx / 13.xx, as well as other Debian-based distributions with mono-runtime version 2.10.81. or higher. The drivers are available for the current scopes from the PicoScope 2000 to 6000 series.

The PicoScope software involves an USB oscilloscope from the PicoScope range. These oscilloscopes are available with the bandwidths of up to 1 GHz, up to 4 input channels, with hardware vertical resolutions up to 16 bits, sampling rates up to 5 GS/s, buffer sizes up to 2 GS, and built-in signal generators.

Some more features that are available on some models are flexible hardware resolution, switchable bandwidth limiters, switchable high-impedance and 50 ohm inputs, and differential inputs. The company has asserted that more functions will be added soon. For now, the users can save the captures for off-line analysis, share them with the other PicoScope for Windows and also with PicoScope for Linux users. They can export them in text, CSV and Mathworks MATLAB 4 formats.

Monday, June 25, 2012

Change or Reset Windows Password from a Ubuntu Live CD

If you can’t log in even after trying your twelve passwords, or you’ve inherited a computer complete with password-protected profiles, worry not – you don’t have to do a fresh install of Windows. We’ll show you how to change or reset your Windows password from a Ubuntu Live CD.
This method works for all of the NT-based version of Windows – anything from Windows 2000 and later, basically. And yes, that includes Windows 7.
Note: If you have files on your hard disk encrypted using built-in Windows encryption, they may not be available after changing the Windows password using this method. Exercise caution if you have important encrypted files.
You’ll need a Ubuntu 9.10 Live CD, or a bootable Ubuntu 9.10 Flash Drive. If you don’t have one, or have forgotten how to boot from the flash drive, check out our article on creating a bootable Ubuntu 9.10 flash drive.
The program that lets us manipulate Windows passwords is calledchntpw. The steps to install it are different in 32-bit and 64-bit versions of Ubuntu.

Installation: 32-bit
Open up Synaptic Package Manager by clicking on System at the top of the screen, expanding the Administration section, and clicking on Synaptic Package Manager.



chntpw is found in the universe repository. Repositories are a way for Ubuntu to group software together so that users are able to choose if they want to use only completely open source software maintained by Ubuntu developers, or branch out and use software with different licenses and maintainers.
To enable software from the universe repository, click on Settings > Repositories in the Synaptic window.

Add a checkmark beside the box labeled “Community-maintained Open Source software (universe)” and then click close.


 When you change the repositories you are selecting software from, you have to reload the list of available software. In the main Synaptic window, click on the Reload button.


The software lists will be downloaded.


Once downloaded, Synaptic must rebuild its search index. The label over the text field by the Search button will read “Rebuilding search index.” When it reads “Quick search,” type chntpw in the text field. The package will show up in the list.



Click on the checkbox near the chntpw name. Click on Mark for Installation.


chntpw won’t actually be installed until you apply the changes you’ve made, so click on the Apply button in the Synaptic window now.

You will be prompted to accept the changes. Click Apply.

The changes should be applied quickly. When they’re done, click Close.

chntpw is now installed! You can close Synaptic Package Manager. Skip to the section titled Using chntpw to reset your password.


Installation: 64-bit
The version of chntpw available in Ubuntu’s universe repository will not work properly on a 64-bit machine. Fortunately, a patched version exists in Debian’s Unstable branch, so let’s download it from there and install it manually.
Open Firefox. Whether it’s your preferred browser or not, it’s very readily accessible in the Ubuntu Live CD environment, so it will be the easiest to use. There’s a shortcut to Firefox in the top panel.

Navigate tohttp://packages.debian.org/sid/amd64/chntpw/download and download the latest version of chntpw for 64-bit machines.
Note: In most cases it would be best to add the Debian Unstable branch to a package manager, but since the Live CD environment will revert to its original state once you reboot, it’ll be faster to just download the .deb file.

 Save the .deb file to the default location.


You can close Firefox if desired. Open a terminal window by clicking on Applications at the top-left of the screen, expanding the Accessories folder, and clicking on Terminal.







In the terminal window, enter the following text, hitting enter after each line:












cd Downloads sudo dpkg –i chntpw*



chntpw will now be installed.
Using chntpw to reset your password
Before running chntpw, you will have to mount the hard drive that contains your Windows installation. In most cases, Ubuntu 9.10 makes this simple.
Click on Places at the top-left of the screen. If your Windows driveis easily identifiable – usually by its size – then left click on it.



























If it is not obvious, then click on Computer and check out each hard drive until you find the correct one.

The correct hard drive will have the WINDOWS folder in it. When you find it, make a note of the drive’s label that appears in the menu bar of the file browser.

If you don’t already have one open, start a terminal window by going to Applications > Accessories > Terminal.

In the terminal window, enter the commands
cd /media
ls
pressing enter after each line. You should see one or more strings of text appear; one of those strings should correspond with the string that appeared in the title bar of the file browser earlier.
Change to that directory by entering the command
cd
Since the hard drive label will be very annoying to type in, you can use a shortcut by typing in the first few letters or numbers of the drive label (capitalization matters) and pressing the Tab key. It will automatically complete the rest of the string (if those first few letters or numbers are unique).

We want to switch to a certain Windows directory. Enter the command:




cd WINDOWS/system32/config/
Again, you can use tab-completion to speed up entering this command.

To change or reset the administrator password, enter:


sudo chntpw SAM
SAM is the file that contains your Windows registry. You will see some text appear, including a list of all of the users on your system.


 At the bottom of the terminal window, you should see a prompt that begins with “User Edit Menu:” and offers four choices. We recommend that you clear the password to blank (you can always set a new password in Windows once you log in). To do this, enter “1” and then “y” to confirm.

If you would like to change the password instead, enter “2”, then your desired password, and finally “y” to confirm. 

If you would like to reset or change the password of a user other than the administrator, enter:











sudo chntpw –u SAM


From here, you can follow the same steps as before: enter “1” to reset the password to blank, or “2” to change it to a value you provide.


And that’s it!

Conclusion
chntpw is a very useful utility provided for free by the open source community. It may make you think twice about how secure the Windows login system is, but knowing how to use chntpw can save your tail if your memory fails you two or eight times!

How To Create A Bootable USB Ubuntu Drive



Now there are loads of tools to use for this purpose. I have already covered the Unetbootin tool in my article “Install Linux on a USB drive with Unetbootin.” This time around we are going to do the same trick with a tool that comes pre-installed on any modern Ubuntu distribution. It’s all graphical interface and all easy going.

What you will need

* A USB drive with at least 700 MB in size.
* Either an ISO image or the Ubuntu Live CD

And a little bit of time. If you don’t have either the ISO image or the CD you can just download a fresh copy from the Ubuntu site.

Once you have everything you need, you are ready to go.

Starting The Tool


You will find the USB creator in the Administration sub-menu of the System menu on the GNOME desktop. The entry you are looking for is called “USB Startup Disk Creator”. Click that to open up the main window (see Figure 1).

As you can see (in Figure 1) there is neither an image or a CD listed. You either have to insert your Ubuntu CD or, if you’re using a downloaded image, click the Other button and navigate to where you’ve saed your image file.

When you insert your CD it will be automatically detected by the system and listed in the USB Startup Disk window. When this happens everything that is greyed out in Figure 1 will be at your service.

You will notice the only option available is for saving documents
and settings. If your USB drive has enough extra space you can designate a portion of that drive for this purpose. With this feature you can effectively have a portable version of Linux that is far more than just a “startup disk”.

Creating The Disk 

When you have selected your image to use and configured your free space you are ready to go. Click the Make Startup Disk button and the main windo will be dismissed. During the creation process you will see a progress window (see Figure 2) that will let you know how much is done and what is happening. The phases of this creation are:

    * Copying Files
    * Creating persistence file
    * Making persistence file system

Once all three phases are complete you will get a dialog window telling you installation is complete and you can now reboot your machine with the USB drive. Of course when you boot a machine with this device it has to be able to boot from a USB device. Most modern machine can do that so it shouldn’t be an issue.

Final Thoughts

As far as tools of this nature, the Ubuntu USB disk creator tool is one of the easiest and most reliable. It’s not the most flexible; but for what it does, you can’t beat it. If you’re looking to have a portable Ubuntu distribution you can carry with you, make use of this user-friendly tool. 

Friday, June 22, 2012

How To Take Screenshots On Ubuntu



Screenshots are not only useful for tech bloggers to showcase cool apps, they’re also an integral component of most of the web-based tutorials. Following the ‘show don’t tell’ technique that many writers swear by, tech bloggers lean on the demonstrative power of screenshots to review the latest applications. Tutorial writers too use these screenshots, and sometimes, they edit them so as to point out particular details about theapplication. Whatever be the case, taking screenshots takes time, and in many cases, it also demands a certain amount of effort from the user as you need to capture aspects of the app in action.

For Ubuntu users who are looking to take some nice snaps of their desktops, either for a blog post or for some #showyourdesktop thread, there aren't quite a lot of dedicatedapplications. However, the ones that are available suffice almost every need of the fledgling desktop snapper. So, if you want to learn how to take screenshots on Ubuntu, you've come to the right place. Read on as we guide you through it.


Screenshots using the default screenshot application
If you don’t want anything complicated to take your screenshots, the default screenshot application almost serves the need. To get started, just open the launcher (Super or Windows key ) and type in screenshot. The application then allows you to either grab a shot of the whole desktop or the current window. If you’re looking to capture a specific part of the desktop, then select the option that says ‘Select Area To Grab’. If you want, you can also add a 3-4 second delay to the screenshot so that you’d get some time to get the application in the state you want.

Other options let you choose whether to include the pointer and/or the window border. If you want, you can also choose to include a drop shadow or a border. Finally, to take screenshots on the run, you don’t have to open the application every time. Simply press the Print Scr button and you’ll get a screenshot of the whole desktop. If, however, you wanted to grab a snap of the current window, simply use the combo Alt + Print Scr and the screenshot of that window will be saved to your disk.


Shutter
If the default application isn't enough for your screen-snapping needs, then Shutter is something you’d love. The screenshot tool lets you take screenshots of the whole desktop, of particular sections, of windows, and much more. Furthermore, you can grab multiple screenshots and save them all at once making it much more convenient as compared to the default application. The real beauty of the application, however, lies in its ability to edit and annotate images. You can add bubbles and arrows, encircle stuff, and do much more using the editor. Moreover, you can censor specific parts of the application that contain sensitive information. Though really easy to use, most of the new users would prefer settling on the default application, as it is something that comes and works out of the box.

To install Shutter on Ubuntu, type in or paste the following commands in your terminal (Ctrl + Alt + T):

sudo add-apt-repository ppa:shutter/ppa
sudo apt-get update
sudo apt-get install shutter