Posts Tagged ‘nagios’
As my work takes me to various places (where technology is concerned), I collect lots of browser tab of things I want to keep for later reference.
I have to admit, sadly, that I lack the time to sort them out, to make a real good and nice post about them. I do not want to lose them, however, so I am posting now those which I find or found in the past as more useful to me. I might expand either of them one day into a full post, or elaborate further on them. Either or none. For now – let’s clean up some tab space:
Reading IPMI sensors. Into Cacti, and into Nagios, with some minor modifications by myself (to be disclosed later, I believe):
This is somewhat info of the plugin check_ipmi_sensor
And its wiki (in German. Use Google for translation)
Checking XenServer using NRPE
But I did not care about Dom0 performance parameters, as they meant very little regarding the hypervisor’s behavior. So I have combined into it the following XenServer License Check. Unfortunately, I could run it only on the XenServer domain0, due to python version limitations on my Cacti /Nagios server.
You can obtain XenServer SDK
This plugin looks interesting for various XenServer checks, but I have never tried it myself.
Backing up (exporting) XenServer VMs as a scheduled task. I have had it modified extensively to match my requirements, but I am allowed to, it has some of its sources based on my blog
Installing Dell OpenManage on XenServer 5.6.1, and the nice thing is that it works fine on XenServer 6 as well.
Oracle ASM recovery tips . One day I will take it further, and investigate possible human errors and methods of fixing them. Experience, they say, has a value
A guide dealing with changing from raw to block devices in Oracle ASM . This is only a small part of it, but it’s the thing that interests me.
Understanding Steal Time in Linux Xen-based VMs.
Because I always forget, and I’m too lazy to search again and again (and reach the same page again and again): Upgrading PHP to 5.2 on Centos 5
And last – a very nice remote-control software fomr my Android phone. Don’t leave home without it. Seriously.
Reduced to only 23 tabs is excellent. This was a very nice job, and these links will be useful. To me, for sure. I hope that to you as well.
Centreon is a nice GUI wrapper for Nagios. It is using MySQL as its configuration engine, and it functions quite well. One thing Cacti can do but Centreon can’t is mass automatic addition of servers. I have had a new site with an installed Centreon, and I wanted to add about 40 servers to be monitored. This is a tedious work, and I was searching for some semi-automatic method of doing it.
This is not perfect, but it worked for me.
In this case I do not replicate service-group relationship, but only add a mass of servers.
First – create a text file containing a list of servers and IPs. It should look like this:
I have placed in in /tmp/machines
Second – find the last host entry. In my case the DB name is Centreon, so I run the following command:
mysql -u root -p centreon -e’select host_id from host’
This should return a colum with numbers. Find the largest one and increment it by one. In my example the last one was 19, so my initial host_id will be 20.
You should now find the host_template_model_html_id you are to use. There are few methods for that, but the easiest way is to find another host information which matches to some level your desired information. In my case it was called “DB1”, so this looks like this:
mysql -u root -p centreon -e”select host_template_model_htm_id from host where host_name=’DB1′”
Please note that my blog formatting might change the quote character. You might not want to copy/paste it, but type it yourselves.
The result of the above query should give us a template ID. In my case it was “2”, which is fine by me.
If you want a better reference for the values entered, you can do a whole select for a single host to verify your values match mine:
mysql -u root -p centreon -e”select * from host where host_name=’DB1’G”
This should give you long listing and information of the host, as a reference.
My script goes like this, based on the assumptions made above:
#!/bin/bash HOST=20 for i in `cat /tmp/machines` do NAME=`echo $i | cut -f1 -d:` IP=`echo $2 | cut -f2 -d:` echo "insert into host values ('$HOST',2,NULL,NULL,1,NULL,NULL,NULL,NULL,'$NAME','$NAME','$IP',NULL,NULL,'2','2','2','2','2',NULL,'2',NULL,NULL,'2','2','2','2',NULL,NULL,'2',NULL,NULL,'0',NULL,'1','1');" >> /tmp/insert_sql.sql echo "insert into extended_host_information values('',$HOST,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);" >> /tmp/insert_sql.sql let HOST++ done
This should create a file called /tmp/insert_sql.sql which then should be first reviewed, and then inserted into your database.
Needless to say – back up your database first, just in case:
mysqldump -u root -p –opt -B centreon > /tmp/centreon_backup.sql
and then insert the newly created data:
mysql -u root -p centreon < /tmp/insert_sql.sql
Notice – at this point, no service relationship is created. I think it is quite a chore only to create the nodes. Adding the service relationships complicates things a bit, and I did not want to go there at this specific stage. However, for few tenths of monitored hosts, this is quite a lifesaver.
Notice that this is only Centreon configuration, and you will be required to apply it (through the GUI) to Nagios.