Cacti: Unterschied zwischen den Versionen

Aus crazylinux.de
Zur Navigation springen Zur Suche springen
(cats)
 
(35 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
Cacti
'''Cacti''' is a complete network graphing solution designed to harness the power of RRDTool's data storage and graphing functionality. Cacti provides a fast poller, advanced graph templating, multiple data acquisition methods, and user management features out of the box. All of this is wrapped in an intuitive, easy to use interface that makes sense for LAN-sized installations up to complex networks with hundreds of devices.&nbsp; http://cacti.net/<br>


=Erweiterungen=
download einiger Scripts, siehe [http://crazylinux.de/files/ Files]<br>
Download siehe [http://crazylinux.de/files/ Files]
 
==iptables==
= Tips<br> =
http://forums.cacti.net/about8091.html<br>
 
[http://crazylinux.de/files/it_stuff/cacti/iptables/ download cacti templates]. Da iptables als root ausgeführt werden muss, wird das script über sudo aufgerufen:
*[http://docs.cacti.net/node/358 Howto use externally updated rrd files]<br>
/etc/sudoers
 
<pre>
= Erweiterungen  =
#logging
 
*[http://cactiusers.org/downloads/plugins/ Plugin Architecture + Plugins]
*[http://trac2.assembla.com/npc Nagios Plugin for Cacti]<br>
*http://www.debianhelp.co.uk/cactitemplates.htm
 
== Dovecot and Postfix (via SNMP) ==
see [[Cacti/Dovecot Postfix]]
 
== fail2ban ==
via snmp see https://www.pitt-pladdy.com/blog/_20130324-154457_0000_fail2ban_on_Cacti_via_SNMP/
 
== iptables ==
 
http://forums.cacti.net/about8091.html<br> [http://crazylinux.de/files/it_stuff/cacti/iptables/ download cacti templates]. Da iptables als root ausgeführt werden muss, wird das script über sudo aufgerufen: /etc/sudoers  
<pre>#logging
Defaults syslog = local2
Defaults syslog = local2
# User privilege specification
# User privilege specification
www-data    ALL = NOPASSWD: /usr/share/cacti/site/scripts/iptables.pl
www-data    ALL = NOPASSWD: /usr/share/cacti/site/scripts/iptables.pl
</pre>
</pre>  
Damit der syslog nicht damit unnötig 'beloggt' wird, loggen wir an log-facility local2 und damit in ein eigenes Logfile
Damit der syslog nicht damit unnötig 'beloggt' wird, loggen wir an log-facility local2 und damit in ein eigenes Logfile /etc/syslog.conf:  
/etc/syslog.conf:
<pre>...
<pre>
...
*.*;auth,authpriv.none;mail.!*;daemon.!info;cron.!*;local2.none        -/var/log/syslog
*.*;auth,authpriv.none;mail.!*;daemon.!info;cron.!*;local2.none        -/var/log/syslog
...
...
local2.* /var/log/sudo.log
local2.* /var/log/sudo.log
</pre>
</pre>  
 
<source lang="php">
<source lang=php>
#!/usr/bin/perl
#!/usr/bin/perl
###
###
Zeile 69: Zeile 80:
print "Usage: $0 Chain\n";
print "Usage: $0 Chain\n";
}
}
</source>
</source>  
 
== Mysql  ==
see http://forums.cacti.net/viewtopic.php?f=12&t=42427 OR
 
 
=== Percona Monitoring Plugins ===
The Percona Monitoring Plugins are high-quality components to add enterprise-grade MySQL capabilities to your existing in-house, on-premises monitoring solutions. The components are designed to integrate seamlessly with widely deployed solutions such as Nagios and Cacti, and are delivered in the form of templates, plugins, and scripts. [http://www.percona.com/doc/percona-monitoring-plugins/ More]
[[Datei:Cacti-graph-set.png|ohne|Cacti-graph-set]]


==Mysql==
== Apache  ==
http://forums.cacti.net/viewtopic.php?t=6108


==Squid==
[http://forums.cacti.net/about17995.html ApacheStats 0.6 (PHP Script Server Version)]
in /etc/snmp/snmpd.conf
<pre>
proxy -v 1 -c public localhost:3401 .1.3.6.1.4.1.3495.1
</pre>


und in /etc/squid/squid.conf
== APC - PHP cache ==
<pre>
acl snmppublic snmp_community public
snmp_access allow snmppublic localhost
snmp_access deny all
snmp_port 3401
</pre>


http://forums.cacti.net/about4142-0-asc-0.html
see http://artur.ejsmont.org/blog/content/palm-v3-bundle-of-php-apache-linux-and-memcached-monitoring-scripts-and-cacti-graphs-apc


==Qmail==
== Qmail ==
snmpd erweitern: http://wotsit.thingy.com/haj/cacti/cacti-qmail.html<br>


<pre>
snmpd erweitern: http://wotsit.thingy.com/haj/cacti/cacti-qmail.html<br> <source lang="bash">#/etc/snmp/snmpd.conf
#/etc/snmp/snmpd.conf
...
...
exec .1.3.6.1.4.1.2021.50.1 qmail-message-status /usr/local/bin/qmailmrtg7 s /var/log/qmail
extend .1.3.6.1.4.1.18689.1.3 qmail-message-status /usr/local/bin/qmailmrtg7 s /var/log/qmail
exec .1.3.6.1.4.1.2021.50.2 qmail-bytes-transfer /usr/local/bin/qmailmrtg7 b /var/log/qmail
extend .1.3.6.1.4.1.18689.1.3 qmail-bytes-transfer /usr/local/bin/qmailmrtg7 b /var/log/qmail
exec .1.3.6.1.4.1.2021.50.3 qmail-smtp-concurrency /usr/local/bin/qmailmrtg7 t /var/log/qmail/smtpd
extend .1.3.6.1.4.1.18689.1.3 qmail-smtp-concurrency /usr/local/bin/qmailmrtg7 t /var/log/qmail/smtpd
exec .1.3.6.1.4.1.2021.50.4 qmail-sessions /usr/local/bin/qmailmrtg7 a /var/log/qmail/smtpd
extend .1.3.6.1.4.1.18689.1.3 qmail-smtp-sessions /usr/local/bin/qmailmrtg7 a /var/log/qmail/smtpd
exec .1.3.6.1.4.1.2021.50.5 qmail-queue /usr/local/bin/qmailmrtg7 q /var/qmail/queue
extend .1.3.6.1.4.1.18689.1.3 qmail-queue /usr/local/bin/qmailmrtg7 q /var/qmail/queue
exec .1.3.6.1.4.1.2021.50.6 qmail-messages /usr/local/bin/qmailmrtg7 m /var/log/qmail
extend .1.3.6.1.4.1.18689.1.3 qmail-messages /usr/local/bin/qmailmrtg7 m /var/log/qmail
exec .1.3.6.1.4.1.2021.50.7 qmail-concurrency /usr/local/bin/qmailmrtg7 c /var/log/qmail
extend .1.3.6.1.4.1.18689.1.3 qmail-concurrency /usr/local/bin/qmailmrtg7 c /var/log/qmail
exec .1.3.6.1.4.1.2021.50.8 qmail-smtp-concurrency /usr/local/bin/qmailmrtg7 t /var/log/qmail/smtpd_auth
#optional, a second smtp-service
exec .1.3.6.1.4.1.2021.50.9 qmail-sessions /usr/local/bin/qmailmrtg7 a /var/log/qmail/smtpd_auth
extend .1.3.6.1.4.1.18689.1.3 qmail-mailout-smtp-concurrency /usr/local/bin/qmailmrtg7 t /var/log/qmail/smtpd_auth
extend .1.3.6.1.4.1.18689.1.3 qmail-mailout-sessions /usr/local/bin/qmailmrtg7 a /var/log/qmail/smtpd_auth
...
...
</pre>
</source> Werte abfragen: snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.18689.1.3


Werte abfragen:
Cacti-Templates: http://forums.cacti.net/about3839.html
snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.50


Cacti-Templates: http://forums.cacti.net/about3839.html
OIDs:  


OIDs:
{| width="661" border="1"
{| width="661" border="1"
|  align="center" | <tt>Qmail - Messages - Attempts</tt>
| align="center" | <tt>.1.3.6.1.4.1.2021.50.1.101.2</tt>
|-
|-
| align="center" | <tt>Qmail - Messages - Deliveries</tt>
| align="center" | <tt>Qmail - Messages - Attempts</tt>  
| align="center" | <tt>.1.3.6.1.4.1.2021.50.1.101.1</tt>
| align="center" | <tt>.1.3.6.1.4.1.18689.1.3.4.1.2.14.113.109.97.105.108.45.109.101.115.115.97.103.101.115.2</tt>
|-
|-
| align="center" | <tt>Qmail - Bits Transfer</tt>
| align="center" | <tt>Qmail - Messages - Deliveries</tt>  
| align="center" | <tt>.1.3.6.1.4.1.2021.50.2.101.1</tt>
| align="center" | <tt>.1.3.6.1.4.1.18689.1.3.4.1.2.14.113.109.97.105.108.45.109.101.115.115.97.103.101.115.1</tt>
|-
|-
| align="center" | <tt>Qmail - SMTP Concurrency</tt>
| align="center" | <tt>Qmail - Bits Transfer</tt>  
| align="center" | <tt>.1.3.6.1.4.1.2021.50.3.101.1</tt>
| align="center" | <tt>.1.3.6.1.4.1.18689.1.3.4.1.2.20.113.109.97.105.108.45.98.121.116.101.115.45.116.114.97.110.115.102.101.114.1</tt>
|-
|-
| align="center" | <tt>Qmail - SMTP Totals - Allow</tt>
| align="center" | <tt>Qmail - SMTP Concurrency</tt>  
| align="center" | <tt>.1.3.6.1.4.1.2021.50.4.101.1</tt>
| align="center" | <tt>.1.3.6.1.4.1.18689.1.3.4.1.2.22.113.109.97.105.108.45.115.109.116.112.45.99.111.110.99.117.114.114.101.110.99.121.1</tt>
|-
|-
| align="center" | <tt>Qmail - SMTP Totals - Deny</tt>
| align="center" | <tt>Qmail - SMTP Totals - Allow</tt>  
| align="center" | <tt>.1.3.6.1.4.1.2021.50.4.101.2</tt>
| align="center" | <tt>.1.3.6.1.4.1.18689.1.3.4.1.2.19.113.109.97.105.108.45.115.109.116.112.45.115.101.115.115.105.111.110.115.1</tt>
|-
|-
| align="center" | <tt>Qmail - Queue Size</tt>
| align="center" | <tt>Qmail - SMTP Totals - Deny</tt>  
| align="center" | <tt>.1.3.6.1.4.1.2021.50.5.101.2</tt>
| align="center" | <tt>.1.3.6.1.4.1.18689.1.3.4.1.2.19.113.109.97.105.108.45.115.109.116.112.45.115.101.115.115.105.111.110.115.2</tt>
|-
|-
| align="center" | <tt>Qmail - Queue Size - Unprocessed</tt>
| align="center" | <tt>Qmail - Queue Size</tt>  
| align="center" | <tt>.1.3.6.1.4.1.2021.50.5.101.1</tt>
| align="center" | <tt>.1.3.6.1.4.1.18689.1.3.4.1.2.11.113.109.97.105.108.45.113.117.101.117.101.1</tt>
|-
|-
| align="center" | <tt>Qmail - Messages Status - Failures</tt>
| align="center" | <tt>Qmail - Queue Size - Unprocessed</tt>  
| align="center" | <tt> .1.3.6.1.4.1.2021.50.6.101.2</tt>
| align="center" | <tt>.1.3.6.1.4.1.18689.1.3.4.1.2.11.113.109.97.105.108.45.113.117.101.117.101.2</tt>
|-
|-
| align="center" | <tt>Qmail - Messages Status - Success</tt>
| align="center" | <tt>Qmail - Messages Status - Failures</tt>  
| align="center" | <tt>.1.3.6.1.4.1.2021.50.6.101.1</tt>
| align="center" | <tt>.1.3.6.1.4.1.18689.1.3.4.1.2.20.113.109.97.105.108.45.109.101.115.115.97.103.101.45.115.116.97.116.117.115.2</tt>
|-
|-
| align="center" | <tt>Qmail - Local/Remote Concurrency - Local</tt>
| align="center" | <tt>Qmail - Messages Status - Success</tt>  
| align="center" | <tt>.1.3.6.1.4.1.2021.50.7.101.1</tt>
| align="center" | <tt>.1.3.6.1.4.1.18689.1.3.4.1.2.20.113.109.97.105.108.45.109.101.115.115.97.103.101.45.115.116.97.116.117.115.1</tt>
|-
|-
| align="center" | <tt>Qmail - Local/Remote Concurrency - Remote</tt>
| align="center" | <tt>Qmail - Local/Remote Concurrency - Local</tt>
| align="center" | <tt>.1.3.6.1.4.1.2021.50.7.101.2</tt>
| align="center" | <tt>.1.3.6.1.4.1.18689.1.3.4.1.2.17.113.109.97.105.108.45.99.111.110.99.117.114.114.101.110.99.121.1</tt>
|-
| align="center" | <tt>Qmail - Local/Remote Concurrency - Remote</tt>  
| align="center" | <tt>.1.3.6.1.4.1.18689.1.3.4.1.2.17.113.109.97.105.108.45.99.111.110.99.117.114.114.101.110.99.121.2</tt>
|-
| align="center" | <tt>Qmail - SMTP_Auth Concurrency</tt>
| align="center" | <tt>.1.3.6.1.4.1.18689.1.3.4.1.2.30.113.109.97.105.108.45.109.97.105.108.111.117.116.45.115.109.116.112.45.99.111.110.99.117.114.114.101.110.99.121.1</tt>
|-
| align="center" | <tt>Qmail - SMTP_Auth Totals - Allow</tt>
| align="center" | <tt>.1.3.6.1.4.1.18689.1.3.4.1.2.22.113.109.97.105.108.45.109.97.105.108.111.117.116.45.115.101.115.115.105.111.110.115.1</tt>
|-
| align="center" | <tt>Qmail - SMTP_Auth Totals - Deny</tt>
| align="center" | <tt>.1.3.6.1.4.1.18689.1.3.4.1.2.22.113.109.97.105.108.45.109.97.105.108.111.117.116.45.115.101.115.115.105.111.110.115.2</tt>
|}
|}


Qmail - SpamAssassin - Clean
Qmail - SpamAssassin - Clean Qmail - SpamAssassin - Spam Qmail - Clamav - Error Qmail - Clamav - Found
Qmail - SpamAssassin - Spam
 
Qmail - Clamav - Error
== courier  ==
Qmail - Clamav - Found


==courier==
von http://xavier.perseguers.ch/open-source/cacti/<br> http://www.arschkrebs.de/postfix/couriergraph/<br> Files: http://crazylinux.de/files/it_stuff/cacti/courier/  
von http://xavier.perseguers.ch/open-source/cacti/<br>
Files: http://crazylinux.de/files/it_stuff/cacti/courier/


/etc/snmp/snmpd.conf
/etc/snmp/snmpd.conf  
<pre>
<pre>exec  .1.3.6.1.4.5312.3.1  couriercount_imaps  /bin/cat /var/tmp/courierimaps
exec  .1.3.6.1.4.5312.3.1  couriercount_imaps  /bin/cat /var/tmp/courierimaps
exec  .1.3.6.1.4.5312.3.2  couriercount_imap  /bin/cat /var/tmp/courierimap
exec  .1.3.6.1.4.5312.3.2  couriercount_imap  /bin/cat /var/tmp/courierimap
exec  .1.3.6.1.4.5312.3.3  couriercount_pop3s  /bin/cat /var/tmp/courierpop3s
exec  .1.3.6.1.4.5312.3.3  couriercount_pop3s  /bin/cat /var/tmp/courierpop3s
exec  .1.3.6.1.4.5312.3.4  couriercount_pop3  /bin/cat /var/tmp/courierpop3
exec  .1.3.6.1.4.5312.3.4  couriercount_pop3  /bin/cat /var/tmp/courierpop3
</pre>
== Spamassassin  ==
Als Vorlage diente qs2mrtg.pl. von qmail-scanner: ''Reporting: in the contrib directory there's qs2mrtg.pl. A perl script for monitoring your syslog files for qmail-scanner records. It then graphs how Qmail-Scanner is processing your emails. It creates different graphs for incoming vs outgoing email, as well as the flow of spam and viruses.''
<pre>#/etc/snmp/snmpd.conf
extend .1.3.6.1.4.1.18696.1.3 spamd_spam  /bin/cat /var/qmail/log/spam.txt
extend .1.3.6.1.4.1.18696.1.3 spamd_rbl  /bin/cat /var/qmail/log/rbl.txt
extend .1.3.6.1.4.1.18696.1.3 spamd_tot_local  /bin/cat /var/qmail/log/totall.txt
extend .1.3.6.1.4.1.18696.1.3 spamd_tot_remote  /bin/cat /var/qmail/log/totalr.txt
extend .1.3.6.1.4.1.18696.1.3 spamd_quar_virus  /bin/cat /var/qmail/log/quarantinedv.txt
extend .1.3.6.1.4.1.18696.1.3 spamd_quar_policy  /bin/cat /var/qmail/log/quarantinedp.txt
</pre>
</pre>


==Spamassassin==
== HDDTemp  ==
Als Vorlage diente qs2mrtg.pl.
von qmail-scanner:
''Reporting: in the contrib directory there's qs2mrtg.pl. A perl script for monitoring your syslog files for qmail-scanner records. It then graphs how Qmail-Scanner is processing your emails. It creates different graphs for incoming vs outgoing email, as well as the flow of spam and viruses.
''


<pre>
http://blog.gotchi.at/index.php?/archives/305-Monitoring-Hardware-mit-Cacti.html http://forums.cacti.net/about15743.html
#/etc/snmp/snmpd.conf
exec .1.3.6.1.4.1.2050.50.1 spamd_spam  /bin/cat /var/qmail/log/spam.txt
exec .1.3.6.1.4.1.2050.50.2 spamd_rbl  /bin/cat /var/qmail/log/rbl.txt
exec .1.3.6.1.4.1.2050.50.3 spamd_tot_local  /bin/cat /var/qmail/log/totall.txt
exec .1.3.6.1.4.1.2050.50.4 spamd_tot_remote  /bin/cat /var/qmail/log/totalr.txt
exec .1.3.6.1.4.1.2050.50.5 spamd_quar_virus  /bin/cat /var/qmail/log/quarantinedv.txt
exec .1.3.6.1.4.1.2050.50.6 spamd_quar_policy  /bin/cat /var/qmail/log/quarantinedp.txt
</pre>


==HDDTemp==
== LM Sensors  ==
http://blog.gotchi.at/index.php?/archives/305-Monitoring-Hardware-mit-Cacti.html
http://forums.cacti.net/about15743.html


==LM Sensors==
get some temperatures... see http://wiki.hetzner.de/index.php/Hardwaremonitoring  
get some temperatures... see http://wiki.hetzner.de/index.php/Hardwaremonitoring


modprobe i2c-viapro && modprobe eeprom && modprobe w83627hf
modprobe i2c-viapro &amp;&amp; modprobe eeprom &amp;&amp; modprobe w83627hf or put them into /etc/modules  
or put them into /etc/modules


for cacti start with http://www.wlug.org.nz/CactiLMSensors
for cacti start with http://www.wlug.org.nz/CactiLMSensors  


<source lang=php>
<source lang="php">
#!/usr/bin/perl
#!/usr/bin/perl


Zeile 234: Zeile 240:


print "temp1:$temp1 temp2:$temp2 temp3:$temp3\n";
print "temp1:$temp1 temp2:$temp2 temp3:$temp3\n";
</source>
</source>  
 
<br>
 
'''Alternativ Solution'''<br>
 
get lm_sensors-data via snmp (must be complied with)<br>
 
[http://forums.cacti.net/about11590-0-asc-60.html ucd/net-SNMP lmSensors]<br>
 
== SmartMonTools (smartctl)  ==
 
found a better solution: https://www.pitt-pladdy.com/blog/_20091031-144604_0000_SMART_stats_on_Cacti_via_SNMP_/
 
old solution was:
 
http://forums.cacti.net/viewtopic.php?t=23959


==SmartMonTools (smartctl)==
*HDD-Temp  
http://forums.cacti.net/viewtopic.php?t=23959
*HDD-Errors  
*HDD-Temp
*HDD-Errors
*Power-Up (not used)
*Power-Up (not used)


<source lang=php>
<source lang="php">
#!/usr/bin/php
#!/usr/bin/php
<?php
<?php
Zeile 296: Zeile 316:


?>
?>
</source
</source>
 
== Windows WMI  ==
 
*[http://www.parkingdenied.com/2008/12/11/wmi-monitoring-with-cacti/ WMI Monitoring with Cacti]<br>
*[http://poweradmin.com/Help/enableWMI.aspx Enable WMI for windows-user]
*http://www.microsoft.com/germany/technet/datenbank/articles/600682.mspx<br>
*http://forums.cacti.net/about11752.html<br>
*[http://forums.cacti.net/about11589.html Exchange]<br>
*Service for Windows: http://www.shatterit.com/nc_net/<br>
*[http://forums.cacti.net/about7131.html W32 IIS W3SVC Perl Script via check_nt]
*[http://forums.cacti.net/about4427.html Useful WMI Classes for Monitoring Windows Servers]
 
== W32 System via WMI  ==
 
Gets System Calls/sec, Context Switches/sec, Threads, Processes via WMI... <br> http://forums.cacti.net/about5226.html
 
<source lang="bash">
#!/bin/sh
 
#get host
if [ "x$1" = "x" ]; then
        HOST=this.is.my.hostname
else
        HOST=$1;
fi;
 
/usr/share/cacti/site/scripts/check_nt -H $HOST -v WMICHECK \
-l 'cimv2^select * from Win32_PerfFormattedData_PerfOS_System'|grep =|awk {'print $1 ":" int($3) " "'}|tr -d '\n'</source>
 
== interrupts/context switching  ==
 
Graph templat for interrupts/context switching incl. threads and processes
 
http://forums.cacti.net/about8178.html
 
== IIS via SNMP  ==
 
http://forums.cacti.net/about12464.html
 
== HTTP/TCP-Response-Time  ==
 
http://forums.cacti.net/about11020.html
 
== Smoking Ping  ==
 
http://forums.cacti.net/about7090.html


[[Kategorie:Debian]]
[[Kategorie:Windows]]

Aktuelle Version vom 20. Oktober 2016, 02:41 Uhr

Cacti is a complete network graphing solution designed to harness the power of RRDTool's data storage and graphing functionality. Cacti provides a fast poller, advanced graph templating, multiple data acquisition methods, and user management features out of the box. All of this is wrapped in an intuitive, easy to use interface that makes sense for LAN-sized installations up to complex networks with hundreds of devices.  http://cacti.net/

download einiger Scripts, siehe Files

Tips

Erweiterungen

Dovecot and Postfix (via SNMP)

see Cacti/Dovecot Postfix

fail2ban

via snmp see https://www.pitt-pladdy.com/blog/_20130324-154457_0000_fail2ban_on_Cacti_via_SNMP/

iptables

http://forums.cacti.net/about8091.html
download cacti templates. Da iptables als root ausgeführt werden muss, wird das script über sudo aufgerufen: /etc/sudoers

#logging
Defaults syslog = local2
# User privilege specification
www-data    ALL = NOPASSWD: /usr/share/cacti/site/scripts/iptables.pl

Damit der syslog nicht damit unnötig 'beloggt' wird, loggen wir an log-facility local2 und damit in ein eigenes Logfile /etc/syslog.conf:

...
*.*;auth,authpriv.none;mail.!*;daemon.!info;cron.!*;local2.none         -/var/log/syslog
...
local2.* /var/log/sudo.log
#!/usr/bin/perl
###
### This is a quick perl script to
### pull bandwidth usage from iptables chains
###
### If you use/optimize this script, please let me know.
### Brian Stanback : brian [at] stanback [dot] net
##
### Example iptables rule for web bandwidth usage:
### > iptables -N WWW
### > iptables -A WWW -j ACCEPT
### > iptables -A INPUT -p tcp -m tcp --dport 80 -j WWW
### > iptables -A OUTPUT -p tcp -m tcp --sport 80 -j WWW
###
### Run "iptables.pl WWW" as root to test, note that you can
### combine more than one protocol into a single chain.
###
### Sudo Configuration (/etc/sudoers)
### > www-data    ALL = NOPASSWD: /usr/share/cacti/scripts/iptables.pl
###
### The Input String should be set to "sudo <path_cacti>/scripts/iptables.pl <chain>"
### and you will need to setup an input field so that the <chain> argument can be passed.
###
### The data input type should be set to COUNTER
###
##
##
## modified by: Paul Campbell <forums@campbell-multimedia.co.uk>
## Now returns a seperate entry for each rule.  Output for a
## 3 rule chain might now be:
## rule1:123 rule2:456 rule3:789
#
if ($ARGV[0]) {
$chains = `/sbin/iptables --line-number -xnvL $ARGV[0]`;
@chains = split(/\n/, $chains);
shift(@chains);
shift(@chains);
foreach( @chains ) {
/(\d+)\W+[0-9]+\W+([0-9]+)\W+/;
print " rule$1:$2";
}
print "\n";
#$chains[2] =~ /[\W+]?[0-9]+\W+([0-9]+)\W+/;
} else {
print "Usage: $0 Chain\n";
}

Mysql

see http://forums.cacti.net/viewtopic.php?f=12&t=42427 OR


Percona Monitoring Plugins

The Percona Monitoring Plugins are high-quality components to add enterprise-grade MySQL capabilities to your existing in-house, on-premises monitoring solutions. The components are designed to integrate seamlessly with widely deployed solutions such as Nagios and Cacti, and are delivered in the form of templates, plugins, and scripts. More

Cacti-graph-set

Apache

ApacheStats 0.6 (PHP Script Server Version)

APC - PHP cache

see http://artur.ejsmont.org/blog/content/palm-v3-bundle-of-php-apache-linux-and-memcached-monitoring-scripts-and-cacti-graphs-apc

Qmail

snmpd erweitern: http://wotsit.thingy.com/haj/cacti/cacti-qmail.html

#/etc/snmp/snmpd.conf
...
extend .1.3.6.1.4.1.18689.1.3 qmail-message-status /usr/local/bin/qmailmrtg7 s /var/log/qmail
extend .1.3.6.1.4.1.18689.1.3 qmail-bytes-transfer /usr/local/bin/qmailmrtg7 b /var/log/qmail
extend .1.3.6.1.4.1.18689.1.3 qmail-smtp-concurrency /usr/local/bin/qmailmrtg7 t /var/log/qmail/smtpd
extend .1.3.6.1.4.1.18689.1.3 qmail-smtp-sessions /usr/local/bin/qmailmrtg7 a /var/log/qmail/smtpd
extend .1.3.6.1.4.1.18689.1.3 qmail-queue /usr/local/bin/qmailmrtg7 q /var/qmail/queue
extend .1.3.6.1.4.1.18689.1.3 qmail-messages /usr/local/bin/qmailmrtg7 m /var/log/qmail
extend .1.3.6.1.4.1.18689.1.3 qmail-concurrency /usr/local/bin/qmailmrtg7 c /var/log/qmail
#optional, a second smtp-service
extend .1.3.6.1.4.1.18689.1.3 qmail-mailout-smtp-concurrency /usr/local/bin/qmailmrtg7 t /var/log/qmail/smtpd_auth
extend .1.3.6.1.4.1.18689.1.3 qmail-mailout-sessions /usr/local/bin/qmailmrtg7 a /var/log/qmail/smtpd_auth
...

Werte abfragen: snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.18689.1.3

Cacti-Templates: http://forums.cacti.net/about3839.html

OIDs:

Qmail - Messages - Attempts .1.3.6.1.4.1.18689.1.3.4.1.2.14.113.109.97.105.108.45.109.101.115.115.97.103.101.115.2
Qmail - Messages - Deliveries .1.3.6.1.4.1.18689.1.3.4.1.2.14.113.109.97.105.108.45.109.101.115.115.97.103.101.115.1
Qmail - Bits Transfer .1.3.6.1.4.1.18689.1.3.4.1.2.20.113.109.97.105.108.45.98.121.116.101.115.45.116.114.97.110.115.102.101.114.1
Qmail - SMTP Concurrency .1.3.6.1.4.1.18689.1.3.4.1.2.22.113.109.97.105.108.45.115.109.116.112.45.99.111.110.99.117.114.114.101.110.99.121.1
Qmail - SMTP Totals - Allow .1.3.6.1.4.1.18689.1.3.4.1.2.19.113.109.97.105.108.45.115.109.116.112.45.115.101.115.115.105.111.110.115.1
Qmail - SMTP Totals - Deny .1.3.6.1.4.1.18689.1.3.4.1.2.19.113.109.97.105.108.45.115.109.116.112.45.115.101.115.115.105.111.110.115.2
Qmail - Queue Size .1.3.6.1.4.1.18689.1.3.4.1.2.11.113.109.97.105.108.45.113.117.101.117.101.1
Qmail - Queue Size - Unprocessed .1.3.6.1.4.1.18689.1.3.4.1.2.11.113.109.97.105.108.45.113.117.101.117.101.2
Qmail - Messages Status - Failures .1.3.6.1.4.1.18689.1.3.4.1.2.20.113.109.97.105.108.45.109.101.115.115.97.103.101.45.115.116.97.116.117.115.2
Qmail - Messages Status - Success .1.3.6.1.4.1.18689.1.3.4.1.2.20.113.109.97.105.108.45.109.101.115.115.97.103.101.45.115.116.97.116.117.115.1
Qmail - Local/Remote Concurrency - Local .1.3.6.1.4.1.18689.1.3.4.1.2.17.113.109.97.105.108.45.99.111.110.99.117.114.114.101.110.99.121.1
Qmail - Local/Remote Concurrency - Remote .1.3.6.1.4.1.18689.1.3.4.1.2.17.113.109.97.105.108.45.99.111.110.99.117.114.114.101.110.99.121.2
Qmail - SMTP_Auth Concurrency .1.3.6.1.4.1.18689.1.3.4.1.2.30.113.109.97.105.108.45.109.97.105.108.111.117.116.45.115.109.116.112.45.99.111.110.99.117.114.114.101.110.99.121.1
Qmail - SMTP_Auth Totals - Allow .1.3.6.1.4.1.18689.1.3.4.1.2.22.113.109.97.105.108.45.109.97.105.108.111.117.116.45.115.101.115.115.105.111.110.115.1
Qmail - SMTP_Auth Totals - Deny .1.3.6.1.4.1.18689.1.3.4.1.2.22.113.109.97.105.108.45.109.97.105.108.111.117.116.45.115.101.115.115.105.111.110.115.2

Qmail - SpamAssassin - Clean Qmail - SpamAssassin - Spam Qmail - Clamav - Error Qmail - Clamav - Found

courier

von http://xavier.perseguers.ch/open-source/cacti/
http://www.arschkrebs.de/postfix/couriergraph/
Files: http://crazylinux.de/files/it_stuff/cacti/courier/

/etc/snmp/snmpd.conf

exec   .1.3.6.1.4.5312.3.1   couriercount_imaps  /bin/cat /var/tmp/courierimaps
exec   .1.3.6.1.4.5312.3.2   couriercount_imap   /bin/cat /var/tmp/courierimap
exec   .1.3.6.1.4.5312.3.3   couriercount_pop3s  /bin/cat /var/tmp/courierpop3s
exec   .1.3.6.1.4.5312.3.4   couriercount_pop3   /bin/cat /var/tmp/courierpop3

Spamassassin

Als Vorlage diente qs2mrtg.pl. von qmail-scanner: Reporting: in the contrib directory there's qs2mrtg.pl. A perl script for monitoring your syslog files for qmail-scanner records. It then graphs how Qmail-Scanner is processing your emails. It creates different graphs for incoming vs outgoing email, as well as the flow of spam and viruses.

#/etc/snmp/snmpd.conf
extend .1.3.6.1.4.1.18696.1.3 spamd_spam  /bin/cat /var/qmail/log/spam.txt
extend .1.3.6.1.4.1.18696.1.3 spamd_rbl  /bin/cat /var/qmail/log/rbl.txt
extend .1.3.6.1.4.1.18696.1.3 spamd_tot_local  /bin/cat /var/qmail/log/totall.txt
extend .1.3.6.1.4.1.18696.1.3 spamd_tot_remote  /bin/cat /var/qmail/log/totalr.txt
extend .1.3.6.1.4.1.18696.1.3 spamd_quar_virus  /bin/cat /var/qmail/log/quarantinedv.txt
extend .1.3.6.1.4.1.18696.1.3 spamd_quar_policy  /bin/cat /var/qmail/log/quarantinedp.txt

HDDTemp

http://blog.gotchi.at/index.php?/archives/305-Monitoring-Hardware-mit-Cacti.html http://forums.cacti.net/about15743.html

LM Sensors

get some temperatures... see http://wiki.hetzner.de/index.php/Hardwaremonitoring

modprobe i2c-viapro && modprobe eeprom && modprobe w83627hf or put them into /etc/modules

for cacti start with http://www.wlug.org.nz/CactiLMSensors

#!/usr/bin/perl

@sensoroutput=`/usr/bin/sensors`;

foreach(@sensoroutput) {
chomp();
split();
#print $_[0],"-",$_[1],$_[2],"\n";
if ( $_[0] eq 'M/B' ) {
$temp1 = $_[2];
}
if ( $_[0] eq 'CPU' ) {
$temp2 = $_[2];
}
if ( $_[0] eq 'temp3:' ) {
$temp3 = $_[1];
}
if ( $_[0] eq 'fan1:' ) {
$fan1 = $_[1];
}
if ( $_[0] eq 'fan2:' ) {
$fan2 = $_[1];
}
if ( $_[0] eq 'fan3:' ) {
$fan3 = $_[1];
}
}

$temp1 =~ s/\+//;
$temp1 =~ s/\°C//;
$temp2 =~ s/\+//;
$temp2 =~ s/\°C//;
$temp3 =~ s/\+//;
$temp3 =~ s/\°C//;

print "temp1:$temp1 temp2:$temp2 temp3:$temp3\n";


Alternativ Solution

get lm_sensors-data via snmp (must be complied with)

ucd/net-SNMP lmSensors

SmartMonTools (smartctl)

found a better solution: https://www.pitt-pladdy.com/blog/_20091031-144604_0000_SMART_stats_on_Cacti_via_SNMP_/

old solution was:

http://forums.cacti.net/viewtopic.php?t=23959

  • HDD-Temp
  • HDD-Errors
  • Power-Up (not used)
#!/usr/bin/php
<?php
/*
 * 4 = value
 * 7 = Raw
 *
 * include this into the /etc/sudoers file!!
 * www-data    ALL= NOPASSWD: /usr/sbin/smartctl
 *
 */

if ($argc < 2) {
        die("USAGE: $argv[0] /dev/sdX\n");
}


$dev = $argv[1];
$smartCtl = exec('sudo /usr/sbin/smartctl -d ata --all ' . $dev,$output);
//print_r($output);
$_OUT = array();
$needle = "Temperature_Celsius,Reallocated_Sector_Ct,Power_On_Hours,Spin_Retry_Count,Seek_Error_Rate,Raw_Read_Error_Rate";


foreach ($output as $line) {
        if (preg_match('/^\s*(\d+)\s+(\w+)\s+(0x[0-9a-fA-F]+)\s+(\d+)\s+(\d+)\s+(\d+).*\s+\-\s+(\d+)/',$line,$match)) {
        //      print_r($match);
                if ( $match[2] == 'Temperature_Celsius') $_OUT['Temperature_Celsius'] = $match[7];
                if ( $match[2] == 'Reallocated_Sector_Ct') $_OUT['Reallocated_Sector_Ct'] = $match[7];
                if ( $match[2] == 'Power_On_Hours') $_OUT['Power_On_Hours'] = $match[7];
                if ( $match[2] == 'Spin_Retry_Count') $_OUT['Spin_Retry_Count'] = $match[7];
                if ( $match[2] == 'Seek_Error_Rate') $_OUT['Seek_Error_Rate'] = $match[7];
                if ( $match[2] == 'Raw_Read_Error_Rate') $_OUT['Raw_Read_Error_Rate'] = $match[7];
        }
}


$needle = explode(",",$needle);
foreach ( $needle as $need ) {
        if ( ! isset($_OUT[$need]) ) $_OUT[$need] = 0;
}


print (
        "Temperature_Celsius:" . $_OUT['Temperature_Celsius'] . " " .
        "Reallocated_Sector_Ct:" . $_OUT['Reallocated_Sector_Ct'] . " " .
        "Power_On_Hours:" . $_OUT['Power_On_Hours'] . " " .
        "Spin_Retry_Count:" . $_OUT['Spin_Retry_Count'] . " " .
        "Seek_Error_Rate:" . $_OUT['Seek_Error_Rate'] . " " .
        "Raw_Read_Error_Rate:" . $_OUT['Raw_Read_Error_Rate']
);


?>

Windows WMI

W32 System via WMI

Gets System Calls/sec, Context Switches/sec, Threads, Processes via WMI...
http://forums.cacti.net/about5226.html

#!/bin/sh

#get host
if [ "x$1" = "x" ]; then
        HOST=this.is.my.hostname
else
        HOST=$1;
fi;

/usr/share/cacti/site/scripts/check_nt -H $HOST -v WMICHECK \
 -l 'cimv2^select * from Win32_PerfFormattedData_PerfOS_System'|grep =|awk {'print $1 ":" int($3) " "'}|tr -d '\n'

interrupts/context switching

Graph templat for interrupts/context switching incl. threads and processes

http://forums.cacti.net/about8178.html

IIS via SNMP

http://forums.cacti.net/about12464.html

HTTP/TCP-Response-Time

http://forums.cacti.net/about11020.html

Smoking Ping

http://forums.cacti.net/about7090.html