Selasa, 26 Juli 2016

Cacti Plugin in ubuntu server 14.04

A big strength of Cacti is its possibility to use other tools into plugins in its web interface. The plugins will be useful if you want to group some network related softwares into one interface.
On the cactiusers.org website, you can find and download all the available plugins. We chose here the tutorials about three very useful plugins: NTOP, syslog-ng and PHP Weathermap.

The first thing to do is to install a mandatory plugin, which is required before installing the other one, it is called the "architecture" plugin.

- For Cacti 0.8.6i & j, it can be downloaded (1.1) on the cactiusers.org website.
- For Cacti 0.8.6h, it can be downloaded (1.0) on our website.

If you install cacti with apt (packaged install), you can know your cacti version with the "apt-cache policy cacti" command.

Uncompress the file you just downloaded.

#tar -xvf /home/user/Desktop/cacti-plugin-arch.tar.gz
Move the files inside the architecture plugin directory you just downloaded into the directory containing the cacti website.

#cp /home/user/Desktop/cacti-plugin-arch/* /usr/share/cacti/site/ -R
#cd /usr/share/cacti/site/
Then run the command below:
Just be CAREFUL to run the patch matching your cacti version.

For cacti-0.8.6h:

#patch -p1 -N < cacti-plugin-0.8.6h.diff
For cacti-0.8.6i:

#patch -p1 -N < cacti-plugin-0.8.6i.diff
For cacti-0.8.6j:

#patch -p1 -N < cacti-plugin-0.8.6j.diff

THE CACTI PLUGINS:

1. NTOP (v 0.1) 2. PHP WEATHERMAP (v 0.82) 3. SYSLOG-NG (v 0.4)

1. NTop PLUGIN

NTop is a tool that will provide statistics about network usage.


#apt-get install ntop
download the plugin and uncompress it in the ntop directory.

#tar -xvf /home/user/Desktop/ntop-0.1.tar.gz
Copy the ntop directory in the /usr/share/cacti/site/plugins/ directory

#cp /home/user/Desktop/ntop /usr/share/cacti/site/plugins/ -R
We have to edit the /usr/share/cacti/site/include/config.php file and add just after the line beginning with "$plugins = array();":

$plugins[] = ‘ntop’;
Run ntop

ntop -u user -w 3000
Under the cacti web interface, don't forget to enable the NTOP plugin:

Login in to your cacti interface -> click on the console tab -> click on "User Management" in the "Utilities" section -> click on an user -> enable the "View NTop" checkbox.


2. PHP WEATHERMAP PLUGIN

For more information about PHP Weathermap, read the the PHP Weathermap tutorial.

Download the plugin and uncompress it in the weathermap directory. Enter the following command from where you downloaded Weathermap:

#tar -xvf /home/user/Desktop/php-weathermap-0.82.zip
Copy the weathermap directory in the /usr/share/cacti/site/plugins/ directory

#cp /home/user/Desktop/weathermap/ /usr/share/cacti/site/plugins -R
We have to edit the /usr/share/cacti/site/include/config.php file and add just after the line beginning with "$plugins = array();":

$plugins[] = ‘weathermap’;
Under the cacti web interface, don't forget to enable the weathermap plugin:

Login in to your cacti interface -> click on the console tab -> click on "User Management" in the "Utilities" section -> click on an user -> enable the "View Weathermaps" checkbox.

See the weathermap tutorial for help to configure the tool.



3. SYSLOG-NG PLUGIN (0.4)

An impressive plugin that permit to read the syslog-ng messages.


You can trigger alerts or remove logs from the interface.


For more information about syslog-ng, read the the php-syslog-ng tutorial.

download the plugin and uncompress it in the haloe directory. Enter the following command from where you downloaded haloe:

#tar -xvf /home/user/Desktop/haloe-0.4.tar.gz
Copy the haloe directory in the /usr/share/cacti/site/plugins/ directory

#cp /home/user/Desktop/haloe /usr/share/cacti/site/plugins/ -R
We have to edit the /usr/share/cacti/site/include/config.php file and add just after the line beginning with "$plugins = array();":

$plugins[] = ‘haloe’;
If you don't already have it, you have to install syslog-ng et forward the logs collect by it towards the MySQL database.

Install syslog-ng:

#apt-get install syslog-ng
Syslog-ng will uninstall the default syslog server.
We have to configure the /etc/syslog-ng/syslog-ng.conf file

Syslog changes

To receive logs from a remote machine trough the network, uncomment (ie remove the #) the line containing udp();

# use the following line if you want to receive remote UDP logging messages
# (this is equivalent to the "-r" syslogd flag)
udp();
Forward the logs to the MySQL database.

Add the lines below always in the /etc/syslog-ng/syslog-ng.conf file:

log {
source(s_all);
destination(d_mysql);
};

# pipe messages to /var/log/mysql.pipe to be processed by mysql
destination d_mysql {
pipe("/var/log/mysql.pipe"
template("INSERT INTO syslog_incoming
(facility, priority, date, time, host, message, seq, status)
VALUES ( '$FACILITY', '$PRIORITY', '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$HOST', '$MSG', '$SEQ', '$STATUS' );\n") template-escape(yes));

};
Database settings.

We need to create the MySQL database and then import the tables with the sql file.

#mysqladmin -u root -p create haloe
#mysql -u root -p haloe < /home/user/Desktop/haloe/syslog.sql
We give all the rights to a new MySQL user called haloeuser on the haloe database:

#mysql -u root -p haloe
>GRANT ALL ON haloe.* TO haloeuser@localhost IDENTIFIED BY 'haloepassword';
>flush privileges;
Configure the MySQL connection settings in the /usr/share/cacti/site/plugins/haloe/config.php file:

$haloedb_type = "mysql";
$haloedb_default = "haloe";
$haloedb_hostname = "localhost";
$haloedb_username = "haloeuser";
$haloedb_password = "haloepassword";
In the same file, to see colored lines in your syslog plugin, you need to change the lines beginning with "$haloe_colors" by the lines below:

$haloe_colors["emerg"] = "FF0000";
$haloe_colors["crit"] = "FF0000";
$haloe_colors["alert"] = "FF0000";
$haloe_colors["err"] = "FFAB00";
$haloe_colors["warning"] = "FFFF00";
$haloe_colors["notice"] = "FFAB00";
// $haloe_colors["info"] = "FFAB00";
// $haloe_colors["debug"] = "D0D0D0";
The MySQL pipe file.

Now, we have to create the temporary MySQL insertion file (pipe file):

#mkfifo /var/log/mysql.pipe
We have to push the logs inside the database with a bash script:

Create a new file and insert the line below, save the file as syslog2mysql.sh in the /usr/share/cacti/site/plugings/haloe directory.
Don't forget to change the MySQL username and password.

#!/bin/bash

if [ ! -e /var/log/mysql.pipe ]
then
mkfifo /var/log/mysql.pipe
fi
while [ -e /var/log/mysql.pipe ]
do mysql -u haloeuser --password=haloepassword haloe < /var/log/mysql.pipe >/dev/null
done
The script means that if the mysql.pipe file does not exist, create it.
Then, while the mysql.pipe exists, open a MySQL connection, and send the "buffered" data the database.

Run the syslog2mysql script to see if everything is okay. Errors will be displayed in case of problems.

#/usr/share/cacti/site/plugins/haloe/syslog2mysql.sh
Stop the script with "Ctrl+C".

Final step:

To run the syslog2mysql.sh script without the root user, we need to change a file ownership:

#chown user /etc/cacti/debian.php
It's important that the www-data user, in other words the apache web server user, has the read permission on this file. Normally, it's already the case:

#ls -l | grep debian.php
-rw-r----- 1 user www-data 557 2006-11-18 14:00 debian.php
Run the syslog2mysql.sh script under the user of your choice:

#su user
user@linux#/usr/share/cacti/site/plugins/haloe/syslog2mysql.sh
Finally, we need to configure two cron jobs.

crontab -e -u user
# when the computer boots, it starts automatically the syslog2mysql.sh script.
@reboot /usr/share/cacti/site/plugins/haloe/syslog2mysql.sh
# A command required to transfer the data stored
# into the syslog_incoming table to the syslog table. (every 1 minute)
# For an unknown reason this is not done automatically by the syslog plugin.
*/1 * * * * php5 -q /usr/share/cacti/site/plugins/haloe/syslog_process.php
The crontab command will update the /var/spool/cron/crontabs/user file.

Under the cacti web interface, don't forget to enable the syslog-ng plugin:

Login in to your cacti interface -> click on the console tab -> click on "User Management" in the "Utilities" section -> click on an user -> enable the "View Syslog" checkbox.

Minggu, 24 Juli 2016

Install flex on ubuntu

Before starting, please check to see if there is a latest version available to download. Visit http://flex.sourceforge.net/ to find out about the available versions. IMPORTANT: See "Configuring Ubuntu Linux After Installation" to install the development tools required to compile and install flex from source code.

Steps to download, compile, and install are as follows. Note: Replace 2.5.33 with your version number:
  • Downloading Flex (The fast lexical analyzer):

    Run the command below,
    wget http://prdownloads.sourceforge.net/flex/flex-2.5.33.tar.gz?download
  • Extracting files from the downloaded package:

    tar -xvzf flex-2.5.33.tar.gz
    Now, enter the directory where the package is extracted.
    cd flex-2.5.33
  • Configuring flex before installation:

    If you haven't installed m4 yet then please do so. Run the commands below to include m4 in your PATH variable.
    PATH=$PATH:/usr/local/m4/bin/
    NOTE: Replace '/usr/local/m4/bin' with the location of m4 binary. Now, configure the source code before installation.
    ./configure --prefix=/usr/local/flex
    Replace "/usr/local/flex" above with the directory path where you want to copy the files and folders. Note: check for any error message.
  • Compiling flex:

    make
    Note: check for any error message.
  • Installing flex:

      
  • As root (for privileges on destination directory), run the following.
    With sudo,
    sudo make install
    Without sudo,
    make install
    Note: check for any error messages.
That’s it. Flex has been successfully installed.

Selasa, 24 Mei 2016

Membuat Wordpress Posting

Dalam tutorial ini kita akan mengajarkan Anda hal yang sangat dasar yang perlu Anda lakukan dengan WordPress - membuat posting. Untuk memulai, login ke panel admin situs Anda dan pergi ke Posts -> Add New .


Pada halaman ini Anda akan melihat posting WordPress Editor. Bagian yang paling penting dari halaman ini adalah:

  • - Judul Posting - masukkan judul posting Anda di bidang ini. Pada tema Anda akan ditampilkan di atas konten Anda.
  • - Konten pasca - Anda dapat menggunakan editor WordPress WYSIWYG untuk menambahkan konten yang sebenarnya dari posting Anda. Perhatikan bahwa ia memiliki dua tab ------
  • - Visual(menggunakan editor untuk memformat teks Anda) dan Teks (tambahkan kode HTML Anda langsung).

Setelah Anda memasukkan isi dari posting WordPress pertama Anda, Anda perlu Publikasikan itu.Penerbitan membawa posting Anda ke situs web Anda yang sebenarnya.


Itu dia! Anda sekarang dapat pergi ke halaman depan situs Anda untuk memeriksa posting blog yang baru dibuat.


Jumat, 13 Mei 2016

Install command line on ubuntu 14.04 lts


========================================================================
# install openjdk
sudo apt-get install openjdk-7-jdk

# download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz

tar -xvf android-sdk_r24.2-linux.tgz
cd android-sdk-linux/tools

# install all sdk packages
./android update sdk --no-ui

# set path
vi ~/.zshrc << EOT

export PATH=${PATH}:$HOME/sdk/android-sdk-linux/platform-tools:$HOME/sdk/android-sdk-linux/tools:$HOME/sdk/android-sdk-linux/build-tools/22.0.1/

EOT

source ~/.zshrc

# adb
sudo apt-get install libc6:i386 libstdc++6:i386
# aapt
sudo apt-get install zlib1g:i386


===================================================================================

Kamis, 12 Mei 2016



Memisahkan 2 koneksi internet dan membagi permasing-masing koneksi yang masuk berdasarkan gateway dan IP.
        
PBR sebetulnya salah satu konsep load balance tapi dengan PBR kita dapat mendefinisikan client harus lewat gateway/wan yang mana dengan kebutuhan kita. misal pada gambar di atas ada 2 client tapi 2 client itu ingin akses yang berbeda dengan wannya masing - masing. baik download maupun upload. ini berguna bagi corporate semisal memiliki banyak WAN tapi client harus pake bandwith yang 3Mbps tapi ada server priv harus pake bandwith 10Mbps . lalu penerapan pada warnet yang ingin memisahkan traffic game untuk WAN 1 sedangkan aktifitas lainnya menggunakan WAN 2. sederhana saja ane akan berbagi disini yang pasti itu konsep nya BETUL!!! eheheheh pertama - tama kita definisikan client dengan penamaan grup supaya mempermudah

buat src-address untuk masing - masing client dulu ya
 /ip firewall address-list add list=grup-wan1 address=192.168.1.10  
 /ip firewall address-list add list=grup-wan2 address=192.168.1.20  

lalu kita definisikan connection dan output untuk traffic download dan upload sesuai dengan wan masing2 . (mksdnya apabila wan1 melakukan download maka untuk upload harus wan1 juga)

 /ip firewall mangle add chain=prerouting connection-mark=no-mark in-interface=eth1 action=mark-connection new-connection-mark=con-wan-1  
 /ip firewall mangle add chain=output connection-mark=con-wan-1 action=mark-routing new-routing-mark=via-wan-1  
 /ip firewall mangle add chain=prerouting connection-mark=no-mark in-interface=eth1 action=mark-connection new-connection-mark=con-wan-2 
 /ip firewall mangle add chain=output connection-mark=con-wan-2 action=mark-routing new-routing-mark=via-wan-2  

sesudah itu kita marking routingnya agar jalur menuju internet bisa dikenali oleh masing2 wan agar tidak bentrok dengan menambahkan grup client yang mana harus melewati wan yang ditentukan.
 /ip firewall mangle add chain=prerouting src-address-list=grup-wan1 action=mark-routing new-routing-mark=via-wan-1 passthrough=yes comment="mark routing via wan 1"  
 /ip firewall mangle add chain=prerouting src-address-list=grup-wan2 action=mark-routing new-routing-mark=via-wan-2 passthrough=yes comment="mark routing via wan 2"  

sesudah mendapatkan routing marknya kita tambahkan ke table routing route. dan buat table routing masing2 untuk masing wan ..

 /ip route add dst-address=0.0.0.0/0 gateway=10.10.10.1 routing-mark=via-wan-1  
 check-gateway=ping  
 /ip route add dst-address=0.0.0.0/0 gateway=11.11.11.1 routing-mark=via-wan-2 check-gateway=ping 
/ip route add dst-address=0.0.0.0/0 gateway=10.10.10.1 check-gateway=ping  
/ip route add dst-address=0.0.0.0/0 gateway=11.11.11.1 check-gateway=ping   

selesai ... silahkan lakukan test untuk masing - masing client dan lakukan traceroute . pasti akan melewati gateway yang berbeda .. :)
Tambahakan nih dirules PALING ATAS , agar client bisa melakukan ping ke gateway router atau client.

 /ip firewall mangle add chain=prerouting src-address=192.168.1.0/24 dst-address=192.168.1.0/24 action=accept  
 /ip firewall mangle add chain=prerouting src-address=192.168.1.0/24 dst-address=10.10.10.1 action=accept  
 /ip firewall mangle add chain=prerouting src-address=192.168.1.0/24 dst-address=11.11.11.1 action=accept  




Sabtu, 29 Agustus 2015

The Zimbra Collaboration Server is a mail server, collaborative web application and a web based mail server admin console in a single application. It provides LDAP, antivirus, antispam, collaboration features and a ajax webmail client. Zimbra is easy to use for administrators as well as end users due to its fast Ajax based web interface.

> Prerequisites

    Ubuntu Server 14.04 - 64bit
    root privileges
    Free space 25 GB
    RAM 4 GB

My zimbra Server profile used in this tutorial:

Domain : networking-router.local
IP     : 192.168.1.101
Mail   : mail.networking-router.local

What we will do in this tutorial:


  -  Install the prerequisite packages
  -  Configure hostname and DNS Server
  -  Download and Install Zimbra
  -  Test the installation

> Installation of prerequisites

Step 1 - connect to your server, get root privileges and install this package.

# apt-get install libgmp10 libperl5.18 unzip pax sysstat sqlite3 dnsmasq wget

> Configure hostname and DNS Server

In this tutorial will use the 'dnsmasq' resolving nameserver to speedup DNS lookups in Zimbra. Dnsmask has been installed as prerequisite in the first chapter, so we just have to configure it now:

Step 1 - Edit hostname and hosts

vim /etc/hostname

change your hostname with this 'mail.networking-router.local'.



vim /etc/hosts

add this line:
 
192.168.1.101   mail.networking-router.local  mail

Step 2 - Edit dnsmasq configuration

vim /etc/dnsmasq.conf
server=192.168.1.101
domain=networking-router.local
mx-host=networking-router.local, mail.networking-router.local, 5
mx-host=mail.networking-router.local, mail.networking-router.local, 5
listen-address=127.0.0.1

Step 3 - Reboot


sudo reboot

Installing Zimbra

Step 1 - Download Zimbra and extract it

wget https://files.zimbra.com/downloads/8.6.0_GA/zcs-8.6.0_GA_1153.UBUNTU14_64.20141215151116.tgz
tar -xvf zcs-8.6.0_GA_1153.UBUNTU14_64.20141215151116.tgz
cd zcs*

Step 2 - Run the Installer

./install.sh

At this step, zimbra will check the required packages and will ask you to agree to their installation.



Agreement Zimbra

and then choose the zimbra package :
Choose Zimbra Installation

here doesn`t need zimbra-dnscache, because in this tutorial use dnsmasq.
You need to wait, because this installation takes some time.
next step is configure "zimbra-store" for getting admin password. See the picture:

Configure Admin Pasword

Choose number "4" and enter. and then type your password:
Changing Password

Apply all Configuration:
Apply all configuration

and wait for Zimbra configuration finished.

Testing Zimbra

To test your zimbra server is running, you can type a command :

su - zimbra
zmcontrol status
try to access zimbra from web browser.  https://192.168.1.101/

Access Zimbra

or try admin page " https://192.168.1.101:7071/ ".

Jumat, 28 Agustus 2015

animated-wallpaper-galaxy

There’s a simple tool to replace your boring default wallpaper with a completely animated OpenGL wallpaper. It’s Android style live wallpaper on Ubuntu Desktop.

It only contains a few wallpapers so far. While it’s under developing, it continues adding new wallpapers.
animated-wallpaper-setting

To install this tool on Ubuntu:
There’s a ppa repository that contains stable packages for Ubuntu 13.04 Raring, 12.10 Quantal, 12.04 Precise and Linux Mint 15, 14, 13.

To add the ppa, press Ctrl+Alt+T, copy and paste below command into terminal and hit run:

sudo add-apt-repository ppa:fyrmir/livewallpaper-stable

Then update via command:
 
sudo apt-get update

Finally install the tool:
 
sudo apt-get install livewallpaper livewallpaper-config livewallpaper-indicator
 
Once installed, open Livewallpaper Config from Unity Dash.

^_^