mirror of
https://github.com/YunoHost-Apps/zabbix_ynh.git
synced 2024-09-03 20:36:14 +02:00
Update Template_Yunohost.xml
This commit is contained in:
parent
814220c095
commit
563e034d3f
1 changed files with 26 additions and 15 deletions
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<zabbix_export>
|
<zabbix_export>
|
||||||
<version>4.0</version>
|
<version>4.0</version>
|
||||||
<date>2019-01-15T12:48:48Z</date>
|
<date>2019-01-31T12:45:57Z</date>
|
||||||
<groups>
|
<groups>
|
||||||
<group>
|
<group>
|
||||||
<name>Templates/Applications</name>
|
<name>Templates/Applications</name>
|
||||||
|
@ -32,7 +32,6 @@ cat /etc/zabbix/zabbix_agentd.d/yunohost.sh
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
yunobin=$(which yunohost)
|
yunobin=$(which yunohost)
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" == "yunohost.users.discover" ];then
|
if [ "$1" == "yunohost.users.discover" ];then
|
||||||
users=$($yunobin user list --fields 'uid' | awk -F ': ' '/username: / {print $2}');echo -n "{\"data\":[";for user in $users;do echo -n "{\"{#USERNAME}\":\"$user\"},";done | sed 's/,$//' ;echo "]}"
|
users=$($yunobin user list --fields 'uid' | awk -F ': ' '/username: / {print $2}');echo -n "{\"data\":[";for user in $users;do echo -n "{\"{#USERNAME}\":\"$user\"},";done | sed 's/,$//' ;echo "]}"
|
||||||
fi
|
fi
|
||||||
|
@ -42,37 +41,45 @@ if [ "$1" == "yunohost.user.quota" ] ;then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "yunohost.domains.discover" ] ;then
|
if [ "$1" == "yunohost.domains.discover" ] ;then
|
||||||
domains=$($yunobin domain list --plain);echo -n "{\"data\":[";for domain in $domains;do echo -n "{\"{#DOMAIN}\":\"$domain\"},";done | sed 's/,$//' ;echo "]}"
|
domains=$($yunobin domain list --output-as plain);echo -n "{\"data\":[";for domain in $domains;do echo -n "{\"{#DOMAIN}\":\"$domain\"},";done | sed 's/,$//' ;echo "]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "yunohost.domain.cert" ] ;then
|
if [ "$1" == "yunohost.domain.cert" ] ;then
|
||||||
$yunobin domain cert-status "$2" --plain | awk '/#/{ next;} {printf "%s;",$0} END {print ""}'
|
$yunobin domain cert-status "$2" --output-as plain --full| awk '/#/{ next;} {printf "%s;",$0} END {print ""}'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "yunohost.services.discover" ] ;then
|
if [ "$1" == "yunohost.services.discover" ] ;then
|
||||||
services=$($yunobin service status | grep -Po '^([A-Za-z]+)(?=(:))');echo -n "{\"data\":[";for service in $services;do echo -n "{\"{#SERVICE}\":\"$service\"},";done | sed 's/,$//' ;echo "]}"
|
services=$($yunobin service status 2>/dev/null| grep -Po '^([A-Za-z]+)(?=(:))');echo -n "{\"data\":[";for service in $services;do echo -n "{\"{#SERVICE}\":\"$service\"},";done | sed 's/,$//' ;echo "]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "yunohost.service.status" ] ;then
|
if [ "$1" == "yunohost.service.status" ] ;then
|
||||||
$yunobin service status "$2" --plain | awk '/#/{ next;} {printf "%s;",$0} END {print ""}'
|
service=$($yunobin service status "$2" --output-as json 2>/dev/null)
|
||||||
|
if [[ "$(echo $service | jq -r '.description')" == *"doesn't exists for systemd"* ]] ;then
|
||||||
|
echo "$service" | jq -c '.active = "disabled"'
|
||||||
|
else
|
||||||
|
echo "$service"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "yunohost.backups.number" ] ;then
|
if [ "$1" == "yunohost.backups.number" ] ;then
|
||||||
$yunobin backup list --plain | wc -l
|
$yunobin backup list --output-as plain | wc -l
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "yunohost.backups.ageoflastbackup" ] ;then
|
if [ "$1" == "yunohost.backups.ageoflastbackup" ] ;then
|
||||||
timestamp=$(date +"%d/%m/%Y %H:%M" -d"$($yunobin backup list -i | tail -n 4 | head -n 1 | grep -Po 'created_at: \K(.*)')")
|
if [ $($yunobin backup list --output-as plain | wc -l) -ne 0 ] ;then
|
||||||
echo $(( ($(date +%s) - $(date -d"$timestamp" +%s))/(60*60*24) ))
|
timestamp=$(date +"%d/%m/%Y %H:%M" -d"$($yunobin backup list -i | tail -n 4 | head -n 1 | grep -Po 'created_at: \K(.*)')")
|
||||||
|
echo $(( ($(date +%s) - $(date -d"$timestamp" +%s))/(60*60*24) ))
|
||||||
|
else
|
||||||
|
echo "No backup detected"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" == "yunohost.ports.tcp.discovery" ] ;then
|
if [ "$1" == "yunohost.ports.tcp.discovery" ] ;then
|
||||||
ports=$($yunobin firewall list -r --plain | awk '/#ipv4/{flag=1;next}/#uPnP/{flag=0}flag' | awk '/##TCP/{flag=1;next}/##TCP/{flag=0}flag');echo -n "{\"data\":[";for port in $ports;do echo -n "{\"{#PORT}\":\"$port\"},";done | sed 's/,$//' ;echo "]}"
|
ports=$($yunobin firewall list -r --output-as plain | awk '/#ipv4/{flag=1;next}/#uPnP/{flag=0}flag' | awk '/##TCP/{flag=1;next}/##TCP/{flag=0}flag');echo -n "{\"data\":[";for port in $ports;do echo -n "{\"{#PORT}\":\"$port\"},";done | sed 's/,$//' ;echo "]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "yunohost.ports.udp.discovery" ] ;then
|
if [ "$1" == "yunohost.ports.udp.discovery" ] ;then
|
||||||
ports=$($yunobin firewall list -r --plain | awk '/#ipv4/{flag=1;next}/#uPnP/{flag=0}flag' | awk '/##UDP/{flag=1;next}/##TCP/{flag=0}flag');echo -n "{\"data\":[";for port in $ports;do echo -n "{\"{#PORT}\":\"$port\"},";done | sed 's/,$//' ;echo "]}"
|
ports=$($yunobin firewall list -r --output-as plain | awk '/#ipv4/{flag=1;next}/#uPnP/{flag=0}flag' | awk '/##UDP/{flag=1;next}/##TCP/{flag=0}flag');echo -n "{\"data\":[";for port in $ports;do echo -n "{\"{#PORT}\":\"$port\"},";done | sed 's/,$//' ;echo "]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "yunohost.migrations.lastinstalled" ] ;then
|
if [ "$1" == "yunohost.migrations.lastinstalled" ] ;then
|
||||||
|
@ -962,10 +969,14 @@ fi</description>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<logtimefmt/>
|
<logtimefmt/>
|
||||||
<preprocessing>
|
<preprocessing>
|
||||||
|
<step>
|
||||||
|
<type>12</type>
|
||||||
|
<params>$.active</params>
|
||||||
|
</step>
|
||||||
<step>
|
<step>
|
||||||
<type>5</type>
|
<type>5</type>
|
||||||
<params>(.*);(.*);(.*);(.*);(.*);(.*);(.*);
|
<params>(.*)
|
||||||
\6:inactive=0:active=1:unknown=2;disabled=3</params>
|
\1:inactive=0:active=1:unknown=2;disabled=3</params>
|
||||||
</step>
|
</step>
|
||||||
<step>
|
<step>
|
||||||
<type>5</type>
|
<type>5</type>
|
||||||
|
|
Loading…
Add table
Reference in a new issue