Cacti Daily export graphs and traffic reports

Source: Internet
Author: User

Cacti daily traffic and graphics export previously done a VBS script, about 300 lines, using a browser simulation open cacti website with VBS simulation Mouse keyboard operation to automatically export and save. However, the efficiency is very low and the automatic export fails due to browser upgrades and other reasons.

Recently re-organized the idea of using VBS's download function to download. Reference to the article Cacti automatic report implementation use VBS to define the download function, then download the required report to the TEMP directory, and then use the VBS script to move to a date-named folder.

The last realized

650) this.width=650; "style=" WIDTH:224PX;HEIGHT:177PX; "title=" 1.png "alt=" Wkiol1svkx-cyg1saaij0vd-ae4178.jpg "src= "Http://s3.51cto.com/wyfs02/M00/58/6C/wKioL1Svkx-CYG1SAAIj0vD-AE4178.jpg" width= "321" height= "211"/>650) this.width=650, "style=" width:222px;float:none;height:178px, "title=" 2.png "alt=" wkiom1svkvxwnvxoaak3hb7sh_4327. JPG "src=" http://s3.51cto.com/wyfs02/M01/58/6F/wKiom1SvkvXwnVxOAAK3hb7sH_4327.jpg "width=" 293 "height=" 298 "/> 650) this.width=650; "style=" width:209px;float:none;height:178px; "title=" 3.png "alt=" Wkiol1svk7mcc15qaajgdvv-jji152.jpg "src=" http://s3.51cto.com/wyfs02/M02/58/6C/ Wkiol1svk7mcc15qaajgdvv-jji152.jpg "width=" 291 "height=" 234 "/>

First: Edit the VBS script:

1. Before using this script, you need to modify the graph_xport.php file in cacti.

file:/cacti/graph_image.php

Include ("./include/auth.php"); Include ("./include/global.php");

Comment out the original include ("./include/auth.php");

Use the Include ("./include/global.php") to verify the password-free download.

2. Use this script to create a directory according to the directory structure specified in the script. Otherwise, an error occurs when you run VBS.

Structure

650) this.width=650; "title=" 4.png "src=" Http://s3.51cto.com/wyfs02/M01/58/6C/wKioL1SvmRawx2E0AAFWi-RM1v0777.jpg " Width= "474" height= "332" alt= "wkiol1svmrawx2e0aafwi-rm1v0777.jpg"/>

3. The Automatically exported VBS script is

  ' This script must be created before using the folder  d:\cacti\cacti graphics \ Monthly Traffic \ca-two lines \  and D:\temps\ graphics \ Month ' where D:\cacti\cacti graphics \ Monthly traffic \ca-two lines \   The final copy of the destination folder for the script, according to the requirements can be changed ' by:fenei  ' mail:[email protected] "Use this script file, need to be cacti:/cacti/graph_ xport.php file modified as follows '  //include ("./include/auth.php"); '  include ("./include/global.php"); ' Comment out autp.php  use global.php authentication ' to avoid login download file ' definition download script file Sub download (url,target)  const adtypebinary  = 1 const adsavecreateoverwrite = 2 dim http,ado set http  = createobject ("Msxml2.xmlhttp")  http.open  "GET",url,false http.send set  Ado = createobject ("ADODB.stream")  ado. Type = adtypebinary ado. Open ado. Write http.responsebody ado. Savetofile target ado. Closeend sub ' Download list, can be modified according to List.xls download  "http://192.168.10.11/cacti/graph_image.php?local_graph_id= 1156&rra_id=3 "," D:\temps\ graphics \ Month \ Total bandwidth. png "download " http://192.168.10.11/cacti/graph_image.php?local_graph_id=1137&rra_id=3 "," D:\temps\ graphics \ Month \ Big customers. png "download " http://192.168.10.11/ Cacti/graph_image.php?local_graph_id=1191&rra_id=3 "," D:\temps\ graphics \ Month \ One meter technology. png "download " http:// 192.168.10.11/cacti/graph_image.php?local_graph_id=1192&rra_id=3 "," D:\temps\ graphics \ Lunar \ Branch Chong network. png " " Copy the file and name it by month, emptying the Temp folder Set fso = createobject ("Scripting.FileSystemObject") fso. copyfolder  "D:\temps\ data \ Month", "D:\CACTI\CACTI data \ Monthly traffic \ca-dual line \" &formatdatetime (date, 1), True fso. deletefile  "D:\temps\ data \ Month \* "

The script defines the download function at the top, then uses the download function to download the corresponding graphical report, and then uses the CopyFolder function to move the report file that has been downloaded to the temp directory into a date-named folder

This article is from the "www.fenei.com" blog, make sure to keep this source http://453861.blog.51cto.com/443861/1601275

Cacti Daily export graphs and traffic reports

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.