haloe alerts and removals not showing

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

ejensen
Cacti User
Posts: 55
Joined: Mon Jul 12, 2004 11:39 am

haloe alerts and removals not showing

Post by ejensen »

Haloe is a great plugin, although there is some confusion about which one is current... haloe 0.4 or syslog from the SVN files. :roll:

I have tried both plugins and neither one shows any alerts or removals. When I add an alert, the syslog_alert table is updated, but it never shows on the syslog_alerts.php page. and alert emails never go out. same with removals.

also. when I click on the alert or removal link on the main syslog page that is listed for each message in the database (the red or green icons on the right), the page opens but with an error:
Warning: strpos() [function.strpos]: Offset not contained in string. in C:\Inetpub\wwwroot\cacti\plugins\haloe\haloe_alert.php on line 67
also.. the color coding is not showing up on my syslog page in either IE or Firefox.

Any suggestions would be very appreciated!

Here is my haloe config:

Code: Select all

<?php

$haloedb_type     = "mysql";
$haloedb_default  = "syslog";
$haloedb_hostname = "localhost";
$haloedb_username = "-----";
$haloedb_password = "------";

$haloe_config["rows_per_page"] = "100";

//  Integrate with Graph View Timespan Selector. If false, keep seperate timespan settings
$haloe_config["graphtime"] = true;

//  Display timespan selector or not [ only used if $haloe_config["graphtime"]=false ]
$haloe_config["timespan_sel"] = true;

//  Field Mappings, adjust to match the haloe table columns in use
$haloe_config["haloeTable"]      = "syslog";
$haloe_config["incomingTable"]   = "syslog_incoming";
$haloe_config["removeTable"]     = "syslog_remove";
$haloe_config["alertTable"]      = "syslog_alert";
$haloe_config["dateField"]       = "date";
$haloe_config["timeField"]       = "time";
$haloe_config["priorityField"]   = "priority";
$haloe_config["facilityField"]   = "facility";
$haloe_config["hostField"]       = "host";
$haloe_config["textField"]       = "message";
$haloe_config["id"]              = "seq";

//  Priority colors, change/add/delete to suit
$haloe_colors["emerg"] = "E6808C";
$haloe_colors["crit"]  = "F08896";
$haloe_colors["alert"]     = "F6909C";
$haloe_colors["err"]     = "F9E1B4";
$haloe_colors["warning"]   = "FCF0C0";
// $haloe_colors["notice"]    = "FFAB00";
// $haloe_colors["info"]      = "FFAB00";
$haloe_colors["Debug"]     = "D0D0D0";

?>
User avatar
N3NCY
Cacti User
Posts: 260
Joined: Thu Sep 22, 2005 7:50 pm
Location: Landenberg, PA
Contact:

Post by N3NCY »

Well, I think the SVN is newer.

In either case did you complete the Syslog intregration?
You will need to configure Syslog-NG (or other) to log to a database.

Are you Windows or Unix?

On Unix:
http://www.nmsworld.com/UNIX/Syslog-NG.htm

On Windows there are some "pay" versions of Syslog to Database software I hear are nice too.
Kiwi I hear is nice:
http://www.kiwisyslog.com/kiwi-syslog-daemon-overview/
Thank you,

Ernie
http://www.NMSWorld.com
[b]Dual Zeon Dual Core 2.6Ghz / 8GB RAM / 4x15k RPM SATA RAID5[/b]
[b]Cacti Version[/b] - 0.8.7b
[b]Poller Type[/b] - cactid 0.8.7 with Boost v1.7
[b]Server Info[/b] - FreeBSD 7.0-RELEASE
[b]Web Server[/b] - Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.8g DAV/2 PHP/5.2.5 mod_perl/2.0.3 Perl/v5.8.8
[b]PHP[/b] - 5.2.6
[b]MySQL[/b] - 5.0.51b Mod: poller_output ENGINE = MEMORY
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.4.1
[b]Plugins[/b] - Host Info (hostinfo - v0.2), Update Checker (update - v0.3), Network Tools (tools - v0.2), FlowView (flowview - v0.3), Read-only Devices Tab (devices - v0.4), Network Discovery (discovery - v0.8.3), Syslog Monitoring (syslog - v0.5.2), Thresholds (thold - v0.3.9), Device Monitoring (monitor - v0.8.2), PHP Network Weathermap (weathermap - v0.941), SuperLinks (superlinks - v0.72), Report Creator (reports - v0.1b)
munozm
Posts: 18
Joined: Sun Jul 08, 2007 10:14 pm

Same issue

Post by munozm »

I'm having the same issue. I'm running on Ubuntu 7.04.

I get logs all day long but when I try to use haloe_remove or haloe_alert I get the following messages:

Warning: strpos() [function.strpos]: Offset not contained in string. in /var/www/cacti/plugins/haloe/haloe_alert.php on line 66
or
Warning: strpos() [function.strpos]: Offset not contained in string. in /var/www/cacti/plugins/haloe/haloe_remove.php on line 65

I can't seem to add info either as noted by the original poster.

I used the guide here to setup syslog-ng:
http://openmaniak.com/cacti_plugins.php#ancre-syslog

Thanks for any help.
ejensen
Cacti User
Posts: 55
Joined: Mon Jul 12, 2004 11:39 am

Post by ejensen »

Thanks for the replies!

I tried to use the one from SVN, had to manually download each file since I couldnt figure out how to change tortise to show the plugins root. :-?
With the SVN files, I had the same problems.

There are entries in the table syslog_alerts but they do not show on the page and they never get alerted on.

I can fill in the form to add an alert, and it populates the database, but never shows on the alerts page.

I tried editing the php code, but couldnt get it to work, and I got pulled onto other things.

Could it be something to do with running MySQL 5.0.37? or PHP 5.2.1?
And yes, I am running on Windows 2003 Server with IIS.

I am also using Kiwi Enterprise and the database is popluated with the syslog messages.
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

ejensen wrote: There are entries in the table syslog_alerts but they do not show on the page and they never get alerted on.
I can fill in the form to add an alert, and it populates the database, but never shows on the alerts page.
...
I am also using Kiwi Enterprise and the database is popluated with the syslog messages.
Hello,
see the post on the link http://forums.cacti.net/post-110177.html#110177
I think if you read the whole post you will have the solution.

There are two problems:
- first : you have to fill the SQL database "syslog_incomming" not "syslog"
- second : you have to change some values in "class.phpmailer.php " and "functions.php" until cigamit solve these "known issues".

PS: If you use the free Kiwi you can use my "plugin" to convert text-traps to SQL http://forums.cacti.net/post-108332.html#108332
Jean-Michel
cacti 0.8.7e | cmd & cactid (cactid 0.8.x) | Linux | MySQL Ver 14.7 Distrib 4.1.12, for Win32 | PHP v5.2.6 | Apache v2.x | Thold | Plugin Architecture | plugin "configuration manager" http://cactiusers.org/forums/topic257.html | plugin "IP subnet calculator IPv4 / IPV6" http://forums.cacti.net/viewtopic.php?t=15428 | plugin banner http://docs.cacti.net/userplugin:banner | Net-SNMP 5.5.2 | cygwin 1.5.18 of 02.07.2005
ejensen
Cacti User
Posts: 55
Joined: Mon Jul 12, 2004 11:39 am

Post by ejensen »

thanks for the response.

I changed my syslog server to dump to syslog_incomming and cleared all data from the syslog table. After running the process script, data is being moved over to the syslog table.

That doesnt solve my problem with alerts or removals not showing and the error i get when i click on one of the entries in the syslog screen.

When i click on the removal button i get the following error:
Warning: strpos() [function.strpos]: Offset not contained in string. in C:\Inetpub\wwwroot\cacti\plugins\haloe\haloe_remove.php on line 66
Maybe it will help to see the url my link is trying to go to:
http://<myserver>/cacti/plugins/haloe/haloe_remove.php?id=8758#edit
munozm
Posts: 18
Joined: Sun Jul 08, 2007 10:14 pm

Post by munozm »

I made an error on my earlier post, even though I get the same error messages, I can in fact create alerts and removals. The email even works. I still get the Warning: strpos messages on the haloe_remove and haloe_alert pages. When I go directly to those pages they show empty as if I hadn't added anything. I go into the database and everything is in there. Again, the emails work and maybe the removals work. Not sure on that one but its in the database. Normal logging works.
What am I missing?

As a side note, in trying to compare configs, I look on http://www.nmsworld.com/UNIX/Syslog-NG.htm as posted by N3ncy and one difference I notice is I have:
template("INSERT INTO syslog_incoming
(facility, priority, date, time, host, message, seq, status)
VALUES ( '$FACILITY', '$PRIORITY', '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$HOST', '$MSG', '$SEQ', '$STATUS' );\n") template-escape(yes));
};

He doesn't have seq or status. Could that be related somehow?
Thanks for the help.
ejensen
Cacti User
Posts: 55
Joined: Mon Jul 12, 2004 11:39 am

Post by ejensen »

I reloaded the syslog plugin last night and I am still not seeing anything in the alerts, removals, or reports pages. But there is information in the database tables for each of the related tables.

Last night I also recieved an email from the syslog plugin so that is working also.

I have been looking at the code in the syslog_alert.php file and the error is generated from this section:

Code: Select all

	$text = '';
	if ($id > 0) {
		$text = db_fetch_cell("SELECT " . $syslog_config["textField"] . " FROM " . $syslog_config["syslogTable"] . " where " . $syslog_config["id"] . "=" . $id);
		$x = strpos($text, ':');
		$y = strpos($text, ' ', $x + 2);
		$text = substr($text, 0, $y);
	}
	disyplay_edit($text);
The line with

Code: Select all

$y = strpos($text, ' ', $x + 2);
is where it is failing with the following error:
Warning: strpos() [function.strpos]: Offset not contained in string. in C:\Inetpub\wwwroot\cacti\plugins\syslog\syslog_alert.php on line 89
A typical message in my syslog table looks like this:

Code: Select all

EvntSLog:342107: [ERR] Wed Oct 17 09:38:22 2007: MYDOMAIN/MYSERVER/DCOM (10010) - "The server {2C5DFFB3-472F-11CE-A030-00AA00339A98} did not register with DCOM within the required timeout."
I am not very good at php, but it looks like the code checks to make sure that url query string contains a value of "id" and make sure it is grater than zero. then fetch the message field from he syslog table where the id fields match. Then set

Code: Select all

 $x 
to the numerical posistion of where ":" is found int he message field from the recordset. Then it sets

Code: Select all

 $y 
to the numerical posistion of where it finds ' ' (a space) with an offset of

Code: Select all

 $x + 2 
. So set

Code: Select all

 $y 
to a posistion of where it finds a space in the message field and start at the location where it finds ":" in the message plus 2 characters. T
Then the script sets

Code: Select all

 $text to substr($text, 0, $y) 
. I am assuming this substitutes a "0" for the spot the

Code: Select all

 $y 
is set to.
Not sure why all this manipulation, but with the error of "Offset not contained in string." I am assumeing that a space cannot be found in the posistion that the script is trying to set

Code: Select all

 $y 
to.

If you remove the "offset' part of the code, the error goes away, but I am not sure what concequences this may have down the road.

---- now for the other problem ----

I have not figured out why the alert page does not show any alerts from the table, even though there are alerts present.

Here is the code and maybe someone more knowledgable in php can see something I dont.

Code: Select all

function display_alertss () {
	global $colors, $sql_where, $hostfilter, $config, $types;
	include("./include/config_arrays.php");
	include('plugins/syslog/config.php');

	$syslog_config["rows_per_page"] = read_config_option("num_rows_syslog");

	$url_curr_page = get_browser_query_string();
	$syslog_alerts = db_fetch_assoc("SELECT * FROM " . $syslog_config["alertTable"] . ' LIMIT ' . $syslog_config["rows_per_page"]*($_REQUEST["page"]-1) . ', ' . $syslog_config["rows_per_page"]);
?>

						<center><h1>Syslog Alerts</h1>All items in this table will be alerted on.<br><table width="50%" cellspacing="0" cellpadding="0">
							<tr>
								<td bgcolor="#ffffff" height="8" style="background-image: url(images/shadow.gif); background-repeat: repeat-x;">
								</td>
							</tr>
							<tr>
								<td width="100%" valign="top" style="padding: 5px;">
									<?php
									$total_rows = db_fetch_cell("SELECT count(*) from " . $syslog_config["alertTable"]);
									html_start_box("", "98%", $colors["header"], "3", "center", "");

										$nav = "<tr bgcolor='#" . $colors["header"] . "'>
											<td colspan='8'>
												<table width='100%' cellspacing='0' cellpadding='0' border='0'>
													<tr>
														<td align='left' class='textHeaderDark'>
															<strong><< "; if (isset($_REQUEST["page"]) && $_REQUEST["page"] > 1) { $nav .= "<a class='linkOverDark' href='" . get_query_edited_url($url_curr_page, 'page', ($_REQUEST["page"]-1)) . "'>"; } $nav .= "Previous"; if (isset($_REQUEST["page"]) && $_REQUEST["page"] > 1) { $nav .= "</a>"; } $nav .= "</strong>
														</td>\n
														<td align='center' class='textHeaderDark'>
															Showing Rows " . (($syslog_config["rows_per_page"]*($_REQUEST["page"]-1))+1) . " to " . ((($total_rows < $syslog_config["rows_per_page"]) || ($total_rows < ($syslog_config["rows_per_page"]*$_REQUEST["page"]))) ? $total_rows : ($syslog_config["rows_per_page"]*$_REQUEST["page"])) . " of $total_rows [" . syslog_page_select($total_rows) . "]
														</td>\n
														<td align='right' class='textHeaderDark'>
															<strong>"; if (isset($_REQUEST["page"]) && ($_REQUEST["page"] * $syslog_config["rows_per_page"]) < $total_rows) { $nav .= "<a class='linkOverDark' href='" . get_query_edited_url($url_curr_page, 'page', ($_REQUEST["page"]+1)) . "'>"; } $nav .= "Next"; if (($_REQUEST["page"] * $syslog_config["rows_per_page"]) < $total_rows) { $nav .= "</a>"; } $nav .= " >></strong>
														</td>\n
													</tr>
												</table>
											</td>
										</tr>\n";
										print "	$nav
										<tr bgcolor='#" . $colors["header_panel"] . "'>
											<td class='textSubHeaderDark'>Name</td>
											<td class='textSubHeaderDark'>Type</td>
											<td class='textSubHeaderDark'>Text</td>
											<td class='textSubHeaderDark'>Email</td>
											<td class='textSubHeaderDark'>&nbsp;</td>
											<td class='textSubHeaderDark'>User</td>
											<td class='textSubHeaderDark'>Date</td>
											<td class='textSubHeaderDark'>Options</td>
										</tr>\n";
										$i = 0;
										if (sizeof($syslog_alerts) > 0) {
											foreach ($syslog_alerts as $syslog_message) {
												syslog_row_color($colors["alternate"],$colors["light"],$i,$colors["alternate"]); $i++;
												?>
												<td nowrap valign=top>
													<?php print $syslog_message['name']; ?>
												</td>
												<td nowrap valign=top>
													<?php print $types[$syslog_message['type']]; ?>
												</td>
												<td nowrap valign=top>
													<?php print $syslog_message['message']; ?>
												</td>
												<td nowrap valign=top>
													<?php print $syslog_message['email']; ?>
												</td>
												<td nowrap>
													<?php print " ";?>
												</td>
												<td valign=top>
													<?php print $syslog_message['user']; ?>
												</td>
												<td nowrap valign=top>
													<?php print date("F j, Y, g:i a", $syslog_message['date']); ?>
												</td>
												<td nowrap valign=top>
													<center><a href='syslog_alert.php?remove=<?php print $syslog_message['id']; ?>'><img src='images/red.gif' border=0></a></center>
												</td>
											</tr>
											<?php
											}
										}else{
											print "<tr><td><em>No Messages</em></td></tr>";
										}
										/* put the nav bar on the bottom as well */
										print $nav;
									html_end_box(false);
									?>

								</td>
							</tr>
						</table></center>
<?php
}

?>
any help or suggestions would be much appreciated!

Also, i noticed that I dont see any color coding with syslog messages... not a critical thing, but i will have to work on that in the future.
munozm
Posts: 18
Joined: Sun Jul 08, 2007 10:14 pm

info

Post by munozm »

Hey N3NCY:

I just downloaded your cacti vmware box, executed the setup menu, logged into cacti and hit the syslog tab and find the same error messages. Have you been able to successfully get the haloe_alerts and haloe_remove to work?

Thanks for your help.
Mike
User avatar
N3NCY
Cacti User
Posts: 260
Joined: Thu Sep 22, 2005 7:50 pm
Location: Landenberg, PA
Contact:

Post by N3NCY »

Sorry, I am mostly on the forums on weekends so my replies are slow during the week.
Yes, my VM does work using haloe and I use the alerts heavily.
I will check out the error you reported and see what is causing this soon.

I am about to put up a newer / improved VM (hopefully in a week or so).
The new VM won't use use haloe, I intend to use the updated "Syslog" plugin I see in the SVN repository.
I will test it heavily of course and report back / announce when I post it.

-Ernie
Thank you,

Ernie
http://www.NMSWorld.com
[b]Dual Zeon Dual Core 2.6Ghz / 8GB RAM / 4x15k RPM SATA RAID5[/b]
[b]Cacti Version[/b] - 0.8.7b
[b]Poller Type[/b] - cactid 0.8.7 with Boost v1.7
[b]Server Info[/b] - FreeBSD 7.0-RELEASE
[b]Web Server[/b] - Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.8g DAV/2 PHP/5.2.5 mod_perl/2.0.3 Perl/v5.8.8
[b]PHP[/b] - 5.2.6
[b]MySQL[/b] - 5.0.51b Mod: poller_output ENGINE = MEMORY
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.4.1
[b]Plugins[/b] - Host Info (hostinfo - v0.2), Update Checker (update - v0.3), Network Tools (tools - v0.2), FlowView (flowview - v0.3), Read-only Devices Tab (devices - v0.4), Network Discovery (discovery - v0.8.3), Syslog Monitoring (syslog - v0.5.2), Thresholds (thold - v0.3.9), Device Monitoring (monitor - v0.8.2), PHP Network Weathermap (weathermap - v0.941), SuperLinks (superlinks - v0.72), Report Creator (reports - v0.1b)
ejensen
Cacti User
Posts: 55
Joined: Mon Jul 12, 2004 11:39 am

Post by ejensen »

I have noticed something else that may shed light on this problem. After looking at the syslog_alerts and syslog_removal pages from inside the cacti/syslog web interface, I checked my cacti log file and i noticed some new errors.

Code: Select all

CMDPHP: Poller[0] ERROR: SQL Cell Failed "SELECT message FROM syslog where seq=24032" 
CMDPHP: Poller[0] ERROR: SQL Cell Failed "SELECT count(*) from syslog_alert"  
CMDPHP: Poller[0] ERROR: SQL Assoc Failed "SELECT * FROM syslog_alert LIMIT 0, 30"  
CMDPHP: Poller[0] ERROR: SQL Cell Failed "SELECT count(*) from syslog_alert"  
CMDPHP: Poller[0] ERROR: SQL Assoc Failed "SELECT * FROM syslog_alert LIMIT 0, 30"  
I checked the mysql database and I can run those same queries and get the expected results. I also ran those queries in the user context that my syslog plugin is set to use (same username and password).

Anyone have any additional thoughts on this?

Thanks.
User avatar
zorrosam
Cacti User
Posts: 244
Joined: Thu May 03, 2007 3:17 pm
Location: Italy

news?

Post by zorrosam »

HI,

anyone has news around the mail problem for alerts?

is a problem for me don't receive any alert .... is boring a new downgrade on my system.

thanks,

sam
ejensen
Cacti User
Posts: 55
Joined: Mon Jul 12, 2004 11:39 am

Post by ejensen »

I got around the missing alerts/removals not showing and the lack of emails, by doing a total wipe of cacti and the syslog database. then reinstalling the whole thing. i also installed cacti 8.7 fresh this time.

the syslog plugin no correctly shows syslog events, i can click on an event to add it to the alerts/removals/reports and emails to work.

however, i still have two bugs with the syslog plugin...
1. when adding an alert/removal/report when you click the save button it always shows a blank page. if you hit the back button sometimes the alert/removal/report was added into the database twice and I have to remove one of them.

2. color codeing is not showing. for example... critical priorities should show up as RED, but they dont. I'm not sure if this is because I am running cacti under windows or not.
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Re: news?

Post by pepj »

zorrosam wrote:anyone has news around the mail problem for alerts?
With the new syslog version (you need 0.8.7 and new architecture also) I do not have e-mail problem anymore (I have no more to adapt the snmp.class and class.phpmailer) . In am using option "SMTP".

Attention: you need also to install the new "setting-plugin" and check the setting of "Thold" & "Mail / DNS".
Jean-Michel
cacti 0.8.7e | cmd & cactid (cactid 0.8.x) | Linux | MySQL Ver 14.7 Distrib 4.1.12, for Win32 | PHP v5.2.6 | Apache v2.x | Thold | Plugin Architecture | plugin "configuration manager" http://cactiusers.org/forums/topic257.html | plugin "IP subnet calculator IPv4 / IPV6" http://forums.cacti.net/viewtopic.php?t=15428 | plugin banner http://docs.cacti.net/userplugin:banner | Net-SNMP 5.5.2 | cygwin 1.5.18 of 02.07.2005
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

ejensen wrote:2. color codeing is not showing. for example... critical priorities should show up as RED, but they dont. I'm not sure if this is because I am running cacti under windows or not.
Your are right something is strange, but when I change in config.php of syslog following:

Code: Select all

$syslog_colors['err']		= 'E6808C';

Code: Select all

$syslog_colors['error']		= 'E6808C';
The errors are colored.

Try with

Code: Select all

$syslog_colors['crit']		= 'F08896';
$syslog_colors['critical']	= 'F08896';
or

Code: Select all

$syslog_colors['Critical']	= 'F08896';
I have no critical now
Jean-Michel
cacti 0.8.7e | cmd & cactid (cactid 0.8.x) | Linux | MySQL Ver 14.7 Distrib 4.1.12, for Win32 | PHP v5.2.6 | Apache v2.x | Thold | Plugin Architecture | plugin "configuration manager" http://cactiusers.org/forums/topic257.html | plugin "IP subnet calculator IPv4 / IPV6" http://forums.cacti.net/viewtopic.php?t=15428 | plugin banner http://docs.cacti.net/userplugin:banner | Net-SNMP 5.5.2 | cygwin 1.5.18 of 02.07.2005
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests