rrdtool,mailgraph,queuegraph (the easy way)

Discussion in 'Tips/Tricks/Mods' started by MTvermoes, Dec 27, 2007.

  1. MTvermoes

    MTvermoes New Member

    (Updated attachment 3.Jan.2008)
    This is testet on CentOS 5.1 with ISPConfig(stable)+Perfect Setup+dovecot

    attached script will install RRDtool +all needed libs with --prefix=/usr
    mailgraph.cgi and queuegraph.cgi will be installed in /root/ispconfig/standard_cgis/cgi-bin/
    mods to detect spam and virus in maillog are made to
    /root/ispconfig/isp/conf/customized_templates/spamassassin.rc.master
    /root/ispconfig/isp/conf/spamassassin.rc.master
    and
    /root/ispconfig/isp/conf/customized_templates/antivirus.rc.master
    /root/ispconfig/isp/conf/antivirus.rc.master

    Before you start :
    Make sure that File::Tail is installed

    perl -MCPAN -e shell
    install File::Tail
    exit

    unpack attached file :
    cd /usr/src
    tar xvzf rmqinstall.tar.gz
    cd rmqinstall
    /bin/sh setup.sh

    You will need to update users spamconf (check this link for info on howto)

    You will allso need to copy mailgraph.cgi and queuegraph.cgi to existing websites cgi-bin

    queuegraph.cgi will only be usefull if you are running a non Maildir queue
     

    Attached Files:

    Last edited: Jan 3, 2008
  2. madmucho

    madmucho ISPConfig Developer

    Im trying do this on mandriva but i have problem during install script runs to end but i thing something is bad.
    Code:
    --11:13:57--  http://www.howtoforge.com/forums/attachment.php?attachmentid=389&d=1173267947
               => `attachment.php?attachmentid=389&d=1173267947'
    Resolving www.howtoforge.com... 78.47.159.34
    Connecting to www.howtoforge.com|78.47.159.34|:80... connected.
    HTTP požadavek odeslán, program čeká na odpověď ... 200 OK
    Délka: 555 [plain/text]
    
    100%[=============================================================>] 555           --.--K/s
    
    11:13:57 (21.17 MB/s) - `attachment.php?attachmentid=389&d=1173267947' saved [555/555]
    
    mv: cannot stat `./antivirus.rc.master.patch.txt': není souborem ani adresářem
    mv: cannot stat `./spamassassin.rc.master.patch.txt': není souborem ani adresářem
    mv: cannot stat `/root/ispconfig/isp/conf/customized_templates/antivirus.rc.master': není souborem ani adresářem
    ./setup.sh: line 68: ./spamassassin.rc.master.patch: není souborem ani adresářem
    ./setup.sh: line 69: ./antivirus.rc.master.patch: není souborem ani adresářem
    rm: cannot remove `./spamassassin.rc.master.patch': není souborem ani adresářem
    rm: cannot remove `./antivirus.rc.master.patch': není souborem ani adresářem
    --11:13:57--  http://mailgraph.schweikert.ch/pub/mailgraph-1.14.tar.gz
               => `mailgraph-1.14.tar.gz'
    Resolving mailgraph.schweikert.ch... 88.198.52.145
    Connecting to mailgraph.schweikert.ch|88.198.52.145|:80... connected.
    HTTP požadavek odeslán, program čeká na odpověď ... 200 OK
    Délka: 22 014 (21K) [application/x-gzip]
    
    
    i have czech locale, but 'není souborem ani adresářem' is 'isnt file or directory'.

    Any idea?
     
  3. MTvermoes

    MTvermoes New Member

    For : madmucho

    It is a problem with with wget not saving to the correct filenames.

    replace
    Code:
    wget "http://www.howtoforge.com/forums/attachment.php?attachmentid=388&d=1173267940" 
    
    with
    Code:
    wget "http://www.howtoforge.com/forums/attachment.php?attachmentid=388&d=1173267940" -O antivirus.rc.master.patch.txt
    
    allso replace
    Code:
    wget "http://www.howtoforge.com/forums/attachment.php?attachmentid=389&d=1173267947"
    
    with
    Code:
    wget "http://www.howtoforge.com/forums/attachment.php?attachmentid=389&d=1173267947"  -O spamassassin.rc.master.patch.txt
    
    Best Regards and a Happy New Year

    Mark

     
    Last edited: Jan 3, 2008
  4. madmucho

    madmucho ISPConfig Developer

    Thanx, i will prepare mandriva specific howto atachments, is there some changes in path(s). It will be easier for beginners.
     
  5. MTvermoes

    MTvermoes New Member

    Update

    Today i have updated the attachment in msg 1.

    Fixes:
    wget not saving to correct filenames, when getting attachments from howtoforge.
    allso patching files :
    /root/ispconfig/isp/conf/antivirus.rc.master
    /root/ispconfig/isp/conf/customized_templates/antivirus.rc.master
    and
    /root/ispconfig/isp/conf/spamassassin.rc.master
    /root/ispconfig/isp/conf/customized_templates/spamassassin.rc.master

    Needed to patch both places on my system to make this work, and allso preserve changes when updating ISPConfig.

    /Mark
     
    Last edited: Jan 3, 2008
  6. hvrossum

    hvrossum New Member

    how to Do call mailgraph.cgi

    Hi,

    I followed the steps to install both Mailgraph and Mailqueue. I find both CGI scripts in de cgi-bin dir in the root/ispconfig.

    How do I get to work? I copied them to a website under ispconfig but I get a server 500 error when I call for them.
    I have tried to put them in de cgi-bin dir which is standardly made when I install a website also in a sub dir cgi-bin under www/webXX/web/ but no luck.

    What am i missing
     
  7. MTvermoes

    MTvermoes New Member

    Error 500 is most likely caused by file permissions.
    The httpd user would need exe permissions mailgraph.cgi, and read permissions to .rrd files.
    Allso a look in the logfile for that server will give you a good hint of what went wrong.
    Make sure the first line in mailgraph.cgi points to the location of perl

    Try do a :
    whereis perl

    /Mark
     
  8. hvrossum

    hvrossum New Member

    Hi Mark,

    Where should I put the link to perl

    Whereis perl gives
    perl: /usr/bin/perl /etc/perl /usr/lib/perl /usr/lib64/perl /usr/local/lib/perl /usr/share/perl /usr/share/man/man1/perl.1.gz

    the mailgraph.cgi
    --- mailgraph.cgi.orig 2007-08-29 11:06:01.000000000 +0200
    +++ mailgraph.cgi 2007-12-26 19:53:33.000000000 +0100
    @@ -16,9 +16,9 @@ my $xpoints = 540;
    my $points_per_sample = 3;
    my $ypoints = 160;
    my $ypoints_err = 96;
    -my $rrd = 'mailgraph.rrd'; # path to where the RRD database is
    -my $rrd_virus = 'mailgraph_virus.rrd'; # path to where the Virus RRD database is
    -my $tmp_dir = '/tmp/mailgraph'; # temporary directory where to store the images
    +my $rrd = '/var/lib/mailgraph.rrd'; # path to where the RRD database is
    +my $rrd_virus = '/var/lib/mailgraph_virus.rrd'; # path to where the Virus RRD database is
    +my $tmp_dir = '/tmp'; # temporary directory where to store the images

    my @graphs = (
    { title => 'Last Day', seconds => 3600*24, },
    @@ -163,7 +163,6 @@ sub print_html()

    thanks

    Harry
     
  9. falko

    falko Super Moderator

    /usr/bin/perl is correct.

    What's the output of
    Code:
    ls -la /path/to/mailgraph.cgi
    ?
     
  10. hvrossum

    hvrossum New Member

    I think we are getting there but what to do to solve. The output is not very promising

    ls: /path/to/mailgraph.cgi: No such file or directory
     
  11. falko

    falko Super Moderator

    You must replace /path/to with the real path.
     
  12. hvrossum

    hvrossum New Member

    As I am just a newbie, always good to learn
    Using you pointer i get the following reponse

    -rwxr-xr-x 1 owner grp 1435 2008-01-15 17:41 /var/www/web14/web/cgi-bin/mailgraph.cgi


    owner and grp are similar to all other files in this web
     
  13. MTvermoes

    MTvermoes New Member

    What output do you get when running :
    /var/www/web14/web/cgi-bin/mailgraph.cgi
    from commandline ?

    /Mark

     
  14. falko

    falko Super Moderator

    Are there any errors in Apache's error log when you call mailgraph.cgi in a browser?
    Did you enable suExec in ISPConfig? If so, disable it and try again.
     
  15. madmucho

    madmucho ISPConfig Developer

    Can someone test if this Mode correctly work in 2.2.21 version? i update my system correctly in testing env and i have problem with antivirus.rc.master file. When updated antivirus.rc.master is set, my mails that come to my mailbox are autmaticaly taged as viruses and then deleted. No one mail is correctly delivered to mailbox. When i comment part >

    Code:
    #{
    #    :0 c
    #    | logger -p mail.info -t smtp-vilter clamd: found virus
    #    :0
    #    /dev/null
    #}
    
    Mails come normaly, i have this part now commented, but this mean my viruses isnt counted in statistic generated by rrdtool.

    In 2.2.19 that work correctly.
     
  16. daveb

    daveb Member

    working here on 2.2.21
    antivirus.rc.master
    Code:
    :0fw
    | /home/admispconfig/ispconfig/tools/clamav/bin/clamassassin
    
    :0:
    * ^X-Virus-Status: Yes
    {
        :0 c
        | logger -p mail.info -t smtp-vilter clamd: found virus
    
        :0
        /dev/null
    }
    Maybe you have other issues if all mail is tagged as viruses.
     
  17. madmucho

    madmucho ISPConfig Developer

    Thank you for reply i try test this again. More deeply :)
     
  18. madmucho

    madmucho ISPConfig Developer

    My failure

    My failure, i have today some time and check this, i turn on global loging for procmail and i see i have bad procmail recepie for antivirus. :)
    Thank god for that loging, i resolve next isue with system account mailing, some information isnt send to my admin mail from ispconfig system. Everithing work fine in mandriva now, i will upgrade production server as soon as possible.


    PS: Know someone something that can parase procmail log file for some stat ? maibe something web based..
     

Share This Page