Salt does not recognise packages in SLS file - configuration

I am quite a noob to Salt as well as Nagios but either I am missing something obvious or it is a Bug.
I downloaded the nagios-formula in /srv/formulas and have set up rest of master & minions. I am able to do basic apache installations on all minions (3 vagrant machines - 1 master and 3 minions including master machine minion). What I want to achieve is have naagios server on master and NRPE client and plugins on minions so my top.sls looks like:
base:
'smaster*':
- nagios.server
'*sagent.learn.com':
- nagios.plugins
- nagios.nrpe.server:
cfg_dir: /etc/nagios/nrpe.d/
- nagios.nrpe:
cfg_dir: /etc/nagios/nrpe.d/
Now on agents - nagios.plugins gets installed but nothing else changes. Even a syntax error in "nrpe.server" is not complained about. Also all executions of state.highstate run fine - but without any intended effect. Also if I miss any of cfg_dir - it will complain!

You can't put config data in your top file. Your cfg_dir options should be pillar data or in the sls files directly.

Related

Keyboard short for uploading two files in PhpStorm

The problem
In PhpStorm I have a style.css- and a app.js-file that I have to upload to a server over and over again. I'm trying to automate it.
They're compiled by Webpack, so they are generated/compiled. Which means that I can't simply use the 'Tools' >> 'Deployment' >> 'Upload to...' (since that file isn't and won't every be open).
What I currently do
At the moment, every time I want to see the changed I've done, then I do this (for each file):
Navigate to the files in the file-tree (using the mouse)
Select it
The I've set up a shortcut for Main menu >> Tools >> Deployment >> Upload to..., where-after I select the server I want to upload to.
I do this approximately 100+ times per day.
The ideal solution
The ideal solution would be, that if I pressed a shortcut like CMD + Option + Shift + G
That it then uploaded a selection of files (a scope?) to a predefined remote server.
Solution attempts
Open and upload.
Changing to those files (using CMD + p) and then uploading them (once they're open). But the files are generated, which means that it takes PhpStorm a couple of seconds to render the content (which is necessary before I can do anything with the file) - so that's not faster.
Macro.
Recording a macro, uploading the two files, looking like this:
If I go to the menu and trigger the Macro, then it works. So far so good.
But if I assign a shortcut key and trigger that shortcut while in a file, then it shows me this:
And if I press '1' (for it to upload to number 1 on the list), then it uploads the file that I'm currently in(!?), and not the two files from my macro.
I've tried several different shortcuts (to rule out some kind of keyboard-shortcut-clash):
CMD + Option + CTRL + 0
CMD + Shift 0
CMD + ;
... Same result.
And the PhpStorm Macro's doesn't seem to give me that many options anyways.
Keyboard Maestro.
I've tried doing it using Keyboard Maestro.
But I can't get it setup right. Because if it can't find the folders (if they're off-screen or if I'm in a different project and forgot to adjust they shortcuts), then it blasts through the rest of the recorded actions, resulting in chaos. Ideally it should stop, if it can't find the file on the screen.
Update1 - External program
Even if it's not possible to do in PhpStorm, - are there then another program that I could achieve this with?
Update2 - Automatic Deployment in PhpStorm
I've previously used this, - but I've had happen a few times that I started sync'ing waaaay to many files, overwriting critical core files. It seems smart, but can possibly tear down walls if I've forgotten to define an ignore properly.
I wish there was an 'Automatic Deployment for theses files'-function.
Update3 - File Watchers
I looked into file-watchers ( recommendation from #LazyOne ). Based on this forum thread, then file watchers cannot be used to upload files.
It is possible to accomplish it using external program scp (Secure Copy Protocol):
Steps:
1. Create a Scope (for compiled files app.js and style.css)
2. Create a Custom File Watcher with scp over that Scope
Start with Scope:
Create a Local Scope with name scp files for your compiled files directory (I will assume that your webpack compiles into dist directory):
Then, to add dist directory into Scope, select that folder and click on Include Recursively. Apply and Move to File Watchers
Create a custom template for File Watcher:
Choose a Name
Choose File type as Any
Choose Scope as scp files(created earlier)
Choose Program as scp
Choose Arguments as $FileName$ REMOTE_USER#REMOTE_HOST:/REMOTE_DIR_PATH/$FileName$
Choose Working directory as $FileDir$
That's it, basically what we have done is every time when a file in that scope changes, that file is copied with scp to the remote server to the corresponding path.
Voila. Apply Everything and recompile your project and you will see that everything is uploaded to the server.
(I assumed that you have already set up your ssh client; Generated public/private keys; Added a public key in your remote server; And, know ssh credentials to connect to your remote server)
I figured this out myself. I posted the answer here.
The two questions are kind of similar but not identical.
This way I found is also not the best, since it stores the server password in clean text. So I'll leave the question open, in case someone can come up with a better way to achieve this.

OMA firmware update using Leshan server: Where to save the files?

I'm quite new to the world of the IOT (protocols). I want to update some devices remotely (they will be installed about 8000km away from my working place). I have found out that LWM2M would fit to my scope.
Because the internet connection there is not stable and the bandwidth is low, I have decided to also install a Raspberry Pi to collect the data of the sensors and to install a Leshan server to trigger the updates.
I have tested the devices and I can register them to the Leshan server on the Pi, read some data, and reboot the devices. The problem is, I don't know where to save my binary file for the update, so that the device can download them.
I tried following steps:
Save the file on [leshan-dir]/update.bin.
Write the "Package URI": coap://[raspi-IP]:5683/update.bin
After that, the backgroud color of the button "Write" changes to green.
Execute the update
The response of the server is 404 [Not Found].
I have looked for any API to find out where I can save the .bin file, but without success. And because nobody seems to have had a similar error, I start thinking I have missed some points.
Where do I have to save the files on the Raspbery Pi, so that I can perform an update?
I found a solution for the problem I exposed above.
I use from the californium-project the demo-app cf-simplefile-server (Ref. https://github.com/eclipse/californium/tree/2.0.x/demo-apps/cf-simplefile-server)
Note: You have to checkout to the git-branch 2.0.x to use it.
To run the leshan server and the file-server on the same machine I had to change the port of one of the server using the file Californium.properties.
I decide to change the ones of the file-server to 5685 and 5686
When both server runs I can insert in Package URI something like:
coap://[[ip_of_the_pi]]:5685/data/[[name_of_the_firmware_file]]
Probably there are better solution for it, but for a coap/lwm2m beginner like it works very well.
Note: If you have bigger file to transfer you can also change the property MAX_RESOURCE_BODY_SIZE
I hope this may help somebody.
Regards,
Elvys

How do you configure Xcode Server (Bot) to only keep the n most recent integrations?

We've recently discovered that Xcode Server (i.e. a Bot) will keep all past integrations. (We discovered this as the builds started failing and we realized the CI server was completely out of disk space).
How can you configure a bot (or the server in general) to only keep the last n integrations? Or even the last n days?
If there is no built-in setting, is there a way to accomplish this via a cron job that doesn't have to use the unofficial XCode Server API?
The current max disk size is a ratio of 0.75 of the capacity (if I understand the output well). You can see it for yourself if you run curl -k -u USER:PASS https://localhost:20343/api/settings. You might be able to change it by calling this API as a PATCH request with a modified value for max_percent_disk_usage to something smaller and then giving it time to clean up. I haven't tested that however.
If you're interested in how this works, see /Applications/Xcode.app/Contents/Developer/usr/share/xcs/xcsd/routes/routes_setting.js line 19. From there you should be able to dig deeper and see for yourself.
Hope this helps.
This was very helpful, #czechboy!
The JSON document returned when you fetch the settings will contain the _id of the xcode instance whose settings you wish to modify, and you must send the PATCH request to https://localhost:20343/api/settings/<id>. The body of the request should be something like:
{ "set_props": { "max_percent_disk_usage": 0.40 } }
After doing this I needed to restart the server before old files were cleaned up.

Plesk subdomain creation "limitations are exceeded"

When trying to create a subdomain in Plesk 11.5, i have the following message :
An error occurred during domain creation: Unable to accept the template: the following limitations are exceeded.
Description Requested Allowed
Retain web and traffic statistics 3 12
Ok, I already created something like 50 subdomains… but eh, i do what i want !
Here is my command (yeah, i replaced [SUBDOMAIN] and [DOMAIN] by what i want… mysubdomain.domain.tld) :
/usr/local/psa/bin/subdomain --create [SUBDOMAIN] -domain [DOMAIN] -www-root /subdomains/[SUBDOMAIN]/httpdocs
I need to create something like 600 subdomains by parsing a csv file with a shell script i wrote… (it doesn't work either with user-friendly web interface).
Everything's fine except this limitation… I tried many different things in Plesk web admin, and tried to get manual of subdomain.
Looks like you need to increase "Retain web and traffic statistics" limit in subscription's properties or in Service plan properties?

LDAP server configuration: olcIdleTimeout and olcLogFile

Ive setup a LDAP server. Ive set the olcIdleTimeout property to 5 (seconds) for the purpose of testing and the olcLogFile to /var/log/slapd.log. Then I restarted the slapd service. So the entries look like this:
olcIdleTimeout: 5
olcLogFile: /var/log/slapd.log
Is there a reason this changes arent aplied? The log file is empty (i created it manually, because I have read somewhere that it must be created before you write to it) and nothing happens on the page after 5 seconds.
:-/
The olcXXX properties are for online configuration. So you didn't need to restart slapd at all. It is sounding as though you put online configuration directives into slapd.conf. They won't work in there. Remove the 'olc' part.
olcLogFile is only used on Windows because it lacks syslog.
check this for more information
https://serverfault.com/questions/324608/how-do-i-get-openldap-on-centos-6-to-write-anything-to-its-log-files