Thursday, 19 June 2014

How to install cactus!

Yeah! My first post about some tutorial! Are you pumped? I AM!

Right, right as you know, cactus is a desert plan. So I guess it's quite easy to take care of it. The problem is how to install them into the pot. Many of you know that their leafs are the needles, and needles can hurt your finger, also there's a chance you'll fall into a deep sleep and won't wake up until some asshole rape you. But you know what? SCREW IT! GRAB THE CACTUS BY HAND AND RAM IT INTO THE POT! that's the only way to install it, like a b0ss.

Look at that, ain't it beautiful?

After you've done the procedure on the first paragraph, you can act proud and show the cactus to your friend! Don't be shy! Show it like it was your own private stick! Make them choke with it! Yeah! 



So, now that you have learned how to install a cactus, now you're ready to install Cacti. Now you might be wondering whether Cacti is cactus's long lost brother or he's a complete stranger who someday will rape you roughly. Well, hold that thought, keep it to yourself, we'll discuss it more after this.

Cacti is actually a software - open source one - that monitor network, well not just network, you can also monitor your memory usage, user usage, load usage, and other things which I haven't tried yet. But don't worry, I'll come around and probably write a tutorial about how to use Cacti... also cactus, probably. So basically, Cacti is a front-end of rrdtool, a tool  - which according to my friend wiki - is an industry-standard data logging tool. Whoa whoa, what is that weird words? Worry not friend, I'll explain it to you. As you can see, industry is industry, it's self explanatory. While standard means a level or stuff that you compare to other stuff so you can say smart things like " it's not up to the standard!" or things like that. 

Now what is data logging? Well as the words says, it is used to log data which input is inserted automatically or manually. However this input is continuous and time based, so it's a chore if inputted manually. This rrdtool then sample the data and then present it to the user in the form of graph, also showing you the min/max/avg of the input. 



And like they said, a picture is worth a thousand words. Now why do we need to use Cacti? Not just rrdtool? Like it was said before, Cacti is the front-end of rrdtool. As far as I know, rrdtool can only produce graph like picture above with no interface with user what so ever (except creating graph with the command line). So we use Cacti to add interface to the rrdtool, what does that mean then? Basically we are using rrdtool to gather the data, transform it into a graph, then present it to us. But, with Cacti you can add some plugin like weathermap - which we will try after this (read : after I done trying it and have the time to write the tutorials) - to show the network map of how the packet we send transferred. And also you can create a multiple graph and simultaneously show the data. And also the neat thing is each data can be presented in different time stamp, like data each minutes, each 5 minutes, each 15 minutes, each days, each months, and so on. 

So to sum it up, Cacti makes using rrdtool more convenient. You don't need to input lots of command line to show a graph of something within different time range. Well, there's also other advantage but let's just focus on installing Cacti (read : too lazy, want to play).

Now then, to install cacti on ubuntu 12.04, just blindly follow this tutorial : 

apt-get install snmpd snmp mysql-server apache2 libapache2-mod-php5 php5-mysql php5-cli php5-snmp

apt-get install libpangol1.0-dev libxml2-dev

apt-get install rrdtool

Download and extract the tarball of cacti. Hm? Where to download it? GOOGLE IT

After that, move it to /var/www. You could move just the files and move it to a new folder called cacti on /var/www or just plain straight move the extracted folder there OR move the extracted folder to new folder called cacti there. After that get inside me... I-I mean get inside the extracted folder (E.F.). Time to create a database in mysql and then import the database in the E.F. to that database.

mysql -u root -p
>create database cacti;
>exit

mysql -u root -p cacti < cacti.sql;

After that, we create an user in mysql so cacti can use it.

mysql -u root -p
>create user [insert username] identified by '[insert password]';
>grant all cacti.* to [username]@localhost identified by '[password]';
>flush privileges;
>exit

Now edit the php.config inside the folder, change the username and password of the database with the one you just registered. Then we create an user with this folder as the home and no login.

useradd [username] -d /var/www/[cacti path] -s /bin/false

Now write this command :

chown -R [username] /var/www/[cacti path]

Finally, add a cron job for every users.

crontab -e

Write this on the bottom line :

*/5 * * * * php /var/www/[cacti path]/poller.php > /dev/null 2>&1

And lastly, open your browser, and go to localhost/cacti. Congrats! If nothing goes wrong, it will show up an install page. Just follow it and then cacti has been installed in your computer!


Easy right? Now have fun monitoring your network, memory usage, temperatures, or anything! 


Oh and about that thought, you guys are lewd. 






reference : wiki-chan, various tutorial on the net (I do insert one or two of my own way, which one? Figure it ;) )





2 comments:

  1. pake bahasa indonesia bisa kali yas ..

    ReplyDelete
    Replies
    1. hush child, read the very first post of this blog

      Delete

I want to start flame war on the comment section pl0x