Checking you backups with Nagios (opensuse or rpm system)
While trying to figure out how to check my backups with Nagios, I found many sites that went straight into the scripts without going into detail on the installs required from the Nagios side.
This is just a quick overview of the process. Links to some of the detailed scripts are at the bottom of this post.
An add on module called NSCA ((Nagios Service Check Acceptor) is required. NSCA is an addon that allows you to send passive check results from remote Linux/Unix hosts to the Nagios daemon. Nagios calls these Passive checks.
There are two rpm’s:-
- nagios-nsca-client (installed where your scripts need to report their status to Nagios)
- nagios-nsca (installed on the same machine as the Nagios installation)
The Nagios daemon (2) has a start script in init.d. Be sure to add it to the system services that run on startup.
The client (1) has an send_nsca executable which is used to send the required status information.
/usr/bin/send_nsca –help helped me more that mosts tutorials!
An example of standard input accepted by this command separated by tabs:-
- hostname servicename 0 OK: backup was successful
Nagios config – host and service definitions
By default the Nagios rpm allows active checks in nagios.cfg file but you need to
set check_external_commands=1 otherwise nagios does not create the nagios.cmd file.
.
Host definition
You need to add
- passive_checks_enabled 1
Service definition
You need to add
- passive_checks_enabled 1
and if you want Nagios to report that is has not received updates for a certain period of time you add
- check_freshness 1
- freshness_threshold
- active_checks_enabled 1
Nagios has a check_dummy script which is useful in this regard. Again –help is a friend.
- check_command check_dummy!1 “No Data from backup”
A reminder of Nagios error codes
- 0 success
- 1 warning
- 2 critical
Remember to allow port 5667 through the firewall.
Sources with examples:-
Passive checks with Nagios
Monitor mysql backup
Learning Nagios-Passive Checks Chapter
RT is to twitter as RP is to blog
This hit home. Thought I’d repeat it.
Adultery
Adultery is the most selfish, destructive and hateful thing a person can do.
It’s funny what you don’t know going in.
Or what you choose to ignore.
And it’s tragic that you don’t realize until it’s too late, until what’s done is done, how utterly wasted a life can be. How hopeless hopeless can become. How the promise and joy of life can slip like water through guilty hands.
Hell is merely realizing what you’ve done.
Mostly to others, but ultimately to yourself.
Hell is the flash of memory, snippets and snapshots of a happy spouse, a newlywed or new mother, pleased and pledged her future and hopes tied to you. Her whole life in all its stages gambled on you. The very nature, substance and quality of her life, through all its years, depending on a promise you have casually or repeatedly broken.
How you can take an hour or a decade of selfishness and condemn an innocent person to a lifetime of loneliness and disappointment.
How you can steal someone’s dream and leave it tattered and stained, unrecognizable and unsalvageable. And not just any someone. The one person who has given you more than any other. The only one who truly understands you and cares about you, and who proved it by giving herself to you. By having faith in you and supporting you. By taking your name and taking your fate.
That’s the one you destroy.
It’s an emotional murder. The snuffing out of a life that should have been lived. Not the stopping of a heart, but the breaking of a heart. Taking the “happily” out of “happily ever after.” It’s an emotional murder.
And that’s the hell.
For you because you deserve it, and for her because she doesn’t.
Then there are the children.
Innocents whose lives are forever and unfairly changed. Who have a mommy and a daddy one day, but not the next. At least not in a real way. Not in the way they are supposed to. No Christmases and family reunions and weddings and graduations, no family nights around the dinner table or the TV, it’s all just shattered and broken.
You’d kill someone who hurt your children a fraction of how badly you’ve hurt them, and yet you’ve done it, and they tell you it’s OK but you know it’s not and you’ve done it and you can’t run away from it and Humpty Dumpty can’t be put back together again.
And children cry.
When they are young, and decades later when they are old.
The family died, and daddy did it.
That’s the hell.
Realizing that.
Realizing that you did that to them. That you have returned hate for love, betrayal for trust, evil for good.
You have broken the only promise you really had to keep. And in the world of cause and effect they reap the harvest you have sown.
Adultery isn’t something you do with another person, it is something you do to your family. To the hopes and lives of the only people who will ever really matter to you.
It is a blind and hateful selfishness, a universe out of kilter, an arrogance of priority and interest. You are all that matters, nothing else counts, and you have everything backwards.
And it seals you off until you are alone and they don’t have you even if you are in their midst. Ultimately you rot so much that it collapses, the marriage and the family, and out you spin, not realizing a fraction of what you’ve done and who you’ve hurt and what you’ve lost.
But it comes eventually. In the dark of the night, in the realizations of the soul, in the honesty of humility.
And you can’t think about what you’ve lost, because you’re too ashamed of what you’ve taken. Ashamed and anguished and wrong.
And that is hell. The realization of what you’ve done. Of who you’ve hurt. Of the damage you’ve caused. Of the fact it’ll never go away.
That is the lake of fire and brimstone.
You realize that life was a test.
And you failed.
You failed your family.
Adultery brings nothing but sorrow and pain. The likes of which words cannot communicate and imagination cannot conjure.
“Thou shalt not commit adultery” was not a restriction, it was a warning.
Which only fools fail to heed.
– by Bob Lonsberry © 2004
imagemagick tile all images to same height
To get Imagemagick to tile a set of different sized images to
- the same height (79 pixels)
- keeping aspect ratio
- with no space in between
- flipping just one of the images (img2)
use:-
convert -resize x79 +append img1.jpg img2.jpg \( -flop \) img3.jpg img4.jpg outputImg.jpg
Use -append for a column.
Integer.getInteger(“2″)=null ….. HUH?
This has got to be the worst named method I have ever encountered. Seriously, how many people have been caught out by this?

Integer.getInteger(“2″)=null
but
Integer.getInteger(“sun.arch.data.model”)=32
and
Boolean.getBoolean(“true”)=false
Most unexpected.
More detail at this blog: Integer.getInteger. Are you kidding me?
Wow, couldn’t figure out why eclipse was ignoring the clipboard. Appears to be a Klipper issue. Must have coincided with my KDE upgrade.
CRUD Application funny
This went unnoticed in our application for 2 years!! LOL

password field funny
What was the developer thinking?

password field code - richfaces
scp/sftp, ssh-agent and cron quickest solution
When working with public/private keys and scp the most common solution appears to be using an empty password while generating the key.
I did not like this solution much.
Using ssh-agent is fine until you try to run a cron job. Then this ssh-agent isn’t found.
Some caveats when using ssh-add after running the agent.
dcrx@someserver:~$ ssh-add
Could not open a connection to your authentication agent.
to find the agent you need to be aware of it.
There seems to be more than one way of doing this and therein lies the solution. (note the backticks)
- exec ssh-agent bash
- eval `ssh-agent`
- nohup ssh-agent; chmod a+x nohup.out; . nohup.out
The last command is useful as the output of ssh-agent is to export put the required environment variables. These variables are all that is needed (once ssh-add has been used) to enable your scripts to execute in cron. Provided of coursem it is in the current users cron.
Just add . /path/to/nohup.out to your cron script and until the machine gets rebooted or ssh-agent dies for whatever reason you are not using empty passwords and not passing passwords around.
Sweet.
I’m starting to hate this database
Really ….. postgresql rocks!!!
Mysql: delete from table based on records in another
mysql does not seem to be happy with having or join in a delete query.
I ended up having to join in the where clause and join to the same table thrice! Oh well, it did what I needed.
update measurementunit_strategygroup musg, measurementunit mu3
set musg.measurementUnit_id =
(select min(mu1.id) from measurementunit mu1, measurementunit mu2 where mu1.unit=mu2.unit and mu1.description=mu2.description and mu3.id=mu2.id group by mu1.unit, mu2.id)
where mu3.id=musg.measurementUnit_id
It also seemed to have issues deleting the duplicates in the original table with other databases standard queries for this but the following solved that problem:-
ALTER IGNORE TABLE measurementunit ADD UNIQUE INDEX(unit,description)
