Posts By :

Roderick Derks

Extending the Net-SNMP agent 150 150 Roderick Derks

Extending the Net-SNMP agent

Extending the Net-SNMP agent

A great functionnality of Net-SNMP is that you can “extend” it.

Let’s run the /tmp/foo.sh script :

Code:
$ /tmp/foo.sh -arg1
123

Now put this in snmpd.conf :

Code:
exec foo /bin/sh /tmp/foo.sh -arg1

The result of your script will be accessible under the ucdavis.extTable.extEntry tree :

  • output of the script : ucdavis.extTable.extEntry.extOutput
  • exit status : ucdavis.extTable.extEntry.extResult
  • command : ucdavis.extTable.extEntry.extCommand

You can check the result with this SNMP query :

Code:
$ snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.8.1
UCD-SNMP-MIB::extIndex.1 = INTEGER: 1
UCD-SNMP-MIB::extNames.1 = STRING: foo
UCD-SNMP-MIB::extCommand.1 = STRING: /bin/sh /tmp/foo.sh -arg1
UCD-SNMP-MIB::extResult.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.1 = STRING: 123
UCD-SNMP-MIB::extErrFix.1 = INTEGER: 0
UCD-SNMP-MIB::extErrFixCmd.1 = STRING:

extOutput translates to .1.3.6.1.4.1.2021.8.1.101
As “foo” is our first exec directive, add “.1” at the end of the OID.

In Cacti, use the “SNMP – Generic OID Template” like this :
footh8

Voila ! Result of the /tmp/foo.sh script is now graphed in Cacti.

Now let’s run this second script, which returns more than one result :

Code:
$ /tmp/bar.sh
456
789

It returns two values, one per line (this is important).

Another way to call scripts from snmpd.conf is by specifying an OID, like this :

Code:
exec .1.3.6.1.4.1.2021.555 /bin/sh /tmp/bar.sh

Run this query :

Code:
$ snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.555
UCD-SNMP-MIB::ucdavis.555.1.1 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.555.2.1 = STRING: "/bin/sh"
UCD-SNMP-MIB::ucdavis.555.3.1 = STRING: "/tmp/bar.sh"
UCD-SNMP-MIB::ucdavis.555.100.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.555.101.1 = STRING: "456"
UCD-SNMP-MIB::ucdavis.555.101.2 = STRING: "789"
UCD-SNMP-MIB::ucdavis.555.102.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.555.103.1 = ""

First line returned by the script will be available at .1.3.6.1.4.1.2021.555.2, and so on.

You can then use the “SNMP – Generic OID Template” in Cacti (one Data Source per OID).

Let’s say you want to count the number of entries in a log file.
Add this to snmpd.conf :

Code:
logmatch cactistats /home/cactiuser/cacti/log/cacti.log 120 SYSTEM STATS
  • the global count of matches will be available under the .1.3.6.1.4.1.2021.16.2.1.5.1 OID
  • the “Regex match counter” (which is reset with each file rotation) will be available under the .1.3.6.1.4.1.2021.16.2.1.7.1 OID

To list all the available variables, use this query :

Code:
$ snmpwalk -v 1 -c public localhost logMatch
UCD-SNMP-MIB::logMatchMaxEntries.0 = INTEGER: 50
UCD-SNMP-MIB::logMatchIndex.1 = INTEGER: 1
UCD-SNMP-MIB::logMatchName.1 = STRING: cactistats
UCD-SNMP-MIB::logMatchFilename.1 = STRING: /home/cactiuser/cacti/log/cacti.log
UCD-SNMP-MIB::logMatchRegEx.1 = STRING: SYSTEM STATS
UCD-SNMP-MIB::logMatchGlobalCounter.1 = Counter32: 301634
UCD-SNMP-MIB::logMatchGlobalCount.1 = INTEGER: 301634
UCD-SNMP-MIB::logMatchCurrentCounter.1 = Counter32: 6692
UCD-SNMP-MIB::logMatchCurrentCount.1 = INTEGER: 6692
UCD-SNMP-MIB::logMatchCounter.1 = Counter32: 1
UCD-SNMP-MIB::logMatchCount.1 = INTEGER: 0
UCD-SNMP-MIB::logMatchCycle.1 = INTEGER: 120
UCD-SNMP-MIB::logMatchErrorFlag.1 = INTEGER: 0
UCD-SNMP-MIB::logMatchRegExCompilation.1 = STRING: Success

We’ll then use another interesting directive, the “proxy” one.
Let’s take for example the Squid proxy : when enabled, its SNMP agent listen to UDP 3401 port.
If you want to have system graphs and Squid graphs without declaring 2 devices in Cacti, add this in snmpd.conf :

Code:
proxy -v 1 -c public localhost:3401 .1.3.6.1.4.1.3495.1

The Squid SNMP tree will be available under the .1.3.6.1.4.1.3495.1 branch.

Let’s query this host :

Code:
$ snmpwalk -v 1 -c public 10.151.33.3 sysdescr
SNMPv2-MIB::sysDescr.0 = STRING: Linux srv1.foo.com 2.6.8.1-12mdk #1 Fri Oct 1 12:53:41 CEST 2004 i686

And here’s the Squid part (this specific OID returns the Squid version) :

Code:
$ snmpwalk -v 1 -c public 10.151.33.3 .1.3.6.1.4.1.3495.1.2.3.0
SNMPv2-SMI::enterprises.3495.1.2.3.0 = STRING: "2.5.STABLE6"

You’ll find how to enable the Squid SNMP agent here.

Create a windows service from an executable 150 150 Roderick Derks

Create a windows service from an executable

Prequisits
w2003 resourcekit tools installed

Install the service
C:\>sc.exe create T3NawUp dateService binPath= “C:\Program Files\Infotrom\Trodis3\MT\Binaries\T3NawUpdateService.exe – /L2” obj= “elisabeth\sa_trodis” password= “paszzworrd”
[SC] CreateService SUCCESS

Logon as a service right on the server when yourun the service on a specific windows account
Start > Run – Enter the gpedit.msc command and run.
Select the Computer configuration setting from the appearing window then go through the following path:
Windows settings > Security settings > Local Policies > User Right Assignment
Select the Log on as a service item from the right side list then double click on it (or right click > select Properties from the
local menu). Add the desired user account by clicking on the |Add user or group…| button.

Nokia 6021 Beach Rally 2 topscores 150 150 Roderick Derks

Nokia 6021 Beach Rally 2 topscores

Belangrijke levensvraagstukken: Beach Rally topscore op de Nokia 6021.. kan het beter dan dit? Ik denk het wel maar ben het niet tegengekomen op internet. Die magische 4 minuten grens heb ik nog steeds niet kunnen doorbreken.

Beach Rally II: 4:00.47 -> 4:00.46 -> de magische 4 minuten grens doorbroken 3:59.93 -> 3:59.71 -> 3:59.67 -> inmiddels 3:59.04

My Beach Rally II topscores
Connecting to SMB share on W2K or W2K3 using a CNAME 150 150 Roderick Derks

Connecting to SMB share on W2K or W2K3 using a CNAME

Apply the following registry change to the file server to which you installed the hotfix. To do so:

a. Start Registry Editor (Regedt32.exe).
b. Locate and click the following key in the registry:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters
c. On the Edit menu, click Add Value, and then add the following registry value:

Value name: DisableStrictNameChecking
Data type: REG_DWORD
Radix: Decimal
Value: 1
d. Quit Registry Editor

http://support.microsoft.com/kb/281308

Disk performance and Backup to NUL: command 150 150 Roderick Derks

Disk performance and Backup to NUL: command

Introduction

 

Disk drive performance and databases are directly tied to each other with backups. A full backup, by definition, will start at the beginning of a database and read all the way through to the end. In the process, it can generate a large amount of disk IO. If you have a slow disk subsystem, it can show up here.

 

As you will see in the following examples, slow backups can be an indication of overall system health and poor database architecture.

 

The following table illustrates the different IO patterns that SQL Server uses when going after data. It is possible that you can get good performance in an OLTP environment because it’s doing many small 8K IOs, and then have poor performance when running backups because it’s doing 1M IOs.

 

OLTP Log

Sequential

Write

512 bytes – 64KB

OLTP Data

Random

R/W

8K

Bulk Insert

Sequential

Write

8K multiples to 128K

Read Ahead

Sequential

Read

8K multiples to 256K

Backup

Sequential

R/W

1MB

Restore

Sequential

R/W

64K

CHECKDB

Sequential

Read

8K – 64K

 

Table: SQL Server Disk IO Access Patterns

Source: http://blogs.msdn.com/sqlcat/

 

One of the best reasons to use the backup command is its uniformity and simplicity. Every SQL Server has it which enables comparison between different platforms, and at the end of the backup, it summarizes for you the actual throughput so you don’t have to even calculate anything.

BACKUP to a Null Device

The main purpose of a backup is an offline copy of the database for possible recovery purposes. Typically backups dump to disk or tape. In some cases, it’s beneficial to make a backup, but not store the results anywhere. For example, if you want to run through an operational process for practice… or in our case, stress the disk subsystem.

 

When a backup is run, it reads from the database, and then writes to the backup media. Hence it will read then pause then read then pause when accessing the database itself. The pause to the database occurs as it’s writing to the backup media. This does not help with stress testing by putting a constant load on the system.

 

The only way to put a full load using the BACKUP command is running it with the NUL: device syntax.

Syntax:

backup database <db_name> to disk = ‘NUL:’ with stats = <perc compl>

Example of Usage:

backup database siebelprd to disk = ‘NUL:’ with stats = 1

Sample Output:

Processed 1416 pages for database ‘newmsdb’, file ‘MSDBData’ on file 1.

100 percent backed up.

Processed 1 pages for database ‘newmsdb’, file ‘MSDBLog’ on file 1.

BACKUP DATABASE successfully processed 1417 pages in 0.071 seconds (163.392MB/sec).

 

Backing up to the NUL: device will cause a full time read to the database without pausing to write to the backup media. 

Another issue when testing databases is caching. If the same test is run often, the results will always be in RAM hence distorting the results. By running a backup, it usually exceeds the amount of cache on the server thus helps eliminate this distortion.

 

Judging the Results: Bad, Good, Best
Once the command is run, the DBA needs to know what the results mean. The following examples were taken from customers I have worked with over the last 2 years and help illustrate what the throughput numbers mean.

 

Laptop Disk Drive With 36MB Database

99 percent backed up.

100 percent backed up.

BACKUP DATABASE successfully processed 4473 pages in 1.172 seconds (31.259 MB/sec).

 

Desktop internal disk drive 3.4GB database:

100 percent backed up.

BACKUP DATABASE successfully processed 425841 pages in 135.945 seconds (25.660 MB/sec).

Bad
Customer’s 1.6TB database with 12 CPU and High End SAN RAID 1:

100 percent backed up. 

BACKUP DATABASE successfully processed 202986177 pages in 47070.773 seconds (35.326 MB/sec).

This is almost the same IO as my laptop (31.259 MB/Sec)?!

 

Concern
Customer’s 87GB database with 8 CPU 32G and High End RAID 5:

ファイル 1 で、データベース ‘siebeldb’ 、ファイル ‘siebeldb_prm1’ 2670712 ページが処理されました。

ファイル 1 で、データベース ‘siebeldb’ 、ファイル ‘siebeldb_prm2’ 2665816 ページが処理されました。

ファイル 1 で、データベース ‘siebeldb’ 、ファイル ‘siebeldb_prm3’ 2662176 ページが処理されました。

ファイル 1 で、データベース ‘siebeldb’ 、ファイル ‘siebeldb_prm4’ 2662064 ページが処理されました。

ファイル 1 で、データベース ‘siebeldb’ 、ファイル ‘siebeldb_log1’ 47 ページが処理されました。

 BACKUP DATABASE 10660815 ページを 789.876 秒で正常に処理しました (110.565 MB/ )

Good

Customer 575GB SAN:
100 percent backed up.
BACKUP DATABASE successfully processed 70246627 pages in 3540.611 seconds (162.531 MB/sec).

Microsoft Dev Database 101G with RAID10 on 146Gb 10K drive on SAN:

 

100 percent processed.

BACKUP DATABASE successfully processed 12376579 pages in 707.413 seconds (143.323 MB/sec).

 

Microsoft DSS database 28GB  database High End SAN 72G 15K:

100 percent backed up.
BACKUP DATABASE successfully processed 3468866 pages in 151.831 seconds (187.161 MB/sec).

 

Microsoft OLTP Database 2TB with 72Gb 15K drives Raid10 on SAN:

100 percent backed up.

BACKUP DATABASE successfully processed 244138625 pages in 5561.102 seconds (359.638 MB/sec).

 

Great
Processed 25342792 pages for database ‘TUC’, file ‘data1’ on file 1.

Processed 25215088 pages for database ‘TUC’, file ‘data3’ on file 1.

Processed 25215168 pages for database ‘TUC’, file ‘data5’ on file 1.

Processed 25214320 pages for database ‘TUC’, file ‘data2’ on file 1.

Processed 25214344 pages for database ‘TUC’, file ‘data4’ on file 1.

Processed 25215168 pages for database ‘TUC’, file ‘data6’ on file 1.

Processed 25213704 pages for database ‘TUC’, file ‘data7’ on file 1.

Processed 25214552 pages for database ‘TUC’, file ‘data8’ on file 1.

Processed 25215200 pages for database ‘TUC’, file ‘data9’ on file 1.

Processed 25214280 pages for database ‘TUC’, file ‘data10’ on file 1.

Processed 25214920 pages for database ‘TUC’, file ‘data11’ on file 1.

Processed 25321384 pages for database ‘TUC’, file ‘data12’ on file 1.

Processed 3 pages for database ‘TUC’, file ‘log1’ on file 1.

BACKUP DATABASE successfully processed 302810923 pages in 6010.430 seconds (412.720 MB/sec).

DB Size= 2,365,619Mb

Backup time to Null:  1 hr. 40 min.

 

What to Do?
If you see that you are having slow throughput times (low MB/sec), the fixes are usually to add more spindles to the database and spread the load out more and/or increase bandwidth to the disk by adding faster/more controllers.

 

Warning!
This command runs great accept under the following conditions:

  1. If you run a differential backup, don’t run this command! The reason is that the differential backup picks up pages that have changed. Running the backup command resets the flag on the page. Since the backup to a NUL: device reads the page, but does not back it up to media, the flag is reset as if it HAD been backed up… so the database does NOT back it up during the next differential. If you have run a backup to NUL: and do differential backups, run a FULL backup immediately and everything will be fine.
  2. If you have heavy disk IO now, a backup to a NUL: device will only add more stress slowing things down more.
  3. For reason #2, run this command in off hours.

Summary

Backup to a NUL: device is a handy command. It allows you to compare disk performance throughput of a laptop to a high end database server with a SAN. It’s a poor man’s stress test and doesn’t take much to setup or run… or interpret the results.  It will not fix any of the problems, but hopefully show whether the database as a whole can sustain massive IO within its architecture.

 

Thanks to Frank McBath

Disk Queue Length vs. Disk Latency Times: Which is Best for Measuring Database Performance 150 150 Roderick Derks

Disk Queue Length vs. Disk Latency Times: Which is Best for Measuring Database Performance

Introduction

 

There are several common metrics that people use to look for performance bottlenecks. They are usually:

 

Disk queue length

Disk latency/transfer times

MB/sec

IO/sec

 

For the rest of this note, I’ll focus on the top two.

read more

Nagios Install on Fedora 7 150 150 Roderick Derks

Nagios Install on Fedora 7

yum -y update

vi /etc/inittab
shutdown -r 0

yum -y install gcc perl-Config-IniFiles net-snmp net-snmp-perl net-snmp-utils perl-Net-SNMP net-snmp-libs gd gd-devel libpng libpng-devel libjpg libjpg-devel

cd /tmp/
wget http://downloads.sourceforge.net/nagiosplug/nagios-plugins-1.4.9.tar.gz?modtime=1180952247&big_mirror=0
wget http://downloads.sourceforge.net/nagiosplug/nagios-plugins-1.4.9.tar.gz?modtime=1180952247&big_mirror=0
tar xvzf nagios-2.9.tar.gz
rm nagios-2.9.tar*
cd nagios-2.9
adduser nagios
mkdir /usr/local/nagios
chown nagios:nagios /usr/local/nagios
grep “^User” /etc/httpd/conf/httpd.conf
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -G nagcmd apache
/usr/sbin/usermod -G nagcmd nagios

../configure –prefix=/usr/local/nagios –with-command-group=nagcmd
make all
make install
make install-init
chkconfig –add nagios
service nagios status
cd /usr/local/nagios/
chown -R nagios:nagios etc/
ln -s /usr/local/nagios/etc/apache/nagios.conf /etc/httpd/conf.d/nagios.conf
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

rsync -avu root@cacti.elisabeth.nl:/usr/local/nagios/etc /usr/local/nagios/
rsync -avu root@cacti.elisabeth.nl:/usr/local/nagios/libexec /usr/local/nagios/
mv share share.bak
rsync -avu root@cacti.elisabeth.nl:/usr/local/nagios/share /usr/local/nagios/
system-config-securitylevel-tui
service httpd start

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

tar xvzf nagiosgraph-0.9.0.tgz
cd nagiosgraph-0.9.0
mkdir /usr/local/nagios/nagiosgraph
cp nagiosgraph.conf /usr/local/nagios/nagiosgraph/
cp map /usr/local/nagios/nagiosgraph/
cp insert.pl /usr/local/nagios/nagiosgraph/
cp show.cgi /usr/local/nagios/nagiosgraph/
vi /usr/local/nagios/nagiosgraph/nagiosgraph.conf

ls -ald /var/log
touch /usr/local/nagios/var/nagiosgraph.log
chown nagios:nagios /usr/local/nagios/var/nagiosgraph.log
vi /usr/local/nagios/nagiosgraph/nagiosgraph.conf
mkdir /usr/local/nagios/nagiosgraph/rrd
chown nagios:nagios /usr/local/nagios/nagiosgraph/rrd
chown -R nagios:nagios /usr/local/nagios/nagiosgraph
vi /usr/local/nagios/nagiosgraph/nagiosgraph.conf
updatedb
locate perfdata.log
touch /usr/local/nagios/var/perfdata.log
vi /usr/local/nagios/nagiosgraph/nagiosgraph.conf

cd /usr/local/nagios/nagiosgraph/
vi insert.pl
vi show.cgi

chown nagios:nagios /usr/local/nagios/var/perfdata.log
chmod 664 /usr/local/nagios/var/nagiosgraph.log
chmod 664 /usr/local/nagios/var/perfdata.log
chmod 775 /usr/local/nagios/nagiosgraph/rrd/

chown nagios:nagios ../../var/nagiosgraph.log
chmod 666 ../../var/nagiosgraph.log
perl-Config-IniFiles

yum -y install perl-Config-IniFiles

[root@cacti ~]# scp /lib/libssl.so.5 root@10.20.2.26:/lib/
root@10.20.2.26’s password:
libssl.so.5                                   100%  225KB 224.7KB/s   00:00    
[root@cacti ~]# scp /lib/libcrypto.so.5 root@10.20.2.26:/lib/
root@10.20.2.26’s password:
libcrypto.so.5    

ldconfig

NagiosPlugin NSCA
——————

tar xvzf nsca-2.7.2.tar.gz
cd nsca-2.7.2
../configure
make all
cp src/nsca /usr/local/nagios/bin
cp /tmp/nsca-2.7.2/sample-config/nsca.cfg /usr/local/nagios/etc/nsca.conf
cp /tmp/nsca-2.7.2/sample-config/nsca.xinetd /etc/xinetd.d/nsca

vi /etc/services

nsca            5667/tcp                        # NSCA

vi README
touch /etc/xinetd.d/nsca

[root@cacti ~]# vi /etc/xinetd.d/nsca
# default: on
# description: NSCA (Nagios Service Check Acceptor)
service nsca
{
        flags           = REUSE
        socket_type     = stream
        wait            = no
        user            = nagios
        group           = nagios
        server          = /usr/local/nagios/bin/nsca
        server_args     = -c /usr/local/nagios/etc/nsca.cfg –inetd
        log_on_failure  += USERID
        disable         = no
        #only_from       = 127.0.0.1 ezhdevdb02 ezhcom02 ezhcom01
}

cd /usr/local/nagios/var
touch nsca.dump
chown nagios:nagios nsca.dump
chmod 660 nsca.dump
vi /usr/local/nagios/etc/nsca.cfg

 command_file=/usr/local/nagios/var/rw/nagios.cmd
 alternate_dump_file=/usr/local/nagios/var/nsca.dump

yum install xinetd
chkconfig –add xinetd
chkconfig –level 3  xinetd on
service xinetd start
chkconfig –list
# system-config-securitylevel
add port 5667

Voorbeeldcommando:
ezhcom01;adt-endo_adt;2;TESTJE”| /usr/local/nagios/bin/send_nsca -H 10.20.2.26 -d “;” -c /usr/local/nagios/etc/send_nsca.cfg

————————————————————

R71 Nagios Centreon Network & System Monitoring Consultancy 150 60 Roderick Derks

R71 Nagios Centreon Network & System Monitoring Consultancy

 

Uitval, storingen en instabiliteit van uw netwerkomgeving kunnen onverwachts voor down-time zorgen. U wilt voorkomen dat uw bedrijfsprocessen tot stilstand komen.

Voor het monitoren van uw ICT-infrastructuur en bedrijfsprocessen is Nagios® Network Monitor framework in combinatie met Centreon een uitstekende keuze. Dit is een zeer schaalbare, uitgebreide en betrouwbare monitoringapplicatie welke uitermate geschikt is voor zowel kleinere als grote (enterprise) netwerken. Nagios is diverse malen door gerenomeerde organisaties bekroond tot beste Open Source Network Monitoring software. En bovendien is Nagios het netwerkmonitoringsysteem met de laagste TCO.

 

Centreon: overview status services Centreon: beschikbaarheidsrapport Centreon: grafieken Centreon: grafieken
Centreon: grafieken Centreon: grafieken

 

Enkele functies van Nagios:

  • Monitoren van network services (SMTP, POP3, HTTP, NNTP, PING, etc.)
  • Monitoren van host resources (processor load, disk en geheugen gebruik, lopende processen, databases, etc.)
  • Monitoren van omgevingsfactoren zoals temperatuur en luchtvochtigheid
  • Mogelijkheid tot het hierarchisch weergeven van het netwerk om zo onderscheid te maken tussen hosts welke down zijn en welke niet bereikbaar zijn
  • Scheduled downtime inplannen voor hosts en services
  • Verzenden van notificaties via email, sms, pagers
  • Sateliet Nagios systemen voor externe lokaties of in een DMZ
  • Zelf plugins maken

Centreon voegt een nieuwe frontend en extra functionaliteiten aan Nagios toe:

  • Professionele en intuitieve webinterface, Ajax powered
  • Configuratie van nagios via de webinterface
  • Genereren van grafieken om trends te ontdekken
  • Beschikbaarheidsrapportages
  • MySQL database (data historie)

Resultaat:

  • Een betrouwbaar, schaalbaar en zeer flexibel monitoringsyteem
  • Snel een duidelijk overzicht van actuele problemen in stress situaties, adequaat reageren ipv achter de feiten aanlopen
  • Trends signaleren waardoor pro-actief ingegrepen kan worden (bv door een helder inzicht van het diskruimte gebruik)
  • Inzicht in het gebruik van resources door applicaties (geheugen, cpu) waardoor geld bespaard kan worden
  • Zeer actieve ontwikkelaars en een enthousiaste Open Source community van zowel Nagios als Centreon

Een snelle implementatie van Nagios en Centreon met de belangrijkste checks kan al in enkele werkdagen worden gerealiseerd. Dit is mogelijk door een voorgeinstalleerde en -geconfigureerde omgeving als een appliance aan te sluiten op het netwerk in uw bedrijf. Uitgebreidere installaties met op maat gemaakte plugins is eveneens mogelijk. Geinteresseerd? Neem contact op!

{module RokSlideshow}

Certificaten:
* VCP410 VMware Certified Professional on vSphere
* VCP310 VMware Certified Professional on VI3
* Certified System Administrator CSA HP-UX (UNIX)
* Certified Cloverleaf Technician
* Nortel Networks Ethernet Router and Switch Admin
* Check Point Security Administration I NGX (R65)
* Microsoft Certified System Engineer
* DELL EMC SAN Management
* Novell Netware Advanced Administration

vmware certified professional hp certified professional

microsoft certified professional

cloverleaf certified
Centreon and Nagios Install Guide 150 150 Roderick Derks

Centreon and Nagios Install Guide

Centos 5.5 add repo to get RedHat packages

echo "[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el\$releasever/en/\$basearch/dag
gpgcheck=1
gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
enabled=1" > /etc/yum.repos.d/dag.repo

And you are off...

 

This is what I did on my Fedora 7 box:

Disable SELINUX

—————————————-
nagios update 2.9 to 3.0.3
—————————————-

tar xvzf nagios-3.0.3.tar.gz
cd nagios-3.0.3
./configure –with-gd-lib=/usr/lib –with-gd-inc=/usr/include –with-command-group=nagcmd
make all
make install
vi /etc/local/nagios/etc/nagios.conf
disable parameter check_result_buffer_slots

service nagios restart

Nagios/Apache authetication against local htpasswd file

# vi /etc/httpd/conf.d/nagios.conf

ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"

<Directory "/usr/local/nagios/sbin">

   AuthType Basic
   AuthName "Nagios Access"

   Options Indexes FollowSymLinks
   AllowOverride None
   Order allow,deny
   Allow from all
   Require valid-user

   # Lokale autenticatie file ipv LDAP
   AuthUserFile /usr/local/nagios/etc/apache/htpasswd.users

</Directory>

Alias /nagios "/usr/local/nagios/share"

<Directory "/usr/local/nagios/share">
   Options None
   AllowOverride AuthConfig
   Allow from all

</Directory>

Add First User and create htpasswd file:
htpasswd -c /usr/local/nagios/etc/apache/htpasswd.users nagiosadmin
Add Second User and use existing htpasswd file:
htpasswd -c /usr/local/nagios/etc/apache/htpasswd.users nagiosadmin

Nagios/Apache authetication against Windows Active Directory W2003R2 and higher

# vi /etc/httpd/conf.d/nagios.conf

ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"

<Directory "/usr/local/nagios/sbin">

   AuthBasicProvider ldap
   AuthType Basic
   AuthzLDAPAuthoritative on
   AuthName "Nagios Access"

   Options Indexes FollowSymLinks
   AllowOverride None
   Order allow,deny
   Allow from all
   Require valid-user

   # Active Directory LDAP
   AuthLDAPURL "ldap://elisabeth.nl:389/ou=Users,ou=admins,dc=elisabeth,dc=nl?sAMAccountName?sub?(objectClass=*)"
   AuthLDAPBindDN "cn=sa_nagios,ou=Service Accounts,ou=admins,dc=elisabeth,dc=nl"
   AuthLDAPBindPassword "wwwwachtwoord"
</Directory>

Alias /nagios "/usr/local/nagios/share"

<Directory "/usr/local/nagios/share">
   Options None
   AllowOverride AuthConfig
   Allow from all

</Directory>

————————————-
Install Linux Software
————————————-

yum install perl-RRD-Simple perl-DBI
yum install perl-DBI perl-DBD-MySQL
yum install gd fontconfig-devel libjpeg-devel libpng-devel gd-devel perl-GD
yum install php php-mysql php-gd
yum install perl-DBI perl-DBD-MySQL
yum install gd fontconfig-devel libjpeg-devel libpng-devel gd-devel perl-GD
yum install rrdtool perl-rrdtool
yum install perl-Crypt-DES perl-Digest-SHA1 perl-Digest-HMAC net-snmp-utils y
yum install perl-Socket6 perl-IO-Socket-INET6 net-snmp net-snmp-libs php-snmp dmidecode lm_sensors perl-Net-SNMP net-snmp-perl
yum install php
yum list |grep -i pear
yum install php-pear
pear channel-update pear.php.net

# yum install php-xml (voor xmlwriter.so vanaf Centreon 2.1)

#oftwel in één regel:

yum install perl-RRD-Simple perl-DBI perl-DBD-MySQL gd fontconfig-devel libjpeg-devel libpng-devel gd-devel perl-GD php php-mysql php-gd perl-DBI perl-DBD-MySQL gd fontconfig-devel libjpeg-devel libpng-devel gd-devel perl-GD rrdtool perl-rrdtool perl-Crypt-DES perl-Digest-SHA1 perl-Socket6 perl-IO-Socket-INET6 net-snmp net-snmp-libs php-snmp dmidecode lm_sensors perl-Net-SNMP net-snmp-perl perl-Digest-HMAC net-snmp-utils openssl-devel perl-DBD-MySQL mysql-server mysql-devel sudo php-ldap php-xml

yum install php-pear -y ; pear channel-update pear.php.net

Now, I had an issue when I want to install/upgrade my PEAR modules with the script install.sh for the installation of Centreon (§5). It's impossible to upgrade/install modules. My internet connection works fine (http, apt etc … work) but is there a configuration file to access outside with pear ? In fact, you can see the configuration of pear with this command :
# pear config-show

If you have an internet access with a proxy, the script install.sh will not be able to upgrade your PEAR modules. Before that, you must configure your proxy parameter for pear :
pear config-set http_proxy http://[your_login]:[your password]@[@IP proxy]:[port]
Example :
pear config-set http_proxy http://toto:fgdto@192.168.1.25:8080

This is the PEAR module that the script installs, you can install it yourself:
# yum install php-pear-SOAP -y

yum install mysqlclient14-devel.i386 -y

vi /etc/php.ini

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

;RRD
extension=ldap.so

———————————-
NDOutils
———————————-
cd /tmp
tar xvzf ndoutils-cvs.tar.gz
cd ndoutils-cvs
./configure –prefix=/usr/local/nagios/ –enable-mysql –disable-pgsql –with-ndo2db-user=nagios –with-ndo2db-group=nagios
make
cp ./src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o
cp ./src/ndo2db-3x /usr/local/nagios/bin/ndo2db
chmod 774 /usr/local/nagios/bin/ndo*
chown nagios:nagios /usr/local/nagios/bin/ndo*
cp config/ndo* /usr/local/nagios/etc/

#oftwel:
#cp ./src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o; cp ./src/ndo2db-3x /usr/local/nagios/bin/ndo2db; chmod 774 /usr/local/nagios/bin/ndo*; chown nagios:nagios /usr/local/nagios/bin/ndo*;cp config/ndo* /usr/local/nagios/etc/

#vi /usr/local/nagios/etc/nagios.cfg
# event_broker_options=-1
# broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg

-bash-3.2# vi /etc/init.d/ndo2db
*** zie file onderaan ****

chmod +x /etc/init.d/ndo2db
chkconfig –add ndo2db
chkconfig –level 345 ndo2db on

service mysqld start
chkconfig –level 345 mysqld on

mysql -u root
mysql> update mysql.user set Password=PASSWORD('root') where User='root';
mysql> CREATE DATABASE ndo;
mysql> GRANT SELECT, INSERT, UPDATE, DELETE ON ndo.* TO 'ndo'@'localhost' IDENTIFIED BY 'ndo';
mysql> FLUSH PRIVILEGES;
mysql> exit

——————————-
INSTALL CENTREON
——————————-

-bash-3.2# visudo
#Defaults requiretty

cd /tmp
tar xvzf centreon-2.0-b6.tar.gz
export PATH="$PATH:/usr/local/nagios/bin/"
cd /tmp/centreon-2.0-b6
./install.sh -i

—————————————————–
Please choose what you want to install
—————————————————–

Do you want to install : Centreon Web Front
[y/n], default to [n]:
> y

Do you want to install : Centreon CentCore
[y/n], default to [n]:
> n

Do you want to install : Centreon Nagios Plugins
[y/n], default to [n]:
> y

Do you want to install : Centreon Snmp Traps process
[y/n], default to [n]:
> n
—————————————————–
Start CentWeb Installation
—————————————————–

Where is your Centreon directory?
default to [/usr/local/centreon]
>

Do you want me to create this directory ? [/usr/local/centreon]
[y/n], default to [n]:
> y
Path /usr/local/centreon OK

Where is your Centreon log directory
default to [/usr/local/centreon/log]
>

Do you want me to create this directory ? [/usr/local/centreon/log]
[y/n], default to [n]:
> y
Path /usr/local/centreon/log OK

Where is your Centreon etc directory
default to [/etc/centreon]
>

Do you want me to create this directory ? [/etc/centreon]
[y/n], default to [n]:
> y
Path /etc/centreon OK

Where is your Centreon generation_files directory?
default to [/usr/local/centreon]
>
Path /usr/local/centreon OK

Where is the RRD perl module installed [RRDs.pm]
default to [/usr/lib/perl5/RRDs.pm]
> /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/RRDs.pm
Path /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-mulOK
/usr/bin/rrdtool OK
/bin/mail OK

Where is PEAR [PEAR.php]
default to [/usr/share/php/PEAR.php]
> /usr/share/pear/PEAR.php
Path /usr/share/pear OK

Where is installed Nagios ?
default to [/usr/local/nagios]
>
Path /usr/local/nagios OK

Where is your nagios config directory
default to [/usr/local/nagios/etc]
>
Path /usr/local/nagios/etc OK

Where is your Nagios var directory ?
default to [/usr/local/nagios/var]
>
Path /usr/local/nagios/var OK

Where is your Nagios plugins (libexec) directory ?
default to [/usr/local/nagios/libexec]
>
Path /usr/local/nagios/libexec OK
/usr/local/nagios/bin//nagios OK

Where is your Nagios image directory ?
default to [/usr/local/nagios/share/images/logos]
>
Path /usr/local/nagios/share/images/logos OK
/usr/local/nagios/bin//nagiostats OK
p1_file : /usr/local/nagios/bin/p1.pl OK
/usr/bin/php OK
Finding Apache group : apache
Finding Apache user : apache
Finding Nagios user : nagios
Finding Nagios group : nagios

Do you want to use NDO ?
[y/n], default to [n]:
> y
/usr/local/nagios/bin/ndomod.o OK
————————————————————————
Configure Sudo
————————————————————————

Where is sudo configuration file
default to [/etc/sudoers]
>
/etc/sudoers OK
Nagios init script OK
Your sudo is not configured

Do you want me to configure your sudo ? (WARNING)
[y/n], default to [n]:
> y
Configuring Sudo OK
————————————————————————
Configure Apache server
————————————————————————

Do you want to write in Apache configuration file ?
[y/n], default to [n]:
> y
Create '/etc/httpd/conf.d/centreon.conf' OK
Configuring Apache OK

Do you want to reload your Apache ?
[y/n], default to [n]:
> y
Reloading Apache service OK
Preparing Centreon temporary files)
In process
Change macros for php file
Change macros for php file OK
Copy CentWeb in system directory
CentWeb file installation OK
Install Centreon cron OK
Pear Modules
Check PEAR modules
PEAR 1.5.0 1.5.0 OK
DB 1.7.6 NOK
DB_DataObject 1.8.4 NOK
DB_DataObject_FormBuilder 1.0.0RC4 NOK
MDB2 2.0.0 NOK
Date 1.4.6 NOK
HTML_Common 1.2.2 NOK
HTML_QuickForm 3.2.5 NOK
HTML_QuickForm_advmultiselect 1.1.0 NOK
HTML_Table 1.6.1 NOK
Archive_Tar 1.1 1.3.2 OK
Auth_SASL 1.0.1 NOK
Console_Getopt 1.2 1.2.1 OK
HTTP 1.2.2 NOK
Image_GraphViz 1.1.0 NOK
Net_SMTP 1.2.8 NOK
Net_Socket 1.0.1 NOK
Net_Traceroute 0.21 NOK
Net_Ping 2.4.1 NOK
Validate 0.6.2 NOK
XML_RPC 1.4.5 1.5.1 OK
SOAP 0.10.1 NOK
Log 1.9.11 NOK

Do you want me to install/upgrade your PEAR modules
[y/n], default to [y]:
> y
Upgrading PEAR modules
Installing PEAR modules
DB 1.7.6 1.7.13 OK
DB_DataObject 1.8.4 1.8.8 OK
DB_DataObject_FormBuilder 1.0.0RC4 1.0.0RC7 OK
MDB2 2.0.0 2.4.1 OK
HTML_QuickForm_advmultiselect 1.1.0 1.4.1 OK
HTML_Table 1.6.1 1.8.2 OK
Auth_SASL 1.0.1 1.0.2 OK
HTTP 1.2.2 1.4.0 OK
Image_GraphViz 1.1.0 1.2.1 OK
Net_SMTP 1.2.8 1.3.1 OK
Net_Traceroute 0.21 0.21.1 OK
Net_Ping 2.4.1 2.4.3 OK
Validate 0.6.2 0.8.1 OK
SOAP 0.10.1 0.11.0 OK
Log 1.9.11 1.11.0 OK
Check PEAR modules
PEAR 1.5.0 1.5.0 OK
DB 1.7.6 1.7.13 OK
DB_DataObject 1.8.4 1.8.8 OK
DB_DataObject_FormBuilder 1.0.0RC4 1.0.0RC7 OK
MDB2 2.0.0 2.4.1 OK
Date 1.4.6 1.4.7 OK
HTML_Common 1.2.2 1.2.4 OK
HTML_QuickForm 3.2.5 3.2.10 OK
HTML_QuickForm_advmultiselect 1.1.0 1.4.1 OK
HTML_Table 1.6.1 1.8.2 OK
Archive_Tar 1.1 1.3.2 OK
Auth_SASL 1.0.1 1.0.2 OK
Console_Getopt 1.2 1.2.1 OK
HTTP 1.2.2 1.4.0 OK
Image_GraphViz 1.1.0 1.2.1 OK
Net_SMTP 1.2.8 1.3.1 OK
Net_Socket 1.0.1 1.0.9 OK
Net_Traceroute 0.21 0.21.1 OK
Net_Ping 2.4.1 2.4.3 OK
Validate 0.6.2 0.8.1 OK
XML_RPC 1.4.5 1.5.1 OK
SOAP 0.10.1 0.11.0 OK
Log 1.9.11 1.11.0 OK
All PEAR modules OK
————————————————————————
Centreon Post Install
————————————————————————

Create /usr/local/centreon/www/install/install.conf.php OK
Create /etc/centreon/instCentWeb.conf OK

————————————————————————
Start CentStorage Installation
————————————————————————

Where is your Centreon Run Dir directory?
default to [/var/run/centreon]
>

Do you want me to create this directory ? [/var/run/centreon]
[y/n], default to [n]:
> y
Path /var/run/centreon OK

Where is your CentStorage binary directory
default to [/usr/local/centreon/bin]
>

Do you want me to create this directory ? [/usr/local/centreon/bin]
[y/n], default to [n]:
> y
Path /usr/local/centreon/bin OK

Where is your CentStorage RRD directory
default to [/var/lib/centreon]
>

Do you want me to create this directory ? [/var/lib/centreon]
[y/n], default to [n]:
> y
Path /var/lib/centreon OK
Finding Nagios group : nagios
Finding Nagios user : nagios
Preparing Centreon temporary files)
/tmp/centreon-setup exists, it will be moved…
Creating Centreon Directory '/var/lib/centreon/status' OK
Creating Centreon Directory '/var/lib/centreon/metrics' OK
Replace Centstorage Macro OK
Set CentStorage properties OK
Change macros for centstorage init script OK

Do you want me to install CentStorage init script ?
[y/n], default to [n]:
> y

Do you want me to install CentStorage run level ?
[y/n], default to [n]:
> y
Set logAnalyser properties OK
Set nagiosPerfTrace properties OK
Install CentStorage cron OK
Create /etc/centreon/instCentStorage.conf OK

————————————————————————
Start CentPlugins Installation
————————————————————————

Where is your CentPlugins lib directory
default to [/var/lib/centreon/centplugins]
>

Do you want me to create this directory ? [/var/lib/centreon/centplugins]
[y/n], default to [n]:
> y
Path /var/lib/centreon/centplugins OK
Finding Nagios user : nagios
Finding Nagios group : nagios
Preparing Centreon temporary files)
/tmp/centreon-setup exists, it will be moved…
CentPlugins is installed
Create /etc/centreon/instCentPlugins.conf OK
#################################################
# #
# Go to the URL : http://your-server/centreon/ #
# to finish the setup #
# #
# Report bugs at http://trac.centreon.com #
# #
# Thanks for using Centreon. #
# ———————– #
# Contact : infos@centreon.com #
# http://www.centreon.com #
# #
#################################################

mysql -u root -p ndo < /tmp/centreon-2.0-b6/www/install/createNDODB.sql
mysql> GRANT SELECT , INSERT , UPDATE , DELETE ON `ndo` . * TO 'centreon'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> use centreon;
mysql> update cfg_ndo2db set db_user = 'centreon';
mysql> exit;

# vi /usr/local/nagios/etc/ndo2db.cfg
db_user=ndo
db_pass=ndo

/usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg

system-config-security
port 3306 en 5669 openen (tcp en ik heb ook udp geopend)

# vi /usr/local/nagios/etc/ndo2db.cfg
socket_type=tcp
tcp_port=5669
db_name=ndo
db_prefix=nagios_
db_user=ndo
db_pass=ndo
output_type=tcpsocket

# vi /usr/local/nagios/etc/ndomod.cfg
output=127.0.0.1
tcp_port=5669

service centcore start
service centstorage start

 

———————————————————————–
#!/bin/sh
#
#
# chkconfig: 345 99 01
# description: Nagios to mysql
#
# Author : Gaëtan Lucas
# Realase : 07/02/08
# Version : 0.1 b
# File : ndo2db
# Description: Starts and stops the Ndo2db daemon
# used to provide network services status in a database.
#

status_ndo ()
{
if ps -p $NdoPID > /dev/null 2>&1; then
return 0
else
return 1
fi

return 1
}

printstatus_ndo()
{
if status_ndo $1 $2; then
echo "ndo (pid $NdoPID) is running…"
else
echo "ndo is not running"
fi
}

killproc_ndo ()
{
echo "kill $2 $NdoPID"
kill $2 $NdoPID
}

pid_ndo ()
{
if test ! -f $NdoRunFile; then
echo "No lock file found in $NdoRunFile"
echo -n " checking runing process…"
NdoPID=`ps h -C ndo2db -o pid`
if [ -z "$NdoPID" ]; then
echo " No ndo2db process found"
exit 1
else
echo " found process pid: $NdoPID"
echo -n " reinit $NdoRunFile …"
touch $NdoRunFile
chown $NdoUser:$NdoGroup $NdoRunFile
echo "$NdoPID" > $NdoRunFile
echo " done"
fi
fi

NdoPID=`head $NdoRunFile`
}

# Source function library
# Solaris doesn't have an rc.d directory, so do a test first
if [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
elif [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
fi

prefix=/usr/local/nagios
exec_prefix=${prefix}
NdoBin=${exec_prefix}/bin/ndo2db
NdoCfgFile=${prefix}/etc/ndo2db.cfg
NdoRunFile=${prefix}/var/ndo2db.run
NdoLockDir=/var/lock/subsys
NdoLockFile=ndo2db.lock
NdoUser=nagios
NdoGroup=nagios

# Check that ndo exists.
if [ ! -f $NdoBin ]; then
echo "Executable file $NdoBin not found. Exiting."
exit 1
fi

# Check that ndo.cfg exists.
if [ ! -f $NdoCfgFile ]; then
echo "Configuration file $NdoCfgFile not found. Exiting."
exit 1
fi

# See how we were called.
case "$1" in

start)
echo -n "Starting ndo:"
touch $NdoRunFile
chown $NdoUser:$NdoGroup $NdoRunFile
$NdoBin -c $NdoCfgFile
if [ -d $NdoLockDir ]; then
touch $NdoLockDir/$NdoLockFile;
fi
ps h -C ndo2db -o pid > $NdoRunFile
if [ $? -eq 0 ]; then
echo " done."
exit 0
else
echo " failed."
$0 stop
exit 1
fi
;;

stop)
echo -n "Stopping ndo: "

pid_ndo
killproc_ndo

# now we have to wait for ndo to exit and remove its
# own NdoRunFile, otherwise a following "start" could
# happen, and then the exiting ndo will remove the
# new NdoRunFile, allowing multiple ndo daemons
# to (sooner or later) run
#echo -n 'Waiting for ndo to exit .'
for i in 1 2 3 4 5 6 7 8 9 10 ; do
if status_ndo > /dev/null; then
echo -n '.'
sleep 1
else
break
fi
done
if status_ndo > /dev/null; then
echo
echo 'Warning – ndo did not exit in a timely manner'
else
echo 'done.'
fi

rm -f $NdoRunFile $NdoLockDir/$NdoLockFile
;;

status)
pid_ndo
printstatus_ndo ndo
;;

restart)
$0 stop
$0 start
;;

*)
echo "Usage: ndo {start|stop|restart|status}"
exit 1
;;

esac

# End of this script

 

—————————————-
Add another Nagios server to the configuration
—————————————-

When you create the config files for a nagios server, fiels will be generated in the following directory:
/usr/local/centreon/filesGeneration/nagiosCFG/1/ for the local Centreon/Nagios server
/usr/local/centreon/filesGeneration/nagiosCFG/2/ for the satelite (and 3 and so on for more satelites)

—————————————-
Importing existing Nagios files
—————————————-

This part of setting up Centreon lacks documentation so this took a while to find out who things work. The order of importing the data is very important because of the dependencies:

01 checkcommandfile – select the "YES" radiobutton for the option "Delete all configuration for the chosen type of files" if youwant to delete the default preconfigured items
02 notificationcommands – from now on select the "NO" radiobutton for each step
03 timeperiods
04 servicegroups
05 contacts
06 contact_groups
07 services_templates
08 host_templates
09 hostgroups
10 hosts
11 services

Ok, after loading a file into the database check the result to see if the number of imported configuration items is correct.

It's still not the perfect solution for me cause I miss the relationship between servicegroups and services, but that's not a major issue.

I ran into some more problems. To be able to import the service templates I had to add the service _description parameter to each template, something I had not done in Nagios and it was not mandatory:

define service {
name 7×24-service
service_description 7×24-service
use generic-service
max_check_attempts 4
normal_check_interval 14
retry_check_interval 1
register 0
notification_interval 60
contact_groups 24u-medewerkers,kantoortijd-medewerkers
notification_options c,r
notification_period 7×24
}

The services were loaded and I can see them being attached directly to a host or to a hostgroup. It took me a while to understand the pages. The relationships between services and hosts were made in the Nagios config files. Hosts are member of a group that have services attached to it and other services were related directly to a certain host, not using hostgroups.

I have the idea though that sometimes the "services by host" or "services by host group" pages do not show up correctly. I get blank pages when i.e. I select a pagenumber to see more services.

Then I had to manually configure the users that were imported in the database. A lot of fields that for some reason were not filled needed to be filled manually:

– Host and Service notification options
– Host and Service notification period
– Host and Service commands

I think this has got something to do with the fact that usertemplates are not used by Centreon. At least, I can't find them. And in my Nagios config these templates contained this info.

 

——————————————————
LDAP and Active Directory
——————————————————

LDAP Information
Enable LDAP authentification: YES
LDAP Server: dnsname_or_ipaddress
LDAP port: 389
LDAP Base DN: ou=Users,ou=admins,dc=elisabeth,dc=nl
LDAP Login Attribute: samaccountname
Enable LDAP over SSL: NO

LDAP Search Information
User to search (anonymous if empty): cn=username,ou=Service Accounts,ou=admins,dc=your_ad_name,dc=nl
Password: ************
Default LDAP filter: (&(objectClass=user)(samaccounttype=805306368)(memberOf=cn=APP_Nagios,ou=Applicaties,ou=Groups,ou=EZH,dc=elisabeth,dc=nl)(cn=*))Category=person)(cn=*))
LDAP search timeout: 60
LDAP Search Size Limit: 60

For each user select LDAP as the Authentication Type, and fill in the LDAP DN (cn=username,ou=Users,dc=your_ad_name,dc=nl)
I think you can automate the last step by doing an LDAP import, but I could not get this to work.

—————————————————–
SQL stuff
—————————————————–

Install phpMyAdmin
yum install phpMyAdmin

vi /usr/share/phpMyAdmin/config.inc.php
$cfg['Servers'][$i]['auth_type'] = 'http';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'passsswooorrrddd';

vi /etc/httpd/conf.d/phpMyAdmin.conf
-> adjust the rights to your needs

SQL SELECT statements:

SELECT `centreon`.`ns_host_relation` SET `nagios_server_id` = '2' WHERE `ns_host_relation`.`nagios_server_id` = 1
FROM `ns_host_relation`
LIMIT 0 , 300

SELECT * FROM `ns_host_relation` WHERE `nagios_server_id` = 1

SQL UPDATE statement to change the nagios server that monitors a host:
UPDATE `centreon`.`ns_host_relation` SET `nagios_server_id` = '2' WHERE `ns_host_relation`.`nagios_server_id` = '1'

SELECT * FROM `index_data` WHERE `service_description` = 'drive-space-root'

————————————–
GRAPHS
————————————–

First configure Nagios to export the plugin service performance data to a file:

vi /usr/local/nagios/libexec/process-service-perfdata

#!/bin/bash
# some parameters passed on command line
TIMET=$1
HOSTNAME=$2
SERVICEDESC=$3
OUTPUT=$4
SERVICESTATE=$5
PERFDATA=$6
PERFFILE="/usr/local/nagios/var/service-perfdata"
/usr/bin/printf "%b" "$TIMET\t$HOSTNAME\t$SERVICEDESC\t$OUTPUT\t$SERVICESTATE\t$PERFDATA\n" >> $PERFFILE

chmod +rx /usr/local/nagios/libexec/process-service-perfdata

First of all, create a new Nagios command:
Go to 'Centreon -> Configuration -> Commands -> Miscellaneous Commands' and add a new command
name: process-service-perfdata-centreon
commandline: $USER1$/process-service-perfdata "$LASTSERVICECHECK$" "$HOSTNAME$" "$SERVICEDESC$" "$SERVICEOUTPUT$" "$SERVICESTATE$" "$SERVICEPERFDATA$"

Then, activate this command in Nagios :
Go to 'Centreon -> Configuration -> Nagios -> Nagios CFG'
Set 'Performance Data Processing Option' option to YES
In 'Service Performance Data Processing Command', select 'process-service-perfdata-centreon' plugin
Save changes and restart Nagios

Check /usr/local/nagios/var/service-perf-data. This file is now created and getting filled with data from Nagios's activated check plugins results. This file will be used by CentStorage to collect the data.

-bash-3.2# cat /usr/local/nagios/var/service-perfdata
# New File #
1218743663 ezhappl21 centreon_ping GPING OK – rtt min/avg/max/mdev = 1.064/1.064/1.064/0.000 ms OK time=1.064ms;20;40;; ok=1
[SERVICEPERFDATA] 1218743664 ezhappl21 centreon_ping 0.078 0.758 GPING OK – rtt min/avg/max/mdev = 1.064/1.064/1.064/0.000 ms time=1.064ms;20;40;; ok=1

Now configure CentStorage which is fully configured in the Centreon's webinterface

Go to 'Centreon -> Administration -> CentStorage -> Options'

Path to RRDTool Database For Metrics: /var/lib/centreon/metrics/
Path to RRDTool Database For Status: /var/lib/centreon/status/
Path to RRDTool Database for Nagios: /var/lib/centreon/nagios-perf/
RRDTool database size: 365
Retention Duration for Data in MySQL: 365
RRDTool auto delete: unselect
Sleep Time: 10
Purge check interval: 60
Storage Type: RRDTool & MySQL
Perfdata: /usr/local/nagios/var/service-perfdata
Drop Data in another file: unselect (or select for debugging to collect the perfdata picked up by CentStorage)
Drop file: /usr/local/nagios/var/service-perfdata.tmp
Archive Nagios Logs: select
Logs retention duration: 31
Nagios current log file to parse: /usr/local/nagios/var/nagios.log

– rrd files will be generated in /var/lib/centreon/metrics/{hostnumber}.rrd and /var/lib/centreon/status/{hostnumber}.rrd (depends on your Centstrore config, satelite nagios servers use directories like perfmon-2, perfmon-3, etc.
– go to 'Centreon -> Administration -> CentStorage -> Manage' to see hosts for which graphs are created.

Using CentStorage compatible Checkplugins

CentStorage catches a specific string group within Nagios checkplugin's results. CentStorage reads the performance data: behind the | in the result's string.

Example (in bold: readable data for CentStorage) :
cpu_user:OK-0% cpu_system:OK-0% cpu_idle:WARNING-97>70% | cpu_user=0%;120;90; cpu_system=0%;100;70; cpu_idle=97%;100;70;

This is the same data that used Perfparse but much more compliant.
General format is :
(user_readable_message_for_nagios) | (label)=(value)(metric);(warn level);(crit level);(min level);(max level)
Only bold string are requested by CentStorage to be able to read data.

Check if a plugin is perfdata or perfparse compatible :
1. (plugin_name) –help : usually, -f option to get perfdata.
2. Just run the plugin in a terminal to check its response format.
3. In Oreon or Nagios : have a look to 'Performance Data' info when checking a service (field must contain strings after the '|' in the message)

A problem I ran into:
I produced my first selfmade graphs. Unfortunately the legenda has got an error because of a problem with the output of the plugin. I fixed this error but the graph is still not allright. I changed the fields in the Metrics table to be as it is supposed to be and then I lost the graph and no new one is generated. I had to reset the graph and start from zero:

Administration -> Centstorage -> Manage -> Select service -> Select Metrics -> Empty All Service Data

So, step by step:

  1. So first create a plugin with the correct output
  2. Then go to "Views -> Curves" and create a curve for each label in the perfdata of the pluginyou want to put in a graph. Curves are more important then Templates.
  3. Create a command:"Configuration -> Commands -> Add.."
  4. Create a Service using the command "Services -> Add.." and link the service to a host or hostgroup (in the service object
    In the service configuration screen, go into Service Extended Infos and select a Graph Template that actually matches the perfdata that you are gathering, for example, Latency would apply to performance figures such as PING or response time.
    At this point the graph setup should be complete as long as your service has perfdata turned ON. Check your templates to make sure it's not 'blocked' somewhere
  5. Execute a Nagios Configuration Files Export

 

MySQL commmands for centstorage:

All tables but not the tabale no_data
mysqldump –opt -hlocalhost -uroot -proot centstorage config data_stats_daily data_stats_monthly data_stats_yearly index_data instance log log_archive_host log_archive_last_status log_archive_service log_snmptt metrics statistics |gzip > /tmp/mysql_centstorage_db_table_no_data.gz

Just table data_bin without the data
mysqldump –opt -hlocalhost -uroot -proot –no_data centstorage data_bin |gzip > /tmp/mysql_centstorage_db.gz

Restore:

-bash-3.2# gzip -d 20081126174501.centreon.gz
-bash-3.2# gzip -d 20081126174501.centstorage.gz
-bash-3.2# gzip -d 20081126174501.ndo.gz
-bash-3.2# mysql -u root -p centreon < 20081126174501.centreon
Enter password:
-bash-3.2# mysql -u root -p centstorage < 20081126174501.centstorage
Enter password:
-bash-3.2# mysql -u root -p ndo < 20081126174501.ndo
Enter password:

Empty Rows In Table

There are two ways to delete all the data in a MySQL database table.

TRUNCATE TABLE tablename; This will delete all data in the table very quickly. In MySQL the table is actually dropped and recreated, hence the speed of the query. The number of deleted rows for MyISAM tables returned is zero; for INNODB it returns the actual number deleted.
DELETE FROM tablename;
This also deletes all the data in the table, but is not as quick as using the "TRUNCATE TABLE" method. In MySQL >= 4.0 the number of rows deleted is returned; in MySQL 3.23 the number returned is always zero.

 

 

Database Growth Control

1. Change Retention Duration for Data in MySQL to 182 days, has this got any effect on the data that is being reported in the reporting tool?

2. Empty the NDO database (except for the tables nagios_acknowledgements, nagios_commenthistory, nagios_comments, nagios_downtimehistory, nagios_instances I think)

3. In Administration> Options > Centstorage > Options I have this config:
I unchecked teh box to prevent the unlimited growth of the service-perfdata.tmp file.
Drop possibility after parsing performance data
Drop Data in another file [ ]
Drop file /usr/local/nagios/var/service-perfdata.tmp

Database performance

Use the tuning-primer.sh script to check mysqld performance and follow the advices given.

-bash-3.2# vi /etc/my.cnf
key_buffer_size=500M
table_cache=1024
query_cache_size=32M

-bash-3.2# service mysqld restart

You can use the other mysql check script to see if there is a difference. Run it before and after the command above.
-bash-3.2# ./ mysql_mem_usage /etc/my.cnf /usr/libexec/mysqld


Upgrade 2.0.2 to 2.1RC6

Got the message that there were not enough rights on the NDO database to execute the script.

mysql -u root  mysql> GRANT SELECT , INSERT , UPDATE , DELETE, ALTER ON `ndo` . * TO 'centreon'@'localhost'; mysql> exit

The the script was executted but it gave me the status CRITICAL. The result was that a user who is NOT a Centreon admin does not see any of the hosts or services in the Home or Monitoring tab. Also no graphs, no reporting info, nothing. The user can just see the config pages.

Solution: with MySQL client or phpMyAdmin, execute this on NDO database:

ALTER TABLE `centreon_acl` ADD host_id INT(11) default NULL AFTER `id` ; ALTER TABLE `centreon_acl` ADD service_id INT(11) default NULL AFTER `host_name`; ALTER TABLE `nagios_servicestatus` ADD INDEX (`current_state`);

Then you have to execute the right SQL script again on the commandline. Scripts can be found in dirs like /usr/local/centreon/www/zKi45v/.

Another problem with the upgrade too. I had to do the upgrade to RC6 in steps (RC6, then RC2, then RC6 again) because the webpage got stuck trying to run the SQL scripts going from RC1 to RC2 when trying to do the upgrade directly from the 2.1RC6 package.

 

MYSQL statement example:

# SELECT host_name, host_address FROM `host` where `host_register`='1'

Trainingen hervat! 150 150 Roderick Derks

Trainingen hervat!

Jawel, twee weken geleden heb ik de trainingen hervat. Lang niet gefietst met als oorzaak de toch wel flinke blessure aan m’n schouder. Het bindweefsel wat helemaal vast zat is nu weer vrijwel los. Echter het gedeelte tussen het sleutelbeen, de bovenarm en de nek tot aan m’n hoofd is nog pijnlijk en dat nodigt niet uit tot bijvoorbeeld het tillen van accu’s of een avondje gezellig bowlen. Fietsen gaat wel en vanavond voor de vierde keer gereden. Met 6 kilo erbij en geslonken beenspieren zat ik de eerste keer na 45 kilometer helemaal kapot. Maar de tweede rit ging al veel beter en zojuist weer lekker rond de 34 p/u kunnen rijden zonder al te zwaar in te spannen. Is niet wat ik gewend was maar valt me toch niet tegen na twee maanden te hebben moeten toekijken.

read more

    Your Name (required)

    Your Email (required)

    Subject

    Your Message

      Your Name (required)

      Your Email (required)

      Subject

      Your Message