Internet, UNIX, Video, Leisure…
Web
Adding pages inside Cacti
21/11/07
When you are talking of monitoring, you often end with many tools, like Nagios, Cacti or others. But none of them are interconnected.
There was a solution to add external pages inside Cacti, bythe aim of the Links plugin.
While migrating to Cacti 0.8.7a, I checked back the validity of this plugin with the new version. I ended with the new version : SuperLinks
This version adds many new things, like many tabs, authorization management and such.
As for now, the only problem I got is an error with the generation of the tab icon. I emailed the author about that.
On the same website, you will find the Weathermap plugins, which I still have to test with Cacti 0.8.7a.
[EDIT]
I got an answer from the author, and the bug is a known bug. It seems to be dependent of your config. You only have to add one line to the code. In the meantime, I also found a limitation in the URL size you can add, which wad 60. I set it to 512.
Here is the diff of the file :
diff -bur superlinks-old/superlinks-mgmt.php superlinks/superlinks-mgmt.php
--- superlinks-old/superlinks-mgmt.php Fri Nov 9 16:52:19 2007
+++ superlinks/superlinks-mgmt.php Wed Nov 21 16:25:01 2007
@@ -561,6 +561,7 @@
{
$orig_cwd = getcwd();
chdir(dirname(__FILE__));
+ putenv('GDFONTPATH=' . realpath('.')); $possibles = array(
array("DejaVuSans-Bold.ttf",10,false),
@@ -646,7 +647,7 @@
"style" => array("friendly_name" => "Style", "method" => "drop_array", "array" => array( "TAB" => "Top Tab", "CONSOLE"=>"Console Menu", "FRONT" => "Front Cacti Page"), "description" => "Where should this page appear?", "value"=>$data[0]['style'] ) ,
"title" => array("friendly_name" => "Tab/Menu Name", "method" => "textbox", "max_length"=>20, "description"=>"The text that will appear in the tab or menu. This should be all lower-case for tabs, to match Cacti tabs", "value"=>$data[0]['title']) ,
- "filename" => array("friendly_name" => "Content File/URL", "method" => "textbox", "max_length"=>60,"description"=>"The file that contains the content for this page. This can be a file in the content/ directory or a valid URL.", "value"=>$data[0]['contentfile'])
+ "filename" => array("friendly_name" => "Content File/URL", "method" => "textbox", "max_length"=>512,"description"=>"The file that contains the content for this page. This can be a file in the content/ directory or a valid URL.", "value"=>$data[0]['contentfile'])
);
html_start_box("Edit SuperLinks Page $id: ".$data[0]['title']."", "98%", $colors["header"], "3", "center", "");
New Cacti, New patches !
21/11/07
It wasn’t too long to upgrade cacti. Download files, patch with the plugins architecture, and there you go.
The good thing is that Cacti now knows how to bind to a LDAP directory with a user, search for your user, then authenticate. In fact, it seems they re-wrote the whole authentication system. You won’t have to apply my patch for that.
The bad thing is that the Threshold plugin patch is not yet working. But you know what ? I have an updated version working with the new cacti.
You will find it on the download page or here. Refer to the first post to know how to set it up.
The tools (network tools) plugins also have problems with the new snmp function of Cacti. I modified my patch, and I will send it to the author once again, and he may modify his stupid version with it. As a reminder, the patch, not only gives full compatibility with the new Cacti snmp code, but also add this crazy feature where you keep the informations you enter in each fields when you submit. Then you can submit a second time, or just change a parameter without having to re-enter every information. Did I said crazy ? Thanks the new Web 2.0 for this as everybody is doing
Get it here.
On ne vous dit pas tout…
21/11/07
L’histoire n’est pas reelement comme on veut bien vous la raconter a l’ecole ou dans les livres. Si vous cherchez le fond de la veritée perdue par les années qui passent, rendez vous ici.
HTML Encoding (fo dummies ?)
17/08/07
When trying to write HTML in text mode, you always wonder how to write a special charactere like <,> or #. You will find all the possible ASCII encoding on the w3schools.com website. Look at the menu on the right and you’ll find any possible encoding.
Using the special crypto chip of Sun’s T1 processor (on T1000 and T2000)
8/08/07
I know this is an old improvement now, but as I’m using it once more, I would like to remind people of this, and how to do this.
If you are using Apache, you can have a look a the Sun’s PDF doc.
When compiling apache, first, use the new optimized GCC 4 with CoolThreads support. You will find this by searching « coolthreads » or « cooltools » on Sun’s website.
Just get the 2 packages and install them. You can put then wherever you want, but the easiest way is to keep the 2 packages in the same directory.
Set your path so the bin directory is the first one in your path, so you use the new GCC :
PATH=/opt/tools/gcc-coolthreads/gcc/bin:/opt/csw/bin:/opt/csw/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/xpg4/bin:/usr/ccs/bin:/usr/ucb:/usr/openwin/bin:/usr/sfw/bin:/usr/sfw/sbin:/usr/local/bin:/usr/local/sbin
In this example, my GCC is installedin « /opt/tools/gcc-coolthreads«
Untar your Apache (2.2.4 for now) and cd into it. Configure and make it with this command line. This should build the MPM prefork module, which is the most efficient on T2000. If not sure, force it to compile.
CFLAGS='-DSSL_EXPERIMENTAL -DSSL_ENGINE -xO4' ./configure --enable-ssl --enable-rule=SSL_EXPERIMENTAL --with-ssl=/usr/sfw --prefix=/opt/monitor/apache-2.2.4 --enable-mods-shared=all --enable-so
make
make install
This will install Apache in « /opt/monitor/apache-2.2.4«
You then have to change the config files. Add the Include for httpd-ssl.conf at the end of httpd.conf file.
In the extra/httpd-ssl.conf file, search for « SSLCryptoDevice » lines and replace them with :
SSLCryptoDevice pkcs11
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect file:/dev/urandom 512
And there you go. Your apache is now 100 times faster when doing SSL. Just don’t forget to tune others parameters of the config files, like in « extra/httpd-mpm.conf » where you can tune the prefork module to :
ServerLimit 8192
MaxClients 2048
ListenBacklog 8192
ServerLimit 2048
MaxClients 2048
MinSpareServers 20
MaxSpareServers 20
MaxRequestsPerChild 0
StartServers 20
Scaling your web apps
8/08/07
Just came accross this many slide-show (provided by SlideShare) about web application scalability. Some are woth reading, but I’ll let you choose….
it’s all here : http://www.slideshare.net
Changing the Tools Cacti Plugins for better use
3/08/07
Network Tools for Cacti is a great tool. It allows you to query for an open port or a special SNMP OID. The default version lacks few things. I made a patch to allow changes in SNMP port or community. It applies to version 0.2.
Check it out here.
Patching Cacti Threshold plugin for Nagios notification
3/08/07
This is the first part of a post about setting up and patching the threshold plugin so it can trigger passive checks into Nagios.
The patch is in the download section here.
First of all, install Cacti. As for now the latest version is 0.8.6j.
Then install the Plugin Architecture for Cacti (some docs here). OK, the website is a crap and not really working either with Firefox or Safari… You can use the menu on the right to reach the downloads.
You just have to untar the file and copy recursively all files in it (according to the same version as Cacti) into Cacti, overwriting existing files.
You can then apply my Ldap patch.
You can also change the config file and define you database name and user. Don’t forget to set the « URL path to cacti » which is introduced by the plugins arch. See config file later in the post.
Then download the Thold (Threshold) plugin and untar it in your « cacti/plugins » directory. Don’t use the version 0.3.5.1 which is online as it apply to a future revision of Cacti and Plugin Architecture. You have to download the version 0.3.4 here.
Then apply the patch.
You can also add more plugins, like Tools Settings , Host Info or Links. If you do so, don’t forget to enable it for each users in the user management page of Cacti.
Then, enable plugins in the config file. Edit file in cacti/include/config.php :
/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "user";
$database_password = "pass";
$database_port = "3306";
$plugins = array();
$plugins[] = 'thold';
$plugins[] = 'update';
$plugins[] = 'hostinfo';
$plugins[] = 'settings';
$plugins[] = 'tools';
$plugins[] = 'dataquery';
$plugins[] = 'links';
$plugins[] = 'weathermap';
/* Do not edit this line */
$config = array();
/*
This is full URL Path to the Cacti installation
For example, if your cacti was accessible by http://server/cacti/ you would user '/cacti/'
as the url path. For just http://server/ use '/'
*/
$config['url_path'] = '/cacti/';
Of course, you already have a working version of Nagios
Once applied, the Nagios patch will give you 2 more things :
- a new config option in the Settings -> Alerting/Thold to enable Nagios or not. Just enable it or not and add the script (shell, perl, python) which will be executed.

For example, my script is like :
# cat /opt/monitor/scripts/cacti-to-nagios.sh
#!/bin/sh
# this script copy the data in argument to the Nagios external command file
NAGIOS_FILE="/opt/monitor/nagios/var/rw/nagios.cmd"
echo $1 >> ${NAGIOS_FILE}
exit 0
- a new parameter for each threshold you define

Here you have to give the name of the Host defined in Nagios, and the name of the Service (with Passive check enabled) in Nagios.
For example, here is the part of my Nagios config :
define service{
use generic-service ; Name of service template to use
host_name antlia
service_description ANTLIA_INODES
is_volatile 0
check_period 24x7
max_check_attempts 1
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
active_checks_enabled 0
check_command check_dummy
}
Be carefull of access rights, execution rights and most of all, PHP Safe_Mode or exec_dir.
And there you go !
Maybe next release will allow to change the output line, so it is not bound to Nagios and can be run against any monitoring/alerting software.
Maybe I will also add something so Cacti can send SMS directly : we are using opensource smsd with a SMS modem on a serial port. For now it is Nagios wich is using it. The only gain is that Nagios can do some sort of escalation and schedule, so we only get the SMS during the non working hours. We’ll see
Having a real LDAP Login in Cacti
2/08/07
Cacti is one of the best opensource project. Its goal is to collect and aggregate data using SNMP or scripts and give you a graphical result : a graph !
Although Cacti support LDAP users natively, it lacks an important feature : authenticated search.
Many people thinks LDAP is good for authentication. You connect to it, search for the DN of your user and bind against it. Even if it is a good solution, this means anyone on your lan, or any application on your server, can connect and search for any user on your whole tree.
This is not a good solution for me. I work with LDAP for 7 years now, and I will never allow to search anonymously inside my ldap server, even for auth. (This is wrong as I now have a search function for addressbook…)
Whatever, I wanted to have Cacti do it the right way :
- login with a special account
- search for the DN of the user
- bind the DN againt the password
- allow or disallow access
I slightly changed the Cacti 0.8.6j source to achieve that.
You only have to change 2 files. One for the login, one for the setup. You just have to add the DN of the admin user and its password. You can also set up a role (ldap roles are included in Sun’s Directory Server) and your user will only be granted access if he is a member of the role.
You will end with a Setup -> Authentication page like this :

You can download the patch Here. It apply to a Cacti 0.8.6j PATCHED with the Cacti Plugin Architecture v1.1.
Creer ses boutons de site web en 3 clics
4/06/07
C’est possible, et c’est ici : http://www.mycoolbutton.com/
Et voila le resultat :
Et pendant que j’y suis, calculez votre propre prix argus ici. Pour l’info, je vos 6 051 150 euros !
