Saturday, August 31, 2013

gangalia rrd graph is broken (shown with gap on time scale)



Problem : gangalia rrd graph is broken (shown with gap on time scale)

In my case, after upgraded to latest ganglia version, my rrd graphs were like this:



It took a while to find out that 2 unintended changes went into gmetad.conf.

[1]  RRAs has been relplaced with default one. To understand RRAs and RRD database file, read this article. RRD is a circular buffer.

ganglia gmetad polls gmond in every 15 seconds (default). My below RRAs will create 2 circular buffer in RRD database file.

     RRAs    "RRA:AVERAGE:0.5:1:172800"   "RRA:AVERAGE:0.5:24:87600


  • ·         Write value in every polling interval (:1: ) and save last 172800 sample. Thus, 15 seconds x 172800 sample / (3600 second x 24 hours) = 30 days. It will store 30 days data of 15 second resolution.

  • ·       Write once sample by averaging value of 24 polls (:24:) (24 sec x 15 sec = 6 min) and save last 87600 samples. 6 min x 87600 sample / (60 min x  24 hr ) = 365 days . This It will store 1 year data of 6 min resolution.

RRD database files were created with new RRAs values for the systems added after ganglia upgrade. So some of systems, RRD database files were different than other systems' RRD files.
 
[2] There was no polling interval defined for cluster data_source (polling interval is 15 second, if not mentioned). But in new config file, it was 120. (either remove 120 or replace with 15)

         data_source app_cluster 120 appsystem01 appsystem02 appsystem03

Did you find any other fix for same problem ?
 



Tuesday, August 27, 2013

Redhat Satellite CLI API spacecmd

spacecmd is very useful API  to do changes in redhat satellite. Unfortunately, it is not well documented. Some useful command are listed here to explain concept of spacecmd api.

Once spacecmd rpm is installed, you will be able to list all sub-commands using below.

# spacecmd --username=nasimuddin.ansari help

System Information


  • To get all system managed in Stellite

# spacecmd --username=nasimuddin.ansari system_list


  • To get details of a system

# spacecmd system_details

Software Channels


  • To add a child channel to a system

# spacecmd system_addchildchannels

Config Channel


  • Add a config channel to system

# spacecmd system_addconfigchannels  

Packages


  •  To get list of all system installed with with rpm starting with ganglia-gmond

# spacecmd --username=nasimuddin.ansari "package_listinstalledsystems ganglia-gmond"

Network

  •  To get the IP address of all registered systems
# spacespacecmd --username=nasimuddin.ansari report_ipaddresses 

git : rebate a branch onto a commit

First understand what is difference between merge and rebase . Let us see how to rebase a branch to a particular commit.

I have committed three changes. When I am in alphabranch, I can see three commits 83fc543 ,  0e6b2fe , 26e6ec2 

$  git checkout alphabranch
Switched to branch 'alphabranch'

$  git log --graph --decorate --oneline -n5
* 83fc543 (HEAD, alphabranch) third commit on third_file.txt
* 0e6b2fe (betabranch) second commit for second_file.txt
* 26e6ec2 first commit for first_file.txt
* b3a6800 (gerrit/master, gerrit/HEAD) your college submitted some patch
* 3d1bb52 (master) boss has submitted fix


Let us create a  gamabranch branch from *master*.  You will not have above three commit in new gamabranch . This branch will be at master HEAD commit 3d1bb52 

$  git checkout -b gamabranch master        ## From master
Switched to branch 'gamabranch'

$  git log --graph --decorate --oneline -n5
* 3d1bb52 (HEAD, master, gamabranch) boss has submitted fix
* bb7ebab change for system foo config file
* 244c06f patch for video diplay driver


Now rebase gamabranch to commit 0e6b2fe. It will rebase new branch with changes commited in 0e6b2fe and plus its in-line predecessors commits.

$  git rebase 0e6b2fe 
First, rewinding head to replay your work on top of it...
Fast-forwarded gamabranch hto 0e6b2fe.

$  git log --graph --decorate --oneline -n5
0e6b2fe (HEAD, gamabranch, betabranch) second commit for second_file.txt
26e6ec2 first commit for first_file.txt
* b3a6800 (gerrit/master, gerrit/HEAD) your colleage submitted some patch
* 3d1bb52 (master) boss has submitted fix
* bb7ebab change for system foo config file

git review : dealing with - You have more than one commit that you are about to submit

In git + gerrit, you get below message while trying to submit change for review. How to deal with this if you just want to submit only one commit for review not all ?

$  git review -n
You have more than one commit that you are about to submit.
The outstanding commits are:

0e6b2fe (HEAD, betabranch) second commit for second_file.txt
26e6ec2 first commit for first_file.txt

Is this really what you meant to do?
Type 'yes' to confirm: no
Aborting.

You need to move the commit you want to submit for review to another branch and submit it. See below article how to move a commit to another branch.

http://techmolecules.blogspot.sg/2013/08/git-cherry-pick-move-selected-commit-to.html

Tuesday, August 20, 2013

git cherry-pick : move a selected commit to another branch

This git post is to demonstrate :
1 - use git cherry-pick to move a selected commit (among many commit of a brnach ) to amother from
2 - git review : just one commit out of many commit to gerrit code review

Working Bed:

Clone you central repo to your local system. create a branch alphabranch create a file first_file.txt and commit it.

$ git clone ssh://gerrit:29418/centralrepo.git mygitrepo
Initialized empty Git repository in /home/nasimuddin.ansari/git/mygitrepo/.git/
remote: Counting objects: 8272, done
remote: Finding sources: 100% (8272/8272)
remote: Total 8272 (delta 3517), reused 7971 (delta 3517)
Receiving objects: 100% (8272/8272), 1.31 MiB | 932 KiB/s, done.
Resolving deltas: 100% (3517/3517), done.

$ cd mygitrepo/

$  git checkout -b alphabranch
Switched to a new branch 'alphabranch'

$  git branch
* alphabranch
  master

$  date >first_file.txt

$  git status
# On branch alphabranch
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       first_file.txt
nothing added to commit but untracked files present (use "git add" to track)

$  git add first_file.txt

$  git status
# On branch alphabranch
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       new file:   first_file.txt
#

$  git commit -m"first commit for first_file.txt"
[alphabranch 1e9f56d] first commit for first_file.txt
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 first_file.txt

$  git log -1
commit 1e9f56d5e1acdf90360ddf553dd47cdc15071173
Author: Nasimuddin Ansari <nasimuddin.ansari@company.com>
Date:   Tue Aug 20 07:26:50 2013 +0000

    first commit for first_file.txt


Create a second file, do second commit and then create third file and do third commit in same branch alphabranch.

$  cal >second_file.txt
$  git add second_file.txt &&  git commit -m"second commit for second_file.txt"
$  cal 2013 >third_file.txt
$  git add third_file.txt && git commit -m"third commit on third_file.txt"

$  git log --graph --decorate --oneline -n3
d60352(HEAD, alphabranch) third commit on third_file.txt
e30f0b second commit for second_file.txt
1e9f56 first commit for first_file.txt


$  git status
# On branch alphabranch
nothing to commit (working directory clean)

 Now it is time to submit it for gerrit review. I just want to submit only second commit for review for the moment. On first and 3rd I need to do some more changes before submitting for review. Do a dry run and you know the problem - all three commits are listing in git review list !



$  git review -n
You have more than one commit that you are about to submit.
The outstanding commits are:

d60352(HEAD, alphabranch) third commit on third_file.txt
e30f0b second commit for second_file.txt
1e9f56 first commit for first_file.txt

Is this really what you meant to do?
Type 'yes' to confirm:no

I  just want to submit second commit for review.

git cherry-pick : moving a selected commit to new branch

Create a  commitbranch branch from master

$  git checkout -b commitbranch master
Switched to a new branch 'commitbranch'

$  git log --graph --decorate --oneline -n5
* 3d1bb52 (HEAD, master, commitbranch) boss has submitted fix
* bb7ebab change for system foo config file

Switch to alphabranch and find out commit ID you want to move to commit branch

$  git checkout alphabranch
Switched to branch 'alphabranch'

$  git log --graph --decorate --oneline -n3
d60352(HEAD, alphabranch) third commit on third_file.txt
e30f0b second commit for second_file.txt
1e9f56 first commit for first_file.txt


Now switch to commitbranch and do cherry-pick on second commit's ID.

$  git checkout commitbranch
Switched to branch 'commitbranch'

$  git cherry-pick e30f0b
Finished one cherry-pick.
[commitbranch c957988] second commit for second_file.txt
 1 files changed, 8 insertions(+), 0 deletions(-)
 create mode 100644 second_file.txt
                            ( Commit ID will change !)

$  git log --graph --decorate --oneline -n3
* c957988 (HEAD, commitbranch) second commit for second_file.txt
* 3d1bb52 (master) boss has submitted fix
* bb7ebab change for system foo config file


Now you are good to submit only one change for review. Do a dry run and submit it !

$  git review -n
Please use the following command to send your commits to review:

        git push gerrit HEAD:refs/publish/master/commitbranch

$ git review

                              Did this post help anyone ?

git - uncommiting last commit

--soft : uncommit all changes and move back to stage state



Create a new file, stage it (add), commit it and do soft reset HEAD^

$ git branch
* master

$ git checkout -b a_branch
Switched to a new branch 'a_branch'

$ git log --graph --decorate --oneline -n3
* 3d1bb52 (HEAD, master, a_branch) Noh has build ship
* bb7ebab this is john sermon

$ cal 2013 > a_test_file.txt

$ git status
# On branch a_branch
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       a_test_file.txt

$ git add a_test_file.txt

$ git status
# On branch a_branch
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       new file:   a_test_file.txt
#

$ git commit -m"a new change commited in a_test_file.txt"
[a_branch c1a194c] a new change commited in a_test_file.txt
 1 files changed, 35 insertions(+), 0 deletions(-)
 create mode 100644 a_test_file.txt

$ git log --graph --decorate --oneline -n3
* c1a194c (HEAD, a_branch) a new change commited in a_test_file.txt
* 3d1bb52 (master) Noh has build ship
* bb7ebab this is john sermon

$ git reset --soft HEAD^

$ git log --graph --decorate --oneline -n3
* 3d1bb52 (HEAD, master, a_branch) Noh has build ship
* bb7ebab this is john sermon


$ git status
# On branch a_branch
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       new file:   a_test_file.txt
#


--hard : discard all changes permanently ! 

All new files will be deleted and modification to all file will disappear (you cannot recover !)

Commit newly created import file and do --hard reset to make your life hell !

$ git commit -m"a new change commited in a_test_file.txt"
[a_branch 8a59c62] a new change commited in a_test_file.txt
 1 files changed, 35 insertions(+), 0 deletions(-)
 create mode 100644 a_test_file.txt

$ git log --graph --decorate --oneline -n3
* 8a59c62 (HEAD, a_branch) a new change commited in a_test_file.txt
* 3d1bb52 (master) Noh has build ship
* bb7ebab this is john sermon

$ git reset --hard HEAD^
HEAD is now at 3d1bb52 Noh has build ship
$ git log --graph --decorate --oneline -n3
* 3d1bb52 (HEAD, master, a_branch) Noh has build ship
* bb7ebab this is john sermon


$ git status
# On branch a_branch
nothing to commit (working directory clean


You file has been permanently deleted by Mr   --hard !

Saturday, August 17, 2013

php-gd installation fails because of libjpeg.so.62 though it is installed

Problem : php-gd installation fails on rhel6 because of libjpeg.so.62 though libjpeg-6b-46.el6.x86_64 is installed.


# /usr/bin/yum -d 0 -e 0 -y install php-gd-5.3.3-22.el6
Error: Package: php-gd-5.3.3-22.el6.x86_64 (qa-redhat-x86_64-6-repository)
           Requires: libjpeg.so.62(LIBJPEG_6.2)(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
#rpm -qf /usr/lib64/libjpeg.so.62
libjpeg-6b-46.el6.x86_64



Solution : Install libjpeg-turbo along with other installed package since libjpeg-6b-4 is replaced with libjpeg-turbo

# yum install php-gd libjpeg-turbo


Referencehttps://access.redhat.com/site/solutions/324053

Did it help you ?