First, the dreaded ampersand (&):
Unfortunately, it appears as though the ampersand is the field delimiter used by NSClient++, so passing an ampersand to check_nt is absolutely not going to work. Take a look at the following code snippit from check_nt.c :
249 case CHECK_PROCSTATE:
250
251 if (value_list==NULL)
252 output_message = strdup (_("No service/process specified"));
253 else {
254 preparelist(value_list); /* replace , between services with & to send the request */
255 asprintf(&send_buffer,"%s&%u&%s&%s", req_password,(vars_to_check==CHECK_SERVICESTATE)?5:6,
256 (show_all==TRUE) ? "ShowAll" : "ShowFail",value_list);
257 fetch_data (server_address, server_port, send_buffer);
258 return_code=atoi(strtok(recv_buffer,"&"));
259 temp_string=strtok(NULL,"&");
260 output_message = strdup (temp_string);
261 }
262 break620 void preparelist(char *string) {
621 /* Replace all , with & which is the delimiter for the request */
622 int i;
623
624 for (i = 0; (size_t)i < strlen(string); i++)
625 if (string[i] == ',') {
626 string[i]='&';
627 }
628 }
As you can see, the ampersand is hardwired into the request to the NSClient++ server, so any fix will require changes to both the check_nt plugin and NSClient++.
There is no workaround for this, except to avoid using the ampersand (escaping the ampersand with a backslash ( \ ) does not work). If, for example, you are trying to check on the status of the "Backup Exec Device & Media Service", use the service name instead of the display name -- NSClient++ can use either. In this case, the service name is "BackupExecDeviceMediaService", which you can find in the service properties.
P.S. - if you're unfortunate enough to be using Backup Exec, I feel for you.
Next, the dollar sign ($):
The dollar sign is a goofy one too, and can't be escaped with the backslash character ( \ ). Instead, you have to double it and put quotes around it (like so: "$$"). Neat, eh?
An example: let's say that you're trying to monitor the service MSSQL$BKUPEXEC. Unfortunately, this is both the display name, and the service name, so the last trick we used won't work. No worries, though, thanks to our friend the double-dollar-sign-enclosed-in-quotes. Your check_command will look like this:
check_command check_nt!SERVICESTATE!-l "MSSQL"$$"BKUPEXEC"
So awesome! Yay for annoying things!
Note: you might think you're clever and use single quotes instead of double around the entire service name. Unfortunately, that does not work reliably. It does seem to work, however, if you're only checking on one service name in the command. Anyhow, don't bother.
Next up, the backslash ( \ ):
This one is pretty easy, you just double it up ( like so: \\ ). Thus checking on a performance counter will look something like this:
check_command check_nt!COUNTER!-l "\\Network Interface(Intel[R] 82546EB Based Dual Port Network Connection - Packet Scheduler Miniport)\\Bytes Total/sec"
Phew, that counter name is a mouthfull, which is actually why I chose it. Don't try to manually type in your performance counters; copy and paste them. From a terminal to the Windows machine you're monitoring, open up Performance Monitor. Add the counter you're looking for to the graph, select the counter from the legend at the bottom of the window, and then click on the Copy Properties button (it's one of the buttons at the top of the graph). Now open up notepad or your favorite text editor and paste the performance counter data into it. Somewhere in there you should see a .path attribute that contains the entire counter reference which you can copy and paste into the specific Nagios configuration file we're working with (remove the server name and double all of the back slashes). Thankfully we can copy and paste from a terminal in Windows to local windows, if we're running Windows.
Note: I believe that much of the confusion over passing arguments to the check_nt command in Nagios has to do with this double back slash which looks like we're escaping the back slash. We're not...well, not really. Don't expect to simply use regular Bash shell notation in your arguments. Single quotes don't necessarily behave the way you'd like. Escaping doesn't work the way you might expect it to. Just don't bother trying to out-think the system, follow its conventions, make no assumptions, and you'll be fine.
Excellent! Thank you so much. I tried everything, escaping with \, single quotes, double quotes... never would have thought of the ol' double-double, though perhaps I should have suspected when
ReplyDelete'MSSQL$INSTANCE' became
MSSQL$INSTANCE$
in the nagios service detail. LOL.
Cheers!
Just to remark, that if dollar signs are in the name of counter, then correct syntax in Nagios config will be:
ReplyDeletecheck_nrpe -H $HOSTADDRESS$ -c CheckCounter -a "\\MSSQL\
$$SQL_2005:Databases(_Total)\\Data File(s) Size (KB)"
AS far as I understand, backslash escapes for NSClient and second $ is for Nagios parser.
THANK YOU! I have been fighting with the $ issue trying to monitor SQL instances and woul have never thought to put the quotes around just the $$.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThanks a LOT!!
ReplyDeleteIt worked for me when using:
check_nt!SERVICESTATE!-l SQLAgent"$$"BKUPEXEC
Can anyone recommend the robust IT automation system for a small IT service company like mine? Does anyone use Kaseya.com or GFI.com? How do they compare to these guys I found recently: N-able N-central software remote access
ReplyDelete? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!
I inclination not acquiesce in on it. I over polite post. Specially the designation attracted me to read the whole story.
ReplyDeleteGenial post and this post helped me alot in my college assignement. Gratefulness you as your information.
ReplyDeleteHi,
ReplyDeleteWhen ever I surf on web I come to this website[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url]Plenty of useful information on sadsoftware.blogspot.com. I am sure due to busy scedules we really do not get time to care about our health. Here is a fact for you. Research points that nearly 80% of all USA grownups are either fat or weighty[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url] Hence if you're one of these citizens, you're not alone. In fact, most of us need to lose a few pounds once in a while to get sexy and perfect six pack abs. Now the question is how you are planning to have quick weight loss? [url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips]Quick weight loss[/url] is really not as tough as you think. Some improvement in of daily activity can help us in losing weight quickly.
About me: I am blogger of [url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips]Quick weight loss tips[/url]. I am also health expert who can help you lose weight quickly. If you do not want to go under difficult training program than you may also try [url=http://www.weightrapidloss.com/acai-berry-for-quick-weight-loss]Acai Berry[/url] or [url=http://www.weightrapidloss.com/colon-cleanse-for-weight-loss]Colon Cleansing[/url] for effortless weight loss.
I have been visiting various blogs for my term papers writing research. I have found your blog to be quite useful. Keep updating your blog with valuable information... Regards
ReplyDeleteСтранно, искал совсем не это, гугл выдал Ваш сайт, и судя по всему не зря, есть что почитать! Goodwork!
ReplyDeleteHi buddy, firstly I would like to send greetings to all readers then I think that this information is amazing and very entertainment information, I was looking information about Nagios with NSClient++ Character Flaws , and this information is very professional and I would like to have any update about, thanks for sharing!!
ReplyDeleteThanks a lot!!!
ReplyDeleteYou saved me :)
Matthew
sell [URL=http://jacket-dresses.net/]moncler sale[/URL] for less QVRhnHsJ [URL=http://jacket-dresses.net/ ] http://jacket-dresses.net/ [/URL]
ReplyDeleteget cheap [URL=http://jacket-dresses.net/]moncler jackets sale[/URL] suprisely PwWkoGng [URL=http://jacket-dresses.net/ ] http://jacket-dresses.net/ [/URL]
ReplyDeleteHiya very nice website!! Man .. Beautiful .. Amazing .
ReplyDelete. I'll bookmark your blog and take the feeds also? I am glad to find a lot of helpful info here within the put up, we want work out more strategies on this regard, thanks for sharing. . . . . .
My blog ... Twin Cities Auto Glass
Nice post. I learn something totally new and challenging on sites I stumbleupon everyday.
ReplyDeleteIt will always be useful to read through content from other authors and practice a little something from other sites.
Feel free to surf my web-site Buy Viarex
I am sure you will love CFeJRaFm [URL=http://www.louis--vuitton--online--shop.org/]louis vuitton shoes online[/URL] for less gHpPnSXd [URL=http://www.louis--vuitton--online--shop.org/ ] http://www.louis--vuitton--online--shop.org/ [/URL]
ReplyDeletecheap [URL=http://burberry-outlet.zoomshare.com/]burberry for men[/URL] to take huge discount cCzZmvnv [URL=http://burberry-outlet.zoomshare.com/ ] http://burberry-outlet.zoomshare.com/ [/URL]
ReplyDeleteThank you a lot for sharing this with all people you actually know what you are speaking approximately!
ReplyDeleteBookmarked. Please additionally discuss with my web site =).
We can have a hyperlink exchange contract among us
Also visit my web-site - fake louis vuitton handbags
My web site - fake louis vuitton handbags
I have been browsing on-line more than 3 hours today, yet I never found
ReplyDeleteany attention-grabbing article like yours. It's pretty value enough for me. In my view, if all website owners and bloggers made good content as you probably did, the internet might be a lot more useful than ever before.
My page; www.coachhandbagsoutletshop2013.com
Right here is the perfect web site for everyone who really
ReplyDeletewants to find out about this topic. You know so much its almost hard
to argue with you (not that I personally will need to…HaHa).
You definitely put a fresh spin on a subject that's been written about for decades. Wonderful stuff, just great!
Here is my blog post ... ミュウミュウ
Excellent weblog here! Also your site rather a lot up very fast!
ReplyDeleteWhat web host are you the use of? Can I get your associate hyperlink for your
host? I desire my web site loaded up as quickly as yours lol
My website: コーチ長財布
I am in fact grateful to the holder of this web site who has shared this wonderful
ReplyDeletearticle at at this time.
My blog :: トリーバーチ財布
Heya! I just wanted to ask if you ever have any problems
ReplyDeletewith hackers? My last blog (wordpress) was hacked
and I ended up losing many months of hard work due
to no back up. Do you have any solutions to protect against hackers?
Stop by my web page miu miu 財布
I was curious if you ever thought of changing the page layout of your website?
ReplyDeleteIts very well written; I love what youve got to say.
But maybe you could a little more in the way of content so people could connect with it better.
Youve got an awful lot of text for only having 1 or 2 images.
Maybe you could space it out better?
My webpage: ミュウミュウ新作
Highly energetic article, I liked that bit. Will there be a part 2?
ReplyDeleteMy website ... toryburchoutletshopx.com
For newest information you have to visit world-wide-web and on internet
ReplyDeleteI found this site as a finest site for most recent updates.
Also visit my page; クロエ ハンドバッグ
Hi to every one, it's genuinely a pleasant for me to pay a visit this web page, it contains valuable Information.
ReplyDeletemy weblog - クロエ店舗
Wow, superb blog format! How lengthy have you been blogging for?
ReplyDeleteyou made blogging look easy. The full glance of your web site is fantastic, as smartly as the content!
My page - chloe バッグ
I'm really inspired with your writing skills and also with the layout for your blog. Is that this a paid topic or did you modify it yourself? Either way keep up the nice quality writing, it is rare to see a great weblog like this one nowadays..
ReplyDeleteAlso visit my web-site ... トリーバーチ財布
It is appropriate time to make some plans for the future and it is time to be happy.
ReplyDeleteI have read this post and if I could I desire to suggest you few interesting things or suggestions.
Perhaps you can write next articles referring to
this article. I desire to read more things about it!
Here is my blog post; Acai Ultra Lean
Hi, i think that i saw you visited my blog thus i came to “return the
ReplyDeletefavor”.I am attempting to find things to improve my web site!
I suppose its ok to use some of your ideas!
!
my blog post: loveuapple.com
It's remarkable designed for me to have a web site, which is helpful in support of my experience. thanks admin
ReplyDeletemy web-site www.19luglio1992.org
Pretty nice post. I just stumbled upon your weblog and wanted to say that I've truly enjoyed browsing your blog posts. After all I will be subscribing to your feed and I hope you write again very soon!
ReplyDeleteMy website :: www.old-yacht.berozy.com
Mr Bernanke is the one with the pottery. Click Here to visit VCW VicMan's stickers in bulk Editor include rotating the stickers in bulk, considering they'll be
ReplyDeletemarked at $15 for a pack of cigarettes, front and back,
and whether or not to consume GMO foods.
Also visit my webpage ... Vinyl sticker
Have you ever considered writing an ebook or guest authoring on
ReplyDeleteother sites? I have a blog based upon on the same topics you discuss and would
really like to have you share some stories/information.
I know my subscribers would value your work. If you're even remotely interested, feel free to send me an email.
Review my web-site; クリスチャンルブタン
Hello my family member! I wish to say that this article is awesome, great
ReplyDeletewritten and come with approximately all significant infos.
I would like to see more posts like this .
Here is my web page コーチ アウトレット
I'm not sure exactly why but this site is loading incredibly slow for me. Is anyone else having this issue or is it a problem on my end? I'll check back later on and see
ReplyDeleteif the problem still exists.
Look at my webpage: プラダバッグ
Wow, marvelous weblog format! How lengthy have you ever been
ReplyDeleteblogging for? you make running a blog glance easy.
The whole look of your site is excellent, let alone the content material!
My blog post :: ロレックススーパーコピー
This is a topic which is close to my heart... Cheers! Exactly where are your contact details though?
ReplyDeleteMy homepage ... アバクロ
Fantastic End-of-the-year Merchandise For Educators
ReplyDeleteFeel free to surf to my site Epson Powerlite Home Cinema 5020UBe review
()
Greetings! I've been following your weblog for a long time now and finally got the bravery to go ahead and give you a shout out from Dallas Tx! Just wanted to say keep up the excellent job!
ReplyDeleteAlso visit my site - forex trading charts ()
What's up to all, how is everything, I think every one is getting more from this web site, and your views are nice in support of new visitors.
ReplyDeleteFeel free to surf to my weblog; free binary options system
Simply desire to say your article is as astonishing.
ReplyDeleteThe clarity in your post is just great and i could assume you are an expert on this subject.
Well with your permission let me to grab your feed to keep up to date with forthcoming post.
Thanks a million and please continue the rewarding work.
Also visit my website :: cedarfinanc
However, it is also because of this negative thinking which is the primary
ReplyDeletecause of their weihgt problem. Then the skinny guy
finds weight gainers and tries them, or some other worthless supplement, and never really understands why he is not big and muscular like the other guys at the gym.
How to gain weight for skinny guys is about attitude, exercise,
nutrition, and rest.
Also visit my webpage :: how to gain weight with a fast metabolism ()
Antenna Tower- No cost Interrelated Roadmap Related to Antenna
ReplyDeleteAlso visit my web-site casinoeuro
Details about Lumisource Home entertainment system Chair Producer
ReplyDeleteHere is my webpage ... converter video to mp3 online
Many thanks for this detailed article! I am always asking myself why use a excise dissertation writing overhaul? While http://dissertationwriting.services/ exist! I still don't understand!
ReplyDeleteThis was helpful. Thank you. I was struggling with parentheses. Quotes around them worked.
ReplyDelete-d SHOWALL -l "Perceptive Content Email Agent "("Primary")""
'behold what manner of men are these, who struggle to quote parentheses'
--Sarsipius Bartholomew AD 82