[mrtg] writeexpires killing rateup?

Steve Shipway s.shipway at auckland.ac.nz
Fri Jun 17 22:55:03 CEST 2011


Looking at the code, clearly the open is failing (and the code doesnt check for it, naughty!) so you get the error.

Check the HTMLdir to make sure the MRTg process has write permission to it, and if the .meta file already exists, check the write permission on that as well.

Steve

Steve Shipway
University of Auckland ITS
UNIX Systems Design Lead
s.shipway at auckland.ac.nz<mailto:s.shipway at auckland.ac.nz>
Ph: +64 9 373 7599 ext 86487

________________________________
From: mrtg-bounces+s.shipway=auckland.ac.nz at lists.oetiker.ch [mrtg-bounces+s.shipway=auckland.ac.nz at lists.oetiker.ch] on behalf of Grossman, Benjamin [Benjamin.Grossman at kingcounty.gov]
Sent: Saturday, 18 June 2011 6:35 a.m.
To: mrtg at lists.oetiker.ch
Subject: [mrtg] writeexpires killing rateup?

Migrating from Solaris 10 to Red Hat Enterprise 6…

I keep getting:

print() on closed filehandle META at /usr/bin/mrtg line 396.

…in the log.

This is MRTG 2.16.2, installed as a package.

mrtg @ line 396 is:
        # set meta expires if there is an index file
        # 2000/05/03 Bill McGonigle <bill at zettabyte.net>
        if (defined $cfg{'writeexpires'}) {
           my $exp = &expistr($cfg{'interval'});
           my $fil;
           $fil = "$cfg{'htmldir'}index.html"  if -e "$cfg{'htmldir'}index.html";
           $fil = "$cfg{'htmldir'}index.htm"  if -e "$cfg{'htmldir'}index.htm";
            if (defined $fil) {
                   open(META, ">$fil.meta");
                   print META "Expires: $exp\n";
                   close(META);
            }


Any ideas what the problem is?
mrtg runs from cron as a member of group=users; files in Working Directory look like:

[bkg at net-counts log]$ ls -al /var/www/mrtg/inet/switch/ia-isp-ksc
total 768
drwxr-xr-x.   2 apache apache  4096 Jun 13 13:28 .
drwxr-xr-x. 165 apache apache  4096 Jun  9 00:07 ..
-rwxrwxr-x.   1 apache users   2064 Jun 13 13:28 ia-isp-ksc.inet.networks.lcl_4718644-day.png
-rwxrwxr-x.   1 apache users     39 Jun 13 13:28 ia-isp-ksc.inet.networks.lcl_4718644-day.png.meta
-rwxrwxr-x.   1 apache users   2457 Jun 13 12:28 ia-isp-ksc.inet.networks.lcl_4718644-month.png
-rwxrwxr-x.   1 apache users     39 Jun 13 12:28 ia-isp-ksc.inet.networks.lcl_4718644-month.png.meta
-rwxrwxr-x.   1 apache users   3067 Jun 13 12:58 ia-isp-ksc.inet.networks.lcl_4718644-week.png
-rwxrwxr-x.   1 apache users     39 Jun 13 12:58 ia-isp-ksc.inet.networks.lcl_4718644-week.png.meta
-rwxrwxr-x.   1 apache users   2423 Jun 13 10:18 ia-isp-ksc.inet.networks.lcl_4718644-year.png
-rwxrwxr-x.   1 apache users     39 Jun 13 10:18 ia-isp-ksc.inet.networks.lcl_4718644-year.png.meta
-rwxrwxr-x.   1 apache users   8321 Jun 13 13:28 ia-isp-ksc.inet.networks.lcl_4718644.html
-rwxrwxr-x.   1 apache users     39 Jun 13 13:28 ia-isp-ksc.inet.networks.lcl_4718644.html.meta
-rwxrwxr-x.   1 apache users  68601 Jun 13 13:28 ia-isp-ksc.inet.networks.lcl_4718644.log
-rwxrwxr-x.   1 apache users  68601 Jun 13 13:23 ia-isp-ksc.inet.networks.lcl_4718644.old
…
-rwxrwxr-x.   1 apache users   1823 Jun 13 13:28 ia-isp-ksc.inet.networks.lcl_cpu-day.png
-rwxrwxr-x.   1 apache users     39 Jun 13 13:28 ia-isp-ksc.inet.networks.lcl_cpu-day.png.meta
-rwxrwxr-x.   1 apache users   2017 Jun 13 12:38 ia-isp-ksc.inet.networks.lcl_cpu-month.png
-rwxrwxr-x.   1 apache users     39 Jun 13 12:38 ia-isp-ksc.inet.networks.lcl_cpu-month.png.meta
-rwxrwxr-x.   1 apache users   2226 Jun 13 12:58 ia-isp-ksc.inet.networks.lcl_cpu-week.png
-rwxrwxr-x.   1 apache users     39 Jun 13 12:58 ia-isp-ksc.inet.networks.lcl_cpu-week.png.meta
-rwxrwxr-x.   1 apache users   2140 Jun 13 10:18 ia-isp-ksc.inet.networks.lcl_cpu-year.png
-rwxrwxr-x.   1 apache users     39 Jun 13 10:18 ia-isp-ksc.inet.networks.lcl_cpu-year.png.meta
-rwxrwxr-x.   1 apache users   7952 Jun 13 13:28 ia-isp-ksc.inet.networks.lcl_cpu.html
-rwxrwxr-x.   1 apache users     39 Jun 13 13:28 ia-isp-ksc.inet.networks.lcl_cpu.html.meta
-rwxrwxr-x.   1 apache users  52910 Jun 13 13:28 ia-isp-ksc.inet.networks.lcl_cpu.log
-rwxrwxr-x.   1 apache users  52910 Jun 13 13:23 ia-isp-ksc.inet.networks.lcl_cpu.old
-rwxrwxr-x.   1 apache users   6687 Jun 15 13:47 index.html

Config file looks like:

WithPeak[_]: wmy

Include: /opt/local/site/bin/mrtg-header.conf

PageFoot[_]: <HR>Page Design last modified on 16-jan-08 -- <A HREF=http://mrtg.metrokc.gov/mrtg/inet-switch-history.html>"Change History"</A><HR>

AddHead[^]:\n
<table cellspacing="0" border="0" cellpadding="0" width="100%" style="border-collapse: collapse" bordercolor="#111111">\n
   <tr>\n
     <td  width="20%" valign="top" rowspan="2"><img src="Homelogo2.gif" align="left" /></p></td>\n
     <td width="60%" valign="top"><p><h1 align="center">Network Tools</h1></p></td>\n
     <td  width="20%" valign="top" rowspan="2"><img src="mrtg_logo.gif" align="right" /></td>\n
   </tr>\n
   <tr>\n
     <td width="500" valign="bottom" height="53">\n
        <p align="center"><font color="#FF8000" size="2"><strong>CAUTION</strong>: This is primarily for use by King County Network Engineers. </font></p>\n
  <p align="center"><a href="http://net-counts/mrtg">KC MRTG Home</a>| <a href="http://quickstart.inet.networks.lcl/quickstart.htm">QuickStart Home</a> | <a href="mailto:benjamin.grossman at kingcounty.gov">Feedback</a> </p></td>\n
   </tr>\n
</table>\n
  <HR>\n
  <H3><FONT color=#663300>About KC Network's MRTG monitoring tool:</H3>\n
    <H4><b>UNDERSTANDING:</b> Data presented below is based on a 5 minute polling cycle. Please see <A HREF=http://net-counts/mrtg/notes.html>MRTG Notes</A> for more details.</H4><p>\n
  </FONT>\n
  <HR>

# Created by
# /usr/bin/cfgmaker2 --ifdesc=name --global IconDir:/mrtg/ --global WorkDir:/var/www/html/mrtg/inet/switch --global WriteExpires:yes --global "Options[_]:growright,bits,pngdate,printrouter" --subdirs=ia-isp-ksc --community=FullMotionVide
o --dns-domain=inet.networks.lcl "--if-filter=$if_oper  && $if_index>100  && $if_type!=39  && $if_type!=50  && $if_type!=61  && $if_port_name ne "1CTL"  && $if_port_name ne "5CTL"  && $if_port_name ne "1ACTL"  && $if_port_name ne "1BCTL"
  && $if_port_name ne "1CCTL"  && $if_port_name ne "1DCTL" " --if-template=/opt/local/site/bin/marconi-if.template --host-template=/opt/local/site/bin/marconi-host.template --output=46754devicetemp ia-isp-ksc


### Global Config Options

#  for UNIX
# WorkDir: /home/http/mrtg

#  or for NT
# WorkDir: c:\mrtgdata

### Global Defaults

#  to get bits instead of bytes and graphs growing to the right
# Options[_]: growright, bits

EnableIPv6: no
IconDir:/mrtg/
WorkDir:/var/www/html/mrtg/inet/switch
WriteExpires:yes
Options[_]:growright,bits,pngdate,printrouter

######################################################################
# System: ia-isp-ksc
# Description: Marconi ASX-200BX
# Contact: I-Net NOC 206/263-7000
# Location: a#218732 s#437556
######################################################################
#-------------------------------------------------------------
# 1.003 10-oct-07 BkG work on PageTop


Target[ia-isp-ksc.inet.networks.lcl_CPU]: 1.3.6.1.4.1.326.2.2.1.1.1.3.1.2.0&1.3.6.1.4.1.326.2.2.1.1.1.3.1.6.0:xxxxxxxxxxxxx at ia-isp-ksc
SetEnv[ia-isp-ksc.inet.networks.lcl_CPU]: MRTG_INT_IP="" MRTG_INT_DESCR=""
Directory[ia-isp-ksc.inet.networks.lcl_CPU]: ia-isp-ksc
MaxBytes[ia-isp-ksc.inet.networks.lcl_CPU]: 100
Unscaled[ia-isp-ksc.inet.networks.lcl_CPU]: dwmy
Title[ia-isp-ksc.inet.networks.lcl_CPU]: ia-isp-ksc.inet.networks.lcl CPU load
YLegend[ia-isp-ksc.inet.networks.lcl_CPU]: Percentage CPU Load
ShortLegend[ia-isp-ksc.inet.networks.lcl_CPU]: %
Legend1[ia-isp-ksc.inet.networks.lcl_CPU]: CPU load in %
Legend2[ia-isp-ksc.inet.networks.lcl_CPU]: Max CPU load in %
Legend3[ia-isp-ksc.inet.networks.lcl_CPU]: Peak Observed CPU load
Legend4[ia-isp-ksc.inet.networks.lcl_CPU]: Peak Reported Max CPU load
LegendI[ia-isp-ksc.inet.networks.lcl_CPU]: &nbsp;CPU Load:
LegendO[ia-isp-ksc.inet.networks.lcl_CPU]: &nbsp;Max CPU Load:
WithPeak[ia-isp-ksc.inet.networks.lcl_CPU]: ywm
Options[ia-isp-ksc.inet.networks.lcl_CPU]: growright,gauge,nopercent,pngdate,printrouter
PageTop[ia-isp-ksc.inet.networks.lcl_CPU]: <H1>ia-isp-ksc.inet.networks.lcl -- CPU</H1>
  <TABLE>
        <TR><TD>System:</TD><TD>ia-isp-ksc.inet.networks.lcl in a#218732 s#437556</TD></TR>
    <TR><TD>OS:</TD>        <TD>9.2.0.188602</TD></TR>
        <TR><TD>Maintainer:</TD><TD>I-Net NOC 206/263-7000</TD></TR>
        <TR><TD VALING="top">Description:</TD><TD>ia-isp-kscMarconi ASX-200BX</TD></TR>
        <TR><TD>Port Name:</TD><TD>CPU</TD></TR>
  </TABLE>


### Interface 4718644 >> Descr: 'Ethernet-Interface' | Name: '1B1' | Ip: '' | Eth: '' ###

Target[ia-isp-ksc.inet.networks.lcl_4718644]: 4718644:xxxxxxxx at ia-isp-ksc:
SetEnv[ia-isp-ksc.inet.networks.lcl_4718644]: MRTG_INT_IP="" MRTG_INT_DESCR="Ethernet-Interface"

Directory[ia-isp-ksc.inet.networks.lcl_4718644]: ia-isp-ksc
MaxBytes[ia-isp-ksc.inet.networks.lcl_4718644]: 125000000
Title[ia-isp-ksc.inet.networks.lcl_4718644]:  -- ia-isp-ksc.inet.networks.lcl
PageTop[ia-isp-ksc.inet.networks.lcl_4718644]: <H1> -- ia-isp-ksc</H1>
<TABLE>
   <TR><TD>System:</TD>     <TD>ia-isp-ksc at a#218732 s#437556</TD></TR>
   <TR><TD>OS:</TD>         <TD>ForeThought 9.2.0.188602</TD></TR>
   <TR><TD>Maintainer:</TD> <TD>I-Net NOC 206/263-7000</TD></TR>
   <TR><TD>ifType:</TD>     <TD>ethernetCsmacd (6)</TD></TR>
   <TR><TD>Port Name:</TD>  <TD></TD></TR>
   <TR><TD>Max Thruput:</TD>  <TD>1000.0 Mbits/s</TD></TR>
</TABLE>


### Interface 5046271 >> Descr: '' | Name: '1BCTL' | Ip: '' | Eth: '45-00-01-20-62-63-70-00-ff-00-00-2c-20-00-20-48-0d-00-08-00' ###

Target[ia-isp-ksc.inet.networks.lcl_5046271]: 1.3.6.1.4.1.326.2.2.2.1.2.2.1.12.aaa-&1.3.6.1.4.1.326.2.2.2.1.2.2.1.18.aaa-:xxxxxxx at ia-isp-ksc: *53
SetEnv[ia-isp-ksc.inet.networks.lcl_5046271]: MRTG_INT_IP="" MRTG_INT_DESCR=""

Directory[ia-isp-ksc.inet.networks.lcl_5046271]: ia-isp-ksc
MaxBytes[ia-isp-ksc.inet.networks.lcl_5046271]: 73375055
Title[ia-isp-ksc.inet.networks.lcl_5046271]:  -- ia-isp-ksc.inet.networks.lcl
PageTop[ia-isp-ksc.inet.networks.lcl_5046271]: <H1> -- ia-isp-ksc</H1>
<TABLE>
   <TR><TD>System:</TD>     <TD>ia-isp-ksc at a#218732 s#437556</TD></TR>
   <TR><TD>OS:</TD>         <TD>ForeThought 9.2.0.188602</TD></TR>
   <TR><TD>Maintainer:</TD> <TD>I-Net NOC 206/263-7000</TD></TR>
   <TR><TD>ifType:</TD>     <TD>atm (37)</TD></TR>
   <TR><TD>Port Name:</TD>  <TD></TD></TR>
   <TR><TD>Max Thruput:</TD>  <TD>587.0 Mbits/s</TD></TR>
</TABLE>

Benjamin k Grossman
I-Net Network Engineering ~ King County IT ~ http://www.kingcounty.gov/business/oirm/inet.aspx

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/mrtg/attachments/20110617/c7884929/attachment-0001.htm 


More information about the mrtg mailing list