I am using the latest version of Nagios (4.3.2). I changed the enable_splunk_integration variable to true today and entered my base url for splunk. However, whenever I would click the 'splunk>' icon from a 'Services' or 'Hosts' page, I would get a 404 not found error. I went to my splunk installation and typed the same search terms in to the splunk search bar that Nagios was trying to pass in the URL. I found that the URL that my version of Splunk (6.5.2) has for searching is different than what is implemented in Nagios 4.3.2.
I went to the Nagios 4.3.2 source code and edited the cgi/cgiutils.c file which contains the anchor tag with href to splunk. I edited the URL to match what is in splunk, recompiled, and now the 'splunk>' button works great.
Has anyone else had this issue with Nagios / Splunk integration? Anyways here is the .patch file for the changes I made.
Code: Select all
--- nagios-4.3.2/cgi/cgiutils.c 2017-05-09 12:03:31.000000000 -0500
+++ nagios-4.3.2-splunk-patch/cgi/cgiutils.c 2017-07-07 14:44:20.759764576 -0500
@@ -2063,7 +2063,7 @@
if(hst == NULL)
return;
- printf("<a href='%s?q=search %s' target='_blank'><img src='%s%s' alt='Splunk It' title='Splunk It' border='0'></a>\n", splunk_url, url_encode(hst->name), url_images_path, SPLUNK_SMALL_WHITE_ICON);
+ printf("<a href='%sapp/search/search?q=search %s' target='_blank'><img src='%s%s' alt='Splunk It' title='Splunk It' border='0'></a>\n", splunk_url, url_encode(hst->name), url_images_path, SPLUNK_SMALL_WHITE_ICON);
return;
}
@@ -2077,7 +2077,7 @@
if(svc == NULL)
return;
- printf("<a href='%s?q=search %s%%20", splunk_url, url_encode(svc->host_name));
+ printf("<a href='%sapp/search/search?q=search %s%%20", splunk_url, url_encode(svc->host_name));
printf("%s' target='_blank'><img src='%s%s' alt='Splunk It' title='Splunk It' border='0'></a>\n", url_encode(svc->description), url_images_path, SPLUNK_SMALL_WHITE_ICON);
return;
@@ -2098,7 +2098,7 @@
strip_splunk_query_terms(newbuf);
- printf("<a href='%s?q=search %s' target='_blank'>", splunk_url, url_encode(newbuf));
+ printf("<a href='%sapp/search/search?q=search %s' target='_blank'>", splunk_url, url_encode(newbuf));
if(icon > 0)
printf("<img src='%s%s' alt='Splunk It' title='Splunk It' border='0'>", url_images_path, (icon == 1) ? SPLUNK_SMALL_WHITE_ICON : SPLUNK_SMALL_BLACK_ICON);
printf("</a>\n");