About 50 pieces of graphs monitored by cacti on the mysql server have been obtained and shown. Some problems have been encountered and the impressive records are as follows:
(1 ):Add io monitoring
Click Create Graphs for this Host to Create an IO graph. An error is returned.
This data query returned 0 rows, perhaps there was a problem executing this data query. You can run this data query in debug mode to get more information.
Enter* Turn On Graph Debug ModeMode, the error is as follows:
RRDTool Command:
/Usr/bin/rrdtool graph -\
-- Imgformat = PNG \
-- Starting =-86400 \
-- End =-300 \
-- Title = 'db-m2-slave-1-Traffic '\
-- Rigid \
-- Base= 1000 \
-- Width = 120 \
-- Width = 500 \
-- Alt-autoscale-max \
-- Lower-limit = '0 '\
-- Vertical-label = 'bits per second '\
-- Slope-mode \
-- Font TITLE: 10 :\
-- Font AXIS: 7 :\
-- Font LEGEND: 8 :\
-- Font UNIT: 7 :\
CDEF: cdefa = 'a, 8 ,*'\
AREA: cdefa # 00CF00FF: 'inbound '\
Uplint: cdefa: LAST: 'Current \: % 8.2lf % s '\
Uplint: cdefa: AVERAGE: 'average \: % 8.2lf % s '\
Uplint: cdefa: MAX: 'maximum \: % 8.2lf % s \ n '\
LINE1: cdefa # 002A97FF: 'outbound '\
Uplint: cdefa: LAST: 'Current \: % 8.2lf % s '\
Uplint: cdefa: AVERAGE: 'average \: % 8.2lf % s '\
Uplint: cdefa: MAX: 'maximum \: % 8.2lf % s \ N'
RRDTool Says:
ERROR: invalid rpn expression in: a, 8, *, as shown in
Edit the/etc/snmp/snmpd. conf file on a linux host
Found: com2sec notConfigUser default public
Modify to: com2sec notConfigUser all public
Find: access notConfigGroup "" any noauth exact systemview none
Change to: access notConfigGroup "" any noauth exact all none
Find: # view all supported ded. 1 80 and remove the line,
Find # view mib2 shortded .iso.org. dod. internet. mgmt. mib-2 fc remove the modified,
Restart snmpd:/etc/init. d/snmpd restart
(2 ):How to add hosts to MySQL
[Root @ squid-2 test] # service httpd restart
Stop httpd: [OK]
Starting httpd: cocould not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[OK]
1) enter the configuration file directory
Cd/etc/httpd/conf/
2) edit the httpd. conf file, search for "# ServerName", and add ServerName localhost: 80
[Root @ server conf] # ls
Extra httpd. conf magic mime. types original
[Root @ server conf] # vi httpd. conf
# ServerName www.example.com: 80
ServerName localhost: 80
3) Restart apache.
(3) Startup Error
[Root @ squid-2 error] # tail-f/var/log/httpd/error_log
[Sat May 31 22:49:02 2014] [notice] caught SIGTERM, shutting down
[Sat May 31 22:49:02 2014] [notice] SELinux policy enabled; httpd running as context unconfined_u: system_r: httpd_t: s0
[Sat May 31 22:49:02 2014] [notice] suEXEC mechanic enabled (wrapper:/usr/sbin/suexec)
[Sat May 31 22:49:02 2014] [notice] Digest: generating secret for digest authentication...
[Sat May 31 22:49:02 2014] [notice] Digest: done
[Sat May 31 22:49:02 2014] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 configured -- resuming normal operations
Solution: Disable SELinux and firewall.
(4) MySQL metric item plotting Error
[Sat May 31 23:20:10 2014] [error] [client 192.168.171.71] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 523800 bytes) in/var/www/html/cacti/lib/adodb. inc. php on line 833
Cacti. SQL file needs to be imported
Mysql-u root-p cacti </var/www/html/cacti. SQL
(5) Error reported by SNMP-Interface Statistics
The following error is returned when an SNMP-Interface Statistics is created:
Created graph: db-m2-slave-2-Traffic-| query_ifName |
ERROR: no Data Source associated. Check Template
[Root @ squid-2 html] # snmpwalk-c public-v 2c 10.254.3.73 ifHCInOctets
IF-MIB: ifHCInOctets = No more variables left in this MIB View (It is past the end of the MIB tree)
[Root @ squid-2 html] #
[Root @ squid-2 html] # snmpwalk-c public-v 2c 10.254.3.73 if
IF-MIB: ifTable = No Such Object available on this agent at this OID
So modify snmpd. conf again and restart snmpd.
Access notConfigGroup "" any noauth exact systemview none -->
Access notConfigGroup "" any noauth exact all none
[Root @ db-m2-slave-2 ~] # Service snmpd restart
Stop snmpd: [OK]
Starting snmpd: [OK]
[Root @ db-m2-slave-2 ~] #
[Root @ squid-2 html] # snmpwalk-c public-v 2c 10.254.3.73 if
IF-MIB: ifTable = No more variables left in this MIB View (It is past the end of the MIB tree)
[] Solution
In the snmpd. conf configuration file, find the following fields: [/color]
# Incl/excl subtree mask
# View all supported ded. 1 80
Remove "#" before this row.
Then restart the snmpd service.
Error (6 ):
Remove an error chart
Go to Console à Graph Management à Host (select the Host address with an error)-> Search (Search for the keyword Used Space with an error), and find the Graph Title column with no error reported, select all on the right and clickGoDelete invalid graphs, as shown in:
ClickContinueButton.
(7): the Memory Free value is nan.
Analysis: memery free has no data. cause: the maximum memory size of rrdtool is 10 Gb.
[Root @ squid-2 local] # find/-name * mem *. rrd
/Var/www/html/cacti/rra/db-m2-slave-1_mem_buffers_189.rrd
/Var/www/html/cacti/rra/db-master-2_mem_free_156.rrd
/Var/www/html/cacti/rra/db-m2-slave-1_lock_system_memory_20.rrd
/Var/www/html/cacti/rra/db-m2-slave-2_total_mem_alloc_74.rrd
/Var/www/html/cacti/rra/db-m2-slave-1_total_mem_alloc_23.rrd
/Var/www/html/cacti/rra/db-m2-slave-2_lock_system_memory_71.rrd
/Var/www/html/cacti/rra/localhost_mem_swap_4.rrd
/Var/www/html/cacti/rra/db-master-2_total_mem_alloc_117.rrd
/Var/www/html/cacti/rra/db-master-2_mem_cache_155.rrd
/Var/www/html/cacti/rra/db-master-2_mem_buffers_154.rrd
/Var/www/html/cacti/rra/db-m2-slave-1_mem_free_191.rrd
/Var/www/html/cacti/rra/localhost_mem_buffers_3.rrd
/Var/www/html/cacti/rra/db-m2-slave-2_mem_free_164.rrd
/Var/www/html/cacti/rra/db-m2-slave-2_mem_buffers_162.rrd
/Var/www/html/cacti/rra/db-m2-slave-1_mem_buffers_54.rrd
/Var/www/html/cacti/rra/db-m2-slave-1_mem_swap_55.rrd
/Var/www/html/cacti/rra/db-master-2_lock_system_memory_114.rrd
/Var/www/html/cacti/rra/db-m2-slave-2_mem_cache_163.rrd
/Var/www/html/cacti/rra/db-m2-slave-1_mem_cache_190.rrd
/Var/www/html/cacti/rra/db-master-2_mem_free_146.rrd
[Root @ squid-2 local] #
[Root @ squid-2 local] # rrdtool info/var/www/html/cacti/rra/db-m2-slave-1_mem_free_191.rrd | grep mem_free
Filename = "/var/www/html/cacti/rra/db-m2-slave-1_mem_free_191.rrd"
Ds [mem_free]. type = "GAUGE"
Ds [mem_free]. minimal_heartbeat = 120
Ds [mem_free]. min = 0.20.000000e + 00
Ds [mem_free]. max = 1.20.000000e + 07
Ds [mem_free]. last_ds = "34166500"
Ds [mem_free]. value = NaN
Ds [mem_free]. unknown_sec = 2
[Root @ squid-2 local] #
Note: The maximum value of ds [mem_free]. max = 1.20.000000e + 07 data is set to 10 Gb.
Run the-help command to view how rrdtool is modified:
[Root @ squid-2 local] # rrdtool -- help
RRDtool 1.3.8 Copyright 1997-2009 by Tobias Oetiker <tobi@oetiker.ch>
Compiled Aug 21 2010 10:57:18
Usage: rrdtool [options] command command_options
Valid commands: create, update, updatev, graph, graphv, dump, restore,
Last, lastupdate, first, info, fetch, tune,
Resize, xport
RRDtool is distributed under the Terms of the GNU General
Public License Version 2. (www.gnu.org/copyleft/gpl.html)
For more information read the RRD manpages
[Root @ squid-2 local] #
Modify the parameters using the tune command:
[Root @ squid-2 rra] # rrdtool tune * _ mem_free _ *. rrd mem_free: 100000000
DS [mem_free] typ: GAUGE hbt: 120 min: 0.0000 max: 10000000.0000
[Root @ squid-2 rra] #
A message is displayed, indicating that the table name tune failed. a-a parameter is missing and the following is modified again:
[Root @ squid-2 rra] # rrdtool tune * _ mem_cache _ *. rrd-a mem_cache: 3000000000
[Root @ squid-2 rra] # rrdtool tune * _ mem_free _ *. rrd-a mem_free: 3000000000
[Root @ squid-2 rra] # rrdtool tune * _ mem_buffers _ *. rrd-a mem_buffers: 3000000000
[Root @ squid-2 rra] #
It is found that after rrdtool is executed, the nan of only one host is changed to a number, and the nan of other hosts is not changed. The reason is that rrdtool tune *-... The command has only one. rrd file, and the rest need to manually execute the rrdtool tune command again and again.
To simplify the operation, I wrote an ssh script as follows:
vim /root/rrdtool_increate_mem.shcd /var/www/html/cacti/rrals *_mem_free_*.rrd -1 >a_mem_free.txtfor i in `cat a_mem_free.txt`dorrdtool tune $i -a mem_free:300000000;done;ls *_mem_cache_*.rrd -1 >a_mem_cache.txtfor i in `cat a_mem_cache.txt`dorrdtool tune $i -a mem_cache:300000000;done;ls *_mem_buffers_*.rrd -1 >a_mem_buffers.txtfor i in `cat a_mem_buffers.txt`dorrdtool tune $i -a mem_buffers:300000000;done;
Directly sh/root/rrdtool_increate_mem.sh.
[Supplement]
To debug the cacti graph, follow these steps:
(1) Console, go to Graph Manager, select the target Host, search for Memory, select the Graph you want, and click the link. For example, here is Memory Usage, as shown in:
(2) Click the Memory Usage link and click Debug mode in the upper-right corner:
(3) The following debug interface is displayed. You can slowly observe the RRDTool Command, why is the-nan value.
(8) Dual-nic Traffic Nic Traffic problems
For example, em1 and em2 all point to one IP address, but em1 does not take effect, em2 takes effect, but the IP address is on em1 and is not displayed in the em2 column.
Therefore, there is no data in the graph, all of which are-nan-values, as shown below:
Run check on the cacti Server:
[Root @ squid-2 rra] # snmpwalk-v 2c-c public 10.254.3.72 IF-MIB: ifDescr
IF-MIB: ifDescr.1 = STRING: lo
IF-MIB: ifDescr.2 = STRING: em1
IF-MIB: ifDescr.3 = STRING: em2
IF-MIB: ifDescr.4 = STRING: em3
IF-MIB: ifDescr.5 = STRING: em4
[Root @ squid-2 rra] #
There are indeed four Nic information records, all of which are OK and normal. After careful troubleshooting, we find that the main cause is to select Interface-Traffic (bits/sec) in the drop-down box ), do not select Interface-Traffic (bytes/sec), as shown in:
When Interface-Traffic (bits/sec) is selected, graph generates data.
(9): InnoDB Active/Locked Transactions
RRDTool Says:
ERROR: opening '/var/www/html/cacti/rra/db-m1-slave-1_locked_transactions_215.rrd': No such file or directory
The reason is that the mysql database account on the mysql server that enables cacti to access is not created. Create a mysql account and solve the problem.
(10 ):Tomcat-Connection Rate
RRDTool Says:
ERROR: invalid y-grid format
Choose Console> Graph templates> Tomcat-Connection Rate> Unit Grid Value (-- unit/-- y-grid)
Change the default value of 1 to 0.