How To Test Nagios Remote NRPE Commands

Author: , Posted on Thursday, September 27th, 2018 at 10:46:20am

There are many things to configure in Nagios, especially when using custom check commands. Recently I needed to configure all of the Continuent Clustering Nagios checks. Once setup on the database side, I wanted to confirm that everything was working.

Basics: Run a Remote NRPE Check

To test a remote NRPE client command from a nagios server via the command line, use the check_nrpe command:

1
shell> /opt/local/libexec/nagios/check_nrpe -H db1 -c check_tungsten_latency
shell> /opt/local/libexec/nagios/check_nrpe -H db1 -c check_tungsten_latency

The above command calls the NRPE daemon running on host db1 and executes the NRPE command “check_tungsten_latency” as defined in the db1:/etc/nagios/nrpe.cfg file.

Here is the line used in nrpe.cfg to define the check_tungsten_latency remote NRPE call:

1
command[check_tungsten_latency]=/usr/bin/sudo -u tungsten /opt/continuent/tungsten/cluster-home/bin/check_tungsten_latency -w 2.5 -c 4.0
command[check_tungsten_latency]=/usr/bin/sudo -u tungsten /opt/continuent/tungsten/cluster-home/bin/check_tungsten_latency -w 2.5 -c 4.0

Note that sudo is in use to give the nrpe user access as the tungsten user to the tungsten-owned check scripts using the sudo wildcard configuration.

Here is the service check definition in the /opt/local/etc/nagios/objects/services.cfg file:

1
2
3
4
5
6
7
8
9
# Service definition
define service{
    service_description         check_tungsten_latency - Continuent Clustering
    servicegroups               myclusters
    host_name                   db1,db2,db3,db4,db5,db6,db7,db8,db9
    check_command               check_nrpe!check_tungsten_latency
    contact_groups              admin
    use                         generic-service
    }
# Service definition
define service{
    service_description         check_tungsten_latency - Continuent Clustering
    servicegroups               myclusters
    host_name                   db1,db2,db3,db4,db5,db6,db7,db8,db9
    check_command               check_nrpe!check_tungsten_latency
    contact_groups              admin
    use                         generic-service
    }

Security: Sudo Configuration

To enable sudo for the nrpe user, create or edit the file /etc/sudoers.d/20_nagios like so:

sudo vim /etc/sudoers.d/20_nagios

1
2
3
Defaults:nrpe !requiretty
Defaults:nrpe !visiblepw
nrpe          ALL=(tungsten)  NOPASSWD: /opt/continuent/tungsten/cluster-home/bin/check*
Defaults:nrpe !requiretty
Defaults:nrpe !visiblepw
nrpe          ALL=(tungsten)  NOPASSWD: /opt/continuent/tungsten/cluster-home/bin/check*

Additional Command Examples

/etc/nagios/nrpe.cfg

1
2
command[check_tungsten_online]=/usr/bin/sudo -u tungsten /opt/continuent/tungsten/cluster-home/bin/check_tungsten_online
command[check_tungsten_progress]=/usr/bin/sudo -u tungsten /opt/continuent/tungsten/cluster-home/bin/check_tungsten_progress -t 5</code>
command[check_tungsten_online]=/usr/bin/sudo -u tungsten /opt/continuent/tungsten/cluster-home/bin/check_tungsten_online
command[check_tungsten_progress]=/usr/bin/sudo -u tungsten /opt/continuent/tungsten/cluster-home/bin/check_tungsten_progress -t 5</code>

/opt/local/etc/nagios/objects/services.cfg

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Service definition
define service{
    service_description         check_tungsten_online - Continuent Clustering
    servicegroups               myclusters
    host_name                   db1,db2,db3,db4,db5,db6,db7,db8,db9
    check_command               check_nrpe!check_tungsten_online
    contact_groups              admin
    use                         generic-service
    }
 
# Service definition
define service{
    service_description         check_tungsten_progress - Continuent Clustering
    servicegroups               myclusters
    host_name                   db1,db2,db3,db4,db5,db6,db7,db8,db9
    check_command               check_nrpe!check_tungsten_progress
    contact_groups              admin
    use                         generic-service
    }    
# Service definition
define service{
    service_description         check_tungsten_online - Continuent Clustering
    servicegroups               myclusters
    host_name                   db1,db2,db3,db4,db5,db6,db7,db8,db9
    check_command               check_nrpe!check_tungsten_online
    contact_groups              admin
    use                         generic-service
    }

# Service definition
define service{
    service_description         check_tungsten_progress - Continuent Clustering
    servicegroups               myclusters
    host_name                   db1,db2,db3,db4,db5,db6,db7,db8,db9
    check_command               check_nrpe!check_tungsten_progress
    contact_groups              admin
    use                         generic-service
    }    

For more information about monitoring Continuent clusters, please visit https://docs.continuent.com/tungsten-clustering-6.0/ecosystem-nagios.html.

To learn about Continuent solutions in general, check out https://www.continuent.com/solutions

How To Create a PayPal-styled Button Using CSS and HTML

Author: , Posted on Friday, August 31st, 2018 at 11:42:15am
1
<button class="paypal-btn large" onclick="window.location='https://www.yoursite.com/targetPage/';return false">What a Great Button</button>
<button class="paypal-btn large" onclick="window.location='https://www.yoursite.com/targetPage/';return false">What a Great Button</button>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
button.paypal-btn {
 white-space: nowrap;
}
button.paypal-btn {
 white-space: nowrap;
 overflow: hidden;
 border-radius: 13px;
 font-family: "Arial", bold, italic;
 font-weight: bold;
 font-style: italic;
 border: 1px solid #ffa823;
 color: #0E3168;
 background: #ffa823;
 position: relative;
 text-shadow: 0 1px 0 rgba(255,255,255,.5);
 cursor: pointer;
 z-index: 0;
}
button.paypal-btn:before {
 content: " ";
 position: absolute;
 width: 100%;
 height: 100%;
 border-radius: 11px;
 top: 0;
 left: 0;
 background: #ffa823;
 background: -webkit-linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%);
 background: -moz-linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%);
 background: -ms-linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%);
 background: linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%);
 z-index: -2;
}
button.paypal-btn:after {
 content: " ";
 position: absolute;
 width: 98%;
 height: 60%;
 border-radius: 40px 40px 38px 38px;
 top: 0;
 left: 0;
 background: -webkit-linear-gradient(top, #fefefe 0%, #fed994 100%);
 background: -moz-linear-gradient(top, #fefefe 0%, #fed994 100%);
 background: -ms-linear-gradient(top, #fefefe 0%, #fed994 100%);
 background: linear-gradient(top, #fefefe 0%, #fed994 100%);
 z-index: -1;
 -webkit-transform: translateX(1%);
 -moz-transform: translateX(1%);
 -ms-transform: translateX(1%);
 transform: translateX(1%);
}
button.paypal-btn.small {
 padding: 3px 15px;
 font-size: 12px;
}
button.paypal-btn.large {
 padding: 4px 19px;
 font-size: 14px;
}
button.paypal-btn {
 white-space: nowrap;
}
button.paypal-btn {
 white-space: nowrap;
 overflow: hidden;
 border-radius: 13px;
 font-family: "Arial", bold, italic;
 font-weight: bold;
 font-style: italic;
 border: 1px solid #ffa823;
 color: #0E3168;
 background: #ffa823;
 position: relative;
 text-shadow: 0 1px 0 rgba(255,255,255,.5);
 cursor: pointer;
 z-index: 0;
}
button.paypal-btn:before {
 content: " ";
 position: absolute;
 width: 100%;
 height: 100%;
 border-radius: 11px;
 top: 0;
 left: 0;
 background: #ffa823;
 background: -webkit-linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%);
 background: -moz-linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%);
 background: -ms-linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%);
 background: linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%);
 z-index: -2;
}
button.paypal-btn:after {
 content: " ";
 position: absolute;
 width: 98%;
 height: 60%;
 border-radius: 40px 40px 38px 38px;
 top: 0;
 left: 0;
 background: -webkit-linear-gradient(top, #fefefe 0%, #fed994 100%);
 background: -moz-linear-gradient(top, #fefefe 0%, #fed994 100%);
 background: -ms-linear-gradient(top, #fefefe 0%, #fed994 100%);
 background: linear-gradient(top, #fefefe 0%, #fed994 100%);
 z-index: -1;
 -webkit-transform: translateX(1%);
 -moz-transform: translateX(1%);
 -ms-transform: translateX(1%);
 transform: translateX(1%);
}
button.paypal-btn.small {
 padding: 3px 15px;
 font-size: 12px;
}
button.paypal-btn.large {
 padding: 4px 19px;
 font-size: 14px;
}

R.I.P. William “Bill” Baldwin

Author: , Posted on Thursday, August 9th, 2018 at 12:48:45pm

Bill Baldwin passed away from a stroke in July 2018. He will be missed terribly by his many friends, family and co-workers. His exemplary craftsmanship and feisty attitude will be remembered with great fondness by all who knew him.
Bill-1
Bill-4
Bill-2
Bill-3

How To Display Blog Pages for a Single Category

Author: , Posted on Monday, August 6th, 2018 at 4:23:58pm

Create a new page and set the page template to Blog.

Add a new Custom Field to the page.

Set the Name to the string query_args and the value to cat=NNN, where NNN is the ID of the desired category.

Be sure to click Publish or Update when done.

You can locate the Category ID on the Categories management page:

/wp-admin/edit-tags.php?taxonomy=category

If you cannot find the Custom Fields box on the edit page screen, look at the very top for a drop-down menu called “Screen Options”. Make sure that “Custom Fields” is checked.

How To Revert All Changes in a git Branch

Author: , Posted on Thursday, August 2nd, 2018 at 12:55:42pm

git checkout -f

How To Disable WordPress wpautop for Shortcodes

Author: , Posted on Friday, June 15th, 2018 at 1:35:54pm

remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'smart_autop' );
function smart_autop($content) {
$post = get_post();
if($post->post_type != 'post') return $content; // if not a post, leave $content untouched
return wpautop($content);
}

Trademark Symbol

Author: , Posted on Friday, June 15th, 2018 at 9:53:58am

&#x2122; ™

How To Select Rows in MySQL with No Matching Entry in Another Table

Author: , Posted on Wednesday, May 16th, 2018 at 6:08:36pm

SELECT t1.id
FROM tableOne t1
LEFT JOIN tableTwo t2 ON t1.id = t2.id
WHERE t2.id IS NULL

The “WHERE t2.id IS NULL clause” restricts the results to only those rows where the id returned from tableTwo is null.

tableTwo.id will be NULL for all records from tableOne where the id is not found in tableTwo.

How To Move Around in Linux CLI Mail

Author: , Posted on Monday, May 7th, 2018 at 4:48:44pm

h Shows you a screenful of message headers (a “header” being the number, sender, date, size and subject).
h with no message number shows the current screenful of messages (the number that make up a screenful is set with the screen variable, described below).

h$ shows you the last screenful of messages — which is usually what you’re interested in (this is usually the first thing I type when I start mail).

h1 or h^ shows you the first screenful of messages.

z or z- If there is more than a screenful of messages, then z will show the next screenful, and z- will show the previous screenful.

d Mark message(s) for deletion.

d with no number marks the current message for deletion.

d with a number (or +, -, $, etc.) will mark the specified message(s) for deletion. To delete messages 1 to 3, you could do d 1-3, or d 1 2 3 or d *

I means ‘mark for deletion’ instead of ‘delete’ because the changes you make are only saved when you type q.

http://www.johnkerl.org/doc/mail-how-to.html

R.I.P. James R. Boyd Sr. (1934 – 2018)

Author: , Posted on Tuesday, May 1st, 2018 at 8:39:14am

James R. Boyd Sr. (1934 - 2018)

James R. Boyd Sr. (1934 – 2018)

NORTH RUPERT – James R. Boyd Sr., age 84 passed away peacefully on Monday, April 23, 2018, after an extended hospitalization.
Jim was born in Albany, NY, on March 26, 1934, the only child of David and Elizabeth (Adams) Boyd. He grew up in Colonie, NY, and served honorably in the U.S. Army 82nd Airborne Division in the 1950s.
Jim was the proprietor of Valley Woodworking in North Rupert, specializing in custom cabinetry work for the past 28 years.
He loved seeing friends and neighbors from the Pawlet community each day and was a regular at Mach’s Market and Sheldon’s Store in Pawlet for morning coffee. Always quick with a smile, he loved to laugh, share a good joke and opine on national and world events. It was especially pleasing to him when neighbors stopped into his shop for conversation.
Jim loved the outdoors and hunted and fished his entire life from the Adirondacks of New York to Narragansett Bay in Rhode Island. Oftentimes on summer evenings, he would be found fly fishing in his favorite spots along the nearby Mettowee River.
Jim is survived by his loving wife of 28 years, Linda (Stetson) Boyd. He was the beloved father of James R. Boyd Jr. and his wife, Emily Harrison, of Rumford, RI; his daughter, Cheryl Curcio and her husband, Steven, of Smithfield, RI; his daughter, Kerry Fleming and partner Al Wood, of Coventry, RI. He is also survived by a stepson, Robert Stetson, of Warwick, RI; and was predeceased by his stepdaughter, Melissa Stetson.
Additionally, he is survived by his six cherished grandchildren Tyler Curcio, Jordan Curcio, Andrew Fleming, Ryan Fleming, Jennifer Fleming, U.S. Navy PO3; and Rocque Dutil. He is also survived by his first wife, Arlene (Hunt Boyd) Papa.
Friends are invited to join family members for a graveside service with military honors to be held on Saturday, May 5, at 9 a.m. in the North Rupert Cemetery, VT Route 30.
A celebration of life gathering will immediately follow at The Barn Restaurant, 5581 VT Route 30, Pawlet.
Donations in Jim’s memory may be sent to the Wounded Warriors Project at: https://support.woundedwarriorproject.org
To send personal condolences, please visit www.sheafuneralhomes.com