Jump to content

Viaduct

Members
  • Content Count

    76
  • Joined

  • Last visited

Community Reputation

1 Neutral

About Viaduct

  • Rank
    Advanced Member

Converted

  • Gender
    Undisclosed

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. 30 Gb and roughly only 45% full. Sent from my iPhone using Tapatalk
  2. @BinHex v2.99 is reported on forums as broken with a new v3.00 out. Is there a plan to update the docker? Thanks V
  3. I did a powerdown on the console and it shutdown ok. Docker came up ok, but orphaned my Plex container. A 'force update ' fixed it. All happy now V Sent from my iPhone using Tapatalk
  4. Is there a how to for getting email alerts in zoneminder on unraid working? I can't see any reference to ssmtp in the appdata folder to enter any config. V Sent from my iPhone using Tapatalk
  5. Ok. I killed the dockerd process: kill PID and have the Unraid GUI back (with some warnings on the dashboard for missing docker.sock) How do I restart the docker daemon? V
  6. Had a docker fail an update. Now the Unraid UI is unresponsive. Telnet still works, but docker seems hung. docker ps -a Hangs and have to do a Ctrl - C to come out of it. All the containers are working though i.e. Plex and Zoneminder are still running and are fully responsive, just seems the parent docker process has hung. Any tips to un hang it? I fear powerdown will just hang on trying to stop docker and I would need to do a hard reset. How do I stop docker cleanly? Thanks V
  7. I'm sure it would be doable as a plugin. Docker container might be difficult since some of the scripts might need native access to the OS. It's not within my capability though, and it would be a weird plugin since it would be dependent on the dockers too. Sent from my iPhone using Tapatalk
  8. I had similar issues a few months ago with finding a local server. It was when I was messing about with different plug in and docker containers, testing the initial setup, then recreating the server in a different docker. Not sure what the cause was, but it seemed to sort itself out. My impression was that plex doesn't like recreating the same server with same name, owner and ip address. It's like it gets confused. I think internally it has a unique id and when there's two instances of the server with same name and ip address but different unique id it just fails to find it. At times I could find it over wan, but not over lan. Also some pc's found it, eg hard wired into same router, whilst Wi-Fi didn't. It was very strange. It just fixed itself without any intervention from me. I did the management from the interfaces that could see it ie wan or the hard wired PC. Now it's behaved for ages. I assumed that plex forgets servers it hasn't seen for a while and thus sorted out its internal confusion. I'm just guessing. There are plex logs to be looked through, but they didn't add anything to help me at the time. YMMV. Sent from my iPhone using Tapatalk
  9. OK. I've started a thread in the user customisations board. https://lime-technology.com/forum/index.php?topic=52220.0 Any corrections or suggestions for improvement is very welcome!
  10. apcupsd.sh Script to monitor values from the UPS. ** A working influxdb setup is required - see opening post ** **Disclaimer: I am not a programmer and thus please use the scripts at your own risk. Please read the script to understand what it is trying to achieve. There is no error trapping in it and no check to see if it is already running, so in theory if the script running time is longer than the crontab interval you could end up in a ever increasing system load and potentially crash the server.** This uses apcaccess to get values from the UPS such as 'time on battery', 'battery %charge', 'load in %', 'time left on battery', 'unit temperature'. #!/usr/bin/php <?php $command = "apcaccess"; $args = "status"; $tagsArray = array( "LOADPCT", "ITEMP", "TIMELEFT", "TONBATT", "BCHARGE" ); //do system call $call = $command." ".$args; $output = shell_exec($call); //parse output for tag and value foreach ($tagsArray as $tag) { preg_match("/".$tag."\s*:\s([\d|\.]+)/si", $output, $match); //send measurement, tag and value to influx sendDB($match[1], $tag); } //end system call //send to influxdb function sendDB($val, $tagname) { $curl = "curl -i -XPOST 'http://influxDBIP:8086/write?db=telegraf' --data-binary 'APC,host=Tower,region=us-west " .$tagname."=".$val."'"; $execsr = exec($curl); } ?> Nothing special in grafana for this since they are simple values returned. I modified the LOADPCT by multiplying it with the rated capacity of my unit to get the power in watts. I run this every minute in crontab: * * * * * /mnt/cache/appdata/myscripts/apcupsd.sh &>/dev/null 2>&1
  11. ipmi.sh Script for monitoring IPMI parameters. ** A working influxdb setup is required - see opening post ** **Disclaimer: I am not a programmer and thus please use the scripts at your own risk. Please read the script to understand what it is trying to achieve. There is no error trapping in it and no check to see if it is already running, so in theory if the script running time is longer than the crontab interval you could end up in a ever increasing system load and potentially crash the server.** This requires ipmi-sensors to be installed. I use the excellent dmacias IPMI plugin which installs this. You need to edit the script to add the devices you want measuring in the $tagsArray statement. Different motherboards will have different values. Run ipmi-sensors from the command line to see what yours are. I'm not clever enough to write a script that does it automatically. And you will need to change the parameters mentioned in the first post in the curl statement. You will need to use a unix type editor to do it e.g. Notepad++ such that the correct line endings are in the file. Save them somewhere that crontab can access them (mine are in /mnt/cache/appdata/myscripts/). Note that the tagName cannot have spaces in, so I have had to add an extra line to remove the spaces from the string. #!/usr/bin/php <?php $tagsArray = array( "CPU_FAN1", "REAR_FAN1", "REAR_FAN2", "MB Temp", "CPU Temp" ); //do system call $call = "ipmi-sensors"; $output = shell_exec($call); //parse output for tag and value foreach ($tagsArray as $tag) { preg_match("/".$tag.".*(\b\d+\b)\..*$/mi", $output, $match); //send measurement, tag and value to influx sendDB($match[1], $tag); } //end system call //send to influxdb function sendDB($val, $tagname) { $tagname2 = str_replace(' ', '', $tagname); $curl = "curl -i -XPOST 'http://influxDBIP:8086/write?db=telegraf' --data-binary 'IPMI,host=Tower,region=us-west " .$tagname2."=".$val."'"; $execsr = exec($curl); } ?> I run this script every 5 min in crontab: */5 * * * * /mnt/cache/appdata/myscripts/ipmi.sh &>/dev/null 2>&1 Grafana does not need any specific setup to show this metric since it is a simple value. The measurement IPMI will appear in the list of measurements to select. To show fan speed and temp on the same graph, move the temps to the right axis and the fans to the left axis.
  12. spin.sh Script for monitoring the spin state of the HDs with hdparm ** A working influxdb setup is required - see opening post ** **Disclaimer: I am not a programmer and thus please use the scripts at your own risk. Please read the script to understand what it is trying to achieve. There is no error trapping in it and no check to see if it is already running, so in theory if the script running time is longer than the crontab interval you could end up in a ever increasing system load and potentially crash the server.** The script uses hdparm to check if the value is standby. You need to edit the script to add the devices you want measuring in the $tagsArray statement. I'm not clever enough to write a script that does it automatically. And you will need to change the parameters mentioned in the first post in the curl statement. You will need to use a unix type editor to do it e.g. Notepad++ such that the correct line endings are in the file. Save them somewhere that crontab can access them (mine are in /mnt/cache/appdata/myscripts/) #!/usr/bin/php <?php $tagsArray = array( "/dev/sdc", "/dev/sdd", "/dev/sde", "/dev/sdg", "/dev/sdh", "/dev/sdi", "/dev/sdj", "/dev/sdb", "/dev/sdf" ); //do system call and parse output for tag and value foreach ($tagsArray as $tag) { $call = "hdparm -C ".$tag; $output = shell_exec($call); if (strpos($output, 'standby') !== false) { $idle = 0; } else { $idle = 1; } //send measurement, tag and value to influx sendDB($idle, $tag); } //end system call //send to influxdb function sendDB($val, $tagname) { $curl = "curl -i -XPOST 'http://influxDBServerIP:8086/write?db=telegraf' --data-binary 'HDSpin,host=Tower,region=us-west " .$tagname."=".$val."'"; $execsr = exec($curl); } ?> This script runs pretty quickly, so I have mine setup to run every minute, but that might be overkill. * * * * * /mnt/cache/appdata/myscripts/spin.sh &>/dev/null 2>&1 Grafana setup I have this set up as a stacked bar chart in grafana. The query for each device reads as follows in the Metrics tab: FROM default HDSpin WHERE + SELECT field(/dev/sde) sum() + GROUP BY time(1m) + ALIAS BY disc name Format as Time Series At the bottom I have : Group by time interval >60s The display tab has Draw Mode Bars checked Stacking and Null value Stack checked Hover info Stacked value individual
  13. hdtemp.sh Script for monitoring HD temperatures via smartctl. ** A working influxdb setup is required - see opening post ** **Disclaimer: I am not a programmer and thus please use the scripts at your own risk. Please read the script to understand what it is trying to achieve. There is no error trapping in it and no check to see if it is already running, so in theory if the script running time is longer than the crontab interval you could end up in a ever increasing system load and potentially crash the server.** This uses smartctl to get the information output from the SMART for the device. Needless to say SMART needs to be turned on for the device otherwise it won't work. But I can't think of a reason why you wouldn't want to have SMART turned off in any case. You need to edit the script to add the devices you want measuring in the $tagsArray statement. I'm not clever enough to write a script that does it automatically. And you will need to change the parameters mentioned in the first post in the curl statement. You will need to use a unix type editor to do it e.g. Notepad++ such that the correct line endings are in the file. Save them somewhere that crontab can access them (mine are in /mnt/cache/appdata/myscripts/) #!/usr/bin/php <?php $tagsArray = array( "/dev/sdc", "/dev/sdd", "/dev/sde", "/dev/sdg", "/dev/sdh", "/dev/sdi", "/dev/sdj", "/dev/sdb" ); //do system call and parse output for tag and value foreach ($tagsArray as $tag) { $call = "smartctl -A ".$tag; $output = shell_exec($call); preg_match("/Temperature.+(\d\d)$/im", $output, $match); //send measurement, tag and value to influx sendDB($match[1], $tag); } //end system call //send to influxdb - you will need to change the parameters (influxserverIP, Tower, us-west) in the $curl to your setup, optionally change the telegraf to another database, but you must create the database in influxdb first. telegraf will already exist if you have set up the telegraf agent docker. function sendDB($val, $tagname) { $curl = "curl -i -XPOST 'http://influxServerIP:8086/write?db=telegraf' --data-binary 'HDTemp,host=Tower,region=us-west " .$tagname."=".$val."'"; $execsr = exec($curl); } ?> Since HD temp doesn't change that quickly I have made the script run every 5 minutes in crontab: */5 * * * * /mnt/cache/appdata/myscripts/hdtemp.sh &>/dev/null 2>&1 Grafana does not need any specific setup to show this metric since it is a simple value. The measurement HDTemp will appear in the list of measurements to select.
  14. Scripts for Server Monitoring using Influx DB and Grafana without Telegraf agent Thread for discussing user scripts to push data into Infuxdb. Any system command that lists useful data can be parsed to send data into influxdb via a script. I use the atribe docker for telegraf, influx and grafana from Community Applications plugin. They worked pretty much out of the box. Set these up first before adding any scripts, just to test that influxdb and grafana are actually working properly, and that the telegraf database within influxdb is already set up and accepting data. I'm not going to go into any detail on setting up these dockers, they seemed quite easy to setup. The only bit that needed specific setup was setting the datasource in grafana, but it was fairly self explanatory. Data can be sent to Influxdb direct without requiring the telegraph agent. See influxdb man pages - Writing Data with the HTTP API: https://docs.influxdata.com/influxdb/v1.0/guides/writing_data/ The basic command is : curl -i -XPOST 'http://[color=red]influxServerIP[/color]:8086/write?db=[color=red]telegraf[/color]' --data-binary ’[color=red]measurementName[/color],host=[color=red]Tower[/color],region=[color=red]us-west[/color] [color=red]tagName[/color]=[color=red]value[/color]' Specific bits in this to change are: Usually static for your setup and same for all your scripts: influxServerIP: change this to your InfluxDB server IP telegraf: this can be changed to a different database if required. I just added the data to the existing telegraf database which saves adding another datasource in grafana host: the host name of the server e.g. Tower or Unraid or whatever - best use the same as telegraf region: region where you are Usually change per script depending on what it is designed to measure: measurementName: the type of measurement as a group, e.g. HDTemp tagName: the specific thing/device/tag the measurement is measuring e.g. /dev/sdx value: the numerical value to store Note that spaces in the names can be a problem, so you might need a line in the script to remove spaces from the thing that you are measuring. I'm sure there are better, more sophisticated ways of sending data direct to influxdb including specific php libraries, but I am not a developer, so I had to keep it simple. So you just need a script to parse the data for measurementName, tagName and value and send it with the curl command. Simples! The graphs can be generated in Grafana in just the same way as the graphs from telegraf (if you stick to sending the data to the telegraf database in influxdb). Otherwise you will need to set up another datasource in grafana which complicates this a little, but can be done. I store my scripts in a folder called myscripts on appdata. I'm not entirely sure this is the safest place to keep them since anyone with smb access to this folder could change the scripts and then there could be trouble, so any advice on this is welcome. Don't forget to make the script executable: chmod +x /mnt/cache/appdata/myscripts/script.sh The scripts are run using cron. The list of active scripts can be edited by the crontab -e command. This defaults to the vi editor to edit the text which I find painful to use. In terms of basics there are plenty of useful guides on the net on how to use it, but essentially you need to go to the bottom of the file (type capital G), then insert a line below the current one ready for editing (type * o). Insert your crontab line e.g. * * * * * /mnt/cache/appdata/myscripts/hdtemp.sh &>/dev/null 2>&1 Then <esc> (to stop editing mode) Then type :wq <enter> (with the colon) to save the file again. You can check the line is correct with crontab -l which lists the crontab file. All stars in the crontab will run the script every minute. If you want it to run every 5 minutes use */5 * * * * instead of 5 stars. Some scripts to get started with: HDTemp.sh - measures HD temperature with smartctl https://lime-technology.com/forum/index.php?topic=52220.msg501122#msg501122 spin.sh - gets the spin state of the HDs with hdparm https://lime-technology.com/forum/index.php?topic=52220.msg501124#msg501124 IPMI.sh - gets values from IPMI with ipmi-sensors (needs ipmi-sensors installed) https://lime-technology.com/forum/index.php?topic=52220.msg501125#msg501125 apcupsd.sh - gets info from UPS from apcaccess https://lime-technology.com/forum/index.php?topic=52220.msg501126#msg501126
  15. No worries guys. I'll do a how to guide soon. I'll tidy the scripts up over the weekend and post something. Possibly in a new thread. I have absolutely no idea about github, I'm not a developer or programmer and the last time I wrote anything resembling a program or script was in the 80s in BASIC! So I probably can't vouch whether the scripts are safe to run or not, nor can I probably support users where the scripts might not work. But, happy to post them as a starting point and others more capable can refine them. Sent from my iPhone using Tapatalk