Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Sun May 26, 2019 2:51 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 56 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
 Post subject: Re: [HOWTO] Availability Reporting
PostPosted: Wed Apr 20, 2011 2:01 am 
Offline
Cacti Pro User
User avatar

Joined: Wed Apr 09, 2003 2:17 am
Posts: 722
Location: Izmir/Turkey
U right. i forgot the " .
Now ok
Thnx


Top
 Profile  
 
 Post subject: Re: [HOWTO] Availability Reporting
PostPosted: Wed Apr 20, 2011 2:20 am 
Offline
Cacti Pro User
User avatar

Joined: Wed Apr 09, 2003 2:17 am
Posts: 722
Location: Izmir/Turkey
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 :)


Top
 Profile  
 
 Post subject: Re: [HOWTO] Availability Reporting
PostPosted: Wed Apr 20, 2011 2:21 am 
Offline
Cacti Pro User
User avatar

Joined: Wed Apr 09, 2003 2:17 am
Posts: 722
Location: Izmir/Turkey
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 :)


Top
 Profile  
 
 Post subject: Re: [HOWTO] Availability Reporting
PostPosted: Mon Oct 17, 2011 1:29 pm 
Offline

Joined: Tue Feb 15, 2011 4:51 am
Posts: 35
Yes.........I have reached in my target....... Oshm..... :P


Attachments:
Cacti_Availability_Screenshot.jpg
Cacti_Availability_Screenshot.jpg [ 149.82 KiB | Viewed 4142 times ]


Last edited by surajitpal2007 on Mon Aug 12, 2013 5:03 am, edited 3 times in total.
Top
 Profile  
 
 Post subject: Re: [HOWTO] Availability Reporting
PostPosted: Mon Oct 17, 2011 8:45 pm 
Offline
Developer
User avatar

Joined: Tue May 14, 2002 5:08 pm
Posts: 14804
Location: MI, USA
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.


Top
 Profile  
 
 Post subject: Re: [HOWTO] Availability Reporting
PostPosted: Tue Oct 18, 2011 12:09 am 
Offline
Cacti Pro User
User avatar

Joined: Wed Apr 09, 2003 2:17 am
Posts: 722
Location: Izmir/Turkey
If u wanna have PAM (php,Apache,Mysql) platform ,Uniz and Linuz are the best.


Top
 Profile  
 
 Post subject: Re: [HOWTO] Availability Reporting
PostPosted: Tue May 22, 2012 9:44 pm 
Offline

Joined: Mon Nov 09, 2009 4:22 am
Posts: 4
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:
Warning: Invalid argument supplied for foreach() in /var/www/cacti/scripts/availabilityReport.php on line 323


The line in question is.
Quote:
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:
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);
   
}


Quote:
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)


Top
 Profile  
 
 Post subject: Re: [HOWTO] Availability Reporting
PostPosted: Wed Sep 12, 2012 1:30 pm 
Offline

Joined: Wed Sep 12, 2012 1:22 pm
Posts: 3
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


Top
 Profile  
 
 Post subject: Re: [HOWTO] Availability Reporting
PostPosted: Wed Sep 12, 2012 1:35 pm 
Offline

Joined: Wed Sep 12, 2012 1:22 pm
Posts: 3
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


Top
 Profile  
 
 Post subject: Re: [HOWTO] Availability Reporting
PostPosted: Thu Feb 06, 2014 8:20 am 
Offline

Joined: Tue Aug 13, 2013 11:59 pm
Posts: 3
hi, thanks a lot for this feature!!!

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


Top
 Profile  
 
 Post subject: Re: [HOWTO] Availability Reporting
PostPosted: Thu Mar 14, 2019 2:23 am 
Offline

Joined: Fri Mar 06, 2015 10:36 am
Posts: 9
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 56 posts ]  Go to page Previous  1, 2, 3, 4

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group