Showing posts with label Scientific Linux 6. Show all posts
Showing posts with label Scientific Linux 6. Show all posts

Friday, June 22, 2012

Nagios issues, duh.

I went to go pull up the Nagios web interface yesterday and to my surprise received a "Error: Could not read object configuration data!". Troubleshooting here we come!

First things first, check the process
 # /etc/init.d/nagios status  
 nagios is stopped  


Not running? Odd. ok, start it up
 # /etc/init.d/nagios start  
 nagios is stopped  
 Configuration validation failed              [FAILED]  


Hmm.
 # /usr/bin/nagios -v /etc/nagios/nagios.cfg  
 Checking...  
  Total Warnings: 0  
 Total Errors:  0  
 Things look okay - No serious problems were detected during the pre-flight check  


So, I checked the log files and they are all from past dates, including nothing from the last day or so.
 # cat /var/log/nagios/nagios.log | perl -pe 's/(\d+)/localtime($1)/e' | less  

Nifty perl script there to fix the dates, but it's not mine, just a web snippet.


 I was stumped. Then I had a thought, SELinux errors...
 # getenforce  
 Enforcing

Ok, 
 # setenforce permissive 


and give it another shot,
 # /etc/init.d/nagios start  
 nagios is stopped  
 Starting nagios:                      [ OK ]  


As they say on Afrotechmods,


A lot of folks disable SELinux in their environments as it can get rather complicated. However, for this issue I was able to dig up this post regarding setting up a new type definition for Nagios, but haven't yet tried it myself.

http://fportase.wordpress.com/selinux-policies/nagios-and-rhel-5-xx-and-6-xx-working-with-selinux-enabled/

Thursday, March 22, 2012

Quick Configurations Make For Trouble

I'm a few days behind in my studies for the RHCSA. I've scheduled the exam which has the added effect of pressure to be done within a certain time frame even though, I can of course, reschedule. Who wants to do that though!

For labbing I enabled X11 over SSH and am running GUI tools like virt-manager and system-config-firewall (iptables shell commands changed with RHEL 6 and I'm working on gotten it all sorted out) while not at home. Even at home though, I connect via VNC from my Mac Pro to the VM server.


The VM server built with Scientific Linux 6 and Tigervnc (quasi Xvnc)  is their default VNC server from their SL repo. So, it is what I went with to get things up quickly.

[root@shuttlehosti ~]# yum search vnc server
...
tigervnc-server.x86_64 : A TigerVNC server
...
[root@shuttlehosti ~]# yum install tigervnc-server.x86_64
Done.

Ok, I installed, configured it under my user account, according to this post from server-world.info. Then checked to see if it was persistent through reboots and it wasn't. That's fine. I only wanted my user account to be able to have access, I wrote a super simple bash script and dropped it in my .bashrc file.

[root@shuttlehosti ~]# less /home/kim/vnc-start.sh

#!/bin/bash

vncserver :1 -geometry 1280x1024 -depth 24
/home/kim/vnc-start.sh (END)

...
[root@shuttlehosti ~]# less /home/kim/.bashrc

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# User specific aliases and functions
/home/kim/vnc-start.sh
/home/kim/.bashrc (END)

Each time I log in to the machine it launches the vnc service for display :1 and fails out if display :1 is already open. Great until I have more time to focus on shell scripting. 

Yesterday, I started having issues with the VNC server and my connection attempts were getting refused. I would log out or reboot and try the connection and get be refused. Ok, disable IPtables, SELinux and try it again. Still nothing. Even running "vncserver -kill :1" didn't stop the process or allow me to log in.

So, whats the vnc process up to?  I do a

[root@shuttlehosti ~]#ps -efH | grep vnc
qemu      7458     1  0 Mar08 ?        00:01:28   /usr/libexec/qemu-kvm ...

 There are three processes just like that. Hmm 3 VMs up and running. Which means each VM  takes up a single vnc display when up and running. Curious. I checked out the VNC command options and came up with:

[kim@shuttlehosti ~]$ vncserver -list

TigerVNC server sessions:

X DISPLAY #     PROCESS ID
:2              5931
:1              4007
:3              4206
[kim@shuttlehosti ~]$

The processes correspond to the VM processes noted in the ps command. Jeez. Ok, I shutdown the VMs, kill off the vnc process if any are left, relaunch the vnc process under my user account, and it works like a charm.

The moral of the story? Don't rush through Linux technologies when you need to " to get things up quickly."

So, RHCSA studies can resume. After the exam I would like to figure out how to write a shell script to check for the next available vnc display and to open a IPtables port to allow for connection.