Automatically download Cacti Weathermap at regular intervals - windows

I was looking for a way to automatically download the weathermap image from the Cacti Weathermap plugin at regular intervals. There does not seem to be an easy way to do this listed anywhere on the internet using only Windows, so I thought I'd a) ask here and b) post what I've managed so far.
P.S. I've posted where I got up to in one of the answers below.

You can easily right click - Save As while on the weathermap page. This produces a file called weathermap-cacti-plugin.png.
No such file is available from the webpage however. Right clicking - view URL gave me this:
http://<mydomain>/plugins/weathermap/weathermap-cacti-plugin.php?action=viewimage&id=df9c40dcab42d1fd6867&time=1448863933
I did a quick check in powershell to see if this was downloadable (it was):
$client = new-object System.Net.WebClient
$client.DownloadFile("http://<mydomain>/plugins/weathermap/weathermap-cacti-plugin.php?action=viewimage&id=df9c40dcab42d1fd6867&time=1448864049", "C:\data\test.png")
Following a hunch, I refreshed the page and copied a couple more URLs:
<mydomain>/plugins/weathermap/weathermap-cacti-plugin.php?action=viewimage&id=df9c40dcab42d1fd6867&time=1448863989
<mydomain>/plugins/weathermap/weathermap-cacti-plugin.php?action=viewimage&id=df9c40dcab42d1fd6867&time=1448864049
As I had suspected, the time= changed every time I refreshed the page.
Following another hunch, I checked the changing digits (1448863989 etc) on epochconverter.com and got a valid system time which matched my own.
I found a powershell command (Keith Hill's answer on this question) to get the current Unix time
[int64](([datetime]::UtcNow)-(get-date "1/1/1970")).TotalSeconds
and added this into the powershell download script
$client = new-object System.Net.WebClient
$time=[int64](([datetime]::UtcNow)-(get-date "1/1/1970")).TotalSeconds
$client.DownloadFile("http://<mydomain>/plugins/weathermap/weathermap-cacti-plugin.php?action=viewimage&id=df9c40dcab42d1fd6867&time=$time", "C:\data\test.png")
This seems to work - the file test.png modified timestamp was updated every time I ran the code, and it opened showing a valid picture of the weathermap.
All that's required now is to put this in a proper script and schedule it to run every X minutes and save to a folder. I am sure scheduling powershell scripts in Task Scheduler is covered elsewhere so I will not repeat it here.
If anyone knows an easier way of doing this, please let me know. Otherwise, vote up my answer - I have searched a lot and cannot find any other results on the net that let you do this using only Windows. The Cacti forums have a couple of solutions, but they require you to do stuff on the Linux server which is hard for a Linux noob like me.

Related

How do i get python to run again?

i just started learning python. today i tried to do some problems along with tutorials. somehwere along the way i do not know what i clicked to make it all stop working. originally it said it couldnt find my file, no matter what i typed in the code. i tried clicking projects and making a new file but ended up deleting the files. I then tried to redownload it from the python website to restore factory settings and it says "verify that you have access to that directory. all code i write in google research collab works but once i put it in python i cant get anything to run.
i tried to reset python and also went to google to find what i did wrong. i think i somehow broke the path but i dont know to what

Can a script be too new for a google sheet?

I work on a google sheet that has several departments looking at and/or adding data to all day long every day. I have been working on making scripts to make my departments life a lot easier.I created an exact duplicate of the sheet so I could make sure it works before executing new scripts.
I have one that sets up an order, sends an email and puts it on the calendar all in one click. It works great.
In the email we need to send a link to a job folder. So we have a script to find that folder and get the link to it.
var folder = DriveApp.getFoldersByName("12345 - Help me")
var in = folder.next()
var link = in.getUrl()
In my testing grounds this works exactly how it should. When I put it into the actual sheet that we work in I get an error
"Error Exception: We're sorry, a server error occurred. Please wait a bit and try again."
I have been trying to figure it out for 4 days so far and am getting nowhere.
I had the "owner" of the sheet transfer it into my ownership incase that was the problem.
I moved it to a shared drive.
Made a copy of the whole spreadsheet to test it; it worked in the copy just fine.
To change over to a new spreadsheet will be a lot of work that would have to take place after work hours when no one should be using it. I am hoping there is a way to refresh the spreadsheet in such a way that we need to reapprove scripts (or something). The spreadsheet in question was created in 2018. I am wondering if its just to old for the script; not that that makes any sense but, I cant think of anything else.
Thoughts?
From the question
The spreadsheet in question was created in 2018. I am wondering if its just to old for the script; not that that makes any sense but, I cant think of anything else.
Nowadays Google Apps Scripts supports two runtimes, the old (Rhino) and the new (V8). There are posts sharing that changing the runtime to the one or the other fixed an issue. Considering this, the first thing to check if what runtime are being used on each Google Apps Script that are being used as "testing grounds" and in production as sometimes one of the source of "confusions" is to use different runtime.
Another thing to try is to create a standard Google Cloud Platform Project (GCP) to replace the default GCP project. On this project enable the Google Drive API.
Resources
https://developers.google.com/apps-script/guides/v8-runtime
https://developers.google.com/apps-script/guides/support/troubleshooting

SCCM OSD TS End User Summary Screen

I am looking for a good way to make a summary to existing large build TS.
What I am working with is SCCM 2012r2 and what I need is a hint, how to capture all steps I want(some of them are in various groups) and put result of them in some sort of variable so at the end, someone who is building that PC will have a table showing lets say 30 of applications green and 4 of them red as a failure.
Can it be done in some easy way? I just need someone building the PC to see what app didn't install so he can install it manually or at least provide me more information before I'll dive into logs.
Thanks
I wouldn't say easy because it requires lots of steps and you have to do it per application manually basically but there is a TS Variable _SMSTSLastActionSucceeded which you could check after each installation step (you have to set the step to continue on error to make this work). So basically after you tried to install you check whether it worked and then set a TS variable of your choice to reflect the failure.
As a final step you implement a script that checks all your TS variables and outputs the result.
You could even use the addon OSDBackground to display your errors as the background image.
Some lengthy article how to implement a form of error handling can be found here however you would have to do this quite a bit different because in this example the ts fails at the first error and you want to continue and log but you should get the basic principles.

Local file link to shared dropbox files

Since this is my first time posting a question on stackexchange, please excuse me if I've not included anything. Suggestions for a better post are very welcome!
Background
I'm looking for a way to create a file:// link in e-mails with a specific purpose. In my company we're all using Macbooks with Outlook as our e-mail-client. As soon as a specific document is updated, I would like to be able to e-mail a colleague saying: "here is the to the file". My personal link would be: file:///Users/<MyUserName>/Dropbox/Filepath.ext. However, this does not evaluate correctly on my colleagues computer. I have made it to work with a manual username change, but I'm hoping that there is a way to automatically fill in the username of that person.
My Question:
How can I make the link in such a way that it will always refer to that user's specific user folder?
Resources explored
I've tried working with file://~/ but that always gives a 'can't find the document' error. I've tried googling it but Dropbox and other services only point towards URL-links or to their website. Stackexchange hasn't provided me with an answer so far (Internal links / ":file//" links is without answer). Searching for 'computer independent file links' haven't given me any solace either.
Any help would be greatly appreciated!
not sure if this is what you want. You can check the dorpbox API and read a bit about it. But an easier way might be IFTTT, a free tool which launch triggers. So basically you need to create a folder in dropbox for each user and then use this tool to make triggers for each user. You can send an email and include the new dropbox link and as well you can program the IFTTT to send a file://Users//Dropbox/USER_DROPBOX_FOLDER/{{FILENAME}} whenever a file is placed in his folder.

Prompt to reload an externally modified file in Textmate 2?

Im finding myself using TextMate 2 more and more for development these days
One thing that is bugging me is that it does not seem to reload a file when it is changed externally.
This is a big problem since I use terminal to switch git branches a lot, and it often results in accidentally saving an older version over the new branch
Sadly the TM team seem to have disabled the Issue tracker on github, and documentation just seems scattered far and wide over the web in tiny scraps.
Any ideas?
Right now it reloads the file silently whenever the file on Disk is changed. There is currently no option for a prompt.
Regarding the closed issue tracker: As an alternative, you can always send a mail to the Textmate users list if you find a problem.
I just updated to TM 2. In the past, I have enjoyed using TM to view development.log as I am introducing new or modified code. TM 1 would ask me if I want to revert to what's on disk and of course I would respond with Yes. Then I could see any additions to the log file. Occasionally I would empty the log file with Cmd+A, Delete, Cmd+S. Macromates, please make TM 2 work like TM 1 reloading content.
I also could not find a solution to this problem which is still there, however it is possible to file an issue using this contact page: http://macromates.com/support
Additionally there are hidden setting which cannot be set from the GUI. Unfortunately they don't include and setting for automatic load from disk: https://github.com/textmate/textmate/wiki/Hidden-Settings

Resources