Tuesday, March 12, 2013

SharePoint PowerShell Create View Based on Existing View

The following PowerShell script crawls the specified lists, copies the fields from the All Items views and creates a new view named "Created By Me" and sets it as default. Tested with SharePoint 2010 but should work with 2013 as well. Tested with list but not with Document Libraries.

I used this script as a base.


$ver = $host | select version
if ($ver.Version.Major -gt 1) {$host.Runspace.ThreadOptions = "ReuseThread"} 
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) 
{
 Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") 

$web = Get-SPWeb -Identity "http://portal/sites/Requests"
$lists=$web.Lists["User Request", "Hardware Request",  "Employee Request"]
$SourceView="All Items"
$NewViewName="Created By Me"
$NewViewDefault=$true


foreach($list in $lists) {

 $view = $list.Views[$SourceView]
 $Viewfields = $list.Views[$SourceView].ViewFields.ToStringCollection()
 $viewRowLimit="100"
 $viewPaged=$true
 $viewDefaultView=$NewViewDefault

# Setting the Query for the View
 $viewQuery = ""
 $viewName = $NewViewName

# Finally – Provisioning the View
 $myListView = $list.Views.Add($viewName, $viewFields, $viewQuery, 100, $True, $False, "HTML", $False)

# You need to Update the View for changes made to the view
# Updating the List is not enough
 $myListView.DefaultView = $True
 $myListView.Update()
 $list.Update()
}

$web.Dispose()

Monday, February 18, 2013

Microsoft.Office.Web.Environment.Sharepoint.CacheCreationJob - Object reference not set to an instance of an object.

Problem


The Event Log of the SharePoint Server is reddish due to events occurring every 5 minutes:


Event Log Error:


Log Name:      Application
Source:        Microsoft-SharePoint Products-SharePoint Foundation
Date:          2/18/2013 7:00:01 PM
Event ID:      6398
Task Category: Timer
Level:         Critical
Keywords:     
Description:
The Execute method of job definition Microsoft.Office.Web.Environment.Sharepoint.CacheCreationJob (ID 8ea0b71c-08c4-4644-a0bc-c361c391bc45) threw an exception. More information is included below.
Object reference not set to an instance of an object.
Event Xml:
 
   
    6398
    14
    1
    12
    0
    0x4000000000000000
   
    355489
   
   
    Application
 
 
    Microsoft.Office.Web.Environment.Sharepoint.CacheCreationJob
    8ea0b71c-08c4-4644-a0bc-c361c391bc45
    Object reference not set to an instance of an object.
 

ULS Log:


3880        02/18/2013 19:05:00.04   OWSTIMER.EXE (0x0AA0)                     0x2C2C  SharePoint Foundation           Monitoring                      nasq  Medium    Entering monitored scope (Timer Job OfficeWebApplicationsCacheCreationJob)  1ad52fe0-5766-4a71-8991-e4aa0cb9b356
3881        02/18/2013 19:05:00.04   OWSTIMER.EXE (0x0AA0)                     0x2C2C  Office Web Apps                 Office Viewing Architecture     cu85  Medium    Cache Creation Job Starting [JobId: 8ea0b71c-08c4-4644-a0bc-c361c391bc45]  1ad52fe0-5766-4a71-8991-e4aa0cb9b356
3882        02/18/2013 19:05:00.04   OWSTIMER.EXE (0x0AA0)                     0x2C2C  Office Web Apps                 Office Viewing Architecture     cu86  Exception  Cache Creation Job encountered an exception [JobId: 8ea0b71c-08c4-4644-a0bc-c361c391bc45] System.NullReferenceException: Object reference not set to an instance of an object.     at Microsoft.SharePoint.SPSite.PreinitializeServer(SPRequest request)     at Microsoft.SharePoint.SPSite.GetSPRequest()     at Microsoft.SharePoint.SPSite.get_Request()     at Microsoft.SharePoint.SPSite.get_Usage()     at Microsoft.Office.Web.Environment.Sharepoint.WacSharepointCacheOM.EnsureCacheSiteCollection(SPWebApplication webApp, Boolean elevateReturn, String ownerLogin, String ownerName, String ownerEmail)     at Microsoft.Office.Web.Environment.Sharepoint.WacSharepointCacheOM.EnsureCacheSiteCollection(SPWebApplication webApp)     at Microsoft.Office.Web.Environment.Sharepoint.CacheCreationJob.Execute(SPJo...  1ad52fe0-5766-4a71-8991-e4aa0cb9b356
3883        02/18/2013 19:05:00.04*  OWSTIMER.EXE (0x0AA0)                     0x2C2C  Office Web Apps                 Office Viewing Architecture     cu86  Exception  ...bState jobState)  1ad52fe0-5766-4a71-8991-e4aa0cb9b356
3884        02/18/2013 19:05:00.04   OWSTIMER.EXE (0x0AA0)                     0x2C2C  Office Web Apps                 Unified Logging Service         c91s  Monitorable  Watson bucket parameters: Office Web Apps, ULSException14, 52a97675 "office web apps", 0e00178d "14.0.6029.0", 1f65804a "microsoft.sharepoint", 0e0017ee "14.0.6126.0", 5021a68d "wed aug 08 02:36:45 2012", 000057b1 "000057b1", 01ab21e4 "01ab21e4", 4a6d3421 "nullreferenceexception", 63753836 "cu86"  1ad52fe0-5766-4a71-8991-e4aa0cb9b356
3885        02/18/2013 19:05:00.04   OWSTIMER.EXE (0x0AA0)                     0x2C2C  SharePoint Foundation           Timer                           6398  Critical  The Execute method of job definition Microsoft.Office.Web.Environment.Sharepoint.CacheCreationJob (ID 8ea0b71c-08c4-4644-a0bc-c361c391bc45) threw an exception. More information is included below.  Object reference not set to an instance of an object.  1ad52fe0-5766-4a71-8991-e4aa0cb9b356
3886        02/18/2013 19:05:00.04   OWSTIMER.EXE (0x0AA0)                     0x2C2C  SharePoint Foundation           Timer                           72ae  Unexpected  Exception stack trace:    at Microsoft.SharePoint.SPSite.PreinitializeServer(SPRequest request)     at Microsoft.SharePoint.SPSite.GetSPRequest()     at Microsoft.SharePoint.SPSite.get_Request()     at Microsoft.SharePoint.SPSite.get_Usage()     at Microsoft.Office.Web.Environment.Sharepoint.WacSharepointCacheOM.EnsureCacheSiteCollection(SPWebApplication webApp, Boolean elevateReturn, String ownerLogin, String ownerName, String ownerEmail)     at Microsoft.Office.Web.Environment.Sharepoint.WacSharepointCacheOM.EnsureCacheSiteCollection(SPWebApplication webApp)     at Microsoft.Office.Web.Environment.Sharepoint.CacheCreationJob.Execute(SPJobState jobState)     at Microsoft.SharePoint.Administration.SPTimerJobInvokeInternal.Invoke(SPJobDefinition jd, Guid targetInstanceId, Boolean isTimerSer...  1ad52fe0-5766-4a71-8991-e4aa0cb9b356
3887        02/18/2013 19:05:00.04*  OWSTIMER.EXE (0x0AA0)                     0x2C2C  SharePoint Foundation           Timer                           72ae  Unexpected  ...vice, Int32& result)  1ad52fe0-5766-4a71-8991-e4aa0cb9b356
3891        02/18/2013 19:05:00.05   OWSTIMER.EXE (0x0AA0)                     0x2C2C  SharePoint Foundation           Monitoring                      b4ly  Medium    Leaving Monitored Scope (Timer Job OfficeWebApplicationsCacheCreationJob). Execution Time=14.8229  1ad52fe0-5766-4a71-8991-e4aa0cb9b356
3892        02/18/2013 19:05:00.05   OWSTIMER.EXE (0x0AA0)                     0x2C2C  SharePoint Foundation           Performance                     nask  Monitorable  An SPRequest object was not disposed before the end of this thread.  To avoid wasting system resources, dispose of this object or its parent (such as an SPSite or SPWeb) as soon as you are done using it.  This object will now be disposed.  Allocation Id: {ADFDB253-11D8-4E24-806E-DF9C81239608}  To determine where this object was allocated, set Microsoft.SharePoint.Administration.SPWebService.ContentService.CollectSPRequestAllocationCallStacks = true.  1ad52fe0-5766-4a71-8991-e4aa0cb9b356

The problem is the "Office Web Apps Cache Creation" SP Job tries to run every 5 minutes but fails for some reason. The Cleanup job also fails that is scheduled to run daily.


Solution


I tried without luck:
  • modifying the Cache DB's settings with Set-SPOfficeWebAppsCache
  • moving the Cache Db onto a different Content Database
  • removing the Word Viewing Service Application
  • stopping Excel Calculation Services, PowerPoint Service, Word Viewing Service
  • disabling and re-enabling the Office Web Apps Site Collection Feature

Then, I mounted the Office Web Apps ISO, and started a repair. Rebooted the server and good to go! No more errors.



UPDATE: Don't forget to run the SharePoint 2010 Products Configuration Wizard after the installation if your search doesn't work.

How to Restore SharePoint MySites from Backup

The Story

On Friday I had a very bad surprise. All managers from the company were waked with this emails like:

Subject: The My Site of X Y is scheduled for deletion

The My Site of X Y is scheduled for deletion in 14 days. As their manager you are now the temporary owner of their site. This temporary ownership gives you access to the site to copy any business-related information you might need. To access the site use this URL: https://mysites.portal.domain.local/personal/xy


Pretty uncomfortable. The day before this I deleted the AD Sync Connection from SharePoint's User Profile Service Application and this caused it. The sync job ran and with no connections SP thought that all the users have been deleted.

Theoretically there should be 14 days until these profiles are deleted but for some reason I can't see past activity for the use users.

Long story short, I need to restore MySites from a backup.


The Process

The restoring process is simpler than thought. Later I found out that I had to restore the User Profile Service Application as well, I will detail that later.


Restoring MySites from Backup


1. Unmount the MySites Content Database 
Unmount the MySites content database by going to Central Administration -> Application Management -> Manage Content Databases.



Select the MySites Web Application on the right



Check Remove Content Database and click OK





2. Restore the Database in SQL Server Management Studio from backup


3. Add back the content database in Central Administration

Central Administration -> Application Management -> Manage Content Databases.

Select the Mysites Web Application on the right

Click on Add Content Database and fill out the form






I had another issue: The profiles' data was wiped. I am referring to the content seen under the marked tabs:




This data is stored in the User Profile Service Application's databases (Profile Database and/or Social Database, not sure). So these had to be restored as well.



Restoring the User Profile Service Application from Backup


The process is fairly simple as long as you have the SQL backups.


1. Stop the User Profile Service and User Profile Synchronization Service in Central Administration -> Manage Services on Server


2. Restore the Profile DB and Social DB from backup on the SQL Server
3. Start the User Profile Service and User Profile Synchronization Service in Central Admin.



Sunday, February 17, 2013

Centreon Not Sending Notification Emails

Problem


After finally installing Centreon 2.4 on CentOS 6.3, all was up and running, one issue I had left. No email notifications were sent when a host was down although everything seemed to be correctly configured from the GUI (contacts, notification period, etc).

Looking at  /var/log/maillog gave no hints.
But checking /usr/local/nagios/var/nagios.log was helpful.
[1361058638] HOST NOTIFICATION: Supervisor;Centreon2;DOWN;host-notify-by-email;CRITICAL - 192.168.189.59: Host unreachable @ 192.168.189.36. rta nan, lost 100%
[1361058638] Warning: Attempting to execute the command "/usr/bin/printf "%b" "***** centreon Notification *****\n\nType:PROBLEM\nHost: Centreon2\nState: DOWN\nAddress: 192.168.189.59\nInfo: CRITICAL - 192.168.189.59: Host unreachable @ 192.168.189.36. rta nan, lost 100%\nDate/Time: 17-02-2013" |  -s "Host DOWN alert for Centreon2!" email@gmail.com" resulted in a return code of 127.  Make sure the script or binary you are trying to execute actually exists...

There is no command before the -s and the pipe. This results in email delivery failure.


Solution


This can be fixed from the GUI.
In Centreon go to Configuration -> Commands, select Notifications from the left.
Two commands need to be edited: host-notify-by-email and service-notify-by-email.
The string /bin/mail has to be inserted after the pipe. Then, export Nagios settings. Of course this fix implies that running /bin/mail from the command line results in successful email delivery.





Saturday, February 16, 2013

Configuring SELinux for Centeron 2.4 on CentOS 6.3

  • CentOS 6.3 x64
  • Centreon 2.4

Problem


During Centreon installation when the tool starts up, the website is blank and nothing's happening.



I can observe the following error in /var/log/httpd/error_log:
[Sat Feb 16 18:07:58 2013] [error] [client 192.168.189.63] PHP Fatal error:  Smarty error: unable to write to $compile_dir '/usr/local/centreon/GPL_LIB/SmartyCache/compile'. Be sure $compile_dir is writable by the web server user. in /usr/local/centreon/GPL_LIB/Smarty/libs/Smarty.class.php on line 1095, referer: http://192.168.189.36/centreon/install/setup.php

Other errors can also be seen in the log but those are irrelevant:
[Sat Feb 16 18:29:29 2013] [error] [client 192.168.189.63] PHP Fatal error:  require_once(): Failed opening required 'www/class/centreonXMLBGRequest.class.php' (include_path='.:/usr/share/pear:/usr/share/php') in /usr/local/centreon/www/include/monitoring/status/TopCounter/xml/ndo/statusCounter.php on line 43, referer: http://192.168.189.36/centreon/main.php?p=61701&num=1&limit=30&poller=&template=&search=&type=&o=&search_type_service=1&search_type_host=1&search_service=
[Sat Feb 16 18:29:31 2013] [error] [client 192.168.189.63] PHP Warning:  include_once(/etc/centreon/centreon.conf.php): failed to open stream: No such file or directory in /usr/local/centreon/www/include/monitoring/status/TopCounter/xml/ndo/statusCounter.php on line 41, referer: http://192.168.189.36/centreon/main.php?p=604
[Sat Feb 16 18:29:31 2013] [error] [client 192.168.189.63] PHP Warning:  include_once(): Failed opening '/etc/centreon/centreon.conf.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /usr/local/centreon/www/include/monitoring/status/TopCounter/xml/ndo/statusCounter.php on line 41, referer: http://192.168.189.36/centreon/main.php?p=604
[Sat Feb 16 18:29:31 2013] [error] [client 192.168.189.63] PHP Notice:  Undefined variable: centreon_path in /usr/local/centreon/www/include/monitoring/status/TopCounter/xml/ndo/statusCounter.php on line 43, referer: http://192.168.189.36/centreon/main.php?p=604
[Sat Feb 16 18:29:31 2013] [error] [client 192.168.189.63] PHP Warning:  require_once(www/class/centreonXMLBGRequest.class.php): failed to open stream: No such file or directory in /usr/local/centreon/www/include/monitoring/status/TopCounter/xml/ndo/statusCounter.php on line 43, referer: http://192.168.189.36/centreon/main.php?p=604
[Sat Feb 16 18:29:31 2013] [error] [client 192.168.189.63] PHP Fatal error:  require_once(): Failed opening required 'www/class/centreonXMLBGRequest.class.php' (include_path='.:/usr/share/pear:/usr/share/php') in /usr/local/centreon/www/include/monitoring/status/TopCounter/xml/ndo/statusCounter.php on line 43, referer: http://192.168.189.36/centreon/main.php?p=604
[Sat Feb 16 18:33:46 2013] [error] [client 192.168.189.63] PHP Fatal error:  require_once(): Failed opening required 'www/class/centreonXMLBGRequest.class.php' (include_path='.:/usr/share/pear:/usr/share/php') in /usr/local/centreon/www/include/monitoring/status/TopCounter/xml/ndo/statusCounter.php on line 43, referer: http://192.168.189.36/centreon/main.php?p=604

Solution


SELinux blocks httpd to write in any folder other than /var/www/ and some exceptions have to be made.

Configuring SELinux for Centeron 2.4 on CentOS 6.3

yum -y install policycoreutils-python
semanage fcontext -a -t httpd_sys_rw_content_t "/usr/local/centreon(/.*)?"
restorecon -R /usr/local/centreon/
semanage fcontext -a -t httpd_sys_rw_content_t "/etc/centreon(/.*)?"
restorecon -R /etc/centreon
semanage fcontext -a -t httpd_sys_rw_content_t "/usr/local/nagios/var/spool(/.*)?"
semanage fcontext -a -t httpd_sys_content_t "/usr/local/nagios/share(/.*)?"
restorecon -R /usr/local/nagios
semanage fcontext -a -t httpd_sys_content_t "/usr/share/php(/.*)?"
restorecon -R /usr/share/php
semanage fcontext -a -t httpd_sys_content_t "/usr/share/pear(/.*)?"
restorecon -R /usr/share/pear
#

You may want to check out my blog post on Installing Centreon 2.4 on CentOS 6.3 x64.

Installing Centreon 2.4 on CentOS 6.3 x64 - Step by Step - Part 2

This is the continuation of Installing Centreon 2.4 on CentOS 6.3 x64 - Step by Step

Preparing MySQL

## Add innodb_file_per_table=1 under the [mysqld] section in my.cnf
vim /etc/my.cnf

## then
service mysqld start
chkconfig mysqld on
# 

Installing Centreon

#
service httpd start
groupadd centreon
useradd -g centreon centreon
cd /usr/local/src/
wget http://download.centreon.com/index.php?id=4264

tar -zxf centreon-2.4.0.tar.gz
cd centreon-2.4.0
export PATH="$PATH:/usr/local/nagios/bin/"

# create an answer file with the following contents:
vim ./answer
#
And create the answer file with the following content:
## CentWeb: Web front Centreon for Nagios
PROCESS_CENTREON_WWW=1
## CentStorage: Log and charts archiving.
PROCESS_CENTSTORAGE=1
## CentCore: Distributed Monitoring engine.
PROCESS_CENTCORE=1
## CentPlugins: Centreon Plugins for nagios
PROCESS_CENTREON_PLUGINS=1
## CentTraps: Centreon Snmp traps process for nagios
PROCESS_CENTREON_SNMP_TRAPS=1

#####################################################################
## Begin: Default variables
#####################################################################
## Your default variables
## $BASE_DIR is the centreon source directory
LOG_DIR="$BASE_DIR/log"
LOG_FILE="$LOG_DIR/install_centreon.log"

## Don't change values above unless you perfectly understand
## what you are doing.
## Centreon temporary directory to work
TMP_DIR="/tmp/centreon-setup"
## default snmp config directory
SNMP_ETC="/etc/snmp/"
## a list of pear modules require by Centreon
PEAR_MODULES_LIST="pear.lst"
#####################################################################
## End: Default variables
##################################################################


#####################################################################
## Begin: Centreon preferences
#####################################################################
## Above variables are necessary to run a silent install
## Where you want to install Centreon (Centreon root directory)
INSTALL_DIR_CENTREON="/usr/local/centreon"
## Centreon log files directory
CENTREON_LOG="/usr/local/centreon/log"
## Centreon config files
CENTREON_ETC="/etc/centreon"
## Where is your Centreon binaries directory ?
CENTREON_BINDIR="/usr/local/centreon/bin"
## Where is your Centreon data informations directory ?
CENTREON_DATADIR="/usr/local/centreon/data"
## Centreon generation config directory
##  filesGeneration and filesUpload
## Where is your Centreon generation_files directory ?
CENTREON_GENDIR="/usr/local/centreon"
## libraries temporary files directory
## Where is your Centreon variable library directory ?
CENTREON_VARLIB="/var/lib/centreon"
## Where is your CentPlugins Traps binary?
CENTPLUGINSTRAPS_BINDIR="/usr/local/centreon/bin"
## Where is the RRD perl module installed [RRDs.pm]
## ATTENTION: ON x64 SYSTEMS THE PATH IS LIB64 INSTEAD OF LIB
##               vv
RRD_PERL="/usr/lib64/perl5"
## What is the Centreon group ?
CENTREON_GROUP="centreon"
## What is the Centreon user ?
CENTREON_USER="centreon"
## What is the Monitoring engine user ?
MONITORINGENGINE_USER="nagios"
## What is the Monitoring engine group ?
MONITORINGENGINE_GROUP="nagios"
## What is the Monitoring engine log directory ?
MONITORINGENGINE_LOG="/usr/local/nagios/var"
## Where is your monitoring plugins (libexec) directory ?
PLUGIN_DIR="/usr/local/nagios/libexec"
## Path to sudoers file (optional)
## Where is sudo configuration file
SUDO_FILE="/etc/sudoers"
## What is the Monitoring engine init.d script ?
MONITORINGENGINE_INIT_SCRIPT="/etc/init.d/nagios"
## What is the Monitoring engine binary ?
MONITORINGENGINE_BINARY="/usr/local/nagios/bin/nagios"
## What is the Monitoring engine configuration directory ?
MONITORINGENGINE_ETC="/usr/local/nagios/etc"
## Where is the configuration directory for broker module ?
BROKER_ETC="/usr/local/nagios/etc"
## Where is the init script for broker module daemon ?
BROKER_INIT_SCRIPT="/etc/init.d/ndo2db"
## Do you want me to configure your sudo ? (WARNING)
FORCE_SUDO_CONF=1

#####################################################################
## Begin: Apache preferences
#####################################################################
## Apache configuration directory (optional)
#DIR_APACHE="/etc/apache"
## Apache local specific configuration directory (optional)
## Do you want to update Centreon Apache sub configuration file ?
# DIR_APACHE_CONF="/etc/apache/conf.d"
## Apache configuration file. Only file name. (optional)
#APACHE_CONF="apache.conf"
## Apache user (optional)
WEB_USER="apache"
## Apache group (optional)
WEB_GROUP="apache"
## Force apache reload (optional): set APACHE_RELOAD to 1
## Do you want to reload your Apache ?
APACHE_RELOAD=1
#####################################################################
## End: Apache preferences
#####################################################################


## Do you want me to install/upgrade your PEAR modules
PEAR_AUTOINST=1
## Centreon run dir (all .pid, .run, .lock)
## Where is your Centreon Run Dir directory?
CENTREON_RUNDIR="/var/run/centreon"

## path to centstorage binary
## Where is your CentStorage binary directory
CENTSTORAGE_BINDIR="/usr/local/centreon/bin"
## CentStorage RRDs directory (where .rrd files go)
## Where is your CentStorage RRD directory
CENTSTORAGE_RRD="/var/lib/centreon"
## Do you want me to install CentStorage init script ?
CENTSTORAGE_INSTALL_INIT=1
## Do you want me to install CentStorage run level ?
CENTSTORAGE_INSTALL_RUNLVL=1


## path to centcore binary
CENTCORE_BINDIR="usr/local/centreon/bin"
## force install init script (install in init.d)
## Set to "1" to enable
## Do you want me to install CentCore init script ?
CENTCORE_INSTALL_INIT=1
## force install run level for init script (add all link on rcX.d)
## Set to "1" to enable
## Do you want me to install CentCore run level
CENTCORE_INSTALL_RUNLVL=1

## Some plugins require temporary datas to process output.
## These temp datas are store in the CENTPLUGINS_TMP path.
## Where is your CentPlugins lib directory
CENTPLUGINS_TMP="/var/lib/centreon/centplugins"

## path for snmptt installation
SNMPTT_BINDIR="/usr/local/centreon/bin/"
## What is the Broker user ? (optional)
BROKER_USER=$MONITORINGENGINE_USER

## Nagios user (optional)
NAGIOS_USER="nagios"
## Nagios group (optional)
NAGIOS_GROUP="nagios"
## Centreon Connector PATH
## Mail (optional)
BIN_MAIL="/bin/mail"
## 
Save the file and you're ready to install.
# install using the answer file
./install.sh -f ./answer

# After installation configure SELinux
yum -y install policycoreutils-python
semanage fcontext -a -t httpd_sys_rw_content_t "/usr/local/centreon(/.*)?"
restorecon -R /usr/local/centreon/
semanage fcontext -a -t httpd_sys_rw_content_t "/etc/centreon(/.*)?"
restorecon -R /etc/centreon
semanage fcontext -a -t httpd_sys_rw_content_t "/usr/local/nagios/var/spool(/.*)?"
semanage fcontext -a -t httpd_sys_content_t "/usr/local/nagios/share(/.*)?"
restorecon -R /usr/local/nagios/
semanage fcontext -a -t httpd_sys_content_t "/usr/share/php(/.*)?"
restorecon -R /usr/share/php
semanage fcontext -a -t httpd_sys_content_t "/usr/share/pear(/.*)?"
restorecon -R /usr/share/pear

# Restart some services
service httpd restart
service ndo2db restart
service nagios restart
#

When the installation is finished, open http://server/centreon/ in the browser.

Next, Next




At the third page:

  • Nagios directory: /usr/local/nagios/
  • Nagiostats binary: /usr/local/nagios/bin/nagiostats
  • Nagios image directory: /usr/local/nagios/share/images

At the forth page:
  • Broker Module: ndoutils
  • Ndomod binary (ndomod.o): /usr/local/nagios/bin/ndomod.o

At the fifth page enter the details of the admin user.


At the 6th page you have to specify the db details. By default the mysql root password is blank.


After finishing the setup there'll be something wrong with the db so you'll have to go back to the shell to grant permissions for the centreon db user.


#
mysql -e "grant all on centreon.* to 'centreon'@localhost identified by 'CentreonDBPassword';"
mysql -e "grant all on centreon_storage.* to 'centreon'@localhost identified by 'CentreonDBPassword'"
mysql -e "grant all on centreon_status.* to 'centreon'@localhost identified by 'CentreonDBPassword';"
#

Friday, February 15, 2013

Perl module Test-Simple-0.70 fails to build while compiling Nagios Plugins 1.4.16


  • CentOS 6.3 x64
  • Nagios-Plugins-1.4.16


Problem


While compiling nagios-plugins-1.4.16:
cd /usr/local/src
tar -xzf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl=/usr/bin/openssl --enable-perl-modules
make
make install
The following error shows up at the end of make install:
make[3]: Entering directory `/usr/local/src/nagios-plugins-1.4.16/perlmods/Test-Simple-0.70'
make[3]: *** No rule to make target `install'.  Stop.
make[3]: Leaving directory `/usr/local/src/nagios-plugins-1.4.16/perlmods/Test-Simple-0.70'
Can't run make install at ../tools/build_perl_modules line 85.
make[2]: *** [install-exec-local] Error 2
make[2]: Leaving directory `/usr/local/src/nagios-plugins-1.4.16/perlmods'
make[1]: *** [install-am] Error 2
make[1]: Leaving directory `/usr/local/src/nagios-plugins-1.4.16/perlmods'
make: *** [install-recursive] Error 1

Solution


Build the Test-Simple-0.70 package manually then make install the nagios-plugins again:

#inside the extracted nagios-plugins that is being built
cd nagios-plugins-1.4.16/perlmods/Test-Simple-0.70
perl Makefile.PL
make
make install

# go back to nagios-plugins to make install
cd ../..
make install

You may want to check out my blog post on Installing Centreon 2.4 on CentOS 6.3 x64.