initial commit of file from CVS for smeserver-zabbix-agent on Sat Sep 7 21:17:46 AEST 2024
This commit is contained in:
@@ -0,0 +1 @@
|
||||
disabled
|
@@ -0,0 +1 @@
|
||||
127.0.0.1
|
@@ -0,0 +1 @@
|
||||
10050
|
@@ -0,0 +1 @@
|
||||
private
|
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
service
|
@@ -0,0 +1,21 @@
|
||||
#Only non rpm owned files are backupe there
|
||||
{
|
||||
use RPM2;
|
||||
my $rpm_db = RPM2->open_rpm_db();
|
||||
|
||||
my @dirs = qw(
|
||||
/etc/zabbix
|
||||
/etc/zabbix/zabbix_agentd.conf.d/
|
||||
/var/lib/zabbix/bin/
|
||||
);
|
||||
|
||||
foreach my $some_dir (@dirs) {
|
||||
next unless ( -e $some_dir );
|
||||
opendir(my $dh, $some_dir) || die "Can't open $some_dir: $!";
|
||||
while ( (my $file = readdir $dh) ) {
|
||||
next if $file =~ /^\.{1,2}$/;
|
||||
$OUT .= "$some_dir/$file\n" unless $rpm_db->find_by_file("$some_dir/$file");
|
||||
}
|
||||
closedir $dh;
|
||||
}
|
||||
}
|
20
root/etc/e-smith/templates/etc/crontab/zabbix_mail_stats
Normal file
20
root/etc/e-smith/templates/etc/crontab/zabbix_mail_stats
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
if ((${'zabbix-agent'}{'status'} || 'disabled') eq 'enabled'){
|
||||
$OUT .=<<"HERE";
|
||||
|
||||
# Parse mail logs and write stats in zabbix tmp directory
|
||||
*/10 * * * * root /var/lib/zabbix/bin/util_count_mail_in
|
||||
*/10 * * * * root /var/lib/zabbix/bin/util_count_mail_out
|
||||
|
||||
HERE
|
||||
|
||||
if ((${'zabbix-agent'}{'StatusMail'} || 'disabled' ) eq 'enabled'){
|
||||
$OUT .=<<'HERE';
|
||||
|
||||
# Send a status mail
|
||||
*/15 * * * * root sleep $[ $RANDOM \% 120 ]; /var/lib/zabbix/bin/util_send_status_mail
|
||||
|
||||
HERE
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,2 @@
|
||||
Cmnd_Alias ZABBIX_AGENT = /var/lib/zabbix/bin/*_sudo
|
||||
|
2
root/etc/e-smith/templates/etc/sudoers/30zabbixAgent
Normal file
2
root/etc/e-smith/templates/etc/sudoers/30zabbixAgent
Normal file
@@ -0,0 +1,2 @@
|
||||
zabbix ALL=(root) NOPASSWD: ZABBIX_AGENT
|
||||
|
@@ -0,0 +1,28 @@
|
||||
{
|
||||
|
||||
if ( -x '/usr/sbin/asterisk' ){
|
||||
my $login = "";
|
||||
my $user = ${'zabbix-agent'}{'AsteriskManagerLogin'} || '';
|
||||
my $pass = ${'zabbix-agent'}{'AsteriskManagerPassword'} || '';
|
||||
if ($user ne ''){
|
||||
$login .= "--user=$user";
|
||||
}
|
||||
if ($pass ne ''){
|
||||
$login .= " --secret=$pass";
|
||||
}
|
||||
$OUT.=<<"HERE"
|
||||
# Type: Agent or Agent (active)
|
||||
# Key: asterisk[key] where key can be max_latency, sip_peers, channels, internal_calls,
|
||||
# outgoing_calls, incoming_calls, external_calls, duration_internal or duration_external
|
||||
# Type of information: Numeric (integer 64bit)
|
||||
# Units: depends on the key
|
||||
# Custom multiplier: Do not use
|
||||
# Store Value: As is
|
||||
|
||||
UserParameter=asterisk[*],/var/lib/zabbix/bin/check_asterisk $login --what=\$1
|
||||
|
||||
HERE
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,13 @@
|
||||
{
|
||||
$OUT = '';
|
||||
qx(zabbix_agentd -t vfs.dev.discovery -c /dev/null | grep -q ZBX_NOTSUPPORTED);
|
||||
if ($? != 0){
|
||||
$OUT .= '# vfs.dev.discovery is natively supported, not UserParameter needed';
|
||||
} else{
|
||||
$OUT .=<<'_EOF';
|
||||
# Discover block devices
|
||||
UserParameter=vfs.dev.discovery,/var/lib/zabbix/bin/disco_block_devices
|
||||
_EOF
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,14 @@
|
||||
# Number of CPU
|
||||
|
||||
# Description: Number of CPU
|
||||
# Type: Agent or Agent (active)
|
||||
# Key: cpu.number
|
||||
# Type of information: Numeric (integer 64bit)
|
||||
# Units: cpu
|
||||
# Use multiplier: do not use
|
||||
# Update interval: 86400 (once a day)
|
||||
# Store Value: As is
|
||||
# Show Value: As is
|
||||
|
||||
UserParameter=cpu.number,cat /proc/cpuinfo | grep processor | wc -l
|
||||
|
@@ -0,0 +1,24 @@
|
||||
# Amount of used memory (the agent lacks this stats)
|
||||
|
||||
# Description: Used Memory
|
||||
# Type: Agent or Agent (active)
|
||||
# Key: vm.memory.size.used
|
||||
# Type of information: Numeric (integer 64bit)
|
||||
# Units: B
|
||||
# Use multiplier: do not use
|
||||
# Store Value: As is
|
||||
# Show Value: As is
|
||||
UserParameter=vm.memory.size.used,free -b | grep 'buffers/cache' | awk '\{print $3\}'
|
||||
|
||||
# Amount of used memory in % (the agent lacks this stats)
|
||||
|
||||
# Description: Used Memory in %
|
||||
# Type: Agent or Agent (active)
|
||||
# Key: vm.memory.size.pused
|
||||
# Type of information: Numeric (integer 64bit)
|
||||
# Units: %
|
||||
# Use multiplier: do not use
|
||||
# Store Value: As is
|
||||
# Show Value: As is
|
||||
UserParameter=vm.memory.size.pused,echo $(($(free -b | grep 'buffers/cache' | awk '\{print $3\}')*100/$(free -b | grep 'Mem' | awk '\{print $2\}')))
|
||||
|
@@ -0,0 +1,62 @@
|
||||
# Some networks statistics
|
||||
# zabbix agent support natively interface stats, but, it's hard to create templates for a lot of
|
||||
# SME Servers which can use different interface name (External can be eth0, eth1, ppp0 etc...)
|
||||
# This way, net.if.in.internal, net.if.in.external, net.if.out.internal and net.if.out.external
|
||||
# will always refers to the correct interface.
|
||||
|
||||
{
|
||||
my $internal = $InternalInterface{'Name'} || 'eth0';
|
||||
my $external = $ExternalInterface{'Name'} || 'eth1';
|
||||
|
||||
# Do we use the bridge contrib ?
|
||||
# If yes, we reports only the traffic on the real ethernet interface.
|
||||
if ( (($bridge{'status'} || 'disabled') eq 'enabled') && (defined $bridge{'ethernetInterface'}) ){
|
||||
$internal = $bridge{'ethernetInterface'};
|
||||
}
|
||||
|
||||
$OUT .=<<"HERE";
|
||||
|
||||
# Description: In Internal
|
||||
# Type: Agent or Agent (active)
|
||||
# Key: net.if.in.internal
|
||||
# Type of information: Numeric (float)
|
||||
# Units: b/s
|
||||
# Custom multiplier: 8 (if you want the value in bits/s instead of Bytes/s)
|
||||
# Store Value: Delta (speed per second)
|
||||
UserParameter=net.if.in.internal,cat /proc/net/dev | grep $internal | cut -d":" -f2 | awk '{print \$1}'
|
||||
|
||||
# Description: Out Internal
|
||||
# Type: Agent or Agent (active)
|
||||
# Key: net.if.out.internal
|
||||
# Type of information: Numeric (float)
|
||||
# Units: b/s
|
||||
# Custom multiplier: 8 (if you want the value in bits/s instead of Bytes/s)
|
||||
# Store Value: Delta (speed per second)
|
||||
UserParameter=net.if.out.internal,cat /proc/net/dev | grep $internal | cut -d":" -f2 | awk '{print \$9}'
|
||||
|
||||
HERE
|
||||
|
||||
if (($SystemMode || 'serveronly') ne 'serveronly'){
|
||||
$OUT .=<<"HERE";
|
||||
# Description: In External
|
||||
# Type: Agent or Agent (active)
|
||||
# Key: net.if.in.external
|
||||
# Type of information: Numeric (float)
|
||||
# Units: b/s
|
||||
# Custom multiplier: 8 (if you want the value in bits/s instead of Bytes/s)
|
||||
# Store Value: Delta (speed per second)
|
||||
UserParameter=net.if.in.external,cat /proc/net/dev | grep $external | cut -d":" -f2 | awk '{print \$1}'
|
||||
|
||||
# Description: Out External
|
||||
# Type: Agent or Agent (active)
|
||||
# Key: net.if.out.external
|
||||
# Type of information: Numeric (float)
|
||||
# Units: b/s
|
||||
# Custom multiplier: 8 (if you want the value in bits/s instead of Bytes/s)
|
||||
# Store Value: Delta (speed per second)
|
||||
UserParameter=net.if.out.external,cat /proc/net/dev | grep $external | cut -d":" -f2 | awk '{print \$9}'
|
||||
|
||||
HERE
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,12 @@
|
||||
# Amount of used swap in bytes
|
||||
|
||||
# Description: Used swap space
|
||||
# Type: Agent or Agent (active)
|
||||
# Key: system.swap.size.used
|
||||
# Type of information: Numeric (integer 64bit)
|
||||
# Units: B
|
||||
# Multiplier: do not use
|
||||
# Store Value: As is
|
||||
# Show Value: As is
|
||||
UserParameter=system.swap.size.used,free -b | grep Swap | awk '\{print $3\}'
|
||||
|
@@ -0,0 +1,9 @@
|
||||
|
||||
# Retrieve real external IP
|
||||
# Description: Ext IP
|
||||
# Type: Agent or Agent (active)
|
||||
# Key: ip.external
|
||||
# Type of information: Character
|
||||
# Show Value: As is
|
||||
UserParameter=ip.external,/usr/bin/curl --connect-timeout 5 -s -o - -k "http://www.wimip.fr/?t="
|
||||
|
@@ -0,0 +1,15 @@
|
||||
# Incomming mails statistics
|
||||
|
||||
# Description: Incoming Mail <key>
|
||||
# Type: Agent or Agent (active)
|
||||
# Key: mail.in[<key>] (for example mail.in[dnsbl])
|
||||
# Type of information: Numeric (integer 64bit)
|
||||
# Units: mails/h
|
||||
# Use multiplier: Custom multiplier
|
||||
# Custom multiplier: 6
|
||||
# Update interval: 600
|
||||
# Store Value: As is
|
||||
# Show Value: As is
|
||||
|
||||
UserParameter=mail.in[*],cat /var/lib/zabbix/tmp/mail.in.$1
|
||||
|
@@ -0,0 +1,16 @@
|
||||
# Outgoing mails statistics
|
||||
|
||||
# Description: Incoming Mail <key>
|
||||
# Type: Agent or Agent (active)
|
||||
# Key: mail.out.[<key>] (for example mail.out[total])
|
||||
# Type of information: Numeric (integer 64bit)
|
||||
# Units: mails/h
|
||||
# Use multiplier: Custom multiplier
|
||||
# Custom multiplier: 6
|
||||
# Update interval: 600
|
||||
# Store Value: As is
|
||||
# Show Value: As is
|
||||
|
||||
UserParameter=mail.out[*],cat /var/lib/zabbix/tmp/mail.out.$1
|
||||
|
||||
|
@@ -0,0 +1,15 @@
|
||||
|
||||
# Some stats about MySQL
|
||||
|
||||
# Description: MySQL <key>
|
||||
# Type: Agent or Agent (active)
|
||||
# Type of information: Numeric (float)
|
||||
# Unit: <depend on the key> (for example, qps)
|
||||
# Use multiplier: do not use
|
||||
# Store Value: As is
|
||||
UserParameter=mysql.uptime,/usr/bin/sudo /var/lib/zabbix/bin/check_mysqladmin_status_sudo | cut -d" " -f2
|
||||
UserParameter=mysql.threads,/usr/bin/sudo /var/lib/zabbix/bin/check_mysqladmin_status_sudo | cut -d" " -f5
|
||||
UserParameter=mysql.questions,/usr/bin/sudo /var/lib/zabbix/bin/check_mysqladmin_status_sudo | cut -d" " -f8
|
||||
UserParameter=mysql.slowqueries,/usr/bin/sudo /var/lib/zabbix/bin/check_mysqladmin_status_sudo | cut -d" " -f12
|
||||
UserParameter=mysql.qps,/usr/bin/sudo /var/lib/zabbix/bin/check_mysqladmin_status_sudo | cut -d" " -f29
|
||||
|
@@ -0,0 +1,23 @@
|
||||
{
|
||||
|
||||
if (-e '/opt/phpki/phpki-store/CA/index.txt'){
|
||||
$OUT .=<<'EOF';
|
||||
|
||||
# Discovery of certificates and their status
|
||||
# Key: pki.certs.discovery
|
||||
# Macro:
|
||||
# - {#CRTCN} : contains the common name
|
||||
# - {#CRTSERIAL} : the serial number
|
||||
# - {#CRTSTATUS} : the status, as a string (valid, revoked, expired)
|
||||
# Available arguments:
|
||||
# --index : path to the index file
|
||||
# --path : directory where certificatres are stored, certificates should be named $serial.pem (in PEM format)
|
||||
|
||||
UserParameter=pki.certs.discovery,/usr/bin/sudo /var/lib/zabbix/bin/disco_certs_sudo --index=/opt/phpki/phpki-store/CA/index.txt --path=/opt/phpki/phpki-store/CA/newcerts/
|
||||
UserParameter=pki.certs[*],/usr/bin/sudo /var/lib/zabbix/bin/check_certs_sudo --what=$1 --cert=$2
|
||||
|
||||
EOF
|
||||
}
|
||||
$OUT .= '';
|
||||
|
||||
}
|
@@ -0,0 +1,2 @@
|
||||
# Check if nmbd is available and working
|
||||
UserParameter=samba.nmbd.status,/var/lib/zabbix/bin/check_nmblookup --server=127.0.0.1 --host={$smb{ServerName};}
|
@@ -0,0 +1,2 @@
|
||||
Server={ (${'zabbix-agent'}{'Servers'} || '127.0.0.1'); }
|
||||
|
@@ -0,0 +1,6 @@
|
||||
{
|
||||
|
||||
my $host = (${'zabbix-agent'}{'Hostname'} || $SystemName.".".$DomainName);
|
||||
$OUT = "Hostname=$host\n";
|
||||
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
ListenPort={ (${'zabbix-agent'}{'TCPPort'} || '10050'); }
|
||||
{
|
||||
my $access = ${'zabbix-agent'}{'access'} || 'private';
|
||||
my $listen = '127.0.0.1';
|
||||
|
||||
$listen = $LocalIP if ($access eq 'private');
|
||||
$listen = '' if ($access eq 'public');
|
||||
|
||||
$OUT .= "ListenIP=$listen\n" if ($listen ne '');
|
||||
|
||||
}
|
@@ -0,0 +1 @@
|
||||
StartAgents=5
|
@@ -0,0 +1,2 @@
|
||||
BufferSend=30
|
||||
BufferSize=100
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
if ((${'zabbix-agent'}{'ServerActive'} || '') ne ''){
|
||||
$OUT .= "ServerActive=${'zabbix-agent'}{'ServerActive'}\n";
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
EnableRemoteCommands={ (${'zabbix-agent'}{'RemoteCommands'} || 'disabled') eq 'enabled' ? '1':'0'; }
|
@@ -0,0 +1,5 @@
|
||||
DebugLevel=3
|
||||
PidFile=/var/run/zabbix/zabbix_agentd.pid
|
||||
LogFile=/var/log/zabbix/zabbix_agentd.log
|
||||
LogFileSize=10
|
||||
|
@@ -0,0 +1 @@
|
||||
Include=/etc/zabbix/zabbix_agentd.conf.d/
|
@@ -0,0 +1,5 @@
|
||||
# Spend no more than Timeout seconds on processing
|
||||
# Must be between 1 and 30
|
||||
|
||||
Timeout={${'zabbix-agent'}{'TimeOut'} || '3'}
|
||||
|
@@ -0,0 +1,33 @@
|
||||
{
|
||||
my @encryptions = ();
|
||||
my $psk_file = ${'zabbix-agent'}{'TLSPSKFile'} || '/etc/zabbix/zabbix_agentd.psk';
|
||||
my $psk_id = ${'zabbix-agent'}{'TLSPSKIdentity'} || $SystemName . '.' . $DomainName . '-agent';
|
||||
if (-s $psk_file){
|
||||
push @encryptions, 'psk';
|
||||
$OUT .=<<_EOF;
|
||||
TLSPSKFile=$psk_file
|
||||
TLSPSKIdentity=$psk_id
|
||||
_EOF
|
||||
}
|
||||
|
||||
my $cert = ${'zabbix-agent'}{'TLSCertFile'} || '/etc/zabbix/zabbix_agentd.crt';
|
||||
my $key = ${'zabbix-agent'}{'TLSKeyFile'} || '/etc/zabbix/zabbix_agentd.key';
|
||||
my $ca = ${'zabbix-agent'}{'TLSCAFile'} || '/etc/zabbix/zabbix_agentd.ca';
|
||||
if (-s $cert && -s $key && -s $ca){
|
||||
push @encryptions, 'cert';
|
||||
$OUT .=<<_EOF;
|
||||
TLSCertFile=$cert
|
||||
TLSKeyFile=$key
|
||||
TLSCAFile=$ca
|
||||
_EOF
|
||||
my $issuer = ${'zabbix-agent'}{'TLSServerCertIssuer'} || '';
|
||||
my $subject = ${'zabbix-agent'}{'TLSServerCertSubject'} || '';
|
||||
$OUT .= "TLSServerCertIssuer=$issuer\n" if ($issuer ne '');
|
||||
$OUT .= "TLSServerCertSubject=$subject\n" if ($subject ne '');
|
||||
}
|
||||
my $encryptions = (scalar @encryptions > 0) ? join(',', @encryptions) : '';
|
||||
$OUT .=<<_EOF if ($encryptions ne '');
|
||||
TLSConnect=$encryptions
|
||||
TLSAccept=$encryptions
|
||||
_EOF
|
||||
}
|
Reference in New Issue
Block a user