Affichage des articles dont le libellé est Nagios. Afficher tous les articles
Affichage des articles dont le libellé est Nagios. Afficher tous les articles

jeudi 29 mars 2012

Centreon Could not find DEFINITIONS :: = BEGIN statement in MIB file!


To recover the traps sent by my SAN MSA2012FC (http://bizsupport1.austin.hp.com/bc/docs/support/SupportManual/c01565941/c01565941.pdf), I tried to add a MIB (found here : http://www.emc.com/microsites/fibrealliance/index.htm) in Centreon.


Here is the error I encountered:


Could not find DEFINITIONS :: = BEGIN statement in MIB file!


After catching a headache I found the solution... 


beginning of the file


FCMGMT-MIB
-
Last edit date: November 10th, 1999
DEFINITIONS :: = BEGIN
   IMPORTS     IpAddress, TimeTicks, experimental         FROM RFC1155-SMI     OBJECT-TYPE         FROM RFC-1212     DisplayString         FROM RFC1213-MIB     TRAP-TYPE         FROM RFC-1215;


--> replaced by


FCMGMT-MIB DEFINITIONS :: = BEGIN   IMPORTS     IpAddress, TimeTicks, experimental         FROM RFC1155-SMI     OBJECT-TYPE         FROM RFC-1212     DisplayString         FROM RFC1213-MIB     TRAP-TYPE         FROM RFC-1215;


and it works ^^'

vendredi 10 février 2012

check_centreon_remote_storage returns negative value for a disk

You monitor a disk with a capacity of several terra bytes.

The values ​​returned by the plugin check_centreon_remote_storage are negative.

You can fix this by editing the plugin check_centreon_remote_storage.

replaces this
##############################
$tot = 1;
$tot = $Size * $AllocationUnits;
if (!$tot){$tot = 1;}
$used = $Used * $AllocationUnits;
$pourcent = ($used * 100) / $tot;
##############################

by this
##############################
$tot = 1;
# PIEBRA modification
if ($Size < 0){$Size += 2**32;}
if ($Used < 0){$Used += 2**32;}
# END PIEBRA

$tot = $Size * $AllocationUnits;
if (!$tot){$tot = 1;}
$used = $Used * $AllocationUnits;
$pourcent = ($used * 100) / $tot;
##############################

And everything will be OK!

lundi 8 novembre 2010

Backup Centreon

#!/bin/sh
#######################################################################################################
# #
# #
# Backup data and application #
# nagios and centreon #
# #
# History: #
# #
# dd-mm-yyyy #
# 05-08-2010 mma recup file #
# 05-08-2010 mma adapt script to centreon version and changing log to english #
# 23-08-2010 mma add -p option to mkdir command (support mutli level dir)
# #
# #
#######################################################################################################
#
#
#
#
##############################################################################################################################
# Configuration params
##############################################################################################################################
#
#
#temp working dir
#----------------
working_dir=/BackupCentreon
#
#
# sub dir target_dir
#-------------------
#
version=`date +%A` # here name of day
#
#destination dir for backup file (a sub dir will be created with the value of version defined above)
#---------------------------------------------------------------------------------------------------
target_dir=/mnt/Centreon
#
#
#
#backup log file
#---------------
backup_log=$working_dir/backup-$version.log
#
#
#DBUser
#-----
user_db=root
#
#
#DBPassword
#----------
pwd_db=Your_Password_Db
#
#3 DB's name
#-----------
centreon_db=centreon
storage_db=centstorage
broker_db=centstatus
#
##############################################################################################################################
# creation dir if necessary or/and clean working dir
##############################################################################################################################
#
if [ -d $working_dir ]; then
rm -R $working_dir/
fi
mkdir -p $working_dir
cd $working_dir
#
# create dir $target_dir in not exist to store archives
#
if [ ! -d $target_dir ]; then
mkdir -p $target_dir
fi
#
echo `date`: start backup $version >$backup_log
#
#
#read Centreon version
#---------------------
mysql -u $user_db -p$pwd_db -D $centreon_db -e "SELECT value FROM informations WHERE informations.key = 'version'" -s -N >>$working_dir/centreon_version.txt
#
#
#
#
#
##############################################################################################################################
# stop supervision (to do) #
##############################################################################################################################
#
#
#echo `date`: stop supervision >>$backup_log
#todo supervision stop >>$backup_log
#
#
#
##############################################################################################################################
# build archive for application and data directories
##############################################################################################################################
#
#
echo `date`: tar: /usr/local/nagios/ to CentSav_nagios_rep.tgz >>$backup_log
tar -czf $working_dir/CentSav_nagios_rep.tgz /usr/local/nagios
#
echo `date`: tar: /usr/local/centreon to CentSav_centcore_rep.tgz >>$backup_log
tar -czf $working_dir/CentSav_centcore_rep.tgz /usr/local/centreon
#
echo `date`: tar: /var/lib/centreon >>$backup_log
tar -czf $working_dir/CentSav_centreon_var_lib.tgz /var/lib/centreon
#
echo `date`: tar: /etc/centreon >>$backup_log
tar -czf $working_dir/CentSav_centreon_etc.tgz /etc/centreon
#
echo `date`: tar: /etc/init.d >>$backup_log
tar -czf $working_dir/CentSav_initdScripts.tgz /etc/init.d
#
echo `date`: tar: /etc/httpd >>$backup_log
tar -czf $working_dir/CentSav_httpdConf.tgz /etc/httpd
#
echo `date`: tar /etc/cron.d >>$backup_log
tar -czf $working_dir/CentSav_crond.tgz /etc/cron.d
#
crontab -l >>Save_crontab
tar -czf $working_dir/CentSav_crontab.tgz Save_crontab
#
echo `date`: tar: /etc/sudoers >>$backup_log
tar -czf $working_dir/CentSav_sudoers_confs.tgz /etc/sudoers
#
##############################################################################################################################
# backup 3 db's #
##############################################################################################################################
echo `date`: start dump $centreon_db >>$backup_log
mysqldump -u $user_db -p$pwd_db --opt $centreon_db >$working_dir/$centreon_db.sql
echo `date`: end dump $centreon_db >>$backup_log
#
echo `date`: start dump $storage_db >>$backup_log
mysqldump -u $user_db -p$pwd_db --opt $storage_db > $working_dir/$storage_db.sql
echo `date`: end dump $storage_db >>$backup_log
#
echo `date`: start dump $broker_db >>$backup_log
mysqldump -u $user_db -p$pwd_db --opt $broker_db > $working_dir/$broker_db.sql
echo `date`: end dump $broker_db >>$backup_log
#
##############################################################################################################################
# restart supervision services (to do) #
##############################################################################################################################
#
#
#echo `date`: start supervision >>$backup_log
#todo supervision start >>$backup_log
#
##############################################################################################################################
# tar dump db (commented because option target = one tgz file #
##############################################################################################################################
#echo `date`: start tar dump $centreon_db $storage_db $broker_db to CentSav_DB.tgz >>$backup_log
#tar -czf $working_dir/CentSav_DB.tgz $centreon_db.sql $storage_db.sql $broker_db.sql
#echo `date`: end tar dump db >>$backup_log
#
##############################################################################################################################
# move archive to backup destination rotation 7 days #
##############################################################################################################################
if [ -e $target_dir/$version/ ]; then
rm -R /$target_dir/$version/
fi
#
#target dir = target_dir + version
#
mkdir -p $target_dir/$version/
target_dir=$target_dir/$version
#
# the next block of instructions has two chooses:
#
# option: backup produces several tgz files
#------------------------------------------
#copy the different tar files to target directory --> result several tgz files (more easy to restore)
#
#
# option one tgz file
#--------------------
#copy all backup in one tar files containing different tgz + sql dump (more easy to move outside localhost)
#
#
#
#
# option several tgz files (uncomment/comment is necessary)
#-----------------------------------------------
#echo `date`: move archive to $target_dir >>$backup_log
#cp CentSav_* $target_dir
#cp centreon_version.txt $target_dir
#cp $backup_log $target_dir
#echo `date`: end move archive >>$backup_log
#
#
# option tar (uncomment/comment is necessary)
#--------------------------------------------
#
echo 'date': end just before tar backup bye bye backup $version >>$backup_log
#
tar -czf $target_dir/Centreon_`date +"%m-%d-%y"`.tgz $working_dir/*
#
#
#
################################################################################################################################
# del temp files #
################################################################################################################################
rm -R $working_dir
#
#That's all folks