[HOWTO] Availability Reporting

If you figure out how to do something interesting/cool in Cacti and want to share it with the community, please post your experience here.

Moderators: Moderators, Developers

Author
Message
User avatar
TFC
Cacti Pro User
Posts: 722
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Re: [HOWTO] Availability Reporting

#46 Post by TFC » Wed Apr 20, 2011 2:01 am

U right. i forgot the " .
Now ok
Thnx

User avatar
TFC
Cacti Pro User
Posts: 722
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Re: [HOWTO] Availability Reporting

#47 Post by TFC » Wed Apr 20, 2011 2:20 am

MajorWoody wrote:First off, thanks for this script it works great!

A few enhancements I would love to see:

1. A static html page of the report on the Cacti website.
2. The duration and times of failed polls. So you could see that it was down twice on Tuesday, one time it was down for an hour the other time is was down for 30 minutes.
3. A link to that nodes graph in the e-mail.

I don't know if these are impossible requests or not (I am not much of a programmer) but I think these would greatly enhance there ability.


Thanks again for this awesome script,
Major
another idea is:
Maybe create report group by group. For example my cacti server is for 4 diff. company. And if i can define those company's devices and create report and send mail .. it will be perfect :)

User avatar
TFC
Cacti Pro User
Posts: 722
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Re: [HOWTO] Availability Reporting

#48 Post by TFC » Wed Apr 20, 2011 2:21 am

MajorWoody wrote:First off, thanks for this script it works great!

A few enhancements I would love to see:

1. A static html page of the report on the Cacti website.
2. The duration and times of failed polls. So you could see that it was down twice on Tuesday, one time it was down for an hour the other time is was down for 30 minutes.
3. A link to that nodes graph in the e-mail.

I don't know if these are impossible requests or not (I am not much of a programmer) but I think these would greatly enhance there ability.


Thanks again for this awesome script,
Major
another idea is:
Maybe create report group by group. For example my cacti server is for 4 diff. company. And if i can define those company's devices and create report and send mail .. it will be perfect :)

surajitpal2007
Posts: 35
Joined: Tue Feb 15, 2011 4:51 am

Re: [HOWTO] Availability Reporting

#49 Post by surajitpal2007 » Mon Oct 17, 2011 1:29 pm

Yes.........I have reached in my target....... Oshm..... :P
Attachments
Cacti_Availability_Screenshot.jpg
Cacti_Availability_Screenshot.jpg (149.82 KiB) Viewed 4350 times
Last edited by surajitpal2007 on Mon Aug 12, 2013 5:03 am, edited 3 times in total.

User avatar
TheWitness
Developer
Posts: 14804
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: [HOWTO] Availability Reporting

#50 Post by TheWitness » Mon Oct 17, 2011 8:45 pm

surajitpal2007 wrote:Can any one please say me, how I can add this .php / any .php into my cacti as I am running cacti in windows 2003
Personally, I would use Linux. Trust me, for web hosting, there's nothing better on the planet. So, that would be the first thing that I would have you do. Don't mess with Windows unless you use BSOD's Installer.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository


I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.

User avatar
TFC
Cacti Pro User
Posts: 722
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Re: [HOWTO] Availability Reporting

#51 Post by TFC » Tue Oct 18, 2011 12:09 am

If u wanna have PAM (php,Apache,Mysql) platform ,Uniz and Linuz are the best.

asecure
Posts: 4
Joined: Mon Nov 09, 2009 4:22 am

Re: [HOWTO] Availability Reporting

#52 Post by asecure » Tue May 22, 2012 9:44 pm

Hi All,

Appreciate some help on the matter. Have no php whatsoever. The email comes in fine but only shows the headers without hosts
When running the script form cli, i get back the below-mentioned error message.

Code: Select all

Warning: Invalid argument supplied for foreach() in /var/www/cacti/scripts/availabilityReport.php on line 323
The line in question is.
foreach ($today as $device => $todayStat) {
Searching on the web tell me that this has something to do with php expecting an array but the variables being passed isn't seen as one.

The whole function is as per below.

Code: Select all

function yesterdaysAvailability() 
{
	global $tmpDir, $dailyRecipients, $daily, $yesterdayFile, $weeklyStats;
	
	$today = getReportDetails();
	readStats($yesterdayFile,$yesterday);
	foreach ($today as $device => $todayStat) {
		if (isset($yesterday[$device])) {
			// Make sure yesterday's counters are lower than todays before subtracting one from the other
			if ($yesterday[$device]['total_polls'] < $today[$device]['total_polls']) {
				$avail[$device]['total_polls'] = $today[$device]['total_polls'] - $yesterday[$device]['total_polls'];
				$avail[$device]['failed_polls'] = $today[$device]['failed_polls'] - $yesterday[$device]['failed_polls'];
			} else {
				// Perhaps this device was deleted and added back to Cacti with the same name.  In any case, just use the total polls read today
				$avail[$device]['total_polls'] = $today[$device]['total_polls'];
				$avail[$device]['failed_polls'] = $today[$device]['failed_polls'];
			}
			$avail[$device]['availability'] = number_format(($avail[$device]['total_polls'] - $avail[$device]['failed_polls']) / $avail[$device]['total_polls'] * 100,5,'.','');
		} else {
			$avail[$device] = $today[$device];
		}
	}
	
	$weeklyStats[(date("N")-1)] = $avail;

	// Only write out data if this is the first time running today
	
	natsort2d($avail,'availability');
	
	$extTitle = '';
	
	if ($daily['topX'] > 0) {
		$extTitle .= "Daily Top {$daily['topX']} Worst Availability<br>";
		$count = 0;
		foreach ($avail as $device => $stat) {
			$count++;
			$tmp[$device] = $stat;
			if ($count == $daily['topX']) {
				break;
			}
		}
		if (isset($tmp)) {
			$avail = $tmp;
		} else {
			$avail = array();
		}
	}
	
	if ($daily['availPercent'] > 0) {
		$extTitle .= "Devices with Availability Less Than {$daily['availPercent']}%<br>";
		foreach ($avail as $device => $stat) {
			if ($stat['availability'] > $daily['availPercent']) {
				break;
			}
			$tmp[$device] = $stat;
		}
		if (isset($tmp)) {
			$avail = $tmp;
		} else {
			$avail = array();
		}
	}
	
	if (file_exists($tmpDir . $yesterdayFile)) {
		$extTitle .= "Report Duration: " .  date("F j, Y, g:i a",filemtime($tmpDir . $yesterdayFile)) . 
	    	        " - " . date("F j, Y, g:i a") . "<br>";
	}

	if (!(file_exists($tmpDir . $yesterdayFile)) or (date("d", filemtime($tmpDir . $yesterdayFile)) != date("d"))) {
		writeData($yesterdayFile,$today);
	}
	
	emailReport($avail,$dailyRecipients,"Daily Availability Report",$extTitle);
	
}
Cacti Version - 0.8.7e
Plugin Architecture - 2.5
Poller Type - Cactid v
Server Info - Linux 2.6.28-19-server
Web Server - Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.6 with Suhosin-Patch
PHP - 5.2.6-3ubuntu4.6
PHP Extensions - zip, xmlwriter, libxml, xml, wddx, tokenizer, sysvshm, sysvsem, sysvmsg, session, SimpleXML, sockets, soap, SPL, shmop, standard, Reflection, posix, mime_magic, mbstring, json, iconv, hash, gettext, ftp, filter, exif, dom, dba, date, ctype, calendar, bz2, bcmath, zlib, pcre, openssl, xmlreader, apache2handler, ldap, mysql, mysqli, PDO, pdo_mysql
MySQL - 5.0.75-0ubuntu10.5
RRDTool - 1.3.1
SNMP - 5.4.1
Plugins
  • Host Info (hostinfo - v0.2)
    Global Plugin Settings (settings - v0.5)
    Send Graphs via EMail (nectar - v0.26)
    Thresholds (thold - v0.4.1)
    QuickTree (quicktree - v0.2)
    Device Monitoring (monitor - v0.8.2)

sergiop11
Posts: 3
Joined: Wed Sep 12, 2012 1:22 pm

Re: [HOWTO] Availability Reporting

#53 Post by sergiop11 » Wed Sep 12, 2012 1:30 pm

english
as I do to install reports help please,
now if I generate the graphs, what I want is to generate reports'm somewhat new to this I would ask you to please explain so I understand thanks good afternoon


español

como le hago para instalar reportes ayuda por favor,
actualmente si me generar la gráficas, lo quiero es que genere reportes soy un tanto nuevo en esto les pediría de favor que me expliquen de manera que entienda gracias buenas tardes

sergiop11
Posts: 3
Joined: Wed Sep 12, 2012 1:22 pm

Re: [HOWTO] Availability Reporting

#54 Post by sergiop11 » Wed Sep 12, 2012 1:35 pm

como hago para instalar informes ayudan por favor,
ahora si puedo generar los gráficos, lo que quiero es generar reports'm algo nuevo en esto me gustaría pedirle que explique lo que entiendo gracias buenas tardes español Como Le Hago párr Instalar Reportes Ayuda please, actualmente si me Generar la Gráficas, lo quiero de es Que genere Reportes soy un Tanto en Nuevo ESTO les pediría de favor Que me expliquen de Manera Que entienda gracias buenas tardes

panvin
Posts: 3
Joined: Tue Aug 13, 2013 11:59 pm

Re: [HOWTO] Availability Reporting

#55 Post by panvin » Thu Feb 06, 2014 8:20 am

hi, thanks a lot for this feature!!!

is it possible to insert in email "Notes" row from host table?

monkeydedragon
Posts: 9
Joined: Fri Mar 06, 2015 10:36 am

Re: [HOWTO] Availability Reporting

#56 Post by monkeydedragon » Thu Mar 14, 2019 2:23 am

try use this script for my cacti but not working is there any log or something i can trace.
cacti 0.8.8c
suse linux

need advice.

Post Reply