Comments (9)
Hello,
You can try searching the directory listing located in readme.md to find all supported templates by models.
from community-templates.
I have not found any template to check the status of the notebook battery, is there a guide to create templates? Regards
from community-templates.
There are several ways to query the battery status. For instance using acpi, upower or just cat /sys/class/power_supply/BAT0/capacity
.
Some of the tools provide additional information, but start with only capturing one thing - the battery level - and get that working. You can always extend the template later.
The battery query operation needs to run on the agent, and there are two ways to extend the agent configuration to run a custom battery level query command, either via user parameter, e.g. create a file /etc/zabbix/zabbix_agentd.d/user-parameter.conf
and add
UserParameter=notebook.battery.level,cat /sys/class/power_supply/BAT0/capacity
(I am completely blank on naming policies regarding UserParameter keys, but I guess avoiding collisions with keys already defined in upstream Zabbix is the safest choice. Alternatively system.hw.bat.level
would be in line with the existing keys (although you then run a risk of collision if Zabbix should add that key in the future).)
The other alternative is to use system.run
to execute the command. Then you need to add the following to zabbix_agentd.conf
:
...
AllowKey=system.run[cat /sys/class/power_supply/BAT0/capacity]
...
DenyKey=system.run[*]
DenyKey=system.run
Of these two I would strongly suggest UserParameter
since it hides the implementation detail from the Zabbix template and easily allows for different agents to run different commands to query the battery level.
As for guide on creating a template I do not know, but for this case I would make a copy of Applications/template_zabbix-apt since that is one of the smallest templates in this repository with just one item, i.e. ideal as a starting point and I think you just need to replace the text and check.
Notice that for the yaml file you need to change most of the uuids. I wrote a script to make these changes automatically, see this pull request.
I would be interested in using this battery, so I'll be happy to help testing.
from community-templates.
I think this is the way but, I need make for windows
from community-templates.
You can achieve this by using Windows agent and Powershell commands.
In your case:
(Get-WmiObject win32_battery).estimatedChargeRemaining
from community-templates.
You can achieve this by using Windows agent and Powershell commands. In your case:
(Get-WmiObject win32_battery).estimatedChargeRemaining
Thanks but how can agent take data and send to server? Regards
from community-templates.
You sould save srcipt as script_name.ps1 somewhere on hard drive.
For example: c:\script\script_name.ps1
Then you should edit Zabbix agent config file, for example:
LogFile=c:\zabbix_agentd.log
LogFileSize=10
DebugLevel=2
Server=10.10.10.10
ListenPort=10050
Hostname=W7X86
EnableRemoteCommands=1
LogRemoteCommands=1
Timeout=30
UserParameter=somename[*],PowerShell.exe -nologo "C:\script\script_name.ps1" "somename"
from community-templates.
powercfg/batteryreport this command generate a complete report but output in html, can
You sould save srcipt as script_name.ps1 somewhere on hard drive.
For example: c:\script\script_name.ps1
Then you should edit Zabbix agent config file, for example:
LogFile=c:\zabbix_agentd.log
LogFileSize=10
DebugLevel=2
Server=10.10.10.10
ListenPort=10050
Hostname=W7X86
EnableRemoteCommands=1
LogRemoteCommands=1
Timeout=30
UserParameter=somename[*],PowerShell.exe -nologo "C:\script\script_name.ps1" "somename"
powercfg/batteryreport this command generate a complete report but output in html and need be administrator, how can send by agent?
from community-templates.
powercfg /batteryreport /xml /output batteryreport.xml
$battery = [xml](Get-Content batteryreport.xml)
$health = [pscustomobject]@{
time = $battery.BatteryReport.ReportInformation.ScanTime;
maxpower = $battery.BatteryReport.Batteries.Battery.FullChargeCapacity;
design = $battery.BatteryReport.Batteries.Battery.DesignCapacity
}
$health | Format-Table
Write-Host "Max battery capacity is only $($health.maxpower / $health.design * 100)% of designed capacity"
I found this script very useful, now how can I get this data on the server? using a template
You sould save srcipt as script_name.ps1 somewhere on hard drive.
For example: c:\script\script_name.ps1
Then you should edit Zabbix agent config file, for example:
LogFile=c:\zabbix_agentd.log
LogFileSize=10
DebugLevel=2
Server=10.10.10.10
ListenPort=10050
Hostname=W7X86
EnableRemoteCommands=1
LogRemoteCommands=1
Timeout=30
UserParameter=somename[*],PowerShell.exe -nologo "C:\script\script_name.ps1" "somename"
powercfg /batteryreport /xml /output batteryreport.xml
$battery = [xml](Get-Content batteryreport.xml)
$health = [pscustomobject]@{
time = $battery.BatteryReport.ReportInformation.ScanTime;
maxpower = $battery.BatteryReport.Batteries.Battery.FullChargeCapacity;
design = $battery.BatteryReport.Batteries.Battery.DesignCapacity
}
$health | Format-Table
Write-Host "Max battery capacity is only $($health.maxpower / $health.design * 100)% of designed capacity"
I found this script very useful, now how can I get this data on the server? using a template. Regards
from community-templates.
Related Issues (20)
- Pool health monitoring not working using ZFS templates under Ubuntu 22.04 / Zabbix 6.0
- template_checkpoint not fully upgraded to 6.0+
- Grandstream PBX (UCM63xx) and GXP21xx phones HOT 1
- Zabbix windows templates does not detect network devices and do not show data
- windos icmp ping from zabbix agent does not work
- Arista BGP4 template for v6.0 contains positional arguments in names
- Question about zbx-NVidia_GPUs.yaml 7.0 HOT 2
- Varnish template improvements & v7 changes
- Proxmox lxc container "not running" trigger
- monitor 2 CISCO switches that connected in TEAMING mode HOT 1
- Regular reports - error when generating reports HOT 2
- how to get the python script of oracle?
- synthetic end-user Web monitoring with ability to grab screenshots HOT 2
- Yeastar template not correct HOT 1
- App Speedtest WAN Template
- How to make 95 percentile graph HOT 1
- UBQT UNIFI SNMP V3 HN HOT 1
- Implement monitoring with template template_agentless_storage_and_processor_statistics HOT 1
- Synology Diskstation Blank Graphs
- Synology DiskStation SNMPv3: returned disk bad sector value is -1, template data type is unsigned
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from community-templates.